@delegance/claude-autopilot 5.5.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 +935 -6
- package/README.md +55 -0
- package/dist/src/adapters/council/openai.js +12 -6
- 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/index.d.ts +2 -0
- package/dist/src/adapters/deploy/index.js +33 -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 +67 -3
- package/dist/src/adapters/deploy/vercel.d.ts +17 -1
- package/dist/src/adapters/deploy/vercel.js +29 -49
- package/dist/src/adapters/pricing.d.ts +36 -0
- package/dist/src/adapters/pricing.js +40 -0
- package/dist/src/adapters/review-engine/codex.js +10 -7
- 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 +3 -3
- package/dist/src/cli/deploy.js +34 -9
- 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 +719 -245
- 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 +26 -0
- 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 +9 -0
- package/dist/src/core/config/schema.js +7 -0
- package/dist/src/core/config/types.d.ts +11 -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 +11 -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/schema-validator.js +15 -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 +2 -1
- package/scripts/autoregress.ts +1 -1
- package/skills/claude-autopilot.md +1 -1
- package/skills/make-interfaces-feel-better/SKILL.md +104 -0
- 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
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
// src/cli/implement.ts
|
|
2
|
+
//
|
|
3
|
+
// v6.0.7 — wrap the `implement` pipeline phase through `runPhaseWithLifecycle`.
|
|
4
|
+
//
|
|
5
|
+
// `implement` is the implementation phase of the autopilot pipeline (brainstorm
|
|
6
|
+
// → spec → plan → implement → migrate → validate → pr → review). The actual
|
|
7
|
+
// implementation work — reading the plan, dispatching subagents one per plan
|
|
8
|
+
// phase via the `subagent-driven-development` skill, writing code, running
|
|
9
|
+
// tests, committing, optionally pushing — lives in Claude Code skills, not in
|
|
10
|
+
// this CLI verb. The CLI verb that ships in this binary is an engine-wrap
|
|
11
|
+
// shell: it writes a checkpointable phase log stub so v6 pipeline runs can
|
|
12
|
+
// record an `implement` phase entry alongside the rest. Mirrors the
|
|
13
|
+
// validate / review / plan dispatcher shape.
|
|
14
|
+
//
|
|
15
|
+
// Idempotency / side effects (deviation note vs. spec table):
|
|
16
|
+
//
|
|
17
|
+
// The v6 spec table at `docs/specs/v6-run-state-engine.md` (line 159) lists
|
|
18
|
+
// `implement` with `idempotent: partial, hasSideEffects: yes,
|
|
19
|
+
// externalRefs: git-remote-push`. That declaration assumes the verb itself
|
|
20
|
+
// writes commits and pushes them to a remote. The v6.0.7 wrap declares
|
|
21
|
+
// `idempotent: true, hasSideEffects: false` because the v6.0.7 CLI verb does
|
|
22
|
+
// **not** write code, run tests, commit, or push to a remote. All of that
|
|
23
|
+
// work lives in the Claude Code `claude-autopilot` skill (and its delegates:
|
|
24
|
+
// `subagent-driven-development`, `commit-push-pr`, `using-git-worktrees`).
|
|
25
|
+
// The CLI verb is the engine-wrap shell — its only side effect is writing
|
|
26
|
+
// the local `.guardrail-cache/implement/<ts>-implement.md` log stub, which
|
|
27
|
+
// the engine treats as overwrite-style (same precedent as
|
|
28
|
+
// `.guardrail-cache/validate/`, `.guardrail-cache/plans/`,
|
|
29
|
+
// `.guardrail-cache/reviews/`).
|
|
30
|
+
//
|
|
31
|
+
// If a future PR inlines the implement loop into the CLI verb (writes code,
|
|
32
|
+
// runs tests, commits, pushes), the declarations will flip to
|
|
33
|
+
// `idempotent: false, hasSideEffects: true` and the wrap will need to call
|
|
34
|
+
// `ctx.emitExternalRef({ kind: 'git-remote-push', id: '<commit-sha>',
|
|
35
|
+
// observedAt: ... })` after each successful push. The helper signature does
|
|
36
|
+
// not need to grow for that — `phase.run` already receives `ctx`, and the
|
|
37
|
+
// underlying `runPhase()` records externalRefs unchanged.
|
|
38
|
+
import * as path from 'node:path';
|
|
39
|
+
import * as fs from 'node:fs';
|
|
40
|
+
import { loadConfig } from "../core/config/loader.js";
|
|
41
|
+
import { runPhaseWithLifecycle } from "../core/run-state/run-phase-with-lifecycle.js";
|
|
42
|
+
const C = {
|
|
43
|
+
reset: '\x1b[0m', bold: '\x1b[1m', dim: '\x1b[2m',
|
|
44
|
+
green: '\x1b[32m', yellow: '\x1b[33m', cyan: '\x1b[36m', red: '\x1b[31m',
|
|
45
|
+
};
|
|
46
|
+
const fmt = (c, t) => `${C[c]}${t}${C.reset}`;
|
|
47
|
+
/**
|
|
48
|
+
* v6.2.0 — extract the `RunPhase<ImplementInput, ImplementOutput>`
|
|
49
|
+
* construction out of `runImplement(options)` so the new top-level
|
|
50
|
+
* `autopilot` orchestrator can drive `runPhase` itself with a shared
|
|
51
|
+
* `phaseIdx` against the same run dir.
|
|
52
|
+
*
|
|
53
|
+
* Parity asserted by `tests/cli/implement-builder-parity.test.ts`.
|
|
54
|
+
*/
|
|
55
|
+
export async function buildImplementPhase(options) {
|
|
56
|
+
const cwd = options.cwd ?? process.cwd();
|
|
57
|
+
const configPath = options.configPath ?? path.join(cwd, 'guardrail.config.yaml');
|
|
58
|
+
let config = { configVersion: 1 };
|
|
59
|
+
if (fs.existsSync(configPath)) {
|
|
60
|
+
const loaded = await loadConfig(configPath);
|
|
61
|
+
if (loaded)
|
|
62
|
+
config = loaded;
|
|
63
|
+
}
|
|
64
|
+
// INTENTIONAL DEVIATION FROM THE SPEC TABLE (documented at top of file):
|
|
65
|
+
// the v6 spec (`docs/specs/v6-run-state-engine.md`, line 159) lists
|
|
66
|
+
// `implement` with `idempotent: partial, hasSideEffects: yes,
|
|
67
|
+
// externalRefs: git-remote-push`. The v6.0.7 wrap declares
|
|
68
|
+
// `idempotent: true, hasSideEffects: false` because the v6.0.7 CLI verb
|
|
69
|
+
// is an engine-wrap shell — the actual code-writing / commit / push loop
|
|
70
|
+
// lives in the Claude Code `claude-autopilot` skill, not in this CLI verb.
|
|
71
|
+
// Local file write only — no git push, no PR creation, no provider-side
|
|
72
|
+
// mutation. If a future PR inlines the implement loop into the CLI verb,
|
|
73
|
+
// both declarations flip and a `ctx.emitExternalRef({ kind:
|
|
74
|
+
// 'git-remote-push', id: '<commit-sha>' })` call lands after each push.
|
|
75
|
+
const context = options.context ?? null;
|
|
76
|
+
const plan = options.plan ?? null;
|
|
77
|
+
const outputPath = options.outputPath
|
|
78
|
+
? path.resolve(cwd, options.outputPath)
|
|
79
|
+
: path.join(cwd, '.guardrail-cache', 'implement', `${new Date().toISOString().replace(/[:.]/g, '-')}-implement.md`);
|
|
80
|
+
const implementInput = { cwd, context, plan, outputPath };
|
|
81
|
+
// The wrapped phase body — writes an implement log stub to disk. The
|
|
82
|
+
// actual implement loop (read plan → dispatch subagents → write code →
|
|
83
|
+
// run tests → commit → optional push) is produced by the Claude Code
|
|
84
|
+
// `claude-autopilot` skill and its delegates. Engine-off callers invoke
|
|
85
|
+
// this directly via `executeImplementPhase()`; engine-on callers route
|
|
86
|
+
// through `runPhase()`.
|
|
87
|
+
const phase = {
|
|
88
|
+
name: 'implement',
|
|
89
|
+
// Re-running the implement verb against the same context + plan writes
|
|
90
|
+
// the same log file. Engine treats local file writes as overwrite-style
|
|
91
|
+
// — same precedent as scan's findings-cache and validate's validate-log.
|
|
92
|
+
// Once the implement loop inlines into the CLI verb, this flips to
|
|
93
|
+
// `false` per the spec table and the wrap will rely on the
|
|
94
|
+
// `git-remote-push` externalRef readback for resume safety.
|
|
95
|
+
idempotent: true,
|
|
96
|
+
// Local file write only in v6.0.7 — no PR comment posting, no git push,
|
|
97
|
+
// no provider-side mutation. See the long deviation note above where
|
|
98
|
+
// `context`/`plan`/`outputPath` are computed for the externalRefs
|
|
99
|
+
// rationale.
|
|
100
|
+
hasSideEffects: false,
|
|
101
|
+
run: async (input) => executeImplementPhase(input),
|
|
102
|
+
};
|
|
103
|
+
return {
|
|
104
|
+
kind: 'phase',
|
|
105
|
+
phase,
|
|
106
|
+
input: implementInput,
|
|
107
|
+
config,
|
|
108
|
+
renderResult: (output) => renderImplementOutput(output, implementInput),
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
export async function runImplement(options = {}) {
|
|
112
|
+
const built = await buildImplementPhase(options);
|
|
113
|
+
if (built.kind === 'early-exit')
|
|
114
|
+
return built.exitCode;
|
|
115
|
+
const { phase, input, config, renderResult } = built;
|
|
116
|
+
// v6.0.6+ — lifecycle wiring lives in `runPhaseWithLifecycle`. The helper
|
|
117
|
+
// owns the engine-on/engine-off branch and the failure banner; the caller
|
|
118
|
+
// just supplies the phase, the input, and the engine-off escape hatch.
|
|
119
|
+
let output;
|
|
120
|
+
try {
|
|
121
|
+
const result = await runPhaseWithLifecycle({
|
|
122
|
+
cwd: input.cwd,
|
|
123
|
+
phase,
|
|
124
|
+
input,
|
|
125
|
+
config,
|
|
126
|
+
cliEngine: options.cliEngine,
|
|
127
|
+
envEngine: options.envEngine,
|
|
128
|
+
runEngineOff: () => executeImplementPhase(input),
|
|
129
|
+
});
|
|
130
|
+
output = result.output;
|
|
131
|
+
}
|
|
132
|
+
catch {
|
|
133
|
+
// Helper already printed the failure banner + emitted run.complete
|
|
134
|
+
// failed + refreshed state.json + released the lock. Surface the
|
|
135
|
+
// legacy non-zero exit so existing CI / scripts are unaffected.
|
|
136
|
+
return 1;
|
|
137
|
+
}
|
|
138
|
+
return renderResult(output);
|
|
139
|
+
}
|
|
140
|
+
// ---------------------------------------------------------------------------
|
|
141
|
+
// Phase body — write an implement log stub. Pure: no console output, no exit
|
|
142
|
+
// codes. Returns a JSON-serializable ImplementOutput so the engine can persist
|
|
143
|
+
// it as `result` on the phase snapshot. The actual implement loop is produced
|
|
144
|
+
// by the Claude Code `claude-autopilot` skill; this CLI verb's job is to
|
|
145
|
+
// provide a checkpointable phase shell.
|
|
146
|
+
// ---------------------------------------------------------------------------
|
|
147
|
+
async function executeImplementPhase(input) {
|
|
148
|
+
const { context, plan, outputPath } = input;
|
|
149
|
+
fs.mkdirSync(path.dirname(outputPath), { recursive: true });
|
|
150
|
+
const lines = [
|
|
151
|
+
'# Implement',
|
|
152
|
+
'',
|
|
153
|
+
`Generated: ${new Date().toISOString()}`,
|
|
154
|
+
'',
|
|
155
|
+
context ? `Context: ${context}` : 'Context: (none provided)',
|
|
156
|
+
plan ? `Plan: ${plan}` : 'Plan: (none provided)',
|
|
157
|
+
'',
|
|
158
|
+
'<!--',
|
|
159
|
+
'This is the v6 engine-wrap stub for the `implement` phase. The actual',
|
|
160
|
+
'implement loop (read plan → dispatch subagents one per plan phase via',
|
|
161
|
+
'the `subagent-driven-development` skill → write code → run tests →',
|
|
162
|
+
'commit on the branch → optionally push via `commit-push-pr`) is',
|
|
163
|
+
'produced by the Claude Code `claude-autopilot` skill. The CLI verb',
|
|
164
|
+
'exists to provide a checkpointable phase shell so',
|
|
165
|
+
'`claude-autopilot runs show <id>` reflects an `implement` phase entry',
|
|
166
|
+
'when the pipeline includes one.',
|
|
167
|
+
'-->',
|
|
168
|
+
'',
|
|
169
|
+
];
|
|
170
|
+
fs.writeFileSync(outputPath, lines.join('\n'), 'utf8');
|
|
171
|
+
return {
|
|
172
|
+
implementLogPath: outputPath,
|
|
173
|
+
context,
|
|
174
|
+
plan,
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
// ---------------------------------------------------------------------------
|
|
178
|
+
// Render — translate ImplementOutput back to a stdout summary + exit code.
|
|
179
|
+
// Lives outside the wrapped phase because it's pure presentation.
|
|
180
|
+
// ---------------------------------------------------------------------------
|
|
181
|
+
function renderImplementOutput(output, input) {
|
|
182
|
+
const { implementLogPath, context, plan } = output;
|
|
183
|
+
const { cwd } = input;
|
|
184
|
+
console.log('');
|
|
185
|
+
console.log(fmt('bold', '[implement]') + ' ' + fmt('dim', context ? `context: ${context}` : 'no context provided'));
|
|
186
|
+
if (plan)
|
|
187
|
+
console.log(fmt('dim', ` plan: ${plan}`));
|
|
188
|
+
console.log(fmt('dim', ` → ${path.relative(cwd, implementLogPath)}`));
|
|
189
|
+
console.log('');
|
|
190
|
+
console.log(fmt('cyan', 'Note:') + fmt('dim', ' the implement loop lives in Claude Code (`claude-autopilot` skill —'));
|
|
191
|
+
console.log(fmt('dim', ' reads plan, dispatches subagents per plan phase, writes code, runs'));
|
|
192
|
+
console.log(fmt('dim', ' tests, commits, optionally pushes via `commit-push-pr`).'));
|
|
193
|
+
console.log('');
|
|
194
|
+
return 0;
|
|
195
|
+
}
|
|
196
|
+
//# sourceMappingURL=implement.js.map
|