specdx 0.4.0-alpha.20 → 0.4.0-alpha.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/dist/{check-GGQB3SHI.js → check-GGGHTDTH.js} +7 -7
- package/dist/check-GGGHTDTH.js.map +1 -0
- package/dist/{chunk-ZB5R5SK5.js → chunk-3YXRWQGX.js} +11 -6
- package/dist/chunk-3YXRWQGX.js.map +1 -0
- package/dist/{chunk-CI7KYTC7.js → chunk-6IVWJKMQ.js} +2 -2
- package/dist/{chunk-CI7KYTC7.js.map → chunk-6IVWJKMQ.js.map} +1 -1
- package/dist/{chunk-ZIPGRLYE.js → chunk-HCJDCS26.js} +2 -2
- package/dist/chunk-HCJDCS26.js.map +1 -0
- package/dist/{chunk-FBMYBYFB.js → chunk-IEW62WR2.js} +18 -15
- package/dist/chunk-IEW62WR2.js.map +1 -0
- package/dist/{chunk-RY5CDUNN.js → chunk-PXQML7NE.js} +2 -2
- package/dist/{chunk-UZKOJL2N.js → chunk-QOP2KHW3.js} +5 -5
- package/dist/{chunk-UZKOJL2N.js.map → chunk-QOP2KHW3.js.map} +1 -1
- package/dist/{chunk-MM325DR6.js → chunk-SNQNQ2MP.js} +3 -3
- package/dist/chunk-SNQNQ2MP.js.map +1 -0
- package/dist/{chunk-T232GZ2L.js → chunk-YRQPY5NF.js} +2 -2
- package/dist/{diff-PHEX3HUT.js → diff-VHVSXLKU.js} +4 -4
- package/dist/{dist-DQ6NNKZO.js → dist-QRCEQ5WI.js} +7 -7
- package/dist/{dist-RT3MTIUW.js → dist-ROHCFKYT.js} +2 -2
- package/dist/{generate-5VO6M4PB.js → generate-WMJ37LCN.js} +5 -5
- package/dist/{generate-story-CJMV2F5K.js → generate-story-ORJX24P7.js} +4 -4
- package/dist/{generate-test-plan-XBAFJKJI.js → generate-test-plan-Z46W3N3B.js} +3 -3
- package/dist/{graph-UZJMLX4J.js → graph-TG2CONHV.js} +3 -3
- package/dist/index.js +13 -4
- package/dist/index.js.map +1 -1
- package/dist/{lint-TVL2ILOQ.js → lint-ZFG6ALIT.js} +7 -4
- package/dist/lint-ZFG6ALIT.js.map +1 -0
- package/dist/main.js +3 -3
- package/dist/{mcp-F7LJBZ4X.js → mcp-WBHZANS5.js} +3 -3
- package/dist/{migrate-DEFCNOAH.js → migrate-FKFC7UAO.js} +3 -3
- package/dist/{pack-PNLD5AYW.js → pack-VDEO7GRF.js} +7 -4
- package/dist/pack-VDEO7GRF.js.map +1 -0
- package/dist/{ready-2PHBPWJD.js → ready-VDOH3XCV.js} +5 -5
- package/dist/{skills-LHFTTEJ7.js → skills-36SRUEMR.js} +1 -1
- package/dist/skills-36SRUEMR.js.map +1 -0
- package/dist/{status-UKLQV4AI.js → status-JIQUF6MX.js} +5 -5
- package/dist/{update-KLDLDQZM.js → update-DNXF5Q64.js} +8 -8
- package/dist/update-DNXF5Q64.js.map +1 -0
- package/dist/{validate-FXD5WS4C.js → validate-TSAMI65E.js} +3 -3
- package/package.json +9 -9
- package/dist/check-GGQB3SHI.js.map +0 -1
- package/dist/chunk-FBMYBYFB.js.map +0 -1
- package/dist/chunk-MM325DR6.js.map +0 -1
- package/dist/chunk-ZB5R5SK5.js.map +0 -1
- package/dist/chunk-ZIPGRLYE.js.map +0 -1
- package/dist/lint-TVL2ILOQ.js.map +0 -1
- package/dist/pack-PNLD5AYW.js.map +0 -1
- package/dist/skills-LHFTTEJ7.js.map +0 -1
- package/dist/update-KLDLDQZM.js.map +0 -1
- /package/dist/{chunk-RY5CDUNN.js.map → chunk-PXQML7NE.js.map} +0 -0
- /package/dist/{chunk-T232GZ2L.js.map → chunk-YRQPY5NF.js.map} +0 -0
- /package/dist/{diff-PHEX3HUT.js.map → diff-VHVSXLKU.js.map} +0 -0
- /package/dist/{dist-DQ6NNKZO.js.map → dist-QRCEQ5WI.js.map} +0 -0
- /package/dist/{dist-RT3MTIUW.js.map → dist-ROHCFKYT.js.map} +0 -0
- /package/dist/{generate-5VO6M4PB.js.map → generate-WMJ37LCN.js.map} +0 -0
- /package/dist/{generate-story-CJMV2F5K.js.map → generate-story-ORJX24P7.js.map} +0 -0
- /package/dist/{generate-test-plan-XBAFJKJI.js.map → generate-test-plan-Z46W3N3B.js.map} +0 -0
- /package/dist/{graph-UZJMLX4J.js.map → graph-TG2CONHV.js.map} +0 -0
- /package/dist/{mcp-F7LJBZ4X.js.map → mcp-WBHZANS5.js.map} +0 -0
- /package/dist/{migrate-DEFCNOAH.js.map → migrate-FKFC7UAO.js.map} +0 -0
- /package/dist/{ready-2PHBPWJD.js.map → ready-VDOH3XCV.js.map} +0 -0
- /package/dist/{status-UKLQV4AI.js.map → status-JIQUF6MX.js.map} +0 -0
- /package/dist/{validate-FXD5WS4C.js.map → validate-TSAMI65E.js.map} +0 -0
|
@@ -4,15 +4,15 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
createLintEngine,
|
|
6
6
|
getPreset
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-QOP2KHW3.js";
|
|
8
8
|
import {
|
|
9
9
|
buildGraph,
|
|
10
10
|
createLogger,
|
|
11
11
|
loadConfig,
|
|
12
12
|
parseSpec,
|
|
13
13
|
resolveGlob
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-
|
|
14
|
+
} from "./chunk-SNQNQ2MP.js";
|
|
15
|
+
import "./chunk-HCJDCS26.js";
|
|
16
16
|
import "./chunk-5WRI5ZAA.js";
|
|
17
17
|
|
|
18
18
|
// src/commands/core/lint.ts
|
|
@@ -44,6 +44,9 @@ function formatGithub(diagnostics) {
|
|
|
44
44
|
|
|
45
45
|
// src/commands/core/lint.ts
|
|
46
46
|
async function runLint(options) {
|
|
47
|
+
if (!options.configDir) {
|
|
48
|
+
throw new TypeError("runLint requires `configDir` \u2014 the directory holding spec.config.yaml.");
|
|
49
|
+
}
|
|
47
50
|
const config = await loadConfig(void 0, options.configDir);
|
|
48
51
|
const preset = options.preset ?? config.lint?.extends ?? "recommended";
|
|
49
52
|
const rules = getPreset(preset);
|
|
@@ -120,4 +123,4 @@ export {
|
|
|
120
123
|
lint_default as default,
|
|
121
124
|
runLint
|
|
122
125
|
};
|
|
123
|
-
//# sourceMappingURL=lint-
|
|
126
|
+
//# sourceMappingURL=lint-ZFG6ALIT.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/core/lint.ts","../src/formatters/pretty.ts","../src/formatters/json.ts","../src/formatters/github.ts"],"sourcesContent":["import { defineCommand } from \"citty\";\nimport { loadConfig, parseSpec, resolveGlob, buildGraph, createLogger } from \"@specdx/core\";\nimport { createLintEngine, getPreset, type LintResults } from \"@specdx/lint\";\nimport type { ParsedSpec } from \"@specdx/core\";\nimport { sharedArgs } from \"../../shared-args.js\";\nimport { formatPretty } from \"../../formatters/pretty.js\";\nimport { formatJson } from \"../../formatters/json.js\";\nimport { formatGithub } from \"../../formatters/github.js\";\n\nexport interface RunLintOptions {\n configDir: string;\n specPath?: string;\n preset?: \"minimal\" | \"recommended\" | \"strict\";\n}\n\n/** Lint results plus whether anything was actually linted (vacuous-pass audit). */\nexport interface RunLintResults extends LintResults {\n /** Number of specs linted. */\n specCount: number;\n /** False when no specs resolved — \"no diagnostics\" is then not a pass. */\n assessed: boolean;\n}\n\nexport async function runLint(options: RunLintOptions): Promise<RunLintResults> {\n // A JS caller omitting the option otherwise dies as ERR_INVALID_ARG_TYPE\n // deep inside path.join, with no mention of what was missing.\n if (!options.configDir) {\n throw new TypeError(\"runLint requires `configDir` — the directory holding spec.config.yaml.\");\n }\n const config = await loadConfig(undefined, options.configDir);\n const preset = options.preset ?? config.lint?.extends ?? \"recommended\";\n const rules = getPreset(preset);\n\n // Always parse the full suite so cross-reference rules have complete\n // context; a single-file lint filters the *diagnostics*, not the suite.\n const specs: ParsedSpec[] = [];\n for (const [, entry] of Object.entries(config.specs)) {\n const files = await resolveGlob(entry.path, options.configDir);\n for (const file of files) {\n specs.push(await parseSpec(file));\n }\n }\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 results = engine.lint(specs);\n\n if (options.specPath) {\n const specPath = options.specPath;\n results.diagnostics = results.diagnostics.filter((d) => d.filePath.includes(specPath));\n results.hasErrors = results.diagnostics.some((d) => d.severity === \"error\");\n results.hasWarnings = results.diagnostics.some((d) => d.severity === \"warn\");\n }\n\n if (graphError) {\n results.diagnostics.push({\n ruleId: \"structure/no-circular-deps\",\n severity: \"error\",\n message: graphError,\n filePath: \"spec.config.yaml\",\n });\n results.hasErrors = true;\n }\n\n return { ...results, specCount: specs.length, assessed: specs.length > 0 };\n}\n\nexport default defineCommand({\n meta: { name: \"lint\", description: \"Lint all specs in the suite\" },\n args: {\n ...sharedArgs,\n fix: { type: \"boolean\", description: \"Auto-fix issues where possible\" },\n path: { type: \"positional\", description: \"Lint a specific spec file\", required: false },\n preset: { type: \"string\", description: \"Lint preset (minimal, recommended, strict)\" },\n },\n async run({ args }) {\n const logger = createLogger({ quiet: args.quiet, verbose: args.verbose });\n\n if (args.fix) {\n logger.info(\"No auto-fixable issues supported yet.\");\n }\n\n try {\n const results = await runLint({\n configDir: process.cwd(),\n specPath: args.path,\n preset: args.preset as \"minimal\" | \"recommended\" | \"strict\" | undefined,\n });\n\n const formatter =\n args.format === \"json\"\n ? formatJson\n : args.format === \"github\"\n ? formatGithub\n : formatPretty;\n // \"No diagnostics\" over an empty suite is not a pass (vacuous-pass audit)\n if (!results.assessed) {\n console.error(\n \"\\n ⚠ No specs found — nothing was linted. Check the spec paths in spec.config.yaml.\\n\",\n );\n process.exit(3);\n }\n\n console.log(formatter(results.diagnostics));\n\n if (results.hasErrors) process.exit(1);\n } catch (err) {\n console.error(`\\n ✗ ${(err as Error).message}\\n`);\n process.exit(1);\n }\n },\n});\n","import type { Diagnostic } from \"@specdx/lint\";\n\nexport function formatPretty(diagnostics: Diagnostic[]): string {\n if (diagnostics.length === 0) return \" ✓ All specs pass lint checks.\\n\";\n return diagnostics\n .map((d) => {\n const icon = d.severity === \"error\" ? \"✗\" : d.severity === \"warn\" ? \"⚠\" : \"ℹ\";\n return ` ${icon} ${d.severity} ${d.message} (${d.ruleId})\\n ${d.filePath}${d.line ? `:${d.line}` : \"\"}`;\n })\n .join(\"\\n\");\n}\n","import type { Diagnostic } from \"@specdx/lint\";\nexport function formatJson(diagnostics: Diagnostic[]): string {\n return JSON.stringify(diagnostics, null, 2);\n}\n","import type { Diagnostic } from \"@specdx/lint\";\nexport function formatGithub(diagnostics: Diagnostic[]): string {\n return diagnostics\n .map((d) => {\n const level = d.severity === \"error\" ? \"error\" : \"warning\";\n const line = d.line ? `,line=${d.line}` : \"\";\n return `::${level} file=${d.filePath}${line}::${d.message} (${d.ruleId})`;\n })\n .join(\"\\n\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,SAAS,qBAAqB;;;ACEvB,SAAS,aAAa,aAAmC;AAC9D,MAAI,YAAY,WAAW,EAAG,QAAO;AACrC,SAAO,YACJ,IAAI,CAAC,MAAM;AACV,UAAM,OAAO,EAAE,aAAa,UAAU,WAAM,EAAE,aAAa,SAAS,WAAM;AAC1E,WAAO,KAAK,IAAI,IAAI,EAAE,QAAQ,KAAK,EAAE,OAAO,MAAM,EAAE,MAAM;AAAA,MAAU,EAAE,QAAQ,GAAG,EAAE,OAAO,IAAI,EAAE,IAAI,KAAK,EAAE;AAAA,EAC7G,CAAC,EACA,KAAK,IAAI;AACd;;;ACTO,SAAS,WAAW,aAAmC;AAC5D,SAAO,KAAK,UAAU,aAAa,MAAM,CAAC;AAC5C;;;ACFO,SAAS,aAAa,aAAmC;AAC9D,SAAO,YACJ,IAAI,CAAC,MAAM;AACV,UAAM,QAAQ,EAAE,aAAa,UAAU,UAAU;AACjD,UAAM,OAAO,EAAE,OAAO,SAAS,EAAE,IAAI,KAAK;AAC1C,WAAO,KAAK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k-
|
|
4
|
+
} from "./chunk-6IVWJKMQ.js";
|
|
5
5
|
import {
|
|
6
6
|
subCommands
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-IEW62WR2.js";
|
|
8
|
+
import "./chunk-HCJDCS26.js";
|
|
9
9
|
import "./chunk-5WRI5ZAA.js";
|
|
10
10
|
|
|
11
11
|
// src/main.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
package_default
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-6IVWJKMQ.js";
|
|
4
4
|
import "./chunk-5WRI5ZAA.js";
|
|
5
5
|
|
|
6
6
|
// src/commands/core/mcp.ts
|
|
@@ -12,7 +12,7 @@ var mcp_default = defineCommand({
|
|
|
12
12
|
let mcp;
|
|
13
13
|
let stdio;
|
|
14
14
|
try {
|
|
15
|
-
mcp = await import("./dist-
|
|
15
|
+
mcp = await import("./dist-QRCEQ5WI.js");
|
|
16
16
|
stdio = await import("@modelcontextprotocol/sdk/server/stdio.js");
|
|
17
17
|
} catch (err) {
|
|
18
18
|
const missing = err.message.includes("zod") ? "zod" : "@modelcontextprotocol/sdk";
|
|
@@ -32,4 +32,4 @@ var mcp_default = defineCommand({
|
|
|
32
32
|
export {
|
|
33
33
|
mcp_default as default
|
|
34
34
|
};
|
|
35
|
-
//# sourceMappingURL=mcp-
|
|
35
|
+
//# sourceMappingURL=mcp-WBHZANS5.js.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createLogger,
|
|
3
3
|
loadConfig
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-SNQNQ2MP.js";
|
|
5
5
|
import {
|
|
6
6
|
SPEC_TYPES,
|
|
7
7
|
SUPPORTED_CONFIG_VERSION
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-HCJDCS26.js";
|
|
9
9
|
import "./chunk-5WRI5ZAA.js";
|
|
10
10
|
|
|
11
11
|
// src/commands/experimental/migrate.ts
|
|
@@ -65,4 +65,4 @@ var migrate_default = defineCommand({
|
|
|
65
65
|
export {
|
|
66
66
|
migrate_default as default
|
|
67
67
|
};
|
|
68
|
-
//# sourceMappingURL=migrate-
|
|
68
|
+
//# sourceMappingURL=migrate-FKFC7UAO.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
pack
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-YRQPY5NF.js";
|
|
4
4
|
import {
|
|
5
5
|
sharedArgs
|
|
6
6
|
} from "./chunk-GAM4MXPC.js";
|
|
@@ -10,8 +10,8 @@ import {
|
|
|
10
10
|
loadConfig,
|
|
11
11
|
parseSpec,
|
|
12
12
|
resolveGlob
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import "./chunk-
|
|
13
|
+
} from "./chunk-SNQNQ2MP.js";
|
|
14
|
+
import "./chunk-HCJDCS26.js";
|
|
15
15
|
import "./chunk-5WRI5ZAA.js";
|
|
16
16
|
|
|
17
17
|
// src/commands/core/pack.ts
|
|
@@ -43,6 +43,9 @@ function emptyPackReason(stats, specsResolved) {
|
|
|
43
43
|
return `all ${stats.specsExcluded} candidate spec(s) were excluded \u2014 widen --specs or raise --budget`;
|
|
44
44
|
}
|
|
45
45
|
async function runPack(options) {
|
|
46
|
+
if (!options.configDir) {
|
|
47
|
+
throw new TypeError("runPack requires `configDir` \u2014 the directory holding spec.config.yaml.");
|
|
48
|
+
}
|
|
46
49
|
const config = await loadConfig(void 0, options.configDir);
|
|
47
50
|
const allSpecs = [];
|
|
48
51
|
for (const [, entry] of Object.entries(config.specs)) {
|
|
@@ -189,4 +192,4 @@ export {
|
|
|
189
192
|
emptyPackReason,
|
|
190
193
|
runPack
|
|
191
194
|
};
|
|
192
|
-
//# sourceMappingURL=pack-
|
|
195
|
+
//# sourceMappingURL=pack-VDEO7GRF.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/core/pack.ts"],"sourcesContent":["import { defineCommand } from \"citty\";\nimport { loadConfig, parseSpec, resolveGlob, buildGraph, createLogger } from \"@specdx/core\";\nimport { pack, type PackResult } from \"@specdx/pack\";\nimport type { ParsedSpec } from \"@specdx/core\";\nimport { sharedArgs } from \"../../shared-args.js\";\nimport { writeFile } from \"node:fs/promises\";\nimport { execSync } from \"node:child_process\";\n\nfunction copyToClipboard(text: string): void {\n const platform = process.platform;\n let cmd: string;\n if (platform === \"darwin\") {\n cmd = \"pbcopy\";\n } else if (platform === \"linux\") {\n cmd = \"xclip -selection clipboard\";\n } else if (platform === \"win32\") {\n cmd = \"clip\";\n } else {\n throw new Error(`Clipboard not supported on platform: ${platform}`);\n }\n execSync(cmd, { input: text, stdio: [\"pipe\", \"ignore\", \"ignore\"] });\n}\n\n/**\n * Why a pack produced no context, if it produced none.\n *\n * An empty `<context>` on stdout with exit 0 reads as \"here is your context\"\n * to whatever consumes it. `lint` and `check` already use exit 3 for\n * \"nothing was assessed\"; packing nothing is the same claim.\n */\nexport function emptyPackReason(\n stats: { specsIncluded: number; specsExcluded: number },\n specsResolved: number,\n): string | undefined {\n if (stats.specsIncluded > 0) return undefined;\n if (specsResolved === 0) {\n return \"no specs resolved from spec.config.yaml — check the paths in your config\";\n }\n // The relevance resolver drops sub-threshold specs before allocation, so\n // stats.specsExcluded counts only allocator-level exclusions. Reporting the\n // resolved total instead keeps the message from blaming the config.\n if (stats.specsExcluded === 0) {\n return `none of the ${specsResolved} resolved spec(s) scored above the relevance threshold for this task — try different --task wording, name specs with --specs, or use --full`;\n }\n return `all ${stats.specsExcluded} candidate spec(s) were excluded — widen --specs or raise --budget`;\n}\n\nexport interface RunPackOptions {\n configDir: string;\n task?: string;\n specs?: string[];\n budget?: number;\n format?: \"xml\" | \"markdown\" | \"json\";\n full?: boolean;\n dryRun?: boolean;\n}\n\nexport async function runPack(\n options: RunPackOptions,\n): Promise<PackResult & { specsResolved: number }> {\n if (!options.configDir) {\n throw new TypeError(\"runPack requires `configDir` — the directory holding spec.config.yaml.\");\n }\n const config = await loadConfig(undefined, options.configDir);\n\n const allSpecs: ParsedSpec[] = [];\n for (const [, entry] of Object.entries(config.specs)) {\n const files = await resolveGlob(entry.path, options.configDir);\n for (const file of files) {\n allSpecs.push(await parseSpec(file));\n }\n }\n\n let graph;\n try {\n graph = buildGraph(config);\n } catch {\n // non-fatal: proceed without graph\n }\n\n const result = pack(\n allSpecs,\n {\n task: options.task,\n specs: options.specs,\n budget: options.budget,\n format: options.format,\n full: options.full,\n dryRun: options.dryRun,\n },\n config.pack,\n graph,\n );\n\n return { ...result, specsResolved: allSpecs.length };\n}\n\nexport default defineCommand({\n meta: { name: \"pack\", description: \"Pack specs into AI-ready context\" },\n args: {\n quiet: sharedArgs.quiet,\n verbose: sharedArgs.verbose,\n task: { type: \"string\", description: \"Task or context to optimise relevance for\" },\n specs: { type: \"string\", description: \"Comma-separated spec IDs or glob patterns to include\" },\n budget: { type: \"string\", description: \"Maximum token budget for the output\" },\n format: {\n type: \"string\",\n description: \"Output format (xml, markdown, json)\",\n default: \"xml\",\n },\n out: { type: \"string\", description: \"Write output to file instead of stdout\" },\n copy: { type: \"boolean\", description: \"Copy output to system clipboard\" },\n full: { type: \"boolean\", description: \"Include all specs without budget trimming\" },\n \"dry-run\": {\n type: \"boolean\",\n description: \"Preview what would be packed without writing output\",\n },\n },\n async run({ args }) {\n const logger = createLogger({ quiet: args.quiet, verbose: args.verbose });\n\n // Validate: --task and --specs are mutually exclusive\n if (args.task && args.specs) {\n console.error(\"\\n \\u2717 --task and --specs are mutually exclusive\\n\");\n process.exit(1);\n }\n\n // Validate: --copy and --dry-run are mutually exclusive\n if (args.copy && args[\"dry-run\"]) {\n console.error(\"\\n \\u2717 --copy and --dry-run are mutually exclusive\\n\");\n process.exit(1);\n }\n\n // Validate: --budget is a valid number\n let budget: number | undefined;\n if (args.budget) {\n budget = Number(args.budget);\n if (Number.isNaN(budget)) {\n console.error(\"\\n \\u2717 --budget must be a valid number\\n\");\n process.exit(1);\n }\n }\n\n // Validate: --format is valid\n const format = args.format as string;\n if (format && ![\"xml\", \"markdown\", \"json\"].includes(format)) {\n console.error(`\\n \\u2717 --format must be one of: xml, markdown, json\\n`);\n process.exit(1);\n }\n\n try {\n const specsList = args.specs ? args.specs.split(\",\").map((s: string) => s.trim()) : undefined;\n\n const result = await runPack({\n configDir: process.cwd(),\n task: args.task,\n specs: specsList,\n budget,\n format: format as \"xml\" | \"markdown\" | \"json\" | undefined,\n full: args.full,\n dryRun: args[\"dry-run\"],\n });\n\n const { stats } = result;\n\n // Dry-run: print plan to stdout\n if (args[\"dry-run\"]) {\n console.log(\"\\n Dry Run Summary:\\n\");\n for (const alloc of stats.allocations) {\n const status = alloc.included ? \"\\u2713\" : \"\\u2717\";\n const compressed = alloc.compressed ? \" (compressed)\" : \"\";\n console.log(\n ` ${status} ${alloc.specId} relevance=${alloc.relevance.toFixed(2)} tokens=${alloc.tokens}${compressed}`,\n );\n }\n console.log(`\\n Budget: ${stats.used} / ${stats.budget} tokens`);\n console.log(` Included: ${stats.specsIncluded} / ${result.specsResolved} specs`);\n console.log(` Sections compressed: ${stats.sectionsCompressed}`);\n console.log(` Sections omitted: ${stats.sectionsOmitted}\\n`);\n // A dry run that plans nothing is as misleading as an empty payload.\n const dryReason = emptyPackReason(stats, result.specsResolved);\n if (dryReason) {\n console.log(` ⚠ Nothing would be packed: ${dryReason}\\n`);\n process.exit(3);\n }\n return;\n }\n\n // Write output\n if (args.out) {\n await writeFile(args.out, result.output, \"utf-8\");\n logger.info(`Output written to ${args.out}`);\n }\n if (args.copy) {\n copyToClipboard(result.output);\n logger.info(\"Output copied to clipboard\");\n }\n if (!args.out && !args.copy) {\n process.stdout.write(result.output);\n }\n\n // Token report to stderr\n const total = stats.specsIncluded + stats.specsExcluded;\n process.stderr.write(\n `Packed ${stats.specsIncluded}/${total} specs \\u2022 ${stats.used} / ${stats.budget} tokens \\u2022 ${stats.sectionsCompressed} sections compressed \\u2022 ${stats.sectionsOmitted} sections omitted\\n`,\n );\n\n // Never let an empty payload leave looking like a successful pack.\n const emptyReason = emptyPackReason(stats, result.specsResolved);\n if (emptyReason) {\n process.stderr.write(`\\n \\u26a0 No context packed: ${emptyReason}\\n\\n`);\n process.exit(3);\n }\n } catch (err) {\n console.error(`\\n \\u2717 ${(err as Error).message}\\n`);\n process.exit(1);\n }\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,SAAS,qBAAqB;AAK9B,SAAS,iBAAiB;AAC1B,SAAS,gBAAgB;AAEzB,SAAS,gBAAgB,MAAoB;AAC3C,QAAM,WAAW,QAAQ;AACzB,MAAI;AACJ,MAAI,aAAa,UAAU;AACzB,UAAM;AAAA,EACR,WAAW,aAAa,SAAS;AAC/B,UAAM;AAAA,EACR,WAAW,aAAa,SAAS;AAC/B,UAAM;AAAA,EACR,OAAO;AACL,UAAM,IAAI,MAAM,wCAAwC,QAAQ,EAAE;AAAA,EACpE;AACA,WAAS,KAAK,EAAE,OAAO,MAAM,OAAO,CAAC,QAAQ,UAAU,QAAQ,EAAE,CAAC;AACpE;AASO,SAAS,gBACd,OACA,eACoB;AACpB,MAAI,MAAM,gBAAgB,EAAG,QAAO;AACpC,MAAI,kBAAkB,GAAG;AACvB,WAAO;AAAA,EACT;AAIA,MAAI,MAAM,kBAAkB,GAAG;AAC7B,WAAO,eAAe,aAAa;AAAA,EACrC;AACA,SAAO,OAAO,MAAM,aAAa;AACnC;AAYA,eAAsB,QACpB,SACiD;AACjD,MAAI,CAAC,QAAQ,WAAW;AACtB,UAAM,IAAI,UAAU,6EAAwE;AAAA,EAC9F;AACA,QAAM,SAAS,MAAM,WAAW,QAAW,QAAQ,SAAS;AAE5D,QAAM,WAAyB,CAAC;AAChC,aAAW,CAAC,EAAE,KAAK,KAAK,OAAO,QAAQ,OAAO,KAAK,GAAG;AACpD,UAAM,QAAQ,MAAM,YAAY,MAAM,MAAM,QAAQ,SAA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
|
|
6
6
|
getPreset,
|
|
7
7
|
parseFeatures
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-QOP2KHW3.js";
|
|
9
9
|
import {
|
|
10
10
|
DEFAULT_DIFF_CONFIG
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-PXQML7NE.js";
|
|
12
12
|
import {
|
|
13
13
|
buildGraph,
|
|
14
14
|
createLogger,
|
|
15
15
|
loadConfig,
|
|
16
16
|
parseSpec,
|
|
17
17
|
resolveGlob
|
|
18
|
-
} from "./chunk-
|
|
19
|
-
import "./chunk-
|
|
18
|
+
} from "./chunk-SNQNQ2MP.js";
|
|
19
|
+
import "./chunk-HCJDCS26.js";
|
|
20
20
|
import "./chunk-5WRI5ZAA.js";
|
|
21
21
|
|
|
22
22
|
// src/commands/core/ready.ts
|
|
@@ -254,4 +254,4 @@ export {
|
|
|
254
254
|
ready_default as default,
|
|
255
255
|
runReady
|
|
256
256
|
};
|
|
257
|
-
//# sourceMappingURL=ready-
|
|
257
|
+
//# sourceMappingURL=ready-VDOH3XCV.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/core/skills.ts","../../skills/src/install.ts"],"sourcesContent":["import { defineCommand } from \"citty\";\nimport { installSkills } from \"@specdx/skills\";\n\nexport default defineCommand({\n meta: { name: \"skills\", description: \"Manage specdx skills for AI coding tools\" },\n subCommands: {\n install: defineCommand({\n meta: { name: \"install\", description: \"Install Claude Code skill files\" },\n args: {\n dir: {\n type: \"string\",\n description: \"Target directory (default: current directory)\",\n default: \".\",\n },\n experimental: {\n type: \"boolean\",\n description: \"Also install experimental skills (built on the experimental check command)\",\n default: false,\n },\n },\n async run({ args }) {\n try {\n const result = await installSkills(args.dir, { experimental: args.experimental });\n if (result.installed.length === 0 && result.updated.length === 0) {\n console.log(\" No skill files to install.\");\n return;\n }\n for (const file of result.installed) console.log(` ✓ Installed ${file}`);\n for (const file of result.updated) console.log(` ✓ Updated ${file}`);\n console.log(`\\n Skills installed to .claude/skills/`);\n } catch (err) {\n console.error(`\\n ✗ ${(err as Error).message}\\n`);\n process.exit(1);\n }\n },\n }),\n },\n});\n","import { mkdir, writeFile, readFile, stat, readdir } from \"node:fs/promises\";\nimport { statSync } from \"node:fs\";\nimport { join, dirname, relative } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\n\n/**\n * Promoted skills — the set the Claude Code plugin ships and `skills install`\n * writes by default.\n *\n * Promotion is the directory a skill lives in, not an adjective in its\n * description. A string is easy to drift past; a folder is not.\n */\nexport const CORE_SKILL_NAMES = [\n \"specdx-router\",\n \"specdx-start-task\",\n \"specdx-author-spec\",\n \"specdx-pre-commit\",\n \"specdx-sprint-review\",\n \"specdx-plan-from-spec\",\n \"specdx-onboard\",\n \"specdx-review-spec\",\n];\n\n/** Skills built on `specdx check`, whose static analysis is noisy on prose specs. */\nexport const EXPERIMENTAL_SKILL_NAMES = [\"specdx-verify\", \"specdx-check-drift\"];\n\n/** Every skill that ships, promoted or not. */\nexport const SKILL_NAMES = [...CORE_SKILL_NAMES, ...EXPERIMENTAL_SKILL_NAMES];\n\n/** Bucket directory a skill lives in, under the skills root. */\nexport function bucketOf(skillName: string): \"core\" | \"experimental\" {\n return EXPERIMENTAL_SKILL_NAMES.includes(skillName) ? \"experimental\" : \"core\";\n}\n\nexport interface InstallResult {\n installed: string[];\n updated: string[];\n}\n\nfunction getSkillSourceDir(): string {\n // When bundled: skills at __dirname/skills (sibling of bundle)\n // In dev: skills at __dirname/../skills (sibling of src/)\n const bundledPath = join(__dirname, \"skills\");\n try {\n statSync(bundledPath);\n return bundledPath;\n } catch {\n return join(__dirname, \"..\", \"skills\");\n }\n}\n\n/** Every file under a directory, as paths relative to it. */\nasync function filesUnder(dir: string, base = dir): Promise<string[]> {\n const entries = await readdir(dir, { withFileTypes: true });\n const files: string[] = [];\n for (const entry of entries) {\n const full = join(dir, entry.name);\n if (entry.isDirectory()) {\n files.push(...(await filesUnder(full, base)));\n } else {\n files.push(relative(base, full));\n }\n }\n return files;\n}\n\n/**\n * Install skills into a project's `.claude/skills/`.\n *\n * The Agent Skills specification defines a skill as a *directory* containing a\n * `SKILL.md`, so the whole directory is copied -- `references/` and any other\n * bundled resources included. Skills previously shipped as flat files under\n * `.claude/commands/`, which made them slash commands rather than skills.\n */\nexport interface InstallOptions {\n /** Include experimental skills. Off by default: only promoted skills ship. */\n experimental?: boolean;\n}\n\nexport async function installSkills(\n projectDir: string,\n options: InstallOptions = {},\n): Promise<InstallResult> {\n const sourceDir = getSkillSourceDir();\n const skillsDir = join(projectDir, \".claude\", \"skills\");\n const installed: string[] = [];\n const updated: string[] = [];\n\n await mkdir(skillsDir, { recursive: true });\n\n const names = options.experimental ? SKILL_NAMES : CORE_SKILL_NAMES;\n\n for (const skillName of names) {\n const sourcePath = join(sourceDir, bucketOf(skillName), skillName);\n const targetPath = join(skillsDir, skillName);\n\n let exists = false;\n try {\n await stat(join(targetPath, \"SKILL.md\"));\n exists = true;\n } catch {\n // Not installed yet\n }\n\n for (const file of await filesUnder(sourcePath)) {\n const target = join(targetPath, file);\n await mkdir(dirname(target), { recursive: true });\n await writeFile(target, await readFile(join(sourcePath, file), \"utf-8\"), \"utf-8\");\n }\n\n if (exists) {\n updated.push(skillName);\n } else {\n installed.push(skillName);\n }\n }\n\n return { installed, updated };\n}\n"],"mappings":";;;AAAA,SAAS,qBAAqB;;;ACA9B,SAAS,OAAO,WAAW,UAAU,MAAM,eAAe;AAC1D,SAAS,gBAAgB;AACzB,SAAS,MAAM,SAAS,gBAAgB;AACxC,SAAS,qBAAqB;AAE9B,IAAM,YAAY,QAAQ,cAAc,YAAY,GAAG,CAAC;AASjD,IAAM,mBAAmB;EAC9B;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAIK,IAAM,2BAA2B,CAAC,iBAAiB,oBAAoB;AAGvE,IAAM,cAAc,CAAC,GAAG,kBAAkB,GAAG,wBA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chunk-
|
|
4
|
+
} from "./chunk-QOP2KHW3.js";
|
|
5
5
|
import {
|
|
6
6
|
DEFAULT_DIFF_CONFIG
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-PXQML7NE.js";
|
|
8
8
|
import {
|
|
9
9
|
buildGraph,
|
|
10
10
|
loadConfig,
|
|
11
11
|
parseSpec,
|
|
12
12
|
resolveGlob
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import "./chunk-
|
|
13
|
+
} from "./chunk-SNQNQ2MP.js";
|
|
14
|
+
import "./chunk-HCJDCS26.js";
|
|
15
15
|
import "./chunk-5WRI5ZAA.js";
|
|
16
16
|
|
|
17
17
|
// src/commands/core/status.ts
|
|
@@ -158,4 +158,4 @@ export {
|
|
|
158
158
|
status_default as default,
|
|
159
159
|
runStatus
|
|
160
160
|
};
|
|
161
|
-
//# sourceMappingURL=status-
|
|
161
|
+
//# sourceMappingURL=status-JIQUF6MX.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runCheck
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-3YXRWQGX.js";
|
|
4
4
|
import {
|
|
5
5
|
sharedArgs
|
|
6
6
|
} from "./chunk-GAM4MXPC.js";
|
|
@@ -9,8 +9,8 @@ import {
|
|
|
9
9
|
loadConfig,
|
|
10
10
|
parseSpec,
|
|
11
11
|
resolveGlob
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-SNQNQ2MP.js";
|
|
13
|
+
import "./chunk-HCJDCS26.js";
|
|
14
14
|
import "./chunk-5WRI5ZAA.js";
|
|
15
15
|
|
|
16
16
|
// src/commands/experimental/update.ts
|
|
@@ -60,11 +60,11 @@ function generateUpdates({ findings }) {
|
|
|
60
60
|
}
|
|
61
61
|
function printSuggestionsPretty(suggestions) {
|
|
62
62
|
if (suggestions.length === 0) {
|
|
63
|
-
console.log("\n
|
|
63
|
+
console.log("\n specdx update \u2014 no spec updates suggested\n");
|
|
64
64
|
return;
|
|
65
65
|
}
|
|
66
66
|
console.log(`
|
|
67
|
-
|
|
67
|
+
specdx update \u2014 ${suggestions.length} suggested spec update(s)
|
|
68
68
|
`);
|
|
69
69
|
const bySpec = /* @__PURE__ */ new Map();
|
|
70
70
|
for (const s of suggestions) {
|
|
@@ -86,13 +86,13 @@ function printSuggestionsPretty(suggestions) {
|
|
|
86
86
|
var update_default = defineCommand({
|
|
87
87
|
meta: {
|
|
88
88
|
name: "update",
|
|
89
|
-
description: "Suggest spec updates based on
|
|
89
|
+
description: "Suggest spec updates based on specdx check findings (--from-code)"
|
|
90
90
|
},
|
|
91
91
|
args: {
|
|
92
92
|
...sharedArgs,
|
|
93
93
|
"from-code": {
|
|
94
94
|
type: "boolean",
|
|
95
|
-
description: "Generate suggestions from code drift (
|
|
95
|
+
description: "Generate suggestions from code drift (specdx check findings)",
|
|
96
96
|
default: true
|
|
97
97
|
},
|
|
98
98
|
spec: { type: "string", description: "Limit to a specific spec ID" },
|
|
@@ -130,4 +130,4 @@ export {
|
|
|
130
130
|
update_default as default,
|
|
131
131
|
generateUpdates
|
|
132
132
|
};
|
|
133
|
-
//# sourceMappingURL=update-
|
|
133
|
+
//# sourceMappingURL=update-DNXF5Q64.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/experimental/update.ts"],"sourcesContent":["import { defineCommand } from \"citty\";\nimport { loadConfig, parseSpec, resolveGlob, createLogger } from \"@specdx/core\";\nimport { runCheck } from \"@specdx/check\";\nimport type { Finding } from \"@specdx/check\";\nimport type { ParsedSpec } from \"@specdx/core\";\nimport { sharedArgs } from \"../../shared-args.js\";\n\nexport interface UpdateSuggestion {\n specId: string;\n section: string;\n addition: string;\n reason: string;\n}\n\nexport interface GenerateUpdatesInput {\n findings: Finding[];\n}\n\nexport interface GenerateUpdatesResult {\n suggestions: UpdateSuggestion[];\n}\n\nfunction buildRouteAddition(actual: string): string {\n const parts = actual.trim().split(/\\s+/);\n const method = parts[0] ?? \"GET\";\n const path = parts[1] ?? actual;\n return `### ${method} ${path}\\nDescription placeholder.`;\n}\n\nfunction buildTypeAddition(actual: string): string {\n return `- ${actual}`;\n}\n\nfunction buildTestAddition(actual: string): string {\n return `- ${actual}`;\n}\n\nexport function generateUpdates({ findings }: GenerateUpdatesInput): GenerateUpdatesResult {\n const suggestions: UpdateSuggestion[] = [];\n\n for (const finding of findings) {\n // Only act on extra findings — code has something the spec doesn't know about.\n // missing = code is wrong, spec is correct → skip.\n // mismatch = ambiguous → skip for now, let the user decide.\n if (finding.type !== \"extra\") continue;\n\n const actual = finding.actual ?? \"\";\n\n if (finding.category === \"route\") {\n suggestions.push({\n specId: finding.specId,\n section: \"Endpoints\",\n addition: buildRouteAddition(actual),\n reason: `Route ${actual} exists in code but is not documented in the spec.`,\n });\n } else if (finding.category === \"type\") {\n suggestions.push({\n specId: finding.specId,\n section: \"Data Model\",\n addition: buildTypeAddition(actual),\n reason: `${actual} exists in code but is not documented in the spec.`,\n });\n } else if (finding.category === \"test\") {\n suggestions.push({\n specId: finding.specId,\n section: \"Test Cases\",\n addition: buildTestAddition(actual),\n reason: `Test case \"${actual}\" exists in code but is not listed in the spec.`,\n });\n }\n }\n\n return { suggestions };\n}\n\nfunction printSuggestionsPretty(suggestions: UpdateSuggestion[]): void {\n if (suggestions.length === 0) {\n console.log(\"\\n specdx update — no spec updates suggested\\n\");\n return;\n }\n\n console.log(`\\n specdx update — ${suggestions.length} suggested spec update(s)\\n`);\n\n // Group by specId\n const bySpec = new Map<string, UpdateSuggestion[]>();\n for (const s of suggestions) {\n const list = bySpec.get(s.specId) ?? [];\n list.push(s);\n bySpec.set(s.specId, list);\n }\n\n for (const [specId, items] of bySpec) {\n console.log(` ${specId}:`);\n for (const item of items) {\n console.log(` [${item.section}] ${item.reason}`);\n console.log(` Add:\\n ${item.addition.replace(/\\n/g, \"\\n \")}`);\n }\n console.log();\n }\n\n console.log(\" Note: --apply is not implemented in v1. Apply changes manually.\\n\");\n}\n\nexport default defineCommand({\n meta: {\n name: \"update\",\n description: \"Suggest spec updates based on specdx check findings (--from-code)\",\n },\n args: {\n ...sharedArgs,\n \"from-code\": {\n type: \"boolean\",\n description: \"Generate suggestions from code drift (specdx check findings)\",\n default: true,\n },\n spec: { type: \"string\", description: \"Limit to a specific spec ID\" },\n framework: { type: \"string\", description: \"Framework override: express, hono, nextjs\" },\n },\n async run({ args }) {\n const logger = createLogger({ quiet: args.quiet, verbose: args.verbose });\n const configDir = process.cwd();\n const config = await loadConfig(undefined, configDir);\n\n logger.debug(\"Loading specs...\");\n\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 const spec = await parseSpec(p);\n if (args.spec && spec.frontmatter.id !== args.spec) continue;\n specs.push(spec);\n }\n }\n\n logger.debug(`Running check on ${specs.length} specs...`);\n\n const checkConfig = {\n ...config.check,\n ...(args.framework\n ? { framework: args.framework as \"auto\" | \"express\" | \"hono\" | \"nextjs\" }\n : {}),\n };\n\n const checkResult = await runCheck(specs, configDir, checkConfig);\n const { suggestions } = generateUpdates({ findings: checkResult.findings });\n\n if (args.format === \"json\") {\n console.log(JSON.stringify({ suggestions }, null, 2));\n } else {\n printSuggestionsPretty(suggestions);\n }\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;AAAA,SAAS,qBAAqB;AAsB9B,SAAS,mBAAmB,QAAwB;AAClD,QAAM,QAAQ,OAAO,KAAK,EAAE,MAAM,KAAK;AACvC,QAAM,SAAS,MAAM,CAAC,KAAK;AAC3B,QAAM,OAAO,MAAM,CAAC,KAAK;AACzB,SAAO,OAAO,MAAM,IAAI,IAAI;AAAA;AAC9B;AAEA,SAAS,kBAAkB,QAAwB;AACjD,SAAO,KAAK,MAAM;AACpB;AAEA,SAAS,kBAAkB,QAAwB;AACjD,SAAO,KAAK,MAAM;AACpB;AAEO,SAAS,gBAAgB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AAE,YAAY,IAAI,gBAAgB,EAAE,UAAU,YAAY,SAAS,CAAC;AAE1E,QAAI,KAAK,WAAW,QAAQ;AAC1B,cAAQ,IAAI,KAAK,UAAU,EAAE,YAAY,GAAG,MAAM,CAAC,CAAC;AAAA,IACtD,OAAO;AACL,6BAAuB,WAAW;AAAA,IACpC;AAAA,EACF;AACF,CAAC;","names":[]}
|
|
@@ -7,8 +7,8 @@ import {
|
|
|
7
7
|
buildGraph,
|
|
8
8
|
loadConfig,
|
|
9
9
|
resolveGlob
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-SNQNQ2MP.js";
|
|
11
|
+
import "./chunk-HCJDCS26.js";
|
|
12
12
|
import "./chunk-5WRI5ZAA.js";
|
|
13
13
|
|
|
14
14
|
// src/commands/core/validate.ts
|
|
@@ -84,4 +84,4 @@ export {
|
|
|
84
84
|
validate_default as default,
|
|
85
85
|
runValidate
|
|
86
86
|
};
|
|
87
|
-
//# sourceMappingURL=validate-
|
|
87
|
+
//# sourceMappingURL=validate-TSAMI65E.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "specdx",
|
|
3
|
-
"version": "0.4.0-alpha.
|
|
3
|
+
"version": "0.4.0-alpha.21",
|
|
4
4
|
"description": "Spec-driven development toolchain. Validate, lint, pack, and ship specs for LLM-assisted workflows.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -64,14 +64,14 @@
|
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"tsup": "^8.5.1",
|
|
66
66
|
"typescript": "^5.7.0",
|
|
67
|
-
"@specdx/check": "0.0.0",
|
|
68
|
-
"@specdx/core": "0.0.0",
|
|
69
|
-
"@specdx/
|
|
70
|
-
"@specdx/
|
|
71
|
-
"@specdx/
|
|
72
|
-
"@specdx/schema": "0.0.0",
|
|
73
|
-
"@specdx/
|
|
74
|
-
"@specdx/skills": "0.0.0"
|
|
67
|
+
"@specdx/check": "0.0.1-alpha.0",
|
|
68
|
+
"@specdx/core": "0.0.1-alpha.0",
|
|
69
|
+
"@specdx/lint": "0.0.1-alpha.0",
|
|
70
|
+
"@specdx/diff": "0.0.1-alpha.0",
|
|
71
|
+
"@specdx/pack": "0.0.1-alpha.0",
|
|
72
|
+
"@specdx/schema": "0.0.1-alpha.0",
|
|
73
|
+
"@specdx/mcp": "0.0.1-alpha.0",
|
|
74
|
+
"@specdx/skills": "0.0.1-alpha.0"
|
|
75
75
|
},
|
|
76
76
|
"publishConfig": {
|
|
77
77
|
"access": "public"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/commands/experimental/check.ts"],"sourcesContent":["import { defineCommand } from \"citty\";\nimport { loadConfig, parseSpec, resolveGlob, createLogger } from \"@specdx/core\";\nimport { runCheck } from \"@specdx/check\";\nimport type { ParsedSpec } from \"@specdx/core\";\nimport type { CheckConfig } from \"@specdx/check\";\nimport { sharedArgs } from \"../../shared-args.js\";\n\nexport default defineCommand({\n meta: {\n name: \"check\",\n description:\n \"Check spec-to-implementation drift. Exit codes: 0 ok, 1 errors found, 3 nothing checkable (coverage not assessed)\",\n },\n args: {\n ...sharedArgs,\n spec: { type: \"string\", description: \"Check a specific spec by ID\" },\n framework: { type: \"string\", description: \"Framework override: express, hono, nextjs\" },\n ai: {\n type: \"boolean\",\n description: \"Use AI to assess findings (requires ANTHROPIC_API_KEY)\",\n },\n },\n async run({ args }) {\n const logger = createLogger({ quiet: args.quiet, verbose: args.verbose });\n const configDir = process.cwd();\n const config = await loadConfig(undefined, configDir);\n\n logger.debug(\"Loading specs...\");\n\n // Resolve and 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 const spec = await parseSpec(p);\n if (args.spec && spec.frontmatter.id !== args.spec) continue;\n specs.push(spec);\n }\n }\n\n const checkConfig: CheckConfig = {\n ...config.check,\n ...(args.framework ? { framework: args.framework as CheckConfig[\"framework\"] } : {}),\n };\n\n logger.debug(`Checking ${specs.length} specs...`);\n const result = await runCheck(specs, configDir, checkConfig);\n\n // AI analysis (opt-in)\n if (args.ai) {\n const { analyzeWithAi } = await import(\"@specdx/check\");\n const aiResult = await analyzeWithAi(result.findings, args.spec ?? \"full suite check\");\n\n if (args.format === \"json\") {\n console.log(JSON.stringify({ ...result, ai: aiResult }, null, 2));\n } else {\n console.log(`\\n sdx check --ai — ${result.score.overall}% coverage\\n`);\n console.log(` AI Assessment: ${aiResult.summary}\\n`);\n\n for (const assessment of aiResult.assessments) {\n const finding = result.findings[assessment.findingIndex];\n if (!finding) continue;\n const icon = assessment.isRealIssue ? \"✗\" : \"✓\";\n const label = assessment.isRealIssue ? \"REAL\" : \"FALSE POSITIVE\";\n console.log(` ${icon} [${label}] ${finding.expected}`);\n console.log(` ${assessment.reasoning}`);\n if (assessment.suggestedFix) {\n console.log(` Fix: ${assessment.suggestedFix}`);\n }\n }\n console.log();\n }\n\n if (aiResult.assessments.some((a) => a.isRealIssue)) {\n process.exit(1);\n }\n return;\n }\n\n if (args.format === \"json\") {\n console.log(JSON.stringify(result, null, 2));\n } else {\n // Pretty format\n const headline = result.score.assessed\n ? `${result.score.overall}% implementation coverage`\n : \"coverage not assessed — no checkable surfaces found\";\n console.log(`\\n sdx check — ${headline}\\n`);\n\n for (const note of result.notes) {\n console.log(` ⚠ ${note}`);\n }\n if (result.notes.length > 0) console.log();\n\n if (args.verbose) {\n const fmt = (n: number | null) => (n === null ? \"not scanned\" : `${n} found`);\n console.log(` Scanned: framework=${result.scanned.framework ?? \"none detected\"}`);\n console.log(` routes: ${fmt(result.scanned.codeRoutes)}`);\n console.log(` types: ${fmt(result.scanned.codeTypes)}`);\n console.log(` tests: ${fmt(result.scanned.codeTests)}`);\n const artifacts =\n result.scanned.artifacts === null\n ? \"none declared\"\n : `${result.scanned.artifacts} verified`;\n const pending =\n result.scanned.artifactsPending > 0 ? `, ${result.scanned.artifactsPending} pending` : \"\";\n console.log(` artifacts: ${artifacts}${pending}\\n`);\n }\n\n for (const [category, stats] of Object.entries(result.score.byCategory)) {\n if (stats.total === 0) continue;\n console.log(` ${category} (${stats.matched}/${stats.total}):`);\n const categoryFindings = result.findings.filter(\n (f) => f.category === category.replace(/s$/, \"\"),\n );\n for (const f of categoryFindings) {\n const icon = f.severity === \"error\" ? \"✗\" : f.severity === \"warn\" ? \"⚠\" : \"ℹ\";\n const detail = f.actual ? ` — ${f.actual}` : \"\";\n const suggestion = f.suggestion ? ` (${f.suggestion})` : \"\";\n console.log(` ${icon} ${f.expected}${detail}${suggestion}`);\n }\n if (categoryFindings.length === 0) {\n console.log(\" ✓ all matched\");\n }\n }\n\n const errors = result.findings.filter((f) => f.severity === \"error\").length;\n const warnings = result.findings.filter((f) => f.severity === \"warn\").length;\n const info = result.findings.filter((f) => f.severity === \"info\").length;\n console.log(`\\n ${errors} errors, ${warnings} warnings, ${info} info\\n`);\n }\n\n if (result.findings.some((f) => f.severity === \"error\")) {\n process.exit(1);\n }\n // Distinct exit code so CI cannot mistake \"nothing was checkable\" for a pass\n if (!result.score.assessed) {\n process.exit(3);\n }\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;AAAA,SAAS,qBAAqB;AAO9B,IAAO,gBAAQ,cAAc;AAAA,EAC3B,MAAM;AAAA,IACJ,MAAM;AAAA,IACN,aACE;AAAA,EACJ;AAAA,EACA,MAAM;AAAA,IACJ,GAAG;AAAA,IACH,MAAM,EAAE,MAAM,UAAU,aAAa,8BAA8B;AAAA,IACnE,WAAW,EAAE,MAAM,UAAU,aAAa,4CAA4C;AAAA,IACtF,IAAI;AAAA,MACF,MAAM;AAAA,MACN,aAAa;AAAA,IACf;AAAA,EACF;AAAA,EACA,MAAM,IAAI,EAAE,KAAK,GAAG;AAClB,UAAM,SAAS,aAAa,EAAE,OAAO,KAAK,OAAO,SAAS,KAAK,QAAQ,CAAC;AACxE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"version":3,"sources":["../src/commands/core/init.ts","../src/commands/registry.ts"],"sourcesContent":["import { defineCommand } from \"citty\";\nimport { mkdir, writeFile } from \"node:fs/promises\";\nimport { join, basename, resolve } from \"node:path\";\nimport { REQUIRED_SECTIONS } from \"@specdx/schema\";\n\nexport type Template = \"lightweight\" | \"bmad\" | \"api-first\" | \"quick\" | \"context\";\n\ninterface ScaffoldOptions {\n projectName: string;\n template: Template;\n targetDir: string;\n}\n\nconst TEMPLATE_SPECS: Record<\n Template,\n Array<{ filename: string; type: keyof typeof REQUIRED_SECTIONS }>\n> = {\n lightweight: [\n { filename: \"prd.md\", type: \"prd\" },\n { filename: \"technical-design.md\", type: \"technical-design\" },\n ],\n bmad: [\n { filename: \"prd.md\", type: \"prd\" },\n { filename: \"technical-design.md\", type: \"technical-design\" },\n { filename: \"test-plan.md\", type: \"test-plan\" },\n ],\n \"api-first\": [\n { filename: \"technical-design.md\", type: \"technical-design\" },\n { filename: \"api-contract.md\", type: \"api-contract\" },\n { filename: \"test-plan.md\", type: \"test-plan\" },\n ],\n quick: [{ filename: \"quick-spec.md\", type: \"quick-spec\" }],\n context: [{ filename: \"project-context.md\", type: \"project-context\" }],\n};\n\nconst TEMPLATE_EXTRA_DIRS: Record<Template, string[]> = {\n lightweight: [],\n bmad: [\"specs/stories\", \"specs/adr\"],\n \"api-first\": [],\n quick: [],\n context: [],\n};\n\nfunction specIdFromFilename(filename: string): string {\n return filename.replace(/\\.md$/, \"\");\n}\n\nfunction specTitleFromType(type: string): string {\n return type\n .split(\"-\")\n .map((w) => w.charAt(0).toUpperCase() + w.slice(1))\n .join(\" \");\n}\n\nfunction buildSpecFile(\n filename: string,\n type: keyof typeof REQUIRED_SECTIONS,\n projectName: string,\n today: string,\n): string {\n const id = specIdFromFilename(filename);\n const title = `${specTitleFromType(type)} — ${projectName}`;\n const sections = REQUIRED_SECTIONS[type];\n\n const frontmatter = [\n \"---\",\n `id: ${id}`,\n `type: ${type}`,\n `title: \"${title}\"`,\n `status: draft`,\n `version: \"0.1\"`,\n `created: \"${today}\"`,\n `authors: [\"author\"]`,\n \"---\",\n ].join(\"\\n\");\n\n const body = sections.map((section) => `\\n## ${section}\\n\\n<!-- placeholder -->`).join(\"\\n\");\n\n return `${frontmatter}\\n${body}\\n`;\n}\n\nfunction buildConfigYaml(\n projectName: string,\n specs: Array<{ filename: string; type: string }>,\n): string {\n const specEntries = specs\n .map(({ filename, type }) => {\n const key = specIdFromFilename(filename);\n return ` ${key}:\\n path: specs/${filename}\\n type: ${type}`;\n })\n .join(\"\\n\");\n\n return (\n [`version: \"1.0\"`, `project:`, ` name: \"${projectName}\"`, `specs:`, specEntries].join(\"\\n\") +\n \"\\n\"\n );\n}\n\nexport async function scaffoldProject({\n projectName,\n template,\n targetDir,\n}: ScaffoldOptions): Promise<void> {\n const today = new Date().toISOString().slice(0, 10);\n const specsDir = join(targetDir, \"specs\");\n\n // Create specs/ directory\n await mkdir(specsDir, { recursive: true });\n\n // Create extra template dirs (e.g., bmad needs stories/ and adr/)\n for (const extraDir of TEMPLATE_EXTRA_DIRS[template]) {\n await mkdir(join(targetDir, extraDir), { recursive: true });\n }\n\n const specs = TEMPLATE_SPECS[template];\n\n // Write spec files\n for (const { filename, type } of specs) {\n const content = buildSpecFile(filename, type, projectName, today);\n await writeFile(join(specsDir, filename), content, \"utf-8\");\n }\n\n // Write spec.config.yaml\n const configContent = buildConfigYaml(projectName, specs);\n await writeFile(join(targetDir, \"spec.config.yaml\"), configContent, \"utf-8\");\n}\n\n/**\n * The project name to use when `--name` is absent: the target directory's own\n * name, resolved so that `.` becomes the current directory rather than a dot.\n */\nexport function defaultProjectName(dir: string): string {\n return basename(resolve(dir)) || \"my-project\";\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 (default: the target directory's name)\",\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 { template, dir } = args;\n const validTemplates: Template[] = [\"lightweight\", \"bmad\", \"api-first\", \"quick\", \"context\"];\n if (!validTemplates.includes(template as Template)) {\n console.error(`Unknown template: ${template}. Choose from: ${validTemplates.join(\", \")}`);\n process.exit(1);\n }\n\n // The first command anyone runs should not fail on a missing flag when the\n // answer is sitting in the path. `--name` still wins where they differ.\n const name = args.name || defaultProjectName(dir);\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","import type { ArgsDef, CommandDef, SubCommandsDef } from \"citty\";\nimport initCommand from \"./core/init.js\";\n\n/**\n * Promoted commands — the set `--help` presents without a caveat.\n *\n * Promotion is the directory a command lives in, not an adjective someone\n * remembered to type into its description. `explain` and `changelog` both\n * drifted into the core surface precisely because the marker was a string.\n * Sub-commands are spelled the way a user types them.\n */\nexport const CORE_COMMANDS = [\n \"init\",\n \"lint\",\n \"validate\",\n \"graph\",\n \"skills\",\n \"pack\",\n \"diff\",\n \"status\",\n \"ready\",\n \"generate\",\n \"generate story\",\n \"mcp\",\n] as const;\n\n/** Commands whose output is not yet trusted enough to promote. */\nexport const EXPERIMENTAL_COMMANDS = [\"check\", \"update\", \"migrate\", \"generate test-plan\"] as const;\n\n/** Every command that ships, promoted or not. */\nexport const COMMAND_NAMES = [...CORE_COMMANDS, ...EXPERIMENTAL_COMMANDS];\n\nexport type CommandName = (typeof COMMAND_NAMES)[number];\n\n/** Bucket directory a command lives in, under `commands/`. */\nexport function bucketOf(name: string): \"core\" | \"experimental\" {\n return (EXPERIMENTAL_COMMANDS as readonly string[]).includes(name) ? \"experimental\" : \"core\";\n}\n\n/** Module path for a command, relative to `commands/`. */\nexport function moduleOf(name: string): string {\n return `${bucketOf(name)}/${name.replace(/ /g, \"-\")}.ts`;\n}\n\n/**\n * Prefix an experimental command's description with its caveat.\n *\n * Derived from the bucket, so no description in the tree spells `[experimental]`\n * itself and the two can never disagree.\n */\nexport function labelled<T extends ArgsDef>(name: string, cmd: CommandDef<T>): CommandDef<T> {\n if (bucketOf(name) === \"core\") return cmd;\n const meta = cmd.meta;\n // citty allows meta to be a function or promise. Ours are all plain objects,\n // and the conformance test asserts every experimental command renders the\n // caveat -- so a command that adopts lazy meta fails loudly rather than\n // shipping unlabelled.\n if (typeof meta !== \"object\" || meta === null || \"then\" in meta) return cmd;\n return {\n ...cmd,\n meta: { ...meta, description: `[experimental] ${meta.description ?? \"\"}`.trim() },\n };\n}\n\n/** Lazily load a command module and label it according to its bucket. */\nfunction bucketed<T extends ArgsDef>(\n name: string,\n load: () => Promise<CommandDef<T>>,\n): () => Promise<CommandDef<T>> {\n return () => load().then((cmd) => labelled(name, cmd));\n}\n\n/**\n * The `subCommands` map citty registers, keyed by the top-level names above.\n *\n * Typed as citty's own `SubCommandsDef` rather than a `Record<CommandName, ...>`:\n * `CommandDef` is invariant in its args, so a narrower annotation rejects every\n * command that declares args. The conformance test asserts the keys instead.\n */\nexport const subCommands: SubCommandsDef = {\n init: initCommand,\n lint: bucketed(\"lint\", () => import(\"./core/lint.js\").then((m) => m.default)),\n validate: bucketed(\"validate\", () => import(\"./core/validate.js\").then((m) => m.default)),\n graph: bucketed(\"graph\", () => import(\"./core/graph.js\").then((m) => m.default)),\n skills: bucketed(\"skills\", () => import(\"./core/skills.js\").then((m) => m.default)),\n pack: bucketed(\"pack\", () => import(\"./core/pack.js\").then((m) => m.default)),\n diff: bucketed(\"diff\", () => import(\"./core/diff.js\").then((m) => m.default)),\n status: bucketed(\"status\", () => import(\"./core/status.js\").then((m) => m.default)),\n check: bucketed(\"check\", () => import(\"./experimental/check.js\").then((m) => m.default)),\n ready: bucketed(\"ready\", () => import(\"./core/ready.js\").then((m) => m.default)),\n update: bucketed(\"update\", () => import(\"./experimental/update.js\").then((m) => m.default)),\n generate: bucketed(\"generate\", () => import(\"./core/generate.js\").then((m) => m.default)),\n migrate: bucketed(\"migrate\", () => import(\"./experimental/migrate.js\").then((m) => m.default)),\n mcp: bucketed(\"mcp\", () => import(\"./core/mcp.js\").then((m) => m.default)),\n};\n"],"mappings":";;;;;AAAA,SAAS,qBAAqB;AAC9B,SAAS,OAAO,iBAAiB;AACjC,SAAS,MAAM,UAAU,eAAe;AAWxC,IAAM,iBAGF;AAAA,EACF,aAAa;AAAA,IACX,EAAE,UAAU,UAAU,MAAM,MAAM;AAAA,IAClC,EAAE,UAAU,uBAAuB,MAAM,mBAAmB;AAAA,EAC9D;AAAA,EACA,MAAM;AAAA,IACJ,EAAE,UAAU,UAAU,MAAM,MAAM;AAAA,IAClC,EAAE,UAAU,uBAAuB,MAAM,mBAAmB;AAAA,IAC5D,EAAE,UAAU,gBAAgB,MAAM,YAAY;AAAA,EAChD;AAAA,EACA,aAAa;AAAA,IACX,EAAE,UAAU,uBAAuB,MAAM,mBAAmB;AAAA,IAC5D,EAAE,UAAU,mBAAmB,MAAM,eAAe;AAAA,IACpD,EAAE,UAAU,gBAAgB,MAAM,YAAY;AAAA,EAChD;AAAA,EACA,OAAO,CAAC,EAAE,UAAU,iBAAiB,MAAM,aAAa,CAAC;AAAA,EACzD,SAAS,CAAC,EAAE,UAAU,sBAAsB,MAAM,kBAAkB,CAAC;AACvE;AAEA,IAAM,sBAAkD;AAAA,EACtD,aAAa,CAAC;AAAA,EACd,MAAM,CAAC,iBAAiB,WAAW;AAAA,EACnC,aAAa,CAAC;AAAA,EACd,OAAO,CAAC;AAAA,EACR,SAAS,CAAC;AACZ;AAEA,SAAS,mBAAmB,UAA0B;AACpD,SAAO,SAAS,QAAQ,SAAS,EAAE;AACrC;AAEA,SAAS,kBAAkB,MAAsB;AAC/C,SAAO,KACJ,MAAM,GAAG,EACT,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,IAAI,EAAE,MAAM,CAAC,C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OAAO,CAAC;AAAA,EAC5E,MAAM,SAAS,QAAQ,MAAM,OAAO,oBAAgB,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC;AAAA,EAC5E,QAAQ,SAAS,UAAU,MAAM,OAAO,sBAAkB,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC;AAAA,EAClF,OAAO,SAAS,SAAS,MAAM,OAAO,qBAAyB,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC;AAAA,EACvF,OAAO,SAAS,SAAS,MAAM,OAAO,qBAAiB,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC;AAAA,EAC/E,QAAQ,SAAS,UAAU,MAAM,OAAO,sBAA0B,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC;AAAA,EAC1F,UAAU,SAAS,YAAY,MAAM,OAAO,wBAAoB,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC;AAAA,EACxF,SAAS,SAAS,WAAW,MAAM,OAAO,uBAA2B,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC;AAAA,EAC7F,KAAK,SAAS,OAAO,MAAM,OAAO,mBAAe,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC;AAC3E;","names":[]}
|
|
@@ -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/relations.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\";\nimport { DEPENDENCY_RELATIONSHIPS } 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\n/** A relationship edge declared in a spec's frontmatter `references`. */\nexport interface ReferenceEdge {\n fromId: string;\n toId: string;\n relationship: string;\n}\n\n// The dependency-implying taxonomy lives in @specdx/schema so it is versioned\n// with the schema it describes, rather than hardcoded here (ADR:\n// references/requires unification).\n\n/**\n * Collect relationship edges declared in spec frontmatter `references` fields.\n * Edges point from the declaring spec's id to the referenced spec's id.\n */\nexport function collectReferenceEdges(\n specs: { frontmatter: Record<string, unknown> }[],\n): ReferenceEdge[] {\n const edges: ReferenceEdge[] = [];\n for (const spec of specs) {\n const fromId = spec.frontmatter.id;\n if (typeof fromId !== \"string\") continue;\n const refs = spec.frontmatter.references;\n if (!Array.isArray(refs)) continue;\n for (const ref of refs) {\n if (ref && typeof ref === \"object\" && \"id\" in ref) {\n const r = ref as { id: unknown; relationship?: unknown };\n if (typeof r.id === \"string\") {\n edges.push({\n fromId,\n toId: r.id,\n relationship: typeof r.relationship === \"string\" ? r.relationship : \"related-to\",\n });\n }\n }\n }\n }\n return edges;\n}\n\n/**\n * Find dependency-implying frontmatter references that the config-level\n * `requires` graph does not reflect. `idToEntry` maps spec frontmatter ids to\n * config entry keys. References within the same entry (e.g. story-to-story\n * under one glob) and references to unmapped ids are skipped — reference\n * existence itself is the `structure/valid-references` lint rule's concern.\n */\nexport interface UnreflectedReference {\n edge: ReferenceEdge;\n requiringEntry: string;\n requiredEntry: string;\n /** True when adding the suggested requires edge would create a cycle. */\n createsCycle: boolean;\n}\n\nexport function findUnreflectedReferences(\n referenceEdges: ReferenceEdge[],\n idToEntry: Map<string, string>,\n graph: DependencyGraph,\n): UnreflectedReference[] {\n const configEdges = new Set(graph.edges.map((e) => `${e.from}→${e.to}`));\n const missing: UnreflectedReference[] = [];\n\n for (const edge of referenceEdges) {\n const direction = DEPENDENCY_RELATIONSHIPS[edge.relationship as never];\n if (!direction) continue;\n\n const selfEntry = idToEntry.get(edge.fromId);\n const targetEntry = idToEntry.get(edge.toId);\n if (!selfEntry || !targetEntry || selfEntry === targetEntry) continue;\n\n const requiringEntry = direction === \"self-requires-target\" ? selfEntry : targetEntry;\n const requiredEntry = direction === \"self-requires-target\" ? targetEntry : selfEntry;\n\n // Config edges point dependency → dependent\n if (!configEdges.has(`${requiredEntry}→${requiringEntry}`)) {\n // The suggested edge closes a cycle when the required entry is already\n // downstream of the requiring one (issue #13) — never recommend it.\n const createsCycle = graph.getDownstream(requiringEntry).includes(requiredEntry);\n missing.push({ edge, requiringEntry, requiredEntry, createsCycle });\n }\n }\n\n return missing;\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 type { SdxConfig } from \"@specdx/schema\";\nimport { DEPENDENCY_RELATIONSHIPS } from \"@specdx/schema\";\n\n/** Where a relation edge was declared. */\nexport type RelationSource = \"requires\" | \"references\" | \"both\";\n\n/** A dependency edge in **spec id** space, pointing upstream → downstream. */\nexport interface RelationEdge {\n /** Spec id of the dependency. */\n from: string;\n /** Spec id of the dependent. */\n to: string;\n /** Which declaration(s) produced this edge. */\n source: RelationSource;\n}\n\n/**\n * Answers \"what is upstream / downstream of this spec?\" in spec id space.\n *\n * specdx declares relationships two ways: config `requires` (keyed by config\n * entry, glob-aware, cheap) and frontmatter `references` (keyed by spec id,\n * typed). Consumers used to read one or the other, so the same question got\n * different answers — `freshness/staleness-check` saw only references, while\n * impact analysis saw only the config graph. This resolver unions both at\n * query time so every consumer agrees, without changing which source owns\n * graph topology (ADR: references/requires unification, Option B).\n */\nexport interface RelationResolver {\n /** All dependency edges, in spec id space, deduplicated. */\n edges: RelationEdge[];\n /** Spec ids this spec depends on, transitively. */\n getUpstream(specId: string): string[];\n /** Spec ids that depend on this spec, transitively. */\n getDownstream(specId: string): string[];\n}\n\ninterface SpecLike {\n frontmatter: Record<string, unknown>;\n}\n\n/** Map each config entry key to the spec ids its path resolved to. */\nfunction mapEntriesToIds(\n config: SdxConfig,\n specsByEntry: Map<string, SpecLike[]>,\n): Map<string, string[]> {\n const entryIds = new Map<string, string[]>();\n for (const key of Object.keys(config.specs)) {\n const ids: string[] = [];\n for (const spec of specsByEntry.get(key) ?? []) {\n const id = spec.frontmatter.id;\n if (typeof id === \"string\") ids.push(id);\n }\n entryIds.set(key, ids);\n }\n return entryIds;\n}\n\n/** Every spec id present, regardless of which entry it came from. */\nfunction collectKnownIds(specsByEntry: Map<string, SpecLike[]>): Set<string> {\n const ids = new Set<string>();\n for (const specs of specsByEntry.values()) {\n for (const spec of specs) {\n const id = spec.frontmatter.id;\n if (typeof id === \"string\") ids.add(id);\n }\n }\n return ids;\n}\n\nfunction walk(specId: string, adjacency: Map<string, string[]>): string[] {\n const visited = new Set<string>();\n const stack = [specId];\n while (stack.length > 0) {\n const current = stack.pop()!;\n for (const next of adjacency.get(current) ?? []) {\n if (!visited.has(next)) {\n visited.add(next);\n stack.push(next);\n }\n }\n }\n visited.delete(specId);\n return [...visited];\n}\n\n/**\n * Build a resolver from config `requires` and dependency-implying frontmatter\n * `references`.\n *\n * A glob entry is one config entry but many spec ids, so one `requires` edge\n * between entries expands to the cross-product of their spec ids. Structural\n * reference kinds (`decomposed-into`, `supersedes`, `related-to`) are not\n * dependency-implying and are excluded — see DEPENDENCY_RELATIONSHIPS.\n *\n * @param config - Spec config. When undefined, only frontmatter references\n * contribute edges — useful for callers that have specs but no config.\n * @param specsByEntry - Parsed specs grouped by the config entry key they resolved from.\n */\nexport function buildRelationResolver(\n config: SdxConfig | undefined,\n specsByEntry: Map<string, SpecLike[]>,\n): RelationResolver {\n const entryIds = config ? mapEntriesToIds(config, specsByEntry) : new Map<string, string[]>();\n const knownIds = collectKnownIds(specsByEntry);\n\n // key \"from→to\" -> source, so a relation declared both ways is one edge\n const edgeSources = new Map<string, RelationSource>();\n const addEdge = (from: string, to: string, source: \"requires\" | \"references\"): void => {\n if (from === to) return;\n const key = `${from}\u0000${to}`;\n const existing = edgeSources.get(key);\n if (!existing) {\n edgeSources.set(key, source);\n } else if (existing !== source) {\n edgeSources.set(key, \"both\");\n }\n };\n\n // 1. Config requires: entry-level edges expand across the entries' spec ids\n for (const [key, entry] of Object.entries(config?.specs ?? {})) {\n const requires = (entry as { requires?: string[] }).requires ?? [];\n for (const dep of requires) {\n for (const from of entryIds.get(dep) ?? []) {\n for (const to of entryIds.get(key) ?? []) {\n addEdge(from, to, \"requires\");\n }\n }\n }\n }\n\n // 2. Frontmatter references, already in spec id space\n for (const specs of specsByEntry.values()) {\n for (const spec of specs) {\n const selfId = spec.frontmatter.id;\n if (typeof selfId !== \"string\") continue;\n const refs = spec.frontmatter.references;\n if (!Array.isArray(refs)) continue;\n\n for (const ref of refs) {\n if (!ref || typeof ref !== \"object\") continue;\n const { id: targetId, relationship } = ref as { id?: unknown; relationship?: unknown };\n if (typeof targetId !== \"string\" || typeof relationship !== \"string\") continue;\n // Referencing a spec outside the suite is valid-references' concern.\n if (!knownIds.has(targetId)) continue;\n\n const direction = DEPENDENCY_RELATIONSHIPS[relationship as never];\n if (direction === \"self-requires-target\") {\n addEdge(targetId, selfId, \"references\");\n } else if (direction === \"target-requires-self\") {\n addEdge(selfId, targetId, \"references\");\n }\n }\n }\n }\n\n const edges: RelationEdge[] = [];\n const downstreamAdj = new Map<string, string[]>();\n const upstreamAdj = new Map<string, string[]>();\n\n for (const [key, source] of edgeSources) {\n const [from, to] = key.split(\"\u0000\") as [string, string];\n edges.push({ from, to, source });\n downstreamAdj.set(from, [...(downstreamAdj.get(from) ?? []), to]);\n upstreamAdj.set(to, [...(upstreamAdj.get(to) ?? []), from]);\n }\n\n return {\n edges,\n getUpstream: (specId) => walk(specId, upstreamAdj),\n getDownstream: (specId) => walk(specId, downstreamAdj),\n };\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(`Could not resolve preset \"${name}\" as a local file or npm package`);\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,UA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