@delegance/claude-autopilot 5.0.0-alpha.1 → 5.0.0-alpha.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 CHANGED
@@ -1,5 +1,28 @@
1
1
  # Changelog
2
2
 
3
+ ## [5.0.0-alpha.2] — 2026-04-24
4
+
5
+ ### Added
6
+ - **v4 compatibility assertion matrix** at `tests/v4-compat/` — 20 pinned invocations covering version/help, subcommand routing for all v4 names, deterministic reads (doctor, costs, baseline, explain), flag parsing (`--base`, `--format`, `--fail-on`), deprecation-notice behavior, and the new grouped verbs. Uses marker/regex assertions, not full stdout snapshots — still catches routing and parsing regressions, which is the intent. Full normalized-stdout snapshots for deterministic commands are a follow-up item. Regression of any test blocks future alpha promotion.
7
+ - **Superpowers peer-dep detection** — `doctor` now reports a warn-level check for `superpowers:writing-plans`, `superpowers:using-git-worktrees`, `superpowers:subagent-driven-development`. Missing skills produce an actionable remediation hint (`claude plugin install superpowers`). Treated as warn not fail because review-only users don't need it; pipeline phases will hard-fail at their own entry point.
8
+ - **Grouped CLI verbs (phase 1: additive aliases)** — `claude-autopilot review <verb>` accepts `{run, scan, ci, fix, baseline, explain, watch, report}`. `claude-autopilot advanced <verb>` accepts `{lsp, mcp, worker, autoregress, test-gen, hook, detector, ignore}`. Both are additive aliases — flat forms (`claude-autopilot run`) continue to work unchanged. Broader restructuring (pipeline verbs `migrate`/`validate` top-level, `pr {create,comment,desc}`) is a later-alpha item.
9
+ - **`peerDependencies.superpowers`** (optional) declared in `package.json`.
10
+ - `src/cli/preflight.ts`: `findMissingSuperpowersSkills()` exported with recursive search across `~/.claude/plugins/**` and project-local `.claude/plugins/**`.
11
+
12
+ ### Fixed
13
+ - **`--help` / `-h` routed to `run`** (latent v4 bug). v4's dispatcher defaulted the subcommand to `run` when `args[0]` started with `--`, so `guardrail --help` silently executed a review instead of printing help. v5.0.0-alpha.2 intercepts `--help`/`-h` before subcommand defaulting and routes to the help handler. Surfaced by the new v4 compat matrix.
14
+ - **`--help` output missing 8 v4 subcommands** — `setup`, `preflight`, `hook`, `baseline`, `triage`, `pr-desc`, `council`, `mcp` were listed in the `SUBCOMMANDS` array but not in `printUsage()`. Help now lists all 20+.
15
+
16
+ ### Changed
17
+ - README install instructions now pin `@alpha` explicitly for the v5 alpha cycle. The npm `latest` tag still points at a pre-rename 2.5.0 release; without pinning, bare installs silently regress to old code. When 5.0.0 GA ships, `latest` advances and the `@alpha` pin becomes optional.
18
+ - Migration guide updated with the `@alpha` pinning note for `npm install`, GitHub Actions, and Dockerfile examples.
19
+
20
+ ### Still deferred to alpha.3
21
+ - Tombstone `@delegance/guardrail@5.0.0` with thin CLI wrapper and strict argv/stdio passthrough.
22
+ - CI bin-parity smoke tests (`npx guardrail`, `npx @delegance/guardrail`, global install, GitHub Actions).
23
+ - Codemod script `claude-autopilot migrate-v4 [--write]`.
24
+ - Compiled JS entrypoint (drops `tsx` runtime dep).
25
+
3
26
  ## [5.0.0-alpha.1] — 2026-04-24
4
27
 
5
28
  **Package renamed: `@delegance/guardrail` → `@delegance/claude-autopilot`.**
package/README.md CHANGED
@@ -39,11 +39,11 @@ The architectural differences that matter most in practice:
39
39
  ## 30-second quickstart
40
40
 
41
41
  ```bash
42
- # Install
43
- npm install -g @delegance/claude-autopilot
42
+ # Install (alpha channel — use @alpha through the v5 alpha cycle)
43
+ npm install -g @delegance/claude-autopilot@alpha
44
44
 
45
45
  # One-shot setup — detects stack, writes config, installs skills, sets hooks
46
- npx claude-autopilot init
46
+ npx claude-autopilot@alpha init
47
47
 
48
48
  # Ship a feature end-to-end
49
49
  claude-autopilot brainstorm "add rate limiting to the public API"
@@ -98,13 +98,18 @@ claude-autopilot fix --verify # LLM patch + test gate + rever
98
98
  ## Install & requirements
99
99
 
100
100
  ```bash
