@codeledger/cli 0.7.3 → 0.7.6

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 (196) hide show
  1. package/dist/commands/activate.d.ts.map +1 -1
  2. package/dist/commands/activate.js +34 -1
  3. package/dist/commands/activate.js.map +1 -1
  4. package/dist/commands/broker.d.ts +15 -0
  5. package/dist/commands/broker.d.ts.map +1 -0
  6. package/dist/commands/broker.js +283 -0
  7. package/dist/commands/broker.js.map +1 -0
  8. package/dist/commands/complete-check.d.ts +23 -0
  9. package/dist/commands/complete-check.d.ts.map +1 -0
  10. package/dist/commands/complete-check.js +198 -0
  11. package/dist/commands/complete-check.js.map +1 -0
  12. package/dist/commands/guardrails.d.ts +11 -0
  13. package/dist/commands/guardrails.d.ts.map +1 -0
  14. package/dist/commands/guardrails.js +112 -0
  15. package/dist/commands/guardrails.js.map +1 -0
  16. package/dist/commands/init.d.ts +10 -0
  17. package/dist/commands/init.d.ts.map +1 -1
  18. package/dist/commands/init.js +21 -44
  19. package/dist/commands/init.js.map +1 -1
  20. package/dist/commands/lessons.d.ts +14 -0
  21. package/dist/commands/lessons.d.ts.map +1 -0
  22. package/dist/commands/lessons.js +196 -0
  23. package/dist/commands/lessons.js.map +1 -0
  24. package/dist/commands/memory.d.ts +16 -0
  25. package/dist/commands/memory.d.ts.map +1 -0
  26. package/dist/commands/memory.js +315 -0
  27. package/dist/commands/memory.js.map +1 -0
  28. package/dist/commands/pre-pr.d.ts +14 -0
  29. package/dist/commands/pre-pr.d.ts.map +1 -0
  30. package/dist/commands/pre-pr.js +57 -0
  31. package/dist/commands/pre-pr.js.map +1 -0
  32. package/dist/commands/release-check.d.ts +14 -0
  33. package/dist/commands/release-check.d.ts.map +1 -0
  34. package/dist/commands/release-check.js +44 -0
  35. package/dist/commands/release-check.js.map +1 -0
  36. package/dist/commands/serve.d.ts.map +1 -1
  37. package/dist/commands/serve.js +116 -0
  38. package/dist/commands/serve.js.map +1 -1
  39. package/dist/completion-integrity/claims.d.ts +21 -0
  40. package/dist/completion-integrity/claims.d.ts.map +1 -0
  41. package/dist/completion-integrity/claims.js +85 -0
  42. package/dist/completion-integrity/claims.js.map +1 -0
  43. package/dist/completion-integrity/confidence.d.ts +30 -0
  44. package/dist/completion-integrity/confidence.d.ts.map +1 -0
  45. package/dist/completion-integrity/confidence.js +86 -0
  46. package/dist/completion-integrity/confidence.js.map +1 -0
  47. package/dist/completion-integrity/ghost-detector.d.ts +37 -0
  48. package/dist/completion-integrity/ghost-detector.d.ts.map +1 -0
  49. package/dist/completion-integrity/ghost-detector.js +93 -0
  50. package/dist/completion-integrity/ghost-detector.js.map +1 -0
  51. package/dist/completion-integrity/history.d.ts +19 -0
  52. package/dist/completion-integrity/history.d.ts.map +1 -0
  53. package/dist/completion-integrity/history.js +44 -0
  54. package/dist/completion-integrity/history.js.map +1 -0
  55. package/dist/completion-integrity/index.d.ts +25 -0
  56. package/dist/completion-integrity/index.d.ts.map +1 -0
  57. package/dist/completion-integrity/index.js +243 -0
  58. package/dist/completion-integrity/index.js.map +1 -0
  59. package/dist/completion-integrity/neighborhood.d.ts +21 -0
  60. package/dist/completion-integrity/neighborhood.d.ts.map +1 -0
  61. package/dist/completion-integrity/neighborhood.js +274 -0
  62. package/dist/completion-integrity/neighborhood.js.map +1 -0
  63. package/dist/completion-integrity/output.d.ts +11 -0
  64. package/dist/completion-integrity/output.d.ts.map +1 -0
  65. package/dist/completion-integrity/output.js +215 -0
  66. package/dist/completion-integrity/output.js.map +1 -0
  67. package/dist/completion-integrity/self-audit.d.ts +28 -0
  68. package/dist/completion-integrity/self-audit.d.ts.map +1 -0
  69. package/dist/completion-integrity/self-audit.js +194 -0
  70. package/dist/completion-integrity/self-audit.js.map +1 -0
  71. package/dist/completion-integrity/semantic-drift.d.ts +22 -0
  72. package/dist/completion-integrity/semantic-drift.d.ts.map +1 -0
  73. package/dist/completion-integrity/semantic-drift.js +138 -0
  74. package/dist/completion-integrity/semantic-drift.js.map +1 -0
  75. package/dist/completion-integrity/state-machine.d.ts +36 -0
  76. package/dist/completion-integrity/state-machine.d.ts.map +1 -0
  77. package/dist/completion-integrity/state-machine.js +138 -0
  78. package/dist/completion-integrity/state-machine.js.map +1 -0
  79. package/dist/completion-integrity/types.d.ts +65 -0
  80. package/dist/completion-integrity/types.d.ts.map +1 -0
  81. package/dist/completion-integrity/types.js +4 -0
  82. package/dist/completion-integrity/types.js.map +1 -0
  83. package/dist/guardrails/adversarial-trigger.d.ts +15 -0
  84. package/dist/guardrails/adversarial-trigger.d.ts.map +1 -0
  85. package/dist/guardrails/adversarial-trigger.js +86 -0
  86. package/dist/guardrails/adversarial-trigger.js.map +1 -0
  87. package/dist/guardrails/export-collision.d.ts +11 -0
  88. package/dist/guardrails/export-collision.d.ts.map +1 -0
  89. package/dist/guardrails/export-collision.js +141 -0
  90. package/dist/guardrails/export-collision.js.map +1 -0
  91. package/dist/guardrails/index.d.ts +24 -0
  92. package/dist/guardrails/index.d.ts.map +1 -0
  93. package/dist/guardrails/index.js +24 -0
  94. package/dist/guardrails/index.js.map +1 -0
  95. package/dist/guardrails/release-tag.d.ts +10 -0
  96. package/dist/guardrails/release-tag.d.ts.map +1 -0
  97. package/dist/guardrails/release-tag.js +99 -0
  98. package/dist/guardrails/release-tag.js.map +1 -0
  99. package/dist/guardrails/rename-integrity.d.ts +13 -0
  100. package/dist/guardrails/rename-integrity.d.ts.map +1 -0
  101. package/dist/guardrails/rename-integrity.js +111 -0
  102. package/dist/guardrails/rename-integrity.js.map +1 -0
  103. package/dist/guardrails/runner.d.ts +10 -0
  104. package/dist/guardrails/runner.d.ts.map +1 -0
  105. package/dist/guardrails/runner.js +36 -0
  106. package/dist/guardrails/runner.js.map +1 -0
  107. package/dist/guardrails/stale-artifact.d.ts +11 -0
  108. package/dist/guardrails/stale-artifact.d.ts.map +1 -0
  109. package/dist/guardrails/stale-artifact.js +69 -0
  110. package/dist/guardrails/stale-artifact.js.map +1 -0
  111. package/dist/guardrails/unused-parameter.d.ts +11 -0
  112. package/dist/guardrails/unused-parameter.d.ts.map +1 -0
  113. package/dist/guardrails/unused-parameter.js +105 -0
  114. package/dist/guardrails/unused-parameter.js.map +1 -0
  115. package/dist/guardrails/workspace-validation.d.ts +12 -0
  116. package/dist/guardrails/workspace-validation.d.ts.map +1 -0
  117. package/dist/guardrails/workspace-validation.js +92 -0
  118. package/dist/guardrails/workspace-validation.js.map +1 -0
  119. package/dist/index.d.ts.map +1 -1
  120. package/dist/index.js +265 -305
  121. package/dist/index.js.map +1 -1
  122. package/dist/insight/emit.d.ts +19 -0
  123. package/dist/insight/emit.d.ts.map +1 -0
  124. package/dist/insight/emit.js +105 -0
  125. package/dist/insight/emit.js.map +1 -0
  126. package/dist/insight/engine-bridge.d.ts +7 -0
  127. package/dist/insight/engine-bridge.d.ts.map +1 -0
  128. package/dist/insight/engine-bridge.js +6 -0
  129. package/dist/insight/engine-bridge.js.map +1 -0
  130. package/dist/insight/index.d.ts +3 -0
  131. package/dist/insight/index.d.ts.map +1 -0
  132. package/dist/insight/index.js +2 -0
  133. package/dist/insight/index.js.map +1 -0
  134. package/dist/memory/evidence-gates.d.ts +32 -0
  135. package/dist/memory/evidence-gates.d.ts.map +1 -0
  136. package/dist/memory/evidence-gates.js +168 -0
  137. package/dist/memory/evidence-gates.js.map +1 -0
  138. package/dist/memory/index.d.ts +9 -0
  139. package/dist/memory/index.d.ts.map +1 -0
  140. package/dist/memory/index.js +9 -0
  141. package/dist/memory/index.js.map +1 -0
  142. package/dist/memory/lessons.d.ts +88 -0
  143. package/dist/memory/lessons.d.ts.map +1 -0
  144. package/dist/memory/lessons.js +370 -0
  145. package/dist/memory/lessons.js.map +1 -0
  146. package/dist/memory/ontology.d.ts +34 -0
  147. package/dist/memory/ontology.d.ts.map +1 -0
  148. package/dist/memory/ontology.js +125 -0
  149. package/dist/memory/ontology.js.map +1 -0
  150. package/dist/memory/preamble.d.ts +35 -0
  151. package/dist/memory/preamble.d.ts.map +1 -0
  152. package/dist/memory/preamble.js +104 -0
  153. package/dist/memory/preamble.js.map +1 -0
  154. package/dist/memory/recent-truth.d.ts +21 -0
  155. package/dist/memory/recent-truth.d.ts.map +1 -0
  156. package/dist/memory/recent-truth.js +78 -0
  157. package/dist/memory/recent-truth.js.map +1 -0
  158. package/dist/memory/storage.d.ts +25 -0
  159. package/dist/memory/storage.d.ts.map +1 -0
  160. package/dist/memory/storage.js +182 -0
  161. package/dist/memory/storage.js.map +1 -0
  162. package/dist/memory/structural-trust.d.ts +36 -0
  163. package/dist/memory/structural-trust.d.ts.map +1 -0
  164. package/dist/memory/structural-trust.js +77 -0
  165. package/dist/memory/structural-trust.js.map +1 -0
  166. package/dist/memory/validation-ledger.d.ts +28 -0
  167. package/dist/memory/validation-ledger.d.ts.map +1 -0
  168. package/dist/memory/validation-ledger.js +90 -0
  169. package/dist/memory/validation-ledger.js.map +1 -0
  170. package/dist/onboarding.d.ts +36 -0
  171. package/dist/onboarding.d.ts.map +1 -0
  172. package/dist/onboarding.js +107 -0
  173. package/dist/onboarding.js.map +1 -0
  174. package/dist/pre-pr/checks.d.ts +18 -0
  175. package/dist/pre-pr/checks.d.ts.map +1 -0
  176. package/dist/pre-pr/checks.js +440 -0
  177. package/dist/pre-pr/checks.js.map +1 -0
  178. package/dist/pre-pr/orchestrator.d.ts +30 -0
  179. package/dist/pre-pr/orchestrator.d.ts.map +1 -0
  180. package/dist/pre-pr/orchestrator.js +104 -0
  181. package/dist/pre-pr/orchestrator.js.map +1 -0
  182. package/dist/release-check/engine.d.ts +30 -0
  183. package/dist/release-check/engine.d.ts.map +1 -0
  184. package/dist/release-check/engine.js +722 -0
  185. package/dist/release-check/engine.js.map +1 -0
  186. package/dist/release-check/index.d.ts +16 -0
  187. package/dist/release-check/index.d.ts.map +1 -0
  188. package/dist/release-check/index.js +16 -0
  189. package/dist/release-check/index.js.map +1 -0
  190. package/dist/release-check/output.d.ts +7 -0
  191. package/dist/release-check/output.d.ts.map +1 -0
  192. package/dist/release-check/output.js +123 -0
  193. package/dist/release-check/output.js.map +1 -0
  194. package/dist/templates/claude-md.js +1 -1
  195. package/dist/templates/claude-md.js.map +1 -1
  196. package/package.json +10 -10
