@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,955 +0,0 @@
1
- /**
2
- * Tests for #4707 — the behavioral block is read from origin/<baseBranch>, the
3
- * delivered CLAUDE.local.md is verified for CONTENT, and repeated markers fail
4
- * loudly.
5
- *
6
- * WHAT WENT WRONG. `mx-agent start` resolved the team catalog and the roleguide
7
- * from `projectRoot` — `/workspace`, the main repo working tree — which was 82
8
- * commits behind origin/main. The markers eval's roleguide gained in #4521 were
9
- * in git and had never been read, so eval shipped an isolation-only
10
- * CLAUDE.local.md for four weeks while the same startup sequence printed
11
- * "Agent config generated from … (origin/main)".
12
- *
13
- * HOW THESE TESTS ARE PINNED. Every git-vs-local test builds a repository where
14
- * the two sources DISAGREE: origin/<branch> carries one roleguide, the
15
- * projectRoot working tree carries a different one. Asserting on the CONTENT
16
- * (not merely on "a block exists") means reverting the read to projectRoot fails
17
- * the test rather than passing it by luck — which is exactly how the previous
18
- * iteration's verification passed while the outcome it claimed was false.
19
- */
20
- import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
21
- import { mkdirSync, rmSync, readFileSync, writeFileSync, symlinkSync } from 'fs';
22
- import { spawnSync } from 'child_process';
23
- import { join, dirname } from 'path';
24
- import { tmpdir } from 'os';
25
- import { checkRoleguideMarkers, extractMarkerBlock, checkBehavioralCompleteness, findMissingBehavioralElements, describeBehavioralProblem, resolveBehavioralInjection, REQUIRED_BEHAVIORAL_ELEMENTS, BEHAVIORAL_START_MARKER, BEHAVIORAL_END_MARKER, MAX_ROLEGUIDE_BYTES, MAX_BEHAVIORAL_BLOCK_BYTES, sanitizeForMessage, } from '../lib/behavioral-injection.js';
26
- import { writeClaudeLocal, writeClaudeLocalWithBehavioralSelfHeal, extractInjectedBehavioralBlock, countBehavioralHeaders, } from '../lib/claude.js';
27
- import { startupReport } from '../lib/startup-report.js';
28
- /** A behavioral block carrying all four required elements, minus `omit`. */
29
- function block(opts = {}) {
30
- const omit = opts.omit ?? [];
31
- const marker = opts.marker ?? '';
32
- const sections = [
33
- ['prior-art', [
34
- '## Prior Art Search — Mandatory Before Every Decision',
35
- '',
36
- 'Run a search before proposing any approach.',
37
- ].join('\n')],
38
- ['decision-authority', [
39
- '## Decision Authority',
40
- '',
41
- '- Full authority: iteration selection, tooling, merge timing.',
42
- ].join('\n')],
43
- ['anti-approval', [
44
- '### Anti-pattern: approval-seeking',
45
- '',
46
- 'When the data is clear, decide and execute.',
47
- ].join('\n')],
48
- ['delegation', [
49
- '## Delegation and Stop Conditions',
50
- '',
51
- '- Delegate implementation to teammates.',
52
- '- Escalate to the product owner on cost-impacting changes.',
53
- ].join('\n')],
54
- ];
55
- const body = sections
56
- .filter(([id]) => !omit.includes(id))
57
- .map(([, text]) => text)
58
- .join('\n\n');
59
- return marker ? `${marker}\n\n${body}` : body;
60
- }
61
- /** A full roleguide file wrapping `inner` in one line-anchored marker pair. */
62
- function roleguide(inner) {
63
- return [
64
- '# Roleguide',
65
- '',
66
- 'Prose above the block is never injected.',
67
- '',
68
- BEHAVIORAL_START_MARKER,
69
- inner,
70
- BEHAVIORAL_END_MARKER,
71
- '',
72
- '## Reference (not injected)',
73
- '',
74
- ].join('\n');
75
- }
76
- const RG_REL = 'mx-agent-system/roleguides/eval-leader-v3.md';
77
- function teamFile(slug, displayName, rgRel = RG_REL) {
78
- return `# Team: ${slug}\n\nDisplay name: ${displayName}\nRoleguide: \`${rgRel}\`\n`;
79
- }
80
- // ── Git helpers ───────────────────────────────────────────────────────────
81
- let tmpRoot;
82
- function git(cwd, ...args) {
83
- const r = spawnSync('git', args, { cwd, encoding: 'utf-8', stdio: 'pipe' });
84
- if (r.status !== 0) {
85
- throw new Error(`git ${args.join(' ')} failed in ${cwd}: ${r.stderr}`);
86
- }
87
- return r.stdout ?? '';
88
- }
89
- function write(root, rel, content) {
90
- const abs = join(root, rel);
91
- mkdirSync(dirname(abs), { recursive: true });
92
- writeFileSync(abs, content);
93
- }
94
- function commitAll(repo, message) {
95
- git(repo, 'add', '-A');
96
- // --allow-empty: some fixtures deliberately commit identical bytes on both
97
- // sides, and a "nothing to commit" exit would fail the setup, not the code.
98
- git(repo, '-c', 'user.email=t@t', '-c', 'user.name=T', 'commit', '-q', '--allow-empty', '-m', message);
99
- }
100
- /**
101
- * Build the #4707 topology: a bare origin, a STALE projectRoot checkout, and a
102
- * worktree whose origin/<branch> is current.
103
- *
104
- * The two checkouts deliberately hold DIFFERENT bytes for the same roleguide —
105
- * that disagreement is what makes "which source did we read?" a testable
106
- * question rather than an assumption.
107
- */
108
- function makeRepos(opts) {
109
- const branch = opts.branch ?? 'main';
110
- const slug = opts.teamSlug ?? 'eval';
111
- const origin = join(tmpRoot, 'origin.git');
112
- const projectRoot = join(tmpRoot, 'stale-checkout');
113
- const worktreePath = join(tmpRoot, 'team-worktree');
114
- git(tmpRoot, 'init', '--bare', '-q', '-b', branch, origin);
115
- // 1. projectRoot: the stale main-repo working tree.
116
- mkdirSync(projectRoot, { recursive: true });
117
- git(projectRoot, 'init', '-q', '-b', branch);
118
- write(projectRoot, `mx-agent-system/teams/${slug}.md`, opts.teamFileContent ?? teamFile(slug, opts.displayName ?? 'Eval Integrity'));
119
- write(projectRoot, RG_REL, opts.staleRoleguide);
120
- commitAll(projectRoot, 'stale state');
121
- git(projectRoot, 'remote', 'add', 'origin', origin);
122
- git(projectRoot, 'push', '-q', 'origin', branch);
123
- // 2. worktree: clone, advance the roleguide, push. projectRoot is NOT updated,
124
- // so its working tree stays behind exactly as /workspace did.
125
- git(tmpRoot, 'clone', '-q', origin, worktreePath);
126
- write(worktreePath, RG_REL, opts.currentRoleguide);
127
- commitAll(worktreePath, 'add behavioral markers');
128
- git(worktreePath, 'push', '-q', 'origin', branch);
129
- if (opts.otherBranch) {
130
- git(worktreePath, 'checkout', '-q', '-b', opts.otherBranch.name);
131
- write(worktreePath, RG_REL, opts.otherBranch.roleguide);
132
- commitAll(worktreePath, 'other branch roleguide');
133
- git(worktreePath, 'push', '-q', 'origin', opts.otherBranch.name);
134
- git(worktreePath, 'checkout', '-q', branch);
135
- }
136
- git(worktreePath, 'fetch', '-q', 'origin');
137
- return { projectRoot, worktreePath, branch };
138
- }
139
- beforeEach(() => {
140
- tmpRoot = join(tmpdir(), `mx-4707-${Date.now()}-${Math.random().toString(36).slice(2)}`);
141
- mkdirSync(tmpRoot, { recursive: true });
142
- startupReport._reset();
143
- });
144
- afterEach(() => {
145
- rmSync(tmpRoot, { recursive: true, force: true });
146
- });
147
- function warnings() {
148
- return startupReport._entries().filter((e) => e.level === 'warning');
149
- }
150
- /**
151
- * Run `fn` while capturing what actually reaches the terminal.
152
- *
153
- * `reportWarning` does two things with one string: `record()` it into the
154
- * startup report AFTER stripping control sequences, and `printOut()` it to the
155
- * console RAW. So the report is clean by construction and proves nothing about
156
- * escape injection; only the printed bytes do.
157
- */
158
- function capturePrinted(fn) {
159
- const printed = [];
160
- const log = vi.spyOn(console, 'log').mockImplementation((...args) => {
161
- printed.push(args.map(String).join(' '));
162
- });
163
- try {
164
- fn();
165
- }
166
- finally {
167
- log.mockRestore();
168
- }
169
- return printed.join('\n');
170
- }
171
- // ── 1. The read resolves from origin/<baseBranch>, not projectRoot ────────
172
- describe('#4707 — roleguide bytes come from origin/<baseBranch>', () => {
173
- it('reads the ref, NOT the stale projectRoot working tree', () => {
174
- const { projectRoot, worktreePath } = makeRepos({
175
- staleRoleguide: roleguide(block({ marker: 'STALE-WORKING-TREE-CONTENT' })),
176
- currentRoleguide: roleguide(block({ marker: 'CURRENT-REF-CONTENT' })),
177
- });
178
- const res = resolveBehavioralInjection(projectRoot, 'eval', {
179
- repoPath: worktreePath, baseBranch: 'main',
180
- });
181
- expect(res.source).toBe('git');
182
- expect(res.ref).toBe('origin/main');
183
- expect(res.fallbackReason).toBeNull();
184
- expect(res.result.ok).toBe(true);
185
- // MUTATION PIN: a read from projectRoot returns a block that is present and
186
- // non-empty too, so only the CONTENT distinguishes the two sources.
187
- expect(res.result.content).toContain('CURRENT-REF-CONTENT');
188
- expect(res.result.content).not.toContain('STALE-WORKING-TREE-CONTENT');
189
- });
190
- it('uses the CONFIGURED base branch, not a hardcoded "main"', () => {
191
- const { projectRoot, worktreePath } = makeRepos({
192
- staleRoleguide: roleguide(block({ marker: 'STALE-WORKING-TREE-CONTENT' })),
193
- currentRoleguide: roleguide(block({ marker: 'MAIN-BRANCH-CONTENT' })),
194
- otherBranch: { name: 'develop', roleguide: roleguide(block({ marker: 'DEVELOP-BRANCH-CONTENT' })) },
195
- });
196
- const res = resolveBehavioralInjection(projectRoot, 'eval', {
197
- repoPath: worktreePath, baseBranch: 'develop',
198
- });
199
- expect(res.ref).toBe('origin/develop');
200
- expect(res.result.content).toContain('DEVELOP-BRANCH-CONTENT');
201
- expect(res.result.content).not.toContain('MAIN-BRANCH-CONTENT');
202
- });
203
- it('the ref read is not fooled by a symlinked roleguide committed into git', () => {
204
- // A tree entry records the mode: a symlink is 120000 with the target as its
205
- // blob content. Reading it would put out-of-repo bytes into every turn of
206
- // this team's context while showing nothing in a diff.
207
- const { projectRoot, worktreePath } = makeRepos({
208
- staleRoleguide: roleguide(block()),
209
- currentRoleguide: roleguide(block()),
210
- });
211
- const secret = join(tmpRoot, 'outside-secret.md');
212
- writeFileSync(secret, roleguide(block({ marker: 'OUT-OF-REPO-CONTENT' })));
213
- const rgAbs = join(worktreePath, RG_REL);
214
- rmSync(rgAbs);
215
- symlinkSync(secret, rgAbs);
216
- commitAll(worktreePath, 'replace roleguide with a symlink');
217
- git(worktreePath, 'push', '-q', 'origin', 'main');
218
- git(worktreePath, 'fetch', '-q', 'origin');
219
- const res = resolveBehavioralInjection(projectRoot, 'eval', {
220
- repoPath: worktreePath, baseBranch: 'main',
221
- });
222
- expect(res.source).toBe('git');
223
- expect(res.result.ok).toBe(false);
224
- expect(res.result.problem).toBe('roleguide-symlink');
225
- expect(res.result.content).toBeNull();
226
- });
227
- it('rejects a team slug that could escape the pathspec, without touching disk', () => {
228
- const { projectRoot, worktreePath } = makeRepos({
229
- staleRoleguide: roleguide(block()),
230
- currentRoleguide: roleguide(block()),
231
- });
232
- for (const slug of ['../../etc/passwd', '/etc/passwd', 'a/b', '-x', '..']) {
233
- const res = resolveBehavioralInjection(projectRoot, slug, {
234
- repoPath: worktreePath, baseBranch: 'main',
235
- });
236
- expect(res.result.ok).toBe(false);
237
- expect(res.result.problem).toBe('invalid-team-slug');
238
- expect(res.source).toBe('git');
239
- }
240
- });
241
- });
242
- // ── 2. The eval scenario, end to end ─────────────────────────────────────
243
- describe('#4707 — eval scenario end to end', () => {
244
- it('markers on origin/main but NOT in the stale checkout still yield a populated block', () => {
245
- const { projectRoot, worktreePath } = makeRepos({
246
- // Exactly eval's pre-#4521 roleguide: no markers at all.
247
- staleRoleguide: '# Eval Roleguide\n\nNo behavioral markers in this checkout.\n',
248
- currentRoleguide: roleguide(block({ marker: 'EVAL-BLOCK-FROM-REF' })),
249
- });
250
- writeClaudeLocal({
251
- projectRoot,
252
- worktreePath,
253
- worktreeName: 'eval-20260628',
254
- branch: 'worktree/eval-20260628',
255
- slot: 0,
256
- teamSlug: 'eval',
257
- baseBranch: 'main',
258
- });
259
- const localMd = readFileSync(join(worktreePath, 'CLAUDE.local.md'), 'utf-8');
260
- expect(localMd).toContain('# Eval Integrity — Behavioral Checks (every-turn reinforcement)');
261
- expect(localMd).toContain('EVAL-BLOCK-FROM-REF');
262
- expect(localMd).toContain('## Decision Authority');
263
- expect(localMd).toContain('# Worktree Isolation Context');
264
- // The 24-line isolation-only file is what the bug shipped for four weeks.
265
- expect(localMd.split('\n').length).toBeGreaterThan(24);
266
- // And no warning about a missing block, because there is not one.
267
- expect(warnings().find((e) => e.code === 'behavioral-injection-missing')).toBeUndefined();
268
- expect(warnings().find((e) => e.code === 'behavioral-git-read-fallback')).toBeUndefined();
269
- });
270
- it('self-heal verifies the DELIVERED file and reports the ref it came from', () => {
271
- const { projectRoot, worktreePath } = makeRepos({
272
- staleRoleguide: '# Eval Roleguide\n\nNo markers here.\n',
273
- currentRoleguide: roleguide(block()),
274
- });
275
- const heal = writeClaudeLocalWithBehavioralSelfHeal({
276
- projectRoot,
277
- worktreePath,
278
- worktreeName: 'eval-20260628',
279
- branch: 'worktree/eval-20260628',
280
- slot: 0,
281
- teamSlug: 'eval',
282
- baseBranch: 'main',
283
- });
284
- expect(heal.ok).toBe(true);
285
- expect(heal.source).toBe('git');
286
- expect(heal.ref).toBe('origin/main');
287
- expect(heal.missing).toEqual([]);
288
- expect(warnings()).toEqual([]);
289
- const delivered = extractInjectedBehavioralBlock(readFileSync(join(worktreePath, 'CLAUDE.local.md'), 'utf-8'));
290
- expect(delivered).toContain('## Decision Authority');
291
- expect(delivered).not.toContain('# Worktree Isolation Context');
292
- expect(delivered).not.toContain('Prose above the block is never injected');
293
- });
294
- });
295
- // ── 3. Content assertion — presence is not content ───────────────────────
296
- describe('#4707 — content completeness names what is missing', () => {
297
- const cases = [
298
- ['prior-art', 'prior-art gate'],
299
- ['decision-authority', 'decision authority'],
300
- ['anti-approval', 'anti-approval-seeking'],
301
- ['delegation', 'delegation / stop conditions'],
302
- ];
303
- it('a complete block passes with nothing missing', () => {
304
- const r = checkBehavioralCompleteness(block(), 'rg.md');
305
- expect(r.ok).toBe(true);
306
- expect(r.missing).toEqual([]);
307
- });
308
- for (const [omitted, label] of cases) {
309
- it(`a block missing the ${label} fails and names it`, () => {
310
- const r = checkBehavioralCompleteness(block({ omit: [omitted] }), 'rg.md');
311
- expect(r.ok).toBe(false);
312
- expect(r.problem).toBe('content-incomplete');
313
- expect(r.missing).toEqual([label]);
314
- expect(r.detail).toContain(label);
315
- expect(describeBehavioralProblem(r)).toContain(label);
316
- });
317
- }
318
- it('reports EVERY missing element, not just the first', () => {
319
- const r = checkBehavioralCompleteness(block({ omit: ['prior-art', 'delegation'] }), 'rg.md');
320
- expect(r.missing).toEqual(['prior-art gate', 'delegation / stop conditions']);
321
- expect(r.detail).toContain('2 of 4');
322
- });
323
- it('the mcp proof case — a long block with none of the four is INCOMPLETE, not OK', () => {
324
- // mcp shipped 57 lines carrying 0 of 4. Length is not content.
325
- const filler = Array.from({ length: 57 }, (_, i) => `Line ${i} of mechanisms reference text.`).join('\n');
326
- const r = checkBehavioralCompleteness(filler, 'mcp-experience-leader.md');
327
- expect(r.ok).toBe(false);
328
- expect(r.problem).toBe('content-incomplete');
329
- expect(r.missing).toHaveLength(REQUIRED_BEHAVIORAL_ELEMENTS.length);
330
- expect(findMissingBehavioralElements(filler)).toHaveLength(4);
331
- });
332
- it("recognises eval's live wording — no false 'missing' on a compliant block", () => {
333
- // Verbatim phrasing from eval-leader-v3.md on origin/main. The first draft
334
- // of the element matchers reported this block as missing BOTH decision
335
- // authority and anti-approval-seeking, when it carries both in its own
336
- // words. A checker that fires on a compliant roleguide is the thing teams
337
- // learn to ignore, so the live wording is pinned here.
338
- const evalStyle = [
339
- '## Authority and Accountability',
340
- '',
341
- 'The leader is the DRI for the question, design, integration, execution, and',
342
- 'interpretation. Once the product owner authorizes a direction and budget, the',
343
- 'leader proceeds without repeatedly requesting approval. Only a decision outside',
344
- 'that authority, a material change to the question, or an invalidating blocker',
345
- 'requires escalation.',
346
- '',
347
- '## Minimum Team and Delegation',
348
- '',
349
- 'No more than two subagents may be active. No recursive delegation.',
350
- ].join('\n');
351
- expect(findMissingBehavioralElements(evalStyle)).toEqual(['prior-art gate']);
352
- });
353
- it('an empty block is content-empty, not content-incomplete', () => {
354
- expect(checkBehavioralCompleteness(' \n\t ', 'rg.md').problem).toBe('content-empty');
355
- expect(checkBehavioralCompleteness(null, 'rg.md').problem).toBe('content-empty');
356
- });
357
- it('self-heal warns with content-incomplete and names the element, and still starts', () => {
358
- const { projectRoot, worktreePath } = makeRepos({
359
- staleRoleguide: roleguide(block()),
360
- currentRoleguide: roleguide(block({ omit: ['prior-art'] })),
361
- });
362
- const heal = writeClaudeLocalWithBehavioralSelfHeal({
363
- projectRoot,
364
- worktreePath,
365
- worktreeName: 'eval-20260628',
366
- branch: 'worktree/eval-20260628',
367
- slot: 0,
368
- teamSlug: 'eval',
369
- baseBranch: 'main',
370
- });
371
- expect(heal.ok).toBe(false);
372
- expect(heal.problem).toBe('content-incomplete');
373
- expect(heal.missing).toEqual(['prior-art gate']);
374
- const warn = warnings().find((e) => e.code === 'behavioral-content-incomplete');
375
- expect(warn).toBeDefined();
376
- expect(warn.message).toContain('prior-art gate');
377
- expect(warn.message).toContain('eval');
378
- // FAIL-OPEN (#4123): the file exists and the session may start.
379
- const localMd = readFileSync(join(worktreePath, 'CLAUDE.local.md'), 'utf-8');
380
- expect(localMd).toContain('# Worktree Isolation Context');
381
- expect(localMd).toContain('## Decision Authority');
382
- });
383
- it('asserts the DELIVERED file, not the resolver result — a failed write is caught', () => {
384
- // The resolve succeeds and returns a complete block, but the write cannot
385
- // land (CLAUDE.local.md is a directory). A check that trusted the resolver's
386
- // return value would report a healthy session while the model reads nothing:
387
- // that is #4707's own failure — verifying the artifact you edited instead of
388
- // the outcome you claimed — repeated one layer down.
389
- const { projectRoot, worktreePath } = makeRepos({
390
- staleRoleguide: roleguide(block()),
391
- currentRoleguide: roleguide(block()),
392
- });
393
- mkdirSync(join(worktreePath, 'CLAUDE.local.md'), { recursive: true });
394
- const heal = writeClaudeLocalWithBehavioralSelfHeal({
395
- projectRoot,
396
- worktreePath,
397
- worktreeName: 'eval-20260628',
398
- branch: 'worktree/eval-20260628',
399
- slot: 0,
400
- teamSlug: 'eval',
401
- baseBranch: 'main',
402
- });
403
- expect(heal.ok).toBe(false);
404
- expect(warnings().find((e) => e.code === 'behavioral-selfheal-unverified')).toBeDefined();
405
- });
406
- it('self-heal warns when the delivered file has NO block at all', () => {
407
- const { projectRoot, worktreePath } = makeRepos({
408
- staleRoleguide: '# R\n\nno markers\n',
409
- currentRoleguide: '# R\n\nno markers on the ref either\n',
410
- });
411
- const heal = writeClaudeLocalWithBehavioralSelfHeal({
412
- projectRoot,
413
- worktreePath,
414
- worktreeName: 'eval-20260628',
415
- branch: 'worktree/eval-20260628',
416
- slot: 0,
417
- teamSlug: 'eval',
418
- baseBranch: 'main',
419
- });
420
- expect(heal.ok).toBe(false);
421
- expect(heal.problem).toBe('content-empty');
422
- const warn = warnings().find((e) => e.code === 'behavioral-selfheal-missing');
423
- expect(warn).toBeDefined();
424
- expect(warn.message).toContain('NO every-turn behavioral reinforcement');
425
- });
426
- });
427
- // ── 4. Repeated / unbalanced markers fail loudly ─────────────────────────
428
- describe('#4707 — extractMarkerBlock rejects ambiguous markers', () => {
429
- it('two marker pairs → markers-repeated, no partial extraction', () => {
430
- const text = [
431
- BEHAVIORAL_START_MARKER, 'first block', BEHAVIORAL_END_MARKER,
432
- '', 'prose', '',
433
- BEHAVIORAL_START_MARKER, 'second block', BEHAVIORAL_END_MARKER,
434
- ].join('\n');
435
- const r = extractMarkerBlock(text, 'rg.md');
436
- expect(r.ok).toBe(false);
437
- expect(r.problem).toBe('markers-repeated');
438
- // MUTATION PIN: the old indexOf code returned ok with 'first block'.
439
- expect(r.content).toBeNull();
440
- expect(r.detail).toContain('2');
441
- expect(describeBehavioralProblem(r)).toContain('exactly ONE');
442
- });
443
- it('nested markers → markers-repeated', () => {
444
- const text = [
445
- BEHAVIORAL_START_MARKER,
446
- 'outer',
447
- BEHAVIORAL_START_MARKER,
448
- 'inner',
449
- BEHAVIORAL_END_MARKER,
450
- 'tail',
451
- BEHAVIORAL_END_MARKER,
452
- ].join('\n');
453
- const r = extractMarkerBlock(text, 'rg.md');
454
- expect(r.problem).toBe('markers-repeated');
455
- expect(r.content).toBeNull();
456
- });
457
- it('unbalanced 2 starts / 1 end → markers-repeated naming both counts', () => {
458
- const text = [
459
- BEHAVIORAL_START_MARKER, 'a', BEHAVIORAL_START_MARKER, 'b', BEHAVIORAL_END_MARKER,
460
- ].join('\n');
461
- const r = extractMarkerBlock(text, 'rg.md');
462
- expect(r.problem).toBe('markers-repeated');
463
- expect(r.detail).toContain('2');
464
- expect(r.detail).toContain('1');
465
- });
466
- it('prose mentions of the markers are NOT counted — the team-builder case', () => {
467
- // team-builder.md on origin/main names both markers in a sentence, in
468
- // backticks and in a table row. Substring counting reads 4 starts / 3 ends
469
- // for a file whose real block is one correct pair.
470
- const text = [
471
- '# Team Builder',
472
- '',
473
- BEHAVIORAL_START_MARKER,
474
- block(),
475
- BEHAVIORAL_END_MARKER,
476
- '',
477
- `A roleguide with no \`${BEHAVIORAL_START_MARKER}\` / \`${BEHAVIORAL_END_MARKER}\` block is refused.`,
478
- `| Shipping a roleguide with no \`${BEHAVIORAL_START_MARKER}\` block | The team gets nothing. |`,
479
- ` wrap the sections in ${BEHAVIORAL_START_MARKER} and ${BEHAVIORAL_END_MARKER}. The CLI then generates`,
480
- ].join('\n');
481
- const r = extractMarkerBlock(text, 'team-builder.md');
482
- expect(r.ok).toBe(true);
483
- expect(r.content).toContain('## Decision Authority');
484
- expect(r.content).not.toContain('Shipping a roleguide');
485
- });
486
- it('an indented marker line still counts as a marker', () => {
487
- const text = ` ${BEHAVIORAL_START_MARKER}\ncontent line\n\t${BEHAVIORAL_END_MARKER}\n`;
488
- const r = extractMarkerBlock(text, 'rg.md');
489
- expect(r.ok).toBe(true);
490
- expect(r.content).toBe('content line');
491
- });
492
- it('a marker sharing its line with other text is not a marker', () => {
493
- const text = `${BEHAVIORAL_START_MARKER} ## Heading\ncontent\n${BEHAVIORAL_END_MARKER}\n`;
494
- const r = extractMarkerBlock(text, 'rg.md');
495
- expect(r.ok).toBe(false);
496
- expect(r.problem).toBe('markers-missing');
497
- expect(r.detail).toContain(BEHAVIORAL_START_MARKER);
498
- });
499
- });
500
- // ── 4b. Size, byte and tree-entry limits (security review SF-2) ──────────
501
- describe('#4707 SF-2 — size and byte limits never route to the stale fallback', () => {
502
- it('an oversize roleguide on the ref is REJECTED, not treated as unavailable', () => {
503
- // The failure this pins: spawnSync returns a null status on maxBuffer
504
- // overrun, which naive mapping turns into "git failed" → `unavailable` →
505
- // LOCAL FALLBACK. A size problem would then hand the session the stale tree
506
- // this whole change exists to stop reading.
507
- const { projectRoot, worktreePath } = makeRepos({
508
- staleRoleguide: roleguide(block({ marker: 'LOCAL-TREE-CONTENT' })),
509
- currentRoleguide: roleguide(block()),
510
- });
511
- const padding = 'x'.repeat(MAX_ROLEGUIDE_BYTES + 64 * 1024);
512
- write(worktreePath, RG_REL, roleguide(block()) + '\n' + padding);
513
- commitAll(worktreePath, 'oversize roleguide');
514
- git(worktreePath, 'push', '-q', 'origin', 'main');
515
- git(worktreePath, 'fetch', '-q', 'origin');
516
- const res = resolveBehavioralInjection(projectRoot, 'eval', {
517
- repoPath: worktreePath, baseBranch: 'main',
518
- });
519
- expect(res.source).toBe('git'); // NOT 'local'
520
- expect(res.fallbackReason).toBeNull();
521
- expect(res.result.ok).toBe(false);
522
- expect(res.result.problem).toBe('content-too-large');
523
- expect(res.result.content).toBeNull();
524
- // And nothing from the stale tree leaked in.
525
- expect(res.result.detail).not.toContain('LOCAL-TREE-CONTENT');
526
- });
527
- it('an oversize BLOCK is rejected on the local path too', () => {
528
- const huge = `${block()}\n${'y'.repeat(MAX_BEHAVIORAL_BLOCK_BYTES + 1024)}`;
529
- const r = extractMarkerBlock(roleguide(huge), 'rg.md');
530
- expect(r.ok).toBe(false);
531
- expect(r.problem).toBe('content-too-large');
532
- expect(r.content).toBeNull();
533
- expect(describeBehavioralProblem(r)).toContain('every turn');
534
- });
535
- it('an oversize roleguide FILE is refused on the local path before it is read', () => {
536
- // The fallback path was an unbounded readFileSync straight into memory and,
537
- // one step later, into per-turn context. The size is checked off the same
538
- // descriptor the bytes would come from.
539
- const abs = join(tmpRoot, 'rg-huge.md');
540
- mkdirSync(dirname(abs), { recursive: true });
541
- writeFileSync(abs, roleguide(block()) + 'q'.repeat(MAX_ROLEGUIDE_BYTES));
542
- const r = checkRoleguideMarkers(abs, { allowedRoots: [tmpRoot], label: 'rg-huge.md' });
543
- expect(r.ok).toBe(false);
544
- expect(r.problem).toBe('content-too-large');
545
- expect(r.raw).toBeNull();
546
- });
547
- it('a block just under the limit is still accepted', () => {
548
- const filler = 'z'.repeat(MAX_BEHAVIORAL_BLOCK_BYTES - Buffer.byteLength(block()) - 16);
549
- const r = extractMarkerBlock(roleguide(`${block()}\n${filler}`), 'rg.md');
550
- expect(r.ok).toBe(true);
551
- });
552
- it('control characters in the block are named and nothing is injected', () => {
553
- // ESC reaches the operator's terminal through the warning itself.
554
- const r = extractMarkerBlock(roleguide(`${block()}\n\x1B[2J evil`), 'rg.md');
555
- expect(r.ok).toBe(false);
556
- expect(r.problem).toBe('content-control-characters');
557
- expect(r.content).toBeNull();
558
- expect(r.detail).toContain('0x1B');
559
- expect(describeBehavioralProblem(r)).toContain('terminal');
560
- });
561
- it('a NUL byte in the block is rejected', () => {
562
- const r = extractMarkerBlock(roleguide(`${block()}\x00`), 'rg.md');
563
- expect(r.problem).toBe('content-control-characters');
564
- });
565
- it('tab, newline and carriage return are NOT control characters here', () => {
566
- const r = extractMarkerBlock(roleguide(`${block()}\n\tindented\r\nline`), 'rg.md');
567
- expect(r.ok).toBe(true);
568
- });
569
- it('a control character in the Display name falls back to the slug', () => {
570
- // The display name lands in the CLAUDE.local.md header AND in warnings.
571
- // Losing a label is the right trade; losing the block is not.
572
- const { projectRoot, worktreePath } = makeRepos({
573
- staleRoleguide: roleguide(block()),
574
- currentRoleguide: roleguide(block()),
575
- teamFileContent: `# Team: eval\n\nDisplay name: Eval\x1B[31m Integrity\nRoleguide: \`${RG_REL}\`\n`,
576
- });
577
- const res = resolveBehavioralInjection(projectRoot, 'eval', {
578
- repoPath: worktreePath, baseBranch: 'main',
579
- });
580
- expect(res.result.displayName).toBe('eval');
581
- expect(res.result.ok).toBe(true); // the block still ships
582
- });
583
- it('a gitlink (mode 160000) tree entry is rejected, not read', () => {
584
- const { projectRoot, worktreePath } = makeRepos({
585
- staleRoleguide: roleguide(block({ marker: 'LOCAL-TREE-CONTENT' })),
586
- currentRoleguide: roleguide(block()),
587
- });
588
- // Replace the roleguide entry with a submodule pointer. `git show ref:path`
589
- // on a gitlink does not yield file bytes, and the mode is not 100644/100755.
590
- const oid = git(worktreePath, 'rev-parse', 'HEAD').trim();
591
- git(worktreePath, 'rm', '-q', '--cached', RG_REL);
592
- git(worktreePath, 'update-index', '--add', '--cacheinfo', `160000,${oid},${RG_REL}`);
593
- git(worktreePath, '-c', 'user.email=t@t', '-c', 'user.name=T', 'commit', '-q', '-m', 'roleguide replaced by a gitlink');
594
- git(worktreePath, 'push', '-q', 'origin', 'main');
595
- git(worktreePath, 'fetch', '-q', 'origin');
596
- const res = resolveBehavioralInjection(projectRoot, 'eval', {
597
- repoPath: worktreePath, baseBranch: 'main',
598
- });
599
- expect(res.source).toBe('git');
600
- expect(res.result.ok).toBe(false);
601
- expect(res.result.problem).toBe('roleguide-not-regular-file');
602
- expect(res.result.detail).toContain('160000');
603
- });
604
- });
605
- // ── 4c. Integrity of the delivered file (security review SF-1) ───────────
606
- describe('#4707 SF-1 — the verifier checks integrity, not keywords', () => {
607
- it('a stale projectRoot CLAUDE.local.md carrying the header triggers a MISMATCH', () => {
608
- const { projectRoot, worktreePath } = makeRepos({
609
- staleRoleguide: roleguide(block()),
610
- currentRoleguide: roleguide(block()),
611
- });
612
- // A leftover from an earlier generation: same header, different body. It is
613
- // merged ABOVE the generated content, so it is the first header in the file.
614
- writeFileSync(join(projectRoot, 'CLAUDE.local.md'), [
615
- '# Some Other Team — Behavioral Checks (every-turn reinforcement)',
616
- '',
617
- '## Prior Art Search',
618
- '## Decision Authority',
619
- 'Delegate and escalate to whoever. Decide and execute.',
620
- '',
621
- ].join('\n'));
622
- const heal = writeClaudeLocalWithBehavioralSelfHeal({
623
- projectRoot, worktreePath,
624
- worktreeName: 'eval-20260628', branch: 'worktree/eval-20260628', slot: 0,
625
- teamSlug: 'eval', baseBranch: 'main',
626
- });
627
- // The foreign block carries all four elements, so a keyword check would have
628
- // passed it. Integrity is what catches it.
629
- expect(heal.ok).toBe(false);
630
- const warn = warnings().find((e) => e.code === 'behavioral-selfheal-mismatch');
631
- expect(warn).toBeDefined();
632
- expect(warn.message).toContain('Behavioral Checks');
633
- expect(warn.message).toContain(join(projectRoot, 'CLAUDE.local.md'));
634
- });
635
- it('a foreign header with NO resolved block is a mismatch, not a quiet pass', () => {
636
- const { projectRoot, worktreePath } = makeRepos({
637
- staleRoleguide: '# R\n\nno markers\n',
638
- currentRoleguide: '# R\n\nno markers on the ref either\n',
639
- });
640
- writeFileSync(join(projectRoot, 'CLAUDE.local.md'), '# Ghost Team — Behavioral Checks (every-turn reinforcement)\n\nnothing real here\n');
641
- const heal = writeClaudeLocalWithBehavioralSelfHeal({
642
- projectRoot, worktreePath,
643
- worktreeName: 'eval-20260628', branch: 'worktree/eval-20260628', slot: 0,
644
- teamSlug: 'eval', baseBranch: 'main',
645
- });
646
- expect(heal.ok).toBe(false);
647
- expect(warnings().find((e) => e.code === 'behavioral-selfheal-mismatch')).toBeDefined();
648
- });
649
- it('the normal case has exactly one header and passes integrity', () => {
650
- const { projectRoot, worktreePath } = makeRepos({
651
- staleRoleguide: roleguide(block()),
652
- currentRoleguide: roleguide(block()),
653
- });
654
- const heal = writeClaudeLocalWithBehavioralSelfHeal({
655
- projectRoot, worktreePath,
656
- worktreeName: 'eval-20260628', branch: 'worktree/eval-20260628', slot: 0,
657
- teamSlug: 'eval', baseBranch: 'main',
658
- });
659
- expect(heal.ok).toBe(true);
660
- expect(countBehavioralHeaders(readFileSync(join(worktreePath, 'CLAUDE.local.md'), 'utf-8'))).toBe(1);
661
- expect(warnings()).toEqual([]);
662
- });
663
- });
664
- // ── 4d. Rejected values are not printed raw (Codex finding 1) ────────────
665
- const ESC = '\x1B';
666
- describe('#4707 Codex-1 — refusing a value is not licence to echo it', () => {
667
- it('an ESC-bearing team slug produces a warning with no ESC byte', () => {
668
- // CLAUDE_TEAM_NAME=$'bad\x1b[2J' reaches the invalid-slug path. The slug is
669
- // correctly refused — and the old code then quoted it into the warning, so
670
- // the refusal path WAS the injection path. Same defect the repo already
671
- // recorded as KI-STARTUPREPORT-PRINTOUT-UNSANITIZED.
672
- const { projectRoot, worktreePath } = makeRepos({
673
- staleRoleguide: roleguide(block()),
674
- currentRoleguide: roleguide(block()),
675
- });
676
- const printed = capturePrinted(() => writeClaudeLocal({
677
- projectRoot, worktreePath,
678
- worktreeName: 'eval-20260628', branch: 'worktree/eval-20260628', slot: 0,
679
- teamSlug: `bad${ESC}[2J`, baseBranch: 'main',
680
- }));
681
- // The terminal is the sink that matters here — see capturePrinted.
682
- expect(printed).not.toContain(`${ESC}[2J`);
683
- expect(printed).toContain('bad�[2J');
684
- const warn = warnings().find((e) => e.code === 'behavioral-injection-missing');
685
- expect(warn).toBeDefined();
686
- // The property is the absence of the ESC BYTE. What remains — "bad�[2J" —
687
- // is inert text: without ESC there is no CSI sequence for a terminal to
688
- // execute, and the operator can still see which value was refused.
689
- expect(warn.message).not.toContain(ESC);
690
- expect(warn.message).toContain('bad');
691
- expect(warn.message).toContain('�');
692
- });
693
- it('an unsafe backticked Roleguide path is refused without echoing its bytes', () => {
694
- const { projectRoot, worktreePath } = makeRepos({
695
- staleRoleguide: roleguide(block()),
696
- currentRoleguide: roleguide(block()),
697
- teamFileContent: `# Team: eval\n\nDisplay name: Eval\nRoleguide: \`../outside${ESC}[2K/evil.md\`\n`,
698
- });
699
- const res = resolveBehavioralInjection(projectRoot, 'eval', {
700
- repoPath: worktreePath, baseBranch: 'main',
701
- });
702
- expect(res.result.ok).toBe(false);
703
- expect(res.result.detail).not.toContain(ESC);
704
- expect(res.result.detail).toContain('�');
705
- });
706
- it('sanitizeForMessage strips C0, C1 and DEL, and caps length', () => {
707
- expect(sanitizeForMessage(`a${ESC}[31mb`)).toBe('a�[31mb');
708
- expect(sanitizeForMessage('a\x00\x07\x7F\x9Bb')).toBe('a����b');
709
- expect(sanitizeForMessage('tab\tand\nnewline')).toBe('tab�and�newline');
710
- const long = sanitizeForMessage('x'.repeat(500));
711
- expect(long.length).toBeLessThan(240);
712
- expect(long).toContain('500 chars');
713
- });
714
- it('git stderr reaching a fallback reason is sanitized too', () => {
715
- // The reason text is composed from git's own stderr, which quotes the path.
716
- const res = resolveBehavioralInjection(join(tmpRoot, 'nope'), 'eval', {
717
- repoPath: join(tmpRoot, 'not-a-repo'), baseBranch: `main${ESC}[2J`,
718
- });
719
- expect(res.source).toBe('local');
720
- expect(res.fallbackReason).not.toContain(ESC);
721
- });
722
- });
723
- // ── 4e. The completeness claim matches what is measured (Codex finding 2) ─
724
- describe('#4707 Codex-2 — keyword match, stated as a keyword match', () => {
725
- it('a block whose mentions are all negated is reported missing them', () => {
726
- // Codex's example: every required phrase appears and every one is negated.
727
- // A pure keyword check calls this complete.
728
- const negated = [
729
- '## Rules',
730
- '',
731
- 'There is no prior-art gate here.',
732
- 'This team has no decision authority.',
733
- // NOTE: kept as a single clause deliberately. Writing this as
734
- // "Do not decide and execute; approval-seeking is required." would put a
735
- // BARE mention of "approval-seeking" after the clause break, and a bare
736
- // mention counts as present — see the known-gap test below. That is the
737
- // documented limit interacting with SF-D's clause boundary, not a defect.
738
- 'Do not decide and execute.',
739
- 'Do not delegate, and never escalate to anyone.',
740
- ].join('\n');
741
- expect(findMissingBehavioralElements(negated)).toEqual([
742
- 'prior-art gate', 'decision authority', 'anti-approval-seeking',
743
- 'delegation / stop conditions',
744
- ]);
745
- });
746
- it('DOES NOT catch a bare mention asserting the opposite policy — stated, not hidden', () => {
747
- // Codex's line "approval-seeking is allowed" contains NO negator, so the
748
- // narrow rule cannot see it: the phrase is mentioned and the sentence
749
- // asserts the opposite of the control. Catching this needs semantics, and a
750
- // matcher loose enough to try would fire on compliant roleguides — the
751
- // false positive this session already paid for once.
752
- //
753
- // This test exists so the limit is a recorded property rather than a
754
- // surprise, and it is why the success line says "matched by keyword" instead
755
- // of "verified".
756
- const bare = [
757
- 'There is no prior-art gate here.',
758
- 'This team has no decision authority.',
759
- 'Approval-seeking is allowed.',
760
- 'Do not delegate or escalate.',
761
- ].join('\n');
762
- const missing = findMissingBehavioralElements(bare);
763
- expect(missing).toContain('prior-art gate');
764
- expect(missing).toContain('decision authority');
765
- expect(missing).toContain('delegation / stop conditions');
766
- expect(missing).not.toContain('anti-approval-seeking'); // the known gap
767
- });
768
- it('an incidental negation near a required phrase does NOT make it missing', () => {
769
- // The false-positive boundary. eval's real block says "Do not delegate broad
770
- // exploration" a few lines under its "Minimum Team and Delegation" heading;
771
- // customer-portal's says "**No prior art found** — State explicitly…" inside
772
- // a section that IS the prior-art gate. One negated mention among clean ones
773
- // must not read as absence.
774
- const compliant = [
775
- '## Prior Art Search',
776
- '**No prior art found** — say so explicitly; the search is still required.',
777
- '',
778
- '## Decision Authority',
779
- 'Full authority on iteration selection. Do not exceed that authority.',
780
- '',
781
- '### Anti-pattern: approval-seeking',
782
- 'Decide and execute. Not every call needs a second opinion.',
783
- '',
784
- '## Delegation and Stop Conditions',
785
- 'Delegate implementation. Do not delegate broad exploration.',
786
- 'Escalate to the product owner on cost.',
787
- ].join('\n');
788
- expect(findMissingBehavioralElements(compliant)).toEqual([]);
789
- });
790
- it('every roleguide-style block keeps its pre-negation-rule verdict', () => {
791
- // Regression guard for the rule's blast radius: the four fixture shapes used
792
- // throughout this file must be unaffected by the negation logic.
793
- expect(findMissingBehavioralElements(block())).toEqual([]);
794
- expect(findMissingBehavioralElements(block({ omit: ['prior-art'] })))
795
- .toEqual(['prior-art gate']);
796
- });
797
- it('the success line claims a keyword match, not a verification', () => {
798
- const { projectRoot, worktreePath } = makeRepos({
799
- staleRoleguide: roleguide(block()),
800
- currentRoleguide: roleguide(block()),
801
- });
802
- const heal = writeClaudeLocalWithBehavioralSelfHeal({
803
- projectRoot, worktreePath,
804
- worktreeName: 'eval-20260628', branch: 'worktree/eval-20260628', slot: 0,
805
- teamSlug: 'eval', baseBranch: 'main',
806
- });
807
- expect(heal.ok).toBe(true);
808
- const line = startupReport._entries().map((e) => e.message).join('\n');
809
- expect(line).toContain('matched by keyword');
810
- expect(line).toContain('presence, not semantics');
811
- // "verified" would invite every downstream reader to treat a heuristic as a
812
- // verification — the misreading that produced #4541's false outcome claim.
813
- expect(line).not.toContain('elements present');
814
- expect(line).not.toMatch(/Behavioral block verified/);
815
- });
816
- });
817
- // ── 4f. Security re-review items SF-A … SF-D ────────────────────────────
818
- describe('#4707 SF-A/SF-B — no value is sanitized in one clause and raw in the next', () => {
819
- it('the fallback warning sanitizes ref, remote, base branch and both paths', () => {
820
- // `ref` is BUILT from gitRemote + baseBranch. Sanitizing the composed value
821
- // and printing its ingredients raw in the same sentence is not a control.
822
- const projectRoot = join(tmpRoot, 'plain-root');
823
- const worktreePath = join(tmpRoot, 'plain-wt');
824
- mkdirSync(worktreePath, { recursive: true });
825
- write(projectRoot, 'mx-agent-system/teams/eval.md', teamFile('eval', 'Eval Integrity'));
826
- write(projectRoot, RG_REL, roleguide(block()));
827
- const printed = capturePrinted(() => writeClaudeLocal({
828
- projectRoot, worktreePath,
829
- worktreeName: 'eval-20260628', branch: 'worktree/eval-20260628', slot: 0,
830
- teamSlug: 'eval',
831
- baseBranch: `main${ESC}[2J`,
832
- gitRemote: `origin${ESC}[1m`,
833
- }));
834
- const warn = warnings().find((e) => e.code === 'behavioral-git-read-fallback');
835
- expect(warn).toBeDefined();
836
- // The report copy is stripped on the way in, so it is the PRINTED bytes that
837
- // carry the property. Assert on the injected sequences specifically, so a
838
- // colour code from chalk cannot make this pass or fail by accident.
839
- expect(printed).not.toContain(`${ESC}[2J`);
840
- expect(printed).not.toContain(`${ESC}[1m`);
841
- expect(printed).toContain('main�[2J'); // named, defanged
842
- expect(printed).toContain('origin�[1m');
843
- });
844
- it('the containment rejection sanitizes the resolved path and the allowed roots', () => {
845
- // create.ts passes an operator-supplied --roleguide here, and an escaping
846
- // path is exactly what lands on this branch.
847
- const outside = join(tmpRoot, `outside${ESC}[2K`);
848
- mkdirSync(outside, { recursive: true });
849
- const rg = join(outside, 'evil.md');
850
- writeFileSync(rg, roleguide(block()));
851
- const allowed = join(tmpRoot, 'allowed');
852
- mkdirSync(allowed, { recursive: true });
853
- const r = checkRoleguideMarkers(rg, { allowedRoots: [allowed], label: 'evil.md' });
854
- expect(r.ok).toBe(false);
855
- expect(r.problem).toBe('roleguide-path-escapes-root');
856
- expect(r.detail).not.toContain(ESC);
857
- expect(r.detail).toContain('�');
858
- });
859
- });
860
- describe('#4707 SF-D — a negator cannot reach across a clause boundary', () => {
861
- it('"Do not ask the PO; decide and execute." is COMPLIANT, not missing', () => {
862
- // The reviewer's case. Before the fix the only matching phrase was judged
863
- // negated by "Do not" 13 characters back, and anti-approval-seeking was
864
- // reported absent from a roleguide that states it plainly.
865
- const sentence = 'Do not ask the PO; decide and execute.';
866
- expect(findMissingBehavioralElements(sentence)).not.toContain('anti-approval-seeking');
867
- });
868
- it('an em dash ends the clause too', () => {
869
- expect(findMissingBehavioralElements('Do not wait — decide and execute.'))
870
- .not.toContain('anti-approval-seeking');
871
- });
872
- it('the same sentence inside a full block leaves the block complete', () => {
873
- const withSemicolon = block({ omit: ['anti-approval'] }) +
874
- '\n\n## Working style\n\nDo not ask the PO; decide and execute.\n';
875
- expect(findMissingBehavioralElements(withSemicolon)).toEqual([]);
876
- });
877
- it('a genuine negation with no clause break is still caught', () => {
878
- // The fix must not blunt the rule: same negator, no separator.
879
- expect(findMissingBehavioralElements('Do not decide and execute.'))
880
- .toContain('anti-approval-seeking');
881
- });
882
- it('a negator beyond the window does not negate (SF-C bound is behaviour-preserving)', () => {
883
- const far = `Never mind that. ${'padding '.repeat(12)}decide and execute.`;
884
- expect(findMissingBehavioralElements(far)).not.toContain('anti-approval-seeking');
885
- });
886
- it('a negator at the far end of the 24-char tail is still seen', () => {
887
- // Pins the 64-character window itself. NEGATOR allows 24 characters between
888
- // the negator and the phrase, and the negator word can be several more, so
889
- // a window materially smaller than 64 would start missing negations that the
890
- // rule is specified to catch — a silent weakening with no test to notice.
891
- // Prefix here is 'Do not ever, ever, ever ' — 24 characters of tail.
892
- expect(findMissingBehavioralElements('Do not ever, ever, ever decide and execute.'))
893
- .toContain('anti-approval-seeking');
894
- });
895
- });
896
- // ── 5. Fallback — used when git cannot serve, and never silent ───────────
897
- describe('#4707 — local fallback warns loudly', () => {
898
- it('no origin remote → falls back to the local tree AND warns with the reason', () => {
899
- // A worktree with no remote at all: git cannot serve the bytes, so the local
900
- // read is the only option — and the operator must be told it happened.
901
- const projectRoot = join(tmpRoot, 'plain-root');
902
- const worktreePath = join(tmpRoot, 'plain-wt');
903
- mkdirSync(worktreePath, { recursive: true });
904
- write(projectRoot, 'mx-agent-system/teams/eval.md', teamFile('eval', 'Eval Integrity'));
905
- write(projectRoot, RG_REL, roleguide(block({ marker: 'LOCAL-TREE-CONTENT' })));
906
- const res = resolveBehavioralInjection(projectRoot, 'eval', {
907
- repoPath: worktreePath, baseBranch: 'main',
908
- });
909
- expect(res.source).toBe('local');
910
- expect(res.fallbackReason).toContain('origin/main');
911
- expect(res.result.ok).toBe(true);
912
- expect(res.result.content).toContain('LOCAL-TREE-CONTENT');
913
- writeClaudeLocal({
914
- projectRoot, worktreePath,
915
- worktreeName: 'eval-20260628', branch: 'worktree/eval-20260628', slot: 0,
916
- teamSlug: 'eval', baseBranch: 'main',
917
- });
918
- const warn = warnings().find((e) => e.code === 'behavioral-git-read-fallback');
919
- expect(warn).toBeDefined();
920
- expect(warn.message).toContain('origin/main');
921
- expect(warn.message).toContain('may be stale');
922
- expect(warn.message).toContain(projectRoot);
923
- // The block is still delivered — fallback is a degraded read, not a refusal.
924
- expect(readFileSync(join(worktreePath, 'CLAUDE.local.md'), 'utf-8'))
925
- .toContain('LOCAL-TREE-CONTENT');
926
- });
927
- it('team not yet merged (absent from the ref, present locally) → fallback, warned', () => {
928
- const { projectRoot, worktreePath } = makeRepos({
929
- staleRoleguide: roleguide(block()),
930
- currentRoleguide: roleguide(block()),
931
- });
932
- // A brand-new team: catalog entry exists only in the local tree.
933
- write(projectRoot, 'mx-agent-system/teams/newteam.md', teamFile('newteam', 'New Team', 'mx-agent-system/roleguides/new-leader.md'));
934
- write(projectRoot, 'mx-agent-system/roleguides/new-leader.md', roleguide(block({ marker: 'UNMERGED-TEAM-CONTENT' })));
935
- const res = resolveBehavioralInjection(projectRoot, 'newteam', {
936
- repoPath: worktreePath, baseBranch: 'main',
937
- });
938
- expect(res.source).toBe('local');
939
- expect(res.fallbackReason).toContain('does not exist in origin/main');
940
- expect(res.result.content).toContain('UNMERGED-TEAM-CONTENT');
941
- });
942
- it('a missing base branch on the remote falls back rather than failing the start', () => {
943
- const { projectRoot, worktreePath } = makeRepos({
944
- staleRoleguide: roleguide(block({ marker: 'LOCAL-TREE-CONTENT' })),
945
- currentRoleguide: roleguide(block({ marker: 'REF-CONTENT' })),
946
- });
947
- const res = resolveBehavioralInjection(projectRoot, 'eval', {
948
- repoPath: worktreePath, baseBranch: 'no-such-branch',
949
- });
950
- expect(res.source).toBe('local');
951
- expect(res.fallbackReason).toContain('origin/no-such-branch');
952
- expect(res.result.content).toContain('LOCAL-TREE-CONTENT');
953
- });
954
- });
955
- //# sourceMappingURL=behavioral-git-read.test.js.map