101
- npm install -g @delegance/claude-autopilot
101
+ # v5 alpha — current release channel
102
+ npm install -g @delegance/claude-autopilot@alpha
103
+
104
+ # When 5.0.0 GA ships, the `latest` tag will advance and you can drop the @alpha:
105
+ # npm install -g @delegance/claude-autopilot
102
106
  ```
103
107
 
104
108
  - Node 22+
105
109
  - `gh` CLI (for PR phases)
106
110
  - One of: `ANTHROPIC_API_KEY` (recommended), `OPENAI_API_KEY`, `GEMINI_API_KEY`, or `GROQ_API_KEY`
107
111
  - Claude Code CLI (for skill-based phases — pipeline falls back to direct CLI invocations without it, but loses interactive checkpoints)
112
+ - `superpowers` Claude Code plugin (required for pipeline phases — `claude-autopilot doctor` will remediation-hint if missing)
108
113
 
109
114
  ---
110
115
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@delegance/claude-autopilot",
3
- "version": "5.0.0-alpha.1",
3
+ "version": "5.0.0-alpha.2",
4
4
  "type": "module",
5
5
  "description": "Autonomous development pipeline for Claude Code: brainstorm → spec → plan → implement → migrate → validate → PR → review → merge. Multi-model, local-first, every phase a skill you can intervene in.",
6
6
  "keywords": [
@@ -64,5 +64,13 @@
64
64
  "@types/js-yaml": "^4",
65
65
  "@types/node": "^25",
66
66
  "typescript": "^6"
67
+ },
68
+ "peerDependencies": {
69
+ "superpowers": "*"
70
+ },
71
+ "peerDependenciesMeta": {
72
+ "superpowers": {
73
+ "optional": true
74
+ }
67
75
  }
68
76
  }
package/src/cli/index.ts CHANGED
@@ -40,6 +40,81 @@ if (args[0] === '--version' || args[0] === '-v') {
40
40
  process.exit(0);
41
41
  }
42
42
 
43
+ // Help flag — route to help handler explicitly before subcommand defaulting.
44
+ // Without this, `--help` falls through the "args[0].startsWith('--')" check below
45
+ // and defaults to `run`, which is surprising and a v4 regression we preserve no longer.
46
+ if (args[0] === '--help' || args[0] === '-h') {
47
+ args.unshift('help');
48
+ args.splice(1, 1); // remove the original --help/-h token
49
+ }
50
+
51
+ // Verb grouping (new in alpha.2): `claude-autopilot review <verb>` and
52
+ // `claude-autopilot advanced <verb>` are dispatcher prefixes that route to the
53
+ // same flat handlers. Legacy flat invocation (`claude-autopilot run`) is unchanged
54
+ // — the grouped form is purely additive.
55
+ //
56
+ // Scope gates enforce that only the documented verb sets work under each prefix,
57
+ // so `claude-autopilot review doctor` is rejected with a clear error instead of
58
+ // silently routing to the doctor handler (which would confuse the mental model).
59
+ const REVIEW_VERBS = new Set(['run', 'scan', 'ci', 'fix', 'baseline', 'explain', 'watch', 'report']);
60
+ // `detector` is a library used by setup/run, not a CLI subcommand — leave it out.
61
+ const ADVANCED_VERBS = new Set(['lsp', 'mcp', 'worker', 'autoregress', 'test-gen', 'hook', 'ignore']);
62
+ if (args[0] === 'review') {
63
+ const sub = args[1];
64
+ if (!sub || sub === '--help' || sub === '-h') {
65
+ console.log(`
66
+ Usage: claude-autopilot review <verb> [options]
67
+
68
+ Review-phase verbs:
69
+ run Review git-changed files (default)
70
+ scan Review any path — no git required
71
+ ci Opinionated CI entrypoint (post comments + SARIF)
72
+ fix Auto-fix cached findings using the configured LLM
73
+ baseline Manage the committed findings baseline
74
+ explain Deep-dive explanation + remediation for a specific finding
75
+ watch Watch for file changes and re-run on each save
76
+ report Render cached findings as a markdown report
77
+
78
+ These are aliases for the flat subcommands — \`claude-autopilot run\` and
79
+ \`claude-autopilot review run\` are equivalent.
80
+ `);
81
+ process.exit(0);
82
+ }
83
+ if (!REVIEW_VERBS.has(sub)) {
84
+ console.error(`\x1b[31m[claude-autopilot] "${sub}" is not a review-phase verb.\x1b[0m`);
85
+ console.error(`\x1b[2m Valid: ${[...REVIEW_VERBS].join(', ')}\x1b[0m`);
86
+ console.error(`\x1b[2m Did you mean: claude-autopilot ${sub} ...?\x1b[0m`);
87
+ process.exit(1);
88
+ }
89
+ args.shift(); // drop 'review', leave the flat subcommand at args[0]
90
+ }
91
+ if (args[0] === 'advanced') {
92
+ const sub = args[1];
93
+ if (!sub || sub === '--help' || sub === '-h') {
94
+ console.log(`
95
+ Usage: claude-autopilot advanced <verb> [options]
96
+
97
+ Advanced / niche verbs (hidden from top-level --help to keep it readable):
98
+ lsp Language server — publishes findings as LSP diagnostics
99
+ mcp MCP server for Claude / ChatGPT integration
100
+ worker Persistent review daemon (start|stop|status)
101
+ autoregress Snapshot regression tests
102
+ test-gen Generate test cases for uncovered exports
103
+ hook Install / remove the pre-push git hook
104
+ ignore Edit the findings ignore list
105
+
106
+ These are aliases for the flat subcommands; they still work without the 'advanced' prefix.
107
+ `);
108
+ process.exit(0);
109
+ }
110
+ if (!ADVANCED_VERBS.has(sub)) {
111
+ console.error(`\x1b[31m[claude-autopilot] "${sub}" is not an advanced verb.\x1b[0m`);
112
+ console.error(`\x1b[2m Valid: ${[...ADVANCED_VERBS].join(', ')}\x1b[0m`);
113
+ process.exit(1);
114
+ }
115
+ args.shift(); // drop 'advanced'
116
+ }
117
+
43
118
  const SUBCOMMANDS = ['init', 'run', 'scan', 'report', 'explain', 'ignore', 'ci', 'pr', 'fix', 'costs', 'watch', 'hook', 'autoregress', 'baseline', 'triage', 'lsp', 'worker', 'mcp', 'test-gen', 'pr-desc', 'doctor', 'preflight', 'setup', 'council', 'help', '--help', '-h'] as const;
