specdx 0.3.0-alpha.1 → 0.3.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  createLintEngine,
6
6
  getPreset
7
- } from "./chunk-6DTOYCZ6.js";
7
+ } from "./chunk-ATLVRGHI.js";
8
8
  import {
9
9
  buildGraph,
10
10
  createLogger,
@@ -108,4 +108,4 @@ export {
108
108
  lint_default as default,
109
109
  runLint
110
110
  };
111
- //# sourceMappingURL=lint-CHWVBUV5.js.map
111
+ //# sourceMappingURL=lint-U7VLGS75.js.map
package/dist/main.js CHANGED
@@ -128,15 +128,16 @@ var main = defineCommand2({
128
128
  meta: { name: "specdx", version: "0.0.0", description: "specdx \u2014 Spec Developer Experience" },
129
129
  subCommands: {
130
130
  init: init_default,
131
- lint: () => import("./lint-CHWVBUV5.js").then((m) => m.default),
131
+ lint: () => import("./lint-U7VLGS75.js").then((m) => m.default),
132
132
  validate: () => import("./validate-DOZZEZFC.js").then((m) => m.default),
133
133
  graph: () => import("./graph-OWQJWVSN.js").then((m) => m.default),
134
134
  skills: () => import("./skills-XJYTWGDK.js").then((m) => m.default),
135
135
  pack: () => import("./pack-OJAC7JF2.js").then((m) => m.default),
136
- diff: () => import("./diff-GWJONALU.js").then((m) => m.default),
137
- status: () => import("./status-VMALGNS5.js").then((m) => m.default),
136
+ diff: () => import("./diff-55PTEVB3.js").then((m) => m.default),
137
+ status: () => import("./status-LYZUO6AJ.js").then((m) => m.default),
138
138
  explain: () => import("./explain-YXUILNEA.js").then((m) => m.default),
139
- changelog: () => import("./changelog-NPN34DIO.js").then((m) => m.default)
139
+ changelog: () => import("./changelog-URU2TFNM.js").then((m) => m.default),
140
+ ready: () => import("./ready-3OIF4QHM.js").then((m) => m.default)
140
141
  }
141
142
  });
142
143
  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 },\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, 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;A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#!/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, 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,EACh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;","names":["defineCommand","defineCommand"]}