@@ -0,0 +1,722 @@
1
+ /**
2
+ * Release Check Engine — Hardened Release Authority
3
+ *
4
+ * Evaluates release readiness across 8+ categories with:
5
+ * - CIC-backed completion truth
6
+ * - True manifest parity (source exports vs built exports)
7
+ * - Durable baseline regression tracking
8
+ * - Enforceable stale-binary gates
9
+ * - Lesson-based stress tests
10
+ * - Strict hardened-release criteria (Trinity of Truth)
11
+ */
12
+ import { existsSync, readFileSync, readdirSync, statSync, writeFileSync, mkdirSync } from 'node:fs';
13
+ import { join } from 'node:path';
14
+ import { execSync } from 'node:child_process';
15
+ // ─── Helpers ────────────────────────────────────────────────────────────────
16
+ function exec(cmd, cwd) {
17
+ try {
18
+ return execSync(cmd, { cwd, encoding: 'utf-8', timeout: 15_000 }).trim();
19
+ }
20
+ catch {
21
+ return '';
22
+ }
23
+ }
24
+ function finding(id, category, severity, title, detail, extras) {
25
+ return { id, category, severity, title, detail, ...extras };
26
+ }
27
+ function baselinePath(cwd) {
28
+ return join(cwd, '.codeledger', 'release', 'baseline.json');
29
+ }
30
+ export function loadBaseline(cwd) {
31
+ const path = baselinePath(cwd);
32
+ if (!existsSync(path)) {
33
+ return { lastCheckedAt: '', knownFailures: [] };
34
+ }
35
+ try {
36
+ const raw = JSON.parse(readFileSync(path, 'utf-8'));
37
+ if (typeof raw === 'object' && raw !== null && Array.isArray(raw['knownFailures'])) {
38
+ return raw;
39
+ }
40
+ }
41
+ catch { /* fallback */ }
42
+ return { lastCheckedAt: '', knownFailures: [] };
43
+ }
44
+ export function saveBaseline(cwd, baseline) {
45
+ const dir = join(cwd, '.codeledger', 'release');
46
+ if (!existsSync(dir))
47
+ mkdirSync(dir, { recursive: true });
48
+ writeFileSync(baselinePath(cwd), JSON.stringify(baseline, null, 2), 'utf-8');
49
+ }
50
+ function classifyBaselineVsRegression(findings, baseline) {
51
+ const knownIds = new Set(baseline.knownFailures.map((f) => f.id));
52
+ const knownDebt = [];
53
+ const regressions = [];
54
+ for (const f of findings) {
55
+ if (knownIds.has(f.id)) {
56
+ knownDebt.push({ ...f, isBaseline: true });
57
+ }
58
+ else if (f.severity === 'critical' || f.severity === 'high') {
59
+ regressions.push(f);
60
+ }
61
+ }
62
+ return { knownDebt, regressions };
63
+ }
64
+ function extractSourceManifest(cwd) {
65
+ const commands = new Set();
66
+ const exports = new Set();
67
+ const srcIndex = join(cwd, 'packages', 'cli', 'src', 'index.ts');
68
+ if (!existsSync(srcIndex))
69
+ return { commands, exports };
70
+ const srcContent = readFileSync(srcIndex, 'utf-8');
71
+ // Extract switch case commands (exclude flag aliases like --version, -v, --help, -h)
72
+ const caseRegex = /case\s+'([^']+)':/g;
73
+ let match;
74
+ while ((match = caseRegex.exec(srcContent)) !== null) {
75
+ const cmd = match[1];
76
+ if (cmd && !cmd.startsWith('-') && cmd !== 'version' && cmd !== 'help' && cmd !== 'undefined') {
77
+ commands.add(cmd);
78
+ }
79
+ }
80
+ // Extract imported command functions
81
+ const importRegex = /import\s+\{\s*(\w+)\s*(?:as\s+\w+)?\}\s+from\s+'\.\/commands\/[^']+'/g;
82
+ while ((match = importRegex.exec(srcContent)) !== null) {
83
+ if (match[1])
84
+ exports.add(match[1]);
85
+ }
86
+ // Extract exports from command files
87
+ const commandsDir = join(cwd, 'packages', 'cli', 'src', 'commands');
88
+ if (existsSync(commandsDir)) {
89
+ for (const file of readdirSync(commandsDir)) {
90
+ if (!file.endsWith('.ts'))
91
+ continue;
92
+ const content = readFileSync(join(commandsDir, file), 'utf-8');
93
+ const exportRegex = /export\s+(?:async\s+)?function\s+(\w+)/g;
94
+ while ((match = exportRegex.exec(content)) !== null) {
95
+ if (match[1])
96
+ exports.add(match[1]);
97
+ }
98
+ }
99
+ }
100
+ return { commands, exports };
101
+ }
102
+ function extractBinaryManifest(cwd) {
103
+ const commands = new Set();
104
+ const exports = new Set();
105
+ const standalonePath = join(cwd, 'packages', 'cli', 'bin', 'codeledger-standalone.cjs');
106
+ if (!existsSync(standalonePath))
107
+ return { commands, exports };
108
+ const content = readFileSync(standalonePath, 'utf-8');
109
+ // Extract case statements from bundled code
110
+ const caseRegex = /case\s*["']([a-z][\w-]*)["']\s*:/g;
111
+ let match;
112
+ while ((match = caseRegex.exec(content)) !== null) {
113
+ if (match[1] && match[1].length >= 2)
114
+ commands.add(match[1]);
115
+ }
116
+ return { commands, exports };
117
+ }
118
+ // ─── 1. Git Integrity ───────────────────────────────────────────────────────
119
+ function checkGitIntegrity(cwd) {
120
+ const findings = [];
121
+ let deductions = 0;
122
+ const status = exec('git status --porcelain', cwd);
123
+ if (status) {
124
+ const lines = status.split('\n').filter(Boolean);
125
+ findings.push(finding('git-dirty', 'git_integrity', 'high', 'Working tree is not clean', `${lines.length} uncommitted change(s). Release should be from clean state.`, { remediation: 'Commit or stash changes before releasing.' }));
126
+ deductions += 0.3;
127
+ }
128
+ const localHead = exec('git rev-parse HEAD', cwd);
129
+ const remoteHead = exec('git rev-parse @{upstream} 2>/dev/null', cwd);
130
+ if (remoteHead && localHead !== remoteHead) {
131
+ findings.push(finding('git-unsynced', 'git_integrity', 'high', 'Local branch is not synced with remote', `Local HEAD: ${localHead.slice(0, 8)}, Remote: ${remoteHead.slice(0, 8)}`, { remediation: 'Push or pull to sync with remote.' }));
132
+ deductions += 0.2;
133
+ }
134
+ const latestTag = exec('git describe --tags --abbrev=0 HEAD 2>/dev/null', cwd);
135
+ if (latestTag) {
136
+ const tagCommit = exec(`git rev-list -1 "${latestTag}"`, cwd);
137
+ if (tagCommit && tagCommit !== localHead) {
138
+ findings.push(finding('git-tag-mismatch', 'git_integrity', 'critical', `Release tag "${latestTag}" does not point to HEAD`, `Tag: ${tagCommit.slice(0, 8)}, HEAD: ${localHead.slice(0, 8)}. Fixes after tagging not included.`, { remediation: `Move tag: git tag -f ${latestTag} HEAD && git push --tags --force` }));
139
+ deductions += 0.4;
140
+ }
141
+ }
142
+ return { score: Math.max(0, 1 - deductions), findings };
143
+ }
144
+ // ─── 2. Workspace Version Alignment ─────────────────────────────────────────
145
+ function checkWorkspaceAlignment(cwd) {
146
+ const findings = [];
147
+ const packagesDir = join(cwd, 'packages');
148
+ if (!existsSync(packagesDir))
149
+ return { score: 1, findings };
150
+ const versions = new Map();
151
+ try {
152
+ const dirs = readdirSync(packagesDir).filter((d) => statSync(join(packagesDir, d)).isDirectory());
153
+ for (const dir of dirs) {
154
+ const pkgPath = join(packagesDir, dir, 'package.json');
155
+ if (!existsSync(pkgPath))
156
+ continue;
157
+ const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'));
158
+ if (typeof pkg === 'object' && pkg !== null) {
159
+ const p = pkg;
160
+ if (typeof p['version'] === 'string')
161
+ versions.set(dir, p['version']);
162
+ }
163
+ }
164
+ }
165
+ catch { /* non-fatal */ }
166
+ const uniqueVersions = new Set(versions.values());
167
+ if (uniqueVersions.size > 1) {
168
+ const details = Array.from(versions.entries()).map(([name, ver]) => `${name}@${ver}`).join(', ');
169
+ findings.push(finding('ws-version-mismatch', 'workspace_alignment', 'high', 'Workspace packages have different versions', `Found ${uniqueVersions.size} different versions: ${details}`, { remediation: 'Align all package versions before release.' }));
170
+ return { score: 0.5, findings };
171
+ }
172
+ return { score: 1, findings };
173
+ }
174
+ // ─── 3. Test Integrity ──────────────────────────────────────────────────────
175
+ function checkTestIntegrity(cwd) {
176
+ const findings = [];
177
+ const coreTestFiles = [
178
+ 'tests/context-broker.test.ts',
179
+ 'tests/guardrails.test.ts',
180
+ 'tests/lessons-ledger.test.ts',
181
+ 'tests/memory.test.ts',
182
+ 'tests/completion-integrity.test.ts',
183
+ 'tests/smoke.test.ts',
184
+ 'tests/release-check.test.ts',
185
+ ];
186
+ const existingCore = coreTestFiles.filter((f) => existsSync(join(cwd, f)));
187
+ if (existingCore.length === 0) {
188
+ findings.push(finding('tests-missing', 'core_tests', 'critical', 'No core test files found', 'Expected test files for CIC, broker, guardrails, lessons, memory, smoke, release-check.'));
189
+ return { score: 0, findings };
190
+ }
191
+ return { score: 1, findings };
192
+ }
193
+ // ─── 4. Binary/Build Parity (Hardened: Manifest Comparison) ─────────────────
194
+ function checkBinaryParity(cwd) {
195
+ const findings = [];
196
+ let deductions = 0;
197
+ const srcManifest = extractSourceManifest(cwd);
198
+ if (srcManifest.commands.size === 0) {
199
+ findings.push(finding('src-missing', 'binary_parity', 'critical', 'Source CLI index.ts not found or has no commands', 'Cannot verify binary parity without source.'));
200
+ return { score: 0, findings };
201
+ }
202
+ const standalonePath = join(cwd, 'packages', 'cli', 'bin', 'codeledger-standalone.cjs');
203
+ if (!existsSync(standalonePath)) {
204
+ findings.push(finding('binary-missing', 'binary_parity', 'critical', 'Standalone CLI binary not found', 'packages/cli/bin/codeledger-standalone.cjs is missing.', { remediation: 'Rebuild: node scripts/build-standalone.mjs' }));
205
+ return { score: 0, findings };
206
+ }
207
+ const binaryManifest = extractBinaryManifest(cwd);
208
+ // Commands in source but not in binary (user-facing gap)
209
+ const srcOnly = [];
210
+ for (const cmd of srcManifest.commands) {
211
+ if (!binaryManifest.commands.has(cmd))
212
+ srcOnly.push(cmd);
213
+ }
214
+ if (srcOnly.length > 0) {
215
+ // User-facing commands missing = CRITICAL (blocks ready + hardened)
216
+ findings.push(finding('binary-stale', 'binary_parity', 'critical', `${srcOnly.length} user-facing command(s) missing from standalone binary`, `Stale binary missing: ${srcOnly.join(', ')}. Users cannot access these commands.`, { remediation: 'Rebuild and reverify the standalone CLI bundle: node scripts/build-standalone.mjs' }));
217
+ deductions += 0.5;
218
+ }
219
+ // Dist freshness (informational — standalone binary is the canonical production artifact)
220
+ const srcIndex = join(cwd, 'packages', 'cli', 'src', 'index.ts');
221
+ const distIndex = join(cwd, 'packages', 'cli', 'dist', 'index.js');
222
+ if (existsSync(srcIndex) && existsSync(distIndex)) {
223
+ const srcStat = statSync(srcIndex);
224
+ const distStat = statSync(distIndex);
225
+ if (srcStat.mtimeMs > distStat.mtimeMs) {
226
+ findings.push(finding('dist-stale', 'binary_parity', 'low', 'dist/ output is older than source (non-production)', 'packages/cli/dist/index.js is stale. The standalone binary is the canonical production artifact.', { remediation: 'Optional: run pnpm build to update dist/. Not required for release.' }));
227
+ // No deduction — dist is not the production path
228
+ }
229
+ }
230
+ // Manifest parity percentage
231
+ const totalSrc = srcManifest.commands.size;
232
+ const matchCount = totalSrc - srcOnly.length;
233
+ const parityPct = totalSrc > 0 ? matchCount / totalSrc : 1;
234
+ if (parityPct < 1 && srcOnly.length === 0) {
235
+ // All commands present but may have missed some
236
+ }
237
+ return { score: Math.max(0, Math.min(parityPct, 1 - deductions)), findings };
238
+ }
239
+ // ─── 5. CLI Wiring Completeness ─────────────────────────────────────────────
240
+ function checkCliWiring(cwd) {
241
+ const findings = [];
242
+ const commandsDir = join(cwd, 'packages', 'cli', 'src', 'commands');
243
+ if (!existsSync(commandsDir))
244
+ return { score: 1, findings };
245
+ const commandFiles = readdirSync(commandsDir)
246
+ .filter((f) => f.endsWith('.ts') && !f.startsWith('.'))
247
+ .map((f) => f.replace('.ts', ''));
248
+ const srcIndex = join(cwd, 'packages', 'cli', 'src', 'index.ts');
249
+ if (!existsSync(srcIndex))
250
+ return { score: 0.5, findings };
251
+ const srcContent = readFileSync(srcIndex, 'utf-8');
252
+ const importedCommands = new Set();
253
+ const importRegex = /import\s+\{[^}]+\}\s+from\s+'\.\/commands\/([^']+)\.js'/g;
254
+ let match;
255
+ while ((match = importRegex.exec(srcContent)) !== null) {
256
+ if (match[1])
257
+ importedCommands.add(match[1]);
258
+ }
259
+ const ghostCommands = commandFiles.filter((f) => !importedCommands.has(f));
260
+ if (ghostCommands.length > 0) {
261
+ findings.push(finding('ghost-commands', 'cli_wiring', 'medium', `${ghostCommands.length} command file(s) not imported in CLI dispatcher`, `Ghost commands: ${ghostCommands.slice(0, 10).join(', ')}${ghostCommands.length > 10 ? '...' : ''}`, { remediation: 'Add imports and switch cases for all command files.' }));
262
+ }
263
+ const score = ghostCommands.length === 0 ? 1 : Math.max(0.3, 1 - (ghostCommands.length * 0.02));
264
+ return { score, findings };
265
+ }
266
+ // ─── 6. Docs/Changelog Alignment ────────────────────────────────────────────
267
+ function checkDocsAlignment(cwd) {
268
+ const findings = [];
269
+ let deductions = 0;
270
+ const changelog = join(cwd, 'CHANGELOG.md');
271
+ if (!existsSync(changelog)) {
272
+ findings.push(finding('changelog-missing', 'docs_alignment', 'high', 'CHANGELOG.md not found', 'Release should include a changelog.', { remediation: 'Create CHANGELOG.md with release notes.' }));
273
+ deductions += 0.3;
274
+ }
275
+ // Check CLI package version vs root package version
276
+ const cliPkgPath = join(cwd, 'packages', 'cli', 'package.json');
277
+ const rootPkg = join(cwd, 'package.json');
278
+ if (existsSync(cliPkgPath) && existsSync(rootPkg)) {
279
+ try {
280
+ const cliPkg = JSON.parse(readFileSync(cliPkgPath, 'utf-8'));
281
+ const rootPkgData = JSON.parse(readFileSync(rootPkg, 'utf-8'));
282
+ const cliVersion = typeof cliPkg === 'object' && cliPkg !== null
283
+ ? cliPkg['version']
284
+ : undefined;
285
+ const pkgVersion = typeof rootPkgData === 'object' && rootPkgData !== null
286
+ ? rootPkgData['version']
287
+ : undefined;
288
+ if (typeof pkgVersion === 'string' && typeof cliVersion === 'string' && cliVersion !== pkgVersion) {
289
+ findings.push(finding('version-mismatch', 'docs_alignment', 'high', 'CLI package version does not match root package.json', `CLI: ${cliVersion}, root: ${pkgVersion}`, { remediation: 'Align package versions before release.' }));
290
+ deductions += 0.2;
291
+ }
292
+ }
293
+ catch { /* non-fatal */ }
294
+ }
295
+ return { score: Math.max(0, 1 - deductions), findings };
296
+ }
297
+ // ─── 7. CIC Completion Truth ────────────────────────────────────────────────
298
+ function checkCompletionTruth(cwd) {
299
+ const findings = [];
300
+ // Check for CIC result from two sources:
301
+ // 1. Explicit CIC result file (.codeledger/complete-check-result.json)
302
+ // 2. Release-scope completion evidence (generated by release-check itself)
303
+ const cicResult = join(cwd, '.codeledger', 'complete-check-result.json');
304
+ const releaseEvidence = join(cwd, '.codeledger', 'release', 'completion-evidence.json');
305
+ // Try explicit CIC result first
306
+ if (existsSync(cicResult)) {
307
+ try {
308
+ const raw = JSON.parse(readFileSync(cicResult, 'utf-8'));
309
+ if (typeof raw === 'object' && raw !== null) {
310
+ const result = raw;
311
+ const state = result['completionState'] ?? result['state'];
312
+ if (typeof state === 'string') {
313
+ const highStates = ['verified', 'audited', 'release_safe'];
314
+ if (highStates.includes(state)) {
315
+ return { score: 1, findings };
316
+ }
317
+ findings.push(finding('cic-insufficient', 'core_tests', 'high', `Completion state is "${state}" — not yet verified`, 'Release-critical work should reach at least "verified" before shipping.', { remediation: 'Ensure all claims are verified and evidence is provided.' }));
318
+ return { score: 0.5, findings };
319
+ }
320
+ }
321
+ }
322
+ catch {
323
+ // Fall through to release evidence check
324
+ }
325
+ }
326
+ // Try release-scope completion evidence
327
+ if (existsSync(releaseEvidence)) {
328
+ try {
329
+ const raw = JSON.parse(readFileSync(releaseEvidence, 'utf-8'));
330
+ if (typeof raw === 'object' && raw !== null) {
331
+ const evidence = raw;
332
+ if (evidence['verified'] === true) {
333
+ return { score: 1, findings };
334
+ }
335
+ }
336
+ }
337
+ catch {
338
+ // Fall through
339
+ }
340
+ }
341
+ // Generate release-scope completion evidence from current repo state.
342
+ // This is a lightweight release-specific CIC: it verifies that the
343
+ // release-critical surfaces (tests, binary, wiring, docs) are present
344
+ // and current. This is NOT a substitute for full CIC — it's release-scope
345
+ // structural evidence.
346
+ const releaseCompletionVerified = generateReleaseCompletionEvidence(cwd);
347
+ if (releaseCompletionVerified) {
348
+ return { score: 1, findings };
349
+ }
350
+ findings.push(finding('cic-missing', 'core_tests', 'medium', 'No completion truth evidence found', 'Run `codeledger complete-check --task "release"` or ensure release-critical surfaces pass.', { remediation: 'Run: codeledger complete-check --task "release"' }));
351
+ return { score: 0.7, findings };
352
+ }
353
+ /**
354
+ * Generate release-scope completion evidence by verifying that all
355
+ * release-critical surfaces are present and current.
356
+ *
357
+ * This is structural verification — it checks that the release-visible
358
+ * surfaces (binary, tests, docs, tag) are all present and aligned.
359
+ * It persists the evidence to .codeledger/release/completion-evidence.json
360
+ * so subsequent release-check runs can verify it.
361
+ */
362
+ function generateReleaseCompletionEvidence(cwd) {
363
+ // Verify release-critical surfaces
364
+ const standaloneBinary = join(cwd, 'packages', 'cli', 'bin', 'codeledger-standalone.cjs');
365
+ const hasBinary = existsSync(standaloneBinary);
366
+ const srcIndex = join(cwd, 'packages', 'cli', 'src', 'index.ts');
367
+ const hasSrc = existsSync(srcIndex);
368
+ // Binary must be newer than source (freshly built)
369
+ let binaryFresh = false;
370
+ if (hasBinary && hasSrc) {
371
+ binaryFresh = statSync(standaloneBinary).mtimeMs >= statSync(srcIndex).mtimeMs;
372
+ }
373
+ // Core test files must exist
374
+ const coreTestFiles = [
375
+ 'tests/context-broker.test.ts',
376
+ 'tests/guardrails.test.ts',
377
+ 'tests/lessons-ledger.test.ts',
378
+ 'tests/memory.test.ts',
379
+ 'tests/completion-integrity.test.ts',
380
+ 'tests/smoke.test.ts',
381
+ ];
382
+ const hasTests = coreTestFiles.some((f) => existsSync(join(cwd, f)));
383
+ // Tag must match HEAD
384
+ const tag = exec('git describe --tags --abbrev=0 HEAD 2>/dev/null', cwd);
385
+ const head = exec('git rev-parse HEAD', cwd);
386
+ const tagCommit = tag ? exec(`git rev-list -1 "${tag}"`, cwd) : '';
387
+ const tagAligned = tag !== '' && tagCommit === head;
388
+ // Working tree must be clean
389
+ const status = exec('git status --porcelain', cwd);
390
+ const cleanTree = status === '';
391
+ // All checks must pass for release-scope completion truth
392
+ const verified = hasBinary && binaryFresh && hasTests && tagAligned && cleanTree;
393
+ if (verified) {
394
+ // Persist evidence
395
+ const evidence = {
396
+ verified: true,
397
+ checkedAt: new Date().toISOString(),
398
+ commit: head,
399
+ tag,
400
+ surfaces: {
401
+ binary: hasBinary,
402
+ binaryFresh,
403
+ coreTests: hasTests,
404
+ tagAligned,
405
+ cleanTree,
406
+ },
407
+ };
408
+ try {
409
+ const dir = join(cwd, '.codeledger', 'release');
410
+ if (!existsSync(dir))
411
+ mkdirSync(dir, { recursive: true });
412
+ writeFileSync(join(dir, 'completion-evidence.json'), JSON.stringify(evidence, null, 2), 'utf-8');
413
+ }
414
+ catch {
415
+ // Non-fatal — evidence generation failed but check still passes
416
+ }
417
+ }
418
+ return verified;
419
+ }
420
+ // ─── 8. Lesson-Based Stress Tests ───────────────────────────────────────────
421
+ function checkLessonStress(cwd) {
422
+ const findings = [];
423
+ const lessonsPath = join(cwd, '.codeledger', 'memory', 'lessons.json');
424
+ if (!existsSync(lessonsPath))
425
+ return { score: 1, findings };
426
+ try {
427
+ const raw = JSON.parse(readFileSync(lessonsPath, 'utf-8'));
428
+ if (typeof raw !== 'object' || raw === null)
429
+ return { score: 1, findings };
430
+ const ledger = raw;
431
+ const lessons = ledger.lessons ?? [];
432
+ // Only run stress tests for verified active lessons
433
+ const activeVerified = lessons.filter((l) => l['active'] === true && l['status'] === 'verified');
434
+ for (const lesson of activeVerified) {
435
+ const category = lesson['category'];
436
+ const title = lesson['title'];
437
+ // Run targeted validators per lesson category
438
+ switch (category) {
439
+ case 'release_integrity': {
440
+ // Validate tag alignment
441
+ const tag = exec('git describe --tags --abbrev=0 HEAD 2>/dev/null', cwd);
442
+ const head = exec('git rev-parse HEAD', cwd);
443
+ const tagCommit = tag ? exec(`git rev-list -1 "${tag}"`, cwd) : '';
444
+ if (tag && tagCommit !== head) {
445
+ findings.push(finding(`lesson-stress-${lesson['id']}`, 'lesson_stress', 'high', `Lesson stress: ${title}`, `Release tag "${tag}" does not match HEAD. Lesson pattern confirmed.`));
446
+ }
447
+ break;
448
+ }
449
+ case 'artifact_freshness': {
450
+ // Verify source vs dist timestamps
451
+ const src = join(cwd, 'packages', 'cli', 'src', 'index.ts');
452
+ const dist = join(cwd, 'packages', 'cli', 'dist', 'index.js');
453
+ if (existsSync(src) && existsSync(dist)) {
454
+ if (statSync(src).mtimeMs > statSync(dist).mtimeMs) {
455
+ findings.push(finding(`lesson-stress-${lesson['id']}`, 'lesson_stress', 'high', `Lesson stress: ${title}`, 'Source is newer than dist/ — artifact freshness lesson pattern confirmed.'));
456
+ }
457
+ }
458
+ break;
459
+ }
460
+ case 'workspace_scope': {
461
+ // Verify cross-package alignment
462
+ const packagesDir = join(cwd, 'packages');
463
+ if (existsSync(packagesDir)) {
464
+ const versions = new Set();
465
+ for (const dir of readdirSync(packagesDir)) {
466
+ const pkgPath = join(packagesDir, dir, 'package.json');
467
+ if (!existsSync(pkgPath))
468
+ continue;
469
+ try {
470
+ const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'));
471
+ if (typeof pkg === 'object' && pkg !== null) {
472
+ const v = pkg['version'];
473
+ if (typeof v === 'string')
474
+ versions.add(v);
475
+ }
476
+ }
477
+ catch { /* skip */ }
478
+ }
479
+ if (versions.size > 1) {
480
+ findings.push(finding(`lesson-stress-${lesson['id']}`, 'lesson_stress', 'high', `Lesson stress: ${title}`, `${versions.size} different package versions — workspace scope lesson confirmed.`));
481
+ }
482
+ }
483
+ break;
484
+ }
485
+ case 'rename_safety': {
486
+ // Check for old token residues in dist if binary exists
487
+ const standalonePath = join(cwd, 'packages', 'cli', 'bin', 'codeledger-standalone.cjs');
488
+ if (existsSync(standalonePath)) {
489
+ const triggerCriteria = lesson['triggerCriteria'];
490
+ const filePatterns = triggerCriteria?.['files_changed'];
491
+ if (filePatterns) {
492
+ // Check if any trigger patterns appear as stale references in binary
493
+ // (simplified: just verify binary exists and is recent)
494
+ const binaryStat = statSync(standalonePath);
495
+ const srcIndex = join(cwd, 'packages', 'cli', 'src', 'index.ts');
496
+ if (existsSync(srcIndex) && statSync(srcIndex).mtimeMs > binaryStat.mtimeMs) {
497
+ findings.push(finding(`lesson-stress-${lesson['id']}`, 'lesson_stress', 'medium', `Lesson stress: ${title}`, 'Binary is older than source — rename residues may be present.'));
498
+ }
499
+ }
500
+ }
501
+ break;
502
+ }
503
+ // Other categories: no specific stress test yet, skip silently
504
+ }
505
+ }
506
+ }
507
+ catch {
508
+ // Non-fatal — lesson stress is advisory
509
+ }
510
+ const highFindings = findings.filter((f) => f.severity === 'high' || f.severity === 'critical');
511
+ const score = highFindings.length > 0 ? Math.max(0.3, 1 - (highFindings.length * 0.2)) : 1;
512
+ return { score, findings };
513
+ }
514
+ // ─── 9. Open Loop Detection ─────────────────────────────────────────────────
515
+ function checkOpenLoops(_cwd, allFindings) {
516
+ const findings = [];
517
+ const criticalCount = allFindings.filter((f) => f.severity === 'critical').length;
518
+ const highCount = allFindings.filter((f) => f.severity === 'high').length;
519
+ if (criticalCount > 0) {
520
+ findings.push(finding('open-critical', 'open_loop', 'critical', `${criticalCount} critical finding(s) remain open`, 'Critical findings must be resolved before release.'));
521
+ }
522
+ if (highCount > 3) {
523
+ findings.push(finding('open-high-cluster', 'open_loop', 'high', `${highCount} high-severity findings — risk cluster`, 'Multiple high-severity findings indicate systemic issues.'));
524
+ }
525
+ const score = criticalCount > 0 ? 0 : highCount > 3 ? 0.4 : highCount > 0 ? 0.7 : 1;
526
+ return { score, findings };
527
+ }
528
+ // ─── Release State Determination (Hardened) ─────────────────────────────────
529
+ function determineState(scores, findings, regressions, strict) {
530
+ const criticals = findings.filter((f) => f.severity === 'critical' && !f.isBaseline);
531
+ const highs = findings.filter((f) => f.severity === 'high' && !f.isBaseline);
532
+ // Critical findings → always not_ready
533
+ if (criticals.length > 0) {
534
+ return { state: 'not_ready', shouldBlock: true };
535
+ }
536
+ // Regressions are high-priority blockers in strict mode
537
+ if (regressions.length > 0 && strict) {
538
+ return { state: 'not_ready', shouldBlock: true };
539
+ }
540
+ // Strict Trinity of Truth for hardened
541
+ const sourceOk = scores.coreTests >= 0.9;
542
+ const artifactOk = scores.binaryParity >= 1.0; // Hardened: 100% parity required
543
+ const narrativeOk = scores.docsAlignment >= 0.9 && scores.gitIntegrity >= 0.9;
544
+ const noHighRegressions = regressions.filter((r) => r.severity === 'high' || r.severity === 'critical').length === 0;
545
+ // Only the canonical production artifact (standalone binary) blocks hardened — dist is non-production
546
+ const noStaleArtifacts = !findings.some((f) => f.id === 'binary-stale');
547
+ if (sourceOk && artifactOk && narrativeOk && highs.length === 0 && noHighRegressions && noStaleArtifacts) {
548
+ return { state: 'ready_hardened', shouldBlock: false };
549
+ }
550
+ // Many high findings → not ready
551
+ if (highs.length > 3) {
552
+ return { state: 'not_ready', shouldBlock: strict };
553
+ }
554
+ // Any high findings → conditional
555
+ if (highs.length > 0) {
556
+ return { state: 'ready_conditional', shouldBlock: false };
557
+ }
558
+ return { state: 'ready', shouldBlock: false };
559
+ }
560
+ // ─── Deduplicated Recommendations ───────────────────────────────────────────
561
+ function buildRecommendations(findings, regressions) {
562
+ const seen = new Set();
563
+ const recommendations = [];
564
+ // Priority order: regressions first, then by severity
565
+ const prioritized = [
566
+ ...regressions,
567
+ ...findings.filter((f) => !f.isBaseline),
568
+ ].sort((a, b) => {
569
+ const order = { critical: 0, high: 1, medium: 2, low: 3, info: 4 };
570
+ return (order[a.severity] ?? 5) - (order[b.severity] ?? 5);
571
+ });
572
+ for (const f of prioritized) {
573
+ if (recommendations.length >= 3)
574
+ break;
575
+ // Deduplicate by root cause category
576
+ const rootCause = f.category;
577
+ if (seen.has(rootCause))
578
+ continue;
579
+ seen.add(rootCause);
580
+ if (f.remediation) {
581
+ recommendations.push(f.remediation);
582
+ }
583
+ else {
584
+ recommendations.push(`Resolve: ${f.title}`);
585
+ }
586
+ }
587
+ return recommendations;
588
+ }
589
+ // ─── Main Entry Point ───────────────────────────────────────────────────────
590
+ export function runReleaseCheck(options) {
591
+ const { cwd, strict = false } = options;
592
+ const allFindings = [];
593
+ const verified = [];
594
+ // Load baseline for regression detection
595
+ const baseline = loadBaseline(cwd);
596
+ // 1. Git integrity
597
+ const git = checkGitIntegrity(cwd);
598
+ allFindings.push(...git.findings);
599
+ if (git.findings.length === 0)
600
+ verified.push('git_integrity');
601
+ // 2. Workspace alignment
602
+ const ws = checkWorkspaceAlignment(cwd);
603
+ allFindings.push(...ws.findings);
604
+ if (ws.findings.length === 0)
605
+ verified.push('workspace_alignment');
606
+ // 3. Test integrity
607
+ const tests = checkTestIntegrity(cwd);
608
+ allFindings.push(...tests.findings);
609
+ if (tests.findings.length === 0)
610
+ verified.push('core_tests');
611
+ // 4. Binary parity (hardened manifest comparison)
612
+ const binary = checkBinaryParity(cwd);
613
+ allFindings.push(...binary.findings);
614
+ // Binary parity is verified if no findings above LOW (dist-stale is informational)
615
+ if (binary.findings.filter((f) => f.severity !== 'low' && f.severity !== 'info').length === 0)
616
+ verified.push('binary_parity');
617
+ // 5. CLI wiring
618
+ const wiring = checkCliWiring(cwd);
619
+ allFindings.push(...wiring.findings);
620
+ if (wiring.findings.length === 0)
621
+ verified.push('cli_wiring');
622
+ // 6. Docs alignment
623
+ const docs = checkDocsAlignment(cwd);
624
+ allFindings.push(...docs.findings);
625
+ if (docs.findings.length === 0)
626
+ verified.push('docs_alignment');
627
+ // 7. CIC completion truth
628
+ const cic = checkCompletionTruth(cwd);
629
+ allFindings.push(...cic.findings);
630
+ if (cic.findings.length === 0)
631
+ verified.push('completion_truth');
632
+ // 8. Lesson-based stress tests
633
+ const lessonStress = checkLessonStress(cwd);
634
+ allFindings.push(...lessonStress.findings);
635
+ if (lessonStress.findings.length === 0)
636
+ verified.push('lesson_stress');
637
+ // 9. Open loops
638
+ const loops = checkOpenLoops(cwd, allFindings);
639
+ allFindings.push(...loops.findings);
640
+ // Classify baseline vs regression
641
+ const { knownDebt, regressions } = classifyBaselineVsRegression(allFindings, baseline);
642
+ const categoryScores = {
643
+ gitIntegrity: git.score,
644
+ coreTests: Math.min(tests.score, cic.score),
645
+ fullSuite: tests.score,
646
+ binaryParity: binary.score,
647
+ cliWiring: wiring.score,
648
+ docsAlignment: docs.score,
649
+ openLoopRisk: loops.score,
650
+ workspaceAlignment: ws.score,
651
+ };
652
+ // Weighted confidence
653
+ const weights = {
654
+ gitIntegrity: 0.15,
655
+ coreTests: 0.20,
656
+ fullSuite: 0.05,
657
+ binaryParity: 0.20,
658
+ cliWiring: 0.10,
659
+ docsAlignment: 0.10,
660
+ openLoopRisk: 0.10,
661
+ workspaceAlignment: 0.10,
662
+ };
663
+ let confidenceScore = 0;
664
+ for (const [key, weight] of Object.entries(weights)) {
665
+ confidenceScore += (categoryScores[key] ?? 0) * weight;
666
+ }
667
+ confidenceScore = Math.round(confidenceScore * 100) / 100;
668
+ const { state, shouldBlock } = determineState(categoryScores, allFindings, regressions, strict);
669
+ // Remaining unchecked
670
+ const allCategories = ['git_integrity', 'workspace_alignment', 'core_tests', 'binary_parity', 'cli_wiring', 'docs_alignment', 'completion_truth', 'lesson_stress'];
671
+ const remainingUnchecked = allCategories.filter((c) => !verified.includes(c));
672
+ // Blockers
673
+ const blockers = allFindings
674
+ .filter((f) => f.severity === 'critical' && !f.isBaseline)
675
+ .map((f) => `${f.title}: ${f.detail}`);
676
+ // Deduplicated recommendations
677
+ const recommendations = buildRecommendations(allFindings, regressions);
678
+ // Version — read from package.json (source of truth for esbuild injection)
679
+ let version = 'unknown';
680
+ try {
681
+ const pkgPath = join(cwd, 'packages', 'cli', 'package.json');
682
+ if (existsSync(pkgPath)) {
683
+ const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'));
684
+ if (typeof pkg === 'object' && pkg !== null) {
685
+ const v = pkg['version'];
686
+ if (typeof v === 'string')
687
+ version = v;
688
+ }
689
+ }
690
+ }
691
+ catch { /* non-fatal */ }
692
+ // Update baseline with current findings for next run
693
+ const updatedBaseline = {
694
+ lastCheckedAt: new Date().toISOString(),
695
+ knownFailures: [
696
+ ...baseline.knownFailures,
697
+ ...allFindings
698
+ .filter((f) => !baseline.knownFailures.some((k) => k.id === f.id))
699
+ .map((f) => ({ id: f.id, category: f.category, title: f.title, firstSeen: new Date().toISOString() })),
700
+ ],
701
+ };
702
+ try {
703
+ saveBaseline(cwd, updatedBaseline);
704
+ }
705
+ catch { /* non-fatal */ }
706
+ return {
707
+ releaseState: state,
708
+ confidenceScore,
709
+ categoryScores,
710
+ findings: allFindings.filter((f) => !f.isBaseline),
711
+ verified,
712
+ remainingUnchecked,
713
+ blockers,
714
+ recommendations,
715
+ knownDebt,
716
+ regressions,
717
+ shouldBlockCI: shouldBlock,
718
+ checkedAt: new Date().toISOString(),
719
+ version,
720
+ };
721
+ }
722
+ //# sourceMappingURL=engine.js.map