specdx 0.4.0-alpha.15 → 0.4.0-alpha.17
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 +2 -2
- package/dist/{check-6ULNLONS.js → check-Q3QKTN2D.js} +4 -4
- package/dist/check-Q3QKTN2D.js.map +1 -0
- package/dist/{chunk-SDDTD4R3.js → chunk-TF7WSPFV.js} +31 -11
- package/dist/chunk-TF7WSPFV.js.map +1 -0
- package/dist/chunk-TJPPBM24.js +179 -0
- package/dist/chunk-TJPPBM24.js.map +1 -0
- package/dist/{diff-AWFDXYX4.js → diff-IEN6W4OG.js} +3 -3
- package/dist/diff-IEN6W4OG.js.map +1 -0
- package/dist/{dist-2YMKBA6A.js → dist-DVROIZAO.js} +2 -2
- package/dist/generate-GQPOLFP7.js +21 -0
- package/dist/generate-GQPOLFP7.js.map +1 -0
- package/dist/{generate-story-OV3PFJN6.js → generate-story-UJS37FHA.js} +2 -2
- package/dist/generate-story-UJS37FHA.js.map +1 -0
- package/dist/{generate-test-plan-OGWEIXR2.js → generate-test-plan-RQTSGQLR.js} +3 -3
- package/dist/generate-test-plan-RQTSGQLR.js.map +1 -0
- package/dist/{graph-KZDCVMLT.js → graph-OKUMHR3Q.js} +2 -2
- package/dist/graph-OKUMHR3Q.js.map +1 -0
- package/dist/index.js +39 -120
- package/dist/index.js.map +1 -1
- package/dist/{lint-A5AXYDSO.js → lint-VB5PV32N.js} +3 -3
- package/dist/lint-VB5PV32N.js.map +1 -0
- package/dist/main.js +7 -143
- package/dist/main.js.map +1 -1
- package/dist/{mcp-CWJKX27S.js → mcp-DADOVCEV.js} +3 -3
- package/dist/mcp-DADOVCEV.js.map +1 -0
- package/dist/{migrate-76BXVREF.js → migrate-LAMRDT3V.js} +3 -3
- package/dist/migrate-LAMRDT3V.js.map +1 -0
- package/dist/{pack-I5WFM6B6.js → pack-B3KYRKUR.js} +3 -3
- package/dist/pack-B3KYRKUR.js.map +1 -0
- package/dist/{ready-2M5HXTRZ.js → ready-C6YXJ47W.js} +2 -2
- package/dist/ready-C6YXJ47W.js.map +1 -0
- package/dist/skills/{specdx-author-spec → core/specdx-author-spec}/SKILL.md +4 -0
- package/dist/skills/{specdx-onboard → core/specdx-onboard}/SKILL.md +7 -2
- package/dist/skills/{specdx-plan-from-spec → core/specdx-plan-from-spec}/SKILL.md +4 -0
- package/dist/skills/{specdx-pre-commit → core/specdx-pre-commit}/SKILL.md +4 -0
- package/dist/skills/{specdx-review-spec → core/specdx-review-spec}/SKILL.md +4 -0
- package/dist/skills/core/specdx-router/SKILL.md +67 -0
- package/dist/skills/{specdx-sprint-review → core/specdx-sprint-review}/SKILL.md +4 -0
- package/dist/skills/{specdx-start-task → core/specdx-start-task}/SKILL.md +4 -0
- package/dist/skills/{specdx-check-drift → experimental/specdx-check-drift}/SKILL.md +4 -0
- package/dist/skills/{specdx-verify → experimental/specdx-verify}/SKILL.md +4 -0
- package/dist/{skills-N7ZDWOJM.js → skills-LHFTTEJ7.js} +21 -11
- package/dist/skills-LHFTTEJ7.js.map +1 -0
- package/dist/{status-QLG3ZKS7.js → status-BRLCD7NY.js} +2 -2
- package/dist/status-BRLCD7NY.js.map +1 -0
- package/dist/{update-HGZVLKSL.js → update-P6TQUI6H.js} +3 -3
- package/dist/update-P6TQUI6H.js.map +1 -0
- package/dist/{validate-HMOCZJ2M.js → validate-WIB246IE.js} +2 -2
- package/dist/validate-WIB246IE.js.map +1 -0
- package/package.json +5 -5
- package/dist/check-6ULNLONS.js.map +0 -1
- package/dist/chunk-SDDTD4R3.js.map +0 -1
- package/dist/diff-AWFDXYX4.js.map +0 -1
- package/dist/explain-M2VXXXGP.js +0 -113
- package/dist/explain-M2VXXXGP.js.map +0 -1
- package/dist/generate-XG52JCWH.js +0 -15
- package/dist/generate-XG52JCWH.js.map +0 -1
- package/dist/generate-story-OV3PFJN6.js.map +0 -1
- package/dist/generate-test-plan-OGWEIXR2.js.map +0 -1
- package/dist/graph-KZDCVMLT.js.map +0 -1
- package/dist/lint-A5AXYDSO.js.map +0 -1
- package/dist/mcp-CWJKX27S.js.map +0 -1
- package/dist/migrate-76BXVREF.js.map +0 -1
- package/dist/pack-I5WFM6B6.js.map +0 -1
- package/dist/ready-2M5HXTRZ.js.map +0 -1
- package/dist/skills-N7ZDWOJM.js.map +0 -1
- package/dist/status-QLG3ZKS7.js.map +0 -1
- package/dist/update-HGZVLKSL.js.map +0 -1
- package/dist/validate-HMOCZJ2M.js.map +0 -1
- /package/dist/{dist-2YMKBA6A.js.map → dist-DVROIZAO.js.map} +0 -0
- /package/dist/skills/{specdx-author-spec → core/specdx-author-spec}/references/spec-type-reference.md +0 -0
- /package/dist/skills/{specdx-author-spec → core/specdx-author-spec}/references/step-01-frontmatter.md +0 -0
- /package/dist/skills/{specdx-author-spec → core/specdx-author-spec}/references/step-02-sections.md +0 -0
- /package/dist/skills/{specdx-author-spec → core/specdx-author-spec}/references/step-03-finalize.md +0 -0
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
import "./chunk-SJCIM4TC.js";
|
|
16
16
|
import "./chunk-5WRI5ZAA.js";
|
|
17
17
|
|
|
18
|
-
// src/commands/lint.ts
|
|
18
|
+
// src/commands/core/lint.ts
|
|
19
19
|
import { defineCommand } from "citty";
|
|
20
20
|
|
|
21
21
|
// src/formatters/pretty.ts
|
|
@@ -42,7 +42,7 @@ function formatGithub(diagnostics) {
|
|
|
42
42
|
}).join("\n");
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
// src/commands/lint.ts
|
|
45
|
+
// src/commands/core/lint.ts
|
|
46
46
|
async function runLint(options) {
|
|
47
47
|
const config = await loadConfig(void 0, options.configDir);
|
|
48
48
|
const preset = options.preset ?? config.lint?.extends ?? "recommended";
|
|
@@ -120,4 +120,4 @@ export {
|
|
|
120
120
|
lint_default as default,
|
|
121
121
|
runLint
|
|
122
122
|
};
|
|
123
|
-
//# sourceMappingURL=lint-
|
|
123
|
+
//# sourceMappingURL=lint-VB5PV32N.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/core/lint.ts","../src/formatters/pretty.ts","../src/formatters/json.ts","../src/formatters/github.ts"],"sourcesContent":["import { defineCommand } from \"citty\";\nimport { loadConfig, parseSpec, resolveGlob, buildGraph, createLogger } from \"@specdx/core\";\nimport { createLintEngine, getPreset, type LintResults } from \"@specdx/lint\";\nimport type { ParsedSpec } from \"@specdx/core\";\nimport { sharedArgs } from \"../../shared-args.js\";\nimport { formatPretty } from \"../../formatters/pretty.js\";\nimport { formatJson } from \"../../formatters/json.js\";\nimport { formatGithub } from \"../../formatters/github.js\";\n\nexport interface RunLintOptions {\n configDir: string;\n specPath?: string;\n preset?: \"minimal\" | \"recommended\" | \"strict\";\n}\n\n/** Lint results plus whether anything was actually linted (vacuous-pass audit). */\nexport interface RunLintResults extends LintResults {\n /** Number of specs linted. */\n specCount: number;\n /** False when no specs resolved — \"no diagnostics\" is then not a pass. */\n assessed: boolean;\n}\n\nexport async function runLint(options: RunLintOptions): Promise<RunLintResults> {\n const config = await loadConfig(undefined, options.configDir);\n const preset = options.preset ?? config.lint?.extends ?? \"recommended\";\n const rules = getPreset(preset);\n\n // Always parse the full suite so cross-reference rules have complete\n // context; a single-file lint filters the *diagnostics*, not the suite.\n const specs: 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 specs.push(await parseSpec(file));\n }\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 });\n const results = engine.lint(specs);\n\n if (options.specPath) {\n const specPath = options.specPath;\n results.diagnostics = results.diagnostics.filter((d) => d.filePath.includes(specPath));\n results.hasErrors = results.diagnostics.some((d) => d.severity === \"error\");\n results.hasWarnings = results.diagnostics.some((d) => d.severity === \"warn\");\n }\n\n if (graphError) {\n results.diagnostics.push({\n ruleId: \"structure/no-circular-deps\",\n severity: \"error\",\n message: graphError,\n filePath: \"spec.config.yaml\",\n });\n results.hasErrors = true;\n }\n\n return { ...results, specCount: specs.length, assessed: specs.length > 0 };\n}\n\nexport default defineCommand({\n meta: { name: \"lint\", description: \"Lint all specs in the suite\" },\n args: {\n ...sharedArgs,\n fix: { type: \"boolean\", description: \"Auto-fix issues where possible\" },\n path: { type: \"positional\", description: \"Lint a specific spec file\", required: false },\n preset: { type: \"string\", description: \"Lint preset (minimal, recommended, strict)\" },\n },\n async run({ args }) {\n const logger = createLogger({ quiet: args.quiet, verbose: args.verbose });\n\n if (args.fix) {\n logger.info(\"No auto-fixable issues supported yet.\");\n }\n\n try {\n const results = await runLint({\n configDir: process.cwd(),\n specPath: args.path,\n preset: args.preset as \"minimal\" | \"recommended\" | \"strict\" | undefined,\n });\n\n const formatter =\n args.format === \"json\"\n ? formatJson\n : args.format === \"github\"\n ? formatGithub\n : formatPretty;\n // \"No diagnostics\" over an empty suite is not a pass (vacuous-pass audit)\n if (!results.assessed) {\n console.error(\n \"\\n ⚠ No specs found — nothing was linted. Check the spec paths in spec.config.yaml.\\n\",\n );\n process.exit(3);\n }\n\n console.log(formatter(results.diagnostics));\n\n if (results.hasErrors) process.exit(1);\n } catch (err) {\n console.error(`\\n ✗ ${(err as Error).message}\\n`);\n process.exit(1);\n }\n },\n});\n","import type { Diagnostic } from \"@specdx/lint\";\n\nexport function formatPretty(diagnostics: Diagnostic[]): string {\n if (diagnostics.length === 0) return \" ✓ All specs pass lint checks.\\n\";\n return diagnostics\n .map((d) => {\n const icon = d.severity === \"error\" ? \"✗\" : d.severity === \"warn\" ? \"⚠\" : \"ℹ\";\n return ` ${icon} ${d.severity} ${d.message} (${d.ruleId})\\n ${d.filePath}${d.line ? `:${d.line}` : \"\"}`;\n })\n .join(\"\\n\");\n}\n","import type { Diagnostic } from \"@specdx/lint\";\nexport function formatJson(diagnostics: Diagnostic[]): string {\n return JSON.stringify(diagnostics, null, 2);\n}\n","import type { Diagnostic } from \"@specdx/lint\";\nexport function formatGithub(diagnostics: Diagnostic[]): string {\n return diagnostics\n .map((d) => {\n const level = d.severity === \"error\" ? \"error\" : \"warning\";\n const line = d.line ? `,line=${d.line}` : \"\";\n return `::${level} file=${d.filePath}${line}::${d.message} (${d.ruleId})`;\n })\n .join(\"\\n\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,SAAS,qBAAqB;;;ACEvB,SAAS,aAAa,aAAmC;AAC9D,MAAI,YAAY,WAAW,EAAG,QAAO;AACrC,SAAO,YACJ,IAAI,CAAC,MAAM;AACV,UAAM,OAAO,EAAE,aAAa,UAAU,WAAM,EAAE,aAAa,SAAS,WAAM;AAC1E,WAAO,KAAK,IAAI,IAAI,EAAE,QAAQ,KAAK,EAAE,OAAO,MAAM,EAAE,MAAM;AAAA,MAAU,EAAE,QAAQ,GAAG,EAAE,OAAO,IAAI,EAAE,IAAI,KAAK,EAAE;AAAA,EAC7G,CAAC,EACA,KAAK,IAAI;AACd;;;ACTO,SAAS,WAAW,aAAmC;AAC5D,SAAO,KAAK,UAAU,aAAa,MAAM,CAAC;AAC5C;;;ACFO,SAAS,aAAa,aAAmC;AAC9D,SAAO,YACJ,IAAI,CAAC,MAAM;AACV,UAAM,QAAQ,EAAE,aAAa,UAAU,UAAU;AACjD,UAAM,OAAO,EAAE,OAAO,SAAS,EAAE,IAAI,KAAK;AAC1C,WAAO,KAAK,KAAK,SAAS,EAAE,QAAQ,GAAG,IAAI,KAAK,EAAE,OAAO,KAAK,EAAE,MAAM;AAAA,EACxE,CAAC,EACA,KAAK,IAAI;AACd;;;AHcA,eAAsB,QAAQ,SAAkD;AAC9E,QAAM,SAAS,MAAM,WAAW,QAAW,QAAQ,SAAS;AAC5D,QAAM,SAAS,QAAQ,UAAU,OAAO,MAAM,WAAW;AACzD,QAAM,QAAQ,UAAU,MAAM;AAI9B,QAAM,QAAsB,CAAC;AAC7B,aAAW,CAAC,E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A,MAAM,IAAI,EAAE,KAAK,GAAG;AAClB,UAAM,SAAS,aAAa,EAAE,OAAO,KAAK,OAAO,SAAS,KAAK,QAAQ,CAAC;AAExE,QAAI,KAAK,KAAK;AACZ,aAAO,KAAK,uCAAuC;AAAA,IACrD;AAEA,QAAI;AACF,YAAM,UAAU,MAAM,QAAQ;AAAA,QAC5B,WAAW,QAAQ,IAAI;AAAA,QACvB,UAAU,KAAK;AAAA,QACf,QAAQ,KAAK;AAAA,MACf,CAAC;AAED,YAAM,YACJ,KAAK,WAAW,SACZ,aACA,KAAK,WAAW,WACd,eACA;AAER,UAAI,CAAC,QAAQ,UAAU;AACrB,gBAAQ;AAAA,UACN;AAAA,QACF;AACA,gBAAQ,KAAK,CAAC;AAAA,MAChB;AAEA,cAAQ,IAAI,UAAU,QAAQ,WAAW,CAAC;AAE1C,UAAI,QAAQ,UAAW,SAAQ,KAAK,CAAC;AAAA,IACvC,SAAS,KAAK;AACZ,cAAQ,MAAM;AAAA,WAAU,IAAc,OAAO;AAAA,CAAI;AACjD,cAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF;AACF,CAAC;","names":[]}
|
package/dist/main.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
} from "./chunk-
|
|
3
|
+
subCommands
|
|
4
|
+
} from "./chunk-TJPPBM24.js";
|
|
5
|
+
import "./chunk-SJCIM4TC.js";
|
|
5
6
|
import "./chunk-5WRI5ZAA.js";
|
|
6
7
|
|
|
7
8
|
// src/main.ts
|
|
8
|
-
import { defineCommand
|
|
9
|
+
import { defineCommand, runMain } from "citty";
|
|
9
10
|
|
|
10
11
|
// package.json
|
|
11
12
|
var package_default = {
|
|
12
13
|
name: "specdx",
|
|
13
|
-
version: "0.4.0-alpha.
|
|
14
|
+
version: "0.4.0-alpha.17",
|
|
14
15
|
description: "Spec-driven development toolchain. Validate, lint, pack, and ship specs for LLM-assisted workflows.",
|
|
15
16
|
type: "module",
|
|
16
17
|
license: "MIT",
|
|
@@ -93,147 +94,10 @@ var package_default = {
|
|
|
93
94
|
}
|
|
94
95
|
};
|
|
95
96
|
|
|
96
|
-
// src/commands/init.ts
|
|
97
|
-
import { defineCommand } from "citty";
|
|
98
|
-
import { mkdir, writeFile } from "fs/promises";
|
|
99
|
-
import { join } from "path";
|
|
100
|
-
var TEMPLATE_SPECS = {
|
|
101
|
-
lightweight: [
|
|
102
|
-
{ filename: "prd.md", type: "prd" },
|
|
103
|
-
{ filename: "technical-design.md", type: "technical-design" }
|
|
104
|
-
],
|
|
105
|
-
bmad: [
|
|
106
|
-
{ filename: "prd.md", type: "prd" },
|
|
107
|
-
{ filename: "technical-design.md", type: "technical-design" },
|
|
108
|
-
{ filename: "test-plan.md", type: "test-plan" }
|
|
109
|
-
],
|
|
110
|
-
"api-first": [
|
|
111
|
-
{ filename: "technical-design.md", type: "technical-design" },
|
|
112
|
-
{ filename: "api-contract.md", type: "api-contract" },
|
|
113
|
-
{ filename: "test-plan.md", type: "test-plan" }
|
|
114
|
-
],
|
|
115
|
-
quick: [{ filename: "quick-spec.md", type: "quick-spec" }],
|
|
116
|
-
context: [{ filename: "project-context.md", type: "project-context" }]
|
|
117
|
-
};
|
|
118
|
-
var TEMPLATE_EXTRA_DIRS = {
|
|
119
|
-
lightweight: [],
|
|
120
|
-
bmad: ["specs/stories", "specs/adr"],
|
|
121
|
-
"api-first": [],
|
|
122
|
-
quick: [],
|
|
123
|
-
context: []
|
|
124
|
-
};
|
|
125
|
-
function specIdFromFilename(filename) {
|
|
126
|
-
return filename.replace(/\.md$/, "");
|
|
127
|
-
}
|
|
128
|
-
function specTitleFromType(type) {
|
|
129
|
-
return type.split("-").map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" ");
|
|
130
|
-
}
|
|
131
|
-
function buildSpecFile(filename, type, projectName, today) {
|
|
132
|
-
const id = specIdFromFilename(filename);
|
|
133
|
-
const title = `${specTitleFromType(type)} \u2014 ${projectName}`;
|
|
134
|
-
const sections = REQUIRED_SECTIONS[type];
|
|
135
|
-
const frontmatter = [
|
|
136
|
-
"---",
|
|
137
|
-
`id: ${id}`,
|
|
138
|
-
`type: ${type}`,
|
|
139
|
-
`title: "${title}"`,
|
|
140
|
-
`status: draft`,
|
|
141
|
-
`version: "0.1"`,
|
|
142
|
-
`created: "${today}"`,
|
|
143
|
-
`authors: ["author"]`,
|
|
144
|
-
"---"
|
|
145
|
-
].join("\n");
|
|
146
|
-
const body = sections.map((section) => `
|
|
147
|
-
## ${section}
|
|
148
|
-
|
|
149
|
-
<!-- placeholder -->`).join("\n");
|
|
150
|
-
return `${frontmatter}
|
|
151
|
-
${body}
|
|
152
|
-
`;
|
|
153
|
-
}
|
|
154
|
-
function buildConfigYaml(projectName, specs) {
|
|
155
|
-
const specEntries = specs.map(({ filename, type }) => {
|
|
156
|
-
const key = specIdFromFilename(filename);
|
|
157
|
-
return ` ${key}:
|
|
158
|
-
path: specs/${filename}
|
|
159
|
-
type: ${type}`;
|
|
160
|
-
}).join("\n");
|
|
161
|
-
return [`version: "1.0"`, `project:`, ` name: "${projectName}"`, `specs:`, specEntries].join("\n") + "\n";
|
|
162
|
-
}
|
|
163
|
-
async function scaffoldProject({
|
|
164
|
-
projectName,
|
|
165
|
-
template,
|
|
166
|
-
targetDir
|
|
167
|
-
}) {
|
|
168
|
-
const today = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
169
|
-
const specsDir = join(targetDir, "specs");
|
|
170
|
-
await mkdir(specsDir, { recursive: true });
|
|
171
|
-
for (const extraDir of TEMPLATE_EXTRA_DIRS[template]) {
|
|
172
|
-
await mkdir(join(targetDir, extraDir), { recursive: true });
|
|
173
|
-
}
|
|
174
|
-
const specs = TEMPLATE_SPECS[template];
|
|
175
|
-
for (const { filename, type } of specs) {
|
|
176
|
-
const content = buildSpecFile(filename, type, projectName, today);
|
|
177
|
-
await writeFile(join(specsDir, filename), content, "utf-8");
|
|
178
|
-
}
|
|
179
|
-
const configContent = buildConfigYaml(projectName, specs);
|
|
180
|
-
await writeFile(join(targetDir, "spec.config.yaml"), configContent, "utf-8");
|
|
181
|
-
}
|
|
182
|
-
var init_default = defineCommand({
|
|
183
|
-
meta: {
|
|
184
|
-
name: "init",
|
|
185
|
-
description: "Initialize a new specdx project with spec scaffolding"
|
|
186
|
-
},
|
|
187
|
-
args: {
|
|
188
|
-
name: {
|
|
189
|
-
type: "string",
|
|
190
|
-
description: "Project name",
|
|
191
|
-
required: true
|
|
192
|
-
},
|
|
193
|
-
template: {
|
|
194
|
-
type: "string",
|
|
195
|
-
description: "Template to use (lightweight, bmad, api-first)",
|
|
196
|
-
default: "lightweight"
|
|
197
|
-
},
|
|
198
|
-
dir: {
|
|
199
|
-
type: "string",
|
|
200
|
-
description: "Target directory",
|
|
201
|
-
default: "."
|
|
202
|
-
}
|
|
203
|
-
},
|
|
204
|
-
async run({ args }) {
|
|
205
|
-
const { name, template, dir } = args;
|
|
206
|
-
const validTemplates = ["lightweight", "bmad", "api-first", "quick", "context"];
|
|
207
|
-
if (!validTemplates.includes(template)) {
|
|
208
|
-
console.error(`Unknown template: ${template}. Choose from: ${validTemplates.join(", ")}`);
|
|
209
|
-
process.exit(1);
|
|
210
|
-
}
|
|
211
|
-
console.log(`Scaffolding "${name}" with template "${template}" in ${dir}...`);
|
|
212
|
-
await scaffoldProject({ projectName: name, template, targetDir: dir });
|
|
213
|
-
console.log(`Done! Project "${name}" scaffolded successfully.`);
|
|
214
|
-
}
|
|
215
|
-
});
|
|
216
|
-
|
|
217
97
|
// src/main.ts
|
|
218
|
-
var main =
|
|
98
|
+
var main = defineCommand({
|
|
219
99
|
meta: { name: "specdx", version: package_default.version, description: "specdx \u2014 Spec Developer Experience" },
|
|
220
|
-
subCommands
|
|
221
|
-
init: init_default,
|
|
222
|
-
lint: () => import("./lint-A5AXYDSO.js").then((m) => m.default),
|
|
223
|
-
validate: () => import("./validate-HMOCZJ2M.js").then((m) => m.default),
|
|
224
|
-
graph: () => import("./graph-KZDCVMLT.js").then((m) => m.default),
|
|
225
|
-
skills: () => import("./skills-N7ZDWOJM.js").then((m) => m.default),
|
|
226
|
-
pack: () => import("./pack-I5WFM6B6.js").then((m) => m.default),
|
|
227
|
-
diff: () => import("./diff-AWFDXYX4.js").then((m) => m.default),
|
|
228
|
-
status: () => import("./status-QLG3ZKS7.js").then((m) => m.default),
|
|
229
|
-
explain: () => import("./explain-M2VXXXGP.js").then((m) => m.default),
|
|
230
|
-
check: () => import("./check-6ULNLONS.js").then((m) => m.default),
|
|
231
|
-
ready: () => import("./ready-2M5HXTRZ.js").then((m) => m.default),
|
|
232
|
-
update: () => import("./update-HGZVLKSL.js").then((m) => m.default),
|
|
233
|
-
generate: () => import("./generate-XG52JCWH.js").then((m) => m.default),
|
|
234
|
-
migrate: () => import("./migrate-76BXVREF.js").then((m) => m.default),
|
|
235
|
-
mcp: () => import("./mcp-CWJKX27S.js").then((m) => m.default)
|
|
236
|
-
}
|
|
100
|
+
subCommands
|
|
237
101
|
});
|
|
238
102
|
runMain(main).catch((err) => {
|
|
239
103
|
console.error(`
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/main.ts","../package.json","../src/commands/init.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { defineCommand, runMain } from \"citty\";\nimport pkg from \"../package.json\" with { type: \"json\" };\nimport initCommand from \"./commands/init.js\";\n\nconst main = defineCommand({\n meta: { name: \"specdx\", version: pkg.version, description: \"specdx — Spec Developer Experience\" },\n subCommands: {\n init: initCommand,\n lint: () => import(\"./commands/lint.js\").then((m) => m.default),\n validate: () => import(\"./commands/validate.js\").then((m) => m.default),\n graph: () => import(\"./commands/graph.js\").then((m) => m.default),\n skills: () => import(\"./commands/skills.js\").then((m) => m.default),\n pack: () => import(\"./commands/pack.js\").then((m) => m.default),\n diff: () => import(\"./commands/diff.js\").then((m) => m.default),\n status: () => import(\"./commands/status.js\").then((m) => m.default),\n explain: () => import(\"./commands/explain.js\").then((m) => m.default),\n check: () => import(\"./commands/check.js\").then((m) => m.default),\n ready: () => import(\"./commands/ready.js\").then((m) => m.default),\n update: () => import(\"./commands/update.js\").then((m) => m.default),\n generate: () => import(\"./commands/generate.js\").then((m) => m.default),\n migrate: () => import(\"./commands/migrate.js\").then((m) => m.default),\n mcp: () => import(\"./commands/mcp.js\").then((m) => m.default),\n },\n});\n\nrunMain(main).catch((err: Error) => {\n console.error(`\\n ✗ ${err.message}\\n`);\n process.exit(1);\n});\n","{\n \"name\": \"specdx\",\n \"version\": \"0.4.0-alpha.15\",\n \"description\": \"Spec-driven development toolchain. Validate, lint, pack, and ship specs for LLM-assisted workflows.\",\n \"type\": \"module\",\n \"license\": \"MIT\",\n \"author\": \"Umar Gora (https://github.com/umxr)\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/umxr/specdx.git\",\n \"directory\": \"packages/cli\"\n },\n \"homepage\": \"https://github.com/umxr/specdx#readme\",\n \"bugs\": {\n \"url\": \"https://github.com/umxr/specdx/issues\"\n },\n \"keywords\": [\n \"spec\",\n \"specification\",\n \"prd\",\n \"technical-design\",\n \"api-contract\",\n \"lint\",\n \"validation\",\n \"llm\",\n \"ai\",\n \"context-packing\",\n \"spec-driven-development\",\n \"claude-code\"\n ],\n \"engines\": {\n \"node\": \">=18.0.0\"\n },\n \"bin\": {\n \"specdx\": \"./dist/main.js\"\n },\n \"exports\": {\n \".\": {\n \"import\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\"\n }\n },\n \"files\": [\n \"dist\",\n \".claude-plugin\",\n \"hooks\"\n ],\n \"scripts\": {\n \"build\": \"tsup\",\n \"typecheck\": \"tsc --noEmit\",\n \"test\": \"vitest run\",\n \"clean\": \"rm -rf dist *.tsbuildinfo\"\n },\n \"dependencies\": {\n \"@modelcontextprotocol/sdk\": \"^1.27.0\",\n \"ajv\": \"^8.18.0\",\n \"ajv-formats\": \"^3.0.1\",\n \"citty\": \"^0.2.1\",\n \"consola\": \"^3.4.0\",\n \"gray-matter\": \"^4.0.3\",\n \"js-tiktoken\": \"^1.0.18\",\n \"remark-parse\": \"^11.0.0\",\n \"tinyglobby\": \"^0.2.12\",\n \"unified\": \"^11.0.0\",\n \"unist-util-visit\": \"^5.0.0\",\n \"yaml\": \"^2.7.0\",\n \"zod\": \"^3.23.0\"\n },\n \"devDependencies\": {\n \"@specdx/check\": \"workspace:*\",\n \"@specdx/core\": \"workspace:*\",\n \"@specdx/diff\": \"workspace:*\",\n \"@specdx/lint\": \"workspace:*\",\n \"@specdx/mcp\": \"workspace:*\",\n \"@specdx/pack\": \"workspace:*\",\n \"@specdx/schema\": \"workspace:*\",\n \"@specdx/skills\": \"workspace:*\",\n \"tsup\": \"^8.5.1\",\n \"typescript\": \"^5.7.0\"\n },\n \"publishConfig\": {\n \"access\": \"public\"\n }\n}\n","import { defineCommand } from \"citty\";\nimport { mkdir, writeFile } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport { REQUIRED_SECTIONS } from \"@specdx/schema\";\n\nexport type Template = \"lightweight\" | \"bmad\" | \"api-first\" | \"quick\" | \"context\";\n\ninterface ScaffoldOptions {\n projectName: string;\n template: Template;\n targetDir: string;\n}\n\nconst TEMPLATE_SPECS: Record<\n Template,\n Array<{ filename: string; type: keyof typeof REQUIRED_SECTIONS }>\n> = {\n lightweight: [\n { filename: \"prd.md\", type: \"prd\" },\n { filename: \"technical-design.md\", type: \"technical-design\" },\n ],\n bmad: [\n { filename: \"prd.md\", type: \"prd\" },\n { filename: \"technical-design.md\", type: \"technical-design\" },\n { filename: \"test-plan.md\", type: \"test-plan\" },\n ],\n \"api-first\": [\n { filename: \"technical-design.md\", type: \"technical-design\" },\n { filename: \"api-contract.md\", type: \"api-contract\" },\n { filename: \"test-plan.md\", type: \"test-plan\" },\n ],\n quick: [{ filename: \"quick-spec.md\", type: \"quick-spec\" }],\n context: [{ filename: \"project-context.md\", type: \"project-context\" }],\n};\n\nconst TEMPLATE_EXTRA_DIRS: Record<Template, string[]> = {\n lightweight: [],\n bmad: [\"specs/stories\", \"specs/adr\"],\n \"api-first\": [],\n quick: [],\n context: [],\n};\n\nfunction specIdFromFilename(filename: string): string {\n return filename.replace(/\\.md$/, \"\");\n}\n\nfunction specTitleFromType(type: string): string {\n return type\n .split(\"-\")\n .map((w) => w.charAt(0).toUpperCase() + w.slice(1))\n .join(\" \");\n}\n\nfunction buildSpecFile(\n filename: string,\n type: keyof typeof REQUIRED_SECTIONS,\n projectName: string,\n today: string,\n): string {\n const id = specIdFromFilename(filename);\n const title = `${specTitleFromType(type)} — ${projectName}`;\n const sections = REQUIRED_SECTIONS[type];\n\n const frontmatter = [\n \"---\",\n `id: ${id}`,\n `type: ${type}`,\n `title: \"${title}\"`,\n `status: draft`,\n `version: \"0.1\"`,\n `created: \"${today}\"`,\n `authors: [\"author\"]`,\n \"---\",\n ].join(\"\\n\");\n\n const body = sections.map((section) => `\\n## ${section}\\n\\n<!-- placeholder -->`).join(\"\\n\");\n\n return `${frontmatter}\\n${body}\\n`;\n}\n\nfunction buildConfigYaml(\n projectName: string,\n specs: Array<{ filename: string; type: string }>,\n): string {\n const specEntries = specs\n .map(({ filename, type }) => {\n const key = specIdFromFilename(filename);\n return ` ${key}:\\n path: specs/${filename}\\n type: ${type}`;\n })\n .join(\"\\n\");\n\n return (\n [`version: \"1.0\"`, `project:`, ` name: \"${projectName}\"`, `specs:`, specEntries].join(\"\\n\") +\n \"\\n\"\n );\n}\n\nexport async function scaffoldProject({\n projectName,\n template,\n targetDir,\n}: ScaffoldOptions): Promise<void> {\n const today = new Date().toISOString().slice(0, 10);\n const specsDir = join(targetDir, \"specs\");\n\n // Create specs/ directory\n await mkdir(specsDir, { recursive: true });\n\n // Create extra template dirs (e.g., bmad needs stories/ and adr/)\n for (const extraDir of TEMPLATE_EXTRA_DIRS[template]) {\n await mkdir(join(targetDir, extraDir), { recursive: true });\n }\n\n const specs = TEMPLATE_SPECS[template];\n\n // Write spec files\n for (const { filename, type } of specs) {\n const content = buildSpecFile(filename, type, projectName, today);\n await writeFile(join(specsDir, filename), content, \"utf-8\");\n }\n\n // Write spec.config.yaml\n const configContent = buildConfigYaml(projectName, specs);\n await writeFile(join(targetDir, \"spec.config.yaml\"), configContent, \"utf-8\");\n}\n\nexport default defineCommand({\n meta: {\n name: \"init\",\n description: \"Initialize a new specdx project with spec scaffolding\",\n },\n args: {\n name: {\n type: \"string\",\n description: \"Project name\",\n required: true,\n },\n template: {\n type: \"string\",\n description: \"Template to use (lightweight, bmad, api-first)\",\n default: \"lightweight\",\n },\n dir: {\n type: \"string\",\n description: \"Target directory\",\n default: \".\",\n },\n },\n async run({ args }) {\n const { name, template, dir } = args;\n const validTemplates: Template[] = [\"lightweight\", \"bmad\", \"api-first\", \"quick\", \"context\"];\n if (!validTemplates.includes(template as Template)) {\n console.error(`Unknown template: ${template}. Choose from: ${validTemplates.join(\", \")}`);\n process.exit(1);\n }\n console.log(`Scaffolding \"${name}\" with template \"${template}\" in ${dir}...`);\n await scaffoldProject({ projectName: name, template: template as Template, targetDir: dir });\n console.log(`Done! Project \"${name}\" scaffolded successfully.`);\n },\n});\n"],"mappings":";;;;;;;AACA,SAAS,iBAAAA,gBAAe,eAAe;;;ACDvC;AAAA,EACE,MAAQ;AAAA,EACR,SAAW;AAAA,EACX,aAAe;AAAA,EACf,MAAQ;AAAA,EACR,SAAW;AAAA,EACX,QAAU;AAAA,EACV,YAAc;AAAA,IACZ,MAAQ;AAAA,IACR,KAAO;AAAA,IACP,WAAa;AAAA,EACf;AAAA,EACA,UAAY;AAAA,EACZ,MAAQ;AAAA,IACN,KAAO;AAAA,EACT;AAAA,EACA,UAAY;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA,SAAW;AAAA,IACT,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B,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO;AAAA,IACpE,OAAO,MAAM,OAAO,qBAAqB,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO;AAAA,IAChE,OAAO,MAAM,OAAO,qBAAqB,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO;AAAA,IAChE,QAAQ,MAAM,OAAO,sBAAsB,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO;AAAA,IAClE,UAAU,MAAM,OAAO,wBAAwB,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO;AAAA,IACtE,SAAS,MAAM,OAAO,uBAAuB,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO;AAAA,IACpE,KAAK,MAAM,OAAO,mBAAmB,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO;AAAA,EAC9D;AACF,CAAC;AAED,QAAQ,IAAI,EAAE,MAAM,CAAC,QAAe;AAClC,UAAQ,MAAM;AAAA,WAAS,IAAI,OAAO;AAAA,CAAI;AACtC,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":["defineCommand","defineCommand"]}
|
|
1
|
+
{"version":3,"sources":["../src/main.ts","../package.json"],"sourcesContent":["#!/usr/bin/env node\nimport { defineCommand, runMain } from \"citty\";\nimport pkg from \"../package.json\" with { type: \"json\" };\nimport { subCommands } from \"./commands/registry.js\";\n\nconst main = defineCommand({\n meta: { name: \"specdx\", version: pkg.version, description: \"specdx — Spec Developer Experience\" },\n subCommands,\n});\n\nrunMain(main).catch((err: Error) => {\n console.error(`\\n ✗ ${err.message}\\n`);\n process.exit(1);\n});\n","{\n \"name\": \"specdx\",\n \"version\": \"0.4.0-alpha.17\",\n \"description\": \"Spec-driven development toolchain. Validate, lint, pack, and ship specs for LLM-assisted workflows.\",\n \"type\": \"module\",\n \"license\": \"MIT\",\n \"author\": \"Umar Gora (https://github.com/umxr)\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/umxr/specdx.git\",\n \"directory\": \"packages/cli\"\n },\n \"homepage\": \"https://github.com/umxr/specdx#readme\",\n \"bugs\": {\n \"url\": \"https://github.com/umxr/specdx/issues\"\n },\n \"keywords\": [\n \"spec\",\n \"specification\",\n \"prd\",\n \"technical-design\",\n \"api-contract\",\n \"lint\",\n \"validation\",\n \"llm\",\n \"ai\",\n \"context-packing\",\n \"spec-driven-development\",\n \"claude-code\"\n ],\n \"engines\": {\n \"node\": \">=18.0.0\"\n },\n \"bin\": {\n \"specdx\": \"./dist/main.js\"\n },\n \"exports\": {\n \".\": {\n \"import\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\"\n }\n },\n \"files\": [\n \"dist\",\n \".claude-plugin\",\n \"hooks\"\n ],\n \"scripts\": {\n \"build\": \"tsup\",\n \"typecheck\": \"tsc --noEmit\",\n \"test\": \"vitest run\",\n \"clean\": \"rm -rf dist *.tsbuildinfo\"\n },\n \"dependencies\": {\n \"@modelcontextprotocol/sdk\": \"^1.27.0\",\n \"ajv\": \"^8.18.0\",\n \"ajv-formats\": \"^3.0.1\",\n \"citty\": \"^0.2.1\",\n \"consola\": \"^3.4.0\",\n \"gray-matter\": \"^4.0.3\",\n \"js-tiktoken\": \"^1.0.18\",\n \"remark-parse\": \"^11.0.0\",\n \"tinyglobby\": \"^0.2.12\",\n \"unified\": \"^11.0.0\",\n \"unist-util-visit\": \"^5.0.0\",\n \"yaml\": \"^2.7.0\",\n \"zod\": \"^3.23.0\"\n },\n \"devDependencies\": {\n \"@specdx/check\": \"workspace:*\",\n \"@specdx/core\": \"workspace:*\",\n \"@specdx/diff\": \"workspace:*\",\n \"@specdx/lint\": \"workspace:*\",\n \"@specdx/mcp\": \"workspace:*\",\n \"@specdx/pack\": \"workspace:*\",\n \"@specdx/schema\": \"workspace:*\",\n \"@specdx/skills\": \"workspace:*\",\n \"tsup\": \"^8.5.1\",\n \"typescript\": \"^5.7.0\"\n },\n \"publishConfig\": {\n \"access\": \"public\"\n }\n}\n"],"mappings":";;;;;;;;AACA,SAAS,eAAe,eAAe;;;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EAChB;AAAA,EACA,eAAiB;AAAA,IACf,QAAU;AAAA,EACZ;AACF;;;AD9EA,IAAM,OAAO,cAAc;AAAA,EACzB,MAAM,EAAE,MAAM,UAAU,SAAS,gBAAI,SAAS,aAAa,0CAAqC;AAAA,EAChG;AACF,CAAC;AAED,QAAQ,IAAI,EAAE,MAAM,CAAC,QAAe;AAClC,UAAQ,MAAM;AAAA,WAAS,IAAI,OAAO;AAAA,CAAI;AACtC,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./chunk-5WRI5ZAA.js";
|
|
2
2
|
|
|
3
|
-
// src/commands/mcp.ts
|
|
3
|
+
// src/commands/core/mcp.ts
|
|
4
4
|
import { defineCommand } from "citty";
|
|
5
5
|
var mcp_default = defineCommand({
|
|
6
6
|
meta: { name: "mcp", description: "Start the specdx MCP server (stdio transport)" },
|
|
@@ -9,7 +9,7 @@ var mcp_default = defineCommand({
|
|
|
9
9
|
let mcp;
|
|
10
10
|
let stdio;
|
|
11
11
|
try {
|
|
12
|
-
mcp = await import("./dist-
|
|
12
|
+
mcp = await import("./dist-DVROIZAO.js");
|
|
13
13
|
stdio = await import("@modelcontextprotocol/sdk/server/stdio.js");
|
|
14
14
|
} catch (err) {
|
|
15
15
|
const missing = err.message.includes("zod") ? "zod" : "@modelcontextprotocol/sdk";
|
|
@@ -29,4 +29,4 @@ var mcp_default = defineCommand({
|
|
|
29
29
|
export {
|
|
30
30
|
mcp_default as default
|
|
31
31
|
};
|
|
32
|
-
//# sourceMappingURL=mcp-
|
|
32
|
+
//# sourceMappingURL=mcp-DADOVCEV.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/core/mcp.ts"],"sourcesContent":["import { defineCommand } from \"citty\";\n\nexport default defineCommand({\n meta: { name: \"mcp\", description: \"Start the specdx MCP server (stdio transport)\" },\n args: {},\n async run() {\n // The MCP SDK and zod are dependencies of specdx, not bundled into it. A\n // broken or partial install should say so rather than surface a raw\n // ERR_MODULE_NOT_FOUND stack trace on stdout, which is also the transport.\n let mcp: typeof import(\"@specdx/mcp\");\n let stdio: typeof import(\"@modelcontextprotocol/sdk/server/stdio.js\");\n try {\n mcp = await import(\"@specdx/mcp\");\n stdio = await import(\"@modelcontextprotocol/sdk/server/stdio.js\");\n } catch (err) {\n const missing = (err as Error).message.includes(\"zod\") ? \"zod\" : \"@modelcontextprotocol/sdk\";\n console.error(\n `\\n ✗ Cannot start the MCP server: ${missing} is not installed.\\n` +\n ` It ships as a dependency of specdx, so this usually means a partial install.\\n` +\n ` Try reinstalling specdx, or add it directly: npm install ${missing}\\n`,\n );\n process.exit(1);\n }\n\n const server = mcp.createMcpServer();\n await server.connect(new stdio.StdioServerTransport());\n },\n});\n"],"mappings":";;;AAAA,SAAS,qBAAqB;AAE9B,IAAO,cAAQ,cAAc;AAAA,EAC3B,MAAM,EAAE,MAAM,OAAO,aAAa,gDAAgD;AAAA,EAClF,MAAM,CAAC;AAAA,EACP,MAAM,MAAM;AAIV,QAAI;AACJ,QAAI;AACJ,QAAI;AACF,YAAM,MAAM,OAAO,oBAAa;AAChC,cAAQ,MAAM,OAAO,2CAA2C;AAAA,IAClE,SAAS,KAAK;AACZ,YAAM,UAAW,IAAc,QAAQ,SAAS,KAAK,IAAI,QAAQ;AACjE,cAAQ;AAAA,QACN;AAAA,wCAAsC,OAAO;AAAA;AAAA,+DAEqB,OAAO;AAAA;AAAA,MAC3E;AACA,cAAQ,KAAK,CAAC;AAAA,IAChB;AAEA,UAAM,SAAS,IAAI,gBAAgB;AACnC,UAAM,OAAO,QAAQ,IAAI,MAAM,qBAAqB,CAAC;AAAA,EACvD;AACF,CAAC;","names":[]}
|
|
@@ -7,10 +7,10 @@ import {
|
|
|
7
7
|
} from "./chunk-SJCIM4TC.js";
|
|
8
8
|
import "./chunk-5WRI5ZAA.js";
|
|
9
9
|
|
|
10
|
-
// src/commands/migrate.ts
|
|
10
|
+
// src/commands/experimental/migrate.ts
|
|
11
11
|
import { defineCommand } from "citty";
|
|
12
12
|
var migrate_default = defineCommand({
|
|
13
|
-
meta: { name: "migrate", description: "
|
|
13
|
+
meta: { name: "migrate", description: "Check and migrate spec suite schema" },
|
|
14
14
|
args: {
|
|
15
15
|
quiet: { type: "boolean", description: "Suppress output" }
|
|
16
16
|
},
|
|
@@ -54,4 +54,4 @@ var migrate_default = defineCommand({
|
|
|
54
54
|
export {
|
|
55
55
|
migrate_default as default
|
|
56
56
|
};
|
|
57
|
-
//# sourceMappingURL=migrate-
|
|
57
|
+
//# sourceMappingURL=migrate-LAMRDT3V.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/experimental/migrate.ts"],"sourcesContent":["import { defineCommand } from \"citty\";\nimport { loadConfig, createLogger } from \"@specdx/core\";\nimport { SPEC_TYPES } from \"@specdx/schema\";\n\nexport default defineCommand({\n meta: { name: \"migrate\", description: \"Check and migrate spec suite schema\" },\n args: {\n quiet: { type: \"boolean\", description: \"Suppress output\" },\n },\n async run({ args }) {\n const logger = createLogger({ quiet: args.quiet });\n const configDir = process.cwd();\n\n try {\n const config = await loadConfig(undefined, configDir);\n logger.info(`\\n Config version: ${config.version}`);\n logger.info(` Supported spec types: ${SPEC_TYPES.join(\", \")}`);\n\n const unknownTypes: string[] = [];\n for (const [key, entry] of Object.entries(config.specs)) {\n if (!SPEC_TYPES.includes(entry.type as (typeof SPEC_TYPES)[number])) {\n unknownTypes.push(`${key}: ${entry.type}`);\n }\n }\n\n if (unknownTypes.length > 0) {\n logger.info(`\\n Unknown spec types found:`);\n for (const ut of unknownTypes) {\n logger.info(` - ${ut}`);\n }\n logger.info(`\\n Update specdx to resolve.\\n`);\n process.exit(1);\n } else {\n logger.info(`\\n ✓ All spec types are recognized. No migration needed.\\n`);\n }\n } catch (err) {\n console.error(`\\n ✗ ${(err as Error).message}\\n`);\n process.exit(1);\n }\n },\n});\n"],"mappings":";;;;;;;;;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
|
4
4
|
import {
|
|
5
5
|
sharedArgs
|
|
6
6
|
} from "./chunk-GAM4MXPC.js";
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
import "./chunk-SJCIM4TC.js";
|
|
15
15
|
import "./chunk-5WRI5ZAA.js";
|
|
16
16
|
|
|
17
|
-
// src/commands/pack.ts
|
|
17
|
+
// src/commands/core/pack.ts
|
|
18
18
|
import { defineCommand } from "citty";
|
|
19
19
|
import { writeFile } from "fs/promises";
|
|
20
20
|
import { execSync } from "child_process";
|
|
@@ -189,4 +189,4 @@ export {
|
|
|
189
189
|
emptyPackReason,
|
|
190
190
|
runPack
|
|
191
191
|
};
|
|
192
|
-
//# sourceMappingURL=pack-
|
|
192
|
+
//# sourceMappingURL=pack-B3KYRKUR.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 { sharedArgs } 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 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: sharedArgs.quiet,\n verbose: sharedArgs.verbose,\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;A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;AAAA,MACnL;AAGA,YAAM,cAAc,gBAAgB,OAAO,OAAO,aAAa;AAC/D,UAAI,aAAa;AACf,gBAAQ,OAAO,MAAM;AAAA,8BAAiC,WAAW;AAAA;AAAA,CAAM;AACvE,gBAAQ,KAAK,CAAC;AAAA,MAChB;AAAA,IACF,SAAS,KAAK;AACZ,cAAQ,MAAM;AAAA,WAAe,IAAc,OAAO;AAAA,CAAI;AACtD,cAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF;AACF,CAAC;","names":[]}
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
import "./chunk-SJCIM4TC.js";
|
|
19
19
|
import "./chunk-5WRI5ZAA.js";
|
|
20
20
|
|
|
21
|
-
// src/commands/ready.ts
|
|
21
|
+
// src/commands/core/ready.ts
|
|
22
22
|
import { defineCommand } from "citty";
|
|
23
23
|
async function runReady() {
|
|
24
24
|
const configDir = process.cwd();
|
|
@@ -245,4 +245,4 @@ export {
|
|
|
245
245
|
ready_default as default,
|
|
246
246
|
runReady
|
|
247
247
|
};
|
|
248
|
-
//# sourceMappingURL=ready-
|
|
248
|
+
//# sourceMappingURL=ready-C6YXJ47W.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 } 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 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 {\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}\\n`);\n process.exit(1);\n }\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,qBAAqB;AAqB9B,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,k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M,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":[]}
|
|
@@ -27,3 +27,7 @@ Start by reading `references/step-01-frontmatter.md` (relative to this file). Co
|
|
|
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
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 — `sdx lint` will now flag placeholder sections, so an empty pass means real content.
|
|
@@ -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.
|
|
@@ -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.
|
|
@@ -64,3 +64,7 @@ Respect the user's decision either way.
|
|
|
64
64
|
| "I already ran lint earlier" | Specs may have changed since. Run it again. |
|
|
65
65
|
| "The diff command failed, so skip everything" | Report the lint results at minimum. |
|
|
66
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.
|
|
@@ -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 `sdx 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 `sdx 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.
|
|
@@ -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.
|
|
@@ -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.
|
|
@@ -71,3 +71,7 @@ For each drift:
|
|
|
71
71
|
| "No specs changed, so no drift" | Code can drift even when specs don't change. Run the check. |
|
|
72
72
|
| "The check score is high enough" | Even 95% means 5% drift. Review the findings. |
|
|
73
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.
|
|
@@ -79,3 +79,7 @@ Do NOT skip Step 1. Always run `npx specdx check` before reviewing. Do not rely
|
|
|
79
79
|
| "There are too many findings to review" | Group by category, prioritize errors over warnings. Review all errors. |
|
|
80
80
|
| "The check failed, so skip it" | Report the failure. Partial results are still valuable. |
|
|
81
81
|
| "The user didn't ask for verification" | If you just finished implementing, verify. It's part of the job. |
|
|
82
|
+
|
|
83
|
+
## It's working if
|
|
84
|
+
|
|
85
|
+
Every error-level finding is either resolved or consciously accepted with a reason. Warnings from prose-heavy test plans are expected noise — say so rather than treating the score as a grade.
|