specdx 0.4.0 → 0.5.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.
Files changed (55) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/README.md +25 -1
  3. package/dist/{check-PHXXA7VY.js → check-RH5SCXWW.js} +3 -3
  4. package/dist/{chunk-2BZIG7OE.js → chunk-6EQIDZ4D.js} +14 -14
  5. package/dist/{chunk-NAWYG4VV.js → chunk-6WFNZH7F.js} +2 -2
  6. package/dist/{chunk-YRQPY5NF.js → chunk-BMOOLUPG.js} +2 -2
  7. package/dist/{chunk-SNQNQ2MP.js → chunk-BP3SB35W.js} +2 -2
  8. package/dist/{chunk-OVIKIIR4.js → chunk-CQETLJTZ.js} +2 -2
  9. package/dist/{chunk-OVIKIIR4.js.map → chunk-CQETLJTZ.js.map} +1 -1
  10. package/dist/{chunk-HCJDCS26.js → chunk-XRWLPU24.js} +10 -1
  11. package/dist/chunk-XRWLPU24.js.map +1 -0
  12. package/dist/{chunk-LJTLNXGV.js → chunk-ZIODMXST.js} +315 -4
  13. package/dist/chunk-ZIODMXST.js.map +1 -0
  14. package/dist/{diff-6C5LJ7SH.js → diff-QO7HMAK3.js} +4 -4
  15. package/dist/{dist-PK52GA7M.js → dist-JPWHWMV2.js} +51 -12
  16. package/dist/dist-JPWHWMV2.js.map +1 -0
  17. package/dist/{generate-K72WD455.js → generate-MS4BM7RU.js} +5 -5
  18. package/dist/{generate-story-NUCNYL3I.js → generate-story-OMM322L7.js} +4 -4
  19. package/dist/{generate-test-plan-Z46W3N3B.js → generate-test-plan-75W7SZIO.js} +3 -3
  20. package/dist/{graph-4RNURBNP.js → graph-QOTMXENE.js} +3 -3
  21. package/dist/index.d.ts +27 -0
  22. package/dist/index.js +369 -19
  23. package/dist/index.js.map +1 -1
  24. package/dist/{lint-2VZPNLE3.js → lint-LPFLHVO4.js} +45 -11
  25. package/dist/lint-LPFLHVO4.js.map +1 -0
  26. package/dist/main.js +3 -3
  27. package/dist/{mcp-E6PJWBDQ.js → mcp-OEC43SPF.js} +3 -3
  28. package/dist/{migrate-FKFC7UAO.js → migrate-CBP2AVLH.js} +3 -3
  29. package/dist/{pack-DE4UBTCC.js → pack-X6FSWORJ.js} +4 -4
  30. package/dist/{ready-K74SLQ24.js → ready-7MJWRGLT.js} +5 -5
  31. package/dist/{status-IAE3BB77.js → status-UUPZYX3J.js} +5 -5
  32. package/dist/{update-UFOHZEAK.js → update-EI7IJRHG.js} +3 -3
  33. package/dist/{validate-EZHUB5TW.js → validate-HTTZLQWI.js} +3 -3
  34. package/package.json +2 -2
  35. package/dist/chunk-HCJDCS26.js.map +0 -1
  36. package/dist/chunk-LJTLNXGV.js.map +0 -1
  37. package/dist/dist-PK52GA7M.js.map +0 -1
  38. package/dist/lint-2VZPNLE3.js.map +0 -1
  39. /package/dist/{check-PHXXA7VY.js.map → check-RH5SCXWW.js.map} +0 -0
  40. /package/dist/{chunk-2BZIG7OE.js.map → chunk-6EQIDZ4D.js.map} +0 -0
  41. /package/dist/{chunk-NAWYG4VV.js.map → chunk-6WFNZH7F.js.map} +0 -0
  42. /package/dist/{chunk-YRQPY5NF.js.map → chunk-BMOOLUPG.js.map} +0 -0
  43. /package/dist/{chunk-SNQNQ2MP.js.map → chunk-BP3SB35W.js.map} +0 -0
  44. /package/dist/{diff-6C5LJ7SH.js.map → diff-QO7HMAK3.js.map} +0 -0
  45. /package/dist/{generate-K72WD455.js.map → generate-MS4BM7RU.js.map} +0 -0
  46. /package/dist/{generate-story-NUCNYL3I.js.map → generate-story-OMM322L7.js.map} +0 -0
  47. /package/dist/{generate-test-plan-Z46W3N3B.js.map → generate-test-plan-75W7SZIO.js.map} +0 -0
  48. /package/dist/{graph-4RNURBNP.js.map → graph-QOTMXENE.js.map} +0 -0
  49. /package/dist/{mcp-E6PJWBDQ.js.map → mcp-OEC43SPF.js.map} +0 -0
  50. /package/dist/{migrate-FKFC7UAO.js.map → migrate-CBP2AVLH.js.map} +0 -0
  51. /package/dist/{pack-DE4UBTCC.js.map → pack-X6FSWORJ.js.map} +0 -0
  52. /package/dist/{ready-K74SLQ24.js.map → ready-7MJWRGLT.js.map} +0 -0
  53. /package/dist/{status-IAE3BB77.js.map → status-UUPZYX3J.js.map} +0 -0
  54. /package/dist/{update-UFOHZEAK.js.map → update-EI7IJRHG.js.map} +0 -0
  55. /package/dist/{validate-EZHUB5TW.js.map → validate-HTTZLQWI.js.map} +0 -0
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "specdx",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Spec-driven development skills for Claude Code",
5
5
  "author": {
6
6
  "name": "umxr",
package/README.md CHANGED
@@ -93,6 +93,30 @@ lint:
93
93
  `requires` is what builds the dependency graph, and the graph is what makes
94
94
  `diff` able to tell you that changing the PRD stales the test plan.
95
95
 
96
+ ### Linting AGENTS.md and CLAUDE.md
97
+
98
+ specdx also lints the instruction files you already have. Add the `agents` key
99
+ to `spec.config.yaml`:
100
+
101
+ ```yaml
102
+ agents:
103
+ paths: ["AGENTS.md", "CLAUDE.md"]
104
+ max_tokens: 8000
105
+ ```
106
+
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
+ 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.
119
+
96
120
  **→ [Full configuration reference](docs/configuration.md)** — lint rule
97
121
  overrides, custom rules, pack budgets, staleness thresholds, `check` paths.
98
122
 
@@ -196,7 +220,7 @@ inline annotations and exits non-zero on failure.
196
220
  | Command | Description |
197
221
  |---------|-------------|
198
222
  | `specdx init` | Scaffold a spec suite (`--template lightweight\|bmad\|api-first\|quick\|context`) |
199
- | `specdx lint` | Lint all specs (`--preset`, `--fix`) |
223
+ | `specdx lint [path]` | Lint the suite, or just `path` (`--preset`, `--fix`) |
200
224
  | `specdx validate` | Validate `spec.config.yaml` |
201
225
  | `specdx pack --task <task>` | Pack specs into token-budgeted context (`--copy`, `--full`) |
202
226
  | `specdx status` | Spec suite health overview |
@@ -13,8 +13,8 @@ import {
13
13
  loadConfig,
14
14
  parseSpec,
15
15
  resolveGlob
16
- } from "./chunk-SNQNQ2MP.js";
17
- import "./chunk-HCJDCS26.js";
16
+ } from "./chunk-BP3SB35W.js";
17
+ import "./chunk-XRWLPU24.js";
18
18
  import "./chunk-5WRI5ZAA.js";
