@slowcook-ai/cli 0.12.12 → 0.13.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 +41 -2
- package/dist/cli.js.map +1 -1
- package/dist/commands/brew/agent.d.ts.map +1 -1
- package/dist/commands/brew/agent.js +19 -6
- package/dist/commands/brew/agent.js.map +1 -1
- package/dist/commands/chef/classify.d.ts +65 -0
- package/dist/commands/chef/classify.d.ts.map +1 -0
- package/dist/commands/chef/classify.js +102 -0
- package/dist/commands/chef/classify.js.map +1 -0
- package/dist/commands/chef/index.d.ts +22 -0
- package/dist/commands/chef/index.d.ts.map +1 -0
- package/dist/commands/chef/index.js +287 -0
- package/dist/commands/chef/index.js.map +1 -0
- package/dist/commands/dispatch/index.d.ts.map +1 -1
- package/dist/commands/dispatch/index.js +10 -3
- package/dist/commands/dispatch/index.js.map +1 -1
- package/dist/commands/investigate/agent.d.ts +68 -0
- package/dist/commands/investigate/agent.d.ts.map +1 -0
- package/dist/commands/investigate/agent.js +503 -0
- package/dist/commands/investigate/agent.js.map +1 -0
- package/dist/commands/investigate/index.d.ts +43 -0
- package/dist/commands/investigate/index.d.ts.map +1 -0
- package/dist/commands/investigate/index.js +413 -0
- package/dist/commands/investigate/index.js.map +1 -0
- package/dist/commands/investigate/prompts.d.ts +90 -0
- package/dist/commands/investigate/prompts.d.ts.map +1 -0
- package/dist/commands/investigate/prompts.js +237 -0
- package/dist/commands/investigate/prompts.js.map +1 -0
- package/dist/commands/investigate/schema.d.ts +91 -0
- package/dist/commands/investigate/schema.d.ts.map +1 -0
- package/dist/commands/investigate/schema.js +87 -0
- package/dist/commands/investigate/schema.js.map +1 -0
- package/dist/commands/on-brew-merged/index.d.ts.map +1 -1
- package/dist/commands/on-brew-merged/index.js +27 -6
- package/dist/commands/on-brew-merged/index.js.map +1 -1
- package/dist/commands/recipe-regression/agent.d.ts +94 -0
- package/dist/commands/recipe-regression/agent.d.ts.map +1 -0
- package/dist/commands/recipe-regression/agent.js +442 -0
- package/dist/commands/recipe-regression/agent.js.map +1 -0
- package/dist/commands/recipe-regression/index.d.ts +61 -0
- package/dist/commands/recipe-regression/index.d.ts.map +1 -0
- package/dist/commands/recipe-regression/index.js +187 -0
- package/dist/commands/recipe-regression/index.js.map +1 -0
- package/dist/commands/sift/agent.d.ts +52 -0
- package/dist/commands/sift/agent.d.ts.map +1 -0
- package/dist/commands/sift/agent.js +392 -0
- package/dist/commands/sift/agent.js.map +1 -0
- package/dist/commands/sift/index.d.ts +23 -0
- package/dist/commands/sift/index.d.ts.map +1 -0
- package/dist/commands/sift/index.js +314 -0
- package/dist/commands/sift/index.js.map +1 -0
- package/dist/commands/sift/prompts.d.ts +114 -0
- package/dist/commands/sift/prompts.d.ts.map +1 -0
- package/dist/commands/sift/prompts.js +193 -0
- package/dist/commands/sift/prompts.js.map +1 -0
- package/package.json +4 -4
|
@@ -0,0 +1,503 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Investigate agent loop. Reads a GitHub issue, runs a Claude
|
|
3
|
+
* tool-use loop with read-only repo tools, and emits a validated
|
|
4
|
+
* BugProfile.
|
|
5
|
+
*
|
|
6
|
+
* alpha.2b — real LLM integration. PR opening (creating a branch
|
|
7
|
+
* + pushing the bug-profile.yaml + opening the PR) lands in
|
|
8
|
+
* alpha.2c; this returns the profile to the caller for now.
|
|
9
|
+
*
|
|
10
|
+
* Pattern mirrors brew/agent.ts's runTurn loop but smaller:
|
|
11
|
+
* - read-only tools (no write_file, no justify_diff_overflow)
|
|
12
|
+
* - single conversation, not multi-turn ratchet
|
|
13
|
+
* - output validated against bug-profile schema
|
|
14
|
+
*/
|
|
15
|
+
import { existsSync, readFileSync, readdirSync, statSync, } from "node:fs";
|
|
16
|
+
import { resolve, isAbsolute } from "node:path";
|
|
17
|
+
import { execSync } from "node:child_process";
|
|
18
|
+
import Anthropic from "@anthropic-ai/sdk";
|
|
19
|
+
import { outlineFile } from "../brew/agent.js";
|
|
20
|
+
import { findReferences, findDefinition, renderReferences, } from "../brew/retrieval.js";
|
|
21
|
+
import { INVESTIGATE_SYSTEM, INVESTIGATE_TOOLS, buildInvestigateUserPrompt, } from "./prompts.js";
|
|
22
|
+
import { validateBugProfile, BUG_PROFILE_SCHEMA_VERSION, } from "./schema.js";
|
|
23
|
+
const MAX_ROUNDS = 12;
|
|
24
|
+
const MAX_FILE_READ_BYTES = 20000;
|
|
25
|
+
const DEFAULT_MODEL = "claude-opus-4-7";
|
|
26
|
+
export async function runInvestigation(ctx) {
|
|
27
|
+
const anthropic = new Anthropic({ apiKey: ctx.anthropicApiKey });
|
|
28
|
+
const userPrompt = buildInvestigateUserPrompt({
|
|
29
|
+
issueNumber: ctx.issue.number,
|
|
30
|
+
issueTitle: ctx.issue.title,
|
|
31
|
+
issueBody: ctx.issue.body,
|
|
32
|
+
prior_comments: ctx.issue.priorComments,
|
|
33
|
+
});
|
|
34
|
+
const messages = [
|
|
35
|
+
{ role: "user", content: userPrompt },
|
|
36
|
+
];
|
|
37
|
+
let spendUsd = 0;
|
|
38
|
+
let rounds = 0;
|
|
39
|
+
let finalText = "";
|
|
40
|
+
for (let round = 0; round < MAX_ROUNDS; round++) {
|
|
41
|
+
rounds = round + 1;
|
|
42
|
+
const response = await anthropic.messages.create({
|
|
43
|
+
model: ctx.model,
|
|
44
|
+
max_tokens: 4096,
|
|
45
|
+
system: INVESTIGATE_SYSTEM,
|
|
46
|
+
tools: INVESTIGATE_TOOLS,
|
|
47
|
+
messages,
|
|
48
|
+
});
|
|
49
|
+
spendUsd += costUsd(response, ctx.model);
|
|
50
|
+
// Capture the latest text block before any tool execution so we
|
|
51
|
+
// always have *something* to surface even if the round was
|
|
52
|
+
// tool-only.
|
|
53
|
+
for (const block of response.content) {
|
|
54
|
+
if (block.type === "text")
|
|
55
|
+
finalText = block.text;
|
|
56
|
+
}
|
|
57
|
+
const toolUses = response.content.filter((b) => b.type === "tool_use");
|
|
58
|
+
// If the model returned tool calls, execute them and feed back.
|
|
59
|
+
if (response.stop_reason === "tool_use" && toolUses.length > 0) {
|
|
60
|
+
const toolResults = {
|
|
61
|
+
role: "user",
|
|
62
|
+
content: toolUses.map((t) => {
|
|
63
|
+
const result = executeReadOnlyTool(ctx.repoRoot, t);
|
|
64
|
+
return {
|
|
65
|
+
type: "tool_result",
|
|
66
|
+
tool_use_id: t.id,
|
|
67
|
+
content: result.content,
|
|
68
|
+
is_error: result.is_error,
|
|
69
|
+
};
|
|
70
|
+
}),
|
|
71
|
+
};
|
|
72
|
+
messages.push({ role: "assistant", content: response.content });
|
|
73
|
+
messages.push(toolResults);
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
// Otherwise we're done — parse the final text for `<bug_profile>` or `<halt>`.
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
// 0.13.0-alpha.2c — format-compliance retry. If the agent stopped
|
|
80
|
+
// without emitting either tag, the model produced free-form prose.
|
|
81
|
+
// Send one explicit nudge to wrap the output, then accept whatever
|
|
82
|
+
// tag form lands in the second response. Reduces the "Opus
|
|
83
|
+
// forgets to wrap" failure mode observed on the first live run
|
|
84
|
+
// (rewo issue #135 validation, 2026-04-25).
|
|
85
|
+
if (!hasBugProfileBlock(finalText) && !parseHaltBlock(finalText)) {
|
|
86
|
+
rounds += 1;
|
|
87
|
+
messages.push({ role: "assistant", content: finalText });
|
|
88
|
+
messages.push({
|
|
89
|
+
role: "user",
|
|
90
|
+
content: "Your previous reply was free-form prose. Slowcook's parser greps for `<bug_profile>...</bug_profile>` (or `<halt>...</halt>`) literally. Re-emit your conclusion now using one of those two wrappers — nothing else will parse. Pick one:\n\n" +
|
|
91
|
+
"- `<bug_profile>` block with the schema fields if you have a concrete failure locus.\n" +
|
|
92
|
+
"- `<halt>` block with a one-line description of what you couldn't disambiguate.\n",
|
|
93
|
+
});
|
|
94
|
+
const retry = await anthropic.messages.create({
|
|
95
|
+
model: ctx.model,
|
|
96
|
+
max_tokens: 4096,
|
|
97
|
+
system: INVESTIGATE_SYSTEM,
|
|
98
|
+
tools: INVESTIGATE_TOOLS,
|
|
99
|
+
messages,
|
|
100
|
+
});
|
|
101
|
+
spendUsd += costUsd(retry, ctx.model);
|
|
102
|
+
for (const block of retry.content) {
|
|
103
|
+
if (block.type === "text")
|
|
104
|
+
finalText = block.text;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
const halted = parseHaltBlock(finalText);
|
|
108
|
+
if (halted) {
|
|
109
|
+
return {
|
|
110
|
+
profile: stubHaltProfile(ctx, halted),
|
|
111
|
+
spendUsd,
|
|
112
|
+
rounds,
|
|
113
|
+
halted: true,
|
|
114
|
+
haltReason: halted,
|
|
115
|
+
finalText,
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
const profile = parseBugProfileBlock(finalText, ctx);
|
|
119
|
+
return {
|
|
120
|
+
profile,
|
|
121
|
+
spendUsd,
|
|
122
|
+
rounds,
|
|
123
|
+
halted: false,
|
|
124
|
+
finalText,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
function executeReadOnlyTool(repoRoot, tool) {
|
|
128
|
+
const input = tool.input;
|
|
129
|
+
try {
|
|
130
|
+
switch (tool.name) {
|
|
131
|
+
case "read_file": {
|
|
132
|
+
const p = String(input["path"] ?? "");
|
|
133
|
+
if (!isPathSafe(repoRoot, p)) {
|
|
134
|
+
return { content: `Path escape forbidden: ${p}`, is_error: true };
|
|
135
|
+
}
|
|
136
|
+
const full = resolveRepoPath(repoRoot, p);
|
|
137
|
+
if (!existsSync(full))
|
|
138
|
+
return { content: `File not found: ${p}`, is_error: true };
|
|
139
|
+
if (!statSync(full).isFile())
|
|
140
|
+
return { content: `Not a file: ${p}`, is_error: true };
|
|
141
|
+
const txt = readFileSync(full, "utf8");
|
|
142
|
+
return {
|
|
143
|
+
content: txt.length > MAX_FILE_READ_BYTES
|
|
144
|
+
? txt.slice(0, MAX_FILE_READ_BYTES) + "\n…(truncated)"
|
|
145
|
+
: txt,
|
|
146
|
+
is_error: false,
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
case "outline_file": {
|
|
150
|
+
const p = String(input["path"] ?? "");
|
|
151
|
+
if (!isPathSafe(repoRoot, p)) {
|
|
152
|
+
return { content: `Path escape forbidden: ${p}`, is_error: true };
|
|
153
|
+
}
|
|
154
|
+
const full = resolveRepoPath(repoRoot, p);
|
|
155
|
+
if (!existsSync(full))
|
|
156
|
+
return { content: `File not found: ${p}`, is_error: true };
|
|
157
|
+
if (!statSync(full).isFile())
|
|
158
|
+
return { content: `Not a file: ${p}`, is_error: true };
|
|
159
|
+
const txt = readFileSync(full, "utf8");
|
|
160
|
+
return { content: outlineFile(p, txt), is_error: false };
|
|
161
|
+
}
|
|
162
|
+
case "list_directory": {
|
|
163
|
+
const p = String(input["path"] ?? "");
|
|
164
|
+
if (!isPathSafe(repoRoot, p)) {
|
|
165
|
+
return { content: `Path escape forbidden: ${p}`, is_error: true };
|
|
166
|
+
}
|
|
167
|
+
const full = resolveRepoPath(repoRoot, p);
|
|
168
|
+
if (!existsSync(full))
|
|
169
|
+
return { content: `Not found: ${p}`, is_error: true };
|
|
170
|
+
if (!statSync(full).isDirectory())
|
|
171
|
+
return { content: `Not a directory: ${p}`, is_error: true };
|
|
172
|
+
const entries = readdirSync(full, { withFileTypes: true })
|
|
173
|
+
.map((e) => `${e.name}${e.isDirectory() ? "/" : ""}`)
|
|
174
|
+
.sort()
|
|
175
|
+
.join("\n");
|
|
176
|
+
return { content: entries, is_error: false };
|
|
177
|
+
}
|
|
178
|
+
case "find_references": {
|
|
179
|
+
const symbol = String(input["symbol"] ?? "").trim();
|
|
180
|
+
if (!symbol)
|
|
181
|
+
return { content: "symbol is required", is_error: true };
|
|
182
|
+
const refs = findReferences(repoRoot, symbol, { excludeDefinitions: false });
|
|
183
|
+
return { content: renderReferences(refs), is_error: false };
|
|
184
|
+
}
|
|
185
|
+
case "find_definition": {
|
|
186
|
+
const symbol = String(input["symbol"] ?? "").trim();
|
|
187
|
+
if (!symbol)
|
|
188
|
+
return { content: "symbol is required", is_error: true };
|
|
189
|
+
const def = findDefinition(repoRoot, symbol);
|
|
190
|
+
if (!def)
|
|
191
|
+
return { content: `(no declaration found for ${symbol})`, is_error: false };
|
|
192
|
+
return {
|
|
193
|
+
content: `${def.kind} | ${def.file}:${def.line}:${def.column} | ${def.context}`,
|
|
194
|
+
is_error: false,
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
case "grep": {
|
|
198
|
+
const pattern = String(input["pattern"] ?? "");
|
|
199
|
+
const glob = input["glob"] ? String(input["glob"]) : undefined;
|
|
200
|
+
if (!pattern)
|
|
201
|
+
return { content: "pattern is required", is_error: true };
|
|
202
|
+
return runGrep(repoRoot, pattern, glob);
|
|
203
|
+
}
|
|
204
|
+
default:
|
|
205
|
+
return { content: `Unknown tool: ${tool.name}`, is_error: true };
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
catch (e) {
|
|
209
|
+
return { content: `Tool error: ${e.message}`, is_error: true };
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
function isPathSafe(repoRoot, relPath) {
|
|
213
|
+
if (isAbsolute(relPath))
|
|
214
|
+
return false;
|
|
215
|
+
const resolved = resolve(repoRoot, relPath);
|
|
216
|
+
return resolved.startsWith(resolve(repoRoot));
|
|
217
|
+
}
|
|
218
|
+
function resolveRepoPath(repoRoot, relPath) {
|
|
219
|
+
return resolve(repoRoot, relPath);
|
|
220
|
+
}
|
|
221
|
+
function runGrep(repoRoot, pattern, glob) {
|
|
222
|
+
// Sanitize: no shell metas in pattern. Use rg's -e flag so the
|
|
223
|
+
// pattern is treated literally except for regex chars.
|
|
224
|
+
const safePattern = pattern.replace(/'/g, "'\\''");
|
|
225
|
+
const cmd = glob
|
|
226
|
+
? `rg --line-number --max-count=50 -e '${safePattern}' --glob '${glob.replace(/'/g, "'\\''")}'`
|
|
227
|
+
: `rg --line-number --max-count=50 -e '${safePattern}'`;
|
|
228
|
+
try {
|
|
229
|
+
const out = execSync(cmd, {
|
|
230
|
+
cwd: repoRoot,
|
|
231
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
232
|
+
maxBuffer: 1024 * 256,
|
|
233
|
+
encoding: "utf8",
|
|
234
|
+
});
|
|
235
|
+
if (!out.trim())
|
|
236
|
+
return { content: "(no matches)", is_error: false };
|
|
237
|
+
return {
|
|
238
|
+
content: out.length > MAX_FILE_READ_BYTES ? out.slice(0, MAX_FILE_READ_BYTES) + "\n…(truncated)" : out,
|
|
239
|
+
is_error: false,
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
catch (e) {
|
|
243
|
+
// rg returns exit 1 when no matches — surface as "no matches", not an error.
|
|
244
|
+
const exit = e.status;
|
|
245
|
+
if (exit === 1)
|
|
246
|
+
return { content: "(no matches)", is_error: false };
|
|
247
|
+
return { content: `grep error: ${e.message}`, is_error: true };
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
// -------------------------------------------------------------------------
|
|
251
|
+
// Output parsing
|
|
252
|
+
// -------------------------------------------------------------------------
|
|
253
|
+
/**
|
|
254
|
+
* Extract the YAML body from a `<bug_profile>...</bug_profile>` block,
|
|
255
|
+
* parse + validate it. Throws on missing block / invalid YAML / failed
|
|
256
|
+
* schema validation. The agent prompt explicitly requires the block;
|
|
257
|
+
* a missing block is a contract violation.
|
|
258
|
+
*/
|
|
259
|
+
export function parseBugProfileBlock(finalText, ctx) {
|
|
260
|
+
const match = finalText.match(/<bug_profile>([\s\S]*?)<\/bug_profile>/);
|
|
261
|
+
if (!match || !match[1]) {
|
|
262
|
+
throw new Error(`investigate: agent did not emit a <bug_profile> block. Final text:\n${finalText.slice(0, 500)}`);
|
|
263
|
+
}
|
|
264
|
+
const yaml = match[1].trim();
|
|
265
|
+
const parsed = parseSimpleYaml(yaml);
|
|
266
|
+
if (!parsed || typeof parsed !== "object") {
|
|
267
|
+
throw new Error(`investigate: <bug_profile> contents could not be parsed as YAML`);
|
|
268
|
+
}
|
|
269
|
+
const profile = parsed;
|
|
270
|
+
// Slowcook fills the bug_id (race-aware) and stamps the version
|
|
271
|
+
// server-side; we override whatever the LLM put there. created_at
|
|
272
|
+
// similarly authoritative on slowcook's clock.
|
|
273
|
+
profile["bug_id"] = ctx.bugId;
|
|
274
|
+
profile["investigated_by"] = `slowcook-investigate@${ctx.cliVersion}`;
|
|
275
|
+
profile["created_at"] = (ctx.now?.() ?? new Date()).toISOString();
|
|
276
|
+
profile["status"] = "investigated";
|
|
277
|
+
if (!profile["schema_version"])
|
|
278
|
+
profile["schema_version"] = BUG_PROFILE_SCHEMA_VERSION;
|
|
279
|
+
const validation = validateBugProfile(profile);
|
|
280
|
+
if (!validation.ok) {
|
|
281
|
+
// Include the raw YAML + parsed object so the operator can see
|
|
282
|
+
// exactly what the agent emitted vs what the schema expected.
|
|
283
|
+
// 0.13.0-alpha.3.2 — debug-friendly error shape.
|
|
284
|
+
throw new Error(`investigate: agent emitted an invalid bug-profile:\n` +
|
|
285
|
+
` ${validation.errors.join("\n ")}\n\n` +
|
|
286
|
+
`Raw YAML the agent emitted:\n` +
|
|
287
|
+
`------------\n${yaml}\n------------\n\n` +
|
|
288
|
+
`Parsed object: ${JSON.stringify(profile, null, 2)}`);
|
|
289
|
+
}
|
|
290
|
+
return validation.profile;
|
|
291
|
+
}
|
|
292
|
+
function parseHaltBlock(text) {
|
|
293
|
+
const m = text.match(/<halt>([\s\S]*?)<\/halt>/);
|
|
294
|
+
return m ? (m[1] ?? "").trim() : null;
|
|
295
|
+
}
|
|
296
|
+
function hasBugProfileBlock(text) {
|
|
297
|
+
return /<bug_profile>[\s\S]*?<\/bug_profile>/.test(text);
|
|
298
|
+
}
|
|
299
|
+
function stubHaltProfile(ctx, reason) {
|
|
300
|
+
return {
|
|
301
|
+
schema_version: BUG_PROFILE_SCHEMA_VERSION,
|
|
302
|
+
bug_id: ctx.bugId,
|
|
303
|
+
title: ctx.issue.title,
|
|
304
|
+
source_issue: `#${ctx.issue.number}`,
|
|
305
|
+
status: "investigated",
|
|
306
|
+
investigated_by: `slowcook-investigate@${ctx.cliVersion}-halted`,
|
|
307
|
+
created_at: (ctx.now?.() ?? new Date()).toISOString(),
|
|
308
|
+
symptom: ["(investigation halted; see haltReason)"],
|
|
309
|
+
expected: [],
|
|
310
|
+
reproduction: [],
|
|
311
|
+
failure_locus: {
|
|
312
|
+
file: "(unknown — investigate halted)",
|
|
313
|
+
diagnosis: reason,
|
|
314
|
+
},
|
|
315
|
+
regression_assertion: [],
|
|
316
|
+
fix_scope: [],
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Minimal YAML subset parser. Handles the shape investigate emits:
|
|
321
|
+
* - top-level scalar `key: value` (string, number, or quoted string)
|
|
322
|
+
* - `key:` followed by ` - "string"` list items
|
|
323
|
+
* - `key:` followed by indented `child: value` pairs (one level deep)
|
|
324
|
+
* - block scalars `key: |` followed by indented lines
|
|
325
|
+
*
|
|
326
|
+
* NOT a general YAML parser. We avoid pulling `yaml` dep into this
|
|
327
|
+
* module; the agent's output has a constrained shape that this can
|
|
328
|
+
* cover. Falls back to throwing on anything outside that shape, which
|
|
329
|
+
* surfaces parser drift as a clear error rather than silent miss.
|
|
330
|
+
*/
|
|
331
|
+
export function parseSimpleYaml(src) {
|
|
332
|
+
const lines = src.replace(/\r\n/g, "\n").split("\n");
|
|
333
|
+
const out = {};
|
|
334
|
+
let i = 0;
|
|
335
|
+
while (i < lines.length) {
|
|
336
|
+
const line = lines[i] ?? "";
|
|
337
|
+
if (line.trim() === "" || line.trim().startsWith("#")) {
|
|
338
|
+
i++;
|
|
339
|
+
continue;
|
|
340
|
+
}
|
|
341
|
+
const indent = line.match(/^ */)?.[0].length ?? 0;
|
|
342
|
+
if (indent !== 0) {
|
|
343
|
+
throw new Error(`Top-level YAML key expected; got indented line: ${line}`);
|
|
344
|
+
}
|
|
345
|
+
// top-level
|
|
346
|
+
const m = line.match(/^([A-Za-z_$][A-Za-z0-9_$]*)\s*:\s*(.*)$/);
|
|
347
|
+
if (!m)
|
|
348
|
+
throw new Error(`Cannot parse YAML line: ${line}`);
|
|
349
|
+
const key = m[1] ?? "";
|
|
350
|
+
const rest = (m[2] ?? "").trim();
|
|
351
|
+
if (rest === "") {
|
|
352
|
+
// Block: read indented children
|
|
353
|
+
const block = [];
|
|
354
|
+
const obj = {};
|
|
355
|
+
let mode = "empty";
|
|
356
|
+
i++;
|
|
357
|
+
while (i < lines.length) {
|
|
358
|
+
const next = lines[i] ?? "";
|
|
359
|
+
const ind = next.match(/^ */)?.[0].length ?? 0;
|
|
360
|
+
if (next.trim() === "" || next.trim().startsWith("#")) {
|
|
361
|
+
i++;
|
|
362
|
+
continue;
|
|
363
|
+
}
|
|
364
|
+
if (ind === 0)
|
|
365
|
+
break;
|
|
366
|
+
if (next.trim().startsWith("- ")) {
|
|
367
|
+
mode = "list";
|
|
368
|
+
const itemRaw = next.replace(/^\s*-\s*/, "");
|
|
369
|
+
if (itemRaw.startsWith('"')) {
|
|
370
|
+
block.push(unquote(itemRaw));
|
|
371
|
+
}
|
|
372
|
+
else if (/^[A-Za-z_][A-Za-z0-9_]*\s*:/.test(itemRaw)) {
|
|
373
|
+
// List of objects (e.g., related_specs)
|
|
374
|
+
const item = {};
|
|
375
|
+
const firstMatch = itemRaw.match(/^([A-Za-z_$][A-Za-z0-9_$]*)\s*:\s*(.*)$/);
|
|
376
|
+
if (firstMatch) {
|
|
377
|
+
item[firstMatch[1] ?? ""] = parseScalar(firstMatch[2] ?? "");
|
|
378
|
+
}
|
|
379
|
+
i++;
|
|
380
|
+
// Continuation lines for this list item: indented strictly
|
|
381
|
+
// more than the `- ` itself. Breaks on a new sibling (`- `
|
|
382
|
+
// at same indent) or any less-indented line.
|
|
383
|
+
while (i < lines.length) {
|
|
384
|
+
const cont = lines[i] ?? "";
|
|
385
|
+
const contInd = cont.match(/^ */)?.[0].length ?? 0;
|
|
386
|
+
if (contInd <= ind)
|
|
387
|
+
break;
|
|
388
|
+
if (cont.trim() === "") {
|
|
389
|
+
i++;
|
|
390
|
+
continue;
|
|
391
|
+
}
|
|
392
|
+
const cm = cont.trim().match(/^([A-Za-z_$][A-Za-z0-9_$]*)\s*:\s*(.*)$/);
|
|
393
|
+
if (!cm)
|
|
394
|
+
break;
|
|
395
|
+
item[cm[1] ?? ""] = parseScalar(cm[2] ?? "");
|
|
396
|
+
i++;
|
|
397
|
+
}
|
|
398
|
+
block.push(item);
|
|
399
|
+
continue;
|
|
400
|
+
}
|
|
401
|
+
else {
|
|
402
|
+
block.push(itemRaw);
|
|
403
|
+
}
|
|
404
|
+
i++;
|
|
405
|
+
}
|
|
406
|
+
else {
|
|
407
|
+
mode = "object";
|
|
408
|
+
// child key
|
|
409
|
+
const cm = next.trim().match(/^([A-Za-z_$][A-Za-z0-9_$]*)\s*:\s*(.*)$/);
|
|
410
|
+
if (!cm)
|
|
411
|
+
throw new Error(`Cannot parse YAML child line: ${next}`);
|
|
412
|
+
const ckey = cm[1] ?? "";
|
|
413
|
+
const cval = (cm[2] ?? "").trim();
|
|
414
|
+
if (cval === "|") {
|
|
415
|
+
// Block scalar — collect indented continuation lines.
|
|
416
|
+
i++;
|
|
417
|
+
const blockLines = [];
|
|
418
|
+
const blockIndent = ind + 2;
|
|
419
|
+
while (i < lines.length) {
|
|
420
|
+
const cont = lines[i] ?? "";
|
|
421
|
+
const contInd = cont.match(/^ */)?.[0].length ?? 0;
|
|
422
|
+
if (cont.trim() === "") {
|
|
423
|
+
blockLines.push("");
|
|
424
|
+
i++;
|
|
425
|
+
continue;
|
|
426
|
+
}
|
|
427
|
+
if (contInd < blockIndent)
|
|
428
|
+
break;
|
|
429
|
+
blockLines.push(cont.slice(blockIndent));
|
|
430
|
+
i++;
|
|
431
|
+
}
|
|
432
|
+
obj[ckey] = blockLines.join("\n").replace(/\n+$/, "");
|
|
433
|
+
}
|
|
434
|
+
else {
|
|
435
|
+
obj[ckey] = parseScalar(cval);
|
|
436
|
+
i++;
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
if (mode === "list")
|
|
441
|
+
out[key] = block;
|
|
442
|
+
else if (mode === "object")
|
|
443
|
+
out[key] = obj;
|
|
444
|
+
else
|
|
445
|
+
out[key] = null;
|
|
446
|
+
}
|
|
447
|
+
else {
|
|
448
|
+
out[key] = parseScalar(rest);
|
|
449
|
+
i++;
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
return out;
|
|
453
|
+
}
|
|
454
|
+
function parseScalar(raw) {
|
|
455
|
+
const v = raw.trim();
|
|
456
|
+
if (v === "null")
|
|
457
|
+
return null;
|
|
458
|
+
if (v === "true")
|
|
459
|
+
return true;
|
|
460
|
+
if (v === "false")
|
|
461
|
+
return false;
|
|
462
|
+
if (/^-?\d+$/.test(v))
|
|
463
|
+
return parseInt(v, 10);
|
|
464
|
+
if (/^-?\d+\.\d+$/.test(v))
|
|
465
|
+
return parseFloat(v);
|
|
466
|
+
if (v.startsWith('"'))
|
|
467
|
+
return unquote(v);
|
|
468
|
+
return v;
|
|
469
|
+
}
|
|
470
|
+
function unquote(s) {
|
|
471
|
+
const v = s.trim();
|
|
472
|
+
if (!v.startsWith('"') || !v.endsWith('"'))
|
|
473
|
+
return v;
|
|
474
|
+
return v
|
|
475
|
+
.slice(1, -1)
|
|
476
|
+
.replace(/\\"/g, '"')
|
|
477
|
+
.replace(/\\\\/g, "\\")
|
|
478
|
+
.replace(/\\n/g, "\n");
|
|
479
|
+
}
|
|
480
|
+
// -------------------------------------------------------------------------
|
|
481
|
+
// Cost accounting (mirrors brew's matchPricing without depending on it)
|
|
482
|
+
// -------------------------------------------------------------------------
|
|
483
|
+
const PRICING_PER_M_TOKENS = {
|
|
484
|
+
"claude-opus-4-7": { input: 15, output: 75 },
|
|
485
|
+
"claude-sonnet-4-6": { input: 3, output: 15 },
|
|
486
|
+
"claude-sonnet-4-5": { input: 3, output: 15 },
|
|
487
|
+
"claude-haiku-4-5": { input: 1, output: 5 },
|
|
488
|
+
};
|
|
489
|
+
function costUsd(response, model) {
|
|
490
|
+
const pricing = PRICING_PER_M_TOKENS[model] ??
|
|
491
|
+
Object.entries(PRICING_PER_M_TOKENS).find(([k]) => model.startsWith(k))?.[1];
|
|
492
|
+
if (!pricing)
|
|
493
|
+
return 0;
|
|
494
|
+
const usage = response.usage;
|
|
495
|
+
const input = usage?.input_tokens ?? 0;
|
|
496
|
+
const output = usage?.output_tokens ?? 0;
|
|
497
|
+
const cacheRead = usage?.cache_read_input_tokens ?? 0;
|
|
498
|
+
const cacheCreate = usage?.cache_creation_input_tokens ?? 0;
|
|
499
|
+
const effectiveInput = input + cacheRead * 0.1 + cacheCreate * 1.25;
|
|
500
|
+
return (effectiveInput / 1_000_000) * pricing.input + (output / 1_000_000) * pricing.output;
|
|
501
|
+
}
|
|
502
|
+
void DEFAULT_MODEL;
|
|
503
|
+
//# sourceMappingURL=agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent.js","sourceRoot":"","sources":["../../../src/commands/investigate/agent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EACL,UAAU,EACV,YAAY,EACZ,WAAW,EACX,QAAQ,GACT,MAAM,SAAS,CAAC;AACjB,OAAO,EAAQ,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,SAAS,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EACL,cAAc,EACd,cAAc,EACd,gBAAgB,GACjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,0BAA0B,GAC3B,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,kBAAkB,EAElB,0BAA0B,GAC3B,MAAM,aAAa,CAAC;AAErB,MAAM,UAAU,GAAG,EAAE,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AC,KAAK,GAAG,CAAC,MAAM,GAAG,SAAS,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;AAC9F,CAAC;AAED,KAAK,aAAa,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `slowcook investigate` — bug-flow analogue of refine.
|
|
3
|
+
*
|
|
4
|
+
* Reads a GitHub issue (label: `bug`), uses code tools to find the
|
|
5
|
+
* failure locus, emits `.brewing/bug-profiles/B-<id>.yaml` and opens
|
|
6
|
+
* a PR proposing the profile. The PR's merge triggers
|
|
7
|
+
* `slowcook-recipe-regression.yml` (alpha.3) which kicks off
|
|
8
|
+
* `recipe --regression` to write the failing test.
|
|
9
|
+
*
|
|
10
|
+
* **Status**: alpha.2a — scaffold only. Parses args, prints what it
|
|
11
|
+
* WOULD do. Real LLM agent + PR opening land in alpha.2b. Calling the
|
|
12
|
+
* command today exits with a clear "not yet implemented" notice so
|
|
13
|
+
* accidental wiring (e.g., a workflow trigger) fails fast and visibly.
|
|
14
|
+
*/
|
|
15
|
+
import { type BugProfile } from "./schema.js";
|
|
16
|
+
/**
|
|
17
|
+
* Pick the next free bug-id by walking `.brewing/bug-profiles/`
|
|
18
|
+
* (and once branches exist, also \`slowcook/bug-profile/B-*\`). Same
|
|
19
|
+
* race-aware pattern as story-id assignment (slowcook#8 fix).
|
|
20
|
+
*
|
|
21
|
+
* Exposed for use by alpha.2b once the agent emits real profiles.
|
|
22
|
+
*/
|
|
23
|
+
export declare function pickNextBugId(repoRoot: string): string;
|
|
24
|
+
/**
|
|
25
|
+
* Build a stub bug profile from issue metadata only — no code reading.
|
|
26
|
+
* alpha.2a placeholder. alpha.2b replaces this with an LLM-driven
|
|
27
|
+
* agent that actually investigates.
|
|
28
|
+
*/
|
|
29
|
+
export declare function buildStubProfile(args: {
|
|
30
|
+
issueNumber: number;
|
|
31
|
+
issueTitle: string;
|
|
32
|
+
bugId: string;
|
|
33
|
+
cliVersion: string;
|
|
34
|
+
now: Date;
|
|
35
|
+
}): BugProfile;
|
|
36
|
+
export declare function investigate(argv: string[], cliVersion: string): Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* Render a BugProfile as YAML. Hand-rolled because we don't want to
|
|
39
|
+
* pull a YAML lib dep just for emission. The schema is small enough
|
|
40
|
+
* that this is fine.
|
|
41
|
+
*/
|
|
42
|
+
export declare function renderProfileAsYaml(profile: BugProfile): string;
|
|
43
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/investigate/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAMH,OAAO,EAEL,KAAK,UAAU,EAEhB,MAAM,aAAa,CAAC;AAiGrB;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAatD;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE;IACrC,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE,IAAI,CAAC;CACX,GAAG,UAAU,CAmBb;AAED,wBAAsB,WAAW,CAC/B,IAAI,EAAE,MAAM,EAAE,EACd,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,IAAI,CAAC,CAyDf;AAyND;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,UAAU,GAAG,MAAM,CAuC/D"}
|