con un clic
merge
// Merge completed task branch to main — with conflict resolution, verification retry, and cleanup. Triggered after check post-exec ACCEPT verdict confirms all tests pass.
// Merge completed task branch to main — with conflict resolution, verification retry, and cleanup. Triggered after check post-exec ACCEPT verdict confirms all tests pass.
Process Plan panel annotations — triage, cross-impact assessment, and execution. Triggered automatically when annotations (Insert/Delete/Replace/Comment) are submitted from the Plan panel UI.
Autonomous execution loop — single Claude session orchestrates plan/check/exec cycle internally
Cancel a task module — set status to cancelled, stop auto if running, optionally clean up worktree. Use when a task becomes infeasible, is deprioritized, or needs to be abandoned.
Check plan feasibility at key checkpoints — post-plan, mid-execution, post-execution
Execute the implementation plan for a reviewed task module. Triggered after check PASS (from review status) or on NEEDS_FIX continuation (from executing status with fix guidance).
Initialize a new task module in AiTasks/ directory with system files, git branch, and optional worktree. Use when starting a new feature, bug fix, or refactoring task that needs structured lifecycle tracking.
| name | merge |
| description | Merge completed task branch to main — with conflict resolution, verification retry, and cleanup. Triggered after check post-exec ACCEPT verdict confirms all tests pass. |
| arguments | [{"name":"task_module","description":"Path to the task module directory (e.g., AiTasks/auth-refactor)","required":true}] |
Merge a completed task's branch into main, with automated conflict resolution and verification.
/moonview:merge <task_module_path>
executing.analysis/ file must contain an ACCEPT verdict (from check --checkpoint post-exec)depends_on modules must meet their required status — simple string entries require complete, extended { module, min_status } entries require at-or-past min_status (see depends_on Format in commands/ai-cli-task.md). If any dependency is not met, merge REJECTS with error listing blocking dependencies and their current statuses-- ai-cli-task(<module>):refactor cleanup before mergecd <project-root> first (worktree is locked to task branch)git merge task/<module> --no-ff -m "-- ai-cli-task(<module>):merge merge completed task"
If merge conflict detected:
lsp_diagnosticsgit merge --abort), retry from Phase 2 with different resolution strategyexecuting, report unresolvable conflicts (user can manually resolve then re-run merge)On successful merge:
.index.json status → complete, clear branch to "" (branch will be deleted), update timestamp.summary.md with final task summary: completion status, plan overview, key changes, verification outcome, lessons learned (integrate from directory summaries)-- ai-cli-task(<module>):merge task completed — commit state changes before any destructive cleanup, so status is persisted even if cleanup failsgit worktree remove .worktrees/task-<module> (failure is non-fatal — log warning, continue)git branch -d task/<module> (failure is non-fatal — branch may already be deleted or have extra commits; log warning, continue).index.json — validate status is executingdepends_on from .index.json, check each dependency module's .index.json status against its required level (simple string → complete, extended object → at-or-past min_status). If any dependency is not met, REJECT with error listing blocking dependencies.analysis/ file for post-exec-accept.summary.md for task context (plan overview, completed steps, key decisions)executing, abort merge, report unresolvable conflictscomplete, write .summary.md, git commit state FIRST, then worktree removal + branch deletion — cleanup failures are non-fatal).auto-signal to the main worktree's AiTasks/<module>/ directory (NOT the task worktree's copy) — MUST be written AFTER Phase 4 status update to complete, so the daemon reads correct status when routing to report. In worktree mode, the task directory exists in both locations; writing to main ensures the signal survives worktree removal. The daemon's fs.watch MUST monitor the main worktree path. Resolve main worktree path: read .git file in task worktree → extract gitdir → resolve to main worktree root. Or use git -C <main-repo> rev-parse --show-toplevel| Current Status | After Merge | Condition |
|---|---|---|
executing | complete | Merge successful (with or without conflict resolution) |
executing | executing | Merge conflict unresolvable after 3 attempts (stays executing so merge can be retried after manual conflict resolution) |
| Action | Commit Message |
|---|---|
| Pre-merge cleanup | -- ai-cli-task(<module>):refactor cleanup before merge |
| Merge commit | -- ai-cli-task(<module>):merge merge completed task |
| Conflict resolution | -- ai-cli-task(<module>):merge resolve merge conflict |
| State update | -- ai-cli-task(<module>):merge task completed |
| Result | Signal |
|---|---|
| Success | { "step": "merge", "result": "success", "next": "report", "checkpoint": "", "timestamp": "..." } |
| Conflict | { "step": "merge", "result": "conflict", "next": "(stop)", "checkpoint": "", "timestamp": "..." } |
check to isolate conflict resolution logicexecuting (not blocked) so merge can be retried. The user should manually resolve conflicts and then run /moonview:merge again.index.json status to complete directly.auto-signal is written to the main worktree's AiTasks/<module>/ path (not the task worktree), ensuring the daemon can read it after worktree removal. The daemon MUST watch the main worktree path for all signal filesAiTasks/<module>/.lock before proceeding and releases on completion (see Concurrency Protection in commands/ai-cli-task.md)