@dommaker/harness 3.0.0 → 4.0.1

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 (1240) hide show
  1. package/dist/agents/index.d.ts +0 -1
  2. package/dist/agents/index.js +0 -1
  3. package/dist/agents/lifecycle.d.ts +0 -1
  4. package/dist/agents/lifecycle.js +0 -1
  5. package/dist/agents/types.d.ts +0 -1
  6. package/dist/agents/types.js +0 -1
  7. package/dist/bootstrap/bootstrap.d.ts +0 -1
  8. package/dist/bootstrap/bootstrap.js +0 -1
  9. package/dist/bootstrap/index.d.ts +0 -1
  10. package/dist/bootstrap/index.js +0 -1
  11. package/dist/cli/command-contract.d.ts +0 -1
  12. package/dist/cli/command-contract.js +0 -1
  13. package/dist/cli/commands/__tests__/gate-decision.d.ts +0 -1
  14. package/dist/cli/commands/__tests__/gate-decision.js +0 -1
  15. package/dist/cli/commands/acceptance.d.ts +0 -1
  16. package/dist/cli/commands/acceptance.js +3 -3
  17. package/dist/cli/commands/check.d.ts +0 -1
  18. package/dist/cli/commands/check.js +0 -1
  19. package/dist/cli/commands/command.d.ts +0 -1
  20. package/dist/cli/commands/command.js +0 -1
  21. package/dist/cli/commands/constraints-disable.d.ts +0 -1
  22. package/dist/cli/commands/constraints-disable.js +0 -1
  23. package/dist/cli/commands/constraints-pack-proposal.d.ts +0 -1
  24. package/dist/cli/commands/constraints-pack-proposal.js +0 -1
  25. package/dist/cli/commands/constraints-reactivate.d.ts +0 -1
  26. package/dist/cli/commands/constraints-reactivate.js +0 -1
  27. package/dist/cli/commands/constraints-report.d.ts +0 -1
  28. package/dist/cli/commands/constraints-report.js +4 -4
  29. package/dist/cli/commands/constraints-retire.d.ts +0 -1
  30. package/dist/cli/commands/constraints-retire.js +0 -1
  31. package/dist/cli/commands/constraints.d.ts +0 -1
  32. package/dist/cli/commands/constraints.js +0 -1
  33. package/dist/cli/commands/contract.d.ts +0 -1
  34. package/dist/cli/commands/contract.js +4 -4
  35. package/dist/cli/commands/definitions.d.ts +0 -1
  36. package/dist/cli/commands/definitions.js +0 -1
  37. package/dist/cli/commands/failure.d.ts +0 -1
  38. package/dist/cli/commands/failure.js +0 -1
  39. package/dist/cli/commands/init/ci-platform.d.ts +3 -6
  40. package/dist/cli/commands/init/ci-platform.js +3 -9
  41. package/dist/cli/commands/init/ci-wiring.d.ts +0 -1
  42. package/dist/cli/commands/init/ci-wiring.js +0 -1
  43. package/dist/cli/commands/init/git-hooks.d.ts +0 -1
  44. package/dist/cli/commands/init/git-hooks.js +0 -1
  45. package/dist/cli/commands/init/governance.d.ts +0 -1
  46. package/dist/cli/commands/init/governance.js +0 -1
  47. package/dist/cli/commands/init/index.d.ts +0 -1
  48. package/dist/cli/commands/init/index.js +80 -14
  49. package/dist/cli/commands/init/output-style.d.ts +0 -1
  50. package/dist/cli/commands/init/output-style.js +0 -1
  51. package/dist/cli/commands/init/presets.d.ts +0 -1
  52. package/dist/cli/commands/init/presets.js +0 -1
  53. package/dist/cli/commands/init/snippets.d.ts +0 -1
  54. package/dist/cli/commands/init/snippets.js +0 -1
  55. package/dist/cli/commands/knowledge/audit.d.ts +0 -1
  56. package/dist/cli/commands/knowledge/audit.js +0 -1
  57. package/dist/cli/commands/knowledge/decay.d.ts +0 -1
  58. package/dist/cli/commands/knowledge/decay.js +0 -1
  59. package/dist/cli/commands/knowledge/health.d.ts +0 -1
  60. package/dist/cli/commands/knowledge/health.js +0 -1
  61. package/dist/cli/commands/knowledge/import.d.ts +0 -1
  62. package/dist/cli/commands/knowledge/import.js +12 -1
  63. package/dist/cli/commands/knowledge/index.d.ts +0 -1
  64. package/dist/cli/commands/knowledge/index.js +0 -1
  65. package/dist/cli/commands/knowledge/list.d.ts +0 -1
  66. package/dist/cli/commands/knowledge/list.js +18 -1
  67. package/dist/cli/commands/knowledge/search.d.ts +0 -1
  68. package/dist/cli/commands/knowledge/search.js +0 -1
  69. package/dist/cli/commands/knowledge/shared.d.ts +0 -1
  70. package/dist/cli/commands/knowledge/shared.js +0 -1
  71. package/dist/cli/commands/knowledge/snapshot.d.ts +0 -1
  72. package/dist/cli/commands/knowledge/snapshot.js +0 -1
  73. package/dist/cli/commands/knowledge/stats.d.ts +0 -1
  74. package/dist/cli/commands/knowledge/stats.js +4 -9
  75. package/dist/cli/commands/knowledge/store-access.d.ts +0 -1
  76. package/dist/cli/commands/knowledge/store-access.js +0 -1
  77. package/dist/cli/commands/knowledge-view.d.ts +0 -1
  78. package/dist/cli/commands/knowledge-view.js +0 -1
  79. package/dist/cli/commands/passes-gate.d.ts +0 -1
  80. package/dist/cli/commands/passes-gate.js +5 -42
  81. package/dist/cli/commands/performance.d.ts +0 -1
  82. package/dist/cli/commands/performance.js +0 -1
  83. package/dist/cli/commands/release.d.ts +0 -1
  84. package/dist/cli/commands/release.js +2 -2
  85. package/dist/cli/commands/report.d.ts +0 -1
  86. package/dist/cli/commands/report.js +0 -1
  87. package/dist/cli/commands/review.d.ts +0 -1
  88. package/dist/cli/commands/review.js +4 -4
  89. package/dist/cli/commands/scaffold-templates.d.ts +0 -1
  90. package/dist/cli/commands/scaffold-templates.js +1 -2
  91. package/dist/cli/commands/scaffold.d.ts +0 -1
  92. package/dist/cli/commands/scaffold.js +0 -1
  93. package/dist/cli/commands/sdd.d.ts +0 -1
  94. package/dist/cli/commands/sdd.js +0 -1
  95. package/dist/cli/commands/security.d.ts +0 -1
  96. package/dist/cli/commands/security.js +2 -2
  97. package/dist/cli/commands/spec/validator.d.ts +3 -1
  98. package/dist/cli/commands/spec/validator.js +12 -13
  99. package/dist/cli/commands/spec-baseline-check.d.ts +0 -1
  100. package/dist/cli/commands/spec-baseline-check.js +22 -5
  101. package/dist/cli/commands/spec.d.ts +0 -1
  102. package/dist/cli/commands/spec.js +0 -1
  103. package/dist/cli/commands/status.d.ts +0 -1
  104. package/dist/cli/commands/status.js +0 -1
  105. package/dist/cli/commands/sync-docs/agents-syncer.d.ts +0 -1
  106. package/dist/cli/commands/sync-docs/agents-syncer.js +0 -1
  107. package/dist/cli/commands/sync-docs/capabilities-syncer.d.ts +0 -1
  108. package/dist/cli/commands/sync-docs/capabilities-syncer.js +2 -2
  109. package/dist/cli/commands/sync-docs/compact.d.ts +0 -1
  110. package/dist/cli/commands/sync-docs/compact.js +0 -1
  111. package/dist/cli/commands/sync-docs/context-syncer.d.ts +0 -1
  112. package/dist/cli/commands/sync-docs/context-syncer.js +0 -1
  113. package/dist/cli/commands/sync-docs/gate.d.ts +0 -1
  114. package/dist/cli/commands/sync-docs/gate.js +0 -1
  115. package/dist/cli/commands/sync-docs/head-gate.d.ts +0 -1
  116. package/dist/cli/commands/sync-docs/head-gate.js +0 -1
  117. package/dist/cli/commands/sync-docs/index.d.ts +0 -1
  118. package/dist/cli/commands/sync-docs/index.js +0 -1
  119. package/dist/cli/commands/sync-docs/main-flow.d.ts +0 -1
  120. package/dist/cli/commands/sync-docs/main-flow.js +0 -1
  121. package/dist/cli/commands/sync-docs/preserve-block.d.ts +0 -1
  122. package/dist/cli/commands/sync-docs/preserve-block.js +0 -1
  123. package/dist/cli/commands/sync-docs/project-reader.d.ts +0 -1
  124. package/dist/cli/commands/sync-docs/project-reader.js +0 -1
  125. package/dist/cli/commands/sync-docs/sync-output.d.ts +0 -1
  126. package/dist/cli/commands/sync-docs/sync-output.js +62 -47
  127. package/dist/cli/commands/sync-docs/sync-state.d.ts +0 -1
  128. package/dist/cli/commands/sync-docs/sync-state.js +0 -1
  129. package/dist/cli/commands/sync-docs/sync-writes.d.ts +0 -1
  130. package/dist/cli/commands/sync-docs/sync-writes.js +0 -1
  131. package/dist/cli/commands/validate.d.ts +0 -1
  132. package/dist/cli/commands/validate.js +5 -3
  133. package/dist/cli/gate-command.d.ts +0 -1
  134. package/dist/cli/gate-command.js +2 -2
  135. package/dist/cli/state-io.d.ts +0 -1
  136. package/dist/cli/state-io.js +0 -1
  137. package/dist/completion-checkers/classify.d.ts +0 -1
  138. package/dist/completion-checkers/classify.js +0 -1
  139. package/dist/completion-checkers/contract-presence.d.ts +0 -1
  140. package/dist/completion-checkers/contract-presence.js +0 -1
  141. package/dist/completion-checkers/glob-match.d.ts +0 -1
  142. package/dist/completion-checkers/glob-match.js +0 -1
  143. package/dist/completion-checkers/index.d.ts +0 -1
  144. package/dist/completion-checkers/index.js +0 -1
  145. package/dist/completion-checkers/phase-format.d.ts +0 -1
  146. package/dist/completion-checkers/phase-format.js +0 -1
  147. package/dist/completion-checkers/tdd-chain.d.ts +0 -1
  148. package/dist/completion-checkers/tdd-chain.js +0 -1
  149. package/dist/completion-checkers/types.d.ts +0 -1
  150. package/dist/completion-checkers/types.js +0 -1
  151. package/dist/context/index.d.ts +0 -1
  152. package/dist/context/index.js +0 -1
  153. package/dist/context/session-manager.d.ts +0 -1
  154. package/dist/context/session-manager.js +0 -1
  155. package/dist/context/types.d.ts +0 -1
  156. package/dist/context/types.js +0 -1
  157. package/dist/core/app-constraints-loader.d.ts +0 -1
  158. package/dist/core/app-constraints-loader.js +3 -3
  159. package/dist/core/constraint-lifecycle.d.ts +0 -1
  160. package/dist/core/constraint-lifecycle.js +0 -1
  161. package/dist/core/constraints/capabilities-parser.d.ts +0 -1
  162. package/dist/core/constraints/capabilities-parser.js +0 -1
  163. package/dist/core/constraints/capabilities-reconcile.d.ts +0 -1
  164. package/dist/core/constraints/capabilities-reconcile.js +0 -1
  165. package/dist/core/constraints/check-cache.d.ts +0 -1
  166. package/dist/core/constraints/check-cache.js +0 -1
  167. package/dist/core/constraints/checker.d.ts +0 -2
  168. package/dist/core/constraints/checker.js +1 -4
  169. package/dist/core/constraints/checkers/capability-sync.d.ts +0 -1
  170. package/dist/core/constraints/checkers/capability-sync.js +2 -2
  171. package/dist/core/constraints/checkers/context-doc-sync.d.ts +0 -1
  172. package/dist/core/constraints/checkers/context-doc-sync.js +0 -1
  173. package/dist/core/constraints/checkers/docs-freshness.d.ts +0 -1
  174. package/dist/core/constraints/checkers/docs-freshness.js +2 -2
  175. package/dist/core/constraints/checkers/governance-presence.d.ts +0 -1
  176. package/dist/core/constraints/checkers/governance-presence.js +0 -1
  177. package/dist/core/constraints/checkers/index.d.ts +0 -1
  178. package/dist/core/constraints/checkers/index.js +0 -1
  179. package/dist/core/constraints/checkers/no-completion-without-verification.d.ts +0 -1
  180. package/dist/core/constraints/checkers/no-completion-without-verification.js +2 -2
  181. package/dist/core/constraints/checkers/no-hardcoded-credentials.d.ts +0 -1
  182. package/dist/core/constraints/checkers/no-hardcoded-credentials.js +0 -1
  183. package/dist/core/constraints/checkers/no-test-simplification.d.ts +0 -1
  184. package/dist/core/constraints/checkers/no-test-simplification.js +2 -2
  185. package/dist/core/constraints/checkers/templated/exec.d.ts +0 -1
  186. package/dist/core/constraints/checkers/templated/exec.js +0 -1
  187. package/dist/core/constraints/checkers/templated/file-exists.d.ts +3 -2
  188. package/dist/core/constraints/checkers/templated/file-exists.js +14 -40
  189. package/dist/core/constraints/checkers/templated/glob.d.ts +0 -1
  190. package/dist/core/constraints/checkers/templated/glob.js +0 -1
  191. package/dist/core/constraints/checkers/templated/index.d.ts +0 -1
  192. package/dist/core/constraints/checkers/templated/index.js +0 -1
  193. package/dist/core/constraints/checkers/templated/regex-scan.d.ts +0 -1
  194. package/dist/core/constraints/checkers/templated/regex-scan.js +2 -2
  195. package/dist/core/constraints/checkers/types.d.ts +0 -1
  196. package/dist/core/constraints/checkers/types.js +0 -1
  197. package/dist/core/constraints/construction-sites.d.ts +0 -1
  198. package/dist/core/constraints/construction-sites.js +0 -1
  199. package/dist/core/constraints/context-builder.d.ts +0 -1
  200. package/dist/core/constraints/context-builder.js +0 -1
  201. package/dist/core/constraints/context-reconcile.d.ts +0 -1
  202. package/dist/core/constraints/context-reconcile.js +0 -1
  203. package/dist/core/constraints/definitions/errors.d.ts +0 -1
  204. package/dist/core/constraints/definitions/errors.js +0 -1
  205. package/dist/core/constraints/definitions/warnings.d.ts +0 -1
  206. package/dist/core/constraints/definitions/warnings.js +0 -1
  207. package/dist/core/constraints/definitions.d.ts +1 -6
  208. package/dist/core/constraints/definitions.js +0 -11
  209. package/dist/core/constraints/doc-freshness/check-changelog-version.d.ts +8 -0
  210. package/dist/core/constraints/doc-freshness/check-changelog-version.js +39 -0
  211. package/dist/core/constraints/doc-freshness/check-context-docs.d.ts +8 -0
  212. package/dist/core/constraints/doc-freshness/check-context-docs.js +32 -0
  213. package/dist/core/constraints/doc-freshness/check-doc-dir.d.ts +8 -0
  214. package/dist/core/constraints/doc-freshness/check-doc-dir.js +138 -0
  215. package/dist/core/constraints/doc-freshness/check-doc-regex-count.d.ts +16 -0
  216. package/dist/core/constraints/doc-freshness/check-doc-regex-count.js +131 -0
  217. package/dist/core/constraints/doc-freshness/runner.d.ts +8 -21
  218. package/dist/core/constraints/doc-freshness/runner.js +19 -313
  219. package/dist/core/constraints/find-constraint.d.ts +0 -1
  220. package/dist/core/constraints/find-constraint.js +0 -1
  221. package/dist/core/constraints/git-evidence.d.ts +0 -1
  222. package/dist/core/constraints/git-evidence.js +0 -1
  223. package/dist/core/constraints/governance-accessors.d.ts +0 -1
  224. package/dist/core/constraints/governance-accessors.js +0 -1
  225. package/dist/core/constraints/index.d.ts +2 -3
  226. package/dist/core/constraints/index.js +1 -4
  227. package/dist/core/constraints/injection-writer.d.ts +0 -13
  228. package/dist/core/constraints/injection-writer.js +0 -16
  229. package/dist/core/constraints/meta.d.ts +0 -1
  230. package/dist/core/constraints/meta.js +0 -1
  231. package/dist/core/constraints/pack-proposal.d.ts +0 -1
  232. package/dist/core/constraints/pack-proposal.js +5 -5
  233. package/dist/core/constraints/run-env.d.ts +0 -1
  234. package/dist/core/constraints/run-env.js +1 -2
  235. package/dist/core/constraints/triggers.d.ts +0 -1
  236. package/dist/core/constraints/triggers.js +0 -1
  237. package/dist/core/constraints/usage-report.d.ts +0 -12
  238. package/dist/core/constraints/usage-report.js +0 -16
  239. package/dist/core/effective-constraints.d.ts +0 -1
  240. package/dist/core/effective-constraints.js +0 -1
  241. package/dist/core/effective-set.d.ts +0 -1
  242. package/dist/core/effective-set.js +0 -1
  243. package/dist/core/project-config-loader.d.ts +0 -1
  244. package/dist/core/project-config-loader.js +0 -1
  245. package/dist/core/retired-constraints.d.ts +0 -1
  246. package/dist/core/retired-constraints.js +0 -1
  247. package/dist/core/spec/baseline-check.d.ts +5 -1
  248. package/dist/core/spec/baseline-check.js +0 -1
  249. package/dist/core/validators/check-handlers/command.d.ts +3 -4
  250. package/dist/core/validators/check-handlers/command.js +7 -22
  251. package/dist/core/validators/check-handlers/fail-result.d.ts +11 -0
  252. package/dist/core/validators/check-handlers/fail-result.js +15 -0
  253. package/dist/core/validators/check-handlers/file.d.ts +5 -6
  254. package/dist/core/validators/check-handlers/file.js +12 -33
  255. package/dist/core/validators/check-handlers/http.d.ts +3 -4
  256. package/dist/core/validators/check-handlers/http.js +7 -22
  257. package/dist/core/validators/check-handlers/output.d.ts +5 -6
  258. package/dist/core/validators/check-handlers/output.js +8 -28
  259. package/dist/core/validators/checkpoint.d.ts +7 -1
  260. package/dist/core/validators/checkpoint.js +66 -7
  261. package/dist/core/validators/cso.d.ts +0 -1
  262. package/dist/core/validators/cso.js +0 -1
  263. package/dist/core/validators/index.d.ts +1 -2
  264. package/dist/core/validators/index.js +1 -3
  265. package/dist/core/validators/passes-gate.d.ts +0 -5
  266. package/dist/core/validators/passes-gate.js +2 -9
  267. package/dist/core/validators/test-output.d.ts +0 -1
  268. package/dist/core/validators/test-output.js +0 -1
  269. package/dist/failure/classifier.d.ts +1 -2
  270. package/dist/failure/classifier.js +0 -1
  271. package/dist/failure/error-types.d.ts +48 -5
  272. package/dist/failure/error-types.js +5 -4
  273. package/dist/failure/index.d.ts +1 -2
  274. package/dist/failure/index.js +3 -3
  275. package/dist/failure/recorder.d.ts +1 -2
  276. package/dist/failure/recorder.js +0 -1
  277. package/dist/gates/acceptance.d.ts +0 -36
  278. package/dist/gates/acceptance.js +5 -59
  279. package/dist/gates/blacklist-rules.d.ts +12 -0
  280. package/dist/gates/blacklist-rules.js +227 -0
  281. package/dist/gates/command.d.ts +1 -5
  282. package/dist/gates/command.js +5 -219
  283. package/dist/gates/contract.d.ts +0 -1
  284. package/dist/gates/contract.js +0 -1
  285. package/dist/gates/coverage.d.ts +13 -0
  286. package/dist/gates/coverage.js +63 -0
  287. package/dist/gates/decision.d.ts +0 -1
  288. package/dist/gates/decision.js +0 -1
  289. package/dist/gates/definitions.d.ts +4 -4
  290. package/dist/gates/definitions.js +4 -4
  291. package/dist/gates/performance.d.ts +0 -1
  292. package/dist/gates/performance.js +6 -12
  293. package/dist/gates/review.d.ts +22 -1
  294. package/dist/gates/review.js +4 -3
  295. package/dist/gates/security.d.ts +0 -1
  296. package/dist/gates/security.js +10 -2
  297. package/dist/gates/tasks-file.d.ts +41 -0
  298. package/dist/gates/tasks-file.js +63 -0
  299. package/dist/gates/types.d.ts +0 -1
  300. package/dist/gates/types.js +2 -2
  301. package/dist/index.d.ts +7 -9
  302. package/dist/index.js +4 -18
  303. package/dist/knowledge/audit-dimensions.d.ts +0 -1
  304. package/dist/knowledge/audit-dimensions.js +0 -1
  305. package/dist/knowledge/audit-rules.d.ts +0 -1
  306. package/dist/knowledge/audit-rules.js +0 -1
  307. package/dist/knowledge/audit-scoring.d.ts +0 -1
  308. package/dist/knowledge/audit-scoring.js +0 -1
  309. package/dist/knowledge/audit.d.ts +0 -1
  310. package/dist/knowledge/audit.js +0 -1
  311. package/dist/knowledge/cold-start.d.ts +0 -1
  312. package/dist/knowledge/cold-start.js +8 -7
  313. package/dist/knowledge/flywheel-metrics.d.ts +0 -1
  314. package/dist/knowledge/flywheel-metrics.js +0 -1
  315. package/dist/knowledge/index-generator.d.ts +0 -1
  316. package/dist/knowledge/index-generator.js +8 -9
  317. package/dist/knowledge/index.d.ts +0 -1
  318. package/dist/knowledge/index.js +0 -1
  319. package/dist/knowledge/ingest.d.ts +0 -1
  320. package/dist/knowledge/ingest.js +0 -1
  321. package/dist/knowledge/lifecycle.d.ts +0 -1
  322. package/dist/knowledge/lifecycle.js +0 -1
  323. package/dist/knowledge/query.d.ts +0 -1
  324. package/dist/knowledge/query.js +0 -1
  325. package/dist/knowledge/store.d.ts +0 -1
  326. package/dist/knowledge/store.js +14 -11
  327. package/dist/knowledge/token-estimate.d.ts +0 -1
  328. package/dist/knowledge/token-estimate.js +0 -1
  329. package/dist/knowledge/tree-walker.d.ts +0 -1
  330. package/dist/knowledge/tree-walker.js +0 -1
  331. package/dist/knowledge/types.d.ts +0 -1
  332. package/dist/knowledge/types.js +0 -1
  333. package/dist/monitoring/index.d.ts +1 -2
  334. package/dist/monitoring/index.js +1 -3
  335. package/dist/monitoring/trace-analyzer.d.ts +0 -1
  336. package/dist/monitoring/trace-analyzer.js +32 -6
  337. package/dist/monitoring/traces.d.ts +0 -15
  338. package/dist/monitoring/traces.js +1 -17
  339. package/dist/presets/index.d.ts +0 -1
  340. package/dist/presets/index.js +0 -1
  341. package/dist/presets/standard.d.ts +0 -1
  342. package/dist/presets/standard.js +0 -1
  343. package/dist/pretool-use-hook.d.ts +0 -1
  344. package/dist/pretool-use-hook.js +0 -1
  345. package/dist/release/index.d.ts +0 -1
  346. package/dist/release/index.js +0 -1
  347. package/dist/release/integrity.d.ts +0 -1
  348. package/dist/release/integrity.js +0 -1
  349. package/dist/sdd/index-generator.d.ts +0 -2
  350. package/dist/sdd/index-generator.js +2 -5
  351. package/dist/types/checkpoint.d.ts +105 -33
  352. package/dist/types/checkpoint.js +0 -1
  353. package/dist/types/command-definition.d.ts +0 -1
  354. package/dist/types/command-definition.js +0 -1
  355. package/dist/types/command-io.d.ts +0 -1
  356. package/dist/types/command-io.js +0 -1
  357. package/dist/types/constraint.d.ts +0 -1
  358. package/dist/types/constraint.js +0 -1
  359. package/dist/types/cso.d.ts +0 -1
  360. package/dist/types/cso.js +0 -1
  361. package/dist/types/failure.d.ts +5 -53
  362. package/dist/types/failure.js +5 -9
  363. package/dist/types/gate.d.ts +0 -1
  364. package/dist/types/gate.js +0 -1
  365. package/dist/types/passes-gate.d.ts +10 -4
  366. package/dist/types/passes-gate.js +0 -1
  367. package/dist/types/project-config.d.ts +0 -1
  368. package/dist/types/project-config.js +0 -1
  369. package/dist/types/spec.d.ts +0 -7
  370. package/dist/types/spec.js +0 -1
  371. package/dist/types/trace.d.ts +0 -1
  372. package/dist/types/trace.js +0 -1
  373. package/dist/utils/attempt.d.ts +0 -1
  374. package/dist/utils/attempt.js +0 -1
  375. package/dist/utils/clip.d.ts +0 -1
  376. package/dist/utils/clip.js +0 -1
  377. package/dist/utils/date.d.ts +10 -0
  378. package/dist/utils/date.js +18 -0
  379. package/dist/utils/detect-source-roots.d.ts +0 -1
  380. package/dist/utils/detect-source-roots.js +0 -1
  381. package/dist/utils/diff-parse.d.ts +0 -1
  382. package/dist/utils/diff-parse.js +0 -1
  383. package/dist/utils/error.d.ts +10 -0
  384. package/dist/utils/error.js +15 -0
  385. package/dist/utils/exec.d.ts +0 -1
  386. package/dist/utils/exec.js +0 -1
  387. package/dist/utils/file-walk.d.ts +12 -3
  388. package/dist/utils/file-walk.js +20 -3
  389. package/dist/utils/frontmatter.d.ts +0 -1
  390. package/dist/utils/frontmatter.js +4 -4
  391. package/dist/utils/glob-match.d.ts +0 -1
  392. package/dist/utils/glob-match.js +0 -1
  393. package/dist/utils/guards.d.ts +0 -1
  394. package/dist/utils/guards.js +0 -1
  395. package/dist/utils/json-doc.d.ts +13 -0
  396. package/dist/utils/json-doc.js +54 -0
  397. package/dist/utils/jsonl.d.ts +0 -1
  398. package/dist/utils/jsonl.js +0 -1
  399. package/dist/utils/log-rotate.d.ts +0 -1
  400. package/dist/utils/log-rotate.js +0 -1
  401. package/dist/utils/numeric-flag.d.ts +0 -1
  402. package/dist/utils/numeric-flag.js +0 -1
  403. package/dist/utils/package-json.d.ts +0 -1
  404. package/dist/utils/package-json.js +0 -1
  405. package/dist/utils/package-version.d.ts +0 -1
  406. package/dist/utils/package-version.js +0 -1
  407. package/dist/utils/text.d.ts +18 -0
  408. package/dist/utils/text.js +26 -0
  409. package/dist/utils/yaml-edit.d.ts +2 -3
  410. package/dist/utils/yaml-edit.js +4 -5
  411. package/dist/utils/yaml.d.ts +23 -0
  412. package/dist/utils/yaml.js +30 -0
  413. package/package.json +2 -21
  414. package/CHANGELOG.md +0 -601
  415. package/dist/agents/index.d.ts.map +0 -1
  416. package/dist/agents/index.js.map +0 -1
  417. package/dist/agents/lifecycle.d.ts.map +0 -1
  418. package/dist/agents/lifecycle.js.map +0 -1
  419. package/dist/agents/types.d.ts.map +0 -1
  420. package/dist/agents/types.js.map +0 -1
  421. package/dist/bootstrap/bootstrap.d.ts.map +0 -1
  422. package/dist/bootstrap/bootstrap.js.map +0 -1
  423. package/dist/bootstrap/index.d.ts.map +0 -1
  424. package/dist/bootstrap/index.js.map +0 -1
  425. package/dist/cli/command-contract.d.ts.map +0 -1
  426. package/dist/cli/command-contract.js.map +0 -1
  427. package/dist/cli/commands/__tests__/gate-decision.d.ts.map +0 -1
  428. package/dist/cli/commands/__tests__/gate-decision.js.map +0 -1
  429. package/dist/cli/commands/acceptance.d.ts.map +0 -1
  430. package/dist/cli/commands/acceptance.js.map +0 -1
  431. package/dist/cli/commands/check.d.ts.map +0 -1
  432. package/dist/cli/commands/check.js.map +0 -1
  433. package/dist/cli/commands/command.d.ts.map +0 -1
  434. package/dist/cli/commands/command.js.map +0 -1
  435. package/dist/cli/commands/constraints-disable.d.ts.map +0 -1
  436. package/dist/cli/commands/constraints-disable.js.map +0 -1
  437. package/dist/cli/commands/constraints-pack-proposal.d.ts.map +0 -1
  438. package/dist/cli/commands/constraints-pack-proposal.js.map +0 -1
  439. package/dist/cli/commands/constraints-reactivate.d.ts.map +0 -1
  440. package/dist/cli/commands/constraints-reactivate.js.map +0 -1
  441. package/dist/cli/commands/constraints-report.d.ts.map +0 -1
  442. package/dist/cli/commands/constraints-report.js.map +0 -1
  443. package/dist/cli/commands/constraints-retire.d.ts.map +0 -1
  444. package/dist/cli/commands/constraints-retire.js.map +0 -1
  445. package/dist/cli/commands/constraints.d.ts.map +0 -1
  446. package/dist/cli/commands/constraints.js.map +0 -1
  447. package/dist/cli/commands/contract.d.ts.map +0 -1
  448. package/dist/cli/commands/contract.js.map +0 -1
  449. package/dist/cli/commands/definitions.d.ts.map +0 -1
  450. package/dist/cli/commands/definitions.js.map +0 -1
  451. package/dist/cli/commands/failure.d.ts.map +0 -1
  452. package/dist/cli/commands/failure.js.map +0 -1
  453. package/dist/cli/commands/init/ci-platform.d.ts.map +0 -1
  454. package/dist/cli/commands/init/ci-platform.js.map +0 -1
  455. package/dist/cli/commands/init/ci-wiring.d.ts.map +0 -1
  456. package/dist/cli/commands/init/ci-wiring.js.map +0 -1
  457. package/dist/cli/commands/init/git-hooks.d.ts.map +0 -1
  458. package/dist/cli/commands/init/git-hooks.js.map +0 -1
  459. package/dist/cli/commands/init/governance.d.ts.map +0 -1
  460. package/dist/cli/commands/init/governance.js.map +0 -1
  461. package/dist/cli/commands/init/index.d.ts.map +0 -1
  462. package/dist/cli/commands/init/index.js.map +0 -1
  463. package/dist/cli/commands/init/output-style.d.ts.map +0 -1
  464. package/dist/cli/commands/init/output-style.js.map +0 -1
  465. package/dist/cli/commands/init/presets.d.ts.map +0 -1
  466. package/dist/cli/commands/init/presets.js.map +0 -1
  467. package/dist/cli/commands/init/snippets.d.ts.map +0 -1
  468. package/dist/cli/commands/init/snippets.js.map +0 -1
  469. package/dist/cli/commands/knowledge/audit.d.ts.map +0 -1
  470. package/dist/cli/commands/knowledge/audit.js.map +0 -1
  471. package/dist/cli/commands/knowledge/decay.d.ts.map +0 -1
  472. package/dist/cli/commands/knowledge/decay.js.map +0 -1
  473. package/dist/cli/commands/knowledge/health.d.ts.map +0 -1
  474. package/dist/cli/commands/knowledge/health.js.map +0 -1
  475. package/dist/cli/commands/knowledge/import.d.ts.map +0 -1
  476. package/dist/cli/commands/knowledge/import.js.map +0 -1
  477. package/dist/cli/commands/knowledge/index.d.ts.map +0 -1
  478. package/dist/cli/commands/knowledge/index.js.map +0 -1
  479. package/dist/cli/commands/knowledge/list.d.ts.map +0 -1
  480. package/dist/cli/commands/knowledge/list.js.map +0 -1
  481. package/dist/cli/commands/knowledge/search.d.ts.map +0 -1
  482. package/dist/cli/commands/knowledge/search.js.map +0 -1
  483. package/dist/cli/commands/knowledge/shared.d.ts.map +0 -1
  484. package/dist/cli/commands/knowledge/shared.js.map +0 -1
  485. package/dist/cli/commands/knowledge/snapshot.d.ts.map +0 -1
  486. package/dist/cli/commands/knowledge/snapshot.js.map +0 -1
  487. package/dist/cli/commands/knowledge/stats.d.ts.map +0 -1
  488. package/dist/cli/commands/knowledge/stats.js.map +0 -1
  489. package/dist/cli/commands/knowledge/store-access.d.ts.map +0 -1
  490. package/dist/cli/commands/knowledge/store-access.js.map +0 -1
  491. package/dist/cli/commands/knowledge-view.d.ts.map +0 -1
  492. package/dist/cli/commands/knowledge-view.js.map +0 -1
  493. package/dist/cli/commands/passes-gate.d.ts.map +0 -1
  494. package/dist/cli/commands/passes-gate.js.map +0 -1
  495. package/dist/cli/commands/performance.d.ts.map +0 -1
  496. package/dist/cli/commands/performance.js.map +0 -1
  497. package/dist/cli/commands/release.d.ts.map +0 -1
  498. package/dist/cli/commands/release.js.map +0 -1
  499. package/dist/cli/commands/report.d.ts.map +0 -1
  500. package/dist/cli/commands/report.js.map +0 -1
  501. package/dist/cli/commands/review.d.ts.map +0 -1
  502. package/dist/cli/commands/review.js.map +0 -1
  503. package/dist/cli/commands/scaffold-templates.d.ts.map +0 -1
  504. package/dist/cli/commands/scaffold-templates.js.map +0 -1
  505. package/dist/cli/commands/scaffold.d.ts.map +0 -1
  506. package/dist/cli/commands/scaffold.js.map +0 -1
  507. package/dist/cli/commands/sdd.d.ts.map +0 -1
  508. package/dist/cli/commands/sdd.js.map +0 -1
  509. package/dist/cli/commands/security.d.ts.map +0 -1
  510. package/dist/cli/commands/security.js.map +0 -1
  511. package/dist/cli/commands/spec/validator.d.ts.map +0 -1
  512. package/dist/cli/commands/spec/validator.js.map +0 -1
  513. package/dist/cli/commands/spec-baseline-check.d.ts.map +0 -1
  514. package/dist/cli/commands/spec-baseline-check.js.map +0 -1
  515. package/dist/cli/commands/spec.d.ts.map +0 -1
  516. package/dist/cli/commands/spec.js.map +0 -1
  517. package/dist/cli/commands/status.d.ts.map +0 -1
  518. package/dist/cli/commands/status.js.map +0 -1
  519. package/dist/cli/commands/sync-docs/agents-syncer.d.ts.map +0 -1
  520. package/dist/cli/commands/sync-docs/agents-syncer.js.map +0 -1
  521. package/dist/cli/commands/sync-docs/capabilities-syncer.d.ts.map +0 -1
  522. package/dist/cli/commands/sync-docs/capabilities-syncer.js.map +0 -1
  523. package/dist/cli/commands/sync-docs/compact.d.ts.map +0 -1
  524. package/dist/cli/commands/sync-docs/compact.js.map +0 -1
  525. package/dist/cli/commands/sync-docs/context-syncer.d.ts.map +0 -1
  526. package/dist/cli/commands/sync-docs/context-syncer.js.map +0 -1
  527. package/dist/cli/commands/sync-docs/gate.d.ts.map +0 -1
  528. package/dist/cli/commands/sync-docs/gate.js.map +0 -1
  529. package/dist/cli/commands/sync-docs/head-gate.d.ts.map +0 -1
  530. package/dist/cli/commands/sync-docs/head-gate.js.map +0 -1
  531. package/dist/cli/commands/sync-docs/index.d.ts.map +0 -1
  532. package/dist/cli/commands/sync-docs/index.js.map +0 -1
  533. package/dist/cli/commands/sync-docs/main-flow.d.ts.map +0 -1
  534. package/dist/cli/commands/sync-docs/main-flow.js.map +0 -1
  535. package/dist/cli/commands/sync-docs/preserve-block.d.ts.map +0 -1
  536. package/dist/cli/commands/sync-docs/preserve-block.js.map +0 -1
  537. package/dist/cli/commands/sync-docs/project-reader.d.ts.map +0 -1
  538. package/dist/cli/commands/sync-docs/project-reader.js.map +0 -1
  539. package/dist/cli/commands/sync-docs/sync-output.d.ts.map +0 -1
  540. package/dist/cli/commands/sync-docs/sync-output.js.map +0 -1
  541. package/dist/cli/commands/sync-docs/sync-state.d.ts.map +0 -1
  542. package/dist/cli/commands/sync-docs/sync-state.js.map +0 -1
  543. package/dist/cli/commands/sync-docs/sync-writes.d.ts.map +0 -1
  544. package/dist/cli/commands/sync-docs/sync-writes.js.map +0 -1
  545. package/dist/cli/commands/validate.d.ts.map +0 -1
  546. package/dist/cli/commands/validate.js.map +0 -1
  547. package/dist/cli/gate-command.d.ts.map +0 -1
  548. package/dist/cli/gate-command.js.map +0 -1
  549. package/dist/cli/state-io.d.ts.map +0 -1
  550. package/dist/cli/state-io.js.map +0 -1
  551. package/dist/completion-checkers/classify.d.ts.map +0 -1
  552. package/dist/completion-checkers/classify.js.map +0 -1
  553. package/dist/completion-checkers/contract-presence.d.ts.map +0 -1
  554. package/dist/completion-checkers/contract-presence.js.map +0 -1
  555. package/dist/completion-checkers/glob-match.d.ts.map +0 -1
  556. package/dist/completion-checkers/glob-match.js.map +0 -1
  557. package/dist/completion-checkers/index.d.ts.map +0 -1
  558. package/dist/completion-checkers/index.js.map +0 -1
  559. package/dist/completion-checkers/phase-format.d.ts.map +0 -1
  560. package/dist/completion-checkers/phase-format.js.map +0 -1
  561. package/dist/completion-checkers/tdd-chain.d.ts.map +0 -1
  562. package/dist/completion-checkers/tdd-chain.js.map +0 -1
  563. package/dist/completion-checkers/types.d.ts.map +0 -1
  564. package/dist/completion-checkers/types.js.map +0 -1
  565. package/dist/context/index.d.ts.map +0 -1
  566. package/dist/context/index.js.map +0 -1
  567. package/dist/context/session-manager.d.ts.map +0 -1
  568. package/dist/context/session-manager.js.map +0 -1
  569. package/dist/context/types.d.ts.map +0 -1
  570. package/dist/context/types.js.map +0 -1
  571. package/dist/core/app-constraints-loader.d.ts.map +0 -1
  572. package/dist/core/app-constraints-loader.js.map +0 -1
  573. package/dist/core/config-files.d.ts +0 -21
  574. package/dist/core/config-files.d.ts.map +0 -1
  575. package/dist/core/config-files.js +0 -75
  576. package/dist/core/config-files.js.map +0 -1
  577. package/dist/core/constraint-lifecycle.d.ts.map +0 -1
  578. package/dist/core/constraint-lifecycle.js.map +0 -1
  579. package/dist/core/constraints/capabilities-parser.d.ts.map +0 -1
  580. package/dist/core/constraints/capabilities-parser.js.map +0 -1
  581. package/dist/core/constraints/capabilities-reconcile.d.ts.map +0 -1
  582. package/dist/core/constraints/capabilities-reconcile.js.map +0 -1
  583. package/dist/core/constraints/check-cache.d.ts.map +0 -1
  584. package/dist/core/constraints/check-cache.js.map +0 -1
  585. package/dist/core/constraints/checker.d.ts.map +0 -1
  586. package/dist/core/constraints/checker.js.map +0 -1
  587. package/dist/core/constraints/checkers/capability-sync.d.ts.map +0 -1
  588. package/dist/core/constraints/checkers/capability-sync.js.map +0 -1
  589. package/dist/core/constraints/checkers/context-doc-sync.d.ts.map +0 -1
  590. package/dist/core/constraints/checkers/context-doc-sync.js.map +0 -1
  591. package/dist/core/constraints/checkers/docs-freshness.d.ts.map +0 -1
  592. package/dist/core/constraints/checkers/docs-freshness.js.map +0 -1
  593. package/dist/core/constraints/checkers/governance-presence.d.ts.map +0 -1
  594. package/dist/core/constraints/checkers/governance-presence.js.map +0 -1
  595. package/dist/core/constraints/checkers/index.d.ts.map +0 -1
  596. package/dist/core/constraints/checkers/index.js.map +0 -1
  597. package/dist/core/constraints/checkers/no-completion-without-verification.d.ts.map +0 -1
  598. package/dist/core/constraints/checkers/no-completion-without-verification.js.map +0 -1
  599. package/dist/core/constraints/checkers/no-hardcoded-credentials.d.ts.map +0 -1
  600. package/dist/core/constraints/checkers/no-hardcoded-credentials.js.map +0 -1
  601. package/dist/core/constraints/checkers/no-test-simplification.d.ts.map +0 -1
  602. package/dist/core/constraints/checkers/no-test-simplification.js.map +0 -1
  603. package/dist/core/constraints/checkers/templated/exec.d.ts.map +0 -1
  604. package/dist/core/constraints/checkers/templated/exec.js.map +0 -1
  605. package/dist/core/constraints/checkers/templated/file-exists.d.ts.map +0 -1
  606. package/dist/core/constraints/checkers/templated/file-exists.js.map +0 -1
  607. package/dist/core/constraints/checkers/templated/glob.d.ts.map +0 -1
  608. package/dist/core/constraints/checkers/templated/glob.js.map +0 -1
  609. package/dist/core/constraints/checkers/templated/index.d.ts.map +0 -1
  610. package/dist/core/constraints/checkers/templated/index.js.map +0 -1
  611. package/dist/core/constraints/checkers/templated/regex-scan.d.ts.map +0 -1
  612. package/dist/core/constraints/checkers/templated/regex-scan.js.map +0 -1
  613. package/dist/core/constraints/checkers/types.d.ts.map +0 -1
  614. package/dist/core/constraints/checkers/types.js.map +0 -1
  615. package/dist/core/constraints/construction-sites.d.ts.map +0 -1
  616. package/dist/core/constraints/construction-sites.js.map +0 -1
  617. package/dist/core/constraints/context-builder.d.ts.map +0 -1
  618. package/dist/core/constraints/context-builder.js.map +0 -1
  619. package/dist/core/constraints/context-reconcile.d.ts.map +0 -1
  620. package/dist/core/constraints/context-reconcile.js.map +0 -1
  621. package/dist/core/constraints/definitions/errors.d.ts.map +0 -1
  622. package/dist/core/constraints/definitions/errors.js.map +0 -1
  623. package/dist/core/constraints/definitions/warnings.d.ts.map +0 -1
  624. package/dist/core/constraints/definitions/warnings.js.map +0 -1
  625. package/dist/core/constraints/definitions.d.ts.map +0 -1
  626. package/dist/core/constraints/definitions.js.map +0 -1
  627. package/dist/core/constraints/doc-freshness/runner.d.ts.map +0 -1
  628. package/dist/core/constraints/doc-freshness/runner.js.map +0 -1
  629. package/dist/core/constraints/find-constraint.d.ts.map +0 -1
  630. package/dist/core/constraints/find-constraint.js.map +0 -1
  631. package/dist/core/constraints/git-evidence.d.ts.map +0 -1
  632. package/dist/core/constraints/git-evidence.js.map +0 -1
  633. package/dist/core/constraints/governance-accessors.d.ts.map +0 -1
  634. package/dist/core/constraints/governance-accessors.js.map +0 -1
  635. package/dist/core/constraints/index.d.ts.map +0 -1
  636. package/dist/core/constraints/index.js.map +0 -1
  637. package/dist/core/constraints/injection-writer.d.ts.map +0 -1
  638. package/dist/core/constraints/injection-writer.js.map +0 -1
  639. package/dist/core/constraints/meta.d.ts.map +0 -1
  640. package/dist/core/constraints/meta.js.map +0 -1
  641. package/dist/core/constraints/pack-proposal.d.ts.map +0 -1
  642. package/dist/core/constraints/pack-proposal.js.map +0 -1
  643. package/dist/core/constraints/run-env.d.ts.map +0 -1
  644. package/dist/core/constraints/run-env.js.map +0 -1
  645. package/dist/core/constraints/triggers.d.ts.map +0 -1
  646. package/dist/core/constraints/triggers.js.map +0 -1
  647. package/dist/core/constraints/usage-report.d.ts.map +0 -1
  648. package/dist/core/constraints/usage-report.js.map +0 -1
  649. package/dist/core/effective-constraints.d.ts.map +0 -1
  650. package/dist/core/effective-constraints.js.map +0 -1
  651. package/dist/core/effective-set.d.ts.map +0 -1
  652. package/dist/core/effective-set.js.map +0 -1
  653. package/dist/core/index.d.ts +0 -16
  654. package/dist/core/index.d.ts.map +0 -1
  655. package/dist/core/index.js +0 -42
  656. package/dist/core/index.js.map +0 -1
  657. package/dist/core/project-config-loader.d.ts.map +0 -1
  658. package/dist/core/project-config-loader.js.map +0 -1
  659. package/dist/core/retired-constraints.d.ts.map +0 -1
  660. package/dist/core/retired-constraints.js.map +0 -1
  661. package/dist/core/spec/baseline-check.d.ts.map +0 -1
  662. package/dist/core/spec/baseline-check.js.map +0 -1
  663. package/dist/core/validators/check-handlers/command.d.ts.map +0 -1
  664. package/dist/core/validators/check-handlers/command.js.map +0 -1
  665. package/dist/core/validators/check-handlers/file.d.ts.map +0 -1
  666. package/dist/core/validators/check-handlers/file.js.map +0 -1
  667. package/dist/core/validators/check-handlers/http.d.ts.map +0 -1
  668. package/dist/core/validators/check-handlers/http.js.map +0 -1
  669. package/dist/core/validators/check-handlers/output.d.ts.map +0 -1
  670. package/dist/core/validators/check-handlers/output.js.map +0 -1
  671. package/dist/core/validators/checkpoint.d.ts.map +0 -1
  672. package/dist/core/validators/checkpoint.js.map +0 -1
  673. package/dist/core/validators/cso.d.ts.map +0 -1
  674. package/dist/core/validators/cso.js.map +0 -1
  675. package/dist/core/validators/index.d.ts.map +0 -1
  676. package/dist/core/validators/index.js.map +0 -1
  677. package/dist/core/validators/passes-gate.d.ts.map +0 -1
  678. package/dist/core/validators/passes-gate.js.map +0 -1
  679. package/dist/core/validators/test-output.d.ts.map +0 -1
  680. package/dist/core/validators/test-output.js.map +0 -1
  681. package/dist/failure/classifier.d.ts.map +0 -1
  682. package/dist/failure/classifier.js.map +0 -1
  683. package/dist/failure/error-types.d.ts.map +0 -1
  684. package/dist/failure/error-types.js.map +0 -1
  685. package/dist/failure/index.d.ts.map +0 -1
  686. package/dist/failure/index.js.map +0 -1
  687. package/dist/failure/recorder.d.ts.map +0 -1
  688. package/dist/failure/recorder.js.map +0 -1
  689. package/dist/gates/acceptance.d.ts.map +0 -1
  690. package/dist/gates/acceptance.js.map +0 -1
  691. package/dist/gates/command.d.ts.map +0 -1
  692. package/dist/gates/command.js.map +0 -1
  693. package/dist/gates/contract.d.ts.map +0 -1
  694. package/dist/gates/contract.js.map +0 -1
  695. package/dist/gates/decision.d.ts.map +0 -1
  696. package/dist/gates/decision.js.map +0 -1
  697. package/dist/gates/definitions.d.ts.map +0 -1
  698. package/dist/gates/definitions.js.map +0 -1
  699. package/dist/gates/performance.d.ts.map +0 -1
  700. package/dist/gates/performance.js.map +0 -1
  701. package/dist/gates/registry.d.ts +0 -32
  702. package/dist/gates/registry.d.ts.map +0 -1
  703. package/dist/gates/registry.js +0 -91
  704. package/dist/gates/registry.js.map +0 -1
  705. package/dist/gates/review.d.ts.map +0 -1
  706. package/dist/gates/review.js.map +0 -1
  707. package/dist/gates/security.d.ts.map +0 -1
  708. package/dist/gates/security.js.map +0 -1
  709. package/dist/gates/types.d.ts.map +0 -1
  710. package/dist/gates/types.js.map +0 -1
  711. package/dist/index.d.ts.map +0 -1
  712. package/dist/index.js.map +0 -1
  713. package/dist/knowledge/audit-dimensions.d.ts.map +0 -1
  714. package/dist/knowledge/audit-dimensions.js.map +0 -1
  715. package/dist/knowledge/audit-rules.d.ts.map +0 -1
  716. package/dist/knowledge/audit-rules.js.map +0 -1
  717. package/dist/knowledge/audit-scoring.d.ts.map +0 -1
  718. package/dist/knowledge/audit-scoring.js.map +0 -1
  719. package/dist/knowledge/audit.d.ts.map +0 -1
  720. package/dist/knowledge/audit.js.map +0 -1
  721. package/dist/knowledge/cold-start.d.ts.map +0 -1
  722. package/dist/knowledge/cold-start.js.map +0 -1
  723. package/dist/knowledge/flywheel-metrics.d.ts.map +0 -1
  724. package/dist/knowledge/flywheel-metrics.js.map +0 -1
  725. package/dist/knowledge/index-generator.d.ts.map +0 -1
  726. package/dist/knowledge/index-generator.js.map +0 -1
  727. package/dist/knowledge/index.d.ts.map +0 -1
  728. package/dist/knowledge/index.js.map +0 -1
  729. package/dist/knowledge/ingest.d.ts.map +0 -1
  730. package/dist/knowledge/ingest.js.map +0 -1
  731. package/dist/knowledge/lifecycle.d.ts.map +0 -1
  732. package/dist/knowledge/lifecycle.js.map +0 -1
  733. package/dist/knowledge/query.d.ts.map +0 -1
  734. package/dist/knowledge/query.js.map +0 -1
  735. package/dist/knowledge/store.d.ts.map +0 -1
  736. package/dist/knowledge/store.js.map +0 -1
  737. package/dist/knowledge/token-estimate.d.ts.map +0 -1
  738. package/dist/knowledge/token-estimate.js.map +0 -1
  739. package/dist/knowledge/tree-walker.d.ts.map +0 -1
  740. package/dist/knowledge/tree-walker.js.map +0 -1
  741. package/dist/knowledge/types.d.ts.map +0 -1
  742. package/dist/knowledge/types.js.map +0 -1
  743. package/dist/monitoring/analyzer-base.d.ts +0 -29
  744. package/dist/monitoring/analyzer-base.d.ts.map +0 -1
  745. package/dist/monitoring/analyzer-base.js +0 -48
  746. package/dist/monitoring/analyzer-base.js.map +0 -1
  747. package/dist/monitoring/index.d.ts.map +0 -1
  748. package/dist/monitoring/index.js.map +0 -1
  749. package/dist/monitoring/trace-analyzer.d.ts.map +0 -1
  750. package/dist/monitoring/trace-analyzer.js.map +0 -1
  751. package/dist/monitoring/traces.d.ts.map +0 -1
  752. package/dist/monitoring/traces.js.map +0 -1
  753. package/dist/presets/index.d.ts.map +0 -1
  754. package/dist/presets/index.js.map +0 -1
  755. package/dist/presets/standard.d.ts.map +0 -1
  756. package/dist/presets/standard.js.map +0 -1
  757. package/dist/pretool-use-hook.d.ts.map +0 -1
  758. package/dist/pretool-use-hook.js.map +0 -1
  759. package/dist/release/index.d.ts.map +0 -1
  760. package/dist/release/index.js.map +0 -1
  761. package/dist/release/integrity.d.ts.map +0 -1
  762. package/dist/release/integrity.js.map +0 -1
  763. package/dist/sdd/index-generator.d.ts.map +0 -1
  764. package/dist/sdd/index-generator.js.map +0 -1
  765. package/dist/test-setup/jsonl-fake-fs.d.ts +0 -30
  766. package/dist/test-setup/jsonl-fake-fs.d.ts.map +0 -1
  767. package/dist/test-setup/jsonl-fake-fs.js +0 -49
  768. package/dist/test-setup/jsonl-fake-fs.js.map +0 -1
  769. package/dist/test-setup/mkdtemp-cleanup.d.ts +0 -9
  770. package/dist/test-setup/mkdtemp-cleanup.d.ts.map +0 -1
  771. package/dist/test-setup/mkdtemp-cleanup.js +0 -90
  772. package/dist/test-setup/mkdtemp-cleanup.js.map +0 -1
  773. package/dist/test-setup/project-fixture.d.ts +0 -48
  774. package/dist/test-setup/project-fixture.d.ts.map +0 -1
  775. package/dist/test-setup/project-fixture.js +0 -106
  776. package/dist/test-setup/project-fixture.js.map +0 -1
  777. package/dist/types/checkpoint.d.ts.map +0 -1
  778. package/dist/types/checkpoint.js.map +0 -1
  779. package/dist/types/command-definition.d.ts.map +0 -1
  780. package/dist/types/command-definition.js.map +0 -1
  781. package/dist/types/command-io.d.ts.map +0 -1
  782. package/dist/types/command-io.js.map +0 -1
  783. package/dist/types/constraint.d.ts.map +0 -1
  784. package/dist/types/constraint.js.map +0 -1
  785. package/dist/types/cso.d.ts.map +0 -1
  786. package/dist/types/cso.js.map +0 -1
  787. package/dist/types/failure.d.ts.map +0 -1
  788. package/dist/types/failure.js.map +0 -1
  789. package/dist/types/gate.d.ts.map +0 -1
  790. package/dist/types/gate.js.map +0 -1
  791. package/dist/types/passes-gate.d.ts.map +0 -1
  792. package/dist/types/passes-gate.js.map +0 -1
  793. package/dist/types/project-config.d.ts.map +0 -1
  794. package/dist/types/project-config.js.map +0 -1
  795. package/dist/types/spec.d.ts.map +0 -1
  796. package/dist/types/spec.js.map +0 -1
  797. package/dist/types/trace.d.ts.map +0 -1
  798. package/dist/types/trace.js.map +0 -1
  799. package/dist/utils/attempt.d.ts.map +0 -1
  800. package/dist/utils/attempt.js.map +0 -1
  801. package/dist/utils/clip.d.ts.map +0 -1
  802. package/dist/utils/clip.js.map +0 -1
  803. package/dist/utils/detect-source-roots.d.ts.map +0 -1
  804. package/dist/utils/detect-source-roots.js.map +0 -1
  805. package/dist/utils/diff-parse.d.ts.map +0 -1
  806. package/dist/utils/diff-parse.js.map +0 -1
  807. package/dist/utils/exec.d.ts.map +0 -1
  808. package/dist/utils/exec.js.map +0 -1
  809. package/dist/utils/file-walk.d.ts.map +0 -1
  810. package/dist/utils/file-walk.js.map +0 -1
  811. package/dist/utils/frontmatter.d.ts.map +0 -1
  812. package/dist/utils/frontmatter.js.map +0 -1
  813. package/dist/utils/glob-match.d.ts.map +0 -1
  814. package/dist/utils/glob-match.js.map +0 -1
  815. package/dist/utils/guards.d.ts.map +0 -1
  816. package/dist/utils/guards.js.map +0 -1
  817. package/dist/utils/jsonl.d.ts.map +0 -1
  818. package/dist/utils/jsonl.js.map +0 -1
  819. package/dist/utils/log-rotate.d.ts.map +0 -1
  820. package/dist/utils/log-rotate.js.map +0 -1
  821. package/dist/utils/numeric-flag.d.ts.map +0 -1
  822. package/dist/utils/numeric-flag.js.map +0 -1
  823. package/dist/utils/package-json.d.ts.map +0 -1
  824. package/dist/utils/package-json.js.map +0 -1
  825. package/dist/utils/package-version.d.ts.map +0 -1
  826. package/dist/utils/package-version.js.map +0 -1
  827. package/dist/utils/yaml-edit.d.ts.map +0 -1
  828. package/dist/utils/yaml-edit.js.map +0 -1
  829. package/src/CONTEXT.md +0 -64
  830. package/src/__tests__/acceptance-gate.test.ts +0 -339
  831. package/src/__tests__/app-constraints-loader.test.ts +0 -301
  832. package/src/__tests__/checker-extra.test.ts +0 -303
  833. package/src/__tests__/checker-primitives-sdk.test.ts +0 -55
  834. package/src/__tests__/checker.test.ts +0 -118
  835. package/src/__tests__/checkpoint.test.ts +0 -700
  836. package/src/__tests__/context-files-resolution.test.ts +0 -131
  837. package/src/__tests__/contract-gate.test.ts +0 -268
  838. package/src/__tests__/cso-validator.test.ts +0 -197
  839. package/src/__tests__/detect-source-roots.test.ts +0 -99
  840. package/src/__tests__/effective-constraints.test.ts +0 -114
  841. package/src/__tests__/error-classifier.test.ts +0 -263
  842. package/src/__tests__/exec-checker-full-chain.test.ts +0 -118
  843. package/src/__tests__/exec.test.ts +0 -55
  844. package/src/__tests__/failure-recorder.test.ts +0 -277
  845. package/src/__tests__/install-precommit-hook.test.ts +0 -61
  846. package/src/__tests__/iron-laws.test.ts +0 -221
  847. package/src/__tests__/layering.test.ts +0 -345
  848. package/src/__tests__/no-studio-references.test.ts +0 -62
  849. package/src/__tests__/passes-gate-check.test.ts +0 -154
  850. package/src/__tests__/passes-gate.test.ts +0 -171
  851. package/src/__tests__/performance-gate.test.ts +0 -54
  852. package/src/__tests__/pretool-use-hook.test.ts +0 -289
  853. package/src/__tests__/project-config-loader-extra.test.ts +0 -172
  854. package/src/__tests__/project-config-loader.test.ts +0 -141
  855. package/src/__tests__/public-exports.test.ts +0 -368
  856. package/src/__tests__/public-type-surface.test.ts +0 -305
  857. package/src/__tests__/public-value-surface.test.ts +0 -147
  858. package/src/__tests__/retired-constraints.test.ts +0 -99
  859. package/src/__tests__/review-gate.test.ts +0 -73
  860. package/src/__tests__/security-gate.test.ts +0 -67
  861. package/src/__tests__/skip-semantics.test.ts +0 -285
  862. package/src/__tests__/sub-barrels-explicit.test.ts +0 -87
  863. package/src/__tests__/test-fixture-hygiene.test.ts +0 -53
  864. package/src/__tests__/trace-analyzer-extra.test.ts +0 -101
  865. package/src/__tests__/trace-analyzer.test.ts +0 -182
  866. package/src/__tests__/trace-collector.test.ts +0 -206
  867. package/src/__tests__/traces.test.ts +0 -294
  868. package/src/__tests__/usage-report-public-export.test.ts +0 -21
  869. package/src/agents/CONTEXT.md +0 -19
  870. package/src/agents/__tests__/lifecycle.test.ts +0 -97
  871. package/src/agents/index.ts +0 -10
  872. package/src/agents/lifecycle.ts +0 -86
  873. package/src/agents/types.ts +0 -26
  874. package/src/bootstrap/CONTEXT.md +0 -24
  875. package/src/bootstrap/__tests__/bootstrap.test.ts +0 -155
  876. package/src/bootstrap/bootstrap.ts +0 -106
  877. package/src/bootstrap/index.ts +0 -11
  878. package/src/cli/__tests__/command-contract.test.ts +0 -188
  879. package/src/cli/__tests__/gate-command.test.ts +0 -162
  880. package/src/cli/__tests__/state-io.test.ts +0 -50
  881. package/src/cli/command-contract.ts +0 -111
  882. package/src/cli/commands/CONTEXT.md +0 -83
  883. package/src/cli/commands/__tests__/acceptance.test.ts +0 -186
  884. package/src/cli/commands/__tests__/bin-exit-mapping.test.ts +0 -122
  885. package/src/cli/commands/__tests__/check-read-count.test.ts +0 -159
  886. package/src/cli/commands/__tests__/check-skip-output.test.ts +0 -123
  887. package/src/cli/commands/__tests__/check.test.ts +0 -600
  888. package/src/cli/commands/__tests__/command-gate-dead-options.test.ts +0 -62
  889. package/src/cli/commands/__tests__/command.test.ts +0 -180
  890. package/src/cli/commands/__tests__/constraints-disable.test.ts +0 -229
  891. package/src/cli/commands/__tests__/constraints-pack-proposal.test.ts +0 -141
  892. package/src/cli/commands/__tests__/constraints-reactivate.test.ts +0 -210
  893. package/src/cli/commands/__tests__/constraints-report-json-flag.test.ts +0 -101
  894. package/src/cli/commands/__tests__/constraints-report.test.ts +0 -457
  895. package/src/cli/commands/__tests__/constraints-retire.test.ts +0 -532
  896. package/src/cli/commands/__tests__/context-syncer.test.ts +0 -141
  897. package/src/cli/commands/__tests__/contract.test.ts +0 -151
  898. package/src/cli/commands/__tests__/failure.test.ts +0 -196
  899. package/src/cli/commands/__tests__/gate-decision.ts +0 -30
  900. package/src/cli/commands/__tests__/init-dead-options.test.ts +0 -50
  901. package/src/cli/commands/__tests__/init-governance-io.test.ts +0 -98
  902. package/src/cli/commands/__tests__/init-ondisk.test.ts +0 -859
  903. package/src/cli/commands/__tests__/init.test.ts +0 -479
  904. package/src/cli/commands/__tests__/knowledge-audit-threshold.test.ts +0 -152
  905. package/src/cli/commands/__tests__/knowledge-flywheel-consistency.test.ts +0 -109
  906. package/src/cli/commands/__tests__/knowledge-tone-mapping.test.ts +0 -244
  907. package/src/cli/commands/__tests__/knowledge-view.test.ts +0 -719
  908. package/src/cli/commands/__tests__/knowledge.test.ts +0 -414
  909. package/src/cli/commands/__tests__/numeric-flag-assembly.test.ts +0 -369
  910. package/src/cli/commands/__tests__/passes-gate-dead-options.test.ts +0 -158
  911. package/src/cli/commands/__tests__/passes-gate.test.ts +0 -334
  912. package/src/cli/commands/__tests__/performance.test.ts +0 -102
  913. package/src/cli/commands/__tests__/pre-push-hook.test.ts +0 -181
  914. package/src/cli/commands/__tests__/project-path-anchoring.test.ts +0 -250
  915. package/src/cli/commands/__tests__/project-path-convention.test.ts +0 -260
  916. package/src/cli/commands/__tests__/registry.test.ts +0 -327
  917. package/src/cli/commands/__tests__/release.test.ts +0 -334
  918. package/src/cli/commands/__tests__/report-app-constraints.test.ts +0 -67
  919. package/src/cli/commands/__tests__/report-extra.test.ts +0 -79
  920. package/src/cli/commands/__tests__/report-false-green.test.ts +0 -50
  921. package/src/cli/commands/__tests__/report.test.ts +0 -111
  922. package/src/cli/commands/__tests__/review.test.ts +0 -162
  923. package/src/cli/commands/__tests__/scaffold.test.ts +0 -495
  924. package/src/cli/commands/__tests__/security-default-scan.test.ts +0 -75
  925. package/src/cli/commands/__tests__/security.test.ts +0 -242
  926. package/src/cli/commands/__tests__/spec-baseline-check.test.ts +0 -236
  927. package/src/cli/commands/__tests__/spec-baseline-index-cap.test.ts +0 -131
  928. package/src/cli/commands/__tests__/spec-baseline-read-count.test.ts +0 -325
  929. package/src/cli/commands/__tests__/spec.test.ts +0 -215
  930. package/src/cli/commands/__tests__/status-analysis-wiring.test.ts +0 -68
  931. package/src/cli/commands/__tests__/status-extra.test.ts +0 -163
  932. package/src/cli/commands/__tests__/status-skipped-lines.test.ts +0 -72
  933. package/src/cli/commands/__tests__/status.test.ts +0 -235
  934. package/src/cli/commands/__tests__/sync-docs-agents.test.ts +0 -638
  935. package/src/cli/commands/__tests__/sync-docs-construction-sites.test.ts +0 -175
  936. package/src/cli/commands/__tests__/sync-docs-context-drift.test.ts +0 -232
  937. package/src/cli/commands/__tests__/sync-docs-gate.test.ts +0 -154
  938. package/src/cli/commands/__tests__/sync-docs-module-order.test.ts +0 -111
  939. package/src/cli/commands/__tests__/sync-docs-read-count.test.ts +0 -192
  940. package/src/cli/commands/__tests__/sync-docs-table-layout.test.ts +0 -259
  941. package/src/cli/commands/__tests__/sync-docs.test.ts +0 -691
  942. package/src/cli/commands/__tests__/validate.test.ts +0 -195
  943. package/src/cli/commands/acceptance.ts +0 -118
  944. package/src/cli/commands/check.ts +0 -291
  945. package/src/cli/commands/command.ts +0 -106
  946. package/src/cli/commands/constraints-disable.ts +0 -94
  947. package/src/cli/commands/constraints-pack-proposal.ts +0 -79
  948. package/src/cli/commands/constraints-reactivate.ts +0 -112
  949. package/src/cli/commands/constraints-report.ts +0 -224
  950. package/src/cli/commands/constraints-retire.ts +0 -309
  951. package/src/cli/commands/constraints.ts +0 -30
  952. package/src/cli/commands/contract.ts +0 -187
  953. package/src/cli/commands/definitions.ts +0 -346
  954. package/src/cli/commands/failure.ts +0 -137
  955. package/src/cli/commands/init/ci-platform.ts +0 -66
  956. package/src/cli/commands/init/ci-wiring.ts +0 -48
  957. package/src/cli/commands/init/git-hooks.ts +0 -31
  958. package/src/cli/commands/init/governance.ts +0 -127
  959. package/src/cli/commands/init/index.ts +0 -156
  960. package/src/cli/commands/init/output-style.ts +0 -82
  961. package/src/cli/commands/init/presets.ts +0 -105
  962. package/src/cli/commands/init/snippets.ts +0 -57
  963. package/src/cli/commands/knowledge/audit.ts +0 -155
  964. package/src/cli/commands/knowledge/decay.ts +0 -57
  965. package/src/cli/commands/knowledge/health.ts +0 -180
  966. package/src/cli/commands/knowledge/import.ts +0 -82
  967. package/src/cli/commands/knowledge/index.ts +0 -60
  968. package/src/cli/commands/knowledge/list.ts +0 -73
  969. package/src/cli/commands/knowledge/search.ts +0 -92
  970. package/src/cli/commands/knowledge/shared.ts +0 -13
  971. package/src/cli/commands/knowledge/snapshot.ts +0 -38
  972. package/src/cli/commands/knowledge/stats.ts +0 -112
  973. package/src/cli/commands/knowledge/store-access.ts +0 -40
  974. package/src/cli/commands/knowledge-view.ts +0 -182
  975. package/src/cli/commands/passes-gate.ts +0 -167
  976. package/src/cli/commands/performance.ts +0 -92
  977. package/src/cli/commands/release.ts +0 -234
  978. package/src/cli/commands/report.ts +0 -145
  979. package/src/cli/commands/review.ts +0 -134
  980. package/src/cli/commands/scaffold-templates.ts +0 -377
  981. package/src/cli/commands/scaffold.ts +0 -291
  982. package/src/cli/commands/sdd.ts +0 -46
  983. package/src/cli/commands/security.ts +0 -240
  984. package/src/cli/commands/spec/__tests__/validator.test.ts +0 -417
  985. package/src/cli/commands/spec/validator.ts +0 -353
  986. package/src/cli/commands/spec-baseline-check.ts +0 -229
  987. package/src/cli/commands/spec.ts +0 -175
  988. package/src/cli/commands/status.ts +0 -162
  989. package/src/cli/commands/sync-docs/__tests__/construction-site-count.test.ts +0 -49
  990. package/src/cli/commands/sync-docs/__tests__/context-export-surface.test.ts +0 -102
  991. package/src/cli/commands/sync-docs/__tests__/module-descriptions.test.ts +0 -196
  992. package/src/cli/commands/sync-docs/agents-syncer.ts +0 -274
  993. package/src/cli/commands/sync-docs/capabilities-syncer.ts +0 -329
  994. package/src/cli/commands/sync-docs/compact.ts +0 -36
  995. package/src/cli/commands/sync-docs/context-syncer.ts +0 -241
  996. package/src/cli/commands/sync-docs/gate.ts +0 -78
  997. package/src/cli/commands/sync-docs/head-gate.ts +0 -87
  998. package/src/cli/commands/sync-docs/index.ts +0 -52
  999. package/src/cli/commands/sync-docs/main-flow.ts +0 -109
  1000. package/src/cli/commands/sync-docs/preserve-block.ts +0 -59
  1001. package/src/cli/commands/sync-docs/project-reader.ts +0 -211
  1002. package/src/cli/commands/sync-docs/sync-output.ts +0 -218
  1003. package/src/cli/commands/sync-docs/sync-state.ts +0 -327
  1004. package/src/cli/commands/sync-docs/sync-writes.ts +0 -49
  1005. package/src/cli/commands/validate.ts +0 -117
  1006. package/src/cli/gate-command.ts +0 -87
  1007. package/src/cli/state-io.ts +0 -60
  1008. package/src/completion-checkers/CONTEXT.md +0 -25
  1009. package/src/completion-checkers/__tests__/contract-presence.test.ts +0 -44
  1010. package/src/completion-checkers/__tests__/phase-format.test.ts +0 -60
  1011. package/src/completion-checkers/__tests__/tdd-chain.test.ts +0 -99
  1012. package/src/completion-checkers/classify.ts +0 -47
  1013. package/src/completion-checkers/contract-presence.ts +0 -40
  1014. package/src/completion-checkers/glob-match.ts +0 -22
  1015. package/src/completion-checkers/index.ts +0 -28
  1016. package/src/completion-checkers/phase-format.ts +0 -48
  1017. package/src/completion-checkers/tdd-chain.ts +0 -63
  1018. package/src/completion-checkers/types.ts +0 -84
  1019. package/src/context/CONTEXT.md +0 -20
  1020. package/src/context/__tests__/session-manager.test.ts +0 -169
  1021. package/src/context/index.ts +0 -16
  1022. package/src/context/session-manager.ts +0 -185
  1023. package/src/context/types.ts +0 -35
  1024. package/src/core/CONTEXT.md +0 -43
  1025. package/src/core/__tests__/config-files.test.ts +0 -88
  1026. package/src/core/__tests__/constraint-lifecycle.test.ts +0 -255
  1027. package/src/core/__tests__/constraints-meta.test.ts +0 -26
  1028. package/src/core/__tests__/effective-set.test.ts +0 -56
  1029. package/src/core/__tests__/pack-proposal.test.ts +0 -95
  1030. package/src/core/app-constraints-loader.ts +0 -162
  1031. package/src/core/config-files.ts +0 -39
  1032. package/src/core/constraint-lifecycle.ts +0 -426
  1033. package/src/core/constraints/__tests__/capabilities-reconcile.test.ts +0 -200
  1034. package/src/core/constraints/__tests__/capability-counts.test.ts +0 -94
  1035. package/src/core/constraints/__tests__/check-cache.test.ts +0 -98
  1036. package/src/core/constraints/__tests__/collect-constraints.test.ts +0 -116
  1037. package/src/core/constraints/__tests__/construction-sites.test.ts +0 -147
  1038. package/src/core/constraints/__tests__/context-reconcile.test.ts +0 -246
  1039. package/src/core/constraints/__tests__/git-evidence.test.ts +0 -225
  1040. package/src/core/constraints/__tests__/injection-writer.test.ts +0 -178
  1041. package/src/core/constraints/__tests__/run-env.test.ts +0 -262
  1042. package/src/core/constraints/__tests__/trace-injection.test.ts +0 -76
  1043. package/src/core/constraints/__tests__/triggers.test.ts +0 -71
  1044. package/src/core/constraints/__tests__/usage-report.test.ts +0 -181
  1045. package/src/core/constraints/capabilities-parser.ts +0 -213
  1046. package/src/core/constraints/capabilities-reconcile.ts +0 -190
  1047. package/src/core/constraints/check-cache.ts +0 -102
  1048. package/src/core/constraints/checker.ts +0 -408
  1049. package/src/core/constraints/checkers/__tests__/capability-sync.test.ts +0 -292
  1050. package/src/core/constraints/checkers/__tests__/check-outcome.test.ts +0 -172
  1051. package/src/core/constraints/checkers/__tests__/context-doc-sync.test.ts +0 -90
  1052. package/src/core/constraints/checkers/__tests__/docs-freshness-degraded.test.ts +0 -91
  1053. package/src/core/constraints/checkers/__tests__/docs-freshness.test.ts +0 -129
  1054. package/src/core/constraints/checkers/__tests__/exec-checker.test.ts +0 -99
  1055. package/src/core/constraints/checkers/__tests__/fixtures/public-repo-sanitization.mjs +0 -40
  1056. package/src/core/constraints/checkers/__tests__/governance-presence.test.ts +0 -182
  1057. package/src/core/constraints/checkers/__tests__/input-contract.test.ts +0 -111
  1058. package/src/core/constraints/checkers/__tests__/no-completion-without-verification.test.ts +0 -228
  1059. package/src/core/constraints/checkers/__tests__/no-hardcoded-credentials.test.ts +0 -232
  1060. package/src/core/constraints/checkers/__tests__/no-test-simplification.test.ts +0 -182
  1061. package/src/core/constraints/checkers/__tests__/templated-checkers.test.ts +0 -181
  1062. package/src/core/constraints/checkers/__tests__/templates-registry.test.ts +0 -79
  1063. package/src/core/constraints/checkers/__tests__/three-state-consistency.test.ts +0 -158
  1064. package/src/core/constraints/checkers/capability-sync.ts +0 -134
  1065. package/src/core/constraints/checkers/context-doc-sync.ts +0 -42
  1066. package/src/core/constraints/checkers/docs-freshness.ts +0 -156
  1067. package/src/core/constraints/checkers/governance-presence.ts +0 -60
  1068. package/src/core/constraints/checkers/index.ts +0 -142
  1069. package/src/core/constraints/checkers/no-completion-without-verification.ts +0 -141
  1070. package/src/core/constraints/checkers/no-hardcoded-credentials.ts +0 -185
  1071. package/src/core/constraints/checkers/no-test-simplification.ts +0 -118
  1072. package/src/core/constraints/checkers/templated/exec.ts +0 -133
  1073. package/src/core/constraints/checkers/templated/file-exists.ts +0 -75
  1074. package/src/core/constraints/checkers/templated/glob.ts +0 -13
  1075. package/src/core/constraints/checkers/templated/index.ts +0 -13
  1076. package/src/core/constraints/checkers/templated/regex-scan.ts +0 -113
  1077. package/src/core/constraints/checkers/types.ts +0 -239
  1078. package/src/core/constraints/construction-sites.ts +0 -95
  1079. package/src/core/constraints/context-builder.ts +0 -119
  1080. package/src/core/constraints/context-reconcile.ts +0 -200
  1081. package/src/core/constraints/definitions/errors.ts +0 -69
  1082. package/src/core/constraints/definitions/warnings.ts +0 -108
  1083. package/src/core/constraints/definitions.ts +0 -59
  1084. package/src/core/constraints/doc-freshness/__tests__/runner.test.ts +0 -576
  1085. package/src/core/constraints/doc-freshness/runner.ts +0 -471
  1086. package/src/core/constraints/find-constraint.ts +0 -24
  1087. package/src/core/constraints/git-evidence.ts +0 -138
  1088. package/src/core/constraints/governance-accessors.ts +0 -74
  1089. package/src/core/constraints/index.ts +0 -52
  1090. package/src/core/constraints/injection-writer.ts +0 -164
  1091. package/src/core/constraints/meta.ts +0 -40
  1092. package/src/core/constraints/pack-proposal.ts +0 -168
  1093. package/src/core/constraints/run-env.ts +0 -151
  1094. package/src/core/constraints/triggers.ts +0 -38
  1095. package/src/core/constraints/usage-report.ts +0 -361
  1096. package/src/core/effective-constraints.ts +0 -93
  1097. package/src/core/effective-set.ts +0 -40
  1098. package/src/core/index.ts +0 -80
  1099. package/src/core/project-config-loader.ts +0 -163
  1100. package/src/core/retired-constraints.ts +0 -77
  1101. package/src/core/spec/baseline-check.ts +0 -300
  1102. package/src/core/validators/__tests__/command-success-output.test.ts +0 -56
  1103. package/src/core/validators/__tests__/http-retry-sleep.test.ts +0 -231
  1104. package/src/core/validators/__tests__/passes-gate-counts.test.ts +0 -52
  1105. package/src/core/validators/__tests__/passes-gate.test.ts +0 -70
  1106. package/src/core/validators/__tests__/test-output.test.ts +0 -372
  1107. package/src/core/validators/check-handlers/command.ts +0 -101
  1108. package/src/core/validators/check-handlers/file.ts +0 -147
  1109. package/src/core/validators/check-handlers/http.ts +0 -101
  1110. package/src/core/validators/check-handlers/output.ts +0 -166
  1111. package/src/core/validators/checkpoint.ts +0 -141
  1112. package/src/core/validators/cso.ts +0 -113
  1113. package/src/core/validators/index.ts +0 -23
  1114. package/src/core/validators/passes-gate.ts +0 -292
  1115. package/src/core/validators/test-output.ts +0 -128
  1116. package/src/failure/CONTEXT.md +0 -27
  1117. package/src/failure/__tests__/recorder.test.ts +0 -169
  1118. package/src/failure/classifier.ts +0 -116
  1119. package/src/failure/error-types.ts +0 -122
  1120. package/src/failure/index.ts +0 -37
  1121. package/src/failure/recorder.ts +0 -138
  1122. package/src/gates/CONTEXT.md +0 -47
  1123. package/src/gates/__tests__/acceptance-types-single-source.test.ts +0 -71
  1124. package/src/gates/__tests__/acceptance.test.ts +0 -498
  1125. package/src/gates/__tests__/command-single-predicate.test.ts +0 -90
  1126. package/src/gates/__tests__/command.test.ts +0 -239
  1127. package/src/gates/__tests__/contract.test.ts +0 -73
  1128. package/src/gates/__tests__/decision.test.ts +0 -35
  1129. package/src/gates/__tests__/gate-interface.test.ts +0 -180
  1130. package/src/gates/__tests__/performance.test.ts +0 -254
  1131. package/src/gates/__tests__/registry.test.ts +0 -87
  1132. package/src/gates/__tests__/review.test.ts +0 -278
  1133. package/src/gates/__tests__/security-default-scan.test.ts +0 -100
  1134. package/src/gates/__tests__/security.test.ts +0 -288
  1135. package/src/gates/__tests__/test-verdict-consistency.test.ts +0 -140
  1136. package/src/gates/acceptance.ts +0 -494
  1137. package/src/gates/command.ts +0 -414
  1138. package/src/gates/contract.ts +0 -215
  1139. package/src/gates/decision.ts +0 -27
  1140. package/src/gates/definitions.ts +0 -186
  1141. package/src/gates/performance.ts +0 -243
  1142. package/src/gates/registry.ts +0 -108
  1143. package/src/gates/review.ts +0 -196
  1144. package/src/gates/security.ts +0 -211
  1145. package/src/gates/types.ts +0 -208
  1146. package/src/index.ts +0 -368
  1147. package/src/knowledge/CONTEXT.md +0 -63
  1148. package/src/knowledge/__tests__/audit-labels.test.ts +0 -47
  1149. package/src/knowledge/__tests__/audit-scoring.test.ts +0 -232
  1150. package/src/knowledge/__tests__/audit-write-count.test.ts +0 -131
  1151. package/src/knowledge/__tests__/audit.test.ts +0 -737
  1152. package/src/knowledge/__tests__/flywheel-metrics.test.ts +0 -135
  1153. package/src/knowledge/__tests__/import.test.ts +0 -420
  1154. package/src/knowledge/__tests__/index-generator.test.ts +0 -388
  1155. package/src/knowledge/__tests__/ingest-validate-entry.test.ts +0 -235
  1156. package/src/knowledge/__tests__/ingest.test.ts +0 -529
  1157. package/src/knowledge/__tests__/lifecycle.test.ts +0 -1040
  1158. package/src/knowledge/__tests__/query.test.ts +0 -336
  1159. package/src/knowledge/__tests__/store.test.ts +0 -863
  1160. package/src/knowledge/__tests__/token-estimate.test.ts +0 -54
  1161. package/src/knowledge/__tests__/tree-walker.test.ts +0 -124
  1162. package/src/knowledge/audit-dimensions.ts +0 -190
  1163. package/src/knowledge/audit-rules.ts +0 -339
  1164. package/src/knowledge/audit-scoring.ts +0 -101
  1165. package/src/knowledge/audit.ts +0 -149
  1166. package/src/knowledge/cold-start.ts +0 -454
  1167. package/src/knowledge/flywheel-metrics.ts +0 -71
  1168. package/src/knowledge/index-generator.ts +0 -230
  1169. package/src/knowledge/index.ts +0 -40
  1170. package/src/knowledge/ingest.ts +0 -412
  1171. package/src/knowledge/lifecycle.ts +0 -457
  1172. package/src/knowledge/query.ts +0 -253
  1173. package/src/knowledge/store.ts +0 -493
  1174. package/src/knowledge/token-estimate.ts +0 -27
  1175. package/src/knowledge/tree-walker.ts +0 -29
  1176. package/src/knowledge/types.ts +0 -169
  1177. package/src/monitoring/CONTEXT.md +0 -28
  1178. package/src/monitoring/__tests__/prune-trace-logs.test.ts +0 -76
  1179. package/src/monitoring/__tests__/skipped-lines-report.test.ts +0 -165
  1180. package/src/monitoring/__tests__/trace-file-anchoring.test.ts +0 -80
  1181. package/src/monitoring/__tests__/traces.test.ts +0 -195
  1182. package/src/monitoring/analyzer-base.ts +0 -45
  1183. package/src/monitoring/index.ts +0 -10
  1184. package/src/monitoring/trace-analyzer.ts +0 -236
  1185. package/src/monitoring/traces.ts +0 -316
  1186. package/src/presets/__tests__/standard.test.ts +0 -65
  1187. package/src/presets/index.ts +0 -12
  1188. package/src/presets/standard.ts +0 -71
  1189. package/src/pretool-use-hook.ts +0 -167
  1190. package/src/release/CONTEXT.md +0 -24
  1191. package/src/release/__tests__/barrel.test.ts +0 -60
  1192. package/src/release/__tests__/integrity.test.ts +0 -162
  1193. package/src/release/index.ts +0 -2
  1194. package/src/release/integrity.ts +0 -138
  1195. package/src/sdd/__tests__/index-generator.test.ts +0 -221
  1196. package/src/sdd/index-generator.ts +0 -113
  1197. package/src/test-setup/__tests__/jsonl-fake-fs.test.ts +0 -98
  1198. package/src/test-setup/__tests__/mkdtemp-cleanup.test.ts +0 -45
  1199. package/src/test-setup/__tests__/project-fixture.test.ts +0 -178
  1200. package/src/test-setup/jsonl-fake-fs.ts +0 -59
  1201. package/src/test-setup/mkdtemp-cleanup.ts +0 -83
  1202. package/src/test-setup/project-fixture.ts +0 -87
  1203. package/src/types/__tests__/types.test.ts +0 -53
  1204. package/src/types/checkpoint.ts +0 -180
  1205. package/src/types/command-definition.ts +0 -85
  1206. package/src/types/command-io.ts +0 -14
  1207. package/src/types/constraint.ts +0 -247
  1208. package/src/types/cso.ts +0 -37
  1209. package/src/types/failure.ts +0 -67
  1210. package/src/types/gate.ts +0 -77
  1211. package/src/types/passes-gate.ts +0 -130
  1212. package/src/types/project-config.ts +0 -251
  1213. package/src/types/spec.ts +0 -87
  1214. package/src/types/trace.ts +0 -233
  1215. package/src/utils/__tests__/attempt.test.ts +0 -94
  1216. package/src/utils/__tests__/file-walk.test.ts +0 -54
  1217. package/src/utils/__tests__/frontmatter.test.ts +0 -206
  1218. package/src/utils/__tests__/glob-match.test.ts +0 -52
  1219. package/src/utils/__tests__/jsonl-bounded-read.test.ts +0 -106
  1220. package/src/utils/__tests__/jsonl-skip-disposition.test.ts +0 -174
  1221. package/src/utils/__tests__/jsonl.test.ts +0 -234
  1222. package/src/utils/__tests__/numeric-flag.test.ts +0 -80
  1223. package/src/utils/__tests__/package-json.test.ts +0 -58
  1224. package/src/utils/__tests__/package-version.test.ts +0 -116
  1225. package/src/utils/__tests__/yaml-edit.test.ts +0 -62
  1226. package/src/utils/attempt.ts +0 -35
  1227. package/src/utils/clip.ts +0 -12
  1228. package/src/utils/detect-source-roots.ts +0 -90
  1229. package/src/utils/diff-parse.ts +0 -80
  1230. package/src/utils/exec.ts +0 -16
  1231. package/src/utils/file-walk.ts +0 -103
  1232. package/src/utils/frontmatter.ts +0 -121
  1233. package/src/utils/glob-match.ts +0 -41
  1234. package/src/utils/guards.ts +0 -8
  1235. package/src/utils/jsonl.ts +0 -276
  1236. package/src/utils/log-rotate.ts +0 -43
  1237. package/src/utils/numeric-flag.ts +0 -86
  1238. package/src/utils/package-json.ts +0 -61
  1239. package/src/utils/package-version.ts +0 -25
  1240. package/src/utils/yaml-edit.ts +0 -67
