@delegance/claude-autopilot 5.2.2 → 6.2.2
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.
- package/CHANGELOG.md +1027 -1
- package/README.md +104 -17
- package/dist/src/adapters/council/claude.js +2 -1
- package/dist/src/adapters/council/openai.js +14 -7
- package/dist/src/adapters/deploy/_http.d.ts +43 -0
- package/dist/src/adapters/deploy/_http.js +99 -0
- package/dist/src/adapters/deploy/fly.d.ts +206 -0
- package/dist/src/adapters/deploy/fly.js +696 -0
- package/dist/src/adapters/deploy/generic.d.ts +39 -0
- package/dist/src/adapters/deploy/generic.js +98 -0
- package/dist/src/adapters/deploy/index.d.ts +15 -0
- package/dist/src/adapters/deploy/index.js +78 -0
- package/dist/src/adapters/deploy/render.d.ts +181 -0
- package/dist/src/adapters/deploy/render.js +550 -0
- package/dist/src/adapters/deploy/types.d.ts +221 -0
- package/dist/src/adapters/deploy/types.js +15 -0
- package/dist/src/adapters/deploy/vercel.d.ts +143 -0
- package/dist/src/adapters/deploy/vercel.js +426 -0
- package/dist/src/adapters/pricing.d.ts +36 -0
- package/dist/src/adapters/pricing.js +40 -0
- package/dist/src/adapters/review-engine/claude.js +2 -1
- package/dist/src/adapters/review-engine/codex.js +12 -8
- package/dist/src/adapters/review-engine/gemini.js +2 -1
- package/dist/src/adapters/review-engine/openai-compatible.js +2 -1
- package/dist/src/adapters/sdk-loader.d.ts +15 -0
- package/dist/src/adapters/sdk-loader.js +77 -0
- package/dist/src/cli/autopilot.d.ts +71 -0
- package/dist/src/cli/autopilot.js +735 -0
- package/dist/src/cli/brainstorm.d.ts +23 -0
- package/dist/src/cli/brainstorm.js +131 -0
- package/dist/src/cli/costs.d.ts +15 -1
- package/dist/src/cli/costs.js +99 -10
- package/dist/src/cli/deploy.d.ts +71 -0
- package/dist/src/cli/deploy.js +539 -0
- package/dist/src/cli/fix.d.ts +18 -0
- package/dist/src/cli/fix.js +105 -11
- package/dist/src/cli/help-text.d.ts +52 -0
- package/dist/src/cli/help-text.js +400 -0
- package/dist/src/cli/implement.d.ts +91 -0
- package/dist/src/cli/implement.js +196 -0
- package/dist/src/cli/index.js +784 -222
- package/dist/src/cli/json-envelope.d.ts +187 -0
- package/dist/src/cli/json-envelope.js +270 -0
- package/dist/src/cli/json-mode.d.ts +33 -0
- package/dist/src/cli/json-mode.js +201 -0
- package/dist/src/cli/migrate.d.ts +111 -0
- package/dist/src/cli/migrate.js +305 -0
- package/dist/src/cli/plan.d.ts +81 -0
- package/dist/src/cli/plan.js +149 -0
- package/dist/src/cli/pr.d.ts +106 -0
- package/dist/src/cli/pr.js +191 -19
- package/dist/src/cli/preflight.js +102 -1
- package/dist/src/cli/review.d.ts +27 -0
- package/dist/src/cli/review.js +126 -0
- package/dist/src/cli/runs-watch-renderer.d.ts +45 -0
- package/dist/src/cli/runs-watch-renderer.js +275 -0
- package/dist/src/cli/runs-watch.d.ts +41 -0
- package/dist/src/cli/runs-watch.js +395 -0
- package/dist/src/cli/runs.d.ts +122 -0
- package/dist/src/cli/runs.js +902 -0
- package/dist/src/cli/scan.d.ts +93 -0
- package/dist/src/cli/scan.js +166 -40
- package/dist/src/cli/spec.d.ts +66 -0
- package/dist/src/cli/spec.js +132 -0
- package/dist/src/cli/validate.d.ts +29 -0
- package/dist/src/cli/validate.js +131 -0
- package/dist/src/core/config/schema.d.ts +43 -0
- package/dist/src/core/config/schema.js +25 -0
- package/dist/src/core/config/types.d.ts +17 -0
- package/dist/src/core/council/runner.d.ts +10 -1
- package/dist/src/core/council/runner.js +25 -3
- package/dist/src/core/council/types.d.ts +7 -0
- package/dist/src/core/errors.d.ts +1 -1
- package/dist/src/core/errors.js +12 -0
- package/dist/src/core/logging/redaction.d.ts +13 -0
- package/dist/src/core/logging/redaction.js +20 -0
- package/dist/src/core/migrate/detector-rules.js +6 -0
- package/dist/src/core/migrate/schema-validator.js +22 -1
- package/dist/src/core/phases/static-rules.d.ts +5 -1
- package/dist/src/core/phases/static-rules.js +2 -5
- package/dist/src/core/run-state/budget.d.ts +88 -0
- package/dist/src/core/run-state/budget.js +141 -0
- package/dist/src/core/run-state/cli-internal.d.ts +21 -0
- package/dist/src/core/run-state/cli-internal.js +174 -0
- package/dist/src/core/run-state/events.d.ts +59 -0
- package/dist/src/core/run-state/events.js +504 -0
- package/dist/src/core/run-state/lock.d.ts +61 -0
- package/dist/src/core/run-state/lock.js +206 -0
- package/dist/src/core/run-state/phase-context.d.ts +60 -0
- package/dist/src/core/run-state/phase-context.js +108 -0
- package/dist/src/core/run-state/phase-registry.d.ts +137 -0
- package/dist/src/core/run-state/phase-registry.js +162 -0
- package/dist/src/core/run-state/phase-runner.d.ts +80 -0
- package/dist/src/core/run-state/phase-runner.js +447 -0
- package/dist/src/core/run-state/provider-readback.d.ts +130 -0
- package/dist/src/core/run-state/provider-readback.js +426 -0
- package/dist/src/core/run-state/replay-decision.d.ts +69 -0
- package/dist/src/core/run-state/replay-decision.js +144 -0
- package/dist/src/core/run-state/resolve-engine.d.ts +100 -0
- package/dist/src/core/run-state/resolve-engine.js +190 -0
- package/dist/src/core/run-state/resume-preflight.d.ts +66 -0
- package/dist/src/core/run-state/resume-preflight.js +116 -0
- package/dist/src/core/run-state/run-phase-with-lifecycle.d.ts +73 -0
- package/dist/src/core/run-state/run-phase-with-lifecycle.js +186 -0
- package/dist/src/core/run-state/runs.d.ts +57 -0
- package/dist/src/core/run-state/runs.js +288 -0
- package/dist/src/core/run-state/snapshot.d.ts +14 -0
- package/dist/src/core/run-state/snapshot.js +114 -0
- package/dist/src/core/run-state/state.d.ts +40 -0
- package/dist/src/core/run-state/state.js +164 -0
- package/dist/src/core/run-state/types.d.ts +278 -0
- package/dist/src/core/run-state/types.js +13 -0
- package/dist/src/core/run-state/ulid.d.ts +11 -0
- package/dist/src/core/run-state/ulid.js +95 -0
- package/dist/src/core/schema-alignment/extractor/index.d.ts +1 -1
- package/dist/src/core/schema-alignment/extractor/index.js +2 -2
- package/dist/src/core/schema-alignment/extractor/prisma.d.ts +13 -1
- package/dist/src/core/schema-alignment/extractor/prisma.js +65 -10
- package/dist/src/core/schema-alignment/git-history.d.ts +19 -0
- package/dist/src/core/schema-alignment/git-history.js +53 -0
- package/dist/src/core/static-rules/rules/brand-tokens.js +2 -2
- package/dist/src/core/static-rules/rules/schema-alignment.js +14 -4
- package/package.json +9 -5
- package/scripts/autoregress.ts +3 -2
- package/skills/claude-autopilot.md +1 -1
- package/skills/make-interfaces-feel-better/SKILL.md +104 -0
- package/skills/migrate/SKILL.md +193 -47
- package/skills/simplify-ui/SKILL.md +103 -0
- package/skills/ui/SKILL.md +117 -0
- package/skills/ui-ux-pro-max/SKILL.md +90 -0
package/dist/src/cli/fix.js
CHANGED
|
@@ -6,6 +6,7 @@ import { loadCachedFindings } from "../core/persist/findings-cache.js";
|
|
|
6
6
|
import { loadConfig } from "../core/config/loader.js";
|
|
7
7
|
import { loadAdapter } from "../adapters/loader.js";
|
|
8
8
|
import { generateFix, buildUnifiedDiff } from "../core/fix/generator.js";
|
|
9
|
+
import { runPhaseWithLifecycle } from "../core/run-state/run-phase-with-lifecycle.js";
|
|
9
10
|
const C = {
|
|
10
11
|
reset: '\x1b[0m', bold: '\x1b[1m', dim: '\x1b[2m',
|
|
11
12
|
green: '\x1b[32m', yellow: '\x1b[33m', red: '\x1b[31m', cyan: '\x1b[36m',
|
|
@@ -90,14 +91,22 @@ export async function runFix(options = {}) {
|
|
|
90
91
|
let loadedConfig = null;
|
|
91
92
|
try {
|
|
92
93
|
loadedConfig = fs.existsSync(configPath) ? await loadConfig(configPath) : null;
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
94
|
+
if (options.__testReviewEngine) {
|
|
95
|
+
// Test-only fast path — skip the adapter loader (and therefore the
|
|
96
|
+
// implicit LLM key check inside the auto-loader). Same seam as scan's
|
|
97
|
+
// `__testReviewEngine`. Production callers do not pass this.
|
|
98
|
+
engine = options.__testReviewEngine;
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
const ref = loadedConfig
|
|
102
|
+
? (typeof loadedConfig.reviewEngine === 'string' ? loadedConfig.reviewEngine : (loadedConfig.reviewEngine?.adapter ?? 'auto'))
|
|
103
|
+
: 'auto';
|
|
104
|
+
engine = await loadAdapter({
|
|
105
|
+
point: 'review-engine',
|
|
106
|
+
ref,
|
|
107
|
+
options: loadedConfig && typeof loadedConfig.reviewEngine === 'object' ? loadedConfig.reviewEngine.options : undefined,
|
|
108
|
+
});
|
|
109
|
+
}
|
|
101
110
|
}
|
|
102
111
|
catch (err) {
|
|
103
112
|
console.error(fmt('red', `[fix] Could not load review engine: ${err instanceof Error ? err.message : String(err)}`));
|
|
@@ -108,6 +117,81 @@ export async function runFix(options = {}) {
|
|
|
108
117
|
if (shouldVerify) {
|
|
109
118
|
console.log(fmt('dim', `[fix] Verified mode — running "${testCommand}" after each fix\n`));
|
|
110
119
|
}
|
|
120
|
+
const fixInput = {
|
|
121
|
+
cwd,
|
|
122
|
+
fixable,
|
|
123
|
+
engine,
|
|
124
|
+
testCommand,
|
|
125
|
+
shouldVerify,
|
|
126
|
+
// The early-return above already exits when options.dryRun is true, so
|
|
127
|
+
// we're always entering the apply loop here with dryRun=false. Keep the
|
|
128
|
+
// field on FixInput for shape parity (renderFixOutput consumes it) and
|
|
129
|
+
// for future engine-resume scenarios where the snapshot is replayed.
|
|
130
|
+
dryRun: false,
|
|
131
|
+
yes: options.yes === true,
|
|
132
|
+
};
|
|
133
|
+
// The wrapped phase body — runs the apply loop with native readline +
|
|
134
|
+
// per-finding console output INSIDE the phase body. The recipe doc says
|
|
135
|
+
// "no console output" for phase bodies, but `fix` is fundamentally
|
|
136
|
+
// interactive: the user must see each diff and approve it. Same precedent
|
|
137
|
+
// as scan keeping its LLM call inside the phase body. Documented
|
|
138
|
+
// deviation, intentional.
|
|
139
|
+
const phase = {
|
|
140
|
+
name: 'fix',
|
|
141
|
+
// Same-input → same-output: the LLM fix generator is deterministic per
|
|
142
|
+
// (finding, file content) pair, and applied diffs are exact text
|
|
143
|
+
// replacements. Re-running against the same cached findings against an
|
|
144
|
+
// unchanged tree produces the same results.
|
|
145
|
+
idempotent: true,
|
|
146
|
+
// Local file edits only — no remote / git push / PR creation in the
|
|
147
|
+
// existing `fix` flow. Per the recipe table, "side effects" means
|
|
148
|
+
// platform-side mutations (PR comments, git push, deploy). Local file
|
|
149
|
+
// writes are inside the project tree and the engine treats them like
|
|
150
|
+
// findings-cache writes (already overwrite-style).
|
|
151
|
+
hasSideEffects: false,
|
|
152
|
+
run: async (input) => executeFixPhase(input),
|
|
153
|
+
};
|
|
154
|
+
// v6.0.6 — lifecycle wiring lives in `runPhaseWithLifecycle`. The helper
|
|
155
|
+
// owns the engine-on/engine-off branch and the failure banner; the caller
|
|
156
|
+
// just supplies the phase, the input, and the engine-off escape hatch.
|
|
157
|
+
// The fix phase body is interactive (readline + per-finding diff prints
|
|
158
|
+
// INSIDE executeFixPhase) — that deviation from "pure phase body" is
|
|
159
|
+
// documented in fix's executeFixPhase header comment and unaffected by
|
|
160
|
+
// the helper extract: the helper still calls phase.run, which IS
|
|
161
|
+
// executeFixPhase, exactly as before.
|
|
162
|
+
let output;
|
|
163
|
+
try {
|
|
164
|
+
const result = await runPhaseWithLifecycle({
|
|
165
|
+
cwd,
|
|
166
|
+
phase,
|
|
167
|
+
input: fixInput,
|
|
168
|
+
// The helper only consults `config.engine.enabled` — pass through
|
|
169
|
+
// `loadedConfig` if we have one, otherwise an empty default.
|
|
170
|
+
config: loadedConfig ?? { configVersion: 1 },
|
|
171
|
+
cliEngine: options.cliEngine,
|
|
172
|
+
envEngine: options.envEngine,
|
|
173
|
+
runEngineOff: () => executeFixPhase(fixInput),
|
|
174
|
+
});
|
|
175
|
+
output = result.output;
|
|
176
|
+
}
|
|
177
|
+
catch {
|
|
178
|
+
// Helper already printed the failure banner + emitted run.complete
|
|
179
|
+
// failed + refreshed state.json + released the lock.
|
|
180
|
+
return 1;
|
|
181
|
+
}
|
|
182
|
+
return renderFixOutput(output, fixInput);
|
|
183
|
+
}
|
|
184
|
+
// ---------------------------------------------------------------------------
|
|
185
|
+
// Phase body — drive the apply loop. INTENTIONAL DEVIATION from the recipe:
|
|
186
|
+
// the loop emits per-finding console output and prompts via readline. Pure
|
|
187
|
+
// side-effect-free phase bodies are the recipe default; interactive verbs
|
|
188
|
+
// like `fix` are an explicit exception (same precedent as scan's LLM call
|
|
189
|
+
// inside its phase body). The summary banner + exit code logic still lives
|
|
190
|
+
// in `renderFixOutput` so the engine path's idempotency isn't coupled to
|
|
191
|
+
// the final stdout shape.
|
|
192
|
+
// ---------------------------------------------------------------------------
|
|
193
|
+
async function executeFixPhase(input) {
|
|
194
|
+
const { cwd, fixable, engine, testCommand, shouldVerify, dryRun, yes } = input;
|
|
111
195
|
const results = [];
|
|
112
196
|
let quit = false;
|
|
113
197
|
for (const finding of fixable) {
|
|
@@ -135,7 +219,7 @@ export async function runFix(options = {}) {
|
|
|
135
219
|
}
|
|
136
220
|
// Show diff
|
|
137
221
|
const diff = buildUnifiedDiff(result.originalLines, result.replacementLines, finding.file, result.startLine);
|
|
138
|
-
if (
|
|
222
|
+
if (dryRun) {
|
|
139
223
|
console.log('');
|
|
140
224
|
console.log(diff);
|
|
141
225
|
console.log(fmt('dim', ' (dry run — not applied)'));
|
|
@@ -143,7 +227,7 @@ export async function runFix(options = {}) {
|
|
|
143
227
|
continue;
|
|
144
228
|
}
|
|
145
229
|
// Interactive confirmation (unless --yes)
|
|
146
|
-
if (!
|
|
230
|
+
if (!yes) {
|
|
147
231
|
const answer = await confirmFix(diff, finding);
|
|
148
232
|
if (answer === 'quit') {
|
|
149
233
|
quit = true;
|
|
@@ -197,12 +281,22 @@ export async function runFix(options = {}) {
|
|
|
197
281
|
results.push({ file: finding.file, line: finding.line, findingMessage: finding.message, status: 'failed', reason: String(err) });
|
|
198
282
|
}
|
|
199
283
|
}
|
|
284
|
+
return { results, dryRun };
|
|
285
|
+
}
|
|
286
|
+
// ---------------------------------------------------------------------------
|
|
287
|
+
// Render — translate FixOutput back to the legacy stdout summary + exit
|
|
288
|
+
// code. Lives outside the wrapped phase so the engine path's idempotency
|
|
289
|
+
// isn't coupled to the final summary line shape.
|
|
290
|
+
// ---------------------------------------------------------------------------
|
|
291
|
+
function renderFixOutput(output, input) {
|
|
292
|
+
const { results, dryRun } = output;
|
|
293
|
+
const { fixable } = input;
|
|
200
294
|
const fixed = results.filter(r => r.status === 'fixed').length;
|
|
201
295
|
const rejected = results.filter(r => r.status === 'rejected').length;
|
|
202
296
|
const failed = results.filter(r => r.status === 'failed').length;
|
|
203
297
|
const skipped = results.filter(r => r.status === 'skipped').length;
|
|
204
298
|
console.log('');
|
|
205
|
-
if (
|
|
299
|
+
if (dryRun) {
|
|
206
300
|
console.log(fmt('yellow', `[fix] Dry run complete — ${fixable.length} finding${fixable.length !== 1 ? 's' : ''} previewed, no files modified.\n`));
|
|
207
301
|
}
|
|
208
302
|
else {
|
|
@@ -0,0 +1,52 @@
|
|
|
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 type HelpVerb = {
|
|
25
|
+
verb: string;
|
|
26
|
+
summary: string;
|
|
27
|
+
};
|
|
28
|
+
export type HelpGroup = {
|
|
29
|
+
name: string;
|
|
30
|
+
tagline: string;
|
|
31
|
+
verbs: HelpVerb[];
|
|
32
|
+
};
|
|
33
|
+
export declare const HELP_GROUPS: HelpGroup[];
|
|
34
|
+
/**
|
|
35
|
+
* Per-verb Options blocks. Keyed by the verb that owns the block. Some verbs
|
|
36
|
+
* have no documented flags (e.g. `costs`, `lsp`, `report`) and are absent here;
|
|
37
|
+
* `claude-autopilot help <verb>` will show just the row in that case.
|
|
38
|
+
*/
|
|
39
|
+
export declare const HELP_OPTIONS: Record<string, string>;
|
|
40
|
+
/**
|
|
41
|
+
* Global flags advertised in --help. These work across most verbs (per-verb
|
|
42
|
+
* support varies; v6.0.1 wires them into `scan` first, additional verbs land
|
|
43
|
+
* in subsequent v6.0.x point releases per docs/v6/wrapping-pipeline-phases.md).
|
|
44
|
+
*/
|
|
45
|
+
export declare const GLOBAL_FLAGS_BLOCK = "Global flags:\n --json Emit a structured JSON envelope on stdout (most verbs)\n --engine Run under the v6 Run State Engine (writes .guardrail-cache/runs/<ulid>/)\n --no-engine Force the legacy stateless code path (overrides config / env)\n Precedence: CLI > env (CLAUDE_AUTOPILOT_ENGINE) > config (engine.enabled) > built-in default\n v6.0.1: wired for `scan`. v6.0.2: wired for `fix` and `costs`. v6.0.3: wired for `brainstorm` and `spec`. v6.0.4: wired for `plan` and `review`. v6.0.5: wired for `validate`. v6.0.7: wired for `implement`. v6.0.8: wired for `migrate`. v6.0.9: wired for `pr`. ALL 10 phases now wrapped \u2014 v6.0.x feature-complete.";
|
|
46
|
+
/** Build the full two-level help text. Returned as a string so tests can assert against it without spawning. */
|
|
47
|
+
export declare function buildHelpText(): string;
|
|
48
|
+
/** Build help text for a single verb. Returns null if the verb is unknown. */
|
|
49
|
+
export declare function buildCommandHelpText(verb: string): string | null;
|
|
50
|
+
/** Set of verbs that have a row in HELP_GROUPS — used by `help <verb>` lookup and by tests. */
|
|
51
|
+
export declare const HELP_VERBS: readonly string[];
|
|
52
|
+
//# sourceMappingURL=help-text.d.ts.map
|
|
@@ -0,0 +1,400 @@
|
|
|
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: 'autopilot', summary: 'Multi-phase orchestrator — run scan → spec → plan → implement under one runId (v6.2.0)' },
|
|
32
|
+
{ verb: 'brainstorm', summary: 'Pipeline entry point (Claude Code skill — see /brainstorm)' },
|
|
33
|
+
{ verb: 'spec', summary: 'Spec-writing pointer (Claude Code skill — see /brainstorm)' },
|
|
34
|
+
{ verb: 'plan', summary: 'Pipeline plan phase (engine-wrap shell — see superpowers:writing-plans skill)' },
|
|
35
|
+
{ verb: 'implement', summary: 'Pipeline implement phase (engine-wrap shell — see claude-autopilot skill)' },
|
|
36
|
+
{ verb: 'review', summary: 'Pipeline review phase (engine-wrap shell — see /review, /review-2pass)' },
|
|
37
|
+
{ verb: 'validate', summary: 'Pipeline validate phase (engine-wrap shell — see /validate skill)' },
|
|
38
|
+
{ verb: 'pr', summary: 'Review a specific PR by number (auto-detects if on PR branch)' },
|
|
39
|
+
{ verb: 'pr-desc', summary: 'Generate a PR title / summary / test plan from the current diff' },
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: 'Review',
|
|
44
|
+
tagline: 'findings + scan + autofix',
|
|
45
|
+
verbs: [
|
|
46
|
+
{ verb: 'run', summary: 'Review git-changed files (default)' },
|
|
47
|
+
{ verb: 'scan', summary: 'Review any path — no git required' },
|
|
48
|
+
{ verb: 'ci', summary: 'Opinionated CI entrypoint (post comments + SARIF)' },
|
|
49
|
+
{ verb: 'fix', summary: 'Auto-fix cached findings using the configured LLM' },
|
|
50
|
+
{ verb: 'baseline', summary: 'Manage the committed findings baseline (create|update|show|delete)' },
|
|
51
|
+
{ verb: 'triage', summary: 'Mark individual findings as accepted/dismissed' },
|
|
52
|
+
{ verb: 'explain', summary: 'Deep-dive explanation + remediation for a specific finding' },
|
|
53
|
+
{ verb: 'report', summary: 'Render cached findings as a markdown report' },
|
|
54
|
+
{ verb: 'costs', summary: 'Show per-run cost summary' },
|
|
55
|
+
],
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: 'Deploy',
|
|
59
|
+
tagline: 'platform-specific deploy',
|
|
60
|
+
verbs: [
|
|
61
|
+
{ verb: 'deploy', summary: 'Deploy via configured adapter (vercel | fly | render | generic) — also: rollback, status' },
|
|
62
|
+
],
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
name: 'Migrate',
|
|
66
|
+
tagline: 'database migration dispatch',
|
|
67
|
+
verbs: [
|
|
68
|
+
{ verb: 'migrate', summary: 'Run database migrations via the stack-aware dispatcher' },
|
|
69
|
+
{ verb: 'migrate-doctor', summary: 'Validate .autopilot/stack.md and skill manifests (alias: migrate doctor)' },
|
|
70
|
+
{ verb: 'migrate-v4', summary: 'Codemod for v4 → v5 repo migration (not a pipeline phase)' },
|
|
71
|
+
],
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
name: 'Diagnostics',
|
|
75
|
+
tagline: 'sanity checks + second-opinion + test scaffolding',
|
|
76
|
+
verbs: [
|
|
77
|
+
{ verb: 'doctor', summary: 'Check prerequisites (alias: preflight)' },
|
|
78
|
+
{ verb: 'preflight', summary: 'Check prerequisites (alias: doctor)' },
|
|
79
|
+
{ verb: 'council', summary: 'Multi-model review — dispatch the diff to N models and synthesize consensus' },
|
|
80
|
+
{ verb: 'test-gen', summary: 'Detect uncovered exports and generate test cases using the LLM' },
|
|
81
|
+
],
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
name: 'Engine',
|
|
85
|
+
tagline: 'v6 run state engine — list, inspect, GC, resume',
|
|
86
|
+
verbs: [
|
|
87
|
+
{ verb: 'runs', summary: 'Inspect run state: runs list | show <id> | watch <id> | resume <id> | gc | delete <id> | doctor' },
|
|
88
|
+
],
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
name: 'Advanced',
|
|
92
|
+
tagline: 'server / experimental — hidden from welcome screen',
|
|
93
|
+
verbs: [
|
|
94
|
+
{ verb: 'worker', summary: 'Persistent review daemon for multi-terminal parallel usage (start|stop|status)' },
|
|
95
|
+
{ verb: 'mcp', summary: 'MCP server for Claude / ChatGPT integration' },
|
|
96
|
+
{ verb: 'hook', summary: 'Install / remove the pre-push git hook' },
|
|
97
|
+
{ verb: 'watch', summary: 'Watch for file changes and re-run on each save' },
|
|
98
|
+
{ verb: 'autoregress', summary: 'Snapshot regression tests (run|diff|update|generate)' },
|
|
99
|
+
{ verb: 'lsp', summary: 'Language server — publishes findings as LSP diagnostics (stdin/stdout)' },
|
|
100
|
+
{ verb: 'ignore', summary: 'Interactively add findings to .guardrail-ignore' },
|
|
101
|
+
],
|
|
102
|
+
},
|
|
103
|
+
];
|
|
104
|
+
/**
|
|
105
|
+
* Per-verb Options blocks. Keyed by the verb that owns the block. Some verbs
|
|
106
|
+
* have no documented flags (e.g. `costs`, `lsp`, `report`) and are absent here;
|
|
107
|
+
* `claude-autopilot help <verb>` will show just the row in that case.
|
|
108
|
+
*/
|
|
109
|
+
export const HELP_OPTIONS = {
|
|
110
|
+
run: `Options (run):
|
|
111
|
+
--base <ref> Git base ref for diff (default: HEAD~1)
|
|
112
|
+
--config <path> Path to config file (default: ./guardrail.config.yaml)
|
|
113
|
+
--files <a,b,c> Explicit comma-separated file list (skips git detection)
|
|
114
|
+
--dry-run Show what would run without executing
|
|
115
|
+
--diff Send git diff hunks instead of full files (~70% fewer tokens)
|
|
116
|
+
--delta Only report findings new since last run (suppress pre-existing)
|
|
117
|
+
--inline-comments Post per-line review comments on the PR diff
|
|
118
|
+
--post-comments Post/update a summary comment on the open PR
|
|
119
|
+
--format <text|sarif> Output format (default: text)
|
|
120
|
+
--output <path> Output file path (required with --format sarif)`,
|
|
121
|
+
scan: `Options (scan):
|
|
122
|
+
<path> [path...] Files or directories to scan (or --all for entire codebase)
|
|
123
|
+
--all Scan entire codebase
|
|
124
|
+
--ask <question> Targeted question to inject into the LLM review prompt
|
|
125
|
+
--focus <type> security | logic | performance (default: all)
|
|
126
|
+
--dry-run List files that would be scanned without running
|
|
127
|
+
--config <path> Path to config file
|
|
128
|
+
--engine Run under the v6 Run State Engine (writes .guardrail-cache/runs/<ulid>/)
|
|
129
|
+
--no-engine Force the legacy stateless code path (overrides config / env)`,
|
|
130
|
+
pr: `Options (pr):
|
|
131
|
+
<number> PR number to review (optional if on a PR branch)
|
|
132
|
+
--no-post-comments Skip posting/updating PR summary comment
|
|
133
|
+
--no-inline-comments Skip posting per-line inline annotations
|
|
134
|
+
--config <path> Path to config file
|
|
135
|
+
--engine Run under the v6 Run State Engine (writes .guardrail-cache/runs/<ulid>/)
|
|
136
|
+
--no-engine Force the legacy stateless code path (overrides config / env)
|
|
137
|
+
|
|
138
|
+
Note: pr is side-effecting — it posts/updates a PR comment and inline
|
|
139
|
+
review comments via the gh CLI. Engine-on records a github-pr
|
|
140
|
+
externalRef; future replays gate on the spec's "side-effect
|
|
141
|
+
readback" rule (--force-replay required if a prior phase.success
|
|
142
|
+
exists for the same run).`,
|
|
143
|
+
fix: `Options (fix):
|
|
144
|
+
--severity <critical|warning|all> Which findings to fix (default: critical)
|
|
145
|
+
--dry-run Preview fixes without writing files
|
|
146
|
+
--config <path> Path to config file
|
|
147
|
+
--engine Run under the v6 Run State Engine (writes .guardrail-cache/runs/<ulid>/)
|
|
148
|
+
--no-engine Force the legacy stateless code path (overrides config / env)`,
|
|
149
|
+
costs: `Options (costs):
|
|
150
|
+
--config <path> Path to config file
|
|
151
|
+
--engine Run under the v6 Run State Engine (writes .guardrail-cache/runs/<ulid>/)
|
|
152
|
+
--no-engine Force the legacy stateless code path (overrides config / env)`,
|
|
153
|
+
brainstorm: `Options (brainstorm):
|
|
154
|
+
--config <path> Path to config file
|
|
155
|
+
--engine Run under the v6 Run State Engine (writes .guardrail-cache/runs/<ulid>/)
|
|
156
|
+
--no-engine Force the legacy stateless code path (overrides config / env)
|
|
157
|
+
--json Emit a structured JSON envelope on stdout
|
|
158
|
+
|
|
159
|
+
Note: brainstorm is primarily a Claude Code skill (/brainstorm). The CLI
|
|
160
|
+
verb is an advisory pointer; engine-on still produces a run-state
|
|
161
|
+
snapshot (state.json + events.ndjson) for pipeline introspection.`,
|
|
162
|
+
spec: `Options (spec):
|
|
163
|
+
--config <path> Path to config file
|
|
164
|
+
--engine Run under the v6 Run State Engine (writes .guardrail-cache/runs/<ulid>/)
|
|
165
|
+
--no-engine Force the legacy stateless code path (overrides config / env)
|
|
166
|
+
--json Emit a structured JSON envelope on stdout
|
|
167
|
+
|
|
168
|
+
Note: spec is primarily a Claude Code skill (entered via /brainstorm). The
|
|
169
|
+
CLI verb is an advisory pointer; engine-on still produces a run-state
|
|
170
|
+
snapshot (state.json + events.ndjson) for pipeline introspection.`,
|
|
171
|
+
plan: `Options (plan):
|
|
172
|
+
--spec <path> Spec file the planner should read (optional)
|
|
173
|
+
--output <path> Where to write the plan markdown (default: .guardrail-cache/plans/<ts>-plan.md)
|
|
174
|
+
--config <path> Path to config file
|
|
175
|
+
--engine Run under the v6 Run State Engine (writes .guardrail-cache/runs/<ulid>/)
|
|
176
|
+
--no-engine Force the legacy stateless code path (overrides config / env)`,
|
|
177
|
+
review: `Options (review):
|
|
178
|
+
--context <text> Optional context note injected into the review log
|
|
179
|
+
--output <path> Where to write the review log (default: .guardrail-cache/reviews/<ts>-review.md)
|
|
180
|
+
--config <path> Path to config file
|
|
181
|
+
--engine Run under the v6 Run State Engine (writes .guardrail-cache/runs/<ulid>/)
|
|
182
|
+
--no-engine Force the legacy stateless code path (overrides config / env)`,
|
|
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 Run under the v6 Run State Engine (writes .guardrail-cache/runs/<ulid>/)
|
|
188
|
+
--no-engine Force the legacy stateless code path (overrides config / env)
|
|
189
|
+
|
|
190
|
+
Note: validate is primarily a Claude Code skill (/validate). The CLI verb
|
|
191
|
+
is an engine-wrap shell; engine-on still produces a run-state
|
|
192
|
+
snapshot (state.json + events.ndjson) for pipeline introspection.
|
|
193
|
+
SARIF emission lives in \`claude-autopilot run --format sarif\`.`,
|
|
194
|
+
autopilot: `Options (autopilot):
|
|
195
|
+
--mode <full> Pipeline mode (v6.2.0 ships 'full' only — scan → spec → plan → implement)
|
|
196
|
+
--phases <a,b,c> Explicit phase list (comma-separated; overrides --mode)
|
|
197
|
+
--budget <usd> Run-scope budget cap (USD). Cross-phase — actualSoFar accumulates across phases.
|
|
198
|
+
--engine Run under the v6 Run State Engine (REQUIRED — engine-off is rejected)
|
|
199
|
+
--no-engine REJECTED — orchestrator requires engine-on (rejected at pre-flight, exit 1)
|
|
200
|
+
|
|
201
|
+
Behavior: drives N pipeline phases under ONE runId so a \`runs watch <id>\`
|
|
202
|
+
window covers the whole pipeline. Sequential — no parallel
|
|
203
|
+
execution. Non-interactive — pause budget decisions hard-fail.
|
|
204
|
+
Exit codes: 0 success, 78 budget_exceeded, 2 engine error
|
|
205
|
+
(lock_held / corrupted_state / partial_write), 1 everything else.
|
|
206
|
+
Resume a failed pipeline via \`claude-autopilot run resume <id>\`.
|
|
207
|
+
|
|
208
|
+
v6.2.0 ships scan / spec / plan / implement only. \`migrate\` and \`pr\`
|
|
209
|
+
land in v6.2.1 once their per-phase idempotency contracts (preflight
|
|
210
|
+
readback + externalRef recorded BEFORE side-effect) are wired. The
|
|
211
|
+
--mode=fix and --mode=review modes land in v6.2.1+; --json envelope
|
|
212
|
+
lands in v6.2.2.
|
|
213
|
+
|
|
214
|
+
Examples:
|
|
215
|
+
claude-autopilot autopilot
|
|
216
|
+
claude-autopilot autopilot --budget 25
|
|
217
|
+
claude-autopilot autopilot --phases=scan,spec,plan`,
|
|
218
|
+
implement: `Options (implement):
|
|
219
|
+
--context <text> Optional context note injected into the implement log
|
|
220
|
+
--plan <path> Plan file the implement phase consumed (e.g. docs/plans/<slug>.md)
|
|
221
|
+
--output <path> Where to write the implement log (default: .guardrail-cache/implement/<ts>-implement.md)
|
|
222
|
+
--config <path> Path to config file
|
|
223
|
+
--engine Run under the v6 Run State Engine (writes .guardrail-cache/runs/<ulid>/)
|
|
224
|
+
--no-engine Force the legacy stateless code path (overrides config / env)
|
|
225
|
+
|
|
226
|
+
Note: implement is primarily a Claude Code skill (claude-autopilot — reads
|
|
227
|
+
plan, dispatches subagents per plan phase via subagent-driven-development,
|
|
228
|
+
writes code, runs tests, commits, optionally pushes via commit-push-pr).
|
|
229
|
+
The CLI verb is an engine-wrap shell; engine-on still produces a
|
|
230
|
+
run-state snapshot (state.json + events.ndjson) for pipeline
|
|
231
|
+
introspection. The v6.0.7 wrap declares idempotent: true,
|
|
232
|
+
hasSideEffects: false because the CLI verb writes a local log stub
|
|
233
|
+
only — no git push, no PR creation. If a future PR inlines the
|
|
234
|
+
implement loop into the CLI verb, the declarations flip to match
|
|
235
|
+
the spec table (idempotent: false, hasSideEffects: true,
|
|
236
|
+
externalRefs: git-remote-push). See src/cli/implement.ts deviation
|
|
237
|
+
note for the full rationale.`,
|
|
238
|
+
watch: `Options (watch):
|
|
239
|
+
--config <path> Path to config file (default: ./guardrail.config.yaml)
|
|
240
|
+
--debounce <ms> Debounce delay in ms (default: 300)`,
|
|
241
|
+
autoregress: `Options (autoregress):
|
|
242
|
+
--all Run/diff all snapshots
|
|
243
|
+
--since <ref> Git ref for changed-files detection
|
|
244
|
+
--snapshot <slug> Target a single snapshot
|
|
245
|
+
--files <a,b,c> Explicit file list for generate (skips git detection)`,
|
|
246
|
+
migrate: `Options (migrate):
|
|
247
|
+
--env <name> Target environment from .autopilot/stack.md (default: dev)
|
|
248
|
+
--dry-run Run skill in dry-run mode (no side effects)
|
|
249
|
+
--yes Required to apply prod migrations in CI
|
|
250
|
+
--config <path> Path to config file (default: ./guardrail.config.yaml)
|
|
251
|
+
--engine Run under the v6 Run State Engine (writes .guardrail-cache/runs/<ulid>/)
|
|
252
|
+
--no-engine Force the legacy stateless code path (overrides config / env)
|
|
253
|
+
|
|
254
|
+
Note: migrate is a side-effecting phase — re-running with --engine after a
|
|
255
|
+
prior phase.success requires --force-replay (Phase 6+) because the
|
|
256
|
+
engine cannot read back \`migration_state\` yet. Each applied
|
|
257
|
+
migration emits a \`migration-version\` externalRef under the run
|
|
258
|
+
for the resume gate.`,
|
|
259
|
+
'migrate-doctor': `Options (migrate doctor / migrate-doctor):
|
|
260
|
+
--fix Apply auto-fixable mutations (legacy stack.md, skills/migrate/, schema_version)`,
|
|
261
|
+
runs: `Sub-verbs (runs):
|
|
262
|
+
runs list List runs newest-first
|
|
263
|
+
runs show <id> Show a run's state + last events
|
|
264
|
+
runs watch <id> Tail events.ndjson with a live cost meter
|
|
265
|
+
runs gc Delete completed runs older than N days
|
|
266
|
+
runs delete <id> Delete a single run (terminal-status only)
|
|
267
|
+
runs doctor Replay events vs. state.json; report drift
|
|
268
|
+
run resume <id> Lookup-only: identify the next phase + decision
|
|
269
|
+
|
|
270
|
+
Options (runs list):
|
|
271
|
+
--status <s> Filter: pending | running | paused | completed | failed | aborted
|
|
272
|
+
--json Emit a structured JSON envelope on stdout
|
|
273
|
+
|
|
274
|
+
Options (runs show):
|
|
275
|
+
<id> ULID of the run to inspect
|
|
276
|
+
--events Tail events.ndjson after the state summary
|
|
277
|
+
--events-tail <n> How many tail events to show (default 20)
|
|
278
|
+
--json Emit a structured JSON envelope on stdout
|
|
279
|
+
|
|
280
|
+
Options (runs watch):
|
|
281
|
+
<id> ULID of the run to watch
|
|
282
|
+
--since <seq> Replay forward from a specific event seq (resume after disconnect)
|
|
283
|
+
--no-follow Render the current state once and exit (snapshot mode)
|
|
284
|
+
--json Emit raw NDJSON to stdout (one event per line) — ANSI suppressed
|
|
285
|
+
--no-color Force ANSI off even on a TTY
|
|
286
|
+
|
|
287
|
+
Behavior: tails events.ndjson via fs.watchFile (1s poll) and pretty-renders
|
|
288
|
+
each new event with a running cost/budget meter. Exits when the
|
|
289
|
+
run terminates (run.complete / run.failed / run.aborted) or on
|
|
290
|
+
Ctrl-C. Exit codes: 0 success, 1 invalid input or stream error,
|
|
291
|
+
2 not_found.
|
|
292
|
+
|
|
293
|
+
Options (runs gc):
|
|
294
|
+
--older-than-days <n> Cutoff in days (default 30)
|
|
295
|
+
--dry-run Preview deletions without touching disk
|
|
296
|
+
--yes Skip the confirmation prompt
|
|
297
|
+
--json Emit a structured JSON envelope on stdout
|
|
298
|
+
|
|
299
|
+
Options (runs delete):
|
|
300
|
+
<id> ULID of the run to delete
|
|
301
|
+
--force Override the terminal-status guard (dangerous)
|
|
302
|
+
--json Emit a structured JSON envelope on stdout
|
|
303
|
+
|
|
304
|
+
Options (runs doctor):
|
|
305
|
+
<id> Limit the check to a single run id (optional)
|
|
306
|
+
--fix Rewrite state.json from events.ndjson where drift is found
|
|
307
|
+
--json Emit a structured JSON envelope on stdout
|
|
308
|
+
|
|
309
|
+
Options (run resume):
|
|
310
|
+
<id> ULID of the run to look up
|
|
311
|
+
--from-phase <name> Resume target phase by name (must exist on the run)
|
|
312
|
+
--json Emit a structured JSON envelope on stdout
|
|
313
|
+
|
|
314
|
+
NOTE: \`run resume\` in v6 Phase 3 is LOOKUP-ONLY. It identifies which phase
|
|
315
|
+
would resume from and the decision rationale (retry, skip-idempotent,
|
|
316
|
+
needs-human, already-complete) without actually executing the phase.
|
|
317
|
+
Real execution wires in v6 Phase 6+.`,
|
|
318
|
+
deploy: `Options (deploy):
|
|
319
|
+
--adapter <vercel|fly|render|generic> Override deploy.adapter from config
|
|
320
|
+
--config <path> Path to config file
|
|
321
|
+
--ref <ref> Git ref (branch / tag) to deploy
|
|
322
|
+
--sha <commit> Specific commit SHA to deploy
|
|
323
|
+
--watch Stream build logs to stderr in real time (vercel: SSE; fly: WebSocket; render: REST polling)
|
|
324
|
+
--to <deploy-id> Target deploy ID for 'deploy rollback'
|
|
325
|
+
--pr <n> Post upserting deploy summary comment on the PR
|
|
326
|
+
|
|
327
|
+
Subcommands (deploy):
|
|
328
|
+
deploy Deploy via configured adapter
|
|
329
|
+
deploy rollback Roll back to previous prod deploy
|
|
330
|
+
deploy rollback --to <id> Roll back to a specific deploy
|
|
331
|
+
deploy status Show current prod + last 5 builds`,
|
|
332
|
+
};
|
|
333
|
+
/** Pad the verb column so summaries align across groups. */
|
|
334
|
+
function padVerb(verb) {
|
|
335
|
+
const WIDTH = 16;
|
|
336
|
+
return verb.length >= WIDTH ? verb + ' ' : verb + ' '.repeat(WIDTH - verb.length);
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* Global flags advertised in --help. These work across most verbs (per-verb
|
|
340
|
+
* support varies; v6.0.1 wires them into `scan` first, additional verbs land
|
|
341
|
+
* in subsequent v6.0.x point releases per docs/v6/wrapping-pipeline-phases.md).
|
|
342
|
+
*/
|
|
343
|
+
export const GLOBAL_FLAGS_BLOCK = `Global flags:
|
|
344
|
+
--json Emit a structured JSON envelope on stdout (most verbs)
|
|
345
|
+
--engine Run under the v6 Run State Engine (writes .guardrail-cache/runs/<ulid>/)
|
|
346
|
+
--no-engine Force the legacy stateless code path (overrides config / env)
|
|
347
|
+
Precedence: CLI > env (CLAUDE_AUTOPILOT_ENGINE) > config (engine.enabled) > built-in default
|
|
348
|
+
v6.0.1: wired for \`scan\`. v6.0.2: wired for \`fix\` and \`costs\`. v6.0.3: wired for \`brainstorm\` and \`spec\`. v6.0.4: wired for \`plan\` and \`review\`. v6.0.5: wired for \`validate\`. v6.0.7: wired for \`implement\`. v6.0.8: wired for \`migrate\`. v6.0.9: wired for \`pr\`. ALL 10 phases now wrapped — v6.0.x feature-complete.`;
|
|
349
|
+
/** Build the full two-level help text. Returned as a string so tests can assert against it without spawning. */
|
|
350
|
+
export function buildHelpText() {
|
|
351
|
+
const lines = [];
|
|
352
|
+
lines.push('');
|
|
353
|
+
lines.push('Usage: claude-autopilot <command> [options] (legacy alias: guardrail)');
|
|
354
|
+
lines.push('');
|
|
355
|
+
for (const group of HELP_GROUPS) {
|
|
356
|
+
lines.push(`\x1b[1m${group.name}:\x1b[0m \x1b[2m# ${group.tagline}\x1b[0m`);
|
|
357
|
+
for (const v of group.verbs) {
|
|
358
|
+
lines.push(` ${padVerb(v.verb)}${v.summary}`);
|
|
359
|
+
}
|
|
360
|
+
lines.push('');
|
|
361
|
+
}
|
|
362
|
+
lines.push(GLOBAL_FLAGS_BLOCK);
|
|
363
|
+
lines.push('');
|
|
364
|
+
for (const group of HELP_GROUPS) {
|
|
365
|
+
for (const v of group.verbs) {
|
|
366
|
+
const block = HELP_OPTIONS[v.verb];
|
|
367
|
+
if (block) {
|
|
368
|
+
lines.push(block);
|
|
369
|
+
lines.push('');
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
lines.push('Run \x1b[36mclaude-autopilot help <command>\x1b[0m for command-specific options.');
|
|
374
|
+
return lines.join('\n') + '\n';
|
|
375
|
+
}
|
|
376
|
+
/** Build help text for a single verb. Returns null if the verb is unknown. */
|
|
377
|
+
export function buildCommandHelpText(verb) {
|
|
378
|
+
for (const group of HELP_GROUPS) {
|
|
379
|
+
const match = group.verbs.find(v => v.verb === verb);
|
|
380
|
+
if (match) {
|
|
381
|
+
const lines = [];
|
|
382
|
+
lines.push('');
|
|
383
|
+
lines.push(`Usage: claude-autopilot ${verb} [options]`);
|
|
384
|
+
lines.push('');
|
|
385
|
+
lines.push(` ${padVerb(match.verb)}${match.summary}`);
|
|
386
|
+
lines.push(` \x1b[2m(group: ${group.name} — ${group.tagline})\x1b[0m`);
|
|
387
|
+
lines.push('');
|
|
388
|
+
const block = HELP_OPTIONS[verb];
|
|
389
|
+
if (block) {
|
|
390
|
+
lines.push(block);
|
|
391
|
+
lines.push('');
|
|
392
|
+
}
|
|
393
|
+
return lines.join('\n');
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
return null;
|
|
397
|
+
}
|
|
398
|
+
/** Set of verbs that have a row in HELP_GROUPS — used by `help <verb>` lookup and by tests. */
|
|
399
|
+
export const HELP_VERBS = HELP_GROUPS.flatMap(g => g.verbs.map(v => v.verb));
|
|
400
|
+
//# sourceMappingURL=help-text.js.map
|