@slowcook-ai/cli 0.18.0-alpha.5 → 0.18.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.
- package/dist/cli.js +20 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/brew/pair-sim.d.ts +29 -0
- package/dist/commands/brew/pair-sim.d.ts.map +1 -0
- package/dist/commands/brew/pair-sim.js +595 -0
- package/dist/commands/brew/pair-sim.js.map +1 -0
- package/dist/commands/chef/drift-fix.d.ts +25 -0
- package/dist/commands/chef/drift-fix.d.ts.map +1 -0
- package/dist/commands/chef/drift-fix.js +712 -0
- package/dist/commands/chef/drift-fix.js.map +1 -0
- package/dist/commands/init/entities.d.ts +68 -0
- package/dist/commands/init/entities.d.ts.map +1 -0
- package/dist/commands/init/entities.js +331 -0
- package/dist/commands/init/entities.js.map +1 -0
- package/dist/commands/init/index.d.ts.map +1 -1
- package/dist/commands/init/index.js +9 -0
- package/dist/commands/init/index.js.map +1 -1
- package/dist/commands/refine/context.d.ts +9 -0
- package/dist/commands/refine/context.d.ts.map +1 -1
- package/dist/commands/refine/context.js +67 -1
- package/dist/commands/refine/context.js.map +1 -1
- package/dist/commands/refine/mermaid.d.ts +7 -1
- package/dist/commands/refine/mermaid.d.ts.map +1 -1
- package/dist/commands/refine/mermaid.js +8 -2
- package/dist/commands/refine/mermaid.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,595 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `slowcook brew --pair-sim` — local-only pair-brew simulator.
|
|
3
|
+
*
|
|
4
|
+
* Self-contained orchestration of driver + navigator agents using the
|
|
5
|
+
* Anthropic API directly. Skips the production brew agent's tool-use
|
|
6
|
+
* loop in favour of a "driver returns JSON describing files to write"
|
|
7
|
+
* shape — much simpler to wire than the full tool protocol, and good
|
|
8
|
+
* enough to validate the pair dynamics empirically.
|
|
9
|
+
*
|
|
10
|
+
* Per iteration:
|
|
11
|
+
* 1. DRIVER reads spec + tests + mock + history → returns JSON
|
|
12
|
+
* { rationale, files: [{path, content}], halt? }.
|
|
13
|
+
* 2. Apply files to disk; compute git diff.
|
|
14
|
+
* 3. NAVIGATOR reads diff + mock + code-map digest + tests + history
|
|
15
|
+
* → returns NavigatorVerdict JSON.
|
|
16
|
+
* 4. If verdict.overall === "block": revert files, fold concerns into
|
|
17
|
+
* next iter's history, continue.
|
|
18
|
+
* 5. Else: run vitest on the story tests. If green + no cross-story
|
|
19
|
+
* regression: SUCCESS. If story tests fail: history.failures →
|
|
20
|
+
* next iter. If cross-story regression: revert + log.
|
|
21
|
+
* 6. Halt at max-iters.
|
|
22
|
+
*
|
|
23
|
+
* Output: per-iter transcript to stdout; final summary written to
|
|
24
|
+
* .brewing/pair-sim/<story-id>-<timestamp>.json.
|
|
25
|
+
*
|
|
26
|
+
* Requires: ANTHROPIC_API_KEY in env. Run from the consumer's repo root.
|
|
27
|
+
*/
|
|
28
|
+
import { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
|
|
29
|
+
import { dirname, join, relative } from "node:path";
|
|
30
|
+
import { execSync } from "node:child_process";
|
|
31
|
+
import { AnthropicClient, NAVIGATOR_SYSTEM, buildNavigatorPrompt, } from "@slowcook-ai/llm-anthropic";
|
|
32
|
+
const MAX_FILE_BYTES = 8000;
|
|
33
|
+
const MAX_DIFF_BYTES = 30000;
|
|
34
|
+
function parseArgs(argv) {
|
|
35
|
+
const args = {
|
|
36
|
+
storyId: "",
|
|
37
|
+
repoRoot: process.cwd(),
|
|
38
|
+
maxIters: 5,
|
|
39
|
+
model: "claude-sonnet-4-5-20250929",
|
|
40
|
+
budgetUsd: 5,
|
|
41
|
+
outPath: "",
|
|
42
|
+
};
|
|
43
|
+
for (let i = 0; i < argv.length; i++) {
|
|
44
|
+
const a = argv[i];
|
|
45
|
+
const next = argv[i + 1];
|
|
46
|
+
if (a === "--story" && next) {
|
|
47
|
+
args.storyId = next;
|
|
48
|
+
i++;
|
|
49
|
+
}
|
|
50
|
+
else if (a === "--cwd" && next) {
|
|
51
|
+
args.repoRoot = next;
|
|
52
|
+
i++;
|
|
53
|
+
}
|
|
54
|
+
else if (a === "--max-iters" && next) {
|
|
55
|
+
args.maxIters = parseInt(next, 10);
|
|
56
|
+
i++;
|
|
57
|
+
}
|
|
58
|
+
else if (a === "--model" && next) {
|
|
59
|
+
args.model = next;
|
|
60
|
+
i++;
|
|
61
|
+
}
|
|
62
|
+
else if (a === "--budget-usd" && next) {
|
|
63
|
+
args.budgetUsd = parseFloat(next);
|
|
64
|
+
i++;
|
|
65
|
+
}
|
|
66
|
+
else if (a === "--out" && next) {
|
|
67
|
+
args.outPath = next;
|
|
68
|
+
i++;
|
|
69
|
+
}
|
|
70
|
+
else if (a === "--help" || a === "-h") {
|
|
71
|
+
printHelp();
|
|
72
|
+
process.exit(0);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (!args.storyId) {
|
|
76
|
+
console.error("--story <id> is required");
|
|
77
|
+
printHelp();
|
|
78
|
+
process.exit(64);
|
|
79
|
+
}
|
|
80
|
+
if (!args.outPath) {
|
|
81
|
+
const ts = new Date().toISOString().replace(/[:.]/g, "-");
|
|
82
|
+
args.outPath = join(args.repoRoot, `.brewing/pair-sim/story-${args.storyId}-${ts}.json`);
|
|
83
|
+
}
|
|
84
|
+
return args;
|
|
85
|
+
}
|
|
86
|
+
function printHelp() {
|
|
87
|
+
console.log(`
|
|
88
|
+
slowcook brew --pair-sim — local pair-brew simulator (cli α.8 prototype)
|
|
89
|
+
|
|
90
|
+
Usage:
|
|
91
|
+
slowcook brew --pair-sim --story <id> [options]
|
|
92
|
+
|
|
93
|
+
Options:
|
|
94
|
+
--cwd <path> Repo root (default: cwd).
|
|
95
|
+
--max-iters <n> Iteration cap (default: 5).
|
|
96
|
+
--model <id> Anthropic model id (default: claude-sonnet-4-5).
|
|
97
|
+
--budget-usd <n> Token-spend cap (default: 5).
|
|
98
|
+
--out <path> JSON summary output path.
|
|
99
|
+
|
|
100
|
+
Requires: ANTHROPIC_API_KEY in env.
|
|
101
|
+
|
|
102
|
+
Per iter ~$0.10–0.20 (driver + navigator). Bound iterations + budget
|
|
103
|
+
appropriately. Output JSON has full transcript for post-hoc analysis.
|
|
104
|
+
`);
|
|
105
|
+
}
|
|
106
|
+
const DRIVER_SYSTEM = `You are the brewing DRIVER in a pair-programming session with a navigator.
|
|
107
|
+
|
|
108
|
+
Your job: write prod code that makes every test in the story manifest pass. The navigator reviews each iteration and may BLOCK (revert your iteration) or WARN. Their reward is "is this sensible?", yours is "do tests pass?". Trust them but argue when you have a reason.
|
|
109
|
+
|
|
110
|
+
You have NO tool-use surface. Each iteration you return ONE JSON object describing your intent + the files to write. Slowcook applies them, runs the navigator + tests, and feeds the result back next iter.
|
|
111
|
+
|
|
112
|
+
## Output schema (return this JSON object only, no prose around it)
|
|
113
|
+
|
|
114
|
+
\`\`\`json
|
|
115
|
+
{
|
|
116
|
+
"rationale": "1-3 sentences: what you're doing this iter + why",
|
|
117
|
+
"files": [
|
|
118
|
+
{ "path": "src/components/foo.tsx", "content": "<full file contents>" }
|
|
119
|
+
],
|
|
120
|
+
"halt": { "reason": "...optional, halt the run with this reason" }
|
|
121
|
+
}
|
|
122
|
+
\`\`\`
|
|
123
|
+
|
|
124
|
+
If you halt, omit \`files\`. Otherwise omit \`halt\` and include all files you want to write THIS ITER. Slowcook overwrites the listed files exactly with your content.
|
|
125
|
+
|
|
126
|
+
## Constraints
|
|
127
|
+
|
|
128
|
+
- DO NOT write to: \`tests/**\`, \`vitest.config.*\`, \`.brewing/**\`. Frozen.
|
|
129
|
+
- The mock IS the design. Your prod files should mirror its visual structure + component composition.
|
|
130
|
+
- REUSE existing components/helpers/routes from the codebase. Don't fork.
|
|
131
|
+
- Prefer EDIT-style writes: include the full new file contents (you don't have read tools, but each iter gives you the relevant existing files in context).
|
|
132
|
+
- Per-iter output should be focused — solve ONE coherent slice. Touching too many files in one iter increases blast radius + navigator BLOCK risk.
|
|
133
|
+
|
|
134
|
+
## When to halt
|
|
135
|
+
|
|
136
|
+
- All story tests pass and you have no further changes: \`{ "rationale": "...", "halt": { "reason": "all green" } }\`
|
|
137
|
+
- You believe the test contract is wrong (rare — say so explicitly): \`{ "halt": { "reason": "test X expects Y but spec says Z" } }\`
|
|
138
|
+
- You're stuck after 2+ iters with no progress: \`{ "halt": { "reason": "blocked on ..." } }\`
|
|
139
|
+
|
|
140
|
+
## When the navigator BLOCKED you last iter
|
|
141
|
+
|
|
142
|
+
Their concerns appear in your context. Address them concretely. If you believe a concern is wrong, say so in your rationale + explain — but understand they may BLOCK you again, and after persistent blocking they may add a test that pins the constraint.
|
|
143
|
+
`;
|
|
144
|
+
function buildDriverPrompt(ctx) {
|
|
145
|
+
const sections = [];
|
|
146
|
+
sections.push(`# Driver iteration for story-${ctx.storyId}`);
|
|
147
|
+
sections.push("");
|
|
148
|
+
sections.push("## Spec");
|
|
149
|
+
sections.push("```yaml");
|
|
150
|
+
sections.push(ctx.spec);
|
|
151
|
+
sections.push("```");
|
|
152
|
+
sections.push("");
|
|
153
|
+
sections.push("## Tests (frozen — must pass)");
|
|
154
|
+
for (const t of ctx.testFiles) {
|
|
155
|
+
sections.push(`### ${t.path}`);
|
|
156
|
+
sections.push("```ts");
|
|
157
|
+
sections.push(truncate(t.content, MAX_FILE_BYTES));
|
|
158
|
+
sections.push("```");
|
|
159
|
+
}
|
|
160
|
+
sections.push("## Design reference (mock files — your prod should mirror visual structure)");
|
|
161
|
+
for (const m of ctx.mockFiles) {
|
|
162
|
+
sections.push(`### ${m.path}`);
|
|
163
|
+
sections.push("```tsx");
|
|
164
|
+
sections.push(truncate(m.content, MAX_FILE_BYTES));
|
|
165
|
+
sections.push("```");
|
|
166
|
+
}
|
|
167
|
+
if (ctx.relevantSrcFiles.length > 0) {
|
|
168
|
+
sections.push("## Existing src/ files (current state — overwrite by listing in your `files`)");
|
|
169
|
+
for (const f of ctx.relevantSrcFiles) {
|
|
170
|
+
sections.push(`### ${f.path}`);
|
|
171
|
+
sections.push("```tsx");
|
|
172
|
+
sections.push(truncate(f.content, MAX_FILE_BYTES));
|
|
173
|
+
sections.push("```");
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
if (ctx.codeMapDigest.trim()) {
|
|
177
|
+
sections.push("## Existing codebase vocabulary (REUSE before creating)");
|
|
178
|
+
sections.push(ctx.codeMapDigest.trim());
|
|
179
|
+
sections.push("");
|
|
180
|
+
}
|
|
181
|
+
if (ctx.history.length > 0) {
|
|
182
|
+
sections.push("## Previous iterations (your past attempts + navigator feedback)");
|
|
183
|
+
for (const h of ctx.history.slice(-3)) {
|
|
184
|
+
sections.push(`### Iter ${h.iter} — outcome: ${h.outcome}`);
|
|
185
|
+
sections.push(`Rationale: ${h.driverRationale}`);
|
|
186
|
+
sections.push(`Files touched: ${h.filesTouched.join(", ") || "(none)"}`);
|
|
187
|
+
sections.push(`Navigator: overall=${h.navigatorVerdict.overall}; ${h.navigatorVerdict.rationale}`);
|
|
188
|
+
if (h.navigatorVerdict.axes.length > 0) {
|
|
189
|
+
for (const a of h.navigatorVerdict.axes) {
|
|
190
|
+
sections.push(` - ${a.severity.toUpperCase()} ${a.axis}: ${a.summary}`);
|
|
191
|
+
sections.push(` → ${a.recommendation}`);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
if (h.testFailureFirst)
|
|
195
|
+
sections.push(`First test failure: ${h.testFailureFirst}`);
|
|
196
|
+
if (h.crossStoryFailures && h.crossStoryFailures.length > 0) {
|
|
197
|
+
sections.push(`Cross-story regressions caused: ${h.crossStoryFailures.slice(0, 5).join(", ")}`);
|
|
198
|
+
}
|
|
199
|
+
sections.push("");
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
sections.push("---");
|
|
203
|
+
sections.push("Now produce your iteration. Return the JSON object only — no prose around it.");
|
|
204
|
+
return sections.join("\n");
|
|
205
|
+
}
|
|
206
|
+
function truncate(s, max) {
|
|
207
|
+
if (s.length <= max)
|
|
208
|
+
return s;
|
|
209
|
+
return s.slice(0, max) + `\n// ... (truncated, ${s.length - max} chars omitted)`;
|
|
210
|
+
}
|
|
211
|
+
function parseDriverJson(text) {
|
|
212
|
+
const trimmed = text.trim();
|
|
213
|
+
// Try to find a JSON object — agents often wrap in ```json fences
|
|
214
|
+
const fenceMatch = trimmed.match(/```json\s*([\s\S]*?)```/);
|
|
215
|
+
const candidate = fenceMatch ? fenceMatch[1] : trimmed;
|
|
216
|
+
try {
|
|
217
|
+
return JSON.parse(candidate);
|
|
218
|
+
}
|
|
219
|
+
catch (e) {
|
|
220
|
+
// Try fence-less parse
|
|
221
|
+
throw new Error(`Driver output not valid JSON. First 300 chars:\n${candidate.slice(0, 300)}\n\nError: ${e.message}`);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
function parseNavigatorJson(text) {
|
|
225
|
+
const trimmed = text.trim();
|
|
226
|
+
const fenceMatch = trimmed.match(/```json\s*([\s\S]*?)```/);
|
|
227
|
+
const candidate = fenceMatch ? fenceMatch[1] : trimmed;
|
|
228
|
+
try {
|
|
229
|
+
return JSON.parse(candidate);
|
|
230
|
+
}
|
|
231
|
+
catch (e) {
|
|
232
|
+
throw new Error(`Navigator output not valid JSON. First 300 chars:\n${candidate.slice(0, 300)}\n\nError: ${e.message}`);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
function collectStoryFiles(repoRoot, storyId, kind) {
|
|
236
|
+
const out = [];
|
|
237
|
+
if (kind === "test") {
|
|
238
|
+
const dir = join(repoRoot, "tests/integration");
|
|
239
|
+
if (!existsSync(dir))
|
|
240
|
+
return out;
|
|
241
|
+
for (const name of readdirSync(dir)) {
|
|
242
|
+
if (!name.startsWith(`story-${storyId}`))
|
|
243
|
+
continue;
|
|
244
|
+
if (!/\.test\.(ts|tsx)$/.test(name))
|
|
245
|
+
continue;
|
|
246
|
+
const path = `tests/integration/${name}`;
|
|
247
|
+
out.push({ path, content: readFileSync(join(repoRoot, path), "utf8") });
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
else {
|
|
251
|
+
// mock: walk mock/src/ for files referenced by story scenarios + the components those import.
|
|
252
|
+
// For first cut, just include all mock/src/components and the story scenarios.
|
|
253
|
+
const scenariosDir = join(repoRoot, "mock/scenarios");
|
|
254
|
+
if (existsSync(scenariosDir)) {
|
|
255
|
+
for (const name of readdirSync(scenariosDir)) {
|
|
256
|
+
if (!name.startsWith(`story-${storyId}`))
|
|
257
|
+
continue;
|
|
258
|
+
const path = `mock/scenarios/${name}`;
|
|
259
|
+
out.push({ path, content: readFileSync(join(repoRoot, path), "utf8") });
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
// All files under mock/src/components/members and similar likely-relevant dirs.
|
|
263
|
+
const componentDirs = ["mock/src/components/members", "mock/src/components/rewo"];
|
|
264
|
+
for (const dirRel of componentDirs) {
|
|
265
|
+
const dir = join(repoRoot, dirRel);
|
|
266
|
+
if (!existsSync(dir))
|
|
267
|
+
continue;
|
|
268
|
+
for (const name of readdirSync(dir)) {
|
|
269
|
+
if (!/\.tsx?$/.test(name))
|
|
270
|
+
continue;
|
|
271
|
+
const path = `${dirRel}/${name}`;
|
|
272
|
+
out.push({ path, content: readFileSync(join(repoRoot, path), "utf8") });
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
return out;
|
|
277
|
+
}
|
|
278
|
+
function collectRelevantSrcFiles(repoRoot) {
|
|
279
|
+
// Include existing src/components/members + the api route + the page wiring.
|
|
280
|
+
const out = [];
|
|
281
|
+
const candidates = [
|
|
282
|
+
"src/components/members",
|
|
283
|
+
];
|
|
284
|
+
for (const dirRel of candidates) {
|
|
285
|
+
const dir = join(repoRoot, dirRel);
|
|
286
|
+
if (!existsSync(dir))
|
|
287
|
+
continue;
|
|
288
|
+
for (const name of readdirSync(dir)) {
|
|
289
|
+
if (!/\.tsx?$/.test(name))
|
|
290
|
+
continue;
|
|
291
|
+
const path = `${dirRel}/${name}`;
|
|
292
|
+
out.push({ path, content: readFileSync(join(repoRoot, path), "utf8") });
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
return out;
|
|
296
|
+
}
|
|
297
|
+
function readSpec(repoRoot, storyId) {
|
|
298
|
+
const path = join(repoRoot, `specs/story-${storyId}.yaml`);
|
|
299
|
+
if (!existsSync(path))
|
|
300
|
+
return "(no spec file at " + path + ")";
|
|
301
|
+
return readFileSync(path, "utf8");
|
|
302
|
+
}
|
|
303
|
+
function readCodeMapDigest(repoRoot) {
|
|
304
|
+
const path = join(repoRoot, ".brewing/code-map.target.md");
|
|
305
|
+
if (!existsSync(path)) {
|
|
306
|
+
const fallback = join(repoRoot, ".brewing/code-map.md");
|
|
307
|
+
if (!existsSync(fallback))
|
|
308
|
+
return "";
|
|
309
|
+
const md = readFileSync(fallback, "utf8");
|
|
310
|
+
return md.length > 6000 ? md.slice(0, 6000) + "\n... (truncated)" : md;
|
|
311
|
+
}
|
|
312
|
+
return readFileSync(path, "utf8");
|
|
313
|
+
}
|
|
314
|
+
function applyFiles(repoRoot, files) {
|
|
315
|
+
const touched = [];
|
|
316
|
+
for (const f of files) {
|
|
317
|
+
if (f.path.startsWith("tests/") || f.path.startsWith("vitest.config") || f.path.startsWith(".brewing/")) {
|
|
318
|
+
console.warn(` ! refusing to write frozen path: ${f.path}`);
|
|
319
|
+
continue;
|
|
320
|
+
}
|
|
321
|
+
const abs = join(repoRoot, f.path);
|
|
322
|
+
mkdirSync(dirname(abs), { recursive: true });
|
|
323
|
+
writeFileSync(abs, f.content, "utf8");
|
|
324
|
+
touched.push(f.path);
|
|
325
|
+
}
|
|
326
|
+
return touched;
|
|
327
|
+
}
|
|
328
|
+
function computeDiff(repoRoot) {
|
|
329
|
+
const out = execSync(`git -C "${repoRoot}" diff HEAD`, { encoding: "utf8" });
|
|
330
|
+
return out.length > MAX_DIFF_BYTES ? out.slice(0, MAX_DIFF_BYTES) + "\n... (truncated)" : out;
|
|
331
|
+
}
|
|
332
|
+
function changedPaths(repoRoot) {
|
|
333
|
+
const out = execSync(`git -C "${repoRoot}" diff --name-only HEAD`, { encoding: "utf8" });
|
|
334
|
+
return out.split("\n").filter(Boolean);
|
|
335
|
+
}
|
|
336
|
+
function revertPaths(repoRoot, paths) {
|
|
337
|
+
for (const p of paths) {
|
|
338
|
+
try {
|
|
339
|
+
execSync(`git -C "${repoRoot}" checkout HEAD -- "${p}" 2>/dev/null || rm -f "${repoRoot}/${p}"`, { stdio: "ignore" });
|
|
340
|
+
}
|
|
341
|
+
catch { /* ignore */ }
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
function runStoryTests(repoRoot, storyId) {
|
|
345
|
+
// Run vitest scoped to story-NNN tests; parse summary.
|
|
346
|
+
try {
|
|
347
|
+
const out = execSync(`cd "${repoRoot}" && npx vitest run tests/integration/story-${storyId}* --reporter=default 2>&1 || true`, { encoding: "utf8", maxBuffer: 4 * 1024 * 1024 });
|
|
348
|
+
return parseVitestOutput(out);
|
|
349
|
+
}
|
|
350
|
+
catch (e) {
|
|
351
|
+
return { allPassed: false, failures: [e.message], total: 0, passed: 0 };
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
function runFullSuite(repoRoot) {
|
|
355
|
+
try {
|
|
356
|
+
const out = execSync(`cd "${repoRoot}" && npx vitest run --reporter=default 2>&1 || true`, { encoding: "utf8", maxBuffer: 8 * 1024 * 1024 });
|
|
357
|
+
return parseVitestOutput(out);
|
|
358
|
+
}
|
|
359
|
+
catch (e) {
|
|
360
|
+
return { allPassed: false, failures: [e.message], total: 0, passed: 0 };
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
function parseVitestOutput(out) {
|
|
364
|
+
const lastLines = out.split("\n").slice(-50);
|
|
365
|
+
let total = 0;
|
|
366
|
+
let passed = 0;
|
|
367
|
+
let failed = 0;
|
|
368
|
+
const failures = [];
|
|
369
|
+
for (const line of lastLines) {
|
|
370
|
+
const m = line.match(/Tests\s+(?:(\d+)\s+failed\s+\|\s+)?(\d+)\s+passed(?:\s+\|\s+(\d+)\s+skipped)?\s+\((\d+)\)/);
|
|
371
|
+
if (m) {
|
|
372
|
+
failed = parseInt(m[1] ?? "0", 10);
|
|
373
|
+
passed = parseInt(m[2] ?? "0", 10);
|
|
374
|
+
total = parseInt(m[4] ?? "0", 10);
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
// Extract failing test names
|
|
378
|
+
for (const line of out.split("\n")) {
|
|
379
|
+
const fm = line.match(/×\s+(.+?)\s+\d+ms/);
|
|
380
|
+
if (fm && fm[1])
|
|
381
|
+
failures.push(fm[1].trim());
|
|
382
|
+
}
|
|
383
|
+
return { allPassed: failed === 0 && total > 0, failures: failures.slice(0, 10), total, passed };
|
|
384
|
+
}
|
|
385
|
+
export async function pairSim(argv, _cliVersion) {
|
|
386
|
+
const args = parseArgs(argv);
|
|
387
|
+
const apiKey = process.env["ANTHROPIC_API_KEY"];
|
|
388
|
+
if (!apiKey) {
|
|
389
|
+
console.error("ANTHROPIC_API_KEY env var is required.");
|
|
390
|
+
process.exit(2);
|
|
391
|
+
}
|
|
392
|
+
const client = new AnthropicClient(apiKey);
|
|
393
|
+
console.log(`slowcook brew --pair-sim · story-${args.storyId} · model=${args.model} · max-iters=${args.maxIters} · budget=$${args.budgetUsd}`);
|
|
394
|
+
const spec = readSpec(args.repoRoot, args.storyId);
|
|
395
|
+
const testFiles = collectStoryFiles(args.repoRoot, args.storyId, "test");
|
|
396
|
+
const mockFiles = collectStoryFiles(args.repoRoot, args.storyId, "mock");
|
|
397
|
+
const codeMapDigest = readCodeMapDigest(args.repoRoot);
|
|
398
|
+
console.log(` loaded: ${testFiles.length} test files · ${mockFiles.length} mock files · code-map ${codeMapDigest.length} chars`);
|
|
399
|
+
const history = [];
|
|
400
|
+
let totalSpend = 0;
|
|
401
|
+
let outcome = "iter-cap";
|
|
402
|
+
for (let iter = 1; iter <= args.maxIters; iter++) {
|
|
403
|
+
if (totalSpend >= args.budgetUsd) {
|
|
404
|
+
outcome = "budget-cap";
|
|
405
|
+
break;
|
|
406
|
+
}
|
|
407
|
+
const relevantSrcFiles = collectRelevantSrcFiles(args.repoRoot);
|
|
408
|
+
const ctx = {
|
|
409
|
+
storyId: args.storyId,
|
|
410
|
+
spec,
|
|
411
|
+
testFiles,
|
|
412
|
+
mockFiles,
|
|
413
|
+
codeMapDigest,
|
|
414
|
+
history,
|
|
415
|
+
relevantSrcFiles,
|
|
416
|
+
};
|
|
417
|
+
// DRIVER
|
|
418
|
+
console.log(`\n=== iter ${iter} · DRIVER ===`);
|
|
419
|
+
const driverPrompt = buildDriverPrompt(ctx);
|
|
420
|
+
const driverResp = await client.complete({
|
|
421
|
+
model: args.model,
|
|
422
|
+
system: DRIVER_SYSTEM,
|
|
423
|
+
messages: [{ role: "user", content: driverPrompt }],
|
|
424
|
+
maxTokens: 8192,
|
|
425
|
+
});
|
|
426
|
+
totalSpend += driverResp.costUsd;
|
|
427
|
+
console.log(` driver: ${driverResp.usage.inputTokens}→${driverResp.usage.outputTokens} tok · $${driverResp.costUsd.toFixed(4)} · spent=$${totalSpend.toFixed(2)}`);
|
|
428
|
+
let driverOutput;
|
|
429
|
+
try {
|
|
430
|
+
driverOutput = parseDriverJson(driverResp.text);
|
|
431
|
+
}
|
|
432
|
+
catch (e) {
|
|
433
|
+
console.error(` ! driver JSON parse failed: ${e.message}`);
|
|
434
|
+
outcome = "halt";
|
|
435
|
+
break;
|
|
436
|
+
}
|
|
437
|
+
console.log(` driver rationale: ${driverOutput.rationale}`);
|
|
438
|
+
if (driverOutput.halt) {
|
|
439
|
+
console.log(` driver HALT: ${driverOutput.halt.reason}`);
|
|
440
|
+
outcome = "halt";
|
|
441
|
+
break;
|
|
442
|
+
}
|
|
443
|
+
const filesToWrite = driverOutput.files ?? [];
|
|
444
|
+
if (filesToWrite.length === 0) {
|
|
445
|
+
console.log(` driver wrote no files; recording as no-progress iter`);
|
|
446
|
+
history.push({
|
|
447
|
+
iter,
|
|
448
|
+
driverRationale: driverOutput.rationale,
|
|
449
|
+
filesTouched: [],
|
|
450
|
+
navigatorVerdict: { axes: [], overall: "warn", rationale: "(no diff to navigate)" },
|
|
451
|
+
outcome: "tests-failing",
|
|
452
|
+
driverCostUsd: driverResp.costUsd,
|
|
453
|
+
navigatorCostUsd: 0,
|
|
454
|
+
});
|
|
455
|
+
continue;
|
|
456
|
+
}
|
|
457
|
+
const touched = applyFiles(args.repoRoot, filesToWrite);
|
|
458
|
+
console.log(` driver touched ${touched.length} file(s): ${touched.join(", ")}`);
|
|
459
|
+
const diff = computeDiff(args.repoRoot);
|
|
460
|
+
// NAVIGATOR
|
|
461
|
+
console.log(`=== iter ${iter} · NAVIGATOR ===`);
|
|
462
|
+
const navPrompt = buildNavigatorPrompt({
|
|
463
|
+
storyId: args.storyId,
|
|
464
|
+
driverRationale: driverOutput.rationale,
|
|
465
|
+
diff,
|
|
466
|
+
mockFiles,
|
|
467
|
+
codeMapDigest,
|
|
468
|
+
storyTestIds: extractTestIds(testFiles),
|
|
469
|
+
specYaml: spec,
|
|
470
|
+
priorVerdicts: history.map((h) => ({
|
|
471
|
+
iter: h.iter,
|
|
472
|
+
overall: h.navigatorVerdict.overall,
|
|
473
|
+
axes: h.navigatorVerdict.axes.map((a) => ({
|
|
474
|
+
axis: a.axis,
|
|
475
|
+
severity: a.severity,
|
|
476
|
+
summary: a.summary,
|
|
477
|
+
recommendation: a.recommendation,
|
|
478
|
+
})),
|
|
479
|
+
})),
|
|
480
|
+
});
|
|
481
|
+
const navResp = await client.complete({
|
|
482
|
+
model: args.model,
|
|
483
|
+
system: NAVIGATOR_SYSTEM,
|
|
484
|
+
messages: [{ role: "user", content: navPrompt }],
|
|
485
|
+
maxTokens: 4096,
|
|
486
|
+
});
|
|
487
|
+
totalSpend += navResp.costUsd;
|
|
488
|
+
console.log(` navigator: ${navResp.usage.inputTokens}→${navResp.usage.outputTokens} tok · $${navResp.costUsd.toFixed(4)} · spent=$${totalSpend.toFixed(2)}`);
|
|
489
|
+
let verdict;
|
|
490
|
+
try {
|
|
491
|
+
verdict = parseNavigatorJson(navResp.text);
|
|
492
|
+
}
|
|
493
|
+
catch (e) {
|
|
494
|
+
console.error(` ! navigator JSON parse failed: ${e.message}; treating as approve`);
|
|
495
|
+
verdict = { axes: [], overall: "approve", rationale: "(parse failed; treated as approve)" };
|
|
496
|
+
}
|
|
497
|
+
console.log(` navigator: ${verdict.overall.toUpperCase()} — ${verdict.rationale}`);
|
|
498
|
+
for (const a of verdict.axes) {
|
|
499
|
+
console.log(` [${a.severity}] ${a.axis}: ${a.summary}`);
|
|
500
|
+
}
|
|
501
|
+
if (verdict.overall === "block") {
|
|
502
|
+
console.log(` REVERT iter ${iter} (navigator blocked)`);
|
|
503
|
+
revertPaths(args.repoRoot, touched);
|
|
504
|
+
history.push({
|
|
505
|
+
iter,
|
|
506
|
+
driverRationale: driverOutput.rationale,
|
|
507
|
+
filesTouched: touched,
|
|
508
|
+
navigatorVerdict: verdict,
|
|
509
|
+
outcome: "blocked",
|
|
510
|
+
driverCostUsd: driverResp.costUsd,
|
|
511
|
+
navigatorCostUsd: navResp.costUsd,
|
|
512
|
+
});
|
|
513
|
+
continue;
|
|
514
|
+
}
|
|
515
|
+
// Run story tests
|
|
516
|
+
console.log(`=== iter ${iter} · TESTS ===`);
|
|
517
|
+
const storyResult = runStoryTests(args.repoRoot, args.storyId);
|
|
518
|
+
console.log(` story-${args.storyId} tests: ${storyResult.passed}/${storyResult.total} passed`);
|
|
519
|
+
if (!storyResult.allPassed) {
|
|
520
|
+
history.push({
|
|
521
|
+
iter,
|
|
522
|
+
driverRationale: driverOutput.rationale,
|
|
523
|
+
filesTouched: touched,
|
|
524
|
+
navigatorVerdict: verdict,
|
|
525
|
+
outcome: "tests-failing",
|
|
526
|
+
testFailureFirst: storyResult.failures[0],
|
|
527
|
+
driverCostUsd: driverResp.costUsd,
|
|
528
|
+
navigatorCostUsd: navResp.costUsd,
|
|
529
|
+
});
|
|
530
|
+
continue;
|
|
531
|
+
}
|
|
532
|
+
// Story green — check full suite
|
|
533
|
+
const fullResult = runFullSuite(args.repoRoot);
|
|
534
|
+
if (!fullResult.allPassed) {
|
|
535
|
+
// Cross-story regression
|
|
536
|
+
const crossStoryFailures = fullResult.failures.filter((f) => !f.includes(`story-${args.storyId}`));
|
|
537
|
+
console.log(` CROSS-STORY REGRESSION: ${crossStoryFailures.length} test(s) failing outside story-${args.storyId}`);
|
|
538
|
+
revertPaths(args.repoRoot, touched);
|
|
539
|
+
history.push({
|
|
540
|
+
iter,
|
|
541
|
+
driverRationale: driverOutput.rationale,
|
|
542
|
+
filesTouched: touched,
|
|
543
|
+
navigatorVerdict: verdict,
|
|
544
|
+
outcome: "cross-story-regression",
|
|
545
|
+
crossStoryFailures: crossStoryFailures.slice(0, 10),
|
|
546
|
+
driverCostUsd: driverResp.costUsd,
|
|
547
|
+
navigatorCostUsd: navResp.costUsd,
|
|
548
|
+
});
|
|
549
|
+
continue;
|
|
550
|
+
}
|
|
551
|
+
console.log(` SUCCESS · iter ${iter} · all green · spend=$${totalSpend.toFixed(2)}`);
|
|
552
|
+
history.push({
|
|
553
|
+
iter,
|
|
554
|
+
driverRationale: driverOutput.rationale,
|
|
555
|
+
filesTouched: touched,
|
|
556
|
+
navigatorVerdict: verdict,
|
|
557
|
+
outcome: "success",
|
|
558
|
+
driverCostUsd: driverResp.costUsd,
|
|
559
|
+
navigatorCostUsd: navResp.costUsd,
|
|
560
|
+
});
|
|
561
|
+
outcome = "success";
|
|
562
|
+
break;
|
|
563
|
+
}
|
|
564
|
+
// Write summary
|
|
565
|
+
const summary = {
|
|
566
|
+
story_id: args.storyId,
|
|
567
|
+
model: args.model,
|
|
568
|
+
iterations_run: history.length,
|
|
569
|
+
total_spend_usd: totalSpend,
|
|
570
|
+
outcome,
|
|
571
|
+
iterations: history,
|
|
572
|
+
};
|
|
573
|
+
mkdirSync(dirname(args.outPath), { recursive: true });
|
|
574
|
+
writeFileSync(args.outPath, JSON.stringify(summary, null, 2), "utf8");
|
|
575
|
+
console.log(`\n=== summary ===`);
|
|
576
|
+
console.log(` outcome: ${outcome.toUpperCase()}`);
|
|
577
|
+
console.log(` iterations: ${history.length}`);
|
|
578
|
+
console.log(` total spend: $${totalSpend.toFixed(2)}`);
|
|
579
|
+
console.log(` navigator block rate: ${history.filter(h => h.outcome === "blocked").length}/${history.length}`);
|
|
580
|
+
console.log(` cross-story regressions: ${history.filter(h => h.outcome === "cross-story-regression").length}`);
|
|
581
|
+
console.log(` wrote ${relative(args.repoRoot, args.outPath)}`);
|
|
582
|
+
if (outcome !== "success")
|
|
583
|
+
process.exit(1);
|
|
584
|
+
}
|
|
585
|
+
function extractTestIds(testFiles) {
|
|
586
|
+
const out = [];
|
|
587
|
+
for (const t of testFiles) {
|
|
588
|
+
for (const m of t.content.matchAll(/\bit\s*\(\s*["'`]([^"'`]+)["'`]/g)) {
|
|
589
|
+
if (m[1])
|
|
590
|
+
out.push(`${t.path} > ${m[1]}`);
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
return out.slice(0, 50);
|
|
594
|
+
}
|
|
595
|
+
//# sourceMappingURL=pair-sim.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pair-sim.js","sourceRoot":"","sources":["../../../src/commands/brew/pair-sim.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC1F,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,oBAAoB,GAErB,MAAM,4BAA4B,CAAC;AA6BpC,MAAM,cAAc,GAAG,IAAI,CAAC;AAC5B,MAAM,cAAc,GAAG,K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AAC,CAAC,CAAC,CAAC;AAC7C,CAAC;AAED,SAAS,cAAc,CAAC,SAAmD;IACzE,MAAM,GAAG,GAAa,EAAE,CAAC;IACzB,KAAK,MAAM,CAAC,IAAI,SAAS,EAAE,CAAC;QAC1B,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,kCAAkC,CAAC,EAAE,CAAC;YACvE,IAAI,CAAC,CAAC,CAAC,CAAC;gBAAE,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAC5C,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `slowcook chef-drift` — α.9 L1 drift-fixer (cli α.9).
|
|
3
|
+
*
|
|
4
|
+
* Sibling to the existing `slowcook chef --pr <n>` (PR-CI-failure
|
|
5
|
+
* handler). This module is the SURGICAL EDITOR variant: triggered by
|
|
6
|
+
* mock-isolation / recon / brew halt / navigator halt-class. Reads the
|
|
7
|
+
* failure + history-index + PR state, calls the chef LLM to get a
|
|
8
|
+
* ChefVerdict, applies edits surgically, validates, commits, posts an
|
|
9
|
+
* audit comment.
|
|
10
|
+
*
|
|
11
|
+
* Frozen surface (HARD): never edits tests/, vitest.config.*,
|
|
12
|
+
* .brewing/{auto-gen}/. If a fix requires test edits → escalates to PM
|
|
13
|
+
* via a two-option pm_comment (option B = `testgen --regenerate`).
|
|
14
|
+
*
|
|
15
|
+
* Ledger at .brewing/chef/<story-id>.json tracks moves + cost. Cycle
|
|
16
|
+
* detection + budget cap enforce convergence.
|
|
17
|
+
*
|
|
18
|
+
* Run from consumer repo root:
|
|
19
|
+
* ANTHROPIC_API_KEY=... slowcook chef-drift \
|
|
20
|
+
* --story 018 \
|
|
21
|
+
* --trigger mock_isolation_check_failed \
|
|
22
|
+
* --trigger-detail "Relative import resolves to a non-existent file..."
|
|
23
|
+
*/
|
|
24
|
+
export declare function chefDrift(argv: string[], _cliVersion: string): Promise<void>;
|
|
25
|
+
//# sourceMappingURL=drift-fix.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drift-fix.d.ts","sourceRoot":"","sources":["../../../src/commands/chef/drift-fix.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AA0ZH,wBAAsB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA8RlF"}
|