19
19
 
20
20
  // src/commands/experimental/check.ts
@@ -171,4 +171,4 @@ var check_default = defineCommand({
171
171
  export {
172
172
  check_default as default
173
173
  };
174
- //# sourceMappingURL=check-PHXXA7VY.js.map
174
+ //# sourceMappingURL=check-RH5SCXWW.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  REQUIRED_SECTIONS
3
- } from "./chunk-HCJDCS26.js";
3
+ } from "./chunk-XRWLPU24.js";
4
4
 
5
5
  // src/commands/core/init.ts
6
6
  import { defineCommand } from "citty";
@@ -163,23 +163,23 @@ function bucketed(name, load) {
163
163
  }
164
164
  var subCommands = {
165
165
  init: init_default,
166
- lint: bucketed("lint", () => import("./lint-2VZPNLE3.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)),
166
+ lint: bucketed("lint", () => import("./lint-LPFLHVO4.js").then((m) => m.default)),
167
+ validate: bucketed("validate", () => import("./validate-HTTZLQWI.js").then((m) => m.default)),
168
+ graph: bucketed("graph", () => import("./graph-QOTMXENE.js").then((m) => m.default)),
169
169
  skills: bucketed("skills", () => import("./skills-36SRUEMR.js").then((m) => m.default)),
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-IAE3BB77.js").then((m) => m.default)),
173
- check: bucketed("check", () => import("./check-PHXXA7VY.js").then((m) => m.default)),
174
- ready: bucketed("ready", () => import("./ready-K74SLQ24.js").then((m) => m.default)),
175
- update: bucketed("update", () => import("./update-UFOHZEAK.js").then((m) => m.default)),
176
- generate: bucketed("generate", () => import("./generate-K72WD455.js").then((m) => m.default)),
177
- migrate: bucketed("migrate", () => import("./migrate-FKFC7UAO.js").then((m) => m.default)),
178
- mcp: bucketed("mcp", () => import("./mcp-E6PJWBDQ.js").then((m) => m.default))
170
+ pack: bucketed("pack", () => import("./pack-X6FSWORJ.js").then((m) => m.default)),
171
+ diff: bucketed("diff", () => import("./diff-QO7HMAK3.js").then((m) => m.default)),
172
+ status: bucketed("status", () => import("./status-UUPZYX3J.js").then((m) => m.default)),
173
+ check: bucketed("check", () => import("./check-RH5SCXWW.js").then((m) => m.default)),
174
+ ready: bucketed("ready", () => import("./ready-7MJWRGLT.js").then((m) => m.default)),
175
+ update: bucketed("update", () => import("./update-EI7IJRHG.js").then((m) => m.default)),
176
+ generate: bucketed("generate", () => import("./generate-MS4BM7RU.js").then((m) => m.default)),
177
+ migrate: bucketed("migrate", () => import("./migrate-CBP2AVLH.js").then((m) => m.default)),
178
+ mcp: bucketed("mcp", () => import("./mcp-OEC43SPF.js").then((m) => m.default))
179
179
  };
180
180
 
181
181
  export {
182
182
  labelled,
183
183
  subCommands
184
184
  };
185
- //# sourceMappingURL=chunk-2BZIG7OE.js.map
185
+ //# sourceMappingURL=chunk-6EQIDZ4D.js.map
@@ -2,7 +2,7 @@ import {
2
2
  buildRelationResolver,
3
3
  loadConfig,
4
4
  parseSpecFromString
5
- } from "./chunk-SNQNQ2MP.js";
5
+ } from "./chunk-BP3SB35W.js";
6
6
  import {
7
7
  __commonJS,
8
8
  __toESM
@@ -2843,4 +2843,4 @@ export {
2843
2843
  DiffError,
2844
2844
  diffBetweenRefs
2845
2845
  };
2846
- //# sourceMappingURL=chunk-NAWYG4VV.js.map
2846
+ //# sourceMappingURL=chunk-6WFNZH7F.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  countTokens
3
- } from "./chunk-SNQNQ2MP.js";
3
+ } from "./chunk-BP3SB35W.js";
4
4
 
5
5
  // ../pack/dist/resolver.js
6
6
  var STOPWORDS = /* @__PURE__ */ new Set([
@@ -684,4 +684,4 @@ function pack(specs, options, packConfig, graph) {
684
684
  export {
685
685
  pack
686
686
  };
687
- //# sourceMappingURL=chunk-YRQPY5NF.js.map
687
+ //# sourceMappingURL=chunk-BMOOLUPG.js.map
@@ -2,7 +2,7 @@ import {
2
2
  DEPENDENCY_RELATIONSHIPS,
3
3
  validateConfig,
4
4
  validateSpec
5
- } from "./chunk-HCJDCS26.js";
5
+ } from "./chunk-XRWLPU24.js";
6
6
 
7
7
  // ../core/dist/config.js
8
8
  import { readFile } from "fs/promises";
@@ -451,4 +451,4 @@ export {
451
451
  resolveGlob,
452
452
  createLogger
453
453
  };
454
- //# sourceMappingURL=chunk-SNQNQ2MP.js.map
454
+ //# sourceMappingURL=chunk-BP3SB35W.js.map
@@ -1,7 +1,7 @@
1
1
  // package.json
2
2
  var package_default = {
3
3
  name: "specdx",
4
- version: "0.4.0",
4
+ version: "0.5.0",
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-OVIKIIR4.js.map
103
+ //# sourceMappingURL=chunk-CQETLJTZ.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../package.json"],"sourcesContent":["{\n \"name\": \"specdx\",\n \"version\": \"0.4.0\",\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;AAAA,IACR,KAAO;AAAA,EACT;AAAA,EACA,iBAAmB;AAAA,IACjB,iBAAiB;AAAA,IACjB,gBAAgB;AAAA,IAChB,gBAAgB;AAAA,IAChB,gBAAgB;AAAA,IAChB,eAAe;AAAA,IACf,gBAAgB;AAAA,IAChB,kBAAkB;AAAA,IAClB,kBAAkB;AAAA,IAClB,MAAQ;AAAA,IACR,YAAc;AAAA,EAChB;AAAA,EACA,eAAiB;AAAA,IACf,QAAU;AAAA,EACZ;AAAA,EACA,kBAAoB;AAAA,IAClB,YAAY;AAAA,IACZ,qBAAqB;AAAA,EACvB;AAAA,EACA,sBAAwB;AAAA,IACtB,YAAY;AAAA,MACV,UAAY;AAAA,IACd;AAAA,IACA,qBAAqB;AAAA,MACnB,UAAY;AAAA,IACd;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../package.json"],"sourcesContent":["{\n \"name\": \"specdx\",\n \"version\": \"0.5.0\",\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,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AqB;AAAA,MACnB,UAAY;AAAA,IACd;AAAA,EACF;AACF;","names":[]}
@@ -268,6 +268,15 @@ var config_default = {
268
268
  }
269
269
  },
270
270
  additionalProperties: false
271
+ },
272
+ agents: {
273
+ type: "object",
274
+ properties: {
275
+ paths: { type: "array", items: { type: "string" } },
276
+ max_tokens: { type: "integer", minimum: 1 },
277
+ rules: { type: "object" }
278
+ },
279
+ additionalProperties: false
271
280
  }
272
281
  },
