@memnexus-ai/mx-agent-cli 0.1.294-next.0 → 0.1.295-next.0

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 (450) hide show
  1. package/dist/__tests__/agents-md-canonicalization.test.js +31 -1
  2. package/dist/__tests__/agents-md-canonicalization.test.js.map +1 -1
  3. package/dist/__tests__/behavioral-extraction.test.js +50 -0
  4. package/dist/__tests__/behavioral-extraction.test.js.map +1 -1
  5. package/dist/__tests__/bootstrap-behavioral-contract.test.js +6 -3
  6. package/dist/__tests__/bootstrap-behavioral-contract.test.js.map +1 -1
  7. package/dist/__tests__/bundle-config.test.js +28 -2
  8. package/dist/__tests__/bundle-config.test.js.map +1 -1
  9. package/dist/__tests__/catalog-interaction.test.d.ts +25 -0
  10. package/dist/__tests__/catalog-interaction.test.d.ts.map +1 -0
  11. package/dist/__tests__/catalog-interaction.test.js +269 -0
  12. package/dist/__tests__/catalog-interaction.test.js.map +1 -0
  13. package/dist/__tests__/catalog-named-memories.test.d.ts +2 -0
  14. package/dist/__tests__/catalog-named-memories.test.d.ts.map +1 -0
  15. package/dist/__tests__/catalog-named-memories.test.js +204 -0
  16. package/dist/__tests__/catalog-named-memories.test.js.map +1 -0
  17. package/dist/__tests__/catalog-origin-main.test.d.ts +15 -0
  18. package/dist/__tests__/catalog-origin-main.test.d.ts.map +1 -0
  19. package/dist/__tests__/catalog-origin-main.test.js +296 -0
  20. package/dist/__tests__/catalog-origin-main.test.js.map +1 -0
  21. package/dist/__tests__/catalog.test.d.ts +2 -0
  22. package/dist/__tests__/catalog.test.d.ts.map +1 -0
  23. package/dist/__tests__/catalog.test.js +131 -0
  24. package/dist/__tests__/catalog.test.js.map +1 -0
  25. package/dist/__tests__/cli-build-integration.test.d.ts +2 -0
  26. package/dist/__tests__/cli-build-integration.test.d.ts.map +1 -0
  27. package/dist/__tests__/cli-build-integration.test.js +64 -0
  28. package/dist/__tests__/cli-build-integration.test.js.map +1 -0
  29. package/dist/__tests__/cli-build.test.d.ts +2 -0
  30. package/dist/__tests__/cli-build.test.d.ts.map +1 -0
  31. package/dist/__tests__/cli-build.test.js +640 -0
  32. package/dist/__tests__/cli-build.test.js.map +1 -0
  33. package/dist/__tests__/codex-deploy-config.test.js +60 -0
  34. package/dist/__tests__/codex-deploy-config.test.js.map +1 -1
  35. package/dist/__tests__/completion-rows-discriminate.test.d.ts +20 -0
  36. package/dist/__tests__/completion-rows-discriminate.test.d.ts.map +1 -0
  37. package/dist/__tests__/completion-rows-discriminate.test.js +481 -0
  38. package/dist/__tests__/completion-rows-discriminate.test.js.map +1 -0
  39. package/dist/__tests__/config-fidelity-archived-symlinks.test.d.ts +2 -0
  40. package/dist/__tests__/config-fidelity-archived-symlinks.test.d.ts.map +1 -0
  41. package/dist/__tests__/config-fidelity-archived-symlinks.test.js +127 -0
  42. package/dist/__tests__/config-fidelity-archived-symlinks.test.js.map +1 -0
  43. package/dist/__tests__/config-fidelity-display.test.d.ts +2 -0
  44. package/dist/__tests__/config-fidelity-display.test.d.ts.map +1 -0
  45. package/dist/__tests__/config-fidelity-display.test.js +77 -0
  46. package/dist/__tests__/config-fidelity-display.test.js.map +1 -0
  47. package/dist/__tests__/config-fidelity.test.js +166 -33
  48. package/dist/__tests__/config-fidelity.test.js.map +1 -1
  49. package/dist/__tests__/config-generation-gate.test.js +78 -0
  50. package/dist/__tests__/config-generation-gate.test.js.map +1 -1
  51. package/dist/__tests__/config-sync.test.js +35 -0
  52. package/dist/__tests__/config-sync.test.js.map +1 -1
  53. package/dist/__tests__/coordination-401-production-wiring.test.js +12 -7
  54. package/dist/__tests__/coordination-401-production-wiring.test.js.map +1 -1
  55. package/dist/__tests__/coordination-401-recovery.test.js +39 -32
  56. package/dist/__tests__/coordination-401-recovery.test.js.map +1 -1
  57. package/dist/__tests__/coordination-brief-pin.test.js +21 -8
  58. package/dist/__tests__/coordination-brief-pin.test.js.map +1 -1
  59. package/dist/__tests__/coordination-client.test.js +227 -3
  60. package/dist/__tests__/coordination-client.test.js.map +1 -1
  61. package/dist/__tests__/coordination-credential-endpoint.test.d.ts +24 -0
  62. package/dist/__tests__/coordination-credential-endpoint.test.d.ts.map +1 -0
  63. package/dist/__tests__/coordination-credential-endpoint.test.js +1230 -0
  64. package/dist/__tests__/coordination-credential-endpoint.test.js.map +1 -0
  65. package/dist/__tests__/coordination-memory.test.js +20 -4
  66. package/dist/__tests__/coordination-memory.test.js.map +1 -1
  67. package/dist/__tests__/coordination-provision.test.js +22 -14
  68. package/dist/__tests__/coordination-provision.test.js.map +1 -1
  69. package/dist/__tests__/coordination-status-registration.test.d.ts +16 -0
  70. package/dist/__tests__/coordination-status-registration.test.d.ts.map +1 -0
  71. package/dist/__tests__/coordination-status-registration.test.js +480 -0
  72. package/dist/__tests__/coordination-status-registration.test.js.map +1 -0
  73. package/dist/__tests__/coordination-token-multitenant.test.js +11 -11
  74. package/dist/__tests__/coordination-token-multitenant.test.js.map +1 -1
  75. package/dist/__tests__/coordination-token.test.js +35 -28
  76. package/dist/__tests__/coordination-token.test.js.map +1 -1
  77. package/dist/__tests__/creation-pr-class-check.test.d.ts +17 -0
  78. package/dist/__tests__/creation-pr-class-check.test.d.ts.map +1 -0
  79. package/dist/__tests__/creation-pr-class-check.test.js +346 -0
  80. package/dist/__tests__/creation-pr-class-check.test.js.map +1 -0
  81. package/dist/__tests__/digest-team-omission.test.d.ts +15 -0
  82. package/dist/__tests__/digest-team-omission.test.d.ts.map +1 -0
  83. package/dist/__tests__/digest-team-omission.test.js +247 -0
  84. package/dist/__tests__/digest-team-omission.test.js.map +1 -0
  85. package/dist/__tests__/doctor-worktree-path.test.d.ts +17 -0
  86. package/dist/__tests__/doctor-worktree-path.test.d.ts.map +1 -0
  87. package/dist/__tests__/doctor-worktree-path.test.js +158 -0
  88. package/dist/__tests__/doctor-worktree-path.test.js.map +1 -0
  89. package/dist/__tests__/fleet-data.test.js +40 -7
  90. package/dist/__tests__/fleet-data.test.js.map +1 -1
  91. package/dist/__tests__/fleet-tmux.test.js +2 -2
  92. package/dist/__tests__/fleet-tmux.test.js.map +1 -1
  93. package/dist/__tests__/generate-claude.test.js +137 -3
  94. package/dist/__tests__/generate-claude.test.js.map +1 -1
  95. package/dist/__tests__/git-env.test.d.ts +14 -0
  96. package/dist/__tests__/git-env.test.d.ts.map +1 -0
  97. package/dist/__tests__/git-env.test.js +131 -0
  98. package/dist/__tests__/git-env.test.js.map +1 -0
  99. package/dist/__tests__/git-identity-isolation.test.d.ts +33 -0
  100. package/dist/__tests__/git-identity-isolation.test.d.ts.map +1 -0
  101. package/dist/__tests__/git-identity-isolation.test.js +626 -0
  102. package/dist/__tests__/git-identity-isolation.test.js.map +1 -0
  103. package/dist/__tests__/hook-heal.test.js +17 -0
  104. package/dist/__tests__/hook-heal.test.js.map +1 -1
  105. package/dist/__tests__/init-coordination-url.test.d.ts +11 -0
  106. package/dist/__tests__/init-coordination-url.test.d.ts.map +1 -0
  107. package/dist/__tests__/init-coordination-url.test.js +114 -0
  108. package/dist/__tests__/init-coordination-url.test.js.map +1 -0
  109. package/dist/__tests__/memory-autocreate.test.js +574 -8
  110. package/dist/__tests__/memory-autocreate.test.js.map +1 -1
  111. package/dist/__tests__/memory-log-result.test.d.ts +13 -0
  112. package/dist/__tests__/memory-log-result.test.d.ts.map +1 -0
  113. package/dist/__tests__/memory-log-result.test.js +113 -0
  114. package/dist/__tests__/memory-log-result.test.js.map +1 -0
  115. package/dist/__tests__/memory-named-exists.test.d.ts +16 -0
  116. package/dist/__tests__/memory-named-exists.test.d.ts.map +1 -0
  117. package/dist/__tests__/memory-named-exists.test.js +288 -0
  118. package/dist/__tests__/memory-named-exists.test.js.map +1 -0
  119. package/dist/__tests__/mx-agent-cli-pin-validation.test.js +23 -47
  120. package/dist/__tests__/mx-agent-cli-pin-validation.test.js.map +1 -1
  121. package/dist/__tests__/mx-agent-cli-version-pin.test.js +34 -88
  122. package/dist/__tests__/mx-agent-cli-version-pin.test.js.map +1 -1
  123. package/dist/__tests__/new-project-first-team.test.d.ts +15 -0
  124. package/dist/__tests__/new-project-first-team.test.d.ts.map +1 -0
  125. package/dist/__tests__/new-project-first-team.test.js +263 -0
  126. package/dist/__tests__/new-project-first-team.test.js.map +1 -0
  127. package/dist/__tests__/otel-env.test.d.ts +2 -0
  128. package/dist/__tests__/otel-env.test.d.ts.map +1 -0
  129. package/dist/__tests__/otel-env.test.js +127 -0
  130. package/dist/__tests__/otel-env.test.js.map +1 -0
  131. package/dist/__tests__/project-config.test.js +283 -1
  132. package/dist/__tests__/project-config.test.js.map +1 -1
  133. package/dist/__tests__/provision-behavioral-contract.test.js +96 -4
  134. package/dist/__tests__/provision-behavioral-contract.test.js.map +1 -1
  135. package/dist/__tests__/provision-catalog-precondition.test.d.ts +26 -0
  136. package/dist/__tests__/provision-catalog-precondition.test.d.ts.map +1 -0
  137. package/dist/__tests__/provision-catalog-precondition.test.js +620 -0
  138. package/dist/__tests__/provision-catalog-precondition.test.js.map +1 -0
  139. package/dist/__tests__/provision-completion-rows.test.d.ts +17 -0
  140. package/dist/__tests__/provision-completion-rows.test.d.ts.map +1 -0
  141. package/dist/__tests__/provision-completion-rows.test.js +3095 -0
  142. package/dist/__tests__/provision-completion-rows.test.js.map +1 -0
  143. package/dist/__tests__/provision-identity-gate.test.d.ts +20 -0
  144. package/dist/__tests__/provision-identity-gate.test.d.ts.map +1 -0
  145. package/dist/__tests__/provision-identity-gate.test.js +600 -0
  146. package/dist/__tests__/provision-identity-gate.test.js.map +1 -0
  147. package/dist/__tests__/provision-resume.test.d.ts +26 -0
  148. package/dist/__tests__/provision-resume.test.d.ts.map +1 -0
  149. package/dist/__tests__/provision-resume.test.js +1164 -0
  150. package/dist/__tests__/provision-resume.test.js.map +1 -0
  151. package/dist/__tests__/provision-roleguide-anchors.test.d.ts +27 -0
  152. package/dist/__tests__/provision-roleguide-anchors.test.d.ts.map +1 -0
  153. package/dist/__tests__/provision-roleguide-anchors.test.js +747 -0
  154. package/dist/__tests__/provision-roleguide-anchors.test.js.map +1 -0
  155. package/dist/__tests__/provision-skeleton-fill.test.d.ts +16 -0
  156. package/dist/__tests__/provision-skeleton-fill.test.d.ts.map +1 -0
  157. package/dist/__tests__/provision-skeleton-fill.test.js +488 -0
  158. package/dist/__tests__/provision-skeleton-fill.test.js.map +1 -0
  159. package/dist/__tests__/provision-teambuilder-flow.test.js +93 -7
  160. package/dist/__tests__/provision-teambuilder-flow.test.js.map +1 -1
  161. package/dist/__tests__/repo-guard-wiring.test.d.ts +21 -0
  162. package/dist/__tests__/repo-guard-wiring.test.d.ts.map +1 -0
  163. package/dist/__tests__/repo-guard-wiring.test.js +638 -0
  164. package/dist/__tests__/repo-guard-wiring.test.js.map +1 -0
  165. package/dist/__tests__/runtime-codex-gateway-pilot.test.d.ts +2 -0
  166. package/dist/__tests__/runtime-codex-gateway-pilot.test.d.ts.map +1 -0
  167. package/dist/__tests__/runtime-codex-gateway-pilot.test.js +309 -0
  168. package/dist/__tests__/runtime-codex-gateway-pilot.test.js.map +1 -0
  169. package/dist/__tests__/runtime-codex-gateway-provider.test.d.ts +2 -0
  170. package/dist/__tests__/runtime-codex-gateway-provider.test.d.ts.map +1 -0
  171. package/dist/__tests__/runtime-codex-gateway-provider.test.js +163 -0
  172. package/dist/__tests__/runtime-codex-gateway-provider.test.js.map +1 -0
  173. package/dist/__tests__/runtime-identity.test.d.ts +2 -0
  174. package/dist/__tests__/runtime-identity.test.d.ts.map +1 -0
  175. package/dist/__tests__/runtime-identity.test.js +117 -0
  176. package/dist/__tests__/runtime-identity.test.js.map +1 -0
  177. package/dist/__tests__/session-pause-provisioning.test.js +6 -1
  178. package/dist/__tests__/session-pause-provisioning.test.js.map +1 -1
  179. package/dist/__tests__/session-record-disclosure.test.d.ts +24 -0
  180. package/dist/__tests__/session-record-disclosure.test.d.ts.map +1 -0
  181. package/dist/__tests__/session-record-disclosure.test.js +494 -0
  182. package/dist/__tests__/session-record-disclosure.test.js.map +1 -0
  183. package/dist/__tests__/session.test.js +35 -0
  184. package/dist/__tests__/session.test.js.map +1 -1
  185. package/dist/__tests__/slug-validation.test.js +27 -21
  186. package/dist/__tests__/slug-validation.test.js.map +1 -1
  187. package/dist/__tests__/standards-injection.test.js +23 -1
  188. package/dist/__tests__/standards-injection.test.js.map +1 -1
  189. package/dist/__tests__/start-interactive-role.test.d.ts +22 -0
  190. package/dist/__tests__/start-interactive-role.test.d.ts.map +1 -0
  191. package/dist/__tests__/start-interactive-role.test.js +204 -0
  192. package/dist/__tests__/start-interactive-role.test.js.map +1 -0
  193. package/dist/__tests__/start-team-identity.test.d.ts +25 -0
  194. package/dist/__tests__/start-team-identity.test.d.ts.map +1 -0
  195. package/dist/__tests__/start-team-identity.test.js +307 -0
  196. package/dist/__tests__/start-team-identity.test.js.map +1 -0
  197. package/dist/__tests__/team-memory-commands.test.js +142 -19
  198. package/dist/__tests__/team-memory-commands.test.js.map +1 -1
  199. package/dist/__tests__/template-sync.test.d.ts +19 -0
  200. package/dist/__tests__/template-sync.test.d.ts.map +1 -0
  201. package/dist/__tests__/template-sync.test.js +270 -0
  202. package/dist/__tests__/template-sync.test.js.map +1 -0
  203. package/dist/__tests__/test-project.test.d.ts +18 -0
  204. package/dist/__tests__/test-project.test.d.ts.map +1 -0
  205. package/dist/__tests__/test-project.test.js +465 -0
  206. package/dist/__tests__/test-project.test.js.map +1 -0
  207. package/dist/__tests__/usage-per-call-grouping.test.d.ts +25 -0
  208. package/dist/__tests__/usage-per-call-grouping.test.d.ts.map +1 -0
  209. package/dist/__tests__/usage-per-call-grouping.test.js +952 -0
  210. package/dist/__tests__/usage-per-call-grouping.test.js.map +1 -0
  211. package/dist/__tests__/verify-hooks-check-all.test.d.ts +32 -0
  212. package/dist/__tests__/verify-hooks-check-all.test.d.ts.map +1 -0
  213. package/dist/__tests__/verify-hooks-check-all.test.js +553 -0
  214. package/dist/__tests__/verify-hooks-check-all.test.js.map +1 -0
  215. package/dist/__tests__/worktree-sync-fixture.test.d.ts +17 -0
  216. package/dist/__tests__/worktree-sync-fixture.test.d.ts.map +1 -0
  217. package/dist/__tests__/worktree-sync-fixture.test.js +519 -0
  218. package/dist/__tests__/worktree-sync-fixture.test.js.map +1 -0
  219. package/dist/__tests__/worktree-sync-hardening.test.d.ts +13 -0
  220. package/dist/__tests__/worktree-sync-hardening.test.d.ts.map +1 -0
  221. package/dist/__tests__/worktree-sync-hardening.test.js +919 -0
  222. package/dist/__tests__/worktree-sync-hardening.test.js.map +1 -0
  223. package/dist/__tests__/worktree-sync-shell-free.test.d.ts +25 -0
  224. package/dist/__tests__/worktree-sync-shell-free.test.d.ts.map +1 -0
  225. package/dist/__tests__/worktree-sync-shell-free.test.js +185 -0
  226. package/dist/__tests__/worktree-sync-shell-free.test.js.map +1 -0
  227. package/dist/__tests__/worktree.test.js +75 -1
  228. package/dist/__tests__/worktree.test.js.map +1 -1
  229. package/dist/agent-config/.mx-config-generation.json +2 -2
  230. package/dist/agent-config/AGENTS.md.template +2 -2
  231. package/dist/agent-config/agents/bar-raiser.md +34 -1
  232. package/dist/agent-config/agents/red-team.md +34 -1
  233. package/dist/agent-config/agents/security-reviewer.md +22 -1
  234. package/dist/agent-config/claude-md/CLAUDE.core.md +6 -1
  235. package/dist/agent-config/claude-md/CLAUDE.overlay.memnexus.md +1 -3
  236. package/dist/agent-config/coordination-rosters.generated.json +10 -0
  237. package/dist/agent-config/hooks/HOOK-TIMEOUTS.md +27 -1
  238. package/dist/agent-config/hooks/OR-TRUE-AUDIT.md +8 -8
  239. package/dist/agent-config/hooks/auto-capture-precompact.sh +279 -0
  240. package/dist/agent-config/hooks/auto-capture-session-end.sh +277 -0
  241. package/dist/agent-config/hooks/coordination-brief.sh +290 -245
  242. package/dist/agent-config/hooks/deploy-verification-reminder.sh +359 -22
  243. package/dist/agent-config/hooks/git-mutation-guard.sh +85 -13
  244. package/dist/agent-config/hooks/session-idle-gate.sh +177 -12
  245. package/dist/agent-config/hooks/subagent-write-guard.sh +670 -0
  246. package/dist/agent-config/hooks/worktree-guard.sh +36 -7
  247. package/dist/agent-config/settings.json +15 -2
  248. package/dist/agent-config/shared/creation-pr-review-checklist.md +317 -0
  249. package/dist/commands/bootstrap.d.ts.map +1 -1
  250. package/dist/commands/bootstrap.js +22 -10
  251. package/dist/commands/bootstrap.js.map +1 -1
  252. package/dist/commands/config.d.ts.map +1 -1
  253. package/dist/commands/config.js +28 -1
  254. package/dist/commands/config.js.map +1 -1
  255. package/dist/commands/coordination.d.ts +150 -8
  256. package/dist/commands/coordination.d.ts.map +1 -1
  257. package/dist/commands/coordination.js +519 -25
  258. package/dist/commands/coordination.js.map +1 -1
  259. package/dist/commands/create.d.ts +913 -1
  260. package/dist/commands/create.d.ts.map +1 -1
  261. package/dist/commands/create.js +4879 -345
  262. package/dist/commands/create.js.map +1 -1
  263. package/dist/commands/digest.d.ts.map +1 -1
  264. package/dist/commands/digest.js +91 -7
  265. package/dist/commands/digest.js.map +1 -1
  266. package/dist/commands/fleet-tmux.js +1 -1
  267. package/dist/commands/fleet-tmux.js.map +1 -1
  268. package/dist/commands/init.d.ts +8 -0
  269. package/dist/commands/init.d.ts.map +1 -1
  270. package/dist/commands/init.js +26 -1
  271. package/dist/commands/init.js.map +1 -1
  272. package/dist/commands/list.d.ts +32 -1
  273. package/dist/commands/list.d.ts.map +1 -1
  274. package/dist/commands/list.js +98 -5
  275. package/dist/commands/list.js.map +1 -1
  276. package/dist/commands/new.d.ts +2 -0
  277. package/dist/commands/new.d.ts.map +1 -1
  278. package/dist/commands/new.js +114 -21
  279. package/dist/commands/new.js.map +1 -1
  280. package/dist/commands/session.js +1 -1
  281. package/dist/commands/session.js.map +1 -1
  282. package/dist/commands/start.d.ts +38 -0
  283. package/dist/commands/start.d.ts.map +1 -1
  284. package/dist/commands/start.js +171 -8
  285. package/dist/commands/start.js.map +1 -1
  286. package/dist/commands/sync.d.ts +57 -0
  287. package/dist/commands/sync.d.ts.map +1 -1
  288. package/dist/commands/sync.js +117 -3
  289. package/dist/commands/sync.js.map +1 -1
  290. package/dist/commands/usage.d.ts +64 -0
  291. package/dist/commands/usage.d.ts.map +1 -1
  292. package/dist/commands/usage.js +96 -3
  293. package/dist/commands/usage.js.map +1 -1
  294. package/dist/commands/verify-hooks.d.ts +37 -1
  295. package/dist/commands/verify-hooks.d.ts.map +1 -1
  296. package/dist/commands/verify-hooks.js +114 -2
  297. package/dist/commands/verify-hooks.js.map +1 -1
  298. package/dist/commands/window.d.ts +10 -0
  299. package/dist/commands/window.d.ts.map +1 -0
  300. package/dist/commands/window.js +265 -0
  301. package/dist/commands/window.js.map +1 -0
  302. package/dist/commands/worktree-sync.d.ts +54 -0
  303. package/dist/commands/worktree-sync.d.ts.map +1 -0
  304. package/dist/commands/worktree-sync.js +135 -0
  305. package/dist/commands/worktree-sync.js.map +1 -0
  306. package/dist/index.d.ts.map +1 -1
  307. package/dist/index.js +122 -11
  308. package/dist/index.js.map +1 -1
  309. package/dist/lib/agent-session.d.ts.map +1 -1
  310. package/dist/lib/agent-session.js +6 -1
  311. package/dist/lib/agent-session.js.map +1 -1
  312. package/dist/lib/catalog.d.ts +321 -2
  313. package/dist/lib/catalog.d.ts.map +1 -1
  314. package/dist/lib/catalog.js +490 -11
  315. package/dist/lib/catalog.js.map +1 -1
  316. package/dist/lib/claude.d.ts +53 -23
  317. package/dist/lib/claude.d.ts.map +1 -1
  318. package/dist/lib/claude.js +306 -17
  319. package/dist/lib/claude.js.map +1 -1
  320. package/dist/lib/cli-build.d.ts +172 -0
  321. package/dist/lib/cli-build.d.ts.map +1 -0
  322. package/dist/lib/cli-build.js +654 -0
  323. package/dist/lib/cli-build.js.map +1 -0
  324. package/dist/lib/code-context-file.d.ts +109 -0
  325. package/dist/lib/code-context-file.d.ts.map +1 -0
  326. package/dist/lib/code-context-file.js +219 -0
  327. package/dist/lib/code-context-file.js.map +1 -0
  328. package/dist/lib/code-context-file.test.d.ts +19 -0
  329. package/dist/lib/code-context-file.test.d.ts.map +1 -0
  330. package/dist/lib/code-context-file.test.js +202 -0
  331. package/dist/lib/code-context-file.test.js.map +1 -0
  332. package/dist/lib/config-fidelity.d.ts +40 -20
  333. package/dist/lib/config-fidelity.d.ts.map +1 -1
  334. package/dist/lib/config-fidelity.js +144 -56
  335. package/dist/lib/config-fidelity.js.map +1 -1
  336. package/dist/lib/coordination-client.d.ts +73 -0
  337. package/dist/lib/coordination-client.d.ts.map +1 -1
  338. package/dist/lib/coordination-client.js +180 -8
  339. package/dist/lib/coordination-client.js.map +1 -1
  340. package/dist/lib/coordination-token.d.ts +304 -6
  341. package/dist/lib/coordination-token.d.ts.map +1 -1
  342. package/dist/lib/coordination-token.js +851 -52
  343. package/dist/lib/coordination-token.js.map +1 -1
  344. package/dist/lib/fleet-data.d.ts +34 -0
  345. package/dist/lib/fleet-data.d.ts.map +1 -1
  346. package/dist/lib/fleet-data.js +37 -9
  347. package/dist/lib/fleet-data.js.map +1 -1
  348. package/dist/lib/fleet-render.js +1 -1
  349. package/dist/lib/fleet-render.js.map +1 -1
  350. package/dist/lib/git-identity.d.ts +302 -0
  351. package/dist/lib/git-identity.d.ts.map +1 -0
  352. package/dist/lib/git-identity.js +546 -0
  353. package/dist/lib/git-identity.js.map +1 -0
  354. package/dist/lib/hook-staleness.d.ts +95 -0
  355. package/dist/lib/hook-staleness.d.ts.map +1 -0
  356. package/dist/lib/hook-staleness.js +304 -0
  357. package/dist/lib/hook-staleness.js.map +1 -0
  358. package/dist/lib/jsonl.d.ts +270 -2
  359. package/dist/lib/jsonl.d.ts.map +1 -1
  360. package/dist/lib/jsonl.js +472 -76
  361. package/dist/lib/jsonl.js.map +1 -1
  362. package/dist/lib/memory.d.ts +350 -23
  363. package/dist/lib/memory.d.ts.map +1 -1
  364. package/dist/lib/memory.js +751 -38
  365. package/dist/lib/memory.js.map +1 -1
  366. package/dist/lib/otel-env.d.ts +90 -0
  367. package/dist/lib/otel-env.d.ts.map +1 -0
  368. package/dist/lib/otel-env.js +98 -0
  369. package/dist/lib/otel-env.js.map +1 -0
  370. package/dist/lib/project-config.d.ts +167 -0
  371. package/dist/lib/project-config.d.ts.map +1 -1
  372. package/dist/lib/project-config.js +321 -5
  373. package/dist/lib/project-config.js.map +1 -1
  374. package/dist/lib/projects-registry.d.ts +82 -0
  375. package/dist/lib/projects-registry.d.ts.map +1 -0
  376. package/dist/lib/projects-registry.js +145 -0
  377. package/dist/lib/projects-registry.js.map +1 -0
  378. package/dist/lib/projects-registry.test.d.ts +2 -0
  379. package/dist/lib/projects-registry.test.d.ts.map +1 -0
  380. package/dist/lib/projects-registry.test.js +176 -0
  381. package/dist/lib/projects-registry.test.js.map +1 -0
  382. package/dist/lib/repo-guard-scope.d.ts +126 -0
  383. package/dist/lib/repo-guard-scope.d.ts.map +1 -0
  384. package/dist/lib/repo-guard-scope.js +249 -0
  385. package/dist/lib/repo-guard-scope.js.map +1 -0
  386. package/dist/lib/roster.d.ts +87 -0
  387. package/dist/lib/roster.d.ts.map +1 -0
  388. package/dist/lib/roster.js +332 -0
  389. package/dist/lib/roster.js.map +1 -0
  390. package/dist/lib/roster.test.d.ts +15 -0
  391. package/dist/lib/roster.test.d.ts.map +1 -0
  392. package/dist/lib/roster.test.js +299 -0
  393. package/dist/lib/roster.test.js.map +1 -0
  394. package/dist/lib/runtime/codex-adapter.d.ts.map +1 -1
  395. package/dist/lib/runtime/codex-adapter.js +5 -0
  396. package/dist/lib/runtime/codex-adapter.js.map +1 -1
  397. package/dist/lib/runtime/codex-config.d.ts +129 -0
  398. package/dist/lib/runtime/codex-config.d.ts.map +1 -1
  399. package/dist/lib/runtime/codex-config.js +225 -0
  400. package/dist/lib/runtime/codex-config.js.map +1 -1
  401. package/dist/lib/runtime/identity.d.ts +72 -0
  402. package/dist/lib/runtime/identity.d.ts.map +1 -0
  403. package/dist/lib/runtime/identity.js +128 -0
  404. package/dist/lib/runtime/identity.js.map +1 -0
  405. package/dist/lib/standards.d.ts +10 -1
  406. package/dist/lib/standards.d.ts.map +1 -1
  407. package/dist/lib/standards.js +8 -1
  408. package/dist/lib/standards.js.map +1 -1
  409. package/dist/lib/team-identity.d.ts +134 -0
  410. package/dist/lib/team-identity.d.ts.map +1 -0
  411. package/dist/lib/team-identity.js +193 -0
  412. package/dist/lib/team-identity.js.map +1 -0
  413. package/dist/lib/templates.d.ts +29 -2
  414. package/dist/lib/templates.d.ts.map +1 -1
  415. package/dist/lib/templates.js +1042 -82
  416. package/dist/lib/templates.js.map +1 -1
  417. package/dist/lib/test-project.d.ts +95 -0
  418. package/dist/lib/test-project.d.ts.map +1 -0
  419. package/dist/lib/test-project.js +103 -0
  420. package/dist/lib/test-project.js.map +1 -0
  421. package/dist/lib/vault.d.ts +60 -0
  422. package/dist/lib/vault.d.ts.map +1 -0
  423. package/dist/lib/vault.js +102 -0
  424. package/dist/lib/vault.js.map +1 -0
  425. package/dist/lib/vault.test.d.ts +17 -0
  426. package/dist/lib/vault.test.d.ts.map +1 -0
  427. package/dist/lib/vault.test.js +169 -0
  428. package/dist/lib/vault.test.js.map +1 -0
  429. package/dist/lib/window-view.d.ts +63 -0
  430. package/dist/lib/window-view.d.ts.map +1 -0
  431. package/dist/lib/window-view.js +217 -0
  432. package/dist/lib/window-view.js.map +1 -0
  433. package/dist/lib/window-view.test.d.ts +2 -0
  434. package/dist/lib/window-view.test.d.ts.map +1 -0
  435. package/dist/lib/window-view.test.js +168 -0
  436. package/dist/lib/window-view.test.js.map +1 -0
  437. package/dist/lib/worktree-sync.d.ts +439 -0
  438. package/dist/lib/worktree-sync.d.ts.map +1 -0
  439. package/dist/lib/worktree-sync.js +1167 -0
  440. package/dist/lib/worktree-sync.js.map +1 -0
  441. package/dist/lib/worktree.d.ts +58 -1
  442. package/dist/lib/worktree.d.ts.map +1 -1
  443. package/dist/lib/worktree.js +91 -4
  444. package/dist/lib/worktree.js.map +1 -1
  445. package/dist/standards/decision-request.md +8 -0
  446. package/dist/standards/po-communication-standard.md +126 -0
  447. package/dist/standards/report-format.md +8 -0
  448. package/dist/standards/writing-standard.md +146 -4
  449. package/package.json +1 -1
  450. package/scripts/generate-claude.mjs +119 -46
