specdx 0.4.0-alpha.8 → 0.4.0
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 +7 -2
- package/README.md +259 -0
- package/dist/{check-ULQYDDRD.js → check-PHXXA7VY.js} +70 -31
- package/dist/check-PHXXA7VY.js.map +1 -0
- package/dist/chunk-2BZIG7OE.js +185 -0
- package/dist/chunk-2BZIG7OE.js.map +1 -0
- package/dist/{chunk-OTDEP6WZ.js → chunk-3YXRWQGX.js} +251 -52
- package/dist/chunk-3YXRWQGX.js.map +1 -0
- package/dist/chunk-5WRI5ZAA.js +31 -0
- package/dist/chunk-DMGABJ6T.js +41 -0
- package/dist/chunk-DMGABJ6T.js.map +1 -0
- package/dist/{chunk-7JXW2GTJ.js → chunk-HCJDCS26.js} +9 -2
- package/dist/chunk-HCJDCS26.js.map +1 -0
- package/dist/chunk-LJTLNXGV.js +835 -0
- package/dist/chunk-LJTLNXGV.js.map +1 -0
- package/dist/chunk-NAWYG4VV.js +2846 -0
- package/dist/chunk-NAWYG4VV.js.map +1 -0
- package/dist/chunk-NHD44ZYN.js +20 -0
- package/dist/chunk-NHD44ZYN.js.map +1 -0
- package/dist/chunk-OVIKIIR4.js +103 -0
- package/dist/chunk-OVIKIIR4.js.map +1 -0
- package/dist/{chunk-IHTYAW7C.js → chunk-SNQNQ2MP.js} +111 -7
- package/dist/chunk-SNQNQ2MP.js.map +1 -0
- package/dist/{chunk-AKNPCB37.js → chunk-YRQPY5NF.js} +32 -12
- package/dist/chunk-YRQPY5NF.js.map +1 -0
- package/dist/diff-6C5LJ7SH.js +200 -0
- package/dist/diff-6C5LJ7SH.js.map +1 -0
- package/dist/{dist-HKVTEPU5.js → dist-PK52GA7M.js} +45 -20
- package/dist/dist-PK52GA7M.js.map +1 -0
- package/dist/{dist-4MXKMRHE.js → dist-ROHCFKYT.js} +3 -2
- package/dist/dist-ROHCFKYT.js.map +1 -0
- package/dist/generate-K72WD455.js +21 -0
- package/dist/generate-K72WD455.js.map +1 -0
- package/dist/{generate-story-EFHGINHA.js → generate-story-NUCNYL3I.js} +43 -19
- package/dist/generate-story-NUCNYL3I.js.map +1 -0
- package/dist/{generate-test-plan-BO7444RG.js → generate-test-plan-Z46W3N3B.js} +61 -11
- package/dist/generate-test-plan-Z46W3N3B.js.map +1 -0
- package/dist/{graph-5XINV7PT.js → graph-4RNURBNP.js} +49 -11
- package/dist/graph-4RNURBNP.js.map +1 -0
- package/dist/index.d.ts +275 -0
- package/dist/index.js +2651 -350
- package/dist/index.js.map +1 -1
- package/dist/{lint-PGA7JFKM.js → lint-2VZPNLE3.js} +51 -17
- package/dist/lint-2VZPNLE3.js.map +1 -0
- package/dist/main.js +10 -229
- package/dist/main.js.map +1 -1
- package/dist/mcp-E6PJWBDQ.js +35 -0
- package/dist/mcp-E6PJWBDQ.js.map +1 -0
- package/dist/{migrate-4KF6GHLO.js → migrate-FKFC7UAO.js} +21 -9
- package/dist/migrate-FKFC7UAO.js.map +1 -0
- package/dist/{pack-DSOODXAN.js → pack-DE4UBTCC.js} +41 -13
- package/dist/pack-DE4UBTCC.js.map +1 -0
- package/dist/{ready-GTCDQOIC.js → ready-K74SLQ24.js} +88 -24
- package/dist/ready-K74SLQ24.js.map +1 -0
- package/dist/skills/{specdx-author-spec.md → core/specdx-author-spec/SKILL.md} +10 -6
- package/dist/skills/{specdx-author-spec → core/specdx-author-spec/references}/step-01-frontmatter.md +1 -1
- package/dist/skills/{specdx-author-spec → core/specdx-author-spec/references}/step-02-sections.md +41 -0
- package/dist/skills/{specdx-onboard.md → core/specdx-onboard/SKILL.md} +8 -3
- package/dist/skills/{specdx-plan-from-spec.md → core/specdx-plan-from-spec/SKILL.md} +5 -1
- package/dist/skills/{specdx-pre-commit.md → core/specdx-pre-commit/SKILL.md} +16 -2
- package/dist/skills/{specdx-review-spec.md → core/specdx-review-spec/SKILL.md} +5 -1
- package/dist/skills/core/specdx-router/SKILL.md +67 -0
- package/dist/skills/{specdx-sprint-review.md → core/specdx-sprint-review/SKILL.md} +6 -2
- package/dist/skills/{specdx-start-task.md → core/specdx-start-task/SKILL.md} +5 -1
- package/dist/skills/{specdx-check-drift.md → experimental/specdx-check-drift/SKILL.md} +10 -4
- package/dist/skills/{specdx-verify.md → experimental/specdx-verify/SKILL.md} +8 -2
- package/dist/skills-36SRUEMR.js +121 -0
- package/dist/skills-36SRUEMR.js.map +1 -0
- package/dist/{status-C3YDBH2L.js → status-IAE3BB77.js} +69 -32
- package/dist/status-IAE3BB77.js.map +1 -0
- package/dist/{update-ULMSL5XZ.js → update-UFOHZEAK.js} +22 -12
- package/dist/update-UFOHZEAK.js.map +1 -0
- package/dist/validate-EZHUB5TW.js +105 -0
- package/dist/validate-EZHUB5TW.js.map +1 -0
- package/hooks/hooks.json +12 -6
- package/hooks/session-start +35 -3
- package/package.json +28 -13
- package/dist/changelog-FJIQBEBB.js +0 -93
- package/dist/changelog-FJIQBEBB.js.map +0 -1
- package/dist/check-ULQYDDRD.js.map +0 -1
- package/dist/chunk-7JXW2GTJ.js.map +0 -1
- package/dist/chunk-AKNPCB37.js.map +0 -1
- package/dist/chunk-DAZCOUVK.js +0 -496
- package/dist/chunk-DAZCOUVK.js.map +0 -1
- package/dist/chunk-GAM4MXPC.js +0 -15
- package/dist/chunk-GAM4MXPC.js.map +0 -1
- package/dist/chunk-IHTYAW7C.js.map +0 -1
- package/dist/chunk-OTDEP6WZ.js.map +0 -1
- package/dist/chunk-UZ2E6LX7.js +0 -1147
- package/dist/chunk-UZ2E6LX7.js.map +0 -1
- package/dist/diff-ZN2YTGE2.js +0 -107
- package/dist/diff-ZN2YTGE2.js.map +0 -1
- package/dist/dist-HKVTEPU5.js.map +0 -1
- package/dist/explain-QBV3AESQ.js +0 -109
- package/dist/explain-QBV3AESQ.js.map +0 -1
- package/dist/generate-7GNPT2WJ.js +0 -13
- package/dist/generate-7GNPT2WJ.js.map +0 -1
- package/dist/generate-story-EFHGINHA.js.map +0 -1
- package/dist/generate-test-plan-BO7444RG.js.map +0 -1
- package/dist/graph-5XINV7PT.js.map +0 -1
- package/dist/lint-PGA7JFKM.js.map +0 -1
- package/dist/mcp-QTIA76DS.js +0 -17
- package/dist/mcp-QTIA76DS.js.map +0 -1
- package/dist/migrate-4KF6GHLO.js.map +0 -1
- package/dist/pack-DSOODXAN.js.map +0 -1
- package/dist/ready-GTCDQOIC.js.map +0 -1
- package/dist/skills-3GBBWZW2.js +0 -93
- package/dist/skills-3GBBWZW2.js.map +0 -1
- package/dist/status-C3YDBH2L.js.map +0 -1
- package/dist/update-ULMSL5XZ.js.map +0 -1
- package/dist/validate-E7F3Q5BE.js +0 -49
- package/dist/validate-E7F3Q5BE.js.map +0 -1
- /package/dist/{dist-4MXKMRHE.js.map → chunk-5WRI5ZAA.js.map} +0 -0
- /package/dist/skills/{spec-type-reference.md → core/specdx-author-spec/references/spec-type-reference.md} +0 -0
- /package/dist/skills/{specdx-author-spec → core/specdx-author-spec/references}/step-03-finalize.md +0 -0
|
@@ -1,20 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
sharedArgs
|
|
3
|
-
} from "./chunk-GAM4MXPC.js";
|
|
4
1
|
import {
|
|
5
2
|
createLintEngine,
|
|
6
|
-
|
|
7
|
-
} from "./chunk-
|
|
3
|
+
resolveLintConfig
|
|
4
|
+
} from "./chunk-LJTLNXGV.js";
|
|
5
|
+
import {
|
|
6
|
+
createOutput
|
|
7
|
+
} from "./chunk-NHD44ZYN.js";
|
|
8
|
+
import {
|
|
9
|
+
resolveFormat,
|
|
10
|
+
sharedArgs
|
|
11
|
+
} from "./chunk-DMGABJ6T.js";
|
|
8
12
|
import {
|
|
9
13
|
buildGraph,
|
|
10
14
|
createLogger,
|
|
11
15
|
loadConfig,
|
|
12
16
|
parseSpec,
|
|
13
17
|
resolveGlob
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-
|
|
18
|
+
} from "./chunk-SNQNQ2MP.js";
|
|
19
|
+
import "./chunk-HCJDCS26.js";
|
|
20
|
+
import "./chunk-5WRI5ZAA.js";
|
|
16
21
|
|
|
17
|
-
// src/commands/lint.ts
|
|
22
|
+
// src/commands/core/lint.ts
|
|
18
23
|
import { defineCommand } from "citty";
|
|
19
24
|
|
|
20
25
|
// src/formatters/pretty.ts
|
|
@@ -35,17 +40,25 @@ function formatJson(diagnostics) {
|
|
|
35
40
|
// src/formatters/github.ts
|
|
36
41
|
function formatGithub(diagnostics) {
|
|
37
42
|
return diagnostics.map((d) => {
|
|
38
|
-
const level = d.severity === "error" ? "error" : "warning";
|
|
43
|
+
const level = d.severity === "error" ? "error" : d.severity === "warn" ? "warning" : "notice";
|
|
39
44
|
const line = d.line ? `,line=${d.line}` : "";
|
|
40
45
|
return `::${level} file=${d.filePath}${line}::${d.message} (${d.ruleId})`;
|
|
41
46
|
}).join("\n");
|
|
42
47
|
}
|
|
43
48
|
|
|
44
|
-
// src/commands/lint.ts
|
|
49
|
+
// src/commands/core/lint.ts
|
|
50
|
+
var FORMATS = ["pretty", "json", "github"];
|
|
45
51
|
async function runLint(options) {
|
|
52
|
+
if (!options.configDir) {
|
|
53
|
+
throw new TypeError("runLint requires `configDir` \u2014 the directory holding spec.config.yaml.");
|
|
54
|
+
}
|
|
46
55
|
const config = await loadConfig(void 0, options.configDir);
|
|
47
56
|
const preset = options.preset ?? config.lint?.extends ?? "recommended";
|
|
48
|
-
const rules =
|
|
57
|
+
const { rules, ignore } = await resolveLintConfig({
|
|
58
|
+
config,
|
|
59
|
+
preset,
|
|
60
|
+
configDir: options.configDir
|
|
61
|
+
});
|
|
49
62
|
const specs = [];
|
|
50
63
|
for (const [, entry] of Object.entries(config.specs)) {
|
|
51
64
|
const files = await resolveGlob(entry.path, options.configDir);
|
|
@@ -60,7 +73,7 @@ async function runLint(options) {
|
|
|
60
73
|
} catch (err) {
|
|
61
74
|
graphError = err.message;
|
|
62
75
|
}
|
|
63
|
-
const engine = createLintEngine({ rules, config, graph });
|
|
76
|
+
const engine = createLintEngine({ rules, config, graph, ignore });
|
|
64
77
|
const results = engine.lint(specs);
|
|
65
78
|
if (options.specPath) {
|
|
66
79
|
const specPath = options.specPath;
|
|
@@ -77,18 +90,28 @@ async function runLint(options) {
|
|
|
77
90
|
});
|
|
78
91
|
results.hasErrors = true;
|
|
79
92
|
}
|
|
80
|
-
|
|
93
|
+
const ignored = new Set(ignore);
|
|
94
|
+
const linted = specs.filter((spec) => !ignored.has(spec.filePath));
|
|
95
|
+
return { ...results, specFiles: linted.length, assessed: linted.length > 0 };
|
|
81
96
|
}
|
|
82
97
|
var lint_default = defineCommand({
|
|
83
98
|
meta: { name: "lint", description: "Lint all specs in the suite" },
|
|
84
99
|
args: {
|
|
85
|
-
...sharedArgs,
|
|
100
|
+
...sharedArgs(FORMATS),
|
|
86
101
|
fix: { type: "boolean", description: "Auto-fix issues where possible" },
|
|
87
102
|
path: { type: "positional", description: "Lint a specific spec file", required: false },
|
|
88
103
|
preset: { type: "string", description: "Lint preset (minimal, recommended, strict)" }
|
|
89
104
|
},
|
|
90
105
|
async run({ args }) {
|
|
91
106
|
const logger = createLogger({ quiet: args.quiet, verbose: args.verbose });
|
|
107
|
+
const output = createOutput({ quiet: args.quiet });
|
|
108
|
+
const format = resolveFormat(args.format, FORMATS);
|
|
109
|
+
if (!format.ok) {
|
|
110
|
+
console.error(`
|
|
111
|
+
\u2717 ${format.message}
|
|
112
|
+
`);
|
|
113
|
+
process.exit(1);
|
|
114
|
+
}
|
|
92
115
|
if (args.fix) {
|
|
93
116
|
logger.info("No auto-fixable issues supported yet.");
|
|
94
117
|
}
|
|
@@ -98,8 +121,19 @@ var lint_default = defineCommand({
|
|
|
98
121
|
specPath: args.path,
|
|
99
122
|
preset: args.preset
|
|
100
123
|
});
|
|
101
|
-
const formatter =
|
|
102
|
-
|
|
124
|
+
const formatter = format.format === "json" ? formatJson : format.format === "github" ? formatGithub : formatPretty;
|
|
125
|
+
if (!results.assessed) {
|
|
126
|
+
console.error(
|
|
127
|
+
"\n \u26A0 No specs were linted. Check the spec paths in spec.config.yaml, and whether `lint.ignore` excludes them all.\n"
|
|
128
|
+
);
|
|
129
|
+
process.exit(3);
|
|
130
|
+
}
|
|
131
|
+
const rendered = formatter(results.diagnostics);
|
|
132
|
+
if (format.format === "pretty" && results.diagnostics.length === 0) {
|
|
133
|
+
output.info(rendered);
|
|
134
|
+
} else {
|
|
135
|
+
output.out(rendered);
|
|
136
|
+
}
|
|
103
137
|
if (results.hasErrors) process.exit(1);
|
|
104
138
|
} catch (err) {
|
|
105
139
|
console.error(`
|
|
@@ -113,4 +147,4 @@ export {
|
|
|
113
147
|
lint_default as default,
|
|
114
148
|
runLint
|
|
115
149
|
};
|
|
116
|
-
//# sourceMappingURL=lint-
|
|
150
|
+
//# sourceMappingURL=lint-2VZPNLE3.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, resolveLintConfig, type LintResults } from \"@specdx/lint\";\nimport type { ParsedSpec } from \"@specdx/core\";\nimport { sharedArgs, resolveFormat } from \"../../shared-args.js\";\nimport { createOutput } from \"../../output.js\";\nimport { formatPretty } from \"../../formatters/pretty.js\";\nimport { formatJson } from \"../../formatters/json.js\";\nimport { formatGithub } from \"../../formatters/github.js\";\n\nconst FORMATS = [\"pretty\", \"json\", \"github\"] as const;\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 spec files linted. Named for what it counts, not \"count\". */\n specFiles: 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, ignore } = await resolveLintConfig({\n config,\n preset,\n configDir: options.configDir,\n });\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, ignore });\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 // Count what was actually linted, not what resolved. `lint.ignore` excluding\n // every spec produces no diagnostics, and reporting that as a pass is the\n // vacuous-pass shape one config key over: \"0 problems\" because nothing was\n // looked at reads identically to \"0 problems\" because nothing was wrong.\n const ignored = new Set(ignore);\n const linted = specs.filter((spec) => !ignored.has(spec.filePath));\n\n return { ...results, specFiles: linted.length, assessed: linted.length > 0 };\n}\n\nexport default defineCommand({\n meta: { name: \"lint\", description: \"Lint all specs in the suite\" },\n args: {\n ...sharedArgs(FORMATS),\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 const output = createOutput({ quiet: args.quiet });\n\n const format = resolveFormat(args.format, FORMATS);\n if (!format.ok) {\n console.error(`\\n ✗ ${format.message}\\n`);\n process.exit(1);\n }\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 format.format === \"json\"\n ? formatJson\n : format.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 were linted. Check the spec paths in spec.config.yaml, and whether `lint.ignore` excludes them all.\\n\",\n );\n process.exit(3);\n }\n\n const rendered = formatter(results.diagnostics);\n // A clean pretty run is chrome; diagnostics and machine formats are not.\n if (format.format === \"pretty\" && results.diagnostics.length === 0) {\n output.info(rendered);\n } else {\n output.out(rendered);\n }\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\";\n\n/**\n * GitHub workflow-command annotations.\n *\n * Info-severity diagnostics map to `::notice`, not `::warning`. Rendering an\n * advisory as a warning put five warnings in the Actions log for a suite that\n * was clean and exited 0 — the ambiguity advisory in particular, which is info\n * precisely so it cannot fail a build (audit run 5, F5).\n */\nexport function formatGithub(diagnostics: Diagnostic[]): string {\n return diagnostics\n .map((d) => {\n const level = d.severity === \"error\" ? \"error\" : d.severity === \"warn\" ? \"warning\" : \"notice\";\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;;;ACOO,SAAS,aAAa,aAAmC;AAC9D,SAAO,YACJ,IAAI,CAAC,MAAM;AACV,UAAM,QAAQ,EAAE,aAAa,UAAU,UAAU,EAAE,aAAa,SAAS,YAAY;AACrF,UAAM,OAAO,EAAE,OAAO,SAAS,EAAE,IAAI,KAAK;AAC1C,WAAO,KAAK,KAAK,SAAS,EAAE,QAAQ,GAAG,IAAI,KAAK,EAAE,OAAO,KAAK,EAAE,MAAM;AAAA,EACxE,CAAC,EACA,KAAK,IAAI;AACd;;;AHRA,IAAM,UAAU,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AAM,WAAW,UAAU,QAAQ,WAAW;AAE9C,UAAI,OAAO,WAAW,YAAY,QAAQ,YAAY,WAAW,GAAG;AAClE,eAAO,KAAK,QAAQ;AAAA,MACtB,OAAO;AACL,eAAO,IAAI,QAAQ;AAAA,MACrB;AAEA,UAAI,QAAQ,UAAW,SAAQ,KAAK,CAAC;AAAA,IACvC,SAAS,KAAK;AACZ,cAAQ,MAAM;AAAA,WAAU,IAAc,OAAO;AAAA,CAAI;AACjD,cAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF;AACF,CAAC;","names":[]}
|
package/dist/main.js
CHANGED
|
@@ -1,237 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var package_default = {
|
|
11
|
-
name: "specdx",
|
|
12
|
-
version: "0.4.0-alpha.8",
|
|
13
|
-
description: "Spec-driven development toolchain. Validate, lint, pack, and ship specs for LLM-assisted workflows.",
|
|
14
|
-
type: "module",
|
|
15
|
-
license: "MIT",
|
|
16
|
-
author: "Umar Gora (https://github.com/umxr)",
|
|
17
|
-
repository: {
|
|
18
|
-
type: "git",
|
|
19
|
-
url: "https://github.com/umxr/specdx.git",
|
|
20
|
-
directory: "packages/cli"
|
|
21
|
-
},
|
|
22
|
-
homepage: "https://github.com/umxr/specdx#readme",
|
|
23
|
-
bugs: {
|
|
24
|
-
url: "https://github.com/umxr/specdx/issues"
|
|
25
|
-
},
|
|
26
|
-
keywords: [
|
|
27
|
-
"spec",
|
|
28
|
-
"specification",
|
|
29
|
-
"prd",
|
|
30
|
-
"technical-design",
|
|
31
|
-
"api-contract",
|
|
32
|
-
"lint",
|
|
33
|
-
"validation",
|
|
34
|
-
"llm",
|
|
35
|
-
"ai",
|
|
36
|
-
"context-packing",
|
|
37
|
-
"spec-driven-development",
|
|
38
|
-
"claude-code"
|
|
39
|
-
],
|
|
40
|
-
engines: {
|
|
41
|
-
node: ">=18.0.0"
|
|
42
|
-
},
|
|
43
|
-
bin: {
|
|
44
|
-
specdx: "./dist/main.js"
|
|
45
|
-
},
|
|
46
|
-
exports: {
|
|
47
|
-
".": {
|
|
48
|
-
import: "./dist/index.js",
|
|
49
|
-
types: "./dist/index.d.ts"
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
files: [
|
|
53
|
-
"dist",
|
|
54
|
-
".claude-plugin",
|
|
55
|
-
"hooks"
|
|
56
|
-
],
|
|
57
|
-
scripts: {
|
|
58
|
-
build: "tsup",
|
|
59
|
-
typecheck: "tsc --noEmit",
|
|
60
|
-
test: "vitest run",
|
|
61
|
-
clean: "rm -rf dist *.tsbuildinfo"
|
|
62
|
-
},
|
|
63
|
-
dependencies: {
|
|
64
|
-
ajv: "^8.18.0",
|
|
65
|
-
"ajv-formats": "^3.0.1",
|
|
66
|
-
citty: "^0.2.1",
|
|
67
|
-
consola: "^3.4.0",
|
|
68
|
-
"gray-matter": "^4.0.3",
|
|
69
|
-
"js-tiktoken": "^1.0.18",
|
|
70
|
-
"remark-parse": "^11.0.0",
|
|
71
|
-
tinyglobby: "^0.2.12",
|
|
72
|
-
unified: "^11.0.0",
|
|
73
|
-
"unist-util-visit": "^5.0.0",
|
|
74
|
-
yaml: "^2.7.0"
|
|
75
|
-
},
|
|
76
|
-
devDependencies: {
|
|
77
|
-
"@specdx/check": "workspace:*",
|
|
78
|
-
"@specdx/core": "workspace:*",
|
|
79
|
-
"@specdx/diff": "workspace:*",
|
|
80
|
-
"@specdx/lint": "workspace:*",
|
|
81
|
-
"@specdx/mcp": "workspace:*",
|
|
82
|
-
"@specdx/pack": "workspace:*",
|
|
83
|
-
"@specdx/schema": "workspace:*",
|
|
84
|
-
"@specdx/skills": "workspace:*",
|
|
85
|
-
tsup: "^8.5.1",
|
|
86
|
-
typescript: "^5.7.0"
|
|
87
|
-
},
|
|
88
|
-
publishConfig: {
|
|
89
|
-
access: "public"
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
// src/commands/init.ts
|
|
94
|
-
import { defineCommand } from "citty";
|
|
95
|
-
import { mkdir, writeFile } from "fs/promises";
|
|
96
|
-
import { join } from "path";
|
|
97
|
-
var TEMPLATE_SPECS = {
|
|
98
|
-
lightweight: [
|
|
99
|
-
{ filename: "prd.md", type: "prd" },
|
|
100
|
-
{ filename: "technical-design.md", type: "technical-design" }
|
|
101
|
-
],
|
|
102
|
-
bmad: [
|
|
103
|
-
{ filename: "prd.md", type: "prd" },
|
|
104
|
-
{ filename: "technical-design.md", type: "technical-design" },
|
|
105
|
-
{ filename: "test-plan.md", type: "test-plan" }
|
|
106
|
-
],
|
|
107
|
-
"api-first": [
|
|
108
|
-
{ filename: "technical-design.md", type: "technical-design" },
|
|
109
|
-
{ filename: "api-contract.md", type: "api-contract" },
|
|
110
|
-
{ filename: "test-plan.md", type: "test-plan" }
|
|
111
|
-
],
|
|
112
|
-
quick: [{ filename: "quick-spec.md", type: "quick-spec" }],
|
|
113
|
-
context: [{ filename: "project-context.md", type: "project-context" }]
|
|
114
|
-
};
|
|
115
|
-
var TEMPLATE_EXTRA_DIRS = {
|
|
116
|
-
lightweight: [],
|
|
117
|
-
bmad: ["specs/stories", "specs/adr"],
|
|
118
|
-
"api-first": [],
|
|
119
|
-
quick: [],
|
|
120
|
-
context: []
|
|
121
|
-
};
|
|
122
|
-
function specIdFromFilename(filename) {
|
|
123
|
-
return filename.replace(/\.md$/, "");
|
|
124
|
-
}
|
|
125
|
-
function specTitleFromType(type) {
|
|
126
|
-
return type.split("-").map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" ");
|
|
127
|
-
}
|
|
128
|
-
function buildSpecFile(filename, type, projectName, today) {
|
|
129
|
-
const id = specIdFromFilename(filename);
|
|
130
|
-
const title = `${specTitleFromType(type)} \u2014 ${projectName}`;
|
|
131
|
-
const sections = REQUIRED_SECTIONS[type];
|
|
132
|
-
const frontmatter = [
|
|
133
|
-
"---",
|
|
134
|
-
`id: ${id}`,
|
|
135
|
-
`type: ${type}`,
|
|
136
|
-
`title: "${title}"`,
|
|
137
|
-
`status: draft`,
|
|
138
|
-
`version: "0.1"`,
|
|
139
|
-
`created: "${today}"`,
|
|
140
|
-
`authors: ["author"]`,
|
|
141
|
-
"---"
|
|
142
|
-
].join("\n");
|
|
143
|
-
const body = sections.map((section) => `
|
|
144
|
-
## ${section}
|
|
145
|
-
|
|
146
|
-
<!-- placeholder -->`).join("\n");
|
|
147
|
-
return `${frontmatter}
|
|
148
|
-
${body}
|
|
149
|
-
`;
|
|
150
|
-
}
|
|
151
|
-
function buildConfigYaml(projectName, specs) {
|
|
152
|
-
const specEntries = specs.map(({ filename, type }) => {
|
|
153
|
-
const key = specIdFromFilename(filename);
|
|
154
|
-
return ` ${key}:
|
|
155
|
-
path: specs/${filename}
|
|
156
|
-
type: ${type}`;
|
|
157
|
-
}).join("\n");
|
|
158
|
-
return [`version: "1.0"`, `project:`, ` name: "${projectName}"`, `specs:`, specEntries].join("\n") + "\n";
|
|
159
|
-
}
|
|
160
|
-
async function scaffoldProject({
|
|
161
|
-
projectName,
|
|
162
|
-
template,
|
|
163
|
-
targetDir
|
|
164
|
-
}) {
|
|
165
|
-
const today = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
166
|
-
const specsDir = join(targetDir, "specs");
|
|
167
|
-
await mkdir(specsDir, { recursive: true });
|
|
168
|
-
for (const extraDir of TEMPLATE_EXTRA_DIRS[template]) {
|
|
169
|
-
await mkdir(join(targetDir, extraDir), { recursive: true });
|
|
170
|
-
}
|
|
171
|
-
const specs = TEMPLATE_SPECS[template];
|
|
172
|
-
for (const { filename, type } of specs) {
|
|
173
|
-
const content = buildSpecFile(filename, type, projectName, today);
|
|
174
|
-
await writeFile(join(specsDir, filename), content, "utf-8");
|
|
175
|
-
}
|
|
176
|
-
const configContent = buildConfigYaml(projectName, specs);
|
|
177
|
-
await writeFile(join(targetDir, "spec.config.yaml"), configContent, "utf-8");
|
|
178
|
-
}
|
|
179
|
-
var init_default = defineCommand({
|
|
180
|
-
meta: {
|
|
181
|
-
name: "init",
|
|
182
|
-
description: "Initialize a new specdx project with spec scaffolding"
|
|
183
|
-
},
|
|
184
|
-
args: {
|
|
185
|
-
name: {
|
|
186
|
-
type: "string",
|
|
187
|
-
description: "Project name",
|
|
188
|
-
required: true
|
|
189
|
-
},
|
|
190
|
-
template: {
|
|
191
|
-
type: "string",
|
|
192
|
-
description: "Template to use (lightweight, bmad, api-first)",
|
|
193
|
-
default: "lightweight"
|
|
194
|
-
},
|
|
195
|
-
dir: {
|
|
196
|
-
type: "string",
|
|
197
|
-
description: "Target directory",
|
|
198
|
-
default: "."
|
|
199
|
-
}
|
|
200
|
-
},
|
|
201
|
-
async run({ args }) {
|
|
202
|
-
const { name, template, dir } = args;
|
|
203
|
-
const validTemplates = ["lightweight", "bmad", "api-first", "quick", "context"];
|
|
204
|
-
if (!validTemplates.includes(template)) {
|
|
205
|
-
console.error(`Unknown template: ${template}. Choose from: ${validTemplates.join(", ")}`);
|
|
206
|
-
process.exit(1);
|
|
207
|
-
}
|
|
208
|
-
console.log(`Scaffolding "${name}" with template "${template}" in ${dir}...`);
|
|
209
|
-
await scaffoldProject({ projectName: name, template, targetDir: dir });
|
|
210
|
-
console.log(`Done! Project "${name}" scaffolded successfully.`);
|
|
211
|
-
}
|
|
212
|
-
});
|
|
3
|
+
package_default
|
|
4
|
+
} from "./chunk-OVIKIIR4.js";
|
|
5
|
+
import {
|
|
6
|
+
subCommands
|
|
7
|
+
} from "./chunk-2BZIG7OE.js";
|
|
8
|
+
import "./chunk-HCJDCS26.js";
|
|
9
|
+
import "./chunk-5WRI5ZAA.js";
|
|
213
10
|
|
|
214
11
|
// src/main.ts
|
|
215
|
-
|
|
12
|
+
import { defineCommand, runMain } from "citty";
|
|
13
|
+
var main = defineCommand({
|
|
216
14
|
meta: { name: "specdx", version: package_default.version, description: "specdx \u2014 Spec Developer Experience" },
|
|
217
|
-
subCommands
|
|
218
|
-
init: init_default,
|
|
219
|
-
lint: () => import("./lint-PGA7JFKM.js").then((m) => m.default),
|
|
220
|
-
validate: () => import("./validate-E7F3Q5BE.js").then((m) => m.default),
|
|
221
|
-
graph: () => import("./graph-5XINV7PT.js").then((m) => m.default),
|
|
222
|
-
skills: () => import("./skills-3GBBWZW2.js").then((m) => m.default),
|
|
223
|
-
pack: () => import("./pack-DSOODXAN.js").then((m) => m.default),
|
|
224
|
-
diff: () => import("./diff-ZN2YTGE2.js").then((m) => m.default),
|
|
225
|
-
status: () => import("./status-C3YDBH2L.js").then((m) => m.default),
|
|
226
|
-
explain: () => import("./explain-QBV3AESQ.js").then((m) => m.default),
|
|
227
|
-
changelog: () => import("./changelog-FJIQBEBB.js").then((m) => m.default),
|
|
228
|
-
check: () => import("./check-ULQYDDRD.js").then((m) => m.default),
|
|
229
|
-
ready: () => import("./ready-GTCDQOIC.js").then((m) => m.default),
|
|
230
|
-
update: () => import("./update-ULMSL5XZ.js").then((m) => m.default),
|
|
231
|
-
generate: () => import("./generate-7GNPT2WJ.js").then((m) => m.default),
|
|
232
|
-
migrate: () => import("./migrate-4KF6GHLO.js").then((m) => m.default),
|
|
233
|
-
mcp: () => import("./mcp-QTIA76DS.js").then((m) => m.default)
|
|
234
|
-
}
|
|
15
|
+
subCommands
|
|
235
16
|
});
|
|
236
17
|
runMain(main).catch((err) => {
|
|
237
18
|
console.error(`
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/main.ts","../package.json","../src/commands/init.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { defineCommand, runMain } from \"citty\";\nimport pkg from \"../package.json\" with { type: \"json\" };\nimport initCommand from \"./commands/init.js\";\n\nconst main = defineCommand({\n meta: { name: \"specdx\", version: pkg.version, description: \"specdx — Spec Developer Experience\" },\n subCommands: {\n init: initCommand,\n lint: () => import(\"./commands/lint.js\").then((m) => m.default),\n validate: () => import(\"./commands/validate.js\").then((m) => m.default),\n graph: () => import(\"./commands/graph.js\").then((m) => m.default),\n skills: () => import(\"./commands/skills.js\").then((m) => m.default),\n pack: () => import(\"./commands/pack.js\").then((m) => m.default),\n diff: () => import(\"./commands/diff.js\").then((m) => m.default),\n status: () => import(\"./commands/status.js\").then((m) => m.default),\n explain: () => import(\"./commands/explain.js\").then((m) => m.default),\n changelog: () => import(\"./commands/changelog.js\").then((m) => m.default),\n check: () => import(\"./commands/check.js\").then((m) => m.default),\n ready: () => import(\"./commands/ready.js\").then((m) => m.default),\n update: () => import(\"./commands/update.js\").then((m) => m.default),\n generate: () => import(\"./commands/generate.js\").then((m) => m.default),\n migrate: () => import(\"./commands/migrate.js\").then((m) => m.default),\n mcp: () => import(\"./commands/mcp.js\").then((m) => m.default),\n },\n});\n\nrunMain(main).catch((err: Error) => {\n console.error(`\\n ✗ ${err.message}\\n`);\n process.exit(1);\n});\n","{\n \"name\": \"specdx\",\n \"version\": \"0.4.0-alpha.8\",\n \"description\": \"Spec-driven development toolchain. Validate, lint, pack, and ship specs for LLM-assisted workflows.\",\n \"type\": \"module\",\n \"license\": \"MIT\",\n \"author\": \"Umar Gora (https://github.com/umxr)\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/umxr/specdx.git\",\n \"directory\": \"packages/cli\"\n },\n \"homepage\": \"https://github.com/umxr/specdx#readme\",\n \"bugs\": {\n \"url\": \"https://github.com/umxr/specdx/issues\"\n },\n \"keywords\": [\n \"spec\",\n \"specification\",\n \"prd\",\n \"technical-design\",\n \"api-contract\",\n \"lint\",\n \"validation\",\n \"llm\",\n \"ai\",\n \"context-packing\",\n \"spec-driven-development\",\n \"claude-code\"\n ],\n \"engines\": {\n \"node\": \">=18.0.0\"\n },\n \"bin\": {\n \"specdx\": \"./dist/main.js\"\n },\n \"exports\": {\n \".\": {\n \"import\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\"\n }\n },\n \"files\": [\n \"dist\",\n \".claude-plugin\",\n \"hooks\"\n ],\n \"scripts\": {\n \"build\": \"tsup\",\n \"typecheck\": \"tsc --noEmit\",\n \"test\": \"vitest run\",\n \"clean\": \"rm -rf dist *.tsbuildinfo\"\n },\n \"dependencies\": {\n \"ajv\": \"^8.18.0\",\n \"ajv-formats\": \"^3.0.1\",\n \"citty\": \"^0.2.1\",\n \"consola\": \"^3.4.0\",\n \"gray-matter\": \"^4.0.3\",\n \"js-tiktoken\": \"^1.0.18\",\n \"remark-parse\": \"^11.0.0\",\n \"tinyglobby\": \"^0.2.12\",\n \"unified\": \"^11.0.0\",\n \"unist-util-visit\": \"^5.0.0\",\n \"yaml\": \"^2.7.0\"\n },\n \"devDependencies\": {\n \"@specdx/check\": \"workspace:*\",\n \"@specdx/core\": \"workspace:*\",\n \"@specdx/diff\": \"workspace:*\",\n \"@specdx/lint\": \"workspace:*\",\n \"@specdx/mcp\": \"workspace:*\",\n \"@specdx/pack\": \"workspace:*\",\n \"@specdx/schema\": \"workspace:*\",\n \"@specdx/skills\": \"workspace:*\",\n \"tsup\": \"^8.5.1\",\n \"typescript\": \"^5.7.0\"\n },\n \"publishConfig\": {\n \"access\": \"public\"\n }\n}\n","import { defineCommand } from \"citty\";\nimport { mkdir, writeFile } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport { REQUIRED_SECTIONS } from \"@specdx/schema\";\n\nexport type Template = \"lightweight\" | \"bmad\" | \"api-first\" | \"quick\" | \"context\";\n\ninterface ScaffoldOptions {\n projectName: string;\n template: Template;\n targetDir: string;\n}\n\nconst TEMPLATE_SPECS: Record<\n Template,\n Array<{ filename: string; type: keyof typeof REQUIRED_SECTIONS }>\n> = {\n lightweight: [\n { filename: \"prd.md\", type: \"prd\" },\n { filename: \"technical-design.md\", type: \"technical-design\" },\n ],\n bmad: [\n { filename: \"prd.md\", type: \"prd\" },\n { filename: \"technical-design.md\", type: \"technical-design\" },\n { filename: \"test-plan.md\", type: \"test-plan\" },\n ],\n \"api-first\": [\n { filename: \"technical-design.md\", type: \"technical-design\" },\n { filename: \"api-contract.md\", type: \"api-contract\" },\n { filename: \"test-plan.md\", type: \"test-plan\" },\n ],\n quick: [{ filename: \"quick-spec.md\", type: \"quick-spec\" }],\n context: [{ filename: \"project-context.md\", type: \"project-context\" }],\n};\n\nconst TEMPLATE_EXTRA_DIRS: Record<Template, string[]> = {\n lightweight: [],\n bmad: [\"specs/stories\", \"specs/adr\"],\n \"api-first\": [],\n quick: [],\n context: [],\n};\n\nfunction specIdFromFilename(filename: string): string {\n return filename.replace(/\\.md$/, \"\");\n}\n\nfunction specTitleFromType(type: string): string {\n return type\n .split(\"-\")\n .map((w) => w.charAt(0).toUpperCase() + w.slice(1))\n .join(\" \");\n}\n\nfunction buildSpecFile(\n filename: string,\n type: keyof typeof REQUIRED_SECTIONS,\n projectName: string,\n today: string,\n): string {\n const id = specIdFromFilename(filename);\n const title = `${specTitleFromType(type)} — ${projectName}`;\n const sections = REQUIRED_SECTIONS[type];\n\n const frontmatter = [\n \"---\",\n `id: ${id}`,\n `type: ${type}`,\n `title: \"${title}\"`,\n `status: draft`,\n `version: \"0.1\"`,\n `created: \"${today}\"`,\n `authors: [\"author\"]`,\n \"---\",\n ].join(\"\\n\");\n\n const body = sections.map((section) => `\\n## ${section}\\n\\n<!-- placeholder -->`).join(\"\\n\");\n\n return `${frontmatter}\\n${body}\\n`;\n}\n\nfunction buildConfigYaml(\n projectName: string,\n specs: Array<{ filename: string; type: string }>,\n): string {\n const specEntries = specs\n .map(({ filename, type }) => {\n const key = specIdFromFilename(filename);\n return ` ${key}:\\n path: specs/${filename}\\n type: ${type}`;\n })\n .join(\"\\n\");\n\n return (\n [`version: \"1.0\"`, `project:`, ` name: \"${projectName}\"`, `specs:`, specEntries].join(\"\\n\") +\n \"\\n\"\n );\n}\n\nexport async function scaffoldProject({\n projectName,\n template,\n targetDir,\n}: ScaffoldOptions): Promise<void> {\n const today = new Date().toISOString().slice(0, 10);\n const specsDir = join(targetDir, \"specs\");\n\n // Create specs/ directory\n await mkdir(specsDir, { recursive: true });\n\n // Create extra template dirs (e.g., bmad needs stories/ and adr/)\n for (const extraDir of TEMPLATE_EXTRA_DIRS[template]) {\n await mkdir(join(targetDir, extraDir), { recursive: true });\n }\n\n const specs = TEMPLATE_SPECS[template];\n\n // Write spec files\n for (const { filename, type } of specs) {\n const content = buildSpecFile(filename, type, projectName, today);\n await writeFile(join(specsDir, filename), content, \"utf-8\");\n }\n\n // Write spec.config.yaml\n const configContent = buildConfigYaml(projectName, specs);\n await writeFile(join(targetDir, \"spec.config.yaml\"), configContent, \"utf-8\");\n}\n\nexport default defineCommand({\n meta: {\n name: \"init\",\n description: \"Initialize a new specdx project with spec scaffolding\",\n },\n args: {\n name: {\n type: \"string\",\n description: \"Project name\",\n required: true,\n },\n template: {\n type: \"string\",\n description: \"Template to use (lightweight, bmad, api-first)\",\n default: \"lightweight\",\n },\n dir: {\n type: \"string\",\n description: \"Target directory\",\n default: \".\",\n },\n },\n async run({ args }) {\n const { name, template, dir } = args;\n const validTemplates: Template[] = [\"lightweight\", \"bmad\", \"api-first\", \"quick\", \"context\"];\n if (!validTemplates.includes(template as Template)) {\n console.error(`Unknown template: ${template}. Choose from: ${validTemplates.join(\", \")}`);\n process.exit(1);\n }\n console.log(`Scaffolding \"${name}\" with template \"${template}\" in ${dir}...`);\n await scaffoldProject({ projectName: name, template: template as Template, targetDir: dir });\n console.log(`Done! Project \"${name}\" scaffolded successfully.`);\n },\n});\n"],"mappings":";;;;;;AACA,SAAS,iBAAAA,gBAAe,eAAe;;;ACDvC;AAAA,EACE,MAAQ;AAAA,EACR,SAAW;AAAA,EACX,aAAe;AAAA,EACf,MAAQ;AAAA,EACR,SAAW;AAAA,EACX,QAAU;AAAA,EACV,YAAc;AAAA,IACZ,MAAQ;AAAA,IACR,KAAO;AAAA,IACP,WAAa;AAAA,EACf;AAAA,EACA,UAAY;AAAA,EACZ,MAAQ;AAAA,IACN,KAAO;AAAA,E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,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO;AAAA,IAC9D,QAAQ,MAAM,OAAO,sBAAsB,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO;AAAA,IAClE,SAAS,MAAM,OAAO,uBAAuB,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO;AAAA,IACpE,WAAW,MAAM,OAAO,yBAAyB,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO;AAAA,IACxE,OAAO,MAAM,OAAO,qBAAqB,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO;AAAA,IAChE,OAAO,MAAM,OAAO,qBAAqB,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO;AAAA,IAChE,QAAQ,MAAM,OAAO,sBAAsB,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO;AAAA,IAClE,UAAU,MAAM,OAAO,wBAAwB,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO;AAAA,IACtE,SAAS,MAAM,OAAO,uBAAuB,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO;AAAA,IACpE,KAAK,MAAM,OAAO,mBAAmB,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO;AAAA,EAC9D;AACF,CAAC;AAED,QAAQ,IAAI,EAAE,MAAM,CAAC,QAAe;AAClC,UAAQ,MAAM;AAAA,WAAS,IAAI,OAAO;AAAA,CAAI;AACtC,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":["defineCommand","defineCommand"]}
|
|
1
|
+
{"version":3,"sources":["../src/main.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { defineCommand, runMain } from \"citty\";\nimport pkg from \"../package.json\" with { type: \"json\" };\nimport { subCommands } from \"./commands/registry.js\";\n\nconst main = defineCommand({\n meta: { name: \"specdx\", version: pkg.version, description: \"specdx — Spec Developer Experience\" },\n subCommands,\n});\n\nrunMain(main).catch((err: Error) => {\n console.error(`\\n ✗ ${err.message}\\n`);\n process.exit(1);\n});\n"],"mappings":";;;;;;;;;;;AACA,SAAS,eAAe,eAAe;AAIvC,IAAM,OAAO,cAAc;AAAA,EACzB,MAAM,EAAE,MAAM,UAAU,SAAS,gBAAI,SAAS,aAAa,0CAAqC;AAAA,EAChG;AACF,CAAC;AAED,QAAQ,IAAI,EAAE,MAAM,CAAC,QAAe;AAClC,UAAQ,MAAM;AAAA,WAAS,IAAI,OAAO;AAAA,CAAI;AACtC,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":[]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import {
|
|
2
|
+
package_default
|
|
3
|
+
} from "./chunk-OVIKIIR4.js";
|
|
4
|
+
import "./chunk-5WRI5ZAA.js";
|
|
5
|
+
|
|
6
|
+
// src/commands/core/mcp.ts
|
|
7
|
+
import { defineCommand } from "citty";
|
|
8
|
+
var mcp_default = defineCommand({
|
|
9
|
+
meta: { name: "mcp", description: "Start the specdx MCP server (stdio transport)" },
|
|
10
|
+
args: {},
|
|
11
|
+
async run() {
|
|
12
|
+
let mcp;
|
|
13
|
+
let stdio;
|
|
14
|
+
try {
|
|
15
|
+
mcp = await import("./dist-PK52GA7M.js");
|
|
16
|
+
stdio = await import("@modelcontextprotocol/sdk/server/stdio.js");
|
|
17
|
+
} catch (err) {
|
|
18
|
+
const missing = err.message.includes("zod") ? "zod" : "@modelcontextprotocol/sdk";
|
|
19
|
+
console.error(
|
|
20
|
+
`
|
|
21
|
+
\u2717 Cannot start the MCP server: ${missing} is not installed.
|
|
22
|
+
It ships as a dependency of specdx, so this usually means a partial install.
|
|
23
|
+
Try reinstalling specdx, or add it directly: npm install ${missing}
|
|
24
|
+
`
|
|
25
|
+
);
|
|
26
|
+
process.exit(1);
|
|
27
|
+
}
|
|
28
|
+
const server = mcp.createMcpServer(package_default.version);
|
|
29
|
+
await server.connect(new stdio.StdioServerTransport());
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
export {
|
|
33
|
+
mcp_default as default
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=mcp-E6PJWBDQ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/core/mcp.ts"],"sourcesContent":["import { defineCommand } from \"citty\";\nimport pkg from \"../../../package.json\" with { type: \"json\" };\n\nexport default defineCommand({\n meta: { name: \"mcp\", description: \"Start the specdx MCP server (stdio transport)\" },\n args: {},\n async run() {\n // The MCP SDK and zod are dependencies of specdx, not bundled into it. A\n // broken or partial install should say so rather than surface a raw\n // ERR_MODULE_NOT_FOUND stack trace on stdout, which is also the transport.\n let mcp: typeof import(\"@specdx/mcp\");\n let stdio: typeof import(\"@modelcontextprotocol/sdk/server/stdio.js\");\n try {\n mcp = await import(\"@specdx/mcp\");\n stdio = await import(\"@modelcontextprotocol/sdk/server/stdio.js\");\n } catch (err) {\n const missing = (err as Error).message.includes(\"zod\") ? \"zod\" : \"@modelcontextprotocol/sdk\";\n console.error(\n `\\n ✗ Cannot start the MCP server: ${missing} is not installed.\\n` +\n ` It ships as a dependency of specdx, so this usually means a partial install.\\n` +\n ` Try reinstalling specdx, or add it directly: npm install ${missing}\\n`,\n );\n process.exit(1);\n }\n\n const server = mcp.createMcpServer(pkg.version);\n await server.connect(new stdio.StdioServerTransport());\n },\n});\n"],"mappings":";;;;;;AAAA,SAAS,qBAAqB;AAG9B,IAAO,cAAQ,cAAc;AAAA,EAC3B,MAAM,EAAE,MAAM,OAAO,aAAa,gDAAgD;AAAA,EAClF,MAAM,CAAC;AAAA,EACP,MAAM,MAAM;AAIV,QAAI;AACJ,QAAI;AACJ,QAAI;AACF,YAAM,MAAM,OAAO,oBAAa;AAChC,cAAQ,MAAM,OAAO,2CAA2C;AAAA,IAClE,SAAS,KAAK;AACZ,YAAM,UAAW,IAAc,QAAQ,SAAS,KAAK,IAAI,QAAQ;AACjE,cAAQ;AAAA,QACN;AAAA,wCAAsC,OAAO;AAAA;AAAA,+DAEqB,OAAO;AAAA;AAAA,MAC3E;AACA,cAAQ,KAAK,CAAC;AAAA,IAChB;AAEA,UAAM,SAAS,IAAI,gBAAgB,gBAAI,OAAO;AAC9C,UAAM,OAAO,QAAQ,IAAI,MAAM,qBAAqB,CAAC;AAAA,EACvD;AACF,CAAC;","names":[]}
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createLogger,
|
|
3
3
|
loadConfig
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-SNQNQ2MP.js";
|
|
5
5
|
import {
|
|
6
|
-
SPEC_TYPES
|
|
7
|
-
|
|
6
|
+
SPEC_TYPES,
|
|
7
|
+
SUPPORTED_CONFIG_VERSION
|
|
8
|
+
} from "./chunk-HCJDCS26.js";
|
|
9
|
+
import "./chunk-5WRI5ZAA.js";
|
|
8
10
|
|
|
9
|
-
// src/commands/migrate.ts
|
|
11
|
+
// src/commands/experimental/migrate.ts
|
|
10
12
|
import { defineCommand } from "citty";
|
|
11
13
|
var migrate_default = defineCommand({
|
|
12
|
-
meta: { name: "migrate", description: "
|
|
14
|
+
meta: { name: "migrate", description: "Check and migrate spec suite schema" },
|
|
13
15
|
args: {
|
|
14
16
|
quiet: { type: "boolean", description: "Suppress output" }
|
|
15
17
|
},
|
|
@@ -21,6 +23,7 @@ var migrate_default = defineCommand({
|
|
|
21
23
|
logger.info(`
|
|
22
24
|
Config version: ${config.version}`);
|
|
23
25
|
logger.info(` Supported spec types: ${SPEC_TYPES.join(", ")}`);
|
|
26
|
+
const versionMismatch = config.version !== SUPPORTED_CONFIG_VERSION;
|
|
24
27
|
const unknownTypes = [];
|
|
25
28
|
for (const [key, entry] of Object.entries(config.specs)) {
|
|
26
29
|
if (!SPEC_TYPES.includes(entry.type)) {
|
|
@@ -37,11 +40,20 @@ var migrate_default = defineCommand({
|
|
|
37
40
|
Update specdx to resolve.
|
|
38
41
|
`);
|
|
39
42
|
process.exit(1);
|
|
40
|
-
}
|
|
41
|
-
|
|
43
|
+
}
|
|
44
|
+
if (versionMismatch) {
|
|
45
|
+
logger.info(
|
|
46
|
+
`
|
|
47
|
+
\u26A0 Config declares version "${config.version}", but this specdx supports "${SUPPORTED_CONFIG_VERSION}".
|
|
48
|
+
Every spec type is recognised, so nothing needs migrating \u2014
|
|
49
|
+
set version: "${SUPPORTED_CONFIG_VERSION}" in spec.config.yaml to match.
|
|
50
|
+
`
|
|
51
|
+
);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
logger.info(`
|
|
42
55
|
\u2713 All spec types are recognized. No migration needed.
|
|
43
56
|
`);
|
|
44
|
-
}
|
|
45
57
|
} catch (err) {
|
|
46
58
|
console.error(`
|
|
47
59
|
\u2717 ${err.message}
|
|
@@ -53,4 +65,4 @@ var migrate_default = defineCommand({
|
|
|
53
65
|
export {
|
|
54
66
|
migrate_default as default
|
|
55
67
|
};
|
|
56
|
-
//# sourceMappingURL=migrate-
|
|
68
|
+
//# sourceMappingURL=migrate-FKFC7UAO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/experimental/migrate.ts"],"sourcesContent":["import { defineCommand } from \"citty\";\nimport { loadConfig, createLogger } from \"@specdx/core\";\nimport { SPEC_TYPES, SUPPORTED_CONFIG_VERSION } from \"@specdx/schema\";\n\nexport default defineCommand({\n meta: { name: \"migrate\", description: \"Check and migrate spec suite schema\" },\n args: {\n quiet: { type: \"boolean\", description: \"Suppress output\" },\n },\n async run({ args }) {\n const logger = createLogger({ quiet: args.quiet });\n const configDir = process.cwd();\n\n try {\n const config = await loadConfig(undefined, configDir);\n logger.info(`\\n Config version: ${config.version}`);\n logger.info(` Supported spec types: ${SPEC_TYPES.join(\", \")}`);\n\n // Printing the version and then ignoring it made the field decorative:\n // a config declaring 0.9 was reported as needing no migration, which is\n // the one question this command exists to answer.\n const versionMismatch = config.version !== SUPPORTED_CONFIG_VERSION;\n\n const unknownTypes: string[] = [];\n for (const [key, entry] of Object.entries(config.specs)) {\n if (!SPEC_TYPES.includes(entry.type as (typeof SPEC_TYPES)[number])) {\n unknownTypes.push(`${key}: ${entry.type}`);\n }\n }\n\n if (unknownTypes.length > 0) {\n logger.info(`\\n Unknown spec types found:`);\n for (const ut of unknownTypes) {\n logger.info(` - ${ut}`);\n }\n logger.info(`\\n Update specdx to resolve.\\n`);\n process.exit(1);\n }\n\n if (versionMismatch) {\n logger.info(\n `\\n ⚠ Config declares version \"${config.version}\", but this specdx supports \"${SUPPORTED_CONFIG_VERSION}\".` +\n `\\n Every spec type is recognised, so nothing needs migrating —` +\n `\\n set version: \"${SUPPORTED_CONFIG_VERSION}\" in spec.config.yaml to match.\\n`,\n );\n return;\n }\n\n logger.info(`\\n ✓ All spec types are recognized. No migration needed.\\n`);\n } catch (err) {\n console.error(`\\n ✗ ${(err as Error).message}\\n`);\n process.exit(1);\n }\n },\n});\n"],"mappings":";;;;;;;;;;;AAAA,SAAS,qBAAqB;AAI9B,IAAO,kBAAQ,cAAc;AAAA,EAC3B,MAAM,EAAE,MAAM,WAAW,aAAa,sCAAsC;AAAA,EAC5E,MAAM;AAAA,IACJ,OAAO,EAAE,MAAM,WAAW,aAAa,kBAAkB;AAAA,EAC3D;AAAA,EACA,MAAM,IAAI,EAAE,KAAK,GAAG;AAClB,UAAM,SAAS,aAAa,EAAE,OAAO,KAAK,MAAM,CAAC;AACjD,UAAM,YAAY,QAAQ,IAAI;AAE9B,QAAI;AACF,YAAM,SAAS,MAAM,WAAW,QAAW,SAAS;AACpD,aAAO,KAAK;AAAA,oBAAuB,OAAO,OAAO,EAAE;AACnD,aAAO,KAAK,2BAA2B,WAAW,KAAK,IAAI,CAAC,EAAE;AAK9D,YAAM,kBAAkB,OAAO,YAAY;AAE3C,YAAM,eAAyB,CAAC;AAChC,iBAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,OAAO,KAAK,GAAG;AACvD,YAAI,CAAC,WAAW,SAAS,MAAM,IAAmC,GAAG;AACnE,uBAAa,KAAK,GAAG,GAAG,KAAK,MAAM,IAAI,EAAE;AAAA,QAC3C;AAAA,MACF;AAEA,UAAI,aAAa,SAAS,GAAG;AAC3B,eAAO,KAAK;AAAA,4BAA+B;AAC3C,mBAAW,MAAM,cAAc;AAC7B,iBAAO,KAAK,SAAS,EAAE,EAAE;AAAA,QAC3B;AACA,eAAO,KAAK;AAAA;AAAA,CAAiC;AAC7C,gBAAQ,KAAK,CAAC;AAAA,MAChB;AAEA,UAAI,iBAAiB;AACnB,eAAO;AAAA,UACL;AAAA,oCAAkC,OAAO,OAAO,gCAAgC,wBAAwB;AAAA;AAAA,oBAE/E,wBAAwB;AAAA;AAAA,QACnD;AACA;AAAA,MACF;AAEA,aAAO,KAAK;AAAA;AAAA,CAA6D;AAAA,IAC3E,SAAS,KAAK;AACZ,cAAQ,MAAM;AAAA,WAAU,IAAc,OAAO;AAAA,CAAI;AACjD,cAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF;AACF,CAAC;","names":[]}
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
2
|
pack
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-YRQPY5NF.js";
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
quietArg,
|
|
6
|
+
verboseArg
|
|
7
|
+
} from "./chunk-DMGABJ6T.js";
|
|
7
8
|
import {
|
|
8
9
|
buildGraph,
|
|
9
10
|
createLogger,
|
|
10
11
|
loadConfig,
|
|
11
12
|
parseSpec,
|
|
12
13
|
resolveGlob
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import "./chunk-
|
|
14
|
+
} from "./chunk-SNQNQ2MP.js";
|
|
15
|
+
import "./chunk-HCJDCS26.js";
|
|
16
|
+
import "./chunk-5WRI5ZAA.js";
|
|
15
17
|
|
|
16
|
-
// src/commands/pack.ts
|
|
18
|
+
// src/commands/core/pack.ts
|
|
17
19
|
import { defineCommand } from "citty";
|
|
18
20
|
import { writeFile } from "fs/promises";
|
|
19
21
|
import { execSync } from "child_process";
|
|
@@ -31,7 +33,20 @@ function copyToClipboard(text) {
|
|
|
31
33
|
}
|
|
32
34
|
execSync(cmd, { input: text, stdio: ["pipe", "ignore", "ignore"] });
|
|
33
35
|
}
|
|
36
|
+
function emptyPackReason(stats, specsResolved) {
|
|
37
|
+
if (stats.specsIncluded > 0) return void 0;
|
|
38
|
+
if (specsResolved === 0) {
|
|
39
|
+
return "no specs resolved from spec.config.yaml \u2014 check the paths in your config";
|
|
40
|
+
}
|
|
41
|
+
if (stats.specsExcluded === 0) {
|
|
42
|
+
return `none of the ${specsResolved} resolved spec(s) scored above the relevance threshold for this task \u2014 try different --task wording, name specs with --specs, or use --full`;
|
|
43
|
+
}
|
|
44
|
+
return `all ${stats.specsExcluded} candidate spec(s) were excluded \u2014 widen --specs or raise --budget`;
|
|
45
|
+
}
|
|
34
46
|
async function runPack(options) {
|
|
47
|
+
if (!options.configDir) {
|
|
48
|
+
throw new TypeError("runPack requires `configDir` \u2014 the directory holding spec.config.yaml.");
|
|
49
|
+
}
|
|
35
50
|
const config = await loadConfig(void 0, options.configDir);
|
|
36
51
|
const allSpecs = [];
|
|
37
52
|
for (const [, entry] of Object.entries(config.specs)) {
|
|
@@ -58,13 +73,13 @@ async function runPack(options) {
|
|
|
58
73
|
config.pack,
|
|
59
74
|
graph
|
|
60
75
|
);
|
|
61
|
-
return result;
|
|
76
|
+
return { ...result, specsResolved: allSpecs.length };
|
|
62
77
|
}
|
|
63
78
|
var pack_default = defineCommand({
|
|
64
79
|
meta: { name: "pack", description: "Pack specs into AI-ready context" },
|
|
65
80
|
args: {
|
|
66
|
-
quiet:
|
|
67
|
-
verbose:
|
|
81
|
+
quiet: quietArg,
|
|
82
|
+
verbose: verboseArg,
|
|
68
83
|
task: { type: "string", description: "Task or context to optimise relevance for" },
|
|
69
84
|
specs: { type: "string", description: "Comma-separated spec IDs or glob patterns to include" },
|
|
70
85
|
budget: { type: "string", description: "Maximum token budget for the output" },
|
|
@@ -129,12 +144,16 @@ var pack_default = defineCommand({
|
|
|
129
144
|
}
|
|
130
145
|
console.log(`
|
|
131
146
|
Budget: ${stats.used} / ${stats.budget} tokens`);
|
|
132
|
-
console.log(
|
|
133
|
-
` Included: ${stats.specsIncluded} / ${stats.specsIncluded + stats.specsExcluded} specs`
|
|
134
|
-
);
|
|
147
|
+
console.log(` Included: ${stats.specsIncluded} / ${result.specsResolved} specs`);
|
|
135
148
|
console.log(` Sections compressed: ${stats.sectionsCompressed}`);
|
|
136
149
|
console.log(` Sections omitted: ${stats.sectionsOmitted}
|
|
137
150
|
`);
|
|
151
|
+
const dryReason = emptyPackReason(stats, result.specsResolved);
|
|
152
|
+
if (dryReason) {
|
|
153
|
+
console.log(` \u26A0 Nothing would be packed: ${dryReason}
|
|
154
|
+
`);
|
|
155
|
+
process.exit(3);
|
|
156
|
+
}
|
|
138
157
|
return;
|
|
139
158
|
}
|
|
140
159
|
if (args.out) {
|
|
@@ -153,6 +172,14 @@ var pack_default = defineCommand({
|
|
|
153
172
|
`Packed ${stats.specsIncluded}/${total} specs \u2022 ${stats.used} / ${stats.budget} tokens \u2022 ${stats.sectionsCompressed} sections compressed \u2022 ${stats.sectionsOmitted} sections omitted
|
|
154
173
|
`
|
|
155
174
|
);
|
|
175
|
+
const emptyReason = emptyPackReason(stats, result.specsResolved);
|
|
176
|
+
if (emptyReason) {
|
|
177
|
+
process.stderr.write(`
|
|
178
|
+
\u26A0 No context packed: ${emptyReason}
|
|
179
|
+
|
|
180
|
+
`);
|
|
181
|
+
process.exit(3);
|
|
182
|
+
}
|
|
156
183
|
} catch (err) {
|
|
157
184
|
console.error(`
|
|
158
185
|
\u2717 ${err.message}
|
|
@@ -163,6 +190,7 @@ var pack_default = defineCommand({
|
|
|
163
190
|
});
|
|
164
191
|
export {
|
|
165
192
|
pack_default as default,
|
|
193
|
+
emptyPackReason,
|
|
166
194
|
runPack
|
|
167
195
|
};
|
|
168
|
-
//# sourceMappingURL=pack-
|
|
196
|
+
//# sourceMappingURL=pack-DE4UBTCC.js.map
|