specdx 0.3.0-alpha.2 → 0.4.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/dist/{changelog-URU2TFNM.js → changelog-OUP2RXWN.js} +4 -4
- package/dist/check-3XQYO3HU.js +109 -0
- package/dist/check-3XQYO3HU.js.map +1 -0
- package/dist/{pack-OJAC7JF2.js → chunk-4THCEWAK.js} +53 -169
- package/dist/chunk-4THCEWAK.js.map +1 -0
- package/dist/chunk-6BWZEAST.js +1051 -0
- package/dist/chunk-6BWZEAST.js.map +1 -0
- package/dist/{chunk-LU6M5O63.js → chunk-DDFLMRPC.js} +2 -2
- package/dist/chunk-HMXUNURD.js +490 -0
- package/dist/chunk-HMXUNURD.js.map +1 -0
- package/dist/{chunk-276J7LR6.js → chunk-PHR7AV6I.js} +2 -2
- package/dist/{chunk-XLEN6ZYM.js → chunk-ZX4HVL5M.js} +92 -4
- package/dist/chunk-ZX4HVL5M.js.map +1 -0
- package/dist/{diff-55PTEVB3.js → diff-275PLXYH.js} +4 -4
- package/dist/dist-PQCG2XXF.js +11 -0
- package/dist/dist-PQCG2XXF.js.map +1 -0
- package/dist/dist-QXLX77XG.js +279 -0
- package/dist/dist-QXLX77XG.js.map +1 -0
- package/dist/{explain-YXUILNEA.js → explain-I7AQMEEH.js} +3 -3
- package/dist/generate-PC7BIB7G.js +13 -0
- package/dist/generate-PC7BIB7G.js.map +1 -0
- package/dist/generate-story-7WHPPFHY.js +192 -0
- package/dist/generate-story-7WHPPFHY.js.map +1 -0
- package/dist/generate-test-plan-U5LMWGKX.js +154 -0
- package/dist/generate-test-plan-U5LMWGKX.js.map +1 -0
- package/dist/{graph-OWQJWVSN.js → graph-RCAPF55A.js} +3 -3
- package/dist/index.js +390 -16
- package/dist/index.js.map +1 -1
- package/dist/{lint-U7VLGS75.js → lint-XPAFMLZN.js} +4 -4
- package/dist/main.js +23 -14
- package/dist/main.js.map +1 -1
- package/dist/mcp-6RCSHMXD.js +17 -0
- package/dist/mcp-6RCSHMXD.js.map +1 -0
- package/dist/migrate-L7W5RHSS.js +56 -0
- package/dist/migrate-L7W5RHSS.js.map +1 -0
- package/dist/pack-QCOXMURY.js +167 -0
- package/dist/pack-QCOXMURY.js.map +1 -0
- package/dist/{ready-3OIF4QHM.js → ready-ZXG74W7Y.js} +5 -5
- package/dist/skills/specdx-check-drift.md +71 -0
- package/dist/skills/specdx-review-spec.md +77 -0
- package/dist/skills/specdx-verify.md +70 -0
- package/dist/{skills-XJYTWGDK.js → skills-3GBBWZW2.js} +5 -2
- package/dist/skills-3GBBWZW2.js.map +1 -0
- package/dist/{status-LYZUO6AJ.js → status-EKWK47O5.js} +5 -5
- package/dist/update-HIWDDEZQ.js +132 -0
- package/dist/update-HIWDDEZQ.js.map +1 -0
- package/dist/{validate-DOZZEZFC.js → validate-N2WSG75W.js} +3 -3
- package/package.json +3 -1
- package/dist/chunk-ATLVRGHI.js +0 -237
- package/dist/chunk-ATLVRGHI.js.map +0 -1
- package/dist/chunk-XLEN6ZYM.js.map +0 -1
- package/dist/pack-OJAC7JF2.js.map +0 -1
- package/dist/skills-XJYTWGDK.js.map +0 -1
- /package/dist/{changelog-URU2TFNM.js.map → changelog-OUP2RXWN.js.map} +0 -0
- /package/dist/{chunk-LU6M5O63.js.map → chunk-DDFLMRPC.js.map} +0 -0
- /package/dist/{chunk-276J7LR6.js.map → chunk-PHR7AV6I.js.map} +0 -0
- /package/dist/{diff-55PTEVB3.js.map → diff-275PLXYH.js.map} +0 -0
- /package/dist/{explain-YXUILNEA.js.map → explain-I7AQMEEH.js.map} +0 -0
- /package/dist/{graph-OWQJWVSN.js.map → graph-RCAPF55A.js.map} +0 -0
- /package/dist/{lint-U7VLGS75.js.map → lint-XPAFMLZN.js.map} +0 -0
- /package/dist/{ready-3OIF4QHM.js.map → ready-ZXG74W7Y.js.map} +0 -0
- /package/dist/{status-LYZUO6AJ.js.map → status-EKWK47O5.js.map} +0 -0
- /package/dist/{validate-DOZZEZFC.js.map → validate-N2WSG75W.js.map} +0 -0
|
@@ -4,15 +4,15 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
createLintEngine,
|
|
6
6
|
getPreset
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-HMXUNURD.js";
|
|
8
8
|
import {
|
|
9
9
|
buildGraph,
|
|
10
10
|
createLogger,
|
|
11
11
|
loadConfig,
|
|
12
12
|
parseSpec,
|
|
13
13
|
resolveGlob
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-
|
|
14
|
+
} from "./chunk-PHR7AV6I.js";
|
|
15
|
+
import "./chunk-ZX4HVL5M.js";
|
|
16
16
|
|
|
17
17
|
// src/commands/lint.ts
|
|
18
18
|
import { defineCommand } from "citty";
|
|
@@ -108,4 +108,4 @@ export {
|
|
|
108
108
|
lint_default as default,
|
|
109
109
|
runLint
|
|
110
110
|
};
|
|
111
|
-
//# sourceMappingURL=lint-
|
|
111
|
+
//# sourceMappingURL=lint-XPAFMLZN.js.map
|
package/dist/main.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
REQUIRED_SECTIONS
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-ZX4HVL5M.js";
|
|
5
5
|
|
|
6
6
|
// src/main.ts
|
|
7
7
|
import { defineCommand as defineCommand2, runMain } from "citty";
|
|
@@ -24,12 +24,16 @@ var TEMPLATE_SPECS = {
|
|
|
24
24
|
{ filename: "technical-design.md", type: "technical-design" },
|
|
25
25
|
{ filename: "api-contract.md", type: "api-contract" },
|
|
26
26
|
{ filename: "test-plan.md", type: "test-plan" }
|
|
27
|
-
]
|
|
27
|
+
],
|
|
28
|
+
quick: [{ filename: "quick-spec.md", type: "quick-spec" }],
|
|
29
|
+
context: [{ filename: "project-context.md", type: "project-context" }]
|
|
28
30
|
};
|
|
29
31
|
var TEMPLATE_EXTRA_DIRS = {
|
|
30
32
|
lightweight: [],
|
|
31
33
|
bmad: ["specs/stories", "specs/adr"],
|
|
32
|
-
"api-first": []
|
|
34
|
+
"api-first": [],
|
|
35
|
+
quick: [],
|
|
36
|
+
context: []
|
|
33
37
|
};
|
|
34
38
|
function specIdFromFilename(filename) {
|
|
35
39
|
return filename.replace(/\.md$/, "");
|
|
@@ -112,7 +116,7 @@ var init_default = defineCommand({
|
|
|
112
116
|
},
|
|
113
117
|
async run({ args }) {
|
|
114
118
|
const { name, template, dir } = args;
|
|
115
|
-
const validTemplates = ["lightweight", "bmad", "api-first"];
|
|
119
|
+
const validTemplates = ["lightweight", "bmad", "api-first", "quick", "context"];
|
|
116
120
|
if (!validTemplates.includes(template)) {
|
|
117
121
|
console.error(`Unknown template: ${template}. Choose from: ${validTemplates.join(", ")}`);
|
|
118
122
|
process.exit(1);
|
|
@@ -128,16 +132,21 @@ var main = defineCommand2({
|
|
|
128
132
|
meta: { name: "specdx", version: "0.0.0", description: "specdx \u2014 Spec Developer Experience" },
|
|
129
133
|
subCommands: {
|
|
130
134
|
init: init_default,
|
|
131
|
-
lint: () => import("./lint-
|
|
132
|
-
validate: () => import("./validate-
|
|
133
|
-
graph: () => import("./graph-
|
|
134
|
-
skills: () => import("./skills-
|
|
135
|
-
pack: () => import("./pack-
|
|
136
|
-
diff: () => import("./diff-
|
|
137
|
-
status: () => import("./status-
|
|
138
|
-
explain: () => import("./explain-
|
|
139
|
-
changelog: () => import("./changelog-
|
|
140
|
-
|
|
135
|
+
lint: () => import("./lint-XPAFMLZN.js").then((m) => m.default),
|
|
136
|
+
validate: () => import("./validate-N2WSG75W.js").then((m) => m.default),
|
|
137
|
+
graph: () => import("./graph-RCAPF55A.js").then((m) => m.default),
|
|
138
|
+
skills: () => import("./skills-3GBBWZW2.js").then((m) => m.default),
|
|
139
|
+
pack: () => import("./pack-QCOXMURY.js").then((m) => m.default),
|
|
140
|
+
diff: () => import("./diff-275PLXYH.js").then((m) => m.default),
|
|
141
|
+
status: () => import("./status-EKWK47O5.js").then((m) => m.default),
|
|
142
|
+
explain: () => import("./explain-I7AQMEEH.js").then((m) => m.default),
|
|
143
|
+
changelog: () => import("./changelog-OUP2RXWN.js").then((m) => m.default),
|
|
144
|
+
check: () => import("./check-3XQYO3HU.js").then((m) => m.default),
|
|
145
|
+
ready: () => import("./ready-ZXG74W7Y.js").then((m) => m.default),
|
|
146
|
+
update: () => import("./update-HIWDDEZQ.js").then((m) => m.default),
|
|
147
|
+
generate: () => import("./generate-PC7BIB7G.js").then((m) => m.default),
|
|
148
|
+
migrate: () => import("./migrate-L7W5RHSS.js").then((m) => m.default),
|
|
149
|
+
mcp: () => import("./mcp-6RCSHMXD.js").then((m) => m.default)
|
|
141
150
|
}
|
|
142
151
|
});
|
|
143
152
|
runMain(main).catch((err) => {
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/main.ts","../src/commands/init.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { defineCommand, runMain } from \"citty\";\nimport initCommand from \"./commands/init.js\";\n\nconst main = defineCommand({\n meta: { name: \"specdx\", version: \"0.0.0\", 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 ready: () => import(\"./commands/ready.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","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\";\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};\n\nconst TEMPLATE_EXTRA_DIRS: Record<Template, string[]> = {\n lightweight: [],\n bmad: [\"specs/stories\", \"specs/adr\"],\n \"api-first\": [],\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\"];\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, target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AK,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,WAAW,MAAM,OAAO,yBAAyB,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO;AAAA,IACxE,OAAO,MAAM,OAAO,qBAAqB,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO;AAAA,EAClE;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","../src/commands/init.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { defineCommand, runMain } from \"citty\";\nimport initCommand from \"./commands/init.js\";\n\nconst main = defineCommand({\n meta: { name: \"specdx\", version: \"0.0.0\", 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","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,SAAS,qBAAqB;AAC9B,SAAS,OAAO,iBAAiB;AACjC,SAAS,YAAY;AAWrB,IAAM,iBAGF;AAAA,EACF,aAAa;AAAA,IACX,EAAE,UAAU,UAAU,MAAM,MAAM;AAAA,IAClC,EAAE,UAAU,uBAAuB,MAAM,mBAAmB;AAAA,EAC9D;AAAA,EACA,MAAM;AAAA,IACJ,EAAE,UAAU,UAAU,MAAM,MAAM;AAAA,IAClC,EAAE,UAAU,uBAAuB,MAAM,mBAAmB;AAAA,IAC5D,EAAE,UAAU,gBAAgB,MAAM,YAAY;AAAA,EAChD;AAAA,EACA,aAAa;AAAA,IACX,EAAE,UAAU,uBAAuB,MAAM,mBAAmB;AAAA,IAC5D,EAAE,UAAU,mBAAmB,MAAM,eAAe;AAAA,IACpD,EAAE,UAAU,gBAAgB,MAAM,YAAY;AAAA,EAChD;AAAA,EACA,OAAO,CAAC,EAAE,UAAU,iBAAiB,MAAM,aAAa,CAAC;AAAA,EACzD,SAAS,CAAC,EAAE,UAAU,sBAAsB,MAAM,kBAAkB,CAAC;AACvE;AAEA,IAAM,sBAAkD;AAAA,EACtD,aAAa,CAAC;AAAA,EACd,MAAM,CAAC,iBAAiB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,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,17 @@
|
|
|
1
|
+
// src/commands/mcp.ts
|
|
2
|
+
import { defineCommand } from "citty";
|
|
3
|
+
var mcp_default = defineCommand({
|
|
4
|
+
meta: { name: "mcp", description: "Start the specdx MCP server (stdio transport)" },
|
|
5
|
+
args: {},
|
|
6
|
+
async run() {
|
|
7
|
+
const { createMcpServer } = await import("./dist-QXLX77XG.js");
|
|
8
|
+
const { StdioServerTransport } = await import("@modelcontextprotocol/sdk/server/stdio.js");
|
|
9
|
+
const server = createMcpServer();
|
|
10
|
+
const transport = new StdioServerTransport();
|
|
11
|
+
await server.connect(transport);
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
export {
|
|
15
|
+
mcp_default as default
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=mcp-6RCSHMXD.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 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":[]}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createLogger,
|
|
3
|
+
loadConfig
|
|
4
|
+
} from "./chunk-PHR7AV6I.js";
|
|
5
|
+
import {
|
|
6
|
+
SPEC_TYPES
|
|
7
|
+
} from "./chunk-ZX4HVL5M.js";
|
|
8
|
+
|
|
9
|
+
// src/commands/migrate.ts
|
|
10
|
+
import { defineCommand } from "citty";
|
|
11
|
+
var migrate_default = defineCommand({
|
|
12
|
+
meta: { name: "migrate", description: "Check and migrate spec suite schema" },
|
|
13
|
+
args: {
|
|
14
|
+
quiet: { type: "boolean", description: "Suppress output" }
|
|
15
|
+
},
|
|
16
|
+
async run({ args }) {
|
|
17
|
+
const logger = createLogger({ quiet: args.quiet });
|
|
18
|
+
const configDir = process.cwd();
|
|
19
|
+
try {
|
|
20
|
+
const config = await loadConfig(void 0, configDir);
|
|
21
|
+
logger.info(`
|
|
22
|
+
Config version: ${config.version}`);
|
|
23
|
+
logger.info(` Supported spec types: ${SPEC_TYPES.join(", ")}`);
|
|
24
|
+
const unknownTypes = [];
|
|
25
|
+
for (const [key, entry] of Object.entries(config.specs)) {
|
|
26
|
+
if (!SPEC_TYPES.includes(entry.type)) {
|
|
27
|
+
unknownTypes.push(`${key}: ${entry.type}`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
if (unknownTypes.length > 0) {
|
|
31
|
+
logger.info(`
|
|
32
|
+
Unknown spec types found:`);
|
|
33
|
+
for (const ut of unknownTypes) {
|
|
34
|
+
logger.info(` - ${ut}`);
|
|
35
|
+
}
|
|
36
|
+
logger.info(`
|
|
37
|
+
Update specdx to resolve.
|
|
38
|
+
`);
|
|
39
|
+
process.exit(1);
|
|
40
|
+
} else {
|
|
41
|
+
logger.info(`
|
|
42
|
+
\u2713 All spec types are recognized. No migration needed.
|
|
43
|
+
`);
|
|
44
|
+
}
|
|
45
|
+
} catch (err) {
|
|
46
|
+
console.error(`
|
|
47
|
+
\u2717 ${err.message}
|
|
48
|
+
`);
|
|
49
|
+
process.exit(1);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
export {
|
|
54
|
+
migrate_default as default
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=migrate-L7W5RHSS.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/migrate.ts"],"sourcesContent":["import { defineCommand } from \"citty\";\nimport { loadConfig, createLogger } from \"@specdx/core\";\nimport { SPEC_TYPES } from \"@specdx/schema\";\n\nexport default defineCommand({\n meta: { name: \"migrate\", description: \"Check and migrate spec suite schema\" },\n args: {\n quiet: { type: \"boolean\", description: \"Suppress output\" },\n },\n async run({ args }) {\n const logger = createLogger({ quiet: args.quiet });\n const configDir = process.cwd();\n\n try {\n const config = await loadConfig(undefined, configDir);\n logger.info(`\\n Config version: ${config.version}`);\n logger.info(` Supported spec types: ${SPEC_TYPES.join(\", \")}`);\n\n const unknownTypes: string[] = [];\n for (const [key, entry] of Object.entries(config.specs)) {\n if (!SPEC_TYPES.includes(entry.type as (typeof SPEC_TYPES)[number])) {\n unknownTypes.push(`${key}: ${entry.type}`);\n }\n }\n\n if (unknownTypes.length > 0) {\n logger.info(`\\n Unknown spec types found:`);\n for (const ut of unknownTypes) {\n logger.info(` - ${ut}`);\n }\n logger.info(`\\n Update specdx to resolve.\\n`);\n process.exit(1);\n } else {\n logger.info(`\\n ✓ All spec types are recognized. No migration needed.\\n`);\n }\n } catch (err) {\n console.error(`\\n ✗ ${(err as Error).message}\\n`);\n process.exit(1);\n }\n },\n});\n"],"mappings":";;;;;;;;;AAAA,SAAS,qBAAqB;AAI9B,IAAO,kBAAQ,cAAc;AAAA,EAC3B,MAAM,EAAE,MAAM,WAAW,aAAa,sCAAsC;AAAA,EAC5E,MAAM;AAAA,IACJ,OAAO,EAAE,MAAM,WAAW,aAAa,kBAAkB;AAAA,EAC3D;AAAA,EACA,MAAM,IAAI,EAAE,KAAK,GAAG;AAClB,UAAM,SAAS,aAAa,EAAE,OAAO,KAAK,MAAM,CAAC;AACjD,UAAM,YAAY,QAAQ,IAAI;AAE9B,QAAI;AACF,YAAM,SAAS,MAAM,WAAW,QAAW,SAAS;AACpD,aAAO,KAAK;AAAA,oBAAuB,OAAO,OAAO,EAAE;AACnD,aAAO,KAAK,2BAA2B,WAAW,KAAK,IAAI,CAAC,EAAE;AAE9D,YAAM,eAAyB,CAAC;AAChC,iBAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,OAAO,KAAK,GAAG;AACvD,YAAI,CAAC,WAAW,SAAS,MAAM,IAAmC,GAAG;AACnE,uBAAa,KAAK,GAAG,GAAG,KAAK,MAAM,IAAI,EAAE;AAAA,QAC3C;AAAA,MACF;AAEA,UAAI,aAAa,SAAS,GAAG;AAC3B,eAAO,KAAK;AAAA,4BAA+B;AAC3C,mBAAW,MAAM,cAAc;AAC7B,iBAAO,KAAK,SAAS,EAAE,EAAE;AAAA,QAC3B;AACA,eAAO,KAAK;AAAA;AAAA,CAAiC;AAC7C,gBAAQ,KAAK,CAAC;AAAA,MAChB,OAAO;AACL,eAAO,KAAK;AAAA;AAAA,CAA6D;AAAA,MAC3E;AAAA,IACF,SAAS,KAAK;AACZ,cAAQ,MAAM;AAAA,WAAU,IAAc,OAAO;AAAA,CAAI;AACjD,cAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF;AACF,CAAC;","names":[]}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import {
|
|
2
|
+
pack
|
|
3
|
+
} from "./chunk-4THCEWAK.js";
|
|
4
|
+
import {
|
|
5
|
+
sharedArgs
|
|
6
|
+
} from "./chunk-GAM4MXPC.js";
|
|
7
|
+
import {
|
|
8
|
+
buildGraph,
|
|
9
|
+
createLogger,
|
|
10
|
+
loadConfig,
|
|
11
|
+
parseSpec,
|
|
12
|
+
resolveGlob
|
|
13
|
+
} from "./chunk-PHR7AV6I.js";
|
|
14
|
+
import "./chunk-ZX4HVL5M.js";
|
|
15
|
+
|
|
16
|
+
// src/commands/pack.ts
|
|
17
|
+
import { defineCommand } from "citty";
|
|
18
|
+
import { writeFile } from "fs/promises";
|
|
19
|
+
import { execSync } from "child_process";
|
|
20
|
+
function copyToClipboard(text) {
|
|
21
|
+
const platform = process.platform;
|
|
22
|
+
let cmd;
|
|
23
|
+
if (platform === "darwin") {
|
|
24
|
+
cmd = "pbcopy";
|
|
25
|
+
} else if (platform === "linux") {
|
|
26
|
+
cmd = "xclip -selection clipboard";
|
|
27
|
+
} else if (platform === "win32") {
|
|
28
|
+
cmd = "clip";
|
|
29
|
+
} else {
|
|
30
|
+
throw new Error(`Clipboard not supported on platform: ${platform}`);
|
|
31
|
+
}
|
|
32
|
+
execSync(cmd, { input: text, stdio: ["pipe", "ignore", "ignore"] });
|
|
33
|
+
}
|
|
34
|
+
async function runPack(options) {
|
|
35
|
+
const config = await loadConfig(void 0, options.configDir);
|
|
36
|
+
const allSpecs = [];
|
|
37
|
+
for (const [, entry] of Object.entries(config.specs)) {
|
|
38
|
+
const files = await resolveGlob(entry.path, options.configDir);
|
|
39
|
+
for (const file of files) {
|
|
40
|
+
allSpecs.push(await parseSpec(file));
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
let graph;
|
|
44
|
+
try {
|
|
45
|
+
graph = buildGraph(config);
|
|
46
|
+
} catch {
|
|
47
|
+
}
|
|
48
|
+
const result = pack(
|
|
49
|
+
allSpecs,
|
|
50
|
+
{
|
|
51
|
+
task: options.task,
|
|
52
|
+
specs: options.specs,
|
|
53
|
+
budget: options.budget,
|
|
54
|
+
format: options.format,
|
|
55
|
+
full: options.full,
|
|
56
|
+
dryRun: options.dryRun
|
|
57
|
+
},
|
|
58
|
+
config.pack,
|
|
59
|
+
graph
|
|
60
|
+
);
|
|
61
|
+
return result;
|
|
62
|
+
}
|
|
63
|
+
var pack_default = defineCommand({
|
|
64
|
+
meta: { name: "pack", description: "Pack specs into AI-ready context" },
|
|
65
|
+
args: {
|
|
66
|
+
quiet: sharedArgs.quiet,
|
|
67
|
+
verbose: sharedArgs.verbose,
|
|
68
|
+
task: { type: "string", description: "Task or context to optimise relevance for" },
|
|
69
|
+
specs: { type: "string", description: "Comma-separated spec IDs or glob patterns to include" },
|
|
70
|
+
budget: { type: "string", description: "Maximum token budget for the output" },
|
|
71
|
+
format: {
|
|
72
|
+
type: "string",
|
|
73
|
+
description: "Output format (xml, markdown, json)",
|
|
74
|
+
default: "xml"
|
|
75
|
+
},
|
|
76
|
+
out: { type: "string", description: "Write output to file instead of stdout" },
|
|
77
|
+
copy: { type: "boolean", description: "Copy output to system clipboard" },
|
|
78
|
+
full: { type: "boolean", description: "Include all specs without budget trimming" },
|
|
79
|
+
"dry-run": {
|
|
80
|
+
type: "boolean",
|
|
81
|
+
description: "Preview what would be packed without writing output"
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
async run({ args }) {
|
|
85
|
+
const logger = createLogger({ quiet: args.quiet, verbose: args.verbose });
|
|
86
|
+
if (args.task && args.specs) {
|
|
87
|
+
console.error("\n \u2717 --task and --specs are mutually exclusive\n");
|
|
88
|
+
process.exit(1);
|
|
89
|
+
}
|
|
90
|
+
if (args.copy && args["dry-run"]) {
|
|
91
|
+
console.error("\n \u2717 --copy and --dry-run are mutually exclusive\n");
|
|
92
|
+
process.exit(1);
|
|
93
|
+
}
|
|
94
|
+
let budget;
|
|
95
|
+
if (args.budget) {
|
|
96
|
+
budget = Number(args.budget);
|
|
97
|
+
if (Number.isNaN(budget)) {
|
|
98
|
+
console.error("\n \u2717 --budget must be a valid number\n");
|
|
99
|
+
process.exit(1);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
const format = args.format;
|
|
103
|
+
if (format && !["xml", "markdown", "json"].includes(format)) {
|
|
104
|
+
console.error(`
|
|
105
|
+
\u2717 --format must be one of: xml, markdown, json
|
|
106
|
+
`);
|
|
107
|
+
process.exit(1);
|
|
108
|
+
}
|
|
109
|
+
try {
|
|
110
|
+
const specsList = args.specs ? args.specs.split(",").map((s) => s.trim()) : void 0;
|
|
111
|
+
const result = await runPack({
|
|
112
|
+
configDir: process.cwd(),
|
|
113
|
+
task: args.task,
|
|
114
|
+
specs: specsList,
|
|
115
|
+
budget,
|
|
116
|
+
format,
|
|
117
|
+
full: args.full,
|
|
118
|
+
dryRun: args["dry-run"]
|
|
119
|
+
});
|
|
120
|
+
const { stats } = result;
|
|
121
|
+
if (args["dry-run"]) {
|
|
122
|
+
console.log("\n Dry Run Summary:\n");
|
|
123
|
+
for (const alloc of stats.allocations) {
|
|
124
|
+
const status = alloc.included ? "\u2713" : "\u2717";
|
|
125
|
+
const compressed = alloc.compressed ? " (compressed)" : "";
|
|
126
|
+
console.log(
|
|
127
|
+
` ${status} ${alloc.specId} relevance=${alloc.relevance.toFixed(2)} tokens=${alloc.tokens}${compressed}`
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
console.log(`
|
|
131
|
+
Budget: ${stats.used} / ${stats.budget} tokens`);
|
|
132
|
+
console.log(
|
|
133
|
+
` Included: ${stats.specsIncluded} / ${stats.specsIncluded + stats.specsExcluded} specs`
|
|
134
|
+
);
|
|
135
|
+
console.log(` Sections compressed: ${stats.sectionsCompressed}
|
|
136
|
+
`);
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
if (args.out) {
|
|
140
|
+
await writeFile(args.out, result.output, "utf-8");
|
|
141
|
+
logger.info(`Output written to ${args.out}`);
|
|
142
|
+
}
|
|
143
|
+
if (args.copy) {
|
|
144
|
+
copyToClipboard(result.output);
|
|
145
|
+
logger.info("Output copied to clipboard");
|
|
146
|
+
}
|
|
147
|
+
if (!args.out && !args.copy) {
|
|
148
|
+
process.stdout.write(result.output);
|
|
149
|
+
}
|
|
150
|
+
const total = stats.specsIncluded + stats.specsExcluded;
|
|
151
|
+
process.stderr.write(
|
|
152
|
+
`Packed ${stats.specsIncluded}/${total} specs \u2022 ${stats.used} / ${stats.budget} tokens \u2022 ${stats.sectionsCompressed} sections compressed
|
|
153
|
+
`
|
|
154
|
+
);
|
|
155
|
+
} catch (err) {
|
|
156
|
+
console.error(`
|
|
157
|
+
\u2717 ${err.message}
|
|
158
|
+
`);
|
|
159
|
+
process.exit(1);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
export {
|
|
164
|
+
pack_default as default,
|
|
165
|
+
runPack
|
|
166
|
+
};
|
|
167
|
+
//# sourceMappingURL=pack-QCOXMURY.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\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`);\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\\n`,\n );\n } catch (err) {\n console.error(`\\n \\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AA,QACb,UAAU,MAAM,aAAa,IAAI,KAAK,iBAAiB,MAAM,IAAI,MAAM,MAAM,MAAM,kBAAkB,MAAM,kBAAkB;AAAA;AAAA,MAC/H;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,18 +4,18 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
createLintEngine,
|
|
6
6
|
getPreset
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-HMXUNURD.js";
|
|
8
8
|
import {
|
|
9
9
|
DEFAULT_DIFF_CONFIG
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-DDFLMRPC.js";
|
|
11
11
|
import {
|
|
12
12
|
buildGraph,
|
|
13
13
|
createLogger,
|
|
14
14
|
loadConfig,
|
|
15
15
|
parseSpec,
|
|
16
16
|
resolveGlob
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
import "./chunk-
|
|
17
|
+
} from "./chunk-PHR7AV6I.js";
|
|
18
|
+
import "./chunk-ZX4HVL5M.js";
|
|
19
19
|
|
|
20
20
|
// src/commands/ready.ts
|
|
21
21
|
import { defineCommand } from "citty";
|
|
@@ -156,4 +156,4 @@ export {
|
|
|
156
156
|
ready_default as default,
|
|
157
157
|
runReady
|
|
158
158
|
};
|
|
159
|
-
//# sourceMappingURL=ready-
|
|
159
|
+
//# sourceMappingURL=ready-ZXG74W7Y.js.map
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: specdx-check-drift
|
|
3
|
+
description: "Use when the user says 'check drift', 'did I drift from spec', 'am I still aligned', or as part of a pre-commit check. Compares recent code changes against spec definitions."
|
|
4
|
+
allowed-tools: Bash(npx specdx *), Read
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Check Spec Drift
|
|
8
|
+
|
|
9
|
+
Compare recent code changes against spec definitions to detect drift.
|
|
10
|
+
|
|
11
|
+
## Workflow
|
|
12
|
+
|
|
13
|
+
### Step 1: Check for spec changes
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npx specdx diff
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
This shows which specs changed since the last commit. Note any upstream spec changes.
|
|
20
|
+
|
|
21
|
+
### Step 2: Check implementation alignment
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npx specdx check --format json
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
This compares specs against code. Note any missing implementations or mismatches.
|
|
28
|
+
|
|
29
|
+
### Step 3: Cross-reference changes
|
|
30
|
+
|
|
31
|
+
Compare the two results:
|
|
32
|
+
|
|
33
|
+
| Situation | Meaning |
|
|
34
|
+
|---|---|
|
|
35
|
+
| Spec changed, code matches | Spec was updated to reflect reality. Good. |
|
|
36
|
+
| Spec changed, code doesn't match | Spec was updated but code wasn't. Needs code update. |
|
|
37
|
+
| Spec unchanged, code diverges | Code drifted from spec. Either update code or update spec. |
|
|
38
|
+
| Both changed in alignment | Normal development. Verify alignment. |
|
|
39
|
+
|
|
40
|
+
### Step 4: Present drift report
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
## Drift Report
|
|
44
|
+
|
|
45
|
+
### Spec Changes (since last commit)
|
|
46
|
+
[diff results — which specs changed and how]
|
|
47
|
+
|
|
48
|
+
### Implementation Alignment
|
|
49
|
+
[check results — score, findings]
|
|
50
|
+
|
|
51
|
+
### Drift Detected
|
|
52
|
+
- [list of drifts with suggested resolution: "update code" or "update spec"]
|
|
53
|
+
|
|
54
|
+
### Verdict
|
|
55
|
+
[aligned | minor drift | significant drift]
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Step 5: Suggest resolution
|
|
59
|
+
|
|
60
|
+
For each drift:
|
|
61
|
+
- If spec is the source of truth → suggest code changes
|
|
62
|
+
- If code is intentionally ahead → suggest spec updates
|
|
63
|
+
- If unclear → ask the user which direction to go
|
|
64
|
+
|
|
65
|
+
## Rationalizations to Resist
|
|
66
|
+
|
|
67
|
+
| Thought | Reality |
|
|
68
|
+
|---------|---------|
|
|
69
|
+
| "No specs changed, so no drift" | Code can drift even when specs don't change. Run the check. |
|
|
70
|
+
| "The check score is high enough" | Even 95% means 5% drift. Review the findings. |
|
|
71
|
+
| "I'll check drift later" | Drift compounds. Check now. |
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: specdx-review-spec
|
|
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
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Review Spec Quality
|
|
8
|
+
|
|
9
|
+
Run a three-layer review of a spec: completeness, consistency, and adversarial analysis. Each layer uses a specialized subagent.
|
|
10
|
+
|
|
11
|
+
## Workflow
|
|
12
|
+
|
|
13
|
+
### Step 1: Identify the spec to review
|
|
14
|
+
|
|
15
|
+
Ask the user which spec to review if not clear from context. Get the file path.
|
|
16
|
+
|
|
17
|
+
### Step 2: Gather context
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npx specdx lint --path <spec-file> --preset strict
|
|
21
|
+
npx specdx graph
|
|
22
|
+
npx specdx status --format json
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Step 3: Run three review passes
|
|
26
|
+
|
|
27
|
+
Dispatch three subagents using the templates in the `templates/` directory next to this file's parent directory. Each subagent gets the spec path and related context.
|
|
28
|
+
|
|
29
|
+
**Pass 1 — Completeness** (use `templates/spec-reviewer.md`):
|
|
30
|
+
- Are all required sections present and non-empty?
|
|
31
|
+
- Is the frontmatter valid?
|
|
32
|
+
- Are cross-references intact?
|
|
33
|
+
|
|
34
|
+
**Pass 2 — Consistency** (use `templates/consistency-reviewer.md`):
|
|
35
|
+
- Is terminology consistent across specs?
|
|
36
|
+
- Do names and IDs align?
|
|
37
|
+
- Are versions and statuses coherent?
|
|
38
|
+
|
|
39
|
+
**Pass 3 — Adversarial** (use `templates/adversarial-reviewer.md`):
|
|
40
|
+
- What edge cases are missing?
|
|
41
|
+
- What's ambiguous?
|
|
42
|
+
- What could go wrong?
|
|
43
|
+
|
|
44
|
+
### Step 4: Aggregate results
|
|
45
|
+
|
|
46
|
+
Present a combined report:
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
## Spec Review: <spec-title>
|
|
50
|
+
|
|
51
|
+
### Completeness
|
|
52
|
+
[pass 1 results]
|
|
53
|
+
|
|
54
|
+
### Consistency
|
|
55
|
+
[pass 2 results]
|
|
56
|
+
|
|
57
|
+
### Adversarial Analysis
|
|
58
|
+
[pass 3 results]
|
|
59
|
+
|
|
60
|
+
### Summary
|
|
61
|
+
- X critical issues
|
|
62
|
+
- Y improvements recommended
|
|
63
|
+
- Overall: ready for implementation | needs revision | needs major rework
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
<HARD-GATE>
|
|
67
|
+
Do NOT skip any of the three review passes. Each catches different classes of problems. A spec that passes completeness review may still have critical adversarial gaps.
|
|
68
|
+
</HARD-GATE>
|
|
69
|
+
|
|
70
|
+
## Rationalizations to Resist
|
|
71
|
+
|
|
72
|
+
| Thought | Reality |
|
|
73
|
+
|---------|---------|
|
|
74
|
+
| "The spec looks fine to me" | You're not adversarial enough. Run all three passes. |
|
|
75
|
+
| "Three passes is overkill for a small spec" | Small specs have the most gaps. Run all three. |
|
|
76
|
+
| "The completeness pass already found issues, so skip the rest" | Consistency and adversarial reviews find different issues. |
|
|
77
|
+
| "I can combine the passes into one review" | Separate passes with different prompts catch more. |
|