@@ -0,0 +1,87 @@
1
+ /**
2
+ * Reads the coordination roster on a git ref, as three outcomes (#77).
3
+ *
4
+ * The roster decides which team identity may fetch a token from the dev vault
5
+ * (`coordination-token.ts:75,80,234-243`). Two committed artifacts hold it, and
6
+ * a team is registered only when BOTH do:
7
+ *
8
+ * - `coordination-service/src/config/rosters.ts`, the single source, compiled
9
+ * into the service. Editing it and deploying is what makes the service
10
+ * accept the team's messages.
11
+ * - `mx-agent-system/agent-config/coordination-rosters.generated.json`, the
12
+ * offline file the CLI token gate and the session-start hook read from the
13
+ * calling worktree's checkout. Regenerating it is a manual two-command step
14
+ * (`generate-rosters.ts:10-11`).
15
+ *
16
+ * This module READS both on a ref. It writes nothing, edits no roster, mints
17
+ * nothing, and makes no network call: the ref is local, updated by the fetch the
18
+ * caller already ran. Neither read can tell whether the service was redeployed
19
+ * after the roster changed, and the row that prints these answers says so.
20
+ *
21
+ * `unresolvable` is its own answer, not a synonym for `absent`, for the reason
22
+ * `catalogEntryOnOriginMain` states: a failed fetch leaves a remote-tracking ref
23
+ * of unknown age, so an entry merged since would read as missing and the
24
+ * operator would be told to make an edit that is already on the base branch
25
+ * (`mx-agent-system/standards/fail-loud-standard.md`).
26
+ */
27
+ /** Passed, failed and could-not-run, in the shape `catalogEntryOnRef` returns. */
28
+ export type RosterOutcome = 'present' | 'absent' | 'unresolvable';
29
+ /** The offline roster file, `/`-separated because a git object path always is. */
30
+ export declare const ROSTER_JSON_PATH = "mx-agent-system/agent-config/coordination-rosters.generated.json";
31
+ /** The single-source roster module, compiled into the coordination service. */
32
+ export declare const ROSTER_SOURCE_PATH = "mx-agent-system/coordination-service/src/config/rosters.ts";
33
+ export interface RosterReadOptions {
34
+ /** The project the roster is keyed by, e.g. `mx-agent`. */
35
+ project: string;
36
+ /** The base branch, read at `origin/<base>`. Defaults to `main`. */
37
+ baseBranch?: string;
38
+ /**
39
+ * What `fetchOrigin` returned for this run. NO safe default: omitted, it reads
40
+ * as false and the answer is `unresolvable`, so a caller that forgets it gets
41
+ * a could-not-run it has to look at rather than a `present` read off a ref
42
+ * whose age nothing established.
43
+ */
44
+ fetchOk?: boolean;
45
+ }
46
+ /**
47
+ * Whether the generated offline roster file on `origin/<base>` lists the slug
48
+ * under the project.
49
+ *
50
+ * `present` means the CLI token gate in a checkout of that ref would accept the
51
+ * identity. It does NOT mean the service was redeployed, and it does not mean a
52
+ * token exists: those are the deploy and the mint, neither of which this read
53
+ * can see.
54
+ */
55
+ export declare function rosterEntryOnRef(projectRoot: string, slug: string, opts: RosterReadOptions): RosterOutcome;
56
+ /**
57
+ * Whether the roster SOURCE on `origin/<base>` lists the slug under the project.
58
+ *
59
+ * Answers the state between "nothing was done" and "everything was done": the
60
+ * array in `rosters.ts` was edited and the generated file was not regenerated.
61
+ * The service would accept the team once redeployed while every CLI reading the
62
+ * offline file still refuses it, which is exactly the drift
63
+ * `roster-source.test.ts` exists to catch in CI, after a commit.
64
+ *
65
+ * Comments are removed from the whole file BEFORE any declaration is located,
66
+ * and only then is the export found and its array read. Order matters both ways.
67
+ * A commented-out `export const PROVISIONED_ROSTERS = [` would otherwise shadow
68
+ * the real declaration and answer for it (security review, Should Fix 2). And
69
+ * `rosters.ts:100-107` holds the slug `platform` in prose, including "is still
70
+ * NOT an enqueue target", which a whole-file substring read reports as
71
+ * membership.
72
+ *
73
+ * String contents survive the strip, so a `//` or a `]` inside a quoted slug is
74
+ * read as text rather than as a comment or as the end of the array.
75
+ *
76
+ * The file is parsed as text. Nothing in it is evaluated, imported or executed.
77
+ */
78
+ export declare function rosterSourceHasSlug(projectRoot: string, slug: string, project: string, opts?: {
79
+ baseBranch?: string;
80
+ fetchOk?: boolean;
81
+ }): RosterOutcome;
82
+ /**
83
+ * The parse, separate from the read so every shape it refuses is testable
84
+ * without a git fixture. Exported for that test.
85
+ */
86
+ export declare function sourceRosterMembership(source: string, slug: string, project: string): RosterOutcome;
87
+ //# sourceMappingURL=roster.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"roster.d.ts","sourceRoot":"","sources":["../../src/lib/roster.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAMH,kFAAkF;AAClF,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,QAAQ,GAAG,cAAc,CAAC;AAElE,kFAAkF;AAClF,eAAO,MAAM,gBAAgB,qEAAqE,CAAC;AAEnG,+EAA+E;AAC/E,eAAO,MAAM,kBAAkB,+DAA+D,CAAC;AAU/F,MAAM,WAAW,iBAAiB;IAChC,2DAA2D;IAC3D,OAAO,EAAE,MAAM,CAAC;IAChB,oEAAoE;IACpE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAkCD;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,iBAAiB,GACtB,aAAa,CAuBf;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,IAAI,GAAE;IAAE,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAO,GACpD,aAAa,CAOf;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,aAAa,CASnG"}
@@ -0,0 +1,332 @@
1
+ /**
2
+ * Reads the coordination roster on a git ref, as three outcomes (#77).
3
+ *
4
+ * The roster decides which team identity may fetch a token from the dev vault
5
+ * (`coordination-token.ts:75,80,234-243`). Two committed artifacts hold it, and
6
+ * a team is registered only when BOTH do:
7
+ *
8
+ * - `coordination-service/src/config/rosters.ts`, the single source, compiled
9
+ * into the service. Editing it and deploying is what makes the service
10
+ * accept the team's messages.
11
+ * - `mx-agent-system/agent-config/coordination-rosters.generated.json`, the
12
+ * offline file the CLI token gate and the session-start hook read from the
13
+ * calling worktree's checkout. Regenerating it is a manual two-command step
14
+ * (`generate-rosters.ts:10-11`).
15
+ *
16
+ * This module READS both on a ref. It writes nothing, edits no roster, mints
17
+ * nothing, and makes no network call: the ref is local, updated by the fetch the
18
+ * caller already ran. Neither read can tell whether the service was redeployed
19
+ * after the roster changed, and the row that prints these answers says so.
20
+ *
21
+ * `unresolvable` is its own answer, not a synonym for `absent`, for the reason
22
+ * `catalogEntryOnOriginMain` states: a failed fetch leaves a remote-tracking ref
23
+ * of unknown age, so an entry merged since would read as missing and the
24
+ * operator would be told to make an edit that is already on the base branch
25
+ * (`mx-agent-system/standards/fail-loud-standard.md`).
26
+ */
27
+ import { spawnSync } from 'child_process';
28
+ import { isReadableCatalogRef } from './catalog.js';
29
+ import { refExists } from './worktree.js';
30
+ /** The offline roster file, `/`-separated because a git object path always is. */
31
+ export const ROSTER_JSON_PATH = 'mx-agent-system/agent-config/coordination-rosters.generated.json';
32
+ /** The single-source roster module, compiled into the coordination service. */
33
+ export const ROSTER_SOURCE_PATH = 'mx-agent-system/coordination-service/src/config/rosters.ts';
34
+ /**
35
+ * The map both reads consult: the token-provisioned roster per project, which is
36
+ * the set serialized into the offline file (`rosters.ts:166-174`,
37
+ * `serializeProvisionedRosters`). The enqueue-target map `SERVICE_ROSTERS` is a
38
+ * different set and is not what the token gate reads.
39
+ */
40
+ const PROVISIONED_ROSTERS_EXPORT = 'PROVISIONED_ROSTERS';
41
+ /**
42
+ * Read one path at one ref. `undefined` means the read could not be performed;
43
+ * `null` means the ref resolved and holds no such path.
44
+ *
45
+ * Both git invocations pipe their output, so a git message never reaches the
46
+ * transcript, and nothing read here is interpolated into a caller-facing string.
47
+ */
48
+ function showAtRef(projectRoot, ref, path) {
49
+ try {
50
+ // The two accepted forms, for the reason `catalogEntryOnRef` states: the ref
51
+ // is interpolated into a revision string, and `HEAD` or `origin/<name>` is
52
+ // the whole of what these callers need.
53
+ if (!isReadableCatalogRef(ref))
54
+ return undefined;
55
+ if (!refExists(ref, projectRoot))
56
+ return undefined;
57
+ const r = spawnSync('git', ['show', '--end-of-options', `${ref}:${path}`], {
58
+ cwd: projectRoot,
59
+ stdio: 'pipe',
60
+ encoding: 'utf-8',
61
+ maxBuffer: 4 * 1024 * 1024,
62
+ });
63
+ // A git that could not run at all is not evidence about the file.
64
+ if (r.error || r.status === null)
65
+ return undefined;
66
+ // The ref resolved above, so a non-zero exit here is "no such path in this
67
+ // tree". That is an answer about the roster: the file is not on the base
68
+ // branch, so the roster does not hold the team.
69
+ if (r.status !== 0)
70
+ return null;
71
+ return typeof r.stdout === 'string' ? r.stdout : undefined;
72
+ }
73
+ catch {
74
+ return undefined;
75
+ }
76
+ }
77
+ /**
78
+ * Whether the generated offline roster file on `origin/<base>` lists the slug
79
+ * under the project.
80
+ *
81
+ * `present` means the CLI token gate in a checkout of that ref would accept the
82
+ * identity. It does NOT mean the service was redeployed, and it does not mean a
83
+ * token exists: those are the deploy and the mint, neither of which this read
84
+ * can see.
85
+ */
86
+ export function rosterEntryOnRef(projectRoot, slug, opts) {
87
+ // A failed fetch settles the answer before any ref is read.
88
+ if (opts.fetchOk !== true)
89
+ return 'unresolvable';
90
+ const ref = `origin/${opts.baseBranch?.trim() || 'main'}`;
91
+ const raw = showAtRef(projectRoot, ref, ROSTER_JSON_PATH);
92
+ if (raw === undefined)
93
+ return 'unresolvable';
94
+ // No roster file on the base branch: the project has no offline roster, so it
95
+ // registers no team. That is absent, and the remedy is the same edit.
96
+ if (raw === null)
97
+ return 'absent';
98
+ let parsed;
99
+ try {
100
+ parsed = JSON.parse(raw);
101
+ }
102
+ catch {
103
+ return 'unresolvable';
104
+ }
105
+ const projects = parsed?.projects;
106
+ // A file that parsed but holds no `projects` map is not a roster this code
107
+ // understands. Reporting `absent` would name an edit that may already be made.
108
+ if (!projects || typeof projects !== 'object' || Array.isArray(projects))
109
+ return 'unresolvable';
110
+ const teams = projects[opts.project];
111
+ if (teams === undefined)
112
+ return 'absent';
113
+ if (!Array.isArray(teams))
114
+ return 'unresolvable';
115
+ return teams.includes(slug) ? 'present' : 'absent';
116
+ }
117
+ /**
118
+ * Whether the roster SOURCE on `origin/<base>` lists the slug under the project.
119
+ *
120
+ * Answers the state between "nothing was done" and "everything was done": the
121
+ * array in `rosters.ts` was edited and the generated file was not regenerated.
122
+ * The service would accept the team once redeployed while every CLI reading the
123
+ * offline file still refuses it, which is exactly the drift
124
+ * `roster-source.test.ts` exists to catch in CI, after a commit.
125
+ *
126
+ * Comments are removed from the whole file BEFORE any declaration is located,
127
+ * and only then is the export found and its array read. Order matters both ways.
128
+ * A commented-out `export const PROVISIONED_ROSTERS = [` would otherwise shadow
129
+ * the real declaration and answer for it (security review, Should Fix 2). And
130
+ * `rosters.ts:100-107` holds the slug `platform` in prose, including "is still
131
+ * NOT an enqueue target", which a whole-file substring read reports as
132
+ * membership.
133
+ *
134
+ * String contents survive the strip, so a `//` or a `]` inside a quoted slug is
135
+ * read as text rather than as a comment or as the end of the array.
136
+ *
137
+ * The file is parsed as text. Nothing in it is evaluated, imported or executed.
138
+ */
139
+ export function rosterSourceHasSlug(projectRoot, slug, project, opts = {}) {
140
+ if (opts.fetchOk !== true)
141
+ return 'unresolvable';
142
+ const ref = `origin/${opts.baseBranch?.trim() || 'main'}`;
143
+ const raw = showAtRef(projectRoot, ref, ROSTER_SOURCE_PATH);
144
+ if (raw === undefined)
145
+ return 'unresolvable';
146
+ if (raw === null)
147
+ return 'absent';
148
+ return sourceRosterMembership(raw, slug, project);
149
+ }
150
+ /**
151
+ * The parse, separate from the read so every shape it refuses is testable
152
+ * without a git fixture. Exported for that test.
153
+ */
154
+ export function sourceRosterMembership(source, slug, project) {
155
+ // Once, before anything is located. Every lookup below reads this text.
156
+ const code = stripComments(source);
157
+ const constName = provisionedRosterConstFor(code, project);
158
+ if (constName === 'unresolvable')
159
+ return 'unresolvable';
160
+ if (constName === null)
161
+ return 'absent';
162
+ const teams = arrayLiteralStrings(code, constName);
163
+ if (teams === null)
164
+ return 'unresolvable';
165
+ return teams.includes(slug) ? 'present' : 'absent';
166
+ }
167
+ /**
168
+ * Which `readonly string[]` const the project's provisioned roster is, read from
169
+ * the `PROVISIONED_ROSTERS` object literal.
170
+ *
171
+ * `null`: the map parsed and holds no entry for this project. `'unresolvable'`:
172
+ * the map is absent, or an entry's key is an identifier this file does not
173
+ * define, so an absent answer would be a guess. `DEFAULT_PROJECT` is imported
174
+ * from `../types.js` and is one such identifier, which is why an unresolved key
175
+ * refuses rather than reporting `absent`.
176
+ */
177
+ function provisionedRosterConstFor(source, project) {
178
+ const body = objectLiteralBody(source, PROVISIONED_ROSTERS_EXPORT);
179
+ if (body === null)
180
+ return 'unresolvable';
181
+ let sawUnresolvedKey = false;
182
+ for (const line of body.split('\n')) {
183
+ const m = line.match(/^\s*(?:\[\s*([A-Za-z_$][\w$]*)\s*\]|'([^']+)'|"([^"]+)"|([A-Za-z_$][\w$]*))\s*:\s*([A-Za-z_$][\w$]*)\s*,?\s*$/);
184
+ if (!m)
185
+ continue;
186
+ const [, keyIdent, keySingle, keyDouble, keyBare, valueIdent] = m;
187
+ let key = keySingle ?? keyDouble ?? keyBare ?? null;
188
+ if (keyIdent)
189
+ key = constStringValue(source, keyIdent);
190
+ if (key === null) {
191
+ sawUnresolvedKey = true;
192
+ continue;
193
+ }
194
+ if (key === project)
195
+ return valueIdent;
196
+ }
197
+ return sawUnresolvedKey ? 'unresolvable' : null;
198
+ }
199
+ /**
200
+ * The text between the braces of `export const <name> ... = { ... };`, or null.
201
+ *
202
+ * `source` is comment-free code: `sourceRosterMembership` strips first, so a
203
+ * declaration inside a comment cannot be found here at all.
204
+ */
205
+ function objectLiteralBody(source, name) {
206
+ const re = new RegExp(`export\\s+const\\s+${name}\\b[^=]*=\\s*\\{`);
207
+ const m = re.exec(source);
208
+ if (!m)
209
+ return null;
210
+ const open = m.index + m[0].length - 1;
211
+ const close = matchingIndex(source, open, '{', '}');
212
+ return close === -1 ? null : source.slice(open + 1, close);
213
+ }
214
+ /**
215
+ * The quoted strings of `export const <name> ... = [ ... ];`, or null when the
216
+ * export is absent.
217
+ *
218
+ * Read from the `[` to its matching `]`, not to the first `]`, because both
219
+ * shapes exist in the real file: `MX_AGENT_TEAMS` is one line (`rosters.ts:122`)
220
+ * and `DEFAULT_TEAMS`, `MEMNEXUS_PROVISIONED_TEAMS` and
221
+ * `SPEARMINT_PRIVATE_TEAMS` span many (`:29`, `:53`, `:76`).
222
+ */
223
+ function arrayLiteralStrings(source, name) {
224
+ const re = new RegExp(`export\\s+const\\s+${name}\\b[^=]*=\\s*\\[`);
225
+ const m = re.exec(source);
226
+ if (!m)
227
+ return null;
228
+ const open = m.index + m[0].length - 1;
229
+ const close = matchingIndex(source, open, '[', ']');
230
+ if (close === -1)
231
+ return null;
232
+ const items = [];
233
+ for (const item of source.slice(open + 1, close).matchAll(/'([^']*)'|"([^"]*)"/g)) {
234
+ items.push(item[1] ?? item[2] ?? '');
235
+ }
236
+ return items;
237
+ }
238
+ /** The value of `export const <name> ... = '<value>';`, or null. */
239
+ function constStringValue(source, name) {
240
+ const re = new RegExp(`export\\s+const\\s+${name}\\b[^=]*=\\s*['"]([^'"]+)['"]`);
241
+ const m = re.exec(source);
242
+ return m ? m[1] : null;
243
+ }
244
+ /**
245
+ * The index of the bracket matching the one at `openIndex`, or -1.
246
+ *
247
+ * String literals are skipped, so a `]` inside a quoted slug does not close the
248
+ * array and a `}` inside a quoted description does not close the map.
249
+ */
250
+ function matchingIndex(source, openIndex, open, close) {
251
+ let depth = 0;
252
+ let quote = '';
253
+ for (let i = openIndex; i < source.length; i++) {
254
+ const c = source[i];
255
+ if (quote) {
256
+ if (c === '\\')
257
+ i++;
258
+ else if (c === quote)
259
+ quote = '';
260
+ continue;
261
+ }
262
+ if (c === "'" || c === '"' || c === '`') {
263
+ quote = c;
264
+ continue;
265
+ }
266
+ if (c === open)
267
+ depth++;
268
+ else if (c === close) {
269
+ depth--;
270
+ if (depth === 0)
271
+ return i;
272
+ }
273
+ }
274
+ return -1;
275
+ }
276
+ /**
277
+ * The source with every comment replaced by spaces, and every string literal
278
+ * left as it is.
279
+ *
280
+ * Run BEFORE any declaration is located. A block comment holding
281
+ * `export const PROVISIONED_ROSTERS = [` would otherwise be found by the regex
282
+ * and read as the roster, and a stripper that ran afterwards could not undo
283
+ * that (security review, Should Fix 2).
284
+ *
285
+ * Newlines survive, so line structure and offsets are unchanged. A `//` inside
286
+ * a quoted string is text, not a comment: the scan tracks quotes, which is what
287
+ * the earlier regex form could not do.
288
+ */
289
+ function stripComments(source) {
290
+ const out = [];
291
+ let quote = '';
292
+ for (let i = 0; i < source.length; i++) {
293
+ const c = source[i];
294
+ const next = source[i + 1];
295
+ if (quote) {
296
+ out.push(c);
297
+ if (c === '\\' && i + 1 < source.length) {
298
+ out.push(next);
299
+ i++;
300
+ }
301
+ else if (c === quote) {
302
+ quote = '';
303
+ }
304
+ continue;
305
+ }
306
+ if (c === "'" || c === '"' || c === '`') {
307
+ quote = c;
308
+ out.push(c);
309
+ continue;
310
+ }
311
+ if (c === '/' && next === '/') {
312
+ while (i < source.length && source[i] !== '\n') {
313
+ out.push(' ');
314
+ i++;
315
+ }
316
+ if (i < source.length)
317
+ out.push('\n');
318
+ continue;
319
+ }
320
+ if (c === '/' && next === '*') {
321
+ const end = source.indexOf('*/', i + 2);
322
+ const stop = end === -1 ? source.length : end + 2;
323
+ for (; i < stop; i++)
324
+ out.push(source[i] === '\n' ? '\n' : ' ');
325
+ i--;
326
+ continue;
327
+ }
328
+ out.push(c);
329
+ }
330
+ return out.join('');
331
+ }
332
+ //# sourceMappingURL=roster.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"roster.js","sourceRoot":"","sources":["../../src/lib/roster.ts"],"names":[],"mappings":"AAAA;;;;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M,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC;YAClD,OAAO,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE;gBAAE,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;YAChE,CAAC,EAAE,CAAC;YACJ,SAAS;QACX,CAAC;QACD,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACd,CAAC;IACD,OAAO,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACtB,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * The two roster reads on a ref (#77), against a real git fixture.
3
+ *
4
+ * Row 9 of the completion contract decides whether a creation reports a team as
5
+ * registered on the coordination queue, so what these functions answer decides
6
+ * whether `provision` exits 0. The fixture is a real repository chain — a bare
7
+ * clone as the remote and a clone of it — not a spy on `spawnSync`, because the
8
+ * question is what `git show` returns at `origin/<base>`.
9
+ *
10
+ * Three outcomes throughout. `unresolvable` is the one the tests are here for: a
11
+ * read that could not be performed must never report the roster as missing, or
12
+ * the operator is told to make an edit that may already be merged.
13
+ */
14
+ export {};
15
+ //# sourceMappingURL=roster.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"roster.test.d.ts","sourceRoot":"","sources":["../../src/lib/roster.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG"}