specdx 0.4.0-alpha.21 → 0.4.0-alpha.23
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/README.md +24 -6
- package/dist/{check-GGGHTDTH.js → check-PHXXA7VY.js} +58 -21
- package/dist/check-PHXXA7VY.js.map +1 -0
- package/dist/{chunk-IEW62WR2.js → chunk-CPOXPRS7.js} +12 -12
- package/dist/chunk-CPOXPRS7.js.map +1 -0
- package/dist/chunk-DMGABJ6T.js +41 -0
- package/dist/chunk-DMGABJ6T.js.map +1 -0
- package/dist/{chunk-6IVWJKMQ.js → chunk-ESXULBLW.js} +2 -2
- package/dist/{chunk-6IVWJKMQ.js.map → chunk-ESXULBLW.js.map} +1 -1
- package/dist/{chunk-PXQML7NE.js → chunk-NAWYG4VV.js} +1 -1
- 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-QOP2KHW3.js → chunk-UFTEMDPU.js} +27 -5
- package/dist/chunk-UFTEMDPU.js.map +1 -0
- package/dist/{diff-VHVSXLKU.js → diff-6C5LJ7SH.js} +23 -11
- package/dist/diff-6C5LJ7SH.js.map +1 -0
- package/dist/{dist-QRCEQ5WI.js → dist-SOZ3I4RP.js} +3 -3
- package/dist/{generate-WMJ37LCN.js → generate-IXDZTWWA.js} +3 -3
- package/dist/{generate-story-ORJX24P7.js → generate-story-3O4T4CEV.js} +2 -2
- package/dist/{graph-TG2CONHV.js → graph-4RNURBNP.js} +45 -8
- package/dist/graph-4RNURBNP.js.map +1 -0
- package/dist/index.d.ts +111 -7
- package/dist/index.js +235 -51
- package/dist/index.js.map +1 -1
- package/dist/{lint-ZFG6ALIT.js → lint-PKWAK4CO.js} +28 -10
- package/dist/lint-PKWAK4CO.js.map +1 -0
- package/dist/main.js +2 -2
- package/dist/{mcp-WBHZANS5.js → mcp-ZOLM2ATO.js} +3 -3
- package/dist/{pack-VDEO7GRF.js → pack-DE4UBTCC.js} +6 -5
- package/dist/pack-DE4UBTCC.js.map +1 -0
- package/dist/{ready-VDOH3XCV.js → ready-IKVESKEB.js} +17 -8
- package/dist/ready-IKVESKEB.js.map +1 -0
- package/dist/skills/core/specdx-sprint-review/SKILL.md +1 -1
- package/dist/{status-JIQUF6MX.js → status-W557JGZB.js} +52 -26
- package/dist/status-W557JGZB.js.map +1 -0
- package/dist/{update-DNXF5Q64.js → update-UFOHZEAK.js} +13 -4
- package/dist/update-UFOHZEAK.js.map +1 -0
- package/dist/{validate-TSAMI65E.js → validate-EZHUB5TW.js} +32 -14
- package/dist/validate-EZHUB5TW.js.map +1 -0
- package/package.json +2 -2
- package/dist/check-GGGHTDTH.js.map +0 -1
- package/dist/chunk-GAM4MXPC.js +0 -15
- package/dist/chunk-GAM4MXPC.js.map +0 -1
- package/dist/chunk-IEW62WR2.js.map +0 -1
- package/dist/chunk-PXQML7NE.js.map +0 -1
- package/dist/chunk-QOP2KHW3.js.map +0 -1
- package/dist/diff-VHVSXLKU.js.map +0 -1
- package/dist/graph-TG2CONHV.js.map +0 -1
- package/dist/lint-ZFG6ALIT.js.map +0 -1
- package/dist/pack-VDEO7GRF.js.map +0 -1
- package/dist/ready-VDOH3XCV.js.map +0 -1
- package/dist/status-JIQUF6MX.js.map +0 -1
- package/dist/update-DNXF5Q64.js.map +0 -1
- package/dist/validate-TSAMI65E.js.map +0 -1
- /package/dist/{dist-QRCEQ5WI.js.map → dist-SOZ3I4RP.js.map} +0 -0
- /package/dist/{generate-WMJ37LCN.js.map → generate-IXDZTWWA.js.map} +0 -0
- /package/dist/{generate-story-ORJX24P7.js.map → generate-story-3O4T4CEV.js.map} +0 -0
- /package/dist/{mcp-WBHZANS5.js.map → mcp-ZOLM2ATO.js.map} +0 -0
package/README.md
CHANGED
|
@@ -146,13 +146,21 @@ Add spec health checks to your CI pipeline with the GitHub Action:
|
|
|
146
146
|
|
|
147
147
|
```yaml
|
|
148
148
|
# .github/workflows/specs.yml
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
149
|
+
permissions:
|
|
150
|
+
pull-requests: write
|
|
151
|
+
steps:
|
|
152
|
+
- uses: umxr/specdx/packages/github-action@v0.4.0
|
|
153
|
+
with:
|
|
154
|
+
working-directory: .
|
|
155
|
+
preset: recommended
|
|
156
|
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
153
157
|
```
|
|
154
158
|
|
|
155
|
-
The action runs lint + diff on every PR
|
|
159
|
+
The action runs lint + diff on every PR and can block merges on spec health failures. It fails the job when the spec paths resolve to no files — zero specs checked is not a pass.
|
|
160
|
+
|
|
161
|
+
Pass `github-token` and grant the workflow `permissions: pull-requests: write` to have it post a spec health comment, which it updates in place on each push rather than stacking a new one. Without the token it skips commenting and logs why; a missing permission is a warning, never a failed job. Set `badge-path` to write an SVG health badge.
|
|
162
|
+
|
|
163
|
+
Configure severity thresholds in `spec.config.yaml`:
|
|
156
164
|
|
|
157
165
|
```yaml
|
|
158
166
|
ci:
|
|
@@ -450,7 +458,17 @@ ci:
|
|
|
450
458
|
| `specdx skills install` | Install Claude Code skills (`--experimental` also installs the unpromoted ones) |
|
|
451
459
|
| `specdx mcp` | Start the MCP server |
|
|
452
460
|
|
|
453
|
-
Global flags: `--
|
|
461
|
+
Global flags: `--quiet` (suppress success and summary output; problems still print) and `--verbose`.
|
|
462
|
+
|
|
463
|
+
`--format` is per command, because not every command renders every format. Run `specdx <command> --help` for the list it supports — asking for one it does not render is an error, not a silent fallback to pretty output.
|
|
464
|
+
|
|
465
|
+
| Formats | Commands |
|
|
466
|
+
|---|---|
|
|
467
|
+
| `pretty`, `json`, `github` | `lint`, `status`, `check` |
|
|
468
|
+
| `pretty`, `json` | `validate`, `ready`, `update` |
|
|
469
|
+
| `pretty`, `json`, `dot` | `graph` |
|
|
470
|
+
| `pretty`, `json`, `changelog` | `diff` |
|
|
471
|
+
| `xml`, `markdown`, `json` | `pack` |
|
|
454
472
|
|
|
455
473
|
---
|
|
456
474
|
|
|
@@ -2,8 +2,12 @@ import {
|
|
|
2
2
|
runCheck
|
|
3
3
|
} from "./chunk-3YXRWQGX.js";
|
|
4
4
|
import {
|
|
5
|
+
createOutput
|
|
6
|
+
} from "./chunk-NHD44ZYN.js";
|
|
7
|
+
import {
|
|
8
|
+
resolveFormat,
|
|
5
9
|
sharedArgs
|
|
6
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-DMGABJ6T.js";
|
|
7
11
|
import {
|
|
8
12
|
createLogger,
|
|
9
13
|
loadConfig,
|
|
@@ -15,13 +19,14 @@ import "./chunk-5WRI5ZAA.js";
|
|
|
15
19
|
|
|
16
20
|
// src/commands/experimental/check.ts
|
|
17
21
|
import { defineCommand } from "citty";
|
|
22
|
+
var FORMATS = ["pretty", "json", "github"];
|
|
18
23
|
var check_default = defineCommand({
|
|
19
24
|
meta: {
|
|
20
25
|
name: "check",
|
|
21
26
|
description: "Check spec-to-implementation drift. Exit codes: 0 ok, 1 errors found, 3 nothing checkable (coverage not assessed)"
|
|
22
27
|
},
|
|
23
28
|
args: {
|
|
24
|
-
...sharedArgs,
|
|
29
|
+
...sharedArgs(FORMATS),
|
|
25
30
|
spec: { type: "string", description: "Check a specific spec by ID" },
|
|
26
31
|
framework: { type: "string", description: "Framework override: express, hono, nextjs" },
|
|
27
32
|
ai: {
|
|
@@ -30,7 +35,15 @@ var check_default = defineCommand({
|
|
|
30
35
|
}
|
|
31
36
|
},
|
|
32
37
|
async run({ args }) {
|
|
38
|
+
const format = resolveFormat(args.format, FORMATS);
|
|
39
|
+
if (!format.ok) {
|
|
40
|
+
console.error(`
|
|
41
|
+
\u2717 ${format.message}
|
|
42
|
+
`);
|
|
43
|
+
process.exit(1);
|
|
44
|
+
}
|
|
33
45
|
const logger = createLogger({ quiet: args.quiet, verbose: args.verbose });
|
|
46
|
+
const output = createOutput({ quiet: args.quiet });
|
|
34
47
|
const configDir = process.cwd();
|
|
35
48
|
const config = await loadConfig(void 0, configDir);
|
|
36
49
|
logger.debug("Loading specs...");
|
|
@@ -51,8 +64,16 @@ var check_default = defineCommand({
|
|
|
51
64
|
const result = await runCheck(specs, configDir, checkConfig);
|
|
52
65
|
if (args.ai) {
|
|
53
66
|
const { analyzeWithAi } = await import("./dist-ROHCFKYT.js");
|
|
54
|
-
|
|
55
|
-
|
|
67
|
+
let aiResult;
|
|
68
|
+
try {
|
|
69
|
+
aiResult = await analyzeWithAi(result.findings, args.spec ?? "full suite check");
|
|
70
|
+
} catch (err) {
|
|
71
|
+
console.error(`
|
|
72
|
+
\u2717 ${err.message}
|
|
73
|
+
`);
|
|
74
|
+
process.exit(1);
|
|
75
|
+
}
|
|
76
|
+
if (format.format === "json") {
|
|
56
77
|
console.log(JSON.stringify({ ...result, ai: aiResult }, null, 2));
|
|
57
78
|
} else {
|
|
58
79
|
console.log(`
|
|
@@ -78,48 +99,64 @@ var check_default = defineCommand({
|
|
|
78
99
|
}
|
|
79
100
|
return;
|
|
80
101
|
}
|
|
81
|
-
if (
|
|
102
|
+
if (format.format === "json") {
|
|
82
103
|
console.log(JSON.stringify(result, null, 2));
|
|
104
|
+
} else if (format.format === "github") {
|
|
105
|
+
console.log(
|
|
106
|
+
`::notice::specdx check \u2014 ${result.score.assessed ? `${result.score.overall}% implementation coverage` : "coverage not assessed \u2014 no checkable surfaces found"}`
|
|
107
|
+
);
|
|
108
|
+
for (const note of result.notes) {
|
|
109
|
+
console.log(`::notice::${note}`);
|
|
110
|
+
}
|
|
111
|
+
for (const f of result.findings) {
|
|
112
|
+
const level = f.severity === "error" ? "error" : f.severity === "warn" ? "warning" : "notice";
|
|
113
|
+
const location = f.codeLocation ? ` file=${f.codeLocation.file},line=${f.codeLocation.line}` : "";
|
|
114
|
+
const detail = f.actual ? ` \u2014 ${f.actual}` : "";
|
|
115
|
+
console.log(`::${level}${location}::[${f.specId}] ${f.expected}${detail}`);
|
|
116
|
+
}
|
|
83
117
|
} else {
|
|
84
118
|
const headline = result.score.assessed ? `${result.score.overall}% implementation coverage` : "coverage not assessed \u2014 no checkable surfaces found";
|
|
85
|
-
|
|
119
|
+
output.info(`
|
|
86
120
|
specdx check \u2014 ${headline}
|
|
87
121
|
`);
|
|
88
122
|
for (const note of result.notes) {
|
|
89
|
-
|
|
123
|
+
output.out(` \u26A0 ${note}`);
|
|
90
124
|
}
|
|
91
|
-
if (result.notes.length > 0)
|
|
125
|
+
if (result.notes.length > 0) output.out();
|
|
92
126
|
if (args.verbose) {
|
|
93
127
|
const fmt = (n) => n === null ? "not scanned" : `${n} found`;
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
const artifacts = result.scanned.artifacts === null ? "none declared" : `${result.scanned.artifacts}
|
|
128
|
+
output.out(` Scanned: framework=${result.scanned.framework ?? "none detected"}`);
|
|
129
|
+
output.out(` routes: ${fmt(result.scanned.codeRoutes)}`);
|
|
130
|
+
output.out(` types: ${fmt(result.scanned.codeTypes)}`);
|
|
131
|
+
output.out(` tests: ${fmt(result.scanned.codeTests)}`);
|
|
132
|
+
const artifacts = result.scanned.artifacts === null ? "none declared" : `${result.scanned.artifacts} assessed`;
|
|
99
133
|
const pending = result.scanned.artifactsPending > 0 ? `, ${result.scanned.artifactsPending} pending` : "";
|
|
100
|
-
|
|
134
|
+
output.out(` artifacts: ${artifacts}${pending}
|
|
101
135
|
`);
|
|
102
136
|
}
|
|
103
137
|
for (const [category, stats] of Object.entries(result.score.byCategory)) {
|
|
104
138
|
if (stats.total === 0) continue;
|
|
105
|
-
console.log(` ${category} (${stats.matched}/${stats.total}):`);
|
|
106
139
|
const categoryFindings = result.findings.filter(
|
|
107
140
|
(f) => f.category === category.replace(/s$/, "")
|
|
108
141
|
);
|
|
142
|
+
const header = ` ${category} (${stats.matched}/${stats.total}):`;
|
|
143
|
+
if (categoryFindings.length === 0) {
|
|
144
|
+
output.info(header);
|
|
145
|
+
output.info(" \u2713 all matched");
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
148
|
+
output.out(header);
|
|
109
149
|
for (const f of categoryFindings) {
|
|
110
150
|
const icon = f.severity === "error" ? "\u2717" : f.severity === "warn" ? "\u26A0" : "\u2139";
|
|
111
151
|
const detail = f.actual ? ` \u2014 ${f.actual}` : "";
|
|
112
152
|
const suggestion = f.suggestion ? ` (${f.suggestion})` : "";
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
if (categoryFindings.length === 0) {
|
|
116
|
-
console.log(" \u2713 all matched");
|
|
153
|
+
output.out(` ${icon} ${f.expected}${detail}${suggestion}`);
|
|
117
154
|
}
|
|
118
155
|
}
|
|
119
156
|
const errors = result.findings.filter((f) => f.severity === "error").length;
|
|
120
157
|
const warnings = result.findings.filter((f) => f.severity === "warn").length;
|
|
121
158
|
const info = result.findings.filter((f) => f.severity === "info").length;
|
|
122
|
-
|
|
159
|
+
output.info(`
|
|
123
160
|
${errors} errors, ${warnings} warnings, ${info} info
|
|
124
161
|
`);
|
|
125
162
|
}
|
|
@@ -134,4 +171,4 @@ var check_default = defineCommand({
|
|
|
134
171
|
export {
|
|
135
172
|
check_default as default
|
|
136
173
|
};
|
|
137
|
-
//# sourceMappingURL=check-
|
|
174
|
+
//# sourceMappingURL=check-PHXXA7VY.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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, resolveFormat } from \"../../shared-args.js\";\nimport { createOutput } from \"../../output.js\";\n\nconst FORMATS = [\"pretty\", \"json\", \"github\"] as const;\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(FORMATS),\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 format = resolveFormat(args.format, FORMATS);\n if (!format.ok) {\n console.error(`\\n ✗ ${format.message}\\n`);\n process.exit(1);\n }\n\n const logger = createLogger({ quiet: args.quiet, verbose: args.verbose });\n const output = createOutput({ quiet: args.quiet });\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 // A missing key is a user error, not a crash. It used to surface as an\n // uncaught Error with the full Node trace through citty, where every\n // other user-error path in the CLI prints \"✗ …\" (audit run 5, F7).\n let aiResult;\n try {\n aiResult = await analyzeWithAi(result.findings, args.spec ?? \"full suite check\");\n } catch (err) {\n console.error(`\\n ✗ ${(err as Error).message}\\n`);\n process.exit(1);\n }\n\n if (format.format === \"json\") {\n console.log(JSON.stringify({ ...result, ai: aiResult }, null, 2));\n } else {\n console.log(`\\n specdx 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 (format.format === \"json\") {\n console.log(JSON.stringify(result, null, 2));\n } else if (format.format === \"github\") {\n // Annotations for CI. A finding about missing code has no file to point\n // at, so the spec ID carries the location instead. The headline always\n // prints: a clean or unassessable run must still say something, or the\n // format is silent for exactly the projects that most need telling.\n console.log(\n `::notice::specdx check — ${\n result.score.assessed\n ? `${result.score.overall}% implementation coverage`\n : \"coverage not assessed — no checkable surfaces found\"\n }`,\n );\n for (const note of result.notes) {\n console.log(`::notice::${note}`);\n }\n for (const f of result.findings) {\n const level =\n f.severity === \"error\" ? \"error\" : f.severity === \"warn\" ? \"warning\" : \"notice\";\n const location = f.codeLocation\n ? ` file=${f.codeLocation.file},line=${f.codeLocation.line}`\n : \"\";\n const detail = f.actual ? ` — ${f.actual}` : \"\";\n console.log(`::${level}${location}::[${f.specId}] ${f.expected}${detail}`);\n }\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 output.info(`\\n specdx check — ${headline}\\n`);\n\n for (const note of result.notes) {\n output.out(` ⚠ ${note}`);\n }\n if (result.notes.length > 0) output.out();\n\n if (args.verbose) {\n const fmt = (n: number | null) => (n === null ? \"not scanned\" : `${n} found`);\n output.out(` Scanned: framework=${result.scanned.framework ?? \"none detected\"}`);\n output.out(` routes: ${fmt(result.scanned.codeRoutes)}`);\n output.out(` types: ${fmt(result.scanned.codeTypes)}`);\n output.out(` tests: ${fmt(result.scanned.codeTests)}`);\n // \"assessed\", not \"verified\": this counts the assertions considered,\n // and a failed one is reported below. Calling six verified while the\n // next line says 5/6 made the output contradict itself (F6).\n const artifacts =\n result.scanned.artifacts === null\n ? \"none declared\"\n : `${result.scanned.artifacts} assessed`;\n const pending =\n result.scanned.artifactsPending > 0 ? `, ${result.scanned.artifactsPending} pending` : \"\";\n output.out(` artifacts: ${artifacts}${pending}\\n`);\n }\n\n for (const [category, stats] of Object.entries(result.score.byCategory)) {\n if (stats.total === 0) continue;\n const categoryFindings = result.findings.filter(\n (f) => f.category === category.replace(/s$/, \"\"),\n );\n const header = ` ${category} (${stats.matched}/${stats.total}):`;\n if (categoryFindings.length === 0) {\n output.info(header);\n output.info(\" ✓ all matched\");\n continue;\n }\n output.out(header);\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 output.out(` ${icon} ${f.expected}${detail}${suggestion}`);\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 output.info(`\\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;AAQ9B,IAAM,UAAU,CAAC,UAAU,QAAQ,QAAQ;AAE3C,IAAO,gBAAQ,cAAc;AAAA,EAC3B,MAAM;AAAA,IACJ,MAAM;AAAA,IACN,aACE;AAAA,EACJ;AAAA,EACA,MAAM;AAAA,IACJ,GAAG,WAAW,OAAO;AAAA,IACrB,MAAM,EAAE,MAAM,UAAU,aAAa,8BAA8B;AAAA,IACnE,WAAW,EAAE,MAAM,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lint: bucketed("lint", () => import("./lint-
|
|
167
|
-
validate: bucketed("validate", () => import("./validate-
|
|
168
|
-
graph: bucketed("graph", () => import("./graph-
|
|
166
|
+
lint: bucketed("lint", () => import("./lint-PKWAK4CO.js").then((m) => m.default)),
|
|
167
|
+
validate: bucketed("validate", () => import("./validate-EZHUB5TW.js").then((m) => m.default)),
|
|
168
|
+
graph: bucketed("graph", () => import("./graph-4RNURBNP.js").then((m) => m.default)),
|
|
169
169
|
skills: bucketed("skills", () => import("./skills-36SRUEMR.js").then((m) => m.default)),
|
|
170
|
-
pack: bucketed("pack", () => import("./pack-
|
|
171
|
-
diff: bucketed("diff", () => import("./diff-
|
|
172
|
-
status: bucketed("status", () => import("./status-
|
|
173
|
-
check: bucketed("check", () => import("./check-
|
|
174
|
-
ready: bucketed("ready", () => import("./ready-
|
|
175
|
-
update: bucketed("update", () => import("./update-
|
|
176
|
-
generate: bucketed("generate", () => import("./generate-
|
|
170
|
+
pack: bucketed("pack", () => import("./pack-DE4UBTCC.js").then((m) => m.default)),
|
|
171
|
+
diff: bucketed("diff", () => import("./diff-6C5LJ7SH.js").then((m) => m.default)),
|
|
172
|
+
status: bucketed("status", () => import("./status-W557JGZB.js").then((m) => m.default)),
|
|
173
|
+
check: bucketed("check", () => import("./check-PHXXA7VY.js").then((m) => m.default)),
|
|
174
|
+
ready: bucketed("ready", () => import("./ready-IKVESKEB.js").then((m) => m.default)),
|
|
175
|
+
update: bucketed("update", () => import("./update-UFOHZEAK.js").then((m) => m.default)),
|
|
176
|
+
generate: bucketed("generate", () => import("./generate-IXDZTWWA.js").then((m) => m.default)),
|
|
177
177
|
migrate: bucketed("migrate", () => import("./migrate-FKFC7UAO.js").then((m) => m.default)),
|
|
178
|
-
mcp: bucketed("mcp", () => import("./mcp-
|
|
178
|
+
mcp: bucketed("mcp", () => import("./mcp-ZOLM2ATO.js").then((m) => m.default))
|
|
179
179
|
};
|
|
180
180
|
|
|
181
181
|
export {
|
|
182
182
|
labelled,
|
|
183
183
|
subCommands
|
|
184
184
|
};
|
|
185
|
-
//# sourceMappingURL=chunk-
|
|
185
|
+
//# sourceMappingURL=chunk-CPOXPRS7.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"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\nexport interface 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 if (!targetDir) {\n throw new TypeError(\"scaffoldProject requires `targetDir` — where to create the project.\");\n }\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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;AAAA,EACxF,OAAO,SAAS,SAAS,MAAM,OAAO,qBAAiB,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC;AAAA,EAC/E,QAAQ,SAAS,UAAU,MAAM,OAAO,sBAAkB,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC;AAAA,EAClF,MAAM,SAAS,QAAQ,MAAM,OAAO,oBAAgB,EAAE,KAAK,CAAC,MAAM,EAAE,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":[]}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// src/shared-args.ts
|
|
2
|
+
var quietArg = {
|
|
3
|
+
type: "boolean",
|
|
4
|
+
description: "Suppress success and summary output; problems still print",
|
|
5
|
+
alias: ["q"]
|
|
6
|
+
};
|
|
7
|
+
var verboseArg = {
|
|
8
|
+
type: "boolean",
|
|
9
|
+
description: "Enable debug output",
|
|
10
|
+
alias: ["V"]
|
|
11
|
+
};
|
|
12
|
+
function formatArg(formats) {
|
|
13
|
+
const [fallback] = formats;
|
|
14
|
+
if (!fallback) throw new Error("formatArg requires at least one format");
|
|
15
|
+
return {
|
|
16
|
+
type: "string",
|
|
17
|
+
description: `Output format (${formats.join(", ")})`,
|
|
18
|
+
default: fallback
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
function sharedArgs(formats) {
|
|
22
|
+
return { quiet: quietArg, verbose: verboseArg, format: formatArg(formats) };
|
|
23
|
+
}
|
|
24
|
+
function resolveFormat(value, formats) {
|
|
25
|
+
const [fallback] = formats;
|
|
26
|
+
if (!fallback) throw new Error("resolveFormat requires at least one format");
|
|
27
|
+
if (value === void 0) return { ok: true, format: fallback };
|
|
28
|
+
if (formats.includes(value)) return { ok: true, format: value };
|
|
29
|
+
return {
|
|
30
|
+
ok: false,
|
|
31
|
+
message: `unknown --format "${value}". This command renders: ${formats.join(", ")}.`
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export {
|
|
36
|
+
quietArg,
|
|
37
|
+
verboseArg,
|
|
38
|
+
sharedArgs,
|
|
39
|
+
resolveFormat
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=chunk-DMGABJ6T.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/shared-args.ts"],"sourcesContent":["/**\n * Args every reporting command shares.\n *\n * `--format` is declared per command, not globally. Spreading one blanket\n * `format` arg put the value `github` in every `--help` while only two\n * commands implemented it, and an unknown value fell through to pretty output\n * with exit 0 — a CI step could ask for annotations, get none, and still go\n * green (audit run 5, F2). A command now names the formats it renders, the\n * help text is generated from that list, and anything else is an error.\n */\n\n/** The single source of truth for a command's `--format` values. */\nexport type FormatArg = {\n type: \"string\";\n description: string;\n default: string;\n};\n\nexport const quietArg = {\n type: \"boolean\" as const,\n description: \"Suppress success and summary output; problems still print\",\n alias: [\"q\"],\n};\n\nexport const verboseArg = {\n type: \"boolean\" as const,\n description: \"Enable debug output\",\n alias: [\"V\"],\n};\n\n/**\n * Build the `--format` arg from the formats a command actually implements.\n * The first entry is the default.\n */\nexport function formatArg(formats: readonly string[]): FormatArg {\n const [fallback] = formats;\n if (!fallback) throw new Error(\"formatArg requires at least one format\");\n return {\n type: \"string\",\n description: `Output format (${formats.join(\", \")})`,\n default: fallback,\n };\n}\n\n/** `--quiet`, `--verbose`, and a `--format` limited to what the command renders. */\nexport function sharedArgs(formats: readonly string[]): {\n quiet: typeof quietArg;\n verbose: typeof verboseArg;\n format: FormatArg;\n} {\n return { quiet: quietArg, verbose: verboseArg, format: formatArg(formats) };\n}\n\n/**\n * Narrow a user-supplied `--format` to one the command renders.\n *\n * Returns null when the value is unsupported, so the caller can print and pick\n * its own exit code. Silently falling back to pretty is the defect this\n * replaces: the user asked for a machine-readable payload and got prose.\n */\nexport function resolveFormat<T extends string>(\n value: string | undefined,\n formats: readonly T[],\n): { ok: true; format: T } | { ok: false; message: string } {\n const [fallback] = formats;\n if (!fallback) throw new Error(\"resolveFormat requires at least one format\");\n if (value === undefined) return { ok: true, format: fallback };\n if ((formats as readonly string[]).includes(value)) return { ok: true, format: value as T };\n return {\n ok: false,\n message: `unknown --format \"${value}\". This command renders: ${formats.join(\", \")}.`,\n };\n}\n"],"mappings":";AAkBO,IAAM,WAAW;AAAA,EACtB,MAAM;AAAA,EACN,aAAa;AAAA,EACb,OAAO,CAAC,GAAG;AACb;AAEO,IAAM,aAAa;AAAA,EACxB,MAAM;AAAA,EACN,aAAa;AAAA,EACb,OAAO,CAAC,GAAG;AACb;AAMO,SAAS,UAAU,SAAuC;AAC/D,QAAM,CAAC,QAAQ,IAAI;AACnB,MAAI,CAAC,SAAU,OAAM,IAAI,MAAM,wCAAwC;AACvE,SAAO;AAAA,IACL,MAAM;AAAA,IACN,aAAa,kBAAkB,QAAQ,KAAK,IAAI,CAAC;AAAA,IACjD,SAAS;AAAA,EACX;AACF;AAGO,SAAS,WAAW,SAIzB;AACA,SAAO,EAAE,OAAO,UAAU,SAAS,YAAY,QAAQ,UAAU,OAAO,EAAE;AAC5E;AASO,SAAS,cACd,OACA,SAC0D;AAC1D,QAAM,CAAC,QAAQ,IAAI;AACnB,MAAI,CAAC,SAAU,OAAM,IAAI,MAAM,4CAA4C;AAC3E,MAAI,UAAU,OAAW,QAAO,EAAE,IAAI,MAAM,QAAQ,SAAS;AAC7D,MAAK,QAA8B,SAAS,KAAK,EAAG,QAAO,EAAE,IAAI,MAAM,QAAQ,MAAW;AAC1F,SAAO;AAAA,IACL,IAAI;AAAA,IACJ,SAAS,qBAAqB,KAAK,4BAA4B,QAAQ,KAAK,IAAI,CAAC;AAAA,EACnF;AACF;","names":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// package.json
|
|
2
2
|
var package_default = {
|
|
3
3
|
name: "specdx",
|
|
4
|
-
version: "0.4.0-alpha.
|
|
4
|
+
version: "0.4.0-alpha.23",
|
|
5
5
|
description: "Spec-driven development toolchain. Validate, lint, pack, and ship specs for LLM-assisted workflows.",
|
|
6
6
|
type: "module",
|
|
7
7
|
license: "MIT",
|
|
@@ -100,4 +100,4 @@ var package_default = {
|
|
|
100
100
|
export {
|
|
101
101
|
package_default
|
|
102
102
|
};
|
|
103
|
-
//# sourceMappingURL=chunk-
|
|
103
|
+
//# sourceMappingURL=chunk-ESXULBLW.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../package.json"],"sourcesContent":["{\n \"name\": \"specdx\",\n \"version\": \"0.4.0-alpha.
|
|
1
|
+
{"version":3,"sources":["../package.json"],"sourcesContent":["{\n \"name\": \"specdx\",\n \"version\": \"0.4.0-alpha.23\",\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 \"types\": \"./dist/index.d.ts\",\n \"import\": \"./dist/index.js\"\n }\n },\n \"files\": [\n \"dist\",\n \".claude-plugin\",\n \"hooks\",\n \"README.md\"\n ],\n \"scripts\": {\n \"build\": \"tsup\",\n \"typecheck\": \"tsc --noEmit\",\n \"test\": \"vitest run\",\n \"clean\": \"rm -rf dist *.tsbuildinfo\"\n },\n \"dependencies\": {\n \"@modelcontextprotocol/sdk\": \"^1.27.0\",\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 \"zod\": \"^3.23.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 \"peerDependencies\": {\n \"ts-morph\": \">=20\",\n \"@anthropic-ai/sdk\": \">=0.30\"\n },\n \"peerDependenciesMeta\": {\n \"ts-morph\": {\n \"optional\": true\n },\n \"@anthropic-ai/sdk\": {\n \"optional\": true\n }\n }\n}\n"],"mappings":";AAAA;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,EACT;AAAA,EACA,UAAY;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA,SAAW;AAAA,IACT,MAAQ;AAAA,EACV;AAAA,EACA,KAAO;AAAA,IACL,QAAU;AAAA,EACZ;AAAA,EACA,SAAW;AAAA,IACT,KAAK;AAAA,MACH,OAAS;AAAA,MACT,QAAU;AAAA,IACZ;AAAA,EACF;AAAA,EACA,OAAS;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA,SAAW;AAAA,IACT,OAAS;AAAA,IACT,WAAa;AAAA,IACb,MAAQ;AAAA,IACR,OAAS;AAAA,EACX;AAAA,EACA,cAAgB;AAAA,IACd,6BAA6B;AAAA,IAC7B,KAAO;AAAA,IACP,eAAe;AAAA,IACf,OAAS;AAAA,IACT,SAAW;AAAA,IACX,eAAe;AAAA,IACf,eAAe;AAAA,IACf,gBAAgB;AAAA,IAChB,YAAc;AAAA,IACd,SAAW;AAAA,IACX,oBAAoB;AAAA,IACpB,MAAQ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