specdx 0.4.0-alpha.2 → 0.4.0-alpha.21
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/.claude-plugin/plugin.json +7 -2
- package/LICENSE +21 -0
- package/README.md +477 -0
- package/dist/{check-PZFBVQIP.js → check-GGGHTDTH.js} +37 -11
- package/dist/check-GGGHTDTH.js.map +1 -0
- package/dist/{chunk-QEUZJWBY.js → chunk-3YXRWQGX.js} +373 -63
- package/dist/chunk-3YXRWQGX.js.map +1 -0
- package/dist/chunk-5WRI5ZAA.js +31 -0
- package/dist/chunk-6IVWJKMQ.js +103 -0
- package/dist/chunk-6IVWJKMQ.js.map +1 -0
- package/dist/{chunk-YDU26YTH.js → chunk-HCJDCS26.js} +121 -17
- package/dist/chunk-HCJDCS26.js.map +1 -0
- package/dist/chunk-IEW62WR2.js +185 -0
- package/dist/chunk-IEW62WR2.js.map +1 -0
- package/dist/chunk-PXQML7NE.js +2846 -0
- package/dist/chunk-PXQML7NE.js.map +1 -0
- package/dist/{chunk-PHWUK7TH.js → chunk-QOP2KHW3.js} +290 -52
- package/dist/chunk-QOP2KHW3.js.map +1 -0
- package/dist/{chunk-FZWT4HVX.js → chunk-SNQNQ2MP.js} +157 -3
- package/dist/chunk-SNQNQ2MP.js.map +1 -0
- package/dist/{chunk-YRDOYUKF.js → chunk-YRQPY5NF.js} +124 -19
- package/dist/chunk-YRQPY5NF.js.map +1 -0
- package/dist/diff-VHVSXLKU.js +188 -0
- package/dist/diff-VHVSXLKU.js.map +1 -0
- package/dist/{dist-2B2MR5AM.js → dist-QRCEQ5WI.js} +53 -14
- package/dist/dist-QRCEQ5WI.js.map +1 -0
- package/dist/dist-ROHCFKYT.js +16 -0
- package/dist/dist-ROHCFKYT.js.map +1 -0
- package/dist/generate-WMJ37LCN.js +21 -0
- package/dist/generate-WMJ37LCN.js.map +1 -0
- package/dist/{generate-story-AOALIKSD.js → generate-story-ORJX24P7.js} +48 -20
- package/dist/generate-story-ORJX24P7.js.map +1 -0
- package/dist/{generate-test-plan-34L6RGOB.js → generate-test-plan-Z46W3N3B.js} +63 -10
- package/dist/generate-test-plan-Z46W3N3B.js.map +1 -0
- package/dist/graph-TG2CONHV.js +103 -0
- package/dist/graph-TG2CONHV.js.map +1 -0
- package/dist/index.d.ts +171 -0
- package/dist/index.js +2648 -390
- package/dist/index.js.map +1 -1
- package/dist/{lint-XGVQ6LCP.js → lint-ZFG6ALIT.js} +23 -8
- package/dist/lint-ZFG6ALIT.js.map +1 -0
- package/dist/main.js +11 -146
- package/dist/main.js.map +1 -1
- package/dist/mcp-WBHZANS5.js +35 -0
- package/dist/mcp-WBHZANS5.js.map +1 -0
- package/dist/{migrate-KDJZQKP7.js → migrate-FKFC7UAO.js} +20 -8
- package/dist/migrate-FKFC7UAO.js.map +1 -0
- package/dist/{pack-OJ3CDZHD.js → pack-VDEO7GRF.js} +39 -11
- package/dist/pack-VDEO7GRF.js.map +1 -0
- package/dist/ready-VDOH3XCV.js +257 -0
- package/dist/ready-VDOH3XCV.js.map +1 -0
- package/dist/skills/{specdx-author-spec.md → core/specdx-author-spec/SKILL.md} +10 -6
- package/dist/skills/{specdx-author-spec → core/specdx-author-spec/references}/step-01-frontmatter.md +1 -1
- package/dist/skills/{specdx-author-spec → core/specdx-author-spec/references}/step-02-sections.md +41 -0
- package/dist/skills/{specdx-onboard.md → core/specdx-onboard/SKILL.md} +8 -3
- package/dist/skills/{specdx-plan-from-spec.md → core/specdx-plan-from-spec/SKILL.md} +5 -1
- package/dist/skills/{specdx-pre-commit.md → core/specdx-pre-commit/SKILL.md} +16 -2
- package/dist/skills/{specdx-review-spec.md → core/specdx-review-spec/SKILL.md} +5 -1
- package/dist/skills/core/specdx-router/SKILL.md +67 -0
- package/dist/skills/{specdx-sprint-review.md → core/specdx-sprint-review/SKILL.md} +5 -1
- package/dist/skills/{specdx-start-task.md → core/specdx-start-task/SKILL.md} +5 -1
- package/dist/skills/{specdx-check-drift.md → experimental/specdx-check-drift/SKILL.md} +10 -4
- package/dist/skills/{specdx-verify.md → experimental/specdx-verify/SKILL.md} +17 -2
- package/dist/skills-36SRUEMR.js +121 -0
- package/dist/skills-36SRUEMR.js.map +1 -0
- package/dist/{status-JVIXK73H.js → status-JIQUF6MX.js} +48 -34
- package/dist/status-JIQUF6MX.js.map +1 -0
- package/dist/{update-HFLDULNJ.js → update-DNXF5Q64.js} +10 -9
- package/dist/update-DNXF5Q64.js.map +1 -0
- package/dist/validate-TSAMI65E.js +87 -0
- package/dist/validate-TSAMI65E.js.map +1 -0
- package/hooks/hooks.json +12 -6
- package/hooks/session-start +35 -3
- package/package.json +68 -21
- package/dist/changelog-G6XDIAZP.js +0 -86
- package/dist/changelog-G6XDIAZP.js.map +0 -1
- package/dist/check-PZFBVQIP.js.map +0 -1
- package/dist/chunk-7C3BAVCP.js +0 -1147
- package/dist/chunk-7C3BAVCP.js.map +0 -1
- package/dist/chunk-FZWT4HVX.js.map +0 -1
- package/dist/chunk-PHWUK7TH.js.map +0 -1
- package/dist/chunk-QEUZJWBY.js.map +0 -1
- package/dist/chunk-YDU26YTH.js.map +0 -1
- package/dist/chunk-YRDOYUKF.js.map +0 -1
- package/dist/diff-BEZARP53.js +0 -100
- package/dist/diff-BEZARP53.js.map +0 -1
- package/dist/dist-2B2MR5AM.js.map +0 -1
- package/dist/dist-WIK7F2PJ.js +0 -11
- package/dist/explain-PCZKDEM4.js +0 -102
- package/dist/explain-PCZKDEM4.js.map +0 -1
- package/dist/generate-OMEBJQFQ.js +0 -13
- package/dist/generate-OMEBJQFQ.js.map +0 -1
- package/dist/generate-story-AOALIKSD.js.map +0 -1
- package/dist/generate-test-plan-34L6RGOB.js.map +0 -1
- package/dist/graph-RR5UTY3R.js +0 -54
- package/dist/graph-RR5UTY3R.js.map +0 -1
- package/dist/lint-XGVQ6LCP.js.map +0 -1
- package/dist/mcp-GUFW37BE.js +0 -17
- package/dist/mcp-GUFW37BE.js.map +0 -1
- package/dist/migrate-KDJZQKP7.js.map +0 -1
- package/dist/pack-OJ3CDZHD.js.map +0 -1
- package/dist/ready-WTNO5W7C.js +0 -165
- package/dist/ready-WTNO5W7C.js.map +0 -1
- package/dist/skills-3GBBWZW2.js +0 -93
- package/dist/skills-3GBBWZW2.js.map +0 -1
- package/dist/status-JVIXK73H.js.map +0 -1
- package/dist/update-HFLDULNJ.js.map +0 -1
- package/dist/validate-O7W5YLR6.js +0 -34
- package/dist/validate-O7W5YLR6.js.map +0 -1
- /package/dist/{dist-WIK7F2PJ.js.map → chunk-5WRI5ZAA.js.map} +0 -0
- /package/dist/skills/{spec-type-reference.md → core/specdx-author-spec/references/spec-type-reference.md} +0 -0
- /package/dist/skills/{specdx-author-spec → core/specdx-author-spec/references}/step-03-finalize.md +0 -0
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
import {
|
|
2
|
+
sharedArgs
|
|
3
|
+
} from "./chunk-GAM4MXPC.js";
|
|
4
|
+
import {
|
|
5
|
+
createLintEngine,
|
|
6
|
+
getPreset,
|
|
7
|
+
parseFeatures
|
|
8
|
+
} from "./chunk-QOP2KHW3.js";
|
|
9
|
+
import {
|
|
10
|
+
DEFAULT_DIFF_CONFIG
|
|
11
|
+
} from "./chunk-PXQML7NE.js";
|
|
12
|
+
import {
|
|
13
|
+
buildGraph,
|
|
14
|
+
createLogger,
|
|
15
|
+
loadConfig,
|
|
16
|
+
parseSpec,
|
|
17
|
+
resolveGlob
|
|
18
|
+
} from "./chunk-SNQNQ2MP.js";
|
|
19
|
+
import "./chunk-HCJDCS26.js";
|
|
20
|
+
import "./chunk-5WRI5ZAA.js";
|
|
21
|
+
|
|
22
|
+
// src/commands/core/ready.ts
|
|
23
|
+
import { defineCommand } from "citty";
|
|
24
|
+
async function runReady() {
|
|
25
|
+
const configDir = process.cwd();
|
|
26
|
+
const config = await loadConfig(void 0, configDir);
|
|
27
|
+
const checks = [];
|
|
28
|
+
const specs = [];
|
|
29
|
+
for (const [key, entry] of Object.entries(config.specs)) {
|
|
30
|
+
const paths = await resolveGlob(entry.path, configDir);
|
|
31
|
+
for (const p of paths) {
|
|
32
|
+
const spec = await parseSpec(p);
|
|
33
|
+
specs.push({
|
|
34
|
+
spec,
|
|
35
|
+
key,
|
|
36
|
+
entry
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
checks.push({
|
|
41
|
+
name: "Spec suite non-empty",
|
|
42
|
+
passed: specs.length > 0,
|
|
43
|
+
details: specs.length > 0 ? `${specs.length} specs resolved` : "no spec files resolved \u2014 check the spec paths in spec.config.yaml"
|
|
44
|
+
});
|
|
45
|
+
const requiredEntries = Object.entries(config.specs).filter(
|
|
46
|
+
([, entry]) => entry.required
|
|
47
|
+
);
|
|
48
|
+
const missingRequired = [];
|
|
49
|
+
for (const [key, entry] of requiredEntries) {
|
|
50
|
+
const paths = await resolveGlob(entry.path, configDir);
|
|
51
|
+
if (paths.length === 0) {
|
|
52
|
+
missingRequired.push(key);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (requiredEntries.length === 0) {
|
|
56
|
+
checks.push({
|
|
57
|
+
name: "Required specs present",
|
|
58
|
+
passed: true,
|
|
59
|
+
skipped: true,
|
|
60
|
+
details: "skipped (no specs marked required in config)"
|
|
61
|
+
});
|
|
62
|
+
} else {
|
|
63
|
+
checks.push({
|
|
64
|
+
name: "Required specs present",
|
|
65
|
+
passed: missingRequired.length === 0,
|
|
66
|
+
details: missingRequired.length === 0 ? `All ${requiredEntries.length} required specs found` : `Missing: ${missingRequired.join(", ")}`
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
const presetName = config.lint?.extends ?? "recommended";
|
|
70
|
+
const rules = getPreset(presetName);
|
|
71
|
+
let graph;
|
|
72
|
+
let graphError;
|
|
73
|
+
try {
|
|
74
|
+
graph = buildGraph(config);
|
|
75
|
+
} catch (err) {
|
|
76
|
+
graphError = err.message;
|
|
77
|
+
}
|
|
78
|
+
const engine = createLintEngine({ rules, config, graph });
|
|
79
|
+
const lintResults = engine.lint(specs.map((s) => s.spec));
|
|
80
|
+
if (graphError) {
|
|
81
|
+
lintResults.diagnostics.push({
|
|
82
|
+
ruleId: "structure/no-circular-deps",
|
|
83
|
+
severity: "error",
|
|
84
|
+
message: graphError,
|
|
85
|
+
filePath: "spec.config.yaml"
|
|
86
|
+
});
|
|
87
|
+
lintResults.hasErrors = true;
|
|
88
|
+
}
|
|
89
|
+
const errors = lintResults.diagnostics.filter((d) => d.severity === "error").length;
|
|
90
|
+
const warnings = lintResults.diagnostics.filter((d) => d.severity === "warn").length;
|
|
91
|
+
if (specs.length === 0) {
|
|
92
|
+
checks.push({
|
|
93
|
+
name: "Lint health",
|
|
94
|
+
passed: true,
|
|
95
|
+
skipped: true,
|
|
96
|
+
details: "skipped (no specs to lint)"
|
|
97
|
+
});
|
|
98
|
+
} else {
|
|
99
|
+
checks.push({
|
|
100
|
+
name: "Lint health",
|
|
101
|
+
passed: errors === 0,
|
|
102
|
+
details: `${errors} errors, ${warnings} warnings`
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
const placeholderDiagnostics = lintResults.diagnostics.filter(
|
|
106
|
+
(d) => d.ruleId === "completeness/no-placeholder-sections"
|
|
107
|
+
);
|
|
108
|
+
const placeholderFiles = new Set(placeholderDiagnostics.map((d) => d.filePath));
|
|
109
|
+
if (specs.length === 0) {
|
|
110
|
+
checks.push({
|
|
111
|
+
name: "Specs have content",
|
|
112
|
+
passed: true,
|
|
113
|
+
skipped: true,
|
|
114
|
+
details: "skipped (no specs to assess)"
|
|
115
|
+
});
|
|
116
|
+
} else {
|
|
117
|
+
checks.push({
|
|
118
|
+
name: "Specs have content",
|
|
119
|
+
passed: placeholderFiles.size === 0,
|
|
120
|
+
details: placeholderFiles.size === 0 ? "No placeholder sections" : `${placeholderDiagnostics.length} placeholder section(s) across ${placeholderFiles.size} spec(s)`
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
const integrityIssues = [];
|
|
124
|
+
if (graphError) {
|
|
125
|
+
integrityIssues.push(graphError);
|
|
126
|
+
}
|
|
127
|
+
const refErrors = lintResults.diagnostics.filter(
|
|
128
|
+
(d) => d.ruleId === "structure/valid-references"
|
|
129
|
+
);
|
|
130
|
+
for (const d of refErrors) {
|
|
131
|
+
integrityIssues.push(d.message);
|
|
132
|
+
}
|
|
133
|
+
const hasDeclaredRelations = specs.some((s) => {
|
|
134
|
+
const refs = s.spec.frontmatter.references;
|
|
135
|
+
return Array.isArray(refs) && refs.length > 0;
|
|
136
|
+
}) || Object.values(config.specs).some(
|
|
137
|
+
(entry) => (entry.requires?.length ?? 0) > 0
|
|
138
|
+
);
|
|
139
|
+
if (integrityIssues.length === 0 && !hasDeclaredRelations) {
|
|
140
|
+
checks.push({
|
|
141
|
+
name: "No integrity issues",
|
|
142
|
+
passed: true,
|
|
143
|
+
skipped: true,
|
|
144
|
+
details: "skipped (no references or dependencies declared)"
|
|
145
|
+
});
|
|
146
|
+
} else {
|
|
147
|
+
checks.push({
|
|
148
|
+
name: "No integrity issues",
|
|
149
|
+
passed: integrityIssues.length === 0,
|
|
150
|
+
details: integrityIssues.length === 0 ? "References and dependencies valid" : integrityIssues.join("; ")
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
const thresholdDays = config.diff?.staleness_threshold_days ?? DEFAULT_DIFF_CONFIG.staleness_threshold_days;
|
|
154
|
+
const now = Date.now();
|
|
155
|
+
const staleSpecs = [];
|
|
156
|
+
for (const { spec } of specs) {
|
|
157
|
+
const dateStr = spec.frontmatter.updated || spec.frontmatter.created;
|
|
158
|
+
if (dateStr) {
|
|
159
|
+
const days = Math.floor((now - new Date(dateStr).getTime()) / (1e3 * 60 * 60 * 24));
|
|
160
|
+
if (days > thresholdDays) {
|
|
161
|
+
staleSpecs.push({ specId: spec.frontmatter.id, days });
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
if (specs.length === 0) {
|
|
166
|
+
checks.push({
|
|
167
|
+
name: "No stale specs",
|
|
168
|
+
passed: true,
|
|
169
|
+
skipped: true,
|
|
170
|
+
details: "skipped (no specs to date-check)"
|
|
171
|
+
});
|
|
172
|
+
} else {
|
|
173
|
+
checks.push({
|
|
174
|
+
name: "No stale specs",
|
|
175
|
+
passed: staleSpecs.length === 0,
|
|
176
|
+
details: staleSpecs.length === 0 ? `All specs within ${thresholdDays}-day threshold` : staleSpecs.map((s) => `${s.specId} (${s.days}d)`).join(", ")
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
const hasPrd = specs.some((s) => s.spec.frontmatter.type === "prd");
|
|
180
|
+
const storyCoverageErrors = lintResults.diagnostics.filter(
|
|
181
|
+
(d) => d.ruleId === "completeness/story-coverage"
|
|
182
|
+
);
|
|
183
|
+
const featureCount = specs.filter((s) => s.spec.frontmatter.type === "prd").reduce((sum, s) => sum + parseFeatures(s.spec.content).length, 0);
|
|
184
|
+
if (!hasPrd) {
|
|
185
|
+
checks.push({
|
|
186
|
+
name: "Story coverage",
|
|
187
|
+
passed: true,
|
|
188
|
+
skipped: true,
|
|
189
|
+
details: "skipped (no PRD in suite)"
|
|
190
|
+
});
|
|
191
|
+
} else if (featureCount === 0) {
|
|
192
|
+
checks.push({
|
|
193
|
+
name: "Story coverage",
|
|
194
|
+
passed: true,
|
|
195
|
+
skipped: true,
|
|
196
|
+
details: "skipped (no features declared in the PRD)"
|
|
197
|
+
});
|
|
198
|
+
} else {
|
|
199
|
+
checks.push({
|
|
200
|
+
name: "Story coverage",
|
|
201
|
+
passed: storyCoverageErrors.length === 0,
|
|
202
|
+
details: storyCoverageErrors.length === 0 ? "All PRD features have corresponding stories" : storyCoverageErrors.map((d) => d.message).join("; ")
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
const ready = checks.every((c) => c.passed);
|
|
206
|
+
return { project: config.project?.name ?? "project", ready, checks };
|
|
207
|
+
}
|
|
208
|
+
var ready_default = defineCommand({
|
|
209
|
+
meta: { name: "ready", description: "Check if spec suite is ready for implementation" },
|
|
210
|
+
args: {
|
|
211
|
+
...sharedArgs
|
|
212
|
+
},
|
|
213
|
+
async run({ args }) {
|
|
214
|
+
try {
|
|
215
|
+
const logger = createLogger({ quiet: args.quiet, verbose: args.verbose });
|
|
216
|
+
logger.debug("Running readiness checks...");
|
|
217
|
+
const result = await runReady();
|
|
218
|
+
if (args.format === "json") {
|
|
219
|
+
console.log(JSON.stringify(result, null, 2));
|
|
220
|
+
if (!result.ready) process.exit(1);
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
const icon = result.ready ? "\u2713" : "\u2717";
|
|
224
|
+
const label = result.ready ? "ready for implementation" : "not ready for implementation";
|
|
225
|
+
console.log(`
|
|
226
|
+
${icon} ${result.project} \u2014 ${label}
|
|
227
|
+
`);
|
|
228
|
+
for (const check of result.checks) {
|
|
229
|
+
const checkIcon = check.skipped ? "\u2013" : check.passed ? "\u2713" : "\u2717";
|
|
230
|
+
console.log(` ${checkIcon} ${check.name}: ${check.details}`);
|
|
231
|
+
}
|
|
232
|
+
const failCount = result.checks.filter((c) => !c.passed).length;
|
|
233
|
+
if (failCount > 0) {
|
|
234
|
+
console.log(
|
|
235
|
+
`
|
|
236
|
+
Verdict: NOT READY \u2014 ${failCount} issue${failCount > 1 ? "s" : ""} to resolve
|
|
237
|
+
`
|
|
238
|
+
);
|
|
239
|
+
} else {
|
|
240
|
+
console.log(`
|
|
241
|
+
Verdict: READY
|
|
242
|
+
`);
|
|
243
|
+
}
|
|
244
|
+
if (!result.ready) process.exit(1);
|
|
245
|
+
} catch (err) {
|
|
246
|
+
console.error(`
|
|
247
|
+
\u2717 ${err.message}
|
|
248
|
+
`);
|
|
249
|
+
process.exit(1);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
export {
|
|
254
|
+
ready_default as default,
|
|
255
|
+
runReady
|
|
256
|
+
};
|
|
257
|
+
//# sourceMappingURL=ready-VDOH3XCV.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/core/ready.ts"],"sourcesContent":["import { defineCommand } from \"citty\";\nimport { loadConfig, parseSpec, resolveGlob, buildGraph, createLogger } from \"@specdx/core\";\nimport { createLintEngine, getPreset, parseFeatures } from \"@specdx/lint\";\nimport type { ParsedSpec } from \"@specdx/core\";\nimport { DEFAULT_DIFF_CONFIG } from \"@specdx/diff\";\nimport { sharedArgs } from \"../../shared-args.js\";\n\nexport interface ReadyCheck {\n name: string;\n passed: boolean;\n /** True when the check had nothing to verify — reported as skipped, not as a pass. */\n skipped?: boolean;\n details: string;\n}\n\nexport interface ReadyResult {\n project: string;\n ready: boolean;\n checks: ReadyCheck[];\n}\n\nexport async function runReady(): Promise<ReadyResult> {\n const configDir = process.cwd();\n const config = await loadConfig(undefined, configDir);\n\n const checks: ReadyCheck[] = [];\n\n // Resolve and parse all specs\n const specs: {\n spec: ParsedSpec;\n key: string;\n entry: { path: string; required?: boolean; owner?: string };\n }[] = [];\n for (const [key, entry] of Object.entries(config.specs)) {\n const paths = await resolveGlob(entry.path, configDir);\n for (const p of paths) {\n const spec = await parseSpec(p);\n specs.push({\n spec,\n key,\n entry: entry as { path: string; required?: boolean; owner?: string },\n });\n }\n }\n\n // Check 0: The suite has specs at all. Without this, every check below\n // ticks over an empty set and READY means nothing (vacuous-pass audit).\n checks.push({\n name: \"Spec suite non-empty\",\n passed: specs.length > 0,\n details:\n specs.length > 0\n ? `${specs.length} specs resolved`\n : \"no spec files resolved — check the spec paths in spec.config.yaml\",\n });\n\n // Check 1: Required specs exist\n const requiredEntries = Object.entries(config.specs).filter(\n ([, entry]) => (entry as { required?: boolean }).required,\n );\n const missingRequired: string[] = [];\n for (const [key, entry] of requiredEntries) {\n const paths = await resolveGlob(entry.path, configDir);\n if (paths.length === 0) {\n missingRequired.push(key);\n }\n }\n if (requiredEntries.length === 0) {\n checks.push({\n name: \"Required specs present\",\n passed: true,\n skipped: true,\n details: \"skipped (no specs marked required in config)\",\n });\n } else {\n checks.push({\n name: \"Required specs present\",\n passed: missingRequired.length === 0,\n details:\n missingRequired.length === 0\n ? `All ${requiredEntries.length} required specs found`\n : `Missing: ${missingRequired.join(\", \")}`,\n });\n }\n\n // Check 2: Lint health (no errors)\n const presetName = config.lint?.extends ?? \"recommended\";\n const rules = getPreset(presetName);\n\n let graph;\n let graphError: string | undefined;\n try {\n graph = buildGraph(config);\n } catch (err) {\n graphError = (err as Error).message;\n }\n\n const engine = createLintEngine({ rules, config, graph });\n const lintResults = engine.lint(specs.map((s) => s.spec));\n\n if (graphError) {\n lintResults.diagnostics.push({\n ruleId: \"structure/no-circular-deps\",\n severity: \"error\",\n message: graphError,\n filePath: \"spec.config.yaml\",\n });\n lintResults.hasErrors = true;\n }\n\n const errors = lintResults.diagnostics.filter((d) => d.severity === \"error\").length;\n const warnings = lintResults.diagnostics.filter((d) => d.severity === \"warn\").length;\n if (specs.length === 0) {\n checks.push({\n name: \"Lint health\",\n passed: true,\n skipped: true,\n details: \"skipped (no specs to lint)\",\n });\n } else {\n checks.push({\n name: \"Lint health\",\n passed: errors === 0,\n details: `${errors} errors, ${warnings} warnings`,\n });\n }\n\n // Check 2b: specs actually say something. A scaffolded suite passes every\n // structural check while every section is still a placeholder, so without\n // this a brand new project is declared ready to implement (issue #24).\n const placeholderDiagnostics = lintResults.diagnostics.filter(\n (d) => d.ruleId === \"completeness/no-placeholder-sections\",\n );\n const placeholderFiles = new Set(placeholderDiagnostics.map((d) => d.filePath));\n if (specs.length === 0) {\n checks.push({\n name: \"Specs have content\",\n passed: true,\n skipped: true,\n details: \"skipped (no specs to assess)\",\n });\n } else {\n checks.push({\n name: \"Specs have content\",\n passed: placeholderFiles.size === 0,\n details:\n placeholderFiles.size === 0\n ? \"No placeholder sections\"\n : `${placeholderDiagnostics.length} placeholder section(s) across ${placeholderFiles.size} spec(s)`,\n });\n }\n\n // Check 3: No integrity issues (broken refs, circular deps)\n const integrityIssues: string[] = [];\n if (graphError) {\n integrityIssues.push(graphError);\n }\n const refErrors = lintResults.diagnostics.filter(\n (d) => d.ruleId === \"structure/valid-references\",\n );\n for (const d of refErrors) {\n integrityIssues.push(d.message);\n }\n const hasDeclaredRelations =\n specs.some((s) => {\n const refs = s.spec.frontmatter.references;\n return Array.isArray(refs) && refs.length > 0;\n }) ||\n Object.values(config.specs).some(\n (entry) => ((entry as { requires?: string[] }).requires?.length ?? 0) > 0,\n );\n if (integrityIssues.length === 0 && !hasDeclaredRelations) {\n checks.push({\n name: \"No integrity issues\",\n passed: true,\n skipped: true,\n details: \"skipped (no references or dependencies declared)\",\n });\n } else {\n checks.push({\n name: \"No integrity issues\",\n passed: integrityIssues.length === 0,\n details:\n integrityIssues.length === 0\n ? \"References and dependencies valid\"\n : integrityIssues.join(\"; \"),\n });\n }\n\n // Check 4: No stale specs\n const thresholdDays =\n config.diff?.staleness_threshold_days ?? DEFAULT_DIFF_CONFIG.staleness_threshold_days;\n const now = Date.now();\n const staleSpecs: { specId: string; days: number }[] = [];\n for (const { spec } of specs) {\n const dateStr =\n (spec.frontmatter.updated as string | undefined) ||\n (spec.frontmatter.created as string | undefined);\n if (dateStr) {\n const days = Math.floor((now - new Date(dateStr).getTime()) / (1000 * 60 * 60 * 24));\n if (days > thresholdDays) {\n staleSpecs.push({ specId: spec.frontmatter.id as string, days });\n }\n }\n }\n if (specs.length === 0) {\n checks.push({\n name: \"No stale specs\",\n passed: true,\n skipped: true,\n details: \"skipped (no specs to date-check)\",\n });\n } else {\n checks.push({\n name: \"No stale specs\",\n passed: staleSpecs.length === 0,\n details:\n staleSpecs.length === 0\n ? `All specs within ${thresholdDays}-day threshold`\n : staleSpecs.map((s) => `${s.specId} (${s.days}d)`).join(\", \"),\n });\n }\n\n // Check 5: Story coverage — every PRD feature has a user story\n const hasPrd = specs.some((s) => s.spec.frontmatter.type === \"prd\");\n const storyCoverageErrors = lintResults.diagnostics.filter(\n (d) => d.ruleId === \"completeness/story-coverage\",\n );\n // A PRD with no parseable features has nothing to be covered, so asserting\n // that every feature has a story is a claim about an empty set -- the same\n // vacuous pass the suite-level checks were fixed for.\n const featureCount = specs\n .filter((s) => s.spec.frontmatter.type === \"prd\")\n .reduce((sum, s) => sum + parseFeatures(s.spec.content).length, 0);\n\n if (!hasPrd) {\n checks.push({\n name: \"Story coverage\",\n passed: true,\n skipped: true,\n details: \"skipped (no PRD in suite)\",\n });\n } else if (featureCount === 0) {\n checks.push({\n name: \"Story coverage\",\n passed: true,\n skipped: true,\n details: \"skipped (no features declared in the PRD)\",\n });\n } else {\n checks.push({\n name: \"Story coverage\",\n passed: storyCoverageErrors.length === 0,\n details:\n storyCoverageErrors.length === 0\n ? \"All PRD features have corresponding stories\"\n : storyCoverageErrors.map((d) => d.message).join(\"; \"),\n });\n }\n\n const ready = checks.every((c) => c.passed);\n return { project: config.project?.name ?? \"project\", ready, checks };\n}\n\nexport default defineCommand({\n meta: { name: \"ready\", description: \"Check if spec suite is ready for implementation\" },\n args: {\n ...sharedArgs,\n },\n async run({ args }) {\n try {\n const logger = createLogger({ quiet: args.quiet, verbose: args.verbose });\n logger.debug(\"Running readiness checks...\");\n\n const result = await runReady();\n\n if (args.format === \"json\") {\n console.log(JSON.stringify(result, null, 2));\n if (!result.ready) process.exit(1);\n return;\n }\n\n // Pretty format\n const icon = result.ready ? \"✓\" : \"✗\";\n const label = result.ready ? \"ready for implementation\" : \"not ready for implementation\";\n\n console.log(`\\n ${icon} ${result.project} — ${label}\\n`);\n\n for (const check of result.checks) {\n const checkIcon = check.skipped ? \"–\" : check.passed ? \"✓\" : \"✗\";\n console.log(` ${checkIcon} ${check.name}: ${check.details}`);\n }\n\n const failCount = result.checks.filter((c) => !c.passed).length;\n if (failCount > 0) {\n console.log(\n `\\n Verdict: NOT READY — ${failCount} issue${failCount > 1 ? \"s\" : \"\"} to resolve\\n`,\n );\n } else {\n console.log(`\\n Verdict: READY\\n`);\n }\n\n if (!result.ready) process.exit(1);\n } catch (err) {\n console.error(`\\n ✗ ${(err as Error).message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YAAY,IAAI,MAAM,EAAE;AAAA;AAAA,QACxE;AAAA,MACF,OAAO;AACL,gBAAQ,IAAI;AAAA;AAAA,CAAsB;AAAA,MACpC;AAEA,UAAI,CAAC,OAAO,MAAO,SAAQ,KAAK,CAAC;AAAA,IACnC,SAAS,KAAK;AACZ,cAAQ,MAAM;AAAA,WAAU,IAAc,OAAO;AAAA,CAAI;AACjD,cAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF;AACF,CAAC;","names":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: specdx-author-spec
|
|
3
3
|
description: Use when the user wants to create a new spec, write a PRD, document a technical design, record an architecture decision, add a user story, or write a test plan. Guides spec authoring with iterative linting.
|
|
4
|
-
allowed-tools: Bash(npx specdx
|
|
4
|
+
allowed-tools: Bash(npx specdx:*) Read Write Edit
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Author a Spec
|
|
@@ -10,20 +10,24 @@ This skill follows a 3-step workflow. Load each step file as you reach it — th
|
|
|
10
10
|
|
|
11
11
|
## Steps
|
|
12
12
|
|
|
13
|
-
1. **Frontmatter** — Read `
|
|
13
|
+
1. **Frontmatter** — Read `references/step-01-frontmatter.md`
|
|
14
14
|
- Determine spec type, check existing specs, create file with frontmatter
|
|
15
15
|
|
|
16
|
-
2. **Sections** — Read `
|
|
16
|
+
2. **Sections** — Read `references/step-02-sections.md`
|
|
17
17
|
- Write sections one at a time, lint after every 2-3 sections
|
|
18
18
|
- HARD GATE: Do NOT skip lint between sections
|
|
19
19
|
|
|
20
|
-
3. **Finalize** — Read `
|
|
20
|
+
3. **Finalize** — Read `references/step-03-finalize.md`
|
|
21
21
|
- Register in spec.config.yaml, run final validation
|
|
22
22
|
|
|
23
23
|
## How to use
|
|
24
24
|
|
|
25
|
-
Start by reading `
|
|
25
|
+
Start by reading `references/step-01-frontmatter.md` (relative to this file). Complete that step fully before moving to step 2.
|
|
26
26
|
|
|
27
27
|
Each step file is self-contained with its own instructions. Do NOT read ahead — load one step at a time.
|
|
28
28
|
|
|
29
|
-
For detailed reference on spec types and their fields, see `spec-type-reference.md
|
|
29
|
+
For detailed reference on spec types and their fields, see `references/spec-type-reference.md`.
|
|
30
|
+
|
|
31
|
+
## It's working if
|
|
32
|
+
|
|
33
|
+
The spec lints clean *and* a reader who was not in the conversation could build from it. If you finished the steps but every section is one vague line, the skill ran and the spec still fails its job — `specdx lint` will now flag placeholder sections, so an empty pass means real content.
|
package/dist/skills/{specdx-author-spec → core/specdx-author-spec/references}/step-01-frontmatter.md
RENAMED
|
@@ -19,7 +19,7 @@ Ask what kind of spec they need:
|
|
|
19
19
|
| `adr` | Recording a decision | Context, Decision, Status, Consequences |
|
|
20
20
|
| `api-contract` | Defining an API | Endpoints, Request/Response Schemas, Auth, Error Codes |
|
|
21
21
|
|
|
22
|
-
For detailed guidance on each type, read `spec-type-reference.md` in
|
|
22
|
+
For detailed guidance on each type, read `spec-type-reference.md` in this directory.
|
|
23
23
|
|
|
24
24
|
## Check existing specs
|
|
25
25
|
|
package/dist/skills/{specdx-author-spec → core/specdx-author-spec/references}/step-02-sections.md
RENAMED
|
@@ -57,6 +57,47 @@ Do NOT skip the lint step between sections. Run `npx specdx lint --path <file>`
|
|
|
57
57
|
after every 2-3 sections. Do NOT write the entire spec and lint at the end.
|
|
58
58
|
</HARD-GATE>
|
|
59
59
|
|
|
60
|
+
## Sections `specdx check` parses
|
|
61
|
+
|
|
62
|
+
Three sections are read by `specdx check` and compared against code. Prose in
|
|
63
|
+
them is fine, but the entries themselves must take one of these shapes or the
|
|
64
|
+
section is reported as not assessed — which silently removes it from the
|
|
65
|
+
coverage score.
|
|
66
|
+
|
|
67
|
+
**`## Endpoints`** (api-contract) — a bullet per endpoint, a `###` heading per
|
|
68
|
+
endpoint, or both:
|
|
69
|
+
|
|
70
|
+
```markdown
|
|
71
|
+
- `GET /invoices` — list invoices
|
|
72
|
+
- POST /invoices — create an invoice
|
|
73
|
+
|
|
74
|
+
### DELETE /invoices/:id
|
|
75
|
+
|
|
76
|
+
Void an invoice.
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**`## Data Model`** (technical-design) — a `###` heading per type, one field per
|
|
80
|
+
line as `- name: type`. Backticks are optional. The heading must be a single
|
|
81
|
+
identifier: `### Notes on the model` is read as prose, not as a type.
|
|
82
|
+
|
|
83
|
+
```markdown
|
|
84
|
+
### Invoice
|
|
85
|
+
|
|
86
|
+
- id: string
|
|
87
|
+
- `amountCents`: number
|
|
88
|
+
- paidAt?: Date
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
**`## Test Cases`** (test-plan) — one bullet per case, optionally grouped under
|
|
92
|
+
`###` headings:
|
|
93
|
+
|
|
94
|
+
```markdown
|
|
95
|
+
### Invoices
|
|
96
|
+
|
|
97
|
+
- creates an invoice with a valid payload
|
|
98
|
+
- rejects an invoice with a negative amount
|
|
99
|
+
```
|
|
100
|
+
|
|
60
101
|
## Rationalizations to Resist
|
|
61
102
|
|
|
62
103
|
| Thought | Reality |
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: specdx-onboard
|
|
3
3
|
description: "Use when a new developer joins the project, asks 'what is this project', 'explain the specs', 'how does this codebase work', 'what specs exist', or wants an overview of the spec suite. Provides a guided tour of the project's specs."
|
|
4
|
-
allowed-tools: Bash(npx specdx
|
|
4
|
+
allowed-tools: Bash(npx specdx:*)
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Onboard — Spec Suite Overview
|
|
@@ -13,10 +13,11 @@ Walk a new developer through the project's spec suite so they understand what ex
|
|
|
13
13
|
### Step 1: Get the overview
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
|
-
npx specdx
|
|
16
|
+
npx specdx status --format json
|
|
17
|
+
npx specdx graph
|
|
17
18
|
```
|
|
18
19
|
|
|
19
|
-
|
|
20
|
+
`status` returns the project name, spec count, statuses, lint health, and stale specs. `graph` returns how the specs relate — both config `requires` edges and frontmatter `references`.
|
|
20
21
|
|
|
21
22
|
### Step 2: Load full spec content
|
|
22
23
|
|
|
@@ -47,3 +48,7 @@ Guide the developer through:
|
|
|
47
48
|
- If a spec is marked `draft`, note that it's tentative and may change
|
|
48
49
|
- If a spec is marked `superseded`, briefly mention what replaced it
|
|
49
50
|
- Use the dependency graph to explain why specs exist (e.g. "The test plan depends on the technical design because test cases reference the API endpoints defined there")
|
|
51
|
+
|
|
52
|
+
## It's working if
|
|
53
|
+
|
|
54
|
+
The reader can name what the project is for, which specs are authoritative, and where to look next — without opening a spec file. If your summary is a restatement of the spec list, it has not oriented anyone.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: specdx-plan-from-spec
|
|
3
3
|
description: "Use when the user asks to plan implementation, create a plan from specs, or says 'how should I build this', 'plan this', 'create an implementation plan', or 'what's the approach'. Generates a step-by-step plan grounded in project specs."
|
|
4
|
-
allowed-tools: Bash(npx specdx
|
|
4
|
+
allowed-tools: Bash(npx specdx:*)
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Plan From Spec
|
|
@@ -70,3 +70,7 @@ If the user doesn't have superpowers, use a simpler numbered list format.
|
|
|
70
70
|
2. **Flag gaps** — if the task needs decisions not covered by any spec, say so
|
|
71
71
|
3. **Respect non-goals** — if the PRD says "not X", don't plan for X
|
|
72
72
|
4. **Note risks** — if the technical design lists risks relevant to the task, address them in the plan
|
|
73
|
+
|
|
74
|
+
## It's working if
|
|
75
|
+
|
|
76
|
+
Every step traces to a spec section or is explicitly flagged as a gap the specs do not cover. A plan with steps that trace to neither is invention, not planning.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: specdx-pre-commit
|
|
3
3
|
description: "Use when the user is about to commit, mentions committing, or says 'let's commit', 'ready to commit', 'wrap up', or 'commit this'. Checks spec health and flags drift before committing."
|
|
4
|
-
allowed-tools: Bash(npx specdx
|
|
4
|
+
allowed-tools: Bash(npx specdx:*)
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Pre-Commit Spec Check
|
|
@@ -25,9 +25,14 @@ If lint errors are found, report them and ask the user to fix before committing.
|
|
|
25
25
|
### Step 2: Diff
|
|
26
26
|
|
|
27
27
|
```bash
|
|
28
|
-
npx specdx diff
|
|
28
|
+
npx specdx diff --working
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
+
`--working` is required at this step. You are about to commit, so the changes in
|
|
32
|
+
question are still in the working tree. Plain `npx specdx diff` compares
|
|
33
|
+
committed refs only and would report "no spec changes" for the very edits being
|
|
34
|
+
committed — a false all-clear.
|
|
35
|
+
|
|
31
36
|
If the command fails (e.g. no git history), skip this step and note it.
|
|
32
37
|
|
|
33
38
|
### Step 3: Present results
|
|
@@ -35,6 +40,10 @@ If the command fails (e.g. no git history), skip this step and note it.
|
|
|
35
40
|
**If no spec changes detected:**
|
|
36
41
|
> "No spec changes — safe to commit."
|
|
37
42
|
|
|
43
|
+
Only say this after a `--working` run. If the diff warns that spec files in the
|
|
44
|
+
working tree were not covered, the run was not `--working`. Re-run it before
|
|
45
|
+
reporting anything.
|
|
46
|
+
|
|
38
47
|
**If changes detected, present a summary:**
|
|
39
48
|
- Which specs changed and what sections were modified
|
|
40
49
|
- Downstream specs that may need updating (with staleness scores)
|
|
@@ -54,3 +63,8 @@ Respect the user's decision either way.
|
|
|
54
63
|
| "There are no spec files in the diff" | Code changes can still drift from specs. Run the check. |
|
|
55
64
|
| "I already ran lint earlier" | Specs may have changed since. Run it again. |
|
|
56
65
|
| "The diff command failed, so skip everything" | Report the lint results at minimum. |
|
|
66
|
+
| "`specdx diff` said no changes, so we're clear" | Without `--working` it never looked at the working tree. Re-run with the flag. |
|
|
67
|
+
|
|
68
|
+
## It's working if
|
|
69
|
+
|
|
70
|
+
You ran `specdx diff --working` and can state which specs changed, or that none did. If you said "safe to commit" from a run that never looked at the working tree, the check reported on the wrong thing.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: specdx-review-spec
|
|
3
3
|
description: "Use when the user asks to review a spec, says 'is this spec good enough', 'review my spec', 'check spec quality', or 'audit this spec'. Runs multi-layer spec quality review."
|
|
4
|
-
allowed-tools: Bash(npx specdx
|
|
4
|
+
allowed-tools: Bash(npx specdx:*) Read Agent
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Review Spec Quality
|
|
@@ -75,3 +75,7 @@ Do NOT skip any of the three review passes. Each catches different classes of pr
|
|
|
75
75
|
| "Three passes is overkill for a small spec" | Small specs have the most gaps. Run all three. |
|
|
76
76
|
| "The completeness pass already found issues, so skip the rest" | Consistency and adversarial reviews find different issues. |
|
|
77
77
|
| "I can combine the passes into one review" | Separate passes with different prompts catch more. |
|
|
78
|
+
|
|
79
|
+
## It's working if
|
|
80
|
+
|
|
81
|
+
Each of the three passes produced at least one finding, or you can say precisely why it found nothing. Three clean passes on a first-draft spec usually means the passes were not adversarial.
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: specdx-router
|
|
3
|
+
description: Ask which specdx workflow fits your situation. A map over the spec-driven flow — authoring, planning, implementing, verifying, shipping — and where the human decisions sit.
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
allowed-tools: Bash(npx specdx:*)
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Which specdx workflow fits?
|
|
9
|
+
|
|
10
|
+
You describe where you are. This names the workflow and the next thing to run.
|
|
11
|
+
|
|
12
|
+
It recommends and stops. It does not author a spec, build a plan, or fire the
|
|
13
|
+
skill it names — what you get back is the next thing to type.
|
|
14
|
+
|
|
15
|
+
## The main flow
|
|
16
|
+
|
|
17
|
+
Idea → spec → plan → implement → verify → commit. Most work enters at step 1
|
|
18
|
+
or step 3.
|
|
19
|
+
|
|
20
|
+
| Step | Skill | The decision it leaves you |
|
|
21
|
+
|---|---|---|
|
|
22
|
+
| 1. Capture intent | `specdx-author-spec` | Which spec type, and whether this needs a spec at all |
|
|
23
|
+
| 2. Quality-gate the spec | `specdx-review-spec` | Whether the spec is concrete enough to build from |
|
|
24
|
+
| 3. Load context | `specdx-start-task` | Nothing — run it before every coding session |
|
|
25
|
+
| 4. Plan the build | `specdx-plan-from-spec` | Slice order, and what to defer |
|
|
26
|
+
| 5. Ship it | `specdx-pre-commit` | Whether downstream specs get updated now or later |
|
|
27
|
+
|
|
28
|
+
## Route by situation
|
|
29
|
+
|
|
30
|
+
| Where you are | What to reach for |
|
|
31
|
+
|---|---|
|
|
32
|
+
| New to this repo, don't know what the specs say | `specdx-onboard` |
|
|
33
|
+
| About to write code | `specdx-start-task` — always, before the first edit |
|
|
34
|
+
| An idea that isn't written down yet | `specdx-author-spec` |
|
|
35
|
+
| A spec exists but feels vague | `specdx-review-spec` |
|
|
36
|
+
| A spec is solid, need an approach | `specdx-plan-from-spec` |
|
|
37
|
+
| About to commit | `specdx-pre-commit` |
|
|
38
|
+
| Reporting progress to other people | `specdx-sprint-review` |
|
|
39
|
+
| Wondering if the code still matches the specs | `specdx-verify` (experimental) |
|
|
40
|
+
| Wondering if the specs still match the code | `specdx-check-drift` (experimental) |
|
|
41
|
+
|
|
42
|
+
The last two are experimental: they are built on `specdx check`, whose static
|
|
43
|
+
analysis is noisy on prose-heavy specs. Treat their findings as prompts to look,
|
|
44
|
+
not as failures.
|
|
45
|
+
|
|
46
|
+
## Distinctions that are easy to get wrong
|
|
47
|
+
|
|
48
|
+
- **`specdx-start-task` vs `specdx-plan-from-spec`** — turns on whether you know
|
|
49
|
+
the approach. `start-task` loads context so you can begin. `plan-from-spec`
|
|
50
|
+
decides the order of work first. A one-file change needs the former only.
|
|
51
|
+
- **`specdx-verify` vs `specdx-check-drift`** — turns on which side you suspect.
|
|
52
|
+
`verify` asks "did I build what the spec said". `check-drift` asks "have the
|
|
53
|
+
specs fallen behind the code".
|
|
54
|
+
- **`specdx-review-spec` vs `specdx lint`** — turns on what kind of problem.
|
|
55
|
+
`lint` catches structural and mechanical faults. `review-spec` judges whether
|
|
56
|
+
the content is decision-ready.
|
|
57
|
+
|
|
58
|
+
## When you don't need any of this
|
|
59
|
+
|
|
60
|
+
A typo fix, a dependency bump, a rename with no behaviour change. Spec context
|
|
61
|
+
costs tokens and attention; spend it where intent is genuinely at stake.
|
|
62
|
+
|
|
63
|
+
## It's working if
|
|
64
|
+
|
|
65
|
+
You leave knowing the single next command to type, and why the neighbouring
|
|
66
|
+
skill was not it. If two skills still look interchangeable after reading this,
|
|
67
|
+
the router has failed — say so, because that is a bug in this file.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: specdx-sprint-review
|
|
3
3
|
description: "Use when the user asks for a summary, sprint review, spec health report, progress update, or says 'how are specs looking', 'spec health', or 'what changed'. Generates a shareable spec health report."
|
|
4
|
-
allowed-tools: Bash(npx specdx
|
|
4
|
+
allowed-tools: Bash(npx specdx:*)
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Sprint Review — Spec Health Report
|
|
@@ -67,3 +67,7 @@ The `diff --format json` output looks like:
|
|
|
67
67
|
"summary": "1 spec changed, 1 downstream affected"
|
|
68
68
|
}
|
|
69
69
|
```
|
|
70
|
+
|
|
71
|
+
## It's working if
|
|
72
|
+
|
|
73
|
+
Someone who did not attend the work can read the report and know the suite's health and what changed. If `diff` was unavailable, the report says so rather than implying nothing changed.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: specdx-start-task
|
|
3
3
|
description: Use when the user describes work they're about to do, mentions implementing a feature, asks to start a task, or says 'implement', 'build', 'add', 'fix', or 'refactor'. Loads relevant spec context before coding.
|
|
4
|
-
allowed-tools: Bash(npx specdx
|
|
4
|
+
allowed-tools: Bash(npx specdx:*)
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Load Spec Context
|
|
@@ -56,3 +56,7 @@ For the rest of the session:
|
|
|
56
56
|
2. **Flag drift** — if the code or the user's request contradicts a spec, surface it clearly. Do NOT silently ignore contradictions.
|
|
57
57
|
3. **Note gaps** — if the task needs decisions not covered by any spec, say so
|
|
58
58
|
4. **Respect status** — `approved` specs are current truth; `draft` specs are tentative; `superseded` specs show as collapsed one-liners
|
|
59
|
+
|
|
60
|
+
## It's working if
|
|
61
|
+
|
|
62
|
+
You can name the specs governing the task and any constraint they impose, before the first edit. If `pack` returned no specs, that is a signal to check the task wording — not a licence to code without context.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: specdx-check-drift
|
|
3
|
-
description: "Use when the user says 'check drift', 'did I drift from spec', 'am I still aligned', or as part of a pre-commit check. Compares recent code changes against spec definitions."
|
|
4
|
-
allowed-tools: Bash(npx specdx
|
|
3
|
+
description: "[experimental — built on specdx check, whose static analysis can be noisy] Use when the user says 'check drift', 'did I drift from spec', 'am I still aligned', or as part of a pre-commit check. Compares recent code changes against spec definitions."
|
|
4
|
+
allowed-tools: Bash(npx specdx:*) Read
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Check Spec Drift
|
|
@@ -13,10 +13,12 @@ Compare recent code changes against spec definitions to detect drift.
|
|
|
13
13
|
### Step 1: Check for spec changes
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
|
-
npx specdx diff
|
|
16
|
+
npx specdx diff --working
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
This shows which specs changed
|
|
19
|
+
This shows which specs changed, including edits still in the working tree. Note any upstream spec changes.
|
|
20
|
+
|
|
21
|
+
Use `--working` here. Plain `npx specdx diff` compares committed refs only, so it cannot see uncommitted spec edits — the ones most likely to have caused the drift you are looking for.
|
|
20
22
|
|
|
21
23
|
### Step 2: Check implementation alignment
|
|
22
24
|
|
|
@@ -69,3 +71,7 @@ For each drift:
|
|
|
69
71
|
| "No specs changed, so no drift" | Code can drift even when specs don't change. Run the check. |
|
|
70
72
|
| "The check score is high enough" | Even 95% means 5% drift. Review the findings. |
|
|
71
73
|
| "I'll check drift later" | Drift compounds. Check now. |
|
|
74
|
+
|
|
75
|
+
## It's working if
|
|
76
|
+
|
|
77
|
+
You can say, for each finding, whether the code or the spec should change. A list of findings with no direction is a report, not a drift check.
|