@memnexus-ai/mx-agent-cli 0.1.296 → 0.1.298

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 (797) hide show
  1. package/dist/agent-config/hooks/gh-pr-edit-guard.sh +21 -9
  2. package/dist/agent-config/settings.json +7 -1
  3. package/dist/commands/check.d.ts +20 -0
  4. package/dist/commands/check.d.ts.map +1 -0
  5. package/dist/commands/check.js +30 -0
  6. package/dist/commands/check.js.map +1 -0
  7. package/dist/commands/create.d.ts +36 -0
  8. package/dist/commands/create.d.ts.map +1 -1
  9. package/dist/commands/create.js +85 -8
  10. package/dist/commands/create.js.map +1 -1
  11. package/dist/commands/gh.d.ts +38 -0
  12. package/dist/commands/gh.d.ts.map +1 -0
  13. package/dist/commands/gh.js +162 -0
  14. package/dist/commands/gh.js.map +1 -0
  15. package/dist/commands/git-credential.d.ts +22 -0
  16. package/dist/commands/git-credential.d.ts.map +1 -0
  17. package/dist/commands/git-credential.js +53 -0
  18. package/dist/commands/git-credential.js.map +1 -0
  19. package/dist/commands/new.d.ts +24 -0
  20. package/dist/commands/new.d.ts.map +1 -1
  21. package/dist/commands/new.js +56 -5
  22. package/dist/commands/new.js.map +1 -1
  23. package/dist/commands/pr-set-body.d.ts +120 -35
  24. package/dist/commands/pr-set-body.d.ts.map +1 -1
  25. package/dist/commands/pr-set-body.js +343 -108
  26. package/dist/commands/pr-set-body.js.map +1 -1
  27. package/dist/commands/pr-sync.d.ts +2 -1
  28. package/dist/commands/pr-sync.d.ts.map +1 -1
  29. package/dist/commands/pr-sync.js +129 -32
  30. package/dist/commands/pr-sync.js.map +1 -1
  31. package/dist/index.d.ts +3 -0
  32. package/dist/index.d.ts.map +1 -1
  33. package/dist/index.js +82 -2
  34. package/dist/index.js.map +1 -1
  35. package/dist/lib/check-run.d.ts +131 -0
  36. package/dist/lib/check-run.d.ts.map +1 -0
  37. package/dist/lib/check-run.js +291 -0
  38. package/dist/lib/check-run.js.map +1 -0
  39. package/dist/lib/coordination-token.d.ts +33 -1
  40. package/dist/lib/coordination-token.d.ts.map +1 -1
  41. package/dist/lib/coordination-token.js +138 -9
  42. package/dist/lib/coordination-token.js.map +1 -1
  43. package/dist/lib/gh-remote.d.ts +20 -0
  44. package/dist/lib/gh-remote.d.ts.map +1 -1
  45. package/dist/lib/gh-remote.js +26 -0
  46. package/dist/lib/gh-remote.js.map +1 -1
  47. package/dist/lib/gh-token-run.d.ts +551 -0
  48. package/dist/lib/gh-token-run.d.ts.map +1 -0
  49. package/dist/lib/gh-token-run.js +1246 -0
  50. package/dist/lib/gh-token-run.js.map +1 -0
  51. package/dist/lib/git-credential.d.ts +120 -0
  52. package/dist/lib/git-credential.d.ts.map +1 -0
  53. package/dist/lib/git-credential.js +204 -0
  54. package/dist/lib/git-credential.js.map +1 -0
  55. package/dist/lib/github-app-token.d.ts +288 -0
  56. package/dist/lib/github-app-token.d.ts.map +1 -0
  57. package/dist/lib/github-app-token.js +519 -0
  58. package/dist/lib/github-app-token.js.map +1 -0
  59. package/dist/lib/memory.d.ts.map +1 -1
  60. package/dist/lib/memory.js +35 -2
  61. package/dist/lib/memory.js.map +1 -1
  62. package/dist/lib/repo-guard-state-dirs.d.ts +39 -0
  63. package/dist/lib/repo-guard-state-dirs.d.ts.map +1 -0
  64. package/dist/lib/repo-guard-state-dirs.js +170 -0
  65. package/dist/lib/repo-guard-state-dirs.js.map +1 -0
  66. package/dist/standards/decision-request.md +6 -57
  67. package/dist/standards/po-communication-standard.md +0 -34
  68. package/dist/standards/report-format.md +0 -90
  69. package/dist/standards/writing-standard.md +0 -312
  70. package/package.json +3 -1
  71. package/dist/__tests__/agent-attribution.test.d.ts +0 -16
  72. package/dist/__tests__/agent-attribution.test.d.ts.map +0 -1
  73. package/dist/__tests__/agent-attribution.test.js +0 -250
  74. package/dist/__tests__/agent-attribution.test.js.map +0 -1
  75. package/dist/__tests__/agents-md-canonicalization.test.d.ts +0 -23
  76. package/dist/__tests__/agents-md-canonicalization.test.d.ts.map +0 -1
  77. package/dist/__tests__/agents-md-canonicalization.test.js +0 -319
  78. package/dist/__tests__/agents-md-canonicalization.test.js.map +0 -1
  79. package/dist/__tests__/behavioral-compliance.test.d.ts +0 -8
  80. package/dist/__tests__/behavioral-compliance.test.d.ts.map +0 -1
  81. package/dist/__tests__/behavioral-compliance.test.js +0 -226
  82. package/dist/__tests__/behavioral-compliance.test.js.map +0 -1
  83. package/dist/__tests__/behavioral-extraction.test.d.ts +0 -12
  84. package/dist/__tests__/behavioral-extraction.test.d.ts.map +0 -1
  85. package/dist/__tests__/behavioral-extraction.test.js +0 -330
  86. package/dist/__tests__/behavioral-extraction.test.js.map +0 -1
  87. package/dist/__tests__/behavioral-git-read.test.d.ts +0 -21
  88. package/dist/__tests__/behavioral-git-read.test.d.ts.map +0 -1
  89. package/dist/__tests__/behavioral-git-read.test.js +0 -955
  90. package/dist/__tests__/behavioral-git-read.test.js.map +0 -1
  91. package/dist/__tests__/behavioral-injection.test.d.ts +0 -13
  92. package/dist/__tests__/behavioral-injection.test.d.ts.map +0 -1
  93. package/dist/__tests__/behavioral-injection.test.js +0 -384
  94. package/dist/__tests__/behavioral-injection.test.js.map +0 -1
  95. package/dist/__tests__/binary-smoke.test.d.ts +0 -12
  96. package/dist/__tests__/binary-smoke.test.d.ts.map +0 -1
  97. package/dist/__tests__/binary-smoke.test.js +0 -88
  98. package/dist/__tests__/binary-smoke.test.js.map +0 -1
  99. package/dist/__tests__/bootstrap-behavioral-contract.test.d.ts +0 -18
  100. package/dist/__tests__/bootstrap-behavioral-contract.test.d.ts.map +0 -1
  101. package/dist/__tests__/bootstrap-behavioral-contract.test.js +0 -104
  102. package/dist/__tests__/bootstrap-behavioral-contract.test.js.map +0 -1
  103. package/dist/__tests__/bundle-config.test.d.ts +0 -18
  104. package/dist/__tests__/bundle-config.test.d.ts.map +0 -1
  105. package/dist/__tests__/bundle-config.test.js +0 -123
  106. package/dist/__tests__/bundle-config.test.js.map +0 -1
  107. package/dist/__tests__/catalog-interaction.test.d.ts +0 -25
  108. package/dist/__tests__/catalog-interaction.test.d.ts.map +0 -1
  109. package/dist/__tests__/catalog-interaction.test.js +0 -269
  110. package/dist/__tests__/catalog-interaction.test.js.map +0 -1
  111. package/dist/__tests__/catalog-named-memories.test.d.ts +0 -2
  112. package/dist/__tests__/catalog-named-memories.test.d.ts.map +0 -1
  113. package/dist/__tests__/catalog-named-memories.test.js +0 -204
  114. package/dist/__tests__/catalog-named-memories.test.js.map +0 -1
  115. package/dist/__tests__/catalog-origin-main.test.d.ts +0 -15
  116. package/dist/__tests__/catalog-origin-main.test.d.ts.map +0 -1
  117. package/dist/__tests__/catalog-origin-main.test.js +0 -305
  118. package/dist/__tests__/catalog-origin-main.test.js.map +0 -1
  119. package/dist/__tests__/catalog.test.d.ts +0 -2
  120. package/dist/__tests__/catalog.test.d.ts.map +0 -1
  121. package/dist/__tests__/catalog.test.js +0 -131
  122. package/dist/__tests__/catalog.test.js.map +0 -1
  123. package/dist/__tests__/claude-local-sanitizer.test.d.ts +0 -24
  124. package/dist/__tests__/claude-local-sanitizer.test.d.ts.map +0 -1
  125. package/dist/__tests__/claude-local-sanitizer.test.js +0 -906
  126. package/dist/__tests__/claude-local-sanitizer.test.js.map +0 -1
  127. package/dist/__tests__/claude-md-compose.test.d.ts +0 -17
  128. package/dist/__tests__/claude-md-compose.test.d.ts.map +0 -1
  129. package/dist/__tests__/claude-md-compose.test.js +0 -119
  130. package/dist/__tests__/claude-md-compose.test.js.map +0 -1
  131. package/dist/__tests__/claude-sync.test.d.ts +0 -2
  132. package/dist/__tests__/claude-sync.test.d.ts.map +0 -1
  133. package/dist/__tests__/claude-sync.test.js +0 -571
  134. package/dist/__tests__/claude-sync.test.js.map +0 -1
  135. package/dist/__tests__/cli-build-integration.test.d.ts +0 -2
  136. package/dist/__tests__/cli-build-integration.test.d.ts.map +0 -1
  137. package/dist/__tests__/cli-build-integration.test.js +0 -64
  138. package/dist/__tests__/cli-build-integration.test.js.map +0 -1
  139. package/dist/__tests__/cli-build.test.d.ts +0 -2
  140. package/dist/__tests__/cli-build.test.d.ts.map +0 -1
  141. package/dist/__tests__/cli-build.test.js +0 -640
  142. package/dist/__tests__/cli-build.test.js.map +0 -1
  143. package/dist/__tests__/codex-agent-gate.test.d.ts +0 -2
  144. package/dist/__tests__/codex-agent-gate.test.d.ts.map +0 -1
  145. package/dist/__tests__/codex-agent-gate.test.js +0 -480
  146. package/dist/__tests__/codex-agent-gate.test.js.map +0 -1
  147. package/dist/__tests__/codex-deploy-config.test.d.ts +0 -2
  148. package/dist/__tests__/codex-deploy-config.test.d.ts.map +0 -1
  149. package/dist/__tests__/codex-deploy-config.test.js +0 -1230
  150. package/dist/__tests__/codex-deploy-config.test.js.map +0 -1
  151. package/dist/__tests__/codex-trust-keys.test.d.ts +0 -2
  152. package/dist/__tests__/codex-trust-keys.test.d.ts.map +0 -1
  153. package/dist/__tests__/codex-trust-keys.test.js +0 -731
  154. package/dist/__tests__/codex-trust-keys.test.js.map +0 -1
  155. package/dist/__tests__/codex-write-race.test.d.ts +0 -2
  156. package/dist/__tests__/codex-write-race.test.d.ts.map +0 -1
  157. package/dist/__tests__/codex-write-race.test.js +0 -2253
  158. package/dist/__tests__/codex-write-race.test.js.map +0 -1
  159. package/dist/__tests__/completion-rows-discriminate.test.d.ts +0 -20
  160. package/dist/__tests__/completion-rows-discriminate.test.d.ts.map +0 -1
  161. package/dist/__tests__/completion-rows-discriminate.test.js +0 -481
  162. package/dist/__tests__/completion-rows-discriminate.test.js.map +0 -1
  163. package/dist/__tests__/config-command.test.d.ts +0 -9
  164. package/dist/__tests__/config-command.test.d.ts.map +0 -1
  165. package/dist/__tests__/config-command.test.js +0 -75
  166. package/dist/__tests__/config-command.test.js.map +0 -1
  167. package/dist/__tests__/config-fidelity-archived-symlinks.test.d.ts +0 -2
  168. package/dist/__tests__/config-fidelity-archived-symlinks.test.d.ts.map +0 -1
  169. package/dist/__tests__/config-fidelity-archived-symlinks.test.js +0 -127
  170. package/dist/__tests__/config-fidelity-archived-symlinks.test.js.map +0 -1
  171. package/dist/__tests__/config-fidelity-display.test.d.ts +0 -2
  172. package/dist/__tests__/config-fidelity-display.test.d.ts.map +0 -1
  173. package/dist/__tests__/config-fidelity-display.test.js +0 -77
  174. package/dist/__tests__/config-fidelity-display.test.js.map +0 -1
  175. package/dist/__tests__/config-fidelity-unreadable-fixture.d.ts +0 -32
  176. package/dist/__tests__/config-fidelity-unreadable-fixture.d.ts.map +0 -1
  177. package/dist/__tests__/config-fidelity-unreadable-fixture.js +0 -37
  178. package/dist/__tests__/config-fidelity-unreadable-fixture.js.map +0 -1
  179. package/dist/__tests__/config-fidelity.test.d.ts +0 -16
  180. package/dist/__tests__/config-fidelity.test.d.ts.map +0 -1
  181. package/dist/__tests__/config-fidelity.test.js +0 -2679
  182. package/dist/__tests__/config-fidelity.test.js.map +0 -1
  183. package/dist/__tests__/config-generation-gate.test.d.ts +0 -46
  184. package/dist/__tests__/config-generation-gate.test.d.ts.map +0 -1
  185. package/dist/__tests__/config-generation-gate.test.js +0 -435
  186. package/dist/__tests__/config-generation-gate.test.js.map +0 -1
  187. package/dist/__tests__/config-generation.test.d.ts +0 -7
  188. package/dist/__tests__/config-generation.test.d.ts.map +0 -1
  189. package/dist/__tests__/config-generation.test.js +0 -141
  190. package/dist/__tests__/config-generation.test.js.map +0 -1
  191. package/dist/__tests__/config-sync.test.d.ts +0 -10
  192. package/dist/__tests__/config-sync.test.d.ts.map +0 -1
  193. package/dist/__tests__/config-sync.test.js +0 -268
  194. package/dist/__tests__/config-sync.test.js.map +0 -1
  195. package/dist/__tests__/coordination-401-production-wiring.test.d.ts +0 -19
  196. package/dist/__tests__/coordination-401-production-wiring.test.d.ts.map +0 -1
  197. package/dist/__tests__/coordination-401-production-wiring.test.js +0 -286
  198. package/dist/__tests__/coordination-401-production-wiring.test.js.map +0 -1
  199. package/dist/__tests__/coordination-401-recovery.test.d.ts +0 -22
  200. package/dist/__tests__/coordination-401-recovery.test.d.ts.map +0 -1
  201. package/dist/__tests__/coordination-401-recovery.test.js +0 -601
  202. package/dist/__tests__/coordination-401-recovery.test.js.map +0 -1
  203. package/dist/__tests__/coordination-brief-pin.test.d.ts +0 -20
  204. package/dist/__tests__/coordination-brief-pin.test.d.ts.map +0 -1
  205. package/dist/__tests__/coordination-brief-pin.test.js +0 -66
  206. package/dist/__tests__/coordination-brief-pin.test.js.map +0 -1
  207. package/dist/__tests__/coordination-brief.test.d.ts +0 -9
  208. package/dist/__tests__/coordination-brief.test.d.ts.map +0 -1
  209. package/dist/__tests__/coordination-brief.test.js +0 -290
  210. package/dist/__tests__/coordination-brief.test.js.map +0 -1
  211. package/dist/__tests__/coordination-client.test.d.ts +0 -9
  212. package/dist/__tests__/coordination-client.test.d.ts.map +0 -1
  213. package/dist/__tests__/coordination-client.test.js +0 -517
  214. package/dist/__tests__/coordination-client.test.js.map +0 -1
  215. package/dist/__tests__/coordination-command.test.d.ts +0 -9
  216. package/dist/__tests__/coordination-command.test.d.ts.map +0 -1
  217. package/dist/__tests__/coordination-command.test.js +0 -1082
  218. package/dist/__tests__/coordination-command.test.js.map +0 -1
  219. package/dist/__tests__/coordination-credential-endpoint.test.d.ts +0 -24
  220. package/dist/__tests__/coordination-credential-endpoint.test.d.ts.map +0 -1
  221. package/dist/__tests__/coordination-credential-endpoint.test.js +0 -1292
  222. package/dist/__tests__/coordination-credential-endpoint.test.js.map +0 -1
  223. package/dist/__tests__/coordination-expected-team.test.d.ts +0 -19
  224. package/dist/__tests__/coordination-expected-team.test.d.ts.map +0 -1
  225. package/dist/__tests__/coordination-expected-team.test.js +0 -423
  226. package/dist/__tests__/coordination-expected-team.test.js.map +0 -1
  227. package/dist/__tests__/coordination-fallback.test.d.ts +0 -9
  228. package/dist/__tests__/coordination-fallback.test.d.ts.map +0 -1
  229. package/dist/__tests__/coordination-fallback.test.js +0 -192
  230. package/dist/__tests__/coordination-fallback.test.js.map +0 -1
  231. package/dist/__tests__/coordination-file-guards.test.d.ts +0 -29
  232. package/dist/__tests__/coordination-file-guards.test.d.ts.map +0 -1
  233. package/dist/__tests__/coordination-file-guards.test.js +0 -380
  234. package/dist/__tests__/coordination-file-guards.test.js.map +0 -1
  235. package/dist/__tests__/coordination-history.test.d.ts +0 -8
  236. package/dist/__tests__/coordination-history.test.d.ts.map +0 -1
  237. package/dist/__tests__/coordination-history.test.js +0 -447
  238. package/dist/__tests__/coordination-history.test.js.map +0 -1
  239. package/dist/__tests__/coordination-memory.test.d.ts +0 -14
  240. package/dist/__tests__/coordination-memory.test.d.ts.map +0 -1
  241. package/dist/__tests__/coordination-memory.test.js +0 -401
  242. package/dist/__tests__/coordination-memory.test.js.map +0 -1
  243. package/dist/__tests__/coordination-mode.test.d.ts +0 -13
  244. package/dist/__tests__/coordination-mode.test.d.ts.map +0 -1
  245. package/dist/__tests__/coordination-mode.test.js +0 -180
  246. package/dist/__tests__/coordination-mode.test.js.map +0 -1
  247. package/dist/__tests__/coordination-plain-shell-commands.test.d.ts +0 -22
  248. package/dist/__tests__/coordination-plain-shell-commands.test.d.ts.map +0 -1
  249. package/dist/__tests__/coordination-plain-shell-commands.test.js +0 -1875
  250. package/dist/__tests__/coordination-plain-shell-commands.test.js.map +0 -1
  251. package/dist/__tests__/coordination-provision.test.d.ts +0 -12
  252. package/dist/__tests__/coordination-provision.test.d.ts.map +0 -1
  253. package/dist/__tests__/coordination-provision.test.js +0 -103
  254. package/dist/__tests__/coordination-provision.test.js.map +0 -1
  255. package/dist/__tests__/coordination-render.test.d.ts +0 -9
  256. package/dist/__tests__/coordination-render.test.d.ts.map +0 -1
  257. package/dist/__tests__/coordination-render.test.js +0 -335
  258. package/dist/__tests__/coordination-render.test.js.map +0 -1
  259. package/dist/__tests__/coordination-setup.test.d.ts +0 -6
  260. package/dist/__tests__/coordination-setup.test.d.ts.map +0 -1
  261. package/dist/__tests__/coordination-setup.test.js +0 -448
  262. package/dist/__tests__/coordination-setup.test.js.map +0 -1
  263. package/dist/__tests__/coordination-status-plain-shell.test.d.ts +0 -19
  264. package/dist/__tests__/coordination-status-plain-shell.test.d.ts.map +0 -1
  265. package/dist/__tests__/coordination-status-plain-shell.test.js +0 -332
  266. package/dist/__tests__/coordination-status-plain-shell.test.js.map +0 -1
  267. package/dist/__tests__/coordination-status-registration.test.d.ts +0 -16
  268. package/dist/__tests__/coordination-status-registration.test.d.ts.map +0 -1
  269. package/dist/__tests__/coordination-status-registration.test.js +0 -480
  270. package/dist/__tests__/coordination-status-registration.test.js.map +0 -1
  271. package/dist/__tests__/coordination-token-multitenant.test.d.ts +0 -11
  272. package/dist/__tests__/coordination-token-multitenant.test.d.ts.map +0 -1
  273. package/dist/__tests__/coordination-token-multitenant.test.js +0 -106
  274. package/dist/__tests__/coordination-token-multitenant.test.js.map +0 -1
  275. package/dist/__tests__/coordination-token.test.d.ts +0 -11
  276. package/dist/__tests__/coordination-token.test.d.ts.map +0 -1
  277. package/dist/__tests__/coordination-token.test.js +0 -201
  278. package/dist/__tests__/coordination-token.test.js.map +0 -1
  279. package/dist/__tests__/coordination-wiring.test.d.ts +0 -11
  280. package/dist/__tests__/coordination-wiring.test.d.ts.map +0 -1
  281. package/dist/__tests__/coordination-wiring.test.js +0 -43
  282. package/dist/__tests__/coordination-wiring.test.js.map +0 -1
  283. package/dist/__tests__/creation-pr-class-check.test.d.ts +0 -17
  284. package/dist/__tests__/creation-pr-class-check.test.d.ts.map +0 -1
  285. package/dist/__tests__/creation-pr-class-check.test.js +0 -346
  286. package/dist/__tests__/creation-pr-class-check.test.js.map +0 -1
  287. package/dist/__tests__/creation-step6a-push-check.test.d.ts +0 -15
  288. package/dist/__tests__/creation-step6a-push-check.test.d.ts.map +0 -1
  289. package/dist/__tests__/creation-step6a-push-check.test.js +0 -150
  290. package/dist/__tests__/creation-step6a-push-check.test.js.map +0 -1
  291. package/dist/__tests__/decision-check.test.d.ts +0 -2
  292. package/dist/__tests__/decision-check.test.d.ts.map +0 -1
  293. package/dist/__tests__/decision-check.test.js +0 -105
  294. package/dist/__tests__/decision-check.test.js.map +0 -1
  295. package/dist/__tests__/digest-fail-closed.test.d.ts +0 -16
  296. package/dist/__tests__/digest-fail-closed.test.d.ts.map +0 -1
  297. package/dist/__tests__/digest-fail-closed.test.js +0 -248
  298. package/dist/__tests__/digest-fail-closed.test.js.map +0 -1
  299. package/dist/__tests__/digest-team-omission.test.d.ts +0 -15
  300. package/dist/__tests__/digest-team-omission.test.d.ts.map +0 -1
  301. package/dist/__tests__/digest-team-omission.test.js +0 -247
  302. package/dist/__tests__/digest-team-omission.test.js.map +0 -1
  303. package/dist/__tests__/doctor-config-fidelity.test.d.ts +0 -19
  304. package/dist/__tests__/doctor-config-fidelity.test.d.ts.map +0 -1
  305. package/dist/__tests__/doctor-config-fidelity.test.js +0 -324
  306. package/dist/__tests__/doctor-config-fidelity.test.js.map +0 -1
  307. package/dist/__tests__/doctor-framework-version.test.d.ts +0 -2
  308. package/dist/__tests__/doctor-framework-version.test.d.ts.map +0 -1
  309. package/dist/__tests__/doctor-framework-version.test.js +0 -146
  310. package/dist/__tests__/doctor-framework-version.test.js.map +0 -1
  311. package/dist/__tests__/doctor-worktree-path.test.d.ts +0 -17
  312. package/dist/__tests__/doctor-worktree-path.test.d.ts.map +0 -1
  313. package/dist/__tests__/doctor-worktree-path.test.js +0 -158
  314. package/dist/__tests__/doctor-worktree-path.test.js.map +0 -1
  315. package/dist/__tests__/doctor.test.d.ts +0 -20
  316. package/dist/__tests__/doctor.test.d.ts.map +0 -1
  317. package/dist/__tests__/doctor.test.js +0 -849
  318. package/dist/__tests__/doctor.test.js.map +0 -1
  319. package/dist/__tests__/event-shipper.test.d.ts +0 -16
  320. package/dist/__tests__/event-shipper.test.d.ts.map +0 -1
  321. package/dist/__tests__/event-shipper.test.js +0 -287
  322. package/dist/__tests__/event-shipper.test.js.map +0 -1
  323. package/dist/__tests__/fleet-data.test.d.ts +0 -2
  324. package/dist/__tests__/fleet-data.test.d.ts.map +0 -1
  325. package/dist/__tests__/fleet-data.test.js +0 -501
  326. package/dist/__tests__/fleet-data.test.js.map +0 -1
  327. package/dist/__tests__/fleet-devpod.test.d.ts +0 -12
  328. package/dist/__tests__/fleet-devpod.test.d.ts.map +0 -1
  329. package/dist/__tests__/fleet-devpod.test.js +0 -260
  330. package/dist/__tests__/fleet-devpod.test.js.map +0 -1
  331. package/dist/__tests__/fleet-tmux.test.d.ts +0 -2
  332. package/dist/__tests__/fleet-tmux.test.d.ts.map +0 -1
  333. package/dist/__tests__/fleet-tmux.test.js +0 -289
  334. package/dist/__tests__/fleet-tmux.test.js.map +0 -1
  335. package/dist/__tests__/fleet.test.d.ts +0 -16
  336. package/dist/__tests__/fleet.test.d.ts.map +0 -1
  337. package/dist/__tests__/fleet.test.js +0 -75
  338. package/dist/__tests__/fleet.test.js.map +0 -1
  339. package/dist/__tests__/generate-claude.test.d.ts +0 -18
  340. package/dist/__tests__/generate-claude.test.d.ts.map +0 -1
  341. package/dist/__tests__/generate-claude.test.js +0 -1015
  342. package/dist/__tests__/generate-claude.test.js.map +0 -1
  343. package/dist/__tests__/gh-remote.test.d.ts +0 -2
  344. package/dist/__tests__/gh-remote.test.d.ts.map +0 -1
  345. package/dist/__tests__/gh-remote.test.js +0 -136
  346. package/dist/__tests__/gh-remote.test.js.map +0 -1
  347. package/dist/__tests__/git-env.test.d.ts +0 -14
  348. package/dist/__tests__/git-env.test.d.ts.map +0 -1
  349. package/dist/__tests__/git-env.test.js +0 -131
  350. package/dist/__tests__/git-env.test.js.map +0 -1
  351. package/dist/__tests__/git-identity-isolation.test.d.ts +0 -33
  352. package/dist/__tests__/git-identity-isolation.test.d.ts.map +0 -1
  353. package/dist/__tests__/git-identity-isolation.test.js +0 -626
  354. package/dist/__tests__/git-identity-isolation.test.js.map +0 -1
  355. package/dist/__tests__/harness-extract.test.d.ts +0 -19
  356. package/dist/__tests__/harness-extract.test.d.ts.map +0 -1
  357. package/dist/__tests__/harness-extract.test.js +0 -566
  358. package/dist/__tests__/harness-extract.test.js.map +0 -1
  359. package/dist/__tests__/harness-wiring.test.d.ts +0 -16
  360. package/dist/__tests__/harness-wiring.test.d.ts.map +0 -1
  361. package/dist/__tests__/harness-wiring.test.js +0 -469
  362. package/dist/__tests__/harness-wiring.test.js.map +0 -1
  363. package/dist/__tests__/hook-completeness.test.d.ts +0 -13
  364. package/dist/__tests__/hook-completeness.test.d.ts.map +0 -1
  365. package/dist/__tests__/hook-completeness.test.js +0 -238
  366. package/dist/__tests__/hook-completeness.test.js.map +0 -1
  367. package/dist/__tests__/hook-heal.test.d.ts +0 -8
  368. package/dist/__tests__/hook-heal.test.d.ts.map +0 -1
  369. package/dist/__tests__/hook-heal.test.js +0 -156
  370. package/dist/__tests__/hook-heal.test.js.map +0 -1
  371. package/dist/__tests__/human-turn-classifier.test.d.ts +0 -17
  372. package/dist/__tests__/human-turn-classifier.test.d.ts.map +0 -1
  373. package/dist/__tests__/human-turn-classifier.test.js +0 -311
  374. package/dist/__tests__/human-turn-classifier.test.js.map +0 -1
  375. package/dist/__tests__/init-coordination-url.test.d.ts +0 -11
  376. package/dist/__tests__/init-coordination-url.test.d.ts.map +0 -1
  377. package/dist/__tests__/init-coordination-url.test.js +0 -217
  378. package/dist/__tests__/init-coordination-url.test.js.map +0 -1
  379. package/dist/__tests__/isolation-probe.test.d.ts +0 -15
  380. package/dist/__tests__/isolation-probe.test.d.ts.map +0 -1
  381. package/dist/__tests__/isolation-probe.test.js +0 -611
  382. package/dist/__tests__/isolation-probe.test.js.map +0 -1
  383. package/dist/__tests__/leader-lock.test.d.ts +0 -12
  384. package/dist/__tests__/leader-lock.test.d.ts.map +0 -1
  385. package/dist/__tests__/leader-lock.test.js +0 -293
  386. package/dist/__tests__/leader-lock.test.js.map +0 -1
  387. package/dist/__tests__/memory-archive-checks.test.d.ts +0 -22
  388. package/dist/__tests__/memory-archive-checks.test.d.ts.map +0 -1
  389. package/dist/__tests__/memory-archive-checks.test.js +0 -748
  390. package/dist/__tests__/memory-archive-checks.test.js.map +0 -1
  391. package/dist/__tests__/memory-archive-prep.test.d.ts +0 -8
  392. package/dist/__tests__/memory-archive-prep.test.d.ts.map +0 -1
  393. package/dist/__tests__/memory-archive-prep.test.js +0 -524
  394. package/dist/__tests__/memory-archive-prep.test.js.map +0 -1
  395. package/dist/__tests__/memory-autocreate.test.d.ts +0 -10
  396. package/dist/__tests__/memory-autocreate.test.d.ts.map +0 -1
  397. package/dist/__tests__/memory-autocreate.test.js +0 -709
  398. package/dist/__tests__/memory-autocreate.test.js.map +0 -1
  399. package/dist/__tests__/memory-log-result.test.d.ts +0 -13
  400. package/dist/__tests__/memory-log-result.test.d.ts.map +0 -1
  401. package/dist/__tests__/memory-log-result.test.js +0 -149
  402. package/dist/__tests__/memory-log-result.test.js.map +0 -1
  403. package/dist/__tests__/memory-named-exists.test.d.ts +0 -16
  404. package/dist/__tests__/memory-named-exists.test.d.ts.map +0 -1
  405. package/dist/__tests__/memory-named-exists.test.js +0 -288
  406. package/dist/__tests__/memory-named-exists.test.js.map +0 -1
  407. package/dist/__tests__/message-bus.test.d.ts +0 -10
  408. package/dist/__tests__/message-bus.test.d.ts.map +0 -1
  409. package/dist/__tests__/message-bus.test.js +0 -526
  410. package/dist/__tests__/message-bus.test.js.map +0 -1
  411. package/dist/__tests__/monitor.test.d.ts +0 -6
  412. package/dist/__tests__/monitor.test.d.ts.map +0 -1
  413. package/dist/__tests__/monitor.test.js +0 -458
  414. package/dist/__tests__/monitor.test.js.map +0 -1
  415. package/dist/__tests__/mx-agent-cli-pin-validation.test.d.ts +0 -2
  416. package/dist/__tests__/mx-agent-cli-pin-validation.test.d.ts.map +0 -1
  417. package/dist/__tests__/mx-agent-cli-pin-validation.test.js +0 -232
  418. package/dist/__tests__/mx-agent-cli-pin-validation.test.js.map +0 -1
  419. package/dist/__tests__/mx-agent-cli-version-pin.test.d.ts +0 -2
  420. package/dist/__tests__/mx-agent-cli-version-pin.test.d.ts.map +0 -1
  421. package/dist/__tests__/mx-agent-cli-version-pin.test.js +0 -236
  422. package/dist/__tests__/mx-agent-cli-version-pin.test.js.map +0 -1
  423. package/dist/__tests__/new-project-first-team.test.d.ts +0 -15
  424. package/dist/__tests__/new-project-first-team.test.d.ts.map +0 -1
  425. package/dist/__tests__/new-project-first-team.test.js +0 -444
  426. package/dist/__tests__/new-project-first-team.test.js.map +0 -1
  427. package/dist/__tests__/otel-env.test.d.ts +0 -2
  428. package/dist/__tests__/otel-env.test.d.ts.map +0 -1
  429. package/dist/__tests__/otel-env.test.js +0 -127
  430. package/dist/__tests__/otel-env.test.js.map +0 -1
  431. package/dist/__tests__/pager-fail-closed.test.d.ts +0 -19
  432. package/dist/__tests__/pager-fail-closed.test.d.ts.map +0 -1
  433. package/dist/__tests__/pager-fail-closed.test.js +0 -229
  434. package/dist/__tests__/pager-fail-closed.test.js.map +0 -1
  435. package/dist/__tests__/pr-set-body.test.d.ts +0 -29
  436. package/dist/__tests__/pr-set-body.test.d.ts.map +0 -1
  437. package/dist/__tests__/pr-set-body.test.js +0 -314
  438. package/dist/__tests__/pr-set-body.test.js.map +0 -1
  439. package/dist/__tests__/prior-sync-failure.test.d.ts +0 -2
  440. package/dist/__tests__/prior-sync-failure.test.d.ts.map +0 -1
  441. package/dist/__tests__/prior-sync-failure.test.js +0 -81
  442. package/dist/__tests__/prior-sync-failure.test.js.map +0 -1
  443. package/dist/__tests__/project-config.test.d.ts +0 -2
  444. package/dist/__tests__/project-config.test.d.ts.map +0 -1
  445. package/dist/__tests__/project-config.test.js +0 -458
  446. package/dist/__tests__/project-config.test.js.map +0 -1
  447. package/dist/__tests__/provision-behavioral-contract.test.d.ts +0 -13
  448. package/dist/__tests__/provision-behavioral-contract.test.d.ts.map +0 -1
  449. package/dist/__tests__/provision-behavioral-contract.test.js +0 -548
  450. package/dist/__tests__/provision-behavioral-contract.test.js.map +0 -1
  451. package/dist/__tests__/provision-catalog-precondition.test.d.ts +0 -26
  452. package/dist/__tests__/provision-catalog-precondition.test.d.ts.map +0 -1
  453. package/dist/__tests__/provision-catalog-precondition.test.js +0 -622
  454. package/dist/__tests__/provision-catalog-precondition.test.js.map +0 -1
  455. package/dist/__tests__/provision-completion-rows.test.d.ts +0 -17
  456. package/dist/__tests__/provision-completion-rows.test.d.ts.map +0 -1
  457. package/dist/__tests__/provision-completion-rows.test.js +0 -3473
  458. package/dist/__tests__/provision-completion-rows.test.js.map +0 -1
  459. package/dist/__tests__/provision-copy-containment.test.d.ts +0 -19
  460. package/dist/__tests__/provision-copy-containment.test.d.ts.map +0 -1
  461. package/dist/__tests__/provision-copy-containment.test.js +0 -187
  462. package/dist/__tests__/provision-copy-containment.test.js.map +0 -1
  463. package/dist/__tests__/provision-identity-gate.test.d.ts +0 -20
  464. package/dist/__tests__/provision-identity-gate.test.d.ts.map +0 -1
  465. package/dist/__tests__/provision-identity-gate.test.js +0 -602
  466. package/dist/__tests__/provision-identity-gate.test.js.map +0 -1
  467. package/dist/__tests__/provision-resume.test.d.ts +0 -26
  468. package/dist/__tests__/provision-resume.test.d.ts.map +0 -1
  469. package/dist/__tests__/provision-resume.test.js +0 -1344
  470. package/dist/__tests__/provision-resume.test.js.map +0 -1
  471. package/dist/__tests__/provision-roleguide-anchors.test.d.ts +0 -27
  472. package/dist/__tests__/provision-roleguide-anchors.test.d.ts.map +0 -1
  473. package/dist/__tests__/provision-roleguide-anchors.test.js +0 -747
  474. package/dist/__tests__/provision-roleguide-anchors.test.js.map +0 -1
  475. package/dist/__tests__/provision-row12-stub-server.test.d.ts +0 -21
  476. package/dist/__tests__/provision-row12-stub-server.test.d.ts.map +0 -1
  477. package/dist/__tests__/provision-row12-stub-server.test.js +0 -264
  478. package/dist/__tests__/provision-row12-stub-server.test.js.map +0 -1
  479. package/dist/__tests__/provision-skeleton-fill.test.d.ts +0 -16
  480. package/dist/__tests__/provision-skeleton-fill.test.d.ts.map +0 -1
  481. package/dist/__tests__/provision-skeleton-fill.test.js +0 -490
  482. package/dist/__tests__/provision-skeleton-fill.test.js.map +0 -1
  483. package/dist/__tests__/provision-step8-commit.test.d.ts +0 -40
  484. package/dist/__tests__/provision-step8-commit.test.d.ts.map +0 -1
  485. package/dist/__tests__/provision-step8-commit.test.js +0 -529
  486. package/dist/__tests__/provision-step8-commit.test.js.map +0 -1
  487. package/dist/__tests__/provision-teambuilder-flow.test.d.ts +0 -22
  488. package/dist/__tests__/provision-teambuilder-flow.test.d.ts.map +0 -1
  489. package/dist/__tests__/provision-teambuilder-flow.test.js +0 -253
  490. package/dist/__tests__/provision-teambuilder-flow.test.js.map +0 -1
  491. package/dist/__tests__/provision-write-integrity.test.d.ts +0 -18
  492. package/dist/__tests__/provision-write-integrity.test.d.ts.map +0 -1
  493. package/dist/__tests__/provision-write-integrity.test.js +0 -141
  494. package/dist/__tests__/provision-write-integrity.test.js.map +0 -1
  495. package/dist/__tests__/repo-guard-wiring.test.d.ts +0 -21
  496. package/dist/__tests__/repo-guard-wiring.test.d.ts.map +0 -1
  497. package/dist/__tests__/repo-guard-wiring.test.js +0 -638
  498. package/dist/__tests__/repo-guard-wiring.test.js.map +0 -1
  499. package/dist/__tests__/report-format.test.d.ts +0 -2
  500. package/dist/__tests__/report-format.test.d.ts.map +0 -1
  501. package/dist/__tests__/report-format.test.js +0 -219
  502. package/dist/__tests__/report-format.test.js.map +0 -1
  503. package/dist/__tests__/row15-detail-sanitizer.test.d.ts +0 -20
  504. package/dist/__tests__/row15-detail-sanitizer.test.d.ts.map +0 -1
  505. package/dist/__tests__/row15-detail-sanitizer.test.js +0 -61
  506. package/dist/__tests__/row15-detail-sanitizer.test.js.map +0 -1
  507. package/dist/__tests__/rows-9-10-zero-remotes.test.d.ts +0 -32
  508. package/dist/__tests__/rows-9-10-zero-remotes.test.d.ts.map +0 -1
  509. package/dist/__tests__/rows-9-10-zero-remotes.test.js +0 -203
  510. package/dist/__tests__/rows-9-10-zero-remotes.test.js.map +0 -1
  511. package/dist/__tests__/runtime-claude-adapter.test.d.ts +0 -2
  512. package/dist/__tests__/runtime-claude-adapter.test.d.ts.map +0 -1
  513. package/dist/__tests__/runtime-claude-adapter.test.js +0 -70
  514. package/dist/__tests__/runtime-claude-adapter.test.js.map +0 -1
  515. package/dist/__tests__/runtime-codex-adapter.test.d.ts +0 -2
  516. package/dist/__tests__/runtime-codex-adapter.test.d.ts.map +0 -1
  517. package/dist/__tests__/runtime-codex-adapter.test.js +0 -558
  518. package/dist/__tests__/runtime-codex-adapter.test.js.map +0 -1
  519. package/dist/__tests__/runtime-codex-config.test.d.ts +0 -2
  520. package/dist/__tests__/runtime-codex-config.test.d.ts.map +0 -1
  521. package/dist/__tests__/runtime-codex-config.test.js +0 -1421
  522. package/dist/__tests__/runtime-codex-config.test.js.map +0 -1
  523. package/dist/__tests__/runtime-codex-gateway-pilot.test.d.ts +0 -2
  524. package/dist/__tests__/runtime-codex-gateway-pilot.test.d.ts.map +0 -1
  525. package/dist/__tests__/runtime-codex-gateway-pilot.test.js +0 -309
  526. package/dist/__tests__/runtime-codex-gateway-pilot.test.js.map +0 -1
  527. package/dist/__tests__/runtime-codex-gateway-provider.test.d.ts +0 -2
  528. package/dist/__tests__/runtime-codex-gateway-provider.test.d.ts.map +0 -1
  529. package/dist/__tests__/runtime-codex-gateway-provider.test.js +0 -163
  530. package/dist/__tests__/runtime-codex-gateway-provider.test.js.map +0 -1
  531. package/dist/__tests__/runtime-codex-guard-proof.test.d.ts +0 -2
  532. package/dist/__tests__/runtime-codex-guard-proof.test.d.ts.map +0 -1
  533. package/dist/__tests__/runtime-codex-guard-proof.test.js +0 -822
  534. package/dist/__tests__/runtime-codex-guard-proof.test.js.map +0 -1
  535. package/dist/__tests__/runtime-codex-version-pin.test.d.ts +0 -2
  536. package/dist/__tests__/runtime-codex-version-pin.test.d.ts.map +0 -1
  537. package/dist/__tests__/runtime-codex-version-pin.test.js +0 -86
  538. package/dist/__tests__/runtime-codex-version-pin.test.js.map +0 -1
  539. package/dist/__tests__/runtime-identity.test.d.ts +0 -2
  540. package/dist/__tests__/runtime-identity.test.d.ts.map +0 -1
  541. package/dist/__tests__/runtime-identity.test.js +0 -117
  542. package/dist/__tests__/runtime-identity.test.js.map +0 -1
  543. package/dist/__tests__/runtime-resolve.test.d.ts +0 -2
  544. package/dist/__tests__/runtime-resolve.test.d.ts.map +0 -1
  545. package/dist/__tests__/runtime-resolve.test.js +0 -172
  546. package/dist/__tests__/runtime-resolve.test.js.map +0 -1
  547. package/dist/__tests__/security-posture.test.d.ts +0 -8
  548. package/dist/__tests__/security-posture.test.d.ts.map +0 -1
  549. package/dist/__tests__/security-posture.test.js +0 -82
  550. package/dist/__tests__/security-posture.test.js.map +0 -1
  551. package/dist/__tests__/session-model.test.d.ts +0 -2
  552. package/dist/__tests__/session-model.test.d.ts.map +0 -1
  553. package/dist/__tests__/session-model.test.js +0 -74
  554. package/dist/__tests__/session-model.test.js.map +0 -1
  555. package/dist/__tests__/session-pause-provisioning.test.d.ts +0 -19
  556. package/dist/__tests__/session-pause-provisioning.test.d.ts.map +0 -1
  557. package/dist/__tests__/session-pause-provisioning.test.js +0 -115
  558. package/dist/__tests__/session-pause-provisioning.test.js.map +0 -1
  559. package/dist/__tests__/session-reclamation.test.d.ts +0 -15
  560. package/dist/__tests__/session-reclamation.test.d.ts.map +0 -1
  561. package/dist/__tests__/session-reclamation.test.js +0 -73
  562. package/dist/__tests__/session-reclamation.test.js.map +0 -1
  563. package/dist/__tests__/session-record-disclosure.test.d.ts +0 -24
  564. package/dist/__tests__/session-record-disclosure.test.d.ts.map +0 -1
  565. package/dist/__tests__/session-record-disclosure.test.js +0 -494
  566. package/dist/__tests__/session-record-disclosure.test.js.map +0 -1
  567. package/dist/__tests__/session-status.test.d.ts +0 -11
  568. package/dist/__tests__/session-status.test.d.ts.map +0 -1
  569. package/dist/__tests__/session-status.test.js +0 -76
  570. package/dist/__tests__/session-status.test.js.map +0 -1
  571. package/dist/__tests__/session.test.d.ts +0 -15
  572. package/dist/__tests__/session.test.d.ts.map +0 -1
  573. package/dist/__tests__/session.test.js +0 -366
  574. package/dist/__tests__/session.test.js.map +0 -1
  575. package/dist/__tests__/shim-deploy-safety.test.d.ts +0 -24
  576. package/dist/__tests__/shim-deploy-safety.test.d.ts.map +0 -1
  577. package/dist/__tests__/shim-deploy-safety.test.js +0 -174
  578. package/dist/__tests__/shim-deploy-safety.test.js.map +0 -1
  579. package/dist/__tests__/slug-validation.test.d.ts +0 -13
  580. package/dist/__tests__/slug-validation.test.d.ts.map +0 -1
  581. package/dist/__tests__/slug-validation.test.js +0 -202
  582. package/dist/__tests__/slug-validation.test.js.map +0 -1
  583. package/dist/__tests__/standards-injection.test.d.ts +0 -2
  584. package/dist/__tests__/standards-injection.test.d.ts.map +0 -1
  585. package/dist/__tests__/standards-injection.test.js +0 -179
  586. package/dist/__tests__/standards-injection.test.js.map +0 -1
  587. package/dist/__tests__/start-config-conflict.test.d.ts +0 -17
  588. package/dist/__tests__/start-config-conflict.test.d.ts.map +0 -1
  589. package/dist/__tests__/start-config-conflict.test.js +0 -101
  590. package/dist/__tests__/start-config-conflict.test.js.map +0 -1
  591. package/dist/__tests__/start-interactive-role.test.d.ts +0 -22
  592. package/dist/__tests__/start-interactive-role.test.d.ts.map +0 -1
  593. package/dist/__tests__/start-interactive-role.test.js +0 -204
  594. package/dist/__tests__/start-interactive-role.test.js.map +0 -1
  595. package/dist/__tests__/start-rebase-never-ran.test.d.ts +0 -25
  596. package/dist/__tests__/start-rebase-never-ran.test.d.ts.map +0 -1
  597. package/dist/__tests__/start-rebase-never-ran.test.js +0 -227
  598. package/dist/__tests__/start-rebase-never-ran.test.js.map +0 -1
  599. package/dist/__tests__/start-report-generation-capture.test.d.ts +0 -17
  600. package/dist/__tests__/start-report-generation-capture.test.d.ts.map +0 -1
  601. package/dist/__tests__/start-report-generation-capture.test.js +0 -127
  602. package/dist/__tests__/start-report-generation-capture.test.js.map +0 -1
  603. package/dist/__tests__/start-report-integration.test.d.ts +0 -12
  604. package/dist/__tests__/start-report-integration.test.d.ts.map +0 -1
  605. package/dist/__tests__/start-report-integration.test.js +0 -138
  606. package/dist/__tests__/start-report-integration.test.js.map +0 -1
  607. package/dist/__tests__/start-runtime-wiring.test.d.ts +0 -31
  608. package/dist/__tests__/start-runtime-wiring.test.d.ts.map +0 -1
  609. package/dist/__tests__/start-runtime-wiring.test.js +0 -735
  610. package/dist/__tests__/start-runtime-wiring.test.js.map +0 -1
  611. package/dist/__tests__/start-stash.test.d.ts +0 -2
  612. package/dist/__tests__/start-stash.test.d.ts.map +0 -1
  613. package/dist/__tests__/start-stash.test.js +0 -131
  614. package/dist/__tests__/start-stash.test.js.map +0 -1
  615. package/dist/__tests__/start-sync-hardstop.test.d.ts +0 -15
  616. package/dist/__tests__/start-sync-hardstop.test.d.ts.map +0 -1
  617. package/dist/__tests__/start-sync-hardstop.test.js +0 -280
  618. package/dist/__tests__/start-sync-hardstop.test.js.map +0 -1
  619. package/dist/__tests__/start-team-identity.test.d.ts +0 -25
  620. package/dist/__tests__/start-team-identity.test.d.ts.map +0 -1
  621. package/dist/__tests__/start-team-identity.test.js +0 -307
  622. package/dist/__tests__/start-team-identity.test.js.map +0 -1
  623. package/dist/__tests__/startup-health-render.test.d.ts +0 -11
  624. package/dist/__tests__/startup-health-render.test.d.ts.map +0 -1
  625. package/dist/__tests__/startup-health-render.test.js +0 -60
  626. package/dist/__tests__/startup-health-render.test.js.map +0 -1
  627. package/dist/__tests__/startup-policy.test.d.ts +0 -2
  628. package/dist/__tests__/startup-policy.test.d.ts.map +0 -1
  629. package/dist/__tests__/startup-policy.test.js +0 -27
  630. package/dist/__tests__/startup-policy.test.js.map +0 -1
  631. package/dist/__tests__/startup-report.test.d.ts +0 -13
  632. package/dist/__tests__/startup-report.test.d.ts.map +0 -1
  633. package/dist/__tests__/startup-report.test.js +0 -278
  634. package/dist/__tests__/startup-report.test.js.map +0 -1
  635. package/dist/__tests__/startup-shipper.test.d.ts +0 -13
  636. package/dist/__tests__/startup-shipper.test.d.ts.map +0 -1
  637. package/dist/__tests__/startup-shipper.test.js +0 -149
  638. package/dist/__tests__/startup-shipper.test.js.map +0 -1
  639. package/dist/__tests__/stream-input-controller.test.d.ts +0 -10
  640. package/dist/__tests__/stream-input-controller.test.d.ts.map +0 -1
  641. package/dist/__tests__/stream-input-controller.test.js +0 -167
  642. package/dist/__tests__/stream-input-controller.test.js.map +0 -1
  643. package/dist/__tests__/team-memory-commands.test.d.ts +0 -11
  644. package/dist/__tests__/team-memory-commands.test.d.ts.map +0 -1
  645. package/dist/__tests__/team-memory-commands.test.js +0 -240
  646. package/dist/__tests__/team-memory-commands.test.js.map +0 -1
  647. package/dist/__tests__/team-name-propagation.test.d.ts +0 -13
  648. package/dist/__tests__/team-name-propagation.test.d.ts.map +0 -1
  649. package/dist/__tests__/team-name-propagation.test.js +0 -198
  650. package/dist/__tests__/team-name-propagation.test.js.map +0 -1
  651. package/dist/__tests__/team-token-probe.test.d.ts +0 -16
  652. package/dist/__tests__/team-token-probe.test.d.ts.map +0 -1
  653. package/dist/__tests__/team-token-probe.test.js +0 -295
  654. package/dist/__tests__/team-token-probe.test.js.map +0 -1
  655. package/dist/__tests__/template-budget.test.d.ts +0 -2
  656. package/dist/__tests__/template-budget.test.d.ts.map +0 -1
  657. package/dist/__tests__/template-budget.test.js +0 -119
  658. package/dist/__tests__/template-budget.test.js.map +0 -1
  659. package/dist/__tests__/template-sync.test.d.ts +0 -19
  660. package/dist/__tests__/template-sync.test.d.ts.map +0 -1
  661. package/dist/__tests__/template-sync.test.js +0 -480
  662. package/dist/__tests__/template-sync.test.js.map +0 -1
  663. package/dist/__tests__/test-project.test.d.ts +0 -18
  664. package/dist/__tests__/test-project.test.d.ts.map +0 -1
  665. package/dist/__tests__/test-project.test.js +0 -465
  666. package/dist/__tests__/test-project.test.js.map +0 -1
  667. package/dist/__tests__/tracked-instruction-files.test.d.ts +0 -21
  668. package/dist/__tests__/tracked-instruction-files.test.d.ts.map +0 -1
  669. package/dist/__tests__/tracked-instruction-files.test.js +0 -489
  670. package/dist/__tests__/tracked-instruction-files.test.js.map +0 -1
  671. package/dist/__tests__/unlock.test.d.ts +0 -11
  672. package/dist/__tests__/unlock.test.d.ts.map +0 -1
  673. package/dist/__tests__/unlock.test.js +0 -100
  674. package/dist/__tests__/unlock.test.js.map +0 -1
  675. package/dist/__tests__/usage-per-call-grouping.test.d.ts +0 -25
  676. package/dist/__tests__/usage-per-call-grouping.test.d.ts.map +0 -1
  677. package/dist/__tests__/usage-per-call-grouping.test.js +0 -952
  678. package/dist/__tests__/usage-per-call-grouping.test.js.map +0 -1
  679. package/dist/__tests__/usage-pricing.test.d.ts +0 -20
  680. package/dist/__tests__/usage-pricing.test.d.ts.map +0 -1
  681. package/dist/__tests__/usage-pricing.test.js +0 -176
  682. package/dist/__tests__/usage-pricing.test.js.map +0 -1
  683. package/dist/__tests__/usage-subagent-discovery.test.d.ts +0 -17
  684. package/dist/__tests__/usage-subagent-discovery.test.d.ts.map +0 -1
  685. package/dist/__tests__/usage-subagent-discovery.test.js +0 -213
  686. package/dist/__tests__/usage-subagent-discovery.test.js.map +0 -1
  687. package/dist/__tests__/verify-hooks-check-all.test.d.ts +0 -32
  688. package/dist/__tests__/verify-hooks-check-all.test.d.ts.map +0 -1
  689. package/dist/__tests__/verify-hooks-check-all.test.js +0 -563
  690. package/dist/__tests__/verify-hooks-check-all.test.js.map +0 -1
  691. package/dist/__tests__/verify-hooks-heal-log.test.d.ts +0 -11
  692. package/dist/__tests__/verify-hooks-heal-log.test.d.ts.map +0 -1
  693. package/dist/__tests__/verify-hooks-heal-log.test.js +0 -172
  694. package/dist/__tests__/verify-hooks-heal-log.test.js.map +0 -1
  695. package/dist/__tests__/worker-cap.test.d.ts +0 -14
  696. package/dist/__tests__/worker-cap.test.d.ts.map +0 -1
  697. package/dist/__tests__/worker-cap.test.js +0 -97
  698. package/dist/__tests__/worker-cap.test.js.map +0 -1
  699. package/dist/__tests__/worktree-link-repair.test.d.ts +0 -2
  700. package/dist/__tests__/worktree-link-repair.test.d.ts.map +0 -1
  701. package/dist/__tests__/worktree-link-repair.test.js +0 -471
  702. package/dist/__tests__/worktree-link-repair.test.js.map +0 -1
  703. package/dist/__tests__/worktree-sync-fixture.test.d.ts +0 -17
  704. package/dist/__tests__/worktree-sync-fixture.test.d.ts.map +0 -1
  705. package/dist/__tests__/worktree-sync-fixture.test.js +0 -519
  706. package/dist/__tests__/worktree-sync-fixture.test.js.map +0 -1
  707. package/dist/__tests__/worktree-sync-hardening.test.d.ts +0 -13
  708. package/dist/__tests__/worktree-sync-hardening.test.d.ts.map +0 -1
  709. package/dist/__tests__/worktree-sync-hardening.test.js +0 -919
  710. package/dist/__tests__/worktree-sync-hardening.test.js.map +0 -1
  711. package/dist/__tests__/worktree-sync-shell-free.test.d.ts +0 -25
  712. package/dist/__tests__/worktree-sync-shell-free.test.d.ts.map +0 -1
  713. package/dist/__tests__/worktree-sync-shell-free.test.js +0 -185
  714. package/dist/__tests__/worktree-sync-shell-free.test.js.map +0 -1
  715. package/dist/__tests__/worktree.test.d.ts +0 -2
  716. package/dist/__tests__/worktree.test.d.ts.map +0 -1
  717. package/dist/__tests__/worktree.test.js +0 -168
  718. package/dist/__tests__/worktree.test.js.map +0 -1
  719. package/dist/lib/code-context-file.test.d.ts +0 -19
  720. package/dist/lib/code-context-file.test.d.ts.map +0 -1
  721. package/dist/lib/code-context-file.test.js +0 -202
  722. package/dist/lib/code-context-file.test.js.map +0 -1
  723. package/dist/lib/harness/console/announce.test.d.ts +0 -2
  724. package/dist/lib/harness/console/announce.test.d.ts.map +0 -1
  725. package/dist/lib/harness/console/announce.test.js +0 -104
  726. package/dist/lib/harness/console/announce.test.js.map +0 -1
  727. package/dist/lib/harness/console/by-session.test.d.ts +0 -2
  728. package/dist/lib/harness/console/by-session.test.d.ts.map +0 -1
  729. package/dist/lib/harness/console/by-session.test.js +0 -86
  730. package/dist/lib/harness/console/by-session.test.js.map +0 -1
  731. package/dist/lib/harness/console/console.test.d.ts +0 -2
  732. package/dist/lib/harness/console/console.test.d.ts.map +0 -1
  733. package/dist/lib/harness/console/console.test.js +0 -269
  734. package/dist/lib/harness/console/console.test.js.map +0 -1
  735. package/dist/lib/harness/console/decision-request.test.d.ts +0 -2
  736. package/dist/lib/harness/console/decision-request.test.d.ts.map +0 -1
  737. package/dist/lib/harness/console/decision-request.test.js +0 -75
  738. package/dist/lib/harness/console/decision-request.test.js.map +0 -1
  739. package/dist/lib/harness/console/rank.test.d.ts +0 -2
  740. package/dist/lib/harness/console/rank.test.d.ts.map +0 -1
  741. package/dist/lib/harness/console/rank.test.js +0 -124
  742. package/dist/lib/harness/console/rank.test.js.map +0 -1
  743. package/dist/lib/harness/console/render.test.d.ts +0 -2
  744. package/dist/lib/harness/console/render.test.d.ts.map +0 -1
  745. package/dist/lib/harness/console/render.test.js +0 -96
  746. package/dist/lib/harness/console/render.test.js.map +0 -1
  747. package/dist/lib/harness/console/replay-cli.test.d.ts +0 -2
  748. package/dist/lib/harness/console/replay-cli.test.d.ts.map +0 -1
  749. package/dist/lib/harness/console/replay-cli.test.js +0 -96
  750. package/dist/lib/harness/console/replay-cli.test.js.map +0 -1
  751. package/dist/lib/harness/console/replay.test.d.ts +0 -2
  752. package/dist/lib/harness/console/replay.test.d.ts.map +0 -1
  753. package/dist/lib/harness/console/replay.test.js +0 -81
  754. package/dist/lib/harness/console/replay.test.js.map +0 -1
  755. package/dist/lib/harness/console/turn-reader.test.d.ts +0 -2
  756. package/dist/lib/harness/console/turn-reader.test.d.ts.map +0 -1
  757. package/dist/lib/harness/console/turn-reader.test.js +0 -108
  758. package/dist/lib/harness/console/turn-reader.test.js.map +0 -1
  759. package/dist/lib/harness/credential.test.d.ts +0 -2
  760. package/dist/lib/harness/credential.test.d.ts.map +0 -1
  761. package/dist/lib/harness/credential.test.js +0 -74
  762. package/dist/lib/harness/credential.test.js.map +0 -1
  763. package/dist/lib/harness/evaluate.test.d.ts +0 -2
  764. package/dist/lib/harness/evaluate.test.d.ts.map +0 -1
  765. package/dist/lib/harness/evaluate.test.js +0 -621
  766. package/dist/lib/harness/evaluate.test.js.map +0 -1
  767. package/dist/lib/harness/gate.test.d.ts +0 -2
  768. package/dist/lib/harness/gate.test.d.ts.map +0 -1
  769. package/dist/lib/harness/gate.test.js +0 -111
  770. package/dist/lib/harness/gate.test.js.map +0 -1
  771. package/dist/lib/harness/self-check.test.d.ts +0 -2
  772. package/dist/lib/harness/self-check.test.d.ts.map +0 -1
  773. package/dist/lib/harness/self-check.test.js +0 -43
  774. package/dist/lib/harness/self-check.test.js.map +0 -1
  775. package/dist/lib/harness/transcript.test.d.ts +0 -2
  776. package/dist/lib/harness/transcript.test.d.ts.map +0 -1
  777. package/dist/lib/harness/transcript.test.js +0 -118
  778. package/dist/lib/harness/transcript.test.js.map +0 -1
  779. package/dist/lib/projects-registry.test.d.ts +0 -2
  780. package/dist/lib/projects-registry.test.d.ts.map +0 -1
  781. package/dist/lib/projects-registry.test.js +0 -176
  782. package/dist/lib/projects-registry.test.js.map +0 -1
  783. package/dist/lib/roster.test.d.ts +0 -15
  784. package/dist/lib/roster.test.d.ts.map +0 -1
  785. package/dist/lib/roster.test.js +0 -299
  786. package/dist/lib/roster.test.js.map +0 -1
  787. package/dist/lib/vault.test.d.ts +0 -17
  788. package/dist/lib/vault.test.d.ts.map +0 -1
  789. package/dist/lib/vault.test.js +0 -169
  790. package/dist/lib/vault.test.js.map +0 -1
  791. package/dist/lib/window-view.test.d.ts +0 -2
  792. package/dist/lib/window-view.test.d.ts.map +0 -1
  793. package/dist/lib/window-view.test.js +0 -168
  794. package/dist/lib/window-view.test.js.map +0 -1
  795. package/dist/standards/fail-loud-standard.md +0 -495
  796. package/dist/standards/known-issues-standard.md +0 -380
  797. package/dist/standards/rulings.md +0 -104
