@structured-vibe-coding/core 0.17.1 → 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/defaults/prices.yaml +9 -0
- package/defaults/search.yaml +18 -0
- package/dist/{agents-CLTJJVOD.js → agents-AKSUXQHN.js} +18 -7
- package/dist/{change-context-W4HDO2IK.js → change-context-REE7UKU7.js} +2 -4
- package/dist/chunk-44LQ5BKZ.js +2628 -0
- package/dist/{chunk-KYWETNFU.js → chunk-4BRO7BOJ.js} +2 -4
- package/dist/chunk-4PIRWYRA.js +1125 -0
- package/dist/{chunk-72QJHR53.js → chunk-LHSR7JG2.js} +569 -39
- package/dist/{chunk-EPFURATC.js → chunk-O5SP6X5R.js} +89 -0
- package/dist/{chunk-BGM6KS64.js → chunk-QGP43XCN.js} +2 -2
- package/dist/{chunk-A752UVPF.js → chunk-QHV5KZKX.js} +193 -28
- package/dist/{gather-S4A5YR7X.js → gather-ZNV2NAUN.js} +3 -4
- package/dist/{greenfield-QQJH3XL3.js → greenfield-I5S5OS2D.js} +5 -6
- package/dist/index.d.ts +1034 -40
- package/dist/index.js +2927 -988
- package/dist/{sources-PF45EUH2.js → sources-3TXUPU6V.js} +2 -3
- package/package.json +11 -3
- package/vendor/tree-sitter/NOTICE +29 -0
- package/vendor/tree-sitter/tree-sitter-javascript.wasm +0 -0
- package/vendor/tree-sitter/tree-sitter-python.wasm +0 -0
- package/vendor/tree-sitter/tree-sitter-rust.wasm +0 -0
- package/vendor/tree-sitter/tree-sitter-tsx.wasm +0 -0
- package/vendor/tree-sitter/tree-sitter-typescript.wasm +0 -0
- package/dist/chunk-67AUAGNV.js +0 -150
- package/dist/chunk-7MJYPJMR.js +0 -51
- package/dist/chunk-BVCTVKBD.js +0 -538
- package/dist/chunk-WHDG6OTG.js +0 -46
- package/dist/chunk-WPAGUBZ5.js +0 -139
- package/dist/config-X5VDBVR4.js +0 -16
- package/dist/fs-J6DIV6CX.js +0 -28
- package/dist/paths-64GA32IZ.js +0 -28
package/dist/chunk-BVCTVKBD.js
DELETED
|
@@ -1,538 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
buildAgentPrompt,
|
|
3
|
-
formatStatus
|
|
4
|
-
} from "./chunk-WPAGUBZ5.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
|
-
};
|
package/dist/chunk-WHDG6OTG.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ConfigSchema
|
|
3
|
-
} from "./chunk-67AUAGNV.js";
|
|
4
|
-
import {
|
|
5
|
-
SddError
|
|
6
|
-
} from "./chunk-MHODNFIL.js";
|
|
7
|
-
import {
|
|
8
|
-
configPath,
|
|
9
|
-
sddRoot
|
|
10
|
-
} from "./chunk-7MJYPJMR.js";
|
|
11
|
-
import {
|
|
12
|
-
ensureDir,
|
|
13
|
-
pathExists,
|
|
14
|
-
readYaml,
|
|
15
|
-
writeYaml
|
|
16
|
-
} from "./chunk-EPFURATC.js";
|
|
17
|
-
|
|
18
|
-
// src/config.ts
|
|
19
|
-
async function isInitialized(projectRoot) {
|
|
20
|
-
return pathExists(configPath(projectRoot));
|
|
21
|
-
}
|
|
22
|
-
async function loadConfig(projectRoot) {
|
|
23
|
-
const path = configPath(projectRoot);
|
|
24
|
-
if (!await pathExists(path)) {
|
|
25
|
-
throw new SddError(`SDD is not initialized in ${projectRoot}. Run \`sdd init\` first.`, {
|
|
26
|
-
code: "NOT_INITIALIZED",
|
|
27
|
-
hint: "cd into your app and run: sdd init --here --ai copilot"
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
const raw = await readYaml(path);
|
|
31
|
-
return ConfigSchema.parse(raw);
|
|
32
|
-
}
|
|
33
|
-
async function saveConfig(projectRoot, config) {
|
|
34
|
-
await ensureDir(sddRoot(projectRoot));
|
|
35
|
-
await writeYaml(configPath(projectRoot), ConfigSchema.parse(config));
|
|
36
|
-
}
|
|
37
|
-
function defaultConfig() {
|
|
38
|
-
return ConfigSchema.parse({});
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export {
|
|
42
|
-
isInitialized,
|
|
43
|
-
loadConfig,
|
|
44
|
-
saveConfig,
|
|
45
|
-
defaultConfig
|
|
46
|
-
};
|