273
282
  required: ["version", "specs"],
@@ -436,4 +445,4 @@ export {
436
445
  validateSpec,
437
446
  validateConfig
438
447
  };
439
- //# sourceMappingURL=chunk-HCJDCS26.js.map
448
+ //# sourceMappingURL=chunk-XRWLPU24.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../schema/src/types.ts","../../schema/src/sections.ts","../../schema/src/validator.ts","../../schema/dist/schemas/base-spec.json","../../schema/dist/schemas/config.json","../../schema/dist/schemas/prd.json","../../schema/dist/schemas/technical-design.json","../../schema/dist/schemas/user-story.json","../../schema/dist/schemas/test-plan.json","../../schema/dist/schemas/adr.json","../../schema/dist/schemas/api-contract.json","../../schema/dist/schemas/epic.json","../../schema/dist/schemas/quick-spec.json","../../schema/dist/schemas/project-context.json"],"sourcesContent":["/**\n * The `version` a `spec.config.yaml` is expected to declare.\n *\n * The field was accepted with any value at all, so `migrate` printed whatever\n * it read and then said \"no migration needed\" regardless -- a config claiming\n * `0.9` passed as readily as a current one. A version field nothing checks is\n * a field that cannot do its job when a real migration arrives.\n */\nexport const SUPPORTED_CONFIG_VERSION = \"1.0\";\n\nexport const SPEC_TYPES = [\n \"prd\",\n \"technical-design\",\n \"user-story\",\n \"test-plan\",\n \"adr\",\n \"api-contract\",\n \"epic\",\n \"quick-spec\",\n \"project-context\",\n] as const;\nexport type SpecType = (typeof SPEC_TYPES)[number];\n\nexport const SPEC_STATUSES = [\"draft\", \"review\", \"approved\", \"superseded\"] as const;\nexport type SpecStatus = (typeof SPEC_STATUSES)[number];\n\n/**\n * Every relationship kind a spec may declare in frontmatter `references`.\n * Single source of truth — `base-spec.json`'s enum is drift-tested against it.\n */\nexport const SPEC_RELATIONSHIPS = [\n \"implemented-by\",\n \"decomposed-into\",\n \"depends-on\",\n \"supersedes\",\n \"related-to\",\n] as const;\nexport type SpecRelationship = (typeof SPEC_RELATIONSHIPS)[number];\n\n/**\n * Which relationship kinds imply a build dependency, and in which direction.\n *\n * Structural kinds are deliberately absent: `decomposed-into` describes a\n * parent/child split and `supersedes` describes lineage — neither means the\n * target depends on the source (issue #13). Declared here rather than in\n * `@specdx/core` so the taxonomy is versioned with the schema it belongs to\n * (ADR: references/requires unification).\n */\nexport const DEPENDENCY_RELATIONSHIPS: Partial<\n Record<SpecRelationship, \"self-requires-target\" | \"target-requires-self\">\n> = {\n \"depends-on\": \"self-requires-target\",\n \"implemented-by\": \"target-requires-self\",\n};\n\nexport interface SpecReference {\n id: string;\n relationship: SpecRelationship;\n}\n\n/** A checkable implementation artifact declared by a spec (issue #15). */\nexport interface SpecArtifact {\n /** Project-root-relative file path that must exist. */\n path: string;\n /** Names that must be exported from the file. */\n exports?: string[];\n}\n\nexport interface BaseSpec {\n id: string;\n type: SpecType;\n title: string;\n status: SpecStatus;\n version: string;\n created: string;\n updated?: string;\n authors: string[];\n tags?: string[];\n references?: SpecReference[];\n artifacts?: SpecArtifact[];\n}\n\nexport interface PrdSpec extends BaseSpec {\n type: \"prd\";\n}\nexport interface TechnicalDesignSpec extends BaseSpec {\n type: \"technical-design\";\n}\nexport interface UserStorySpec extends BaseSpec {\n type: \"user-story\";\n story_id: string;\n priority: \"critical\" | \"high\" | \"medium\" | \"low\";\n estimate: string;\n}\nexport interface TestPlanSpec extends BaseSpec {\n type: \"test-plan\";\n}\nexport interface AdrSpec extends BaseSpec {\n type: \"adr\";\n}\nexport interface ApiContractSpec extends BaseSpec {\n type: \"api-contract\";\n}\n\nexport interface EpicSpec extends BaseSpec {\n type: \"epic\";\n epic_id: string;\n priority: \"critical\" | \"high\" | \"medium\" | \"low\";\n}\n\nexport interface QuickSpecSpec extends BaseSpec {\n type: \"quick-spec\";\n}\n\nexport interface ProjectContextSpec extends BaseSpec {\n type: \"project-context\";\n}\n\nexport type Spec =\n | PrdSpec\n | TechnicalDesignSpec\n | UserStorySpec\n | TestPlanSpec\n | AdrSpec\n | ApiContractSpec\n | EpicSpec\n | QuickSpecSpec\n | ProjectContextSpec;\n\nexport interface SpecEntry {\n path: string;\n type: SpecType;\n required?: boolean;\n requires?: string[];\n owner?: string;\n}\n\nexport interface PackCompressionConfig {\n strip_boilerplate?: boolean;\n stable_days?: number;\n collapse_resolved_adrs?: boolean;\n}\n\nexport interface PackConfig {\n max_tokens?: number;\n format?: \"xml\" | \"markdown\" | \"json\";\n compression?: PackCompressionConfig;\n boilerplate_sections?: string[];\n}\n\nexport interface SdxConfig {\n version: string;\n project?: { name?: string; description?: string };\n specs: Record<string, SpecEntry>;\n lint?: {\n extends?: string;\n rules?: Record<string, unknown>;\n ignore?: string[];\n };\n pack?: PackConfig;\n diff?: {\n baseline_ref?: string;\n staleness_threshold_days?: number;\n ignore_paths?: string[];\n };\n ci?: {\n block_on?: (\"error\" | \"warn\" | \"info\")[];\n post_comment?: boolean;\n update_badge?: boolean;\n trigger_paths?: string[];\n };\n check?: {\n framework?: \"auto\" | \"express\" | \"hono\" | \"nextjs\";\n routes_dir?: string;\n app_dir?: string;\n types_dir?: string;\n tests_dir?: string;\n ignore?: string[];\n };\n /**\n * Linting for agent instruction files — AGENTS.md, CLAUDE.md and friends.\n *\n * These are not specs and never become `ParsedSpec`: they carry no\n * frontmatter, they are absent from `specs`, and they never enter the\n * dependency graph. See `specs/adr/2026-08-11-linting-formats-we-do-not-own.md`.\n *\n * Presence of this key is what turns the feature on. Auto-discovering\n * AGENTS.md would add diagnostics to every existing suite on upgrade, and\n * `strict` would promote them to errors and break pipelines that never asked\n * for this.\n */\n agents?: {\n /** Globs, relative to the config directory. Defaults to AGENTS.md and CLAUDE.md. */\n paths?: string[];\n /** Ceiling for a single agent file, counted with the same tokenizer `pack` uses. */\n max_tokens?: number;\n /** Per-rule severity overrides, keyed by full rule id (`agents/size-budget`). */\n rules?: Record<string, unknown>;\n };\n}\n","import type { SpecType } from \"./types.js\";\n\nexport const REQUIRED_SECTIONS: Record<SpecType, string[]> = {\n prd: [\"Problem Statement\", \"Goals\", \"Non-Goals\", \"Features\", \"Success Criteria\"],\n \"technical-design\": [\n \"Overview\",\n \"Architecture\",\n \"Data Model\",\n \"API Design\",\n \"Dependencies\",\n \"Risks\",\n \"Open Questions\",\n ],\n \"user-story\": [\"Description\", \"Acceptance Criteria\", \"Dependencies\", \"Notes\"],\n \"test-plan\": [\"Scope\", \"Test Cases\", \"Coverage Matrix\", \"Edge Cases\"],\n adr: [\"Context\", \"Decision\", \"Status\", \"Consequences\"],\n \"api-contract\": [\"Endpoints\", \"Request/Response Schemas\", \"Auth\", \"Error Codes\"],\n epic: [\"Overview\", \"Stories\", \"Acceptance Criteria\", \"Dependencies\"],\n \"quick-spec\": [\"Intent\", \"Boundaries\", \"Tasks\"],\n \"project-context\": [\"Technology Stack\", \"Critical Implementation Rules\", \"Coding Patterns\"],\n};\n","import { Ajv as AjvClass, type ErrorObject } from \"ajv\";\nimport { SPEC_TYPES, type SpecType } from \"./types.js\";\n\nimport baseSpecSchema from \"./schemas/base-spec.json\" with { type: \"json\" };\nimport configSchema from \"./schemas/config.json\" with { type: \"json\" };\nimport prdSchema from \"./schemas/prd.json\" with { type: \"json\" };\nimport technicalDesignSchema from \"./schemas/technical-design.json\" with { type: \"json\" };\nimport userStorySchema from \"./schemas/user-story.json\" with { type: \"json\" };\nimport testPlanSchema from \"./schemas/test-plan.json\" with { type: \"json\" };\nimport adrSchema from \"./schemas/adr.json\" with { type: \"json\" };\nimport apiContractSchema from \"./schemas/api-contract.json\" with { type: \"json\" };\nimport epicSchema from \"./schemas/epic.json\" with { type: \"json\" };\nimport quickSpecSchema from \"./schemas/quick-spec.json\" with { type: \"json\" };\nimport projectContextSchema from \"./schemas/project-context.json\" with { type: \"json\" };\n\n// addFormats is CJS-only; access via the namespace default at runtime\n// The type cast is needed because TypeScript's NodeNext resolution exposes\n// the CJS module as a namespace without a callable default signature.\nimport * as addFormatsNs from \"ajv-formats\";\ntype AddFormatsPlugin = (ajv: AjvClass, formats?: unknown) => AjvClass;\nconst addFormats = ((addFormatsNs as unknown as { default?: AddFormatsPlugin }).default ??\n (addFormatsNs as unknown as AddFormatsPlugin)) as AddFormatsPlugin;\n\nexport interface ValidationResult {\n valid: boolean;\n errors: ErrorObject[] | null;\n}\n\n// The JSON schemas duplicate the spec-type enum for editor and schema-store\n// consumers. At runtime SPEC_TYPES is the single source of truth: the enums are\n// overwritten before compilation so the JSON copies can never drift from the\n// TypeScript types (see issue #2 — a stale enum shipped in 0.4.0-alpha.2).\nconst runtimeBaseSpecSchema = structuredClone(baseSpecSchema);\nruntimeBaseSpecSchema.properties.type.enum = [...SPEC_TYPES];\nconst runtimeConfigSchema = structuredClone(configSchema);\nruntimeConfigSchema.properties.specs.additionalProperties.properties.type.enum = [...SPEC_TYPES];\n\nconst ajv = new AjvClass({ allErrors: true, strict: true });\naddFormats(ajv, [\"date\"]);\najv.addSchema(runtimeBaseSpecSchema);\n\nconst specValidators: Record<string, ReturnType<typeof ajv.compile>> = {\n prd: ajv.compile(prdSchema),\n \"technical-design\": ajv.compile(technicalDesignSchema),\n \"user-story\": ajv.compile(userStorySchema),\n \"test-plan\": ajv.compile(testPlanSchema),\n adr: ajv.compile(adrSchema),\n \"api-contract\": ajv.compile(apiContractSchema),\n epic: ajv.compile(epicSchema),\n \"quick-spec\": ajv.compile(quickSpecSchema),\n \"project-context\": ajv.compile(projectContextSchema),\n};\n\nconst configValidator = ajv.compile(runtimeConfigSchema);\n\nexport function validateSpec(type: SpecType, data: Record<string, unknown>): ValidationResult {\n const validate = specValidators[type];\n if (!validate) {\n return { valid: false, errors: [{ message: `Unknown spec type: \"${type}\"` } as ErrorObject] };\n }\n const valid = validate(data);\n return { valid: !!valid, errors: valid ? null : (validate.errors ?? null) };\n}\n\nexport function validateConfig(data: Record<string, unknown>): ValidationResult {\n const valid = configValidator(data);\n return { valid: !!valid, errors: valid ? null : (configValidator.errors ?? null) };\n}\n","{\n \"$id\": \"base-spec\",\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"type\": \"object\",\n \"properties\": {\n \"id\": {\n \"type\": \"string\",\n \"minLength\": 1\n },\n \"type\": {\n \"type\": \"string\",\n \"enum\": [\n \"prd\",\n \"technical-design\",\n \"user-story\",\n \"test-plan\",\n \"adr\",\n \"api-contract\",\n \"epic\",\n \"quick-spec\",\n \"project-context\"\n ]\n },\n \"title\": {\n \"type\": \"string\",\n \"minLength\": 1\n },\n \"status\": {\n \"type\": \"string\",\n \"enum\": [\n \"draft\",\n \"review\",\n \"approved\",\n \"superseded\"\n ]\n },\n \"version\": {\n \"type\": \"string\"\n },\n \"created\": {\n \"type\": \"string\",\n \"format\": \"date\"\n },\n \"updated\": {\n \"type\": \"string\",\n \"format\": \"date\"\n },\n \"authors\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n },\n \"minItems\": 1\n },\n \"tags\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n },\n \"default\": []\n },\n \"references\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"id\": {\n \"type\": \"string\"\n },\n \"relationship\": {\n \"type\": \"string\",\n \"enum\": [\n \"implemented-by\",\n \"decomposed-into\",\n \"depends-on\",\n \"supersedes\",\n \"related-to\"\n ]\n }\n },\n \"required\": [\n \"id\",\n \"relationship\"\n ],\n \"additionalProperties\": false\n },\n \"default\": []\n },\n \"artifacts\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"path\": {\n \"type\": \"string\",\n \"minLength\": 1\n },\n \"exports\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\",\n \"minLength\": 1\n }\n }\n },\n \"required\": [\n \"path\"\n ],\n \"additionalProperties\": false\n },\n \"default\": []\n }\n },\n \"required\": [\n \"id\",\n \"type\",\n \"title\",\n \"status\",\n \"version\",\n \"created\",\n \"authors\"\n ],\n \"additionalProperties\": true\n}\n","{\n \"$id\": \"specdx-config\",\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"type\": \"object\",\n \"properties\": {\n \"version\": { \"type\": \"string\" },\n \"project\": {\n \"type\": \"object\",\n \"properties\": {\n \"name\": { \"type\": \"string\" },\n \"description\": { \"type\": \"string\" }\n },\n \"additionalProperties\": false\n },\n \"specs\": {\n \"type\": \"object\",\n \"additionalProperties\": {\n \"type\": \"object\",\n \"properties\": {\n \"path\": { \"type\": \"string\" },\n \"type\": { \"type\": \"string\", \"enum\": [\"prd\", \"technical-design\", \"user-story\", \"test-plan\", \"adr\", \"api-contract\", \"epic\", \"quick-spec\", \"project-context\"] },\n \"required\": { \"type\": \"boolean\", \"default\": false },\n \"requires\": { \"type\": \"array\", \"items\": { \"type\": \"string\" } },\n \"owner\": { \"type\": \"string\" }\n },\n \"required\": [\"path\", \"type\"],\n \"additionalProperties\": false\n }\n },\n \"lint\": {\n \"type\": \"object\",\n \"properties\": {\n \"extends\": { \"type\": \"string\" },\n \"rules\": { \"type\": \"object\" },\n \"ignore\": { \"type\": \"array\", \"items\": { \"type\": \"string\" } }\n },\n \"additionalProperties\": false\n },\n \"pack\": {\n \"type\": \"object\",\n \"properties\": {\n \"max_tokens\": { \"type\": \"integer\", \"minimum\": 1 },\n \"format\": { \"type\": \"string\", \"enum\": [\"xml\", \"markdown\", \"json\"] },\n \"compression\": {\n \"type\": \"object\",\n \"properties\": {\n \"strip_boilerplate\": { \"type\": \"boolean\" },\n \"stable_days\": { \"type\": \"integer\", \"minimum\": 0 },\n \"collapse_resolved_adrs\": { \"type\": \"boolean\" }\n },\n \"additionalProperties\": false\n },\n \"boilerplate_sections\": {\n \"type\": \"array\",\n \"items\": { \"type\": \"string\" }\n }\n },\n \"additionalProperties\": false\n },\n \"diff\": {\n \"type\": \"object\",\n \"properties\": {\n \"baseline_ref\": { \"type\": \"string\", \"default\": \"main\" },\n \"staleness_threshold_days\": { \"type\": \"integer\", \"minimum\": 1, \"default\": 14 },\n \"ignore_paths\": { \"type\": \"array\", \"items\": { \"type\": \"string\" } }\n },\n \"additionalProperties\": false\n },\n \"ci\": {\n \"type\": \"object\",\n \"properties\": {\n \"block_on\": {\n \"type\": \"array\",\n \"items\": { \"type\": \"string\", \"enum\": [\"error\", \"warn\", \"info\"] }\n },\n \"post_comment\": { \"type\": \"boolean\", \"default\": true },\n \"update_badge\": { \"type\": \"boolean\", \"default\": true },\n \"trigger_paths\": {\n \"type\": \"array\",\n \"items\": { \"type\": \"string\" }\n }\n },\n \"additionalProperties\": false\n },\n \"check\": {\n \"type\": \"object\",\n \"properties\": {\n \"framework\": {\n \"type\": \"string\",\n \"enum\": [\"auto\", \"express\", \"hono\", \"nextjs\"]\n },\n \"routes_dir\": { \"type\": \"string\" },\n \"app_dir\": { \"type\": \"string\" },\n \"types_dir\": { \"type\": \"string\" },\n \"tests_dir\": { \"type\": \"string\" },\n \"ignore\": {\n \"type\": \"array\",\n \"items\": { \"type\": \"string\" }\n }\n },\n \"additionalProperties\": false\n },\n \"agents\": {\n \"type\": \"object\",\n \"properties\": {\n \"paths\": { \"type\": \"array\", \"items\": { \"type\": \"string\" } },\n \"max_tokens\": { \"type\": \"integer\", \"minimum\": 1 },\n \"rules\": { \"type\": \"object\" }\n },\n \"additionalProperties\": false\n }\n },\n \"required\": [\"version\", \"specs\"],\n \"additionalProperties\": false\n}\n","{\n \"$id\": \"prd\",\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"allOf\": [\n { \"$ref\": \"base-spec\" },\n { \"type\": \"object\", \"properties\": { \"type\": { \"const\": \"prd\" } }, \"required\": [\"type\"] }\n ]\n}\n","{\n \"$id\": \"technical-design\",\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"allOf\": [\n { \"$ref\": \"base-spec\" },\n { \"type\": \"object\", \"properties\": { \"type\": { \"const\": \"technical-design\" } }, \"required\": [\"type\"] }\n ]\n}\n","{\n \"$id\": \"user-story\",\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"allOf\": [\n { \"$ref\": \"base-spec\" },\n {\n \"type\": \"object\",\n \"properties\": {\n \"type\": { \"const\": \"user-story\" },\n \"story_id\": { \"type\": \"string\", \"minLength\": 1 },\n \"priority\": { \"type\": \"string\", \"enum\": [\"critical\", \"high\", \"medium\", \"low\"] },\n \"estimate\": { \"type\": \"string\" }\n },\n \"required\": [\"type\", \"story_id\", \"priority\", \"estimate\"]\n }\n ]\n}\n","{\n \"$id\": \"test-plan\",\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"allOf\": [\n { \"$ref\": \"base-spec\" },\n { \"type\": \"object\", \"properties\": { \"type\": { \"const\": \"test-plan\" } }, \"required\": [\"type\"] }\n ]\n}\n","{\n \"$id\": \"adr\",\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"allOf\": [\n { \"$ref\": \"base-spec\" },\n { \"type\": \"object\", \"properties\": { \"type\": { \"const\": \"adr\" } }, \"required\": [\"type\"] }\n ]\n}\n","{\n \"$id\": \"api-contract\",\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"allOf\": [\n { \"$ref\": \"base-spec\" },\n { \"type\": \"object\", \"properties\": { \"type\": { \"const\": \"api-contract\" } }, \"required\": [\"type\"] }\n ]\n}\n","{\n \"$id\": \"epic\",\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"allOf\": [\n { \"$ref\": \"base-spec\" },\n {\n \"type\": \"object\",\n \"properties\": {\n \"type\": { \"const\": \"epic\" },\n \"epic_id\": { \"type\": \"string\", \"minLength\": 1 },\n \"priority\": { \"type\": \"string\", \"enum\": [\"critical\", \"high\", \"medium\", \"low\"] }\n },\n \"required\": [\"type\", \"epic_id\", \"priority\"]\n }\n ]\n}\n","{\n \"$id\": \"quick-spec\",\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"allOf\": [\n { \"$ref\": \"base-spec\" },\n {\n \"type\": \"object\",\n \"properties\": {\n \"type\": { \"const\": \"quick-spec\" }\n },\n \"required\": [\"type\"]\n }\n ]\n}\n","{\n \"$id\": \"project-context\",\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"allOf\": [\n { \"$ref\": \"base-spec\" },\n {\n \"type\": \"object\",\n \"properties\": {\n \"type\": { \"const\": \"project-context\" }\n },\n \"required\": [\"type\"]\n }\n ]\n}\n"],"mappings":";AAQO,IAAM,2BAA2B;AAEjC,IAAM,aAAa;EACxB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AA6BK,IAAM,2BAET;EACF,cAAc;EACd,kBAAkB;;;;AClDb,IAAM,oBAAgD;EAC3D,KAAK,CAAC,qBAAqB,SAAS,aAAa,YAAY,kBAAkB;EAC/E,oBAAoB;IAClB;IACA;IACA;IACA;IACA;IACA;IACA;;EAEF,cAAc,CAAC,eAAe,uBAAuB,gBAAgB,OAAO;EAC5E,aAAa,CAAC,SAAS,cAAc,mBAAmB,YAAY;EACpE,KAAK,CAAC,WAAW,YAAY,UAAU,cAAc;EACrD,gBAAgB,CAAC,aAAa,4BAA4B,QAAQ,aAAa;EAC/E,MAAM,CAAC,YAAY,WAAW,uBAAuB,cAAc;EACnE,cAAc,CAAC,UAAU,cAAc,OAAO;EAC9C,mBAAmB,CAAC,oBAAoB,iCAAiC,iBAAiB;;;;ACnB5F,SAAS,OAAO,gBAAkC;;;ACAlD;AAAA,EACE,KAAO;AAAA,EACP,SAAW;AAAA,EACX,MAAQ;AAAA,EACR,YAAc;AAAA,IACZ,IAAM;AAAA,MACJ,MAAQ;AAAA,MACR,WAAa;AAAA,IACf;AAAA,IACA,MAAQ;AAAA,MACN,MAAQ;AAAA,MACR,MAAQ;AAAA,QACN;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,Q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cAAc,IAAI,QAAQ,kBAAe;EACzC,aAAa,IAAI,QAAQ,iBAAc;EACvC,KAAK,IAAI,QAAQ,WAAS;EAC1B,gBAAgB,IAAI,QAAQ,oBAAiB;EAC7C,MAAM,IAAI,QAAQ,YAAU;EAC5B,cAAc,IAAI,QAAQ,kBAAe;EACzC,mBAAmB,IAAI,QAAQ,uBAAoB;;AAGrD,IAAM,kBAAkB,IAAI,QAAQ,mBAAmB;AAEjD,SAAU,aAAa,MAAgB,MAA6B;AACxE,QAAM,WAAW,eAAe,IAAI;AACpC,MAAI,CAAC,UAAU;AACb,WAAO,EAAE,OAAO,OAAO,QAAQ,CAAC,EAAE,SAAS,uBAAuB,IAAI,IAAG,CAAiB,EAAC;EAC7F;AACA,QAAM,QAAQ,SAAS,IAAI;AAC3B,SAAO,EAAE,OAAO,CAAC,CAAC,OAAO,QAAQ,QAAQ,OAAQ,SAAS,UAAU,KAAK;AAC3E;AAEM,SAAU,eAAe,MAA6B;AAC1D,QAAM,QAAQ,gBAAgB,IAAI;AAClC,SAAO,EAAE,OAAO,CAAC,CAAC,OAAO,QAAQ,QAAQ,OAAQ,gBAAgB,UAAU,KAAK;AAClF;","names":[]}
@@ -1,10 +1,11 @@
1
1
  import {
2
2
  buildRelationResolver,
3
+ countTokens,
3
4
  resolveGlob
4
- } from "./chunk-SNQNQ2MP.js";
5
+ } from "./chunk-BP3SB35W.js";
5
6
  import {
6
7
  REQUIRED_SECTIONS
7
- } from "./chunk-HCJDCS26.js";
8
+ } from "./chunk-XRWLPU24.js";
8
9
 
