@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.
Files changed (56) hide show
  1. package/dist/cli.js +41 -2
  2. package/dist/cli.js.map +1 -1
  3. package/dist/commands/brew/agent.d.ts.map +1 -1
  4. package/dist/commands/brew/agent.js +19 -6
  5. package/dist/commands/brew/agent.js.map +1 -1
  6. package/dist/commands/chef/classify.d.ts +65 -0
  7. package/dist/commands/chef/classify.d.ts.map +1 -0
  8. package/dist/commands/chef/classify.js +102 -0
  9. package/dist/commands/chef/classify.js.map +1 -0
  10. package/dist/commands/chef/index.d.ts +22 -0
  11. package/dist/commands/chef/index.d.ts.map +1 -0
  12. package/dist/commands/chef/index.js +287 -0
  13. package/dist/commands/chef/index.js.map +1 -0
  14. package/dist/commands/dispatch/index.d.ts.map +1 -1
  15. package/dist/commands/dispatch/index.js +10 -3
  16. package/dist/commands/dispatch/index.js.map +1 -1
  17. package/dist/commands/investigate/agent.d.ts +68 -0
  18. package/dist/commands/investigate/agent.d.ts.map +1 -0
  19. package/dist/commands/investigate/agent.js +503 -0
  20. package/dist/commands/investigate/agent.js.map +1 -0
  21. package/dist/commands/investigate/index.d.ts +43 -0
  22. package/dist/commands/investigate/index.d.ts.map +1 -0
  23. package/dist/commands/investigate/index.js +413 -0
  24. package/dist/commands/investigate/index.js.map +1 -0
  25. package/dist/commands/investigate/prompts.d.ts +90 -0
  26. package/dist/commands/investigate/prompts.d.ts.map +1 -0
  27. package/dist/commands/investigate/prompts.js +237 -0
  28. package/dist/commands/investigate/prompts.js.map +1 -0
  29. package/dist/commands/investigate/schema.d.ts +91 -0
  30. package/dist/commands/investigate/schema.d.ts.map +1 -0
  31. package/dist/commands/investigate/schema.js +87 -0
  32. package/dist/commands/investigate/schema.js.map +1 -0
  33. package/dist/commands/on-brew-merged/index.d.ts.map +1 -1
  34. package/dist/commands/on-brew-merged/index.js +27 -6
  35. package/dist/commands/on-brew-merged/index.js.map +1 -1
  36. package/dist/commands/recipe-regression/agent.d.ts +94 -0
  37. package/dist/commands/recipe-regression/agent.d.ts.map +1 -0
  38. package/dist/commands/recipe-regression/agent.js +442 -0
  39. package/dist/commands/recipe-regression/agent.js.map +1 -0
  40. package/dist/commands/recipe-regression/index.d.ts +61 -0
  41. package/dist/commands/recipe-regression/index.d.ts.map +1 -0
  42. package/dist/commands/recipe-regression/index.js +187 -0
  43. package/dist/commands/recipe-regression/index.js.map +1 -0
  44. package/dist/commands/sift/agent.d.ts +52 -0
  45. package/dist/commands/sift/agent.d.ts.map +1 -0
  46. package/dist/commands/sift/agent.js +392 -0
  47. package/dist/commands/sift/agent.js.map +1 -0
  48. package/dist/commands/sift/index.d.ts +23 -0
  49. package/dist/commands/sift/index.d.ts.map +1 -0
  50. package/dist/commands/sift/index.js +314 -0
  51. package/dist/commands/sift/index.js.map +1 -0
  52. package/dist/commands/sift/prompts.d.ts +114 -0
  53. package/dist/commands/sift/prompts.d.ts.map +1 -0
  54. package/dist/commands/sift/prompts.js +193 -0
  55. package/dist/commands/sift/prompts.js.map +1 -0
  56. package/package.json +4 -4
