specdx 0.4.0-alpha.7 → 0.4.0-alpha.8

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 (59) hide show
  1. package/dist/{changelog-IP7PNCWG.js → changelog-FJIQBEBB.js} +4 -4
  2. package/dist/{check-UFMPBHJ4.js → check-ULQYDDRD.js} +8 -6
  3. package/dist/check-ULQYDDRD.js.map +1 -0
  4. package/dist/{chunk-RVVQKLNL.js → chunk-7JXW2GTJ.js} +107 -14
  5. package/dist/chunk-7JXW2GTJ.js.map +1 -0
  6. package/dist/{chunk-EMMWQV52.js → chunk-AKNPCB37.js} +2 -2
  7. package/dist/{chunk-KAWB5K44.js → chunk-DAZCOUVK.js} +2 -2
  8. package/dist/{chunk-LDV7UXZ7.js → chunk-IHTYAW7C.js} +2 -2
  9. package/dist/{chunk-UKSPVBYC.js → chunk-OTDEP6WZ.js} +106 -8
  10. package/dist/chunk-OTDEP6WZ.js.map +1 -0
  11. package/dist/{chunk-YYMQPWSZ.js → chunk-UZ2E6LX7.js} +2 -2
  12. package/dist/{diff-EJJSEI5Z.js → diff-ZN2YTGE2.js} +4 -4
  13. package/dist/dist-4MXKMRHE.js +15 -0
  14. package/dist/{dist-UAS5655D.js → dist-HKVTEPU5.js} +7 -7
  15. package/dist/{explain-NLWMVXFQ.js → explain-QBV3AESQ.js} +3 -3
  16. package/dist/{generate-ORC5WQ4Z.js → generate-7GNPT2WJ.js} +3 -3
  17. package/dist/{generate-story-RQ6L5C3O.js → generate-story-EFHGINHA.js} +3 -3
  18. package/dist/{generate-test-plan-7MDFBSQN.js → generate-test-plan-BO7444RG.js} +3 -3
  19. package/dist/{graph-CXFIP6ZA.js → graph-5XINV7PT.js} +3 -3
  20. package/dist/index.js +112 -14
  21. package/dist/index.js.map +1 -1
  22. package/dist/{lint-UW7DVZAS.js → lint-PGA7JFKM.js} +10 -5
  23. package/dist/lint-PGA7JFKM.js.map +1 -0
  24. package/dist/main.js +16 -16
  25. package/dist/main.js.map +1 -1
  26. package/dist/{mcp-56I3BENN.js → mcp-QTIA76DS.js} +2 -2
  27. package/dist/{migrate-S7PFFBYI.js → migrate-4KF6GHLO.js} +3 -3
  28. package/dist/{pack-2N5KF75X.js → pack-DSOODXAN.js} +4 -4
  29. package/dist/{ready-BHLNDART.js → ready-GTCDQOIC.js} +5 -5
  30. package/dist/skills/specdx-verify.md +9 -0
  31. package/dist/{status-R6MALIAF.js → status-C3YDBH2L.js} +5 -5
  32. package/dist/{update-S54E2Y4J.js → update-ULMSL5XZ.js} +4 -4
  33. package/dist/{validate-3ZDFA3MM.js → validate-E7F3Q5BE.js} +3 -3
  34. package/package.json +4 -4
  35. package/dist/check-UFMPBHJ4.js.map +0 -1
  36. package/dist/chunk-RVVQKLNL.js.map +0 -1
  37. package/dist/chunk-UKSPVBYC.js.map +0 -1
  38. package/dist/dist-U7CZLXM5.js +0 -11
  39. package/dist/lint-UW7DVZAS.js.map +0 -1
  40. /package/dist/{changelog-IP7PNCWG.js.map → changelog-FJIQBEBB.js.map} +0 -0
  41. /package/dist/{chunk-EMMWQV52.js.map → chunk-AKNPCB37.js.map} +0 -0
  42. /package/dist/{chunk-KAWB5K44.js.map → chunk-DAZCOUVK.js.map} +0 -0
  43. /package/dist/{chunk-LDV7UXZ7.js.map → chunk-IHTYAW7C.js.map} +0 -0
  44. /package/dist/{chunk-YYMQPWSZ.js.map → chunk-UZ2E6LX7.js.map} +0 -0
  45. /package/dist/{diff-EJJSEI5Z.js.map → diff-ZN2YTGE2.js.map} +0 -0
  46. /package/dist/{dist-U7CZLXM5.js.map → dist-4MXKMRHE.js.map} +0 -0
  47. /package/dist/{dist-UAS5655D.js.map → dist-HKVTEPU5.js.map} +0 -0
  48. /package/dist/{explain-NLWMVXFQ.js.map → explain-QBV3AESQ.js.map} +0 -0
  49. /package/dist/{generate-ORC5WQ4Z.js.map → generate-7GNPT2WJ.js.map} +0 -0
  50. /package/dist/{generate-story-RQ6L5C3O.js.map → generate-story-EFHGINHA.js.map} +0 -0
  51. /package/dist/{generate-test-plan-7MDFBSQN.js.map → generate-test-plan-BO7444RG.js.map} +0 -0
  52. /package/dist/{graph-CXFIP6ZA.js.map → graph-5XINV7PT.js.map} +0 -0
  53. /package/dist/{mcp-56I3BENN.js.map → mcp-QTIA76DS.js.map} +0 -0
  54. /package/dist/{migrate-S7PFFBYI.js.map → migrate-4KF6GHLO.js.map} +0 -0
  55. /package/dist/{pack-2N5KF75X.js.map → pack-DSOODXAN.js.map} +0 -0
  56. /package/dist/{ready-BHLNDART.js.map → ready-GTCDQOIC.js.map} +0 -0
  57. /package/dist/{status-R6MALIAF.js.map → status-C3YDBH2L.js.map} +0 -0
  58. /package/dist/{update-S54E2Y4J.js.map → update-ULMSL5XZ.js.map} +0 -0
  59. /package/dist/{validate-3ZDFA3MM.js.map → validate-E7F3Q5BE.js.map} +0 -0