44
119
  const VALUE_FLAGS = ['base', 'config', 'files', 'format', 'output', 'debounce', 'ask', 'focus', 'fail-on', 'note', 'reason', 'expires', 'profile', 'severity', 'prompt', 'context-file'];
45
120
 
@@ -108,7 +183,15 @@ Commands:
108
183
  costs Show per-run cost summary
109
184
  ci Opinionated CI entrypoint (post comments + SARIF)
110
185
  init Scaffold guardrail.config.yaml from a preset
186
+ setup Auto-detect stack, write config, install pre-push hook
111
187
  doctor Check prerequisites (alias: preflight)
188
+ preflight Check prerequisites (alias: doctor)
189
+ hook Install / remove the pre-push git hook
190
+ baseline Manage the committed findings baseline (create|update|show|delete)
191
+ triage Mark individual findings as accepted/dismissed
192
+ pr-desc Generate a PR title / summary / test plan from the current diff
193
+ council Multi-model review — dispatch the diff to N models and synthesize consensus
194
+ mcp MCP server for Claude / ChatGPT integration
112
195
  autoregress Snapshot regression tests (run|diff|update|generate)
113
196
  lsp Language server — publishes findings as LSP diagnostics (stdin/stdout)
114
197
  worker Persistent review daemon for multi-terminal parallel usage (start|stop|status)
@@ -22,6 +22,87 @@ export interface DoctorResult {
22
22
  warnings: number;
23
23
  }
24
24
 