@@ -0,0 +1,413 @@
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 { mkdirSync, writeFileSync, existsSync, readdirSync } from "node:fs";
16
+ import { join } from "node:path";
17
+ import { execSync } from "node:child_process";
18
+ import { GitHubAdapter } from "@slowcook-ai/forge-github";
19
+ import { validateBugProfile, BUG_PROFILE_SCHEMA_VERSION, } from "./schema.js";
20
+ import { runInvestigation } from "./agent.js";
21
+ function parseArgs(argv) {
22
+ const args = {
23
+ issueNumber: 0,
24
+ repoRoot: process.cwd(),
25
+ dryRun: false,
26
+ stub: false,
27
+ model: "claude-opus-4-7",
28
+ noPr: false,
29
+ };
30
+ for (let i = 0; i < argv.length; i++) {
31
+ const arg = argv[i];
32
+ const next = argv[i + 1];
33
+ if ((arg === "--issue" || arg === "-i") && next) {
34
+ args.issueNumber = parseInt(next, 10);
35
+ i++;
36
+ }
37
+ else if (arg === "--cwd" && next) {
38
+ args.repoRoot = next;
39
+ i++;
40
+ }
41
+ else if (arg === "--dry-run") {
42
+ args.dryRun = true;
43
+ }
44
+ else if (arg === "--stub") {
45
+ args.stub = true;
46
+ }
47
+ else if (arg === "--no-pr") {
48
+ args.noPr = true;
49
+ }
50
+ else if (arg === "--owner" && next) {
51
+ args.owner = next;
52
+ i++;
53
+ }
54
+ else if (arg === "--repo" && next) {
55
+ args.repo = next;
56
+ i++;
57
+ }
58
+ else if (arg === "--model" && next) {
59
+ args.model = next;
60
+ i++;
61
+ }
62
+ else if (arg === "--help" || arg === "-h") {
63
+ printHelp();
64
+ process.exit(0);
65
+ }
66
+ }
67
+ return args;
68
+ }
69
+ function printHelp() {
70
+ console.log(`
71
+ slowcook investigate — diagnose a bug from a GitHub issue and emit a bug-profile.
72
+
73
+ Usage:
74
+ slowcook investigate --issue <number> [--cwd <path>] [--model <id>] [--dry-run] [--stub]
75
+
76
+ Status: alpha.2b — real LLM agent integration. PR opening (auto-branch
77
+ + push + PR open) lands in alpha.2c. Today: writes the bug-profile to
78
+ .brewing/bug-profiles/B-<n>.yaml.
79
+
80
+ What it does:
81
+ 1. Fetches issue #<number> body + prior comments via gh
82
+ 2. Runs an LLM agent loop with read-only code tools
83
+ (read_file, outline_file, list_directory, find_references,
84
+ find_definition, grep)
85
+ 3. Validates the agent's <bug_profile> output against the schema
86
+ (schema_version ${BUG_PROFILE_SCHEMA_VERSION})
87
+ 4. Writes .brewing/bug-profiles/B-<n>.yaml
88
+
89
+ Flags:
90
+ --issue <n> GitHub issue number (required).
91
+ --cwd <path> Repo root (default: cwd).
92
+ --model <id> LLM model. Default: claude-opus-4-7.
93
+ --dry-run Print profile + agent stats, don't write to disk.
94
+ --stub Emit a stub profile without calling the LLM (alpha.2a
95
+ behaviour; useful for testing the file layout).
96
+
97
+ Environment:
98
+ ANTHROPIC_API_KEY Required unless --stub. The agent makes Anthropic
99
+ API calls; cost varies by model + bug complexity
100
+ ($0.05–$0.50 typical for opus, $0.01–$0.10 for sonnet).
101
+ GITHUB_TOKEN Required to fetch the issue body via gh CLI.
102
+ Falls back to gh's auth if unset.
103
+ `);
104
+ }
105
+ /**
106
+ * Pick the next free bug-id by walking `.brewing/bug-profiles/`
107
+ * (and once branches exist, also \`slowcook/bug-profile/B-*\`). Same
108
+ * race-aware pattern as story-id assignment (slowcook#8 fix).
109
+ *
110
+ * Exposed for use by alpha.2b once the agent emits real profiles.
111
+ */
112
+ export function pickNextBugId(repoRoot) {
113
+ const dir = join(repoRoot, ".brewing/bug-profiles");
114
+ let max = 0;
115
+ if (existsSync(dir)) {
116
+ for (const entry of readdirSync(dir)) {
117
+ const m = entry.match(/^B-(\d+)\.ya?ml$/);
118
+ if (m) {
119
+ const n = parseInt(m[1] ?? "0", 10);
120
+ if (n > max)
121
+ max = n;
122
+ }
123
+ }
124
+ }
125
+ return `B-${max + 1}`;
126
+ }
127
+ /**
128
+ * Build a stub bug profile from issue metadata only — no code reading.
129
+ * alpha.2a placeholder. alpha.2b replaces this with an LLM-driven
130
+ * agent that actually investigates.
131
+ */
132
+ export function buildStubProfile(args) {
133
+ return {
134
+ schema_version: BUG_PROFILE_SCHEMA_VERSION,
135
+ bug_id: args.bugId,
136
+ title: args.issueTitle,
137
+ source_issue: `#${args.issueNumber}`,
138
+ status: "investigated",
139
+ investigated_by: `slowcook-investigate@${args.cliVersion}-stub`,
140
+ created_at: args.now.toISOString(),
141
+ symptom: ["(not yet investigated — alpha.2a stub)"],
142
+ expected: ["(not yet investigated — alpha.2a stub)"],
143
+ reproduction: ["(not yet investigated — alpha.2a stub)"],
144
+ failure_locus: {
145
+ file: "(unknown)",
146
+ diagnosis: "Stub profile emitted by alpha.2a scaffold. Real investigation lands in alpha.2b.",
147
+ },
148
+ regression_assertion: ["(not yet investigated — alpha.2a stub)"],
149
+ fix_scope: [],
150
+ };
151
+ }
152
+ export async function investigate(argv, cliVersion) {
153
+ const args = parseArgs(argv);
154
+ if (!args.issueNumber || isNaN(args.issueNumber)) {
155
+ console.error("slowcook investigate: --issue <number> is required");
156
+ printHelp();
157
+ process.exit(64);
158
+ }
159
+ const bugId = pickNextBugId(args.repoRoot);
160
+ const now = new Date();
161
+ // ---- Stub path (alpha.2a-style; kept for testing without API key) ----
162
+ if (args.stub) {
163
+ console.error(`slowcook investigate (${cliVersion}) — --stub mode. No LLM call; emitting placeholder profile.`);
164
+ const profile = buildStubProfile({
165
+ issueNumber: args.issueNumber,
166
+ issueTitle: `(issue #${args.issueNumber})`,
167
+ bugId,
168
+ cliVersion,
169
+ now,
170
+ });
171
+ return finaliseProfile(profile, args, bugId, cliVersion);
172
+ }
173
+ // ---- Real agent path (alpha.2b) ----
174
+ const apiKey = process.env["ANTHROPIC_API_KEY"];
175
+ if (!apiKey) {
176
+ console.error("slowcook investigate: ANTHROPIC_API_KEY is required (or use --stub for placeholder)");
177
+ process.exit(78);
178
+ }
179
+ console.error(`slowcook investigate (${cliVersion}) — issue #${args.issueNumber}, model ${args.model}, bug-id ${bugId}.`);
180
+ console.error(`Fetching issue from GitHub…`);
181
+ const issue = fetchIssueViaGh(args.issueNumber, args.repoRoot);
182
+ console.error(`Running investigation agent (read-only tools, max 12 rounds)…`);
183
+ const result = await runInvestigation({
184
+ repoRoot: args.repoRoot,
185
+ anthropicApiKey: apiKey,
186
+ model: args.model,
187
+ bugId,
188
+ cliVersion,
189
+ issue,
190
+ now: () => now,
191
+ });
192
+ console.error(`Agent done: ${result.rounds} round(s), $${result.spendUsd.toFixed(4)} spent${result.halted ? ` (HALTED: ${result.haltReason})` : ""}.`);
193
+ return finaliseProfile(result.profile, args, bugId, cliVersion);
194
+ }
195
+ async function finaliseProfile(profile, args, bugId, cliVersion) {
196
+ const validation = validateBugProfile(profile);
197
+ if (!validation.ok) {
198
+ console.error(`slowcook investigate: profile failed validation:`);
199
+ for (const e of validation.errors)
200
+ console.error(` - ${e}`);
201
+ process.exit(70);
202
+ }
203
+ if (args.dryRun) {
204
+ console.log(renderProfileAsYaml(validation.profile));
205
+ console.error("\n(dry-run: not writing to disk)");
206
+ process.exit(0);
207
+ }
208
+ const relPath = `.brewing/bug-profiles/${bugId}.yaml`;
209
+ const fullPath = join(args.repoRoot, relPath);
210
+ mkdirSync(join(args.repoRoot, ".brewing/bug-profiles"), { recursive: true });
211
+ writeFileSync(fullPath, renderProfileAsYaml(validation.profile), "utf8");
212
+ console.error(`Wrote ${relPath}.`);
213
+ if (args.noPr) {
214
+ console.error(`Next: review the profile, then 'slowcook recipe --regression --bug ${bugId}' (alpha.3) to emit the regression test.`);
215
+ process.exit(0);
216
+ }
217
+ // 0.13.0-alpha.5a — open the bug-profile PR. Mirrors the refine
218
+ // pattern: branch off main, commit the YAML, push, open PR.
219
+ await openBugProfilePr({
220
+ repoRoot: args.repoRoot,
221
+ bugId,
222
+ profile: validation.profile,
223
+ relPath,
224
+ owner: args.owner,
225
+ repo: args.repo,
226
+ cliVersion,
227
+ });
228
+ }
229
+ async function openBugProfilePr(args) {
230
+ const githubToken = process.env["GITHUB_TOKEN"];
231
+ if (!githubToken) {
232
+ console.error("GITHUB_TOKEN not set — bug profile written to disk but PR not opened. Re-run with --no-pr to suppress this notice, or set the token.");
233
+ process.exit(0);
234
+ }
235
+ const detected = detectOwnerRepo(args.repoRoot);
236
+ const owner = args.owner ?? detected?.owner;
237
+ const repo = args.repo ?? detected?.repo;
238
+ if (!owner || !repo) {
239
+ console.error("Could not detect owner/repo from git remote — pass --owner + --repo explicitly.");
240
+ process.exit(2);
241
+ }
242
+ const branch = `slowcook/bug-profile/${args.bugId}`;
243
+ const forge = new GitHubAdapter({ owner, repo, token: githubToken });
244
+ try {
245
+ await forge.git.createBranch(branch);
246
+ await forge.git.stage(args.relPath);
247
+ // forge git op author identity is configured by the caller (workflow
248
+ // step) — see slowcook-investigate.yml's `git config user.*` step.
249
+ await forge.git.commit(`slowcook: bug profile ${args.bugId} (from issue ${args.profile.source_issue})`);
250
+ await forge.git.push(branch);
251
+ }
252
+ catch (e) {
253
+ console.error(`Failed to push branch ${branch}: ${e.message}\n Profile is at ${args.relPath} on disk; open the PR manually if you'd like.`);
254
+ process.exit(0);
255
+ }
256
+ try {
257
+ const pr = await forge.createPullRequest({
258
+ title: `bug profile: ${args.bugId} — ${args.profile.title}`,
259
+ body: buildBugProfilePrBody(args.profile, args.cliVersion),
260
+ base: "main",
261
+ head: branch,
262
+ draft: false,
263
+ labels: ["slowcook-bug-profile", "bug"],
264
+ });
265
+ console.error(`Opened PR ${pr.url}.`);
266
+ console.error(`Next: review the bug-profile PR, merge to trigger 'slowcook recipe --regression' on this bug.`);
267
+ }
268
+ catch (e) {
269
+ console.error(`Pushed branch ${branch} but couldn't open PR: ${e.message}\n Open it manually at https://github.com/${owner}/${repo}/pull/new/${branch}`);
270
+ process.exit(0);
271
+ }
272
+ }
273
+ function detectOwnerRepo(repoRoot) {
274
+ try {
275
+ const url = execSync("git remote get-url origin", {
276
+ cwd: repoRoot,
277
+ encoding: "utf8",
278
+ stdio: ["ignore", "pipe", "ignore"],
279
+ }).trim();
280
+ const m = url.match(/github\.com[:/]([^/]+)\/([^/.]+)(?:\.git)?$/);
281
+ if (m && m[1] && m[2])
282
+ return { owner: m[1], repo: m[2] };
283
+ }
284
+ catch {
285
+ /* not a git repo */
286
+ }
287
+ return null;
288
+ }
289
+ function buildBugProfilePrBody(profile, cliVersion) {
290
+ const lines = [];
291
+ lines.push(`Auto-emitted bug profile from \`slowcook investigate\` (${cliVersion}).`);
292
+ lines.push("");
293
+ lines.push(`Closes related: ${profile.source_issue}`);
294
+ lines.push("");
295
+ lines.push(`## Symptom`);
296
+ for (const s of profile.symptom)
297
+ lines.push(`- ${s}`);
298
+ lines.push("");
299
+ lines.push(`## Expected`);
300
+ for (const s of profile.expected)
301
+ lines.push(`- ${s}`);
302
+ lines.push("");
303
+ lines.push(`## Failure locus`);
304
+ lines.push(`\`${profile.failure_locus.file}${profile.failure_locus.line ? `:${profile.failure_locus.line}` : ""}\`${profile.failure_locus.function ? ` · \`${profile.failure_locus.function}\`` : ""}`);
305
+ lines.push("");
306
+ lines.push(`> ${profile.failure_locus.diagnosis.split("\n").join("\n> ")}`);
307
+ lines.push("");
308
+ lines.push(`## Regression assertion`);
309
+ for (const a of profile.regression_assertion)
310
+ lines.push(`- ${a}`);
311
+ lines.push("");
312
+ lines.push(`## Fix scope`);
313
+ for (const s of profile.fix_scope)
314
+ lines.push(`- \`${s}\``);
315
+ lines.push("");
316
+ lines.push(`Merging this PR triggers \`slowcook recipe --regression --bug ${profile.bug_id}\` to emit the failing test under \`tests/regression/\`. Sift takes it from there.`);
317
+ return lines.join("\n");
318
+ }
319
+ /**
320
+ * Fetch issue body + prior comments via the gh CLI. We invoke gh
321
+ * rather than the REST API directly so the existing GITHUB_TOKEN /
322
+ * gh-auth flow Just Works in CI + on dev machines.
323
+ *
324
+ * Falls back to throwing on failure — investigate without an issue
325
+ * body has nothing to work with.
326
+ */
327
+ function fetchIssueViaGh(issueNumber, repoRoot) {
328
+ let payload;
329
+ try {
330
+ const json = execSync(`gh issue view ${issueNumber} --json title,body,comments`, { cwd: repoRoot, encoding: "utf8", maxBuffer: 1024 * 1024 });
331
+ payload = JSON.parse(json);
332
+ }
333
+ catch (e) {
334
+ throw new Error(`gh issue view ${issueNumber} failed: ${e.message}. ` +
335
+ `Make sure GITHUB_TOKEN is set or 'gh auth status' is healthy.`);
336
+ }
337
+ const priorComments = (payload.comments ?? [])
338
+ .filter((c) =>
339
+ // Drop slowcook-bot's own audit-trail messages — they're noise
340
+ // for an LLM trying to read the *human* conversation.
341
+ !c.body.startsWith("### slowcook ·") &&
342
+ c.author.login !== "github-actions" &&
343
+ c.author.login !== "slowcook-refine[bot]" &&
344
+ c.author.login !== "slowcook-brew[bot]")
345
+ .map((c) => `(${c.author.login}) ${c.body}`);
346
+ return {
347
+ number: issueNumber,
348
+ title: payload.title,
349
+ body: payload.body,
350
+ priorComments,
351
+ };
352
+ }
353
+ /**
354
+ * Render a BugProfile as YAML. Hand-rolled because we don't want to
355
+ * pull a YAML lib dep just for emission. The schema is small enough
356
+ * that this is fine.
357
+ */
358
+ export function renderProfileAsYaml(profile) {
359
+ const lines = [];
360
+ lines.push(`$schema: ./bug-profile.schema.json`);
361
+ lines.push(`schema_version: ${profile.schema_version}`);
362
+ lines.push(`bug_id: ${profile.bug_id}`);
363
+ lines.push(`title: ${yamlString(profile.title)}`);
364
+ lines.push(`source_issue: "${profile.source_issue}"`);
365
+ lines.push(`status: ${profile.status}`);
366
+ lines.push(`investigated_by: ${profile.investigated_by}`);
367
+ lines.push(`created_at: ${profile.created_at}`);
368
+ lines.push("");
369
+ lines.push("symptom:");
370
+ for (const s of profile.symptom)
371
+ lines.push(` - ${yamlString(s)}`);
372
+ lines.push("expected:");
373
+ for (const s of profile.expected)
374
+ lines.push(` - ${yamlString(s)}`);
375
+ lines.push("reproduction:");
376
+ for (const s of profile.reproduction)
377
+ lines.push(` - ${yamlString(s)}`);
378
+ lines.push("failure_locus:");
379
+ lines.push(` file: ${yamlString(profile.failure_locus.file)}`);
380
+ if (profile.failure_locus.line !== undefined) {
381
+ lines.push(` line: ${profile.failure_locus.line}`);
382
+ }
383
+ if (profile.failure_locus.function !== undefined) {
384
+ lines.push(` function: ${yamlString(profile.failure_locus.function)}`);
385
+ }
386
+ lines.push(` diagnosis: ${yamlMultiline(profile.failure_locus.diagnosis)}`);
387
+ lines.push("regression_assertion:");
388
+ for (const s of profile.regression_assertion)
389
+ lines.push(` - ${yamlString(s)}`);
390
+ lines.push("fix_scope:");
391
+ for (const s of profile.fix_scope)
392
+ lines.push(` - ${yamlString(s)}`);
393
+ if (profile.related_specs && profile.related_specs.length > 0) {
394
+ lines.push("related_specs:");
395
+ for (const r of profile.related_specs) {
396
+ lines.push(` - id: ${yamlString(r.id)}`);
397
+ lines.push(` relationship: ${r.relationship}`);
398
+ if (r.note)
399
+ lines.push(` note: ${yamlString(r.note)}`);
400
+ }
401
+ }
402
+ return lines.join("\n") + "\n";
403
+ }
404
+ function yamlString(s) {
405
+ // Always quote — keeps things simple. Escape backslashes + quotes.
406
+ return '"' + s.replace(/\\/g, "\\\\").replace(/"/g, '\\"') + '"';
407
+ }
408
+ function yamlMultiline(s) {
409
+ if (!s.includes("\n"))
410
+ return yamlString(s);
411
+ return "|\n " + s.split("\n").map((l) => l.trimEnd()).join("\n ");
412
+ }
413
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/investigate/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC5E,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EACL,kBAAkB,EAElB,0BAA0B,GAC3B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAkB9C,SAAS,SAAS,CAAC,IAAc;IAC/B,MAAM,IAAI,GAAoB;QAC5B,WAAW,EAAE,CAAC;QACd,QAAQ,EAAE,OAAO,CAAC,GAAG,EAAE;QACvB,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H,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AACjC,CAAC;AAED,SAAS,UAAU,CAAC,CAAS;IAC3B,mEAAmE;IACnE,OAAO,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,GAAG,CAAC;AACnE,CAAC;AAED,SAAS,aAAa,CAAC,CAAS;IAC9B,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC;QAAE,OAAO,UAAU,CAAC,CAAC,CAAC,CAAC;IAC5C,OAAO,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAC1E,CAAC"}
@@ -0,0 +1,90 @@
1
+ /**
2
+ * Prompts for the `slowcook investigate` agent.
3
+ *
4
+ * The investigate agent is the bug-flow analogue of refine. Where
5
+ * refine asks PM clarifying questions, investigate reads code to
6
+ * find the failure locus. The two roles are mirror images:
7
+ *
8
+ * refine investigate
9
+ * ────── ───────────
10
+ * "what to build" "what's broken"
11
+ * text-only code-reading
12
+ * 2-3 questions 0-1 questions (only on truly ambiguous symptoms)
13
+ * spec.yaml bug-profile.yaml
14
+ *
15
+ * The system prompt below names the role explicitly so the LLM
16
+ * doesn't drift back into refine-style behaviour (asking design
17
+ * questions about a 1-line column rename, etc.).
18
+ */
19
+ export declare const INVESTIGATE_SYSTEM = "You are the investigate agent for slowcook \u2014 a TDD-first agentic development harness with a bug-fix flow.\n\n## Your role\n\nYou receive a GitHub issue describing a bug. Your job: read the codebase, identify the failure locus (file, line, function) and the actual root cause, and emit a structured `bug-profile.yaml` that the next agent (sift) will use as its contract.\n\nYou are NOT refine. Refine asks PM clarifying questions and emits design specs. You investigate failed reality. Different posture, different tools, different output.\n\n## Posture\n\n- **Read the code.** The issue body tells you the symptom. The codebase tells you the cause. You have read tools \u2014 use them. A diagnosis built from issue text alone is hand-wavy; a diagnosis built from `outline_file(actual-route.ts)` + `find_references(broken-symbol)` + `grep -r 'thing_X'` is honest.\n- **Don't paraphrase the symptom.** The PM's words in the issue body are the authoritative description of what's broken from the user's perspective. Copy the symptom verbatim where you can; mild paraphrase is OK only when the issue body is unstructured prose. (See slowcook memory: \"PM intent carries weight\" \u2014 you cannot silently weaken it.)\n- **Don't suggest a fix.** Your output names the failure locus + the regression assertion. The actual code change is sift's job. If you find yourself writing \"and the fix should rename X to Y\", stop \u2014 that's beyond your scope.\n- **Ask only when truly stuck.** Most bugs have a single failure locus discoverable from one or two reads. If after reading the obvious files you can't find the failure mode, ask one focused clarifying question on the issue. Do NOT ask multiple rounds of questions like refine does.\n\n## Critical: read the code, NOT just the issue body\n\nIssue bodies often contain BOTH the symptom *and* the reporter's proposed fix (\"Expected fix: ...\"). The proposed fix is a hypothesis \u2014 it has not been verified or applied to the codebase. Your diagnosis must be based on **what the code actually contains right now**, not on what the issue says it should contain.\n\nConcrete rule: before claiming \"X is fixed\" or \"Y now does Z\", read X or Y with a tool. If the issue body describes a fix and you find the code in its pre-fix state, the bug is still active and you investigate it. If the code already contains the fix, the bug is closed and your profile should say so explicitly (`status: closed` is not in the v1 schema, but the diagnosis can name the resolution and the failure_locus.diagnosis can read \"bug already fixed in <commit/PR>\").\n\n## Output\n\nA single `bug-profile.yaml` document with these fields:\n\n```yaml\nschema_version: 1\nbug_id: B-<n> # filled in by slowcook, you don't pick this\ntitle: \"<one-line bug title>\"\nsource_issue: \"#<NNN>\" # the issue you investigated\nstatus: investigated\ninvestigated_by: slowcook-investigate@<version>\ncreated_at: <ISO-8601 UTC>\n\nsymptom:\n - \"<verbatim or near-verbatim from issue body \u2014 what the user sees>\"\n\nexpected:\n - \"<what should happen instead \u2014 from issue body or implicit>\"\n\nreproduction:\n - \"<minimum step 1>\"\n - \"<minimum step 2>\"\n\nfailure_locus:\n file: \"src/path/to/broken-file.ts\"\n line: 42 # optional; omit if not pinpointable\n function: handlerName # optional\n diagnosis: |\n <One paragraph: why is the bug happening? Be specific. Reference\n the read evidence: \"src/foo.ts:42 selects column 'bar' but no\n migration adds 'bar' (verified: grep returns 0 hits)\".>\n\nregression_assertion:\n - \"Given <repro context>, when <action>, then <correct behavior>\"\n - \"(may be multiple if the bug has compound effects)\"\n\nfix_scope:\n - \"src/path/to/broken-file.ts\"\n - \"supabase/migrations/\" # for example, when the fix needs DDL\n\nrelated_specs: # optional, omit if none\n - id: \"story-007\"\n relationship: touches\n note: \"/api/X is owned by story-007's spec; check that contract\"\n```\n\n**Output format is strict.** Wrap the YAML in a single `<bug_profile>...</bug_profile>` XML block. The slowcook parser greps for the literal opening + closing tags; any output without those exact tags fails parsing and the run errors out.\n\nConcrete example of the expected final-message format:\n\n```\n<bug_profile>\nschema_version: 1\ntitle: \"<one-line bug title>\"\nsource_issue: \"#135\"\nstatus: investigated\ninvestigated_by: \"(slowcook stamps this)\"\ncreated_at: \"(slowcook stamps this)\"\n\nsymptom:\n - \"Verbatim user-visible failure mode.\"\n\nexpected:\n - \"What should happen instead.\"\n\nreproduction:\n - \"Step 1.\"\n\nfailure_locus:\n file: \"src/path/to/broken.ts\"\n line: 42\n function: \"handler\"\n diagnosis: |\n One paragraph naming the actual cause, citing read evidence\n (e.g., 'src/foo.ts:42 selects column bar but no migration adds\n bar \u2014 verified via grep').\n\nregression_assertion:\n - \"Given <repro context>, when <action>, then <correct behavior>.\"\n\nfix_scope:\n - \"src/path/to/broken.ts\"\n</bug_profile>\n```\n\nIf you have one preliminary thought to share, put it BEFORE the `<bug_profile>` block \u2014 but the parser only reads what's inside the tags. Anything outside is ignored.\n\nIf you cannot find a single failure locus from reading the obvious files, emit a `<halt>` block with a one-line description of what you couldn't disambiguate. Do not emit prose explaining your confusion \u2014 the slowcook parser doesn't read prose. `<halt>` is the structured way to ask for help.\n\n## Tools\n\nYou have read tools (read_file, outline_file, find_references, find_definition, grep, list_directory) \u2014 exactly the same ones brew uses for pre-write discovery. You do NOT have write_file: investigate doesn't write code, only diagnoses.\n\n## When to halt voluntarily\n\nIf after reading the issue body and the obvious files (mirrored path from issue mentions, fetch URLs, table names, etc.) you cannot identify a single failure locus, halt by emitting a `<halt>` block with a one-line description of what you couldn't disambiguate. Slowcook will surface this to the operator who will either edit the issue with more context or take the bug out of investigate flow. **Don't guess** \u2014 a wrong bug profile costs sift more than a clean halt costs the operator's time.\n";
20
+ /**
21
+ * Tool definitions the investigate agent has access to. Mirrors the
22
+ * brew read-only subset (no write_file): investigate diagnoses, sift
23
+ * fixes.
24
+ *
25
+ * Kept minimal in alpha.2a — alpha.2b wires the actual ts-morph
26
+ * implementations from brew/retrieval.ts.
27
+ */
28
+ export declare const INVESTIGATE_TOOLS: ({
29
+ name: string;
30
+ description: string;
31
+ input_schema: {
32
+ type: "object";
33
+ properties: {
34
+ path: {
35
+ type: "string";
36
+ description: string;
37
+ };
38
+ symbol?: undefined;
39
+ pattern?: undefined;
40
+ glob?: undefined;
41
+ };
42
+ required: string[];
43
+ };
44
+ } | {
45
+ name: string;
46
+ description: string;
47
+ input_schema: {
48
+ type: "object";
49
+ properties: {
50
+ symbol: {
51
+ type: "string";
52
+ description: string;
53
+ };
54
+ path?: undefined;
55
+ pattern?: undefined;
56
+ glob?: undefined;
57
+ };
58
+ required: string[];
59
+ };
60
+ } | {
61
+ name: string;
62
+ description: string;
63
+ input_schema: {
64
+ type: "object";
65
+ properties: {
66
+ pattern: {
67
+ type: "string";
68
+ description: string;
69
+ };
70
+ glob: {
71
+ type: "string";
72
+ description: string;
73
+ };
74
+ path?: undefined;
75
+ symbol?: undefined;
76
+ };
77
+ required: string[];
78
+ };
79
+ })[];
80
+ /**
81
+ * Build the per-issue user message. The issue body becomes the
82
+ * agent's primary input; it tools its way out from there.
83
+ */
84
+ export declare function buildInvestigateUserPrompt(args: {
85
+ issueNumber: number;
86
+ issueTitle: string;
87
+ issueBody: string;
88
+ prior_comments?: string[];
89
+ }): string;
90
+ //# sourceMappingURL=prompts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../../src/commands/investigate/prompts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,eAAO,MAAM,kBAAkB,iwMAqH9B,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAsE7B,CAAC;AAEF;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE;IAC/C,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B,GAAG,MAAM,CAsBT"}