@rasensio/aidlc 1.16.0 → 1.17.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 (209) hide show
  1. package/README.md +1 -0
  2. package/dist/cli.d.ts.map +1 -1
  3. package/dist/cli.js +4 -0
  4. package/dist/cli.js.map +1 -1
  5. package/dist/commands/compliance.d.ts +36 -0
  6. package/dist/commands/compliance.d.ts.map +1 -0
  7. package/dist/commands/compliance.js +275 -0
  8. package/dist/commands/compliance.js.map +1 -0
  9. package/dist/commands/constitution.d.ts +26 -0
  10. package/dist/commands/constitution.d.ts.map +1 -0
  11. package/dist/commands/constitution.js +145 -0
  12. package/dist/commands/constitution.js.map +1 -0
  13. package/dist/commands/cost.d.ts.map +1 -1
  14. package/dist/commands/cost.js +54 -35
  15. package/dist/commands/cost.js.map +1 -1
  16. package/dist/commands/doctor.js +7 -0
  17. package/dist/commands/doctor.js.map +1 -1
  18. package/dist/commands/gate.d.ts.map +1 -1
  19. package/dist/commands/gate.js +13 -0
  20. package/dist/commands/gate.js.map +1 -1
  21. package/dist/commands/init.d.ts.map +1 -1
  22. package/dist/commands/init.js +119 -10
  23. package/dist/commands/init.js.map +1 -1
  24. package/dist/commands/metrics.d.ts.map +1 -1
  25. package/dist/commands/metrics.js +6 -1
  26. package/dist/commands/metrics.js.map +1 -1
  27. package/dist/commands/review.d.ts +2 -27
  28. package/dist/commands/review.d.ts.map +1 -1
  29. package/dist/commands/review.js +10 -166
  30. package/dist/commands/review.js.map +1 -1
  31. package/dist/commands/status.d.ts.map +1 -1
  32. package/dist/commands/status.js +7 -0
  33. package/dist/commands/status.js.map +1 -1
  34. package/dist/commands/transition.d.ts.map +1 -1
  35. package/dist/commands/transition.js +24 -1
  36. package/dist/commands/transition.js.map +1 -1
  37. package/dist/compile/adapters/claude-code.d.ts.map +1 -1
  38. package/dist/compile/adapters/claude-code.js +2 -1
  39. package/dist/compile/adapters/claude-code.js.map +1 -1
  40. package/dist/compile/adapters/codex.d.ts +22 -1
  41. package/dist/compile/adapters/codex.d.ts.map +1 -1
  42. package/dist/compile/adapters/codex.js +61 -27
  43. package/dist/compile/adapters/codex.js.map +1 -1
  44. package/dist/compile/adapters/cursor.d.ts.map +1 -1
  45. package/dist/compile/adapters/cursor.js +2 -19
  46. package/dist/compile/adapters/cursor.js.map +1 -1
  47. package/dist/compile/adapters/kiro.d.ts.map +1 -1
  48. package/dist/compile/adapters/kiro.js +1 -19
  49. package/dist/compile/adapters/kiro.js.map +1 -1
  50. package/dist/compile/adapters/windsurf.d.ts.map +1 -1
  51. package/dist/compile/adapters/windsurf.js +2 -1
  52. package/dist/compile/adapters/windsurf.js.map +1 -1
  53. package/dist/compile/guidance-install.d.ts +16 -19
  54. package/dist/compile/guidance-install.d.ts.map +1 -1
  55. package/dist/compile/guidance-install.js +26 -111
  56. package/dist/compile/guidance-install.js.map +1 -1
  57. package/dist/compile/layer-install.d.ts +122 -0
  58. package/dist/compile/layer-install.d.ts.map +1 -0
  59. package/dist/compile/layer-install.js +195 -0
  60. package/dist/compile/layer-install.js.map +1 -0
  61. package/dist/compile/loaders.d.ts +14 -0
  62. package/dist/compile/loaders.d.ts.map +1 -1
  63. package/dist/compile/loaders.js +23 -18
  64. package/dist/compile/loaders.js.map +1 -1
  65. package/dist/compile/skill-format.d.ts +39 -0
  66. package/dist/compile/skill-format.d.ts.map +1 -0
  67. package/dist/compile/skill-format.js +50 -0
  68. package/dist/compile/skill-format.js.map +1 -0
  69. package/dist/compliance/check.d.ts +79 -0
  70. package/dist/compliance/check.d.ts.map +1 -0
  71. package/dist/compliance/check.js +224 -0
  72. package/dist/compliance/check.js.map +1 -0
  73. package/dist/compliance/config.d.ts +91 -0
  74. package/dist/compliance/config.d.ts.map +1 -0
  75. package/dist/compliance/config.js +173 -0
  76. package/dist/compliance/config.js.map +1 -0
  77. package/dist/compliance/findings.d.ts +70 -0
  78. package/dist/compliance/findings.d.ts.map +1 -0
  79. package/dist/compliance/findings.js +132 -0
  80. package/dist/compliance/findings.js.map +1 -0
  81. package/dist/compliance/gate-criterion.d.ts +87 -0
  82. package/dist/compliance/gate-criterion.d.ts.map +1 -0
  83. package/dist/compliance/gate-criterion.js +168 -0
  84. package/dist/compliance/gate-criterion.js.map +1 -0
  85. package/dist/compliance/install.d.ts +135 -0
  86. package/dist/compliance/install.d.ts.map +1 -0
  87. package/dist/compliance/install.js +291 -0
  88. package/dist/compliance/install.js.map +1 -0
  89. package/dist/compliance/report.d.ts +144 -0
  90. package/dist/compliance/report.d.ts.map +1 -0
  91. package/dist/compliance/report.js +347 -0
  92. package/dist/compliance/report.js.map +1 -0
  93. package/dist/compliance/resolver.d.ts +65 -0
  94. package/dist/compliance/resolver.d.ts.map +1 -0
  95. package/dist/compliance/resolver.js +176 -0
  96. package/dist/compliance/resolver.js.map +1 -0
  97. package/dist/compliance/schema.d.ts +74 -0
  98. package/dist/compliance/schema.d.ts.map +1 -0
  99. package/dist/compliance/schema.js +474 -0
  100. package/dist/compliance/schema.js.map +1 -0
  101. package/dist/compliance/types.d.ts +140 -0
  102. package/dist/compliance/types.d.ts.map +1 -0
  103. package/dist/compliance/types.js +29 -0
  104. package/dist/compliance/types.js.map +1 -0
  105. package/dist/constitution/check.d.ts +22 -0
  106. package/dist/constitution/check.d.ts.map +1 -0
  107. package/dist/constitution/check.js +89 -0
  108. package/dist/constitution/check.js.map +1 -0
  109. package/dist/constitution/docx.d.ts +51 -0
  110. package/dist/constitution/docx.d.ts.map +1 -0
  111. package/dist/constitution/docx.js +157 -0
  112. package/dist/constitution/docx.js.map +1 -0
  113. package/dist/constitution/entries.d.ts +27 -0
  114. package/dist/constitution/entries.d.ts.map +1 -0
  115. package/dist/constitution/entries.js +65 -0
  116. package/dist/constitution/entries.js.map +1 -0
  117. package/dist/constitution/extract.d.ts +34 -0
  118. package/dist/constitution/extract.d.ts.map +1 -0
  119. package/dist/constitution/extract.js +117 -0
  120. package/dist/constitution/extract.js.map +1 -0
  121. package/dist/constitution/snapshot.d.ts +47 -0
  122. package/dist/constitution/snapshot.d.ts.map +1 -0
  123. package/dist/constitution/snapshot.js +159 -0
  124. package/dist/constitution/snapshot.js.map +1 -0
  125. package/dist/constitution/statements.d.ts +37 -0
  126. package/dist/constitution/statements.d.ts.map +1 -0
  127. package/dist/constitution/statements.js +64 -0
  128. package/dist/constitution/statements.js.map +1 -0
  129. package/dist/constitution/types.d.ts +80 -0
  130. package/dist/constitution/types.d.ts.map +1 -0
  131. package/dist/constitution/types.js +9 -0
  132. package/dist/constitution/types.js.map +1 -0
  133. package/dist/core/gate.d.ts +10 -0
  134. package/dist/core/gate.d.ts.map +1 -1
  135. package/dist/core/gate.js.map +1 -1
  136. package/dist/core/paths.d.ts +48 -0
  137. package/dist/core/paths.d.ts.map +1 -0
  138. package/dist/core/paths.js +57 -0
  139. package/dist/core/paths.js.map +1 -0
  140. package/dist/core/types.d.ts +12 -1
  141. package/dist/core/types.d.ts.map +1 -1
  142. package/dist/cost/hooks/registry.d.ts +44 -0
  143. package/dist/cost/hooks/registry.d.ts.map +1 -0
  144. package/dist/cost/hooks/registry.js +66 -0
  145. package/dist/cost/hooks/registry.js.map +1 -0
  146. package/dist/cost/pin.d.ts +63 -0
  147. package/dist/cost/pin.d.ts.map +1 -0
  148. package/dist/cost/pin.js +95 -0
  149. package/dist/cost/pin.js.map +1 -0
  150. package/dist/cost/providers/claude-code.d.ts +9 -2
  151. package/dist/cost/providers/claude-code.d.ts.map +1 -1
  152. package/dist/cost/providers/claude-code.js +10 -5
  153. package/dist/cost/providers/claude-code.js.map +1 -1
  154. package/dist/cost/providers/codex.d.ts +107 -0
  155. package/dist/cost/providers/codex.d.ts.map +1 -0
  156. package/dist/cost/providers/codex.js +283 -0
  157. package/dist/cost/providers/codex.js.map +1 -0
  158. package/dist/cost/providers/index.d.ts.map +1 -1
  159. package/dist/cost/providers/index.js +6 -0
  160. package/dist/cost/providers/index.js.map +1 -1
  161. package/dist/cost/rates.d.ts.map +1 -1
  162. package/dist/cost/rates.js +14 -0
  163. package/dist/cost/rates.js.map +1 -1
  164. package/dist/cost/report.d.ts +23 -1
  165. package/dist/cost/report.d.ts.map +1 -1
  166. package/dist/cost/report.js +26 -5
  167. package/dist/cost/report.js.map +1 -1
  168. package/dist/cost/sessions.d.ts +10 -1
  169. package/dist/cost/sessions.d.ts.map +1 -1
  170. package/dist/cost/sessions.js +10 -2
  171. package/dist/cost/sessions.js.map +1 -1
  172. package/dist/cost/sync.d.ts.map +1 -1
  173. package/dist/cost/sync.js +190 -5
  174. package/dist/cost/sync.js.map +1 -1
  175. package/dist/doctor/migrations/compliance-pack-drift.d.ts +62 -0
  176. package/dist/doctor/migrations/compliance-pack-drift.d.ts.map +1 -0
  177. package/dist/doctor/migrations/compliance-pack-drift.js +255 -0
  178. package/dist/doctor/migrations/compliance-pack-drift.js.map +1 -0
  179. package/dist/doctor/migrations/index.d.ts.map +1 -1
  180. package/dist/doctor/migrations/index.js +11 -0
  181. package/dist/doctor/migrations/index.js.map +1 -1
  182. package/dist/doctor/migrations/legacy-cost-hooks.d.ts.map +1 -1
  183. package/dist/doctor/migrations/legacy-cost-hooks.js +7 -4
  184. package/dist/doctor/migrations/legacy-cost-hooks.js.map +1 -1
  185. package/dist/doctor/migrations/missing-cost-shim.d.ts.map +1 -1
  186. package/dist/doctor/migrations/missing-cost-shim.js +5 -4
  187. package/dist/doctor/migrations/missing-cost-shim.js.map +1 -1
  188. package/dist/doctor/migrations/outdated-cost-hooks.d.ts.map +1 -1
  189. package/dist/doctor/migrations/outdated-cost-hooks.js +7 -4
  190. package/dist/doctor/migrations/outdated-cost-hooks.js.map +1 -1
  191. package/dist/doctor/runner.js +14 -0
  192. package/dist/doctor/runner.js.map +1 -1
  193. package/dist/doctor/types.d.ts +35 -3
  194. package/dist/doctor/types.d.ts.map +1 -1
  195. package/dist/menu/roster.d.ts.map +1 -1
  196. package/dist/menu/roster.js +5 -0
  197. package/dist/menu/roster.js.map +1 -1
  198. package/dist/metrics/report.d.ts.map +1 -1
  199. package/dist/metrics/report.js +11 -2
  200. package/dist/metrics/report.js.map +1 -1
  201. package/dist/review/findings-parser.d.ts +92 -0
  202. package/dist/review/findings-parser.d.ts.map +1 -0
  203. package/dist/review/findings-parser.js +196 -0
  204. package/dist/review/findings-parser.js.map +1 -0
  205. package/dist/setup/setup-compute.d.ts +10 -15
  206. package/dist/setup/setup-compute.d.ts.map +1 -1
  207. package/dist/setup/setup-compute.js +39 -0
  208. package/dist/setup/setup-compute.js.map +1 -1
  209. package/package.json +2 -2
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Read a vision document and hand back plain text.
3
+ *
4
+ * The check order is load-bearing, not stylistic: **parse → bounds → existence →
5
+ * size → decompress**. Checking existence before bounds turns an out-of-bounds
6
+ * path into a "file not found" and makes the command an existence oracle for
7
+ * files outside the project — this repo has shipped that exact defect once
8
+ * (`cost-capture-noise`, 2026-08-22).
9
+ *
10
+ * Requirements: project-constitution/AC-1, project-constitution/AC-4,
11
+ * project-constitution/AC-5, project-constitution/AC-6
12
+ *
13
+ * @module
14
+ */
15
+ import type { ExtractResult } from './types.js';
16
+ /** Largest vision document accepted, before anything is read (AC-5). */
17
+ export declare const MAX_SOURCE_BYTES: number;
18
+ /** Largest single archive entry accepted, declared or actual (AC-5). */
19
+ export declare const MAX_INFLATED_BYTES: number;
20
+ /** Every extension `import` accepts, for the AC-4 message. */
21
+ export declare const SUPPORTED_EXTENSIONS: readonly [".docx", ".md", ".markdown", ".txt"];
22
+ /**
23
+ * Extract the text of a vision document.
24
+ *
25
+ * @param projectRoot - Absolute project root; the source must live inside it.
26
+ * @param rawPath - The path as the user typed it, absolute or relative to cwd.
27
+ */
28
+ export declare function extractVision(projectRoot: string, rawPath: string): ExtractResult;
29
+ /**
30
+ * The message an unsupported format gets. Says what is accepted and what to do
31
+ * about a PDF, because "unsupported" on its own leaves the user stuck (AC-4).
32
+ */
33
+ export declare function unsupportedFormatHelp(detail: string): string;
34
+ //# sourceMappingURL=extract.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extract.d.ts","sourceRoot":"","sources":["../../src/constitution/extract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAOH,OAAO,KAAK,EAAE,aAAa,EAAa,MAAM,YAAY,CAAC;AAE3D,wEAAwE;AACxE,eAAO,MAAM,gBAAgB,QAAmB,CAAC;AAEjD,wEAAwE;AACxE,eAAO,MAAM,kBAAkB,QAAmB,CAAC;AAKnD,8DAA8D;AAC9D,eAAO,MAAM,oBAAoB,gDAAiD,CAAC;AAEnF;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,aAAa,CA8EjF;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAO5D"}
@@ -0,0 +1,117 @@
1
+ /**
2
+ * Read a vision document and hand back plain text.
3
+ *
4
+ * The check order is load-bearing, not stylistic: **parse → bounds → existence →
5
+ * size → decompress**. Checking existence before bounds turns an out-of-bounds
6
+ * path into a "file not found" and makes the command an existence oracle for
7
+ * files outside the project — this repo has shipped that exact defect once
8
+ * (`cost-capture-noise`, 2026-08-22).
9
+ *
10
+ * Requirements: project-constitution/AC-1, project-constitution/AC-4,
11
+ * project-constitution/AC-5, project-constitution/AC-6
12
+ *
13
+ * @module
14
+ */
15
+ import { createHash } from 'node:crypto';
16
+ import { existsSync, readFileSync, statSync } from 'node:fs';
17
+ import { extname, relative, resolve } from 'node:path';
18
+ import { isWithin } from '../core/paths.js';
19
+ import { DOCX_MAIN_PART, ZipReadError, docxToText, readZipEntry } from './docx.js';
20
+ /** Largest vision document accepted, before anything is read (AC-5). */
21
+ export const MAX_SOURCE_BYTES = 25 * 1024 * 1024;
22
+ /** Largest single archive entry accepted, declared or actual (AC-5). */
23
+ export const MAX_INFLATED_BYTES = 10 * 1024 * 1024;
24
+ /** Extensions read directly as UTF-8 text. */
25
+ const TEXT_EXTENSIONS = new Set(['.md', '.markdown', '.txt']);
26
+ /** Every extension `import` accepts, for the AC-4 message. */
27
+ export const SUPPORTED_EXTENSIONS = ['.docx', '.md', '.markdown', '.txt'];
28
+ /**
29
+ * Extract the text of a vision document.
30
+ *
31
+ * @param projectRoot - Absolute project root; the source must live inside it.
32
+ * @param rawPath - The path as the user typed it, absolute or relative to cwd.
33
+ */
34
+ export function extractVision(projectRoot, rawPath) {
35
+ const absolute = resolve(rawPath);
36
+ // Bounds BEFORE existence — see the module docblock (AC-6).
37
+ if (!isWithin(projectRoot, absolute)) {
38
+ return {
39
+ ok: false,
40
+ reason: 'out-of-bounds',
41
+ detail: `${rawPath} resolves outside the project root ${projectRoot}`,
42
+ };
43
+ }
44
+ if (!existsSync(absolute)) {
45
+ return { ok: false, reason: 'missing', detail: `${rawPath} does not exist` };
46
+ }
47
+ const extension = extname(absolute).toLowerCase();
48
+ const isDocx = extension === '.docx';
49
+ if (!isDocx && !TEXT_EXTENSIONS.has(extension)) {
50
+ return {
51
+ ok: false,
52
+ reason: 'unsupported-format',
53
+ detail: `${extension === '' ? '(no extension)' : extension} is not supported`,
54
+ };
55
+ }
56
+ const size = statSync(absolute).size;
57
+ if (size > MAX_SOURCE_BYTES) {
58
+ return {
59
+ ok: false,
60
+ reason: 'too-large',
61
+ detail: `${rawPath} is ${size} bytes, over the ${MAX_SOURCE_BYTES}-byte limit`,
62
+ };
63
+ }
64
+ const bytes = readFileSync(absolute);
65
+ const sha256 = createHash('sha256').update(bytes).digest('hex');
66
+ const relativePath = relative(projectRoot, absolute);
67
+ if (!isDocx) {
68
+ return {
69
+ ok: true,
70
+ text: bytes.toString('utf8'),
71
+ extractor: 'text',
72
+ sha256,
73
+ relativePath,
74
+ };
75
+ }
76
+ let part;
77
+ try {
78
+ part = readZipEntry(bytes, DOCX_MAIN_PART, MAX_INFLATED_BYTES);
79
+ }
80
+ catch (err) {
81
+ if (err instanceof ZipReadError) {
82
+ return {
83
+ ok: false,
84
+ reason: err.code === 'entry-too-large' ? 'entry-too-large' : 'not-a-docx',
85
+ detail: err.message,
86
+ };
87
+ }
88
+ throw err;
89
+ }
90
+ if (part === null) {
91
+ return {
92
+ ok: false,
93
+ reason: 'not-a-docx',
94
+ detail: `${rawPath} is a ZIP archive but has no ${DOCX_MAIN_PART}`,
95
+ };
96
+ }
97
+ return {
98
+ ok: true,
99
+ text: docxToText(part.toString('utf8')),
100
+ extractor: 'docx',
101
+ sha256,
102
+ relativePath,
103
+ };
104
+ }
105
+ /**
106
+ * The message an unsupported format gets. Says what is accepted and what to do
107
+ * about a PDF, because "unsupported" on its own leaves the user stuck (AC-4).
108
+ */
109
+ export function unsupportedFormatHelp(detail) {
110
+ return [
111
+ `Cannot read this vision document: ${detail}.`,
112
+ `Supported: ${SUPPORTED_EXTENSIONS.join(', ')}.`,
113
+ 'For a PDF, Google Doc, or anything else: read it and save a markdown copy',
114
+ 'alongside it, then import that. The snapshot records whichever file you pass.',
115
+ ].join('\n');
116
+ }
117
+ //# sourceMappingURL=extract.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extract.js","sourceRoot":"","sources":["../../src/constitution/extract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAGnF,wEAAwE;AACxE,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAEjD,wEAAwE;AACxE,MAAM,CAAC,MAAM,kBAAkB,G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CAAC;IACJ,CAAC;IAED,OAAO;QACL,EAAE,EAAE,IAAI;QACR,IAAI,EAAE,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QACvC,SAAS,EAAE,MAA0B;QACrC,MAAM;QACN,YAAY;KACb,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAAc;IAClD,OAAO;QACL,qCAAqC,MAAM,GAAG;QAC9C,cAAc,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG;QAChD,2EAA2E;QAC3E,+EAA+E;KAChF,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * The vision snapshot: `.aidlc/context/vision-source.md`.
3
+ *
4
+ * What gets committed is the *extracted text*, never the `.docx` (design D8) —
5
+ * a binary is not reviewable in a diff, and the source document often should not
6
+ * be in the repository at all. `source_sha256` is the digest of the source bytes,
7
+ * which is how `check` notices the document was touched even when the text is
8
+ * unchanged.
9
+ *
10
+ * The file is rendered by hand rather than through a YAML serializer. A
11
+ * round-trip through `Document.toString()` reflows to whatever `lineWidth` is in
12
+ * force and rewrites lines it was only meant to preserve
13
+ * (`knowledge-rebuild-readonly`, 2026-09-02); rendering deterministically avoids
14
+ * the class. Reading uses the YAML parser, which does not have that problem.
15
+ *
16
+ * Requirements: project-constitution/AC-10, project-constitution/AC-11
17
+ *
18
+ * @module
19
+ */
20
+ import type { Snapshot } from './types.js';
21
+ /** Where the snapshot lives, relative to the project root. */
22
+ export declare const SNAPSHOT_RELATIVE: string;
23
+ export declare function snapshotPath(projectRoot: string): string;
24
+ /**
25
+ * Render the snapshot deterministically. Same input, same bytes, always — which
26
+ * is what lets `writeSnapshot` compare rather than guess (AC-11).
27
+ */
28
+ export declare function renderSnapshot(snapshot: Snapshot): string;
29
+ /** Read the snapshot, or null when it is absent or unparseable. */
30
+ export declare function readSnapshot(projectRoot: string): Snapshot | null;
31
+ /**
32
+ * Write the snapshot, but only when it would differ.
33
+ *
34
+ * Returns `'unchanged'` when the recorded source digest and the statement id set
35
+ * both match, leaving the file — `extracted_at` included — byte-identical. A
36
+ * re-import that finds nothing new must not produce a git diff (AC-11).
37
+ */
38
+ export declare function writeSnapshot(projectRoot: string, next: Snapshot): 'written' | 'unchanged';
39
+ /** Build a snapshot from freshly extracted text. */
40
+ export declare function buildSnapshot(input: {
41
+ relativePath: string;
42
+ sha256: string;
43
+ extractor: Snapshot['extractor'];
44
+ text: string;
45
+ now: Date;
46
+ }): Snapshot;
47
+ //# sourceMappingURL=snapshot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snapshot.d.ts","sourceRoot":"","sources":["../../src/constitution/snapshot.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAMH,OAAO,KAAK,EAAE,QAAQ,EAAa,MAAM,YAAY,CAAC;AAEtD,8DAA8D;AAC9D,eAAO,MAAM,iBAAiB,QAAgD,CAAC;AAK/E,wBAAgB,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAExD;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAuBzD;AAED,mEAAmE;AACnE,wBAAgB,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,CAmCjE;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,GAAG,SAAS,GAAG,WAAW,CAW1F;AAED,oDAAoD;AACpD,wBAAgB,aAAa,CAAC,KAAK,EAAE;IACnC,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAC;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,IAAI,CAAC;CACX,GAAG,QAAQ,CAQX"}
@@ -0,0 +1,159 @@
1
+ /**
2
+ * The vision snapshot: `.aidlc/context/vision-source.md`.
3
+ *
4
+ * What gets committed is the *extracted text*, never the `.docx` (design D8) —
5
+ * a binary is not reviewable in a diff, and the source document often should not
6
+ * be in the repository at all. `source_sha256` is the digest of the source bytes,
7
+ * which is how `check` notices the document was touched even when the text is
8
+ * unchanged.
9
+ *
10
+ * The file is rendered by hand rather than through a YAML serializer. A
11
+ * round-trip through `Document.toString()` reflows to whatever `lineWidth` is in
12
+ * force and rewrites lines it was only meant to preserve
13
+ * (`knowledge-rebuild-readonly`, 2026-09-02); rendering deterministically avoids
14
+ * the class. Reading uses the YAML parser, which does not have that problem.
15
+ *
16
+ * Requirements: project-constitution/AC-10, project-constitution/AC-11
17
+ *
18
+ * @module
19
+ */
20
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
21
+ import { dirname, join } from 'node:path';
22
+ import { parse as parseYaml } from 'yaml';
23
+ import { splitStatements } from './statements.js';
24
+ /** Where the snapshot lives, relative to the project root. */
25
+ export const SNAPSHOT_RELATIVE = join('.aidlc', 'context', 'vision-source.md');
26
+ /** Statement lines look like `- V-a1b2c3d4: text` (with an optional ×n suffix). */
27
+ const STATEMENT_RE = /^- (V-[0-9a-f]{8}): (.*?)(?: ×(\d+))?$/;
28
+ export function snapshotPath(projectRoot) {
29
+ return join(projectRoot, SNAPSHOT_RELATIVE);
30
+ }
31
+ /**
32
+ * Render the snapshot deterministically. Same input, same bytes, always — which
33
+ * is what lets `writeSnapshot` compare rather than guess (AC-11).
34
+ */
35
+ export function renderSnapshot(snapshot) {
36
+ const lines = [
37
+ '---',
38
+ `source_path: ${yamlScalar(snapshot.sourcePath)}`,
39
+ `source_sha256: ${snapshot.sourceSha256}`,
40
+ `extracted_at: ${snapshot.extractedAt}`,
41
+ `extractor: ${snapshot.extractor}`,
42
+ `statement_count: ${snapshot.statements.length}`,
43
+ '---',
44
+ '# Vision source (extracted)',
45
+ '',
46
+ 'Generated by `aidlc constitution import`. Each statement is identified by a hash',
47
+ 'of its own text, so inserting a paragraph never renumbers the others and editing',
48
+ 'one changes only its own id. Do not hand-edit: re-run the import instead.',
49
+ '',
50
+ '## Statements',
51
+ '',
52
+ ];
53
+ for (const statement of snapshot.statements) {
54
+ const suffix = statement.occurrences > 1 ? ` ×${statement.occurrences}` : '';
55
+ lines.push(`- ${statement.id}: ${statement.text}${suffix}`);
56
+ }
57
+ return lines.join('\n') + '\n';
58
+ }
59
+ /** Read the snapshot, or null when it is absent or unparseable. */
60
+ export function readSnapshot(projectRoot) {
61
+ const file = snapshotPath(projectRoot);
62
+ let raw;
63
+ try {
64
+ raw = readFileSync(file, 'utf8');
65
+ }
66
+ catch {
67
+ return null;
68
+ }
69
+ if (!raw.startsWith('---\n'))
70
+ return null;
71
+ const close = raw.indexOf('\n---\n', 4);
72
+ if (close === -1)
73
+ return null;
74
+ let data;
75
+ try {
76
+ const parsed = parseYaml(raw.slice(4, close + 1));
77
+ if (typeof parsed !== 'object' || parsed === null)
78
+ return null;
79
+ data = parsed;
80
+ }
81
+ catch {
82
+ return null;
83
+ }
84
+ const sourcePath = str(data['source_path']);
85
+ const sourceSha256 = str(data['source_sha256']);
86
+ const extractedAt = str(data['extracted_at']);
87
+ const extractor = str(data['extractor']);
88
+ if (sourcePath === null || sourceSha256 === null || extractedAt === null)
89
+ return null;
90
+ if (extractor !== 'docx' && extractor !== 'text')
91
+ return null;
92
+ return {
93
+ sourcePath,
94
+ sourceSha256,
95
+ extractedAt,
96
+ extractor,
97
+ statements: parseStatements(raw.slice(close + 5)),
98
+ };
99
+ }
100
+ /**
101
+ * Write the snapshot, but only when it would differ.
102
+ *
103
+ * Returns `'unchanged'` when the recorded source digest and the statement id set
104
+ * both match, leaving the file — `extracted_at` included — byte-identical. A
105
+ * re-import that finds nothing new must not produce a git diff (AC-11).
106
+ */
107
+ export function writeSnapshot(projectRoot, next) {
108
+ const file = snapshotPath(projectRoot);
109
+ const current = readSnapshot(projectRoot);
110
+ if (current !== null && current.sourceSha256 === next.sourceSha256 && sameIds(current, next)) {
111
+ return 'unchanged';
112
+ }
113
+ if (!existsSync(dirname(file)))
114
+ mkdirSync(dirname(file), { recursive: true });
115
+ writeFileSync(file, renderSnapshot(next), 'utf8');
116
+ return 'written';
117
+ }
118
+ /** Build a snapshot from freshly extracted text. */
119
+ export function buildSnapshot(input) {
120
+ return {
121
+ sourcePath: input.relativePath,
122
+ sourceSha256: input.sha256,
123
+ extractedAt: input.now.toISOString(),
124
+ extractor: input.extractor,
125
+ statements: splitStatements(input.text),
126
+ };
127
+ }
128
+ function sameIds(a, b) {
129
+ if (a.statements.length !== b.statements.length)
130
+ return false;
131
+ const seen = new Set(a.statements.map((s) => s.id));
132
+ return b.statements.every((s) => seen.has(s.id));
133
+ }
134
+ function parseStatements(body) {
135
+ const statements = [];
136
+ for (const line of body.split('\n')) {
137
+ const match = STATEMENT_RE.exec(line);
138
+ if (!match)
139
+ continue;
140
+ statements.push({
141
+ id: match[1],
142
+ text: match[2],
143
+ occurrences: match[3] === undefined ? 1 : Number(match[3]),
144
+ });
145
+ }
146
+ return statements;
147
+ }
148
+ function str(value) {
149
+ return typeof value === 'string' && value.length > 0 ? value : null;
150
+ }
151
+ /**
152
+ * Quote a scalar only when a plain one would not round-trip. A path containing a
153
+ * colon or leading indicator character is the case that matters — this project
154
+ * lost five roadmap items to an unquoted backtick-initial title.
155
+ */
156
+ function yamlScalar(value) {
157
+ return /^[A-Za-z0-9._/-]+$/.test(value) ? value : JSON.stringify(value);
158
+ }
159
+ //# sourceMappingURL=snapshot.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snapshot.js","sourceRoot":"","sources":["../../src/constitution/snapshot.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,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C,SAAS,CAAC,KAAK,CAAC,CAAC;AAC1E,CAAC"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Content-addressed vision statements (design D1).
3
+ *
4
+ * A statement's id is derived from its own text, never from its position. That
5
+ * one choice is what makes a re-run usable: inserting a paragraph leaves every
6
+ * other id alone, editing one changes only its own id, and drift reduces to a
7
+ * set difference. Positional numbering would renumber everything below an
8
+ * insertion and invalidate every citation in `constitution.md`.
9
+ *
10
+ * Requirements: project-constitution/AC-7, project-constitution/AC-8,
11
+ * project-constitution/AC-9
12
+ *
13
+ * @module
14
+ */
15
+ import type { Statement } from './types.js';
16
+ /**
17
+ * Collapse a text block to its comparable form: trimmed, every run of
18
+ * whitespace (including newlines inside a wrapped paragraph) one space.
19
+ *
20
+ * This is what makes re-wrapping a paragraph in Word a no-op for its id.
21
+ */
22
+ export declare function normalize(block: string): string;
23
+ /** `V-` plus the first 8 hex characters of sha256 over the normalized text. */
24
+ export declare function statementId(normalized: string): string;
25
+ /**
26
+ * Split extracted text into statements.
27
+ *
28
+ * A statement is a block separated by one or more blank lines — which is what a
29
+ * paragraph, a heading and a list item each become after extraction. Identical
30
+ * normalized blocks collapse to one statement carrying an occurrence count, so
31
+ * a repeated heading cannot produce two entries sharing an id (AC-9).
32
+ *
33
+ * Order follows first appearance in the source, so the snapshot reads like the
34
+ * document even though ids do not depend on order.
35
+ */
36
+ export declare function splitStatements(text: string): Statement[];
37
+ //# sourceMappingURL=statements.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"statements.d.ts","sourceRoot":"","sources":["../../src/constitution/statements.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAK5C;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED,+EAA+E;AAC/E,wBAAgB,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAGtD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,CAqBzD"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Content-addressed vision statements (design D1).
3
+ *
4
+ * A statement's id is derived from its own text, never from its position. That
5
+ * one choice is what makes a re-run usable: inserting a paragraph leaves every
6
+ * other id alone, editing one changes only its own id, and drift reduces to a
7
+ * set difference. Positional numbering would renumber everything below an
8
+ * insertion and invalidate every citation in `constitution.md`.
9
+ *
10
+ * Requirements: project-constitution/AC-7, project-constitution/AC-8,
11
+ * project-constitution/AC-9
12
+ *
13
+ * @module
14
+ */
15
+ import { createHash } from 'node:crypto';
16
+ /** Hex characters of the digest kept in an id. */
17
+ const ID_HEX_LENGTH = 8;
18
+ /**
19
+ * Collapse a text block to its comparable form: trimmed, every run of
20
+ * whitespace (including newlines inside a wrapped paragraph) one space.
21
+ *
22
+ * This is what makes re-wrapping a paragraph in Word a no-op for its id.
23
+ */
24
+ export function normalize(block) {
25
+ return block.replace(/\s+/g, ' ').trim();
26
+ }
27
+ /** `V-` plus the first 8 hex characters of sha256 over the normalized text. */
28
+ export function statementId(normalized) {
29
+ const digest = createHash('sha256').update(normalized, 'utf8').digest('hex');
30
+ return `V-${digest.slice(0, ID_HEX_LENGTH)}`;
31
+ }
32
+ /**
33
+ * Split extracted text into statements.
34
+ *
35
+ * A statement is a block separated by one or more blank lines — which is what a
36
+ * paragraph, a heading and a list item each become after extraction. Identical
37
+ * normalized blocks collapse to one statement carrying an occurrence count, so
38
+ * a repeated heading cannot produce two entries sharing an id (AC-9).
39
+ *
40
+ * Order follows first appearance in the source, so the snapshot reads like the
41
+ * document even though ids do not depend on order.
42
+ */
43
+ export function splitStatements(text) {
44
+ const seen = new Map();
45
+ const order = [];
46
+ for (const raw of text.split(/\n[ \t]*\n+/)) {
47
+ const normalized = normalize(raw);
48
+ if (normalized === '')
49
+ continue;
50
+ const id = statementId(normalized);
51
+ const existing = seen.get(id);
52
+ if (existing) {
53
+ existing.occurrences += 1;
54
+ continue;
55
+ }
56
+ seen.set(id, { text: normalized, occurrences: 1 });
57
+ order.push(id);
58
+ }
59
+ return order.map((id) => {
60
+ const found = seen.get(id);
61
+ return { id, text: found.text, occurrences: found.occurrences };
62
+ });
63
+ }
64
+ //# sourceMappingURL=statements.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"statements.js","sourceRoot":"","sources":["../../src/constitution/statements.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC,kDAAkD;AAClD,MAAM,aAAa,GAAG,CAAC,CAAC;AAExB;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,KAAa;IACrC,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;AAC3C,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,WAAW,CAAC,UAAkB;IAC5C,MAAM,MAAM,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC7E,OAAO,KAAK,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,aAAa,CAAC,EAAE,CAAC;AAC/C,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,eAAe,CAAC,IAAY;IAC1C,MAAM,IAAI,GAAG,IAAI,GAAG,EAAiD,CAAC;IACtE,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE,CAAC;QAC5C,MAAM,UAAU,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC;QAClC,IAAI,UAAU,KAAK,EAAE;YAAE,SAAS;QAChC,MAAM,EAAE,GAAG,WAAW,CAAC,UAAU,CAAC,CAAC;QACnC,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAC9B,IAAI,QAAQ,EAAE,CAAC;YACb,QAAQ,CAAC,WAAW,IAAI,CAAC,CAAC;YAC1B,SAAS;QACX,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,CAAC,EAAE,CAAC,CAAC;QACnD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACjB,CAAC;IAED,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE;QACtB,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,CAAE,CAAC;QAC5B,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,WAAW,EAAE,KAAK,CAAC,WAAW,EAAE,CAAC;IAClE,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,80 @@
1
+ /**
2
+ * Shared types for the constitution module.
3
+ *
4
+ * Requirements: project-constitution/AC-7, project-constitution/AC-10
5
+ *
6
+ * @module
7
+ */
8
+ /** One vision statement, identified by its own content (design D1). */
9
+ export interface Statement {
10
+ /** `V-` followed by the first 8 hex characters of sha256(normalized text). */
11
+ readonly id: string;
12
+ /** The statement as extracted, normalized (trimmed, whitespace collapsed). */
13
+ readonly text: string;
14
+ /** How many times this exact normalized text appeared in the source (AC-9). */
15
+ readonly occurrences: number;
16
+ }
17
+ /** The committed record of what the vision document said when last imported. */
18
+ export interface Snapshot {
19
+ /** Source location, relative to the project root so the file stays portable. */
20
+ readonly sourcePath: string;
21
+ /** sha256 of the source *bytes*, not of the extracted text. */
22
+ readonly sourceSha256: string;
23
+ /** ISO 8601 UTC. */
24
+ readonly extractedAt: string;
25
+ /** Which reader produced the text. */
26
+ readonly extractor: Extractor;
27
+ readonly statements: readonly Statement[];
28
+ }
29
+ export type Extractor = 'docx' | 'text';
30
+ /** Why an extraction could not happen. Ordered as the checks run (NFR-3). */
31
+ export type ExtractFailure = 'out-of-bounds' | 'missing' | 'unsupported-format' | 'too-large' | 'not-a-docx' | 'entry-too-large';
32
+ export type ExtractResult = {
33
+ readonly ok: true;
34
+ readonly text: string;
35
+ readonly extractor: Extractor;
36
+ /** sha256 of the source bytes. */
37
+ readonly sha256: string;
38
+ /** Path relative to the project root. */
39
+ readonly relativePath: string;
40
+ } | {
41
+ readonly ok: false;
42
+ readonly reason: ExtractFailure;
43
+ readonly detail: string;
44
+ };
45
+ /** One `IN-<n>` or `NOT-<n>` line parsed out of `constitution.md`. */
46
+ export interface Entry {
47
+ /** `IN-3`, `NOT-1`. */
48
+ readonly id: string;
49
+ readonly kind: 'in-scope' | 'prohibition';
50
+ /** Every `V-…` id the line cites, in order of appearance. */
51
+ readonly cites: readonly string[];
52
+ /** 1-indexed line in `constitution.md`. */
53
+ readonly line: number;
54
+ }
55
+ /**
56
+ * What `aidlc constitution check` found.
57
+ *
58
+ * `state` distinguishes "evaluated, no drift" from the two situations where no
59
+ * comparison was possible — reporting those explicitly is the point (AC-15).
60
+ */
61
+ export interface CheckReport {
62
+ readonly state: 'ok' | 'no-snapshot' | 'source-missing' | 'source-unreadable';
63
+ readonly source_path: string | null;
64
+ /** Statement ids in the source now and not in the snapshot. */
65
+ readonly added: readonly string[];
66
+ /** Statement ids in the snapshot and no longer in the source. */
67
+ readonly removed: readonly string[];
68
+ /** Constitution entries citing a removed id (AC-13). */
69
+ readonly affected_entries: readonly AffectedEntry[];
70
+ /** Present only when `state` is not `ok`. */
71
+ readonly detail?: string;
72
+ }
73
+ export interface AffectedEntry {
74
+ /** `NOT-2`. */
75
+ readonly entry: string;
76
+ /** The removed statement id it cites. */
77
+ readonly cites: string;
78
+ readonly line: number;
79
+ }
80
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/constitution/types.ts"],"names":[],"m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BAAuB;IACvB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,UAAU,GAAG,aAAa,CAAC;IAC1C,6DAA6D;IAC7D,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,2CAA2C;IAC3C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED;;;;;GAKG;AACH,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,KAAK,EAAE,IAAI,GAAG,aAAa,GAAG,gBAAgB,GAAG,mBAAmB,CAAC;IAC9E,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,+DAA+D;IAC/D,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,iEAAiE;IACjE,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,wDAAwD;IACxD,QAAQ,CAAC,gBAAgB,EAAE,SAAS,aAAa,EAAE,CAAC;IACpD,6CAA6C;IAC7C,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,aAAa;IAC5B,eAAe;IACf,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,yCAAyC;IACzC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Shared types for the constitution module.
3
+ *
4
+ * Requirements: project-constitution/AC-7, project-constitution/AC-10
5
+ *
6
+ * @module
7
+ */
8
+ export {};
9
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/constitution/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
@@ -10,6 +10,7 @@
10
10
  import type { PhaseState, WorkflowTemplate, TemplatePhase } from './types.js';