@@ -2,11 +2,11 @@ import {
2
2
  DEFAULT_DIFF_CONFIG,
3
3
  DiffError,
4
4
  diffBetweenRefs
5
- } from "./chunk-YYMQPWSZ.js";
5
+ } from "./chunk-UZ2E6LX7.js";
6
6
  import {
7
7
  loadConfig
8
- } from "./chunk-LDV7UXZ7.js";
9
- import "./chunk-RVVQKLNL.js";
8
+ } from "./chunk-IHTYAW7C.js";
9
+ import "./chunk-7JXW2GTJ.js";
10
10
 
11
11
  // src/commands/changelog.ts
12
12
  import { defineCommand } from "citty";
@@ -90,4 +90,4 @@ export {
90
90
  changelog_default as default,
91
91
  runChangelog
92
92
  };
93
- //# sourceMappingURL=changelog-IP7PNCWG.js.map
93
+ //# sourceMappingURL=changelog-FJIQBEBB.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  runCheck
3
- } from "./chunk-UKSPVBYC.js";
3
+ } from "./chunk-OTDEP6WZ.js";
4
4
  import {
5
5
  sharedArgs
6
6
  } from "./chunk-GAM4MXPC.js";
@@ -9,8 +9,8 @@ import {
9
9
  loadConfig,
10
10
  parseSpec,
11
11
  resolveGlob
12
- } from "./chunk-LDV7UXZ7.js";
13
- import "./chunk-RVVQKLNL.js";
12
+ } from "./chunk-IHTYAW7C.js";
13
+ import "./chunk-7JXW2GTJ.js";
14
14
 
15
15
  // src/commands/check.ts
16
16
  import { defineCommand } from "citty";
