specdx 0.3.0-alpha.3 → 0.4.0-alpha.10
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/LICENSE +21 -0
- package/dist/{changelog-OUP2RXWN.js → changelog-GR53T6IG.js} +18 -11
- package/dist/{changelog-OUP2RXWN.js.map → changelog-GR53T6IG.js.map} +1 -1
- package/dist/{check-3XQYO3HU.js → check-OMWCIY5D.js} +37 -10
- package/dist/check-OMWCIY5D.js.map +1 -0
- package/dist/chunk-3GMYCATE.js +526 -0
- package/dist/chunk-3GMYCATE.js.map +1 -0
- package/dist/{chunk-6BWZEAST.js → chunk-N77RNV7J.js} +161 -26
- package/dist/chunk-N77RNV7J.js.map +1 -0
- package/dist/{pack-PI6V6OR2.js → chunk-SDDTD4R3.js} +97 -171
- package/dist/chunk-SDDTD4R3.js.map +1 -0
- package/dist/{chunk-ZX4HVL5M.js → chunk-SJCIM4TC.js} +119 -17
- package/dist/chunk-SJCIM4TC.js.map +1 -0
- package/dist/{chunk-DDFLMRPC.js → chunk-VMMTEGYN.js} +15 -11
- package/dist/chunk-VMMTEGYN.js.map +1 -0
- package/dist/{chunk-PHR7AV6I.js → chunk-Z77VQUZ3.js} +156 -2
- package/dist/chunk-Z77VQUZ3.js.map +1 -0
- package/dist/diff-AUBYOQWU.js +107 -0
- package/dist/diff-AUBYOQWU.js.map +1 -0
- package/dist/dist-BXYQB2UO.js +306 -0
- package/dist/dist-BXYQB2UO.js.map +1 -0
- package/dist/dist-RL2DT3ZE.js +15 -0
- package/dist/{explain-I7AQMEEH.js → explain-EUID6MZF.js} +35 -28
- package/dist/explain-EUID6MZF.js.map +1 -0
- package/dist/{generate-PC7BIB7G.js → generate-U3EFOCNS.js} +3 -3
- package/dist/{generate-story-7WHPPFHY.js → generate-story-U6FMQIYZ.js} +8 -4
- package/dist/generate-story-U6FMQIYZ.js.map +1 -0
- package/dist/{generate-test-plan-U5LMWGKX.js → generate-test-plan-HOCWDYKF.js} +11 -6
- package/dist/generate-test-plan-HOCWDYKF.js.map +1 -0
- package/dist/graph-TA54D4XA.js +102 -0
- package/dist/graph-TA54D4XA.js.map +1 -0
- package/dist/index.js +777 -158
- package/dist/index.js.map +1 -1
- package/dist/{lint-6Z2TVWAQ.js → lint-L5WOBD25.js} +17 -6
- package/dist/lint-L5WOBD25.js.map +1 -0
- package/dist/main.js +100 -15
- package/dist/main.js.map +1 -1
- package/dist/mcp-GNQQGD7X.js +17 -0
- package/dist/mcp-GNQQGD7X.js.map +1 -0
- package/dist/{migrate-L7W5RHSS.js → migrate-YEJQWIMX.js} +4 -4
- package/dist/migrate-YEJQWIMX.js.map +1 -0
- package/dist/pack-AQH5XQUF.js +168 -0
- package/dist/pack-AQH5XQUF.js.map +1 -0
- package/dist/ready-DB5ORK2E.js +229 -0
- package/dist/ready-DB5ORK2E.js.map +1 -0
- package/dist/skills/specdx-check-drift.md +1 -1
- package/dist/skills/specdx-verify.md +12 -1
- package/dist/{status-AV5GSWVI.js → status-3QUQMF4L.js} +46 -31
- package/dist/status-3QUQMF4L.js.map +1 -0
- package/dist/{update-HIWDDEZQ.js → update-PE2DPYDR.js} +5 -5
- package/dist/update-PE2DPYDR.js.map +1 -0
- package/dist/validate-YNZMV6KZ.js +86 -0
- package/dist/validate-YNZMV6KZ.js.map +1 -0
- package/hooks/session-start +0 -0
- package/package.json +49 -16
- package/dist/check-3XQYO3HU.js.map +0 -1
- package/dist/chunk-6BWZEAST.js.map +0 -1
- package/dist/chunk-DDFLMRPC.js.map +0 -1
- package/dist/chunk-PHR7AV6I.js.map +0 -1
- package/dist/chunk-WTFWNYJA.js +0 -261
- package/dist/chunk-WTFWNYJA.js.map +0 -1
- package/dist/chunk-ZX4HVL5M.js.map +0 -1
- package/dist/diff-275PLXYH.js +0 -100
- package/dist/diff-275PLXYH.js.map +0 -1
- package/dist/dist-PQCG2XXF.js +0 -11
- package/dist/explain-I7AQMEEH.js.map +0 -1
- package/dist/generate-story-7WHPPFHY.js.map +0 -1
- package/dist/generate-test-plan-U5LMWGKX.js.map +0 -1
- package/dist/graph-RCAPF55A.js +0 -54
- package/dist/graph-RCAPF55A.js.map +0 -1
- package/dist/lint-6Z2TVWAQ.js.map +0 -1
- package/dist/migrate-L7W5RHSS.js.map +0 -1
- package/dist/pack-PI6V6OR2.js.map +0 -1
- package/dist/ready-B7IFPL3S.js +0 -159
- package/dist/ready-B7IFPL3S.js.map +0 -1
- package/dist/status-AV5GSWVI.js.map +0 -1
- package/dist/update-HIWDDEZQ.js.map +0 -1
- package/dist/validate-N2WSG75W.js +0 -34
- package/dist/validate-N2WSG75W.js.map +0 -1
- /package/dist/{dist-PQCG2XXF.js.map → dist-RL2DT3ZE.js.map} +0 -0
- /package/dist/{generate-PC7BIB7G.js.map → generate-U3EFOCNS.js.map} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../core/src/config.ts","../../core/src/parser.ts","../../core/src/tokens.ts","../../core/src/graph.ts","../../core/src/glob.ts","../../core/src/logger.ts","../../core/src/preset.ts"],"sourcesContent":["import { readFile } from \"node:fs/promises\";\nimport { join, dirname } from \"node:path\";\nimport { parse as parseYaml } from \"yaml\";\nimport { validateConfig, type SdxConfig } from \"@specdx/schema\";\n\nexport class ConfigError extends Error {\n constructor(\n message: string,\n public readonly errors?: unknown[],\n ) {\n super(message);\n this.name = \"ConfigError\";\n }\n}\n\nconst CONFIG_FILENAME = \"spec.config.yaml\";\n\nexport async function loadConfig(filePath?: string, searchFrom?: string): Promise<SdxConfig> {\n const resolvedPath = filePath ?? (await findConfig(searchFrom ?? process.cwd()));\n if (!resolvedPath) {\n throw new ConfigError(`No ${CONFIG_FILENAME} found. Run 'sdx init' to create one.`);\n }\n\n let raw: string;\n try {\n raw = await readFile(resolvedPath, \"utf-8\");\n } catch {\n throw new ConfigError(`Cannot read config file: ${resolvedPath}`);\n }\n\n let data: Record<string, unknown>;\n try {\n data = parseYaml(raw) as Record<string, unknown>;\n } catch (err) {\n throw new ConfigError(`Invalid YAML in ${resolvedPath}: ${(err as Error).message}`);\n }\n\n const result = validateConfig(data);\n if (!result.valid) {\n throw new ConfigError(`Invalid config in ${resolvedPath}`, result.errors ?? undefined);\n }\n\n return data as unknown as SdxConfig;\n}\n\nasync function findConfig(from: string): Promise<string | undefined> {\n let dir = from;\n while (true) {\n const candidate = join(dir, CONFIG_FILENAME);\n try {\n await readFile(candidate, \"utf-8\");\n return candidate;\n } catch {\n const parent = dirname(dir);\n if (parent === dir) return undefined;\n dir = parent;\n }\n }\n}\n","import { readFile } from \"node:fs/promises\";\nimport { extname } from \"node:path\";\nimport * as grayMatterNs from \"gray-matter\";\nimport { parse as parseYaml } from \"yaml\";\nimport { unified } from \"unified\";\nimport remarkParse from \"remark-parse\";\nimport { visit } from \"unist-util-visit\";\nimport { validateSpec, type ValidationResult } from \"@specdx/schema\";\nimport type { BaseSpec, SpecType } from \"@specdx/schema\";\nimport { countTokens } from \"./tokens.js\";\n\n// gray-matter is CJS — its callable default is exposed via .default in an ESM context\ntype GrayMatterFn = (input: string) => { data: Record<string, unknown>; content: string };\nconst matter = ((grayMatterNs as unknown as { default?: GrayMatterFn }).default ??\n (grayMatterNs as unknown as GrayMatterFn)) as GrayMatterFn;\n\nexport class ParseError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"ParseError\";\n }\n}\n\nexport interface ParsedSection {\n heading: string;\n content: string;\n tokens: number;\n}\n\nexport interface ParsedSpec {\n filePath: string;\n frontmatter: BaseSpec & Record<string, unknown>;\n content: string;\n sections: string[];\n parsedSections: ParsedSection[];\n valid: boolean;\n validationErrors: ValidationResult[\"errors\"];\n}\n\nexport async function parseSpec(filePath: string): Promise<ParsedSpec> {\n let raw: string;\n try {\n raw = await readFile(filePath, \"utf-8\");\n } catch {\n throw new ParseError(`Cannot read spec file: ${filePath}`);\n }\n\n return parseSpecFromString(raw, filePath);\n}\n\nexport function parseSpecFromString(content: string, filePath: string): Promise<ParsedSpec> {\n const ext = extname(filePath).toLowerCase();\n if (ext === \".yaml\" || ext === \".yml\") {\n return Promise.resolve(parseYamlSpec(filePath, content));\n }\n return Promise.resolve(parseMarkdownSpec(filePath, content));\n}\n\nfunction parseMarkdownSpec(filePath: string, raw: string): ParsedSpec {\n const { data, content } = matter(raw);\n const parsedSections = extractParsedSections(content);\n const sections = parsedSections.map((s) => s.heading).filter(Boolean);\n const frontmatter = data as BaseSpec & Record<string, unknown>;\n const specType = frontmatter.type as SpecType | undefined;\n\n let valid = false;\n let validationErrors: ValidationResult[\"errors\"] = null;\n if (specType) {\n const result = validateSpec(specType, data);\n valid = result.valid;\n validationErrors = result.errors;\n }\n\n return { filePath, frontmatter, content, sections, parsedSections, valid, validationErrors };\n}\n\nfunction parseYamlSpec(filePath: string, raw: string): ParsedSpec {\n let data: Record<string, unknown>;\n try {\n data = parseYaml(raw) as Record<string, unknown>;\n } catch (err) {\n throw new ParseError(`Invalid YAML in ${filePath}: ${(err as Error).message}`);\n }\n\n const frontmatter = data as BaseSpec & Record<string, unknown>;\n const specType = frontmatter.type as SpecType | undefined;\n\n let valid = false;\n let validationErrors: ValidationResult[\"errors\"] = null;\n if (specType) {\n const result = validateSpec(specType, data);\n valid = result.valid;\n validationErrors = result.errors;\n }\n\n return {\n filePath,\n frontmatter,\n content: \"\",\n sections: [],\n parsedSections: [],\n valid,\n validationErrors,\n };\n}\n\nfunction extractParsedSections(markdown: string): ParsedSection[] {\n const tree = unified().use(remarkParse).parse(markdown);\n\n const h2s: { heading: string; startOffset: number; endOffset: number }[] = [];\n\n visit(tree, \"heading\", (node) => {\n if (node.depth === 2) {\n const text = (node.children as Array<{ type: string; value?: string }>)\n .filter((c) => c.type === \"text\")\n .map((c) => c.value ?? \"\")\n .join(\"\");\n h2s.push({\n heading: text,\n startOffset: node.position!.start.offset as number,\n endOffset: node.position!.end.offset as number,\n });\n }\n });\n\n const sections: ParsedSection[] = [];\n\n // Preamble: content before first H2\n const firstH2 = h2s[0];\n const firstOffset = firstH2 ? firstH2.startOffset : markdown.length;\n const preamble = markdown.slice(0, firstOffset).trim();\n if (preamble) {\n sections.push({ heading: \"\", content: preamble, tokens: countTokens(preamble) });\n }\n\n // Each H2 section: content AFTER the heading line, up to the next H2 (or end)\n for (let i = 0; i < h2s.length; i++) {\n const current = h2s[i]!;\n const next = h2s[i + 1];\n const end = next ? next.startOffset : markdown.length;\n const content = markdown.slice(current.endOffset, end).trim();\n sections.push({\n heading: current.heading,\n content,\n tokens: countTokens(content),\n });\n }\n\n return sections;\n}\n","import { encodingForModel } from \"js-tiktoken\";\n\nlet encoder: ReturnType<typeof encodingForModel> | undefined;\n\nfunction getEncoder() {\n if (!encoder) encoder = encodingForModel(\"gpt-4o\");\n return encoder;\n}\n\nexport function countTokens(text: string): number {\n if (!text) return 0;\n return getEncoder().encode(text).length;\n}\n","import type { SdxConfig } from \"@specdx/schema\";\n\nexport class GraphError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"GraphError\";\n }\n}\n\nexport interface Edge {\n from: string;\n to: string;\n}\n\nexport interface DependencyGraph {\n nodes: string[];\n edges: Edge[];\n topologicalSort(): string[];\n getDownstream(nodeId: string): string[];\n getUpstream(nodeId: string): string[];\n}\n\nexport function buildGraph(config: SdxConfig): DependencyGraph {\n const specNames = Object.keys(config.specs);\n const adjacency = new Map<string, string[]>();\n const reverseAdj = new Map<string, string[]>();\n const edges: Edge[] = [];\n\n for (const name of specNames) {\n adjacency.set(name, []);\n reverseAdj.set(name, []);\n }\n\n for (const [name, entry] of Object.entries(config.specs)) {\n if (!entry.requires) continue;\n for (const dep of entry.requires) {\n if (!adjacency.has(dep)) {\n throw new GraphError(\n `Spec \"${name}\" requires \"${dep}\", which does not exist in the config.`,\n );\n }\n adjacency.get(dep)!.push(name);\n reverseAdj.get(name)!.push(dep);\n edges.push({ from: dep, to: name });\n }\n }\n\n // Kahn's algorithm for cycle detection + topological sort\n const inDegree = new Map<string, number>();\n for (const name of specNames) inDegree.set(name, reverseAdj.get(name)!.length);\n\n const queue: string[] = [];\n for (const [name, degree] of inDegree) {\n if (degree === 0) queue.push(name);\n }\n\n const sorted: string[] = [];\n while (queue.length > 0) {\n const node = queue.shift()!;\n sorted.push(node);\n for (const neighbor of adjacency.get(node)!) {\n const newDegree = inDegree.get(neighbor)! - 1;\n inDegree.set(neighbor, newDegree);\n if (newDegree === 0) queue.push(neighbor);\n }\n }\n\n if (sorted.length !== specNames.length) {\n const remaining = specNames.filter((n) => !sorted.includes(n));\n throw new GraphError(`Circular dependency detected involving: ${remaining.join(\", \")}`);\n }\n\n return {\n nodes: specNames,\n edges,\n topologicalSort: () => [...sorted],\n getDownstream(nodeId: string): string[] {\n const visited = new Set<string>();\n const stack = [nodeId];\n while (stack.length > 0) {\n const current = stack.pop()!;\n for (const neighbor of adjacency.get(current) ?? []) {\n if (!visited.has(neighbor)) {\n visited.add(neighbor);\n stack.push(neighbor);\n }\n }\n }\n return [...visited];\n },\n getUpstream(nodeId: string): string[] {\n const visited = new Set<string>();\n const stack = [nodeId];\n while (stack.length > 0) {\n const current = stack.pop()!;\n for (const dep of reverseAdj.get(current) ?? []) {\n if (!visited.has(dep)) {\n visited.add(dep);\n stack.push(dep);\n }\n }\n }\n return [...visited];\n },\n };\n}\n","import { glob } from \"tinyglobby\";\nimport { join, isAbsolute } from \"node:path\";\n\nexport async function resolveGlob(pattern: string, baseDir: string): Promise<string[]> {\n const absolutePattern = isAbsolute(pattern) ? pattern : join(baseDir, pattern);\n return glob([absolutePattern], { absolute: true });\n}\n","import { createConsola, type ConsolaInstance } from \"consola\";\n\nexport type LogLevel = \"debug\" | \"info\" | \"warn\" | \"error\";\n\nexport interface LoggerOptions {\n quiet?: boolean;\n verbose?: boolean;\n}\n\nexport interface Logger extends ConsolaInstance {\n level: number;\n}\n\nexport function createLogger(options?: LoggerOptions): Logger {\n let level = 3; // info\n if (options?.quiet) level = 1; // only errors\n if (options?.verbose) level = 4; // debug\n return createConsola({ level }) as Logger;\n}\n","import { readFile } from \"node:fs/promises\";\nimport { resolve, isAbsolute } from \"node:path\";\nimport { ConfigError } from \"./config.js\";\n\nconst BUILTINS = [\"minimal\", \"recommended\", \"strict\"];\n\n/**\n * Resolve a preset name to its config content.\n * Returns null for built-in presets (handled by @specdx/lint).\n * Resolves local file paths and npm package names.\n */\nexport async function resolvePreset(\n name: string,\n cwd = process.cwd(),\n): Promise<Record<string, unknown> | null> {\n if (BUILTINS.includes(name)) {\n return null;\n }\n\n // Try local file path\n const localPath = isAbsolute(name) ? name : resolve(cwd, name);\n try {\n const content = await readFile(localPath, \"utf-8\");\n const { default: yaml } = await import(\"yaml\");\n return yaml.parse(content) as Record<string, unknown>;\n } catch {\n // Not a local file, try npm\n }\n\n // Try npm package\n try {\n const mod = (await import(name)) as { default?: Record<string, unknown> };\n return (mod.default ?? mod) as Record<string, unknown>;\n } catch {\n throw new ConfigError(\n `Could not resolve preset \"${name}\" as a local file or npm package`,\n );\n }\n}\n"],"mappings":";;;;;;AAAA,SAAS,gBAAgB;AACzB,SAAS,MAAM,eAAe;AAC9B,SAAS,SAAS,iBAAiB;AAG7B,IAAO,cAAP,cAA2B,MAAK;EAGlB;EAFlB,YACE,SACgB,QAAkB;AAElC,UAAM,OAAO;AAFG,SAAA,SAAA;AAGhB,SAAK,OAAO;EACd;;AAGF,IAAM,kBAAkB;AAExB,eAAsB,WAAW,UAAmB,YAAmB;AACrE,QAAM,eAAe,YAAa,MAAM,WAAW,cAAc,QAAQ,IAAG,CAAE;AAC9E,MAAI,CAAC,cAAc;AACjB,UAAM,IAAI,YAAY,MAAM,eAAe,uCAAuC;EACpF;AAEA,MAAI;AACJ,MAAI;AACF,UAAM,MAAM,SAAS,cAAc,OAAO;EAC5C,QAAQ;AACN,UAAM,IAAI,YAAY,4BAA4B,YAAY,EAAE;EAClE;AAEA,MAAI;AACJ,MAAI;AACF,WAAO,UAAU,GAAG;EACtB,SAAS,KAAK;AACZ,UAAM,IAAI,YAAY,mBAAmB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AAI;AACnD,cAAI,CAAC,QAAQ,IAAI,QAAQ,GAAG;AAC1B,oBAAQ,IAAI,QAAQ;AACpB,kBAAM,KAAK,QAAQ;UACrB;QACF;MACF;AACA,aAAO,CAAC,GAAG,OAAO;IACpB;IACA,YAAY,QAAc;AACxB,YAAM,UAAU,oBAAI,IAAG;AACvB,YAAM,QAAQ,CAAC,MAAM;AACrB,aAAO,MAAM,SAAS,GAAG;AACvB,cAAM,UAAU,MAAM,IAAG;AACzB,mBAAW,OAAO,WAAW,IAAI,OAAO,KAAK,CAAA,GAAI;AAC/C,cAAI,CAAC,QAAQ,IAAI,GAAG,GAAG;AACrB,oBAAQ,IAAI,GAAG;AACf,kBAAM,KAAK,GAAG;UAChB;QACF;MACF;AACA,aAAO,CAAC,GAAG,OAAO;IACpB;;AAEJ;;;ACzGA,SAAS,YAAY;AACrB,SAAS,QAAAC,OAAM,kBAAkB;AAEjC,eAAsB,YAAY,SAAiB,SAAe;AAChE,QAAM,kBAAkB,WAAW,OAAO,IAAI,UAAUA,MAAK,SAAS,OAAO;AAC7E,SAAO,KAAK,CAAC,eAAe,GAAG,EAAE,UAAU,KAAI,CAAE;AACnD;;;ACNA,SAAS,qBAA2C;AAa9C,SAAU,aAAa,SAAuB;AAClD,MAAI,QAAQ;AACZ,MAAI,SAAS;AAAO,YAAQ;AAC5B,MAAI,SAAS;AAAS,YAAQ;AAC9B,SAAO,cAAc,EAAE,MAAK,CAAE;AAChC;;;AClBA,SAAS,YAAAC,iBAAgB;AACzB,SAAS,SAAS,cAAAC,mBAAkB;","names":["readFile","parseYaml","readFile","parseYaml","join","readFile","isAbsolute"]}
|
package/dist/chunk-WTFWNYJA.js
DELETED
|
@@ -1,261 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
REQUIRED_SECTIONS
|
|
3
|
-
} from "./chunk-ZX4HVL5M.js";
|
|
4
|
-
|
|
5
|
-
// ../lint/dist/engine.js
|
|
6
|
-
function createLintEngine(options) {
|
|
7
|
-
return {
|
|
8
|
-
lint(specs) {
|
|
9
|
-
const diagnostics = [];
|
|
10
|
-
for (const spec of specs) {
|
|
11
|
-
for (const rule of options.rules) {
|
|
12
|
-
const results = rule.run({
|
|
13
|
-
spec,
|
|
14
|
-
allSpecs: specs,
|
|
15
|
-
config: options.config,
|
|
16
|
-
graph: options.graph
|
|
17
|
-
});
|
|
18
|
-
diagnostics.push(...results);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
return {
|
|
22
|
-
diagnostics,
|
|
23
|
-
hasErrors: diagnostics.some((d) => d.severity === "error"),
|
|
24
|
-
hasWarnings: diagnostics.some((d) => d.severity === "warn")
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// ../lint/dist/rules/valid-frontmatter.js
|
|
31
|
-
var validFrontmatterRule = {
|
|
32
|
-
id: "structure/valid-frontmatter",
|
|
33
|
-
description: "Frontmatter matches the schema for the declared spec type",
|
|
34
|
-
severity: "error",
|
|
35
|
-
run(context) {
|
|
36
|
-
if (context.spec.valid)
|
|
37
|
-
return [];
|
|
38
|
-
const errors = context.spec.validationErrors ?? [];
|
|
39
|
-
return errors.map((err) => ({
|
|
40
|
-
ruleId: "structure/valid-frontmatter",
|
|
41
|
-
severity: "error",
|
|
42
|
-
message: `Invalid frontmatter: ${err.message ?? JSON.stringify(err)}`,
|
|
43
|
-
filePath: context.spec.filePath
|
|
44
|
-
}));
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
// ../lint/dist/rules/required-sections.js
|
|
49
|
-
var requiredSectionsRule = {
|
|
50
|
-
id: "structure/required-sections",
|
|
51
|
-
description: "Spec body contains all required sections for its type",
|
|
52
|
-
severity: "error",
|
|
53
|
-
run(context) {
|
|
54
|
-
const ext = context.spec.filePath.split(".").pop()?.toLowerCase();
|
|
55
|
-
if (ext === "yaml" || ext === "yml")
|
|
56
|
-
return [];
|
|
57
|
-
const specType = context.spec.frontmatter.type;
|
|
58
|
-
const required = REQUIRED_SECTIONS[specType];
|
|
59
|
-
if (!required)
|
|
60
|
-
return [];
|
|
61
|
-
const missing = required.filter((s) => !context.spec.sections.includes(s));
|
|
62
|
-
return missing.map((section) => ({
|
|
63
|
-
ruleId: "structure/required-sections",
|
|
64
|
-
severity: "error",
|
|
65
|
-
message: `Missing required section: "${section}"`,
|
|
66
|
-
filePath: context.spec.filePath,
|
|
67
|
-
section
|
|
68
|
-
}));
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
// ../lint/dist/rules/valid-references.js
|
|
73
|
-
var validReferencesRule = {
|
|
74
|
-
id: "structure/valid-references",
|
|
75
|
-
description: "All references in frontmatter point to specs that exist in the suite",
|
|
76
|
-
severity: "error",
|
|
77
|
-
run(context) {
|
|
78
|
-
const refs = context.spec.frontmatter.references;
|
|
79
|
-
if (!refs || refs.length === 0)
|
|
80
|
-
return [];
|
|
81
|
-
const allIds = new Set(context.allSpecs.map((s) => s.frontmatter.id));
|
|
82
|
-
return refs.filter((ref) => !allIds.has(ref.id)).map((ref) => ({
|
|
83
|
-
ruleId: "structure/valid-references",
|
|
84
|
-
severity: "error",
|
|
85
|
-
message: `Reference "${ref.id}" does not match any spec in the suite`,
|
|
86
|
-
filePath: context.spec.filePath
|
|
87
|
-
}));
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
// ../lint/dist/rules/no-circular-deps.js
|
|
92
|
-
var noCircularDepsRule = {
|
|
93
|
-
id: "structure/no-circular-deps",
|
|
94
|
-
description: "The dependency graph has no cycles",
|
|
95
|
-
severity: "error",
|
|
96
|
-
run() {
|
|
97
|
-
return [];
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
// ../lint/dist/rules/story-coverage.js
|
|
102
|
-
var FEATURE_PATTERN = /\*\*F\d+\*\*:\s*(.+)/g;
|
|
103
|
-
var storyCoverageRule = {
|
|
104
|
-
id: "completeness/story-coverage",
|
|
105
|
-
description: "Every feature listed in a PRD has at least one corresponding user story",
|
|
106
|
-
severity: "warn",
|
|
107
|
-
run(context) {
|
|
108
|
-
if (context.spec.frontmatter.type !== "prd")
|
|
109
|
-
return [];
|
|
110
|
-
const features = [];
|
|
111
|
-
let match;
|
|
112
|
-
const re = new RegExp(FEATURE_PATTERN.source, "g");
|
|
113
|
-
while ((match = re.exec(context.spec.content)) !== null) {
|
|
114
|
-
features.push(match[1].trim());
|
|
115
|
-
}
|
|
116
|
-
if (features.length === 0)
|
|
117
|
-
return [];
|
|
118
|
-
const stories = context.allSpecs.filter((s) => s.frontmatter.type === "user-story");
|
|
119
|
-
const storyContent = stories.map((s) => s.content + " " + s.frontmatter.title).join(" ");
|
|
120
|
-
return features.filter((feature) => !storyContent.toLowerCase().includes(feature.toLowerCase())).map((feature) => ({
|
|
121
|
-
ruleId: "completeness/story-coverage",
|
|
122
|
-
severity: "warn",
|
|
123
|
-
message: `Feature "${feature}" has no corresponding user story`,
|
|
124
|
-
filePath: context.spec.filePath
|
|
125
|
-
}));
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
// ../lint/dist/rules/staleness-check.js
|
|
130
|
-
var stalenessCheckRule = {
|
|
131
|
-
id: "freshness/staleness-check",
|
|
132
|
-
description: "Warns if a spec hasn't been updated since its upstream dependency changed",
|
|
133
|
-
severity: "warn",
|
|
134
|
-
run(context) {
|
|
135
|
-
const refs = context.spec.frontmatter.references;
|
|
136
|
-
if (!refs || refs.length === 0)
|
|
137
|
-
return [];
|
|
138
|
-
const specUpdated = context.spec.frontmatter.updated ?? context.spec.frontmatter.created;
|
|
139
|
-
const specDate = new Date(specUpdated);
|
|
140
|
-
const diagnostics = [];
|
|
141
|
-
for (const ref of refs) {
|
|
142
|
-
if (ref.relationship !== "depends-on" && ref.relationship !== "implemented-by")
|
|
143
|
-
continue;
|
|
144
|
-
const upstream = context.allSpecs.find((s) => s.frontmatter.id === ref.id);
|
|
145
|
-
if (!upstream)
|
|
146
|
-
continue;
|
|
147
|
-
const upstreamUpdated = upstream.frontmatter.updated ?? upstream.frontmatter.created;
|
|
148
|
-
const upstreamDate = new Date(upstreamUpdated);
|
|
149
|
-
if (upstreamDate > specDate) {
|
|
150
|
-
diagnostics.push({
|
|
151
|
-
ruleId: "freshness/staleness-check",
|
|
152
|
-
severity: "warn",
|
|
153
|
-
message: `Potentially stale: upstream "${upstream.frontmatter.id}" was updated on ${upstreamUpdated}, but this spec was last updated on ${specUpdated}`,
|
|
154
|
-
filePath: context.spec.filePath
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
return diagnostics;
|
|
159
|
-
}
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
// ../lint/dist/rules/no-vague-language.js
|
|
163
|
-
var DEFAULT_VAGUE_PATTERNS = [
|
|
164
|
-
"as appropriate",
|
|
165
|
-
"handle edge cases",
|
|
166
|
-
"as needed",
|
|
167
|
-
"etc\\.",
|
|
168
|
-
"TBD",
|
|
169
|
-
"TODO",
|
|
170
|
-
"and so on",
|
|
171
|
-
"various",
|
|
172
|
-
"somehow",
|
|
173
|
-
"straightforward",
|
|
174
|
-
"obviously",
|
|
175
|
-
"simply",
|
|
176
|
-
"just need to"
|
|
177
|
-
];
|
|
178
|
-
var noVagueLanguageRule = {
|
|
179
|
-
id: "clarity/no-vague-language",
|
|
180
|
-
description: "Flags known ambiguous phrases",
|
|
181
|
-
severity: "warn",
|
|
182
|
-
run(context) {
|
|
183
|
-
if (!context.spec.content)
|
|
184
|
-
return [];
|
|
185
|
-
const diagnostics = [];
|
|
186
|
-
for (const pattern of DEFAULT_VAGUE_PATTERNS) {
|
|
187
|
-
const regex = new RegExp(`\\b${pattern}`, "gi");
|
|
188
|
-
let match;
|
|
189
|
-
while ((match = regex.exec(context.spec.content)) !== null) {
|
|
190
|
-
diagnostics.push({
|
|
191
|
-
ruleId: "clarity/no-vague-language",
|
|
192
|
-
severity: "warn",
|
|
193
|
-
message: `Vague language: "${match[0]}"`,
|
|
194
|
-
filePath: context.spec.filePath
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
return diagnostics;
|
|
199
|
-
}
|
|
200
|
-
};
|
|
201
|
-
|
|
202
|
-
// ../lint/dist/rules/single-project-context.js
|
|
203
|
-
var singleProjectContextRule = {
|
|
204
|
-
id: "structure/single-project-context",
|
|
205
|
-
description: "Only one project-context spec should exist per suite",
|
|
206
|
-
severity: "warn",
|
|
207
|
-
run(context) {
|
|
208
|
-
if (context.spec.frontmatter.type !== "project-context")
|
|
209
|
-
return [];
|
|
210
|
-
const contextSpecs = context.allSpecs.filter((s) => s.frontmatter.type === "project-context");
|
|
211
|
-
if (contextSpecs.length > 1) {
|
|
212
|
-
return [
|
|
213
|
-
{
|
|
214
|
-
ruleId: "structure/single-project-context",
|
|
215
|
-
severity: "warn",
|
|
216
|
-
message: `Multiple project-context specs found (${contextSpecs.length}). Only one should exist per suite.`,
|
|
217
|
-
filePath: context.spec.filePath
|
|
218
|
-
}
|
|
219
|
-
];
|
|
220
|
-
}
|
|
221
|
-
return [];
|
|
222
|
-
}
|
|
223
|
-
};
|
|
224
|
-
|
|
225
|
-
// ../lint/dist/rules/index.js
|
|
226
|
-
var structureRules = [
|
|
227
|
-
validFrontmatterRule,
|
|
228
|
-
requiredSectionsRule,
|
|
229
|
-
validReferencesRule,
|
|
230
|
-
noCircularDepsRule,
|
|
231
|
-
singleProjectContextRule
|
|
232
|
-
];
|
|
233
|
-
var contentRules = [
|
|
234
|
-
storyCoverageRule,
|
|
235
|
-
stalenessCheckRule,
|
|
236
|
-
noVagueLanguageRule
|
|
237
|
-
];
|
|
238
|
-
var allBuiltinRules = [...structureRules, ...contentRules];
|
|
239
|
-
|
|
240
|
-
// ../lint/dist/presets.js
|
|
241
|
-
function getPreset(name) {
|
|
242
|
-
switch (name) {
|
|
243
|
-
case "minimal":
|
|
244
|
-
return structureRules;
|
|
245
|
-
case "recommended":
|
|
246
|
-
return allBuiltinRules;
|
|
247
|
-
case "strict":
|
|
248
|
-
return allBuiltinRules.map((rule) => ({ ...rule, severity: "error" }));
|
|
249
|
-
default:
|
|
250
|
-
throw new Error(`Unknown preset: "${name}". Use "minimal", "recommended", or "strict", or resolve external presets via resolvePreset() from @specdx/core.`);
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
// ../lint/dist/custom-rule-loader.js
|
|
255
|
-
import { pathToFileURL } from "url";
|
|
256
|
-
|
|
257
|
-
export {
|
|
258
|
-
createLintEngine,
|
|
259
|
-
getPreset
|
|
260
|
-
};
|
|
261
|
-
//# sourceMappingURL=chunk-WTFWNYJA.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../lint/src/engine.ts","../../lint/src/rules/valid-frontmatter.ts","../../lint/src/rules/required-sections.ts","../../lint/src/rules/valid-references.ts","../../lint/src/rules/no-circular-deps.ts","../../lint/src/rules/story-coverage.ts","../../lint/src/rules/staleness-check.ts","../../lint/src/rules/no-vague-language.ts","../../lint/src/rules/single-project-context.ts","../../lint/src/rules/index.ts","../../lint/src/presets.ts","../../lint/src/custom-rule-loader.ts"],"sourcesContent":["import type { ParsedSpec, DependencyGraph } from \"@specdx/core\";\nimport type { SdxConfig } from \"@specdx/schema\";\nimport type { LintRule, LintResults, Diagnostic } from \"./types.js\";\n\nexport interface LintEngineOptions {\n rules: LintRule[];\n config?: SdxConfig;\n graph?: DependencyGraph;\n}\n\nexport interface LintEngine {\n lint(specs: ParsedSpec[]): LintResults;\n}\n\nexport function createLintEngine(options: LintEngineOptions): LintEngine {\n return {\n lint(specs: ParsedSpec[]): LintResults {\n const diagnostics: Diagnostic[] = [];\n for (const spec of specs) {\n for (const rule of options.rules) {\n const results = rule.run({\n spec,\n allSpecs: specs,\n config: options.config,\n graph: options.graph,\n });\n diagnostics.push(...results);\n }\n }\n return {\n diagnostics,\n hasErrors: diagnostics.some((d) => d.severity === \"error\"),\n hasWarnings: diagnostics.some((d) => d.severity === \"warn\"),\n };\n },\n };\n}\n","import type { LintRule } from \"../types.js\";\n\nexport const validFrontmatterRule: LintRule = {\n id: \"structure/valid-frontmatter\",\n description: \"Frontmatter matches the schema for the declared spec type\",\n severity: \"error\",\n run(context) {\n if (context.spec.valid) return [];\n const errors = context.spec.validationErrors ?? [];\n return errors.map((err) => ({\n ruleId: \"structure/valid-frontmatter\",\n severity: \"error\" as const,\n message: `Invalid frontmatter: ${err.message ?? JSON.stringify(err)}`,\n filePath: context.spec.filePath,\n }));\n },\n};\n","import type { LintRule } from \"../types.js\";\nimport { REQUIRED_SECTIONS } from \"@specdx/schema\";\nimport type { SpecType } from \"@specdx/schema\";\n\nexport const requiredSectionsRule: LintRule = {\n id: \"structure/required-sections\",\n description: \"Spec body contains all required sections for its type\",\n severity: \"error\",\n run(context) {\n // Skip YAML specs (no markdown body)\n const ext = context.spec.filePath.split(\".\").pop()?.toLowerCase();\n if (ext === \"yaml\" || ext === \"yml\") return [];\n\n const specType = context.spec.frontmatter.type as SpecType;\n const required = REQUIRED_SECTIONS[specType];\n if (!required) return [];\n\n const missing = required.filter((s) => !context.spec.sections.includes(s));\n return missing.map((section) => ({\n ruleId: \"structure/required-sections\",\n severity: \"error\" as const,\n message: `Missing required section: \"${section}\"`,\n filePath: context.spec.filePath,\n section,\n }));\n },\n};\n","import type { LintRule } from \"../types.js\";\n\nexport const validReferencesRule: LintRule = {\n id: \"structure/valid-references\",\n description: \"All references in frontmatter point to specs that exist in the suite\",\n severity: \"error\",\n run(context) {\n const refs = context.spec.frontmatter.references;\n if (!refs || refs.length === 0) return [];\n const allIds = new Set(context.allSpecs.map((s) => s.frontmatter.id));\n return refs\n .filter((ref) => !allIds.has(ref.id))\n .map((ref) => ({\n ruleId: \"structure/valid-references\",\n severity: \"error\" as const,\n message: `Reference \"${ref.id}\" does not match any spec in the suite`,\n filePath: context.spec.filePath,\n }));\n },\n};\n","import type { LintRule } from \"../types.js\";\n\nexport const noCircularDepsRule: LintRule = {\n id: \"structure/no-circular-deps\",\n description: \"The dependency graph has no cycles\",\n severity: \"error\",\n run() {\n // Cycle detection happens in buildGraph() — if graph construction succeeds, it's acyclic.\n // GraphErrors are surfaced as diagnostics by the lint command, not by this rule.\n return [];\n },\n};\n","import type { LintRule } from \"../types.js\";\n\nconst FEATURE_PATTERN = /\\*\\*F\\d+\\*\\*:\\s*(.+)/g;\n\nexport const storyCoverageRule: LintRule = {\n id: \"completeness/story-coverage\",\n description: \"Every feature listed in a PRD has at least one corresponding user story\",\n severity: \"warn\",\n run(context) {\n if (context.spec.frontmatter.type !== \"prd\") return [];\n const features: string[] = [];\n let match;\n const re = new RegExp(FEATURE_PATTERN.source, \"g\");\n while ((match = re.exec(context.spec.content)) !== null) {\n features.push(match[1]!.trim());\n }\n if (features.length === 0) return [];\n const stories = context.allSpecs.filter((s) => s.frontmatter.type === \"user-story\");\n const storyContent = stories.map((s) => s.content + \" \" + s.frontmatter.title).join(\" \");\n return features\n .filter((feature) => !storyContent.toLowerCase().includes(feature.toLowerCase()))\n .map((feature) => ({\n ruleId: \"completeness/story-coverage\",\n severity: \"warn\" as const,\n message: `Feature \"${feature}\" has no corresponding user story`,\n filePath: context.spec.filePath,\n }));\n },\n};\n","import type { LintRule } from \"../types.js\";\n\nexport const stalenessCheckRule: LintRule = {\n id: \"freshness/staleness-check\",\n description: \"Warns if a spec hasn't been updated since its upstream dependency changed\",\n severity: \"warn\",\n run(context) {\n const refs = context.spec.frontmatter.references;\n if (!refs || (refs as unknown[]).length === 0) return [];\n const specUpdated =\n (context.spec.frontmatter.updated as string | undefined) ??\n (context.spec.frontmatter.created as string);\n const specDate = new Date(specUpdated);\n const diagnostics = [];\n for (const ref of refs as Array<{ id: string; relationship: string }>) {\n if (ref.relationship !== \"depends-on\" && ref.relationship !== \"implemented-by\") continue;\n const upstream = context.allSpecs.find((s) => s.frontmatter.id === ref.id);\n if (!upstream) continue;\n const upstreamUpdated =\n (upstream.frontmatter.updated as string | undefined) ??\n (upstream.frontmatter.created as string);\n const upstreamDate = new Date(upstreamUpdated);\n if (upstreamDate > specDate) {\n diagnostics.push({\n ruleId: \"freshness/staleness-check\",\n severity: \"warn\" as const,\n message: `Potentially stale: upstream \"${upstream.frontmatter.id}\" was updated on ${upstreamUpdated}, but this spec was last updated on ${specUpdated}`,\n filePath: context.spec.filePath,\n });\n }\n }\n return diagnostics;\n },\n};\n","import type { LintRule } from \"../types.js\";\n\nconst DEFAULT_VAGUE_PATTERNS = [\n \"as appropriate\",\n \"handle edge cases\",\n \"as needed\",\n \"etc\\\\.\",\n \"TBD\",\n \"TODO\",\n \"and so on\",\n \"various\",\n \"somehow\",\n \"straightforward\",\n \"obviously\",\n \"simply\",\n \"just need to\",\n];\n\nexport const noVagueLanguageRule: LintRule = {\n id: \"clarity/no-vague-language\",\n description: \"Flags known ambiguous phrases\",\n severity: \"warn\",\n run(context) {\n if (!context.spec.content) return [];\n const diagnostics = [];\n for (const pattern of DEFAULT_VAGUE_PATTERNS) {\n const regex = new RegExp(`\\\\b${pattern}`, \"gi\");\n let match;\n while ((match = regex.exec(context.spec.content)) !== null) {\n diagnostics.push({\n ruleId: \"clarity/no-vague-language\",\n severity: \"warn\" as const,\n message: `Vague language: \"${match[0]}\"`,\n filePath: context.spec.filePath,\n });\n }\n }\n return diagnostics;\n },\n};\n","import type { LintRule } from \"../types.js\";\n\nexport const singleProjectContextRule: LintRule = {\n id: \"structure/single-project-context\",\n description: \"Only one project-context spec should exist per suite\",\n severity: \"warn\",\n run(context) {\n if (context.spec.frontmatter.type !== \"project-context\") return [];\n\n const contextSpecs = context.allSpecs.filter(\n (s) => s.frontmatter.type === \"project-context\",\n );\n\n if (contextSpecs.length > 1) {\n return [\n {\n ruleId: \"structure/single-project-context\",\n severity: \"warn\" as const,\n message: `Multiple project-context specs found (${contextSpecs.length}). Only one should exist per suite.`,\n filePath: context.spec.filePath,\n },\n ];\n }\n\n return [];\n },\n};\n","import { validFrontmatterRule } from \"./valid-frontmatter.js\";\nimport { requiredSectionsRule } from \"./required-sections.js\";\nimport { validReferencesRule } from \"./valid-references.js\";\nimport { noCircularDepsRule } from \"./no-circular-deps.js\";\nimport { storyCoverageRule } from \"./story-coverage.js\";\nimport { stalenessCheckRule } from \"./staleness-check.js\";\nimport { noVagueLanguageRule } from \"./no-vague-language.js\";\nimport { singleProjectContextRule } from \"./single-project-context.js\";\nimport type { LintRule } from \"../types.js\";\n\nexport const structureRules: LintRule[] = [\n validFrontmatterRule,\n requiredSectionsRule,\n validReferencesRule,\n noCircularDepsRule,\n singleProjectContextRule,\n];\n\nexport const contentRules: LintRule[] = [\n storyCoverageRule,\n stalenessCheckRule,\n noVagueLanguageRule,\n];\n\nexport const allBuiltinRules: LintRule[] = [...structureRules, ...contentRules];\n\nexport {\n validFrontmatterRule,\n requiredSectionsRule,\n validReferencesRule,\n noCircularDepsRule,\n storyCoverageRule,\n stalenessCheckRule,\n noVagueLanguageRule,\n singleProjectContextRule,\n};\n","import type { LintRule } from \"./types.js\";\nimport { structureRules, allBuiltinRules } from \"./rules/index.js\";\n\nexport function getPreset(name: string): LintRule[] {\n switch (name) {\n case \"minimal\":\n return structureRules;\n case \"recommended\":\n return allBuiltinRules;\n case \"strict\":\n return allBuiltinRules.map((rule) => ({ ...rule, severity: \"error\" as const }));\n default:\n throw new Error(`Unknown preset: \"${name}\". Use \"minimal\", \"recommended\", or \"strict\", or resolve external presets via resolvePreset() from @specdx/core.`);\n }\n}\n","import { pathToFileURL } from \"node:url\";\nimport type { LintRule } from \"./types.js\";\n\nexport async function loadCustomRule(filePath: string): Promise<LintRule> {\n const module = await import(pathToFileURL(filePath).href);\n const rule = module.default ?? module.rule;\n if (!rule || !rule.id || !rule.run) {\n throw new Error(\n `Custom rule at ${filePath} must export a default LintRule with id and run function`,\n );\n }\n return rule as LintRule;\n}\n"],"mappings":";;;;;AAcM,SAAU,iBAAiB,SAA0B;AACzD,SAAO;IACL,KAAK,OAAmB;AACtB,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,UAAU;UACV,SAAS,oBAAoB,MAAM,CAAC,CAAC;UACrC,UAAU,QAAQ,KAAK;SACxB;MACH;IACF;AACA,WAAO;EACT;;;;ACpCK,IAAM,2BAAqC;EAChD,IAAI;EACJ,aAAa;EACb,UAAU;EACV,IAAI,SAAO;AACT,QAAI,QAAQ,KAAK,YAAY,SAAS;AAAmB,aAAO,CAAA;AAEhE,UAAM,eAAe,QAAQ,SAAS,OACpC,CAAC,MAAM,EAAE,YAAY,SAAS,iBAAiB;AAGjD,QAAI,aAAa,SAAS,GAAG;AAC3B,aAAO;QACL;UACE,QAAQ;UACR,UAAU;UACV,SAAS,yCAAyC,aAAa,MAAM;UACrE,UAAU,QAAQ,KAAK;;;IAG7B;AAEA,WAAO,CAAA;EACT;;;;ACfK,IAAM,iBAA6B;EACxC;EACA;EACA;EACA;EACA;;AAGK,IAAM,eAA2B;EACtC;EACA;EACA;;AAGK,IAAM,kBAA8B,CAAC,GAAG,gBAAgB,GAAG,YAAY;;;ACrBxE,SAAU,UAAU,MAAY;AACpC,UAAQ,MAAM;IACZ,KAAK;AACH,aAAO;IACT,KAAK;AACH,aAAO;IACT,KAAK;AACH,aAAO,gBAAgB,IAAI,CAAC,UAAU,EAAE,GAAG,MAAM,UAAU,QAAgB,EAAG;IAChF;AACE,YAAM,IAAI,MAAM,oBAAoB,IAAI,kHAAkH;EAC9J;AACF;;;ACdA,SAAS,qBAAqB;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../schema/src/types.ts","../../schema/src/sections.ts","../../schema/src/validator.ts","../../schema/dist/schemas/base-spec.json","../../schema/dist/schemas/config.json","../../schema/dist/schemas/prd.json","../../schema/dist/schemas/technical-design.json","../../schema/dist/schemas/user-story.json","../../schema/dist/schemas/test-plan.json","../../schema/dist/schemas/adr.json","../../schema/dist/schemas/api-contract.json","../../schema/dist/schemas/epic.json","../../schema/dist/schemas/quick-spec.json","../../schema/dist/schemas/project-context.json"],"sourcesContent":["export const SPEC_TYPES = [\n \"prd\",\n \"technical-design\",\n \"user-story\",\n \"test-plan\",\n \"adr\",\n \"api-contract\",\n \"epic\",\n \"quick-spec\",\n \"project-context\",\n] as const;\nexport type SpecType = (typeof SPEC_TYPES)[number];\n\nexport const SPEC_STATUSES = [\"draft\", \"review\", \"approved\", \"superseded\"] as const;\nexport type SpecStatus = (typeof SPEC_STATUSES)[number];\n\nexport interface SpecReference {\n id: string;\n relationship: \"implemented-by\" | \"decomposed-into\" | \"depends-on\" | \"supersedes\" | \"related-to\";\n}\n\nexport interface BaseSpec {\n id: string;\n type: SpecType;\n title: string;\n status: SpecStatus;\n version: string;\n created: string;\n updated?: string;\n authors: string[];\n tags?: string[];\n references?: SpecReference[];\n}\n\nexport interface PrdSpec extends BaseSpec {\n type: \"prd\";\n}\nexport interface TechnicalDesignSpec extends BaseSpec {\n type: \"technical-design\";\n}\nexport interface UserStorySpec extends BaseSpec {\n type: \"user-story\";\n story_id: string;\n priority: \"critical\" | \"high\" | \"medium\" | \"low\";\n estimate: string;\n}\nexport interface TestPlanSpec extends BaseSpec {\n type: \"test-plan\";\n}\nexport interface AdrSpec extends BaseSpec {\n type: \"adr\";\n}\nexport interface ApiContractSpec extends BaseSpec {\n type: \"api-contract\";\n}\n\nexport interface EpicSpec extends BaseSpec {\n type: \"epic\";\n epic_id: string;\n priority: \"critical\" | \"high\" | \"medium\" | \"low\";\n}\n\nexport interface QuickSpecSpec extends BaseSpec {\n type: \"quick-spec\";\n}\n\nexport interface ProjectContextSpec extends BaseSpec {\n type: \"project-context\";\n}\n\nexport type Spec =\n | PrdSpec\n | TechnicalDesignSpec\n | UserStorySpec\n | TestPlanSpec\n | AdrSpec\n | ApiContractSpec\n | EpicSpec\n | QuickSpecSpec\n | ProjectContextSpec;\n\nexport interface SpecEntry {\n path: string;\n type: SpecType;\n required?: boolean;\n requires?: string[];\n owner?: string;\n}\n\nexport interface PackCompressionConfig {\n strip_boilerplate?: boolean;\n stable_days?: number;\n collapse_resolved_adrs?: boolean;\n}\n\nexport interface PackConfig {\n max_tokens?: number;\n format?: \"xml\" | \"markdown\" | \"json\";\n compression?: PackCompressionConfig;\n boilerplate_sections?: string[];\n}\n\nexport interface SdxConfig {\n version: string;\n project?: { name?: string; description?: string };\n specs: Record<string, SpecEntry>;\n lint?: {\n extends?: string;\n rules?: Record<string, unknown>;\n ignore?: string[];\n };\n pack?: PackConfig;\n diff?: {\n baseline_ref?: string;\n staleness_threshold_days?: number;\n ignore_paths?: string[];\n };\n ci?: {\n block_on?: (\"error\" | \"warn\" | \"info\")[];\n post_comment?: boolean;\n update_badge?: boolean;\n trigger_paths?: string[];\n };\n check?: {\n framework?: \"auto\" | \"express\" | \"hono\" | \"nextjs\";\n routes_dir?: string;\n app_dir?: string;\n types_dir?: string;\n tests_dir?: string;\n ignore?: string[];\n };\n}\n","import type { SpecType } from \"./types.js\";\n\nexport const REQUIRED_SECTIONS: Record<SpecType, string[]> = {\n prd: [\"Problem Statement\", \"Goals\", \"Non-Goals\", \"Features\", \"Success Criteria\"],\n \"technical-design\": [\n \"Overview\",\n \"Architecture\",\n \"Data Model\",\n \"API Design\",\n \"Dependencies\",\n \"Risks\",\n \"Open Questions\",\n ],\n \"user-story\": [\"Description\", \"Acceptance Criteria\", \"Dependencies\", \"Notes\"],\n \"test-plan\": [\"Scope\", \"Test Cases\", \"Coverage Matrix\", \"Edge Cases\"],\n adr: [\"Context\", \"Decision\", \"Status\", \"Consequences\"],\n \"api-contract\": [\"Endpoints\", \"Request/Response Schemas\", \"Auth\", \"Error Codes\"],\n epic: [\"Overview\", \"Stories\", \"Acceptance Criteria\", \"Dependencies\"],\n \"quick-spec\": [\"Intent\", \"Boundaries\", \"Tasks\"],\n \"project-context\": [\"Technology Stack\", \"Critical Implementation Rules\", \"Coding Patterns\"],\n};\n","import { Ajv as AjvClass, type ErrorObject } from \"ajv\";\nimport type { SpecType } from \"./types.js\";\n\nimport baseSpecSchema from \"./schemas/base-spec.json\" with { type: \"json\" };\nimport configSchema from \"./schemas/config.json\" with { type: \"json\" };\nimport prdSchema from \"./schemas/prd.json\" with { type: \"json\" };\nimport technicalDesignSchema from \"./schemas/technical-design.json\" with { type: \"json\" };\nimport userStorySchema from \"./schemas/user-story.json\" with { type: \"json\" };\nimport testPlanSchema from \"./schemas/test-plan.json\" with { type: \"json\" };\nimport adrSchema from \"./schemas/adr.json\" with { type: \"json\" };\nimport apiContractSchema from \"./schemas/api-contract.json\" with { type: \"json\" };\nimport epicSchema from \"./schemas/epic.json\" with { type: \"json\" };\nimport quickSpecSchema from \"./schemas/quick-spec.json\" with { type: \"json\" };\nimport projectContextSchema from \"./schemas/project-context.json\" with { type: \"json\" };\n\n// addFormats is CJS-only; access via the namespace default at runtime\n// The type cast is needed because TypeScript's NodeNext resolution exposes\n// the CJS module as a namespace without a callable default signature.\nimport * as addFormatsNs from \"ajv-formats\";\ntype AddFormatsPlugin = (ajv: AjvClass, formats?: unknown) => AjvClass;\nconst addFormats = ((addFormatsNs as unknown as { default?: AddFormatsPlugin }).default ??\n (addFormatsNs as unknown as AddFormatsPlugin)) as AddFormatsPlugin;\n\nexport interface ValidationResult {\n valid: boolean;\n errors: ErrorObject[] | null;\n}\n\nconst ajv = new AjvClass({ allErrors: true, strict: true });\naddFormats(ajv, [\"date\"]);\najv.addSchema(baseSpecSchema);\n\nconst specValidators: Record<string, ReturnType<typeof ajv.compile>> = {\n prd: ajv.compile(prdSchema),\n \"technical-design\": ajv.compile(technicalDesignSchema),\n \"user-story\": ajv.compile(userStorySchema),\n \"test-plan\": ajv.compile(testPlanSchema),\n adr: ajv.compile(adrSchema),\n \"api-contract\": ajv.compile(apiContractSchema),\n epic: ajv.compile(epicSchema),\n \"quick-spec\": ajv.compile(quickSpecSchema),\n \"project-context\": ajv.compile(projectContextSchema),\n};\n\nconst configValidator = ajv.compile(configSchema);\n\nexport function validateSpec(type: SpecType, data: Record<string, unknown>): ValidationResult {\n const validate = specValidators[type];\n if (!validate) {\n return { valid: false, errors: [{ message: `Unknown spec type: \"${type}\"` } as ErrorObject] };\n }\n const valid = validate(data);\n return { valid: !!valid, errors: valid ? null : (validate.errors ?? null) };\n}\n\nexport function validateConfig(data: Record<string, unknown>): ValidationResult {\n const valid = configValidator(data);\n return { valid: !!valid, errors: valid ? null : (configValidator.errors ?? null) };\n}\n","{\n \"$id\": \"base-spec\",\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"type\": \"object\",\n \"properties\": {\n \"id\": { \"type\": \"string\", \"minLength\": 1 },\n \"type\": { \"type\": \"string\", \"enum\": [\"prd\", \"technical-design\", \"user-story\", \"test-plan\", \"adr\", \"api-contract\", \"epic\", \"quick-spec\", \"project-context\"] },\n \"title\": { \"type\": \"string\", \"minLength\": 1 },\n \"status\": { \"type\": \"string\", \"enum\": [\"draft\", \"review\", \"approved\", \"superseded\"] },\n \"version\": { \"type\": \"string\" },\n \"created\": { \"type\": \"string\", \"format\": \"date\" },\n \"updated\": { \"type\": \"string\", \"format\": \"date\" },\n \"authors\": { \"type\": \"array\", \"items\": { \"type\": \"string\" }, \"minItems\": 1 },\n \"tags\": { \"type\": \"array\", \"items\": { \"type\": \"string\" }, \"default\": [] },\n \"references\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"id\": { \"type\": \"string\" },\n \"relationship\": { \"type\": \"string\", \"enum\": [\"implemented-by\", \"decomposed-into\", \"depends-on\", \"supersedes\", \"related-to\"] }\n },\n \"required\": [\"id\", \"relationship\"],\n \"additionalProperties\": false\n },\n \"default\": []\n }\n },\n \"required\": [\"id\", \"type\", \"title\", \"status\", \"version\", \"created\", \"authors\"],\n \"additionalProperties\": true\n}\n","{\n \"$id\": \"sdx-config\",\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"type\": \"object\",\n \"properties\": {\n \"version\": { \"type\": \"string\" },\n \"project\": {\n \"type\": \"object\",\n \"properties\": {\n \"name\": { \"type\": \"string\" },\n \"description\": { \"type\": \"string\" }\n },\n \"additionalProperties\": false\n },\n \"specs\": {\n \"type\": \"object\",\n \"additionalProperties\": {\n \"type\": \"object\",\n \"properties\": {\n \"path\": { \"type\": \"string\" },\n \"type\": { \"type\": \"string\", \"enum\": [\"prd\", \"technical-design\", \"user-story\", \"test-plan\", \"adr\", \"api-contract\"] },\n \"required\": { \"type\": \"boolean\", \"default\": false },\n \"requires\": { \"type\": \"array\", \"items\": { \"type\": \"string\" } },\n \"owner\": { \"type\": \"string\" }\n },\n \"required\": [\"path\", \"type\"],\n \"additionalProperties\": false\n }\n },\n \"lint\": {\n \"type\": \"object\",\n \"properties\": {\n \"extends\": { \"type\": \"string\" },\n \"rules\": { \"type\": \"object\" },\n \"ignore\": { \"type\": \"array\", \"items\": { \"type\": \"string\" } }\n },\n \"additionalProperties\": false\n },\n \"pack\": {\n \"type\": \"object\",\n \"properties\": {\n \"max_tokens\": { \"type\": \"integer\", \"minimum\": 1 },\n \"format\": { \"type\": \"string\", \"enum\": [\"xml\", \"markdown\", \"json\"] },\n \"compression\": {\n \"type\": \"object\",\n \"properties\": {\n \"strip_boilerplate\": { \"type\": \"boolean\" },\n \"stable_days\": { \"type\": \"integer\", \"minimum\": 0 },\n \"collapse_resolved_adrs\": { \"type\": \"boolean\" }\n },\n \"additionalProperties\": false\n },\n \"boilerplate_sections\": {\n \"type\": \"array\",\n \"items\": { \"type\": \"string\" }\n }\n },\n \"additionalProperties\": false\n },\n \"diff\": {\n \"type\": \"object\",\n \"properties\": {\n \"baseline_ref\": { \"type\": \"string\", \"default\": \"main\" },\n \"staleness_threshold_days\": { \"type\": \"integer\", \"minimum\": 1, \"default\": 14 },\n \"ignore_paths\": { \"type\": \"array\", \"items\": { \"type\": \"string\" } }\n },\n \"additionalProperties\": false\n },\n \"ci\": {\n \"type\": \"object\",\n \"properties\": {\n \"block_on\": {\n \"type\": \"array\",\n \"items\": { \"type\": \"string\", \"enum\": [\"error\", \"warn\", \"info\"] }\n },\n \"post_comment\": { \"type\": \"boolean\", \"default\": true },\n \"update_badge\": { \"type\": \"boolean\", \"default\": true },\n \"trigger_paths\": {\n \"type\": \"array\",\n \"items\": { \"type\": \"string\" }\n }\n },\n \"additionalProperties\": false\n },\n \"check\": {\n \"type\": \"object\",\n \"properties\": {\n \"framework\": {\n \"type\": \"string\",\n \"enum\": [\"auto\", \"express\", \"hono\", \"nextjs\"]\n },\n \"routes_dir\": { \"type\": \"string\" },\n \"app_dir\": { \"type\": \"string\" },\n \"types_dir\": { \"type\": \"string\" },\n \"tests_dir\": { \"type\": \"string\" },\n \"ignore\": {\n \"type\": \"array\",\n \"items\": { \"type\": \"string\" }\n }\n },\n \"additionalProperties\": false\n }\n },\n \"required\": [\"version\", \"specs\"],\n \"additionalProperties\": false\n}\n","{\n \"$id\": \"prd\",\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"allOf\": [\n { \"$ref\": \"base-spec\" },\n { \"type\": \"object\", \"properties\": { \"type\": { \"const\": \"prd\" } }, \"required\": [\"type\"] }\n ]\n}\n","{\n \"$id\": \"technical-design\",\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"allOf\": [\n { \"$ref\": \"base-spec\" },\n { \"type\": \"object\", \"properties\": { \"type\": { \"const\": \"technical-design\" } }, \"required\": [\"type\"] }\n ]\n}\n","{\n \"$id\": \"user-story\",\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"allOf\": [\n { \"$ref\": \"base-spec\" },\n {\n \"type\": \"object\",\n \"properties\": {\n \"type\": { \"const\": \"user-story\" },\n \"story_id\": { \"type\": \"string\", \"minLength\": 1 },\n \"priority\": { \"type\": \"string\", \"enum\": [\"critical\", \"high\", \"medium\", \"low\"] },\n \"estimate\": { \"type\": \"string\" }\n },\n \"required\": [\"type\", \"story_id\", \"priority\", \"estimate\"]\n }\n ]\n}\n","{\n \"$id\": \"test-plan\",\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"allOf\": [\n { \"$ref\": \"base-spec\" },\n { \"type\": \"object\", \"properties\": { \"type\": { \"const\": \"test-plan\" } }, \"required\": [\"type\"] }\n ]\n}\n","{\n \"$id\": \"adr\",\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"allOf\": [\n { \"$ref\": \"base-spec\" },\n { \"type\": \"object\", \"properties\": { \"type\": { \"const\": \"adr\" } }, \"required\": [\"type\"] }\n ]\n}\n","{\n \"$id\": \"api-contract\",\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"allOf\": [\n { \"$ref\": \"base-spec\" },\n { \"type\": \"object\", \"properties\": { \"type\": { \"const\": \"api-contract\" } }, \"required\": [\"type\"] }\n ]\n}\n","{\n \"$id\": \"epic\",\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"allOf\": [\n { \"$ref\": \"base-spec\" },\n {\n \"type\": \"object\",\n \"properties\": {\n \"type\": { \"const\": \"epic\" },\n \"epic_id\": { \"type\": \"string\", \"minLength\": 1 },\n \"priority\": { \"type\": \"string\", \"enum\": [\"critical\", \"high\", \"medium\", \"low\"] }\n },\n \"required\": [\"type\", \"epic_id\", \"priority\"]\n }\n ]\n}\n","{\n \"$id\": \"quick-spec\",\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"allOf\": [\n { \"$ref\": \"base-spec\" },\n {\n \"type\": \"object\",\n \"properties\": {\n \"type\": { \"const\": \"quick-spec\" }\n },\n \"required\": [\"type\"]\n }\n ]\n}\n","{\n \"$id\": \"project-context\",\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"allOf\": [\n { \"$ref\": \"base-spec\" },\n {\n \"type\": \"object\",\n \"properties\": {\n \"type\": { \"const\": \"project-context\" }\n },\n \"required\": [\"type\"]\n }\n ]\n}\n"],"mappings":";AAAO,IAAM,aAAa;EACxB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;;ACPK,IAAM,oBAAgD;EAC3D,KAAK,CAAC,qBAAqB,SAAS,aAAa,YAAY,kBAAkB;EAC/E,oBAAoB;IAClB;IACA;IACA;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C,CAAC,OAAO,QAAQ,QAAQ,OAAQ,SAAS,UAAU,KAAK;AAC3E;AAEM,SAAU,eAAe,MAA6B;AAC1D,QAAM,QAAQ,gBAAgB,IAAI;AAClC,SAAO,EAAE,OAAO,CAAC,CAAC,OAAO,QAAQ,QAAQ,OAAQ,gBAAgB,UAAU,KAAK;AAClF;","names":[]}
|
package/dist/diff-275PLXYH.js
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DEFAULT_DIFF_CONFIG,
|
|
3
|
-
DiffError,
|
|
4
|
-
diffBetweenRefs
|
|
5
|
-
} from "./chunk-DDFLMRPC.js";
|
|
6
|
-
import {
|
|
7
|
-
loadConfig
|
|
8
|
-
} from "./chunk-PHR7AV6I.js";
|
|
9
|
-
import "./chunk-ZX4HVL5M.js";
|
|
10
|
-
|
|
11
|
-
// src/commands/diff.ts
|
|
12
|
-
import { defineCommand } from "citty";
|
|
13
|
-
import { join } from "path";
|
|
14
|
-
async function runDiff(options) {
|
|
15
|
-
const configDir = process.cwd();
|
|
16
|
-
const config = await loadConfig(void 0, configDir);
|
|
17
|
-
const baseRef = options.base ?? config.diff?.baseline_ref ?? DEFAULT_DIFF_CONFIG.baseline_ref;
|
|
18
|
-
const headRef = options.head ?? "HEAD";
|
|
19
|
-
const configPath = join(configDir, "spec.config.yaml");
|
|
20
|
-
const result = await diffBetweenRefs(configPath, baseRef, headRef);
|
|
21
|
-
if (options.spec) {
|
|
22
|
-
result.diffs = result.diffs.filter((d) => d.specId === options.spec);
|
|
23
|
-
result.impact = result.impact.filter((i) => i.changedSpec === options.spec);
|
|
24
|
-
}
|
|
25
|
-
return result;
|
|
26
|
-
}
|
|
27
|
-
var diff_default = defineCommand({
|
|
28
|
-
meta: { name: "diff", description: "Show spec changes and downstream impact" },
|
|
29
|
-
args: {
|
|
30
|
-
base: { type: "string", description: "Base git ref (default: from config or 'main')" },
|
|
31
|
-
head: { type: "string", description: "Head git ref (default: HEAD)" },
|
|
32
|
-
spec: { type: "string", description: "Scope to a single spec ID" },
|
|
33
|
-
format: {
|
|
34
|
-
type: "string",
|
|
35
|
-
description: "Output format: pretty, json",
|
|
36
|
-
default: "pretty"
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
async run({ args }) {
|
|
40
|
-
try {
|
|
41
|
-
const result = await runDiff({
|
|
42
|
-
base: args.base,
|
|
43
|
-
head: args.head,
|
|
44
|
-
spec: args.spec,
|
|
45
|
-
format: args.format
|
|
46
|
-
});
|
|
47
|
-
if (args.format === "json") {
|
|
48
|
-
console.log(JSON.stringify(result, null, 2));
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
if (result.diffs.length === 0 && result.added.length === 0 && result.removed.length === 0) {
|
|
52
|
-
console.log(" \u2713 No spec changes detected.");
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
console.log(result.summary);
|
|
56
|
-
console.log();
|
|
57
|
-
for (const diff of result.diffs) {
|
|
58
|
-
console.log(` ${diff.specId}:`);
|
|
59
|
-
for (const fc of diff.frontmatter) {
|
|
60
|
-
const detail = fc.before !== void 0 || fc.after !== void 0 ? ` (${String(fc.before)} \u2192 ${String(fc.after)})` : "";
|
|
61
|
-
console.log(` ${fc.type}: ${fc.field}${detail}`);
|
|
62
|
-
}
|
|
63
|
-
for (const sc of diff.sections) {
|
|
64
|
-
console.log(` ${sc.type}: ${sc.heading}`);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
if (result.added.length > 0) {
|
|
68
|
-
console.log(`
|
|
69
|
-
Added: ${result.added.join(", ")}`);
|
|
70
|
-
}
|
|
71
|
-
if (result.removed.length > 0) {
|
|
72
|
-
console.log(`
|
|
73
|
-
Removed: ${result.removed.join(", ")}`);
|
|
74
|
-
}
|
|
75
|
-
if (result.impact.length > 0) {
|
|
76
|
-
console.log("\n Downstream Impact:");
|
|
77
|
-
for (const impact of result.impact) {
|
|
78
|
-
for (const d of impact.downstream) {
|
|
79
|
-
console.log(
|
|
80
|
-
` ${d.specId} \u2014 staleness: ${d.staleness.toFixed(2)} \u2014 ${d.reason}`
|
|
81
|
-
);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
} catch (err) {
|
|
86
|
-
if (err instanceof DiffError) {
|
|
87
|
-
console.error(`
|
|
88
|
-
\u2717 ${err.message}
|
|
89
|
-
`);
|
|
90
|
-
process.exit(1);
|
|
91
|
-
}
|
|
92
|
-
throw err;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
export {
|
|
97
|
-
diff_default as default,
|
|
98
|
-
runDiff
|
|
99
|
-
};
|
|
100
|
-
//# sourceMappingURL=diff-275PLXYH.js.map
|
|
@@ -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}\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\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 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 const result = await runDiff({\n base: args.base,\n head: args.head,\n spec: args.spec,\n format: args.format,\n });\n\n if (args.format === \"json\") {\n console.log(JSON.stringify(result, null, 2));\n return;\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 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 } 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 },\n});\n"],"mappings":";;;;;;;;;;;AAAA,SAAS,qBAAqB;AAC9B,SAAS,YAAY;AAYrB,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,k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,UAAa,GAAG,UAAU,SACpC,KAAK,OAAO,GAAG,MAAM,CAAC,WAAW,OAAO,GAAG,KAAK,CAAC,MACjD;AACN,kBAAQ,IAAI,OAAO,GAAG,IAAI,KAAK,GAAG,KAAK,GAAG,MAAM,EAAE;AAAA,QACpD;AACA,mBAAW,MAAM,KAAK,UAAU;AAC9B,kBAAQ,IAAI,OAAO,GAAG,IAAI,KAAK,GAAG,OAAO,EAAE;AAAA,QAC7C;AAAA,MACF;AAEA,UAAI,OAAO,MAAM,SAAS,GAAG;AAC3B,gBAAQ,IAAI;AAAA,WAAc,OAAO,MAAM,KAAK,IAAI,CAAC,EAAE;AAAA,MACrD;AACA,UAAI,OAAO,QAAQ,SAAS,GAAG;AAC7B,gBAAQ,IAAI;AAAA,aAAgB,OAAO,QAAQ,KAAK,IAAI,CAAC,EAAE;AAAA,MACzD;AAEA,UAAI,OAAO,OAAO,SAAS,GAAG;AAC5B,gBAAQ,IAAI,wBAAwB;AACpC,mBAAW,UAAU,OAAO,QAAQ;AAClC,qBAAW,KAAK,OAAO,YAAY;AACjC,oBAAQ;AAAA,cACN,OAAO,EAAE,MAAM,sBAAsB,EAAE,UAAU,QAAQ,CAAC,CAAC,WAAW,EAAE,MAAM;AAAA,YAChF;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,IACF,SAAS,KAAK;AACZ,UAAI,eAAe,WAAW;AAC5B,gBAAQ,MAAM;AAAA,WAAc,IAAI,OAAO;AAAA,CAAI;AAC3C,gBAAQ,KAAK,CAAC;AAAA,MAChB;AACA,YAAM;AAAA,IACR;AAAA,EACF;AACF,CAAC;","names":[]}
|
package/dist/dist-PQCG2XXF.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/commands/explain.ts"],"sourcesContent":["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 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 },\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,UAAM,SAAU,KAAK,YAAY,UAAqB;AACtD,WAAO,IAAI,KAAK,OAAO,IAAI,KAAK,KAAK;AACrC,aAAS,MAAM,KAAK,SAAS,MAAM,KAAK,KAAK;AAAA,EAC/C;AAGA,QAAM,gBAAgB,MAAM,IAAI,CAAC,SAAS;AACxC,UA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AQ;AAC1B,cAAQ,IAAI,KAAK,UAAU,QAAQ,MAAM,CAAC,CAAC;AAC3C;AAAA,IACF;AAGA,YAAQ,IAAI;AAAA,IAAO,OAAO,OAAO,EAAE;AACnC,QAAI,OAAO,aAAa;AACtB,cAAQ,IAAI,KAAK,OAAO,WAAW,EAAE;AAAA,IACvC;AACA,YAAQ;AAAA,MACN;AAAA,IAAO,OAAO,SAAS,WAAW,OAAO,QAAQ,OAAO,MAAM,EAC3D,IAAI,CAAC,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,EAAE,EAC3B,KAAK,IAAI,CAAC;AAAA,IACf;AACA,YAAQ;AAAA,MACN,aAAa,OAAO,QAAQ,OAAO,QAAQ,EACxC,IAAI,CAAC,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,EAAE,EAC3B,KAAK,IAAI,CAAC;AAAA,IACf;AAEA,YAAQ,IAAI,YAAY;AACxB,eAAW,QAAQ,OAAO,OAAO;AAC/B,cAAQ,IAAI,OAAO,KAAK,EAAE,KAAK,KAAK,IAAI,KAAK,KAAK,MAAM,YAAO,KAAK,KAAK,EAAE;AAC3E,UAAI,KAAK,WAAW;AAClB,gBAAQ,IAAI,SAAS,KAAK,SAAS,EAAE;AAAA,MACvC;AAAA,IACF;AAEA,YAAQ,IAAI,mBAAmB;AAC/B,eAAW,QAAQ,OAAO,OAAO;AAC/B,cAAQ,IAAI,OAAO,IAAI,EAAE;AAAA,IAC3B;AACA,YAAQ,IAAI;AAAA,EACd;AACF,CAAC;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/commands/generate-story.ts"],"sourcesContent":["import { defineCommand } from \"citty\";\nimport { writeFile, mkdir } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport { loadConfig, parseSpec, resolveGlob, createLogger } from \"@specdx/core\";\nimport { REQUIRED_SECTIONS } from \"@specdx/schema\";\n\nexport interface GenerateStoriesOptions {\n configDir: string;\n from: string;\n outDir?: string;\n}\n\nexport interface GenerateStoriesResult {\n generated: string[];\n}\n\nfunction slugify(text: string): string {\n return text\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\")\n .slice(0, 40);\n}\n\nfunction detectStoriesDir(configDir: string, config: Awaited<ReturnType<typeof loadConfig>>): string {\n for (const entry of Object.values(config.specs)) {\n if (entry.type === \"user-story\") {\n // Use the directory portion of the glob path\n const dirPart = entry.path.replace(/\\/[^/]*\\*.*$/, \"\").replace(/\\/[^/]*$/, \"\");\n // If path ends with *.md at a directory level, take that dir\n const match = entry.path.match(/^(.+?)\\/\\*/);\n if (match) {\n return join(configDir, match[1]!);\n }\n return join(configDir, dirPart);\n }\n }\n return join(configDir, \"specs/stories\");\n}\n\nfunction buildStoryFile(options: {\n featureNum: string;\n featureText: string;\n prdId: string;\n prdAuthors: string[];\n today: string;\n sections: string[];\n}): string {\n const { featureNum, featureText, prdId, prdAuthors, today, sections } = options;\n const storyId = `story-f${featureNum}`;\n const title = featureText.trim();\n const authorsYaml = JSON.stringify(prdAuthors);\n\n const frontmatter = [\n \"---\",\n `id: \"${storyId}\"`,\n `type: \"user-story\"`,\n `title: \"${title}\"`,\n `status: \"draft\"`,\n `version: \"0.1\"`,\n `created: \"${today}\"`,\n `authors: ${authorsYaml}`,\n `story_id: \"${storyId}\"`,\n `priority: \"medium\"`,\n `estimate: \"TBD\"`,\n `references:`,\n ` - id: \"${prdId}\"`,\n ` relationship: \"decomposed-into\"`,\n \"---\",\n ].join(\"\\n\");\n\n const bodyParts = sections.map((section) => {\n if (section === \"Description\") {\n return `\\n## ${section}\\n\\n${featureText.trim()}`;\n }\n if (section === \"Acceptance Criteria\") {\n return `\\n## ${section}\\n\\n- [ ] <!-- acceptance criterion -->`;\n }\n if (section === \"Dependencies\") {\n return `\\n## ${section}\\n\\nF${featureNum} from ${prdId}`;\n }\n return `\\n## ${section}\\n\\n<!-- placeholder -->`;\n });\n\n return `${frontmatter}\\n${bodyParts.join(\"\\n\")}\\n`;\n}\n\nexport async function generateStories(\n options: GenerateStoriesOptions,\n): Promise<GenerateStoriesResult> {\n const { configDir, from, outDir } = options;\n const config = await loadConfig(undefined, configDir);\n\n // Find the PRD spec file by ID\n let prdFilePath: string | undefined;\n for (const entry of Object.values(config.specs)) {\n const files = await resolveGlob(entry.path, configDir);\n for (const file of files) {\n const parsed = await parseSpec(file);\n if (parsed.frontmatter.id === from) {\n prdFilePath = file;\n break;\n }\n }\n if (prdFilePath) break;\n }\n\n if (!prdFilePath) {\n throw new Error(`No spec with id \"${from}\" found in config.`);\n }\n\n const prd = await parseSpec(prdFilePath);\n\n // Find the Features section content\n const featuresSection = prd.parsedSections.find((s) => s.heading === \"Features\");\n if (!featuresSection) {\n return { generated: [] };\n }\n\n // Parse features using the required regex pattern\n const featureRegex = /\\*\\*F(\\d+)\\*\\*:\\s*(.+)/g;\n const features: Array<{ num: string; text: string }> = [];\n let match: RegExpExecArray | null;\n while ((match = featureRegex.exec(featuresSection.content)) !== null) {\n features.push({ num: match[1]!, text: match[2]! });\n }\n\n if (features.length === 0) {\n return { generated: [] };\n }\n\n const storiesDir = outDir ?? detectStoriesDir(configDir, config);\n await mkdir(storiesDir, { recursive: true });\n\n const today = new Date().toISOString().slice(0, 10);\n const prdAuthors = (prd.frontmatter.authors as string[] | undefined) ?? [];\n const sections = REQUIRED_SECTIONS[\"user-story\"];\n\n const generated: string[] = [];\n\n for (const feature of features) {\n const slug = slugify(feature.text);\n const filename = `story-f${feature.num}-${slug}.md`;\n const filePath = join(storiesDir, filename);\n\n const content = buildStoryFile({\n featureNum: feature.num,\n featureText: feature.text,\n prdId: from,\n prdAuthors,\n today,\n sections,\n });\n\n await writeFile(filePath, content, \"utf-8\");\n generated.push(filePath);\n }\n\n return { generated };\n}\n\nexport const defineCommandExport = defineCommand({\n meta: {\n name: \"generate story\",\n description: \"Generate user story stub files from a PRD's Features section\",\n },\n args: {\n from: {\n type: \"string\",\n description: \"Spec ID of the PRD to generate stories from\",\n required: true,\n },\n out: {\n type: \"string\",\n description: \"Output directory for story files (default: auto-detected from config)\",\n },\n quiet: {\n type: \"boolean\",\n description: \"Suppress output\",\n default: false,\n },\n verbose: {\n type: \"boolean\",\n description: \"Verbose output\",\n default: false,\n },\n },\n async run({ args }) {\n const logger = createLogger({ quiet: args.quiet, verbose: args.verbose });\n\n try {\n const result = await generateStories({\n configDir: process.cwd(),\n from: args.from,\n outDir: args.out,\n });\n\n if (result.generated.length === 0) {\n logger.info(\"No features found in PRD — no story stubs generated.\");\n } else {\n logger.info(`Generated ${result.generated.length} story stub(s):`);\n for (const filePath of result.generated) {\n logger.info(` ${filePath}`);\n }\n }\n } catch (err) {\n console.error(`\\n ✗ ${(err as Error).message}\\n`);\n process.exit(1);\n }\n },\n});\n\nexport default defineCommandExport;\n"],"mappings":";;;;;;;;;;;AAAA,SAAS,qBAAqB;AAC9B,SAAS,WAAW,aAAa;AACjC,SAAS,YAAY;AAcrB,SAAS,QAAQ,MAAsB;AACrC,SAAO,KACJ,YAAY,EACZ,QAAQ,eAAe,GAAG,EAC1B,QAAQ,YAAY,EAAE,EACtB,MAAM,GAAG,EAAE;AAChB;AAEA,SAAS,iBAAiB,WAAmB,QAAwD;AACnG,aAAW,SAAS,OAAO,OAAO,OAAO,KAAK,GAAG;AAC/C,QAAI,MAAM,SAAS,cAAc;AAE/B,YAAM,UAAU,MAAM,KAAK,QAAQ,gBAAgB,EAAE,EAAE,QAAQ,YAAY,EAAE;AAE7E,YAAM,QAAQ,MAAM,KAAK,MAAM,YAAY;AAC3C,UAAI,OAAO;AACT,eAAO,KAAK,WAAW,MAAM,CAAC,CAAE;AAAA,MAClC;AACA,aAAO,KAAK,WAAW,OAAO;AAAA,IAChC;AAAA,EACF;AACA,SAAO,KAAK,WAAW,eAAe;AACxC;AAEA,SAAS,eAAe,SAOb;AACT,QAAM,EAAE,YAAY,aAAa,OAAO,YAAY,OAAO,SAAS,IAAI;AACxE,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M,sBAAsB,cAAc;AAAA,EAC/C,MAAM;AAAA,IACJ,MAAM;AAAA,IACN,aAAa;AAAA,EACf;AAAA,EACA,MAAM;AAAA,IACJ,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,aAAa;AAAA,MACb,UAAU;AAAA,IACZ;AAAA,IACA,KAAK;AAAA,MACH,MAAM;AAAA,MACN,aAAa;AAAA,IACf;AAAA,IACA,OAAO;AAAA,MACL,MAAM;AAAA,MACN,aAAa;AAAA,MACb,SAAS;AAAA,IACX;AAAA,IACA,SAAS;AAAA,MACP,MAAM;AAAA,MACN,aAAa;AAAA,MACb,SAAS;AAAA,IACX;AAAA,EACF;AAAA,EACA,MAAM,IAAI,EAAE,KAAK,GAAG;AAClB,UAAM,SAAS,aAAa,EAAE,OAAO,KAAK,OAAO,SAAS,KAAK,QAAQ,CAAC;AAExE,QAAI;AACF,YAAM,SAAS,MAAM,gBAAgB;AAAA,QACnC,WAAW,QAAQ,IAAI;AAAA,QACvB,MAAM,KAAK;AAAA,QACX,QAAQ,KAAK;AAAA,MACf,CAAC;AAED,UAAI,OAAO,UAAU,WAAW,GAAG;AACjC,eAAO,KAAK,2DAAsD;AAAA,MACpE,OAAO;AACL,eAAO,KAAK,aAAa,OAAO,UAAU,MAAM,iBAAiB;AACjE,mBAAW,YAAY,OAAO,WAAW;AACvC,iBAAO,KAAK,KAAK,QAAQ,EAAE;AAAA,QAC7B;AAAA,MACF;AAAA,IACF,SAAS,KAAK;AACZ,cAAQ,MAAM;AAAA,WAAU,IAAc,OAAO;AAAA,CAAI;AACjD,cAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF;AACF,CAAC;AAED,IAAO,yBAAQ;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/commands/generate-test-plan.ts"],"sourcesContent":["import { defineCommand } from \"citty\";\nimport { loadConfig, parseSpec, resolveGlob, createLogger } from \"@specdx/core\";\nimport { writeFile } from \"node:fs/promises\";\nimport { join } from \"node:path\";\n\nexport interface GenerateTestPlanOptions {\n configDir: string;\n outPath?: string;\n}\n\nexport interface GenerateTestPlanResult {\n filePath: string;\n testCases: number;\n}\n\ninterface StoryTestCases {\n storyId: string;\n title: string;\n authors: string[];\n cases: string[];\n}\n\n/**\n * Extracts the content of a `## Heading` section from a markdown string.\n * Returns the text between that heading and the next `## ` heading (or end of string).\n */\nfunction extractSection(content: string, heading: string): string | null {\n const escapedHeading = heading.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n const headingPattern = new RegExp(`^##\\\\s+${escapedHeading}\\\\s*$`, \"im\");\n const match = headingPattern.exec(content);\n if (!match) return null;\n\n const start = match.index + match[0].length;\n const rest = content.slice(start);\n\n const nextSection = /^##\\s+/m.exec(rest);\n return nextSection ? rest.slice(0, nextSection.index) : rest;\n}\n\n/**\n * Parses acceptance criteria bullet points from a section string.\n * Handles `- [ ] text`, `- [x] text`, and plain `- text` formats.\n */\nfunction parseAcceptanceCriteria(section: string): string[] {\n const cases: string[] = [];\n for (const rawLine of section.split(\"\\n\")) {\n const line = rawLine.trim();\n // Match bullet lines: `- [ ] text`, `- [x] text`, `- text`\n const bulletMatch = /^-\\s+(?:\\[[ xX]\\]\\s+)?(.+)/.exec(line);\n if (bulletMatch) {\n const text = bulletMatch[1]!.trim();\n if (text) {\n cases.push(text);\n }\n }\n }\n return cases;\n}\n\nexport async function generateTestPlan(\n options: GenerateTestPlanOptions,\n): Promise<GenerateTestPlanResult> {\n const { configDir, outPath } = options;\n const config = await loadConfig(undefined, configDir);\n\n const storiesBySpec: StoryTestCases[] = [];\n\n for (const [, entry] of Object.entries(config.specs)) {\n if (entry.type !== \"user-story\") continue;\n\n const files = await resolveGlob(entry.path, configDir);\n for (const file of files) {\n const parsed = await parseSpec(file);\n const frontmatter = parsed.frontmatter;\n const storyId = (frontmatter[\"id\"] as string | undefined) ?? file;\n const title = (frontmatter[\"title\"] as string | undefined) ?? storyId;\n const authors = (frontmatter[\"authors\"] as string[] | undefined) ?? [];\n\n const acSection = extractSection(parsed.content, \"Acceptance Criteria\");\n const cases = acSection ? parseAcceptanceCriteria(acSection) : [];\n\n storiesBySpec.push({ storyId, title, authors, cases });\n }\n }\n\n // Sort stories by ID for deterministic output\n storiesBySpec.sort((a, b) => a.storyId.localeCompare(b.storyId));\n\n const today = new Date().toISOString().slice(0, 10);\n\n // Aggregate authors from all stories (deduplicated)\n const allAuthors = Array.from(new Set(storiesBySpec.flatMap((s) => s.authors)));\n\n // Build references to all stories\n const storyRefs = storiesBySpec.map((s) => ` - id: \"${s.storyId}\"\\n relationship: \"related-to\"`);\n\n const totalTestCases = storiesBySpec.reduce((sum, s) => sum + s.cases.length, 0);\n\n // Build frontmatter\n const authorsYaml =\n allAuthors.length > 0\n ? `[${allAuthors.map((a) => `\"${a}\"`).join(\", \")}]`\n : '[\"generated\"]';\n\n const refsYaml =\n storyRefs.length > 0\n ? `\\nreferences:\\n${storyRefs.join(\"\\n\")}`\n : \"\";\n\n const frontmatter = [\n \"---\",\n 'id: \"generated-test-plan\"',\n 'type: \"test-plan\"',\n 'title: \"Generated Test Plan\"',\n 'status: \"draft\"',\n 'version: \"0.1\"',\n `created: \"${today}\"`,\n `authors: ${authorsYaml}`,\n refsYaml.length > 0 ? refsYaml.trimStart() : null,\n \"---\",\n ]\n .filter((line) => line !== null)\n .join(\"\\n\");\n\n // ## Scope\n const scopeLines =\n storiesBySpec.length > 0\n ? storiesBySpec.map((s) => `- ${s.storyId}: ${s.title}`).join(\"\\n\")\n : \"_No user stories found._\";\n\n // ## Test Cases — grouped by story\n const testCaseBlocks = storiesBySpec\n .map((s) => {\n const caseBullets =\n s.cases.length > 0\n ? s.cases.map((c) => `- [ ] ${c}`).join(\"\\n\")\n : \"_No acceptance criteria found._\";\n return `### ${s.storyId}\\n\\n${caseBullets}`;\n })\n .join(\"\\n\\n\");\n\n const testCasesBody =\n storiesBySpec.length > 0 ? testCaseBlocks : \"_No user stories found._\";\n\n // ## Coverage Matrix\n const matrixHeader = \"| Story | Test Cases |\";\n const matrixSep = \"| ----- | ---------- |\";\n const matrixRows = storiesBySpec.map((s) => `| ${s.storyId} | ${s.cases.length} |`);\n const coverageMatrix = [matrixHeader, matrixSep, ...matrixRows].join(\"\\n\");\n\n // ## Edge Cases\n const edgeCasesPlaceholder = \"<!-- Add edge cases and boundary conditions here -->\";\n\n const body = [\n `## Scope`,\n \"\",\n scopeLines,\n \"\",\n `## Test Cases`,\n \"\",\n testCasesBody,\n \"\",\n `## Coverage Matrix`,\n \"\",\n coverageMatrix,\n \"\",\n `## Edge Cases`,\n \"\",\n edgeCasesPlaceholder,\n \"\",\n ].join(\"\\n\");\n\n const fileContent = `${frontmatter}\\n\\n${body}`;\n\n const targetPath = outPath ?? join(configDir, \"specs\", \"test-plan.md\");\n await writeFile(targetPath, fileContent, \"utf-8\");\n\n return { filePath: targetPath, testCases: totalTestCases };\n}\n\nexport default defineCommand({\n meta: { name: \"generate-test-plan\", description: \"Generate a test plan stub from user stories\" },\n args: {\n from: {\n type: \"string\",\n description: \"Source to generate from (currently only 'stories' is supported)\",\n default: \"stories\",\n },\n out: {\n type: \"string\",\n description: \"Output file path (default: specs/test-plan.md)\",\n },\n },\n async run({ args }) {\n const logger = createLogger({ quiet: false, verbose: false });\n\n if (args.from !== \"stories\") {\n console.error(`\\n ✗ --from must be 'stories' (got: ${args.from})\\n`);\n process.exit(1);\n }\n\n try {\n const result = await generateTestPlan({\n configDir: process.cwd(),\n outPath: args.out,\n });\n\n logger.info(`Generated test plan with ${result.testCases} test cases → ${result.filePath}`);\n } catch (err) {\n console.error(`\\n ✗ ${(err as Error).message}\\n`);\n process.exit(1);\n }\n },\n});\n"],"mappings":";;;;;;;;;AAAA,SAAS,qBAAqB;AAE9B,SAAS,iBAAiB;AAC1B,SAAS,YAAY;AAuBrB,SAAS,eAAe,SAAiB,SAAgC;AACvE,QAAM,iBAAiB,QAAQ,QAAQ,uBAAuB,MAAM;AACpE,QAAM,iBAAiB,IAA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