@structured-vibe-coding/core 0.17.2 → 0.19.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 (50) hide show
  1. package/defaults/prices.yaml +9 -0
  2. package/defaults/search.yaml +18 -0
  3. package/defaults/teams/research/roles/researcher.md +29 -0
  4. package/defaults/teams/research/team.yaml +7 -0
  5. package/defaults/teams/software/roles/architect.md +31 -0
  6. package/defaults/teams/software/roles/dev-lead.md +32 -0
  7. package/defaults/teams/software/roles/developer.md +30 -0
  8. package/defaults/teams/software/roles/product-manager.md +32 -0
  9. package/defaults/teams/software/roles/product-owner.md +30 -0
  10. package/defaults/teams/software/roles/qa.md +35 -0
  11. package/defaults/teams/software/routing.yaml +28 -0
  12. package/defaults/teams/software/team.yaml +24 -0
  13. package/defaults/teams/solo/roles/developer.md +28 -0
  14. package/defaults/teams/solo/team.yaml +7 -0
  15. package/defaults/templates/plan.md +17 -0
  16. package/defaults/templates/review.md +11 -0
  17. package/defaults/templates/story.md +13 -0
  18. package/defaults/templates/task.md +11 -0
  19. package/defaults/workflows/team-software.yaml +153 -0
  20. package/dist/{agents-RWYBLZQE.js → agents-PSIOQEYH.js} +18 -7
  21. package/dist/{change-context-W4HDO2IK.js → change-context-EZJMSGSP.js} +2 -4
  22. package/dist/chunk-26YG6A4M.js +1210 -0
  23. package/dist/chunk-2FJBFYVJ.js +1576 -0
  24. package/dist/{chunk-KYWETNFU.js → chunk-4BRO7BOJ.js} +2 -4
  25. package/dist/{chunk-74OGSVJZ.js → chunk-H55RFAEI.js} +2 -2
  26. package/dist/chunk-HG7TPW5V.js +567 -0
  27. package/dist/{chunk-EPFURATC.js → chunk-O5SP6X5R.js} +89 -0
  28. package/dist/chunk-TGRV6WGS.js +3436 -0
  29. package/dist/{gather-BZDW4EN4.js → gather-7TSVKQO2.js} +3 -4
  30. package/dist/{greenfield-Z425JOMP.js → greenfield-QFA5WVHE.js} +5 -6
  31. package/dist/index.d.ts +1832 -44
  32. package/dist/index.js +5172 -992
  33. package/dist/{sources-PF45EUH2.js → sources-3TXUPU6V.js} +2 -3
  34. package/package.json +11 -3
  35. package/vendor/tree-sitter/NOTICE +29 -0
  36. package/vendor/tree-sitter/tree-sitter-javascript.wasm +0 -0
  37. package/vendor/tree-sitter/tree-sitter-python.wasm +0 -0
  38. package/vendor/tree-sitter/tree-sitter-rust.wasm +0 -0
  39. package/vendor/tree-sitter/tree-sitter-tsx.wasm +0 -0
  40. package/vendor/tree-sitter/tree-sitter-typescript.wasm +0 -0
  41. package/dist/chunk-67AUAGNV.js +0 -150
  42. package/dist/chunk-7JLDL2OK.js +0 -771
  43. package/dist/chunk-7MJYPJMR.js +0 -51
  44. package/dist/chunk-A752UVPF.js +0 -317
  45. package/dist/chunk-P3N67UEZ.js +0 -538
  46. package/dist/chunk-R5WQN4HA.js +0 -139
  47. package/dist/chunk-WHDG6OTG.js +0 -46
  48. package/dist/config-X5VDBVR4.js +0 -16
  49. package/dist/fs-J6DIV6CX.js +0 -28
  50. package/dist/paths-64GA32IZ.js +0 -28
