@delegance/claude-autopilot 1.0.0-alpha.7 → 1.0.0-alpha.8
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 +8 -0
- package/README.md +134 -33
- package/package.json +1 -1
- package/src/cli/autoregress-bridge.ts +30 -0
- package/src/cli/index.ts +15 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.0.0-alpha.8
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- **`autopilot autoregress`** — `autoregress run|diff|update|generate` now a first-class `autopilot` subcommand (no more raw `npx tsx scripts/autoregress.ts`)
|
|
8
|
+
- **GitHub Actions CI** — `.github/workflows/ci.yml` runs typecheck + tests on every PR; auto-publishes to npm on `v*` tags
|
|
9
|
+
- **README rewrite** — full feature documentation covering all alphas (all commands, config, GitHub Actions, snapshot regression, architecture)
|
|
10
|
+
|
|
3
11
|
## 1.0.0-alpha.7
|
|
4
12
|
|
|
5
13
|
### Added
|
package/README.md
CHANGED
|
@@ -1,58 +1,159 @@
|
|
|
1
|
-
# claude-autopilot
|
|
1
|
+
# @delegance/claude-autopilot
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Automated code review pipeline for Claude Code. Runs static rules, an optional LLM review engine, and impact-aware snapshot regression tests — outputs SARIF for GitHub Code Scanning, inline PR annotations, and a pre-push hook for local enforcement.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Install
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
```bash
|
|
8
|
+
npm install --save-dev @delegance/claude-autopilot@alpha
|
|
9
|
+
```
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
Requires Node 22+.
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
- YAML config (`autopilot.config.yaml`) replaces `.autopilot/stack.md`
|
|
14
|
-
- Unified `Finding` type across validate + review-bot, with separate `TriageRecord[]` / `FixAttempt[]` history
|
|
15
|
-
- Merged static-rules phase with global re-check after autofix
|
|
16
|
-
- `AutopilotError` taxonomy with per-code retry policy
|
|
17
|
-
- `apiVersion` + `getCapabilities()` on every adapter
|
|
18
|
-
- Real tests phase — runs `testCommand` from config, emits critical finding on failure
|
|
19
|
-
- NDJSON event log with secret redaction
|
|
13
|
+
## Quick Start
|
|
20
14
|
|
|
21
|
-
|
|
15
|
+
```bash
|
|
16
|
+
# Scaffold config
|
|
17
|
+
npx autopilot init
|
|
22
18
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
- `OPENAI_API_KEY` in `.env.local`
|
|
19
|
+
# Run on changed files
|
|
20
|
+
npx autopilot run
|
|
26
21
|
|
|
27
|
-
|
|
22
|
+
# Watch mode (re-runs on every file save)
|
|
23
|
+
npx autopilot watch
|
|
24
|
+
|
|
25
|
+
# Install pre-push hook
|
|
26
|
+
npx autopilot hook install
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Commands
|
|
30
|
+
|
|
31
|
+
### `autopilot run`
|
|
32
|
+
|
|
33
|
+
Runs the pipeline on git-changed files vs the base ref.
|
|
28
34
|
|
|
29
35
|
```bash
|
|
30
|
-
|
|
36
|
+
npx autopilot run # diff against HEAD~1
|
|
37
|
+
npx autopilot run --base main # diff against main
|
|
38
|
+
npx autopilot run --files src/foo.ts # explicit file list
|
|
39
|
+
npx autopilot run --format sarif --output results.sarif
|
|
40
|
+
npx autopilot run --dry-run # show what would run, no execution
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### `autopilot watch`
|
|
44
|
+
|
|
45
|
+
Debounced re-run on every file save.
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
npx autopilot watch
|
|
49
|
+
npx autopilot watch --debounce 500
|
|
31
50
|
```
|
|
32
51
|
|
|
33
|
-
|
|
52
|
+
### `autopilot hook`
|
|
34
53
|
|
|
35
|
-
|
|
54
|
+
Manages a `pre-push` git hook that runs snapshot regression tests before every push.
|
|
36
55
|
|
|
37
56
|
```bash
|
|
38
|
-
npx autopilot #
|
|
57
|
+
npx autopilot hook install # write .git/hooks/pre-push
|
|
58
|
+
npx autopilot hook install --force # overwrite existing
|
|
59
|
+
npx autopilot hook uninstall # remove
|
|
60
|
+
npx autopilot hook status # show installed hook content
|
|
39
61
|
```
|
|
40
62
|
|
|
41
|
-
|
|
63
|
+
Works in git worktrees (handles `.git` as a file pointer).
|
|
64
|
+
|
|
65
|
+
### `autopilot autoregress`
|
|
66
|
+
|
|
67
|
+
Impact-aware snapshot regression testing. Only fires tests whose source modules (or one-hop importers) were touched by the current branch.
|
|
42
68
|
|
|
43
69
|
```bash
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
npx
|
|
70
|
+
npx autopilot autoregress run # impact-selected snapshots (default)
|
|
71
|
+
npx autopilot autoregress run --all # all snapshots
|
|
72
|
+
npx autopilot autoregress diff # show JSON diffs vs baselines
|
|
73
|
+
npx autopilot autoregress update # overwrite baselines with current output
|
|
74
|
+
npx autopilot autoregress generate # LLM-generate snapshot tests for changed files
|
|
75
|
+
npx autopilot autoregress generate --files src/foo.ts,src/bar.ts
|
|
47
76
|
```
|
|
48
77
|
|
|
49
|
-
|
|
78
|
+
Requires `OPENAI_API_KEY` for `generate` mode.
|
|
79
|
+
|
|
80
|
+
### `autopilot init`
|
|
81
|
+
|
|
82
|
+
Scaffolds `autopilot.config.yaml` from a preset.
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
npx autopilot init
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Available presets: `nextjs-supabase`, `t3`, `python-fastapi`, `rails-postgres`, `go`.
|
|
89
|
+
|
|
90
|
+
### `autopilot preflight`
|
|
91
|
+
|
|
92
|
+
Checks prerequisites (Node version, `gh` CLI auth, `OPENAI_API_KEY`).
|
|
93
|
+
|
|
94
|
+
## GitHub Actions
|
|
95
|
+
|
|
96
|
+
Add to your workflow:
|
|
97
|
+
|
|
98
|
+
```yaml
|
|
99
|
+
- uses: axledbetter/claude-autopilot@v1
|
|
100
|
+
with:
|
|
101
|
+
openai-api-key: ${{ secrets.OPENAI_API_KEY }}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Runs the pipeline, uploads SARIF to GitHub Code Scanning, and annotates the PR diff inline.
|
|
105
|
+
|
|
106
|
+
## SARIF Output
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
npx autopilot run --format sarif --output autopilot.sarif
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Compatible with `github/codeql-action/upload-sarif@v3`.
|
|
113
|
+
|
|
114
|
+
## Config (`autopilot.config.yaml`)
|
|
115
|
+
|
|
116
|
+
```yaml
|
|
117
|
+
preset: nextjs-supabase # inherit a base config
|
|
118
|
+
reviewEngine:
|
|
119
|
+
adapter: codex
|
|
120
|
+
options:
|
|
121
|
+
model: gpt-5.3-codex
|
|
122
|
+
testCommand: npm test
|
|
123
|
+
protect:
|
|
124
|
+
- src/core/**
|
|
125
|
+
- data/deltas/**
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Snapshot Regression Testing
|
|
129
|
+
|
|
130
|
+
After each feature lands, generate behavioral baselines:
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
npx autopilot autoregress generate
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Future PRs automatically fail if covered behavior diverges. The impact selector uses `git merge-base` diff + one-hop import graph expansion so only relevant snapshots run — keeping CI token-efficient.
|
|
137
|
+
|
|
138
|
+
High-impact paths (`src/core/pipeline/**`, `src/adapters/**`, `src/core/findings/**`, `src/core/config/**`) always trigger a full run.
|
|
139
|
+
|
|
140
|
+
## Architecture
|
|
141
|
+
|
|
142
|
+
Four pluggable adapter points:
|
|
143
|
+
|
|
144
|
+
| Point | Built-in | Purpose |
|
|
145
|
+
|---|---|---|
|
|
146
|
+
| `review-engine` | `codex` | LLM code review |
|
|
147
|
+
| `vcs-host` | `github` | PR comments + SARIF upload |
|
|
148
|
+
| `migration-runner` | `supabase` | DB migration execution |
|
|
149
|
+
| `review-bot-parser` | `cursor` | Parse review bot comments |
|
|
150
|
+
|
|
151
|
+
## Requirements
|
|
50
152
|
|
|
51
|
-
-
|
|
52
|
-
-
|
|
53
|
-
-
|
|
54
|
-
- **beta → 1.0.0:** dogfood + npm publish
|
|
153
|
+
- Node ≥ 22
|
|
154
|
+
- `OPENAI_API_KEY` (optional — review engine and `autoregress generate` only)
|
|
155
|
+
- `gh` CLI authenticated (optional — PR creation / vcs-host adapter)
|
|
55
156
|
|
|
56
157
|
## License
|
|
57
158
|
|
|
58
|
-
MIT
|
|
159
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@delegance/claude-autopilot",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Claude Code automation pipeline: spec → plan → implement → validate → PR",
|
|
6
6
|
"keywords": ["claude", "autopilot", "ai", "pipeline", "code-review", "cli"],
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// src/cli/autoregress-bridge.ts
|
|
2
|
+
import * as path from 'node:path';
|
|
3
|
+
import { spawnSync } from 'node:child_process';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
|
+
|
|
6
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
7
|
+
const SCRIPT = path.resolve(__dirname, '../../scripts/autoregress.ts');
|
|
8
|
+
|
|
9
|
+
const VALID_MODES = ['run', 'update', 'generate', 'diff'];
|
|
10
|
+
|
|
11
|
+
export function buildAutoregressArgs(args: string[]): string[] {
|
|
12
|
+
const mode = args[0] && VALID_MODES.includes(args[0]) ? args[0] : 'run';
|
|
13
|
+
const rest = args[0] && VALID_MODES.includes(args[0]) ? args.slice(1) : args;
|
|
14
|
+
return [mode, ...rest];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function runAutoregress(args: string[]): number {
|
|
18
|
+
const resolvedArgs = buildAutoregressArgs(args);
|
|
19
|
+
const result = spawnSync(
|
|
20
|
+
process.execPath,
|
|
21
|
+
['--import', 'tsx', SCRIPT, ...resolvedArgs],
|
|
22
|
+
{ stdio: 'inherit', cwd: process.cwd() },
|
|
23
|
+
);
|
|
24
|
+
if (result.error) {
|
|
25
|
+
console.error(`[autoregress] failed to launch: ${result.error.message}`);
|
|
26
|
+
console.error(` script: ${SCRIPT}`);
|
|
27
|
+
return 1;
|
|
28
|
+
}
|
|
29
|
+
return result.status ?? 1;
|
|
30
|
+
}
|
package/src/cli/index.ts
CHANGED
|
@@ -16,7 +16,7 @@ import { runWatch } from './watch.ts';
|
|
|
16
16
|
|
|
17
17
|
const args = process.argv.slice(2);
|
|
18
18
|
|
|
19
|
-
const SUBCOMMANDS = ['init', 'run', 'preflight', 'help', '--help', '-h'] as const;
|
|
19
|
+
const SUBCOMMANDS = ['init', 'run', 'watch', 'hook', 'autoregress', 'preflight', 'help', '--help', '-h'] as const;
|
|
20
20
|
const VALUE_FLAGS = ['base', 'config', 'files', 'format', 'output', 'debounce'];
|
|
21
21
|
|
|
22
22
|
// Detect first non-flag arg as subcommand, default to 'run'
|
|
@@ -47,6 +47,7 @@ Commands:
|
|
|
47
47
|
watch Watch for file changes and re-run pipeline on each save
|
|
48
48
|
init Scaffold autopilot.config.yaml from a preset
|
|
49
49
|
preflight Check prerequisites
|
|
50
|
+
autoregress Run snapshot regression tests (run|diff|update|generate)
|
|
50
51
|
|
|
51
52
|
Options (run):
|
|
52
53
|
--base <ref> Git base ref for diff (default: HEAD~1)
|
|
@@ -59,6 +60,12 @@ Options (run):
|
|
|
59
60
|
Options (watch):
|
|
60
61
|
--config <path> Path to config file (default: ./autopilot.config.yaml)
|
|
61
62
|
--debounce <ms> Debounce delay in ms (default: 300)
|
|
63
|
+
|
|
64
|
+
Options (autoregress):
|
|
65
|
+
--all Run/diff all snapshots
|
|
66
|
+
--since <ref> Git ref for changed-files detection
|
|
67
|
+
--snapshot <slug> Target a single snapshot
|
|
68
|
+
--files <a,b,c> Explicit file list for generate (skips git detection)
|
|
62
69
|
`);
|
|
63
70
|
}
|
|
64
71
|
|
|
@@ -127,6 +134,13 @@ switch (subcommand) {
|
|
|
127
134
|
break;
|
|
128
135
|
}
|
|
129
136
|
|
|
137
|
+
case 'autoregress': {
|
|
138
|
+
const { runAutoregress } = await import('./autoregress-bridge.ts');
|
|
139
|
+
const code = runAutoregress(args.slice(1));
|
|
140
|
+
process.exit(code);
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
|
|
130
144
|
default:
|
|
131
145
|
console.error(`\x1b[31m[autopilot] Unknown subcommand: "${subcommand}"\x1b[0m`);
|
|
132
146
|
printUsage();
|