11
11
  import type { TraceabilityResult } from '../traceability/types.js';
12
12
  import type { TasksResult } from '../tasks/types.js';
13
+ import type { ComplianceResult } from '../compliance/gate-criterion.js';
13
14
  /**
14
15
  * Gate check result for CI/CD integration.
15
16
  */
@@ -35,6 +36,15 @@ export interface GateCheckResult {
35
36
  * AC-19).
36
37
  */
37
38
  tasks?: TasksResult;
39
+ /**
40
+ * Compliance control coverage — present only when a compliance pack is installed.
41
+ * Attached at the command layer; `evaluateGate` never sets it.
42
+ *
43
+ * Conditionally assigned, following the two fields above, so a project with no
44
+ * pack produces a `--json` payload byte-identical to the pre-feature one
45
+ * (compliance-packs/AC-55).
46
+ */
47
+ compliance?: ComplianceResult;
38
48
  }
39
49
  /**
40
50
  * Evaluate whether a phase passes its gate check.
@@ -1 +1 @@
1
- {"version":3,"file":"gate.d.ts","sourceRoot":"","sources":["../../src/core/gate.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC9E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAMrD;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,mDAAmD;IACnD,IAAI,EAAE,OAAO,CAAC;IACd,0BAA0B;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,yCAAyC;IACzC,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,8DAA8D;IAC9D,mBAAmB,EAAE,MAAM,EAAE,CAAC;IAC9B;;;;OAIG;IACH,YAAY,CAAC,EAAE,kBAAkB,CAAC;IAClC;;;;;OAKG;IACH,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB;AAMD;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAC1B,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC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