@@ -1,538 +0,0 @@
1
- import {
2
- buildAgentPrompt,
3
- formatStatus
4
- } from "./chunk-R5WQN4HA.js";
5
- import {
6
- loadConfig
7
- } from "./chunk-WHDG6OTG.js";
8
- import {
9
- buildContext,
10
- getActiveChangeId
11
- } from "./chunk-A752UVPF.js";
12
- import {
13
- sddRoot
14
- } from "./chunk-7MJYPJMR.js";
15
- import {
16
- pathExists,
17
- readText,
18
- removePath,
19
- writeText
20
- } from "./chunk-EPFURATC.js";
21
-
22
- // src/agents.ts
23
- import { join } from "pathe";
24
- var AGENT_INTEGRATIONS = [
25
- {
26
- id: "copilot",
27
- key: "copilot",
28
- aliases: ["github-copilot", "gh-copilot"],
29
- label: "GitHub Copilot",
30
- hint: ".github/agents/*.agent.md (VS Code, Cursor, JetBrains, \u2026)",
31
- requiresCli: false,
32
- installUrl: "https://github.com/features/copilot",
33
- rolePath: (roleId) => `.github/agents/${roleId}.agent.md`,
34
- agentsMdRow: "| GitHub Copilot | `.github/agents/*.agent.md` (same roles; any IDE that supports Copilot agents) |"
35
- },
36
- {
37
- id: "claude-code",
38
- key: "claude",
39
- aliases: ["claude-code", "claudecode"],
40
- label: "Claude Code",
41
- hint: ".claude/agents/*.md (terminal agent)",
42
- requiresCli: true,
43
- cliBinary: "claude",
44
- installUrl: "https://docs.anthropic.com/en/docs/claude-code",
45
- rolePath: (roleId) => `.claude/agents/${roleId}.md`,
46
- agentsMdRow: "| Claude Code | `.claude/agents/` (`sdd`, `sdd-planner`, `sdd-implementer`, `sdd-reviewer`) |"
47
- },
48
- {
49
- id: "grok",
50
- key: "grok",
51
- aliases: ["grok-build", "grokbuild", "xai", "xai-grok"],
52
- label: "Grok Build",
53
- hint: ".grok/rules/sdd.md + AGENTS.md (terminal TUI from xAI)",
54
- requiresCli: false,
55
- cliBinary: "grok",
56
- installUrl: "https://docs.x.ai",
57
- // Single rules file: Grok auto-loads all .grok/rules/*.md
58
- rolePath: () => `.grok/rules/sdd.md`,
59
- rolesToInstall: ["sdd"],
60
- agentsMdRow: "| Grok Build | `.grok/rules/sdd.md` + `AGENTS.md` (reads protocol + active-context; run `sdd` in shell) |"
61
- },
62
- {
63
- id: "ollama",
64
- key: "ollama",
65
- aliases: ["local", "llama", "ollama-local"],
66
- label: "Ollama (local)",
67
- hint: "Local models via `ollama` CLI + AGENTS.md / .ollama/sdd.md (set SDD_OLLAMA_MODEL)",
68
- requiresCli: true,
69
- cliBinary: "ollama",
70
- installUrl: "https://ollama.com",
71
- // Single project brief — Ollama does not auto-load multi-role agent trees
72
- rolePath: () => `.ollama/sdd.md`,
73
- rolesToInstall: ["sdd"],
74
- agentsMdRow: "| Ollama (local) | `.ollama/sdd.md` + `AGENTS.md` + handoff; launch: `ollama run $SDD_OLLAMA_MODEL` |"
75
- },
76
- {
77
- id: "kilo",
78
- key: "kilo",
79
- aliases: ["kilocode", "kilo-code", "kilo-ai"],
80
- label: "Kilo Code",
81
- hint: ".kilo/sdd.md + AGENTS.md (terminal CLI from kilo.ai)",
82
- requiresCli: true,
83
- cliBinary: "kilo",
84
- installUrl: "https://kilo.ai/docs/code-with-ai/platforms/cli",
85
- // Single project brief — Kilo loads AGENTS.md and supports instruction files
86
- rolePath: () => `.kilo/sdd.md`,
87
- rolesToInstall: ["sdd"],
88
- agentsMdRow: "| Kilo Code | `.kilo/sdd.md` + `AGENTS.md` (reads protocol + active-context; run `kilo` or `sdd` in shell) |"
89
- }
90
- ];
91
- var ALL_AGENT_TARGETS = AGENT_INTEGRATIONS.map((i) => i.id);
92
- var DEFAULT_INIT_INTEGRATION = "copilot";
93
- var AGENT_TARGET_OPTIONS = AGENT_INTEGRATIONS.map(
94
- ({ id, key, label, hint, requiresCli, installUrl }) => ({
95
- id,
96
- key,
97
- label,
98
- hint,
99
- requiresCli,
100
- installUrl
101
- })
102
- );
103
- var IDE_NAMES = /* @__PURE__ */ new Set(["intellij", "idea", "jetbrains", "vscode", "vs-code", "cursor"]);
104
- function getIntegration(target) {
105
- const found = AGENT_INTEGRATIONS.find((i) => i.id === target);
106
- if (!found) throw new Error(`Unknown agent integration: ${target}`);
107
- return found;
108
- }
109
- function integrationKeyFor(target) {
110
- return getIntegration(target).key;
111
- }
112
- function optionForTarget(target) {
113
- return getIntegration(target);
114
- }
115
- function agentHostPaths(target) {
116
- switch (target) {
117
- case "copilot":
118
- return [".github/agents"];
119
- case "claude-code":
120
- return [".claude/agents"];
121
- case "grok":
122
- return [".grok/rules"];
123
- case "ollama":
124
- return [".ollama"];
125
- case "kilo":
126
- return [".kilo"];
127
- default:
128
- return [];
129
- }
130
- }
131
- var LEGACY_AGENT_PATHS = [".idea/sdd-agent-notes.md"];
132
- async function removeOtherAgentHosts(projectRoot, keep) {
133
- const removed = [];
134
- for (const integ of AGENT_INTEGRATIONS) {
135
- if (integ.id === keep) continue;
136
- for (const rel of agentHostPaths(integ.id)) {
137
- const full = join(projectRoot, rel);
138
- if (await pathExists(full)) {
139
- await removePath(full);
140
- removed.push(rel);
141
- }
142
- }
143
- }
144
- for (const rel of LEGACY_AGENT_PATHS) {
145
- const full = join(projectRoot, rel);
146
- if (await pathExists(full)) {
147
- await removePath(full);
148
- removed.push(rel);
149
- }
150
- }
151
- for (const parent of [".claude", ".idea", ".grok", ".ollama", ".kilo"]) {
152
- if (keep === "grok" && parent === ".grok") continue;
153
- if (keep === "ollama" && parent === ".ollama") continue;
154
- if (keep === "kilo" && parent === ".kilo") continue;
155
- const full = join(projectRoot, parent);
156
- if (!await pathExists(full)) continue;
157
- try {
158
- const { readdir } = await import("fs/promises");
159
- const kids = await readdir(full);
160
- if (kids.length === 0) {
161
- await removePath(full);
162
- removed.push(parent);
163
- }
164
- } catch {
165
- }
166
- }
167
- return removed;
168
- }
169
- function parseIntegration(raw) {
170
- const p = raw.trim().toLowerCase();
171
- if (!p) {
172
- throw new Error(
173
- `Expected one AI coding agent. Choose from: ${AGENT_INTEGRATIONS.map((i) => i.key).join(", ")}`
174
- );
175
- }
176
- if (IDE_NAMES.has(p)) {
177
- throw new Error(
178
- `"${p}" is an IDE, not an AI coding agent. Choose: ${AGENT_INTEGRATIONS.map((i) => i.key).join(", ")}.`
179
- );
180
- }
181
- for (const integ of AGENT_INTEGRATIONS) {
182
- if (integ.id === p || integ.key === p || integ.aliases.includes(p)) {
183
- return integ.id;
184
- }
185
- }
186
- throw new Error(
187
- `Unknown AI coding agent "${raw}". Choose from: ${AGENT_INTEGRATIONS.map((i) => i.key).join(", ")}`
188
- );
189
- }
190
- function parseAgentTargets(raw) {
191
- const parts = (Array.isArray(raw) ? raw : [raw]).flatMap((s) => String(s).split(",")).map((s) => s.trim()).filter(Boolean);
192
- if (!parts.length) {
193
- throw new Error("No AI coding agent specified");
194
- }
195
- const out = [];
196
- for (const p of parts) {
197
- const id = parseIntegration(p);
198
- if (!out.includes(id)) out.push(id);
199
- }
200
- return out;
201
- }
202
- var SDD_AGENT_ROLES = [
203
- {
204
- id: "sdd",
205
- description: "Default SDD agent. Use for any Spec-Driven Development work on the active change pack.",
206
- roleLine: "Router: inspect stage in active-context; plan or implement accordingly.",
207
- roleRules: [
208
- "If stage is intent/feature/design/tasks/stories/research: act as planner (artifacts, little or no product code).",
209
- "If stage is implement: act as implementer (scoped code only).",
210
- "If stage is local_verify: act as reviewer (gaps vs acceptance; fixes only).",
211
- "If kickoff/brief says refine or analyze: follow changes/<id>/refine-brief.md \u2014 stage-scoped refine; never edit constitution; do not sdd next."
212
- ]
213
- },
214
- {
215
- id: "sdd-planner",
216
- description: "SDD planner. Use when filling intent, design, research, stories, or tasks \u2014 not large code changes.",
217
- roleLine: "Planner: produce/update stage markdown only.",
218
- roleRules: [
219
- "Do not make large product code changes unless the user explicitly overrides.",
220
- "Keep artifacts short and actionable."
221
- ]
222
- },
223
- {
224
- id: "sdd-implementer",
225
- description: "SDD implementer. Use when coding the active change (implement stage).",
226
- roleLine: "Implementer: code only for the active change pack.",
227
- roleRules: [
228
- "Follow tasks.md / acceptance; honor arb-decision and design constraints.",
229
- "Do not expand scope beyond the change title/intent."
230
- ]
231
- },
232
- {
233
- id: "sdd-reviewer",
234
- description: "SDD reviewer. Use before verify/complete or to check work against the change pack.",
235
- roleLine: "Reviewer: compare work to acceptance and stage artifacts.",
236
- roleRules: [
237
- "List gaps; suggest minimal fixes only.",
238
- "Remind user to run sdd verify before sdd complete."
239
- ]
240
- }
241
- ];
242
- async function installAgentIntegration(opts) {
243
- const integ = getIntegration(opts.target);
244
- const created = [];
245
- const skipped = [];
246
- const root = opts.projectRoot;
247
- const force = opts.force ?? false;
248
- await removeOtherAgentHosts(root, opts.target);
249
- const write = async (rel, content) => {
250
- const full = join(root, rel);
251
- if (await pathExists(full) && !force) {
252
- skipped.push(rel);
253
- return;
254
- }
255
- await writeText(full, content);
256
- created.push(rel);
257
- };
258
- await write(join(".sdd", "protocol.md"), PROTOCOL_MD);
259
- await refreshActiveAgentContext(root);
260
- const roles = integ.rolesToInstall?.length ? SDD_AGENT_ROLES.filter((r) => integ.rolesToInstall.includes(r.id)) : SDD_AGENT_ROLES;
261
- for (const role of roles) {
262
- await write(integ.rolePath(role.id), renderThinAgent(role));
263
- }
264
- await write("AGENTS.md", renderAgentsMd(integ));
265
- await write(
266
- join(".sdd", "agents.json"),
267
- JSON.stringify(
268
- {
269
- version: 3,
270
- mode: "agents-only",
271
- protocol: ".sdd/protocol.md",
272
- activeContext: ".sdd/active-context.md",
273
- roles: SDD_AGENT_ROLES.map((r) => r.id),
274
- /** Speckit-style public key */
275
- ai: integ.key,
276
- integration: integ.key,
277
- installed: [integ.id],
278
- updated: (/* @__PURE__ */ new Date()).toISOString()
279
- },
280
- null,
281
- 2
282
- ) + "\n"
283
- );
284
- return { created, skipped, target: opts.target };
285
- }
286
- async function installAgentIntegrations(opts) {
287
- if (!opts.targets?.length) {
288
- throw new Error(
289
- `Specify one AI coding agent: ${AGENT_INTEGRATIONS.map((i) => i.key).join(", ")}`
290
- );
291
- }
292
- const created = [];
293
- const skipped = [];
294
- for (const target of opts.targets) {
295
- const r = await installAgentIntegration({
296
- projectRoot: opts.projectRoot,
297
- target,
298
- force: opts.force
299
- });
300
- created.push(...r.created);
301
- skipped.push(...r.skipped);
302
- }
303
- return { created, skipped, targets: opts.targets };
304
- }
305
- function renderThinAgent(role) {
306
- const rules = role.roleRules.map((r) => `- ${r}`).join("\n");
307
- return `---
308
- name: ${role.id}
309
- description: ${role.description}
310
- ---
311
-
312
- # ${role.id}
313
-
314
- ${role.roleLine}
315
-
316
- ## Required reads (in order)
317
-
318
- 1. \`.sdd/active-context.md\` \u2014 current change and stage
319
- 2. \`.sdd/protocol.md\` \u2014 SDD rules for this repo (single playbook)
320
- 3. \`memory/constitution.md\` if present \u2014 non-negotiables
321
- 4. Active change files under \`changes/<id>/\` as listed in active-context
322
-
323
- ## Role rules
324
-
325
- ${rules}
326
-
327
- ## Done
328
-
329
- Remind the human: \`sdd verify\` then \`sdd next\` / \`sdd complete\` as appropriate.
330
- Do not claim the change is complete without local verification when the workflow requires it.
331
- `;
332
- }
333
- async function loadInstalledAgent(projectRoot) {
334
- const path = join(sddRoot(projectRoot), "agents.json");
335
- if (!await pathExists(path)) return null;
336
- try {
337
- const raw = JSON.parse(await readText(path));
338
- const key = raw.ai ?? raw.integration ?? raw.installed?.[0];
339
- if (!key || typeof key !== "string") return null;
340
- const target = parseIntegration(key);
341
- return { ai: integrationKeyFor(target), target, integration: getIntegration(target) };
342
- } catch {
343
- return null;
344
- }
345
- }
346
- async function writeAgentHandoff(projectRoot, config, changeId) {
347
- const ctx = await buildContext(projectRoot, config, changeId);
348
- const body = await buildAgentPrompt(ctx, config, projectRoot);
349
- const outPath = join(sddRoot(projectRoot), "handoff.md");
350
- const header = `# SDD handoff (auto)
351
-
352
- > Generated for the AI coding agent configured at init.
353
- > Change: **${ctx.meta.title}** \xB7 \`${ctx.id}\` \xB7 stage **${ctx.meta.stage}**
354
-
355
- Also read: \`.sdd/active-context.md\`, \`.sdd/protocol.md\`, \`memory/constitution.md\` if present.
356
-
357
- ---
358
-
359
- `;
360
- await writeText(outPath, header + body + "\n");
361
- return outPath;
362
- }
363
- function agentKickoffMessage(opts) {
364
- const event = opts.event ?? "context updated";
365
- if (opts.instructions?.trim()) {
366
- return [
367
- `SDD: ${event}.`,
368
- `Title: ${opts.title}`,
369
- `Change: ${opts.changeId}`,
370
- `Stage: ${opts.stage}`,
371
- opts.instructions.trim()
372
- ].join(" ");
373
- }
374
- return [
375
- `SDD: ${event}.`,
376
- `Title: ${opts.title}`,
377
- `Change: ${opts.changeId}`,
378
- `Stage: ${opts.stage}`,
379
- `Read in order: .sdd/active-context.md, .sdd/handoff.md, .sdd/protocol.md, memory/constitution.md (if present).`,
380
- `Do the work for the current stage only under changes/${opts.changeId}/. Do not expand scope.`,
381
- `When the stage is done, tell the human to run: sdd next (or sdd verify / sdd complete as appropriate).`
382
- ].join(" ");
383
- }
384
- async function refreshActiveAgentContext(projectRoot) {
385
- const markerDir = sddRoot(projectRoot);
386
- if (!await pathExists(join(markerDir, "config.yaml"))) {
387
- return null;
388
- }
389
- const protocolPath = join(markerDir, "protocol.md");
390
- if (!await pathExists(protocolPath)) {
391
- await writeText(protocolPath, PROTOCOL_MD);
392
- }
393
- const config = await loadConfig(projectRoot);
394
- const activeId = await getActiveChangeId(projectRoot, config);
395
- const outPath = join(markerDir, "active-context.md");
396
- if (!activeId) {
397
- const empty = `# SDD active context
398
-
399
- _No active change._ Run \`sdd new "\u2026"\` or **SDD: New Change** in the IDE.
400
-
401
- Then re-run \`sdd agents refresh\` (or advance a stage) to update this file.
402
-
403
- Protocol: \`.sdd/protocol.md\`
404
- `;
405
- await writeText(outPath, empty);
406
- return outPath;
407
- }
408
- const ctx = await buildContext(projectRoot, config, activeId);
409
- const handoff = await buildAgentPrompt(ctx, config, projectRoot);
410
- const status = formatStatus(ctx);
411
- const body = `# SDD active context
412
-
413
- > Auto-generated for coding agents.
414
- > Change: **${ctx.meta.title}** \xB7 \`${ctx.id}\` \xB7 stage **${ctx.meta.stage}**
415
- > Protocol: \`.sdd/protocol.md\`
416
-
417
- ## Status
418
-
419
- \`\`\`
420
- ${status}
421
- \`\`\`
422
-
423
- ${handoff}
424
- `;
425
- await writeText(outPath, body);
426
- return outPath;
427
- }
428
- var PROTOCOL_MD = `# SDD protocol
429
-
430
- This repo uses **Structured Vibe Coding** (\`sdd\`). Agents must follow this file plus \`.sdd/active-context.md\`. Do not invent a parallel process.
431
-
432
- ## Source of truth
433
-
434
- | What | Where |
435
- |------|--------|
436
- | Process state | \`changes/<id>/meta.yaml\` (workflow, stage, gates) |
437
- | Current task snapshot | \`.sdd/active-context.md\` |
438
- | Non-negotiables | \`memory/constitution.md\` if present |
439
- | Stable product/tech rules | \`memory/*.md\` (start at \`memory/index.md\` if present) |
440
- | Stage artifacts | files in \`changes/<id>/\` for the active change |
441
-
442
- ## Required read order
443
-
444
- 1. \`.sdd/active-context.md\`
445
- 2. This file (\`.sdd/protocol.md\`)
446
- 3. \`memory/constitution.md\` if present (non-negotiables agents must not violate)
447
- 4. \`meta.yaml\` + artifacts for the **current stage** (and prior stages if needed)
448
- 5. \`memory/index.md\` (documentation map) if present, then linked memory pages when architecture or conventions matter
449
-
450
- ## Stage behavior
451
-
452
- | Stage kind | Agent focus |
453
- |------------|-------------|
454
- | intent / feature / stories | Clarify scope; write short artifacts |
455
- | design / lld / db / research / hl_arb | Specs and decisions; minimal product code |
456
- | tasks | Break work into implementable checklist |
457
- | implement | Code only for this change; follow tasks/acceptance |
458
- | local_verify | Check acceptance; fix only; prepare for complete |
459
- | brainstorm (optional) | Multiple approaches; parallel exploration; no final design yet |
460
- | clarify_* (optional) | Ask clarifying questions; write Q&A; or tell human to skip |
461
-
462
- ## Optional stages
463
-
464
- - Stages marked **optional** / kind \`brainstorm\` or \`clarify\` may be skipped:
465
- \`sdd skip <stage_id> -r "not needed"\`
466
- - Do **not** invent a skip by jumping stages. \`sdd next\` blocks on empty required stubs (e.g. design.md).
467
- - If the tool falls back to an earlier stage, **complete that stage** before advancing again.
468
-
469
- ## Hard rules
470
-
471
- 1. **Do not skip hard gates.** If blocked, tell the human to run \`sdd gate approve\` (or fix the gate).
472
- 2. **Stay in scope** of the active change title/intent. No drive-by refactors or new features.
473
- 3. **Honor constraints** in \`arb-decision.md\`, design, and memory non-negotiables.
474
- 4. **Local verify** is part of done when the workflow has a verify stage: \`sdd verify\`.
475
- 5. Prefer small, reviewable diffs.
476
- 6. **Required stage artifacts must be substantive** \u2014 not empty templates. Design cannot be skipped via empty design.md.
477
-
478
- ## Commands (human / shell)
479
-
480
- \`\`\`bash
481
- sdd status
482
- sdd next
483
- sdd agent # print handoff
484
- sdd agents refresh # refresh active-context.md
485
- sdd verify
486
- sdd complete
487
- \`\`\`
488
-
489
- ## Out of scope for agents
490
-
491
- - Replacing CI/CD or team process tools
492
- - Deleting \`.sdd\` / completed change history
493
- - Claiming complete without verify when required
494
- `;
495
- function renderAgentsMd(integ) {
496
- return `# Agents
497
-
498
- This repo uses **SDD agents only** (no skills).
499
-
500
- AI coding agents are **not** the same as IDEs: VS Code, Cursor, and IntelliJ host tools like Copilot or Claude Code.
501
-
502
- | Read first | |
503
- |------------|--|
504
- | Live task | \`.sdd/active-context.md\` |
505
- | Playbook | \`.sdd/protocol.md\` |
506
- | Constitution | \`memory/constitution.md\` if present |
507
- | Doc map (stable) | \`memory/index.md\` if present |
508
-
509
- | AI agent | Files |
510
- |----------|--------|
511
- ${integ.agentsMdRow}
512
-
513
- Refresh context: \`sdd agents refresh\`.
514
- `;
515
- }
516
-
517
- export {
518
- AGENT_INTEGRATIONS,
519
- ALL_AGENT_TARGETS,
520
- DEFAULT_INIT_INTEGRATION,
521
- AGENT_TARGET_OPTIONS,
522
- getIntegration,
523
- integrationKeyFor,
524
- optionForTarget,
525
- agentHostPaths,
526
- removeOtherAgentHosts,
527
- parseIntegration,
528
- parseAgentTargets,
529
- SDD_AGENT_ROLES,
530
- installAgentIntegration,
531
- installAgentIntegrations,
532
- renderThinAgent,
533
- loadInstalledAgent,
534
- writeAgentHandoff,
535
- agentKickoffMessage,
536
- refreshActiveAgentContext,
537
- PROTOCOL_MD
538
- };
@@ -1,139 +0,0 @@
1
- import {
2
- getStage,
3
- isStageSkipped,
4
- shouldAutoSkip
5
- } from "./chunk-A752UVPF.js";
6
-
7
- // src/agent-handoff.ts
8
- import { join } from "pathe";
9
- function formatStatus(ctx) {
10
- const lines = [];
11
- lines.push(`Change: ${ctx.meta.title}`);
12
- lines.push(`ID: ${ctx.id}`);
13
- lines.push(`Status: ${ctx.meta.status}`);
14
- lines.push(`Workflow: ${ctx.meta.workflow}`);
15
- lines.push(`Path: ${ctx.path}`);
16
- lines.push("");
17
- lines.push("Stages:");
18
- for (const stage of ctx.stages) {
19
- const skipped = isStageSkipped(ctx.meta, stage.id) || shouldAutoSkip(stage, ctx.meta);
20
- let mark = " ";
21
- if (skipped) mark = "\xB7";
22
- else if (stage.id === ctx.meta.stage) mark = "\u25CF";
23
- else {
24
- const order = ctx.active.map((s) => s.id);
25
- const cur = order.indexOf(ctx.meta.stage);
26
- const idx = order.indexOf(stage.id);
27
- if (idx >= 0 && cur >= 0 && idx < cur) mark = "\u2713";
28
- }
29
- const gate = ctx.meta.gates?.[stage.id];
30
- const gateInfo = gate ? ` [${gate.status}]` : "";
31
- const skipInfo = skipped ? " (skipped)" : "";
32
- lines.push(
33
- ` [${mark}] ${stage.id}${stage.title ? ` \u2014 ${stage.title}` : ""}${gateInfo}${skipInfo}`
34
- );
35
- }
36
- if (ctx.meta.overrides?.skip_stages?.length) {
37
- lines.push("");
38
- lines.push(`Overrides: skip=${ctx.meta.overrides.skip_stages.join(", ")}`);
39
- }
40
- return lines.join("\n");
41
- }
42
- async function buildAgentPrompt(ctx, config, projectRoot) {
43
- const stage = getStage(ctx.workflow, ctx.meta, ctx.meta.stage);
44
- const parts = [];
45
- parts.push(`# SDD Agent Handoff`);
46
- parts.push("");
47
- parts.push(`You are implementing a change under Structured Vibe Coding (local SDD).`);
48
- parts.push("");
49
- parts.push(`## Change`);
50
- parts.push(`- Title: ${ctx.meta.title}`);
51
- parts.push(`- ID: ${ctx.id}`);
52
- parts.push(`- Workflow: ${ctx.meta.workflow}`);
53
- parts.push(`- Current stage: ${ctx.meta.stage}${stage?.title ? ` (${stage.title})` : ""}`);
54
- parts.push(`- Change path: ${ctx.path}`);
55
- parts.push("");
56
- if (stage?.summary) {
57
- parts.push(`## Stage goal`);
58
- parts.push(stage.summary);
59
- parts.push("");
60
- }
61
- if (stage?.agent_context?.instructions) {
62
- parts.push(`## Instructions`);
63
- parts.push(stage.agent_context.instructions);
64
- parts.push("");
65
- }
66
- parts.push(`## Constraints`);
67
- parts.push(`- Follow artifacts in the change directory as source of truth.`);
68
- parts.push(`- Honor \`memory/constitution.md\` when present (non-negotiables).`);
69
- parts.push(`- Do not skip ARB/decision constraints if present.`);
70
- parts.push(`- Local development only \u2014 verify on this machine.`);
71
- parts.push(`- Prefer small, reviewable commits.`);
72
- parts.push("");
73
- parts.push(`## Artifacts to read`);
74
- const memoryHint = join(projectRoot, config.memory_path);
75
- parts.push(`- Documentation map (if present): ${memoryHint}/index.md`);
76
- parts.push(`- Memory: ${memoryHint}/`);
77
- for (const s of ctx.stages) {
78
- for (const a of s.artifacts) {
79
- parts.push(`- ${join(ctx.path, a.path)}`);
80
- }
81
- }
82
- parts.push("");
83
- parts.push(`## Current stage artifacts`);
84
- if (stage) {
85
- for (const a of stage.artifacts) {
86
- parts.push(`- ${a.path}${a.required ? " (required)" : ""}`);
87
- }
88
- }
89
- parts.push("");
90
- const stageId = ctx.meta.stage;
91
- if (stageId === "implement" || stageId === "local_verify") {
92
- parts.push(`## Code context (product code)`);
93
- parts.push("");
94
- parts.push(`Process context above is not enough for product code structure.`);
95
- parts.push(`When you need symbols, callers, or package-boundary context:`);
96
- parts.push(
97
- `1. Run: \`sdd context\` (optional: \`--path \u2026\`, \`--symbol \u2026\`, \`--out change\`)`
98
- );
99
- parts.push(`2. If present, read: \`changes/${ctx.id}/code-context.md\` (regenerate if stale)`);
100
- parts.push(
101
- `3. Org libraries / remote AST: \`.sdd/mcp.yaml\` sources via \`sdd mcp sources\` / \`sdd mcp fetch\``
102
- );
103
- parts.push(`Do not dump unbounded source into the prompt; prefer sliced / MCP output.`);
104
- parts.push("");
105
- }
106
- try {
107
- const { loadMcpConfig } = await import("./sources-PF45EUH2.js");
108
- const { gatherMcpContextForChange, formatMcpContextForHandoff } = await import("./gather-BZDW4EN4.js");
109
- const mcpCfg = await loadMcpConfig(projectRoot);
110
- if (mcpCfg.auto_fetch_on_handoff && mcpCfg.sources.length) {
111
- const fetched = await gatherMcpContextForChange(projectRoot, ctx);
112
- const block = formatMcpContextForHandoff(fetched.filter((r) => r.ok || r.error));
113
- if (block) {
114
- parts.push(block);
115
- }
116
- } else if (mcpCfg.sources.length === 0) {
117
- parts.push(`## External MCP sources`);
118
- parts.push("");
119
- parts.push(`No sources in \`.sdd/mcp.yaml\` yet. To attach org libraries / AST engines:`);
120
- parts.push(`\`sdd mcp sources add --help\` \xB7 docs: Configure MCP sources`);
121
- parts.push("");
122
- }
123
- } catch (err) {
124
- const msg = err instanceof Error ? err.message : String(err);
125
- parts.push(`## External MCP sources`);
126
- parts.push("");
127
- parts.push(`_MCP auto-fetch skipped (non-fatal): ${msg}_`);
128
- parts.push("");
129
- }
130
- parts.push(
131
- `When done with this stage, the human will run \`sdd next\` or \`sdd verify\` / \`sdd complete\`.`
132
- );
133
- return parts.join("\n");
134
- }
135
-
136
- export {
137
- formatStatus,
138
- buildAgentPrompt
139
- };