Skip to content

feat(cli): add auto-improve command#4161

Closed
DragonnZhang wants to merge 94 commits into
mainfrom
dragon/feat-self-improve
Closed

feat(cli): add auto-improve command#4161
DragonnZhang wants to merge 94 commits into
mainfrom
dragon/feat-self-improve

Conversation

@DragonnZhang

@DragonnZhang DragonnZhang commented May 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • What changed: Added a new /auto-improve slash command that lets Qwen Code run a session-scoped loop for small, locally verifiable repository improvements. The command supports source configuration, loop start/status/stop controls, scheduled ticks, and local state tracking for each run.
  • Source configuration: /auto-improve source supports built-in source toggles plus an editable custom source list. Users can add multiple custom source hints, edit existing hints, delete hints, and save them into the repository-level auto-improve config.
  • Delivery policy: Auto-improve now uses source-aware local delivery. Local/default tasks target the loop's default branch, PR-derived tasks target the PR head branch, unclear targets use a local-only branch, and push is skipped unless the user explicitly requested it.
  • Cancellation behavior: Cancelling an auto-improve tick with Escape marks the active run as cancelled when possible and reminds the user that the loop remains active until /auto-improve stop.
  • Why it changed: To provide a structured automated improvement workflow where the agent can analyze, plan, implement, verify, and locally commit changes from isolated worktrees without accidentally delivering PR fixes to the wrong branch.
  • Reviewer focus: Verify the command naming and help text, scheduled tick behavior, state management during improvement sessions, worktree isolation model, custom source list UX, legacy single-context config migration, source-aware delivery rules, and PR source prioritization for open non-draft PRs with actionable unresolved review feedback.

Validation

  • Commands run:
    npm run build
    npm run typecheck
    cd packages/cli && npx vitest run src/ui/commands/autoImproveCommand.test.ts
  • Expected result: /auto-improve source opens source configuration, supports adding/editing/deleting custom source entries, and /auto-improve start --every <interval> [prompt] snapshots those custom sources into the loop and schedules /auto-improve tick <loop-id>. Tick instructions require PR-derived tasks to use PR head branches and prohibit push unless explicitly requested.
  • Observed result: Build passes; typecheck passes; the focused command test passes with 8 tests.
  • Quickest reviewer verification path: Run the focused test above, then try /auto-improve source and /auto-improve start --every 30m in the CLI with cron enabled.

Scope / Risk

  • Main risk or tradeoff: Worktree cleanup on failure or interrupt; a hard process kill could still leave orphaned local worktrees.
  • Not covered / not validated: Cross-platform worktree behavior, especially Windows.
  • Breaking changes / migration notes: This PR introduces the command as /auto-improve. Existing draft userContext config is migrated into the new custom source list on read.

Testing Matrix

macOS Windows Linux
npm run Pass Not run Not run
npx Pass Not run Not run
Docker Not run Not run Not run

Testing matrix notes:

  • Core logic and focused tests were validated on macOS.
  • Windows worktree behavior needs separate validation.

Linked Issues / Bugs

No linked issues.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants