specdx 0.5.0 → 0.6.1

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.
Files changed (74) hide show
  1. package/.claude-plugin/plugin.json +2 -2
  2. package/README.md +70 -22
  3. package/dist/{check-RH5SCXWW.js → check-5EA2MTNN.js} +120 -26
  4. package/dist/check-5EA2MTNN.js.map +1 -0
  5. package/dist/{chunk-3YXRWQGX.js → chunk-2UUQJ2ER.js} +242 -53
  6. package/dist/chunk-2UUQJ2ER.js.map +1 -0
  7. package/dist/{chunk-6WFNZH7F.js → chunk-5XOWCPP2.js} +2 -2
  8. package/dist/{chunk-CQETLJTZ.js → chunk-6S2OQMUH.js} +8 -4
  9. package/dist/chunk-6S2OQMUH.js.map +1 -0
  10. package/dist/{chunk-BP3SB35W.js → chunk-JGD3BOPH.js} +15 -5
  11. package/dist/chunk-JGD3BOPH.js.map +1 -0
  12. package/dist/{chunk-BMOOLUPG.js → chunk-MOYYF7Q6.js} +2 -2
  13. package/dist/{chunk-ZIODMXST.js → chunk-VVZUJ6H4.js} +52 -14
  14. package/dist/{chunk-ZIODMXST.js.map → chunk-VVZUJ6H4.js.map} +1 -1
  15. package/dist/{chunk-6EQIDZ4D.js → chunk-WSLIO2ZD.js} +13 -13
  16. package/dist/{diff-QO7HMAK3.js → diff-ZT6HXHK5.js} +3 -3
  17. package/dist/dist-6WDWUOCV.js +26 -0
  18. package/dist/{dist-JPWHWMV2.js → dist-A3CWALDC.js} +30 -9
  19. package/dist/dist-A3CWALDC.js.map +1 -0
  20. package/dist/{generate-MS4BM7RU.js → generate-PTDHGDR2.js} +4 -4
  21. package/dist/{generate-story-OMM322L7.js → generate-story-BXGNKWC6.js} +3 -3
  22. package/dist/{generate-test-plan-75W7SZIO.js → generate-test-plan-PZUNCNN3.js} +2 -2
  23. package/dist/{graph-QOTMXENE.js → graph-GKXD2IGW.js} +2 -2
  24. package/dist/index.d.ts +11 -0
  25. package/dist/index.js +109 -22
  26. package/dist/index.js.map +1 -1
  27. package/dist/{lint-LPFLHVO4.js → lint-GZX5C5EQ.js} +55 -10
  28. package/dist/lint-GZX5C5EQ.js.map +1 -0
  29. package/dist/main.js +2 -2
  30. package/dist/{mcp-OEC43SPF.js → mcp-PIVG3LEF.js} +3 -3
  31. package/dist/{migrate-CBP2AVLH.js → migrate-VASWPA3L.js} +2 -2
  32. package/dist/{pack-X6FSWORJ.js → pack-DFUCNWVR.js} +3 -3
  33. package/dist/{ready-7MJWRGLT.js → ready-5OFSV2OD.js} +4 -4
  34. package/dist/{status-UUPZYX3J.js → status-5MDODW4N.js} +4 -4
  35. package/dist/{update-EI7IJRHG.js → update-NFXC45UT.js} +3 -3
  36. package/dist/{validate-HTTZLQWI.js → validate-LWRLZR3H.js} +2 -2
  37. package/package.json +10 -6
  38. package/skills/core/specdx-author-spec/SKILL.md +33 -0
  39. package/skills/core/specdx-author-spec/references/spec-type-reference.md +57 -0
  40. package/skills/core/specdx-author-spec/references/step-01-frontmatter.md +66 -0
  41. package/skills/core/specdx-author-spec/references/step-02-sections.md +111 -0
  42. package/skills/core/specdx-author-spec/references/step-03-finalize.md +48 -0
  43. package/skills/core/specdx-onboard/SKILL.md +54 -0
  44. package/skills/core/specdx-plan-from-spec/SKILL.md +76 -0
  45. package/skills/core/specdx-pre-commit/SKILL.md +70 -0
  46. package/skills/core/specdx-review-spec/SKILL.md +81 -0
  47. package/skills/core/specdx-router/SKILL.md +67 -0
  48. package/skills/core/specdx-sprint-review/SKILL.md +73 -0
  49. package/skills/core/specdx-start-task/SKILL.md +62 -0
  50. package/skills/experimental/specdx-check-drift/SKILL.md +77 -0
  51. package/skills/experimental/specdx-verify/SKILL.md +85 -0
  52. package/dist/check-RH5SCXWW.js.map +0 -1
  53. package/dist/chunk-3YXRWQGX.js.map +0 -1
  54. package/dist/chunk-BP3SB35W.js.map +0 -1
  55. package/dist/chunk-CQETLJTZ.js.map +0 -1
  56. package/dist/dist-JPWHWMV2.js.map +0 -1
  57. package/dist/dist-ROHCFKYT.js +0 -16
  58. package/dist/lint-LPFLHVO4.js.map +0 -1
  59. /package/dist/{chunk-6WFNZH7F.js.map → chunk-5XOWCPP2.js.map} +0 -0
  60. /package/dist/{chunk-BMOOLUPG.js.map → chunk-MOYYF7Q6.js.map} +0 -0
  61. /package/dist/{chunk-6EQIDZ4D.js.map → chunk-WSLIO2ZD.js.map} +0 -0
  62. /package/dist/{diff-QO7HMAK3.js.map → diff-ZT6HXHK5.js.map} +0 -0
  63. /package/dist/{dist-ROHCFKYT.js.map → dist-6WDWUOCV.js.map} +0 -0
  64. /package/dist/{generate-MS4BM7RU.js.map → generate-PTDHGDR2.js.map} +0 -0
  65. /package/dist/{generate-story-OMM322L7.js.map → generate-story-BXGNKWC6.js.map} +0 -0
  66. /package/dist/{generate-test-plan-75W7SZIO.js.map → generate-test-plan-PZUNCNN3.js.map} +0 -0
  67. /package/dist/{graph-QOTMXENE.js.map → graph-GKXD2IGW.js.map} +0 -0
  68. /package/dist/{mcp-OEC43SPF.js.map → mcp-PIVG3LEF.js.map} +0 -0
  69. /package/dist/{migrate-CBP2AVLH.js.map → migrate-VASWPA3L.js.map} +0 -0
  70. /package/dist/{pack-X6FSWORJ.js.map → pack-DFUCNWVR.js.map} +0 -0
  71. /package/dist/{ready-7MJWRGLT.js.map → ready-5OFSV2OD.js.map} +0 -0
  72. /package/dist/{status-UUPZYX3J.js.map → status-5MDODW4N.js.map} +0 -0
  73. /package/dist/{update-EI7IJRHG.js.map → update-NFXC45UT.js.map} +0 -0
  74. /package/dist/{validate-HTTZLQWI.js.map → validate-LWRLZR3H.js.map} +0 -0
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "specdx",
3
- "version": "0.5.0",
3
+ "version": "0.6.1",
4
4
  "description": "Spec-driven development skills for Claude Code",
5
5
  "author": {
6
6
  "name": "umxr",
7
7
  "url": "https://github.com/umxr"
8
8
  },
9
- "skills": "./dist/skills/core",
9
+ "skills": "./skills/core",
10
10
  "hooks": "./hooks/hooks.json"
11
11
  }
package/README.md CHANGED
@@ -1,23 +1,48 @@
1
1
  # specdx
2
2
 
3
- > Keep AI coding sessions grounded in specs your team actually maintains.
3
+ > Find the stale parts of the documents your coding agent reads.
4
4
 
5
5
  [![npm version](https://img.shields.io/npm/v/specdx)](https://www.npmjs.com/package/specdx)
6
6
  [![license](https://img.shields.io/npm/l/specdx)](LICENSE)
7
7
  [![CI](https://github.com/umxr/specdx/actions/workflows/ci.yml/badge.svg)](https://github.com/umxr/specdx/actions/workflows/ci.yml)
8
8
 
9
- specdx gives your PRDs, technical designs, user stories and API contracts a
10
- schema, lints them for the gaps an LLM will trip over, and packs the relevant
11
- ones into a token budget before you start coding. No LLM calls in the pipeline,
12
- no API key, deterministic enough to gate a pull request on.
9
+ specdx is a linter for the documents an AI coding agent reads: your `CLAUDE.md`
10
+ and `AGENTS.md` today, and a suite of specs if you keep one. No LLM calls in the
11
+ pipeline, no API key, deterministic enough to gate a pull request on.
12
+
13
+ ## Try it on a repo you already have
14
+
15
+ No install, no config. In any repository with a `CLAUDE.md` or an `AGENTS.md`:
13
16
 
14
17
  ```bash
15
- npm install -D specdx
18
+ npx specdx lint
19
+ ```
20
+
21
+ ```
22
+ ⚠ warn AGENTS.md refers to "../VERSIONING.md", which does not exist. An agent
23
+ told to look there will not find it. (agents/stale-references)
24
+ AGENTS.md:134
16
25
  ```
17
26
 
18
- ## Quick start
27
+ It checks that every path the file names still exists, that the file is
28
+ organised under headings, and that it fits a token budget. The first check is
29
+ the one that matters: an instruction file that points at a file which moved
30
+ sends every agent session to the wrong place.
31
+
32
+ The rule is tuned on the instruction files of twelve public repositories, and it
33
+ is not perfect. It leaves alone git refs, import specifiers, container images,
34
+ paths git ignores, and paths a line reports as removed. It cannot tell a deleted
35
+ file from one that exists only at run time, so read a finding before you act on
36
+ it. [More on what it checks](#linting-agentsmd-and-claudemd).
37
+
38
+ ## Add a spec suite
39
+
40
+ specdx also gives PRDs, technical designs, user stories and API contracts a
41
+ schema, lints them for the gaps an LLM will trip over, and packs the relevant
42
+ ones into a token budget before you start coding.
19
43
 
20
44
  ```bash
45
+ npm install -D specdx
21
46
  npx specdx init --template lightweight # scaffold specs/ and spec.config.yaml
22
47
  npx specdx lint # find the gaps
23
48
  ```
@@ -95,8 +120,27 @@ lint:
95
120
 
96
121
  ### Linting AGENTS.md and CLAUDE.md
97
122
 
98
- specdx also lints the instruction files you already have. Add the `agents` key
99
- to `spec.config.yaml`:
123
+ specdx also lints the instruction files you already have — no spec suite
124
+ required. In a directory with an `AGENTS.md` or `CLAUDE.md` and no
125
+ `spec.config.yaml` at or above it:
126
+
127
+ ```bash
128
+ npx specdx lint
129
+ ```
130
+
131
+ It lints those files alone and says so, in every output format. It checks that
132
+ the file is organised under headings, that every path it names still exists,
133
+ and that it fits a token budget. The middle one is the one that earns its
134
+ keep — a `CLAUDE.md` pointing at a file that moved sends every agent session to
135
+ the wrong place, confidently.
136
+
137
+ The search walks upward, so this fallback is about projects with no spec suite,
138
+ not about directories inside one. Run it in a package of a monorepo whose root
139
+ has a `spec.config.yaml` and specdx uses that config, as it would anywhere else
140
+ in the repo.
141
+
142
+ Once you do have a spec suite, add the `agents` key to lint both together and
143
+ to configure it:
100
144
 
101
145
  ```yaml
102
146
  agents:
@@ -104,18 +148,9 @@ agents:
104
148
  max_tokens: 8000
105
149
  ```
106
150
 
107
- It checks that the file is organised under headings, that every path it names
108
- still exists, and that it fits a token budget. The middle one is the one that
109
- earns its keep — a `CLAUDE.md` pointing at a file that moved sends every agent
110
- session to the wrong place, confidently.
111
-
112
151
  These files are not specs. They stay out of the dependency graph, out of
113
- `pack`, and out of `diff`. Adding the `agents` key is what switches this on, and
114
- the spec presets never promote its findings.
115
-
116
- This currently runs as part of `specdx lint`, so it needs a `spec.config.yaml`
117
- to hang off. Linting an `AGENTS.md` in a project with no spec suite at all is
118
- not supported yet.
152
+ `pack`, and out of `diff`. In a project *with* a spec suite the `agents` key is
153
+ what switches this on, and the spec presets never promote its findings.
119
154
 
120
155
  **→ [Full configuration reference](docs/configuration.md)** — lint rule
121
156
  overrides, custom rules, pack budgets, staleness thresholds, `check` paths.
@@ -150,8 +185,14 @@ required sections, cross-references, declared artifacts, and the three sections
150
185
 
151
186
  ### Claude Code
152
187
 
153
- specdx ships as a plugin with **ten skills**. Install it as a dev dependency and
154
- the plugin is discovered automatically:
188
+ specdx ships as a plugin with **ten skills**. Install it from the marketplace:
189
+
190
+ ```bash
191
+ /plugin marketplace add umxr/specdx
192
+ /plugin install specdx@specdx
193
+ ```
194
+
195
+ Or install it as a dev dependency, and the plugin is discovered automatically:
155
196
 
156
197
  ```bash
157
198
  npm install -D specdx
@@ -265,6 +306,13 @@ Accuracy feedback is what graduates these to stable.
265
306
 
266
307
  ## How it compares
267
308
 
309
+ **Spec Kit, BMAD, Kiro, OpenSpec** are workflows. They take you from an idea to
310
+ a spec to a task list, and an LLM writes most of it. specdx is not a workflow and
311
+ does not write specs. It is a check with no model in it, for the part those
312
+ tools leave to a second LLM pass: is this document still true, and is it fit to
313
+ build from. It reads its own spec format; it does not read a Spec Kit or Kiro
314
+ feature folder. The `CLAUDE.md` and `AGENTS.md` lint works beside any of them.
315
+
268
316
  **Markdown linters** (markdownlint, remark-lint) check formatting. specdx checks
269
317
  semantics: required sections by spec type, cross-reference validity, dependency
270
318
  cycles, downstream staleness.
@@ -1,6 +1,10 @@
1
1
  import {
2
- runCheck
3
- } from "./chunk-3YXRWQGX.js";
2
+ applyBaseline,
3
+ createBaseline,
4
+ parseBaseline,
5
+ runCheck,
6
+ serializeBaseline
7
+ } from "./chunk-2UUQJ2ER.js";
4
8
  import {
5
9
  createOutput
6
10
  } from "./chunk-NHD44ZYN.js";
@@ -13,17 +17,20 @@ import {
13
17
  loadConfig,
14
18
  parseSpec,
15
19
  resolveGlob
16
- } from "./chunk-BP3SB35W.js";
20
+ } from "./chunk-JGD3BOPH.js";
17
21
  import "./chunk-XRWLPU24.js";
18
22
  import "./chunk-5WRI5ZAA.js";
19
23
 
20
24
  // src/commands/experimental/check.ts
21
25
  import { defineCommand } from "citty";
26
+ import { readFile, writeFile } from "fs/promises";
27
+ import { isAbsolute, resolve } from "path";
22
28
  var FORMATS = ["pretty", "json", "github"];
29
+ var DEFAULT_BASELINE = ".specdx-baseline.json";
23
30
  var check_default = defineCommand({
24
31
  meta: {
25
32
  name: "check",
26
- description: "Check spec-to-implementation drift. Exit codes: 0 ok, 1 errors found, 3 nothing checkable (coverage not assessed)"
33
+ description: "Check spec-to-implementation drift. Exit codes: 0 ok, 1 errors found, 3 nothing checkable, 4 a declared surface could not be read"
27
34
  },
28
35
  args: {
29
36
  ...sharedArgs(FORMATS),
@@ -32,6 +39,18 @@ var check_default = defineCommand({
32
39
  ai: {
33
40
  type: "boolean",
34
41
  description: "Use AI to assess findings (requires ANTHROPIC_API_KEY)"
42
+ },
43
+ baseline: {
44
+ type: "string",
45
+ description: `Accept the findings recorded in this file; gate only on new ones (default ${DEFAULT_BASELINE})`
46
+ },
47
+ "update-baseline": {
48
+ type: "boolean",
49
+ description: "Record the current findings as accepted and write the baseline file"
50
+ },
51
+ "allow-unassessed": {
52
+ type: "boolean",
53
+ description: "Exit 0 even when a declared surface could not be read (default: exit 4)"
35
54
  }
36
55
  },
37
56
  async run({ args }) {
@@ -62,11 +81,53 @@ var check_default = defineCommand({
62
81
  };
63
82
  logger.debug(`Checking ${specs.length} specs...`);
64
83
  const result = await runCheck(specs, configDir, checkConfig);
84
+ const baselineFlag = args.baseline;
85
+ const updateBaseline = Boolean(args["update-baseline"]);
86
+ const baselinePath = typeof baselineFlag === "string" && baselineFlag !== "" ? baselineFlag : DEFAULT_BASELINE;
87
+ const baselineFile = isAbsolute(baselinePath) ? baselinePath : resolve(configDir, baselinePath);
88
+ if (updateBaseline) {
89
+ const baseline = createBaseline(result.findings);
90
+ await writeFile(baselineFile, serializeBaseline(baseline), "utf-8");
91
+ output.info(
92
+ `
93
+ \u2713 recorded ${baseline.entries.length} accepted finding${baseline.entries.length === 1 ? "" : "s"} to ${baselinePath}
94
+ `
95
+ );
96
+ output.info(
97
+ " The coverage score still counts them. Only new findings will fail the build.\n"
98
+ );
99
+ return;
100
+ }
101
+ let application = null;
102
+ if (baselineFlag !== void 0) {
103
+ let source;
104
+ try {
105
+ source = await readFile(baselineFile, "utf-8");
106
+ } catch {
107
+ console.error(
108
+ `
109
+ \u2717 baseline file not found: ${baselinePath}
110
+ Create it with: specdx check --update-baseline
111
+ `
112
+ );
113
+ process.exit(1);
114
+ }
115
+ try {
116
+ application = applyBaseline(result.findings, parseBaseline(source));
117
+ } catch (err) {
118
+ console.error(`
119
+ \u2717 ${err.message} (${baselinePath})
120
+ `);
121
+ process.exit(1);
122
+ }
123
+ }
124
+ const gating = application ? application.remaining : result.findings;
125
+ const exitCode = gating.some((f) => f.severity === "error") ? 1 : !result.score.assessed ? 3 : result.unassessed.length > 0 && !args["allow-unassessed"] ? 4 : 0;
65
126
  if (args.ai) {
66
- const { analyzeWithAi } = await import("./dist-ROHCFKYT.js");
127
+ const { analyzeWithAi } = await import("./dist-6WDWUOCV.js");
67
128
  let aiResult;
68
129
  try {
69
- aiResult = await analyzeWithAi(result.findings, args.spec ?? "full suite check");
130
+ aiResult = await analyzeWithAi(gating, args.spec ?? "full suite check");
70
131
  } catch (err) {
71
132
  console.error(`
72
133
  \u2717 ${err.message}
@@ -82,7 +143,7 @@ var check_default = defineCommand({
82
143
  console.log(` AI Assessment: ${aiResult.summary}
83
144
  `);
84
145
  for (const assessment of aiResult.assessments) {
85
- const finding = result.findings[assessment.findingIndex];
146
+ const finding = gating[assessment.findingIndex];
86
147
  if (!finding) continue;
87
148
  const icon = assessment.isRealIssue ? "\u2717" : "\u2713";
88
149
  const label = assessment.isRealIssue ? "REAL" : "FALSE POSITIVE";
@@ -99,8 +160,13 @@ var check_default = defineCommand({
99
160
  }
100
161
  return;
101
162
  }
163
+ const baselineReport = application ? {
164
+ path: baselinePath,
165
+ accepted: application.suppressed.length,
166
+ obsolete: application.obsolete
167
+ } : null;
102
168
  if (format.format === "json") {
103
- console.log(JSON.stringify(result, null, 2));
169
+ console.log(JSON.stringify({ ...result, gating, baseline: baselineReport }, null, 2));
104
170
  } else if (format.format === "github") {
105
171
  console.log(
106
172
  `::notice::specdx check \u2014 ${result.score.assessed ? `${result.score.overall}% implementation coverage` : "coverage not assessed \u2014 no checkable surfaces found"}`
@@ -108,7 +174,17 @@ var check_default = defineCommand({
108
174
  for (const note of result.notes) {
109
175
  console.log(`::notice::${note}`);
110
176
  }
111
- for (const f of result.findings) {
177
+ if (baselineReport) {
178
+ console.log(
179
+ `::notice::${baselineReport.accepted} finding(s) accepted by ${baselineReport.path} \u2014 still counted in coverage, not gating`
180
+ );
181
+ if (baselineReport.obsolete.length > 0) {
182
+ console.log(
183
+ `::notice::${baselineReport.obsolete.length} baseline entr(ies) no longer occur \u2014 re-record with --update-baseline`
184
+ );
185
+ }
186
+ }
187
+ for (const f of gating) {
112
188
  const level = f.severity === "error" ? "error" : f.severity === "warn" ? "warning" : "notice";
113
189
  const location = f.codeLocation ? ` file=${f.codeLocation.file},line=${f.codeLocation.line}` : "";
114
190
  const detail = f.actual ? ` \u2014 ${f.actual}` : "";
@@ -127,22 +203,37 @@ var check_default = defineCommand({
127
203
  const fmt = (n) => n === null ? "not scanned" : `${n} found`;
128
204
  output.out(` Scanned: framework=${result.scanned.framework ?? "none detected"}`);
129
205
  output.out(` routes: ${fmt(result.scanned.codeRoutes)}`);
130
- output.out(` types: ${fmt(result.scanned.codeTypes)}`);
206
+ const typesPending = result.scanned.typesPending > 0 ? `, ${result.scanned.typesPending} pending` : "";
207
+ output.out(` types: ${fmt(result.scanned.codeTypes)}${typesPending}`);
131
208
  output.out(` tests: ${fmt(result.scanned.codeTests)}`);
132
209
  const artifacts = result.scanned.artifacts === null ? "none declared" : `${result.scanned.artifacts} assessed`;
133
210
  const pending = result.scanned.artifactsPending > 0 ? `, ${result.scanned.artifactsPending} pending` : "";
134
211
  output.out(` artifacts: ${artifacts}${pending}
135
212
  `);
136
213
  }
214
+ if (baselineReport) {
215
+ output.info(
216
+ ` ${baselineReport.accepted} finding${baselineReport.accepted === 1 ? "" : "s"} accepted by ${baselineReport.path} \u2014 counted in coverage above, not gating`
217
+ );
218
+ const stale = baselineReport.obsolete.length;
219
+ if (stale > 0) {
220
+ output.info(
221
+ ` ${stale} baseline ${stale === 1 ? "entry no longer occurs" : "entries no longer occur"} \u2014 re-record with --update-baseline`
222
+ );
223
+ }
224
+ output.info("");
225
+ }
137
226
  for (const [category, stats] of Object.entries(result.score.byCategory)) {
138
227
  if (stats.total === 0) continue;
139
- const categoryFindings = result.findings.filter(
140
- (f) => f.category === category.replace(/s$/, "")
141
- );
142
- const header = ` ${category} (${stats.matched}/${stats.total}):`;
228
+ const categoryFindings = gating.filter((f) => f.category === category.replace(/s$/, ""));
229
+ const advisory = category === "tests" ? " \u2014 advisory, not scored" : "";
230
+ const header = ` ${category} (${stats.matched}/${stats.total})${advisory}:`;
143
231
  if (categoryFindings.length === 0) {
144
232
  output.info(header);
145
- output.info(" \u2713 all matched");
233
+ const acceptedHere = application ? application.suppressed.filter((f) => f.category === category.replace(/s$/, "")).length : 0;
234
+ output.info(
235
+ acceptedHere > 0 ? ` \u2713 no new findings (${acceptedHere} accepted by baseline)` : " \u2713 all matched"
236
+ );
146
237
  continue;
147
238
  }
148
239
  output.out(header);
@@ -153,22 +244,25 @@ var check_default = defineCommand({
153
244
  output.out(` ${icon} ${f.expected}${detail}${suggestion}`);
154
245
  }
155
246
  }
156
- const errors = result.findings.filter((f) => f.severity === "error").length;
157
- const warnings = result.findings.filter((f) => f.severity === "warn").length;
158
- const info = result.findings.filter((f) => f.severity === "info").length;
247
+ const errors = gating.filter((f) => f.severity === "error").length;
248
+ const warnings = gating.filter((f) => f.severity === "warn").length;
249
+ const info = gating.filter((f) => f.severity === "info").length;
159
250
  output.info(`
160
- ${errors} errors, ${warnings} warnings, ${info} info
161
- `);
162
- }
163
- if (result.findings.some((f) => f.severity === "error")) {
164
- process.exit(1);
251
+ ${errors} errors, ${warnings} warnings, ${info} info`);
252
+ if (exitCode === 4) {
253
+ output.info(
254
+ ` ${result.unassessed.length} declared surface${result.unassessed.length === 1 ? "" : "s"} could not be read \u2014 the coverage above excludes ${result.unassessed.length === 1 ? "it" : "them"} (exit 4).`
255
+ );
256
+ output.info(" Fix the shapes named above, or pass --allow-unassessed to accept it.");
257
+ }
258
+ output.info("");
165
259
  }
166
- if (!result.score.assessed) {
167
- process.exit(3);
260
+ if (exitCode !== 0) {
261
+ process.exit(exitCode);
168
262
  }
169
263
  }
170
264
  });
171
265
  export {
172
266
  check_default as default
173
267
  };
174
- //# sourceMappingURL=check-RH5SCXWW.js.map
268
+ //# sourceMappingURL=check-5EA2MTNN.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/commands/experimental/check.ts"],"sourcesContent":["import { defineCommand } from \"citty\";\nimport { readFile, writeFile } from \"node:fs/promises\";\nimport { isAbsolute, resolve } from \"node:path\";\nimport { loadConfig, parseSpec, resolveGlob, createLogger } from \"@specdx/core\";\nimport {\n runCheck,\n applyBaseline,\n createBaseline,\n parseBaseline,\n serializeBaseline,\n} from \"@specdx/check\";\nimport type { ParsedSpec } from \"@specdx/core\";\nimport type { CheckConfig, BaselineApplication } from \"@specdx/check\";\nimport { sharedArgs, resolveFormat } from \"../../shared-args.js\";\nimport { createOutput } from \"../../output.js\";\n\nconst FORMATS = [\"pretty\", \"json\", \"github\"] as const;\n\n/** Where a baseline lives when the flag names no path. */\nconst DEFAULT_BASELINE = \".specdx-baseline.json\";\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, 4 a declared surface could not be read\",\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 baseline: {\n type: \"string\",\n description: `Accept the findings recorded in this file; gate only on new ones (default ${DEFAULT_BASELINE})`,\n },\n \"update-baseline\": {\n type: \"boolean\",\n description: \"Record the current findings as accepted and write the baseline file\",\n },\n \"allow-unassessed\": {\n type: \"boolean\",\n description: \"Exit 0 even when a declared surface could not be read (default: exit 4)\",\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 // Baseline. Only ever narrows what *gates* the build — the score above is\n // computed over every finding, baselined or not, so adopting a baseline on\n // an existing project cannot report it as suddenly complete.\n const baselineFlag = args.baseline;\n const updateBaseline = Boolean(args[\"update-baseline\"]);\n // `--baseline` with no value arrives as boolean true, not \"\", so a string\n // check alone crashed in path.isAbsolute.\n const baselinePath =\n typeof baselineFlag === \"string\" && baselineFlag !== \"\" ? baselineFlag : DEFAULT_BASELINE;\n const baselineFile = isAbsolute(baselinePath) ? baselinePath : resolve(configDir, baselinePath);\n\n if (updateBaseline) {\n const baseline = createBaseline(result.findings);\n await writeFile(baselineFile, serializeBaseline(baseline), \"utf-8\");\n output.info(\n `\\n ✓ recorded ${baseline.entries.length} accepted finding${\n baseline.entries.length === 1 ? \"\" : \"s\"\n } to ${baselinePath}\\n`,\n );\n output.info(\n \" The coverage score still counts them. Only new findings will fail the build.\\n\",\n );\n return;\n }\n\n let application: BaselineApplication | null = null;\n if (baselineFlag !== undefined) {\n let source: string;\n try {\n source = await readFile(baselineFile, \"utf-8\");\n } catch {\n // Silently continuing with no baseline would gate every pre-existing\n // finding and read as a wall of new drift.\n console.error(\n `\\n ✗ baseline file not found: ${baselinePath}\\n` +\n \" Create it with: specdx check --update-baseline\\n\",\n );\n process.exit(1);\n }\n try {\n application = applyBaseline(result.findings, parseBaseline(source));\n } catch (err) {\n console.error(`\\n ✗ ${(err as Error).message} (${baselinePath})\\n`);\n process.exit(1);\n }\n }\n\n // What gates, and what the report lists. The score stays on every finding.\n const gating = application ? application.remaining : result.findings;\n\n // Decided once, before anything is printed, so the report cannot name an\n // exit code the process does not then use.\n // 1 errors 3 nothing checkable 4 a declared surface could not be read\n const exitCode = gating.some((f) => f.severity === \"error\")\n ? 1\n : !result.score.assessed\n ? 3\n : result.unassessed.length > 0 && !args[\"allow-unassessed\"]\n ? 4\n : 0;\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(gating, 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 // `findingIndex` indexes what was handed to the assessor, which is\n // the gating set — indexing the full list would mislabel findings\n // whenever a baseline suppressed anything.\n const finding = gating[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 const baselineReport = application\n ? {\n path: baselinePath,\n accepted: application.suppressed.length,\n obsolete: application.obsolete,\n }\n : null;\n\n if (format.format === \"json\") {\n console.log(JSON.stringify({ ...result, gating, baseline: baselineReport }, 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 if (baselineReport) {\n console.log(\n `::notice::${baselineReport.accepted} finding(s) accepted by ${baselineReport.path} — still counted in coverage, not gating`,\n );\n if (baselineReport.obsolete.length > 0) {\n console.log(\n `::notice::${baselineReport.obsolete.length} baseline entr(ies) no longer occur — re-record with --update-baseline`,\n );\n }\n }\n for (const f of gating) {\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 const typesPending =\n result.scanned.typesPending > 0 ? `, ${result.scanned.typesPending} pending` : \"\";\n output.out(` types: ${fmt(result.scanned.codeTypes)}${typesPending}`);\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 if (baselineReport) {\n output.info(\n ` ${baselineReport.accepted} finding${\n baselineReport.accepted === 1 ? \"\" : \"s\"\n } accepted by ${baselineReport.path} — counted in coverage above, not gating`,\n );\n const stale = baselineReport.obsolete.length;\n if (stale > 0) {\n output.info(\n ` ${stale} baseline ${stale === 1 ? \"entry no longer occurs\" : \"entries no longer occur\"} — re-record with --update-baseline`,\n );\n }\n output.info(\"\");\n }\n\n for (const [category, stats] of Object.entries(result.score.byCategory)) {\n if (stats.total === 0) continue;\n const categoryFindings = gating.filter((f) => f.category === category.replace(/s$/, \"\"));\n // Tests are matched by prose similarity, which is too weak to score on;\n // saying so keeps the arithmetic above explicable.\n const advisory = category === \"tests\" ? \" — advisory, not scored\" : \"\";\n const header = ` ${category} (${stats.matched}/${stats.total})${advisory}:`;\n if (categoryFindings.length === 0) {\n output.info(header);\n // \"all matched\" under a 2/3 header contradicts itself. When a baseline\n // is what emptied the list, the honest line names it.\n const acceptedHere = application\n ? application.suppressed.filter((f) => f.category === category.replace(/s$/, \"\")).length\n : 0;\n output.info(\n acceptedHere > 0\n ? ` ✓ no new findings (${acceptedHere} accepted by baseline)`\n : \" ✓ all matched\",\n );\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 = gating.filter((f) => f.severity === \"error\").length;\n const warnings = gating.filter((f) => f.severity === \"warn\").length;\n const info = gating.filter((f) => f.severity === \"info\").length;\n output.info(`\\n ${errors} errors, ${warnings} warnings, ${info} info`);\n\n if (exitCode === 4) {\n output.info(\n ` ${result.unassessed.length} declared surface${\n result.unassessed.length === 1 ? \"\" : \"s\"\n } could not be read — the coverage above excludes ${\n result.unassessed.length === 1 ? \"it\" : \"them\"\n } (exit 4).`,\n );\n output.info(\" Fix the shapes named above, or pass --allow-unassessed to accept it.\");\n }\n output.info(\"\");\n }\n\n // Distinct codes so CI cannot mistake \"nothing was checkable\" or \"could not\n // look\" for a pass. An unreadable surface leaves the score's denominator\n // silently, which *raises* the percentage — exiting 0 there is the same\n // conflation issue #6 fixed for the whole-run case, still live per surface.\n if (exitCode !== 0) {\n process.exit(exitCode);\n }\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,qBAAqB;AAC9B,SAAS,UAAU,iBAAiB;AACpC,SAAS,YAAY,eAAe;AAcpC,IAAM,UAAU,CAAC,UAAU,QAAQ,QAAQ;AAG3C,IAAM,mBAAmB;AAEzB,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,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