@@ -1,1040 +0,0 @@
1
- /**
2
- * KnowledgeLifecycle 测试
3
- */
4
-
5
- import { describe, it, expect, beforeAll, afterAll, beforeEach } from '@jest/globals';
6
- import { FileKnowledgeStore as KnowledgeStore } from '../store';
7
- import { KnowledgeLifecycle } from '../lifecycle';
8
- import type { KnowledgeEntry } from '../types';
9
- import * as fs from 'fs';
10
- import * as path from 'path';
11
- import * as os from 'os';
12
-
13
- describe('KnowledgeLifecycle', () => {
14
- let tempDir: string;
15
- let store: KnowledgeStore;
16
- let lifecycle: KnowledgeLifecycle;
17
-
18
- const makeEntry = (overrides?: Partial<KnowledgeEntry>): KnowledgeEntry => ({
19
- id: 'DEC-001',
20
- type: 'decision',
21
- title: 'Test Decision',
22
- content: 'Content.',
23
- maturity: 'draft',
24
- layer: 'project',
25
- created: '2026-05-01T00:00:00.000Z',
26
- lastReferenced: '',
27
- contributors: [],
28
- projects: [],
29
- tags: [],
30
- applicablePhases: [],
31
- sourceReferences: [],
32
- referencedBy: [],
33
- executionResults: [],
34
- consumptionMode: 'reference',
35
- origin: 'agent',
36
- ...overrides,
37
- });
38
-
39
- beforeAll(() => {
40
- tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'temp-test-lifecycle-'));
41
- });
42
-
43
- afterAll(() => {
44
- try {
45
- fs.rmSync(tempDir, { recursive: true, force: true });
46
- } catch {
47
- // ignore
48
- }
49
- });
50
-
51
- beforeEach(() => {
52
- const files = fs.readdirSync(tempDir);
53
- for (const f of files) {
54
- fs.unlinkSync(path.join(tempDir, f));
55
- }
56
- store = new KnowledgeStore({ baseDir: tempDir });
57
- lifecycle = new KnowledgeLifecycle(store);
58
- });
59
-
60
- describe('recordReference', () => {
61
- it('should update lastReferenced', () => {
62
- store.save(makeEntry());
63
- lifecycle.recordReference('DEC-001');
64
- const entry = store.get('DEC-001');
65
- expect(entry!.lastReferenced).toBeTruthy();
66
- });
67
-
68
- it('should add contributor', () => {
69
- store.save(makeEntry());
70
- lifecycle.recordReference('DEC-001', 'alice');
71
- const entry = store.get('DEC-001');
72
- expect(entry!.contributors).toContain('alice');
73
- });
74
-
75
- it('should not duplicate contributor', () => {
76
- store.save(makeEntry({ contributors: ['alice'] }));
77
- lifecycle.recordReference('DEC-001', 'alice');
78
- const entry = store.get('DEC-001');
79
- expect(entry!.contributors).toEqual(['alice']);
80
- });
81
-
82
- it('should return undefined for non-existent entry', () => {
83
- expect(lifecycle.recordReference('NON-EXISTENT')).toBeUndefined();
84
- });
85
- });
86
-
87
- describe('recordReference with execution result', () => {
88
- it('should record success execution result', () => {
89
- store.save(makeEntry());
90
- lifecycle.recordReference('DEC-001', 'alice', true);
91
- const entry = store.get('DEC-001');
92
- expect(entry!.executionResults).toHaveLength(1);
93
- expect(entry!.executionResults[0].success).toBe(true);
94
- expect(entry!.executionResults[0].contributor).toBe('alice');
95
- });
96
-
97
- it('should record failure execution result', () => {
98
- store.save(makeEntry());
99
- lifecycle.recordReference('DEC-001', 'bob', false);
100
- const entry = store.get('DEC-001');
101
- expect(entry!.executionResults).toHaveLength(1);
102
- expect(entry!.executionResults[0].success).toBe(false);
103
- });
104
-
105
- it('should not record execution result when success is undefined', () => {
106
- store.save(makeEntry());
107
- lifecycle.recordReference('DEC-001', 'alice');
108
- const entry = store.get('DEC-001');
109
- expect(entry!.executionResults).toHaveLength(0);
110
- });
111
-
112
- it('should record execution result even on same-day dedup', () => {
113
- store.save(makeEntry());
114
- lifecycle.recordReference('DEC-001', 'alice', true);
115
- lifecycle.recordReference('DEC-001', 'alice', false); // same day, but different result
116
- const entry = store.get('DEC-001');
117
- expect(entry!.referencedBy).toHaveLength(1); // deduped
118
- expect(entry!.executionResults).toHaveLength(2); // both recorded
119
- });
120
- });
121
-
122
- describe('getExecutionSuccessRate', () => {
123
- it('should return undefined when no execution data', () => {
124
- store.save(makeEntry());
125
- expect(lifecycle.getExecutionSuccessRate('DEC-001')).toBeUndefined();
126
- });
127
-
128
- it('should compute success rate correctly', () => {
129
- store.save(makeEntry());
130
- lifecycle.recordReference('DEC-001', 'a', true);
131
- lifecycle.recordReference('DEC-001', 'b', true);
132
- lifecycle.recordReference('DEC-001', 'c', false);
133
- const rate = lifecycle.getExecutionSuccessRate('DEC-001');
134
- expect(rate).toBeDefined();
135
- expect(rate!.total).toBe(3);
136
- expect(rate!.rate).toBeCloseTo(2 / 3);
137
- });
138
-
139
- it('should return undefined for non-existent entry', () => {
140
- expect(lifecycle.getExecutionSuccessRate('NON-EXISTENT')).toBeUndefined();
141
- });
142
- });
143
-
144
- describe('getHumanSuccessRate', () => {
145
- it('should return undefined when no execution data', () => {
146
- store.save(makeEntry());
147
- expect(lifecycle.getHumanSuccessRate('DEC-001')).toBeUndefined();
148
- });
149
-
150
- it('should return undefined when no human-sourced results', () => {
151
- store.save(makeEntry());
152
- lifecycle.recordReference('DEC-001', 'auto-bot', true, 'auto');
153
- lifecycle.recordReference('DEC-001', 'auto-bot', true, 'auto');
154
- expect(lifecycle.getHumanSuccessRate('DEC-001')).toBeUndefined();
155
- });
156
-
157
- it('should compute human-only success rate', () => {
158
- store.save(makeEntry());
159
- lifecycle.recordReference('DEC-001', 'alice', true, 'human');
160
- lifecycle.recordReference('DEC-001', 'bob', true, 'human');
161
- lifecycle.recordReference('DEC-001', 'auto-bot', true, 'auto');
162
- lifecycle.recordReference('DEC-001', 'charlie', false, 'human');
163
- const rate = lifecycle.getHumanSuccessRate('DEC-001');
164
- expect(rate).toBeDefined();
165
- expect(rate!.total).toBe(3); // 3 human results
166
- expect(rate!.rate).toBeCloseTo(2 / 3); // 2 success out of 3 human
167
- });
168
-
169
- it('should return undefined for non-existent entry', () => {
170
- expect(lifecycle.getHumanSuccessRate('NON-EXISTENT')).toBeUndefined();
171
- });
172
- });
173
-
174
- describe('recordReference with source', () => {
175
- it('should store source in execution result', () => {
176
- store.save(makeEntry());
177
- lifecycle.recordReference('DEC-001', 'alice', true, 'human');
178
- const entry = store.get('DEC-001');
179
- expect(entry!.executionResults[0].source).toBe('human');
180
- });
181
-
182
- it('should default source to undefined when not provided', () => {
183
- store.save(makeEntry());
184
- lifecycle.recordReference('DEC-001', 'alice', true);
185
- const entry = store.get('DEC-001');
186
- expect(entry!.executionResults[0].source).toBeUndefined();
187
- });
188
-
189
- it('should auto-detect source for auto- prefixed contributors', () => {
190
- store.save(makeEntry());
191
- lifecycle.recordReference('DEC-001', 'auto-deploy', true);
192
- const entry = store.get('DEC-001');
193
- expect(entry!.executionResults[0].source).toBe('auto');
194
- });
195
- });
196
-
197
- describe('onReference callback', () => {
198
- it('should fire callback on recordReference()', () => {
199
- store.save(makeEntry());
200
- const events: any[] = [];
201
- lifecycle.onReference((event) => events.push(event));
202
-
203
- lifecycle.recordReference('DEC-001', 'alice');
204
-
205
- expect(events).toHaveLength(1);
206
- expect(events[0].entryId).toBe('DEC-001');
207
- expect(events[0].contributor).toBe('alice');
208
- expect(events[0].timestamp).toBeDefined();
209
- });
210
-
211
- it('should fire multiple callbacks', () => {
212
- store.save(makeEntry());
213
- const events1: any[] = [];
214
- const events2: any[] = [];
215
- lifecycle.onReference((event) => events1.push(event));
216
- lifecycle.onReference((event) => events2.push(event));
217
-
218
- lifecycle.recordReference('DEC-001', 'bob');
219
-
220
- expect(events1).toHaveLength(1);
221
- expect(events2).toHaveLength(1);
222
- });
223
-
224
- it('should not fire callback on same-day dedup', () => {
225
- store.save(makeEntry());
226
- const events: any[] = [];
227
- lifecycle.onReference((event) => events.push(event));
228
-
229
- lifecycle.recordReference('DEC-001', 'alice');
230
- lifecycle.recordReference('DEC-001', 'alice'); // same day dedup
231
-
232
- expect(events).toHaveLength(1); // only first call fires
233
- });
234
-
235
- it('should not fire callback for non-existent entry', () => {
236
- const events: any[] = [];
237
- lifecycle.onReference((event) => events.push(event));
238
-
239
- lifecycle.recordReference('NONEXISTENT', 'alice');
240
-
241
- expect(events).toHaveLength(0);
242
- });
243
- });
244
-
245
- describe('recordReference same-day dedup (B4)', () => {
246
- it('should skip file write when same contributor references on same day', () => {
247
- store.save(makeEntry());
248
- const result1 = lifecycle.recordReference('DEC-001', 'alice');
249
- expect(result1).toBeDefined();
250
- expect(result1!.referencedBy).toHaveLength(1);
251
-
252
- // Second call same day, same contributor — should return entry unchanged
253
- const result2 = lifecycle.recordReference('DEC-001', 'alice');
254
- expect(result2).toBeDefined();
255
- expect(result2!.referencedBy).toHaveLength(1); // no new refKey added
256
- expect(result2!.lastReferenced).toBe(result1!.lastReferenced); // unchanged
257
- });
258
-
259
- it('should add ref for different contributor on same day', () => {
260
- store.save(makeEntry());
261
- lifecycle.recordReference('DEC-001', 'alice');
262
- const result = lifecycle.recordReference('DEC-001', 'bob');
263
- expect(result!.referencedBy).toHaveLength(2);
264
- });
265
- });
266
-
267
- describe('referencedBy cap at 20 (B4)', () => {
268
- it('should cap referencedBy at MAX_REFERENCED_BY (20)', () => {
269
- // Pre-fill with 19 referencedBy entries
270
- const refs = Array.from({ length: 19 }, (_, i) => `user-${i}:2026-05-${String(i + 1).padStart(2, '0')}`);
271
- store.save(makeEntry({ referencedBy: refs }));
272
-
273
- // Add a new unique ref
274
- const result = lifecycle.recordReference('DEC-001', 'new-user');
275
- expect(result!.referencedBy).toHaveLength(20);
276
- expect(result!.referencedBy[19]).toMatch(/^new-user:/);
277
- });
278
-
279
- it('should drop oldest refs when exceeding cap', () => {
280
- // Pre-fill with 25 referencedBy entries
281
- const refs = Array.from({ length: 25 }, (_, i) => `user-${i}:2026-05-${String(i + 1).padStart(2, '0')}`);
282
- store.save(makeEntry({ referencedBy: refs }));
283
-
284
- // Add a new unique ref — total would be 26, should cap to 20
285
- const result = lifecycle.recordReference('DEC-001', 'brand-new');
286
- expect(result!.referencedBy).toHaveLength(20);
287
- // Should have dropped the 6 oldest (indices 0-5)
288
- expect(result!.referencedBy[0]).toBe('user-6:2026-05-07');
289
- });
290
- });
291
-
292
- describe('checkPromotion', () => {
293
- it('should promote draft to verified when referenced', () => {
294
- store.save(makeEntry({ maturity: 'draft', lastReferenced: '2026-05-01', content: 'a'.repeat(60) }));
295
- expect(lifecycle.checkPromotion('DEC-001')).toBe('verified');
296
- });
297
-
298
- it('should NOT promote draft with content < 50 chars', () => {
299
- store.save(makeEntry({ maturity: 'draft', lastReferenced: '2026-05-01', content: 'short' }));
300
- expect(lifecycle.checkPromotion('DEC-001')).toBeUndefined();
301
- });
302
-
303
- it('should promote draft with exactly 50 chars content', () => {
304
- store.save(makeEntry({ maturity: 'draft', lastReferenced: '2026-05-01', content: 'a'.repeat(50) }));
305
- expect(lifecycle.checkPromotion('DEC-001')).toBe('verified');
306
- });
307
-
308
- it('should not promote unreferenced draft', () => {
309
- store.save(makeEntry({ maturity: 'draft', lastReferenced: '' }));
310
- expect(lifecycle.checkPromotion('DEC-001')).toBeUndefined();
311
- });
312
-
313
- it('should promote verified to proven when criteria met', () => {
314
- store.save(makeEntry({
315
- maturity: 'verified',
316
- content: 'a'.repeat(100),
317
- contributors: ['a', 'b', 'c'],
318
- projects: ['p1', 'p2'],
319
- }));
320
- expect(lifecycle.checkPromotion('DEC-001')).toBe('proven');
321
- });
322
-
323
- it('should not promote verified without enough contributors', () => {
324
- store.save(makeEntry({
325
- maturity: 'verified',
326
- contributors: ['a'],
327
- projects: ['p1', 'p2'],
328
- }));
329
- expect(lifecycle.checkPromotion('DEC-001')).toBeUndefined();
330
- });
331
-
332
- it('should not promote verified without enough projects', () => {
333
- store.save(makeEntry({
334
- maturity: 'verified',
335
- contributors: ['a', 'b', 'c'],
336
- projects: ['p1'],
337
- }));
338
- expect(lifecycle.checkPromotion('DEC-001')).toBeUndefined();
339
- });
340
- });
341
-
342
- describe('checkEntryDecay', () => {
343
- it('should decay proven after 12 months', () => {
344
- const oldDate = new Date();
345
- oldDate.setMonth(oldDate.getMonth() - 13);
346
- store.save(makeEntry({
347
- maturity: 'proven',
348
- lastReferenced: oldDate.toISOString(),
349
- }));
350
- expect(lifecycle.checkEntryDecay('DEC-001')).toBe('verified');
351
- });
352
-
353
- it('should not decay proven within 12 months', () => {
354
- const recentDate = new Date();
355
- recentDate.setMonth(recentDate.getMonth() - 6);
356
- store.save(makeEntry({
357
- maturity: 'proven',
358
- lastReferenced: recentDate.toISOString(),
359
- }));
360
- expect(lifecycle.checkEntryDecay('DEC-001')).toBeUndefined();
361
- });
362
-
363
- it('should decay verified after 6 months', () => {
364
- const oldDate = new Date();
365
- oldDate.setMonth(oldDate.getMonth() - 7);
366
- store.save(makeEntry({
367
- maturity: 'verified',
368
- lastReferenced: oldDate.toISOString(),
369
- }));
370
- expect(lifecycle.checkEntryDecay('DEC-001')).toBe('draft');
371
- });
372
-
373
- it('should decay draft after 3 months', () => {
374
- const oldDate = new Date();
375
- oldDate.setMonth(oldDate.getMonth() - 4);
376
- store.save(makeEntry({
377
- maturity: 'draft',
378
- lastReferenced: oldDate.toISOString(),
379
- }));
380
- expect(lifecycle.checkEntryDecay('DEC-001')).toBe('archived');
381
- });
382
- });
383
-
384
- describe('runDecayCycle', () => {
385
- it('should apply decay to all eligible entries', () => {
386
- const oldDate = new Date();
387
- oldDate.setMonth(oldDate.getMonth() - 13);
388
- store.save(makeEntry({ id: 'DEC-001', maturity: 'proven', lastReferenced: oldDate.toISOString() }));
389
- const recentDate = new Date();
390
- recentDate.setMonth(recentDate.getMonth() - 1);
391
- // DEC-002 不应 decay:lastReferenced 必须相对当前时间(硬编码日期会随时间越过阈值,2026-08 已爆雷)
392
- store.save(makeEntry({ id: 'DEC-002', maturity: 'draft', lastReferenced: recentDate.toISOString() }));
393
-
394
- const changes = lifecycle.runDecayCycle();
395
- expect(changes).toHaveLength(1);
396
- expect(changes[0].entryId).toBe('DEC-001');
397
- expect(changes[0].from).toBe('proven');
398
- expect(changes[0].to).toBe('verified');
399
- });
400
-
401
- it('一次 cycle 的 K 条衰减只重写一次 index.json(harness#134 走 applyAll)', () => {
402
- const oldDate = new Date();
403
- oldDate.setMonth(oldDate.getMonth() - 4);
404
- for (const id of ['DEC-001', 'DEC-002', 'DEC-003']) {
405
- store.save(makeEntry({ id, maturity: 'draft', lastReferenced: oldDate.toISOString() }));
406
- }
407
-
408
- const stringifySpy = jest.spyOn(JSON, 'stringify');
409
- try {
410
- const changes = lifecycle.runDecayCycle();
411
- // 正对照:3 条真衰减,否则「1 次重写」是空跑出来的
412
- expect(changes.map(c => c.entryId)).toEqual(['DEC-001', 'DEC-002', 'DEC-003']);
413
- expect(stringifySpy).toHaveBeenCalledTimes(1);
414
- } finally {
415
- stringifySpy.mockRestore();
416
- }
417
- for (const id of ['DEC-001', 'DEC-002', 'DEC-003']) {
418
- expect(store.get(id)!.maturity).toBe('archived');
419
- }
420
- });
421
- });
422
-
423
- describe('tryPromote', () => {
424
- it('should promote eligible entry', () => {
425
- store.save(makeEntry({ maturity: 'draft', lastReferenced: '2026-05-01', content: 'a'.repeat(60) }));
426
- const change = lifecycle.tryPromote('DEC-001');
427
- expect(change).toBeDefined();
428
- expect(change!.from).toBe('draft');
429
- expect(change!.to).toBe('verified');
430
-
431
- const entry = store.get('DEC-001');
432
- expect(entry!.maturity).toBe('verified');
433
- });
434
-
435
- it('should return undefined for non-eligible entry', () => {
436
- store.save(makeEntry({ maturity: 'draft', lastReferenced: '' }));
437
- expect(lifecycle.tryPromote('DEC-001')).toBeUndefined();
438
- });
439
-
440
- it('should return undefined for non-existent entry', () => {
441
- expect(lifecycle.tryPromote('NON-EXISTENT')).toBeUndefined();
442
- });
443
- });
444
-
445
- describe('checkPromotion edge cases', () => {
446
- it('should return undefined for proven entry', () => {
447
- store.save(makeEntry({ maturity: 'proven', lastReferenced: '2026-05-01' }));
448
- expect(lifecycle.checkPromotion('DEC-001')).toBeUndefined();
449
- });
450
-
451
- it('should return undefined for archived entry', () => {
452
- store.save(makeEntry({ maturity: 'archived' }));
453
- expect(lifecycle.checkPromotion('DEC-001')).toBeUndefined();
454
- });
455
-
456
- it('should return undefined for non-existent entry', () => {
457
- expect(lifecycle.checkPromotion('NON-EXISTENT')).toBeUndefined();
458
- });
459
-
460
- // RC2: test ID exclusion
461
- it('should NOT promote draft with test-* ID', () => {
462
- store.save(makeEntry({ id: 'test-search-123', maturity: 'draft', lastReferenced: '2026-05-01', content: 'a'.repeat(60) }));
463
- expect(lifecycle.checkPromotion('test-search-123')).toBeUndefined();
464
- });
465
-
466
- it('should NOT promote draft with inj-test-* ID', () => {
467
- store.save(makeEntry({ id: 'inj-test-123', maturity: 'draft', lastReferenced: '2026-05-01', content: 'a'.repeat(60) }));
468
- expect(lifecycle.checkPromotion('inj-test-123')).toBeUndefined();
469
- });
470
-
471
- // RC2: verified→proven content quality gate
472
- it('should NOT promote verified to proven with content < 100 chars', () => {
473
- store.save(makeEntry({
474
- maturity: 'verified',
475
- content: 'short content',
476
- contributors: ['a', 'b', 'c'],
477
- projects: ['p1', 'p2'],
478
- }));
479
- expect(lifecycle.checkPromotion('DEC-001')).toBeUndefined();
480
- });
481
-
482
- it('should promote verified to proven with content >= 100 chars', () => {
483
- store.save(makeEntry({
484
- maturity: 'verified',
485
- content: 'a'.repeat(100),
486
- contributors: ['a', 'b', 'c'],
487
- projects: ['p1', 'p2'],
488
- }));
489
- expect(lifecycle.checkPromotion('DEC-001')).toBe('proven');
490
- });
491
-
492
- it('should NOT promote verified via Path B with content < 100 chars', () => {
493
- store.save(makeEntry({
494
- maturity: 'verified',
495
- content: 'short',
496
- referencedBy: ['a:2026-05-01', 'b:2026-05-02', 'c:2026-05-03'],
497
- sourceReferences: [
498
- { workflow: 'pattern:monitor', timestamp: '2026-05-01' },
499
- { workflow: 'pattern:triage', timestamp: '2026-05-02' },
500
- ],
501
- }));
502
- expect(lifecycle.checkPromotion('DEC-001')).toBeUndefined();
503
- });
504
-
505
- // Path C: execution success rate promotion
506
- it('should promote verified to proven via execution success rate >= 80%', () => {
507
- store.save(makeEntry({
508
- maturity: 'verified',
509
- content: 'a'.repeat(100),
510
- executionResults: [
511
- { contributor: 'a', success: true, timestamp: '2026-05-01' },
512
- { contributor: 'b', success: true, timestamp: '2026-05-02' },
513
- { contributor: 'c', success: true, timestamp: '2026-05-03' },
514
- { contributor: 'd', success: true, timestamp: '2026-05-04' },
515
- ],
516
- }));
517
- expect(lifecycle.checkPromotion('DEC-001')).toBe('proven'); // 4/4 = 100%
518
- });
519
-
520
- it('should promote verified to proven with exactly 80% success rate', () => {
521
- store.save(makeEntry({
522
- maturity: 'verified',
523
- content: 'a'.repeat(100),
524
- executionResults: [
525
- { contributor: 'a', success: true, timestamp: '2026-05-01' },
526
- { contributor: 'b', success: true, timestamp: '2026-05-02' },
527
- { contributor: 'c', success: true, timestamp: '2026-05-03' },
528
- { contributor: 'd', success: true, timestamp: '2026-05-04' },
529
- { contributor: 'e', success: false, timestamp: '2026-05-05' },
530
- ],
531
- }));
532
- expect(lifecycle.checkPromotion('DEC-001')).toBe('proven'); // 4/5 = 80%
533
- });
534
-
535
- it('should NOT promote verified with execution success rate just below 80%', () => {
536
- store.save(makeEntry({
537
- maturity: 'verified',
538
- content: 'a'.repeat(100),
539
- executionResults: [
540
- { contributor: 'a', success: true, timestamp: '2026-05-01' },
541
- { contributor: 'b', success: true, timestamp: '2026-05-02' },
542
- { contributor: 'c', success: true, timestamp: '2026-05-03' },
543
- { contributor: 'd', success: false, timestamp: '2026-05-04' },
544
- ],
545
- }));
546
- expect(lifecycle.checkPromotion('DEC-001')).toBeUndefined(); // 3/4 = 75%
547
- });
548
-
549
- it('should NOT promote verified with execution success rate < 80%', () => {
550
- store.save(makeEntry({
551
- maturity: 'verified',
552
- content: 'a'.repeat(100),
553
- executionResults: [
554
- { contributor: 'a', success: true, timestamp: '2026-05-01' },
555
- { contributor: 'b', success: false, timestamp: '2026-05-02' },
556
- { contributor: 'c', success: false, timestamp: '2026-05-03' },
557
- ],
558
- }));
559
- expect(lifecycle.checkPromotion('DEC-001')).toBeUndefined(); // 1/3 = 33%
560
- });
561
-
562
- it('should NOT promote verified with < 3 execution results', () => {
563
- store.save(makeEntry({
564
- maturity: 'verified',
565
- content: 'a'.repeat(100),
566
- executionResults: [
567
- { contributor: 'a', success: true, timestamp: '2026-05-01' },
568
- { contributor: 'b', success: true, timestamp: '2026-05-02' },
569
- ],
570
- }));
571
- expect(lifecycle.checkPromotion('DEC-001')).toBeUndefined(); // only 2 results
572
- });
573
-
574
- it('should NOT promote verified via Path C with content < 100 chars', () => {
575
- store.save(makeEntry({
576
- maturity: 'verified',
577
- content: 'short',
578
- executionResults: [
579
- { contributor: 'a', success: true, timestamp: '2026-05-01' },
580
- { contributor: 'b', success: true, timestamp: '2026-05-02' },
581
- { contributor: 'c', success: true, timestamp: '2026-05-03' },
582
- ],
583
- }));
584
- expect(lifecycle.checkPromotion('DEC-001')).toBeUndefined(); // content gate blocks
585
- });
586
-
587
- // Path C: human source preference
588
- it('should promote verified via human success rate when mixed with auto', () => {
589
- store.save(makeEntry({
590
- maturity: 'verified',
591
- content: 'a'.repeat(100),
592
- executionResults: [
593
- { contributor: 'alice', success: true, timestamp: '2026-05-01', source: 'human' },
594
- { contributor: 'bob', success: true, timestamp: '2026-05-02', source: 'human' },
595
- { contributor: 'charlie', success: true, timestamp: '2026-05-03', source: 'human' },
596
- { contributor: 'auto-bot', success: false, timestamp: '2026-05-04', source: 'auto' },
597
- ],
598
- }));
599
- // Human rate: 3/3 = 100%, auto fails but human succeeds → promote
600
- expect(lifecycle.checkPromotion('DEC-001')).toBe('proven');
601
- });
602
-
603
- it('should NOT promote when human rate < 80% even if overall rate >= 80%', () => {
604
- store.save(makeEntry({
605
- maturity: 'verified',
606
- content: 'a'.repeat(100),
607
- executionResults: [
608
- { contributor: 'alice', success: false, timestamp: '2026-05-01', source: 'human' },
609
- { contributor: 'bob', success: false, timestamp: '2026-05-02', source: 'human' },
610
- { contributor: 'charlie', success: true, timestamp: '2026-05-03', source: 'human' },
611
- { contributor: 'auto-1', success: true, timestamp: '2026-05-04', source: 'auto' },
612
- { contributor: 'auto-2', success: true, timestamp: '2026-05-05', source: 'auto' },
613
- { contributor: 'auto-3', success: true, timestamp: '2026-05-06', source: 'auto' },
614
- ],
615
- }));
616
- // Human rate: 1/3 = 33%, overall: 4/6 = 67% — neither meets threshold
617
- expect(lifecycle.checkPromotion('DEC-001')).toBeUndefined();
618
- });
619
-
620
- it('should fall back to overall rate when no human results', () => {
621
- store.save(makeEntry({
622
- maturity: 'verified',
623
- content: 'a'.repeat(100),
624
- executionResults: [
625
- { contributor: 'auto-1', success: true, timestamp: '2026-05-01', source: 'auto' },
626
- { contributor: 'auto-2', success: true, timestamp: '2026-05-02', source: 'auto' },
627
- { contributor: 'auto-3', success: true, timestamp: '2026-05-03', source: 'auto' },
628
- { contributor: 'auto-4', success: true, timestamp: '2026-05-04', source: 'auto' },
629
- ],
630
- }));
631
- // No human results → fall back to overall: 4/4 = 100%
632
- expect(lifecycle.checkPromotion('DEC-001')).toBe('proven');
633
- });
634
- });
635
-
636
- describe('checkEntryDecay edge cases', () => {
637
- it('should not decay verified within threshold', () => {
638
- const recentDate = new Date();
639
- recentDate.setMonth(recentDate.getMonth() - 3);
640
- store.save(makeEntry({
641
- maturity: 'verified',
642
- lastReferenced: recentDate.toISOString(),
643
- }));
644
- expect(lifecycle.checkEntryDecay('DEC-001')).toBeUndefined();
645
- });
646
-
647
- it('should return undefined for archived entry', () => {
648
- store.save(makeEntry({ maturity: 'archived' }));
649
- expect(lifecycle.checkEntryDecay('DEC-001')).toBeUndefined();
650
- });
651
-
652
- it('should return undefined for non-existent entry', () => {
653
- expect(lifecycle.checkEntryDecay('NON-EXISTENT')).toBeUndefined();
654
- });
655
-
656
- it('should use created date when lastReferenced is empty', () => {
657
- const oldDate = new Date();
658
- oldDate.setMonth(oldDate.getMonth() - 13);
659
- store.save(makeEntry({
660
- maturity: 'proven',
661
- lastReferenced: '',
662
- created: oldDate.toISOString(),
663
- }));
664
- expect(lifecycle.checkEntryDecay('DEC-001')).toBe('verified');
665
- });
666
- });
667
-
668
- // ── decayAt hard expiry ────────────────────────────────────
669
-
670
- describe('decayAt hard expiry', () => {
671
- it('should archive entry when decayAt is in the past', () => {
672
- store.save(makeEntry({
673
- maturity: 'proven',
674
- decayAt: '2026-01-01T00:00:00.000Z',
675
- }));
676
- expect(lifecycle.checkEntryDecay('DEC-001')).toBe('archived');
677
- });
678
-
679
- it('should NOT archive entry when decayAt is in the future', () => {
680
- const future = new Date();
681
- future.setFullYear(future.getFullYear() + 1);
682
- store.save(makeEntry({
683
- maturity: 'proven',
684
- decayAt: future.toISOString(),
685
- lastReferenced: new Date().toISOString(),
686
- }));
687
- expect(lifecycle.checkEntryDecay('DEC-001')).toBeUndefined();
688
- });
689
-
690
- it('should take precedence over mode-specific decay', () => {
691
- // proven entry with decayAt in the past should go straight to archived
692
- // even though proven→verified takes 12 months normally
693
- store.save(makeEntry({
694
- maturity: 'proven',
695
- decayAt: '2026-01-01T00:00:00.000Z',
696
- lastReferenced: new Date().toISOString(), // recent
697
- }));
698
- expect(lifecycle.checkEntryDecay('DEC-001')).toBe('archived');
699
- });
700
- });
701
-
702
- // ── rule lifecycle ─────────────────────────────────────────
703
-
704
- describe('rule lifecycle', () => {
705
- it('should promote draft→active with 1 success execution', () => {
706
- store.save(makeEntry({
707
- id: 'RULE-001',
708
- consumptionMode: 'rule',
709
- maturity: 'draft',
710
- content: 'API port must be 13101',
711
- executionResults: [
712
- { contributor: 'alice', success: true, timestamp: '2026-05-01T00:00:00.000Z', source: 'human' },
713
- ],
714
- }));
715
- expect(lifecycle.checkPromotion('RULE-001')).toBe('active');
716
- });
717
-
718
- it('should NOT promote draft→active with 0 executions', () => {
719
- store.save(makeEntry({
720
- id: 'RULE-001',
721
- consumptionMode: 'rule',
722
- maturity: 'draft',
723
- content: 'API port must be 13101',
724
- executionResults: [],
725
- }));
726
- expect(lifecycle.checkPromotion('RULE-001')).toBeUndefined();
727
- });
728
-
729
- it('should NOT promote draft→active with failure execution', () => {
730
- store.save(makeEntry({
731
- id: 'RULE-001',
732
- consumptionMode: 'rule',
733
- maturity: 'draft',
734
- content: 'API port must be 13101',
735
- executionResults: [
736
- { contributor: 'alice', success: false, timestamp: '2026-05-01T00:00:00.000Z', source: 'human' },
737
- ],
738
- }));
739
- expect(lifecycle.checkPromotion('RULE-001')).toBeUndefined();
740
- });
741
-
742
- it('should decay active→deprecated when fail rate >= 50% with 3+ results', () => {
743
- store.save(makeEntry({
744
- id: 'RULE-001',
745
- consumptionMode: 'rule',
746
- maturity: 'active',
747
- content: 'API port must be 13101',
748
- executionResults: [
749
- { contributor: 'alice', success: false, timestamp: '2026-05-01T00:00:00.000Z' },
750
- { contributor: 'bob', success: false, timestamp: '2026-05-02T00:00:00.000Z' },
751
- { contributor: 'charlie', success: true, timestamp: '2026-05-03T00:00:00.000Z' },
752
- ],
753
- }));
754
- expect(lifecycle.checkEntryDecay('RULE-001')).toBe('deprecated');
755
- });
756
-
757
- it('边界钉:成功率恰 0.5(失败率恰 50%)即降级(harness#161 修边界差一)', () => {
758
- store.save(makeEntry({
759
- id: 'RULE-001',
760
- consumptionMode: 'rule',
761
- maturity: 'active',
762
- content: 'API port must be 13101',
763
- executionResults: [
764
- { contributor: 'alice', success: true, timestamp: '2026-05-01T00:00:00.000Z' },
765
- { contributor: 'bob', success: false, timestamp: '2026-05-02T00:00:00.000Z' },
766
- { contributor: 'charlie', success: true, timestamp: '2026-05-03T00:00:00.000Z' },
767
- { contributor: 'dave', success: false, timestamp: '2026-05-04T00:00:00.000Z' },
768
- ],
769
- }));
770
- expect(lifecycle.checkEntryDecay('RULE-001')).toBe('deprecated');
771
- });
772
-
773
- it('成功率略高于 0.5(3 成 2 败)不降级', () => {
774
- store.save(makeEntry({
775
- id: 'RULE-001',
776
- consumptionMode: 'rule',
777
- maturity: 'active',
778
- content: 'API port must be 13101',
779
- executionResults: [
780
- { contributor: 'alice', success: true, timestamp: '2026-05-01T00:00:00.000Z' },
781
- { contributor: 'bob', success: true, timestamp: '2026-05-02T00:00:00.000Z' },
782
- { contributor: 'charlie', success: true, timestamp: '2026-05-03T00:00:00.000Z' },
783
- { contributor: 'dave', success: false, timestamp: '2026-05-04T00:00:00.000Z' },
784
- { contributor: 'erin', success: false, timestamp: '2026-05-05T00:00:00.000Z' },
785
- ],
786
- }));
787
- expect(lifecycle.checkEntryDecay('RULE-001')).toBeUndefined();
788
- });
789
-
790
- it('should NOT decay active→deprecated when fail rate < 50%', () => {
791
- store.save(makeEntry({
792
- id: 'RULE-001',
793
- consumptionMode: 'rule',
794
- maturity: 'active',
795
- content: 'API port must be 13101',
796
- executionResults: [
797
- { contributor: 'alice', success: true, timestamp: '2026-05-01T00:00:00.000Z' },
798
- { contributor: 'bob', success: true, timestamp: '2026-05-02T00:00:00.000Z' },
799
- { contributor: 'charlie', success: false, timestamp: '2026-05-03T00:00:00.000Z' },
800
- ],
801
- }));
802
- expect(lifecycle.checkEntryDecay('RULE-001')).toBeUndefined();
803
- });
804
-
805
- it('should NOT decay active with < 3 results', () => {
806
- store.save(makeEntry({
807
- id: 'RULE-001',
808
- consumptionMode: 'rule',
809
- maturity: 'active',
810
- content: 'API port must be 13101',
811
- executionResults: [
812
- { contributor: 'alice', success: false, timestamp: '2026-05-01T00:00:00.000Z' },
813
- ],
814
- }));
815
- expect(lifecycle.checkEntryDecay('RULE-001')).toBeUndefined();
816
- });
817
-
818
- it('should NOT promote or decay deprecated', () => {
819
- store.save(makeEntry({
820
- id: 'RULE-001',
821
- consumptionMode: 'rule',
822
- maturity: 'deprecated',
823
- content: 'Old rule',
824
- }));
825
- expect(lifecycle.checkPromotion('RULE-001')).toBeUndefined();
826
- expect(lifecycle.checkEntryDecay('RULE-001')).toBeUndefined();
827
- });
828
- });
829
-
830
- // ── context lifecycle ──────────────────────────────────────
831
-
832
- describe('context lifecycle', () => {
833
- it('should promote draft→active with 1 reference', () => {
834
- store.save(makeEntry({
835
- id: 'CTX-001',
836
- consumptionMode: 'context',
837
- maturity: 'draft',
838
- content: 'Project uses TypeScript 5.0',
839
- referencedBy: ['user:2026-05-01'],
840
- }));
841
- expect(lifecycle.checkPromotion('CTX-001')).toBe('active');
842
- });
843
-
844
- it('should NOT promote draft→active with 0 references', () => {
845
- store.save(makeEntry({
846
- id: 'CTX-001',
847
- consumptionMode: 'context',
848
- maturity: 'draft',
849
- content: 'Project uses TypeScript 5.0',
850
- referencedBy: [],
851
- }));
852
- expect(lifecycle.checkPromotion('CTX-001')).toBeUndefined();
853
- });
854
-
855
- it('should decay active→archived after 3 months unreferenced', () => {
856
- const oldDate = new Date();
857
- oldDate.setMonth(oldDate.getMonth() - 4);
858
- store.save(makeEntry({
859
- id: 'CTX-001',
860
- consumptionMode: 'context',
861
- maturity: 'active',
862
- content: 'Project uses TypeScript 5.0',
863
- lastReferenced: oldDate.toISOString(),
864
- }));
865
- expect(lifecycle.checkEntryDecay('CTX-001')).toBe('archived');
866
- });
867
-
868
- it('should NOT decay active when recently referenced', () => {
869
- store.save(makeEntry({
870
- id: 'CTX-001',
871
- consumptionMode: 'context',
872
- maturity: 'active',
873
- content: 'Project uses TypeScript 5.0',
874
- lastReferenced: new Date().toISOString(),
875
- }));
876
- expect(lifecycle.checkEntryDecay('CTX-001')).toBeUndefined();
877
- });
878
-
879
- it('should NOT promote active or archived', () => {
880
- store.save(makeEntry({
881
- id: 'CTX-001',
882
- consumptionMode: 'context',
883
- maturity: 'active',
884
- content: 'Project uses TypeScript 5.0',
885
- }));
886
- expect(lifecycle.checkPromotion('CTX-001')).toBeUndefined();
887
- });
888
- });
889
-
890
- // ── signal lifecycle ───────────────────────────────────────
891
-
892
- describe('signal lifecycle', () => {
893
- it('should NOT promote signal entries', () => {
894
- store.save(makeEntry({
895
- id: 'SIG-001',
896
- consumptionMode: 'signal',
897
- maturity: 'active',
898
- content: 'CPU usage spike detected',
899
- tags: ['monitoring'],
900
- }));
901
- expect(lifecycle.checkPromotion('SIG-001')).toBeUndefined();
902
- });
903
-
904
- it('should archive saturated signal with newer same-tag entry', () => {
905
- store.save(makeEntry({
906
- id: 'SIG-001',
907
- consumptionMode: 'signal',
908
- maturity: 'active',
909
- content: 'Old monitoring alert',
910
- tags: ['monitoring'],
911
- created: '2026-05-01T00:00:00.000Z',
912
- referencedBy: ['a:2026-05-01', 'b:2026-05-02', 'c:2026-05-03'],
913
- }));
914
- store.save(makeEntry({
915
- id: 'SIG-002',
916
- consumptionMode: 'signal',
917
- maturity: 'active',
918
- content: 'New monitoring alert',
919
- tags: ['monitoring'],
920
- created: '2026-05-10T00:00:00.000Z',
921
- }));
922
- expect(lifecycle.checkEntryDecay('SIG-001')).toBe('archived');
923
- });
924
-
925
- it('should NOT archive saturated signal without newer same-tag entry', () => {
926
- store.save(makeEntry({
927
- id: 'SIG-001',
928
- consumptionMode: 'signal',
929
- maturity: 'active',
930
- content: 'Latest monitoring alert',
931
- tags: ['monitoring'],
932
- created: '2026-05-10T00:00:00.000Z',
933
- referencedBy: ['a:2026-05-01', 'b:2026-05-02', 'c:2026-05-03'],
934
- }));
935
- expect(lifecycle.checkEntryDecay('SIG-001')).toBeUndefined();
936
- });
937
-
938
- it('should NOT archive unsaturated signal even with newer entry', () => {
939
- store.save(makeEntry({
940
- id: 'SIG-001',
941
- consumptionMode: 'signal',
942
- maturity: 'active',
943
- content: 'Old monitoring alert',
944
- tags: ['monitoring'],
945
- created: '2026-05-01T00:00:00.000Z',
946
- referencedBy: ['a:2026-05-01'], // only 1 reference, not saturated
947
- }));
948
- store.save(makeEntry({
949
- id: 'SIG-002',
950
- consumptionMode: 'signal',
951
- maturity: 'active',
952
- content: 'New monitoring alert',
953
- tags: ['monitoring'],
954
- created: '2026-05-10T00:00:00.000Z',
955
- }));
956
- expect(lifecycle.checkEntryDecay('SIG-001')).toBeUndefined();
957
- });
958
- });
959
-
960
- describe('checkConstraintCandidate(块 3 子项 6,ADR-0033)', () => {
961
- /** 达标基线:proven + 5 条引用 + 3 个不同来源会话 */
962
- const eligible = (overrides?: Partial<KnowledgeEntry>): KnowledgeEntry => makeEntry({
963
- maturity: 'proven',
964
- referencedBy: ['a:2026-05-01', 'b:2026-05-02', 'c:2026-05-03', 'a:2026-05-04', 'b:2026-05-05'],
965
- contributors: ['a', 'b', 'c'],
966
- ...overrides,
967
- });
968
-
969
- it('达标:打 constraintCandidate 标 + 触发 constraintCandidate:marked 事件,返回 true', () => {
970
- const events: Array<{ entryId: string; context?: string }> = [];
971
- lifecycle.onReference(e => events.push({ entryId: e.entryId, context: e.context }));
972
- store.save(eligible());
973
-
974
- expect(lifecycle.checkConstraintCandidate('DEC-001')).toBe(true);
975
- expect(store.get('DEC-001')!.tags).toContain('constraintCandidate');
976
- expect(events).toEqual([{ entryId: 'DEC-001', context: 'constraintCandidate:marked' }]);
977
- });
978
-
979
- it('不达标不打标:非 proven / 引用不足 5 / 来源会话不足 3', () => {
980
- store.save(eligible({ id: 'E-1', maturity: 'verified' }));
981
- store.save(eligible({ id: 'E-2', referencedBy: ['a:2026-05-01', 'b:2026-05-02', 'c:2026-05-03', 'a:2026-05-04'] }));
982
- store.save(eligible({ id: 'E-3', contributors: ['a', 'b'] }));
983
-
984
- for (const id of ['E-1', 'E-2', 'E-3']) {
985
- expect(lifecycle.checkConstraintCandidate(id)).toBe(false);
986
- expect(store.get(id)!.tags).not.toContain('constraintCandidate');
987
- }
988
- });
989
-
990
- it('幂等:已打标不重复打、不重复触发事件', () => {
991
- const events: string[] = [];
992
- lifecycle.onReference(e => { if (e.context) events.push(e.context); });
993
- store.save(eligible({ tags: ['constraintCandidate'] }));
994
-
995
- expect(lifecycle.checkConstraintCandidate('DEC-001')).toBe(false);
996
- expect(store.get('DEC-001')!.tags.filter(t => t === 'constraintCandidate')).toHaveLength(1);
997
- expect(events).toEqual([]);
998
- });
999
-
1000
- it('不存在的条目返回 false', () => {
1001
- expect(lifecycle.checkConstraintCandidate('NON-EXISTENT')).toBe(false);
1002
- });
1003
-
1004
- it('与 skillCandidate 互不干扰:达标条目可同时挂两标', () => {
1005
- store.save(eligible({
1006
- content: 'a'.repeat(200),
1007
- executionResults: [
1008
- { contributor: 'a', success: true, timestamp: '2026-05-01' },
1009
- { contributor: 'b', success: true, timestamp: '2026-05-02' },
1010
- { contributor: 'c', success: true, timestamp: '2026-05-03' },
1011
- { contributor: 'a', success: true, timestamp: '2026-05-04' },
1012
- { contributor: 'b', success: true, timestamp: '2026-05-05' },
1013
- ],
1014
- }));
1015
-
1016
- expect(lifecycle.checkSkillCandidate('DEC-001')).toBe(true);
1017
- expect(lifecycle.checkConstraintCandidate('DEC-001')).toBe(true);
1018
- const tags = store.get('DEC-001')!.tags;
1019
- expect(tags).toContain('skillCandidate');
1020
- expect(tags).toContain('constraintCandidate');
1021
- });
1022
-
1023
- it('tryPromote 升到 proven 后自动触发判定(与 checkSkillCandidate 同位)', () => {
1024
- const events: string[] = [];
1025
- lifecycle.onReference(e => { if (e.context) events.push(e.context); });
1026
- store.save(makeEntry({
1027
- maturity: 'verified',
1028
- content: 'a'.repeat(100),
1029
- contributors: ['a', 'b', 'c'],
1030
- projects: ['p1', 'p2'],
1031
- referencedBy: ['a:2026-05-01', 'b:2026-05-02', 'c:2026-05-03', 'a:2026-05-04', 'b:2026-05-05'],
1032
- }));
1033
-
1034
- const change = lifecycle.tryPromote('DEC-001');
1035
- expect(change?.to).toBe('proven');
1036
- expect(store.get('DEC-001')!.tags).toContain('constraintCandidate');
1037
- expect(events).toContain('constraintCandidate:marked');
1038
- });
1039
- });
1040
- });