25
+ /**
26
+ * Checks that the superpowers plugin skills required by the pipeline are resolvable
27
+ * from the usual Claude Code plugin paths. Returns skill names that weren't found.
28
+ */
29
+ const REQUIRED_SUPERPOWERS_SKILLS = [
30
+ 'writing-plans',
31
+ 'using-git-worktrees',
32
+ 'subagent-driven-development',
33
+ ] as const;
34
+
35
+ function skillRoots(): string[] {
36
+ const home = process.env.HOME || process.env.USERPROFILE || '';
37
+ const cwd = process.cwd();
38
+ const roots: string[] = [];
39
+ // Project-local plugin install
40
+ roots.push(path.join(cwd, '.claude', 'plugins'));
41
+ // User-global plugin install
42
+ if (home) roots.push(path.join(home, '.claude', 'plugins'));
43
+ return roots.filter(p => fs.existsSync(p));
44
+ }
45
+
46
+ export function findMissingSuperpowersSkills(): string[] {
47
+ // Traverse each root once, collect all discovered skill names, then diff against
48
+ // the required set. Previous implementation did N × roots separate recursive walks.
49
+ const discovered = new Set<string>();
50
+ const MAX_DIRS_PER_ROOT = 2000; // safety cap to prevent pathological plugin trees
51
+
52
+ for (const root of skillRoots()) {
53
+ collectSkills(root, discovered, { visited: { n: 0 }, max: MAX_DIRS_PER_ROOT });
54
+ }
55
+
56
+ return REQUIRED_SUPERPOWERS_SKILLS.filter(s => !discovered.has(s));
57
+ }
58
+
59
+ // Walks up to 8 levels deep, capped at `max` directories total. When it finds a
60
+ // `skills/` directory, records every `<skill-name>/SKILL.md` and `<skill-name>.md`
61
+ // entry directly into the Set. Never revisits by name (Claude Code plugin caches
62
+ // can contain many parallel copies — we only care whether a skill exists *somewhere*).
63
+ function collectSkills(
64
+ dir: string,
65
+ out: Set<string>,
66
+ ctx: { visited: { n: number }; max: number },
67
+ depth = 0,
68
+ ): void {
69
+ if (depth > 8) return;
70
+ if (ctx.visited.n >= ctx.max) return;
71
+ ctx.visited.n++;
72
+
73
+ let entries: fs.Dirent[];
74
+ try {
75
+ entries = fs.readdirSync(dir, { withFileTypes: true });
76
+ } catch {
77
+ return;
78
+ }
79
+
80
+ // If this dir has a skills/ child, record every skill inside it
81
+ for (const entry of entries) {
82
+ if (entry.isDirectory() && entry.name === 'skills') {
83
+ const skillsDir = path.join(dir, 'skills');
84
+ try {
85
+ for (const skill of fs.readdirSync(skillsDir, { withFileTypes: true })) {
86
+ if (skill.isDirectory() && fs.existsSync(path.join(skillsDir, skill.name, 'SKILL.md'))) {
87
+ out.add(skill.name);
88
+ } else if (skill.isFile() && skill.name.endsWith('.md') && skill.name !== 'README.md') {
89
+ out.add(skill.name.slice(0, -3)); // strip .md
90
+ }
91
+ }
92
+ } catch { /* ignore */ }
93
+ }
94
+ }
95
+
96
+ // Recurse into non-skills dirs (bounded depth + visit cap prevent pathological scans)
97
+ for (const entry of entries) {
98
+ if (!entry.isDirectory()) continue;
99
+ if (entry.name.startsWith('.')) continue;
100
+ if (entry.name === 'node_modules') continue;
101
+ if (entry.name === 'skills') continue; // already handled above
102
+ collectSkills(path.join(dir, entry.name), out, ctx, depth + 1);
103
+ }
104
+ }
105
+
25
106
  export async function runDoctor(): Promise<DoctorResult> {
26
107
  const checks: Check[] = [];
27
108
 
@@ -106,6 +187,19 @@ export async function runDoctor(): Promise<DoctorResult> {
106
187
  : undefined,
107
188
  });
108
189
 
190
+ // 9. Superpowers plugin — required for pipeline phases, optional for review-only use
191
+ const missingSkills = findMissingSuperpowersSkills();
192
+ const allSkillsFound = missingSkills.length === 0;
193
+ checks.push({
194
+ name: `Superpowers plugin${allSkillsFound ? '' : ` (missing: ${missingSkills.join(', ')})`}`,
195
+ // Treat as warn, not fail — users who only run `claude-autopilot run` (review phase)
196
+ // don't need superpowers. Pipeline invocations (`autopilot` skill) will hard-fail at
197
+ // their own entry point.
198
+ result: allSkillsFound ? 'pass' : 'warn',
199
+ message: !allSkillsFound
200
+ ? 'Install: `claude plugin install superpowers` (required for pipeline phases — brainstorm/plan/implement)'
201
+ : undefined,
202
+ });
109
203
 
110
204
  // Print results
111
205
  console.log('\n\x1b[1m[doctor] Guardrail prerequisite check\x1b[0m\n');