@@ -0,0 +1,159 @@
1
+ import {
2
+ sharedArgs
3
+ } from "./chunk-GAM4MXPC.js";
4
+ import {
5
+ createLintEngine,
6
+ getPreset
7
+ } from "./chunk-ATLVRGHI.js";
8
+ import {
9
+ DEFAULT_DIFF_CONFIG
10
+ } from "./chunk-LU6M5O63.js";
11
+ import {
12
+ buildGraph,
13
+ createLogger,
14
+ loadConfig,
15
+ parseSpec,
16
+ resolveGlob
17
+ } from "./chunk-276J7LR6.js";
18
+ import "./chunk-XLEN6ZYM.js";
19
+
20
+ // src/commands/ready.ts
21
+ import { defineCommand } from "citty";
22
+ async function runReady() {
23
+ const configDir = process.cwd();
24
+ const config = await loadConfig(void 0, configDir);
25
+ const checks = [];
26
+ const specs = [];
27
+ for (const [key, entry] of Object.entries(config.specs)) {
28
+ const paths = await resolveGlob(entry.path, configDir);
29
+ for (const p of paths) {
30
+ const spec = await parseSpec(p);
31
+ specs.push({ spec, key, entry });
32
+ }
33
+ }
34
+ const requiredEntries = Object.entries(config.specs).filter(
35
+ ([, entry]) => entry.required
36
+ );
37
+ const missingRequired = [];
38
+ for (const [key, entry] of requiredEntries) {
39
+ const paths = await resolveGlob(entry.path, configDir);
40
+ if (paths.length === 0) {
41
+ missingRequired.push(key);
42
+ }
43
+ }
44
+ checks.push({
45
+ name: "Required specs present",
46
+ passed: missingRequired.length === 0,
47
+ details: missingRequired.length === 0 ? `All ${requiredEntries.length} required specs found` : `Missing: ${missingRequired.join(", ")}`
48
+ });
49
+ const presetName = config.lint?.extends ?? "recommended";
50
+ const rules = getPreset(presetName);
51
+ let graph;
52
+ let graphError;
53
+ try {
54
+ graph = buildGraph(config);
55
+ } catch (err) {
56
+ graphError = err.message;
57
+ }
58
+ const engine = createLintEngine({ rules, config, graph });
59
+ const lintResults = engine.lint(specs.map((s) => s.spec));
60
+ if (graphError) {
61
+ lintResults.diagnostics.push({
62
+ ruleId: "structure/no-circular-deps",
63
+ severity: "error",
64
+ message: graphError,
65
+ filePath: "spec.config.yaml"
66
+ });
67
+ lintResults.hasErrors = true;
68
+ }
69
+ const errors = lintResults.diagnostics.filter((d) => d.severity === "error").length;
70
+ const warnings = lintResults.diagnostics.filter((d) => d.severity === "warn").length;
71
+ checks.push({
72
+ name: "Lint health",
73
+ passed: errors === 0,
74
+ details: `${errors} errors, ${warnings} warnings`
75
+ });
76
+ const integrityIssues = [];
77
+ if (graphError) {
78
+ integrityIssues.push(graphError);
79
+ }
80
+ const refErrors = lintResults.diagnostics.filter(
81
+ (d) => d.ruleId === "structure/valid-references"
82
+ );
83
+ for (const d of refErrors) {
84
+ integrityIssues.push(d.message);
85
+ }
86
+ checks.push({
87
+ name: "No integrity issues",
88
+ passed: integrityIssues.length === 0,
89
+ details: integrityIssues.length === 0 ? "References and dependencies valid" : integrityIssues.join("; ")
90
+ });
91
+ const thresholdDays = config.diff?.staleness_threshold_days ?? DEFAULT_DIFF_CONFIG.staleness_threshold_days;
92
+ const now = Date.now();
93
+ const staleSpecs = [];
94
+ for (const { spec } of specs) {
95
+ const dateStr = spec.frontmatter.updated || spec.frontmatter.created;
96
+ if (dateStr) {
97
+ const days = Math.floor((now - new Date(dateStr).getTime()) / (1e3 * 60 * 60 * 24));
98
+ if (days > thresholdDays) {
99
+ staleSpecs.push({ specId: spec.frontmatter.id, days });
100
+ }
101
+ }
102
+ }
103
+ checks.push({
104
+ name: "No stale specs",
105
+ passed: staleSpecs.length === 0,
106
+ details: staleSpecs.length === 0 ? `All specs within ${thresholdDays}-day threshold` : staleSpecs.map((s) => `${s.specId} (${s.days}d)`).join(", ")
107
+ });
108
+ const storyCoverageErrors = lintResults.diagnostics.filter(
109
+ (d) => d.ruleId === "completeness/story-coverage"
110
+ );
111
+ checks.push({
112
+ name: "Story coverage",
113
+ passed: storyCoverageErrors.length === 0,
114
+ details: storyCoverageErrors.length === 0 ? "All PRD features have corresponding stories" : storyCoverageErrors.map((d) => d.message).join("; ")
115
+ });
116
+ const ready = checks.every((c) => c.passed);
117
+ return { project: config.project?.name ?? "project", ready, checks };
118
+ }
119
+ var ready_default = defineCommand({
120
+ meta: { name: "ready", description: "Check if spec suite is ready for implementation" },
121
+ args: {
122
+ ...sharedArgs
123
+ },
124
+ async run({ args }) {
125
+ const logger = createLogger({ quiet: args.quiet, verbose: args.verbose });
126
+ logger.debug("Running readiness checks...");
127
+ const result = await runReady();
128
+ if (args.format === "json") {
129
+ console.log(JSON.stringify(result, null, 2));
130
+ if (!result.ready) process.exit(1);
131
+ return;
132
+ }
133
+ const icon = result.ready ? "\u2713" : "\u2717";
134
+ const label = result.ready ? "ready for implementation" : "not ready for implementation";
135
+ console.log(`
136
+ ${icon} ${result.project} \u2014 ${label}
137
+ `);
138
+ for (const check of result.checks) {
139
+ const checkIcon = check.passed ? "\u2713" : "\u2717";
140
+ console.log(` ${checkIcon} ${check.name}: ${check.details}`);
141
+ }
142
+ const failCount = result.checks.filter((c) => !c.passed).length;
143
+ if (failCount > 0) {
144
+ console.log(`
145
+ Verdict: NOT READY \u2014 ${failCount} issue${failCount > 1 ? "s" : ""} to resolve
146
+ `);
147
+ } else {
148
+ console.log(`
149
+ Verdict: READY
150
+ `);
151
+ }
152
+ if (!result.ready) process.exit(1);
153
+ }
154
+ });
155
+ export {
156
+ ready_default as default,
157
+ runReady
158
+ };
159
+ //# sourceMappingURL=ready-3OIF4QHM.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/commands/ready.ts"],"sourcesContent":["import { defineCommand } from \"citty\";\nimport { loadConfig, parseSpec, resolveGlob, buildGraph, createLogger } from \"@specdx/core\";\nimport { createLintEngine, getPreset } from \"@specdx/lint\";\nimport type { ParsedSpec } from \"@specdx/core\";\nimport { DEFAULT_DIFF_CONFIG } from \"@specdx/diff\";\nimport { sharedArgs } from \"../shared-args.js\";\n\nexport interface ReadyCheck {\n name: string;\n passed: boolean;\n details: string;\n}\n\nexport interface ReadyResult {\n project: string;\n ready: boolean;\n checks: ReadyCheck[];\n}\n\nexport async function runReady(): Promise<ReadyResult> {\n const configDir = process.cwd();\n const config = await loadConfig(undefined, configDir);\n\n const checks: ReadyCheck[] = [];\n\n // Resolve and parse all specs\n const specs: { spec: ParsedSpec; key: string; entry: { path: string; required?: boolean; owner?: string } }[] = [];\n for (const [key, entry] of Object.entries(config.specs)) {\n const paths = await resolveGlob(entry.path, configDir);\n for (const p of paths) {\n const spec = await parseSpec(p);\n specs.push({ spec, key, entry: entry as { path: string; required?: boolean; owner?: string } });\n }\n }\n\n // Check 1: Required specs exist\n const requiredEntries = Object.entries(config.specs).filter(\n ([, entry]) => (entry as { required?: boolean }).required,\n );\n const missingRequired: string[] = [];\n for (const [key, entry] of requiredEntries) {\n const paths = await resolveGlob(entry.path, configDir);\n if (paths.length === 0) {\n missingRequired.push(key);\n }\n }\n checks.push({\n name: \"Required specs present\",\n passed: missingRequired.length === 0,\n details:\n missingRequired.length === 0\n ? `All ${requiredEntries.length} required specs found`\n : `Missing: ${missingRequired.join(\", \")}`,\n });\n\n // Check 2: Lint health (no errors)\n const presetName = config.lint?.extends ?? \"recommended\";\n const rules = getPreset(presetName);\n\n let graph;\n let graphError: string | undefined;\n try {\n graph = buildGraph(config);\n } catch (err) {\n graphError = (err as Error).message;\n }\n\n const engine = createLintEngine({ rules, config, graph });\n const lintResults = engine.lint(specs.map((s) => s.spec));\n\n if (graphError) {\n lintResults.diagnostics.push({\n ruleId: \"structure/no-circular-deps\",\n severity: \"error\",\n message: graphError,\n filePath: \"spec.config.yaml\",\n });\n lintResults.hasErrors = true;\n }\n\n const errors = lintResults.diagnostics.filter((d) => d.severity === \"error\").length;\n const warnings = lintResults.diagnostics.filter((d) => d.severity === \"warn\").length;\n checks.push({\n name: \"Lint health\",\n passed: errors === 0,\n details: `${errors} errors, ${warnings} warnings`,\n });\n\n // Check 3: No integrity issues (broken refs, circular deps)\n const integrityIssues: string[] = [];\n if (graphError) {\n integrityIssues.push(graphError);\n }\n const refErrors = lintResults.diagnostics.filter(\n (d) => d.ruleId === \"structure/valid-references\",\n );\n for (const d of refErrors) {\n integrityIssues.push(d.message);\n }\n checks.push({\n name: \"No integrity issues\",\n passed: integrityIssues.length === 0,\n details:\n integrityIssues.length === 0\n ? \"References and dependencies valid\"\n : integrityIssues.join(\"; \"),\n });\n\n // Check 4: No stale specs\n const thresholdDays =\n config.diff?.staleness_threshold_days ?? DEFAULT_DIFF_CONFIG.staleness_threshold_days;\n const now = Date.now();\n const staleSpecs: { specId: string; days: number }[] = [];\n for (const { spec } of specs) {\n const dateStr =\n (spec.frontmatter.updated as string | undefined) ||\n (spec.frontmatter.created as string | undefined);\n if (dateStr) {\n const days = Math.floor((now - new Date(dateStr).getTime()) / (1000 * 60 * 60 * 24));\n if (days > thresholdDays) {\n staleSpecs.push({ specId: spec.frontmatter.id as string, days });\n }\n }\n }\n checks.push({\n name: \"No stale specs\",\n passed: staleSpecs.length === 0,\n details:\n staleSpecs.length === 0\n ? `All specs within ${thresholdDays}-day threshold`\n : staleSpecs.map((s) => `${s.specId} (${s.days}d)`).join(\", \"),\n });\n\n // Check 5: Story coverage — every PRD feature has a user story\n const storyCoverageErrors = lintResults.diagnostics.filter(\n (d) => d.ruleId === \"completeness/story-coverage\",\n );\n checks.push({\n name: \"Story coverage\",\n passed: storyCoverageErrors.length === 0,\n details:\n storyCoverageErrors.length === 0\n ? \"All PRD features have corresponding stories\"\n : storyCoverageErrors.map((d) => d.message).join(\"; \"),\n });\n\n const ready = checks.every((c) => c.passed);\n return { project: config.project?.name ?? \"project\", ready, checks };\n}\n\nexport default defineCommand({\n meta: { name: \"ready\", description: \"Check if spec suite is ready for implementation\" },\n args: {\n ...sharedArgs,\n },\n async run({ args }) {\n const logger = createLogger({ quiet: args.quiet, verbose: args.verbose });\n logger.debug(\"Running readiness checks...\");\n\n const result = await runReady();\n\n if (args.format === \"json\") {\n console.log(JSON.stringify(result, null, 2));\n if (!result.ready) process.exit(1);\n return;\n }\n\n // Pretty format\n const icon = result.ready ? \"✓\" : \"✗\";\n const label = result.ready ? \"ready for implementation\" : \"not ready for implementation\";\n\n console.log(`\\n ${icon} ${result.project} — ${label}\\n`);\n\n for (const check of result.checks) {\n const checkIcon = check.passed ? \"✓\" : \"✗\";\n console.log(` ${checkIcon} ${check.name}: ${check.details}`);\n }\n\n const failCount = result.checks.filter((c) => !c.passed).length;\n if (failCount > 0) {\n console.log(`\\n Verdict: NOT READY — ${failCount} issue${failCount > 1 ? \"s\" : \"\"} to resolve\\n`);\n } else {\n console.log(`\\n Verdict: READY\\n`);\n }\n\n if (!result.ready) process.exit(1);\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,SAAS,qBAAqB;AAmB9B,eAAsB,WAAiC;AACrD,QAAM,YAAY,QAAQ,IAAI;AAC9B,QAAM,SAAS,MAAM,WAAW,QAAW,SAAS;AAEpD,QAAM,SAAuB,CAAC;AAG9B,QAAM,QAA0G,CAAC;AACjH,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,OAAO,KAAK,GAAG;AACvD,UAAM,QAAQ,MAAM,YAAY,MAAM,MAAM,SAAS;AACrD,eAAW,KAAK,OAAO;AACrB,YAAM,OAAO,MAAM,UAAU,CAAC;AAC9B,YAAM,KAAK,EAAE,MAAM,KAAK,MAAqE,CAAC;AAAA,IAChG;AAAA,EACF;AAGA,QAAM,kBAAkB,OAAO,QAAQ,OAAO,KAAK,EAAE;AAAA,IACnD,CAAC,CAAC,EAAE,KAAK,MAAO,MAAiC;AAAA,EACnD;AACA,QAAM,kBAA4B,CAAC;AACnC,aAAW,CAAC,KAAK,KAAK,KAAK,iBAAiB;AAC1C,UAAM,QAAQ,MAAM,YAAY,MAAM,MAAM,SAAS;AACrD,QAAI,MAAM,WAAW,GAAG;AACtB,sBAAgB,KAAK,GAAG;AAAA,IAC1B;AAAA,EACF;AACA,SAAO,KAAK;AAAA,IACV,MAAM;AAAA,IACN,QAAQ,gBAAgB,WAAW;AAAA,IACnC,SACE,gBAAgB,WAAW,IACvB,OAAO,g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CAAC;AACxE,WAAO,MAAM,6BAA6B;AAE1C,UAAM,SAAS,MAAM,SAAS;AAE9B,QAAI,KAAK,WAAW,QAAQ;AAC1B,cAAQ,IAAI,KAAK,UAAU,QAAQ,MAAM,CAAC,CAAC;AAC3C,UAAI,CAAC,OAAO,MAAO,SAAQ,KAAK,CAAC;AACjC;AAAA,IACF;AAGA,UAAM,OAAO,OAAO,QAAQ,WAAM;AAClC,UAAM,QAAQ,OAAO,QAAQ,6BAA6B;AAE1D,YAAQ,IAAI;AAAA,IAAO,IAAI,IAAI,OAAO,OAAO,WAAM,KAAK;AAAA,CAAI;AAExD,eAAW,SAAS,OAAO,QAAQ;AACjC,YAAM,YAAY,MAAM,SAAS,WAAM;AACvC,cAAQ,IAAI,OAAO,SAAS,IAAI,MAAM,IAAI,KAAK,MAAM,OAAO,EAAE;AAAA,IAChE;AAEA,UAAM,YAAY,OAAO,OAAO,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE;AACzD,QAAI,YAAY,GAAG;AACjB,cAAQ,IAAI;AAAA,8BAA4B,SAAS,SAAS,YAAY,IAAI,MAAM,EAAE;AAAA,CAAe;AAAA,IACnG,OAAO;AACL,cAAQ,IAAI;AAAA;AAAA,CAAsB;AAAA,IACpC;AAEA,QAAI,CAAC,OAAO,MAAO,SAAQ,KAAK,CAAC;AAAA,EACnC;AACF,CAAC;","names":[]}
@@ -0,0 +1,66 @@
1
+ ---
2
+ step: 1
3
+ name: Frontmatter
4
+ description: Determine spec type, check existing specs, create file with frontmatter
5
+ ---
6
+
7
+ # Step 1: Frontmatter
8
+
9
+ ## Determine the type
10
+
11
+ Ask what kind of spec they need:
12
+
13
+ | Type | Use when | Required sections |
14
+ |---|---|---|
15
+ | `prd` | Defining what to build | Problem Statement, Goals, Non-Goals, Features, Success Criteria |
16
+ | `technical-design` | Describing how it works | Overview, Architecture, Data Model, API Design, Dependencies, Risks, Open Questions |
17
+ | `user-story` | Capturing a user workflow | Description, Acceptance Criteria, Dependencies, Notes |
18
+ | `test-plan` | Planning test coverage | Scope, Test Cases, Coverage Matrix, Edge Cases |
19
+ | `adr` | Recording a decision | Context, Decision, Status, Consequences |
20
+ | `api-contract` | Defining an API | Endpoints, Request/Response Schemas, Auth, Error Codes |
21
+
22
+ For detailed guidance on each type, read `spec-type-reference.md` in the parent directory.
23
+
24
+ ## Check existing specs
25
+
26
+ ```bash
27
+ npx specdx validate
28
+ npx specdx graph
29
+ ```
30
+
31
+ This shows what specs exist and their dependency relationships. Use this to determine where the new spec fits.
32
+
33
+ ## Create the file with frontmatter
34
+
35
+ ```yaml
36
+ ---
37
+ id: "<type>-<short-name>"
38
+ type: "<spec-type>"
39
+ title: "<clear title>"
40
+ status: "draft"
41
+ version: "0.1"
42
+ created: "<YYYY-MM-DD>"
43
+ authors: ["<name>"]
44
+ tags: ["<keyword>", "<keyword>"]
45
+ references:
46
+ - id: "<other-spec-id>"
47
+ relationship: "depends-on"
48
+ ---
49
+ ```
50
+
51
+ Rules:
52
+ - **Always quote dates**: `"2026-03-18"` — unquoted YAML dates fail validation
53
+ - **authors must have at least one entry** — `authors: []` fails validation
54
+ - **id** must be unique across the spec suite
55
+ - **type** must be one of: `prd`, `technical-design`, `user-story`, `test-plan`, `adr`, `api-contract`
56
+ - **status** must be one of: `draft`, `review`, `approved`, `superseded`
57
+ - **references.relationship** must be one of: `implemented-by`, `decomposed-into`, `depends-on`, `supersedes`, `related-to`
58
+
59
+ Run an initial lint to verify frontmatter:
60
+
61
+ ```bash
62
+ npx specdx lint --path <file>
63
+ ```
64
+
65
+ ---
66
+ **Next:** When frontmatter passes lint, read `step-02-sections.md` in this directory.
@@ -0,0 +1,70 @@
1
+ ---
2
+ step: 2
3
+ name: Sections
4
+ description: Write sections one at a time, lint after every 2-3 sections
5
+ ---
6
+
7
+ # Step 2: Write Sections
8
+
9
+ ## Write sections one at a time
10
+
11
+ For each required section:
12
+ 1. Explain what the section should contain
13
+ 2. Ask the user for their thoughts
14
+ 3. Draft the section
15
+ 4. Refine based on feedback
16
+
17
+ ### PRD tips
18
+ - Use **F1**, **F2** etc. for features — the `story-coverage` lint rule checks each has a user story
19
+ - Be specific in Non-Goals — this prevents scope creep
20
+
21
+ ### Technical Design tips
22
+ - Include concrete field names and types in Data Model
23
+ - List specific risks with likelihood and mitigation
24
+
25
+ ### ADR tips
26
+ - State the decision in one clear sentence, then elaborate
27
+ - List both positive AND negative consequences
28
+
29
+ ### User Story tips
30
+ - Acceptance criteria should be testable
31
+ - Include the priority and estimate in frontmatter
32
+
33
+ ### Test Plan tips
34
+ - Coverage matrix should map to features from the PRD
35
+ - Edge cases are often where bugs hide — be thorough
36
+
37
+ ### API Contract tips
38
+ - Include both success and error response schemas
39
+ - Document auth requirements per endpoint
40
+
41
+ ## Lint after every 2-3 sections
42
+
43
+ ```bash
44
+ npx specdx lint --path <file>
45
+ ```
46
+
47
+ Common issues:
48
+
49
+ | Issue | Fix |
50
+ |---|---|
51
+ | Vague language ("as appropriate", "etc.", "TBD") | Replace with concrete language |
52
+ | Missing required section | Add it, even if minimal |
53
+ | Broken reference | Check the referenced spec ID exists |
54
+
55
+ <HARD-GATE>
56
+ Do NOT skip the lint step between sections. Run `npx specdx lint --path <file>`
57
+ after every 2-3 sections. Do NOT write the entire spec and lint at the end.
58
+ </HARD-GATE>
59
+
60
+ ## Rationalizations to Resist
61
+
62
+ | Thought | Reality |
63
+ |---------|---------|
64
+ | "I'll lint at the end, it's faster" | Lint catches issues early. Fixing 1 issue now beats fixing 10 later. |
65
+ | "This section is simple, no need to lint" | Simple sections have frontmatter and reference issues too. |
66
+ | "The user seems in a hurry" | Shipping a broken spec wastes more time than linting. |
67
+ | "I already know the lint rules" | Rules evolve. Run the tool. |
68
+
69
+ ---
70
+ **Next:** When all sections are written and linting clean, read `step-03-finalize.md` in this directory.
@@ -0,0 +1,48 @@
1
+ ---
2
+ step: 3
3
+ name: Finalize
4
+ description: Register in spec.config.yaml, run final validation
5
+ ---
6
+
7
+ # Step 3: Finalize
8
+
9
+ ## Register in spec.config.yaml
10
+
11
+ If this is a new spec, add it to `spec.config.yaml`:
12
+
13
+ ```yaml
14
+ specs:
15
+ new-spec:
16
+ path: specs/new-spec.md
17
+ type: technical-design
18
+ requires: ["prd"]
19
+ ```
20
+
21
+ The `requires` field establishes dependency relationships used by `specdx graph` and `specdx pack`.
22
+
23
+ If the spec replaces an existing entry, update the path. If it's a glob pattern (e.g. `specs/stories/*.md`), no config change is needed — the new file is picked up automatically.
24
+
25
+ ## Final validation
26
+
27
+ Run the full validation suite:
28
+
29
+ ```bash
30
+ npx specdx lint --path <file> --preset strict
31
+ npx specdx lint
32
+ npx specdx validate
33
+ npx specdx graph
34
+ ```
35
+
36
+ This verifies:
37
+ - The new spec passes strict linting
38
+ - The full suite still passes (no broken cross-references)
39
+ - The config is valid
40
+ - The dependency graph is acyclic
41
+
42
+ ## Report
43
+
44
+ Provide the user with:
45
+ - **Spec type** and file path
46
+ - **Lint status** (pass/fail, any remaining warnings)
47
+ - **Graph position** (what it depends on, what depends on it)
48
+ - **Next steps** (e.g. "run `npx specdx pack --task '...'` to include this spec in LLM context")
@@ -6,124 +6,24 @@ allowed-tools: Bash(npx specdx *), Read, Write, Edit
6
6
 