9
10
  // ../lint/dist/engine.js
10
11
  function createLintEngine(options) {
@@ -825,11 +826,321 @@ async function resolveLintConfig({ config, preset, configDir }) {
825
826
  return { rules: [...byId.values()], ignore };
826
827
  }
827
828
 
829
+ // ../lint/dist/agents/discover.js
830
+ import { readFile } from "fs/promises";
831
+ import { relative } from "path";
832
+ var DEFAULT_AGENT_PATHS = ["AGENTS.md", "CLAUDE.md"];
833
+ var DEFAULT_MAX_TOKENS = 8e3;
834
+ async function discoverAgentFiles(patterns, configDir) {
835
+ const seen = /* @__PURE__ */ new Set();
836
+ const files = [];
837
+ for (const pattern of patterns) {
838
+ for (const filePath of await resolveGlob(pattern, configDir)) {
839
+ if (seen.has(filePath))
840
+ continue;
841
+ seen.add(filePath);
842
+ const content = await readFile(filePath, "utf8");
843
+ files.push({
844
+ filePath,
845
+ relativePath: relative(configDir, filePath),
846
+ content,
847
+ lines: content.split("\n"),
848
+ tokens: countTokens(content)
849
+ });
850
+ }
851
+ }
852
+ return files.sort((a, b) => a.relativePath.localeCompare(b.relativePath));
853
+ }
854
+
855
+ // ../lint/dist/agents/rules/structure.js
856
+ var structureRule = {
857
+ id: "agents/structure",
858
+ description: "Agent instruction files should have content and be organised under headings",
859
+ severity: "warn",
860
+ run(context) {
861
+ const { file } = context;
862
+ const diagnostics = [];
863
+ if (file.content.trim() === "") {
864
+ diagnostics.push({
865
+ ruleId: "agents/structure",
866
+ severity: "warn",
867
+ message: `${file.relativePath} is empty. An empty instruction file steers nothing \u2014 delete it or write it.`,
868
+ filePath: file.filePath
869
+ });
870
+ return { diagnostics };
871
+ }
872
+ const headings = file.lines.filter((line) => /^#{1,6}\s+\S/.test(line));
873
+ if (headings.length === 0) {
874
+ diagnostics.push({
875
+ ruleId: "agents/structure",
876
+ severity: "warn",
877
+ message: `${file.relativePath} has no headings, so it is one undifferentiated block. Nothing can be referenced, revised, or removed in isolation.`,
878
+ filePath: file.filePath
879
+ });
880
+ }
881
+ return { diagnostics };
882
+ }
883
+ };
884
+
885
+ // ../lint/dist/agents/rules/stale-references.js
886
+ var PATH_SHAPED = /^(?:[\w.@-]+\/)+[\w.-]+$|^[\w.-]+\.(?:ts|tsx|js|jsx|mjs|cjs|json|md|ya?ml|toml|sh|py|rb|rs|go|java|css|html)$/;
887
+ function isNotAFileClaim(candidate) {
888
+ return candidate.includes("*") || // a glob describes a set, not a file
889
+ candidate.includes("://") || // a URL
890
+ candidate.startsWith("http") || candidate.startsWith("@") || // an npm scope: @specdx/core
891
+ candidate.startsWith("~") || // a home-relative path outside the repo
892
+ candidate.startsWith("/") || // an absolute path outside the repo
893
+ /^[A-Z_]+=/.test(candidate);
894
+ }
895
+ function normalise(candidate) {
896
+ return candidate.replace(/^\.\//, "").replace(/[.,;:)]+$/, "");
897
+ }
898
+ function fencedLines(lines) {
899
+ const fenced = /* @__PURE__ */ new Set();
900
+ let fence;
901
+ lines.forEach((line, index) => {
902
+ const match = /^\s*(`{3,}|~{3,})/.exec(line);
903
+ if (match) {
904
+ if (fence === void 0) {
905
+ fence = match[1];
906
+ fenced.add(index);
907
+ return;
908
+ }
909
+ if (match[1][0] === fence[0])
910
+ fence = void 0;
911
+ fenced.add(index);
912
+ return;
913
+ }
914
+ if (fence !== void 0)
915
+ fenced.add(index);
916
+ });
917
+ return fenced;
918
+ }
919
+ function extractReferences(lines) {
920
+ const skip = fencedLines(lines);
921
+ const found = [];
922
+ const seen = /* @__PURE__ */ new Set();
923
+ lines.forEach((line, index) => {
924
+ if (skip.has(index))
925
+ return;
926
+ const candidates = [];
927
+ for (const match of line.matchAll(/`([^`\n]+)`/g))
928
+ candidates.push(match[1]);
929
+ for (const match of line.matchAll(/\]\((?!https?:|#)([^)\s]+)\)/g))
930
+ candidates.push(match[1]);
931
+ for (const raw of candidates) {
932
+ const candidate = normalise(raw.trim());
933
+ if (!candidate || isNotAFileClaim(candidate))
934
+ continue;
935
+ if (!PATH_SHAPED.test(candidate))
936
+ continue;
937
+ if (seen.has(candidate))
938
+ continue;
939
+ seen.add(candidate);
940
+ found.push({ path: candidate, line: index + 1 });
941
+ }
942
+ });
943
+ return found;
944
+ }
945
+ var staleReferencesRule = {
946
+ id: "agents/stale-references",
947
+ description: "Paths named by an agent instruction file must exist",
948
+ severity: "warn",
949
+ run(context) {
950
+ const { file, exists } = context;
951
+ const references = extractReferences(file.lines);
952
+ if (references.length === 0) {
953
+ return {
954
+ diagnostics: [],
955
+ assessed: false,
956
+ notAssessedReason: `${file.relativePath} names no file paths, so none were checked for staleness.`
957
+ };
958
+ }
959
+ return {
960
+ diagnostics: references.filter((reference) => !exists(reference.path)).map((reference) => ({
961
+ ruleId: "agents/stale-references",
962
+ severity: this.severity,
963
+ message: `${file.relativePath} refers to "${reference.path}", which does not exist. An agent told to look there will not find it.`,
964
+ filePath: file.filePath,
965
+ line: reference.line
966
+ }))
967
+ };
968
+ }
969
+ };
970
+
971
+ // ../lint/dist/agents/rules/size-budget.js
972
+ var sizeBudgetRule = {
973
+ id: "agents/size-budget",
974
+ description: "Agent instruction files should fit a token budget",
975
+ severity: "warn",
976
+ run(context) {
977
+ const { file, maxTokens } = context;
978
+ if (file.tokens <= maxTokens)
979
+ return { diagnostics: [] };
980
+ const over = file.tokens - maxTokens;
981
+ const percent = Math.round(over / maxTokens * 100);
982
+ return {
983
+ diagnostics: [
984
+ {
985
+ ruleId: "agents/size-budget",
986
+ severity: this.severity,
987
+ message: `${file.relativePath} is ${file.tokens} tokens, ${over} over the ${maxTokens} budget (${percent}% over). It is spending the context window it exists to protect.`,
988
+ filePath: file.filePath
989
+ }
990
+ ]
991
+ };
992
+ }
993
+ };
994
+
995
+ // ../lint/dist/agents/resolve-reference.js
996
+ import { readdirSync } from "fs";
997
+ import { join, sep } from "path";
998
+ var SKIP_DIRECTORIES = /* @__PURE__ */ new Set([
999
+ "node_modules",
1000
+ ".git",
1001
+ "dist",
1002
+ "build",
1003
+ "coverage",
1004
+ ".next",
1005
+ ".turbo",
1006
+ ".cache",
1007
+ "out"
1008
+ ]);
1009
+ var MAX_INDEXED_FILES = 2e4;
1010
+ function indexProjectFiles(configDir) {
1011
+ const found = [];
1012
+ const walk = (dir, prefix) => {
1013
+ if (found.length >= MAX_INDEXED_FILES)
1014
+ return;
1015
+ let entries;
1016
+ try {
1017
+ entries = readdirSync(dir, { withFileTypes: true });
1018
+ } catch {
1019
+ return;
1020
+ }
1021
+ for (const entry of entries) {
1022
+ if (found.length >= MAX_INDEXED_FILES)
1023
+ return;
1024
+ const relative2 = prefix ? `${prefix}/${entry.name}` : entry.name;
1025
+ if (entry.isDirectory()) {
1026
+ if (SKIP_DIRECTORIES.has(entry.name))
1027
+ continue;
1028
+ found.push(relative2);
1029
+ walk(join(dir, entry.name), relative2);
1030
+ } else {
1031
+ found.push(relative2);
1032
+ }
1033
+ }
1034
+ };
1035
+ walk(configDir, "");
1036
+ return found;
1037
+ }
1038
+ var PLACEHOLDER_STEMS = /* @__PURE__ */ new Set([
1039
+ "foo",
1040
+ "bar",
1041
+ "baz",
1042
+ "qux",
1043
+ "example",
1044
+ "your-app",
1045
+ "my-app",
1046
+ "some-file",
1047
+ "path"
1048
+ ]);
1049
+ function isPlaceholder(reference) {
1050
+ const base = reference.split("/").pop() ?? reference;
1051
+ const stem = base.split(".")[0] ?? base;
1052
+ return PLACEHOLDER_STEMS.has(stem.toLowerCase());
1053
+ }
1054
+ function createReferenceResolver(files) {
1055
+ const exact = new Set(files);
1056
+ const byLastSegment = /* @__PURE__ */ new Map();
1057
+ for (const file of files) {
1058
+ const last = file.split("/").pop();
1059
+ const bucket = byLastSegment.get(last);
1060
+ if (bucket)
1061
+ bucket.push(file);
1062
+ else
1063
+ byLastSegment.set(last, [file]);
1064
+ }
1065
+ return (reference) => {
1066
+ const normalised = reference.split(sep).join("/");
1067
+ if (exact.has(normalised))
1068
+ return true;
1069
+ if (isPlaceholder(normalised))
1070
+ return true;
1071
+ const last = normalised.split("/").pop();
1072
+ if (!last)
1073
+ return false;
1074
+ const candidates = byLastSegment.get(last);
1075
+ if (!candidates)
1076
+ return false;
1077
+ return candidates.some((candidate) => candidate === normalised || candidate.endsWith(`/${normalised}`));
1078
+ };
1079
+ }
1080
+
1081
+ // ../lint/dist/agents/index.js
1082
+ var AGENT_RULES = [structureRule, staleReferencesRule, sizeBudgetRule];
1083
+ var VALID_SEVERITIES = /* @__PURE__ */ new Set(["error", "warn", "info"]);
1084
+ var AgentConfigError = class extends Error {
1085
+ };
1086
+ function resolveAgentRules(overrides = {}) {
1087
+ const known = new Map(AGENT_RULES.map((rule) => [rule.id, rule]));
1088
+ for (const id of Object.keys(overrides)) {
1089
+ if (!known.has(id)) {
1090
+ throw new AgentConfigError(`Unknown agent rule "${id}" in agents.rules. Known rules: ${[...known.keys()].join(", ")}.`);
1091
+ }
1092
+ }
1093
+ const resolved = [];
1094
+ for (const rule of AGENT_RULES) {
1095
+ const override = overrides[rule.id];
1096
+ if (override === void 0) {
1097
+ resolved.push(rule);
1098
+ continue;
1099
+ }
1100
+ if (override === false || override === "off")
1101
+ continue;
1102
+ if (typeof override === "string" && VALID_SEVERITIES.has(override)) {
1103
+ resolved.push({ ...rule, severity: override });
1104
+ continue;
1105
+ }
1106
+ throw new AgentConfigError(`Invalid severity ${JSON.stringify(override)} for "${rule.id}". Use "error", "warn", "info", "off", or false.`);
1107
+ }
1108
+ return resolved;
1109
+ }
1110
+ async function lintAgentFiles(options) {
1111
+ const { config, configDir } = options;
1112
+ const agents = config.agents ?? {};
1113
+ const patterns = agents.paths ?? DEFAULT_AGENT_PATHS;
1114
+ const maxTokens = agents.max_tokens ?? DEFAULT_MAX_TOKENS;
1115
+ const rules = resolveAgentRules(agents.rules);
1116
+ const files = await discoverAgentFiles(patterns, configDir);
1117
+ const exists = options.exists ?? (files.length > 0 ? createReferenceResolver(indexProjectFiles(configDir)) : () => true);
1118
+ const diagnostics = [];
1119
+ for (const file of files) {
1120
+ for (const rule of rules) {
1121
+ const result = rule.run({ file, configDir, exists, maxTokens });
1122
+ for (const diagnostic of result.diagnostics) {
1123
+ diagnostics.push({ ...diagnostic, severity: rule.severity });
1124
+ }
1125
+ if (result.assessed === false) {
1126
+ diagnostics.push({
1127
+ ruleId: rule.id,
1128
+ severity: "info",
1129
+ message: result.notAssessedReason ?? `${rule.id} assessed nothing in ${file.relativePath}.`,
1130
+ filePath: file.filePath
1131
+ });
1132
+ }
1133
+ }
1134
+ }
1135
+ return { diagnostics, filesLinted: files.length, assessed: files.length > 0 };
1136
+ }
1137
+
828
1138
  export {
829
1139
  createLintEngine,
830
1140
  parseFeatures,
831
1141
  parseFeatureEntries,
832
1142
  uncoveredFeatures,
833
- resolveLintConfig
1143
+ resolveLintConfig,
1144
+ lintAgentFiles
834
1145
  };
835
- //# sourceMappingURL=chunk-LJTLNXGV.js.map
1146
+ //# sourceMappingURL=chunk-ZIODMXST.js.map