specdx 0.4.0-alpha.12 → 0.4.0-alpha.13

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.
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  createLintEngine,
6
6
  getPreset
7
- } from "./chunk-3GMYCATE.js";
7
+ } from "./chunk-V7JOVK6D.js";
8
8
  import {
9
9
  buildGraph,
10
10
  createLogger,
@@ -120,4 +120,4 @@ export {
120
120
  lint_default as default,
121
121
  runLint
122
122
  };
123
- //# sourceMappingURL=lint-NKE5XJQY.js.map
123
+ //# sourceMappingURL=lint-A5AXYDSO.js.map
package/dist/main.js CHANGED
@@ -10,7 +10,7 @@ import { defineCommand as defineCommand2, runMain } from "citty";
10
10
  // package.json
11
11
  var package_default = {
12
12
  name: "specdx",
13
- version: "0.4.0-alpha.12",
13
+ version: "0.4.0-alpha.13",
14
14
  description: "Spec-driven development toolchain. Validate, lint, pack, and ship specs for LLM-assisted workflows.",
15
15
  type: "module",
16
16
  license: "MIT",
@@ -62,6 +62,7 @@ var package_default = {
62
62
  clean: "rm -rf dist *.tsbuildinfo"
63
63
  },
64
64
  dependencies: {
65
+ "@modelcontextprotocol/sdk": "^1.27.0",
65
66
  ajv: "^8.18.0",
66
67
  "ajv-formats": "^3.0.1",
67
68
  citty: "^0.2.1",
@@ -72,7 +73,8 @@ var package_default = {
72
73
  tinyglobby: "^0.2.12",
73
74
  unified: "^11.0.0",
74
75
  "unist-util-visit": "^5.0.0",
75
- yaml: "^2.7.0"
76
+ yaml: "^2.7.0",
77
+ zod: "^3.23.0"
76
78
  },
77
79
  devDependencies: {
78
80
  "@specdx/check": "workspace:*",
@@ -217,21 +219,21 @@ var main = defineCommand2({
217
219
  meta: { name: "specdx", version: package_default.version, description: "specdx \u2014 Spec Developer Experience" },
218
220
  subCommands: {
219
221
  init: init_default,
220
- lint: () => import("./lint-NKE5XJQY.js").then((m) => m.default),
222
+ lint: () => import("./lint-A5AXYDSO.js").then((m) => m.default),
221
223
  validate: () => import("./validate-HMOCZJ2M.js").then((m) => m.default),
222
224
  graph: () => import("./graph-KZDCVMLT.js").then((m) => m.default),
223
225
  skills: () => import("./skills-EQTVRLER.js").then((m) => m.default),
224
- pack: () => import("./pack-RRSHBRKJ.js").then((m) => m.default),
226
+ pack: () => import("./pack-I5WFM6B6.js").then((m) => m.default),
225
227
  diff: () => import("./diff-DHU3OMNM.js").then((m) => m.default),
226
- status: () => import("./status-7OVCSV2I.js").then((m) => m.default),
228
+ status: () => import("./status-QLG3ZKS7.js").then((m) => m.default),
227
229
  explain: () => import("./explain-EULHHRQC.js").then((m) => m.default),
228
230
  changelog: () => import("./changelog-COHY6ILK.js").then((m) => m.default),
229
231
  check: () => import("./check-6ULNLONS.js").then((m) => m.default),
230
- ready: () => import("./ready-UNK75BQ7.js").then((m) => m.default),
232
+ ready: () => import("./ready-2M5HXTRZ.js").then((m) => m.default),
231
233
  update: () => import("./update-HGZVLKSL.js").then((m) => m.default),
232
234
  generate: () => import("./generate-XG52JCWH.js").then((m) => m.default),
233
235
  migrate: () => import("./migrate-76BXVREF.js").then((m) => m.default),
234
- mcp: () => import("./mcp-OG3DRYN6.js").then((m) => m.default)
236
+ mcp: () => import("./mcp-CWJKX27S.js").then((m) => m.default)
235
237
  }
236
238
  });
237
239
  runMain(main).catch((err) => {
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 changelog: () => import(\"./commands/changelog.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.12\",\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 \"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 },\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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,MAAM,EAAE,OAAO;AAAA,IAClE,SAAS,MAAM,OAAO,uBAAuB,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO;AAAA,IACpE,WAAW,MAAM,OAAO,yBAAyB,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO;AAAA,IACxE,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","../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 changelog: () => import(\"./commands/changelog.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.13\",\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;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,sBAAsB,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO;AAAA,IAClE,SAAS,MAAM,OAAO,uBAAuB,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO;AAAA,IACpE,WAAW,MAAM,OAAO,yBAAyB,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO;AAAA,IACxE,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"]}
@@ -0,0 +1,32 @@
1
+ import "./chunk-5WRI5ZAA.js";
2
+
3
+ // src/commands/mcp.ts
4
+ import { defineCommand } from "citty";
5
+ var mcp_default = defineCommand({
6
+ meta: { name: "mcp", description: "Start the specdx MCP server (stdio transport)" },
7
+ args: {},
8
+ async run() {
9
+ let mcp;
10
+ let stdio;
11
+ try {
12
+ mcp = await import("./dist-2YMKBA6A.js");
13
+ stdio = await import("@modelcontextprotocol/sdk/server/stdio.js");
14
+ } catch (err) {
15
+ const missing = err.message.includes("zod") ? "zod" : "@modelcontextprotocol/sdk";
16
+ console.error(
17
+ `
18
+ \u2717 Cannot start the MCP server: ${missing} is not installed.
19
+ It ships as a dependency of specdx, so this usually means a partial install.
20
+ Try reinstalling specdx, or add it directly: npm install ${missing}
21
+ `
22
+ );
23
+ process.exit(1);
24
+ }
25
+ const server = mcp.createMcpServer();
26
+ await server.connect(new stdio.StdioServerTransport());
27
+ }
28
+ });
29
+ export {
30
+ mcp_default as default
31
+ };
32
+ //# sourceMappingURL=mcp-CWJKX27S.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/commands/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":[]}
@@ -32,6 +32,16 @@ function copyToClipboard(text) {
32
32
  }
33
33
  execSync(cmd, { input: text, stdio: ["pipe", "ignore", "ignore"] });
34
34
  }
35
+ function emptyPackReason(stats, specsResolved) {
36
+ if (stats.specsIncluded > 0) return void 0;
37
+ if (specsResolved === 0) {
38
+ return "no specs resolved from spec.config.yaml \u2014 check the paths in your config";
39
+ }
40
+ if (stats.specsExcluded === 0) {
41
+ 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`;
42
+ }
43
+ return `all ${stats.specsExcluded} candidate spec(s) were excluded \u2014 widen --specs or raise --budget`;
44
+ }
35
45
  async function runPack(options) {
36
46
  const config = await loadConfig(void 0, options.configDir);
37
47
  const allSpecs = [];
@@ -59,7 +69,7 @@ async function runPack(options) {
59
69
  config.pack,
60
70
  graph
61
71
  );
62
- return result;
72
+ return { ...result, specsResolved: allSpecs.length };
63
73
  }
64
74
  var pack_default = defineCommand({
65
75
  meta: { name: "pack", description: "Pack specs into AI-ready context" },
@@ -130,12 +140,16 @@ var pack_default = defineCommand({
130
140
  }
131
141
  console.log(`
132
142
  Budget: ${stats.used} / ${stats.budget} tokens`);
133
- console.log(
134
- ` Included: ${stats.specsIncluded} / ${stats.specsIncluded + stats.specsExcluded} specs`
135
- );
143
+ console.log(` Included: ${stats.specsIncluded} / ${result.specsResolved} specs`);
136
144
  console.log(` Sections compressed: ${stats.sectionsCompressed}`);
137
145
  console.log(` Sections omitted: ${stats.sectionsOmitted}
138
146
  `);
147
+ const dryReason = emptyPackReason(stats, result.specsResolved);
148
+ if (dryReason) {
149
+ console.log(` \u26A0 Nothing would be packed: ${dryReason}
150
+ `);
151
+ process.exit(3);
152
+ }
139
153
  return;
140
154
  }
141
155
  if (args.out) {
@@ -154,6 +168,14 @@ var pack_default = defineCommand({
154
168
  `Packed ${stats.specsIncluded}/${total} specs \u2022 ${stats.used} / ${stats.budget} tokens \u2022 ${stats.sectionsCompressed} sections compressed \u2022 ${stats.sectionsOmitted} sections omitted
155
169
  `
156
170
  );
171
+ const emptyReason = emptyPackReason(stats, result.specsResolved);
172
+ if (emptyReason) {
173
+ process.stderr.write(`
174
+ \u26A0 No context packed: ${emptyReason}
175
+
176
+ `);
177
+ process.exit(3);
178
+ }
157
179
  } catch (err) {
158
180
  console.error(`
159
181
  \u2717 ${err.message}
@@ -164,6 +186,7 @@ var pack_default = defineCommand({
164
186
  });
165
187
  export {
166
188
  pack_default as default,
189
+ emptyPackReason,
167
190
  runPack
168
191
  };
169
- //# sourceMappingURL=pack-RRSHBRKJ.js.map
192
+ //# sourceMappingURL=pack-I5WFM6B6.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/commands/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,wCAAw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AAM,QAAQ,MAAM,gBAAgB,MAAM;AAC1C,cAAQ,OAAO;AAAA,QACb,UAAU,MAAM,aAAa,IAAI,KAAK,iBAAiB,MAAM,IAAI,MAAM,MAAM,MAAM,kBAAkB,MAAM,kBAAkB,+BAA+B,MAAM,eAAe;AAAA;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":[]}
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  createLintEngine,
6
6
  getPreset
7
- } from "./chunk-3GMYCATE.js";
7
+ } from "./chunk-V7JOVK6D.js";
8
8
  import {
9
9
  DEFAULT_DIFF_CONFIG
10
10
  } from "./chunk-4HPWTWBL.js";
@@ -101,6 +101,24 @@ async function runReady() {
101
101
  details: `${errors} errors, ${warnings} warnings`
102
102
  });
103
103
  }
104
+ const placeholderDiagnostics = lintResults.diagnostics.filter(
105
+ (d) => d.ruleId === "completeness/no-placeholder-sections"
106
+ );
107
+ const placeholderFiles = new Set(placeholderDiagnostics.map((d) => d.filePath));
108
+ if (specs.length === 0) {
109
+ checks.push({
110
+ name: "Specs have content",
111
+ passed: true,
112
+ skipped: true,
113
+ details: "skipped (no specs to assess)"
114
+ });
115
+ } else {
116
+ checks.push({
117
+ name: "Specs have content",
118
+ passed: placeholderFiles.size === 0,
119
+ details: placeholderFiles.size === 0 ? "No placeholder sections" : `${placeholderDiagnostics.length} placeholder section(s) across ${placeholderFiles.size} spec(s)`
120
+ });
121
+ }
104
122
  const integrityIssues = [];
105
123
  if (graphError) {
106
124
  integrityIssues.push(graphError);
@@ -227,4 +245,4 @@ export {
227
245
  ready_default as default,
228
246
  runReady
229
247
  };
230
- //# sourceMappingURL=ready-UNK75BQ7.js.map
248
+ //# sourceMappingURL=ready-2M5HXTRZ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/commands/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,S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_CONFIG
7
7
  } from "./chunk-4HPWTWBL.js";
@@ -158,4 +158,4 @@ export {
158
158
  status_default as default,
159
159
  runStatus
160
160
  };
161
- //# sourceMappingURL=status-7OVCSV2I.js.map
161
+ //# sourceMappingURL=status-QLG3ZKS7.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "specdx",
3
- "version": "0.4.0-alpha.12",
3
+ "version": "0.4.0-alpha.13",
4
4
  "description": "Spec-driven development toolchain. Validate, lint, pack, and ship specs for LLM-assisted workflows.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -46,6 +46,7 @@
46
46
  "hooks"
47
47
  ],
48
48
  "dependencies": {
49
+ "@modelcontextprotocol/sdk": "^1.27.0",
49
50
  "ajv": "^8.18.0",
50
51
  "ajv-formats": "^3.0.1",
51
52
  "citty": "^0.2.1",
@@ -56,16 +57,17 @@
56
57
  "tinyglobby": "^0.2.12",
57
58
  "unified": "^11.0.0",
58
59
  "unist-util-visit": "^5.0.0",
59
- "yaml": "^2.7.0"
60
+ "yaml": "^2.7.0",
61
+ "zod": "^3.23.0"
60
62
  },
61
63
  "devDependencies": {
62
64
  "tsup": "^8.5.1",
63
65
  "typescript": "^5.7.0",
64
66
  "@specdx/check": "0.0.0",
67
+ "@specdx/core": "0.0.0",
65
68
  "@specdx/diff": "0.0.0",
66
69
  "@specdx/lint": "0.0.0",
67
70
  "@specdx/mcp": "0.0.0",
68
- "@specdx/core": "0.0.0",
69
71
  "@specdx/pack": "0.0.0",
70
72
  "@specdx/schema": "0.0.0",
71
73
  "@specdx/skills": "0.0.0"
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../lint/src/engine.ts","../../lint/src/rules/valid-frontmatter.ts","../../lint/src/rules/required-sections.ts","../../lint/src/rules/valid-references.ts","../../lint/src/rules/no-circular-deps.ts","../../lint/src/rules/story-coverage.ts","../../lint/src/rules/staleness-check.ts","../../lint/src/rules/no-vague-language.ts","../../lint/src/rules/single-project-context.ts","../../lint/src/rules/terminology.ts","../../lint/src/rules/edge-case-coverage.ts","../../lint/src/rules/naming-conventions.ts","../../lint/src/rules/threat-coverage.ts","../../lint/src/rules/ambiguity-score-ai.ts","../../lint/src/rules/index.ts","../../lint/src/presets.ts","../../lint/src/custom-rule-loader.ts"],"sourcesContent":["import type { ParsedSpec, DependencyGraph } from \"@specdx/core\";\nimport type { SdxConfig } from \"@specdx/schema\";\nimport type { LintRule, LintResults, Diagnostic } from \"./types.js\";\n\nexport interface LintEngineOptions {\n rules: LintRule[];\n config?: SdxConfig;\n graph?: DependencyGraph;\n}\n\nexport interface LintEngine {\n lint(specs: ParsedSpec[]): LintResults;\n}\n\nexport function createLintEngine(options: LintEngineOptions): LintEngine {\n return {\n lint(specs: ParsedSpec[]): LintResults {\n const diagnostics: Diagnostic[] = [];\n for (const spec of specs) {\n for (const rule of options.rules) {\n const results = rule.run({\n spec,\n allSpecs: specs,\n config: options.config,\n graph: options.graph,\n });\n diagnostics.push(...results);\n }\n }\n return {\n diagnostics,\n hasErrors: diagnostics.some((d) => d.severity === \"error\"),\n hasWarnings: diagnostics.some((d) => d.severity === \"warn\"),\n };\n },\n };\n}\n","import type { LintRule } from \"../types.js\";\n\nexport const validFrontmatterRule: LintRule = {\n id: \"structure/valid-frontmatter\",\n description: \"Frontmatter matches the schema for the declared spec type\",\n severity: \"error\",\n run(context) {\n if (context.spec.valid) return [];\n const errors = context.spec.validationErrors ?? [];\n return errors.map((err) => ({\n ruleId: \"structure/valid-frontmatter\",\n severity: \"error\" as const,\n message: `Invalid frontmatter: ${err.message ?? JSON.stringify(err)}`,\n filePath: context.spec.filePath,\n }));\n },\n};\n","import type { LintRule } from \"../types.js\";\nimport { REQUIRED_SECTIONS } from \"@specdx/schema\";\nimport type { SpecType } from \"@specdx/schema\";\n\nexport const requiredSectionsRule: LintRule = {\n id: \"structure/required-sections\",\n description: \"Spec body contains all required sections for its type\",\n severity: \"error\",\n run(context) {\n // Skip YAML specs (no markdown body)\n const ext = context.spec.filePath.split(\".\").pop()?.toLowerCase();\n if (ext === \"yaml\" || ext === \"yml\") return [];\n\n const specType = context.spec.frontmatter.type as SpecType;\n const required = REQUIRED_SECTIONS[specType];\n if (!required) return [];\n\n const missing = required.filter((s) => !context.spec.sections.includes(s));\n return missing.map((section) => ({\n ruleId: \"structure/required-sections\",\n severity: \"error\" as const,\n message: `Missing required section: \"${section}\"`,\n filePath: context.spec.filePath,\n section,\n }));\n },\n};\n","import type { LintRule } from \"../types.js\";\n\nexport const validReferencesRule: LintRule = {\n id: \"structure/valid-references\",\n description: \"All references in frontmatter point to specs that exist in the suite\",\n severity: \"error\",\n run(context) {\n const refs = context.spec.frontmatter.references;\n if (!refs || refs.length === 0) return [];\n const allIds = new Set(context.allSpecs.map((s) => s.frontmatter.id));\n return refs\n .filter((ref) => !allIds.has(ref.id))\n .map((ref) => ({\n ruleId: \"structure/valid-references\",\n severity: \"error\" as const,\n message: `Reference \"${ref.id}\" does not match any spec in the suite`,\n filePath: context.spec.filePath,\n }));\n },\n};\n","import type { LintRule } from \"../types.js\";\n\nexport const noCircularDepsRule: LintRule = {\n id: \"structure/no-circular-deps\",\n description: \"The dependency graph has no cycles\",\n severity: \"error\",\n run() {\n // Cycle detection happens in buildGraph() — if graph construction succeeds, it's acyclic.\n // GraphErrors are surfaced as diagnostics by the lint command, not by this rule.\n return [];\n },\n};\n","import type { LintRule } from \"../types.js\";\n\nconst FEATURE_PATTERN = /\\*\\*F\\d+\\*\\*:\\s*(.+)/g;\n\nexport const storyCoverageRule: LintRule = {\n id: \"completeness/story-coverage\",\n description: \"Every feature listed in a PRD has at least one corresponding user story\",\n severity: \"warn\",\n run(context) {\n if (context.spec.frontmatter.type !== \"prd\") return [];\n const features: string[] = [];\n let match;\n const re = new RegExp(FEATURE_PATTERN.source, \"g\");\n while ((match = re.exec(context.spec.content)) !== null) {\n features.push(match[1]!.trim());\n }\n if (features.length === 0) return [];\n const stories = context.allSpecs.filter((s) => s.frontmatter.type === \"user-story\");\n const storyContent = stories.map((s) => s.content + \" \" + s.frontmatter.title).join(\" \");\n return features\n .filter((feature) => !storyContent.toLowerCase().includes(feature.toLowerCase()))\n .map((feature) => ({\n ruleId: \"completeness/story-coverage\",\n severity: \"warn\" as const,\n message: `Feature \"${feature}\" has no corresponding user story`,\n filePath: context.spec.filePath,\n }));\n },\n};\n","import { buildRelationResolver } from \"@specdx/core\";\nimport type { ParsedSpec } from \"@specdx/core\";\nimport type { SdxConfig } from \"@specdx/schema\";\nimport type { LintRule } from \"../types.js\";\n\n/**\n * Group specs by the config entry whose glob they came from, so config\n * `requires` edges can be mapped into spec id space. Matching is by the entry\n * path's directory prefix, which is enough for the resolver: an id that maps\n * to no entry simply contributes no `requires` edges.\n */\nfunction groupByEntry(config: SdxConfig, specs: ParsedSpec[]): Map<string, ParsedSpec[]> {\n const byEntry = new Map<string, ParsedSpec[]>();\n for (const key of Object.keys(config.specs)) byEntry.set(key, []);\n\n for (const spec of specs) {\n let bestKey: string | undefined;\n let bestLen = -1;\n for (const [key, entry] of Object.entries(config.specs)) {\n const prefix = entry.path.split(\"*\")[0] ?? \"\";\n const normalized = spec.filePath.replace(/\\\\/g, \"/\");\n if (normalized.includes(prefix) && prefix.length > bestLen) {\n bestKey = key;\n bestLen = prefix.length;\n }\n }\n if (bestKey) byEntry.get(bestKey)!.push(spec);\n }\n return byEntry;\n}\n\nfunction lastUpdated(spec: ParsedSpec): string {\n return (\n (spec.frontmatter.updated as string | undefined) ?? (spec.frontmatter.created as string) ?? \"\"\n );\n}\n\nexport const stalenessCheckRule: LintRule = {\n id: \"freshness/staleness-check\",\n description: \"Warns if a spec hasn't been updated since its upstream dependency changed\",\n severity: \"warn\",\n run(context) {\n const specId = context.spec.frontmatter.id;\n if (typeof specId !== \"string\") return [];\n\n const specUpdated = lastUpdated(context.spec);\n if (!specUpdated) return [];\n const specDate = new Date(specUpdated);\n\n // Upstream comes from config `requires` and frontmatter `references`\n // unioned, so a suite declaring dependencies either way gets the same\n // answer (ADR: references/requires unification).\n const byEntry = context.config\n ? groupByEntry(context.config, context.allSpecs)\n : new Map([[\"\", context.allSpecs]]);\n const relations = buildRelationResolver(context.config, byEntry);\n const upstreamIds = relations.getUpstream(specId);\n\n const diagnostics = [];\n for (const upstreamId of upstreamIds) {\n const upstream = context.allSpecs.find((s) => s.frontmatter.id === upstreamId);\n if (!upstream) continue;\n const upstreamUpdated = lastUpdated(upstream);\n if (!upstreamUpdated) continue;\n\n if (new Date(upstreamUpdated) > specDate) {\n diagnostics.push({\n ruleId: \"freshness/staleness-check\",\n severity: \"warn\" as const,\n message: `Potentially stale: upstream \"${upstreamId}\" was updated on ${upstreamUpdated}, but this spec was last updated on ${specUpdated}`,\n filePath: context.spec.filePath,\n });\n }\n }\n return diagnostics;\n },\n};\n","import type { LintRule } from \"../types.js\";\n\nconst DEFAULT_VAGUE_PATTERNS = [\n \"as appropriate\",\n \"handle edge cases\",\n \"as needed\",\n \"etc\\\\.\",\n \"TBD\",\n \"TODO\",\n \"and so on\",\n \"various\",\n \"somehow\",\n \"straightforward\",\n \"obviously\",\n \"simply\",\n \"just need to\",\n];\n\nexport const noVagueLanguageRule: LintRule = {\n id: \"clarity/no-vague-language\",\n description: \"Flags known ambiguous phrases\",\n severity: \"warn\",\n run(context) {\n if (!context.spec.content) return [];\n const diagnostics = [];\n for (const pattern of DEFAULT_VAGUE_PATTERNS) {\n const regex = new RegExp(`\\\\b${pattern}`, \"gi\");\n let match;\n while ((match = regex.exec(context.spec.content)) !== null) {\n diagnostics.push({\n ruleId: \"clarity/no-vague-language\",\n severity: \"warn\" as const,\n message: `Vague language: \"${match[0]}\"`,\n filePath: context.spec.filePath,\n });\n }\n }\n return diagnostics;\n },\n};\n","import type { LintRule } from \"../types.js\";\n\nexport const singleProjectContextRule: LintRule = {\n id: \"structure/single-project-context\",\n description: \"Only one project-context spec should exist per suite\",\n severity: \"warn\",\n run(context) {\n if (context.spec.frontmatter.type !== \"project-context\") return [];\n\n const contextSpecs = context.allSpecs.filter((s) => s.frontmatter.type === \"project-context\");\n\n if (contextSpecs.length > 1) {\n return [\n {\n ruleId: \"structure/single-project-context\",\n severity: \"warn\" as const,\n message: `Multiple project-context specs found (${contextSpecs.length}). Only one should exist per suite.`,\n filePath: context.spec.filePath,\n },\n ];\n }\n\n return [];\n },\n};\n","import type { LintRule } from \"../types.js\";\n\nfunction normalizeCompound(term: string): string {\n // Split camelCase: \"UserProfile\" → \"user profile\"\n // Split hyphens/underscores: \"user-profile\" → \"user profile\"\n return term\n .replace(/([a-z])([A-Z])/g, \"$1 $2\")\n .replace(/[-_]/g, \" \")\n .toLowerCase()\n .trim();\n}\n\nfunction extractCompoundTerms(content: string): string[] {\n const terms: string[] = [];\n\n // Extract camelCase words (e.g., UserProfile, userProfile)\n const camelCaseRegex = /\\b[a-zA-Z]*[a-z][A-Z][a-zA-Z]*\\b/g;\n let match;\n while ((match = camelCaseRegex.exec(content)) !== null) {\n terms.push(match[0]);\n }\n\n // Extract hyphenated words (e.g., user-profile, my-component)\n const hyphenatedRegex = /\\b[a-z][a-z0-9]*(?:-[a-z][a-z0-9]*)+\\b/g;\n while ((match = hyphenatedRegex.exec(content)) !== null) {\n terms.push(match[0]);\n }\n\n return terms;\n}\n\nexport const terminologyRule: LintRule = {\n id: \"consistency/terminology\",\n description:\n \"Detects terminology drift (e.g., user-profile vs UserProfile vs user profile) across specs\",\n severity: \"warn\",\n run(context) {\n // Only run on the first spec to avoid duplicate diagnostics\n if (context.spec !== context.allSpecs[0]) return [];\n\n // Build a map: normalized form → Set of original forms found across all specs\n const termMap = new Map<string, Set<string>>();\n\n for (const spec of context.allSpecs) {\n if (!spec.content) continue;\n const terms = extractCompoundTerms(spec.content);\n for (const term of terms) {\n const normalized = normalizeCompound(term);\n // Only track multi-word normalized forms (skip single words)\n if (!normalized.includes(\" \")) continue;\n if (!termMap.has(normalized)) {\n termMap.set(normalized, new Set());\n }\n termMap.get(normalized)!.add(term);\n }\n }\n\n const diagnostics = [];\n\n for (const [normalized, variants] of termMap) {\n if (variants.size >= 2) {\n const variantList = [...variants].join(\", \");\n diagnostics.push({\n ruleId: \"consistency/terminology\",\n severity: \"warn\" as const,\n message: `Inconsistent terminology for \"${normalized}\": found variants [${variantList}]. Standardize terminology across specs.`,\n filePath: context.spec.filePath,\n });\n }\n }\n\n return diagnostics;\n },\n};\n","import type { LintRule } from \"../types.js\";\n\nconst EDGE_CASE_KEYWORDS = [\n \"error\",\n \"invalid\",\n \"empty\",\n \"timeout\",\n \"fails\",\n \"failure\",\n \"boundary\",\n \"edge case\",\n \"null\",\n \"undefined\",\n \"reject\",\n \"unauthorized\",\n \"forbidden\",\n \"404\",\n \"500\",\n \"missing\",\n \"malformed\",\n \"overflow\",\n \"duplicate\",\n \"graceful\",\n \"fall back\",\n \"fallback\",\n \"crash\",\n \"nonexistent\",\n \"corrupt\",\n];\n\nexport const edgeCaseCoverageRule: LintRule = {\n id: \"completeness/edge-case-coverage\",\n description: \"Flag user stories or test plans that don't mention error states or edge cases\",\n severity: \"warn\",\n run(context) {\n const type = context.spec.frontmatter.type as string;\n if (type !== \"user-story\" && type !== \"test-plan\") return [];\n\n const content = context.spec.content.toLowerCase();\n const hasEdgeCases = EDGE_CASE_KEYWORDS.some((kw) => content.includes(kw));\n\n if (hasEdgeCases) return [];\n\n return [\n {\n ruleId: \"completeness/edge-case-coverage\",\n severity: \"warn\" as const,\n message:\n \"No error states or edge cases mentioned. Consider adding error handling, boundary conditions, or failure mode scenarios.\",\n filePath: context.spec.filePath,\n },\n ];\n },\n};\n","import type { LintRule } from \"../types.js\";\n\nexport const namingConventionsRule: LintRule = {\n id: \"consistency/naming-conventions\",\n description: \"Enforce consistent naming conventions across specs\",\n severity: \"warn\",\n run(context) {\n const { spec } = context;\n const type = spec.frontmatter.type as string;\n const diagnostics = [];\n\n if (type === \"prd\") {\n // Split content into sections and find the Features section\n const sectionParts = spec.content.split(/^(?=## )/m);\n const featuresSection = sectionParts.find((p) => /^## Features\\b/.test(p));\n if (featuresSection) {\n const bullets = featuresSection.match(/^- .+$/gm) ?? [];\n for (const bullet of bullets) {\n if (bullet.match(/^- \\*\\*F\\d+\\*\\*:/) === null && bullet.trim().length > 2) {\n diagnostics.push({\n ruleId: \"consistency/naming-conventions\",\n severity: \"warn\" as const,\n message: `PRD feature missing feature ID pattern (**F<N>**:): \"${bullet.slice(0, 60)}\"`,\n filePath: spec.filePath,\n });\n }\n }\n }\n }\n\n if (type === \"user-story\") {\n const id = spec.frontmatter.id as string;\n if (!id.startsWith(\"story-\")) {\n diagnostics.push({\n ruleId: \"consistency/naming-conventions\",\n severity: \"warn\" as const,\n message: `User story ID \"${id}\" should start with \"story-\" (e.g., \"story-${id}\")`,\n filePath: spec.filePath,\n });\n }\n }\n\n if (type === \"api-contract\") {\n // Check endpoints for camelCase path segments\n const endpointRe = /^###\\s+(GET|POST|PUT|PATCH|DELETE)\\s+(\\S+)/gm;\n let match;\n while ((match = endpointRe.exec(spec.content)) !== null) {\n const path = match[2]!;\n if (/\\/[a-z]+[A-Z]/.test(path)) {\n diagnostics.push({\n ruleId: \"consistency/naming-conventions\",\n severity: \"warn\" as const,\n message: `Endpoint path \"${path}\" uses camelCase — use kebab-case instead (e.g., \"${path.replace(/([a-z])([A-Z])/g, \"$1-$2\").toLowerCase()}\")`,\n filePath: spec.filePath,\n });\n }\n }\n }\n\n return diagnostics;\n },\n};\n","import type { LintRule } from \"../types.js\";\n\nconst STOPWORDS = new Set([\"the\", \"and\", \"for\", \"with\", \"from\", \"that\", \"this\", \"into\", \"via\"]);\n\nfunction extractThreats(content: string): string[] {\n // Split into sections at each ## heading, then filter for Threats/Security\n const parts = content.split(/^(?=## )/m);\n const threats: string[] = [];\n for (const part of parts) {\n if (!/^##\\s+(Threats|Security)\\b/i.test(part)) continue;\n const bullets = part.match(/^- .+$/gm) ?? [];\n threats.push(...bullets.map((b) => b.slice(2).trim()));\n }\n return threats;\n}\n\nfunction extractKeyTerms(text: string): string[] {\n return text\n .toLowerCase()\n .split(/\\W+/)\n .filter((w) => w.length > 3)\n .filter((w) => !STOPWORDS.has(w));\n}\n\nexport const threatCoverageRule: LintRule = {\n id: \"security/threat-coverage\",\n description: \"Technical design specs must address threats identified in other specs\",\n severity: \"warn\",\n run(context) {\n if (context.spec.frontmatter.type !== \"technical-design\") return [];\n\n const allThreats: string[] = [];\n for (const spec of context.allSpecs) {\n if (spec.filePath === context.spec.filePath) continue;\n allThreats.push(...extractThreats(spec.content));\n }\n\n if (allThreats.length === 0) return [];\n\n const techContent = context.spec.content.toLowerCase();\n const diagnostics = [];\n\n for (const threat of allThreats) {\n const keyTerms = extractKeyTerms(threat);\n const covered = keyTerms.some((term) => techContent.includes(term));\n if (!covered) {\n diagnostics.push({\n ruleId: \"security/threat-coverage\",\n severity: \"warn\" as const,\n message: `Threat not addressed in technical design: \"${threat}\". Ensure the design covers this threat.`,\n filePath: context.spec.filePath,\n });\n }\n }\n\n return diagnostics;\n },\n};\n","import type { LintRule } from \"../types.js\";\n\nexport const ambiguityScoreAiRule: LintRule = {\n id: \"clarity/ambiguity-score-ai\",\n description: \"AI-powered ambiguity detection (requires ANTHROPIC_API_KEY)\",\n severity: \"info\",\n run(context) {\n if (!process.env[\"ANTHROPIC_API_KEY\"]) return [];\n\n return [\n {\n ruleId: \"clarity/ambiguity-score-ai\",\n severity: \"info\" as const,\n message:\n \"AI ambiguity analysis available — run `sdx check --ai` for LLM-powered ambiguity detection\",\n filePath: context.spec.filePath,\n },\n ];\n },\n};\n","import { validFrontmatterRule } from \"./valid-frontmatter.js\";\nimport { requiredSectionsRule } from \"./required-sections.js\";\nimport { validReferencesRule } from \"./valid-references.js\";\nimport { noCircularDepsRule } from \"./no-circular-deps.js\";\nimport { storyCoverageRule } from \"./story-coverage.js\";\nimport { stalenessCheckRule } from \"./staleness-check.js\";\nimport { noVagueLanguageRule } from \"./no-vague-language.js\";\nimport { singleProjectContextRule } from \"./single-project-context.js\";\nimport { terminologyRule } from \"./terminology.js\";\nimport { edgeCaseCoverageRule } from \"./edge-case-coverage.js\";\nimport { namingConventionsRule } from \"./naming-conventions.js\";\nimport { threatCoverageRule } from \"./threat-coverage.js\";\nimport { ambiguityScoreAiRule } from \"./ambiguity-score-ai.js\";\nimport type { LintRule } from \"../types.js\";\n\nexport const structureRules: LintRule[] = [\n validFrontmatterRule,\n requiredSectionsRule,\n validReferencesRule,\n noCircularDepsRule,\n singleProjectContextRule,\n];\n\nexport const contentRules: LintRule[] = [\n storyCoverageRule,\n stalenessCheckRule,\n noVagueLanguageRule,\n terminologyRule,\n edgeCaseCoverageRule,\n namingConventionsRule,\n threatCoverageRule,\n ambiguityScoreAiRule,\n];\n\nexport const allBuiltinRules: LintRule[] = [...structureRules, ...contentRules];\n\nexport {\n validFrontmatterRule,\n requiredSectionsRule,\n validReferencesRule,\n noCircularDepsRule,\n storyCoverageRule,\n stalenessCheckRule,\n noVagueLanguageRule,\n singleProjectContextRule,\n terminologyRule,\n edgeCaseCoverageRule,\n namingConventionsRule,\n threatCoverageRule,\n ambiguityScoreAiRule,\n};\n","import type { LintRule } from \"./types.js\";\nimport { structureRules, allBuiltinRules } from \"./rules/index.js\";\n\nexport function getPreset(name: string): LintRule[] {\n switch (name) {\n case \"minimal\":\n return structureRules;\n case \"recommended\":\n return allBuiltinRules;\n case \"strict\":\n return allBuiltinRules.map((rule) => ({ ...rule, severity: \"error\" as const }));\n default:\n throw new Error(\n `Unknown preset: \"${name}\". Use \"minimal\", \"recommended\", or \"strict\", or resolve external presets via resolvePreset() from @specdx/core.`,\n );\n }\n}\n","import { pathToFileURL } from \"node:url\";\nimport type { LintRule } from \"./types.js\";\n\nexport async function loadCustomRule(filePath: string): Promise<LintRule> {\n const module = await import(pathToFileURL(filePath).href);\n const rule = module.default ?? module.rule;\n if (!rule || !rule.id || !rule.run) {\n throw new Error(\n `Custom rule at ${filePath} must export a default LintRule with id and run function`,\n );\n }\n return rule as LintRule;\n}\n"],"mappings":";;;;;;;;AAcM,SAAU,iBAAiB,SAA0B;AACz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;AChBA,SAAS,qBAAqB;","names":[]}
@@ -1,19 +0,0 @@
1
- import "./chunk-5WRI5ZAA.js";
2
-
3
- // src/commands/mcp.ts
4
- import { defineCommand } from "citty";
5
- var mcp_default = defineCommand({
6
- meta: { name: "mcp", description: "Start the specdx MCP server (stdio transport)" },
7
- args: {},
8
- async run() {
9
- const { createMcpServer } = await import("./dist-6XCIT3RF.js");
10
- const { StdioServerTransport } = await import("@modelcontextprotocol/sdk/server/stdio.js");
11
- const server = createMcpServer();
12
- const transport = new StdioServerTransport();
13
- await server.connect(transport);
14
- }
15
- });
16
- export {
17
- mcp_default as default
18
- };
19
- //# sourceMappingURL=mcp-OG3DRYN6.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/commands/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 const { createMcpServer } = await import(\"@specdx/mcp\");\n // @ts-expect-error — sub-path export resolved at runtime via external bundle\n const { StdioServerTransport } = await import(\"@modelcontextprotocol/sdk/server/stdio.js\");\n\n const server = createMcpServer();\n const transport = new StdioServerTransport();\n await server.connect(transport);\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;AACV,UAAM,EAAE,gBAAgB,IAAI,MAAM,OAAO,oBAAa;AAEtD,UAAM,EAAE,qBAAqB,IAAI,MAAM,OAAO,2CAA2C;AAEzF,UAAM,SAAS,gBAAgB;AAC/B,UAAM,YAAY,IAAI,qBAAqB;AAC3C,UAAM,OAAO,QAAQ,SAAS;AAAA,EAChC;AACF,CAAC;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/commands/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\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(options: RunPackOptions): Promise<PackResult> {\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;\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(\n ` Included: ${stats.specsIncluded} / ${stats.specsIncluded + stats.specsExcluded} specs`,\n );\n console.log(` Sections compressed: ${stats.sectionsCompressed}`);\n console.log(` Sections omitted: ${stats.sectionsOmitted}\\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 } 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;AAYA,eAAsB,QAAQ,SAA8C;AAC1E,QAAM,SAAS,MAAM,WAAW,QAAW,QAAQ,SAAS;AAE5D,QAAM,WAAyB,CAAC;AAChC,aAAW,CAAC,EAAE,KAAK,KAAK,OAAO,QAAQ,OAAO,KAAK,GAAG;AACpD,UAAM,QAAQ,MAAM,YAAY,MAAM,MAAM,QAAQ,SAAS;AAC7D,eAAW,QAAQ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Aa,MAAM,MAAM,gBAAgB,MAAM,aAAa;AAAA,QACnF;AACA,gBAAQ,IAAI,0BAA0B,MAAM,kBAAkB,EAAE;AAChE,gBAAQ,IAAI,uBAAuB,MAAM,eAAe;AAAA,CAAI;AAC5D;AAAA,MACF;AAGA,UAAI,KAAK,KAAK;AACZ,cAAM,UAAU,KAAK,KAAK,OAAO,QAAQ,OAAO;AAChD,eAAO,KAAK,qBAAqB,KAAK,GAAG,EAAE;AAAA,MAC7C;AACA,UAAI,KAAK,MAAM;AACb,wBAAgB,OAAO,MAAM;AAC7B,eAAO,KAAK,4BAA4B;AAAA,MAC1C;AACA,UAAI,CAAC,KAAK,OAAO,CAAC,KAAK,MAAM;AAC3B,gBAAQ,OAAO,MAAM,OAAO,MAAM;AAAA,MACpC;AAGA,YAAM,QAAQ,MAAM,gBAAgB,MAAM;AAC1C,cAAQ,OAAO;AAAA,QACb,UAAU,MAAM,aAAa,IAAI,KAAK,iBAAiB,MAAM,IAAI,MAAM,MAAM,MAAM,kBAAkB,MAAM,kBAAkB,+BAA+B,MAAM,eAAe;AAAA;AAAA,MACnL;AAAA,IACF,SAAS,KAAK;AACZ,cAAQ,MAAM;AAAA,WAAe,IAAc,OAAO;AAAA,CAAI;AACtD,cAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF;AACF,CAAC;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/commands/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 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,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,WAAO,KAAK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