7
7
  # Author a Spec
8
8
 
9
- Guide the user through writing a spec. Walk through sections one at a time, lint iteratively, and produce a spec that passes `npx specdx lint`.
9
+ This skill follows a 3-step workflow. Load each step file as you reach it — this keeps the context focused and prevents bloat in long authoring sessions.
10
10
 
11
- ## Step 1: Determine the type
11
+ ## Steps
12
12
 
13
- Ask what kind of spec they need:
13
+ 1. **Frontmatter** — Read `specdx-author-spec/step-01-frontmatter.md` next to this file
14
+ - Determine spec type, check existing specs, create file with frontmatter
14
15
 
15
- | Type | Use when | Required sections |
16
- |---|---|---|
17
- | `prd` | Defining what to build | Problem Statement, Goals, Non-Goals, Features, Success Criteria |
18
- | `technical-design` | Describing how it works | Overview, Architecture, Data Model, API Design, Dependencies, Risks, Open Questions |
19
- | `user-story` | Capturing a user workflow | Description, Acceptance Criteria, Dependencies, Notes |
20
- | `test-plan` | Planning test coverage | Scope, Test Cases, Coverage Matrix, Edge Cases |
21
- | `adr` | Recording a decision | Context, Decision, Status, Consequences |
22
- | `api-contract` | Defining an API | Endpoints, Request/Response Schemas, Auth, Error Codes |
16
+ 2. **Sections** — Read `specdx-author-spec/step-02-sections.md`
17
+ - Write sections one at a time, lint after every 2-3 sections
18
+ - HARD GATE: Do NOT skip lint between sections
23
19
 
