@delegance/claude-autopilot 1.2.1 → 1.2.3
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/README.md +68 -68
- package/package.json +1 -1
- package/src/cli/hook.ts +2 -2
- package/src/cli/setup.ts +1 -1
package/README.md
CHANGED
|
@@ -8,115 +8,126 @@ Automated code review pipeline for Claude Code. Runs static rules, an optional L
|
|
|
8
8
|
npm install @delegance/claude-autopilot
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
**Prerequisites:** Node 22+, [`gh` CLI](https://cli.github.com/) authenticated, [`claude` CLI](https://claude.ai/claude-code) (Claude Code).
|
|
12
12
|
|
|
13
13
|
## Quick Start
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
|
-
# One command — auto-detects project type, writes config, installs hook
|
|
16
|
+
# One command — auto-detects project type, writes config, installs hook, runs doctor
|
|
17
17
|
npx autopilot setup
|
|
18
18
|
|
|
19
|
-
#
|
|
19
|
+
# Run your first pipeline
|
|
20
20
|
npx autopilot run
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
`setup` detects your stack (Go, Rails, FastAPI, T3, Next.js+Supabase), infers your test command, writes `autopilot.config.yaml`, installs the pre-push hook, then runs `doctor` to show anything still missing.
|
|
24
24
|
|
|
25
25
|
## Commands
|
|
26
26
|
|
|
27
|
+
### `autopilot setup`
|
|
28
|
+
|
|
29
|
+
Zero-prompt setup. Auto-detects project type and configures everything.
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npx autopilot setup # detect, write config, install hook
|
|
33
|
+
npx autopilot setup --force # overwrite existing autopilot.config.yaml
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### `autopilot doctor`
|
|
37
|
+
|
|
38
|
+
Checks prerequisites. Runs automatically after `setup` — also useful any time `run` behaves unexpectedly.
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
npx autopilot doctor
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Verifies: Node 22+, tsx, `gh` CLI auth, `claude` CLI, `OPENAI_API_KEY`, git user config, superpowers plugin. Exits 1 if blockers found. `autopilot preflight` is an alias.
|
|
45
|
+
|
|
27
46
|
### `autopilot run`
|
|
28
47
|
|
|
29
|
-
Runs the pipeline on git-changed files
|
|
48
|
+
Runs the pipeline on git-changed files.
|
|
30
49
|
|
|
31
50
|
```bash
|
|
32
51
|
npx autopilot run # diff against HEAD~1
|
|
33
52
|
npx autopilot run --base main # diff against main
|
|
34
53
|
npx autopilot run --files src/foo.ts # explicit file list
|
|
35
54
|
npx autopilot run --format sarif --output results.sarif
|
|
36
|
-
npx autopilot run --dry-run
|
|
55
|
+
npx autopilot run --dry-run
|
|
37
56
|
```
|
|
38
57
|
|
|
39
58
|
### `autopilot watch`
|
|
40
59
|
|
|
41
|
-
|
|
60
|
+
Re-runs on every file save.
|
|
42
61
|
|
|
43
62
|
```bash
|
|
44
63
|
npx autopilot watch
|
|
45
64
|
npx autopilot watch --debounce 500
|
|
46
65
|
```
|
|
47
66
|
|
|
48
|
-
### `autopilot hook`
|
|
49
|
-
|
|
50
|
-
Manages a `pre-push` git hook that runs snapshot regression tests before every push.
|
|
51
|
-
|
|
52
|
-
```bash
|
|
53
|
-
npx autopilot hook install # write .git/hooks/pre-push
|
|
54
|
-
npx autopilot hook install --force # overwrite existing
|
|
55
|
-
npx autopilot hook uninstall # remove
|
|
56
|
-
npx autopilot hook status # show installed hook content
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
Works in git worktrees (handles `.git` as a file pointer).
|
|
60
|
-
|
|
61
67
|
### `autopilot autoregress`
|
|
62
68
|
|
|
63
|
-
Impact-aware snapshot regression
|
|
69
|
+
Impact-aware snapshot regression tests. Only fires snapshots whose source modules were touched by the current branch.
|
|
64
70
|
|
|
65
71
|
```bash
|
|
66
|
-
npx autopilot autoregress run # impact-selected
|
|
67
|
-
npx autopilot autoregress run --all
|
|
72
|
+
npx autopilot autoregress run # impact-selected (default)
|
|
73
|
+
npx autopilot autoregress run --all
|
|
68
74
|
npx autopilot autoregress diff # show JSON diffs vs baselines
|
|
69
|
-
npx autopilot autoregress update # overwrite baselines
|
|
75
|
+
npx autopilot autoregress update # overwrite baselines
|
|
70
76
|
npx autopilot autoregress generate # LLM-generate snapshot tests for changed files
|
|
71
77
|
npx autopilot autoregress generate --files src/foo.ts,src/bar.ts
|
|
72
78
|
```
|
|
73
79
|
|
|
74
|
-
|
|
80
|
+
`generate` requires `OPENAI_API_KEY`.
|
|
75
81
|
|
|
76
|
-
### `autopilot
|
|
82
|
+
### `autopilot hook`
|
|
77
83
|
|
|
78
|
-
|
|
84
|
+
Manages the `pre-push` git hook.
|
|
79
85
|
|
|
80
86
|
```bash
|
|
81
|
-
npx autopilot
|
|
82
|
-
npx autopilot
|
|
87
|
+
npx autopilot hook install # write .git/hooks/pre-push
|
|
88
|
+
npx autopilot hook install --force # overwrite existing
|
|
89
|
+
npx autopilot hook uninstall
|
|
90
|
+
npx autopilot hook status
|
|
83
91
|
```
|
|
84
92
|
|
|
85
|
-
|
|
93
|
+
Works in git worktrees.
|
|
86
94
|
|
|
87
95
|
### `autopilot init`
|
|
88
96
|
|
|
89
|
-
|
|
97
|
+
Interactive preset picker — for when you want to choose a preset manually instead of using `setup`.
|
|
90
98
|
|
|
91
99
|
```bash
|
|
92
100
|
npx autopilot init
|
|
93
101
|
```
|
|
94
102
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
### `autopilot doctor`
|
|
103
|
+
Presets: `nextjs-supabase`, `t3`, `python-fastapi`, `rails-postgres`, `go`.
|
|
98
104
|
|
|
99
|
-
|
|
105
|
+
## Config (`autopilot.config.yaml`)
|
|
100
106
|
|
|
101
|
-
```
|
|
102
|
-
|
|
107
|
+
```yaml
|
|
108
|
+
configVersion: 1
|
|
109
|
+
reviewEngine:
|
|
110
|
+
adapter: codex
|
|
111
|
+
testCommand: npm test
|
|
112
|
+
protectedPaths:
|
|
113
|
+
- src/core/**
|
|
114
|
+
- data/deltas/**
|
|
115
|
+
staticRules:
|
|
116
|
+
- hardcoded-secrets
|
|
117
|
+
- npm-audit
|
|
103
118
|
```
|
|
104
119
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
`autopilot preflight` is kept as an alias for `doctor`.
|
|
120
|
+
Full schema and preset defaults: `presets/<name>/autopilot.config.yaml`.
|
|
108
121
|
|
|
109
122
|
## GitHub Actions
|
|
110
123
|
|
|
111
|
-
Add to your workflow:
|
|
112
|
-
|
|
113
124
|
```yaml
|
|
114
|
-
- uses: axledbetter/claude-autopilot@
|
|
125
|
+
- uses: axledbetter/claude-autopilot/.github/actions/ci@main
|
|
115
126
|
with:
|
|
116
127
|
openai-api-key: ${{ secrets.OPENAI_API_KEY }}
|
|
117
128
|
```
|
|
118
129
|
|
|
119
|
-
Runs the pipeline, uploads SARIF to GitHub Code Scanning,
|
|
130
|
+
Runs the pipeline, uploads SARIF to GitHub Code Scanning, annotates the PR diff inline.
|
|
120
131
|
|
|
121
132
|
## SARIF Output
|
|
122
133
|
|
|
@@ -126,49 +137,38 @@ npx autopilot run --format sarif --output autopilot.sarif
|
|
|
126
137
|
|
|
127
138
|
Compatible with `github/codeql-action/upload-sarif@v3`.
|
|
128
139
|
|
|
129
|
-
## Config (`autopilot.config.yaml`)
|
|
130
|
-
|
|
131
|
-
```yaml
|
|
132
|
-
preset: nextjs-supabase # inherit a base config
|
|
133
|
-
reviewEngine:
|
|
134
|
-
adapter: codex
|
|
135
|
-
options:
|
|
136
|
-
model: gpt-5.3-codex
|
|
137
|
-
testCommand: npm test
|
|
138
|
-
protect:
|
|
139
|
-
- src/core/**
|
|
140
|
-
- data/deltas/**
|
|
141
|
-
```
|
|
142
|
-
|
|
143
140
|
## Snapshot Regression Testing
|
|
144
141
|
|
|
145
|
-
After each feature lands
|
|
142
|
+
After each feature lands:
|
|
146
143
|
|
|
147
144
|
```bash
|
|
148
|
-
npx autopilot autoregress generate
|
|
145
|
+
npx autopilot autoregress generate # generate baselines for changed files
|
|
149
146
|
```
|
|
150
147
|
|
|
151
|
-
Future PRs automatically fail if covered behavior diverges. The impact selector uses `git merge-base` diff + one-hop import graph expansion
|
|
148
|
+
Future PRs automatically fail if covered behavior diverges. The impact selector uses `git merge-base` diff + one-hop import graph expansion — only relevant snapshots run, keeping CI fast.
|
|
152
149
|
|
|
153
150
|
High-impact paths (`src/core/pipeline/**`, `src/adapters/**`, `src/core/findings/**`, `src/core/config/**`) always trigger a full run.
|
|
154
151
|
|
|
152
|
+
## Public API
|
|
153
|
+
|
|
154
|
+
```typescript
|
|
155
|
+
import type { Finding, RunResult, AutopilotConfig } from '@delegance/claude-autopilot';
|
|
156
|
+
import { normalizeSnapshot } from '@delegance/claude-autopilot';
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Types are available for TypeScript consumers. Runtime import requires a tsx-aware bundler (the package ships TypeScript source).
|
|
160
|
+
|
|
155
161
|
## Architecture
|
|
156
162
|
|
|
157
163
|
Four pluggable adapter points:
|
|
158
164
|
|
|
159
165
|
| Point | Built-in | Purpose |
|
|
160
166
|
|---|---|---|
|
|
161
|
-
| `review-engine` | `codex` | LLM code review |
|
|
167
|
+
| `review-engine` | `codex` | LLM code review (OpenAI) |
|
|
162
168
|
| `vcs-host` | `github` | PR comments + SARIF upload |
|
|
163
169
|
| `migration-runner` | `supabase` | DB migration execution |
|
|
164
170
|
| `review-bot-parser` | `cursor` | Parse review bot comments |
|
|
165
171
|
|
|
166
|
-
## Requirements
|
|
167
|
-
|
|
168
|
-
- Node ≥ 22
|
|
169
|
-
- `OPENAI_API_KEY` (optional — review engine and `autoregress generate` only)
|
|
170
|
-
- `gh` CLI authenticated (optional — PR creation / vcs-host adapter)
|
|
171
|
-
|
|
172
172
|
## License
|
|
173
173
|
|
|
174
174
|
MIT
|
package/package.json
CHANGED
package/src/cli/hook.ts
CHANGED
|
@@ -28,13 +28,13 @@ function findGitDir(cwd: string): string | null {
|
|
|
28
28
|
|
|
29
29
|
export async function runHook(
|
|
30
30
|
sub: string,
|
|
31
|
-
options: { cwd?: string; force?: boolean } = {},
|
|
31
|
+
options: { cwd?: string; force?: boolean; silent?: boolean } = {},
|
|
32
32
|
): Promise<number> {
|
|
33
33
|
const cwd = options.cwd ?? process.cwd();
|
|
34
34
|
const gitDir = findGitDir(cwd);
|
|
35
35
|
|
|
36
36
|
if (!gitDir) {
|
|
37
|
-
console.error('[hook] not inside a git repository');
|
|
37
|
+
if (!options.silent) console.error('[hook] not inside a git repository');
|
|
38
38
|
return 1;
|
|
39
39
|
}
|
|
40
40
|
|
package/src/cli/setup.ts
CHANGED
|
@@ -70,7 +70,7 @@ export async function runSetup(options: SetupOptions = {}): Promise<void> {
|
|
|
70
70
|
console.log(` ${PASS} Created autopilot.config.yaml`);
|
|
71
71
|
|
|
72
72
|
if (!options.skipHook) {
|
|
73
|
-
const hookCode = await runHook('install', { cwd });
|
|
73
|
+
const hookCode = await runHook('install', { cwd, silent: true });
|
|
74
74
|
if (hookCode === 0) {
|
|
75
75
|
console.log(` ${PASS} Installed pre-push git hook`);
|
|
76
76
|
} else {
|