@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.
- package/defaults/prices.yaml +9 -0
- package/defaults/search.yaml +18 -0
- package/defaults/teams/research/roles/researcher.md +29 -0
- package/defaults/teams/research/team.yaml +7 -0
- package/defaults/teams/software/roles/architect.md +31 -0
- package/defaults/teams/software/roles/dev-lead.md +32 -0
- package/defaults/teams/software/roles/developer.md +30 -0
- package/defaults/teams/software/roles/product-manager.md +32 -0
- package/defaults/teams/software/roles/product-owner.md +30 -0
- package/defaults/teams/software/roles/qa.md +35 -0
- package/defaults/teams/software/routing.yaml +28 -0
- package/defaults/teams/software/team.yaml +24 -0
- package/defaults/teams/solo/roles/developer.md +28 -0
- package/defaults/teams/solo/team.yaml +7 -0
- package/defaults/templates/plan.md +17 -0
- package/defaults/templates/review.md +11 -0
- package/defaults/templates/story.md +13 -0
- package/defaults/templates/task.md +11 -0
- package/defaults/workflows/team-software.yaml +153 -0
- package/dist/{agents-RWYBLZQE.js → agents-PSIOQEYH.js} +18 -7
- package/dist/{change-context-W4HDO2IK.js → change-context-EZJMSGSP.js} +2 -4
- package/dist/chunk-26YG6A4M.js +1210 -0
- package/dist/chunk-2FJBFYVJ.js +1576 -0
- package/dist/{chunk-KYWETNFU.js → chunk-4BRO7BOJ.js} +2 -4
- package/dist/{chunk-74OGSVJZ.js → chunk-H55RFAEI.js} +2 -2
- package/dist/chunk-HG7TPW5V.js +567 -0
- package/dist/{chunk-EPFURATC.js → chunk-O5SP6X5R.js} +89 -0
- package/dist/chunk-TGRV6WGS.js +3436 -0
- package/dist/{gather-BZDW4EN4.js → gather-7TSVKQO2.js} +3 -4
- package/dist/{greenfield-Z425JOMP.js → greenfield-QFA5WVHE.js} +5 -6
- package/dist/index.d.ts +1832 -44
- package/dist/index.js +5172 -992
- 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-7JLDL2OK.js +0 -771
- package/dist/chunk-7MJYPJMR.js +0 -51
- package/dist/chunk-A752UVPF.js +0 -317
- package/dist/chunk-P3N67UEZ.js +0 -538
- package/dist/chunk-R5WQN4HA.js +0 -139
- package/dist/chunk-WHDG6OTG.js +0 -46
- package/dist/config-X5VDBVR4.js +0 -16
- package/dist/fs-J6DIV6CX.js +0 -28
- package/dist/paths-64GA32IZ.js +0 -28
package/dist/chunk-7MJYPJMR.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
// src/paths.ts
|
|
2
|
-
import { join } from "pathe";
|
|
3
|
-
var SDD_DIR = ".sdd";
|
|
4
|
-
function sddRoot(projectRoot) {
|
|
5
|
-
return join(projectRoot, SDD_DIR);
|
|
6
|
-
}
|
|
7
|
-
function configPath(projectRoot) {
|
|
8
|
-
return join(sddRoot(projectRoot), "config.yaml");
|
|
9
|
-
}
|
|
10
|
-
function workflowsDir(projectRoot) {
|
|
11
|
-
return join(sddRoot(projectRoot), "workflows");
|
|
12
|
-
}
|
|
13
|
-
function templatesDir(projectRoot) {
|
|
14
|
-
return join(sddRoot(projectRoot), "templates");
|
|
15
|
-
}
|
|
16
|
-
function memoryDir(projectRoot, config) {
|
|
17
|
-
return join(projectRoot, config.memory_path);
|
|
18
|
-
}
|
|
19
|
-
function changesDir(projectRoot, config) {
|
|
20
|
-
return join(projectRoot, config.changes_path);
|
|
21
|
-
}
|
|
22
|
-
function archiveDir(projectRoot, config) {
|
|
23
|
-
return join(projectRoot, config.archive_path);
|
|
24
|
-
}
|
|
25
|
-
function domainsDir(projectRoot, config) {
|
|
26
|
-
return join(projectRoot, config.domains_path);
|
|
27
|
-
}
|
|
28
|
-
function changePath(projectRoot, config, changeId) {
|
|
29
|
-
return join(changesDir(projectRoot, config), changeId);
|
|
30
|
-
}
|
|
31
|
-
function changeMetaPath(projectRoot, config, changeId) {
|
|
32
|
-
return join(changePath(projectRoot, config, changeId), "meta.yaml");
|
|
33
|
-
}
|
|
34
|
-
function activePointerPath(projectRoot, config) {
|
|
35
|
-
return join(changesDir(projectRoot, config), ".active");
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export {
|
|
39
|
-
SDD_DIR,
|
|
40
|
-
sddRoot,
|
|
41
|
-
configPath,
|
|
42
|
-
workflowsDir,
|
|
43
|
-
templatesDir,
|
|
44
|
-
memoryDir,
|
|
45
|
-
changesDir,
|
|
46
|
-
archiveDir,
|
|
47
|
-
domainsDir,
|
|
48
|
-
changePath,
|
|
49
|
-
changeMetaPath,
|
|
50
|
-
activePointerPath
|
|
51
|
-
};
|
package/dist/chunk-A752UVPF.js
DELETED
|
@@ -1,317 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ChangeMetaSchema,
|
|
3
|
-
WorkflowSchema
|
|
4
|
-
} from "./chunk-67AUAGNV.js";
|
|
5
|
-
import {
|
|
6
|
-
activePointerPath,
|
|
7
|
-
changeMetaPath,
|
|
8
|
-
changePath,
|
|
9
|
-
changesDir,
|
|
10
|
-
workflowsDir
|
|
11
|
-
} from "./chunk-7MJYPJMR.js";
|
|
12
|
-
import {
|
|
13
|
-
ensureDir,
|
|
14
|
-
listDirs,
|
|
15
|
-
listFiles,
|
|
16
|
-
pathExists,
|
|
17
|
-
readText,
|
|
18
|
-
readYaml,
|
|
19
|
-
writeText,
|
|
20
|
-
writeYaml
|
|
21
|
-
} from "./chunk-EPFURATC.js";
|
|
22
|
-
|
|
23
|
-
// src/slug.ts
|
|
24
|
-
function slugify(input) {
|
|
25
|
-
return input.toLowerCase().trim().replace(/['"]/g, "").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 60).replace(/-+$/g, "");
|
|
26
|
-
}
|
|
27
|
-
function todayIsoDate(d = /* @__PURE__ */ new Date()) {
|
|
28
|
-
return d.toISOString().slice(0, 10);
|
|
29
|
-
}
|
|
30
|
-
function nowIso(d = /* @__PURE__ */ new Date()) {
|
|
31
|
-
return d.toISOString();
|
|
32
|
-
}
|
|
33
|
-
function changeDirName(title, d = /* @__PURE__ */ new Date()) {
|
|
34
|
-
const slug = slugify(title) || "change";
|
|
35
|
-
return `${todayIsoDate(d)}-${slug}`;
|
|
36
|
-
}
|
|
37
|
-
function uniqueChangeDirName(base, taken) {
|
|
38
|
-
if (!taken.has(base)) return base;
|
|
39
|
-
let n = 2;
|
|
40
|
-
while (taken.has(`${base}-${n}`)) n += 1;
|
|
41
|
-
return `${base}-${n}`;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// src/workflow.ts
|
|
45
|
-
import { join } from "pathe";
|
|
46
|
-
async function listWorkflowNames(projectRoot) {
|
|
47
|
-
const dir = workflowsDir(projectRoot);
|
|
48
|
-
const files = await listFiles(dir);
|
|
49
|
-
return files.filter((f) => f.endsWith(".yaml") || f.endsWith(".yml")).map((f) => f.replace(/\.ya?ml$/, "")).sort();
|
|
50
|
-
}
|
|
51
|
-
async function loadWorkflow(projectRoot, name) {
|
|
52
|
-
const dir = workflowsDir(projectRoot);
|
|
53
|
-
const candidates = [`${name}.yaml`, `${name}.yml`];
|
|
54
|
-
for (const file of candidates) {
|
|
55
|
-
const path = join(dir, file);
|
|
56
|
-
if (await pathExists(path)) {
|
|
57
|
-
const raw = await readYaml(path);
|
|
58
|
-
const workflow = WorkflowSchema.parse(raw);
|
|
59
|
-
if (workflow.name !== name) {
|
|
60
|
-
}
|
|
61
|
-
return workflow;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
throw new Error(
|
|
65
|
-
`Workflow "${name}" not found in ${dir}. Available: ${(await listWorkflowNames(projectRoot)).join(", ") || "(none)"}`
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
function resolveStages(workflow, meta) {
|
|
69
|
-
const base = [...workflow.stages];
|
|
70
|
-
const extra = meta.overrides?.extra_stages ?? [];
|
|
71
|
-
const stages = [...base, ...extra];
|
|
72
|
-
return stages.map((stage) => {
|
|
73
|
-
const gateOverride = meta.overrides?.gates?.[stage.id];
|
|
74
|
-
if (!gateOverride) return stage;
|
|
75
|
-
return {
|
|
76
|
-
...stage,
|
|
77
|
-
gate: {
|
|
78
|
-
...stage.gate,
|
|
79
|
-
type: gateOverride
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
function isStageSkipped(meta, stageId) {
|
|
85
|
-
if (meta.overrides?.skip_stages?.includes(stageId)) return true;
|
|
86
|
-
if (meta.skipped?.some((s) => s.stage === stageId)) return true;
|
|
87
|
-
return false;
|
|
88
|
-
}
|
|
89
|
-
function shouldAutoSkip(stage, meta) {
|
|
90
|
-
const flags = stage.skip_when?.flags ?? [];
|
|
91
|
-
for (const flag of flags) {
|
|
92
|
-
if (meta.flags?.[flag] === true || meta.flags?.[flag] === "true") {
|
|
93
|
-
return true;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
return false;
|
|
97
|
-
}
|
|
98
|
-
function activeStages(workflow, meta) {
|
|
99
|
-
return resolveStages(workflow, meta).filter((s) => {
|
|
100
|
-
if (isStageSkipped(meta, s.id)) return false;
|
|
101
|
-
if (shouldAutoSkip(s, meta)) return false;
|
|
102
|
-
return true;
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
function getStage(workflow, meta, stageId) {
|
|
106
|
-
return resolveStages(workflow, meta).find((s) => s.id === stageId);
|
|
107
|
-
}
|
|
108
|
-
function nextStageId(workflow, meta) {
|
|
109
|
-
const all = resolveStages(workflow, meta);
|
|
110
|
-
const activeIds = new Set(activeStages(workflow, meta).map((s) => s.id));
|
|
111
|
-
let start = all.findIndex((s) => s.id === meta.stage);
|
|
112
|
-
if (start === -1) start = -1;
|
|
113
|
-
for (let i = start + 1; i < all.length; i++) {
|
|
114
|
-
const id = all[i].id;
|
|
115
|
-
if (activeIds.has(id)) return id;
|
|
116
|
-
}
|
|
117
|
-
return null;
|
|
118
|
-
}
|
|
119
|
-
function firstActiveStageId(workflow, meta) {
|
|
120
|
-
return activeStages(workflow, meta)[0]?.id ?? null;
|
|
121
|
-
}
|
|
122
|
-
function inferComplexity(title, hints) {
|
|
123
|
-
const text = `${title} ${(hints?.keywords ?? []).join(" ")}`.toLowerCase();
|
|
124
|
-
const hotfixHints = ["typo", "hotfix", "nit", "rename", "bump", "chore", "readme", "docs"];
|
|
125
|
-
const highHints = [
|
|
126
|
-
"architecture",
|
|
127
|
-
"migration",
|
|
128
|
-
"auth",
|
|
129
|
-
"payment",
|
|
130
|
-
"billing",
|
|
131
|
-
"redesign",
|
|
132
|
-
"platform",
|
|
133
|
-
"arb",
|
|
134
|
-
"epic"
|
|
135
|
-
];
|
|
136
|
-
if (hotfixHints.some((h) => text.includes(h))) return "low";
|
|
137
|
-
if (highHints.some((h) => text.includes(h))) return "high";
|
|
138
|
-
if (text.length > 80) return "medium";
|
|
139
|
-
return "medium";
|
|
140
|
-
}
|
|
141
|
-
async function recommendWorkflow(projectRoot, title, config, opts) {
|
|
142
|
-
const available = await listWorkflowNames(projectRoot);
|
|
143
|
-
const allowed = config.allowed_workflows?.length ? available.filter((n) => config.allowed_workflows.includes(n)) : available;
|
|
144
|
-
if (opts?.preferred) {
|
|
145
|
-
if (!available.includes(opts.preferred)) {
|
|
146
|
-
throw new Error(
|
|
147
|
-
`Workflow "${opts.preferred}" is not available. Available: ${available.join(", ") || "(none)"}`
|
|
148
|
-
);
|
|
149
|
-
}
|
|
150
|
-
if (config.allowed_workflows?.length && !config.allowed_workflows.includes(opts.preferred)) {
|
|
151
|
-
throw new Error(
|
|
152
|
-
`Workflow "${opts.preferred}" is not in allowed_workflows: ${config.allowed_workflows.join(", ")}`
|
|
153
|
-
);
|
|
154
|
-
}
|
|
155
|
-
return {
|
|
156
|
-
name: opts.preferred,
|
|
157
|
-
reason: "Explicitly selected",
|
|
158
|
-
alternatives: allowed.filter((n) => n !== opts.preferred)
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
if (config.default_workflow !== "recommend" && allowed.includes(config.default_workflow)) {
|
|
162
|
-
return {
|
|
163
|
-
name: config.default_workflow,
|
|
164
|
-
reason: `Repo default_workflow=${config.default_workflow}`,
|
|
165
|
-
alternatives: allowed.filter((n) => n !== config.default_workflow)
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
const complexity = opts?.complexity ?? inferComplexity(title);
|
|
169
|
-
const scored = [];
|
|
170
|
-
for (const name of allowed) {
|
|
171
|
-
try {
|
|
172
|
-
const wf = await loadWorkflow(projectRoot, name);
|
|
173
|
-
let score = wf.recommendation?.priority ?? 0;
|
|
174
|
-
let reason = `workflow priority ${score}`;
|
|
175
|
-
const when = wf.recommendation?.when;
|
|
176
|
-
if (complexity === "low" && name === "hotfix") {
|
|
177
|
-
score += 50;
|
|
178
|
-
reason = "Low complexity \u2192 hotfix";
|
|
179
|
-
} else if (complexity === "low" && name === "patch") {
|
|
180
|
-
score += 40;
|
|
181
|
-
reason = "Low complexity \u2192 patch";
|
|
182
|
-
} else if (complexity === "medium" && name === "feature") {
|
|
183
|
-
score += 45;
|
|
184
|
-
reason = "Medium complexity \u2192 feature";
|
|
185
|
-
} else if (complexity === "medium" && name === "patch") {
|
|
186
|
-
score += 30;
|
|
187
|
-
reason = "Medium complexity \u2192 patch";
|
|
188
|
-
} else if (complexity === "high" && name === "enterprise-feature") {
|
|
189
|
-
score += 50;
|
|
190
|
-
reason = "High complexity \u2192 enterprise-feature";
|
|
191
|
-
} else if (complexity === "high" && name === "feature") {
|
|
192
|
-
score += 35;
|
|
193
|
-
reason = "High complexity \u2192 feature";
|
|
194
|
-
}
|
|
195
|
-
const keywords = when?.keywords ?? [];
|
|
196
|
-
const titleLower = title.toLowerCase();
|
|
197
|
-
if (keywords.some((k) => titleLower.includes(k.toLowerCase()))) {
|
|
198
|
-
score += 20;
|
|
199
|
-
reason = `Keyword match for ${name}`;
|
|
200
|
-
}
|
|
201
|
-
scored.push({ name, score, reason });
|
|
202
|
-
} catch {
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
scored.sort((a, b) => b.score - a.score);
|
|
206
|
-
const best = scored[0];
|
|
207
|
-
if (!best) {
|
|
208
|
-
throw new Error("No workflows available. Run `sdd init` or add files under .sdd/workflows/");
|
|
209
|
-
}
|
|
210
|
-
return {
|
|
211
|
-
name: best.name,
|
|
212
|
-
reason: best.reason,
|
|
213
|
-
alternatives: scored.slice(1).map((s) => s.name)
|
|
214
|
-
};
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
// src/change-context.ts
|
|
218
|
-
async function loadChangeMeta(projectRoot, config, changeId) {
|
|
219
|
-
const path = changeMetaPath(projectRoot, config, changeId);
|
|
220
|
-
if (!await pathExists(path)) {
|
|
221
|
-
throw new Error(`Change not found: ${changeId}`);
|
|
222
|
-
}
|
|
223
|
-
return ChangeMetaSchema.parse(await readYaml(path));
|
|
224
|
-
}
|
|
225
|
-
async function saveChangeMeta(projectRoot, config, meta) {
|
|
226
|
-
meta.updated = nowIso();
|
|
227
|
-
await writeYaml(changeMetaPath(projectRoot, config, meta.id), ChangeMetaSchema.parse(meta));
|
|
228
|
-
}
|
|
229
|
-
async function buildContext(projectRoot, config, changeId) {
|
|
230
|
-
const meta = await loadChangeMeta(projectRoot, config, changeId);
|
|
231
|
-
const workflow = await loadWorkflow(projectRoot, meta.workflow);
|
|
232
|
-
return {
|
|
233
|
-
id: changeId,
|
|
234
|
-
path: changePath(projectRoot, config, changeId),
|
|
235
|
-
meta,
|
|
236
|
-
workflow,
|
|
237
|
-
stages: resolveStages(workflow, meta),
|
|
238
|
-
active: activeStages(workflow, meta)
|
|
239
|
-
};
|
|
240
|
-
}
|
|
241
|
-
async function listChanges(projectRoot, config) {
|
|
242
|
-
return listDirs(changesDir(projectRoot, config));
|
|
243
|
-
}
|
|
244
|
-
async function getActiveChangeId(projectRoot, config) {
|
|
245
|
-
const pointer = activePointerPath(projectRoot, config);
|
|
246
|
-
if (await pathExists(pointer)) {
|
|
247
|
-
const id = (await readText(pointer)).trim();
|
|
248
|
-
if (id && await pathExists(changePath(projectRoot, config, id))) {
|
|
249
|
-
return id;
|
|
250
|
-
}
|
|
251
|
-
if (id) {
|
|
252
|
-
await writeText(pointer, "");
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
const all = await listChanges(projectRoot, config);
|
|
256
|
-
const inProgress = [];
|
|
257
|
-
for (const id of all) {
|
|
258
|
-
try {
|
|
259
|
-
const meta = await loadChangeMeta(projectRoot, config, id);
|
|
260
|
-
if (meta.status === "in_progress" || meta.status === "blocked") {
|
|
261
|
-
inProgress.push({ id, updated: meta.updated ?? meta.created });
|
|
262
|
-
}
|
|
263
|
-
} catch {
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
if (!inProgress.length) return null;
|
|
267
|
-
inProgress.sort((a, b) => b.updated.localeCompare(a.updated));
|
|
268
|
-
return inProgress[0].id;
|
|
269
|
-
}
|
|
270
|
-
async function clearActiveIf(projectRoot, config, changeId) {
|
|
271
|
-
const pointer = activePointerPath(projectRoot, config);
|
|
272
|
-
if (!await pathExists(pointer)) return;
|
|
273
|
-
const id = (await readText(pointer)).trim();
|
|
274
|
-
if (id === changeId) {
|
|
275
|
-
await writeText(pointer, "");
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
async function setActiveChange(projectRoot, config, changeId) {
|
|
279
|
-
await ensureDir(changesDir(projectRoot, config));
|
|
280
|
-
await writeText(activePointerPath(projectRoot, config), `${changeId}
|
|
281
|
-
`);
|
|
282
|
-
}
|
|
283
|
-
async function resolveChangeId(projectRoot, config, changeId) {
|
|
284
|
-
if (changeId) return changeId;
|
|
285
|
-
const active = await getActiveChangeId(projectRoot, config);
|
|
286
|
-
if (!active) {
|
|
287
|
-
throw new Error("No active change. Pass --change <id> or run `sdd new`.");
|
|
288
|
-
}
|
|
289
|
-
return active;
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
export {
|
|
293
|
-
listWorkflowNames,
|
|
294
|
-
loadWorkflow,
|
|
295
|
-
resolveStages,
|
|
296
|
-
isStageSkipped,
|
|
297
|
-
shouldAutoSkip,
|
|
298
|
-
activeStages,
|
|
299
|
-
getStage,
|
|
300
|
-
nextStageId,
|
|
301
|
-
firstActiveStageId,
|
|
302
|
-
inferComplexity,
|
|
303
|
-
recommendWorkflow,
|
|
304
|
-
slugify,
|
|
305
|
-
todayIsoDate,
|
|
306
|
-
nowIso,
|
|
307
|
-
changeDirName,
|
|
308
|
-
uniqueChangeDirName,
|
|
309
|
-
loadChangeMeta,
|
|
310
|
-
saveChangeMeta,
|
|
311
|
-
buildContext,
|
|
312
|
-
listChanges,
|
|
313
|
-
getActiveChangeId,
|
|
314
|
-
clearActiveIf,
|
|
315
|
-
setActiveChange,
|
|
316
|
-
resolveChangeId
|
|
317
|
-
};
|