@codeledger/cli 0.10.5 → 0.10.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 (1291) hide show
  1. package/LICENSE +61 -0
  2. package/README.md +97 -0
  3. package/bin/codeledger.js +66 -0
  4. package/package.json +32 -46
  5. package/scripts/postinstall.js +285 -0
  6. package/bin/codeledger-open.cjs +0 -89
  7. package/bin/codeledger-standalone.cjs +0 -3964
  8. package/dist/ambient-activation.d.ts +0 -30
  9. package/dist/ambient-activation.d.ts.map +0 -1
  10. package/dist/ambient-activation.js +0 -449
  11. package/dist/ambient-activation.js.map +0 -1
  12. package/dist/arch-policy/resolve.d.ts +0 -11
  13. package/dist/arch-policy/resolve.d.ts.map +0 -1
  14. package/dist/arch-policy/resolve.js +0 -195
  15. package/dist/arch-policy/resolve.js.map +0 -1
  16. package/dist/arch-policy/simulate.d.ts +0 -9
  17. package/dist/arch-policy/simulate.d.ts.map +0 -1
  18. package/dist/arch-policy/simulate.js +0 -175
  19. package/dist/arch-policy/simulate.js.map +0 -1
  20. package/dist/architecture-graph/dependency-scanner.d.ts +0 -16
  21. package/dist/architecture-graph/dependency-scanner.d.ts.map +0 -1
  22. package/dist/architecture-graph/dependency-scanner.js +0 -96
  23. package/dist/architecture-graph/dependency-scanner.js.map +0 -1
  24. package/dist/architecture-graph/graph-builder.d.ts +0 -70
  25. package/dist/architecture-graph/graph-builder.d.ts.map +0 -1
  26. package/dist/architecture-graph/graph-builder.js +0 -231
  27. package/dist/architecture-graph/graph-builder.js.map +0 -1
  28. package/dist/architecture-graph/index.d.ts +0 -4
  29. package/dist/architecture-graph/index.d.ts.map +0 -1
  30. package/dist/architecture-graph/index.js +0 -7
  31. package/dist/architecture-graph/index.js.map +0 -1
  32. package/dist/architecture-graph/service-scanner.d.ts +0 -22
  33. package/dist/architecture-graph/service-scanner.d.ts.map +0 -1
  34. package/dist/architecture-graph/service-scanner.js +0 -181
  35. package/dist/architecture-graph/service-scanner.js.map +0 -1
  36. package/dist/artifacts/summary.d.ts +0 -6
  37. package/dist/artifacts/summary.d.ts.map +0 -1
  38. package/dist/artifacts/summary.js +0 -49
  39. package/dist/artifacts/summary.js.map +0 -1
  40. package/dist/command-activation.d.ts +0 -3
  41. package/dist/command-activation.d.ts.map +0 -1
  42. package/dist/command-activation.js +0 -2
  43. package/dist/command-activation.js.map +0 -1
  44. package/dist/commands/about.d.ts +0 -2
  45. package/dist/commands/about.d.ts.map +0 -1
  46. package/dist/commands/about.js +0 -18
  47. package/dist/commands/about.js.map +0 -1
  48. package/dist/commands/activate.d.ts +0 -18
  49. package/dist/commands/activate.d.ts.map +0 -1
  50. package/dist/commands/activate.js +0 -1110
  51. package/dist/commands/activate.js.map +0 -1
  52. package/dist/commands/apply-policy.d.ts +0 -7
  53. package/dist/commands/apply-policy.d.ts.map +0 -1
  54. package/dist/commands/apply-policy.js +0 -62
  55. package/dist/commands/apply-policy.js.map +0 -1
  56. package/dist/commands/arch-policy.d.ts +0 -8
  57. package/dist/commands/arch-policy.d.ts.map +0 -1
  58. package/dist/commands/arch-policy.js +0 -349
  59. package/dist/commands/arch-policy.js.map +0 -1
  60. package/dist/commands/audit-export.d.ts +0 -8
  61. package/dist/commands/audit-export.d.ts.map +0 -1
  62. package/dist/commands/audit-export.js +0 -192
  63. package/dist/commands/audit-export.js.map +0 -1
  64. package/dist/commands/audit.d.ts +0 -24
  65. package/dist/commands/audit.d.ts.map +0 -1
  66. package/dist/commands/audit.js +0 -1138
  67. package/dist/commands/audit.js.map +0 -1
  68. package/dist/commands/auto-refresh.d.ts +0 -17
  69. package/dist/commands/auto-refresh.d.ts.map +0 -1
  70. package/dist/commands/auto-refresh.js +0 -152
  71. package/dist/commands/auto-refresh.js.map +0 -1
  72. package/dist/commands/broker.d.ts +0 -22
  73. package/dist/commands/broker.d.ts.map +0 -1
  74. package/dist/commands/broker.js +0 -487
  75. package/dist/commands/broker.js.map +0 -1
  76. package/dist/commands/bundle.d.ts +0 -2
  77. package/dist/commands/bundle.d.ts.map +0 -1
  78. package/dist/commands/bundle.js +0 -230
  79. package/dist/commands/bundle.js.map +0 -1
  80. package/dist/commands/capsule-change.d.ts +0 -7
  81. package/dist/commands/capsule-change.d.ts.map +0 -1
  82. package/dist/commands/capsule-change.js +0 -177
  83. package/dist/commands/capsule-change.js.map +0 -1
  84. package/dist/commands/checkpoint.d.ts +0 -26
  85. package/dist/commands/checkpoint.d.ts.map +0 -1
  86. package/dist/commands/checkpoint.js +0 -382
  87. package/dist/commands/checkpoint.js.map +0 -1
  88. package/dist/commands/ci.d.ts +0 -16
  89. package/dist/commands/ci.d.ts.map +0 -1
  90. package/dist/commands/ci.js +0 -287
  91. package/dist/commands/ci.js.map +0 -1
  92. package/dist/commands/claims.d.ts +0 -14
  93. package/dist/commands/claims.d.ts.map +0 -1
  94. package/dist/commands/claims.js +0 -93
  95. package/dist/commands/claims.js.map +0 -1
  96. package/dist/commands/claude.d.ts +0 -2
  97. package/dist/commands/claude.d.ts.map +0 -1
  98. package/dist/commands/claude.js +0 -5
  99. package/dist/commands/claude.js.map +0 -1
  100. package/dist/commands/clean.d.ts +0 -2
  101. package/dist/commands/clean.d.ts.map +0 -1
  102. package/dist/commands/clean.js +0 -28
  103. package/dist/commands/clean.js.map +0 -1
  104. package/dist/commands/coach.d.ts +0 -11
  105. package/dist/commands/coach.d.ts.map +0 -1
  106. package/dist/commands/coach.js +0 -169
  107. package/dist/commands/coach.js.map +0 -1
  108. package/dist/commands/codex.d.ts +0 -2
  109. package/dist/commands/codex.d.ts.map +0 -1
  110. package/dist/commands/codex.js +0 -5
  111. package/dist/commands/codex.js.map +0 -1
  112. package/dist/commands/commit-msg.d.ts +0 -58
  113. package/dist/commands/commit-msg.d.ts.map +0 -1
  114. package/dist/commands/commit-msg.js +0 -461
  115. package/dist/commands/commit-msg.js.map +0 -1
  116. package/dist/commands/compare-current.d.ts +0 -2
  117. package/dist/commands/compare-current.d.ts.map +0 -1
  118. package/dist/commands/compare-current.js +0 -186
  119. package/dist/commands/compare-current.js.map +0 -1
  120. package/dist/commands/compare.d.ts +0 -2
  121. package/dist/commands/compare.d.ts.map +0 -1
  122. package/dist/commands/compare.js +0 -253
  123. package/dist/commands/compare.js.map +0 -1
  124. package/dist/commands/complete-check.d.ts +0 -24
  125. package/dist/commands/complete-check.d.ts.map +0 -1
  126. package/dist/commands/complete-check.js +0 -287
  127. package/dist/commands/complete-check.js.map +0 -1
  128. package/dist/commands/conflicts.d.ts +0 -12
  129. package/dist/commands/conflicts.d.ts.map +0 -1
  130. package/dist/commands/conflicts.js +0 -55
  131. package/dist/commands/conflicts.js.map +0 -1
  132. package/dist/commands/context-handoff.d.ts +0 -2
  133. package/dist/commands/context-handoff.d.ts.map +0 -1
  134. package/dist/commands/context-handoff.js +0 -58
  135. package/dist/commands/context-handoff.js.map +0 -1
  136. package/dist/commands/context.d.ts +0 -22
  137. package/dist/commands/context.d.ts.map +0 -1
  138. package/dist/commands/context.js +0 -836
  139. package/dist/commands/context.js.map +0 -1
  140. package/dist/commands/coordination.d.ts +0 -6
  141. package/dist/commands/coordination.d.ts.map +0 -1
  142. package/dist/commands/coordination.js +0 -177
  143. package/dist/commands/coordination.js.map +0 -1
  144. package/dist/commands/cowork-refresh.d.ts +0 -8
  145. package/dist/commands/cowork-refresh.d.ts.map +0 -1
  146. package/dist/commands/cowork-refresh.js +0 -50
  147. package/dist/commands/cowork-refresh.js.map +0 -1
  148. package/dist/commands/cowork-snapshot.d.ts +0 -8
  149. package/dist/commands/cowork-snapshot.d.ts.map +0 -1
  150. package/dist/commands/cowork-snapshot.js +0 -34
  151. package/dist/commands/cowork-snapshot.js.map +0 -1
  152. package/dist/commands/cowork-start.d.ts +0 -8
  153. package/dist/commands/cowork-start.d.ts.map +0 -1
  154. package/dist/commands/cowork-start.js +0 -71
  155. package/dist/commands/cowork-start.js.map +0 -1
  156. package/dist/commands/cowork-stop.d.ts +0 -7
  157. package/dist/commands/cowork-stop.d.ts.map +0 -1
  158. package/dist/commands/cowork-stop.js +0 -43
  159. package/dist/commands/cowork-stop.js.map +0 -1
  160. package/dist/commands/daemon.d.ts +0 -2
  161. package/dist/commands/daemon.d.ts.map +0 -1
  162. package/dist/commands/daemon.js +0 -5
  163. package/dist/commands/daemon.js.map +0 -1
  164. package/dist/commands/dashboard.d.ts +0 -18
  165. package/dist/commands/dashboard.d.ts.map +0 -1
  166. package/dist/commands/dashboard.js +0 -481
  167. package/dist/commands/dashboard.js.map +0 -1
  168. package/dist/commands/detect-secrets.d.ts +0 -19
  169. package/dist/commands/detect-secrets.d.ts.map +0 -1
  170. package/dist/commands/detect-secrets.js +0 -210
  171. package/dist/commands/detect-secrets.js.map +0 -1
  172. package/dist/commands/discover-check.d.ts +0 -19
  173. package/dist/commands/discover-check.d.ts.map +0 -1
  174. package/dist/commands/discover-check.js +0 -256
  175. package/dist/commands/discover-check.js.map +0 -1
  176. package/dist/commands/discover-gate.d.ts +0 -20
  177. package/dist/commands/discover-gate.d.ts.map +0 -1
  178. package/dist/commands/discover-gate.js +0 -131
  179. package/dist/commands/discover-gate.js.map +0 -1
  180. package/dist/commands/discover.d.ts +0 -14
  181. package/dist/commands/discover.d.ts.map +0 -1
  182. package/dist/commands/discover.js +0 -132
  183. package/dist/commands/discover.js.map +0 -1
  184. package/dist/commands/doctor.d.ts +0 -9
  185. package/dist/commands/doctor.d.ts.map +0 -1
  186. package/dist/commands/doctor.js +0 -277
  187. package/dist/commands/doctor.js.map +0 -1
  188. package/dist/commands/drift.d.ts +0 -2
  189. package/dist/commands/drift.d.ts.map +0 -1
  190. package/dist/commands/drift.js +0 -171
  191. package/dist/commands/drift.js.map +0 -1
  192. package/dist/commands/ecl.d.ts +0 -11
  193. package/dist/commands/ecl.d.ts.map +0 -1
  194. package/dist/commands/ecl.js +0 -109
  195. package/dist/commands/ecl.js.map +0 -1
  196. package/dist/commands/enable.d.ts +0 -7
  197. package/dist/commands/enable.d.ts.map +0 -1
  198. package/dist/commands/enable.js +0 -75
  199. package/dist/commands/enable.js.map +0 -1
  200. package/dist/commands/evidence.d.ts +0 -2
  201. package/dist/commands/evidence.d.ts.map +0 -1
  202. package/dist/commands/evidence.js +0 -53
  203. package/dist/commands/evidence.js.map +0 -1
  204. package/dist/commands/features.d.ts +0 -2
  205. package/dist/commands/features.d.ts.map +0 -1
  206. package/dist/commands/features.js +0 -185
  207. package/dist/commands/features.js.map +0 -1
  208. package/dist/commands/fix.d.ts +0 -7
  209. package/dist/commands/fix.d.ts.map +0 -1
  210. package/dist/commands/fix.js +0 -107
  211. package/dist/commands/fix.js.map +0 -1
  212. package/dist/commands/fleet.d.ts +0 -17
  213. package/dist/commands/fleet.d.ts.map +0 -1
  214. package/dist/commands/fleet.js +0 -682
  215. package/dist/commands/fleet.js.map +0 -1
  216. package/dist/commands/graph.d.ts +0 -18
  217. package/dist/commands/graph.d.ts.map +0 -1
  218. package/dist/commands/graph.js +0 -370
  219. package/dist/commands/graph.js.map +0 -1
  220. package/dist/commands/guardrails.d.ts +0 -11
  221. package/dist/commands/guardrails.d.ts.map +0 -1
  222. package/dist/commands/guardrails.js +0 -112
  223. package/dist/commands/guardrails.js.map +0 -1
  224. package/dist/commands/harvest.d.ts +0 -2
  225. package/dist/commands/harvest.d.ts.map +0 -1
  226. package/dist/commands/harvest.js +0 -136
  227. package/dist/commands/harvest.js.map +0 -1
  228. package/dist/commands/health.d.ts +0 -8
  229. package/dist/commands/health.d.ts.map +0 -1
  230. package/dist/commands/health.js +0 -101
  231. package/dist/commands/health.js.map +0 -1
  232. package/dist/commands/hotspots.d.ts +0 -2
  233. package/dist/commands/hotspots.d.ts.map +0 -1
  234. package/dist/commands/hotspots.js +0 -20
  235. package/dist/commands/hotspots.js.map +0 -1
  236. package/dist/commands/init.d.ts +0 -12
  237. package/dist/commands/init.d.ts.map +0 -1
  238. package/dist/commands/init.js +0 -423
  239. package/dist/commands/init.js.map +0 -1
  240. package/dist/commands/insight-seed.d.ts +0 -2
  241. package/dist/commands/insight-seed.d.ts.map +0 -1
  242. package/dist/commands/insight-seed.js +0 -59
  243. package/dist/commands/insight-seed.js.map +0 -1
  244. package/dist/commands/insight-smoke-test.d.ts +0 -2
  245. package/dist/commands/insight-smoke-test.d.ts.map +0 -1
  246. package/dist/commands/insight-smoke-test.js +0 -44
  247. package/dist/commands/insight-smoke-test.js.map +0 -1
  248. package/dist/commands/insight.d.ts +0 -2
  249. package/dist/commands/insight.d.ts.map +0 -1
  250. package/dist/commands/insight.js +0 -183
  251. package/dist/commands/insight.js.map +0 -1
  252. package/dist/commands/intent.d.ts +0 -39
  253. package/dist/commands/intent.d.ts.map +0 -1
  254. package/dist/commands/intent.js +0 -539
  255. package/dist/commands/intent.js.map +0 -1
  256. package/dist/commands/intervene.d.ts +0 -11
  257. package/dist/commands/intervene.d.ts.map +0 -1
  258. package/dist/commands/intervene.js +0 -94
  259. package/dist/commands/intervene.js.map +0 -1
  260. package/dist/commands/interventions.d.ts +0 -8
  261. package/dist/commands/interventions.d.ts.map +0 -1
  262. package/dist/commands/interventions.js +0 -69
  263. package/dist/commands/interventions.js.map +0 -1
  264. package/dist/commands/learn.d.ts +0 -8
  265. package/dist/commands/learn.d.ts.map +0 -1
  266. package/dist/commands/learn.js +0 -33
  267. package/dist/commands/learn.js.map +0 -1
  268. package/dist/commands/ledger.d.ts +0 -15
  269. package/dist/commands/ledger.d.ts.map +0 -1
  270. package/dist/commands/ledger.js +0 -137
  271. package/dist/commands/ledger.js.map +0 -1
  272. package/dist/commands/lessons.d.ts +0 -14
  273. package/dist/commands/lessons.d.ts.map +0 -1
  274. package/dist/commands/lessons.js +0 -196
  275. package/dist/commands/lessons.js.map +0 -1
  276. package/dist/commands/license-utils.d.ts +0 -36
  277. package/dist/commands/license-utils.d.ts.map +0 -1
  278. package/dist/commands/license-utils.js +0 -74
  279. package/dist/commands/license-utils.js.map +0 -1
  280. package/dist/commands/license.d.ts +0 -50
  281. package/dist/commands/license.d.ts.map +0 -1
  282. package/dist/commands/license.js +0 -281
  283. package/dist/commands/license.js.map +0 -1
  284. package/dist/commands/manifest.d.ts +0 -8
  285. package/dist/commands/manifest.d.ts.map +0 -1
  286. package/dist/commands/manifest.js +0 -144
  287. package/dist/commands/manifest.js.map +0 -1
  288. package/dist/commands/mcp.d.ts +0 -14
  289. package/dist/commands/mcp.d.ts.map +0 -1
  290. package/dist/commands/mcp.js +0 -70
  291. package/dist/commands/mcp.js.map +0 -1
  292. package/dist/commands/memory.d.ts +0 -16
  293. package/dist/commands/memory.d.ts.map +0 -1
  294. package/dist/commands/memory.js +0 -621
  295. package/dist/commands/memory.js.map +0 -1
  296. package/dist/commands/merge-check.d.ts +0 -15
  297. package/dist/commands/merge-check.d.ts.map +0 -1
  298. package/dist/commands/merge-check.js +0 -164
  299. package/dist/commands/merge-check.js.map +0 -1
  300. package/dist/commands/open-init.d.ts +0 -13
  301. package/dist/commands/open-init.d.ts.map +0 -1
  302. package/dist/commands/open-init.js +0 -115
  303. package/dist/commands/open-init.js.map +0 -1
  304. package/dist/commands/open-license.d.ts +0 -11
  305. package/dist/commands/open-license.d.ts.map +0 -1
  306. package/dist/commands/open-license.js +0 -98
  307. package/dist/commands/open-license.js.map +0 -1
  308. package/dist/commands/orchestrate.d.ts +0 -12
  309. package/dist/commands/orchestrate.d.ts.map +0 -1
  310. package/dist/commands/orchestrate.js +0 -119
  311. package/dist/commands/orchestrate.js.map +0 -1
  312. package/dist/commands/outcome.d.ts +0 -2
  313. package/dist/commands/outcome.d.ts.map +0 -1
  314. package/dist/commands/outcome.js +0 -121
  315. package/dist/commands/outcome.js.map +0 -1
  316. package/dist/commands/pack.d.ts +0 -12
  317. package/dist/commands/pack.d.ts.map +0 -1
  318. package/dist/commands/pack.js +0 -75
  319. package/dist/commands/pack.js.map +0 -1
  320. package/dist/commands/policy-author.d.ts +0 -48
  321. package/dist/commands/policy-author.d.ts.map +0 -1
  322. package/dist/commands/policy-author.js +0 -396
  323. package/dist/commands/policy-author.js.map +0 -1
  324. package/dist/commands/policy-simulate.d.ts +0 -9
  325. package/dist/commands/policy-simulate.d.ts.map +0 -1
  326. package/dist/commands/policy-simulate.js +0 -46
  327. package/dist/commands/policy-simulate.js.map +0 -1
  328. package/dist/commands/policy.d.ts +0 -9
  329. package/dist/commands/policy.d.ts.map +0 -1
  330. package/dist/commands/policy.js +0 -121
  331. package/dist/commands/policy.js.map +0 -1
  332. package/dist/commands/post-merge-outcome.d.ts +0 -2
  333. package/dist/commands/post-merge-outcome.d.ts.map +0 -1
  334. package/dist/commands/post-merge-outcome.js +0 -32
  335. package/dist/commands/post-merge-outcome.js.map +0 -1
  336. package/dist/commands/pr-check.d.ts +0 -18
  337. package/dist/commands/pr-check.d.ts.map +0 -1
  338. package/dist/commands/pr-check.js +0 -299
  339. package/dist/commands/pr-check.js.map +0 -1
  340. package/dist/commands/pr-comment.d.ts +0 -2
  341. package/dist/commands/pr-comment.d.ts.map +0 -1
  342. package/dist/commands/pr-comment.js +0 -96
  343. package/dist/commands/pr-comment.js.map +0 -1
  344. package/dist/commands/pr-summary.d.ts +0 -59
  345. package/dist/commands/pr-summary.d.ts.map +0 -1
  346. package/dist/commands/pr-summary.js +0 -524
  347. package/dist/commands/pr-summary.js.map +0 -1
  348. package/dist/commands/pre-pr.d.ts +0 -14
  349. package/dist/commands/pre-pr.d.ts.map +0 -1
  350. package/dist/commands/pre-pr.js +0 -57
  351. package/dist/commands/pre-pr.js.map +0 -1
  352. package/dist/commands/preflight.d.ts +0 -2
  353. package/dist/commands/preflight.d.ts.map +0 -1
  354. package/dist/commands/preflight.js +0 -48
  355. package/dist/commands/preflight.js.map +0 -1
  356. package/dist/commands/progress-check.d.ts +0 -14
  357. package/dist/commands/progress-check.d.ts.map +0 -1
  358. package/dist/commands/progress-check.js +0 -153
  359. package/dist/commands/progress-check.js.map +0 -1
  360. package/dist/commands/provenance.d.ts +0 -10
  361. package/dist/commands/provenance.d.ts.map +0 -1
  362. package/dist/commands/provenance.js +0 -103
  363. package/dist/commands/provenance.js.map +0 -1
  364. package/dist/commands/pulse.d.ts +0 -12
  365. package/dist/commands/pulse.d.ts.map +0 -1
  366. package/dist/commands/pulse.js +0 -61
  367. package/dist/commands/pulse.js.map +0 -1
  368. package/dist/commands/reality-check.d.ts +0 -4
  369. package/dist/commands/reality-check.d.ts.map +0 -1
  370. package/dist/commands/reality-check.js +0 -133
  371. package/dist/commands/reality-check.js.map +0 -1
  372. package/dist/commands/refine.d.ts +0 -17
  373. package/dist/commands/refine.d.ts.map +0 -1
  374. package/dist/commands/refine.js +0 -250
  375. package/dist/commands/refine.js.map +0 -1
  376. package/dist/commands/release-check.d.ts +0 -14
  377. package/dist/commands/release-check.d.ts.map +0 -1
  378. package/dist/commands/release-check.js +0 -44
  379. package/dist/commands/release-check.js.map +0 -1
  380. package/dist/commands/release-decision.d.ts +0 -2
  381. package/dist/commands/release-decision.d.ts.map +0 -1
  382. package/dist/commands/release-decision.js +0 -26
  383. package/dist/commands/release-decision.js.map +0 -1
  384. package/dist/commands/release-history.d.ts +0 -2
  385. package/dist/commands/release-history.d.ts.map +0 -1
  386. package/dist/commands/release-history.js +0 -34
  387. package/dist/commands/release-history.js.map +0 -1
  388. package/dist/commands/release-insights.d.ts +0 -2
  389. package/dist/commands/release-insights.d.ts.map +0 -1
  390. package/dist/commands/release-insights.js +0 -34
  391. package/dist/commands/release-insights.js.map +0 -1
  392. package/dist/commands/release-truth.d.ts +0 -2
  393. package/dist/commands/release-truth.d.ts.map +0 -1
  394. package/dist/commands/release-truth.js +0 -15
  395. package/dist/commands/release-truth.js.map +0 -1
  396. package/dist/commands/replay.d.ts +0 -2
  397. package/dist/commands/replay.d.ts.map +0 -1
  398. package/dist/commands/replay.js +0 -181
  399. package/dist/commands/replay.js.map +0 -1
  400. package/dist/commands/review-coverage.d.ts +0 -12
  401. package/dist/commands/review-coverage.d.ts.map +0 -1
  402. package/dist/commands/review-coverage.js +0 -142
  403. package/dist/commands/review-coverage.js.map +0 -1
  404. package/dist/commands/review-gate.d.ts +0 -12
  405. package/dist/commands/review-gate.d.ts.map +0 -1
  406. package/dist/commands/review-gate.js +0 -130
  407. package/dist/commands/review-gate.js.map +0 -1
  408. package/dist/commands/run.d.ts +0 -2
  409. package/dist/commands/run.d.ts.map +0 -1
  410. package/dist/commands/run.js +0 -84
  411. package/dist/commands/run.js.map +0 -1
  412. package/dist/commands/runs.d.ts +0 -2
  413. package/dist/commands/runs.d.ts.map +0 -1
  414. package/dist/commands/runs.js +0 -61
  415. package/dist/commands/runs.js.map +0 -1
  416. package/dist/commands/scan.d.ts +0 -2
  417. package/dist/commands/scan.d.ts.map +0 -1
  418. package/dist/commands/scan.js +0 -349
  419. package/dist/commands/scan.js.map +0 -1
  420. package/dist/commands/serve.d.ts +0 -32
  421. package/dist/commands/serve.d.ts.map +0 -1
  422. package/dist/commands/serve.js +0 -904
  423. package/dist/commands/serve.js.map +0 -1
  424. package/dist/commands/session-cleanup.d.ts +0 -11
  425. package/dist/commands/session-cleanup.d.ts.map +0 -1
  426. package/dist/commands/session-cleanup.js +0 -85
  427. package/dist/commands/session-cleanup.js.map +0 -1
  428. package/dist/commands/session-init.d.ts +0 -10
  429. package/dist/commands/session-init.d.ts.map +0 -1
  430. package/dist/commands/session-init.js +0 -46
  431. package/dist/commands/session-init.js.map +0 -1
  432. package/dist/commands/session-progress.d.ts +0 -12
  433. package/dist/commands/session-progress.d.ts.map +0 -1
  434. package/dist/commands/session-progress.js +0 -287
  435. package/dist/commands/session-progress.js.map +0 -1
  436. package/dist/commands/session-summary.d.ts +0 -14
  437. package/dist/commands/session-summary.d.ts.map +0 -1
  438. package/dist/commands/session-summary.js +0 -1413
  439. package/dist/commands/session-summary.js.map +0 -1
  440. package/dist/commands/sessions.d.ts +0 -9
  441. package/dist/commands/sessions.d.ts.map +0 -1
  442. package/dist/commands/sessions.js +0 -60
  443. package/dist/commands/sessions.js.map +0 -1
  444. package/dist/commands/setup-ci.d.ts +0 -27
  445. package/dist/commands/setup-ci.d.ts.map +0 -1
  446. package/dist/commands/setup-ci.js +0 -487
  447. package/dist/commands/setup-ci.js.map +0 -1
  448. package/dist/commands/share.d.ts +0 -9
  449. package/dist/commands/share.d.ts.map +0 -1
  450. package/dist/commands/share.js +0 -275
  451. package/dist/commands/share.js.map +0 -1
  452. package/dist/commands/shared-summary.d.ts +0 -15
  453. package/dist/commands/shared-summary.d.ts.map +0 -1
  454. package/dist/commands/shared-summary.js +0 -194
  455. package/dist/commands/shared-summary.js.map +0 -1
  456. package/dist/commands/sign-manifest.d.ts +0 -8
  457. package/dist/commands/sign-manifest.d.ts.map +0 -1
  458. package/dist/commands/sign-manifest.js +0 -58
  459. package/dist/commands/sign-manifest.js.map +0 -1
  460. package/dist/commands/snapshot.d.ts +0 -4
  461. package/dist/commands/snapshot.d.ts.map +0 -1
  462. package/dist/commands/snapshot.js +0 -79
  463. package/dist/commands/snapshot.js.map +0 -1
  464. package/dist/commands/stats.d.ts +0 -8
  465. package/dist/commands/stats.d.ts.map +0 -1
  466. package/dist/commands/stats.js +0 -164
  467. package/dist/commands/stats.js.map +0 -1
  468. package/dist/commands/sync.d.ts +0 -9
  469. package/dist/commands/sync.d.ts.map +0 -1
  470. package/dist/commands/sync.js +0 -157
  471. package/dist/commands/sync.js.map +0 -1
  472. package/dist/commands/task.d.ts +0 -2
  473. package/dist/commands/task.d.ts.map +0 -1
  474. package/dist/commands/task.js +0 -315
  475. package/dist/commands/task.js.map +0 -1
  476. package/dist/commands/team-ledger.d.ts +0 -11
  477. package/dist/commands/team-ledger.d.ts.map +0 -1
  478. package/dist/commands/team-ledger.js +0 -77
  479. package/dist/commands/team-ledger.js.map +0 -1
  480. package/dist/commands/team-metrics.d.ts +0 -8
  481. package/dist/commands/team-metrics.d.ts.map +0 -1
  482. package/dist/commands/team-metrics.js +0 -57
  483. package/dist/commands/team-metrics.js.map +0 -1
  484. package/dist/commands/test-summary.d.ts +0 -2
  485. package/dist/commands/test-summary.d.ts.map +0 -1
  486. package/dist/commands/test-summary.js +0 -53
  487. package/dist/commands/test-summary.js.map +0 -1
  488. package/dist/commands/time-travel.d.ts +0 -2
  489. package/dist/commands/time-travel.d.ts.map +0 -1
  490. package/dist/commands/time-travel.js +0 -89
  491. package/dist/commands/time-travel.js.map +0 -1
  492. package/dist/commands/truth-utils.d.ts +0 -14
  493. package/dist/commands/truth-utils.d.ts.map +0 -1
  494. package/dist/commands/truth-utils.js +0 -70
  495. package/dist/commands/truth-utils.js.map +0 -1
  496. package/dist/commands/upgrade.d.ts +0 -2
  497. package/dist/commands/upgrade.d.ts.map +0 -1
  498. package/dist/commands/upgrade.js +0 -17
  499. package/dist/commands/upgrade.js.map +0 -1
  500. package/dist/commands/vendor.d.ts +0 -20
  501. package/dist/commands/vendor.d.ts.map +0 -1
  502. package/dist/commands/vendor.js +0 -205
  503. package/dist/commands/vendor.js.map +0 -1
  504. package/dist/commands/verify.d.ts +0 -36
  505. package/dist/commands/verify.d.ts.map +0 -1
  506. package/dist/commands/verify.js +0 -761
  507. package/dist/commands/verify.js.map +0 -1
  508. package/dist/completion-integrity/claims.d.ts +0 -21
  509. package/dist/completion-integrity/claims.d.ts.map +0 -1
  510. package/dist/completion-integrity/claims.js +0 -99
  511. package/dist/completion-integrity/claims.js.map +0 -1
  512. package/dist/completion-integrity/confidence.d.ts +0 -30
  513. package/dist/completion-integrity/confidence.d.ts.map +0 -1
  514. package/dist/completion-integrity/confidence.js +0 -86
  515. package/dist/completion-integrity/confidence.js.map +0 -1
  516. package/dist/completion-integrity/ghost-detector.d.ts +0 -37
  517. package/dist/completion-integrity/ghost-detector.d.ts.map +0 -1
  518. package/dist/completion-integrity/ghost-detector.js +0 -93
  519. package/dist/completion-integrity/ghost-detector.js.map +0 -1
  520. package/dist/completion-integrity/history.d.ts +0 -19
  521. package/dist/completion-integrity/history.d.ts.map +0 -1
  522. package/dist/completion-integrity/history.js +0 -44
  523. package/dist/completion-integrity/history.js.map +0 -1
  524. package/dist/completion-integrity/index.d.ts +0 -25
  525. package/dist/completion-integrity/index.d.ts.map +0 -1
  526. package/dist/completion-integrity/index.js +0 -251
  527. package/dist/completion-integrity/index.js.map +0 -1
  528. package/dist/completion-integrity/neighborhood.d.ts +0 -21
  529. package/dist/completion-integrity/neighborhood.d.ts.map +0 -1
  530. package/dist/completion-integrity/neighborhood.js +0 -274
  531. package/dist/completion-integrity/neighborhood.js.map +0 -1
  532. package/dist/completion-integrity/notary.d.ts +0 -3
  533. package/dist/completion-integrity/notary.d.ts.map +0 -1
  534. package/dist/completion-integrity/notary.js +0 -124
  535. package/dist/completion-integrity/notary.js.map +0 -1
  536. package/dist/completion-integrity/output.d.ts +0 -11
  537. package/dist/completion-integrity/output.d.ts.map +0 -1
  538. package/dist/completion-integrity/output.js +0 -228
  539. package/dist/completion-integrity/output.js.map +0 -1
  540. package/dist/completion-integrity/self-audit.d.ts +0 -28
  541. package/dist/completion-integrity/self-audit.d.ts.map +0 -1
  542. package/dist/completion-integrity/self-audit.js +0 -194
  543. package/dist/completion-integrity/self-audit.js.map +0 -1
  544. package/dist/completion-integrity/semantic-drift.d.ts +0 -22
  545. package/dist/completion-integrity/semantic-drift.d.ts.map +0 -1
  546. package/dist/completion-integrity/semantic-drift.js +0 -138
  547. package/dist/completion-integrity/semantic-drift.js.map +0 -1
  548. package/dist/completion-integrity/state-machine.d.ts +0 -36
  549. package/dist/completion-integrity/state-machine.d.ts.map +0 -1
  550. package/dist/completion-integrity/state-machine.js +0 -138
  551. package/dist/completion-integrity/state-machine.js.map +0 -1
  552. package/dist/completion-integrity/types.d.ts +0 -69
  553. package/dist/completion-integrity/types.d.ts.map +0 -1
  554. package/dist/completion-integrity/types.js +0 -4
  555. package/dist/completion-integrity/types.js.map +0 -1
  556. package/dist/context-engine/contract.d.ts +0 -12
  557. package/dist/context-engine/contract.d.ts.map +0 -1
  558. package/dist/context-engine/contract.js +0 -227
  559. package/dist/context-engine/contract.js.map +0 -1
  560. package/dist/context-engine/delta.d.ts +0 -10
  561. package/dist/context-engine/delta.d.ts.map +0 -1
  562. package/dist/context-engine/delta.js +0 -78
  563. package/dist/context-engine/delta.js.map +0 -1
  564. package/dist/context-engine/index.d.ts +0 -6
  565. package/dist/context-engine/index.d.ts.map +0 -1
  566. package/dist/context-engine/index.js +0 -5
  567. package/dist/context-engine/index.js.map +0 -1
  568. package/dist/context-engine/policy-evaluator.d.ts +0 -32
  569. package/dist/context-engine/policy-evaluator.d.ts.map +0 -1
  570. package/dist/context-engine/policy-evaluator.js +0 -69
  571. package/dist/context-engine/policy-evaluator.js.map +0 -1
  572. package/dist/context-engine/renderer.d.ts +0 -9
  573. package/dist/context-engine/renderer.d.ts.map +0 -1
  574. package/dist/context-engine/renderer.js +0 -28
  575. package/dist/context-engine/renderer.js.map +0 -1
  576. package/dist/context-engine/renderers/claude.d.ts +0 -3
  577. package/dist/context-engine/renderers/claude.d.ts.map +0 -1
  578. package/dist/context-engine/renderers/claude.js +0 -223
  579. package/dist/context-engine/renderers/claude.js.map +0 -1
  580. package/dist/context-engine/renderers/cursor.d.ts +0 -3
  581. package/dist/context-engine/renderers/cursor.d.ts.map +0 -1
  582. package/dist/context-engine/renderers/cursor.js +0 -158
  583. package/dist/context-engine/renderers/cursor.js.map +0 -1
  584. package/dist/context-engine/renderers/generic.d.ts +0 -3
  585. package/dist/context-engine/renderers/generic.d.ts.map +0 -1
  586. package/dist/context-engine/renderers/generic.js +0 -180
  587. package/dist/context-engine/renderers/generic.js.map +0 -1
  588. package/dist/coordination/index.d.ts +0 -69
  589. package/dist/coordination/index.d.ts.map +0 -1
  590. package/dist/coordination/index.js +0 -1110
  591. package/dist/coordination/index.js.map +0 -1
  592. package/dist/discovery/blast-radius.d.ts +0 -15
  593. package/dist/discovery/blast-radius.d.ts.map +0 -1
  594. package/dist/discovery/blast-radius.js +0 -160
  595. package/dist/discovery/blast-radius.js.map +0 -1
  596. package/dist/discovery/cache.d.ts +0 -38
  597. package/dist/discovery/cache.d.ts.map +0 -1
  598. package/dist/discovery/cache.js +0 -87
  599. package/dist/discovery/cache.js.map +0 -1
  600. package/dist/discovery/diff-compliance.d.ts +0 -19
  601. package/dist/discovery/diff-compliance.d.ts.map +0 -1
  602. package/dist/discovery/diff-compliance.js +0 -96
  603. package/dist/discovery/diff-compliance.js.map +0 -1
  604. package/dist/discovery/duplicate-detection.d.ts +0 -29
  605. package/dist/discovery/duplicate-detection.d.ts.map +0 -1
  606. package/dist/discovery/duplicate-detection.js +0 -133
  607. package/dist/discovery/duplicate-detection.js.map +0 -1
  608. package/dist/discovery/gap-analysis.d.ts +0 -16
  609. package/dist/discovery/gap-analysis.d.ts.map +0 -1
  610. package/dist/discovery/gap-analysis.js +0 -199
  611. package/dist/discovery/gap-analysis.js.map +0 -1
  612. package/dist/discovery/index.d.ts +0 -18
  613. package/dist/discovery/index.d.ts.map +0 -1
  614. package/dist/discovery/index.js +0 -565
  615. package/dist/discovery/index.js.map +0 -1
  616. package/dist/discovery/override.d.ts +0 -19
  617. package/dist/discovery/override.d.ts.map +0 -1
  618. package/dist/discovery/override.js +0 -113
  619. package/dist/discovery/override.js.map +0 -1
  620. package/dist/discovery/scoring.d.ts +0 -35
  621. package/dist/discovery/scoring.d.ts.map +0 -1
  622. package/dist/discovery/scoring.js +0 -194
  623. package/dist/discovery/scoring.js.map +0 -1
  624. package/dist/discovery/source-of-truth.d.ts +0 -17
  625. package/dist/discovery/source-of-truth.d.ts.map +0 -1
  626. package/dist/discovery/source-of-truth.js +0 -182
  627. package/dist/discovery/source-of-truth.js.map +0 -1
  628. package/dist/discovery/symbol-growth.d.ts +0 -20
  629. package/dist/discovery/symbol-growth.d.ts.map +0 -1
  630. package/dist/discovery/symbol-growth.js +0 -111
  631. package/dist/discovery/symbol-growth.js.map +0 -1
  632. package/dist/ecl/git-sync.d.ts +0 -53
  633. package/dist/ecl/git-sync.d.ts.map +0 -1
  634. package/dist/ecl/git-sync.js +0 -182
  635. package/dist/ecl/git-sync.js.map +0 -1
  636. package/dist/ecl/lifecycle.d.ts +0 -107
  637. package/dist/ecl/lifecycle.d.ts.map +0 -1
  638. package/dist/ecl/lifecycle.js +0 -264
  639. package/dist/ecl/lifecycle.js.map +0 -1
  640. package/dist/ecl/persistence.d.ts +0 -108
  641. package/dist/ecl/persistence.d.ts.map +0 -1
  642. package/dist/ecl/persistence.js +0 -362
  643. package/dist/ecl/persistence.js.map +0 -1
  644. package/dist/ecl/sync.d.ts +0 -43
  645. package/dist/ecl/sync.d.ts.map +0 -1
  646. package/dist/ecl/sync.js +0 -155
  647. package/dist/ecl/sync.js.map +0 -1
  648. package/dist/feedback/index.d.ts +0 -35
  649. package/dist/feedback/index.d.ts.map +0 -1
  650. package/dist/feedback/index.js +0 -81
  651. package/dist/feedback/index.js.map +0 -1
  652. package/dist/guardrails/adversarial-trigger.d.ts +0 -15
  653. package/dist/guardrails/adversarial-trigger.d.ts.map +0 -1
  654. package/dist/guardrails/adversarial-trigger.js +0 -86
  655. package/dist/guardrails/adversarial-trigger.js.map +0 -1
  656. package/dist/guardrails/export-collision.d.ts +0 -11
  657. package/dist/guardrails/export-collision.d.ts.map +0 -1
  658. package/dist/guardrails/export-collision.js +0 -141
  659. package/dist/guardrails/export-collision.js.map +0 -1
  660. package/dist/guardrails/index.d.ts +0 -24
  661. package/dist/guardrails/index.d.ts.map +0 -1
  662. package/dist/guardrails/index.js +0 -24
  663. package/dist/guardrails/index.js.map +0 -1
  664. package/dist/guardrails/release-tag.d.ts +0 -10
  665. package/dist/guardrails/release-tag.d.ts.map +0 -1
  666. package/dist/guardrails/release-tag.js +0 -99
  667. package/dist/guardrails/release-tag.js.map +0 -1
  668. package/dist/guardrails/rename-integrity.d.ts +0 -13
  669. package/dist/guardrails/rename-integrity.d.ts.map +0 -1
  670. package/dist/guardrails/rename-integrity.js +0 -111
  671. package/dist/guardrails/rename-integrity.js.map +0 -1
  672. package/dist/guardrails/runner.d.ts +0 -10
  673. package/dist/guardrails/runner.d.ts.map +0 -1
  674. package/dist/guardrails/runner.js +0 -36
  675. package/dist/guardrails/runner.js.map +0 -1
  676. package/dist/guardrails/stale-artifact.d.ts +0 -11
  677. package/dist/guardrails/stale-artifact.d.ts.map +0 -1
  678. package/dist/guardrails/stale-artifact.js +0 -69
  679. package/dist/guardrails/stale-artifact.js.map +0 -1
  680. package/dist/guardrails/unused-parameter.d.ts +0 -11
  681. package/dist/guardrails/unused-parameter.d.ts.map +0 -1
  682. package/dist/guardrails/unused-parameter.js +0 -105
  683. package/dist/guardrails/unused-parameter.js.map +0 -1
  684. package/dist/guardrails/workspace-validation.d.ts +0 -12
  685. package/dist/guardrails/workspace-validation.d.ts.map +0 -1
  686. package/dist/guardrails/workspace-validation.js +0 -92
  687. package/dist/guardrails/workspace-validation.js.map +0 -1
  688. package/dist/health/advisor.d.ts +0 -18
  689. package/dist/health/advisor.d.ts.map +0 -1
  690. package/dist/health/advisor.js +0 -174
  691. package/dist/health/advisor.js.map +0 -1
  692. package/dist/health/dashboard.d.ts +0 -96
  693. package/dist/health/dashboard.d.ts.map +0 -1
  694. package/dist/health/dashboard.js +0 -470
  695. package/dist/health/dashboard.js.map +0 -1
  696. package/dist/hooks/discovery-enforcement.d.ts +0 -9
  697. package/dist/hooks/discovery-enforcement.d.ts.map +0 -1
  698. package/dist/hooks/discovery-enforcement.js +0 -137
  699. package/dist/hooks/discovery-enforcement.js.map +0 -1
  700. package/dist/hooks/discovery-hook.d.ts +0 -22
  701. package/dist/hooks/discovery-hook.d.ts.map +0 -1
  702. package/dist/hooks/discovery-hook.js +0 -199
  703. package/dist/hooks/discovery-hook.js.map +0 -1
  704. package/dist/index.d.ts +0 -3
  705. package/dist/index.d.ts.map +0 -1
  706. package/dist/index.js +0 -1499
  707. package/dist/index.js.map +0 -1
  708. package/dist/insight/emit.d.ts +0 -19
  709. package/dist/insight/emit.d.ts.map +0 -1
  710. package/dist/insight/emit.js +0 -107
  711. package/dist/insight/emit.js.map +0 -1
  712. package/dist/insight/engine-bridge.d.ts +0 -7
  713. package/dist/insight/engine-bridge.d.ts.map +0 -1
  714. package/dist/insight/engine-bridge.js +0 -6
  715. package/dist/insight/engine-bridge.js.map +0 -1
  716. package/dist/insight/index.d.ts +0 -3
  717. package/dist/insight/index.d.ts.map +0 -1
  718. package/dist/insight/index.js +0 -2
  719. package/dist/insight/index.js.map +0 -1
  720. package/dist/insight/telemetry.d.ts +0 -14
  721. package/dist/insight/telemetry.d.ts.map +0 -1
  722. package/dist/insight/telemetry.js +0 -87
  723. package/dist/insight/telemetry.js.map +0 -1
  724. package/dist/intake/candidate-paths/CandidatePathDetector.d.ts +0 -5
  725. package/dist/intake/candidate-paths/CandidatePathDetector.d.ts.map +0 -1
  726. package/dist/intake/candidate-paths/CandidatePathDetector.js +0 -173
  727. package/dist/intake/candidate-paths/CandidatePathDetector.js.map +0 -1
  728. package/dist/intake/candidate-paths/anchorRadiusExpansion.d.ts +0 -4
  729. package/dist/intake/candidate-paths/anchorRadiusExpansion.d.ts.map +0 -1
  730. package/dist/intake/candidate-paths/anchorRadiusExpansion.js +0 -66
  731. package/dist/intake/candidate-paths/anchorRadiusExpansion.js.map +0 -1
  732. package/dist/intake/candidate-paths/applyNegativeFiltering.d.ts +0 -4
  733. package/dist/intake/candidate-paths/applyNegativeFiltering.d.ts.map +0 -1
  734. package/dist/intake/candidate-paths/applyNegativeFiltering.js +0 -24
  735. package/dist/intake/candidate-paths/applyNegativeFiltering.js.map +0 -1
  736. package/dist/intake/candidate-paths/coCommitAnalyzer.d.ts +0 -3
  737. package/dist/intake/candidate-paths/coCommitAnalyzer.d.ts.map +0 -1
  738. package/dist/intake/candidate-paths/coCommitAnalyzer.js +0 -27
  739. package/dist/intake/candidate-paths/coCommitAnalyzer.js.map +0 -1
  740. package/dist/intake/candidate-paths/computeConfidence.d.ts +0 -3
  741. package/dist/intake/candidate-paths/computeConfidence.d.ts.map +0 -1
  742. package/dist/intake/candidate-paths/computeConfidence.js +0 -14
  743. package/dist/intake/candidate-paths/computeConfidence.js.map +0 -1
  744. package/dist/intake/candidate-paths/consolidateCandidates.d.ts +0 -5
  745. package/dist/intake/candidate-paths/consolidateCandidates.d.ts.map +0 -1
  746. package/dist/intake/candidate-paths/consolidateCandidates.js +0 -61
  747. package/dist/intake/candidate-paths/consolidateCandidates.js.map +0 -1
  748. package/dist/intake/candidate-paths/hierarchicalMatching.d.ts +0 -7
  749. package/dist/intake/candidate-paths/hierarchicalMatching.d.ts.map +0 -1
  750. package/dist/intake/candidate-paths/hierarchicalMatching.js +0 -46
  751. package/dist/intake/candidate-paths/hierarchicalMatching.js.map +0 -1
  752. package/dist/intake/candidate-paths/integration.d.ts +0 -7
  753. package/dist/intake/candidate-paths/integration.d.ts.map +0 -1
  754. package/dist/intake/candidate-paths/integration.js +0 -63
  755. package/dist/intake/candidate-paths/integration.js.map +0 -1
  756. package/dist/intake/candidate-paths/pathDetectionOverrides.d.ts +0 -3
  757. package/dist/intake/candidate-paths/pathDetectionOverrides.d.ts.map +0 -1
  758. package/dist/intake/candidate-paths/pathDetectionOverrides.js +0 -134
  759. package/dist/intake/candidate-paths/pathDetectionOverrides.js.map +0 -1
  760. package/dist/intake/candidate-paths/repoIndexAdapter.d.ts +0 -4
  761. package/dist/intake/candidate-paths/repoIndexAdapter.d.ts.map +0 -1
  762. package/dist/intake/candidate-paths/repoIndexAdapter.js +0 -99
  763. package/dist/intake/candidate-paths/repoIndexAdapter.js.map +0 -1
  764. package/dist/intake/candidate-paths/resolveExplicitTargets.d.ts +0 -8
  765. package/dist/intake/candidate-paths/resolveExplicitTargets.d.ts.map +0 -1
  766. package/dist/intake/candidate-paths/resolveExplicitTargets.js +0 -65
  767. package/dist/intake/candidate-paths/resolveExplicitTargets.js.map +0 -1
  768. package/dist/intake/candidate-paths/rules.d.ts +0 -13
  769. package/dist/intake/candidate-paths/rules.d.ts.map +0 -1
  770. package/dist/intake/candidate-paths/rules.js +0 -64
  771. package/dist/intake/candidate-paths/rules.js.map +0 -1
  772. package/dist/intake/candidate-paths/scoreIntentSurfaceMatches.d.ts +0 -10
  773. package/dist/intake/candidate-paths/scoreIntentSurfaceMatches.d.ts.map +0 -1
  774. package/dist/intake/candidate-paths/scoreIntentSurfaceMatches.js +0 -73
  775. package/dist/intake/candidate-paths/scoreIntentSurfaceMatches.js.map +0 -1
  776. package/dist/intake/candidate-paths/shapeEstimator.d.ts +0 -3
  777. package/dist/intake/candidate-paths/shapeEstimator.d.ts.map +0 -1
  778. package/dist/intake/candidate-paths/shapeEstimator.js +0 -17
  779. package/dist/intake/candidate-paths/shapeEstimator.js.map +0 -1
  780. package/dist/intake/candidate-paths/types.d.ts +0 -148
  781. package/dist/intake/candidate-paths/types.d.ts.map +0 -1
  782. package/dist/intake/candidate-paths/types.js +0 -2
  783. package/dist/intake/candidate-paths/types.js.map +0 -1
  784. package/dist/intake/task-classifier/TaskClassifier.d.ts +0 -5
  785. package/dist/intake/task-classifier/TaskClassifier.d.ts.map +0 -1
  786. package/dist/intake/task-classifier/TaskClassifier.js +0 -96
  787. package/dist/intake/task-classifier/TaskClassifier.js.map +0 -1
  788. package/dist/intake/task-classifier/applyOverrides.d.ts +0 -3
  789. package/dist/intake/task-classifier/applyOverrides.d.ts.map +0 -1
  790. package/dist/intake/task-classifier/applyOverrides.js +0 -55
  791. package/dist/intake/task-classifier/applyOverrides.js.map +0 -1
  792. package/dist/intake/task-classifier/computeConfidence.d.ts +0 -3
  793. package/dist/intake/task-classifier/computeConfidence.d.ts.map +0 -1
  794. package/dist/intake/task-classifier/computeConfidence.js +0 -13
  795. package/dist/intake/task-classifier/computeConfidence.js.map +0 -1
  796. package/dist/intake/task-classifier/deriveRiskAndComplexity.d.ts +0 -4
  797. package/dist/intake/task-classifier/deriveRiskAndComplexity.d.ts.map +0 -1
  798. package/dist/intake/task-classifier/deriveRiskAndComplexity.js +0 -24
  799. package/dist/intake/task-classifier/deriveRiskAndComplexity.js.map +0 -1
  800. package/dist/intake/task-classifier/deriveTags.d.ts +0 -3
  801. package/dist/intake/task-classifier/deriveTags.d.ts.map +0 -1
  802. package/dist/intake/task-classifier/deriveTags.js +0 -43
  803. package/dist/intake/task-classifier/deriveTags.js.map +0 -1
  804. package/dist/intake/task-classifier/index.d.ts +0 -6
  805. package/dist/intake/task-classifier/index.d.ts.map +0 -1
  806. package/dist/intake/task-classifier/index.js +0 -6
  807. package/dist/intake/task-classifier/index.js.map +0 -1
  808. package/dist/intake/task-classifier/mergeScores.d.ts +0 -4
  809. package/dist/intake/task-classifier/mergeScores.d.ts.map +0 -1
  810. package/dist/intake/task-classifier/mergeScores.js +0 -68
  811. package/dist/intake/task-classifier/mergeScores.js.map +0 -1
  812. package/dist/intake/task-classifier/pathMatching.d.ts +0 -3
  813. package/dist/intake/task-classifier/pathMatching.d.ts.map +0 -1
  814. package/dist/intake/task-classifier/pathMatching.js +0 -33
  815. package/dist/intake/task-classifier/pathMatching.js.map +0 -1
  816. package/dist/intake/task-classifier/rules.d.ts +0 -28
  817. package/dist/intake/task-classifier/rules.d.ts.map +0 -1
  818. package/dist/intake/task-classifier/rules.js +0 -138
  819. package/dist/intake/task-classifier/rules.js.map +0 -1
  820. package/dist/intake/task-classifier/scoreKeywords.d.ts +0 -5
  821. package/dist/intake/task-classifier/scoreKeywords.d.ts.map +0 -1
  822. package/dist/intake/task-classifier/scoreKeywords.js +0 -41
  823. package/dist/intake/task-classifier/scoreKeywords.js.map +0 -1
  824. package/dist/intake/task-classifier/scoreMetadata.d.ts +0 -3
  825. package/dist/intake/task-classifier/scoreMetadata.d.ts.map +0 -1
  826. package/dist/intake/task-classifier/scoreMetadata.js +0 -29
  827. package/dist/intake/task-classifier/scoreMetadata.js.map +0 -1
  828. package/dist/intake/task-classifier/scorePaths.d.ts +0 -3
  829. package/dist/intake/task-classifier/scorePaths.d.ts.map +0 -1
  830. package/dist/intake/task-classifier/scorePaths.js +0 -38
  831. package/dist/intake/task-classifier/scorePaths.js.map +0 -1
  832. package/dist/intake/task-classifier/types.d.ts +0 -51
  833. package/dist/intake/task-classifier/types.d.ts.map +0 -1
  834. package/dist/intake/task-classifier/types.js +0 -2
  835. package/dist/intake/task-classifier/types.js.map +0 -1
  836. package/dist/integrations/github-actions.d.ts +0 -17
  837. package/dist/integrations/github-actions.d.ts.map +0 -1
  838. package/dist/integrations/github-actions.js +0 -77
  839. package/dist/integrations/github-actions.js.map +0 -1
  840. package/dist/intent/extractor.d.ts +0 -15
  841. package/dist/intent/extractor.d.ts.map +0 -1
  842. package/dist/intent/extractor.js +0 -149
  843. package/dist/intent/extractor.js.map +0 -1
  844. package/dist/intent/fetcher.d.ts +0 -33
  845. package/dist/intent/fetcher.d.ts.map +0 -1
  846. package/dist/intent/fetcher.js +0 -364
  847. package/dist/intent/fetcher.js.map +0 -1
  848. package/dist/intent/loader.d.ts +0 -26
  849. package/dist/intent/loader.d.ts.map +0 -1
  850. package/dist/intent/loader.js +0 -80
  851. package/dist/intent/loader.js.map +0 -1
  852. package/dist/intent/types.d.ts +0 -33
  853. package/dist/intent/types.d.ts.map +0 -1
  854. package/dist/intent/types.js +0 -9
  855. package/dist/intent/types.js.map +0 -1
  856. package/dist/intervention/drift-velocity.d.ts +0 -19
  857. package/dist/intervention/drift-velocity.d.ts.map +0 -1
  858. package/dist/intervention/drift-velocity.js +0 -107
  859. package/dist/intervention/drift-velocity.js.map +0 -1
  860. package/dist/intervention/engine.d.ts +0 -43
  861. package/dist/intervention/engine.d.ts.map +0 -1
  862. package/dist/intervention/engine.js +0 -356
  863. package/dist/intervention/engine.js.map +0 -1
  864. package/dist/intervention/templates.d.ts +0 -23
  865. package/dist/intervention/templates.d.ts.map +0 -1
  866. package/dist/intervention/templates.js +0 -167
  867. package/dist/intervention/templates.js.map +0 -1
  868. package/dist/manifest/build.d.ts +0 -19
  869. package/dist/manifest/build.d.ts.map +0 -1
  870. package/dist/manifest/build.js +0 -82
  871. package/dist/manifest/build.js.map +0 -1
  872. package/dist/manifest/schema.d.ts +0 -2
  873. package/dist/manifest/schema.d.ts.map +0 -1
  874. package/dist/manifest/schema.js +0 -2
  875. package/dist/manifest/schema.js.map +0 -1
  876. package/dist/manifest/write.d.ts +0 -13
  877. package/dist/manifest/write.d.ts.map +0 -1
  878. package/dist/manifest/write.js +0 -69
  879. package/dist/manifest/write.js.map +0 -1
  880. package/dist/mcp/server.d.ts +0 -20
  881. package/dist/mcp/server.d.ts.map +0 -1
  882. package/dist/mcp/server.js +0 -271
  883. package/dist/mcp/server.js.map +0 -1
  884. package/dist/mcp/skill-template.d.ts +0 -10
  885. package/dist/mcp/skill-template.d.ts.map +0 -1
  886. package/dist/mcp/skill-template.js +0 -75
  887. package/dist/mcp/skill-template.js.map +0 -1
  888. package/dist/memory/TaskClassifier.d.ts +0 -6
  889. package/dist/memory/TaskClassifier.d.ts.map +0 -1
  890. package/dist/memory/TaskClassifier.js +0 -344
  891. package/dist/memory/TaskClassifier.js.map +0 -1
  892. package/dist/memory/context-injection.d.ts +0 -12
  893. package/dist/memory/context-injection.d.ts.map +0 -1
  894. package/dist/memory/context-injection.js +0 -550
  895. package/dist/memory/context-injection.js.map +0 -1
  896. package/dist/memory/evidence-gates.d.ts +0 -32
  897. package/dist/memory/evidence-gates.d.ts.map +0 -1
  898. package/dist/memory/evidence-gates.js +0 -168
  899. package/dist/memory/evidence-gates.js.map +0 -1
  900. package/dist/memory/golden-patterns.d.ts +0 -68
  901. package/dist/memory/golden-patterns.d.ts.map +0 -1
  902. package/dist/memory/golden-patterns.js +0 -260
  903. package/dist/memory/golden-patterns.js.map +0 -1
  904. package/dist/memory/index.d.ts +0 -11
  905. package/dist/memory/index.d.ts.map +0 -1
  906. package/dist/memory/index.js +0 -11
  907. package/dist/memory/index.js.map +0 -1
  908. package/dist/memory/lessons.d.ts +0 -88
  909. package/dist/memory/lessons.d.ts.map +0 -1
  910. package/dist/memory/lessons.js +0 -370
  911. package/dist/memory/lessons.js.map +0 -1
  912. package/dist/memory/ontology.d.ts +0 -34
  913. package/dist/memory/ontology.d.ts.map +0 -1
  914. package/dist/memory/ontology.js +0 -125
  915. package/dist/memory/ontology.js.map +0 -1
  916. package/dist/memory/policy-artifacts.d.ts +0 -31
  917. package/dist/memory/policy-artifacts.d.ts.map +0 -1
  918. package/dist/memory/policy-artifacts.js +0 -618
  919. package/dist/memory/policy-artifacts.js.map +0 -1
  920. package/dist/memory/preamble.d.ts +0 -35
  921. package/dist/memory/preamble.d.ts.map +0 -1
  922. package/dist/memory/preamble.js +0 -114
  923. package/dist/memory/preamble.js.map +0 -1
  924. package/dist/memory/recent-truth.d.ts +0 -21
  925. package/dist/memory/recent-truth.d.ts.map +0 -1
  926. package/dist/memory/recent-truth.js +0 -78
  927. package/dist/memory/recent-truth.js.map +0 -1
  928. package/dist/memory/storage.d.ts +0 -28
  929. package/dist/memory/storage.d.ts.map +0 -1
  930. package/dist/memory/storage.js +0 -204
  931. package/dist/memory/storage.js.map +0 -1
  932. package/dist/memory/structural-trust.d.ts +0 -36
  933. package/dist/memory/structural-trust.d.ts.map +0 -1
  934. package/dist/memory/structural-trust.js +0 -77
  935. package/dist/memory/structural-trust.js.map +0 -1
  936. package/dist/memory/taskClassifierOverrides.d.ts +0 -3
  937. package/dist/memory/taskClassifierOverrides.d.ts.map +0 -1
  938. package/dist/memory/taskClassifierOverrides.js +0 -153
  939. package/dist/memory/taskClassifierOverrides.js.map +0 -1
  940. package/dist/memory/taskClassifierRules.d.ts +0 -15
  941. package/dist/memory/taskClassifierRules.d.ts.map +0 -1
  942. package/dist/memory/taskClassifierRules.js +0 -277
  943. package/dist/memory/taskClassifierRules.js.map +0 -1
  944. package/dist/memory/taskClassifierTypes.d.ts +0 -40
  945. package/dist/memory/taskClassifierTypes.d.ts.map +0 -1
  946. package/dist/memory/taskClassifierTypes.js +0 -2
  947. package/dist/memory/taskClassifierTypes.js.map +0 -1
  948. package/dist/memory/validation-ledger.d.ts +0 -28
  949. package/dist/memory/validation-ledger.d.ts.map +0 -1
  950. package/dist/memory/validation-ledger.js +0 -90
  951. package/dist/memory/validation-ledger.js.map +0 -1
  952. package/dist/merge-check/hallucination-guard.d.ts +0 -49
  953. package/dist/merge-check/hallucination-guard.d.ts.map +0 -1
  954. package/dist/merge-check/hallucination-guard.js +0 -228
  955. package/dist/merge-check/hallucination-guard.js.map +0 -1
  956. package/dist/merge-check/intent-registry.d.ts +0 -42
  957. package/dist/merge-check/intent-registry.d.ts.map +0 -1
  958. package/dist/merge-check/intent-registry.js +0 -154
  959. package/dist/merge-check/intent-registry.js.map +0 -1
  960. package/dist/merge-check/sentinel.d.ts +0 -60
  961. package/dist/merge-check/sentinel.d.ts.map +0 -1
  962. package/dist/merge-check/sentinel.js +0 -399
  963. package/dist/merge-check/sentinel.js.map +0 -1
  964. package/dist/narrative/contextNarrative.d.ts +0 -22
  965. package/dist/narrative/contextNarrative.d.ts.map +0 -1
  966. package/dist/narrative/contextNarrative.js +0 -259
  967. package/dist/narrative/contextNarrative.js.map +0 -1
  968. package/dist/onboarding.d.ts +0 -37
  969. package/dist/onboarding.d.ts.map +0 -1
  970. package/dist/onboarding.js +0 -112
  971. package/dist/onboarding.js.map +0 -1
  972. package/dist/open-shell.d.ts +0 -14
  973. package/dist/open-shell.d.ts.map +0 -1
  974. package/dist/open-shell.js +0 -191
  975. package/dist/open-shell.js.map +0 -1
  976. package/dist/policy/load.d.ts +0 -21
  977. package/dist/policy/load.d.ts.map +0 -1
  978. package/dist/policy/load.js +0 -63
  979. package/dist/policy/load.js.map +0 -1
  980. package/dist/policy/realtime.d.ts +0 -17
  981. package/dist/policy/realtime.d.ts.map +0 -1
  982. package/dist/policy/realtime.js +0 -108
  983. package/dist/policy/realtime.js.map +0 -1
  984. package/dist/policy/resolve.d.ts +0 -18
  985. package/dist/policy/resolve.d.ts.map +0 -1
  986. package/dist/policy/resolve.js +0 -86
  987. package/dist/policy/resolve.js.map +0 -1
  988. package/dist/policy/schema.d.ts +0 -22
  989. package/dist/policy/schema.d.ts.map +0 -1
  990. package/dist/policy/schema.js +0 -220
  991. package/dist/policy/schema.js.map +0 -1
  992. package/dist/pr-comment/renderer.d.ts +0 -3
  993. package/dist/pr-comment/renderer.d.ts.map +0 -1
  994. package/dist/pr-comment/renderer.js +0 -32
  995. package/dist/pr-comment/renderer.js.map +0 -1
  996. package/dist/pr-comment/templates.d.ts +0 -4
  997. package/dist/pr-comment/templates.d.ts.map +0 -1
  998. package/dist/pr-comment/templates.js +0 -9
  999. package/dist/pr-comment/templates.js.map +0 -1
  1000. package/dist/pr-comment/types.d.ts +0 -13
  1001. package/dist/pr-comment/types.d.ts.map +0 -1
  1002. package/dist/pr-comment/types.js +0 -2
  1003. package/dist/pr-comment/types.js.map +0 -1
  1004. package/dist/pre-pr/checks.d.ts +0 -18
  1005. package/dist/pre-pr/checks.d.ts.map +0 -1
  1006. package/dist/pre-pr/checks.js +0 -440
  1007. package/dist/pre-pr/checks.js.map +0 -1
  1008. package/dist/pre-pr/orchestrator.d.ts +0 -30
  1009. package/dist/pre-pr/orchestrator.d.ts.map +0 -1
  1010. package/dist/pre-pr/orchestrator.js +0 -104
  1011. package/dist/pre-pr/orchestrator.js.map +0 -1
  1012. package/dist/project-config.d.ts +0 -38
  1013. package/dist/project-config.d.ts.map +0 -1
  1014. package/dist/project-config.js +0 -206
  1015. package/dist/project-config.js.map +0 -1
  1016. package/dist/prompt-coach/admission.d.ts +0 -31
  1017. package/dist/prompt-coach/admission.d.ts.map +0 -1
  1018. package/dist/prompt-coach/admission.js +0 -105
  1019. package/dist/prompt-coach/admission.js.map +0 -1
  1020. package/dist/prompt-coach/feedback.d.ts +0 -49
  1021. package/dist/prompt-coach/feedback.d.ts.map +0 -1
  1022. package/dist/prompt-coach/feedback.js +0 -177
  1023. package/dist/prompt-coach/feedback.js.map +0 -1
  1024. package/dist/prompt-coach/format.d.ts +0 -56
  1025. package/dist/prompt-coach/format.d.ts.map +0 -1
  1026. package/dist/prompt-coach/format.js +0 -190
  1027. package/dist/prompt-coach/format.js.map +0 -1
  1028. package/dist/prompt-coach/index.d.ts +0 -13
  1029. package/dist/prompt-coach/index.d.ts.map +0 -1
  1030. package/dist/prompt-coach/index.js +0 -13
  1031. package/dist/prompt-coach/index.js.map +0 -1
  1032. package/dist/prompt-coach/interactive.d.ts +0 -28
  1033. package/dist/prompt-coach/interactive.d.ts.map +0 -1
  1034. package/dist/prompt-coach/interactive.js +0 -118
  1035. package/dist/prompt-coach/interactive.js.map +0 -1
  1036. package/dist/prompt-coach/policy.d.ts +0 -67
  1037. package/dist/prompt-coach/policy.d.ts.map +0 -1
  1038. package/dist/prompt-coach/policy.js +0 -502
  1039. package/dist/prompt-coach/policy.js.map +0 -1
  1040. package/dist/prompt-coach/summary.d.ts +0 -56
  1041. package/dist/prompt-coach/summary.d.ts.map +0 -1
  1042. package/dist/prompt-coach/summary.js +0 -304
  1043. package/dist/prompt-coach/summary.js.map +0 -1
  1044. package/dist/protected-runtime/core.d.ts +0 -7
  1045. package/dist/protected-runtime/core.d.ts.map +0 -1
  1046. package/dist/protected-runtime/core.js +0 -24
  1047. package/dist/protected-runtime/core.js.map +0 -1
  1048. package/dist/protected-runtime/module-loader.d.ts +0 -9
  1049. package/dist/protected-runtime/module-loader.d.ts.map +0 -1
  1050. package/dist/protected-runtime/module-loader.js +0 -54
  1051. package/dist/protected-runtime/module-loader.js.map +0 -1
  1052. package/dist/protected-shell.d.ts +0 -2
  1053. package/dist/protected-shell.d.ts.map +0 -1
  1054. package/dist/protected-shell.js +0 -41
  1055. package/dist/protected-shell.js.map +0 -1
  1056. package/dist/release-check/engine.d.ts +0 -30
  1057. package/dist/release-check/engine.d.ts.map +0 -1
  1058. package/dist/release-check/engine.js +0 -726
  1059. package/dist/release-check/engine.js.map +0 -1
  1060. package/dist/release-check/index.d.ts +0 -16
  1061. package/dist/release-check/index.d.ts.map +0 -1
  1062. package/dist/release-check/index.js +0 -16
  1063. package/dist/release-check/index.js.map +0 -1
  1064. package/dist/release-check/output.d.ts +0 -7
  1065. package/dist/release-check/output.d.ts.map +0 -1
  1066. package/dist/release-check/output.js +0 -123
  1067. package/dist/release-check/output.js.map +0 -1
  1068. package/dist/release-truth.d.ts +0 -20
  1069. package/dist/release-truth.d.ts.map +0 -1
  1070. package/dist/release-truth.js +0 -114
  1071. package/dist/release-truth.js.map +0 -1
  1072. package/dist/review-intelligence/baseline.d.ts +0 -58
  1073. package/dist/review-intelligence/baseline.d.ts.map +0 -1
  1074. package/dist/review-intelligence/baseline.js +0 -99
  1075. package/dist/review-intelligence/baseline.js.map +0 -1
  1076. package/dist/review-intelligence/companion-check.d.ts +0 -28
  1077. package/dist/review-intelligence/companion-check.d.ts.map +0 -1
  1078. package/dist/review-intelligence/companion-check.js +0 -71
  1079. package/dist/review-intelligence/companion-check.js.map +0 -1
  1080. package/dist/review-intelligence/detectors/architecture-graph.d.ts +0 -18
  1081. package/dist/review-intelligence/detectors/architecture-graph.d.ts.map +0 -1
  1082. package/dist/review-intelligence/detectors/architecture-graph.js +0 -73
  1083. package/dist/review-intelligence/detectors/architecture-graph.js.map +0 -1
  1084. package/dist/review-intelligence/detectors/cjs-named-import.d.ts +0 -13
  1085. package/dist/review-intelligence/detectors/cjs-named-import.d.ts.map +0 -1
  1086. package/dist/review-intelligence/detectors/cjs-named-import.js +0 -134
  1087. package/dist/review-intelligence/detectors/cjs-named-import.js.map +0 -1
  1088. package/dist/review-intelligence/detectors/exact-count-assertion.d.ts +0 -17
  1089. package/dist/review-intelligence/detectors/exact-count-assertion.d.ts.map +0 -1
  1090. package/dist/review-intelligence/detectors/exact-count-assertion.js +0 -93
  1091. package/dist/review-intelligence/detectors/exact-count-assertion.js.map +0 -1
  1092. package/dist/review-intelligence/detectors/exports-map-missing.d.ts +0 -14
  1093. package/dist/review-intelligence/detectors/exports-map-missing.d.ts.map +0 -1
  1094. package/dist/review-intelligence/detectors/exports-map-missing.js +0 -131
  1095. package/dist/review-intelligence/detectors/exports-map-missing.js.map +0 -1
  1096. package/dist/review-intelligence/detectors/fixture-keyword-drift.d.ts +0 -12
  1097. package/dist/review-intelligence/detectors/fixture-keyword-drift.d.ts.map +0 -1
  1098. package/dist/review-intelligence/detectors/fixture-keyword-drift.js +0 -82
  1099. package/dist/review-intelligence/detectors/fixture-keyword-drift.js.map +0 -1
  1100. package/dist/review-intelligence/detectors/optional-infra-crash.d.ts +0 -12
  1101. package/dist/review-intelligence/detectors/optional-infra-crash.d.ts.map +0 -1
  1102. package/dist/review-intelligence/detectors/optional-infra-crash.js +0 -97
  1103. package/dist/review-intelligence/detectors/optional-infra-crash.js.map +0 -1
  1104. package/dist/review-intelligence/detectors/outbound-io.d.ts +0 -14
  1105. package/dist/review-intelligence/detectors/outbound-io.d.ts.map +0 -1
  1106. package/dist/review-intelligence/detectors/outbound-io.js +0 -122
  1107. package/dist/review-intelligence/detectors/outbound-io.js.map +0 -1
  1108. package/dist/review-intelligence/detectors/pack-rules.d.ts +0 -16
  1109. package/dist/review-intelligence/detectors/pack-rules.d.ts.map +0 -1
  1110. package/dist/review-intelligence/detectors/pack-rules.js +0 -107
  1111. package/dist/review-intelligence/detectors/pack-rules.js.map +0 -1
  1112. package/dist/review-intelligence/detectors/platform-helpers.d.ts +0 -15
  1113. package/dist/review-intelligence/detectors/platform-helpers.d.ts.map +0 -1
  1114. package/dist/review-intelligence/detectors/platform-helpers.js +0 -171
  1115. package/dist/review-intelligence/detectors/platform-helpers.js.map +0 -1
  1116. package/dist/review-intelligence/detectors/runtime-validation.d.ts +0 -10
  1117. package/dist/review-intelligence/detectors/runtime-validation.d.ts.map +0 -1
  1118. package/dist/review-intelligence/detectors/runtime-validation.js +0 -109
  1119. package/dist/review-intelligence/detectors/runtime-validation.js.map +0 -1
  1120. package/dist/review-intelligence/detectors/undeclared-dependency.d.ts +0 -11
  1121. package/dist/review-intelligence/detectors/undeclared-dependency.d.ts.map +0 -1
  1122. package/dist/review-intelligence/detectors/undeclared-dependency.js +0 -100
  1123. package/dist/review-intelligence/detectors/undeclared-dependency.js.map +0 -1
  1124. package/dist/review-intelligence/engine/ast-parser.d.ts +0 -90
  1125. package/dist/review-intelligence/engine/ast-parser.d.ts.map +0 -1
  1126. package/dist/review-intelligence/engine/ast-parser.js +0 -266
  1127. package/dist/review-intelligence/engine/ast-parser.js.map +0 -1
  1128. package/dist/review-intelligence/engine/dataflow.d.ts +0 -34
  1129. package/dist/review-intelligence/engine/dataflow.d.ts.map +0 -1
  1130. package/dist/review-intelligence/engine/dataflow.js +0 -115
  1131. package/dist/review-intelligence/engine/dataflow.js.map +0 -1
  1132. package/dist/review-intelligence/engine/index.d.ts +0 -7
  1133. package/dist/review-intelligence/engine/index.d.ts.map +0 -1
  1134. package/dist/review-intelligence/engine/index.js +0 -7
  1135. package/dist/review-intelligence/engine/index.js.map +0 -1
  1136. package/dist/review-intelligence/engine/symbol-resolver.d.ts +0 -34
  1137. package/dist/review-intelligence/engine/symbol-resolver.d.ts.map +0 -1
  1138. package/dist/review-intelligence/engine/symbol-resolver.js +0 -106
  1139. package/dist/review-intelligence/engine/symbol-resolver.js.map +0 -1
  1140. package/dist/review-intelligence/fingerprint.d.ts +0 -15
  1141. package/dist/review-intelligence/fingerprint.d.ts.map +0 -1
  1142. package/dist/review-intelligence/fingerprint.js +0 -29
  1143. package/dist/review-intelligence/fingerprint.js.map +0 -1
  1144. package/dist/review-intelligence/fixes/index.d.ts +0 -54
  1145. package/dist/review-intelligence/fixes/index.d.ts.map +0 -1
  1146. package/dist/review-intelligence/fixes/index.js +0 -346
  1147. package/dist/review-intelligence/fixes/index.js.map +0 -1
  1148. package/dist/review-intelligence/index.d.ts +0 -24
  1149. package/dist/review-intelligence/index.d.ts.map +0 -1
  1150. package/dist/review-intelligence/index.js +0 -155
  1151. package/dist/review-intelligence/index.js.map +0 -1
  1152. package/dist/review-intelligence/invariants.d.ts +0 -25
  1153. package/dist/review-intelligence/invariants.d.ts.map +0 -1
  1154. package/dist/review-intelligence/invariants.js +0 -73
  1155. package/dist/review-intelligence/invariants.js.map +0 -1
  1156. package/dist/review-intelligence/learning/index.d.ts +0 -39
  1157. package/dist/review-intelligence/learning/index.d.ts.map +0 -1
  1158. package/dist/review-intelligence/learning/index.js +0 -265
  1159. package/dist/review-intelligence/learning/index.js.map +0 -1
  1160. package/dist/review-intelligence/output.d.ts +0 -31
  1161. package/dist/review-intelligence/output.d.ts.map +0 -1
  1162. package/dist/review-intelligence/output.js +0 -224
  1163. package/dist/review-intelligence/output.js.map +0 -1
  1164. package/dist/review-intelligence/packs/index.d.ts +0 -69
  1165. package/dist/review-intelligence/packs/index.d.ts.map +0 -1
  1166. package/dist/review-intelligence/packs/index.js +0 -168
  1167. package/dist/review-intelligence/packs/index.js.map +0 -1
  1168. package/dist/review-intelligence/repair-guidance.d.ts +0 -11
  1169. package/dist/review-intelligence/repair-guidance.d.ts.map +0 -1
  1170. package/dist/review-intelligence/repair-guidance.js +0 -137
  1171. package/dist/review-intelligence/repair-guidance.js.map +0 -1
  1172. package/dist/review-intelligence/severity.d.ts +0 -10
  1173. package/dist/review-intelligence/severity.d.ts.map +0 -1
  1174. package/dist/review-intelligence/severity.js +0 -36
  1175. package/dist/review-intelligence/severity.js.map +0 -1
  1176. package/dist/review-intelligence/standards-discovery.d.ts +0 -12
  1177. package/dist/review-intelligence/standards-discovery.d.ts.map +0 -1
  1178. package/dist/review-intelligence/standards-discovery.js +0 -221
  1179. package/dist/review-intelligence/standards-discovery.js.map +0 -1
  1180. package/dist/review-intelligence/suppressions.d.ts +0 -53
  1181. package/dist/review-intelligence/suppressions.d.ts.map +0 -1
  1182. package/dist/review-intelligence/suppressions.js +0 -86
  1183. package/dist/review-intelligence/suppressions.js.map +0 -1
  1184. package/dist/review-intelligence/triggers.d.ts +0 -15
  1185. package/dist/review-intelligence/triggers.d.ts.map +0 -1
  1186. package/dist/review-intelligence/triggers.js +0 -104
  1187. package/dist/review-intelligence/triggers.js.map +0 -1
  1188. package/dist/review-intelligence/types.d.ts +0 -186
  1189. package/dist/review-intelligence/types.d.ts.map +0 -1
  1190. package/dist/review-intelligence/types.js +0 -11
  1191. package/dist/review-intelligence/types.js.map +0 -1
  1192. package/dist/risk-detection/heuristics.d.ts +0 -13
  1193. package/dist/risk-detection/heuristics.d.ts.map +0 -1
  1194. package/dist/risk-detection/heuristics.js +0 -348
  1195. package/dist/risk-detection/heuristics.js.map +0 -1
  1196. package/dist/risk-detection/index.d.ts +0 -20
  1197. package/dist/risk-detection/index.d.ts.map +0 -1
  1198. package/dist/risk-detection/index.js +0 -128
  1199. package/dist/risk-detection/index.js.map +0 -1
  1200. package/dist/security/export-sanitizer.d.ts +0 -76
  1201. package/dist/security/export-sanitizer.d.ts.map +0 -1
  1202. package/dist/security/export-sanitizer.js +0 -176
  1203. package/dist/security/export-sanitizer.js.map +0 -1
  1204. package/dist/security/path-summary.d.ts +0 -4
  1205. package/dist/security/path-summary.d.ts.map +0 -1
  1206. package/dist/security/path-summary.js +0 -94
  1207. package/dist/security/path-summary.js.map +0 -1
  1208. package/dist/session-id.d.ts +0 -22
  1209. package/dist/session-id.d.ts.map +0 -1
  1210. package/dist/session-id.js +0 -49
  1211. package/dist/session-id.js.map +0 -1
  1212. package/dist/session-paths.d.ts +0 -35
  1213. package/dist/session-paths.d.ts.map +0 -1
  1214. package/dist/session-paths.js +0 -68
  1215. package/dist/session-paths.js.map +0 -1
  1216. package/dist/session-registry.d.ts +0 -19
  1217. package/dist/session-registry.d.ts.map +0 -1
  1218. package/dist/session-registry.js +0 -182
  1219. package/dist/session-registry.js.map +0 -1
  1220. package/dist/session-timeline.d.ts +0 -13
  1221. package/dist/session-timeline.d.ts.map +0 -1
  1222. package/dist/session-timeline.js +0 -134
  1223. package/dist/session-timeline.js.map +0 -1
  1224. package/dist/signing/canonicalize.d.ts +0 -17
  1225. package/dist/signing/canonicalize.d.ts.map +0 -1
  1226. package/dist/signing/canonicalize.js +0 -50
  1227. package/dist/signing/canonicalize.js.map +0 -1
  1228. package/dist/signing/hmac.d.ts +0 -8
  1229. package/dist/signing/hmac.d.ts.map +0 -1
  1230. package/dist/signing/hmac.js +0 -16
  1231. package/dist/signing/hmac.js.map +0 -1
  1232. package/dist/signing/signer.d.ts +0 -16
  1233. package/dist/signing/signer.d.ts.map +0 -1
  1234. package/dist/signing/signer.js +0 -2
  1235. package/dist/signing/signer.js.map +0 -1
  1236. package/dist/templates/claude-md.d.ts +0 -12
  1237. package/dist/templates/claude-md.d.ts.map +0 -1
  1238. package/dist/templates/claude-md.js +0 -113
  1239. package/dist/templates/claude-md.js.map +0 -1
  1240. package/dist/templates/config.d.ts +0 -3
  1241. package/dist/templates/config.d.ts.map +0 -1
  1242. package/dist/templates/config.js +0 -154
  1243. package/dist/templates/config.js.map +0 -1
  1244. package/dist/templates/harness-pack.d.ts +0 -3
  1245. package/dist/templates/harness-pack.d.ts.map +0 -1
  1246. package/dist/templates/harness-pack.js +0 -26
  1247. package/dist/templates/harness-pack.js.map +0 -1
  1248. package/dist/templates/hooks.d.ts +0 -36
  1249. package/dist/templates/hooks.d.ts.map +0 -1
  1250. package/dist/templates/hooks.js +0 -278
  1251. package/dist/templates/hooks.js.map +0 -1
  1252. package/dist/templates/runtime-resolution.d.ts +0 -4
  1253. package/dist/templates/runtime-resolution.d.ts.map +0 -1
  1254. package/dist/templates/runtime-resolution.js +0 -76
  1255. package/dist/templates/runtime-resolution.js.map +0 -1
  1256. package/dist/templates/scenarios.d.ts +0 -3
  1257. package/dist/templates/scenarios.d.ts.map +0 -1
  1258. package/dist/templates/scenarios.js +0 -335
  1259. package/dist/templates/scenarios.js.map +0 -1
  1260. package/dist/utils/two-loop.d.ts +0 -36
  1261. package/dist/utils/two-loop.d.ts.map +0 -1
  1262. package/dist/utils/two-loop.js +0 -75
  1263. package/dist/utils/two-loop.js.map +0 -1
  1264. package/dist/utils/upgrade-nudge.d.ts +0 -18
  1265. package/dist/utils/upgrade-nudge.d.ts.map +0 -1
  1266. package/dist/utils/upgrade-nudge.js +0 -57
  1267. package/dist/utils/upgrade-nudge.js.map +0 -1
  1268. package/dist/verify/evaluate.d.ts +0 -10
  1269. package/dist/verify/evaluate.d.ts.map +0 -1
  1270. package/dist/verify/evaluate.js +0 -117
  1271. package/dist/verify/evaluate.js.map +0 -1
  1272. package/dist/verify/insertion-point-lock.d.ts +0 -12
  1273. package/dist/verify/insertion-point-lock.d.ts.map +0 -1
  1274. package/dist/verify/insertion-point-lock.js +0 -208
  1275. package/dist/verify/insertion-point-lock.js.map +0 -1
  1276. package/dist/verify/policy-snapshot.d.ts +0 -7
  1277. package/dist/verify/policy-snapshot.d.ts.map +0 -1
  1278. package/dist/verify/policy-snapshot.js +0 -36
  1279. package/dist/verify/policy-snapshot.js.map +0 -1
  1280. package/dist/verify/report.d.ts +0 -11
  1281. package/dist/verify/report.d.ts.map +0 -1
  1282. package/dist/verify/report.js +0 -64
  1283. package/dist/verify/report.js.map +0 -1
  1284. package/dist/verify/symbol-growth.d.ts +0 -13
  1285. package/dist/verify/symbol-growth.d.ts.map +0 -1
  1286. package/dist/verify/symbol-growth.js +0 -143
  1287. package/dist/verify/symbol-growth.js.map +0 -1
  1288. package/dist/version.d.ts +0 -2
  1289. package/dist/version.d.ts.map +0 -1
  1290. package/dist/version.js +0 -11
  1291. package/dist/version.js.map +0 -1