24
- ## Step 2: Check existing specs
20
+ 3. **Finalize** — Read `specdx-author-spec/step-03-finalize.md`
21
+ - Register in spec.config.yaml, run final validation
25
22
 
26
- ```bash
27
- npx specdx validate
28
- npx specdx graph
29
- ```
23
+ ## How to use
30
24
 
31
- This shows what specs exist and their dependency relationships.
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.
32
26
 
33
- ## Step 3: Create the file with frontmatter
27
+ Each step file is self-contained with its own instructions. Do NOT read ahead — load one step at a time.
34
28
 
35
- ```yaml
36
- ---
37
- id: "<type>-<short-name>"
38
- type: "<spec-type>"
39
- title: "<clear title>"
40
- status: "draft"
41
- version: "0.1"
42
- created: "<YYYY-MM-DD>"
43
- authors: ["<name>"]
44
- tags: ["<keyword>", "<keyword>"]
45
- references:
46
- - id: "<other-spec-id>"
47
- relationship: "depends-on"
48
- ---
49
- ```
50
-
51
- Rules:
52
- - **Always quote dates**: `"2026-03-18"` — unquoted YAML dates fail validation
53
- - **authors must have at least one entry** — `authors: []` fails validation
54
- - **id** must be unique across the spec suite
55
- - **type** must be one of: `prd`, `technical-design`, `user-story`, `test-plan`, `adr`, `api-contract`
56
- - **status** must be one of: `draft`, `review`, `approved`, `superseded`
57
- - **references.relationship** must be one of: `implemented-by`, `decomposed-into`, `depends-on`, `supersedes`, `related-to`
58
-
59
- ## Step 4: Write sections one at a time
60
-
61
- For each required section:
62
- 1. Explain what the section should contain
63
- 2. Ask the user for their thoughts
64
- 3. Draft the section
65
- 4. Refine based on feedback
66
-
67
- ### PRD tips
68
- - Use **F1**, **F2** etc. for features — the `story-coverage` lint rule checks each has a user story
69
- - Be specific in Non-Goals — this prevents scope creep
70
-
71
- ### Technical Design tips
72
- - Include concrete field names and types in Data Model
73
- - List specific risks with likelihood and mitigation
74
-
75
- ### ADR tips
76
- - State the decision in one clear sentence, then elaborate
77
- - List both positive AND negative consequences
78
-
79
- ## Step 5: Lint after every 2-3 sections
80
-
81
- ```bash
82
- npx specdx lint --path <file>
83
- ```
84
-
85
- Common issues:
86
-
87
- | Issue | Fix |
88
- |---|---|
89
- | Vague language ("as appropriate", "etc.", "TBD") | Replace with concrete language |
90
- | Missing required section | Add it, even if minimal |
91
- | Broken reference | Check the referenced spec ID exists |
92
-
93
- <HARD-GATE>
94
- Do NOT skip the lint step between sections. Run `npx specdx lint --path <file>`
95
- after every 2-3 sections. Do NOT write the entire spec and lint at the end.
96
- </HARD-GATE>
97
-
98
- ## Rationalizations to Resist
99
-
100
- | Thought | Reality |
101
- |---------|---------|
102
- | "I'll lint at the end, it's faster" | Lint catches issues early. Fixing 1 issue now beats fixing 10 later. |
103
- | "This section is simple, no need to lint" | Simple sections have frontmatter and reference issues too. |
104
- | "The user seems in a hurry" | Shipping a broken spec wastes more time than linting. |
105
- | "I already know the lint rules" | Rules evolve. Run the tool. |
106
-
107
- ## Step 6: Register in spec.config.yaml
108
-
109
- If this is a new spec, add it to `spec.config.yaml`:
110
-
111
- ```yaml
112
- specs:
113
- new-spec:
114
- path: specs/new-spec.md
115
- type: technical-design
116
- requires: ["prd"]
117
- ```
118
-
119
- The `requires` field establishes dependency relationships used by `specdx graph` and `specdx pack`.
120
-
121
- ## Step 7: Final validation
122
-
123
- ```bash
124
- npx specdx lint --path <file> --preset strict
125
- npx specdx lint
126
- npx specdx validate
127
- ```
128
-
129
- Report: spec type, file path, lint status, and any remaining warnings.
29
+ For detailed reference on spec types and their fields, see `spec-type-reference.md` in this directory.
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  createLintEngine,
3
3
  getPreset
4
- } from "./chunk-6DTOYCZ6.js";
4
+ } from "./chunk-ATLVRGHI.js";
5
5
  import {
6
6
  DEFAULT_DIFF_CONFIG
7
- } from "./chunk-AO3ZQKLJ.js";
7
+ } from "./chunk-LU6M5O63.js";
8
8
  import {
9
9
  buildGraph,
10
10
  loadConfig,
@@ -142,4 +142,4 @@ export {
142
142
  status_default as default,
143
143
  runStatus
144
144
  };
145
- //# sourceMappingURL=status-VMALGNS5.js.map
145
+ //# sourceMappingURL=status-LYZUO6AJ.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "specdx",
3
- "version": "0.3.0-alpha.1",
3
+ "version": "0.3.0-alpha.2",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "specdx": "./dist/main.js"