@@ -49,7 +49,7 @@ var check_default = defineCommand({
49
49
  logger.debug(`Checking ${specs.length} specs...`);
50
50
  const result = await runCheck(specs, configDir, checkConfig);
51
51
  if (args.ai) {
52
- const { analyzeWithAi } = await import("./dist-U7CZLXM5.js");
52
+ const { analyzeWithAi } = await import("./dist-4MXKMRHE.js");
53
53
  const aiResult = await analyzeWithAi(result.findings, args.spec ?? "full suite check");
54
54
  if (args.format === "json") {
55
55
  console.log(JSON.stringify({ ...result, ai: aiResult }, null, 2));
@@ -93,7 +93,9 @@ var check_default = defineCommand({
93
93
  console.log(` Scanned: framework=${result.scanned.framework ?? "none detected"}`);
94
94
  console.log(` routes: ${fmt(result.scanned.codeRoutes)}`);
95
95
  console.log(` types: ${fmt(result.scanned.codeTypes)}`);
96
- console.log(` tests: ${fmt(result.scanned.codeTests)}
96
+ console.log(` tests: ${fmt(result.scanned.codeTests)}`);
97
+ const artifacts = result.scanned.artifacts === null ? "none declared" : `${result.scanned.artifacts} verified`;
98
+ console.log(` artifacts: ${artifacts}
97
99
  `);
98
100
  }
99
101
  for (const [category, stats] of Object.entries(result.score.byCategory)) {
@@ -130,4 +132,4 @@ var check_default = defineCommand({
130
132
  export {
131
133
  check_default as default
132
134
  };
133
- //# sourceMappingURL=check-UFMPBHJ4.js.map
135
+ //# sourceMappingURL=check-ULQYDDRD.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/commands/check.ts"],"sourcesContent":["import { defineCommand } from \"citty\";\nimport { loadConfig, parseSpec, resolveGlob, createLogger } from \"@specdx/core\";\nimport { runCheck } from \"@specdx/check\";\nimport type { ParsedSpec } from \"@specdx/core\";\nimport type { CheckConfig } from \"@specdx/check\";\nimport { sharedArgs } from \"../shared-args.js\";\n\nexport default defineCommand({\n meta: {\n name: \"check\",\n description:\n \"[experimental] Check spec-to-implementation drift. Exit codes: 0 ok, 1 errors found, 3 nothing checkable (coverage not assessed)\",\n },\n args: {\n ...sharedArgs,\n spec: { type: \"string\", description: \"Check a specific spec by ID\" },\n framework: { type: \"string\", description: \"Framework override: express, hono, nextjs\" },\n ai: {\n type: \"boolean\",\n description: \"[experimental] Use AI to assess findings (requires ANTHROPIC_API_KEY)\",\n },\n },\n async run({ args }) {\n const logger = createLogger({ quiet: args.quiet, verbose: args.verbose });\n const configDir = process.cwd();\n const config = await loadConfig(undefined, configDir);\n\n logger.debug(\"Loading specs...\");\n\n // Resolve and parse all specs\n const specs: ParsedSpec[] = [];\n for (const [, entry] of Object.entries(config.specs)) {\n const paths = await resolveGlob(entry.path, configDir);\n for (const p of paths) {\n const spec = await parseSpec(p);\n if (args.spec && spec.frontmatter.id !== args.spec) continue;\n specs.push(spec);\n }\n }\n\n const checkConfig: CheckConfig = {\n ...config.check,\n ...(args.framework ? { framework: args.framework as CheckConfig[\"framework\"] } : {}),\n };\n\n logger.debug(`Checking ${specs.length} specs...`);\n const result = await runCheck(specs, configDir, checkConfig);\n\n // AI analysis (opt-in)\n if (args.ai) {\n const { analyzeWithAi } = await import(\"@specdx/check\");\n const aiResult = await analyzeWithAi(result.findings, args.spec ?? \"full suite check\");\n\n if (args.format === \"json\") {\n console.log(JSON.stringify({ ...result, ai: aiResult }, null, 2));\n } else {\n console.log(`\\n sdx check --ai — ${result.score.overall}% coverage\\n`);\n console.log(` AI Assessment: ${aiResult.summary}\\n`);\n\n for (const assessment of aiResult.assessments) {\n const finding = result.findings[assessment.findingIndex];\n if (!finding) continue;\n const icon = assessment.isRealIssue ? \"✗\" : \"✓\";\n const label = assessment.isRealIssue ? \"REAL\" : \"FALSE POSITIVE\";\n console.log(` ${icon} [${label}] ${finding.expected}`);\n console.log(` ${assessment.reasoning}`);\n if (assessment.suggestedFix) {\n console.log(` Fix: ${assessment.suggestedFix}`);\n }\n }\n console.log();\n }\n\n if (aiResult.assessments.some((a) => a.isRealIssue)) {\n process.exit(1);\n }\n return;\n }\n\n if (args.format === \"json\") {\n console.log(JSON.stringify(result, null, 2));\n } else {\n // Pretty format\n const headline = result.score.assessed\n ? `${result.score.overall}% implementation coverage`\n : \"coverage not assessed — no checkable surfaces found\";\n console.log(`\\n sdx check — ${headline}\\n`);\n\n for (const note of result.notes) {\n console.log(` ⚠ ${note}`);\n }\n if (result.notes.length > 0) console.log();\n\n if (args.verbose) {\n const fmt = (n: number | null) => (n === null ? \"not scanned\" : `${n} found`);\n console.log(` Scanned: framework=${result.scanned.framework ?? \"none detected\"}`);\n console.log(` routes: ${fmt(result.scanned.codeRoutes)}`);\n console.log(` types: ${fmt(result.scanned.codeTypes)}`);\n console.log(` tests: ${fmt(result.scanned.codeTests)}`);\n const artifacts =\n result.scanned.artifacts === null\n ? \"none declared\"\n : `${result.scanned.artifacts} verified`;\n console.log(` artifacts: ${artifacts}\\n`);\n }\n\n for (const [category, stats] of Object.entries(result.score.byCategory)) {\n if (stats.total === 0) continue;\n console.log(` ${category} (${stats.matched}/${stats.total}):`);\n const categoryFindings = result.findings.filter(\n (f) => f.category === category.replace(/s$/, \"\"),\n );\n for (const f of categoryFindings) {\n const icon = f.type === \"extra\" ? \"ℹ\" : f.severity === \"error\" ? \"✗\" : \"⚠\";\n const detail = f.actual ? ` — ${f.actual}` : \"\";\n const suggestion = f.suggestion ? ` (${f.suggestion})` : \"\";\n console.log(` ${icon} ${f.expected}${detail}${suggestion}`);\n }\n if (categoryFindings.length === 0) {\n console.log(\" ✓ all matched\");\n }\n }\n\n const errors = result.findings.filter((f) => f.severity === \"error\").length;\n const warnings = result.findings.filter((f) => f.severity === \"warn\").length;\n const info = result.findings.filter((f) => f.severity === \"info\").length;\n console.log(`\\n ${errors} errors, ${warnings} warnings, ${info} info\\n`);\n }\n\n if (result.findings.some((f) => f.severity === \"error\")) {\n process.exit(1);\n }\n // Distinct ex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OAAO,CAAC,MAAM,EAAE,aAAa,MAAM,EAAE;AACtE,YAAM,OAAO,OAAO,SAAS,OAAO,CAAC,MAAM,EAAE,aAAa,MAAM,EAAE;AAClE,cAAQ,IAAI;AAAA,IAAO,MAAM,YAAY,QAAQ,cAAc,IAAI;AAAA,CAAS;AAAA,IAC1E;AAEA,QAAI,OAAO,SAAS,KAAK,CAAC,MAAM,EAAE,aAAa,OAAO,GAAG;AACvD,cAAQ,KAAK,CAAC;AAAA,IAChB;AAEA,QAAI,CAAC,OAAO,MAAM,UAAU;AAC1B,cAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF;AACF,CAAC;","names":[]}
@@ -41,30 +41,123 @@ var base_spec_default = {
41
41
  $schema: "http://json-schema.org/draft-07/schema#",
42
42
  type: "object",
43
43
  properties: {
44
- id: { type: "string", minLength: 1 },
45
- type: { type: "string", enum: ["prd", "technical-design", "user-story", "test-plan", "adr", "api-contract", "epic", "quick-spec", "project-context"] },
46
- title: { type: "string", minLength: 1 },
47
- status: { type: "string", enum: ["draft", "review", "approved", "superseded"] },
48
- version: { type: "string" },
49
- created: { type: "string", format: "date" },
50
- updated: { type: "string", format: "date" },
51
- authors: { type: "array", items: { type: "string" }, minItems: 1 },
52
- tags: { type: "array", items: { type: "string" }, default: [] },
44
+ id: {
45
+ type: "string",
46
+ minLength: 1
47
+ },
48
+ type: {
49
+ type: "string",
50
+ enum: [
51
+ "prd",
52
+ "technical-design",
53
+ "user-story",
54
+ "test-plan",
55
+ "adr",
56
+ "api-contract",
57
+ "epic",
58
+ "quick-spec",
59
+ "project-context"
60
+ ]
61
+ },
62
+ title: {
63
+ type: "string",
64
+ minLength: 1
65
+ },
66
+ status: {
67
+ type: "string",
68
+ enum: [
69
+ "draft",
70
+ "review",
71
+ "approved",
72
+ "superseded"
73
+ ]
74
+ },
75
+ version: {
76
+ type: "string"
77
+ },
78
+ created: {
79
+ type: "string",
80
+ format: "date"
81
+ },
82
+ updated: {
83
+ type: "string",
84
+ format: "date"
85
+ },
86
+ authors: {
87
+ type: "array",
88
+ items: {
89
+ type: "string"
90
+ },
91
+ minItems: 1
92
+ },
93
+ tags: {
94
+ type: "array",
95
+ items: {
96
+ type: "string"
97
+ },
98
+ default: []
99
+ },
53
100
  references: {
54
101
  type: "array",
55
102
  items: {
56
103
  type: "object",
57
104
  properties: {
58
- id: { type: "string" },
59
- relationship: { type: "string", enum: ["implemented-by", "decomposed-into", "depends-on", "supersedes", "related-to"] }
105
+ id: {
106
+ type: "string"
107
+ },
108
+ relationship: {
109
+ type: "string",
110
+ enum: [
111
+ "implemented-by",
112
+ "decomposed-into",
113
+ "depends-on",
114
+ "supersedes",
115
+ "related-to"
116
+ ]
117
+ }
118
+ },
119
+ required: [
120
+ "id",
121
+ "relationship"
122
+ ],
123
+ additionalProperties: false
124
+ },
125
+ default: []
126
+ },
127
+ artifacts: {
128
+ type: "array",
129
+ items: {
130
+ type: "object",
131
+ properties: {
132
+ path: {
133
+ type: "string",
134
+ minLength: 1
135
+ },
136
+ exports: {
137
+ type: "array",
138
+ items: {
139
+ type: "string",
140
+ minLength: 1
141
+ }
142
+ }
60
143
  },
61
- required: ["id", "relationship"],
144
+ required: [
145
+ "path"
146
+ ],
62
147
  additionalProperties: false
63
148
  },
64
149
  default: []
65
150
  }
66
151
  },
67
- required: ["id", "type", "title", "status", "version", "created", "authors"],
152
+ required: [
153
+ "id",
154
+ "type",
155
+ "title",
156
+ "status",
157
+ "version",
158
+ "created",
159
+ "authors"
160
+ ],
68
161
  additionalProperties: true
69
162
  };
70
163
 
@@ -336,4 +429,4 @@ export {
336
429
  validateSpec,
337
430
  validateConfig
338
431
  };
339
- //# sourceMappingURL=chunk-RVVQKLNL.js.map
432
+ //# sourceMappingURL=chunk-7JXW2GTJ.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":["export 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\nexport interface SpecReference {\n id: string;\n relationship: \"implemented-by\" | \"decomposed-into\" | \"depends-on\" | \"supersedes\" | \"related-to\";\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","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\": \"sdx-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 },\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":";AAAO,IAAM,aAAa;EACxB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;;ACPK,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,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AK,OAAO,CAAC,GAAG,UAAU;AAE/F,IAAM,MAAM,IAAI,SAAS,EAAE,WAAW,MAAM,QAAQ,KAAI,CAAE;AAC1D,WAAW,KAAK,CAAC,MAAM,CAAC;AACxB,IAAI,UAAU,qBAAqB;AAEnC,IAAM,iBAAiE;EACrE,KAAK,IAAI,QAAQ,WAAS;EAC1B,oBAAoB,IAAI,QAAQ,wBAAqB;EACrD,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,6 +1,6 @@
1
1
  import {
2
2
  countTokens
3
- } from "./chunk-LDV7UXZ7.js";
3
+ } from "./chunk-IHTYAW7C.js";
4
4
 
5
5
  // ../pack/dist/resolver.js
6
6
  var STOPWORDS = /* @__PURE__ */ new Set([
@@ -664,4 +664,4 @@ function pack(specs, options, packConfig, graph) {
664
664
  export {
665
665
  pack
666
666
  };
667
- //# sourceMappingURL=chunk-EMMWQV52.js.map
667
+ //# sourceMappingURL=chunk-AKNPCB37.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  REQUIRED_SECTIONS
3
- } from "./chunk-RVVQKLNL.js";
3
+ } from "./chunk-7JXW2GTJ.js";
4
4
 
5
5
  // ../lint/dist/engine.js
6
6
  function createLintEngine(options) {
@@ -493,4 +493,4 @@ export {
493
493
  createLintEngine,
494
494
  getPreset
495
495
  };
496
- //# sourceMappingURL=chunk-KAWB5K44.js.map
496
+ //# sourceMappingURL=chunk-DAZCOUVK.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  validateConfig,
3
3
  validateSpec
4
- } from "./chunk-RVVQKLNL.js";
4
+ } from "./chunk-7JXW2GTJ.js";
5
5
 
6
6
  // ../core/dist/config.js
7
7
  import { readFile } from "fs/promises";
@@ -347,4 +347,4 @@ export {
347
347
  resolveGlob,
348
348
  createLogger
349
349
  };
350
- //# sourceMappingURL=chunk-LDV7UXZ7.js.map
350
+ //# sourceMappingURL=chunk-IHTYAW7C.js.map
@@ -866,9 +866,95 @@ function matchTests(specCases, codeTests, specId) {
866
866
  return findings;
867
867
  }
868
868
 
869
+ // ../check/dist/artifacts.js
870
+ import { existsSync as existsSync7 } from "fs";
871
+ import { join as join8 } from "path";
872
+ function parseArtifacts(spec) {
873
+ const raw = spec.frontmatter.artifacts;
874
+ if (!Array.isArray(raw))
875
+ return [];
876
+ const out = [];
877
+ for (const item of raw) {
878
+ if (!item || typeof item !== "object")
879
+ continue;
880
+ const decl = item;
881
+ if (typeof decl.path !== "string" || decl.path.length === 0)
882
+ continue;
883
+ const exports = Array.isArray(decl.exports) ? decl.exports.filter((e) => typeof e === "string" && e.length > 0) : void 0;
884
+ out.push({ path: decl.path, exports });
885
+ }
886
+ return out;
887
+ }
888
+ async function getExportedNames(filePath) {
889
+ try {
890
+ const { Project } = await import("ts-morph");
891
+ const project = new Project({
892
+ skipAddingFilesFromTsConfig: true,
893
+ compilerOptions: { allowJs: true }
894
+ });
895
+ const sourceFile = project.addSourceFileAtPath(filePath);
896
+ return new Set(sourceFile.getExportedDeclarations().keys());
897
+ } catch {
898
+ return null;
899
+ }
900
+ }
901
+ async function checkArtifacts(specs, projectDir, tsMorphAvailable) {
902
+ const findings = [];
903
+ const notes = [];
904
+ let total = 0;
905
+ let skippedExports = 0;
906
+ for (const spec of specs) {
907
+ const specId = String(spec.frontmatter.id);
908
+ for (const artifact of parseArtifacts(spec)) {
909
+ total += 1;
910
+ const absolute = join8(projectDir, artifact.path);
911
+ if (!existsSync7(absolute)) {
912
+ findings.push({
913
+ type: "missing",
914
+ category: "artifact",
915
+ specId,
916
+ expected: `file "${artifact.path}"`,
917
+ severity: "error",
918
+ suggestion: `Create ${artifact.path} or update the artifacts list in ${specId}.`
919
+ });
920
+ continue;
921
+ }
922
+ if (!artifact.exports || artifact.exports.length === 0)
923
+ continue;
924
+ if (!tsMorphAvailable) {
925
+ skippedExports += artifact.exports.length;
926
+ continue;
927
+ }
928
+ const exported = await getExportedNames(absolute);
929
+ if (exported === null) {
930
+ skippedExports += artifact.exports.length;
931
+ continue;
932
+ }
933
+ for (const name of artifact.exports) {
934
+ total += 1;
935
+ if (!exported.has(name)) {
936
+ findings.push({
937
+ type: "missing",
938
+ category: "artifact",
939
+ specId,
940
+ codeLocation: { file: artifact.path, line: 1 },
941
+ expected: `export "${name}" from ${artifact.path}`,
942
+ severity: "error",
943
+ suggestion: `Export ${name} from ${artifact.path} or update the artifacts list in ${specId}.`
944
+ });
945
+ }
946
+ }
947
+ }
948
+ }
949
+ if (skippedExports > 0) {
950
+ notes.push(`artifact export checks skipped for ${skippedExports} export(s): ts-morph is not available or the file could not be parsed.`);
951
+ }
952
+ return { findings, total, checked: total, notes };
953
+ }
954
+
869
955
  // ../check/dist/score.js
870
956
  function computeScore(findings, totals) {
871
- const missingByCategory = { route: 0, type: 0, test: 0 };
957
+ const missingByCategory = { route: 0, type: 0, test: 0, artifact: 0 };
872
958
  for (const f of findings) {
873
959
  if (f.type === "missing" || f.type === "mismatch") {
874
960
  missingByCategory[f.category] = (missingByCategory[f.category] ?? 0) + 1;
@@ -877,7 +963,8 @@ function computeScore(findings, totals) {
877
963
  const categoryMap = {
878
964
  routes: { total: totals.routes, categoryKey: "route" },
879
965
  types: { total: totals.types, categoryKey: "type" },
880
- tests: { total: totals.tests, categoryKey: "test" }
966
+ tests: { total: totals.tests, categoryKey: "test" },
967
+ artifacts: { total: totals.artifacts, categoryKey: "artifact" }
881
968
  };
882
969
  const byCategory = {};
883
970
  let totalItems = 0;
@@ -898,7 +985,7 @@ function computeScore(findings, totals) {
898
985
 
899
986
  // ../check/dist/detect-framework.js
900
987
  import { readFile as readFile2 } from "fs/promises";
901
- import { join as join8 } from "path";
988
+ import { join as join9 } from "path";
902
989
  var FRAMEWORK_PACKAGES = [
903
990
  ["express", "express"],
904
991
  ["hono", "hono"],
@@ -907,7 +994,7 @@ var FRAMEWORK_PACKAGES = [
907
994
  async function detectFramework(projectDir) {
908
995
  let pkg;
909
996
  try {
910
- const content = await readFile2(join8(projectDir, "package.json"), "utf-8");
997
+ const content = await readFile2(join9(projectDir, "package.json"), "utf-8");
911
998
  pkg = JSON.parse(content);
912
999
  } catch {
913
1000
  return null;
@@ -973,15 +1060,24 @@ async function runCheck(specs, projectDir, config = {}) {
973
1060
  findings.push(...matchTests(specCases, codeTests, spec.frontmatter.id));
974
1061
  }
975
1062
  }
976
- const score = computeScore(findings, { routes: routeTotal, types: typeTotal, tests: testTotal });
1063
+ const artifactResult = await checkArtifacts(specs, projectDir, tsMorphAvailable);
1064
+ findings.push(...artifactResult.findings);
1065
+ notes.push(...artifactResult.notes);
1066
+ const score = computeScore(findings, {
1067
+ routes: routeTotal,
1068
+ types: typeTotal,
1069
+ tests: testTotal,
1070
+ artifacts: artifactResult.total
1071
+ });
977
1072
  const errors = findings.filter((f) => f.severity === "error").length;
978
1073
  const warnings = findings.filter((f) => f.severity === "warn").length;
979
- const summary = score.assessed ? `${score.overall}% implementation coverage \u2014 ${errors} errors, ${warnings} warnings` : "coverage not assessed \u2014 no checkable surfaces found (no spec'd routes, types, or test cases)";
1074
+ const summary = score.assessed ? `${score.overall}% implementation coverage \u2014 ${errors} errors, ${warnings} warnings` : "coverage not assessed \u2014 no checkable surfaces found (no spec'd routes, types, test cases, or declared artifacts)";
980
1075
  const scanned = {
981
1076
  framework: framework ?? null,
982
1077
  codeRoutes: codeRouteCount,
983
1078
  codeTypes: codeTypeCount,
984
- codeTests: codeTestCount
1079
+ codeTests: codeTestCount,
1080
+ artifacts: artifactResult.total > 0 ? artifactResult.checked : null
985
1081
  };
986
1082
  return { findings, score, summary, scanned, notes };
987
1083
  }
@@ -1057,8 +1153,10 @@ Only output the JSON array, no other text.`;
1057
1153
  }
1058
1154
 
1059
1155
  export {
1156
+ parseArtifacts,
1157
+ checkArtifacts,
1060
1158
  detectFramework,
1061
1159
  runCheck,
1062
1160
  analyzeWithAi
1063
1161
  };
1064
- //# sourceMappingURL=chunk-UKSPVBYC.js.map
1162
+ //# sourceMappingURL=chunk-OTDEP6WZ.js.map