@delegance/claude-autopilot 5.5.2 → 7.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. package/CHANGELOG.md +1776 -6
  2. package/README.md +65 -1
  3. package/bin/_launcher.js +38 -23
  4. package/dist/src/adapters/council/openai.js +12 -6
  5. package/dist/src/adapters/deploy/_http.d.ts +43 -0
  6. package/dist/src/adapters/deploy/_http.js +99 -0
  7. package/dist/src/adapters/deploy/fly.d.ts +206 -0
  8. package/dist/src/adapters/deploy/fly.js +696 -0
  9. package/dist/src/adapters/deploy/index.d.ts +2 -0
  10. package/dist/src/adapters/deploy/index.js +33 -0
  11. package/dist/src/adapters/deploy/render.d.ts +181 -0
  12. package/dist/src/adapters/deploy/render.js +550 -0
  13. package/dist/src/adapters/deploy/types.d.ts +67 -3
  14. package/dist/src/adapters/deploy/vercel.d.ts +17 -1
  15. package/dist/src/adapters/deploy/vercel.js +29 -49
  16. package/dist/src/adapters/pricing.d.ts +36 -0
  17. package/dist/src/adapters/pricing.js +40 -0
  18. package/dist/src/adapters/review-engine/codex.js +10 -7
  19. package/dist/src/cli/autopilot.d.ts +75 -0
  20. package/dist/src/cli/autopilot.js +750 -0
  21. package/dist/src/cli/brainstorm.d.ts +23 -0
  22. package/dist/src/cli/brainstorm.js +131 -0
  23. package/dist/src/cli/costs.d.ts +15 -1
  24. package/dist/src/cli/costs.js +99 -10
  25. package/dist/src/cli/dashboard/index.d.ts +5 -0
  26. package/dist/src/cli/dashboard/index.js +49 -0
  27. package/dist/src/cli/dashboard/login.d.ts +22 -0
  28. package/dist/src/cli/dashboard/login.js +260 -0
  29. package/dist/src/cli/dashboard/logout.d.ts +12 -0
  30. package/dist/src/cli/dashboard/logout.js +45 -0
  31. package/dist/src/cli/dashboard/status.d.ts +30 -0
  32. package/dist/src/cli/dashboard/status.js +65 -0
  33. package/dist/src/cli/dashboard/upload.d.ts +16 -0
  34. package/dist/src/cli/dashboard/upload.js +48 -0
  35. package/dist/src/cli/deploy.d.ts +3 -3
  36. package/dist/src/cli/deploy.js +34 -9
  37. package/dist/src/cli/engine-flag-deprecation.d.ts +14 -0
  38. package/dist/src/cli/engine-flag-deprecation.js +20 -0
  39. package/dist/src/cli/fix.d.ts +18 -0
  40. package/dist/src/cli/fix.js +105 -11
  41. package/dist/src/cli/help-text.d.ts +52 -0
  42. package/dist/src/cli/help-text.js +416 -0
  43. package/dist/src/cli/implement.d.ts +91 -0
  44. package/dist/src/cli/implement.js +196 -0
  45. package/dist/src/cli/index.d.ts +2 -1
  46. package/dist/src/cli/index.js +774 -245
  47. package/dist/src/cli/json-envelope.d.ts +187 -0
  48. package/dist/src/cli/json-envelope.js +270 -0
  49. package/dist/src/cli/json-mode.d.ts +33 -0
  50. package/dist/src/cli/json-mode.js +201 -0
  51. package/dist/src/cli/migrate.d.ts +111 -0
  52. package/dist/src/cli/migrate.js +305 -0
  53. package/dist/src/cli/plan.d.ts +81 -0
  54. package/dist/src/cli/plan.js +149 -0
  55. package/dist/src/cli/pr.d.ts +106 -0
  56. package/dist/src/cli/pr.js +191 -19
  57. package/dist/src/cli/preflight.js +26 -0
  58. package/dist/src/cli/review.d.ts +27 -0
  59. package/dist/src/cli/review.js +126 -0
  60. package/dist/src/cli/runs-watch-renderer.d.ts +45 -0
  61. package/dist/src/cli/runs-watch-renderer.js +275 -0
  62. package/dist/src/cli/runs-watch.d.ts +41 -0
  63. package/dist/src/cli/runs-watch.js +395 -0
  64. package/dist/src/cli/runs.d.ts +122 -0
  65. package/dist/src/cli/runs.js +902 -0
  66. package/dist/src/cli/scaffold.d.ts +39 -0
  67. package/dist/src/cli/scaffold.js +287 -0
  68. package/dist/src/cli/scan.d.ts +93 -0
  69. package/dist/src/cli/scan.js +166 -40
  70. package/dist/src/cli/setup.d.ts +30 -0
  71. package/dist/src/cli/setup.js +137 -0
  72. package/dist/src/cli/spec.d.ts +66 -0
  73. package/dist/src/cli/spec.js +132 -0
  74. package/dist/src/cli/validate.d.ts +29 -0
  75. package/dist/src/cli/validate.js +131 -0
  76. package/dist/src/core/config/schema.d.ts +9 -0
  77. package/dist/src/core/config/schema.js +7 -0
  78. package/dist/src/core/config/types.d.ts +11 -0
  79. package/dist/src/core/council/runner.d.ts +10 -1
  80. package/dist/src/core/council/runner.js +25 -3
  81. package/dist/src/core/council/types.d.ts +7 -0
  82. package/dist/src/core/errors.d.ts +1 -1
  83. package/dist/src/core/errors.js +11 -0
  84. package/dist/src/core/logging/redaction.d.ts +13 -0
  85. package/dist/src/core/logging/redaction.js +20 -0
  86. package/dist/src/core/migrate/schema-validator.js +15 -1
  87. package/dist/src/core/phases/static-rules.d.ts +5 -1
  88. package/dist/src/core/phases/static-rules.js +2 -5
  89. package/dist/src/core/run-state/budget.d.ts +88 -0
  90. package/dist/src/core/run-state/budget.js +141 -0
  91. package/dist/src/core/run-state/cli-internal.d.ts +21 -0
  92. package/dist/src/core/run-state/cli-internal.js +174 -0
  93. package/dist/src/core/run-state/events.d.ts +59 -0
  94. package/dist/src/core/run-state/events.js +512 -0
  95. package/dist/src/core/run-state/lock.d.ts +61 -0
  96. package/dist/src/core/run-state/lock.js +206 -0
  97. package/dist/src/core/run-state/phase-context.d.ts +60 -0
  98. package/dist/src/core/run-state/phase-context.js +108 -0
  99. package/dist/src/core/run-state/phase-registry.d.ts +137 -0
  100. package/dist/src/core/run-state/phase-registry.js +162 -0
  101. package/dist/src/core/run-state/phase-runner.d.ts +80 -0
  102. package/dist/src/core/run-state/phase-runner.js +447 -0
  103. package/dist/src/core/run-state/provider-readback.d.ts +130 -0
  104. package/dist/src/core/run-state/provider-readback.js +426 -0
  105. package/dist/src/core/run-state/replay-decision.d.ts +69 -0
  106. package/dist/src/core/run-state/replay-decision.js +144 -0
  107. package/dist/src/core/run-state/resolve-engine.d.ts +45 -0
  108. package/dist/src/core/run-state/resolve-engine.js +74 -0
  109. package/dist/src/core/run-state/resume-preflight.d.ts +66 -0
  110. package/dist/src/core/run-state/resume-preflight.js +116 -0
  111. package/dist/src/core/run-state/run-phase-with-lifecycle.d.ts +69 -0
  112. package/dist/src/core/run-state/run-phase-with-lifecycle.js +193 -0
  113. package/dist/src/core/run-state/runs.d.ts +57 -0
  114. package/dist/src/core/run-state/runs.js +288 -0
  115. package/dist/src/core/run-state/snapshot.d.ts +14 -0
  116. package/dist/src/core/run-state/snapshot.js +114 -0
  117. package/dist/src/core/run-state/state.d.ts +40 -0
  118. package/dist/src/core/run-state/state.js +164 -0
  119. package/dist/src/core/run-state/types.d.ts +284 -0
  120. package/dist/src/core/run-state/types.js +19 -0
  121. package/dist/src/core/run-state/ulid.d.ts +11 -0
  122. package/dist/src/core/run-state/ulid.js +95 -0
  123. package/dist/src/core/schema-alignment/extractor/index.d.ts +1 -1
  124. package/dist/src/core/schema-alignment/extractor/index.js +2 -2
  125. package/dist/src/core/schema-alignment/extractor/prisma.d.ts +13 -1
  126. package/dist/src/core/schema-alignment/extractor/prisma.js +65 -10
  127. package/dist/src/core/schema-alignment/git-history.d.ts +19 -0
  128. package/dist/src/core/schema-alignment/git-history.js +53 -0
  129. package/dist/src/core/static-rules/rules/brand-tokens.js +2 -2
  130. package/dist/src/core/static-rules/rules/schema-alignment.js +14 -4
  131. package/dist/src/dashboard/auto-upload.d.ts +26 -0
  132. package/dist/src/dashboard/auto-upload.js +107 -0
  133. package/dist/src/dashboard/config.d.ts +22 -0
  134. package/dist/src/dashboard/config.js +109 -0
  135. package/dist/src/dashboard/upload/canonical.d.ts +3 -0
  136. package/dist/src/dashboard/upload/canonical.js +16 -0
  137. package/dist/src/dashboard/upload/chain.d.ts +9 -0
  138. package/dist/src/dashboard/upload/chain.js +27 -0
  139. package/dist/src/dashboard/upload/snapshot.d.ts +23 -0
  140. package/dist/src/dashboard/upload/snapshot.js +66 -0
  141. package/dist/src/dashboard/upload/uploader.d.ts +54 -0
  142. package/dist/src/dashboard/upload/uploader.js +330 -0
  143. package/package.json +19 -3
  144. package/scripts/autoregress.ts +1 -1
  145. package/scripts/test-runner.mjs +4 -0
  146. package/skills/claude-autopilot.md +1 -1
  147. package/skills/make-interfaces-feel-better/SKILL.md +104 -0
  148. package/skills/simplify-ui/SKILL.md +103 -0
  149. package/skills/ui/SKILL.md +117 -0
  150. package/skills/ui-ux-pro-max/SKILL.md +90 -0
