specdx 0.4.0-alpha.9 → 0.5.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/.claude-plugin/plugin.json +7 -2
- package/README.md +283 -0
- package/dist/{check-4FSSC6HN.js → check-RH5SCXWW.js} +68 -30
- package/dist/check-RH5SCXWW.js.map +1 -0
- package/dist/{chunk-N77RNV7J.js → chunk-3YXRWQGX.js} +217 -42
- package/dist/chunk-3YXRWQGX.js.map +1 -0
- package/dist/chunk-5WRI5ZAA.js +31 -0
- package/dist/chunk-6EQIDZ4D.js +185 -0
- package/dist/chunk-6EQIDZ4D.js.map +1 -0
- package/dist/chunk-6WFNZH7F.js +2846 -0
- package/dist/chunk-6WFNZH7F.js.map +1 -0
- package/dist/{chunk-AKNPCB37.js → chunk-BMOOLUPG.js} +32 -12
- package/dist/chunk-BMOOLUPG.js.map +1 -0
- package/dist/{chunk-IHTYAW7C.js → chunk-BP3SB35W.js} +111 -7
- package/dist/chunk-BP3SB35W.js.map +1 -0
- package/dist/chunk-CQETLJTZ.js +103 -0
- package/dist/chunk-CQETLJTZ.js.map +1 -0
- package/dist/chunk-DMGABJ6T.js +41 -0
- package/dist/chunk-DMGABJ6T.js.map +1 -0
- package/dist/chunk-NHD44ZYN.js +20 -0
- package/dist/chunk-NHD44ZYN.js.map +1 -0
- package/dist/{chunk-7JXW2GTJ.js → chunk-XRWLPU24.js} +18 -2
- package/dist/chunk-XRWLPU24.js.map +1 -0
- package/dist/chunk-ZIODMXST.js +1146 -0
- package/dist/chunk-ZIODMXST.js.map +1 -0
- package/dist/diff-QO7HMAK3.js +200 -0
- package/dist/diff-QO7HMAK3.js.map +1 -0
- package/dist/{dist-4DIRTBJH.js → dist-JPWHWMV2.js} +88 -26
- package/dist/dist-JPWHWMV2.js.map +1 -0
- package/dist/{dist-RL2DT3ZE.js → dist-ROHCFKYT.js} +3 -2
- package/dist/dist-ROHCFKYT.js.map +1 -0
- package/dist/generate-MS4BM7RU.js +21 -0
- package/dist/generate-MS4BM7RU.js.map +1 -0
- package/dist/{generate-story-EFHGINHA.js → generate-story-OMM322L7.js} +43 -19
- package/dist/generate-story-OMM322L7.js.map +1 -0
- package/dist/{generate-test-plan-BO7444RG.js → generate-test-plan-75W7SZIO.js} +61 -11
- package/dist/generate-test-plan-75W7SZIO.js.map +1 -0
- package/dist/{graph-5XINV7PT.js → graph-QOTMXENE.js} +49 -11
- package/dist/graph-QOTMXENE.js.map +1 -0
- package/dist/index.d.ts +302 -0
- package/dist/index.js +2996 -357
- package/dist/index.js.map +1 -1
- package/dist/lint-LPFLHVO4.js +184 -0
- package/dist/lint-LPFLHVO4.js.map +1 -0
- package/dist/main.js +10 -229
- package/dist/main.js.map +1 -1
- package/dist/mcp-OEC43SPF.js +35 -0
- package/dist/mcp-OEC43SPF.js.map +1 -0
- package/dist/{migrate-4KF6GHLO.js → migrate-CBP2AVLH.js} +21 -9
- package/dist/migrate-CBP2AVLH.js.map +1 -0
- package/dist/{pack-DSOODXAN.js → pack-X6FSWORJ.js} +41 -13
- package/dist/pack-X6FSWORJ.js.map +1 -0
- package/dist/{ready-6DNKIHP6.js → ready-7MJWRGLT.js} +55 -14
- package/dist/ready-7MJWRGLT.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} +6 -2
- 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} +6 -2
- package/dist/skills-36SRUEMR.js +121 -0
- package/dist/skills-36SRUEMR.js.map +1 -0
- package/dist/{status-WZK247CI.js → status-UUPZYX3J.js} +63 -32
- package/dist/status-UUPZYX3J.js.map +1 -0
- package/dist/{update-JTNSYX3B.js → update-EI7IJRHG.js} +22 -12
- package/dist/update-EI7IJRHG.js.map +1 -0
- package/dist/{validate-LBDYWUDX.js → validate-HTTZLQWI.js} +36 -17
- package/dist/validate-HTTZLQWI.js.map +1 -0
- package/hooks/hooks.json +12 -6
- package/hooks/session-start +35 -3
- package/package.json +28 -13
- package/dist/changelog-XUVHY3QK.js +0 -93
- package/dist/changelog-XUVHY3QK.js.map +0 -1
- package/dist/check-4FSSC6HN.js.map +0 -1
- package/dist/chunk-7JXW2GTJ.js.map +0 -1
- package/dist/chunk-AKNPCB37.js.map +0 -1
- package/dist/chunk-DAZCOUVK.js +0 -496
- package/dist/chunk-DAZCOUVK.js.map +0 -1
- package/dist/chunk-GAM4MXPC.js +0 -15
- package/dist/chunk-GAM4MXPC.js.map +0 -1
- package/dist/chunk-IHTYAW7C.js.map +0 -1
- package/dist/chunk-N77RNV7J.js.map +0 -1
- package/dist/chunk-SRZ33RJP.js +0 -1147
- package/dist/chunk-SRZ33RJP.js.map +0 -1
- package/dist/diff-OXZ34NU4.js +0 -107
- package/dist/diff-OXZ34NU4.js.map +0 -1
- package/dist/dist-4DIRTBJH.js.map +0 -1
- package/dist/explain-QBV3AESQ.js +0 -109
- package/dist/explain-QBV3AESQ.js.map +0 -1
- package/dist/generate-7GNPT2WJ.js +0 -13
- package/dist/generate-7GNPT2WJ.js.map +0 -1
- package/dist/generate-story-EFHGINHA.js.map +0 -1
- package/dist/generate-test-plan-BO7444RG.js.map +0 -1
- package/dist/graph-5XINV7PT.js.map +0 -1
- package/dist/lint-PTMWMLDQ.js +0 -122
- package/dist/lint-PTMWMLDQ.js.map +0 -1
- package/dist/mcp-BGFAPM6G.js +0 -17
- package/dist/mcp-BGFAPM6G.js.map +0 -1
- package/dist/migrate-4KF6GHLO.js.map +0 -1
- package/dist/pack-DSOODXAN.js.map +0 -1
- package/dist/ready-6DNKIHP6.js.map +0 -1
- package/dist/skills-3GBBWZW2.js +0 -93
- package/dist/skills-3GBBWZW2.js.map +0 -1
- package/dist/status-WZK247CI.js.map +0 -1
- package/dist/update-JTNSYX3B.js.map +0 -1
- package/dist/validate-LBDYWUDX.js.map +0 -1
- /package/dist/{dist-RL2DT3ZE.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
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
2
|
pack
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-BMOOLUPG.js";
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
quietArg,
|
|
6
|
+
verboseArg
|
|
7
|
+
} from "./chunk-DMGABJ6T.js";
|
|
7
8
|
import {
|
|
8
9
|
buildGraph,
|
|
9
10
|
createLogger,
|
|
10
11
|
loadConfig,
|
|
11
12
|
parseSpec,
|
|
12
13
|
resolveGlob
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import "./chunk-
|
|
14
|
+
} from "./chunk-BP3SB35W.js";
|
|
15
|
+
import "./chunk-XRWLPU24.js";
|
|
16
|
+
import "./chunk-5WRI5ZAA.js";
|
|
15
17
|
|
|
16
|
-
// src/commands/pack.ts
|
|
18
|
+
// src/commands/core/pack.ts
|
|
17
19
|
import { defineCommand } from "citty";
|
|
18
20
|
import { writeFile } from "fs/promises";
|
|
19
21
|
import { execSync } from "child_process";
|
|
@@ -31,7 +33,20 @@ function copyToClipboard(text) {
|
|
|
31
33
|
}
|
|
32
34
|
execSync(cmd, { input: text, stdio: ["pipe", "ignore", "ignore"] });
|
|
33
35
|
}
|
|
36
|
+
function emptyPackReason(stats, specsResolved) {
|
|
37
|
+
if (stats.specsIncluded > 0) return void 0;
|
|
38
|
+
if (specsResolved === 0) {
|
|
39
|
+
return "no specs resolved from spec.config.yaml \u2014 check the paths in your config";
|
|
40
|
+
}
|
|
41
|
+
if (stats.specsExcluded === 0) {
|
|
42
|
+
return `none of the ${specsResolved} resolved spec(s) scored above the relevance threshold for this task \u2014 try different --task wording, name specs with --specs, or use --full`;
|
|
43
|
+
}
|
|
44
|
+
return `all ${stats.specsExcluded} candidate spec(s) were excluded \u2014 widen --specs or raise --budget`;
|
|
45
|
+
}
|
|
34
46
|
async function runPack(options) {
|
|
47
|
+
if (!options.configDir) {
|
|
48
|
+
throw new TypeError("runPack requires `configDir` \u2014 the directory holding spec.config.yaml.");
|
|
49
|
+
}
|
|
35
50
|
const config = await loadConfig(void 0, options.configDir);
|
|
36
51
|
const allSpecs = [];
|
|
37
52
|
for (const [, entry] of Object.entries(config.specs)) {
|
|
@@ -58,13 +73,13 @@ async function runPack(options) {
|
|
|
58
73
|
config.pack,
|
|
59
74
|
graph
|
|
60
75
|
);
|
|
61
|
-
return result;
|
|
76
|
+
return { ...result, specsResolved: allSpecs.length };
|
|
62
77
|
}
|
|
63
78
|
var pack_default = defineCommand({
|
|
64
79
|
meta: { name: "pack", description: "Pack specs into AI-ready context" },
|
|
65
80
|
args: {
|
|
66
|
-
quiet:
|
|
67
|
-
verbose:
|
|
81
|
+
quiet: quietArg,
|
|
82
|
+
verbose: verboseArg,
|
|
68
83
|
task: { type: "string", description: "Task or context to optimise relevance for" },
|
|
69
84
|
specs: { type: "string", description: "Comma-separated spec IDs or glob patterns to include" },
|
|
70
85
|
budget: { type: "string", description: "Maximum token budget for the output" },
|
|
@@ -129,12 +144,16 @@ var pack_default = defineCommand({
|
|
|
129
144
|
}
|
|
130
145
|
console.log(`
|
|
131
146
|
Budget: ${stats.used} / ${stats.budget} tokens`);
|
|
132
|
-
console.log(
|
|
133
|
-
` Included: ${stats.specsIncluded} / ${stats.specsIncluded + stats.specsExcluded} specs`
|
|
134
|
-
);
|
|
147
|
+
console.log(` Included: ${stats.specsIncluded} / ${result.specsResolved} specs`);
|
|
135
148
|
console.log(` Sections compressed: ${stats.sectionsCompressed}`);
|
|
136
149
|
console.log(` Sections omitted: ${stats.sectionsOmitted}
|
|
137
150
|
`);
|
|
151
|
+
const dryReason = emptyPackReason(stats, result.specsResolved);
|
|
152
|
+
if (dryReason) {
|
|
153
|
+
console.log(` \u26A0 Nothing would be packed: ${dryReason}
|
|
154
|
+
`);
|
|
155
|
+
process.exit(3);
|
|
156
|
+
}
|
|
138
157
|
return;
|
|
139
158
|
}
|
|
140
159
|
if (args.out) {
|
|
@@ -153,6 +172,14 @@ var pack_default = defineCommand({
|
|
|
153
172
|
`Packed ${stats.specsIncluded}/${total} specs \u2022 ${stats.used} / ${stats.budget} tokens \u2022 ${stats.sectionsCompressed} sections compressed \u2022 ${stats.sectionsOmitted} sections omitted
|
|
154
173
|
`
|
|
155
174
|
);
|
|
175
|
+
const emptyReason = emptyPackReason(stats, result.specsResolved);
|
|
176
|
+
if (emptyReason) {
|
|
177
|
+
process.stderr.write(`
|
|
178
|
+
\u26A0 No context packed: ${emptyReason}
|
|
179
|
+
|
|
180
|
+
`);
|
|
181
|
+
process.exit(3);
|
|
182
|
+
}
|
|
156
183
|
} catch (err) {
|
|
157
184
|
console.error(`
|
|
158
185
|
\u2717 ${err.message}
|
|
@@ -163,6 +190,7 @@ var pack_default = defineCommand({
|
|
|
163
190
|
});
|
|
164
191
|
export {
|
|
165
192
|
pack_default as default,
|
|
193
|
+
emptyPackReason,
|
|
166
194
|
runPack
|
|
167
195
|
};
|
|
168
|
-
//# sourceMappingURL=pack-
|
|
196
|
+
//# sourceMappingURL=pack-X6FSWORJ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/core/pack.ts"],"sourcesContent":["import { defineCommand } from \"citty\";\nimport { loadConfig, parseSpec, resolveGlob, buildGraph, createLogger } from \"@specdx/core\";\nimport { pack, type PackResult } from \"@specdx/pack\";\nimport type { ParsedSpec } from \"@specdx/core\";\nimport { quietArg, verboseArg } from \"../../shared-args.js\";\nimport { writeFile } from \"node:fs/promises\";\nimport { execSync } from \"node:child_process\";\n\nfunction copyToClipboard(text: string): void {\n const platform = process.platform;\n let cmd: string;\n if (platform === \"darwin\") {\n cmd = \"pbcopy\";\n } else if (platform === \"linux\") {\n cmd = \"xclip -selection clipboard\";\n } else if (platform === \"win32\") {\n cmd = \"clip\";\n } else {\n throw new Error(`Clipboard not supported on platform: ${platform}`);\n }\n execSync(cmd, { input: text, stdio: [\"pipe\", \"ignore\", \"ignore\"] });\n}\n\n/**\n * Why a pack produced no context, if it produced none.\n *\n * An empty `<context>` on stdout with exit 0 reads as \"here is your context\"\n * to whatever consumes it. `lint` and `check` already use exit 3 for\n * \"nothing was assessed\"; packing nothing is the same claim.\n */\nexport function emptyPackReason(\n stats: { specsIncluded: number; specsExcluded: number },\n specsResolved: number,\n): string | undefined {\n if (stats.specsIncluded > 0) return undefined;\n if (specsResolved === 0) {\n return \"no specs resolved from spec.config.yaml — check the paths in your config\";\n }\n // The relevance resolver drops sub-threshold specs before allocation, so\n // stats.specsExcluded counts only allocator-level exclusions. Reporting the\n // resolved total instead keeps the message from blaming the config.\n if (stats.specsExcluded === 0) {\n return `none of the ${specsResolved} resolved spec(s) scored above the relevance threshold for this task — try different --task wording, name specs with --specs, or use --full`;\n }\n return `all ${stats.specsExcluded} candidate spec(s) were excluded — widen --specs or raise --budget`;\n}\n\nexport interface RunPackOptions {\n configDir: string;\n task?: string;\n specs?: string[];\n budget?: number;\n format?: \"xml\" | \"markdown\" | \"json\";\n full?: boolean;\n dryRun?: boolean;\n}\n\nexport async function runPack(\n options: RunPackOptions,\n): Promise<PackResult & { specsResolved: number }> {\n if (!options.configDir) {\n throw new TypeError(\"runPack requires `configDir` — the directory holding spec.config.yaml.\");\n }\n const config = await loadConfig(undefined, options.configDir);\n\n const allSpecs: ParsedSpec[] = [];\n for (const [, entry] of Object.entries(config.specs)) {\n const files = await resolveGlob(entry.path, options.configDir);\n for (const file of files) {\n allSpecs.push(await parseSpec(file));\n }\n }\n\n let graph;\n try {\n graph = buildGraph(config);\n } catch {\n // non-fatal: proceed without graph\n }\n\n const result = pack(\n allSpecs,\n {\n task: options.task,\n specs: options.specs,\n budget: options.budget,\n format: options.format,\n full: options.full,\n dryRun: options.dryRun,\n },\n config.pack,\n graph,\n );\n\n return { ...result, specsResolved: allSpecs.length };\n}\n\nexport default defineCommand({\n meta: { name: \"pack\", description: \"Pack specs into AI-ready context\" },\n args: {\n quiet: quietArg,\n verbose: verboseArg,\n task: { type: \"string\", description: \"Task or context to optimise relevance for\" },\n specs: { type: \"string\", description: \"Comma-separated spec IDs or glob patterns to include\" },\n budget: { type: \"string\", description: \"Maximum token budget for the output\" },\n format: {\n type: \"string\",\n description: \"Output format (xml, markdown, json)\",\n default: \"xml\",\n },\n out: { type: \"string\", description: \"Write output to file instead of stdout\" },\n copy: { type: \"boolean\", description: \"Copy output to system clipboard\" },\n full: { type: \"boolean\", description: \"Include all specs without budget trimming\" },\n \"dry-run\": {\n type: \"boolean\",\n description: \"Preview what would be packed without writing output\",\n },\n },\n async run({ args }) {\n const logger = createLogger({ quiet: args.quiet, verbose: args.verbose });\n\n // Validate: --task and --specs are mutually exclusive\n if (args.task && args.specs) {\n console.error(\"\\n \\u2717 --task and --specs are mutually exclusive\\n\");\n process.exit(1);\n }\n\n // Validate: --copy and --dry-run are mutually exclusive\n if (args.copy && args[\"dry-run\"]) {\n console.error(\"\\n \\u2717 --copy and --dry-run are mutually exclusive\\n\");\n process.exit(1);\n }\n\n // Validate: --budget is a valid number\n let budget: number | undefined;\n if (args.budget) {\n budget = Number(args.budget);\n if (Number.isNaN(budget)) {\n console.error(\"\\n \\u2717 --budget must be a valid number\\n\");\n process.exit(1);\n }\n }\n\n // Validate: --format is valid\n const format = args.format as string;\n if (format && ![\"xml\", \"markdown\", \"json\"].includes(format)) {\n console.error(`\\n \\u2717 --format must be one of: xml, markdown, json\\n`);\n process.exit(1);\n }\n\n try {\n const specsList = args.specs ? args.specs.split(\",\").map((s: string) => s.trim()) : undefined;\n\n const result = await runPack({\n configDir: process.cwd(),\n task: args.task,\n specs: specsList,\n budget,\n format: format as \"xml\" | \"markdown\" | \"json\" | undefined,\n full: args.full,\n dryRun: args[\"dry-run\"],\n });\n\n const { stats } = result;\n\n // Dry-run: print plan to stdout\n if (args[\"dry-run\"]) {\n console.log(\"\\n Dry Run Summary:\\n\");\n for (const alloc of stats.allocations) {\n const status = alloc.included ? \"\\u2713\" : \"\\u2717\";\n const compressed = alloc.compressed ? \" (compressed)\" : \"\";\n console.log(\n ` ${status} ${alloc.specId} relevance=${alloc.relevance.toFixed(2)} tokens=${alloc.tokens}${compressed}`,\n );\n }\n console.log(`\\n Budget: ${stats.used} / ${stats.budget} tokens`);\n console.log(` Included: ${stats.specsIncluded} / ${result.specsResolved} specs`);\n console.log(` Sections compressed: ${stats.sectionsCompressed}`);\n console.log(` Sections omitted: ${stats.sectionsOmitted}\\n`);\n // A dry run that plans nothing is as misleading as an empty payload.\n const dryReason = emptyPackReason(stats, result.specsResolved);\n if (dryReason) {\n console.log(` ⚠ Nothing would be packed: ${dryReason}\\n`);\n process.exit(3);\n }\n return;\n }\n\n // Write output\n if (args.out) {\n await writeFile(args.out, result.output, \"utf-8\");\n logger.info(`Output written to ${args.out}`);\n }\n if (args.copy) {\n copyToClipboard(result.output);\n logger.info(\"Output copied to clipboard\");\n }\n if (!args.out && !args.copy) {\n process.stdout.write(result.output);\n }\n\n // Token report to stderr\n const total = stats.specsIncluded + stats.specsExcluded;\n process.stderr.write(\n `Packed ${stats.specsIncluded}/${total} specs \\u2022 ${stats.used} / ${stats.budget} tokens \\u2022 ${stats.sectionsCompressed} sections compressed \\u2022 ${stats.sectionsOmitted} sections omitted\\n`,\n );\n\n // Never let an empty payload leave looking like a successful pack.\n const emptyReason = emptyPackReason(stats, result.specsResolved);\n if (emptyReason) {\n process.stderr.write(`\\n \\u26a0 No context packed: ${emptyReason}\\n\\n`);\n process.exit(3);\n }\n } catch (err) {\n console.error(`\\n \\u2717 ${(err as Error).message}\\n`);\n process.exit(1);\n }\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,SAAS,qBAAqB;AAK9B,SAAS,iBAAiB;AAC1B,SAAS,gBAAgB;AAEzB,SAAS,gBAAgB,MAAoB;AAC3C,QAAM,WAAW,QAAQ;AACzB,MAAI;AACJ,MAAI,aAAa,UAAU;AACzB,UAAM;AAAA,EACR,WAAW,aAAa,SAAS;AAC/B,UAAM;AAAA,EACR,WAAW,aAAa,SAAS;AAC/B,UAAM;AAAA,EACR,OAAO;AACL,UAAM,IAAI,MAAM,wCAAwC,QAAQ,EAAE;AAAA,EACpE;AACA,WAAS,KAAK,EAAE,OAAO,MAAM,OAAO,CAAC,QAAQ,UAAU,QAAQ,EAAE,CAAC;AACpE;AASO,SAAS,gBACd,OACA,eACoB;AACpB,MAAI,MAAM,gBAAgB,EAAG,QAAO;AACpC,MAAI,kBAAkB,GAAG;AACvB,WAAO;AAAA,EACT;AAIA,MAAI,MAAM,kBAAkB,GAAG;AAC7B,WAAO,eAAe,aAAa;AAAA,EACrC;AACA,SAAO,OAAO,MAAM,aAAa;AACnC;AAYA,eAAsB,QACpB,SACiD;AACjD,MAAI,CAAC,QAAQ,WAAW;AACtB,UAAM,IAAI,UAAU,6EAAwE;AAAA,EAC9F;AACA,QAAM,SAAS,MAAM,WAAW,QAAW,QAAQ,SAAS;AAE5D,QAAM,WAAyB,CAAC;AAChC,aAAW,CAAC,EAAE,KAAK,KAAK,OAAO,QAAQ,O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":[]}
|
|
@@ -1,24 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
sharedArgs
|
|
3
|
-
} from "./chunk-GAM4MXPC.js";
|
|
4
1
|
import {
|
|
5
2
|
createLintEngine,
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
parseFeatures,
|
|
4
|
+
resolveLintConfig
|
|
5
|
+
} from "./chunk-ZIODMXST.js";
|
|
8
6
|
import {
|
|
9
7
|
DEFAULT_DIFF_CONFIG
|
|
10
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-6WFNZH7F.js";
|
|
9
|
+
import {
|
|
10
|
+
resolveFormat,
|
|
11
|
+
sharedArgs
|
|
12
|
+
} from "./chunk-DMGABJ6T.js";
|
|
11
13
|
import {
|
|
12
14
|
buildGraph,
|
|
13
15
|
createLogger,
|
|
14
16
|
loadConfig,
|
|
15
17
|
parseSpec,
|
|
16
18
|
resolveGlob
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
import "./chunk-
|
|
19
|
+
} from "./chunk-BP3SB35W.js";
|
|
20
|
+
import "./chunk-XRWLPU24.js";
|
|
21
|
+
import "./chunk-5WRI5ZAA.js";
|
|
19
22
|
|
|
20
|
-
// src/commands/ready.ts
|
|
23
|
+
// src/commands/core/ready.ts
|
|
21
24
|
import { defineCommand } from "citty";
|
|
25
|
+
var FORMATS = ["pretty", "json"];
|
|
22
26
|
async function runReady() {
|
|
23
27
|
const configDir = process.cwd();
|
|
24
28
|
const config = await loadConfig(void 0, configDir);
|
|
@@ -65,7 +69,11 @@ async function runReady() {
|
|
|
65
69
|
});
|
|
66
70
|
}
|
|
67
71
|
const presetName = config.lint?.extends ?? "recommended";
|
|
68
|
-
const rules =
|
|
72
|
+
const { rules, ignore } = await resolveLintConfig({
|
|
73
|
+
config,
|
|
74
|
+
preset: presetName,
|
|
75
|
+
configDir
|
|
76
|
+
});
|
|
69
77
|
let graph;
|
|
70
78
|
let graphError;
|
|
71
79
|
try {
|
|
@@ -73,7 +81,7 @@ async function runReady() {
|
|
|
73
81
|
} catch (err) {
|
|
74
82
|
graphError = err.message;
|
|
75
83
|
}
|
|
76
|
-
const engine = createLintEngine({ rules, config, graph });
|
|
84
|
+
const engine = createLintEngine({ rules, config, graph, ignore });
|
|
77
85
|
const lintResults = engine.lint(specs.map((s) => s.spec));
|
|
78
86
|
if (graphError) {
|
|
79
87
|
lintResults.diagnostics.push({
|
|
@@ -100,6 +108,24 @@ async function runReady() {
|
|
|
100
108
|
details: `${errors} errors, ${warnings} warnings`
|
|
101
109
|
});
|
|
102
110
|
}
|
|
111
|
+
const placeholderDiagnostics = lintResults.diagnostics.filter(
|
|
112
|
+
(d) => d.ruleId === "completeness/no-placeholder-sections"
|
|
113
|
+
);
|
|
114
|
+
const placeholderFiles = new Set(placeholderDiagnostics.map((d) => d.filePath));
|
|
115
|
+
if (specs.length === 0) {
|
|
116
|
+
checks.push({
|
|
117
|
+
name: "Specs have content",
|
|
118
|
+
passed: true,
|
|
119
|
+
skipped: true,
|
|
120
|
+
details: "skipped (no specs to assess)"
|
|
121
|
+
});
|
|
122
|
+
} else {
|
|
123
|
+
checks.push({
|
|
124
|
+
name: "Specs have content",
|
|
125
|
+
passed: placeholderFiles.size === 0,
|
|
126
|
+
details: placeholderFiles.size === 0 ? "No placeholder sections" : `${placeholderDiagnostics.length} placeholder section(s) across ${placeholderFiles.size} spec(s)`
|
|
127
|
+
});
|
|
128
|
+
}
|
|
103
129
|
const integrityIssues = [];
|
|
104
130
|
if (graphError) {
|
|
105
131
|
integrityIssues.push(graphError);
|
|
@@ -160,6 +186,7 @@ async function runReady() {
|
|
|
160
186
|
const storyCoverageErrors = lintResults.diagnostics.filter(
|
|
161
187
|
(d) => d.ruleId === "completeness/story-coverage"
|
|
162
188
|
);
|
|
189
|
+
const featureCount = specs.filter((s) => s.spec.frontmatter.type === "prd").reduce((sum, s) => sum + parseFeatures(s.spec.content).length, 0);
|
|
163
190
|
if (!hasPrd) {
|
|
164
191
|
checks.push({
|
|
165
192
|
name: "Story coverage",
|
|
@@ -167,6 +194,13 @@ async function runReady() {
|
|
|
167
194
|
skipped: true,
|
|
168
195
|
details: "skipped (no PRD in suite)"
|
|
169
196
|
});
|
|
197
|
+
} else if (featureCount === 0) {
|
|
198
|
+
checks.push({
|
|
199
|
+
name: "Story coverage",
|
|
200
|
+
passed: true,
|
|
201
|
+
skipped: true,
|
|
202
|
+
details: "skipped (no features declared in the PRD)"
|
|
203
|
+
});
|
|
170
204
|
} else {
|
|
171
205
|
checks.push({
|
|
172
206
|
name: "Story coverage",
|
|
@@ -180,14 +214,21 @@ async function runReady() {
|
|
|
180
214
|
var ready_default = defineCommand({
|
|
181
215
|
meta: { name: "ready", description: "Check if spec suite is ready for implementation" },
|
|
182
216
|
args: {
|
|
183
|
-
...sharedArgs
|
|
217
|
+
...sharedArgs(FORMATS)
|
|
184
218
|
},
|
|
185
219
|
async run({ args }) {
|
|
220
|
+
const format = resolveFormat(args.format, FORMATS);
|
|
221
|
+
if (!format.ok) {
|
|
222
|
+
console.error(`
|
|
223
|
+
\u2717 ${format.message}
|
|
224
|
+
`);
|
|
225
|
+
process.exit(1);
|
|
226
|
+
}
|
|
186
227
|
try {
|
|
187
228
|
const logger = createLogger({ quiet: args.quiet, verbose: args.verbose });
|
|
188
229
|
logger.debug("Running readiness checks...");
|
|
189
230
|
const result = await runReady();
|
|
190
|
-
if (
|
|
231
|
+
if (format.format === "json") {
|
|
191
232
|
console.log(JSON.stringify(result, null, 2));
|
|
192
233
|
if (!result.ready) process.exit(1);
|
|
193
234
|
return;
|
|
@@ -226,4 +267,4 @@ export {
|
|
|
226
267
|
ready_default as default,
|
|
227
268
|
runReady
|
|
228
269
|
};
|
|
229
|
-
//# sourceMappingURL=ready-
|
|
270
|
+
//# sourceMappingURL=ready-7MJWRGLT.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, resolveLintConfig, parseFeatures } from \"@specdx/lint\";\nimport type { ParsedSpec } from \"@specdx/core\";\nimport { DEFAULT_DIFF_CONFIG } from \"@specdx/diff\";\nimport { sharedArgs, resolveFormat } from \"../../shared-args.js\";\n\nconst FORMATS = [\"pretty\", \"json\"] as const;\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, ignore } = await resolveLintConfig({\n config,\n preset: presetName,\n configDir,\n });\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, ignore });\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(FORMATS),\n },\n async run({ args }) {\n const format = resolveFormat(args.format, FORMATS);\n if (!format.ok) {\n console.error(`\\n ✗ ${format.message}\\n`);\n process.exit(1);\n }\n\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 (format.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}\\n`);\n process.exit(1);\n }\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,qBAAqB;AAO9B,IAAM,UAAU,CAAC,UAAU,MAAM;AAgBjC,eAAsB,WAAiC;AACrD,QAAM,YAAY,QAAQ,IAAI;AAC9B,QAAM,SAAS,MAAM,WAAW,QAAW,SAAS;AAEpD,QAAM,SAAuB,CAAC;AAG9B,QAAM,QAIA,CAAC;AACP,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,OAAO,KAAK,GAAG;AACvD,UAAM,QAAQ,MAAM,YAAY,MAAM,MAAM,SAAS;AACrD,eAAW,KAAK,OAAO;AACrB,YAAM,OAAO,MAAM,UAAU,CAAC;AAC9B,YAAM,KAAK;AAAA,QACT;AAAA,QACA;AAAA,QACA;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AAIA,SAAO,KAAK;AAAA,IACV,MAAM;AAAA,IACN,QAAQ,MAAM,SAAS;AAAA,IACvB,SACE,MAAM,SAAS,IACX,GAAG,MAAM,MAAM,oBACf;AAAA,EACR,CAAC;AAGD,QAAM,kBAAkB,OAAO,QAAQ,OAAO,KAAK,EAAE;AAAA,IACnD,CAAC,CAAC,EAAE,KAAK,MAAO,MAAiC;AAAA,EACnD;AACA,QAAM,kBAA4B,CAAC;AACnC,aAAW,CAAC,KAAK,KAAK,KAAK,iBAAiB;AAC1C,UAAM,QAAQ,MAAM,YAAY,MAAM,MAAM,SAAS;AACrD,QAAI,MAAM,WAAW,GAAG;AACtB,sBAAgB,KAAK,GAAG;AAAA,IAC1B;AAAA,EACF;AACA,MAAI,gBAAgB,WAAW,GAAG;AAChC,WAAO,KAAK;AAAA,MACV,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,SAAS;AAAA,MACT,SAAS;AAAA,IACX,CAAC;AAAA,EACH,OAAO;AACL,WAA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IAAO,IAAI,IAAI,OAAO,OAAO,WAAM,KAAK;AAAA,CAAI;AAExD,iBAAW,SAAS,OAAO,QAAQ;AACjC,cAAM,YAAY,MAAM,UAAU,WAAM,MAAM,SAAS,WAAM;AAC7D,gBAAQ,IAAI,OAAO,SAAS,IAAI,MAAM,IAAI,KAAK,MAAM,OAAO,EAAE;AAAA,MAChE;AAEA,YAAM,YAAY,OAAO,OAAO,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE;AACzD,UAAI,YAAY,GAAG;AACjB,gBAAQ;AAAA,UACN;AAAA,8BAA4B,SAAS,SAAS,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
|
|
@@ -49,7 +49,7 @@ The `status --format json` output looks like:
|
|
|
49
49
|
```json
|
|
50
50
|
{
|
|
51
51
|
"project": "my-project",
|
|
52
|
-
"
|
|
52
|
+
"specFiles": 3,
|
|
53
53
|
"byStatus": {"approved": 2, "draft": 1},
|
|
54
54
|
"lintHealth": {"errors": 0, "warnings": 2, "passing": 3},
|
|
55
55
|
"staleSpecs": [{"specId": "tech", "daysSinceUpdate": 15}],
|
|
@@ -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.
|