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

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 (736) hide show
  1. package/dist/commands/create.d.ts +36 -0
  2. package/dist/commands/create.d.ts.map +1 -1
  3. package/dist/commands/create.js +85 -8
  4. package/dist/commands/create.js.map +1 -1
  5. package/dist/standards/decision-request.md +6 -57
  6. package/dist/standards/po-communication-standard.md +0 -34
  7. package/dist/standards/report-format.md +0 -90
  8. package/dist/standards/writing-standard.md +0 -312
  9. package/package.json +3 -1
  10. package/dist/__tests__/agent-attribution.test.d.ts +0 -16
  11. package/dist/__tests__/agent-attribution.test.d.ts.map +0 -1
  12. package/dist/__tests__/agent-attribution.test.js +0 -250
  13. package/dist/__tests__/agent-attribution.test.js.map +0 -1
  14. package/dist/__tests__/agents-md-canonicalization.test.d.ts +0 -23
  15. package/dist/__tests__/agents-md-canonicalization.test.d.ts.map +0 -1
  16. package/dist/__tests__/agents-md-canonicalization.test.js +0 -319
  17. package/dist/__tests__/agents-md-canonicalization.test.js.map +0 -1
  18. package/dist/__tests__/behavioral-compliance.test.d.ts +0 -8
  19. package/dist/__tests__/behavioral-compliance.test.d.ts.map +0 -1
  20. package/dist/__tests__/behavioral-compliance.test.js +0 -226
  21. package/dist/__tests__/behavioral-compliance.test.js.map +0 -1
  22. package/dist/__tests__/behavioral-extraction.test.d.ts +0 -12
  23. package/dist/__tests__/behavioral-extraction.test.d.ts.map +0 -1
  24. package/dist/__tests__/behavioral-extraction.test.js +0 -330
  25. package/dist/__tests__/behavioral-extraction.test.js.map +0 -1
  26. package/dist/__tests__/behavioral-git-read.test.d.ts +0 -21
  27. package/dist/__tests__/behavioral-git-read.test.d.ts.map +0 -1
  28. package/dist/__tests__/behavioral-git-read.test.js +0 -955
  29. package/dist/__tests__/behavioral-git-read.test.js.map +0 -1
  30. package/dist/__tests__/behavioral-injection.test.d.ts +0 -13
  31. package/dist/__tests__/behavioral-injection.test.d.ts.map +0 -1
  32. package/dist/__tests__/behavioral-injection.test.js +0 -384
  33. package/dist/__tests__/behavioral-injection.test.js.map +0 -1
  34. package/dist/__tests__/binary-smoke.test.d.ts +0 -12
  35. package/dist/__tests__/binary-smoke.test.d.ts.map +0 -1
  36. package/dist/__tests__/binary-smoke.test.js +0 -88
  37. package/dist/__tests__/binary-smoke.test.js.map +0 -1
  38. package/dist/__tests__/bootstrap-behavioral-contract.test.d.ts +0 -18
  39. package/dist/__tests__/bootstrap-behavioral-contract.test.d.ts.map +0 -1
  40. package/dist/__tests__/bootstrap-behavioral-contract.test.js +0 -104
  41. package/dist/__tests__/bootstrap-behavioral-contract.test.js.map +0 -1
  42. package/dist/__tests__/bundle-config.test.d.ts +0 -18
  43. package/dist/__tests__/bundle-config.test.d.ts.map +0 -1
  44. package/dist/__tests__/bundle-config.test.js +0 -123
  45. package/dist/__tests__/bundle-config.test.js.map +0 -1
  46. package/dist/__tests__/catalog-interaction.test.d.ts +0 -25
  47. package/dist/__tests__/catalog-interaction.test.d.ts.map +0 -1
  48. package/dist/__tests__/catalog-interaction.test.js +0 -269
  49. package/dist/__tests__/catalog-interaction.test.js.map +0 -1
  50. package/dist/__tests__/catalog-named-memories.test.d.ts +0 -2
  51. package/dist/__tests__/catalog-named-memories.test.d.ts.map +0 -1
  52. package/dist/__tests__/catalog-named-memories.test.js +0 -204
  53. package/dist/__tests__/catalog-named-memories.test.js.map +0 -1
  54. package/dist/__tests__/catalog-origin-main.test.d.ts +0 -15
  55. package/dist/__tests__/catalog-origin-main.test.d.ts.map +0 -1
  56. package/dist/__tests__/catalog-origin-main.test.js +0 -305
  57. package/dist/__tests__/catalog-origin-main.test.js.map +0 -1
  58. package/dist/__tests__/catalog.test.d.ts +0 -2
  59. package/dist/__tests__/catalog.test.d.ts.map +0 -1
  60. package/dist/__tests__/catalog.test.js +0 -131
  61. package/dist/__tests__/catalog.test.js.map +0 -1
  62. package/dist/__tests__/claude-local-sanitizer.test.d.ts +0 -24
  63. package/dist/__tests__/claude-local-sanitizer.test.d.ts.map +0 -1
  64. package/dist/__tests__/claude-local-sanitizer.test.js +0 -906
  65. package/dist/__tests__/claude-local-sanitizer.test.js.map +0 -1
  66. package/dist/__tests__/claude-md-compose.test.d.ts +0 -17
  67. package/dist/__tests__/claude-md-compose.test.d.ts.map +0 -1
  68. package/dist/__tests__/claude-md-compose.test.js +0 -119
  69. package/dist/__tests__/claude-md-compose.test.js.map +0 -1
  70. package/dist/__tests__/claude-sync.test.d.ts +0 -2
  71. package/dist/__tests__/claude-sync.test.d.ts.map +0 -1
  72. package/dist/__tests__/claude-sync.test.js +0 -571
  73. package/dist/__tests__/claude-sync.test.js.map +0 -1
  74. package/dist/__tests__/cli-build-integration.test.d.ts +0 -2
  75. package/dist/__tests__/cli-build-integration.test.d.ts.map +0 -1
  76. package/dist/__tests__/cli-build-integration.test.js +0 -64
  77. package/dist/__tests__/cli-build-integration.test.js.map +0 -1
  78. package/dist/__tests__/cli-build.test.d.ts +0 -2
  79. package/dist/__tests__/cli-build.test.d.ts.map +0 -1
  80. package/dist/__tests__/cli-build.test.js +0 -640
  81. package/dist/__tests__/cli-build.test.js.map +0 -1
  82. package/dist/__tests__/codex-agent-gate.test.d.ts +0 -2
  83. package/dist/__tests__/codex-agent-gate.test.d.ts.map +0 -1
  84. package/dist/__tests__/codex-agent-gate.test.js +0 -480
  85. package/dist/__tests__/codex-agent-gate.test.js.map +0 -1
  86. package/dist/__tests__/codex-deploy-config.test.d.ts +0 -2
  87. package/dist/__tests__/codex-deploy-config.test.d.ts.map +0 -1
  88. package/dist/__tests__/codex-deploy-config.test.js +0 -1230
  89. package/dist/__tests__/codex-deploy-config.test.js.map +0 -1
  90. package/dist/__tests__/codex-trust-keys.test.d.ts +0 -2
  91. package/dist/__tests__/codex-trust-keys.test.d.ts.map +0 -1
  92. package/dist/__tests__/codex-trust-keys.test.js +0 -731
  93. package/dist/__tests__/codex-trust-keys.test.js.map +0 -1
  94. package/dist/__tests__/codex-write-race.test.d.ts +0 -2
  95. package/dist/__tests__/codex-write-race.test.d.ts.map +0 -1
  96. package/dist/__tests__/codex-write-race.test.js +0 -2253
  97. package/dist/__tests__/codex-write-race.test.js.map +0 -1
  98. package/dist/__tests__/completion-rows-discriminate.test.d.ts +0 -20
  99. package/dist/__tests__/completion-rows-discriminate.test.d.ts.map +0 -1
  100. package/dist/__tests__/completion-rows-discriminate.test.js +0 -481
  101. package/dist/__tests__/completion-rows-discriminate.test.js.map +0 -1
  102. package/dist/__tests__/config-command.test.d.ts +0 -9
  103. package/dist/__tests__/config-command.test.d.ts.map +0 -1
  104. package/dist/__tests__/config-command.test.js +0 -75
  105. package/dist/__tests__/config-command.test.js.map +0 -1
  106. package/dist/__tests__/config-fidelity-archived-symlinks.test.d.ts +0 -2
  107. package/dist/__tests__/config-fidelity-archived-symlinks.test.d.ts.map +0 -1
  108. package/dist/__tests__/config-fidelity-archived-symlinks.test.js +0 -127
  109. package/dist/__tests__/config-fidelity-archived-symlinks.test.js.map +0 -1
  110. package/dist/__tests__/config-fidelity-display.test.d.ts +0 -2
  111. package/dist/__tests__/config-fidelity-display.test.d.ts.map +0 -1
  112. package/dist/__tests__/config-fidelity-display.test.js +0 -77
  113. package/dist/__tests__/config-fidelity-display.test.js.map +0 -1
  114. package/dist/__tests__/config-fidelity-unreadable-fixture.d.ts +0 -32
  115. package/dist/__tests__/config-fidelity-unreadable-fixture.d.ts.map +0 -1
  116. package/dist/__tests__/config-fidelity-unreadable-fixture.js +0 -37
  117. package/dist/__tests__/config-fidelity-unreadable-fixture.js.map +0 -1
  118. package/dist/__tests__/config-fidelity.test.d.ts +0 -16
  119. package/dist/__tests__/config-fidelity.test.d.ts.map +0 -1
  120. package/dist/__tests__/config-fidelity.test.js +0 -2679
  121. package/dist/__tests__/config-fidelity.test.js.map +0 -1
  122. package/dist/__tests__/config-generation-gate.test.d.ts +0 -46
  123. package/dist/__tests__/config-generation-gate.test.d.ts.map +0 -1
  124. package/dist/__tests__/config-generation-gate.test.js +0 -435
  125. package/dist/__tests__/config-generation-gate.test.js.map +0 -1
  126. package/dist/__tests__/config-generation.test.d.ts +0 -7
  127. package/dist/__tests__/config-generation.test.d.ts.map +0 -1
  128. package/dist/__tests__/config-generation.test.js +0 -141
  129. package/dist/__tests__/config-generation.test.js.map +0 -1
  130. package/dist/__tests__/config-sync.test.d.ts +0 -10
  131. package/dist/__tests__/config-sync.test.d.ts.map +0 -1
  132. package/dist/__tests__/config-sync.test.js +0 -268
  133. package/dist/__tests__/config-sync.test.js.map +0 -1
  134. package/dist/__tests__/coordination-401-production-wiring.test.d.ts +0 -19
  135. package/dist/__tests__/coordination-401-production-wiring.test.d.ts.map +0 -1
  136. package/dist/__tests__/coordination-401-production-wiring.test.js +0 -286
  137. package/dist/__tests__/coordination-401-production-wiring.test.js.map +0 -1
  138. package/dist/__tests__/coordination-401-recovery.test.d.ts +0 -22
  139. package/dist/__tests__/coordination-401-recovery.test.d.ts.map +0 -1
  140. package/dist/__tests__/coordination-401-recovery.test.js +0 -601
  141. package/dist/__tests__/coordination-401-recovery.test.js.map +0 -1
  142. package/dist/__tests__/coordination-brief-pin.test.d.ts +0 -20
  143. package/dist/__tests__/coordination-brief-pin.test.d.ts.map +0 -1
  144. package/dist/__tests__/coordination-brief-pin.test.js +0 -66
  145. package/dist/__tests__/coordination-brief-pin.test.js.map +0 -1
  146. package/dist/__tests__/coordination-brief.test.d.ts +0 -9
  147. package/dist/__tests__/coordination-brief.test.d.ts.map +0 -1
  148. package/dist/__tests__/coordination-brief.test.js +0 -290
  149. package/dist/__tests__/coordination-brief.test.js.map +0 -1
  150. package/dist/__tests__/coordination-client.test.d.ts +0 -9
  151. package/dist/__tests__/coordination-client.test.d.ts.map +0 -1
  152. package/dist/__tests__/coordination-client.test.js +0 -517
  153. package/dist/__tests__/coordination-client.test.js.map +0 -1
  154. package/dist/__tests__/coordination-command.test.d.ts +0 -9
  155. package/dist/__tests__/coordination-command.test.d.ts.map +0 -1
  156. package/dist/__tests__/coordination-command.test.js +0 -1082
  157. package/dist/__tests__/coordination-command.test.js.map +0 -1
  158. package/dist/__tests__/coordination-credential-endpoint.test.d.ts +0 -24
  159. package/dist/__tests__/coordination-credential-endpoint.test.d.ts.map +0 -1
  160. package/dist/__tests__/coordination-credential-endpoint.test.js +0 -1292
  161. package/dist/__tests__/coordination-credential-endpoint.test.js.map +0 -1
  162. package/dist/__tests__/coordination-expected-team.test.d.ts +0 -19
  163. package/dist/__tests__/coordination-expected-team.test.d.ts.map +0 -1
  164. package/dist/__tests__/coordination-expected-team.test.js +0 -423
  165. package/dist/__tests__/coordination-expected-team.test.js.map +0 -1
  166. package/dist/__tests__/coordination-fallback.test.d.ts +0 -9
  167. package/dist/__tests__/coordination-fallback.test.d.ts.map +0 -1
  168. package/dist/__tests__/coordination-fallback.test.js +0 -192
  169. package/dist/__tests__/coordination-fallback.test.js.map +0 -1
  170. package/dist/__tests__/coordination-file-guards.test.d.ts +0 -29
  171. package/dist/__tests__/coordination-file-guards.test.d.ts.map +0 -1
  172. package/dist/__tests__/coordination-file-guards.test.js +0 -380
  173. package/dist/__tests__/coordination-file-guards.test.js.map +0 -1
  174. package/dist/__tests__/coordination-history.test.d.ts +0 -8
  175. package/dist/__tests__/coordination-history.test.d.ts.map +0 -1
  176. package/dist/__tests__/coordination-history.test.js +0 -447
  177. package/dist/__tests__/coordination-history.test.js.map +0 -1
  178. package/dist/__tests__/coordination-memory.test.d.ts +0 -14
  179. package/dist/__tests__/coordination-memory.test.d.ts.map +0 -1
  180. package/dist/__tests__/coordination-memory.test.js +0 -401
  181. package/dist/__tests__/coordination-memory.test.js.map +0 -1
  182. package/dist/__tests__/coordination-mode.test.d.ts +0 -13
  183. package/dist/__tests__/coordination-mode.test.d.ts.map +0 -1
  184. package/dist/__tests__/coordination-mode.test.js +0 -180
  185. package/dist/__tests__/coordination-mode.test.js.map +0 -1
  186. package/dist/__tests__/coordination-plain-shell-commands.test.d.ts +0 -22
  187. package/dist/__tests__/coordination-plain-shell-commands.test.d.ts.map +0 -1
  188. package/dist/__tests__/coordination-plain-shell-commands.test.js +0 -1875
  189. package/dist/__tests__/coordination-plain-shell-commands.test.js.map +0 -1
  190. package/dist/__tests__/coordination-provision.test.d.ts +0 -12
  191. package/dist/__tests__/coordination-provision.test.d.ts.map +0 -1
  192. package/dist/__tests__/coordination-provision.test.js +0 -103
  193. package/dist/__tests__/coordination-provision.test.js.map +0 -1
  194. package/dist/__tests__/coordination-render.test.d.ts +0 -9
  195. package/dist/__tests__/coordination-render.test.d.ts.map +0 -1
  196. package/dist/__tests__/coordination-render.test.js +0 -335
  197. package/dist/__tests__/coordination-render.test.js.map +0 -1
  198. package/dist/__tests__/coordination-setup.test.d.ts +0 -6
  199. package/dist/__tests__/coordination-setup.test.d.ts.map +0 -1
  200. package/dist/__tests__/coordination-setup.test.js +0 -448
  201. package/dist/__tests__/coordination-setup.test.js.map +0 -1
  202. package/dist/__tests__/coordination-status-plain-shell.test.d.ts +0 -19
  203. package/dist/__tests__/coordination-status-plain-shell.test.d.ts.map +0 -1
  204. package/dist/__tests__/coordination-status-plain-shell.test.js +0 -332
  205. package/dist/__tests__/coordination-status-plain-shell.test.js.map +0 -1
  206. package/dist/__tests__/coordination-status-registration.test.d.ts +0 -16
  207. package/dist/__tests__/coordination-status-registration.test.d.ts.map +0 -1
  208. package/dist/__tests__/coordination-status-registration.test.js +0 -480
  209. package/dist/__tests__/coordination-status-registration.test.js.map +0 -1
  210. package/dist/__tests__/coordination-token-multitenant.test.d.ts +0 -11
  211. package/dist/__tests__/coordination-token-multitenant.test.d.ts.map +0 -1
  212. package/dist/__tests__/coordination-token-multitenant.test.js +0 -106
  213. package/dist/__tests__/coordination-token-multitenant.test.js.map +0 -1
  214. package/dist/__tests__/coordination-token.test.d.ts +0 -11
  215. package/dist/__tests__/coordination-token.test.d.ts.map +0 -1
  216. package/dist/__tests__/coordination-token.test.js +0 -201
  217. package/dist/__tests__/coordination-token.test.js.map +0 -1
  218. package/dist/__tests__/coordination-wiring.test.d.ts +0 -11
  219. package/dist/__tests__/coordination-wiring.test.d.ts.map +0 -1
  220. package/dist/__tests__/coordination-wiring.test.js +0 -43
  221. package/dist/__tests__/coordination-wiring.test.js.map +0 -1
  222. package/dist/__tests__/creation-pr-class-check.test.d.ts +0 -17
  223. package/dist/__tests__/creation-pr-class-check.test.d.ts.map +0 -1
  224. package/dist/__tests__/creation-pr-class-check.test.js +0 -346
  225. package/dist/__tests__/creation-pr-class-check.test.js.map +0 -1
  226. package/dist/__tests__/creation-step6a-push-check.test.d.ts +0 -15
  227. package/dist/__tests__/creation-step6a-push-check.test.d.ts.map +0 -1
  228. package/dist/__tests__/creation-step6a-push-check.test.js +0 -150
  229. package/dist/__tests__/creation-step6a-push-check.test.js.map +0 -1
  230. package/dist/__tests__/decision-check.test.d.ts +0 -2
  231. package/dist/__tests__/decision-check.test.d.ts.map +0 -1
  232. package/dist/__tests__/decision-check.test.js +0 -105
  233. package/dist/__tests__/decision-check.test.js.map +0 -1
  234. package/dist/__tests__/digest-fail-closed.test.d.ts +0 -16
  235. package/dist/__tests__/digest-fail-closed.test.d.ts.map +0 -1
  236. package/dist/__tests__/digest-fail-closed.test.js +0 -248
  237. package/dist/__tests__/digest-fail-closed.test.js.map +0 -1
  238. package/dist/__tests__/digest-team-omission.test.d.ts +0 -15
  239. package/dist/__tests__/digest-team-omission.test.d.ts.map +0 -1
  240. package/dist/__tests__/digest-team-omission.test.js +0 -247
  241. package/dist/__tests__/digest-team-omission.test.js.map +0 -1
  242. package/dist/__tests__/doctor-config-fidelity.test.d.ts +0 -19
  243. package/dist/__tests__/doctor-config-fidelity.test.d.ts.map +0 -1
  244. package/dist/__tests__/doctor-config-fidelity.test.js +0 -324
  245. package/dist/__tests__/doctor-config-fidelity.test.js.map +0 -1
  246. package/dist/__tests__/doctor-framework-version.test.d.ts +0 -2
  247. package/dist/__tests__/doctor-framework-version.test.d.ts.map +0 -1
  248. package/dist/__tests__/doctor-framework-version.test.js +0 -146
  249. package/dist/__tests__/doctor-framework-version.test.js.map +0 -1
  250. package/dist/__tests__/doctor-worktree-path.test.d.ts +0 -17
  251. package/dist/__tests__/doctor-worktree-path.test.d.ts.map +0 -1
  252. package/dist/__tests__/doctor-worktree-path.test.js +0 -158
  253. package/dist/__tests__/doctor-worktree-path.test.js.map +0 -1
  254. package/dist/__tests__/doctor.test.d.ts +0 -20
  255. package/dist/__tests__/doctor.test.d.ts.map +0 -1
  256. package/dist/__tests__/doctor.test.js +0 -849
  257. package/dist/__tests__/doctor.test.js.map +0 -1
  258. package/dist/__tests__/event-shipper.test.d.ts +0 -16
  259. package/dist/__tests__/event-shipper.test.d.ts.map +0 -1
  260. package/dist/__tests__/event-shipper.test.js +0 -287
  261. package/dist/__tests__/event-shipper.test.js.map +0 -1
  262. package/dist/__tests__/fleet-data.test.d.ts +0 -2
  263. package/dist/__tests__/fleet-data.test.d.ts.map +0 -1
  264. package/dist/__tests__/fleet-data.test.js +0 -501
  265. package/dist/__tests__/fleet-data.test.js.map +0 -1
  266. package/dist/__tests__/fleet-devpod.test.d.ts +0 -12
  267. package/dist/__tests__/fleet-devpod.test.d.ts.map +0 -1
  268. package/dist/__tests__/fleet-devpod.test.js +0 -260
  269. package/dist/__tests__/fleet-devpod.test.js.map +0 -1
  270. package/dist/__tests__/fleet-tmux.test.d.ts +0 -2
  271. package/dist/__tests__/fleet-tmux.test.d.ts.map +0 -1
  272. package/dist/__tests__/fleet-tmux.test.js +0 -289
  273. package/dist/__tests__/fleet-tmux.test.js.map +0 -1
  274. package/dist/__tests__/fleet.test.d.ts +0 -16
  275. package/dist/__tests__/fleet.test.d.ts.map +0 -1
  276. package/dist/__tests__/fleet.test.js +0 -75
  277. package/dist/__tests__/fleet.test.js.map +0 -1
  278. package/dist/__tests__/generate-claude.test.d.ts +0 -18
  279. package/dist/__tests__/generate-claude.test.d.ts.map +0 -1
  280. package/dist/__tests__/generate-claude.test.js +0 -1015
  281. package/dist/__tests__/generate-claude.test.js.map +0 -1
  282. package/dist/__tests__/gh-remote.test.d.ts +0 -2
  283. package/dist/__tests__/gh-remote.test.d.ts.map +0 -1
  284. package/dist/__tests__/gh-remote.test.js +0 -136
  285. package/dist/__tests__/gh-remote.test.js.map +0 -1
  286. package/dist/__tests__/git-env.test.d.ts +0 -14
  287. package/dist/__tests__/git-env.test.d.ts.map +0 -1
  288. package/dist/__tests__/git-env.test.js +0 -131
  289. package/dist/__tests__/git-env.test.js.map +0 -1
  290. package/dist/__tests__/git-identity-isolation.test.d.ts +0 -33
  291. package/dist/__tests__/git-identity-isolation.test.d.ts.map +0 -1
  292. package/dist/__tests__/git-identity-isolation.test.js +0 -626
  293. package/dist/__tests__/git-identity-isolation.test.js.map +0 -1
  294. package/dist/__tests__/harness-extract.test.d.ts +0 -19
  295. package/dist/__tests__/harness-extract.test.d.ts.map +0 -1
  296. package/dist/__tests__/harness-extract.test.js +0 -566
  297. package/dist/__tests__/harness-extract.test.js.map +0 -1
  298. package/dist/__tests__/harness-wiring.test.d.ts +0 -16
  299. package/dist/__tests__/harness-wiring.test.d.ts.map +0 -1
  300. package/dist/__tests__/harness-wiring.test.js +0 -469
  301. package/dist/__tests__/harness-wiring.test.js.map +0 -1
  302. package/dist/__tests__/hook-completeness.test.d.ts +0 -13
  303. package/dist/__tests__/hook-completeness.test.d.ts.map +0 -1
  304. package/dist/__tests__/hook-completeness.test.js +0 -238
  305. package/dist/__tests__/hook-completeness.test.js.map +0 -1
  306. package/dist/__tests__/hook-heal.test.d.ts +0 -8
  307. package/dist/__tests__/hook-heal.test.d.ts.map +0 -1
  308. package/dist/__tests__/hook-heal.test.js +0 -156
  309. package/dist/__tests__/hook-heal.test.js.map +0 -1
  310. package/dist/__tests__/human-turn-classifier.test.d.ts +0 -17
  311. package/dist/__tests__/human-turn-classifier.test.d.ts.map +0 -1
  312. package/dist/__tests__/human-turn-classifier.test.js +0 -311
  313. package/dist/__tests__/human-turn-classifier.test.js.map +0 -1
  314. package/dist/__tests__/init-coordination-url.test.d.ts +0 -11
  315. package/dist/__tests__/init-coordination-url.test.d.ts.map +0 -1
  316. package/dist/__tests__/init-coordination-url.test.js +0 -217
  317. package/dist/__tests__/init-coordination-url.test.js.map +0 -1
  318. package/dist/__tests__/isolation-probe.test.d.ts +0 -15
  319. package/dist/__tests__/isolation-probe.test.d.ts.map +0 -1
  320. package/dist/__tests__/isolation-probe.test.js +0 -611
  321. package/dist/__tests__/isolation-probe.test.js.map +0 -1
  322. package/dist/__tests__/leader-lock.test.d.ts +0 -12
  323. package/dist/__tests__/leader-lock.test.d.ts.map +0 -1
  324. package/dist/__tests__/leader-lock.test.js +0 -293
  325. package/dist/__tests__/leader-lock.test.js.map +0 -1
  326. package/dist/__tests__/memory-archive-checks.test.d.ts +0 -22
  327. package/dist/__tests__/memory-archive-checks.test.d.ts.map +0 -1
  328. package/dist/__tests__/memory-archive-checks.test.js +0 -748
  329. package/dist/__tests__/memory-archive-checks.test.js.map +0 -1
  330. package/dist/__tests__/memory-archive-prep.test.d.ts +0 -8
  331. package/dist/__tests__/memory-archive-prep.test.d.ts.map +0 -1
  332. package/dist/__tests__/memory-archive-prep.test.js +0 -524
  333. package/dist/__tests__/memory-archive-prep.test.js.map +0 -1
  334. package/dist/__tests__/memory-autocreate.test.d.ts +0 -10
  335. package/dist/__tests__/memory-autocreate.test.d.ts.map +0 -1
  336. package/dist/__tests__/memory-autocreate.test.js +0 -709
  337. package/dist/__tests__/memory-autocreate.test.js.map +0 -1
  338. package/dist/__tests__/memory-log-result.test.d.ts +0 -13
  339. package/dist/__tests__/memory-log-result.test.d.ts.map +0 -1
  340. package/dist/__tests__/memory-log-result.test.js +0 -149
  341. package/dist/__tests__/memory-log-result.test.js.map +0 -1
  342. package/dist/__tests__/memory-named-exists.test.d.ts +0 -16
  343. package/dist/__tests__/memory-named-exists.test.d.ts.map +0 -1
  344. package/dist/__tests__/memory-named-exists.test.js +0 -288
  345. package/dist/__tests__/memory-named-exists.test.js.map +0 -1
  346. package/dist/__tests__/message-bus.test.d.ts +0 -10
  347. package/dist/__tests__/message-bus.test.d.ts.map +0 -1
  348. package/dist/__tests__/message-bus.test.js +0 -526
  349. package/dist/__tests__/message-bus.test.js.map +0 -1
  350. package/dist/__tests__/monitor.test.d.ts +0 -6
  351. package/dist/__tests__/monitor.test.d.ts.map +0 -1
  352. package/dist/__tests__/monitor.test.js +0 -458
  353. package/dist/__tests__/monitor.test.js.map +0 -1
  354. package/dist/__tests__/mx-agent-cli-pin-validation.test.d.ts +0 -2
  355. package/dist/__tests__/mx-agent-cli-pin-validation.test.d.ts.map +0 -1
  356. package/dist/__tests__/mx-agent-cli-pin-validation.test.js +0 -232
  357. package/dist/__tests__/mx-agent-cli-pin-validation.test.js.map +0 -1
  358. package/dist/__tests__/mx-agent-cli-version-pin.test.d.ts +0 -2
  359. package/dist/__tests__/mx-agent-cli-version-pin.test.d.ts.map +0 -1
  360. package/dist/__tests__/mx-agent-cli-version-pin.test.js +0 -236
  361. package/dist/__tests__/mx-agent-cli-version-pin.test.js.map +0 -1
  362. package/dist/__tests__/new-project-first-team.test.d.ts +0 -15
  363. package/dist/__tests__/new-project-first-team.test.d.ts.map +0 -1
  364. package/dist/__tests__/new-project-first-team.test.js +0 -444
  365. package/dist/__tests__/new-project-first-team.test.js.map +0 -1
  366. package/dist/__tests__/otel-env.test.d.ts +0 -2
  367. package/dist/__tests__/otel-env.test.d.ts.map +0 -1
  368. package/dist/__tests__/otel-env.test.js +0 -127
  369. package/dist/__tests__/otel-env.test.js.map +0 -1
  370. package/dist/__tests__/pager-fail-closed.test.d.ts +0 -19
  371. package/dist/__tests__/pager-fail-closed.test.d.ts.map +0 -1
  372. package/dist/__tests__/pager-fail-closed.test.js +0 -229
  373. package/dist/__tests__/pager-fail-closed.test.js.map +0 -1
  374. package/dist/__tests__/pr-set-body.test.d.ts +0 -29
  375. package/dist/__tests__/pr-set-body.test.d.ts.map +0 -1
  376. package/dist/__tests__/pr-set-body.test.js +0 -314
  377. package/dist/__tests__/pr-set-body.test.js.map +0 -1
  378. package/dist/__tests__/prior-sync-failure.test.d.ts +0 -2
  379. package/dist/__tests__/prior-sync-failure.test.d.ts.map +0 -1
  380. package/dist/__tests__/prior-sync-failure.test.js +0 -81
  381. package/dist/__tests__/prior-sync-failure.test.js.map +0 -1
  382. package/dist/__tests__/project-config.test.d.ts +0 -2
  383. package/dist/__tests__/project-config.test.d.ts.map +0 -1
  384. package/dist/__tests__/project-config.test.js +0 -458
  385. package/dist/__tests__/project-config.test.js.map +0 -1
  386. package/dist/__tests__/provision-behavioral-contract.test.d.ts +0 -13
  387. package/dist/__tests__/provision-behavioral-contract.test.d.ts.map +0 -1
  388. package/dist/__tests__/provision-behavioral-contract.test.js +0 -548
  389. package/dist/__tests__/provision-behavioral-contract.test.js.map +0 -1
  390. package/dist/__tests__/provision-catalog-precondition.test.d.ts +0 -26
  391. package/dist/__tests__/provision-catalog-precondition.test.d.ts.map +0 -1
  392. package/dist/__tests__/provision-catalog-precondition.test.js +0 -622
  393. package/dist/__tests__/provision-catalog-precondition.test.js.map +0 -1
  394. package/dist/__tests__/provision-completion-rows.test.d.ts +0 -17
  395. package/dist/__tests__/provision-completion-rows.test.d.ts.map +0 -1
  396. package/dist/__tests__/provision-completion-rows.test.js +0 -3473
  397. package/dist/__tests__/provision-completion-rows.test.js.map +0 -1
  398. package/dist/__tests__/provision-copy-containment.test.d.ts +0 -19
  399. package/dist/__tests__/provision-copy-containment.test.d.ts.map +0 -1
  400. package/dist/__tests__/provision-copy-containment.test.js +0 -187
  401. package/dist/__tests__/provision-copy-containment.test.js.map +0 -1
  402. package/dist/__tests__/provision-identity-gate.test.d.ts +0 -20
  403. package/dist/__tests__/provision-identity-gate.test.d.ts.map +0 -1
  404. package/dist/__tests__/provision-identity-gate.test.js +0 -602
  405. package/dist/__tests__/provision-identity-gate.test.js.map +0 -1
  406. package/dist/__tests__/provision-resume.test.d.ts +0 -26
  407. package/dist/__tests__/provision-resume.test.d.ts.map +0 -1
  408. package/dist/__tests__/provision-resume.test.js +0 -1344
  409. package/dist/__tests__/provision-resume.test.js.map +0 -1
  410. package/dist/__tests__/provision-roleguide-anchors.test.d.ts +0 -27
  411. package/dist/__tests__/provision-roleguide-anchors.test.d.ts.map +0 -1
  412. package/dist/__tests__/provision-roleguide-anchors.test.js +0 -747
  413. package/dist/__tests__/provision-roleguide-anchors.test.js.map +0 -1
  414. package/dist/__tests__/provision-row12-stub-server.test.d.ts +0 -21
  415. package/dist/__tests__/provision-row12-stub-server.test.d.ts.map +0 -1
  416. package/dist/__tests__/provision-row12-stub-server.test.js +0 -264
  417. package/dist/__tests__/provision-row12-stub-server.test.js.map +0 -1
  418. package/dist/__tests__/provision-skeleton-fill.test.d.ts +0 -16
  419. package/dist/__tests__/provision-skeleton-fill.test.d.ts.map +0 -1
  420. package/dist/__tests__/provision-skeleton-fill.test.js +0 -490
  421. package/dist/__tests__/provision-skeleton-fill.test.js.map +0 -1
  422. package/dist/__tests__/provision-step8-commit.test.d.ts +0 -40
  423. package/dist/__tests__/provision-step8-commit.test.d.ts.map +0 -1
  424. package/dist/__tests__/provision-step8-commit.test.js +0 -529
  425. package/dist/__tests__/provision-step8-commit.test.js.map +0 -1
  426. package/dist/__tests__/provision-teambuilder-flow.test.d.ts +0 -22
  427. package/dist/__tests__/provision-teambuilder-flow.test.d.ts.map +0 -1
  428. package/dist/__tests__/provision-teambuilder-flow.test.js +0 -253
  429. package/dist/__tests__/provision-teambuilder-flow.test.js.map +0 -1
  430. package/dist/__tests__/provision-write-integrity.test.d.ts +0 -18
  431. package/dist/__tests__/provision-write-integrity.test.d.ts.map +0 -1
  432. package/dist/__tests__/provision-write-integrity.test.js +0 -141
  433. package/dist/__tests__/provision-write-integrity.test.js.map +0 -1
  434. package/dist/__tests__/repo-guard-wiring.test.d.ts +0 -21
  435. package/dist/__tests__/repo-guard-wiring.test.d.ts.map +0 -1
  436. package/dist/__tests__/repo-guard-wiring.test.js +0 -638
  437. package/dist/__tests__/repo-guard-wiring.test.js.map +0 -1
  438. package/dist/__tests__/report-format.test.d.ts +0 -2
  439. package/dist/__tests__/report-format.test.d.ts.map +0 -1
  440. package/dist/__tests__/report-format.test.js +0 -219
  441. package/dist/__tests__/report-format.test.js.map +0 -1
  442. package/dist/__tests__/row15-detail-sanitizer.test.d.ts +0 -20
  443. package/dist/__tests__/row15-detail-sanitizer.test.d.ts.map +0 -1
  444. package/dist/__tests__/row15-detail-sanitizer.test.js +0 -61
  445. package/dist/__tests__/row15-detail-sanitizer.test.js.map +0 -1
  446. package/dist/__tests__/rows-9-10-zero-remotes.test.d.ts +0 -32
  447. package/dist/__tests__/rows-9-10-zero-remotes.test.d.ts.map +0 -1
  448. package/dist/__tests__/rows-9-10-zero-remotes.test.js +0 -203
  449. package/dist/__tests__/rows-9-10-zero-remotes.test.js.map +0 -1
  450. package/dist/__tests__/runtime-claude-adapter.test.d.ts +0 -2
  451. package/dist/__tests__/runtime-claude-adapter.test.d.ts.map +0 -1
  452. package/dist/__tests__/runtime-claude-adapter.test.js +0 -70
  453. package/dist/__tests__/runtime-claude-adapter.test.js.map +0 -1
  454. package/dist/__tests__/runtime-codex-adapter.test.d.ts +0 -2
  455. package/dist/__tests__/runtime-codex-adapter.test.d.ts.map +0 -1
  456. package/dist/__tests__/runtime-codex-adapter.test.js +0 -558
  457. package/dist/__tests__/runtime-codex-adapter.test.js.map +0 -1
  458. package/dist/__tests__/runtime-codex-config.test.d.ts +0 -2
  459. package/dist/__tests__/runtime-codex-config.test.d.ts.map +0 -1
  460. package/dist/__tests__/runtime-codex-config.test.js +0 -1421
  461. package/dist/__tests__/runtime-codex-config.test.js.map +0 -1
  462. package/dist/__tests__/runtime-codex-gateway-pilot.test.d.ts +0 -2
  463. package/dist/__tests__/runtime-codex-gateway-pilot.test.d.ts.map +0 -1
  464. package/dist/__tests__/runtime-codex-gateway-pilot.test.js +0 -309
  465. package/dist/__tests__/runtime-codex-gateway-pilot.test.js.map +0 -1
  466. package/dist/__tests__/runtime-codex-gateway-provider.test.d.ts +0 -2
  467. package/dist/__tests__/runtime-codex-gateway-provider.test.d.ts.map +0 -1
  468. package/dist/__tests__/runtime-codex-gateway-provider.test.js +0 -163
  469. package/dist/__tests__/runtime-codex-gateway-provider.test.js.map +0 -1
  470. package/dist/__tests__/runtime-codex-guard-proof.test.d.ts +0 -2
  471. package/dist/__tests__/runtime-codex-guard-proof.test.d.ts.map +0 -1
  472. package/dist/__tests__/runtime-codex-guard-proof.test.js +0 -822
  473. package/dist/__tests__/runtime-codex-guard-proof.test.js.map +0 -1
  474. package/dist/__tests__/runtime-codex-version-pin.test.d.ts +0 -2
  475. package/dist/__tests__/runtime-codex-version-pin.test.d.ts.map +0 -1
  476. package/dist/__tests__/runtime-codex-version-pin.test.js +0 -86
  477. package/dist/__tests__/runtime-codex-version-pin.test.js.map +0 -1
  478. package/dist/__tests__/runtime-identity.test.d.ts +0 -2
  479. package/dist/__tests__/runtime-identity.test.d.ts.map +0 -1
  480. package/dist/__tests__/runtime-identity.test.js +0 -117
  481. package/dist/__tests__/runtime-identity.test.js.map +0 -1
  482. package/dist/__tests__/runtime-resolve.test.d.ts +0 -2
  483. package/dist/__tests__/runtime-resolve.test.d.ts.map +0 -1
  484. package/dist/__tests__/runtime-resolve.test.js +0 -172
  485. package/dist/__tests__/runtime-resolve.test.js.map +0 -1
  486. package/dist/__tests__/security-posture.test.d.ts +0 -8
  487. package/dist/__tests__/security-posture.test.d.ts.map +0 -1
  488. package/dist/__tests__/security-posture.test.js +0 -82
  489. package/dist/__tests__/security-posture.test.js.map +0 -1
  490. package/dist/__tests__/session-model.test.d.ts +0 -2
  491. package/dist/__tests__/session-model.test.d.ts.map +0 -1
  492. package/dist/__tests__/session-model.test.js +0 -74
  493. package/dist/__tests__/session-model.test.js.map +0 -1
  494. package/dist/__tests__/session-pause-provisioning.test.d.ts +0 -19
  495. package/dist/__tests__/session-pause-provisioning.test.d.ts.map +0 -1
  496. package/dist/__tests__/session-pause-provisioning.test.js +0 -115
  497. package/dist/__tests__/session-pause-provisioning.test.js.map +0 -1
  498. package/dist/__tests__/session-reclamation.test.d.ts +0 -15
  499. package/dist/__tests__/session-reclamation.test.d.ts.map +0 -1
  500. package/dist/__tests__/session-reclamation.test.js +0 -73
  501. package/dist/__tests__/session-reclamation.test.js.map +0 -1
  502. package/dist/__tests__/session-record-disclosure.test.d.ts +0 -24
  503. package/dist/__tests__/session-record-disclosure.test.d.ts.map +0 -1
  504. package/dist/__tests__/session-record-disclosure.test.js +0 -494
  505. package/dist/__tests__/session-record-disclosure.test.js.map +0 -1
  506. package/dist/__tests__/session-status.test.d.ts +0 -11
  507. package/dist/__tests__/session-status.test.d.ts.map +0 -1
  508. package/dist/__tests__/session-status.test.js +0 -76
  509. package/dist/__tests__/session-status.test.js.map +0 -1
  510. package/dist/__tests__/session.test.d.ts +0 -15
  511. package/dist/__tests__/session.test.d.ts.map +0 -1
  512. package/dist/__tests__/session.test.js +0 -366
  513. package/dist/__tests__/session.test.js.map +0 -1
  514. package/dist/__tests__/shim-deploy-safety.test.d.ts +0 -24
  515. package/dist/__tests__/shim-deploy-safety.test.d.ts.map +0 -1
  516. package/dist/__tests__/shim-deploy-safety.test.js +0 -174
  517. package/dist/__tests__/shim-deploy-safety.test.js.map +0 -1
  518. package/dist/__tests__/slug-validation.test.d.ts +0 -13
  519. package/dist/__tests__/slug-validation.test.d.ts.map +0 -1
  520. package/dist/__tests__/slug-validation.test.js +0 -202
  521. package/dist/__tests__/slug-validation.test.js.map +0 -1
  522. package/dist/__tests__/standards-injection.test.d.ts +0 -2
  523. package/dist/__tests__/standards-injection.test.d.ts.map +0 -1
  524. package/dist/__tests__/standards-injection.test.js +0 -179
  525. package/dist/__tests__/standards-injection.test.js.map +0 -1
  526. package/dist/__tests__/start-config-conflict.test.d.ts +0 -17
  527. package/dist/__tests__/start-config-conflict.test.d.ts.map +0 -1
  528. package/dist/__tests__/start-config-conflict.test.js +0 -101
  529. package/dist/__tests__/start-config-conflict.test.js.map +0 -1
  530. package/dist/__tests__/start-interactive-role.test.d.ts +0 -22
  531. package/dist/__tests__/start-interactive-role.test.d.ts.map +0 -1
  532. package/dist/__tests__/start-interactive-role.test.js +0 -204
  533. package/dist/__tests__/start-interactive-role.test.js.map +0 -1
  534. package/dist/__tests__/start-rebase-never-ran.test.d.ts +0 -25
  535. package/dist/__tests__/start-rebase-never-ran.test.d.ts.map +0 -1
  536. package/dist/__tests__/start-rebase-never-ran.test.js +0 -227
  537. package/dist/__tests__/start-rebase-never-ran.test.js.map +0 -1
  538. package/dist/__tests__/start-report-generation-capture.test.d.ts +0 -17
  539. package/dist/__tests__/start-report-generation-capture.test.d.ts.map +0 -1
  540. package/dist/__tests__/start-report-generation-capture.test.js +0 -127
  541. package/dist/__tests__/start-report-generation-capture.test.js.map +0 -1
  542. package/dist/__tests__/start-report-integration.test.d.ts +0 -12
  543. package/dist/__tests__/start-report-integration.test.d.ts.map +0 -1
  544. package/dist/__tests__/start-report-integration.test.js +0 -138
  545. package/dist/__tests__/start-report-integration.test.js.map +0 -1
  546. package/dist/__tests__/start-runtime-wiring.test.d.ts +0 -31
  547. package/dist/__tests__/start-runtime-wiring.test.d.ts.map +0 -1
  548. package/dist/__tests__/start-runtime-wiring.test.js +0 -735
  549. package/dist/__tests__/start-runtime-wiring.test.js.map +0 -1
  550. package/dist/__tests__/start-stash.test.d.ts +0 -2
  551. package/dist/__tests__/start-stash.test.d.ts.map +0 -1
  552. package/dist/__tests__/start-stash.test.js +0 -131
  553. package/dist/__tests__/start-stash.test.js.map +0 -1
  554. package/dist/__tests__/start-sync-hardstop.test.d.ts +0 -15
  555. package/dist/__tests__/start-sync-hardstop.test.d.ts.map +0 -1
  556. package/dist/__tests__/start-sync-hardstop.test.js +0 -280
  557. package/dist/__tests__/start-sync-hardstop.test.js.map +0 -1
  558. package/dist/__tests__/start-team-identity.test.d.ts +0 -25
  559. package/dist/__tests__/start-team-identity.test.d.ts.map +0 -1
  560. package/dist/__tests__/start-team-identity.test.js +0 -307
  561. package/dist/__tests__/start-team-identity.test.js.map +0 -1
  562. package/dist/__tests__/startup-health-render.test.d.ts +0 -11
  563. package/dist/__tests__/startup-health-render.test.d.ts.map +0 -1
  564. package/dist/__tests__/startup-health-render.test.js +0 -60
  565. package/dist/__tests__/startup-health-render.test.js.map +0 -1
  566. package/dist/__tests__/startup-policy.test.d.ts +0 -2
  567. package/dist/__tests__/startup-policy.test.d.ts.map +0 -1
  568. package/dist/__tests__/startup-policy.test.js +0 -27
  569. package/dist/__tests__/startup-policy.test.js.map +0 -1
  570. package/dist/__tests__/startup-report.test.d.ts +0 -13
  571. package/dist/__tests__/startup-report.test.d.ts.map +0 -1
  572. package/dist/__tests__/startup-report.test.js +0 -278
  573. package/dist/__tests__/startup-report.test.js.map +0 -1
  574. package/dist/__tests__/startup-shipper.test.d.ts +0 -13
  575. package/dist/__tests__/startup-shipper.test.d.ts.map +0 -1
  576. package/dist/__tests__/startup-shipper.test.js +0 -149
  577. package/dist/__tests__/startup-shipper.test.js.map +0 -1
  578. package/dist/__tests__/stream-input-controller.test.d.ts +0 -10
  579. package/dist/__tests__/stream-input-controller.test.d.ts.map +0 -1
  580. package/dist/__tests__/stream-input-controller.test.js +0 -167
  581. package/dist/__tests__/stream-input-controller.test.js.map +0 -1
  582. package/dist/__tests__/team-memory-commands.test.d.ts +0 -11
  583. package/dist/__tests__/team-memory-commands.test.d.ts.map +0 -1
  584. package/dist/__tests__/team-memory-commands.test.js +0 -240
  585. package/dist/__tests__/team-memory-commands.test.js.map +0 -1
  586. package/dist/__tests__/team-name-propagation.test.d.ts +0 -13
  587. package/dist/__tests__/team-name-propagation.test.d.ts.map +0 -1
  588. package/dist/__tests__/team-name-propagation.test.js +0 -198
  589. package/dist/__tests__/team-name-propagation.test.js.map +0 -1
  590. package/dist/__tests__/team-token-probe.test.d.ts +0 -16
  591. package/dist/__tests__/team-token-probe.test.d.ts.map +0 -1
  592. package/dist/__tests__/team-token-probe.test.js +0 -295
  593. package/dist/__tests__/team-token-probe.test.js.map +0 -1
  594. package/dist/__tests__/template-budget.test.d.ts +0 -2
  595. package/dist/__tests__/template-budget.test.d.ts.map +0 -1
  596. package/dist/__tests__/template-budget.test.js +0 -119
  597. package/dist/__tests__/template-budget.test.js.map +0 -1
  598. package/dist/__tests__/template-sync.test.d.ts +0 -19
  599. package/dist/__tests__/template-sync.test.d.ts.map +0 -1
  600. package/dist/__tests__/template-sync.test.js +0 -480
  601. package/dist/__tests__/template-sync.test.js.map +0 -1
  602. package/dist/__tests__/test-project.test.d.ts +0 -18
  603. package/dist/__tests__/test-project.test.d.ts.map +0 -1
  604. package/dist/__tests__/test-project.test.js +0 -465
  605. package/dist/__tests__/test-project.test.js.map +0 -1
  606. package/dist/__tests__/tracked-instruction-files.test.d.ts +0 -21
  607. package/dist/__tests__/tracked-instruction-files.test.d.ts.map +0 -1
  608. package/dist/__tests__/tracked-instruction-files.test.js +0 -489
  609. package/dist/__tests__/tracked-instruction-files.test.js.map +0 -1
  610. package/dist/__tests__/unlock.test.d.ts +0 -11
  611. package/dist/__tests__/unlock.test.d.ts.map +0 -1
  612. package/dist/__tests__/unlock.test.js +0 -100
  613. package/dist/__tests__/unlock.test.js.map +0 -1
  614. package/dist/__tests__/usage-per-call-grouping.test.d.ts +0 -25
  615. package/dist/__tests__/usage-per-call-grouping.test.d.ts.map +0 -1
  616. package/dist/__tests__/usage-per-call-grouping.test.js +0 -952
  617. package/dist/__tests__/usage-per-call-grouping.test.js.map +0 -1
  618. package/dist/__tests__/usage-pricing.test.d.ts +0 -20
  619. package/dist/__tests__/usage-pricing.test.d.ts.map +0 -1
  620. package/dist/__tests__/usage-pricing.test.js +0 -176
  621. package/dist/__tests__/usage-pricing.test.js.map +0 -1
  622. package/dist/__tests__/usage-subagent-discovery.test.d.ts +0 -17
  623. package/dist/__tests__/usage-subagent-discovery.test.d.ts.map +0 -1
  624. package/dist/__tests__/usage-subagent-discovery.test.js +0 -213
  625. package/dist/__tests__/usage-subagent-discovery.test.js.map +0 -1
  626. package/dist/__tests__/verify-hooks-check-all.test.d.ts +0 -32
  627. package/dist/__tests__/verify-hooks-check-all.test.d.ts.map +0 -1
  628. package/dist/__tests__/verify-hooks-check-all.test.js +0 -563
  629. package/dist/__tests__/verify-hooks-check-all.test.js.map +0 -1
  630. package/dist/__tests__/verify-hooks-heal-log.test.d.ts +0 -11
  631. package/dist/__tests__/verify-hooks-heal-log.test.d.ts.map +0 -1
  632. package/dist/__tests__/verify-hooks-heal-log.test.js +0 -172
  633. package/dist/__tests__/verify-hooks-heal-log.test.js.map +0 -1
  634. package/dist/__tests__/worker-cap.test.d.ts +0 -14
  635. package/dist/__tests__/worker-cap.test.d.ts.map +0 -1
  636. package/dist/__tests__/worker-cap.test.js +0 -97
  637. package/dist/__tests__/worker-cap.test.js.map +0 -1
  638. package/dist/__tests__/worktree-link-repair.test.d.ts +0 -2
  639. package/dist/__tests__/worktree-link-repair.test.d.ts.map +0 -1
  640. package/dist/__tests__/worktree-link-repair.test.js +0 -471
  641. package/dist/__tests__/worktree-link-repair.test.js.map +0 -1
  642. package/dist/__tests__/worktree-sync-fixture.test.d.ts +0 -17
  643. package/dist/__tests__/worktree-sync-fixture.test.d.ts.map +0 -1
  644. package/dist/__tests__/worktree-sync-fixture.test.js +0 -519
  645. package/dist/__tests__/worktree-sync-fixture.test.js.map +0 -1
  646. package/dist/__tests__/worktree-sync-hardening.test.d.ts +0 -13
  647. package/dist/__tests__/worktree-sync-hardening.test.d.ts.map +0 -1
  648. package/dist/__tests__/worktree-sync-hardening.test.js +0 -919
  649. package/dist/__tests__/worktree-sync-hardening.test.js.map +0 -1
  650. package/dist/__tests__/worktree-sync-shell-free.test.d.ts +0 -25
  651. package/dist/__tests__/worktree-sync-shell-free.test.d.ts.map +0 -1
  652. package/dist/__tests__/worktree-sync-shell-free.test.js +0 -185
  653. package/dist/__tests__/worktree-sync-shell-free.test.js.map +0 -1
  654. package/dist/__tests__/worktree.test.d.ts +0 -2
  655. package/dist/__tests__/worktree.test.d.ts.map +0 -1
  656. package/dist/__tests__/worktree.test.js +0 -168
  657. package/dist/__tests__/worktree.test.js.map +0 -1
  658. package/dist/lib/code-context-file.test.d.ts +0 -19
  659. package/dist/lib/code-context-file.test.d.ts.map +0 -1
  660. package/dist/lib/code-context-file.test.js +0 -202
  661. package/dist/lib/code-context-file.test.js.map +0 -1
  662. package/dist/lib/harness/console/announce.test.d.ts +0 -2
  663. package/dist/lib/harness/console/announce.test.d.ts.map +0 -1
  664. package/dist/lib/harness/console/announce.test.js +0 -104
  665. package/dist/lib/harness/console/announce.test.js.map +0 -1
  666. package/dist/lib/harness/console/by-session.test.d.ts +0 -2
  667. package/dist/lib/harness/console/by-session.test.d.ts.map +0 -1
  668. package/dist/lib/harness/console/by-session.test.js +0 -86
  669. package/dist/lib/harness/console/by-session.test.js.map +0 -1
  670. package/dist/lib/harness/console/console.test.d.ts +0 -2
  671. package/dist/lib/harness/console/console.test.d.ts.map +0 -1
  672. package/dist/lib/harness/console/console.test.js +0 -269
  673. package/dist/lib/harness/console/console.test.js.map +0 -1
  674. package/dist/lib/harness/console/decision-request.test.d.ts +0 -2
  675. package/dist/lib/harness/console/decision-request.test.d.ts.map +0 -1
  676. package/dist/lib/harness/console/decision-request.test.js +0 -75
  677. package/dist/lib/harness/console/decision-request.test.js.map +0 -1
  678. package/dist/lib/harness/console/rank.test.d.ts +0 -2
  679. package/dist/lib/harness/console/rank.test.d.ts.map +0 -1
  680. package/dist/lib/harness/console/rank.test.js +0 -124
  681. package/dist/lib/harness/console/rank.test.js.map +0 -1
  682. package/dist/lib/harness/console/render.test.d.ts +0 -2
  683. package/dist/lib/harness/console/render.test.d.ts.map +0 -1
  684. package/dist/lib/harness/console/render.test.js +0 -96
  685. package/dist/lib/harness/console/render.test.js.map +0 -1
  686. package/dist/lib/harness/console/replay-cli.test.d.ts +0 -2
  687. package/dist/lib/harness/console/replay-cli.test.d.ts.map +0 -1
  688. package/dist/lib/harness/console/replay-cli.test.js +0 -96
  689. package/dist/lib/harness/console/replay-cli.test.js.map +0 -1
  690. package/dist/lib/harness/console/replay.test.d.ts +0 -2
  691. package/dist/lib/harness/console/replay.test.d.ts.map +0 -1
  692. package/dist/lib/harness/console/replay.test.js +0 -81
  693. package/dist/lib/harness/console/replay.test.js.map +0 -1
  694. package/dist/lib/harness/console/turn-reader.test.d.ts +0 -2
  695. package/dist/lib/harness/console/turn-reader.test.d.ts.map +0 -1
  696. package/dist/lib/harness/console/turn-reader.test.js +0 -108
  697. package/dist/lib/harness/console/turn-reader.test.js.map +0 -1
  698. package/dist/lib/harness/credential.test.d.ts +0 -2
  699. package/dist/lib/harness/credential.test.d.ts.map +0 -1
  700. package/dist/lib/harness/credential.test.js +0 -74
  701. package/dist/lib/harness/credential.test.js.map +0 -1
  702. package/dist/lib/harness/evaluate.test.d.ts +0 -2
  703. package/dist/lib/harness/evaluate.test.d.ts.map +0 -1
  704. package/dist/lib/harness/evaluate.test.js +0 -621
  705. package/dist/lib/harness/evaluate.test.js.map +0 -1
  706. package/dist/lib/harness/gate.test.d.ts +0 -2
  707. package/dist/lib/harness/gate.test.d.ts.map +0 -1
  708. package/dist/lib/harness/gate.test.js +0 -111
  709. package/dist/lib/harness/gate.test.js.map +0 -1
  710. package/dist/lib/harness/self-check.test.d.ts +0 -2
  711. package/dist/lib/harness/self-check.test.d.ts.map +0 -1
  712. package/dist/lib/harness/self-check.test.js +0 -43
  713. package/dist/lib/harness/self-check.test.js.map +0 -1
  714. package/dist/lib/harness/transcript.test.d.ts +0 -2
  715. package/dist/lib/harness/transcript.test.d.ts.map +0 -1
  716. package/dist/lib/harness/transcript.test.js +0 -118
  717. package/dist/lib/harness/transcript.test.js.map +0 -1
  718. package/dist/lib/projects-registry.test.d.ts +0 -2
  719. package/dist/lib/projects-registry.test.d.ts.map +0 -1
  720. package/dist/lib/projects-registry.test.js +0 -176
  721. package/dist/lib/projects-registry.test.js.map +0 -1
  722. package/dist/lib/roster.test.d.ts +0 -15
  723. package/dist/lib/roster.test.d.ts.map +0 -1
  724. package/dist/lib/roster.test.js +0 -299
  725. package/dist/lib/roster.test.js.map +0 -1
  726. package/dist/lib/vault.test.d.ts +0 -17
  727. package/dist/lib/vault.test.d.ts.map +0 -1
  728. package/dist/lib/vault.test.js +0 -169
  729. package/dist/lib/vault.test.js.map +0 -1
  730. package/dist/lib/window-view.test.d.ts +0 -2
  731. package/dist/lib/window-view.test.d.ts.map +0 -1
  732. package/dist/lib/window-view.test.js +0 -168
  733. package/dist/lib/window-view.test.js.map +0 -1
  734. package/dist/standards/fail-loud-standard.md +0 -495
  735. package/dist/standards/known-issues-standard.md +0 -380
  736. 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