specdx 0.4.0-alpha.13 → 0.4.0-alpha.15

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.
Files changed (31) hide show
  1. package/.claude-plugin/plugin.json +7 -2
  2. package/dist/{diff-DHU3OMNM.js → diff-AWFDXYX4.js} +60 -2
  3. package/dist/diff-AWFDXYX4.js.map +1 -0
  4. package/dist/{explain-EULHHRQC.js → explain-M2VXXXGP.js} +5 -2
  5. package/dist/explain-M2VXXXGP.js.map +1 -0
  6. package/dist/index.js +63 -84
  7. package/dist/index.js.map +1 -1
  8. package/dist/main.js +4 -5
  9. package/dist/main.js.map +1 -1
  10. package/dist/skills/{specdx-author-spec.md → specdx-author-spec/SKILL.md} +6 -6
  11. package/dist/skills/specdx-author-spec/{step-01-frontmatter.md → references/step-01-frontmatter.md} +1 -1
  12. package/dist/skills/{specdx-check-drift.md → specdx-check-drift/SKILL.md} +1 -1
  13. package/dist/skills/{specdx-onboard.md → specdx-onboard/SKILL.md} +1 -1
  14. package/dist/skills/{specdx-plan-from-spec.md → specdx-plan-from-spec/SKILL.md} +1 -1
  15. package/dist/skills/{specdx-pre-commit.md → specdx-pre-commit/SKILL.md} +1 -1
  16. package/dist/skills/{specdx-review-spec.md → specdx-review-spec/SKILL.md} +1 -1
  17. package/dist/skills/{specdx-sprint-review.md → specdx-sprint-review/SKILL.md} +1 -1
  18. package/dist/skills/{specdx-start-task.md → specdx-start-task/SKILL.md} +1 -1
  19. package/dist/skills/{specdx-verify.md → specdx-verify/SKILL.md} +1 -1
  20. package/dist/{skills-EQTVRLER.js → skills-N7ZDWOJM.js} +27 -11
  21. package/dist/skills-N7ZDWOJM.js.map +1 -0
  22. package/hooks/hooks.json +12 -6
  23. package/package.json +3 -3
  24. package/dist/changelog-COHY6ILK.js +0 -94
  25. package/dist/changelog-COHY6ILK.js.map +0 -1
  26. package/dist/diff-DHU3OMNM.js.map +0 -1
  27. package/dist/explain-EULHHRQC.js.map +0 -1
  28. package/dist/skills-EQTVRLER.js.map +0 -1
  29. /package/dist/skills/{spec-type-reference.md → specdx-author-spec/references/spec-type-reference.md} +0 -0
  30. /package/dist/skills/specdx-author-spec/{step-02-sections.md → references/step-02-sections.md} +0 -0
  31. /package/dist/skills/specdx-author-spec/{step-03-finalize.md → references/step-03-finalize.md} +0 -0
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.13",
13
+ version: "0.4.0-alpha.15",
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",
@@ -222,12 +222,11 @@ var main = defineCommand2({
222
222
  lint: () => import("./lint-A5AXYDSO.js").then((m) => m.default),
223
223
  validate: () => import("./validate-HMOCZJ2M.js").then((m) => m.default),
224
224
  graph: () => import("./graph-KZDCVMLT.js").then((m) => m.default),
225
- skills: () => import("./skills-EQTVRLER.js").then((m) => m.default),
225
+ skills: () => import("./skills-N7ZDWOJM.js").then((m) => m.default),
226
226
  pack: () => import("./pack-I5WFM6B6.js").then((m) => m.default),
227
- diff: () => import("./diff-DHU3OMNM.js").then((m) => m.default),
227
+ diff: () => import("./diff-AWFDXYX4.js").then((m) => m.default),
228
228
  status: () => import("./status-QLG3ZKS7.js").then((m) => m.default),
229
- explain: () => import("./explain-EULHHRQC.js").then((m) => m.default),
230
- changelog: () => import("./changelog-COHY6ILK.js").then((m) => m.default),
229
+ explain: () => import("./explain-M2VXXXGP.js").then((m) => m.default),
231
230
  check: () => import("./check-6ULNLONS.js").then((m) => m.default),
232
231
  ready: () => import("./ready-2M5HXTRZ.js").then((m) => m.default),
233
232
  update: () => import("./update-HGZVLKSL.js").then((m) => m.default),
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.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,iBAAA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.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,eA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E,KAAK,CAAC,MAAM,EAAE,OAAO;AAAA,IACtE,OAAO,MAAM,OAAO,qBAAqB,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO;AAAA,IAChE,QAAQ,MAAM,OAAO,sBAAsB,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO;AAAA,IAClE,MAAM,MAAM,OAAO,oBAAoB,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO;AAAA,IAC9D,MAAM,MAAM,OAAO,oBAAoB,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO;AAAA,IAC9D,QAAQ,MAAM,OAAO,sBAAsB,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO;AAAA,IAClE,SAAS,MAAM,OAAO,uBAAuB,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,7 +1,7 @@
1
1
  ---
2
2
  name: specdx-author-spec
3
3
  description: Use when the user wants to create a new spec, write a PRD, document a technical design, record an architecture decision, add a user story, or write a test plan. Guides spec authoring with iterative linting.
4
- allowed-tools: Bash(npx specdx *), Read, Write, Edit
4
+ allowed-tools: Bash(npx specdx:*) Read Write Edit
5
5
  ---
6
6
 
7
7
  # Author a Spec
@@ -10,20 +10,20 @@ This skill follows a 3-step workflow. Load each step file as you reach it — th
10
10
 
11
11
  ## Steps
12
12
 
13
- 1. **Frontmatter** — Read `specdx-author-spec/step-01-frontmatter.md` next to this file
13
+ 1. **Frontmatter** — Read `references/step-01-frontmatter.md`
14
14
  - Determine spec type, check existing specs, create file with frontmatter
15
15
 
16
- 2. **Sections** — Read `specdx-author-spec/step-02-sections.md`
16
+ 2. **Sections** — Read `references/step-02-sections.md`
17
17
  - Write sections one at a time, lint after every 2-3 sections
18
18
  - HARD GATE: Do NOT skip lint between sections
19
19
 
20
- 3. **Finalize** — Read `specdx-author-spec/step-03-finalize.md`
20
+ 3. **Finalize** — Read `references/step-03-finalize.md`
21
21
  - Register in spec.config.yaml, run final validation
22
22
 
23
23
  ## How to use
24
24
 
25
- Start by reading `specdx-author-spec/step-01-frontmatter.md` (relative to this file's directory). Complete that step fully before moving to step 2.
25
+ Start by reading `references/step-01-frontmatter.md` (relative to this file). Complete that step fully before moving to step 2.
26
26
 
27
27
  Each step file is self-contained with its own instructions. Do NOT read ahead — load one step at a time.
28
28
 
29
- For detailed reference on spec types and their fields, see `spec-type-reference.md` in this directory.
29
+ For detailed reference on spec types and their fields, see `references/spec-type-reference.md`.
@@ -19,7 +19,7 @@ Ask what kind of spec they need:
19
19
  | `adr` | Recording a decision | Context, Decision, Status, Consequences |
20
20
  | `api-contract` | Defining an API | Endpoints, Request/Response Schemas, Auth, Error Codes |
21
21
 
22
- For detailed guidance on each type, read `spec-type-reference.md` in the parent directory.
22
+ For detailed guidance on each type, read `spec-type-reference.md` in this directory.
23
23
 
24
24
  ## Check existing specs
25
25
 
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: specdx-check-drift
3
3
  description: "[experimental — built on sdx check, whose static analysis can be noisy] Use when the user says 'check drift', 'did I drift from spec', 'am I still aligned', or as part of a pre-commit check. Compares recent code changes against spec definitions."
4
- allowed-tools: Bash(npx specdx *), Read
4
+ allowed-tools: Bash(npx specdx:*) Read
5
5
  ---
6
6
 
7
7
  # Check Spec Drift
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: specdx-onboard
3
3
  description: "Use when a new developer joins the project, asks 'what is this project', 'explain the specs', 'how does this codebase work', 'what specs exist', or wants an overview of the spec suite. Provides a guided tour of the project's specs."
4
- allowed-tools: Bash(npx specdx *)
4
+ allowed-tools: Bash(npx specdx:*)
5
5
  ---
6
6
 
7
7
  # Onboard — Spec Suite Overview
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: specdx-plan-from-spec
3
3
  description: "Use when the user asks to plan implementation, create a plan from specs, or says 'how should I build this', 'plan this', 'create an implementation plan', or 'what's the approach'. Generates a step-by-step plan grounded in project specs."
4
- allowed-tools: Bash(npx specdx *)
4
+ allowed-tools: Bash(npx specdx:*)
5
5
  ---
6
6
 
7
7
  # Plan From Spec
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: specdx-pre-commit
3
3
  description: "Use when the user is about to commit, mentions committing, or says 'let's commit', 'ready to commit', 'wrap up', or 'commit this'. Checks spec health and flags drift before committing."
4
- allowed-tools: Bash(npx specdx *)
4
+ allowed-tools: Bash(npx specdx:*)
5
5
  ---
6
6
 
7
7
  # Pre-Commit Spec Check
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: specdx-review-spec
3
3
  description: "Use when the user asks to review a spec, says 'is this spec good enough', 'review my spec', 'check spec quality', or 'audit this spec'. Runs multi-layer spec quality review."
4
- allowed-tools: Bash(npx specdx *), Read, Agent
4
+ allowed-tools: Bash(npx specdx:*) Read Agent
5
5
  ---
6
6
 
7
7
  # Review Spec Quality
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: specdx-sprint-review
3
3
  description: "Use when the user asks for a summary, sprint review, spec health report, progress update, or says 'how are specs looking', 'spec health', or 'what changed'. Generates a shareable spec health report."
4
- allowed-tools: Bash(npx specdx *)
4
+ allowed-tools: Bash(npx specdx:*)
5
5
  ---
6
6
 
7
7
  # Sprint Review — Spec Health Report
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: specdx-start-task
3
3
  description: Use when the user describes work they're about to do, mentions implementing a feature, asks to start a task, or says 'implement', 'build', 'add', 'fix', or 'refactor'. Loads relevant spec context before coding.
4
- allowed-tools: Bash(npx specdx *)
4
+ allowed-tools: Bash(npx specdx:*)
5
5
  ---
6
6
 
7
7
  # Load Spec Context
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: specdx-verify
3
3
  description: "[experimental — built on sdx check, whose static analysis can be noisy] Use when the user says 'verify', 'check against spec', 'does this match the spec', 'review implementation', or after completing a feature. Runs spec-to-implementation analysis and reviews findings."
4
- allowed-tools: Bash(npx specdx *), Read
4
+ allowed-tools: Bash(npx specdx:*) Read
5
5
  ---
6
6
 
7
7
  # Verify Implementation Against Specs
@@ -4,9 +4,9 @@ import "./chunk-5WRI5ZAA.js";
4
4
  import { defineCommand } from "citty";
5
5
 
6
6
  // ../skills/dist/install.js
7
- import { mkdir, writeFile, readFile, stat } from "fs/promises";
7
+ import { mkdir, writeFile, readFile, stat, readdir } from "fs/promises";
8
8
  import { statSync } from "fs";
9
- import { join, dirname } from "path";
9
+ import { join, dirname, relative } from "path";
10
10
  import { fileURLToPath } from "url";
11
11
  var __dirname = dirname(fileURLToPath(import.meta.url));
12
12
  var SKILL_NAMES = [
@@ -29,23 +29,39 @@ function getSkillSourceDir() {
29
29
  return join(__dirname, "..", "skills");
30
30
  }
31
31
  }
32
+ async function filesUnder(dir, base = dir) {
33
+ const entries = await readdir(dir, { withFileTypes: true });
34
+ const files = [];
35
+ for (const entry of entries) {
36
+ const full = join(dir, entry.name);
37
+ if (entry.isDirectory()) {
38
+ files.push(...await filesUnder(full, base));
39
+ } else {
40
+ files.push(relative(base, full));
41
+ }
42
+ }
43
+ return files;
44
+ }
32
45
  async function installSkills(projectDir) {
33
46
  const sourceDir = getSkillSourceDir();
34
- const commandsDir = join(projectDir, ".claude", "commands");
47
+ const skillsDir = join(projectDir, ".claude", "skills");
35
48
  const installed = [];
36
49
  const updated = [];
37
- await mkdir(commandsDir, { recursive: true });
50
+ await mkdir(skillsDir, { recursive: true });
38
51
  for (const skillName of SKILL_NAMES) {
39
- const sourcePath = join(sourceDir, `${skillName}.md`);
40
- const targetPath = join(commandsDir, `${skillName}.md`);
41
- const content = await readFile(sourcePath, "utf-8");
52
+ const sourcePath = join(sourceDir, skillName);
53
+ const targetPath = join(skillsDir, skillName);
42
54
  let exists = false;
43
55
  try {
44
- await stat(targetPath);
56
+ await stat(join(targetPath, "SKILL.md"));
45
57
  exists = true;
46
58
  } catch {
47
59
  }
48
- await writeFile(targetPath, content, "utf-8");
60
+ for (const file of await filesUnder(sourcePath)) {
61
+ const target = join(targetPath, file);
62
+ await mkdir(dirname(target), { recursive: true });
63
+ await writeFile(target, await readFile(join(sourcePath, file), "utf-8"), "utf-8");
64
+ }
49
65
  if (exists) {
50
66
  updated.push(skillName);
51
67
  } else {
@@ -78,7 +94,7 @@ var skills_default = defineCommand({
78
94
  for (const file of result.installed) console.log(` \u2713 Installed ${file}`);
79
95
  for (const file of result.updated) console.log(` \u2713 Updated ${file}`);
80
96
  console.log(`
81
- Skills installed to .claude/commands/`);
97
+ Skills installed to .claude/skills/`);
82
98
  } catch (err) {
83
99
  console.error(`
84
100
  \u2717 ${err.message}
@@ -92,4 +108,4 @@ var skills_default = defineCommand({
92
108
  export {
93
109
  skills_default as default
94
110
  };
95
- //# sourceMappingURL=skills-EQTVRLER.js.map
111
+ //# sourceMappingURL=skills-N7ZDWOJM.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/commands/skills.ts","../../skills/src/install.ts"],"sourcesContent":["import { defineCommand } from \"citty\";\nimport { installSkills } from \"@specdx/skills\";\n\nexport default defineCommand({\n meta: { name: \"skills\", description: \"Manage specdx skills for AI coding tools\" },\n subCommands: {\n install: defineCommand({\n meta: { name: \"install\", description: \"Install Claude Code skill files\" },\n args: {\n dir: {\n type: \"string\",\n description: \"Target directory (default: current directory)\",\n default: \".\",\n },\n },\n async run({ args }) {\n try {\n const result = await installSkills(args.dir);\n if (result.installed.length === 0 && result.updated.length === 0) {\n console.log(\" No skill files to install.\");\n return;\n }\n for (const file of result.installed) console.log(` ✓ Installed ${file}`);\n for (const file of result.updated) console.log(` ✓ Updated ${file}`);\n console.log(`\\n Skills installed to .claude/skills/`);\n } catch (err) {\n console.error(`\\n ✗ ${(err as Error).message}\\n`);\n process.exit(1);\n }\n },\n }),\n },\n});\n","import { mkdir, writeFile, readFile, stat, readdir } from \"node:fs/promises\";\nimport { statSync } from \"node:fs\";\nimport { join, dirname, relative } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\n\n/** Skill directory names. Each holds a SKILL.md plus optional bundled resources. */\nexport const SKILL_NAMES = [\n \"specdx-start-task\",\n \"specdx-author-spec\",\n \"specdx-pre-commit\",\n \"specdx-sprint-review\",\n \"specdx-plan-from-spec\",\n \"specdx-onboard\",\n \"specdx-verify\",\n \"specdx-review-spec\",\n \"specdx-check-drift\",\n];\n\nexport interface InstallResult {\n installed: string[];\n updated: string[];\n}\n\nfunction getSkillSourceDir(): string {\n // When bundled: skills at __dirname/skills (sibling of bundle)\n // In dev: skills at __dirname/../skills (sibling of src/)\n const bundledPath = join(__dirname, \"skills\");\n try {\n statSync(bundledPath);\n return bundledPath;\n } catch {\n return join(__dirname, \"..\", \"skills\");\n }\n}\n\n/** Every file under a directory, as paths relative to it. */\nasync function filesUnder(dir: string, base = dir): Promise<string[]> {\n const entries = await readdir(dir, { withFileTypes: true });\n const files: string[] = [];\n for (const entry of entries) {\n const full = join(dir, entry.name);\n if (entry.isDirectory()) {\n files.push(...(await filesUnder(full, base)));\n } else {\n files.push(relative(base, full));\n }\n }\n return files;\n}\n\n/**\n * Install skills into a project's `.claude/skills/`.\n *\n * The Agent Skills specification defines a skill as a *directory* containing a\n * `SKILL.md`, so the whole directory is copied -- `references/` and any other\n * bundled resources included. Skills previously shipped as flat files under\n * `.claude/commands/`, which made them slash commands rather than skills.\n */\nexport async function installSkills(projectDir: string): Promise<InstallResult> {\n const sourceDir = getSkillSourceDir();\n const skillsDir = join(projectDir, \".claude\", \"skills\");\n const installed: string[] = [];\n const updated: string[] = [];\n\n await mkdir(skillsDir, { recursive: true });\n\n for (const skillName of SKILL_NAMES) {\n const sourcePath = join(sourceDir, skillName);\n const targetPath = join(skillsDir, skillName);\n\n let exists = false;\n try {\n await stat(join(targetPath, \"SKILL.md\"));\n exists = true;\n } catch {\n // Not installed yet\n }\n\n for (const file of await filesUnder(sourcePath)) {\n const target = join(targetPath, file);\n await mkdir(dirname(target), { recursive: true });\n await writeFile(target, await readFile(join(sourcePath, file), \"utf-8\"), \"utf-8\");\n }\n\n if (exists) {\n updated.push(skillName);\n } else {\n installed.push(skillName);\n }\n }\n\n return { installed, updated };\n}\n"],"mappings":";;;AAAA,SAAS,qBAAqB;;;ACA9B,SAAS,OAAO,WAAW,UAAU,MAAM,eAAe;AAC1D,SAAS,gBAAgB;AACzB,SAAS,MAAM,SAAS,gBAAgB;AACxC,SAAS,qBAAqB;AAE9B,IAAM,YAAY,QAAQ,cAAc,YAAY,GAAG,CAAC;AAGjD,IAAM,cAAc;EACzB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAQF,SAAS,oBAAiB;AAGxB,QAAM,cAAc,KAAK,WAAW,QAAQ;AAC5C,MAAI;AACF,aAAS,WAAW;AACpB,WAAO;EACT,QAAQ;AACN,WAAO,KAAK,WAAW,MAAM,QAAQ;EACvC;AACF;AAGA,eAAe,WAAW,KAAa,OAAO,KAAG;AAC/C,QAAM,UAAU,MAAM,QAAQ,KAAK,EAAE,eAAe,KAAI,CAAE;AAC1D,QAAM,QAAkB,CAAA;AACxB,aAAW,SAAS,SAAS;AA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A,MACF;AAAA,MACA,MAAM,IAAI,EAAE,KAAK,GAAG;AAClB,YAAI;AACF,gBAAM,SAAS,MAAM,cAAc,KAAK,GAAG;AAC3C,cAAI,OAAO,UAAU,WAAW,KAAK,OAAO,QAAQ,WAAW,GAAG;AAChE,oBAAQ,IAAI,8BAA8B;AAC1C;AAAA,UACF;AACA,qBAAW,QAAQ,OAAO,UAAW,SAAQ,IAAI,sBAAiB,IAAI,EAAE;AACxE,qBAAW,QAAQ,OAAO,QAAS,SAAQ,IAAI,oBAAe,IAAI,EAAE;AACpE,kBAAQ,IAAI;AAAA,sCAAyC;AAAA,QACvD,SAAS,KAAK;AACZ,kBAAQ,MAAM;AAAA,WAAU,IAAc,OAAO;AAAA,CAAI;AACjD,kBAAQ,KAAK,CAAC;AAAA,QAChB;AAAA,MACF;AAAA,IACF,CAAC;AAAA,EACH;AACF,CAAC;","names":[]}
package/hooks/hooks.json CHANGED
@@ -1,8 +1,14 @@
1
1
  {
2
- "hooks": [
3
- {
4
- "event": "SessionStart",
5
- "command": "./hooks/session-start"
6
- }
7
- ]
2
+ "hooks": {
3
+ "SessionStart": [
4
+ {
5
+ "hooks": [
6
+ {
7
+ "type": "command",
8
+ "command": "\"${CLAUDE_PLUGIN_ROOT}\"/hooks/session-start"
9
+ }
10
+ ]
11
+ }
12
+ ]
13
+ }
8
14
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "specdx",
3
- "version": "0.4.0-alpha.13",
3
+ "version": "0.4.0-alpha.15",
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",
@@ -69,8 +69,8 @@
69
69
  "@specdx/lint": "0.0.0",
70
70
  "@specdx/mcp": "0.0.0",
71
71
  "@specdx/pack": "0.0.0",
72
- "@specdx/schema": "0.0.0",
73
- "@specdx/skills": "0.0.0"
72
+ "@specdx/skills": "0.0.0",
73
+ "@specdx/schema": "0.0.0"
74
74
  },
75
75
  "publishConfig": {
76
76
  "access": "public"
@@ -1,94 +0,0 @@
1
- import {
2
- DEFAULT_DIFF_CONFIG,
3
- DiffError,
4
- diffBetweenRefs
5
- } from "./chunk-4HPWTWBL.js";
6
- import {
7
- loadConfig
8
- } from "./chunk-Z77VQUZ3.js";
9
- import "./chunk-SJCIM4TC.js";
10
- import "./chunk-5WRI5ZAA.js";
11
-
12
- // src/commands/changelog.ts
13
- import { defineCommand } from "citty";
14
- import { join } from "path";
15
- async function runChangelog(options) {
16
- const configDir = process.cwd();
17
- const config = await loadConfig(void 0, configDir);
18
- const fromRef = options.from ?? config.diff?.baseline_ref ?? DEFAULT_DIFF_CONFIG.baseline_ref;
19
- const toRef = options.to ?? "HEAD";
20
- const configPath = join(configDir, "spec.config.yaml");
21
- const result = await diffBetweenRefs(configPath, fromRef, toRef);
22
- const lines = [];
23
- lines.push(`## Spec Changes (${fromRef}..${toRef})
24
- `);
25
- if (result.diffs.length > 0) {
26
- lines.push("### Modified");
27
- for (const diff of result.diffs) {
28
- const sections = diff.sections.map((s) => s.heading).join(", ");
29
- const versionChange = diff.frontmatter.find((f) => f.field === "version");
30
- const versionStr = versionChange ? ` (${String(versionChange.before)} \u2192 ${String(versionChange.after)})` : "";
31
- lines.push(`- **${diff.specId}**${versionStr} \u2014 ${sections || "frontmatter only"}`);
32
- }
33
- lines.push("");
34
- }
35
- if (result.added.length > 0) {
36
- lines.push("### Added");
37
- for (const id of result.added) {
38
- lines.push(`- **${id}**`);
39
- }
40
- lines.push("");
41
- }
42
- if (result.removed.length > 0) {
43
- lines.push("### Removed");
44
- for (const id of result.removed) {
45
- lines.push(`- **${id}**`);
46
- }
47
- lines.push("");
48
- }
49
- const allDownstream = result.impact.flatMap((i) => i.downstream);
50
- if (allDownstream.length > 0) {
51
- lines.push("### Downstream Impact");
52
- for (const d of allDownstream) {
53
- lines.push(`- ${d.specId} may be stale (${d.reason})`);
54
- }
55
- lines.push("");
56
- }
57
- if (result.diffs.length === 0 && result.added.length === 0 && result.removed.length === 0) {
58
- lines.push("No spec changes detected.\n");
59
- }
60
- return lines.join("\n");
61
- }
62
- var changelog_default = defineCommand({
63
- meta: { name: "changelog", description: "Generate changelog of spec changes between git refs" },
64
- args: {
65
- from: { type: "string", description: "Start git ref (default: from config or 'main')" },
66
- to: { type: "string", description: "End git ref (default: HEAD)" }
67
- },
68
- async run({ args }) {
69
- try {
70
- try {
71
- const output = await runChangelog(args);
72
- console.log(output);
73
- } catch (err) {
74
- if (err instanceof DiffError) {
75
- console.error(`
76
- \u2717 ${err.message}
77
- `);
78
- process.exit(1);
79
- }
80
- throw err;
81
- }
82
- } catch (err) {
83
- console.error(`
84
- \u2717 ${err.message}
85
- `);
86
- process.exit(1);
87
- }
88
- }
89
- });
90
- export {
91
- changelog_default as default,
92
- runChangelog
93
- };
94
- //# sourceMappingURL=changelog-COHY6ILK.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/commands/changelog.ts"],"sourcesContent":["import { defineCommand } from \"citty\";\nimport { join } from \"node:path\";\nimport { loadConfig } from \"@specdx/core\";\nimport { diffBetweenRefs, DEFAULT_DIFF_CONFIG, DiffError } from \"@specdx/diff\";\n\nexport interface RunChangelogOptions {\n from?: string;\n to?: string;\n}\n\nexport async function runChangelog(options: RunChangelogOptions): Promise<string> {\n const configDir = process.cwd();\n const config = await loadConfig(undefined, configDir);\n\n const fromRef = options.from ?? config.diff?.baseline_ref ?? DEFAULT_DIFF_CONFIG.baseline_ref;\n const toRef = options.to ?? \"HEAD\";\n\n const configPath = join(configDir, \"spec.config.yaml\");\n\n const result = await diffBetweenRefs(configPath, fromRef, toRef);\n\n const lines: string[] = [];\n lines.push(`## Spec Changes (${fromRef}..${toRef})\\n`);\n\n if (result.diffs.length > 0) {\n lines.push(\"### Modified\");\n for (const diff of result.diffs) {\n const sections = diff.sections.map((s) => s.heading).join(\", \");\n const versionChange = diff.frontmatter.find((f) => f.field === \"version\");\n const versionStr = versionChange\n ? ` (${String(versionChange.before)} \\u2192 ${String(versionChange.after)})`\n : \"\";\n lines.push(`- **${diff.specId}**${versionStr} \\u2014 ${sections || \"frontmatter only\"}`);\n }\n lines.push(\"\");\n }\n\n if (result.added.length > 0) {\n lines.push(\"### Added\");\n for (const id of result.added) {\n lines.push(`- **${id}**`);\n }\n lines.push(\"\");\n }\n\n if (result.removed.length > 0) {\n lines.push(\"### Removed\");\n for (const id of result.removed) {\n lines.push(`- **${id}**`);\n }\n lines.push(\"\");\n }\n\n const allDownstream = result.impact.flatMap((i) => i.downstream);\n if (allDownstream.length > 0) {\n lines.push(\"### Downstream Impact\");\n for (const d of allDownstream) {\n lines.push(`- ${d.specId} may be stale (${d.reason})`);\n }\n lines.push(\"\");\n }\n\n if (result.diffs.length === 0 && result.added.length === 0 && result.removed.length === 0) {\n lines.push(\"No spec changes detected.\\n\");\n }\n\n return lines.join(\"\\n\");\n}\n\nexport default defineCommand({\n meta: { name: \"changelog\", description: \"Generate changelog of spec changes between git refs\" },\n args: {\n from: { type: \"string\", description: \"Start git ref (default: from config or 'main')\" },\n to: { type: \"string\", description: \"End git ref (default: HEAD)\" },\n },\n async run({ args }) {\n try {\n try {\n const output = await runChangelog(args);\n console.log(output);\n } catch (err) {\n if (err instanceof DiffError) {\n console.error(`\\n \\u2717 ${err.message}\\n`);\n process.exit(1);\n }\n throw err;\n }\n } catch (err) {\n console.error(`\\n ✗ ${(err as Error).message}\\n`);\n process.exit(1);\n }\n },\n});\n"],"mappings":";;;;;;;;;;;;AAAA,SAAS,qBAAqB;AAC9B,SAAS,YAAY;AASrB,eAAsB,aAAa,SAA+C;AAChF,QAAM,YAAY,QAAQ,IAAI;AAC9B,QAAM,SAAS,MAAM,WAAW,QAAW,SAAS;AAEpD,QAAM,UAAU,QAAQ,QAAQ,OAAO,MAAM,gBAAgB,oBAAoB;AACjF,QAAM,QAAQ,QAAQ,MAAM;AAE5B,QAAM,aAAa,KAAK,WAAW,kBAAkB;AAErD,QAAM,SAAS,MAAM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OAAO,QAAQ,WAAW,GAAG;AACzF,UAAM,KAAK,6BAA6B;AAAA,EAC1C;AAEA,SAAO,MAAM,KAAK,IAAI;AACxB;AAEA,IAAO,oBAAQ,cAAc;AAAA,EAC3B,MAAM,EAAE,MAAM,aAAa,aAAa,sDAAsD;AAAA,EAC9F,MAAM;AAAA,IACJ,MAAM,EAAE,MAAM,UAAU,aAAa,iDAAiD;AAAA,IACtF,IAAI,EAAE,MAAM,UAAU,aAAa,8BAA8B;AAAA,EACnE;AAAA,EACA,MAAM,IAAI,EAAE,KAAK,GAAG;AAClB,QAAI;AACF,UAAI;AACF,cAAM,SAAS,MAAM,aAAa,IAAI;AACtC,gBAAQ,IAAI,MAAM;AAAA,MACpB,SAAS,KAAK;AACZ,YAAI,eAAe,WAAW;AAC5B,kBAAQ,MAAM;AAAA,WAAc,IAAI,OAAO;AAAA,CAAI;AAC3C,kBAAQ,KAAK,CAAC;AAAA,QAChB;AACA,cAAM;AAAA,MACR;AAAA,IACF,SAAS,KAAK;AACZ,cAAQ,MAAM;AAAA,WAAU,IAAc,OAAO;AAAA,CAAI;AACjD,cAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF;AACF,CAAC;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/commands/diff.ts"],"sourcesContent":["import { defineCommand } from \"citty\";\nimport { join } from \"node:path\";\nimport { diffBetweenRefs, DEFAULT_DIFF_CONFIG, DiffError } from \"@specdx/diff\";\nimport { loadConfig } from \"@specdx/core\";\nimport type { DiffResult } from \"@specdx/diff\";\n\nexport interface RunDiffOptions {\n base?: string;\n head?: string;\n spec?: string;\n format?: string;\n /** Compare the base ref against the working tree instead of a head ref. */\n working?: boolean;\n}\n\nexport async function runDiff(options: RunDiffOptions): Promise<DiffResult> {\n const configDir = process.cwd();\n const config = await loadConfig(undefined, configDir);\n\n const baseRef = options.base ?? config.diff?.baseline_ref ?? DEFAULT_DIFF_CONFIG.baseline_ref;\n const headRef = options.head ?? \"HEAD\";\n\n const configPath = join(configDir, \"spec.config.yaml\");\n\n const result = await diffBetweenRefs(configPath, baseRef, headRef, {\n working: options.working ?? false,\n });\n\n if (options.spec) {\n result.diffs = result.diffs.filter((d) => d.specId === options.spec);\n result.impact = result.impact.filter((i) => i.changedSpec === options.spec);\n }\n\n return result;\n}\n\nexport default defineCommand({\n meta: { name: \"diff\", description: \"Show spec changes and downstream impact\" },\n args: {\n base: { type: \"string\", description: \"Base git ref (default: from config or 'main')\" },\n head: { type: \"string\", description: \"Head git ref (default: HEAD)\" },\n working: {\n type: \"boolean\",\n description: \"Compare the base ref against the working tree (includes uncommitted specs)\",\n default: false,\n },\n spec: { type: \"string\", description: \"Scope to a single spec ID\" },\n format: {\n type: \"string\",\n description: \"Output format: pretty, json\",\n default: \"pretty\",\n },\n },\n async run({ args }) {\n try {\n try {\n const result = await runDiff({\n base: args.base,\n head: args.head,\n spec: args.spec,\n format: args.format,\n working: args.working,\n });\n\n if (args.format === \"json\") {\n console.log(JSON.stringify(result, null, 2));\n return;\n }\n\n // A ref-to-ref comparison cannot see the working tree, so an unqualified\n // \"no changes\" would be a false all-clear for anyone about to commit.\n const printUncommittedWarning = (): void => {\n if (result.uncommittedSpecFiles.length === 0) return;\n const count = result.uncommittedSpecFiles.length;\n console.log(\n `\\n \\u26a0 ${count} spec file(s) changed in the working tree are not covered by this comparison:`,\n );\n for (const file of result.uncommittedSpecFiles) {\n console.log(` ${file}`);\n }\n console.log(\" Run with --working to include them.\");\n };\n\n // Pretty format\n if (result.diffs.length === 0 && result.added.length === 0 && result.removed.length === 0) {\n console.log(\" \\u2713 No spec changes detected.\");\n printUncommittedWarning();\n return;\n }\n\n console.log(result.summary);\n console.log();\n\n for (const diff of result.diffs) {\n console.log(` ${diff.specId}:`);\n for (const fc of diff.frontmatter) {\n const detail =\n fc.before !== undefined || fc.after !== undefined\n ? ` (${String(fc.before)} \\u2192 ${String(fc.after)})`\n : \"\";\n console.log(` ${fc.type}: ${fc.field}${detail}`);\n }\n for (const sc of diff.sections) {\n console.log(` ${sc.type}: ${sc.heading}`);\n }\n }\n\n if (result.added.length > 0) {\n console.log(`\\n Added: ${result.added.join(\", \")}`);\n }\n if (result.removed.length > 0) {\n console.log(`\\n Removed: ${result.removed.join(\", \")}`);\n }\n\n if (result.impact.length > 0) {\n console.log(\"\\n Downstream Impact:\");\n for (const impact of result.impact) {\n for (const d of impact.downstream) {\n console.log(\n ` ${d.specId} \\u2014 staleness: ${d.staleness.toFixed(2)} \\u2014 ${d.reason}`,\n );\n }\n }\n }\n\n printUncommittedWarning();\n } catch (err) {\n if (err instanceof DiffError) {\n console.error(`\\n \\u2717 ${err.message}\\n`);\n process.exit(1);\n }\n throw err;\n }\n } catch (err) {\n console.error(`\\n ✗ ${(err as Error).message}\\n`);\n process.exit(1);\n }\n },\n});\n"],"mappings":";;;;;;;;;;;;AAAA,SAAS,qBAAqB;AAC9B,SAAS,YAAY;AAcrB,eAAsB,QAAQ,SAA8C;AAC1E,QAAM,YAAY,QAAQ,IAAI;AAC9B,QAAM,SAAS,MAAM,WAAW,QAAW,SAAS;AAEpD,QAAM,UAAU,QAAQ,QAAQ,OAAO,MAAM,gBAAgB,oBAAoB;AACjF,QAAM,UAAU,QAAQ,QAAQ;AAEhC,QAAM,aAAa,KAAK,WAAW,kBAAkB;AAErD,QAAM,SAAS,MAAM,gBAAgB,YAAY,SAAS,SAAS;AAAA,IACjE,SAAS,QAAQ,WAAW;AAAA,EAC9B,CAAC;AAED,MAAI,QAAQ,MAAM;AAChB,WAAO,QAAQ,OAAO,MAAM,OAAO,CAAC,MAAM,EAAE,WAAW,QAAQ,IAAI;AACnE,WAAO,SAAS,OAAO,OAAO,OAAO,CAAC,MAAM,EAAE,gBAAgB,QAAQ,IAAI;AAAA,EAC5E;AAEA,SAAO;AACT;AAEA,IAAO,eAAQ,cAAc;AAAA,EAC3B,MAAM,EAAE,MAAM,QAAQ,aAAa,0CAA0C;AAAA,EAC7E,MAAM;AAAA,IACJ,MAAM,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["import { defineCommand } from \"citty\";\nimport { loadConfig, parseSpec, buildGraph, resolveGlob } from \"@specdx/core\";\nimport type { ParsedSpec } from \"@specdx/core\";\n\ninterface ExplainResult {\n project: string;\n description?: string;\n specCount: number;\n byType: Record<string, number>;\n byStatus: Record<string, number>;\n specs: { id: string; type: string; title: string; status: string; firstLine: string }[];\n graph: string[];\n}\n\nexport async function runExplain(_options: { format?: string } = {}): Promise<ExplainResult> {\n const configDir = process.cwd();\n const config = await loadConfig(undefined, configDir);\n\n // Parse all specs\n const specs: ParsedSpec[] = [];\n for (const [, entry] of Object.entries(config.specs)) {\n const paths = await resolveGlob(entry.path, configDir);\n for (const p of paths) {\n specs.push(await parseSpec(p));\n }\n }\n\n // Count by type and status\n const byType: Record<string, number> = {};\n const byStatus: Record<string, number> = {};\n for (const spec of specs) {\n const type = (spec.frontmatter.type as string) || \"unknown\";\n const status = (spec.frontmatter.status as string) || \"unknown\";\n byType[type] = (byType[type] ?? 0) + 1;\n byStatus[status] = (byStatus[status] ?? 0) + 1;\n }\n\n // Build spec summaries — first sentence of first section content\n const specSummaries = specs.map((spec) => {\n const firstSection = spec.parsedSections[0];\n const firstLine =\n firstSection?.content\n ?.split(\"\\n\")\n .find((l) => l.trim().length > 0)\n ?.trim() ?? \"\";\n const truncated = firstLine.slice(0, 120) + (firstLine.length > 120 ? \"...\" : \"\");\n return {\n id: spec.frontmatter.id as string,\n type: spec.frontmatter.type as string,\n title: spec.frontmatter.title as string,\n status: spec.frontmatter.status as string,\n firstLine: truncated,\n };\n });\n\n // Build dependency graph lines\n const graph = buildGraph(config);\n const graphLines: string[] = [];\n for (const node of graph.nodes) {\n const downstream = graph.edges.filter((e) => e.from === node).map((e) => e.to);\n if (downstream.length > 0) {\n graphLines.push(`${node} → ${downstream.join(\", \")}`);\n } else {\n graphLines.push(node);\n }\n }\n\n return {\n project: config.project?.name ?? \"unknown\",\n description: config.project?.description,\n specCount: specs.length,\n byType,\n byStatus,\n specs: specSummaries,\n graph: graphLines,\n };\n}\n\nexport default defineCommand({\n meta: { name: \"explain\", description: \"Explain the spec suite for onboarding\" },\n args: {\n format: { type: \"string\", description: \"Output format: pretty, json\", default: \"pretty\" },\n },\n async run({ args }) {\n try {\n const result = await runExplain({ format: args.format });\n\n if (args.format === \"json\") {\n console.log(JSON.stringify(result, null, 2));\n return;\n }\n\n // Pretty format\n console.log(`\\n ${result.project}`);\n if (result.description) {\n console.log(` ${result.description}`);\n }\n console.log(\n `\\n ${result.specCount} specs: ${Object.entries(result.byType)\n .map(([k, v]) => `${v} ${k}`)\n .join(\", \")}`,\n );\n console.log(\n ` Status: ${Object.entries(result.byStatus)\n .map(([k, v]) => `${v} ${k}`)\n .join(\", \")}`,\n );\n\n console.log(\"\\n Specs:\");\n for (const spec of result.specs) {\n console.log(` ${spec.id} (${spec.type}, ${spec.status}) — ${spec.title}`);\n if (spec.firstLine) {\n console.log(` ${spec.firstLine}`);\n }\n }\n\n console.log(\"\\n Dependencies:\");\n for (const line of result.graph) {\n console.log(` ${line}`);\n }\n console.log();\n } catch (err) {\n console.error(`\\n ✗ ${(err as Error).message}\\n`);\n process.exit(1);\n }\n },\n});\n"],"mappings":";;;;;;;;;;AAAA,SAAS,qBAAqB;AAc9B,eAAsB,WAAW,WAAgC,CAAC,GAA2B;AAC3F,QAAM,YAAY,QAAQ,IAAI;AAC9B,QAAM,SAAS,MAAM,WAAW,QAAW,SAAS;AAGpD,QAAM,QAAsB,CAAC;AAC7B,aAAW,CAAC,EAAE,KAAK,KAAK,OAAO,QAAQ,OAAO,KAAK,GAAG;AACpD,UAAM,QAAQ,MAAM,YAAY,MAAM,MAAM,SAAS;AACrD,eAAW,KAAK,OAAO;AACrB,YAAM,KAAK,MAAM,UAAU,CAAC,CAAC;AAAA,IAC/B;AAAA,EACF;AAGA,QAAM,SAAiC,CAAC;AACxC,QAAM,WAAmC,CAAC;AAC1C,aAAW,QAAQ,OAAO;AACxB,UAAM,OAAQ,KAAK,YAAY,QAAmB;AAClD,UAA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AAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF;AACF,CAAC;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/commands/skills.ts","../../skills/src/install.ts"],"sourcesContent":["import { defineCommand } from \"citty\";\nimport { installSkills } from \"@specdx/skills\";\n\nexport default defineCommand({\n meta: { name: \"skills\", description: \"Manage specdx skills for AI coding tools\" },\n subCommands: {\n install: defineCommand({\n meta: { name: \"install\", description: \"Install Claude Code skill files\" },\n args: {\n dir: {\n type: \"string\",\n description: \"Target directory (default: current directory)\",\n default: \".\",\n },\n },\n async run({ args }) {\n try {\n const result = await installSkills(args.dir);\n if (result.installed.length === 0 && result.updated.length === 0) {\n console.log(\" No skill files to install.\");\n return;\n }\n for (const file of result.installed) console.log(` ✓ Installed ${file}`);\n for (const file of result.updated) console.log(` ✓ Updated ${file}`);\n console.log(`\\n Skills installed to .claude/commands/`);\n } catch (err) {\n console.error(`\\n ✗ ${(err as Error).message}\\n`);\n process.exit(1);\n }\n },\n }),\n },\n});\n","import { mkdir, writeFile, readFile, stat } from \"node:fs/promises\";\nimport { statSync } from \"node:fs\";\nimport { join, dirname } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\n\n/** Skill file names (without .md extension) */\nexport const SKILL_NAMES = [\n \"specdx-start-task\",\n \"specdx-author-spec\",\n \"specdx-pre-commit\",\n \"specdx-sprint-review\",\n \"specdx-plan-from-spec\",\n \"specdx-onboard\",\n \"specdx-verify\",\n \"specdx-review-spec\",\n \"specdx-check-drift\",\n];\n\nexport interface InstallResult {\n installed: string[];\n updated: string[];\n}\n\nfunction getSkillSourceDir(): string {\n // When bundled: skills at __dirname/skills (sibling of bundle)\n // In dev: skills at __dirname/../skills (sibling of src/)\n const bundledPath = join(__dirname, \"skills\");\n try {\n statSync(bundledPath);\n return bundledPath;\n } catch {\n return join(__dirname, \"..\", \"skills\");\n }\n}\n\nexport async function installSkills(projectDir: string): Promise<InstallResult> {\n const sourceDir = getSkillSourceDir();\n const commandsDir = join(projectDir, \".claude\", \"commands\");\n const installed: string[] = [];\n const updated: string[] = [];\n\n await mkdir(commandsDir, { recursive: true });\n\n for (const skillName of SKILL_NAMES) {\n const sourcePath = join(sourceDir, `${skillName}.md`);\n const targetPath = join(commandsDir, `${skillName}.md`);\n\n const content = await readFile(sourcePath, \"utf-8\");\n\n // Check if target already exists\n let exists = false;\n try {\n await stat(targetPath);\n exists = true;\n } catch {\n // File doesn't exist\n }\n\n await writeFile(targetPath, content, \"utf-8\");\n\n if (exists) {\n updated.push(skillName);\n } else {\n installed.push(skillName);\n }\n }\n\n return { installed, updated };\n}\n"],"mappings":";;;AAAA,SAAS,qBAAqB;;;ACA9B,SAAS,OAAO,WAAW,UAAU,YAAY;AACjD,SAAS,gBAAgB;AACzB,SAAS,MAAM,eAAe;AAC9B,SAAS,qBAAqB;AAE9B,IAAM,YAAY,QAAQ,cAAc,YAAY,GAAG,CAAC;AAGjD,IAAM,cAAc;EACzB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAQF,SAAS,oBAAiB;AAGxB,QAAM,cAAc,KAAK,WAAW,QAAQ;AAC5C,MAAI;AACF,aAAS,WAAW;AACpB,WAAO;EACT,QAAQ;AACN,WAAO,KAAK,WAAW,MAAM,QAAQ;EACvC;AACF;AAEA,eAAsB,cAAc,YAAkB;AACpD,QAAM,YAAY,kBAAiB;AACnC,QAAM,cAAc,KAAK,YAAY,WAAW,UAAU;AAC1D,QAAM,YAAsB,CAAA;AAC5B,QAAM,UAAoB,CAAA;AAE1B,QAAM,MAAM,aAAa,EAAE,WAAW,KAAI,CAAE;AAE5C,aAAW,aAAa,aAAa;AACnC,UAAM,aAAa,KAAK,WAAW,GAAG,SAAS,KAAK;AACpD,UAAM,aAAa,KAAK,aAAa,GAAG,SAAS,KAAK;AAEtD,UAAM,UAAU,MAAM,SAAS,YAAY,OAAO;AAGlD,QAAI,SAAS;AACb,QAAI;AACF,YA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