@@ -1,1413 +0,0 @@
1
- import { readFileSync, existsSync, readdirSync, statSync } from 'node:fs';
2
- import { join } from 'node:path';
3
- import { execSync } from 'node:child_process';
4
- import { intentNorm } from '@codeledger/selector';
5
- import { resolveSessionId } from '../session-id.js';
6
- import { sessionActivateRef, sessionStartRef, sessionTaskHistoryPath, sessionReadLogPath, sessionReviewConfigPath, } from '../session-paths.js';
7
- import { countCheckpoints } from './checkpoint.js';
8
- import { evaluateDrift } from './intent.js';
9
- import { loadReadTracker } from './review-coverage.js';
10
- import { detectLedgerAdmission } from '../prompt-coach/admission.js';
11
- import { writeSessionEvidence, writeEpisodeRecord } from '../ecl/persistence.js';
12
- import { recordPatternReuse, refreshPatternScore, shouldRetire, detectAntiPatterns, writeAntiPattern } from '../ecl/lifecycle.js';
13
- import { loadPromotedPatterns, writePromotedPattern } from '../ecl/persistence.js';
14
- import { analyzeSessionDensity, generatePatternCandidate } from '@codeledger/engine';
15
- import { tagSensitiveLines } from '../merge-check/hallucination-guard.js';
16
- import { releaseSession } from '../merge-check/intent-registry.js';
17
- import { generateExecutionSummary, formatExecutionSummary, formatExecutionSummaryCI, buildSummaryEvent, detectImplicitSignals, askFeedback, recordSummaryEvent, } from '../prompt-coach/index.js';
18
- /**
19
- * `codeledger session-summary [--session <id>]`
20
- *
21
- * Lightweight session-end value report. Compares the active context bundle
22
- * against files actually changed during the session, producing a concise
23
- * recap that reinforces the value of deterministic context selection.
24
- *
25
- * Designed to be called from the Claude Code Stop hook.
26
- *
27
- * Multi-session: when a session ID is provided, reads refs from the
28
- * session-specific directory instead of the shared .codeledger/ root.
29
- */
30
- export async function runSessionSummary(cwd, flags) {
31
- const configPath = join(cwd, '.codeledger', 'config.json');
32
- if (!existsSync(configPath)) {
33
- if (flags['quiet'] !== 'true') {
34
- console.log('No .codeledger/ found. Run "codeledger init" first.');
35
- }
36
- return;
37
- }
38
- let config;
39
- try {
40
- config = JSON.parse(readFileSync(configPath, 'utf-8'));
41
- }
42
- catch {
43
- // Malformed config — exit silently (don't pollute agent output from hook)
44
- return;
45
- }
46
- const sessionId = resolveSessionId({ session: flags['session'] });
47
- // ── Find the latest bundle artifact ─────────────────────────────────────
48
- const bundle = loadLatestBundle(cwd, config);
49
- if (!bundle) {
50
- // No bundle was generated this session — nothing to summarize
51
- return;
52
- }
53
- // ── Gather actual file changes from git ─────────────────────────────────
54
- const filesChanged = getSessionChangedFiles(cwd, sessionId);
55
- if (filesChanged.length === 0) {
56
- console.log('CodeLedger: no files changed this session — nothing to recap.');
57
- return;
58
- }
59
- // ── Compute overlap metrics ─────────────────────────────────────────────
60
- const bundleFiles = bundle.files.map((f) => f.path);
61
- const overlap = filesChanged.filter((f) => bundleFiles.includes(f));
62
- const regretFiles = filesChanged.filter((f) => !bundleFiles.includes(f));
63
- const recall = filesChanged.length > 0
64
- ? overlap.length / filesChanged.length
65
- : 0;
66
- const precision = bundleFiles.length > 0
67
- ? overlap.length / bundleFiles.length
68
- : 0;
69
- // ── Split recall: edit-recall vs creation-recall ──────────────────────
70
- // Files that existed before the session (edits) vs files that were created
71
- // during the session (new). Only edit-recall is meaningful — bundles
72
- // can't predict files that don't exist yet.
73
- const { editedFiles, createdFiles } = classifyEditedVsCreated(cwd, filesChanged, sessionId);
74
- // ── Estimate repo-wide token count for context reduction ────────────────
75
- const repoTokens = estimateRepoTokens(cwd, config);
76
- const reductionPct = repoTokens > 0
77
- ? ((repoTokens - bundle.total_tokens) / repoTokens) * 100
78
- : 0;
79
- // ── Debt injection detection ─────────────────────────────────────────────
80
- const debt = analyzeDebt(cwd, sessionId);
81
- // ── Commit hygiene analysis ─────────────────────────────────────────────
82
- const commitHygiene = analyzeCommitHygiene(cwd, sessionId, bundleFiles);
83
- // ── Scope drift detection ─────────────────────────────────────────────
84
- const scopeDriftFiles = bundle.scope_contract
85
- ? getScopeDriftFiles(filesChanged, bundle.scope_contract)
86
- : [];
87
- const scopeDriftCount = scopeDriftFiles.length > 0 ? scopeDriftFiles.length : undefined;
88
- // ── Conflict zone touches ─────────────────────────────────────────────
89
- const conflictZoneTouches = bundle.conflict_zones
90
- ? countConflictTouches(filesChanged, bundle.conflict_zones)
91
- : undefined;
92
- // ── Bundle invalidation (commit-aware staleness) ──────────────────────
93
- const bundleInvalidation = analyzeBundleInvalidation(cwd, sessionId, bundleFiles);
94
- // ── Checkpoint count ──────────────────────────────────────────────────
95
- const checkpointCount = countCheckpoints(cwd, sessionId);
96
- // ── Review coverage (Sentinel) ───────────────────────────────────────
97
- let reviewCoverage;
98
- const reviewConfigPath = sessionReviewConfigPath(cwd, sessionId);
99
- if (existsSync(reviewConfigPath)) {
100
- try {
101
- const reviewConfig = JSON.parse(readFileSync(reviewConfigPath, 'utf-8'));
102
- const indexPath = join(cwd, config.workspace.cache_dir, 'repo-index.json');
103
- if (existsSync(indexPath)) {
104
- const ridx = JSON.parse(readFileSync(indexPath, 'utf-8'));
105
- const readLogPath = sessionReadLogPath(cwd, sessionId);
106
- const tracker = loadReadTracker(readLogPath, ridx);
107
- const { computeReviewCoverage } = await import('@codeledger/selector');
108
- const allRequired = [...reviewConfig.must_read_files, ...reviewConfig.should_read_files];
109
- reviewCoverage = computeReviewCoverage(allRequired, tracker.getAllDepths(), tracker.getReadPaths(), ridx);
110
- }
111
- }
112
- catch {
113
- // Non-fatal: review coverage is optional enrichment
114
- }
115
- }
116
- // Compute edit-recall: recall only over files that existed pre-session
117
- const editOverlap = editedFiles.filter((f) => bundleFiles.includes(f));
118
- const editRecall = editedFiles.length > 0
119
- ? editOverlap.length / editedFiles.length
120
- : 0;
121
- const summary = {
122
- bundle_id: bundle.bundle_id,
123
- task: bundle.task,
124
- bundle_files: bundleFiles,
125
- files_changed: filesChanged,
126
- files_overlapping: overlap,
127
- recall,
128
- precision,
129
- edit_recall: editRecall,
130
- created_file_count: createdFiles.length,
131
- bundle_tokens: bundle.total_tokens,
132
- repo_total_tokens: repoTokens,
133
- context_reduction_pct: reductionPct,
134
- generated_at: new Date().toISOString(),
135
- session_id: sessionId ?? undefined,
136
- debt: debt ?? undefined,
137
- commit_hygiene: commitHygiene ?? undefined,
138
- scope_drift_count: scopeDriftCount,
139
- conflict_zone_touches: conflictZoneTouches,
140
- checkpoint_count: checkpointCount > 0 ? checkpointCount : undefined,
141
- bundle_invalidation: bundleInvalidation ?? undefined,
142
- review_coverage: reviewCoverage,
143
- regret_files: regretFiles.length > 0 ? regretFiles : undefined,
144
- regret_ratio: filesChanged.length > 0 ? regretFiles.length / filesChanged.length : undefined,
145
- };
146
- // ── Intent drift evaluation ───────────────────────────────────────────
147
- const intentDrift = evaluateDrift(cwd, sessionId);
148
- // ── Implicit feedback capture ──────────────────────────────────────────
149
- detectImplicitSignals(cwd, sessionId, scopeDriftCount ?? 0, summary.regret_ratio ?? 0, summary.recall);
150
- // ── Execution summary (Prompt Coach post-execution) ────────────────────
151
- const isFinal = flags['final'] === 'true';
152
- const quiet = flags['quiet'] === 'true';
153
- // Detect reused patterns from bundle reasons
154
- const reusedPattern = detectReusedPattern(bundle);
155
- // Detect ledger admission outcome (the execution/persistence distinction)
156
- const ledgerAdmission = detectLedgerAdmission(cwd, summary);
157
- const execSummary = generateExecutionSummary({
158
- sessionSummary: summary,
159
- bundle,
160
- ledgerAdmission,
161
- isFinal,
162
- scopeDriftCount: scopeDriftCount ?? 0,
163
- intentDriftLevel: intentDrift?.drift?.drift_level,
164
- reusedPattern,
165
- });
166
- // Print execution summary (replaces verbose recap for prompt-coach users)
167
- const isCI = process.env['CI'] === 'true' || process.env['CI'] === '1';
168
- if (!quiet) {
169
- if (isCI) {
170
- console.log(formatExecutionSummaryCI(execSummary));
171
- }
172
- else {
173
- console.log(formatExecutionSummary(execSummary));
174
- }
175
- }
176
- // Explicit feedback (only on final, only if interactive, only if warranted)
177
- let feedbackResponse = null;
178
- if (execSummary.askFeedback && execSummary.feedbackQuestion && isFinal && !quiet && !isCI) {
179
- feedbackResponse = await askFeedback(execSummary.feedbackQuestion);
180
- }
181
- // Record telemetry
182
- const summaryEvent = buildSummaryEvent(execSummary, feedbackResponse, sessionId ?? undefined);
183
- recordSummaryEvent(cwd, sessionId, summaryEvent);
184
- // ── Write ECL evidence (💎 Next becomes real) ──────────────────────────
185
- const hasCoachEvents = (() => {
186
- try {
187
- const { existsSync: ex } = require('node:fs');
188
- const { join: j } = require('node:path');
189
- const coachDir = sessionId
190
- ? j(cwd, '.codeledger', 'sessions', sessionId)
191
- : j(cwd, '.codeledger');
192
- return ex(j(coachDir, '.coach-events.jsonl'));
193
- }
194
- catch {
195
- return false;
196
- }
197
- })();
198
- let evidencePath;
199
- let episodePath;
200
- try {
201
- evidencePath = writeSessionEvidence(cwd, sessionId, summary, bundle, hasCoachEvents);
202
- }
203
- catch { /* non-fatal */ }
204
- // Episode generation only on --final (session end)
205
- if (isFinal) {
206
- try {
207
- episodePath = writeEpisodeRecord(cwd, sessionId, summary);
208
- }
209
- catch { /* non-fatal */ }
210
- }
211
- // ── IQO analysis: distill session density for pattern promotion ─────────
212
- if (isFinal && summary.recall >= 0.5) {
213
- try {
214
- const bundleFiles = bundle.files.map((f) => f.path);
215
- const iqoResult = analyzeSessionDensity(bundleFiles, summary.files_changed, bundle.total_tokens);
216
- if (iqoResult.promotionEligible) {
217
- const candidate = generatePatternCandidate(summary.task, iqoResult, bundle.task_type);
218
- writePromotedPattern(cwd, candidate, iqoResult.anchorFiles);
219
- }
220
- }
221
- catch { /* non-fatal: IQO is best-effort */ }
222
- }
223
- // ── Semantic Fortress: tag sensitive lines on successful sessions ──────
224
- if (isFinal && summary.recall >= 0.5 && summary.files_changed.length > 0) {
225
- try {
226
- tagSensitiveLines(cwd, sessionId ?? 'default', summary.task, summary.files_changed);
227
- }
228
- catch { /* non-fatal */ }
229
- }
230
- // ── Semantic Fortress: release session lock on final summary ───────────
231
- if (isFinal) {
232
- try {
233
- releaseSession(cwd, sessionId ?? 'default');
234
- }
235
- catch { /* non-fatal */ }
236
- }
237
- // ── Pattern reuse outcome linking (closes the feedback loop) ───────────
238
- let patternsStrengthened = 0;
239
- let patternsWeakened = 0;
240
- try {
241
- const activePatternPath = join(sessionId ? join(cwd, '.codeledger', 'sessions', sessionId) : join(cwd, '.codeledger'), '.active-patterns.json');
242
- if (existsSync(activePatternPath)) {
243
- const activePatterns = JSON.parse(readFileSync(activePatternPath, 'utf-8'));
244
- const sessionOutcome = summary.recall >= 0.5 ? 'success' : summary.recall > 0 ? 'partial' : 'failure';
245
- for (const ap of activePatterns) {
246
- recordPatternReuse(cwd, ap.id, {
247
- episodeId: sessionId ?? 'default',
248
- task: summary.task,
249
- outcome: sessionOutcome,
250
- reusedAt: new Date().toISOString(),
251
- });
252
- if (sessionOutcome === 'success')
253
- patternsStrengthened++;
254
- else if (sessionOutcome === 'failure')
255
- patternsWeakened++;
256
- }
257
- }
258
- }
259
- catch { /* non-fatal */ }
260
- // ── Pattern lifecycle: retirement + anti-pattern detection (on --final) ──
261
- let patternsRetired = 0;
262
- let antiPatternsDetected = 0;
263
- if (isFinal) {
264
- try {
265
- const allPatterns = loadPromotedPatterns(cwd);
266
- const scoredPatterns = allPatterns.map((p) => refreshPatternScore(cwd, p));
267
- // Check for patterns that should retire
268
- for (const sp of scoredPatterns) {
269
- if (sp.score && shouldRetire(sp.score) && sp.score.status !== 'retired') {
270
- sp.score.status = 'retired';
271
- // Write updated pattern back to disk
272
- const { writeFileSync: wfs } = require('node:fs');
273
- const { join: j } = require('node:path');
274
- const patternPath = j(cwd, '.codeledger', 'patterns', `${sp.id}.json`);
275
- if (existsSync(patternPath)) {
276
- wfs(patternPath, JSON.stringify({ ...sp, score: sp.score }, null, 2) + '\n');
277
- patternsRetired++;
278
- }
279
- }
280
- }
281
- // Detect anti-patterns from retired patterns
282
- const retiredWithScores = scoredPatterns.filter((p) => p.score?.status === 'retired');
283
- const antiPatterns = detectAntiPatterns(retiredWithScores);
284
- for (const ap of antiPatterns) {
285
- try {
286
- writeAntiPattern(cwd, ap);
287
- antiPatternsDetected++;
288
- }
289
- catch { /* non-fatal */ }
290
- }
291
- }
292
- catch { /* non-fatal: lifecycle analysis should never break session end */ }
293
- }
294
- // ── Session-wide aggregate (only on --final, i.e. Stop hook) ───────────
295
- // Print the per-task breakdown FIRST when --final is set, so the most
296
- // useful information appears at the top (Fix 3.1)
297
- if (isFinal) {
298
- printSessionAggregate(cwd, sessionId, summary);
299
- }
300
- // ── Extract shadow files from bundle ────────────────────────────────────
301
- const shadowFiles = bundle.files.filter((f) => f.shadow_reason);
302
- // ── Print concise recap ─────────────────────────────────────────────────
303
- const measuredValue = loadMeasuredBenchmarkValue(cwd, bundle.task);
304
- printRecap(summary, intentDrift, scopeDriftFiles, config.suggestions?.prefill_task === true, shadowFiles, bundle.task_type, measuredValue);
305
- // ── 📂 Memory written — show developers where evidence lives ──────────
306
- if (!quiet) {
307
- const memLines = [];
308
- memLines.push('');
309
- memLines.push(' \uD83D\uDCC2 Memory written');
310
- if (evidencePath) {
311
- memLines.push(` Evidence: ${evidencePath.replace(cwd + '/', '')}`);
312
- }
313
- if (episodePath) {
314
- memLines.push(` Episode: ${episodePath.replace(cwd + '/', '')}`);
315
- }
316
- memLines.push(' Patterns: .codeledger/patterns/');
317
- if (patternsStrengthened > 0 || patternsWeakened > 0) {
318
- memLines.push('');
319
- memLines.push(' \uD83D\uDC8E Pattern lifecycle');
320
- if (patternsStrengthened > 0) {
321
- memLines.push(` ${patternsStrengthened} pattern${patternsStrengthened > 1 ? 's' : ''} strengthened by successful outcome`);
322
- }
323
- if (patternsWeakened > 0) {
324
- memLines.push(` ${patternsWeakened} pattern${patternsWeakened > 1 ? 's' : ''} weakened by failure`);
325
- }
326
- if (patternsRetired > 0) {
327
- memLines.push(` ${patternsRetired} pattern${patternsRetired > 1 ? 's' : ''} retired (repeated failure)`);
328
- }
329
- if (antiPatternsDetected > 0) {
330
- memLines.push(` ${antiPatternsDetected} anti-pattern${antiPatternsDetected > 1 ? 's' : ''} detected`);
331
- }
332
- }
333
- memLines.push('');
334
- console.log(memLines.join('\n'));
335
- }
336
- }
337
- function loadLatestBundle(cwd, config) {
338
- const bundleDir = join(cwd, config.workspace.artifacts_dir, 'bundles');
339
- if (!existsSync(bundleDir))
340
- return null;
341
- const files = readdirSync(bundleDir)
342
- .filter((f) => f.endsWith('.json'))
343
- .map((f) => ({
344
- name: f,
345
- mtime: statSync(join(bundleDir, f)).mtimeMs,
346
- }))
347
- .sort((a, b) => b.mtime - a.mtime);
348
- if (files.length === 0)
349
- return null;
350
- const latestPath = join(bundleDir, files[0].name);
351
- try {
352
- return JSON.parse(readFileSync(latestPath, 'utf-8'));
353
- }
354
- catch {
355
- // Corrupted or deleted bundle file — treat as missing
356
- return null;
357
- }
358
- }
359
- function getSessionChangedFiles(cwd, sessionId) {
360
- try {
361
- const files = new Set();
362
- // 1. Uncommitted changes (staged + unstaged)
363
- const diffOutput = execSync('git diff --name-only HEAD', {
364
- cwd,
365
- encoding: 'utf-8',
366
- timeout: 5000,
367
- stdio: ['pipe', 'pipe', 'pipe'],
368
- }).trim();
369
- if (diffOutput) {
370
- for (const f of diffOutput.split('\n'))
371
- files.add(f);
372
- }
373
- // 2. Untracked files
374
- const untrackedOutput = execSync('git ls-files --others --exclude-standard', {
375
- cwd,
376
- encoding: 'utf-8',
377
- timeout: 5000,
378
- stdio: ['pipe', 'pipe', 'pipe'],
379
- }).trim();
380
- if (untrackedOutput) {
381
- for (const f of untrackedOutput.split('\n'))
382
- files.add(f);
383
- }
384
- // 3. Committed changes: prefer .activate-ref (scoped to current task)
385
- // over .session-start-ref (full session) for accurate per-task metrics
386
- // Use session-specific paths when a session ID is available
387
- const activateRefPath = sessionActivateRef(cwd, sessionId);
388
- const sessionRefPath = sessionStartRef(cwd, sessionId);
389
- const refPath = existsSync(activateRefPath) ? activateRefPath : sessionRefPath;
390
- if (existsSync(refPath)) {
391
- const startRef = readFileSync(refPath, 'utf-8').trim();
392
- if (startRef) {
393
- try {
394
- const committedDiff = execSync(`git diff --name-only ${startRef}..HEAD`, { cwd, encoding: 'utf-8', timeout: 5000, stdio: ['pipe', 'pipe', 'pipe'] }).trim();
395
- if (committedDiff) {
396
- for (const f of committedDiff.split('\n'))
397
- files.add(f);
398
- }
399
- }
400
- catch {
401
- // startRef may no longer be valid (rebased away, etc.) — non-fatal
402
- }
403
- }
404
- }
405
- return [...files].filter((f) => !f.startsWith('.codeledger/') && !f.startsWith('.claude/'));
406
- }
407
- catch {
408
- return [];
409
- }
410
- }
411
- /**
412
- * Detect if the bundle leveraged a known reusable pattern.
413
- * Looks for pattern_exemplar reasons in bundle files.
414
- */
415
- function detectReusedPattern(bundle) {
416
- const exemplars = bundle.files.filter((f) => f.reasons.includes('pattern_exemplar'));
417
- if (exemplars.length === 0)
418
- return undefined;
419
- // Extract a short label from the first exemplar's path
420
- const firstPath = exemplars[0].path;
421
- const parts = firstPath.split('/');
422
- // Use last 2 path segments as label (e.g., "auth/middleware")
423
- return parts.length >= 2 ? parts.slice(-2).join('/') : firstPath;
424
- }
425
- function estimateRepoTokens(cwd, config) {
426
- const indexPath = join(cwd, config.workspace.cache_dir, 'repo-index.json');
427
- if (!existsSync(indexPath))
428
- return 0;
429
- try {
430
- const repoIndex = JSON.parse(readFileSync(indexPath, 'utf-8'));
431
- // Use same heuristic as selector stop-rule: 4 tokens per line
432
- return repoIndex.files.reduce((sum, f) => sum + f.lines * 4, 0);
433
- }
434
- catch {
435
- return 0;
436
- }
437
- }
438
- function printRecap(s, intentDrift, scopeDriftFiles, prefillTask, shadowFiles, taskType, measuredValue) {
439
- const recallPct = Math.round(s.recall * 100);
440
- const precisionPct = Math.round(s.precision * 100);
441
- const reductionPct = Math.round(s.context_reduction_pct);
442
- const isRepoScan = taskType === 'repo_scan';
443
- // F1 score: harmonic mean of precision and recall — single usefulness metric
444
- const f1 = (s.precision + s.recall) > 0
445
- ? 2 * (s.precision * s.recall) / (s.precision + s.recall)
446
- : 0;
447
- const valueStatement = measuredValue
448
- ? null
449
- : formatValueStatement(s.bundle_tokens, s.repo_total_tokens, 1);
450
- const lines = [];
451
- lines.push('');
452
- lines.push('-- CodeLedger Session Recap ----------------------------------');
453
- if (s.session_id) {
454
- lines.push(` Session: ${s.session_id}`);
455
- }
456
- // Task shape annotation for repo_scan
457
- if (isRepoScan) {
458
- lines.push(` Task shape: repo_scan (broad/mechanical)`);
459
- }
460
- if (isRepoScan) {
461
- // repo_scan-specific messaging — low recall is expected, not a failure
462
- lines.push(` Bundle predicted ${s.files_overlapping.length}/${s.files_changed.length} files you changed (${recallPct}% recall)`);
463
- lines.push(` Bundle accuracy: ${s.files_overlapping.length}/${s.bundle_files.length} bundled files were relevant (${precisionPct}% precision)`);
464
- lines.push(` Assessment: repo_scan task — bundle includes validator + representative targets; scope drift is expected.`);
465
- lines.push(` Task breadth: ${s.files_changed.length} files touched`);
466
- }
467
- else if (f1 < 0.3) {
468
- // Bundle was not useful — diagnose why
469
- lines.push(` Bundle missed: predicted ${s.files_overlapping.length}/${s.files_changed.length} files you changed (${recallPct}% recall)`);
470
- lines.push(` Bundle accuracy: ${s.files_overlapping.length}/${s.bundle_files.length} bundled files were relevant (${precisionPct}% precision)`);
471
- // Classify the session pattern to give actionable advice
472
- const sessionPattern = classifySessionPattern(s.files_changed);
473
- if (sessionPattern.isInfrastructure) {
474
- lines.push(` Pattern: infrastructure/ops session — ${sessionPattern.infraFileCount} of ${s.files_changed.length} files are infra (migrations, docker, scripts, k8s, terraform).`);
475
- lines.push(` Assessment: Bundle recall is not meaningful for infrastructure tasks. Bundles target source code edits.`);
476
- }
477
- else if (sessionPattern.newFileRatio > 0.5) {
478
- lines.push(` Pattern: exploratory session — ${sessionPattern.newFileCount} of ${s.files_changed.length} files were created (not predictable).`);
479
- lines.push(` Tip: Bundles work best for focused edits to existing code. For scaffolding/new-file tasks, low recall is expected.`);
480
- }
481
- else if (s.files_changed.length > 50) {
482
- lines.push(` Pattern: broad session (${s.files_changed.length} files touched). Bundle targets focused tasks.`);
483
- lines.push(` Tip: For multi-phase work, refresh the bundle between phases: "codeledger activate --task \\"...\\"".`);
484
- }
485
- else if (s.recall === 0 && s.precision > 0) {
486
- // Zero recall but bundle had files — work diverged from task
487
- lines.push(` Pattern: work diverged from task — none of the ${s.files_changed.length} files you touched were in the bundle.`);
488
- lines.push(` This often means the task changed mid-session. The bundle may have been correct for the original intent.`);
489
- lines.push(` Tip: Refresh with "codeledger activate --task \\"your current goal\\"" when changing direction.`);
490
- }
491
- else {
492
- lines.push(` The bundle was not useful for this task.`);
493
- lines.push(` Tip: Re-run "codeledger activate --task ${prefillTask ? `"${s.task}"` : '...'}" with a more specific task description.`);
494
- }
495
- }
496
- else if (s.recall < 0.5) {
497
- // Bundle was partially useful — show all stats but highlight room to improve
498
- lines.push(` Bundle predicted ${s.files_overlapping.length}/${s.files_changed.length} files you changed (${recallPct}% recall)`);
499
- lines.push(` Bundle accuracy: ${s.files_overlapping.length}/${s.bundle_files.length} bundled files were relevant (${precisionPct}% precision)`);
500
- lines.push(` Context: ~${fmtTokens(s.bundle_tokens)} tokens vs ~${fmtTokens(s.repo_total_tokens)} full repo (${reductionPct}% reduction)`);
501
- lines.push(` Tip: A more specific task description may improve recall.`);
502
- }
503
- else {
504
- // Bundle worked well — show the full value story
505
- lines.push(` Bundle predicted ${s.files_overlapping.length}/${s.files_changed.length} files you changed (${recallPct}% recall)`);
506
- lines.push(` Bundle accuracy: ${s.files_overlapping.length}/${s.bundle_files.length} bundled files were relevant (${precisionPct}% precision)`);
507
- lines.push(` Context: ~${fmtTokens(s.bundle_tokens)} tokens vs ~${fmtTokens(s.repo_total_tokens)} full repo (${reductionPct}% reduction)`);
508
- }
509
- if (measuredValue) {
510
- lines.push(` Measured value: ${measuredValue.summary}`);
511
- if (measuredValue.outcomeLine) {
512
- lines.push(` Measured outcomes: ${measuredValue.outcomeLine}`);
513
- }
514
- }
515
- else if (valueStatement) {
516
- lines.push(` Value: ${valueStatement.summary}`);
517
- if (valueStatement.costLine) {
518
- lines.push(` Value $: ${valueStatement.costLine}`);
519
- }
520
- }
521
- else {
522
- lines.push(' Value: estimated baseline only. Run `codeledger compare-current --guided` for measured with-vs-without data.');
523
- }
524
- // ── Split recall annotation ─────────────────────────────────────────
525
- // When files were created during the session, show edit-recall separately
526
- // since bundle recall for new files is inherently 0%.
527
- // Lead with edit-recall when new files significantly impact raw recall.
528
- if (s.created_file_count !== undefined && s.created_file_count > 0 && !isRepoScan) {
529
- const editRecallPct = s.edit_recall !== undefined ? Math.round(s.edit_recall * 100) : recallPct;
530
- const editedCount = s.files_changed.length - s.created_file_count;
531
- const creationRatio = s.created_file_count / s.files_changed.length;
532
- if (creationRatio >= 0.3) {
533
- // New files significantly drag down raw recall — highlight edit-recall as primary metric
534
- lines.push(` >> Edit-recall: ${editRecallPct}% (${editedCount} existing files) — this is the meaningful metric`);
535
- lines.push(` ${s.created_file_count} new file${s.created_file_count === 1 ? ' was' : 's were'} created (bundles cannot predict files that don't exist yet)`);
536
- }
537
- else {
538
- lines.push(` Edit-recall: ${editRecallPct}% (${editedCount} existing files) | ${s.created_file_count} new file${s.created_file_count === 1 ? '' : 's'} created (not predictable)`);
539
- }
540
- }
541
- // ── Debt injection section ───────────────────────────────────────────
542
- if (s.debt && s.debt.total_suppressions > 0) {
543
- lines.push(` Debt: ${s.debt.total_suppressions} suppression${s.debt.total_suppressions === 1 ? '' : 's'} detected (score: ${s.debt.debt_score.toFixed(2)})`);
544
- // Show up to 3 debt warnings
545
- for (const w of s.debt.warnings.slice(0, 3)) {
546
- lines.push(` - ${w.file}:${w.line}: ${w.message}`);
547
- }
548
- if (s.debt.warnings.length > 3) {
549
- lines.push(` ... and ${s.debt.warnings.length - 3} more`);
550
- }
551
- }
552
- // ── Commit hygiene section ──────────────────────────────────────────
553
- if (s.commit_hygiene) {
554
- const h = s.commit_hygiene;
555
- const issues = [];
556
- if (h.empty_commits > 0)
557
- issues.push(`${h.empty_commits} empty`);
558
- if (h.no_verify_count > 0)
559
- issues.push(`${h.no_verify_count} --no-verify`);
560
- if (h.out_of_scope_files.length > 0)
561
- issues.push(`${h.out_of_scope_files.length} out-of-scope files`);
562
- if (issues.length > 0) {
563
- lines.push(` Commit hygiene: ${h.hygiene_score.toFixed(2)} (${issues.join(', ')})`);
564
- }
565
- }
566
- // ── Scope drift section ───────────────────────────────────────────
567
- if (s.scope_drift_count !== undefined && s.scope_drift_count > 0) {
568
- if (isRepoScan) {
569
- lines.push(` Scope: repo-wide mechanical edits detected (${s.files_changed.length} files touched).`);
570
- }
571
- else {
572
- lines.push(` Scope drift: ${s.scope_drift_count} file${s.scope_drift_count === 1 ? '' : 's'} edited outside scope contract`);
573
- if (scopeDriftFiles && scopeDriftFiles.length > 0) {
574
- for (const f of scopeDriftFiles.slice(0, 5)) {
575
- lines.push(` - ${f}`);
576
- }
577
- if (scopeDriftFiles.length > 5) {
578
- lines.push(` ... and ${scopeDriftFiles.length - 5} more`);
579
- }
580
- }
581
- }
582
- }
583
- // ── Regret metric (missed files) ────────────────────────────────
584
- if (s.regret_files && s.regret_files.length > 0 && !isRepoScan && s.recall < 0.9) {
585
- lines.push(` Missed files: ${s.regret_files.length} file${s.regret_files.length === 1 ? '' : 's'} changed but not in bundle`);
586
- for (const f of s.regret_files.slice(0, 5)) {
587
- lines.push(` - ${f}`);
588
- }
589
- if (s.regret_files.length > 5) {
590
- lines.push(` ... and ${s.regret_files.length - 5} more`);
591
- }
592
- }
593
- // ── Conflict zone touches section ─────────────────────────────────
594
- if (s.conflict_zone_touches !== undefined && s.conflict_zone_touches > 0) {
595
- lines.push(` Conflict zones: ${s.conflict_zone_touches} contested file${s.conflict_zone_touches === 1 ? '' : 's'} were modified`);
596
- }
597
- // ── Bundle invalidation section ─────────────────────────────────
598
- if (s.bundle_invalidation && s.bundle_invalidation.addressed_files.length > 0) {
599
- const inv = s.bundle_invalidation;
600
- const stalenessPct = Math.round(inv.staleness_ratio * 100);
601
- lines.push(` Bundle freshness: ${inv.addressed_files.length} of ${inv.addressed_files.length + inv.fresh_files.length} files committed (${stalenessPct}% addressed)`);
602
- if (inv.staleness_ratio >= 0.75) {
603
- lines.push(` Tip: Bundle is mostly stale — refresh with "codeledger activate --task ${prefillTask ? `"${s.task}"` : '...'}" for updated context.`);
604
- }
605
- }
606
- // ── Checkpoint count section ────────────────────────────────────
607
- if (s.checkpoint_count && s.checkpoint_count > 0) {
608
- lines.push(` Checkpoints: ${s.checkpoint_count} saved`);
609
- }
610
- // ── Intent drift section ───────────────────────────────────────
611
- if (intentDrift && intentDrift.drift.drift_level !== 'NONE') {
612
- const d = intentDrift.drift;
613
- lines.push(` Intent drift: ${d.drift_level} (${d.drift_score.toFixed(3)})`);
614
- if (d.drift_level === 'MAJOR' || d.drift_level === 'CRITICAL') {
615
- const topReasons = d.reasons.filter((r) => r.distance > 0).slice(0, 3);
616
- for (const r of topReasons) {
617
- lines.push(` - ${r.field}: ${r.distance.toFixed(3)}`);
618
- }
619
- }
620
- }
621
- // ── Review coverage section (Sentinel) ─────────────────────────
622
- if (s.review_coverage) {
623
- const rc = s.review_coverage;
624
- const pct = (rc.file_coverage * 100).toFixed(1);
625
- const depthPct = (rc.depth_weighted_coverage * 100).toFixed(1);
626
- const thresholdTag = rc.file_coverage >= 0.90 ? 'PASS' : 'BELOW 90%';
627
- lines.push(` Review Coverage: ${rc.files_read.length}/${rc.required_files.length} files read (${pct}%) ${thresholdTag}`);
628
- lines.push(` Depth Coverage: ${depthPct}%`);
629
- if (rc.post_hoc_reads.length > 0) {
630
- lines.push(` Post-hoc reads: ${rc.post_hoc_reads.length} file${rc.post_hoc_reads.length === 1 ? '' : 's'}`);
631
- }
632
- }
633
- // ── Shadow files section ──────────────────────────────────────
634
- if (shadowFiles && shadowFiles.length > 0) {
635
- lines.push(` Shadow Files Included: ${shadowFiles.length}`);
636
- for (const sf of shadowFiles) {
637
- if (sf.shadow_reason) {
638
- lines.push(` - ${sf.path} (affinity ${sf.shadow_reason.affinity.toFixed(2)} with ${sf.shadow_reason.linked_to})`);
639
- }
640
- }
641
- }
642
- lines.push(` [${s.bundle_id}]`);
643
- lines.push('-'.repeat(61));
644
- lines.push('');
645
- lines.push(' \u26A1 Immediate value');
646
- lines.push(` Files touched: ${s.files_changed.length}`);
647
- if (s.context_reduction_pct > 0) {
648
- lines.push(` Context reduction: ${Math.round(s.context_reduction_pct)}%`);
649
- }
650
- lines.push('');
651
- lines.push(' \uD83D\uDC8E Compounding value');
652
- lines.push(' Session evidence recorded');
653
- if (s.regret_files && s.regret_files.length === 0) {
654
- lines.push(' Bundle predicted all changes — pattern reinforced');
655
- }
656
- lines.push('');
657
- lines.push(' Stored locally in .codeledger/');
658
- lines.push('');
659
- console.log(lines.join('\n'));
660
- }
661
- function classifySessionPattern(filesChanged) {
662
- // Detect new files by checking git status for untracked/newly added
663
- let newFileCount = 0;
664
- try {
665
- const untrackedRaw = execSync('git ls-files --others --exclude-standard', {
666
- encoding: 'utf-8',
667
- timeout: 5000,
668
- stdio: ['pipe', 'pipe', 'pipe'],
669
- }).trim();
670
- const untracked = new Set(untrackedRaw ? untrackedRaw.split('\n') : []);
671
- // Also check for files that were added in commits (new file mode)
672
- const addedRaw = execSync('git diff --diff-filter=A --name-only HEAD~20..HEAD 2>/dev/null || echo ""', {
673
- encoding: 'utf-8',
674
- timeout: 5000,
675
- stdio: ['pipe', 'pipe', 'pipe'],
676
- }).trim();
677
- const added = new Set(addedRaw ? addedRaw.split('\n') : []);
678
- for (const f of filesChanged) {
679
- if (untracked.has(f) || added.has(f)) {
680
- newFileCount++;
681
- }
682
- }
683
- }
684
- catch {
685
- // Non-fatal — fall back to 0 new files
686
- }
687
- const newFileRatio = filesChanged.length > 0 ? newFileCount / filesChanged.length : 0;
688
- // Detect infrastructure-heavy sessions by checking if changed files are
689
- // predominantly config/migration/infra files rather than source code.
690
- // Infrastructure file patterns — match directory names and filenames, not
691
- // substrings, to avoid false positives (e.g. "src/docker-utils.ts" is NOT infra).
692
- const infraPatterns = [
693
- /migrations?\//i, /\.sql$/i, /\.env(\.|$)/i,
694
- /(?:^|\/)dockerfile/i, /(?:^|\/)docker-compose/i,
695
- /(?:^|\/)makefile$/i, /\.sh$/i,
696
- /(?:^|\/)k8s\//i, /(?:^|\/)kubernetes\//i, /(?:^|\/)helm\//i,
697
- /(?:^|\/)terraform\//i, /\.tf$/i, /\.tfvars$/i,
698
- /(?:^|\/)deploy\//i, /(?:^|\/)infra\//i, /(?:^|\/)infrastructure\//i,
699
- /(?:^|\/)scripts?\//i, /\.github\//i, /ci\.ya?ml$/i,
700
- ];
701
- const infraFileCount = filesChanged.filter((f) => infraPatterns.some((pat) => pat.test(f))).length;
702
- const infraRatio = filesChanged.length > 0 ? infraFileCount / filesChanged.length : 0;
703
- const isInfrastructure = infraRatio > 0.5 || (filesChanged.length <= 3 && infraFileCount > 0);
704
- return {
705
- newFileCount,
706
- newFileRatio,
707
- isExploratory: newFileRatio > 0.5,
708
- isBroad: filesChanged.length > 50,
709
- isInfrastructure,
710
- infraFileCount,
711
- };
712
- }
713
- /**
714
- * Classify changed files into edits (pre-existing files modified) vs creations
715
- * (new files added during the session). This allows split recall reporting:
716
- * edit-recall measures bundle accuracy for predictable changes, while
717
- * creation-recall is always 0 (bundles can't predict files that don't exist).
718
- */
719
- function classifyEditedVsCreated(cwd, filesChanged, sessionId) {
720
- const createdPaths = new Set();
721
- try {
722
- // Untracked files = definitely created this session
723
- const untrackedRaw = execSync('git ls-files --others --exclude-standard', {
724
- cwd,
725
- encoding: 'utf-8',
726
- timeout: 5000,
727
- stdio: ['pipe', 'pipe', 'pipe'],
728
- }).trim();
729
- if (untrackedRaw) {
730
- for (const f of untrackedRaw.split('\n'))
731
- createdPaths.add(f);
732
- }
733
- // Files added in commits since session start
734
- const activateRefPath = sessionActivateRef(cwd, sessionId);
735
- const sessionRefPath = sessionStartRef(cwd, sessionId);
736
- const refPath = existsSync(activateRefPath) ? activateRefPath : sessionRefPath;
737
- if (existsSync(refPath)) {
738
- const startRef = readFileSync(refPath, 'utf-8').trim();
739
- if (startRef) {
740
- try {
741
- const addedRaw = execSync(`git diff --diff-filter=A --name-only ${startRef}..HEAD`, { cwd, encoding: 'utf-8', timeout: 5000, stdio: ['pipe', 'pipe', 'pipe'] }).trim();
742
- if (addedRaw) {
743
- for (const f of addedRaw.split('\n'))
744
- createdPaths.add(f);
745
- }
746
- }
747
- catch {
748
- // Non-fatal: ref may not be valid
749
- }
750
- }
751
- }
752
- }
753
- catch {
754
- // Non-fatal: fall back to treating all files as edits
755
- }
756
- const editedFiles = filesChanged.filter((f) => !createdPaths.has(f));
757
- const createdFiles = filesChanged.filter((f) => createdPaths.has(f));
758
- return { editedFiles, createdFiles };
759
- }
760
- function fmtTokens(n) {
761
- if (n >= 1000)
762
- return `${(n / 1000).toFixed(1)}k`;
763
- return `${n}`;
764
- }
765
- function fmtSigned(n) {
766
- const sign = n >= 0 ? '+' : '';
767
- return `${sign}${n}`;
768
- }
769
- function formatValueStatement(bundleTokens, repoTokens, activationCount) {
770
- if (bundleTokens <= 0 || repoTokens <= 0 || activationCount <= 0)
771
- return null;
772
- const baselineTokens = repoTokens * activationCount;
773
- const savedTokens = baselineTokens - bundleTokens;
774
- if (savedTokens <= 0)
775
- return null;
776
- const reductionPct = Math.round((savedTokens / baselineTokens) * 100);
777
- const activationLabel = activationCount === 1
778
- ? '1 task activation'
779
- : `${activationCount} task activations`;
780
- const summary = `avoided ~${fmtTokens(savedTokens)} input tokens vs a no-CodeLedger full-repo baseline (~${fmtTokens(baselineTokens)} tokens across ${activationLabel}, ${reductionPct}% less context)`;
781
- const estCostSaved = (savedTokens / 1_000_000) * 3;
782
- const costLine = estCostSaved >= 0.01
783
- ? `~$${estCostSaved.toFixed(2)} estimated input cost avoided at $3/M tokens`
784
- : undefined;
785
- return { summary, costLine };
786
- }
787
- function loadMeasuredBenchmarkValue(cwd, task) {
788
- const reportsRoot = join(cwd, '.codeledger', 'reports');
789
- if (!existsSync(reportsRoot))
790
- return null;
791
- const target = intentNorm(task);
792
- if (!target)
793
- return null;
794
- const reportPaths = readdirSync(reportsRoot)
795
- .map((entry) => join(reportsRoot, entry, 'report.json'))
796
- .filter((path) => existsSync(path))
797
- .map((path) => ({
798
- path,
799
- mtime: statSync(path).mtimeMs,
800
- }))
801
- .sort((a, b) => b.mtime - a.mtime);
802
- for (const candidate of reportPaths) {
803
- try {
804
- const report = JSON.parse(readFileSync(candidate.path, 'utf-8'));
805
- if (!report.task_prompt)
806
- continue;
807
- if (intentNorm(report.task_prompt) !== target)
808
- continue;
809
- return formatMeasuredBenchmarkValue(report);
810
- }
811
- catch {
812
- // Ignore malformed report artifacts.
813
- }
814
- }
815
- return null;
816
- }
817
- function formatMeasuredBenchmarkValue(report) {
818
- const delta = report.aggregate.delta;
819
- if (!Number.isFinite(delta.token_estimate_pct) && !Number.isFinite(delta.duration_sec_pct)) {
820
- return null;
821
- }
822
- const summaryParts = [];
823
- if (Number.isFinite(delta.token_estimate_pct)) {
824
- if (delta.token_estimate_pct < 0) {
825
- summaryParts.push(`${Math.abs(delta.token_estimate_pct)}% lower token usage vs measured without-CodeLedger runs`);
826
- }
827
- else if (delta.token_estimate_pct > 0) {
828
- summaryParts.push(`${delta.token_estimate_pct}% higher token usage vs measured without-CodeLedger runs`);
829
- }
830
- else {
831
- summaryParts.push('no token-usage change vs measured without-CodeLedger runs');
832
- }
833
- }
834
- if (Number.isFinite(delta.duration_sec_pct)) {
835
- if (delta.duration_sec_pct < 0) {
836
- summaryParts.push(`${Math.abs(delta.duration_sec_pct)}% faster completion`);
837
- }
838
- else if (delta.duration_sec_pct > 0) {
839
- summaryParts.push(`${delta.duration_sec_pct}% slower completion`);
840
- }
841
- else {
842
- summaryParts.push('no duration change');
843
- }
844
- }
845
- let outcomeLine;
846
- const outcomes = report.aggregate.outcomes;
847
- if (outcomes) {
848
- outcomeLine = `acceptance ${outcomes.acceptance_rate_without}% -> ${outcomes.acceptance_rate_with}% (${fmtSigned(outcomes.acceptance_rate_uplift_pct)}pp)`;
849
- if (outcomes.time_to_acceptance_reduction_pct !== null) {
850
- outcomeLine += `, time-to-acceptance ${fmtSigned(outcomes.time_to_acceptance_reduction_pct)}%`;
851
- }
852
- }
853
- if (summaryParts.length === 0)
854
- return null;
855
- return {
856
- summary: summaryParts.join(', '),
857
- outcomeLine,
858
- };
859
- }
860
- // ── Debt Injection Detection ────────────────────────────────────────────────
861
- function analyzeDebt(cwd, sessionId) {
862
- const activateRefPath = sessionActivateRef(cwd, sessionId);
863
- const sessionRefPath = sessionStartRef(cwd, sessionId);
864
- const refPath = existsSync(activateRefPath) ? activateRefPath : sessionRefPath;
865
- if (!existsSync(refPath))
866
- return null;
867
- const startRef = readFileSync(refPath, 'utf-8').trim();
868
- if (!startRef)
869
- return null;
870
- try {
871
- const diff = execSync(`git diff ${startRef}..HEAD`, {
872
- cwd,
873
- encoding: 'utf-8',
874
- timeout: 10000,
875
- maxBuffer: 10 * 1024 * 1024,
876
- stdio: ['pipe', 'pipe', 'pipe'],
877
- });
878
- if (!diff.trim())
879
- return null;
880
- // Dynamic import to avoid bundling selector into CLI at compile time
881
- const debtFns = loadDebtDetection();
882
- if (!debtFns.scanDebtPatterns || !debtFns.computeDebtScore)
883
- return null;
884
- const warnings = debtFns.scanDebtPatterns(diff);
885
- const addedLines = diff.split('\n').filter((l) => l.startsWith('+') && !l.startsWith('+++')).length;
886
- const debtScore = debtFns.computeDebtScore(warnings, addedLines);
887
- return {
888
- warnings,
889
- total_suppressions: warnings.length,
890
- debt_score: debtScore,
891
- };
892
- }
893
- catch {
894
- return null;
895
- }
896
- }
897
- function loadDebtDetection() {
898
- try {
899
- // Inline implementation to avoid cross-package import complexity
900
- const DEBT_PATTERNS = [
901
- { pattern: /@Suppress\b/, message: '@Suppress annotation suppresses warnings' },
902
- { pattern: /@SuppressWarnings\b/, message: '@SuppressWarnings hides compiler warnings' },
903
- { pattern: /eslint-disable(?!-next-line)/, message: 'eslint-disable disables linting for entire block' },
904
- { pattern: /eslint-disable-next-line/, message: 'eslint-disable-next-line suppresses linting' },
905
- { pattern: /@ts-ignore\b/, message: '@ts-ignore suppresses TypeScript errors' },
906
- { pattern: /@ts-expect-error\b/, message: '@ts-expect-error suppresses a TypeScript error' },
907
- { pattern: /:\s*any\b/, message: 'Explicit `any` type bypasses type safety' },
908
- { pattern: /as\s+any\b/, message: '`as any` assertion bypasses type safety' },
909
- { pattern: /\/\/\s*noinspection\b/, message: 'noinspection comment suppresses IDE warnings' },
910
- { pattern: /NOSONAR\b/, message: 'NOSONAR suppresses static analysis' },
911
- { pattern: /--no-verify\b/, message: '--no-verify skips pre-commit hooks' },
912
- ];
913
- const scanDebtPatterns = (diffContent) => {
914
- const warnings = [];
915
- const lines = diffContent.split('\n');
916
- let currentFile = '';
917
- let lineNumber = 0;
918
- for (const line of lines) {
919
- const fileMatch = /^\+\+\+ b\/(.+)$/.exec(line);
920
- if (fileMatch) {
921
- currentFile = fileMatch[1];
922
- if (currentFile.startsWith('.codeledger/') || currentFile.startsWith('.claude/')) {
923
- currentFile = '';
924
- }
925
- lineNumber = 0;
926
- continue;
927
- }
928
- const hunkMatch = /^@@ -\d+(?:,\d+)? \+(\d+)/.exec(line);
929
- if (hunkMatch) {
930
- lineNumber = parseInt(hunkMatch[1], 10);
931
- continue;
932
- }
933
- if (!currentFile) {
934
- continue;
935
- }
936
- if (line.startsWith('+') && !line.startsWith('+++')) {
937
- const content = line.slice(1);
938
- for (const { pattern, message } of DEBT_PATTERNS) {
939
- if (pattern.test(content)) {
940
- warnings.push({ file: currentFile, line: lineNumber, pattern: pattern.source, message });
941
- }
942
- }
943
- lineNumber++;
944
- }
945
- else if (!line.startsWith('-')) {
946
- lineNumber++;
947
- }
948
- }
949
- return warnings;
950
- };
951
- const computeDebtScore = (warnings, lineCount) => {
952
- if (lineCount === 0 || warnings.length === 0)
953
- return 0;
954
- const ratio = warnings.length / (lineCount / 10);
955
- return Math.min(1.0, Math.round(ratio * 100) / 100);
956
- };
957
- return { scanDebtPatterns, computeDebtScore };
958
- }
959
- catch {
960
- return { scanDebtPatterns: null, computeDebtScore: null };
961
- }
962
- }
963
- // ── Commit Hygiene Analysis ─────────────────────────────────────────────────
964
- function analyzeCommitHygiene(cwd, sessionId, bundleFiles) {
965
- const activateRefPath = sessionActivateRef(cwd, sessionId);
966
- const sessionRefPath = sessionStartRef(cwd, sessionId);
967
- const refPath = existsSync(activateRefPath) ? activateRefPath : sessionRefPath;
968
- if (!existsSync(refPath))
969
- return null;
970
- const startRef = readFileSync(refPath, 'utf-8').trim();
971
- if (!startRef)
972
- return null;
973
- try {
974
- // Get commit log since start ref
975
- const log = execSync(`git log --format="%H %s" ${startRef}..HEAD`, { cwd, encoding: 'utf-8', timeout: 5000, stdio: ['pipe', 'pipe', 'pipe'] }).trim();
976
- if (!log)
977
- return null;
978
- const commits = log.split('\n').filter(Boolean);
979
- let emptyCommits = 0;
980
- let noVerifyCount = 0;
981
- let forcePushCount = 0;
982
- for (const commit of commits) {
983
- const sha = commit.split(' ')[0];
984
- // Check for empty commits (no file changes)
985
- try {
986
- const files = execSync(`git diff-tree --no-commit-id --name-only -r ${sha}`, {
987
- cwd, encoding: 'utf-8', timeout: 5000, stdio: ['pipe', 'pipe', 'pipe'],
988
- }).trim();
989
- if (!files)
990
- emptyCommits++;
991
- }
992
- catch {
993
- // non-fatal
994
- }
995
- // Check commit message for --no-verify indicators
996
- const message = commit.slice(sha.length + 1);
997
- if (message.includes('--no-verify') || message.includes('[skip ci]')) {
998
- noVerifyCount++;
999
- }
1000
- }
1001
- // Detect out-of-scope files (changed files not in bundle)
1002
- const bundleSet = new Set(bundleFiles);
1003
- const changedFiles = new Set();
1004
- try {
1005
- const diff = execSync(`git diff --name-only ${startRef}..HEAD`, {
1006
- cwd, encoding: 'utf-8', timeout: 5000, stdio: ['pipe', 'pipe', 'pipe'],
1007
- }).trim();
1008
- if (diff) {
1009
- for (const f of diff.split('\n')) {
1010
- if (!f.startsWith('.codeledger/') && !f.startsWith('.claude/'))
1011
- changedFiles.add(f);
1012
- }
1013
- }
1014
- }
1015
- catch {
1016
- // non-fatal
1017
- }
1018
- const outOfScope = [...changedFiles].filter((f) => !bundleSet.has(f));
1019
- // Compute hygiene score: 1.0 = perfect, deductions for issues
1020
- let hygieneScore = 1.0;
1021
- if (commits.length > 0) {
1022
- hygieneScore -= (emptyCommits / commits.length) * 0.3;
1023
- hygieneScore -= (noVerifyCount / commits.length) * 0.3;
1024
- }
1025
- if (changedFiles.size > 0 && outOfScope.length > 0) {
1026
- hygieneScore -= Math.min(0.3, (outOfScope.length / changedFiles.size) * 0.3);
1027
- }
1028
- hygieneScore = Math.max(0, Math.round(hygieneScore * 100) / 100);
1029
- return {
1030
- total_commits: commits.length,
1031
- empty_commits: emptyCommits,
1032
- no_verify_count: noVerifyCount,
1033
- force_push_count: forcePushCount,
1034
- out_of_scope_files: outOfScope,
1035
- hygiene_score: hygieneScore,
1036
- };
1037
- }
1038
- catch {
1039
- return null;
1040
- }
1041
- }
1042
- /**
1043
- * When the session involved multiple tasks, print a per-task breakdown
1044
- * showing recall/precision for each activate call, plus session-wide totals.
1045
- *
1046
- * Reads `.task-history.jsonl` to reconstruct what happened in each task.
1047
- */
1048
- function printSessionAggregate(cwd, sessionId, lastTaskSummary) {
1049
- const sessionRefPath = sessionStartRef(cwd, sessionId);
1050
- if (!existsSync(sessionRefPath))
1051
- return;
1052
- const sessionRef = readFileSync(sessionRefPath, 'utf-8').trim();
1053
- if (!sessionRef)
1054
- return;
1055
- // -- Load task history (JSONL) -------------------------------------------
1056
- const historyPath = sessionTaskHistoryPath(cwd, sessionId);
1057
- const activations = loadTaskHistory(historyPath);
1058
- // -- Count commits since session start -----------------------------------
1059
- let commitCount = 0;
1060
- try {
1061
- const count = execSync(`git rev-list --count ${sessionRef}..HEAD`, {
1062
- cwd,
1063
- encoding: 'utf-8',
1064
- timeout: 5000,
1065
- stdio: ['pipe', 'pipe', 'pipe'],
1066
- }).trim();
1067
- commitCount = parseInt(count, 10) || 0;
1068
- }
1069
- catch {
1070
- // non-fatal
1071
- }
1072
- // -- Gather all files changed across the entire session -------------------
1073
- const allChanged = new Set();
1074
- try {
1075
- const committed = execSync(`git diff --name-only ${sessionRef}..HEAD`, {
1076
- cwd,
1077
- encoding: 'utf-8',
1078
- timeout: 5000,
1079
- stdio: ['pipe', 'pipe', 'pipe'],
1080
- }).trim();
1081
- if (committed) {
1082
- for (const f of committed.split('\n')) {
1083
- if (!f.startsWith('.codeledger/') && !f.startsWith('.claude/'))
1084
- allChanged.add(f);
1085
- }
1086
- }
1087
- }
1088
- catch {
1089
- // non-fatal
1090
- }
1091
- try {
1092
- const uncommitted = execSync('git diff --name-only HEAD', {
1093
- cwd,
1094
- encoding: 'utf-8',
1095
- timeout: 5000,
1096
- stdio: ['pipe', 'pipe', 'pipe'],
1097
- }).trim();
1098
- if (uncommitted) {
1099
- for (const f of uncommitted.split('\n')) {
1100
- if (!f.startsWith('.codeledger/') && !f.startsWith('.claude/'))
1101
- allChanged.add(f);
1102
- }
1103
- }
1104
- }
1105
- catch {
1106
- // non-fatal
1107
- }
1108
- // -- Compute per-task metrics -------------------------------------------
1109
- const taskMetrics = computePerTaskMetrics(cwd, activations);
1110
- const lines = [];
1111
- lines.push('');
1112
- lines.push('-- Session Summary (all tasks) --------------------------------');
1113
- if (sessionId) {
1114
- lines.push(` Session: ${sessionId}`);
1115
- }
1116
- // Per-task breakdown (only if there's history and at least one task had changes)
1117
- if (taskMetrics.length > 0) {
1118
- lines.push('');
1119
- for (let i = 0; i < taskMetrics.length; i++) {
1120
- const m = taskMetrics[i];
1121
- const recallPct = Math.round(m.recall * 100);
1122
- const precisionPct = Math.round(m.precision * 100);
1123
- const icon = m.verdict === 'HIT' ? '\u2705' : m.verdict === 'PARTIAL' ? '\u{1F7E1}' : '\u274C';
1124
- lines.push(` Task ${i + 1}: "${truncate(m.task, 55)}"`);
1125
- if (m.files_changed.length === 0) {
1126
- lines.push(` No files changed — skipped`);
1127
- }
1128
- else {
1129
- lines.push(` Recall: ${m.files_overlapping.length}/${m.files_changed.length} (${recallPct}%) Precision: ${m.files_overlapping.length}/${m.bundle_file_count} (${precisionPct}%) ${icon} ${m.verdict}`);
1130
- }
1131
- }
1132
- }
1133
- else if (allChanged.size > lastTaskSummary.files_changed.length) {
1134
- // Fallback: no task history but session had multiple tasks worth of changes
1135
- lines.push(` ${allChanged.size} files changed across ${commitCount} commit${commitCount === 1 ? '' : 's'}`);
1136
- }
1137
- // Session totals
1138
- if (taskMetrics.length > 1 || (taskMetrics.length === 0 && allChanged.size > 0)) {
1139
- const totalChanged = taskMetrics.length > 0
1140
- ? new Set(taskMetrics.flatMap((m) => m.files_changed)).size
1141
- : allChanged.size;
1142
- const totalOverlap = taskMetrics.length > 0
1143
- ? new Set(taskMetrics.flatMap((m) => m.files_overlapping)).size
1144
- : lastTaskSummary.files_overlapping.length;
1145
- const sessionRecall = totalChanged > 0 ? totalOverlap / totalChanged : 0;
1146
- const sessionRecallPct = Math.round(sessionRecall * 100);
1147
- const hits = taskMetrics.filter((m) => m.verdict === 'HIT').length;
1148
- const partials = taskMetrics.filter((m) => m.verdict === 'PARTIAL').length;
1149
- const misses = taskMetrics.filter((m) => m.verdict === 'MISS').length;
1150
- lines.push('');
1151
- lines.push(` Session: ${totalChanged} files changed, ${commitCount} commit${commitCount === 1 ? '' : 's'}, ${sessionRecallPct}% overall recall`);
1152
- if (taskMetrics.length > 0) {
1153
- lines.push(` Tasks: ${hits} hit, ${partials} partial, ${misses} miss (${taskMetrics.length} total)`);
1154
- }
1155
- }
1156
- const activationCount = Math.max(activations.length, 1);
1157
- const totalBundleTokens = activations.length > 0
1158
- ? activations.reduce((sum, activation) => sum + activation.bundle_tokens, 0)
1159
- : lastTaskSummary.bundle_tokens;
1160
- const sessionValue = formatValueStatement(totalBundleTokens, lastTaskSummary.repo_total_tokens, activationCount);
1161
- const sessionMeasuredValue = loadMeasuredBenchmarkValue(cwd, lastTaskSummary.task);
1162
- if (sessionMeasuredValue) {
1163
- lines.push('');
1164
- lines.push(` Measured value: ${sessionMeasuredValue.summary}`);
1165
- if (sessionMeasuredValue.outcomeLine) {
1166
- lines.push(` Measured outcomes: ${sessionMeasuredValue.outcomeLine}`);
1167
- }
1168
- }
1169
- else if (sessionValue) {
1170
- lines.push('');
1171
- lines.push(` Value: ${sessionValue.summary}`);
1172
- if (sessionValue.costLine) {
1173
- lines.push(` Value $: ${sessionValue.costLine}`);
1174
- }
1175
- }
1176
- else {
1177
- lines.push('');
1178
- lines.push(' Value: estimated baseline only. Run `codeledger compare-current --guided` for measured with-vs-without data.');
1179
- }
1180
- lines.push('-'.repeat(61));
1181
- lines.push('');
1182
- console.log(lines.join('\n'));
1183
- }
1184
- // ── Scope Drift Detection ───────────────────────────────────────────────────
1185
- function getScopeDriftFiles(changedFiles, scopeContract) {
1186
- const scopeSet = new Set([...scopeContract.bundle_files, ...scopeContract.neighbor_files]);
1187
- return changedFiles.filter((f) => !scopeSet.has(f));
1188
- }
1189
- // ── Conflict Zone Touches ───────────────────────────────────────────────────
1190
- function countConflictTouches(changedFiles, conflictZones) {
1191
- const conflictFiles = new Set(conflictZones.map((z) => z.file));
1192
- return changedFiles.filter((f) => conflictFiles.has(f)).length;
1193
- }
1194
- // ── Bundle Invalidation (Commit-Aware) ──────────────────────────────────────
1195
- function analyzeBundleInvalidation(cwd, sessionId, bundleFiles) {
1196
- if (bundleFiles.length === 0)
1197
- return null;
1198
- // Get the activate ref to know when the bundle was generated
1199
- const activateRefPath = sessionActivateRef(cwd, sessionId);
1200
- const sessionRefPath = sessionStartRef(cwd, sessionId);
1201
- const refPath = existsSync(activateRefPath) ? activateRefPath : sessionRefPath;
1202
- if (!existsSync(refPath))
1203
- return null;
1204
- const startRef = readFileSync(refPath, 'utf-8').trim();
1205
- if (!startRef)
1206
- return null;
1207
- try {
1208
- // Get commit log with file names since the bundle was generated
1209
- const log = execSync(`git log --format="%H %aI" --name-only ${startRef}..HEAD`, { cwd, encoding: 'utf-8', timeout: 5000, stdio: ['pipe', 'pipe', 'pipe'] }).trim();
1210
- if (!log)
1211
- return null;
1212
- // Parse which files were committed
1213
- const committedFiles = new Map();
1214
- const lines = log.split('\n');
1215
- let currentSha = '';
1216
- let currentDate = '';
1217
- for (const line of lines) {
1218
- const trimmed = line.trim();
1219
- if (!trimmed)
1220
- continue;
1221
- const commitMatch = /^([0-9a-f]{40})\s+(.+)$/.exec(trimmed);
1222
- if (commitMatch) {
1223
- currentSha = commitMatch[1];
1224
- currentDate = commitMatch[2];
1225
- continue;
1226
- }
1227
- // File path — only record the first (most recent) commit
1228
- if (currentSha && !committedFiles.has(trimmed)) {
1229
- committedFiles.set(trimmed, { commit_sha: currentSha, committed_at: currentDate });
1230
- }
1231
- }
1232
- if (committedFiles.size === 0)
1233
- return null;
1234
- // Cross-reference with bundle files
1235
- const addressed = [];
1236
- const fresh = [];
1237
- for (const filePath of bundleFiles) {
1238
- const commitInfo = committedFiles.get(filePath);
1239
- if (commitInfo) {
1240
- addressed.push({
1241
- path: filePath,
1242
- addressed_at: commitInfo.committed_at,
1243
- commit_sha: commitInfo.commit_sha,
1244
- });
1245
- }
1246
- else {
1247
- fresh.push(filePath);
1248
- }
1249
- }
1250
- if (addressed.length === 0)
1251
- return null;
1252
- return {
1253
- addressed_files: addressed,
1254
- fresh_files: fresh,
1255
- staleness_ratio: Math.round((addressed.length / bundleFiles.length) * 100) / 100,
1256
- };
1257
- }
1258
- catch {
1259
- return null;
1260
- }
1261
- }
1262
- // ── Per-Task History & Metrics ──────────────────────────────────────────────
1263
- /**
1264
- * Load the JSONL task history file. Returns an empty array if missing or
1265
- * malformed (best-effort — task history is non-critical).
1266
- */
1267
- function loadTaskHistory(historyPath) {
1268
- if (!existsSync(historyPath))
1269
- return [];
1270
- try {
1271
- const content = readFileSync(historyPath, 'utf-8').trim();
1272
- if (!content)
1273
- return [];
1274
- return content
1275
- .split('\n')
1276
- .filter(Boolean)
1277
- .map((line) => {
1278
- try {
1279
- return JSON.parse(line);
1280
- }
1281
- catch {
1282
- return null;
1283
- }
1284
- })
1285
- .filter((r) => r !== null);
1286
- }
1287
- catch {
1288
- return [];
1289
- }
1290
- }
1291
- /**
1292
- * For each activation in the task history, compute the files changed between
1293
- * that activation's ref and the next activation's ref (or HEAD for the last one).
1294
- * Then compute recall/precision against that task's bundle.
1295
- */
1296
- function computePerTaskMetrics(cwd, activations) {
1297
- if (activations.length === 0)
1298
- return [];
1299
- const metrics = [];
1300
- for (let i = 0; i < activations.length; i++) {
1301
- const activation = activations[i];
1302
- const nextActivation = activations[i + 1];
1303
- // Determine the end ref: next activation's ref or HEAD
1304
- const startRef = activation.activate_ref;
1305
- let endRef = 'HEAD';
1306
- if (nextActivation) {
1307
- endRef = nextActivation.activate_ref;
1308
- }
1309
- // Get files changed in this task's window
1310
- const filesChanged = getFilesChangedBetween(cwd, startRef, endRef);
1311
- // Also include uncommitted changes if this is the last task
1312
- if (!nextActivation) {
1313
- try {
1314
- const uncommitted = execSync('git diff --name-only HEAD', {
1315
- cwd,
1316
- encoding: 'utf-8',
1317
- timeout: 5000,
1318
- stdio: ['pipe', 'pipe', 'pipe'],
1319
- }).trim();
1320
- if (uncommitted) {
1321
- for (const f of uncommitted.split('\n')) {
1322
- if (!f.startsWith('.codeledger/') && !f.startsWith('.claude/'))
1323
- filesChanged.add(f);
1324
- }
1325
- }
1326
- }
1327
- catch {
1328
- // non-fatal
1329
- }
1330
- try {
1331
- const untracked = execSync('git ls-files --others --exclude-standard', {
1332
- cwd,
1333
- encoding: 'utf-8',
1334
- timeout: 5000,
1335
- stdio: ['pipe', 'pipe', 'pipe'],
1336
- }).trim();
1337
- if (untracked) {
1338
- for (const f of untracked.split('\n')) {
1339
- if (!f.startsWith('.codeledger/') && !f.startsWith('.claude/'))
1340
- filesChanged.add(f);
1341
- }
1342
- }
1343
- }
1344
- catch {
1345
- // non-fatal
1346
- }
1347
- }
1348
- const changed = [...filesChanged];
1349
- const bundleSet = new Set(activation.bundle_files);
1350
- const overlapping = changed.filter((f) => bundleSet.has(f));
1351
- const recall = changed.length > 0 ? overlapping.length / changed.length : 0;
1352
- const precision = activation.bundle_files.length > 0
1353
- ? overlapping.length / activation.bundle_files.length
1354
- : 0;
1355
- // Verdict based on F1 thresholds
1356
- const f1 = (precision + recall) > 0
1357
- ? 2 * (precision * recall) / (precision + recall)
1358
- : 0;
1359
- let verdict;
1360
- if (changed.length === 0) {
1361
- verdict = 'MISS'; // No files changed — can't evaluate
1362
- }
1363
- else if (f1 >= 0.3) {
1364
- verdict = 'HIT';
1365
- }
1366
- else if (recall > 0) {
1367
- verdict = 'PARTIAL';
1368
- }
1369
- else {
1370
- verdict = 'MISS';
1371
- }
1372
- metrics.push({
1373
- task: activation.task,
1374
- bundle_id: activation.bundle_id,
1375
- bundle_file_count: activation.bundle_files.length,
1376
- bundle_tokens: activation.bundle_tokens,
1377
- files_changed: changed,
1378
- files_overlapping: overlapping,
1379
- recall,
1380
- precision,
1381
- verdict,
1382
- });
1383
- }
1384
- return metrics;
1385
- }
1386
- /**
1387
- * Get files changed between two git refs. Returns a mutable set.
1388
- */
1389
- function getFilesChangedBetween(cwd, startRef, endRef) {
1390
- const files = new Set();
1391
- try {
1392
- const diff = execSync(`git diff --name-only ${startRef}..${endRef}`, {
1393
- cwd,
1394
- encoding: 'utf-8',
1395
- timeout: 5000,
1396
- stdio: ['pipe', 'pipe', 'pipe'],
1397
- }).trim();
1398
- if (diff) {
1399
- for (const f of diff.split('\n')) {
1400
- if (!f.startsWith('.codeledger/') && !f.startsWith('.claude/'))
1401
- files.add(f);
1402
- }
1403
- }
1404
- }
1405
- catch {
1406
- // non-fatal: ref may no longer be valid
1407
- }
1408
- return files;
1409
- }
1410
- function truncate(s, max) {
1411
- return s.length <= max ? s : s.slice(0, max - 3) + '...';
1412
- }
1413
- //# sourceMappingURL=session-summary.js.map