@@ -0,0 +1,416 @@
1
+ /**
2
+ * Two-level help grouping for the claude-autopilot CLI.
3
+ *
4
+ * The CLI ships ~25 subcommands. A flat list crowds the welcome screen and
5
+ * makes it hard for new users to find the verb they need. This module owns
6
+ * the canonical grouping (Pipeline / Review / Deploy / Migrate / Diagnostics
7
+ * / Advanced), the per-verb summaries, and the per-verb Options blocks.
8
+ *
9
+ * The dispatcher in index.ts imports these helpers — keeping the data here
10
+ * means the help text can be rendered into a string for tests without firing
11
+ * the side-effecting top-level switch statement in index.ts.
12
+ *
13
+ * Group assignments are asserted by tests/cli/help-text.test.ts so newly
14
+ * added verbs are forced into the structure rather than silently dropped.
15
+ *
16
+ * Groups are ordered roughly by user journey:
17
+ * Pipeline — brainstorm → spec → plan → implement → PR
18
+ * Review — operates on findings / runs the LLM-backed code review
19
+ * Deploy — platform-specific deploy verbs
20
+ * Migrate — database migration dispatch
21
+ * Diagnostics — sanity checks, second-opinion, test scaffolding
22
+ * Advanced — long-running daemons / niche / experimental verbs
23
+ */
24
+ export const HELP_GROUPS = [
25
+ {
26
+ name: 'Pipeline',
27
+ tagline: 'spec → plan → implement → PR loop',
28
+ verbs: [
29
+ { verb: 'init', summary: 'Scaffold guardrail.config.yaml + auto-detect migrate stack (writes .autopilot/stack.md)' },
30
+ { verb: 'setup', summary: 'Auto-detect stack, write config, install pre-push hook' },
31
+ { verb: 'scaffold', summary: 'Scaffold project skeleton from a spec markdown (--from-spec <path>)' },
32
+ { verb: 'autopilot', summary: 'Multi-phase orchestrator — run scan → spec → plan → implement under one runId (v6.2.0)' },
33
+ { verb: 'brainstorm', summary: 'Pipeline entry point (Claude Code skill — see /brainstorm)' },
34
+ { verb: 'spec', summary: 'Spec-writing pointer (Claude Code skill — see /brainstorm)' },
35
+ { verb: 'plan', summary: 'Pipeline plan phase (engine-wrap shell — see superpowers:writing-plans skill)' },
36
+ { verb: 'implement', summary: 'Pipeline implement phase (engine-wrap shell — see claude-autopilot skill)' },
37
+ { verb: 'review', summary: 'Pipeline review phase (engine-wrap shell — see /review, /review-2pass)' },
38
+ { verb: 'validate', summary: 'Pipeline validate phase (engine-wrap shell — see /validate skill)' },
39
+ { verb: 'pr', summary: 'Review a specific PR by number (auto-detects if on PR branch)' },
40
+ { verb: 'pr-desc', summary: 'Generate a PR title / summary / test plan from the current diff' },
41
+ ],
42
+ },
43
+ {
44
+ name: 'Review',
45
+ tagline: 'findings + scan + autofix',
46
+ verbs: [
47
+ { verb: 'run', summary: 'Review git-changed files (default)' },
48
+ { verb: 'scan', summary: 'Review any path — no git required' },
49
+ { verb: 'ci', summary: 'Opinionated CI entrypoint (post comments + SARIF)' },
50
+ { verb: 'fix', summary: 'Auto-fix cached findings using the configured LLM' },
51
+ { verb: 'baseline', summary: 'Manage the committed findings baseline (create|update|show|delete)' },
52
+ { verb: 'triage', summary: 'Mark individual findings as accepted/dismissed' },
53
+ { verb: 'explain', summary: 'Deep-dive explanation + remediation for a specific finding' },
54
+ { verb: 'report', summary: 'Render cached findings as a markdown report' },
55
+ { verb: 'costs', summary: 'Show per-run cost summary' },
56
+ ],
57
+ },
58
+ {
59
+ name: 'Deploy',
60
+ tagline: 'platform-specific deploy',
61
+ verbs: [
62
+ { verb: 'deploy', summary: 'Deploy via configured adapter (vercel | fly | render | generic) — also: rollback, status' },
63
+ ],
64
+ },
65
+ {
66
+ name: 'Migrate',
67
+ tagline: 'database migration dispatch',
68
+ verbs: [
69
+ { verb: 'migrate', summary: 'Run database migrations via the stack-aware dispatcher' },
70
+ { verb: 'migrate-doctor', summary: 'Validate .autopilot/stack.md and skill manifests (alias: migrate doctor)' },
71
+ { verb: 'migrate-v4', summary: 'Codemod for v4 → v5 repo migration (not a pipeline phase)' },
72
+ ],
73
+ },
74
+ {
75
+ name: 'Diagnostics',
76
+ tagline: 'sanity checks + second-opinion + test scaffolding',
77
+ verbs: [
78
+ { verb: 'doctor', summary: 'Check prerequisites (alias: preflight)' },
79
+ { verb: 'preflight', summary: 'Check prerequisites (alias: doctor)' },
80
+ { verb: 'council', summary: 'Multi-model review — dispatch the diff to N models and synthesize consensus' },
81
+ { verb: 'test-gen', summary: 'Detect uncovered exports and generate test cases using the LLM' },
82
+ ],
83
+ },
84
+ {
85
+ name: 'Engine',
86
+ tagline: 'v6 run state engine — list, inspect, GC, resume',
87
+ verbs: [
88
+ { verb: 'runs', summary: 'Inspect run state: runs list | show <id> | watch <id> | resume <id> | gc | delete <id> | doctor' },
89
+ ],
90
+ },
91
+ {
92
+ name: 'Dashboard',
93
+ tagline: 'hosted product — login, status, manual upload (v7.0 Phase 2.3)',
94
+ verbs: [
95
+ { verb: 'dashboard', summary: 'Manage hosted dashboard auth + uploads: dashboard {login,logout,status,upload <runId>}' },
96
+ ],
97
+ },
98
+ {
99
+ name: 'Advanced',
100
+ tagline: 'server / experimental — hidden from welcome screen',
101
+ verbs: [
102
+ { verb: 'worker', summary: 'Persistent review daemon for multi-terminal parallel usage (start|stop|status)' },
103
+ { verb: 'mcp', summary: 'MCP server for Claude / ChatGPT integration' },
104
+ { verb: 'hook', summary: 'Install / remove the pre-push git hook' },
105
+ { verb: 'watch', summary: 'Watch for file changes and re-run on each save' },
106
+ { verb: 'autoregress', summary: 'Snapshot regression tests (run|diff|update|generate)' },
107
+ { verb: 'lsp', summary: 'Language server — publishes findings as LSP diagnostics (stdin/stdout)' },
108
+ { verb: 'ignore', summary: 'Interactively add findings to .guardrail-ignore' },
109
+ ],
110
+ },
111
+ ];
112
+ /**
113
+ * Per-verb Options blocks. Keyed by the verb that owns the block. Some verbs
114
+ * have no documented flags (e.g. `costs`, `lsp`, `report`) and are absent here;
115
+ * `claude-autopilot help <verb>` will show just the row in that case.
116
+ */
117
+ export const HELP_OPTIONS = {
118
+ run: `Options (run):
119
+ --base <ref> Git base ref for diff (default: HEAD~1)
120
+ --config <path> Path to config file (default: ./guardrail.config.yaml)
121
+ --files <a,b,c> Explicit comma-separated file list (skips git detection)
122
+ --dry-run Show what would run without executing
123
+ --diff Send git diff hunks instead of full files (~70% fewer tokens)
124
+ --delta Only report findings new since last run (suppress pre-existing)
125
+ --inline-comments Post per-line review comments on the PR diff
126
+ --post-comments Post/update a summary comment on the open PR
127
+ --format <text|sarif> Output format (default: text)
128
+ --output <path> Output file path (required with --format sarif)`,
129
+ scan: `Options (scan):
130
+ <path> [path...] Files or directories to scan (or --all for entire codebase)
131
+ --all Scan entire codebase
132
+ --ask <question> Targeted question to inject into the LLM review prompt
133
+ --focus <type> security | logic | performance (default: all)
134
+ --dry-run List files that would be scanned without running
135
+ --config <path> Path to config file
136
+ --engine [v7.0 deprecated no-op] engine is always on; flag emits a warning`,
137
+ pr: `Options (pr):
138
+ <number> PR number to review (optional if on a PR branch)
139
+ --no-post-comments Skip posting/updating PR summary comment
140
+ --no-inline-comments Skip posting per-line inline annotations
141
+ --config <path> Path to config file
142
+ --engine [v7.0 deprecated no-op] engine is always on; flag emits a warning
143
+
144
+ Note: pr is side-effecting — it posts/updates a PR comment and inline
145
+ review comments via the gh CLI. Engine-on records a github-pr
146
+ externalRef; future replays gate on the spec's "side-effect
147
+ readback" rule (--force-replay required if a prior phase.success
148
+ exists for the same run).`,
149
+ fix: `Options (fix):
150
+ --severity <critical|warning|all> Which findings to fix (default: critical)
151
+ --dry-run Preview fixes without writing files
152
+ --config <path> Path to config file
153
+ --engine [v7.0 deprecated no-op] engine is always on; flag emits a warning`,
154
+ costs: `Options (costs):
155
+ --config <path> Path to config file
156
+ --engine [v7.0 deprecated no-op] engine is always on; flag emits a warning`,
157
+ brainstorm: `Options (brainstorm):
158
+ --config <path> Path to config file
159
+ --engine [v7.0 deprecated no-op] engine is always on; flag emits a warning
160
+ --json Emit a structured JSON envelope on stdout
161
+
162
+ Note: brainstorm is primarily a Claude Code skill (/brainstorm). The CLI
163
+ verb is an advisory pointer; engine-on still produces a run-state
164
+ snapshot (state.json + events.ndjson) for pipeline introspection.`,
165
+ spec: `Options (spec):
166
+ --config <path> Path to config file
167
+ --engine [v7.0 deprecated no-op] engine is always on; flag emits a warning
168
+ --json Emit a structured JSON envelope on stdout
169
+
170
+ Note: spec is primarily a Claude Code skill (entered via /brainstorm). The
171
+ CLI verb is an advisory pointer; engine-on still produces a run-state
172
+ snapshot (state.json + events.ndjson) for pipeline introspection.`,
173
+ plan: `Options (plan):
174
+ --spec <path> Spec file the planner should read (optional)
175
+ --output <path> Where to write the plan markdown (default: .guardrail-cache/plans/<ts>-plan.md)
176
+ --config <path> Path to config file
177
+ --engine [v7.0 deprecated no-op] engine is always on; flag emits a warning`,
178
+ review: `Options (review):
179
+ --context <text> Optional context note injected into the review log
180
+ --output <path> Where to write the review log (default: .guardrail-cache/reviews/<ts>-review.md)
181
+ --config <path> Path to config file
182
+ --engine [v7.0 deprecated no-op] engine is always on; flag emits a warning`,
183
+ validate: `Options (validate):
184
+ --context <text> Optional context note injected into the validate log
185
+ --output <path> Where to write the validate log (default: .guardrail-cache/validate/<ts>-validate.md)
186
+ --config <path> Path to config file
187
+ --engine [v7.0 deprecated no-op] engine is always on; flag emits a warning
188
+
189
+ Note: validate is primarily a Claude Code skill (/validate). The CLI verb
190
+ is an engine-wrap shell; engine-on still produces a run-state
191
+ snapshot (state.json + events.ndjson) for pipeline introspection.
192
+ SARIF emission lives in \`claude-autopilot run --format sarif\`.`,
193
+ autopilot: `Options (autopilot):
194
+ --mode <full> Pipeline mode (v6.2.0 ships 'full' only — scan → spec → plan → implement)
195
+ --phases <a,b,c> Explicit phase list (comma-separated; overrides --mode)
196
+ --budget <usd> Run-scope budget cap (USD). Cross-phase — actualSoFar accumulates across phases.
197
+ --engine [v7.0 deprecated no-op] engine is always on; flag emits a warning
198
+
199
+ Behavior: drives N pipeline phases under ONE runId so a \`runs watch <id>\`
200
+ window covers the whole pipeline. Sequential — no parallel
201
+ execution. Non-interactive — pause budget decisions hard-fail.
202
+ Exit codes: 0 success, 78 budget_exceeded, 2 engine error
203
+ (lock_held / corrupted_state / partial_write), 1 everything else.
204
+ Resume a failed pipeline via \`claude-autopilot run resume <id>\`.
205
+
206
+ v6.2.0 ships scan / spec / plan / implement only. \`migrate\` and \`pr\`
207
+ land in v6.2.1 once their per-phase idempotency contracts (preflight
208
+ readback + externalRef recorded BEFORE side-effect) are wired. The
209
+ --mode=fix and --mode=review modes land in v6.2.1+; --json envelope
210
+ lands in v6.2.2.
211
+
212
+ Examples:
213
+ claude-autopilot autopilot
214
+ claude-autopilot autopilot --budget 25
215
+ claude-autopilot autopilot --phases=scan,spec,plan`,
216
+ dashboard: `Options (dashboard):
217
+ login Open browser, mint API key via loopback callback
218
+ logout Revoke server-side, delete local config
219
+ status Show login state + memberships + last upload
220
+ upload <runId> Manually upload a run (resume an interrupted auto-upload)
221
+
222
+ Auto-upload: after \`dashboard login\`, every engine-on autopilot run
223
+ uploads to autopilot.dev when run.complete fires. Failure prints a
224
+ resume command and never fails the run. Opt out per-run with
225
+ \`--no-upload\` or globally with \`CLAUDE_AUTOPILOT_UPLOAD=off\`.
226
+
227
+ Env:
228
+ AUTOPILOT_DASHBOARD_BASE_URL Override base URL (default https://autopilot.dev)
229
+ CLAUDE_AUTOPILOT_HOME Override config dir (default ~/.claude-autopilot)
230
+ CLAUDE_AUTOPILOT_UPLOAD=off Skip auto-upload at run.complete
231
+
232
+ Examples:
233
+ claude-autopilot dashboard login
234
+ claude-autopilot dashboard status
235
+ claude-autopilot dashboard upload 01HFGB...`,
236
+ implement: `Options (implement):
237
+ --context <text> Optional context note injected into the implement log
238
+ --plan <path> Plan file the implement phase consumed (e.g. docs/plans/<slug>.md)
239
+ --output <path> Where to write the implement log (default: .guardrail-cache/implement/<ts>-implement.md)
240
+ --config <path> Path to config file
241
+ --engine [v7.0 deprecated no-op] engine is always on; flag emits a warning
242
+
243
+ Note: implement is primarily a Claude Code skill (claude-autopilot — reads
244
+ plan, dispatches subagents per plan phase via subagent-driven-development,
245
+ writes code, runs tests, commits, optionally pushes via commit-push-pr).
246
+ The CLI verb is an engine-wrap shell; engine-on still produces a
247
+ run-state snapshot (state.json + events.ndjson) for pipeline
248
+ introspection. The v6.0.7 wrap declares idempotent: true,
249
+ hasSideEffects: false because the CLI verb writes a local log stub
250
+ only — no git push, no PR creation. If a future PR inlines the
251
+ implement loop into the CLI verb, the declarations flip to match
252
+ the spec table (idempotent: false, hasSideEffects: true,
253
+ externalRefs: git-remote-push). See src/cli/implement.ts deviation
254
+ note for the full rationale.`,
255
+ watch: `Options (watch):
256
+ --config <path> Path to config file (default: ./guardrail.config.yaml)
257
+ --debounce <ms> Debounce delay in ms (default: 300)`,
258
+ autoregress: `Options (autoregress):
259
+ --all Run/diff all snapshots
260
+ --since <ref> Git ref for changed-files detection
261
+ --snapshot <slug> Target a single snapshot
262
+ --files <a,b,c> Explicit file list for generate (skips git detection)`,
263
+ migrate: `Options (migrate):
264
+ --env <name> Target environment from .autopilot/stack.md (default: dev)
265
+ --dry-run Run skill in dry-run mode (no side effects)
266
+ --yes Required to apply prod migrations in CI
267
+ --config <path> Path to config file (default: ./guardrail.config.yaml)
268
+ --engine [v7.0 deprecated no-op] engine is always on; flag emits a warning
269
+
270
+ Note: migrate is a side-effecting phase — re-running with --engine after a
271
+ prior phase.success requires --force-replay (Phase 6+) because the
272
+ engine cannot read back \`migration_state\` yet. Each applied
273
+ migration emits a \`migration-version\` externalRef under the run
274
+ for the resume gate.`,
275
+ 'migrate-doctor': `Options (migrate doctor / migrate-doctor):
276
+ --fix Apply auto-fixable mutations (legacy stack.md, skills/migrate/, schema_version)`,
277
+ runs: `Sub-verbs (runs):
278
+ runs list List runs newest-first
279
+ runs show <id> Show a run's state + last events
280
+ runs watch <id> Tail events.ndjson with a live cost meter
281
+ runs gc Delete completed runs older than N days
282
+ runs delete <id> Delete a single run (terminal-status only)
283
+ runs doctor Replay events vs. state.json; report drift
284
+ run resume <id> Lookup-only: identify the next phase + decision
285
+
286
+ Options (runs list):
287
+ --status <s> Filter: pending | running | paused | completed | failed | aborted
288
+ --json Emit a structured JSON envelope on stdout
289
+
290
+ Options (runs show):
291
+ <id> ULID of the run to inspect
292
+ --events Tail events.ndjson after the state summary
293
+ --events-tail <n> How many tail events to show (default 20)
294
+ --json Emit a structured JSON envelope on stdout
295
+
296
+ Options (runs watch):
297
+ <id> ULID of the run to watch
298
+ --since <seq> Replay forward from a specific event seq (resume after disconnect)
299
+ --no-follow Render the current state once and exit (snapshot mode)
300
+ --json Emit raw NDJSON to stdout (one event per line) — ANSI suppressed
301
+ --no-color Force ANSI off even on a TTY
302
+
303
+ Behavior: tails events.ndjson via fs.watchFile (1s poll) and pretty-renders
304
+ each new event with a running cost/budget meter. Exits when the
305
+ run terminates (run.complete / run.failed / run.aborted) or on
306
+ Ctrl-C. Exit codes: 0 success, 1 invalid input or stream error,
307
+ 2 not_found.
308
+
309
+ Options (runs gc):
310
+ --older-than-days <n> Cutoff in days (default 30)
311
+ --dry-run Preview deletions without touching disk
312
+ --yes Skip the confirmation prompt
313
+ --json Emit a structured JSON envelope on stdout
314
+
315
+ Options (runs delete):
316
+ <id> ULID of the run to delete
317
+ --force Override the terminal-status guard (dangerous)
318
+ --json Emit a structured JSON envelope on stdout
319
+
320
+ Options (runs doctor):
321
+ <id> Limit the check to a single run id (optional)
322
+ --fix Rewrite state.json from events.ndjson where drift is found
323
+ --json Emit a structured JSON envelope on stdout
324
+
325
+ Options (run resume):
326
+ <id> ULID of the run to look up
327
+ --from-phase <name> Resume target phase by name (must exist on the run)
328
+ --json Emit a structured JSON envelope on stdout
329
+
330
+ NOTE: \`run resume\` in v6 Phase 3 is LOOKUP-ONLY. It identifies which phase
331
+ would resume from and the decision rationale (retry, skip-idempotent,
332
+ needs-human, already-complete) without actually executing the phase.
333
+ Real execution wires in v6 Phase 6+.`,
334
+ deploy: `Options (deploy):
335
+ --adapter <vercel|fly|render|generic> Override deploy.adapter from config
336
+ --config <path> Path to config file
337
+ --ref <ref> Git ref (branch / tag) to deploy
338
+ --sha <commit> Specific commit SHA to deploy
339
+ --watch Stream build logs to stderr in real time (vercel: SSE; fly: WebSocket; render: REST polling)
340
+ --to <deploy-id> Target deploy ID for 'deploy rollback'
341
+ --pr <n> Post upserting deploy summary comment on the PR
342
+
343
+ Subcommands (deploy):
344
+ deploy Deploy via configured adapter
345
+ deploy rollback Roll back to previous prod deploy
346
+ deploy rollback --to <id> Roll back to a specific deploy
347
+ deploy status Show current prod + last 5 builds`,
348
+ };
349
+ /** Pad the verb column so summaries align across groups. */
350
+ function padVerb(verb) {
351
+ const WIDTH = 16;
352
+ return verb.length >= WIDTH ? verb + ' ' : verb + ' '.repeat(WIDTH - verb.length);
353
+ }
354
+ /**
355
+ * Global flags advertised in --help. These work across most verbs (per-verb
356
+ * support varies; v6.0.1 wires them into `scan` first, additional verbs land
357
+ * in subsequent v6.0.x point releases per docs/v6/wrapping-pipeline-phases.md).
358
+ */
359
+ export const GLOBAL_FLAGS_BLOCK = `Global flags:
360
+ --json Emit a structured JSON envelope on stdout (most verbs)
361
+ --engine [v7.0 deprecated no-op] engine is always on; flag emits a warning
362
+ v7.0 removed the engine-off opt-out flag and code path entirely.
363
+ CLAUDE_AUTOPILOT_ENGINE=off is now ignored (warns once per process)
364
+ instead of disabling the engine. See docs/v7/breaking-changes.md.`;
365
+ /** Build the full two-level help text. Returned as a string so tests can assert against it without spawning. */
366
+ export function buildHelpText() {
367
+ const lines = [];
368
+ lines.push('');
369
+ lines.push('Usage: claude-autopilot <command> [options] (legacy alias: guardrail)');
370
+ lines.push('');
371
+ for (const group of HELP_GROUPS) {
372
+ lines.push(`\x1b[1m${group.name}:\x1b[0m \x1b[2m# ${group.tagline}\x1b[0m`);
373
+ for (const v of group.verbs) {
374
+ lines.push(` ${padVerb(v.verb)}${v.summary}`);
375
+ }
376
+ lines.push('');
377
+ }
378
+ lines.push(GLOBAL_FLAGS_BLOCK);
379
+ lines.push('');
380
+ for (const group of HELP_GROUPS) {
381
+ for (const v of group.verbs) {
382
+ const block = HELP_OPTIONS[v.verb];
383
+ if (block) {
384
+ lines.push(block);
385
+ lines.push('');
386
+ }
387
+ }
388
+ }
389
+ lines.push('Run \x1b[36mclaude-autopilot help <command>\x1b[0m for command-specific options.');
390
+ return lines.join('\n') + '\n';
391
+ }
392
+ /** Build help text for a single verb. Returns null if the verb is unknown. */
393
+ export function buildCommandHelpText(verb) {
394
+ for (const group of HELP_GROUPS) {
395
+ const match = group.verbs.find(v => v.verb === verb);
396
+ if (match) {
397
+ const lines = [];
398
+ lines.push('');
399
+ lines.push(`Usage: claude-autopilot ${verb} [options]`);
400
+ lines.push('');
401
+ lines.push(` ${padVerb(match.verb)}${match.summary}`);
402
+ lines.push(` \x1b[2m(group: ${group.name} — ${group.tagline})\x1b[0m`);
403
+ lines.push('');
404
+ const block = HELP_OPTIONS[verb];
405
+ if (block) {
406
+ lines.push(block);
407
+ lines.push('');
408
+ }
409
+ return lines.join('\n');
410
+ }
411
+ }
412
+ return null;
413
+ }
414
+ /** Set of verbs that have a row in HELP_GROUPS — used by `help <verb>` lookup and by tests. */
415
+ export const HELP_VERBS = HELP_GROUPS.flatMap(g => g.verbs.map(v => v.verb));
416
+ //# sourceMappingURL=help-text.js.map
@@ -0,0 +1,91 @@
1
+ import type { GuardrailConfig } from '../core/config/types.ts';
2
+ import { type RunPhase } from '../core/run-state/phase-runner.ts';
3
+ export interface ImplementCommandOptions {
4
+ cwd?: string;
5
+ configPath?: string;
6
+ /**
7
+ * Optional context note injected into the implement log. The actual
8
+ * implementation work (reading the plan, dispatching subagents, writing
9
+ * code, running tests, committing, optionally pushing) is owned by the
10
+ * Claude Code `claude-autopilot` skill and its delegates
11
+ * (`subagent-driven-development`, `commit-push-pr`,
12
+ * `using-git-worktrees`); this CLI verb is the engine-wrap shell so v6
13
+ * pipeline runs can checkpoint an `implement` phase entry alongside
14
+ * `plan` / `migrate` / `validate` / `pr` / `review`.
15
+ */
16
+ context?: string;
17
+ /**
18
+ * Optional reference to the plan file the implement phase consumed
19
+ * (e.g. `docs/plans/2026-05-05-foo.md`). Echoed into the log stub so
20
+ * `runs show <id>` can surface it. The CLI verb does not read the plan
21
+ * — it just records the path for downstream introspection.
22
+ */
23
+ plan?: string;
24
+ /**
25
+ * Where to write the implement log file. Defaults to
26
+ * `.guardrail-cache/implement/<timestamp>-implement.md` so it lands inside
27
+ * the cache that's already gitignored. The path is recorded on
28
+ * ImplementOutput so the engine path can persist it as `result` for
29
+ * replay.
30
+ */
31
+ outputPath?: string;
32
+ /**
33
+ * v6.0.7 — engine knob inputs. Same shape and precedence as scan / costs /
34
+ * fix / plan / review / validate (CLI > env > config > built-in default
35
+ * off in v6.0.x).
36
+ */
37
+ cliEngine?: boolean;
38
+ envEngine?: string;
39
+ }
40
+ /**
41
+ * Phase input — captured as a struct so the engine path's phase body matches
42
+ * the engine-off path call signature.
43
+ *
44
+ * Exported so the v6.2.0 orchestrator's phase registry can carry the typed
45
+ * I/O shape on its `PhaseRegistration<ImplementInput, ImplementOutput>` slot.
46
+ */
47
+ export interface ImplementInput {
48
+ cwd: string;
49
+ context: string | null;
50
+ plan: string | null;
51
+ outputPath: string;
52
+ }
53
+ /**
54
+ * Phase output — JSON-serializable summary suitable for persistence as
55
+ * `result` on phases/implement.json. A future skip-already-applied (Phase 6)
56
+ * could restore this without re-invoking the implement loop by reading the
57
+ * persisted log path.
58
+ */
59
+ export interface ImplementOutput {
60
+ /** Absolute path to the written implement log file. */
61
+ implementLogPath: string;
62
+ /** Echoed for the render layer / future skip-already-applied. */
63
+ context: string | null;
64
+ /** Plan file path the implement phase was pointed at, if any. */
65
+ plan: string | null;
66
+ }
67
+ /** v6.2.0 — see scan.ts for the kind='early-exit' rationale. Implement has
68
+ * no early-exit branches today; the discriminant is included for shape
69
+ * parity with the other builders. */
70
+ export interface BuildImplementPhaseEarlyExit {
71
+ kind: 'early-exit';
72
+ exitCode: number;
73
+ }
74
+ export interface BuildImplementPhaseResult {
75
+ kind: 'phase';
76
+ phase: RunPhase<ImplementInput, ImplementOutput>;
77
+ input: ImplementInput;
78
+ config: GuardrailConfig;
79
+ renderResult: (output: ImplementOutput) => number;
80
+ }
81
+ /**
82
+ * v6.2.0 — extract the `RunPhase<ImplementInput, ImplementOutput>`
83
+ * construction out of `runImplement(options)` so the new top-level
84
+ * `autopilot` orchestrator can drive `runPhase` itself with a shared
85
+ * `phaseIdx` against the same run dir.
86
+ *
87
+ * Parity asserted by `tests/cli/implement-builder-parity.test.ts`.
88
+ */
89
+ export declare function buildImplementPhase(options: ImplementCommandOptions): Promise<BuildImplementPhaseResult | BuildImplementPhaseEarlyExit>;
90
+ export declare function runImplement(options?: ImplementCommandOptions): Promise<number>;
91
+ //# sourceMappingURL=implement.d.ts.map