cli: make bundled help self-describing

This commit is contained in:
2026-03-22 23:37:38 +08:00
parent 5859ff219e
commit 4d8c90eb26
49 changed files with 792 additions and 29 deletions
@@ -23,6 +23,16 @@ func newCleanupCmd(root *rootOptions) *cobra.Command {
cmd := &cobra.Command{
Use: "cleanup",
Short: "Remove completed or abandoned attempt worktrees",
Long: helpLong(
"Use cleanup to remove worktrees that belong to completed, abandoned, or explicitly forced attempt cleanup.",
"cleanup only affects attempts that actually have worktree-backed execution state; analysis-mode attempts have no worktree to remove.",
"Pass --task when you want to clean one task's latest cleanup candidate.",
"Pass --task plus --attempt when you want one exact attempt.",
"Pass --all-completed when you want a run-wide cleanup sweep.",
),
Example: ` orch --db .agents/coord.db cleanup --run blog_mvp_001 --task T1
orch --db .agents/coord.db cleanup --run blog_mvp_001 --task T1 --attempt 2
orch --db .agents/coord.db cleanup --run blog_mvp_001 --all-completed`,
RunE: func(cmd *cobra.Command, args []string) error {
ctx := cmd.Context()
@@ -74,9 +84,9 @@ func newCleanupCmd(root *rootOptions) *cobra.Command {
}
cmd.Flags().StringVar(&opts.runID, "run", "", "Run ID")
cmd.Flags().StringVar(&opts.taskID, "task", "", "Optional task ID")
cmd.Flags().IntVar(&opts.attemptNo, "attempt", 0, "Specific attempt number")
cmd.Flags().BoolVar(&opts.allCompleted, "all-completed", false, "Clean all completed or abandoned worktrees in the run")
cmd.Flags().StringVar(&opts.taskID, "task", "", "Limit cleanup candidates to one task")
cmd.Flags().IntVar(&opts.attemptNo, "attempt", 0, "Limit cleanup to one specific attempt number")
cmd.Flags().BoolVar(&opts.allCompleted, "all-completed", false, "Clean every completed or abandoned worktree in the run")
cmd.Flags().BoolVar(&opts.force, "force", false, "Force cleanup even for non-terminal worktrees")
_ = cmd.MarkFlagRequired("run")