@@ -1,748 +0,0 @@
1
- /**
2
- * Tests for the three advisory safety checks in `mx-agent memory archive-prep`
3
- * — per-draft date evidence, the orphaned-identifier diff, and the index-stub
4
- * list.
5
- *
6
- * Every case here traces to a measured incident on 2026-08-05/06:
7
- * * platform: 38 slugs would have been archived with no index line left in
8
- * the live head; all 38 were OPEN.
9
- * * customer-portal: two docs, opposite ordering conventions, same session;
10
- * 76 of 77 moved entries carried no resolution marker; several said
11
- * "fixed" about a SUB-PART of a still-open item.
12
- *
13
- * Two of the three checks used to CLASSIFY: one inferred an ordering direction
14
- * and printed "Match: NO — THE SPLIT IS PROBABLY INVERTED … Swap the two
15
- * drafts"; the other sorted orphans into resolved / open / ambiguous and
16
- * published a stub count that could read 0. Two security reviews found nine
17
- * shapes of real document text that drove those verdicts to a confident wrong
18
- * answer, and each fix drew another shape. Both classifiers are gone. What is
19
- * left reports extracted facts, so there is no verdict left to be wrong.
20
- */
21
- import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
22
- import { existsSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'fs';
23
- import { tmpdir } from 'os';
24
- import { join } from 'path';
25
- import { collectDateEvidence, extractIdentifiers, findUnrecognisedIdentifierTokens, findOrphanedIdentifiers, relateDrafts, printSafetyChecks, splitForArchive, stripControlChars, buildHeadDraft, runArchivePrep, isGitIgnored, MIN_ANCHOR_DATES, } from '../commands/memory.js';
26
- // ── Check 1: per-draft date evidence, no direction ───────────────────────────
27
- describe('collectDateEvidence', () => {
28
- it('reports the earliest and latest date in each draft', () => {
29
- const content = [
30
- '## 2026-08-05 — latest',
31
- '- entry e',
32
- '## 2026-08-01 — earlier',
33
- '- entry d',
34
- '## 2026-07-20 — earlier still',
35
- '- entry c',
36
- '## 2026-07-02 — older',
37
- '- entry b',
38
- '## 2026-06-11 — oldest',
39
- '- entry a',
40
- ].join('\n');
41
- const r = collectDateEvidence(content, 6);
42
- expect(r.head).toEqual({ count: 3, earliest: '2026-07-20', latest: '2026-08-05' });
43
- expect(r.archive).toEqual({ count: 2, earliest: '2026-06-11', latest: '2026-07-02' });
44
- expect(r.firstDate).toBe('2026-08-05');
45
- expect(r.lastDate).toBe('2026-06-11');
46
- });
47
- it('reports ranges that let the operator SEE an inverted split', () => {
48
- // customer-portal's iteration-log shape, newest at the bottom. The tool
49
- // states nothing; the archive draft's dates being NEWER than the head's is
50
- // the whole signal, and it is arithmetic on extracted dates.
51
- const content = [
52
- '## 2026-06-11 — oldest',
53
- '- entry a',
54
- '## 2026-07-02 — older',
55
- '- entry b',
56
- '## 2026-07-20 — later',
57
- '- entry c',
58
- '## 2026-08-01 — later still',
59
- '- entry d',
60
- '## 2026-08-05 — newest',
61
- '- entry e',
62
- ].join('\n');
63
- const r = collectDateEvidence(content, 6);
64
- expect(r.head.latest).toBe('2026-07-20');
65
- expect(r.archive.earliest).toBe('2026-08-01');
66
- // The archive draft is entirely NEWER than the head draft.
67
- expect(r.archive.earliest > r.head.latest).toBe(true);
68
- });
69
- it('exposes no direction, verdict or agreement score at all', () => {
70
- const content = [
71
- '## 2026-08-05 a',
72
- '## 2026-08-04 b',
73
- '## 2026-08-02 c',
74
- '## 2026-07-30 d',
75
- ].join('\n');
76
- const r = collectDateEvidence(content, 2);
77
- const keys = Object.keys(r).sort();
78
- expect(keys).toEqual([
79
- 'allArchive',
80
- 'allDateCount',
81
- 'allHead',
82
- 'archive',
83
- 'dates',
84
- 'firstDate',
85
- 'head',
86
- 'lastDate',
87
- 'population',
88
- 'readingsConflict',
89
- ]);
90
- expect(JSON.stringify(r)).not.toMatch(/newest-at|inference|contradicts|agree/i);
91
- });
92
- it('handles bracketed [YYYY-MM-DD] section headers', () => {
93
- const content = [
94
- '[2026-08-05] newest note',
95
- '[2026-08-03] older note',
96
- '[2026-08-01] older note',
97
- '[2026-07-28] oldest note',
98
- ].join('\n');
99
- const r = collectDateEvidence(content, 2);
100
- expect(r.population).toBe('section-anchor');
101
- expect(r.dates.length).toBe(4);
102
- });
103
- it('reports zero dates for an undateable doc rather than inventing a range', () => {
104
- const content = Array.from({ length: 20 }, (_, i) => `- entry ${i} with no date at all`).join('\n');
105
- const r = collectDateEvidence(content, 10);
106
- expect(r.dates).toEqual([]);
107
- expect(r.head).toEqual({ count: 0 });
108
- expect(r.archive).toEqual({ count: 0 });
109
- });
110
- it('still reports the dates it found when there are only a few', () => {
111
- const content = ['## 2026-08-05 a', 'body', '## 2026-08-01 b', 'body'].join('\n');
112
- const r = collectDateEvidence(content, 2);
113
- expect(r.dates.length).toBe(2);
114
- expect(r.dates.length).toBeLessThan(MIN_ANCHOR_DATES);
115
- });
116
- it('prefers structural anchor dates over prose dates when anchors are plentiful', () => {
117
- const content = [
118
- '## 2026-08-05 newest — see the note from 2026-01-01',
119
- '## 2026-08-04 next — see the note from 2026-02-01',
120
- '## 2026-08-03 next — see the note from 2026-03-01',
121
- '## 2026-08-02 next — see the note from 2026-04-01',
122
- '## 2026-08-01 oldest — see the note from 2026-05-01',
123
- ].join('\n');
124
- const r = collectDateEvidence(content, 3);
125
- expect(r.population).toBe('section-anchor');
126
- expect(r.dates).toEqual([
127
- '2026-08-05',
128
- '2026-08-04',
129
- '2026-08-03',
130
- '2026-08-02',
131
- '2026-08-01',
132
- ]);
133
- });
134
- it('falls back to all-lines dates when anchors are too sparse', () => {
135
- const content = [
136
- 'a long preamble sentence that pushes the date well past the line start 2026-08-05',
137
- 'another long preamble sentence pushing the date past the line start 2026-08-04',
138
- 'a third long preamble sentence pushing the date past the line start 2026-08-03',
139
- 'a fourth long preamble sentence pushing the date past the line start 2026-08-02',
140
- ].join('\n');
141
- const r = collectDateEvidence(content, 2);
142
- expect(r.population).toBe('all-lines');
143
- expect(r.dates.length).toBe(4);
144
- });
145
- it('is consistent with the boundary splitForArchive actually chose', () => {
146
- const content = [
147
- '# Doc',
148
- '## 2026-08-05 a',
149
- 'body a',
150
- '## 2026-08-04 b',
151
- 'body b',
152
- '## 2026-08-03 c',
153
- 'body c',
154
- '## 2026-08-02 d',
155
- 'body d',
156
- ].join('\n');
157
- const split = splitForArchive(content);
158
- const r = collectDateEvidence(content, split.boundary);
159
- expect(r.head.count + r.archive.count).toBe(r.dates.length);
160
- });
161
- });
162
- // ── The two delta-review documents that produced a WRONG verdict ─────────────
163
- //
164
- // Both defeated the ordering classifier: it printed, in red bold, that the
165
- // split was inverted and told the operator to swap the drafts. An operator who
166
- // obeys archives their newest entries — the safety check causes the incident.
167
- // There is now no direction in the output to be wrong.
168
- describe('collectDateEvidence — the delta-review documents', () => {
169
- /** Category headings with ascending dated sub-bullets underneath each. */
170
- const categoryDoc = [
171
- '## Retrieval',
172
- '- 2026-01-04 first observed',
173
- '- 2026-02-11 triage',
174
- '- 2026-03-09 partial fix',
175
- '## Coordination',
176
- '- 2026-01-06 first observed',
177
- '- 2026-02-14 triage',
178
- '- 2026-03-12 recurrence confirmed',
179
- '## Platform',
180
- '- 2026-01-09 first observed',
181
- '- 2026-02-20 triage',
182
- '- 2026-03-18 still open',
183
- ].join('\n');
184
- /** 5 entries, headings strictly DESCENDING, each with 4 ASCENDING sub-bullets. */
185
- const subBulletDoc = [
186
- '## 2026-08-05 — entry 0',
187
- '## 2026-08-01 — entry 1',
188
- '## 2026-07-20 — entry 2',
189
- '## 2026-07-02 — entry 3',
190
- '## 2026-06-11 — entry 4',
191
- ]
192
- .map((h) => [
193
- h,
194
- ' - 2026-01-01 first observed',
195
- ' - 2026-01-02 triage',
196
- ' - 2026-01-03 partial fix',
197
- ' - 2026-01-04 recurrence confirmed',
198
- ].join('\n'))
199
- .join('\n');
200
- for (const [label, doc, boundary] of [
201
- ['category-heading document', categoryDoc, 6],
202
- ['dated-sub-bullet document', subBulletDoc, 12],
203
- ]) {
204
- it(`${label}: states no ordering direction`, () => {
205
- const r = collectDateEvidence(doc, boundary);
206
- expect(JSON.stringify(r)).not.toMatch(/newest-at|inverted|swap/i);
207
- });
208
- it(`${label}: reports a date range for each draft`, () => {
209
- const r = collectDateEvidence(doc, boundary);
210
- expect(r.head.count).toBeGreaterThan(0);
211
- expect(r.archive.count).toBeGreaterThan(0);
212
- for (const range of [r.head, r.archive]) {
213
- expect(range.earliest).toMatch(/^\d{4}-\d{2}-\d{2}$/);
214
- expect(range.latest).toMatch(/^\d{4}-\d{2}-\d{2}$/);
215
- expect(range.earliest <= range.latest).toBe(true);
216
- }
217
- });
218
- it(`${label}: the printed report contains no verdict`, () => {
219
- const out = captureOutput(() => printSafetyChecks(collectDateEvidence(doc, boundary), NO_ORPHANS));
220
- expect(out).not.toMatch(/Match: (YES|NO)/);
221
- expect(out).not.toMatch(/INVERTED FOR THIS DOCUMENT/);
222
- expect(out).not.toMatch(/Swap the two drafts/);
223
- expect(out).toContain('YOU must determine this');
224
- });
225
- }
226
- it('sub-bullet document: the head draft range is a fact, not an inference', () => {
227
- // The heading dates descend and the sub-bullet dates ascend. Reported as
228
- // ranges, both populations simply widen the range — no vote, no winner.
229
- const r = collectDateEvidence(subBulletDoc, 12);
230
- expect(r.head.earliest).toBe('2026-01-01');
231
- expect(r.head.latest).toBe('2026-08-05');
232
- });
233
- });
234
- // ── The silently-dropped-dates document ──────────────────────────────────────
235
- //
236
- // `ANCHOR_LINE_RE` requires the date to be the line's leading content, so
237
- // `## Iteration 12 — 2026-08-05` is not an anchor and its date was discarded
238
- // with no mention in the report. This document is genuinely newest-at-bottom —
239
- // the split IS inverted — but the surviving anchor sample says the archive is
240
- // cleanly older, because old entries carry recent status-refresh bullets and new
241
- // entries cite old first-observed dates. Both halves occur in real documents.
242
- // The operator applies the printed rule to a filtered sample and archives their
243
- // newest entries.
244
- const droppedDatesDoc = [
245
- '## Iteration 9 — 2026-06-01',
246
- '- 2026-08-04 still open as of today',
247
- '- 2026-08-03 status refreshed',
248
- '## Iteration 10 — 2026-06-15',
249
- '- 2026-08-05 still open as of today',
250
- '- 2026-08-02 status refreshed',
251
- '## Iteration 11 — 2026-07-20',
252
- '- 2026-01-04 first observed upstream',
253
- '- 2026-01-03 first observed upstream',
254
- '## Iteration 12 — 2026-08-05',
255
- '- 2026-01-02 first observed upstream',
256
- '- 2026-01-01 first observed upstream',
257
- ].join('\n');
258
- describe('collectDateEvidence — dates the anchor filter drops', () => {
259
- it('counts every date in the document, not only the anchors', () => {
260
- const r = collectDateEvidence(droppedDatesDoc, 6);
261
- expect(r.population).toBe('section-anchor');
262
- expect(r.dates).toHaveLength(8); // the bullet dates
263
- expect(r.allDateCount).toBe(12); // plus the four heading dates
264
- });
265
- it('reports the anchor ranges AND the unfiltered ranges', () => {
266
- const r = collectDateEvidence(droppedDatesDoc, 6);
267
- // Anchor-only reading: the archive looks cleanly older. It is not.
268
- expect(r.head).toEqual({ count: 4, earliest: '2026-08-02', latest: '2026-08-05' });
269
- expect(r.archive).toEqual({ count: 4, earliest: '2026-01-01', latest: '2026-01-04' });
270
- // Counting every date, the two drafts overlap — the heading dates that the
271
- // anchor filter dropped are the entry dates.
272
- expect(r.allHead).toEqual({ count: 6, earliest: '2026-06-01', latest: '2026-08-05' });
273
- expect(r.allArchive).toEqual({ count: 6, earliest: '2026-01-01', latest: '2026-08-05' });
274
- });
275
- it('flags that the two readings disagree', () => {
276
- const r = collectDateEvidence(droppedDatesDoc, 6);
277
- expect(relateDrafts(r.head, r.archive)).toBe('archive-older');
278
- expect(relateDrafts(r.allHead, r.allArchive)).toBe('overlapping');
279
- expect(r.readingsConflict).toBe(true);
280
- });
281
- it('the printed report shows both readings and the disagreement', () => {
282
- const out = captureOutput(() => printSafetyChecks(collectDateEvidence(droppedDatesDoc, 6), NO_ORPHANS));
283
- expect(out).toContain('4 further date(s) on non-anchor lines were not counted above');
284
- expect(out).toContain('Counting EVERY date instead');
285
- expect(out).toContain('earliest 2026-06-01, latest 2026-08-05 (6 dates)'); // allHead
286
- expect(out).toContain('earliest 2026-01-01, latest 2026-08-05 (6 dates)'); // allArchive
287
- expect(out).toContain('DISAGREE about which draft holds the older entries');
288
- expect(out).toContain('Neither reading is');
289
- // Still no verdict of any kind.
290
- expect(out).not.toMatch(/Match: (YES|NO)/);
291
- expect(out).not.toMatch(/newest-at-(TOP|BOTTOM)/);
292
- expect(out).not.toMatch(/Swap the two drafts/);
293
- });
294
- it('does not flag a disagreement when no dates were dropped', () => {
295
- const clean = [
296
- '## 2026-08-05 a',
297
- '## 2026-08-01 b',
298
- '## 2026-07-20 c',
299
- '## 2026-07-02 d',
300
- ].join('\n');
301
- const r = collectDateEvidence(clean, 2);
302
- expect(r.allDateCount).toBe(r.dates.length);
303
- expect(r.readingsConflict).toBe(false);
304
- const out = captureOutput(() => printSafetyChecks(r, NO_ORPHANS));
305
- expect(out).not.toContain('not counted above');
306
- expect(out).not.toContain('DISAGREE');
307
- });
308
- it('reports the dropped dates even when the two readings agree', () => {
309
- // The note is unconditional on dropped dates; only the DISAGREE banner is
310
- // conditional. A filtered sample must never be presented as the whole
311
- // document, agreement or not.
312
- const doc = [
313
- '## Entry A — 2026-08-05',
314
- '- 2026-08-04 note',
315
- '- 2026-08-03 note',
316
- '## Entry B — 2026-08-02',
317
- '- 2026-07-04 note',
318
- '- 2026-07-03 note',
319
- ].join('\n');
320
- const r = collectDateEvidence(doc, 3);
321
- expect(r.readingsConflict).toBe(false);
322
- const out = captureOutput(() => printSafetyChecks(r, NO_ORPHANS));
323
- expect(out).toContain('2 further date(s) on non-anchor lines were not counted above');
324
- expect(out).not.toContain('DISAGREE');
325
- });
326
- });
327
- describe('relateDrafts', () => {
328
- it('reports which range sits wholly before the other, or overlapping', () => {
329
- const older = { count: 2, earliest: '2026-01-01', latest: '2026-01-31' };
330
- const newer = { count: 2, earliest: '2026-06-01', latest: '2026-06-30' };
331
- expect(relateDrafts(newer, older)).toBe('archive-older');
332
- expect(relateDrafts(older, newer)).toBe('head-older');
333
- expect(relateDrafts(older, { count: 2, earliest: '2026-01-15', latest: '2026-03-01' })).toBe('overlapping');
334
- });
335
- it('reports insufficient when either draft has no dates', () => {
336
- expect(relateDrafts({ count: 0 }, { count: 1, earliest: 'a', latest: 'a' })).toBe('insufficient');
337
- expect(relateDrafts({ count: 1, earliest: 'a', latest: 'a' }, { count: 0 })).toBe('insufficient');
338
- });
339
- });
340
- // ── Check 2: orphaned identifiers ────────────────────────────────────────────
341
- describe('extractIdentifiers', () => {
342
- it('extracts KI- slugs and #NNNN issue refs, unique and in order', () => {
343
- const text = '- **KI-CODEX-SPAWN-GATE (P2, OPEN, #4227)** — see #4227 and KI-CODEX-SPAWN-GATE again. Also #512.';
344
- expect(extractIdentifiers(text)).toEqual(['KI-CODEX-SPAWN-GATE', '#4227', '#512']);
345
- });
346
- it('captures a two-digit #NN issue ref and ignores a bare single digit', () => {
347
- // This assertion USED to require #12 to be ignored (`#\d{3,}`). Re-examined
348
- // after MF-3: two-digit issue numbers exist in this repo's history, and the
349
- // cost of the two directions is not symmetric. A missed identifier means an
350
- // open entry moves to the archive with the orphan count reading zero —
351
- // silent, with no artifact. A false positive adds one line to an advisory
352
- // list a human is already reading. So `#\d{2,}`.
353
- expect(extractIdentifiers('bumped to #12 and v2 #7')).toEqual(['#12']);
354
- });
355
- it('does not swallow a trailing hyphen into the slug', () => {
356
- expect(extractIdentifiers('KI-FOO-BAR — text')).toEqual(['KI-FOO-BAR']);
357
- });
358
- });
359
- describe('findOrphanedIdentifiers', () => {
360
- it('reports an identifier present only in the archive half', () => {
361
- const head = '- **KI-KEPT (P1, OPEN, #4001)** — still live.';
362
- const archive = '- **KI-GONE (P2, OPEN, #4002)** — moved out.';
363
- const r = findOrphanedIdentifiers(head, archive);
364
- expect(r.orphaned).toEqual(['KI-GONE', '#4002']);
365
- expect(r.retained).toEqual([]);
366
- });
367
- it('does NOT report an identifier present in BOTH halves', () => {
368
- const head = '- **KI-BOTH (P2, OPEN, #4002)** — index line. Full text: archive-1.';
369
- const archive = '- **KI-BOTH (P2, OPEN, #4002)** — the full narrative lives here.';
370
- const r = findOrphanedIdentifiers(head, archive);
371
- expect(r.orphaned).toEqual([]);
372
- expect(r.retained).toEqual(['KI-BOTH', '#4002']);
373
- });
374
- it('counts a mixed document correctly (platform incident shape)', () => {
375
- const head = ['# Live head', '- **KI-A (P1, OPEN, #4001)** — index stub. Full text: archive-1.'].join('\n');
376
- const archive = [
377
- '- **KI-A (P1, OPEN, #4001)** — full text.',
378
- '- **KI-B (P2, OPEN, #4002)** — full text.',
379
- '- **KI-C (P3, OPEN, #4003)** — full text.',
380
- ].join('\n');
381
- const r = findOrphanedIdentifiers(head, archive);
382
- expect(r.archiveIdentifiers).toHaveLength(6);
383
- expect(r.orphaned).toEqual(['KI-B', '#4002', 'KI-C', '#4003']);
384
- expect(r.retained).toEqual(['KI-A', '#4001']);
385
- });
386
- it('reports nothing when the archive holds no identifiers', () => {
387
- const r = findOrphanedIdentifiers('head text', 'archive prose with no identifiers');
388
- expect(r.orphaned).toEqual([]);
389
- });
390
- });
391
- // ── Check 3: every orphan needs a stub, unconditionally ─────────────────────
392
- //
393
- // The lines below are the ones that defeated the removed status classifier —
394
- // (a) and (b) verbatim from the live platform known-issues document. Each was
395
- // bucketed RESOLVED, which published a stub count that omitted an open entry.
396
- // A later revision kept them as display-only notes; executed on (a) and (b) the
397
- // notes fired 12 times and were right once, so they went too. The assertion is
398
- // now the same for all of them: the stub requirement is the orphan count, and
399
- // nothing in the report qualifies it.
400
- describe('index stubs — the orphan count IS the stub requirement', () => {
401
- it('an explicitly-resolved entry is still an orphan and still needs a stub', () => {
402
- const archive = '- **KI-DONE (P2, RESOLVED, #4010)** — the guard now rejects the case.';
403
- const r = findOrphanedIdentifiers('# empty head', archive);
404
- expect(r.orphaned).toEqual(['KI-DONE', '#4010']);
405
- });
406
- it('(a) a round-up line: every listed identifier needs a stub (verbatim real line)', () => {
407
- // "NEW-12/13/14/15 … CLOSED" used to resolve the two Deferred Should Fix
408
- // slugs listed beside it. They were OPEN. The CLOSED belongs to the
409
- // tool_input removal, which is not any of them.
410
- const archive = '**ROUND 3 (2026-07-31, commit 523dde2f7): PASS, 0 Must Fix.** NEW-12/13/14/15 + tool_input removal CLOSED (verified empirically, 16 config states). Deferred Should Fix, full text archive-2: KI-CODEX-TOML-MULTILINE-SMUGGLE (P3, NEW-18), KI-CODEX-CONFIG-READ-NO-SIZE-CHECK (P4, NEW-19), INFO NEW-20 (quoted-path/dotted-key trust reads untrusted).';
411
- const r = findOrphanedIdentifiers('# empty head', archive);
412
- expect(r.orphaned).toEqual(expect.arrayContaining([
413
- 'KI-CODEX-TOML-MULTILINE-SMUGGLE',
414
- 'KI-CODEX-CONFIG-READ-NO-SIZE-CHECK',
415
- 'NEW-18',
416
- 'NEW-19',
417
- 'NEW-20',
418
- ]));
419
- const out = captureOutput(() => printSafetyChecks(evidence({}), r));
420
- expect(out).toContain(`${r.orphaned.length} identifier(s) would become unfindable`);
421
- expect(out).not.toMatch(/CLOSED/);
422
- });
423
- it('(b) one CLOSED sub-clause does not excuse the four issues filed beside it (verbatim real line)', () => {
424
- const archive = '- NEW ISSUES FILED 2026-08-01: #4813 (checkpoint-reminder + idle-gate ambient-context bug — CLOSED by PR #4810), #4823 (session startup names a recovery path in its error text and never attempts it — a team can be bricked with a working permission cache sitting unused), #4828 (SF-7 common-mode, above), #4830 (nothing surfaces an agent/task tool-capability mismatch until the agent burns a round-trip).';
425
- const r = findOrphanedIdentifiers('# empty head', archive);
426
- for (const id of ['#4813', '#4823', '#4828', '#4830', 'SF-7']) {
427
- expect(r.orphaned).toContain(id);
428
- }
429
- });
430
- it('(c) a cross-reference does not excuse the entry it points at', () => {
431
- const archive = [
432
- '- **KI-A (P2, RESOLVED, #4050)** — superseded by #4051.',
433
- '- **#4051** — the retry loop never terminates.',
434
- ].join('\n');
435
- const r = findOrphanedIdentifiers('# empty head', archive);
436
- expect(r.orphaned).toEqual(['KI-A', '#4050', '#4051']);
437
- });
438
- it('(d) an ALL-CAPS sub-part resolution does not excuse the entry', () => {
439
- const archive = [
440
- '- **KI-OPEN-ONE (P1, #4300)** — the guard never fires on Windows;',
441
- ' the Linux half was RESOLVED, the Windows half was not looked at.',
442
- ].join('\n');
443
- const r = findOrphanedIdentifiers('# empty head', archive);
444
- expect(r.orphaned).toEqual(['KI-OPEN-ONE', '#4300']);
445
- });
446
- it('(e) a bolded **Status:** OPEN entry with a RESOLVED sub-issue still needs a stub', () => {
447
- const archive = [
448
- '- **KI-BOLDSTATUS (P1, #4099)** — the gate never fires.',
449
- ' **Status:** OPEN. A sub-issue was RESOLVED in #4100.',
450
- ].join('\n');
451
- const r = findOrphanedIdentifiers('# empty head', archive);
452
- expect(r.orphaned).toEqual(['KI-BOLDSTATUS', '#4099', '#4100']);
453
- });
454
- it('"fixed" in prose about a SUB-PART is not a reason to skip the stub', () => {
455
- const archive = '- **KI-SUBPART (P2, #4012)** — the ASCII path is fixed; treat as open until confirmed, not resolved.';
456
- const r = findOrphanedIdentifiers('# empty head', archive);
457
- expect(r.orphaned).toEqual(['KI-SUBPART', '#4012']);
458
- });
459
- });
460
- // ── MF-3 regression: identifier families that carry explicit OPEN status ──────
461
- describe('extractIdentifiers — MF-3 missed families', () => {
462
- it('extracts every identifier family the corpus actually uses', () => {
463
- const line = 'SF-7 (P3, OPEN) / NEW-18 / PRE-SF-1 / KI-117 / #99 / COE-2026-07-03 / RT-4 / FL-14 / #4227';
464
- // Before: only KI-117 and #4227 — 2 of 9.
465
- expect(extractIdentifiers(line)).toEqual([
466
- 'SF-7',
467
- 'NEW-18',
468
- 'PRE-SF-1',
469
- 'KI-117',
470
- '#99',
471
- 'COE-2026-07-03',
472
- 'RT-4',
473
- 'FL-14',
474
- '#4227',
475
- ]);
476
- });
477
- it('keeps the SF-29a sub-part suffix', () => {
478
- expect(extractIdentifiers('SF-29a regressed')).toEqual(['SF-29a']);
479
- });
480
- it('sees the SF-N entries whose ONLY identifier is the SF number (verbatim real lines)', () => {
481
- // Twelve entries in the live document look like this. Each is tagged OPEN
482
- // and points at archive-3 for its full text. With SF-N unmatched, a split
483
- // landing above this block moved them all to the archive and the orphan
484
- // list reported ZERO — silent, no artifact.
485
- const archive = [
486
- '- SF-7 (P3, mx-guard-hook.sh:187-190, OPEN) -- quote-parity heuristic apostrophe bug can skip lint on a local push. Full text: archive-3.',
487
- '- SF-9 (P3, git-mutation-guard.sh:487-490, OPEN) -- log_override can write a false audit record when a later segment blocks. Full text: archive-3.',
488
- ].join('\n');
489
- const r = findOrphanedIdentifiers('# Live head with no references', archive);
490
- expect(r.orphaned).toEqual(['SF-7', 'SF-9']);
491
- });
492
- });
493
- describe('findUnrecognisedIdentifierTokens', () => {
494
- it('reports an identifier-shaped token the strict regex does not know', () => {
495
- expect(findUnrecognisedIdentifierTokens('- XYZ-4 (P2, OPEN) -- a family nobody taught this tool')).toContain('XYZ-4');
496
- });
497
- it('does not report tokens that ARE recognised identifiers', () => {
498
- expect(findUnrecognisedIdentifierTokens('KI-CODEX-SPAWN-GATE and SF-7 and PRE-SF-1')).toEqual([]);
499
- });
500
- it('surfaces the residual on a real report', () => {
501
- const r = findOrphanedIdentifiers('head', '- QQ-3 (P1, OPEN) -- unknown family. KI-KNOWN (P2, OPEN, #4001).');
502
- expect(r.unrecognised).toContain('QQ-3');
503
- expect(r.unrecognised).not.toContain('KI-KNOWN');
504
- });
505
- });
506
- // ── SF-1: untrusted memory content must not carry ANSI escapes to the terminal ─
507
- const ESC = String.fromCharCode(27); // a real ESC (0x1B), the byte that starts an ANSI sequence
508
- describe('stripControlChars', () => {
509
- it('removes ESC and other control characters, keeping printable text', () => {
510
- const nasty = `KI-EVIL${ESC}[2K${ESC}[1AORPHANED: 0`;
511
- expect(stripControlChars(nasty)).toBe('KI-EVIL[2K[1AORPHANED: 0');
512
- expect(stripControlChars(nasty)).not.toContain(ESC);
513
- });
514
- it('strips control characters out of the orphan list printed by the report', () => {
515
- const orphans = {
516
- ...NO_ORPHANS,
517
- archiveIdentifiers: [`KI-EVIL${ESC}[2K`],
518
- orphaned: [`KI-EVIL${ESC}[2K`],
519
- };
520
- const out = captureOutput(() => printSafetyChecks(evidence({}), orphans));
521
- expect(out).not.toContain(ESC);
522
- });
523
- });
524
- // ── MF-4: the head draft is the only copy of the operator's hand-added stubs ──
525
- describe('buildHeadDraft — provenance stamp', () => {
526
- it('stamps generation time and source size so a stale draft is self-identifying', () => {
527
- const draft = buildHeadDraft('mem', 'head', 'mem-archive-1', '2026-08-06', 47210, '2026-08-06T09:00:00.000Z');
528
- expect(draft).toContain('_Generated 2026-08-06T09:00:00.000Z by archive-prep from a 47210-char head_');
529
- });
530
- });
531
- // ── printSafetyChecks: the display branch had ZERO coverage until a QA finding ─
532
- //
533
- // The old display was mutated to always take the "Match: YES" path and all 89
534
- // tests still passed: the tool would have told an operator the split was fine on
535
- // a document it had itself determined was inverted. There is no Match line any
536
- // more, so the assertions below pin the evidence the operator reads instead.
537
- function captureOutput(fn) {
538
- const chunks = [];
539
- const spy = vi.spyOn(console, 'log').mockImplementation((...args) => {
540
- chunks.push(args.map(String).join(' '));
541
- });
542
- try {
543
- fn();
544
- }
545
- finally {
546
- spy.mockRestore();
547
- }
548
- return chunks.join('\n');
549
- }
550
- const NO_ORPHANS = {
551
- archiveIdentifiers: [],
552
- headIdentifiers: [],
553
- orphaned: [],
554
- retained: [],
555
- unrecognised: [],
556
- };
557
- function evidence(over) {
558
- return {
559
- population: 'section-anchor',
560
- dates: ['2026-08-05', '2026-08-01', '2026-07-20', '2026-07-02'],
561
- firstDate: '2026-08-05',
562
- lastDate: '2026-07-02',
563
- head: { count: 2, earliest: '2026-08-01', latest: '2026-08-05' },
564
- archive: { count: 2, earliest: '2026-07-02', latest: '2026-07-20' },
565
- allDateCount: 4,
566
- allHead: { count: 2, earliest: '2026-08-01', latest: '2026-08-05' },
567
- allArchive: { count: 2, earliest: '2026-07-02', latest: '2026-07-20' },
568
- readingsConflict: false,
569
- ...over,
570
- };
571
- }
572
- describe('printSafetyChecks', () => {
573
- afterEach(() => vi.restoreAllMocks());
574
- it('prints a date range for each draft and asks the operator to decide', () => {
575
- const out = captureOutput(() => printSafetyChecks(evidence({}), NO_ORPHANS));
576
- expect(out).toContain('YOU must determine this; the tool cannot');
577
- expect(out).toContain('KEPT HEAD draft');
578
- expect(out).toContain('earliest 2026-08-01, latest 2026-08-05 (2 dates)');
579
- expect(out).toContain('ARCHIVE draft');
580
- expect(out).toContain('earliest 2026-07-02, latest 2026-07-20 (2 dates)');
581
- expect(out).toContain('First date in the file: 2026-08-05');
582
- expect(out).toContain('Last date in the file: 2026-07-02');
583
- });
584
- it('never states an ordering direction, on any input', () => {
585
- for (const ev of [
586
- evidence({}),
587
- evidence({ head: { count: 2, earliest: '2026-07-02', latest: '2026-07-20' }, archive: { count: 2, earliest: '2026-08-01', latest: '2026-08-05' } }),
588
- evidence({ dates: [], firstDate: undefined, lastDate: undefined, head: { count: 0 }, archive: { count: 0 } }),
589
- ]) {
590
- const out = captureOutput(() => printSafetyChecks(ev, NO_ORPHANS));
591
- expect(out).not.toMatch(/Match: (YES|NO)/);
592
- expect(out).not.toMatch(/newest-at-(TOP|BOTTOM)/);
593
- expect(out).not.toMatch(/Swap the two drafts/);
594
- expect(out).not.toMatch(/PROBABLY INVERTED/);
595
- }
596
- });
597
- it('states the inversion CONSEQUENCE without claiming it happened', () => {
598
- const out = captureOutput(() => printSafetyChecks(evidence({}), NO_ORPHANS));
599
- expect(out).toContain("If the archive draft's dates are NOT older");
600
- expect(out).toContain('do not carry over an answer');
601
- });
602
- it('says so plainly when the document carries no dates', () => {
603
- const out = captureOutput(() => printSafetyChecks(evidence({ dates: [], firstDate: undefined, lastDate: undefined, head: { count: 0 }, archive: { count: 0 } }), NO_ORPHANS));
604
- expect(out).toContain('No dates found');
605
- expect(out).toContain('by hand');
606
- });
607
- it('reports how many dates were found when they are too few to characterise a draft', () => {
608
- const out = captureOutput(() => printSafetyChecks(evidence({
609
- dates: ['2026-08-05', '2026-08-01'],
610
- head: { count: 1, earliest: '2026-08-05', latest: '2026-08-05' },
611
- archive: { count: 1, earliest: '2026-08-01', latest: '2026-08-01' },
612
- }), NO_ORPHANS));
613
- expect(out).toContain('Only 2 date(s)');
614
- expect(out).toContain('by hand');
615
- });
616
- it('a non-zero orphan count is printed with its warning and the identifiers listed', () => {
617
- const orphans = {
618
- archiveIdentifiers: ['KI-A', 'SF-7'],
619
- headIdentifiers: [],
620
- orphaned: ['KI-A', 'SF-7'],
621
- retained: [],
622
- unrecognised: [],
623
- };
624
- const out = captureOutput(() => printSafetyChecks(evidence({}), orphans));
625
- expect(out).toContain('ORPHANED: 2');
626
- expect(out).toContain('KI-A');
627
- expect(out).toContain('SF-7');
628
- expect(out).toContain('loses its last reference');
629
- expect(out).toContain('2 identifier(s) would become unfindable');
630
- expect(out).toContain('each needs an index');
631
- });
632
- it('a zero orphan count does not print the loss warning', () => {
633
- const out = captureOutput(() => printSafetyChecks(evidence({}), NO_ORPHANS));
634
- expect(out).toContain('ORPHANED: 0');
635
- expect(out).not.toContain('loses its last reference');
636
- });
637
- it('prints no status annotation of any kind against an orphan', () => {
638
- // A display-only "resolution-shaped words appear nearby" note used to sit
639
- // here. Executed on two real corpus lines it fired 12 times and was right
640
- // once — on one live line, wrong six times out of six, because the CLOSED
641
- // belonged to a different subject than the six items listed beside it. It
642
- // fired densest on round-up lines, which is exactly where stubs matter most.
643
- const archive = [
644
- '- **KI-DONE (P2, RESOLVED, #4010)** — shipped in 0.1.80.',
645
- '- NEW ISSUES FILED 2026-08-01: #4813 (bug — CLOSED by PR #4810), #4823 (open).',
646
- ].join('\n');
647
- const orphans = findOrphanedIdentifiers('# empty head', archive);
648
- const out = captureOutput(() => printSafetyChecks(evidence({}), orphans));
649
- expect(out).toContain(`${orphans.orphaned.length} identifier(s) would become unfindable`);
650
- expect(out).not.toMatch(/appears nearby/);
651
- expect(out).not.toMatch(/RESOLVED|CLOSED/);
652
- expect(out).not.toMatch(/reading aid/i);
653
- });
654
- it('unrecognised identifier-shaped tokens are reported loudly', () => {
655
- const orphans = { ...NO_ORPHANS, unrecognised: ['QQ-3'] };
656
- const out = captureOutput(() => printSafetyChecks(evidence({}), orphans));
657
- expect(out).toContain('Unrecognised identifier-shaped tokens');
658
- expect(out).toContain('QQ-3');
659
- });
660
- });
661
- // ── MF-4 regression: re-running archive-prep must not destroy the head draft ──
662
- //
663
- // Step 2 of next-steps tells the operator to hand-add an index stub for every
664
- // orphan INTO THE HEAD DRAFT, so that file becomes the only copy of the
665
- // mitigation. Step 3 (`mx memories create`) can fail — outage, shrink-guard
666
- // hook, typo — and the natural recovery is to re-run archive-prep. On a re-run
667
- // `nextArchiveN` returns a different N so the ARCHIVE draft goes to a new path,
668
- // but the head path is a fixed function of `name` and was overwritten with no
669
- // existence check, no prompt and no backup.
670
- vi.mock('../lib/memory.js', () => ({
671
- isMxAvailable: () => true,
672
- readNamedMemoryJson: (name) => name.includes('-archive-')
673
- ? { status: 'absent' }
674
- : { status: 'present', content: '# Doc\n\n## 2026-08-05 a\nbody a\n\n## 2026-08-01 b\nbody b\n' },
675
- }));
676
- describe('runArchivePrep — draft clobber protection', () => {
677
- let dir;
678
- beforeEach(() => {
679
- dir = mkdtempSync(join(tmpdir(), 'archive-prep-'));
680
- });
681
- afterEach(() => {
682
- rmSync(dir, { recursive: true, force: true });
683
- vi.restoreAllMocks();
684
- });
685
- /** Run the command with console/exit silenced; returns the exit code, if any. */
686
- async function run(opts) {
687
- vi.spyOn(console, 'log').mockImplementation(() => { });
688
- vi.spyOn(console, 'error').mockImplementation(() => { });
689
- let code;
690
- const exit = vi.spyOn(process, 'exit').mockImplementation(((c) => {
691
- code = c;
692
- throw new Error('__exit__');
693
- }));
694
- try {
695
- await runArchivePrep({ name: opts.name, cwd: dir, force: opts.force });
696
- }
697
- catch (e) {
698
- if (!(e instanceof Error) || e.message !== '__exit__')
699
- throw e;
700
- }
701
- finally {
702
- exit.mockRestore();
703
- }
704
- return code;
705
- }
706
- it('refuses to overwrite an existing head draft, and leaves its contents intact', async () => {
707
- const headPath = join(dir, 'memnexus-doc.head.draft.md');
708
- const handEdited = '# Doc\n\n- **KI-OPEN (P1, OPEN, #4001)** — hand-added stub. Full text: archive-1.\n';
709
- writeFileSync(headPath, handEdited, 'utf-8');
710
- const code = await run({ name: 'memnexus-doc' });
711
- expect(code).toBe(1);
712
- expect(readFileSync(headPath, 'utf-8')).toBe(handEdited);
713
- });
714
- it('--force overwrites deliberately', async () => {
715
- const headPath = join(dir, 'memnexus-doc.head.draft.md');
716
- writeFileSync(headPath, 'stale\n', 'utf-8');
717
- const code = await run({ name: 'memnexus-doc', force: true });
718
- expect(code).toBeUndefined();
719
- const written = readFileSync(headPath, 'utf-8');
720
- expect(written).not.toBe('stale\n');
721
- expect(written).toContain('by archive-prep from a');
722
- });
723
- it('writes both drafts on a clean first run', async () => {
724
- const code = await run({ name: 'memnexus-doc' });
725
- expect(code).toBeUndefined();
726
- expect(existsSync(join(dir, 'memnexus-doc.head.draft.md'))).toBe(true);
727
- expect(existsSync(join(dir, 'memnexus-doc.archive-1.draft.md'))).toBe(true);
728
- });
729
- });
730
- // ── SF-3: the "gitignored" reassurance must be earned, not asserted ───────────
731
- describe('isGitIgnored', () => {
732
- it('reports true for a *.draft.md path inside this repo', () => {
733
- expect(isGitIgnored(join(process.cwd(), 'memnexus-doc.head.draft.md'))).toBe(true);
734
- });
735
- it('reports false outside any repository — drafts go to process.cwd(), which need not be this repo', () => {
736
- const outside = mkdtempSync(join(tmpdir(), 'not-a-repo-'));
737
- try {
738
- expect(isGitIgnored(join(outside, 'memnexus-doc.head.draft.md'))).toBe(false);
739
- }
740
- finally {
741
- rmSync(outside, { recursive: true, force: true });
742
- }
743
- });
744
- it('reports false for a path that is tracked, not ignored', () => {
745
- expect(isGitIgnored(join(process.cwd(), 'package.json'))).toBe(false);
746
- });
747
- });
748
- //# sourceMappingURL=memory-archive-checks.test.js.map