@delegance/claude-autopilot 5.5.2 → 7.2.0

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.
Files changed (150) hide show
  1. package/CHANGELOG.md +1776 -6
  2. package/README.md +65 -1
  3. package/bin/_launcher.js +38 -23
  4. package/dist/src/adapters/council/openai.js +12 -6
  5. package/dist/src/adapters/deploy/_http.d.ts +43 -0
  6. package/dist/src/adapters/deploy/_http.js +99 -0
  7. package/dist/src/adapters/deploy/fly.d.ts +206 -0
  8. package/dist/src/adapters/deploy/fly.js +696 -0
  9. package/dist/src/adapters/deploy/index.d.ts +2 -0
  10. package/dist/src/adapters/deploy/index.js +33 -0
  11. package/dist/src/adapters/deploy/render.d.ts +181 -0
  12. package/dist/src/adapters/deploy/render.js +550 -0
  13. package/dist/src/adapters/deploy/types.d.ts +67 -3
  14. package/dist/src/adapters/deploy/vercel.d.ts +17 -1
  15. package/dist/src/adapters/deploy/vercel.js +29 -49
  16. package/dist/src/adapters/pricing.d.ts +36 -0
  17. package/dist/src/adapters/pricing.js +40 -0
  18. package/dist/src/adapters/review-engine/codex.js +10 -7
  19. package/dist/src/cli/autopilot.d.ts +75 -0
  20. package/dist/src/cli/autopilot.js +750 -0
  21. package/dist/src/cli/brainstorm.d.ts +23 -0
  22. package/dist/src/cli/brainstorm.js +131 -0
  23. package/dist/src/cli/costs.d.ts +15 -1
  24. package/dist/src/cli/costs.js +99 -10
  25. package/dist/src/cli/dashboard/index.d.ts +5 -0
  26. package/dist/src/cli/dashboard/index.js +49 -0
  27. package/dist/src/cli/dashboard/login.d.ts +22 -0
  28. package/dist/src/cli/dashboard/login.js +260 -0
  29. package/dist/src/cli/dashboard/logout.d.ts +12 -0
  30. package/dist/src/cli/dashboard/logout.js +45 -0
  31. package/dist/src/cli/dashboard/status.d.ts +30 -0
  32. package/dist/src/cli/dashboard/status.js +65 -0
  33. package/dist/src/cli/dashboard/upload.d.ts +16 -0
  34. package/dist/src/cli/dashboard/upload.js +48 -0
  35. package/dist/src/cli/deploy.d.ts +3 -3
  36. package/dist/src/cli/deploy.js +34 -9
  37. package/dist/src/cli/engine-flag-deprecation.d.ts +14 -0
  38. package/dist/src/cli/engine-flag-deprecation.js +20 -0
  39. package/dist/src/cli/fix.d.ts +18 -0
  40. package/dist/src/cli/fix.js +105 -11
  41. package/dist/src/cli/help-text.d.ts +52 -0
  42. package/dist/src/cli/help-text.js +416 -0
  43. package/dist/src/cli/implement.d.ts +91 -0
  44. package/dist/src/cli/implement.js +196 -0
  45. package/dist/src/cli/index.d.ts +2 -1
  46. package/dist/src/cli/index.js +774 -245
  47. package/dist/src/cli/json-envelope.d.ts +187 -0
  48. package/dist/src/cli/json-envelope.js +270 -0
  49. package/dist/src/cli/json-mode.d.ts +33 -0
  50. package/dist/src/cli/json-mode.js +201 -0
  51. package/dist/src/cli/migrate.d.ts +111 -0
  52. package/dist/src/cli/migrate.js +305 -0
  53. package/dist/src/cli/plan.d.ts +81 -0
  54. package/dist/src/cli/plan.js +149 -0
  55. package/dist/src/cli/pr.d.ts +106 -0
  56. package/dist/src/cli/pr.js +191 -19
  57. package/dist/src/cli/preflight.js +26 -0
  58. package/dist/src/cli/review.d.ts +27 -0
  59. package/dist/src/cli/review.js +126 -0
  60. package/dist/src/cli/runs-watch-renderer.d.ts +45 -0
  61. package/dist/src/cli/runs-watch-renderer.js +275 -0
  62. package/dist/src/cli/runs-watch.d.ts +41 -0
  63. package/dist/src/cli/runs-watch.js +395 -0
  64. package/dist/src/cli/runs.d.ts +122 -0
  65. package/dist/src/cli/runs.js +902 -0
  66. package/dist/src/cli/scaffold.d.ts +39 -0
  67. package/dist/src/cli/scaffold.js +287 -0
  68. package/dist/src/cli/scan.d.ts +93 -0
  69. package/dist/src/cli/scan.js +166 -40
  70. package/dist/src/cli/setup.d.ts +30 -0
  71. package/dist/src/cli/setup.js +137 -0
  72. package/dist/src/cli/spec.d.ts +66 -0
  73. package/dist/src/cli/spec.js +132 -0
  74. package/dist/src/cli/validate.d.ts +29 -0
  75. package/dist/src/cli/validate.js +131 -0
  76. package/dist/src/core/config/schema.d.ts +9 -0
  77. package/dist/src/core/config/schema.js +7 -0
  78. package/dist/src/core/config/types.d.ts +11 -0
  79. package/dist/src/core/council/runner.d.ts +10 -1
  80. package/dist/src/core/council/runner.js +25 -3
  81. package/dist/src/core/council/types.d.ts +7 -0
  82. package/dist/src/core/errors.d.ts +1 -1
  83. package/dist/src/core/errors.js +11 -0
  84. package/dist/src/core/logging/redaction.d.ts +13 -0
  85. package/dist/src/core/logging/redaction.js +20 -0
  86. package/dist/src/core/migrate/schema-validator.js +15 -1
  87. package/dist/src/core/phases/static-rules.d.ts +5 -1
  88. package/dist/src/core/phases/static-rules.js +2 -5
  89. package/dist/src/core/run-state/budget.d.ts +88 -0
  90. package/dist/src/core/run-state/budget.js +141 -0
  91. package/dist/src/core/run-state/cli-internal.d.ts +21 -0
  92. package/dist/src/core/run-state/cli-internal.js +174 -0
  93. package/dist/src/core/run-state/events.d.ts +59 -0
  94. package/dist/src/core/run-state/events.js +512 -0
  95. package/dist/src/core/run-state/lock.d.ts +61 -0
  96. package/dist/src/core/run-state/lock.js +206 -0
  97. package/dist/src/core/run-state/phase-context.d.ts +60 -0
  98. package/dist/src/core/run-state/phase-context.js +108 -0
  99. package/dist/src/core/run-state/phase-registry.d.ts +137 -0
  100. package/dist/src/core/run-state/phase-registry.js +162 -0
  101. package/dist/src/core/run-state/phase-runner.d.ts +80 -0
  102. package/dist/src/core/run-state/phase-runner.js +447 -0
  103. package/dist/src/core/run-state/provider-readback.d.ts +130 -0
  104. package/dist/src/core/run-state/provider-readback.js +426 -0
  105. package/dist/src/core/run-state/replay-decision.d.ts +69 -0
  106. package/dist/src/core/run-state/replay-decision.js +144 -0
  107. package/dist/src/core/run-state/resolve-engine.d.ts +45 -0
  108. package/dist/src/core/run-state/resolve-engine.js +74 -0
  109. package/dist/src/core/run-state/resume-preflight.d.ts +66 -0
  110. package/dist/src/core/run-state/resume-preflight.js +116 -0
  111. package/dist/src/core/run-state/run-phase-with-lifecycle.d.ts +69 -0
  112. package/dist/src/core/run-state/run-phase-with-lifecycle.js +193 -0
  113. package/dist/src/core/run-state/runs.d.ts +57 -0
  114. package/dist/src/core/run-state/runs.js +288 -0
  115. package/dist/src/core/run-state/snapshot.d.ts +14 -0
  116. package/dist/src/core/run-state/snapshot.js +114 -0
  117. package/dist/src/core/run-state/state.d.ts +40 -0
  118. package/dist/src/core/run-state/state.js +164 -0
  119. package/dist/src/core/run-state/types.d.ts +284 -0
  120. package/dist/src/core/run-state/types.js +19 -0
  121. package/dist/src/core/run-state/ulid.d.ts +11 -0
  122. package/dist/src/core/run-state/ulid.js +95 -0
  123. package/dist/src/core/schema-alignment/extractor/index.d.ts +1 -1
  124. package/dist/src/core/schema-alignment/extractor/index.js +2 -2
  125. package/dist/src/core/schema-alignment/extractor/prisma.d.ts +13 -1
  126. package/dist/src/core/schema-alignment/extractor/prisma.js +65 -10
  127. package/dist/src/core/schema-alignment/git-history.d.ts +19 -0
  128. package/dist/src/core/schema-alignment/git-history.js +53 -0
  129. package/dist/src/core/static-rules/rules/brand-tokens.js +2 -2
  130. package/dist/src/core/static-rules/rules/schema-alignment.js +14 -4
  131. package/dist/src/dashboard/auto-upload.d.ts +26 -0
  132. package/dist/src/dashboard/auto-upload.js +107 -0
  133. package/dist/src/dashboard/config.d.ts +22 -0
  134. package/dist/src/dashboard/config.js +109 -0
  135. package/dist/src/dashboard/upload/canonical.d.ts +3 -0
  136. package/dist/src/dashboard/upload/canonical.js +16 -0
  137. package/dist/src/dashboard/upload/chain.d.ts +9 -0
  138. package/dist/src/dashboard/upload/chain.js +27 -0
  139. package/dist/src/dashboard/upload/snapshot.d.ts +23 -0
  140. package/dist/src/dashboard/upload/snapshot.js +66 -0
  141. package/dist/src/dashboard/upload/uploader.d.ts +54 -0
  142. package/dist/src/dashboard/upload/uploader.js +330 -0
  143. package/package.json +19 -3
  144. package/scripts/autoregress.ts +1 -1
  145. package/scripts/test-runner.mjs +4 -0
  146. package/skills/claude-autopilot.md +1 -1
  147. package/skills/make-interfaces-feel-better/SKILL.md +104 -0
  148. package/skills/simplify-ui/SKILL.md +103 -0
  149. package/skills/ui/SKILL.md +117 -0
  150. 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
@@ -1,3 +1,4 @@
1
1
  #!/usr/bin/env node
2
- export {};
2
+ export declare function _resetEngineDeprecationLatchForTests(): void;
3
+ export declare function _resetEngineEnvOffLatchForTests(): void;
3
4
  //# sourceMappingURL=index.d.ts.map