@memnexus-ai/mx-agent-cli 0.1.294 → 0.1.296-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 (649) 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__/claude-local-sanitizer.test.d.ts +24 -0
  26. package/dist/__tests__/claude-local-sanitizer.test.d.ts.map +1 -0
  27. package/dist/__tests__/claude-local-sanitizer.test.js +906 -0
  28. package/dist/__tests__/claude-local-sanitizer.test.js.map +1 -0
  29. package/dist/__tests__/cli-build-integration.test.d.ts +2 -0
  30. package/dist/__tests__/cli-build-integration.test.d.ts.map +1 -0
  31. package/dist/__tests__/cli-build-integration.test.js +64 -0
  32. package/dist/__tests__/cli-build-integration.test.js.map +1 -0
  33. package/dist/__tests__/cli-build.test.d.ts +2 -0
  34. package/dist/__tests__/cli-build.test.d.ts.map +1 -0
  35. package/dist/__tests__/cli-build.test.js +640 -0
  36. package/dist/__tests__/cli-build.test.js.map +1 -0
  37. package/dist/__tests__/codex-deploy-config.test.js +60 -0
  38. package/dist/__tests__/codex-deploy-config.test.js.map +1 -1
  39. package/dist/__tests__/completion-rows-discriminate.test.d.ts +20 -0
  40. package/dist/__tests__/completion-rows-discriminate.test.d.ts.map +1 -0
  41. package/dist/__tests__/completion-rows-discriminate.test.js +481 -0
  42. package/dist/__tests__/completion-rows-discriminate.test.js.map +1 -0
  43. package/dist/__tests__/config-fidelity-archived-symlinks.test.d.ts +2 -0
  44. package/dist/__tests__/config-fidelity-archived-symlinks.test.d.ts.map +1 -0
  45. package/dist/__tests__/config-fidelity-archived-symlinks.test.js +127 -0
  46. package/dist/__tests__/config-fidelity-archived-symlinks.test.js.map +1 -0
  47. package/dist/__tests__/config-fidelity-display.test.d.ts +2 -0
  48. package/dist/__tests__/config-fidelity-display.test.d.ts.map +1 -0
  49. package/dist/__tests__/config-fidelity-display.test.js +77 -0
  50. package/dist/__tests__/config-fidelity-display.test.js.map +1 -0
  51. package/dist/__tests__/config-fidelity.test.js +166 -33
  52. package/dist/__tests__/config-fidelity.test.js.map +1 -1
  53. package/dist/__tests__/config-generation-gate.test.js +78 -0
  54. package/dist/__tests__/config-generation-gate.test.js.map +1 -1
  55. package/dist/__tests__/config-sync.test.js +89 -1
  56. package/dist/__tests__/config-sync.test.js.map +1 -1
  57. package/dist/__tests__/coordination-401-production-wiring.test.js +12 -7
  58. package/dist/__tests__/coordination-401-production-wiring.test.js.map +1 -1
  59. package/dist/__tests__/coordination-401-recovery.test.js +39 -32
  60. package/dist/__tests__/coordination-401-recovery.test.js.map +1 -1
  61. package/dist/__tests__/coordination-brief-pin.test.js +21 -8
  62. package/dist/__tests__/coordination-brief-pin.test.js.map +1 -1
  63. package/dist/__tests__/coordination-client.test.js +316 -3
  64. package/dist/__tests__/coordination-client.test.js.map +1 -1
  65. package/dist/__tests__/coordination-credential-endpoint.test.d.ts +24 -0
  66. package/dist/__tests__/coordination-credential-endpoint.test.d.ts.map +1 -0
  67. package/dist/__tests__/coordination-credential-endpoint.test.js +1290 -0
  68. package/dist/__tests__/coordination-credential-endpoint.test.js.map +1 -0
  69. package/dist/__tests__/coordination-memory.test.js +20 -4
  70. package/dist/__tests__/coordination-memory.test.js.map +1 -1
  71. package/dist/__tests__/coordination-provision.test.js +22 -14
  72. package/dist/__tests__/coordination-provision.test.js.map +1 -1
  73. package/dist/__tests__/coordination-status-registration.test.d.ts +16 -0
  74. package/dist/__tests__/coordination-status-registration.test.d.ts.map +1 -0
  75. package/dist/__tests__/coordination-status-registration.test.js +480 -0
  76. package/dist/__tests__/coordination-status-registration.test.js.map +1 -0
  77. package/dist/__tests__/coordination-token-multitenant.test.js +24 -24
  78. package/dist/__tests__/coordination-token-multitenant.test.js.map +1 -1
  79. package/dist/__tests__/coordination-token.test.js +35 -28
  80. package/dist/__tests__/coordination-token.test.js.map +1 -1
  81. package/dist/__tests__/creation-pr-class-check.test.d.ts +17 -0
  82. package/dist/__tests__/creation-pr-class-check.test.d.ts.map +1 -0
  83. package/dist/__tests__/creation-pr-class-check.test.js +346 -0
  84. package/dist/__tests__/creation-pr-class-check.test.js.map +1 -0
  85. package/dist/__tests__/decision-check.test.d.ts +2 -0
  86. package/dist/__tests__/decision-check.test.d.ts.map +1 -0
  87. package/dist/__tests__/decision-check.test.js +105 -0
  88. package/dist/__tests__/decision-check.test.js.map +1 -0
  89. package/dist/__tests__/digest-team-omission.test.d.ts +15 -0
  90. package/dist/__tests__/digest-team-omission.test.d.ts.map +1 -0
  91. package/dist/__tests__/digest-team-omission.test.js +247 -0
  92. package/dist/__tests__/digest-team-omission.test.js.map +1 -0
  93. package/dist/__tests__/doctor-worktree-path.test.d.ts +17 -0
  94. package/dist/__tests__/doctor-worktree-path.test.d.ts.map +1 -0
  95. package/dist/__tests__/doctor-worktree-path.test.js +158 -0
  96. package/dist/__tests__/doctor-worktree-path.test.js.map +1 -0
  97. package/dist/__tests__/fleet-data.test.js +40 -7
  98. package/dist/__tests__/fleet-data.test.js.map +1 -1
  99. package/dist/__tests__/fleet-tmux.test.js +2 -2
  100. package/dist/__tests__/fleet-tmux.test.js.map +1 -1
  101. package/dist/__tests__/generate-claude.test.js +137 -3
  102. package/dist/__tests__/generate-claude.test.js.map +1 -1
  103. package/dist/__tests__/git-env.test.d.ts +14 -0
  104. package/dist/__tests__/git-env.test.d.ts.map +1 -0
  105. package/dist/__tests__/git-env.test.js +131 -0
  106. package/dist/__tests__/git-env.test.js.map +1 -0
  107. package/dist/__tests__/git-identity-isolation.test.d.ts +33 -0
  108. package/dist/__tests__/git-identity-isolation.test.d.ts.map +1 -0
  109. package/dist/__tests__/git-identity-isolation.test.js +626 -0
  110. package/dist/__tests__/git-identity-isolation.test.js.map +1 -0
  111. package/dist/__tests__/harness-extract.test.d.ts +19 -0
  112. package/dist/__tests__/harness-extract.test.d.ts.map +1 -0
  113. package/dist/__tests__/harness-extract.test.js +566 -0
  114. package/dist/__tests__/harness-extract.test.js.map +1 -0
  115. package/dist/__tests__/harness-wiring.test.d.ts +16 -0
  116. package/dist/__tests__/harness-wiring.test.d.ts.map +1 -0
  117. package/dist/__tests__/harness-wiring.test.js +469 -0
  118. package/dist/__tests__/harness-wiring.test.js.map +1 -0
  119. package/dist/__tests__/hook-heal.test.js +17 -0
  120. package/dist/__tests__/hook-heal.test.js.map +1 -1
  121. package/dist/__tests__/init-coordination-url.test.d.ts +11 -0
  122. package/dist/__tests__/init-coordination-url.test.d.ts.map +1 -0
  123. package/dist/__tests__/init-coordination-url.test.js +114 -0
  124. package/dist/__tests__/init-coordination-url.test.js.map +1 -0
  125. package/dist/__tests__/memory-autocreate.test.js +574 -8
  126. package/dist/__tests__/memory-autocreate.test.js.map +1 -1
  127. package/dist/__tests__/memory-log-result.test.d.ts +13 -0
  128. package/dist/__tests__/memory-log-result.test.d.ts.map +1 -0
  129. package/dist/__tests__/memory-log-result.test.js +113 -0
  130. package/dist/__tests__/memory-log-result.test.js.map +1 -0
  131. package/dist/__tests__/memory-named-exists.test.d.ts +16 -0
  132. package/dist/__tests__/memory-named-exists.test.d.ts.map +1 -0
  133. package/dist/__tests__/memory-named-exists.test.js +288 -0
  134. package/dist/__tests__/memory-named-exists.test.js.map +1 -0
  135. package/dist/__tests__/mx-agent-cli-pin-validation.test.js +23 -47
  136. package/dist/__tests__/mx-agent-cli-pin-validation.test.js.map +1 -1
  137. package/dist/__tests__/mx-agent-cli-version-pin.test.js +34 -88
  138. package/dist/__tests__/mx-agent-cli-version-pin.test.js.map +1 -1
  139. package/dist/__tests__/new-project-first-team.test.d.ts +15 -0
  140. package/dist/__tests__/new-project-first-team.test.d.ts.map +1 -0
  141. package/dist/__tests__/new-project-first-team.test.js +263 -0
  142. package/dist/__tests__/new-project-first-team.test.js.map +1 -0
  143. package/dist/__tests__/otel-env.test.d.ts +2 -0
  144. package/dist/__tests__/otel-env.test.d.ts.map +1 -0
  145. package/dist/__tests__/otel-env.test.js +127 -0
  146. package/dist/__tests__/otel-env.test.js.map +1 -0
  147. package/dist/__tests__/project-config.test.js +283 -1
  148. package/dist/__tests__/project-config.test.js.map +1 -1
  149. package/dist/__tests__/provision-behavioral-contract.test.js +96 -4
  150. package/dist/__tests__/provision-behavioral-contract.test.js.map +1 -1
  151. package/dist/__tests__/provision-catalog-precondition.test.d.ts +26 -0
  152. package/dist/__tests__/provision-catalog-precondition.test.d.ts.map +1 -0
  153. package/dist/__tests__/provision-catalog-precondition.test.js +620 -0
  154. package/dist/__tests__/provision-catalog-precondition.test.js.map +1 -0
  155. package/dist/__tests__/provision-completion-rows.test.d.ts +17 -0
  156. package/dist/__tests__/provision-completion-rows.test.d.ts.map +1 -0
  157. package/dist/__tests__/provision-completion-rows.test.js +3187 -0
  158. package/dist/__tests__/provision-completion-rows.test.js.map +1 -0
  159. package/dist/__tests__/provision-identity-gate.test.d.ts +20 -0
  160. package/dist/__tests__/provision-identity-gate.test.d.ts.map +1 -0
  161. package/dist/__tests__/provision-identity-gate.test.js +600 -0
  162. package/dist/__tests__/provision-identity-gate.test.js.map +1 -0
  163. package/dist/__tests__/provision-resume.test.d.ts +26 -0
  164. package/dist/__tests__/provision-resume.test.d.ts.map +1 -0
  165. package/dist/__tests__/provision-resume.test.js +1164 -0
  166. package/dist/__tests__/provision-resume.test.js.map +1 -0
  167. package/dist/__tests__/provision-roleguide-anchors.test.d.ts +27 -0
  168. package/dist/__tests__/provision-roleguide-anchors.test.d.ts.map +1 -0
  169. package/dist/__tests__/provision-roleguide-anchors.test.js +747 -0
  170. package/dist/__tests__/provision-roleguide-anchors.test.js.map +1 -0
  171. package/dist/__tests__/provision-skeleton-fill.test.d.ts +16 -0
  172. package/dist/__tests__/provision-skeleton-fill.test.d.ts.map +1 -0
  173. package/dist/__tests__/provision-skeleton-fill.test.js +488 -0
  174. package/dist/__tests__/provision-skeleton-fill.test.js.map +1 -0
  175. package/dist/__tests__/provision-teambuilder-flow.test.js +93 -7
  176. package/dist/__tests__/provision-teambuilder-flow.test.js.map +1 -1
  177. package/dist/__tests__/repo-guard-wiring.test.d.ts +21 -0
  178. package/dist/__tests__/repo-guard-wiring.test.d.ts.map +1 -0
  179. package/dist/__tests__/repo-guard-wiring.test.js +638 -0
  180. package/dist/__tests__/repo-guard-wiring.test.js.map +1 -0
  181. package/dist/__tests__/report-format.test.d.ts +2 -0
  182. package/dist/__tests__/report-format.test.d.ts.map +1 -0
  183. package/dist/__tests__/report-format.test.js +219 -0
  184. package/dist/__tests__/report-format.test.js.map +1 -0
  185. package/dist/__tests__/row15-detail-sanitizer.test.d.ts +20 -0
  186. package/dist/__tests__/row15-detail-sanitizer.test.d.ts.map +1 -0
  187. package/dist/__tests__/row15-detail-sanitizer.test.js +61 -0
  188. package/dist/__tests__/row15-detail-sanitizer.test.js.map +1 -0
  189. package/dist/__tests__/runtime-codex-gateway-pilot.test.d.ts +2 -0
  190. package/dist/__tests__/runtime-codex-gateway-pilot.test.d.ts.map +1 -0
  191. package/dist/__tests__/runtime-codex-gateway-pilot.test.js +309 -0
  192. package/dist/__tests__/runtime-codex-gateway-pilot.test.js.map +1 -0
  193. package/dist/__tests__/runtime-codex-gateway-provider.test.d.ts +2 -0
  194. package/dist/__tests__/runtime-codex-gateway-provider.test.d.ts.map +1 -0
  195. package/dist/__tests__/runtime-codex-gateway-provider.test.js +163 -0
  196. package/dist/__tests__/runtime-codex-gateway-provider.test.js.map +1 -0
  197. package/dist/__tests__/runtime-identity.test.d.ts +2 -0
  198. package/dist/__tests__/runtime-identity.test.d.ts.map +1 -0
  199. package/dist/__tests__/runtime-identity.test.js +117 -0
  200. package/dist/__tests__/runtime-identity.test.js.map +1 -0
  201. package/dist/__tests__/session-pause-provisioning.test.js +6 -1
  202. package/dist/__tests__/session-pause-provisioning.test.js.map +1 -1
  203. package/dist/__tests__/session-record-disclosure.test.d.ts +24 -0
  204. package/dist/__tests__/session-record-disclosure.test.d.ts.map +1 -0
  205. package/dist/__tests__/session-record-disclosure.test.js +494 -0
  206. package/dist/__tests__/session-record-disclosure.test.js.map +1 -0
  207. package/dist/__tests__/session.test.js +35 -0
  208. package/dist/__tests__/session.test.js.map +1 -1
  209. package/dist/__tests__/slug-validation.test.js +27 -21
  210. package/dist/__tests__/slug-validation.test.js.map +1 -1
  211. package/dist/__tests__/standards-injection.test.d.ts +2 -0
  212. package/dist/__tests__/standards-injection.test.d.ts.map +1 -0
  213. package/dist/__tests__/standards-injection.test.js +179 -0
  214. package/dist/__tests__/standards-injection.test.js.map +1 -0
  215. package/dist/__tests__/start-interactive-role.test.d.ts +22 -0
  216. package/dist/__tests__/start-interactive-role.test.d.ts.map +1 -0
  217. package/dist/__tests__/start-interactive-role.test.js +204 -0
  218. package/dist/__tests__/start-interactive-role.test.js.map +1 -0
  219. package/dist/__tests__/start-team-identity.test.d.ts +25 -0
  220. package/dist/__tests__/start-team-identity.test.d.ts.map +1 -0
  221. package/dist/__tests__/start-team-identity.test.js +307 -0
  222. package/dist/__tests__/start-team-identity.test.js.map +1 -0
  223. package/dist/__tests__/team-memory-commands.test.js +142 -19
  224. package/dist/__tests__/team-memory-commands.test.js.map +1 -1
  225. package/dist/__tests__/template-sync.test.d.ts +19 -0
  226. package/dist/__tests__/template-sync.test.d.ts.map +1 -0
  227. package/dist/__tests__/template-sync.test.js +270 -0
  228. package/dist/__tests__/template-sync.test.js.map +1 -0
  229. package/dist/__tests__/test-project.test.d.ts +18 -0
  230. package/dist/__tests__/test-project.test.d.ts.map +1 -0
  231. package/dist/__tests__/test-project.test.js +465 -0
  232. package/dist/__tests__/test-project.test.js.map +1 -0
  233. package/dist/__tests__/usage-per-call-grouping.test.d.ts +25 -0
  234. package/dist/__tests__/usage-per-call-grouping.test.d.ts.map +1 -0
  235. package/dist/__tests__/usage-per-call-grouping.test.js +952 -0
  236. package/dist/__tests__/usage-per-call-grouping.test.js.map +1 -0
  237. package/dist/__tests__/verify-hooks-check-all.test.d.ts +32 -0
  238. package/dist/__tests__/verify-hooks-check-all.test.d.ts.map +1 -0
  239. package/dist/__tests__/verify-hooks-check-all.test.js +553 -0
  240. package/dist/__tests__/verify-hooks-check-all.test.js.map +1 -0
  241. package/dist/__tests__/worktree-sync-fixture.test.d.ts +17 -0
  242. package/dist/__tests__/worktree-sync-fixture.test.d.ts.map +1 -0
  243. package/dist/__tests__/worktree-sync-fixture.test.js +519 -0
  244. package/dist/__tests__/worktree-sync-fixture.test.js.map +1 -0
  245. package/dist/__tests__/worktree-sync-hardening.test.d.ts +13 -0
  246. package/dist/__tests__/worktree-sync-hardening.test.d.ts.map +1 -0
  247. package/dist/__tests__/worktree-sync-hardening.test.js +919 -0
  248. package/dist/__tests__/worktree-sync-hardening.test.js.map +1 -0
  249. package/dist/__tests__/worktree-sync-shell-free.test.d.ts +25 -0
  250. package/dist/__tests__/worktree-sync-shell-free.test.d.ts.map +1 -0
  251. package/dist/__tests__/worktree-sync-shell-free.test.js +185 -0
  252. package/dist/__tests__/worktree-sync-shell-free.test.js.map +1 -0
  253. package/dist/__tests__/worktree.test.js +75 -1
  254. package/dist/__tests__/worktree.test.js.map +1 -1
  255. package/dist/agent-config/.mx-config-generation.json +2 -2
  256. package/dist/agent-config/AGENTS.md.template +2 -2
  257. package/dist/agent-config/agents/bar-raiser.md +34 -1
  258. package/dist/agent-config/agents/red-team.md +34 -1
  259. package/dist/agent-config/agents/security-reviewer.md +22 -1
  260. package/dist/agent-config/claude-md/CLAUDE.core.md +6 -1
  261. package/dist/agent-config/claude-md/CLAUDE.overlay.memnexus.md +1 -3
  262. package/dist/agent-config/coordination-rosters.generated.json +10 -0
  263. package/dist/agent-config/hooks/HOOK-TIMEOUTS.md +27 -1
  264. package/dist/agent-config/hooks/OR-TRUE-AUDIT.md +8 -8
  265. package/dist/agent-config/hooks/auto-capture-precompact.sh +180 -83
  266. package/dist/agent-config/hooks/auto-capture-session-end.sh +216 -87
  267. package/dist/agent-config/hooks/auto-checkpoint.sh +75 -5
  268. package/dist/agent-config/hooks/coordination-brief.sh +290 -245
  269. package/dist/agent-config/hooks/deploy-verification-reminder.sh +359 -22
  270. package/dist/agent-config/hooks/git-mutation-guard.sh +85 -13
  271. package/dist/agent-config/hooks/observability-sync.sh +46 -9
  272. package/dist/agent-config/hooks/session-idle-gate.sh +177 -12
  273. package/dist/agent-config/hooks/subagent-write-guard.sh +670 -0
  274. package/dist/agent-config/hooks/worktree-guard.sh +36 -7
  275. package/dist/agent-config/settings.json +15 -2
  276. package/dist/agent-config/shared/creation-pr-review-checklist.md +317 -0
  277. package/dist/commands/bootstrap.d.ts.map +1 -1
  278. package/dist/commands/bootstrap.js +22 -10
  279. package/dist/commands/bootstrap.js.map +1 -1
  280. package/dist/commands/config-sync.d.ts +37 -0
  281. package/dist/commands/config-sync.d.ts.map +1 -1
  282. package/dist/commands/config-sync.js +36 -18
  283. package/dist/commands/config-sync.js.map +1 -1
  284. package/dist/commands/config.d.ts.map +1 -1
  285. package/dist/commands/config.js +28 -1
  286. package/dist/commands/config.js.map +1 -1
  287. package/dist/commands/coordination.d.ts +150 -8
  288. package/dist/commands/coordination.d.ts.map +1 -1
  289. package/dist/commands/coordination.js +524 -25
  290. package/dist/commands/coordination.js.map +1 -1
  291. package/dist/commands/create.d.ts +922 -1
  292. package/dist/commands/create.d.ts.map +1 -1
  293. package/dist/commands/create.js +4934 -345
  294. package/dist/commands/create.js.map +1 -1
  295. package/dist/commands/dashboard.d.ts.map +1 -1
  296. package/dist/commands/dashboard.js +10 -2
  297. package/dist/commands/dashboard.js.map +1 -1
  298. package/dist/commands/decision.d.ts +20 -0
  299. package/dist/commands/decision.d.ts.map +1 -0
  300. package/dist/commands/decision.js +54 -0
  301. package/dist/commands/decision.js.map +1 -0
  302. package/dist/commands/digest.d.ts.map +1 -1
  303. package/dist/commands/digest.js +91 -7
  304. package/dist/commands/digest.js.map +1 -1
  305. package/dist/commands/fleet-tmux.js +1 -1
  306. package/dist/commands/fleet-tmux.js.map +1 -1
  307. package/dist/commands/init.d.ts +8 -0
  308. package/dist/commands/init.d.ts.map +1 -1
  309. package/dist/commands/init.js +26 -1
  310. package/dist/commands/init.js.map +1 -1
  311. package/dist/commands/list.d.ts +32 -1
  312. package/dist/commands/list.d.ts.map +1 -1
  313. package/dist/commands/list.js +98 -5
  314. package/dist/commands/list.js.map +1 -1
  315. package/dist/commands/monitor.d.ts.map +1 -1
  316. package/dist/commands/monitor.js +8 -2
  317. package/dist/commands/monitor.js.map +1 -1
  318. package/dist/commands/new.d.ts +2 -0
  319. package/dist/commands/new.d.ts.map +1 -1
  320. package/dist/commands/new.js +114 -21
  321. package/dist/commands/new.js.map +1 -1
  322. package/dist/commands/report.d.ts +33 -0
  323. package/dist/commands/report.d.ts.map +1 -0
  324. package/dist/commands/report.js +73 -0
  325. package/dist/commands/report.js.map +1 -0
  326. package/dist/commands/session.js +1 -1
  327. package/dist/commands/session.js.map +1 -1
  328. package/dist/commands/start.d.ts +42 -0
  329. package/dist/commands/start.d.ts.map +1 -1
  330. package/dist/commands/start.js +183 -8
  331. package/dist/commands/start.js.map +1 -1
  332. package/dist/commands/sync.d.ts +57 -0
  333. package/dist/commands/sync.d.ts.map +1 -1
  334. package/dist/commands/sync.js +117 -3
  335. package/dist/commands/sync.js.map +1 -1
  336. package/dist/commands/update.d.ts +13 -1
  337. package/dist/commands/update.d.ts.map +1 -1
  338. package/dist/commands/update.js +50 -1
  339. package/dist/commands/update.js.map +1 -1
  340. package/dist/commands/usage.d.ts +64 -0
  341. package/dist/commands/usage.d.ts.map +1 -1
  342. package/dist/commands/usage.js +96 -3
  343. package/dist/commands/usage.js.map +1 -1
  344. package/dist/commands/verify-hooks.d.ts +37 -1
  345. package/dist/commands/verify-hooks.d.ts.map +1 -1
  346. package/dist/commands/verify-hooks.js +114 -2
  347. package/dist/commands/verify-hooks.js.map +1 -1
  348. package/dist/commands/window.d.ts +10 -0
  349. package/dist/commands/window.d.ts.map +1 -0
  350. package/dist/commands/window.js +265 -0
  351. package/dist/commands/window.js.map +1 -0
  352. package/dist/commands/worktree-sync.d.ts +54 -0
  353. package/dist/commands/worktree-sync.d.ts.map +1 -0
  354. package/dist/commands/worktree-sync.js +135 -0
  355. package/dist/commands/worktree-sync.js.map +1 -0
  356. package/dist/index.d.ts.map +1 -1
  357. package/dist/index.js +189 -14
  358. package/dist/index.js.map +1 -1
  359. package/dist/lib/agent-session.d.ts +12 -0
  360. package/dist/lib/agent-session.d.ts.map +1 -1
  361. package/dist/lib/agent-session.js +189 -42
  362. package/dist/lib/agent-session.js.map +1 -1
  363. package/dist/lib/behavioral-injection.d.ts +9 -0
  364. package/dist/lib/behavioral-injection.d.ts.map +1 -1
  365. package/dist/lib/behavioral-injection.js +10 -1
  366. package/dist/lib/behavioral-injection.js.map +1 -1
  367. package/dist/lib/catalog.d.ts +321 -2
  368. package/dist/lib/catalog.d.ts.map +1 -1
  369. package/dist/lib/catalog.js +490 -11
  370. package/dist/lib/catalog.js.map +1 -1
  371. package/dist/lib/claude.d.ts +113 -23
  372. package/dist/lib/claude.d.ts.map +1 -1
  373. package/dist/lib/claude.js +498 -32
  374. package/dist/lib/claude.js.map +1 -1
  375. package/dist/lib/cli-build.d.ts +172 -0
  376. package/dist/lib/cli-build.d.ts.map +1 -0
  377. package/dist/lib/cli-build.js +654 -0
  378. package/dist/lib/cli-build.js.map +1 -0
  379. package/dist/lib/code-context-file.d.ts +109 -0
  380. package/dist/lib/code-context-file.d.ts.map +1 -0
  381. package/dist/lib/code-context-file.js +219 -0
  382. package/dist/lib/code-context-file.js.map +1 -0
  383. package/dist/lib/code-context-file.test.d.ts +19 -0
  384. package/dist/lib/code-context-file.test.d.ts.map +1 -0
  385. package/dist/lib/code-context-file.test.js +202 -0
  386. package/dist/lib/code-context-file.test.js.map +1 -0
  387. package/dist/lib/config-fidelity.d.ts +40 -20
  388. package/dist/lib/config-fidelity.d.ts.map +1 -1
  389. package/dist/lib/config-fidelity.js +144 -56
  390. package/dist/lib/config-fidelity.js.map +1 -1
  391. package/dist/lib/coordination-client.d.ts +101 -0
  392. package/dist/lib/coordination-client.d.ts.map +1 -1
  393. package/dist/lib/coordination-client.js +232 -8
  394. package/dist/lib/coordination-client.js.map +1 -1
  395. package/dist/lib/coordination-token.d.ts +333 -6
  396. package/dist/lib/coordination-token.d.ts.map +1 -1
  397. package/dist/lib/coordination-token.js +875 -52
  398. package/dist/lib/coordination-token.js.map +1 -1
  399. package/dist/lib/decision-check.d.ts +48 -0
  400. package/dist/lib/decision-check.d.ts.map +1 -0
  401. package/dist/lib/decision-check.js +149 -0
  402. package/dist/lib/decision-check.js.map +1 -0
  403. package/dist/lib/fleet-data.d.ts +34 -0
  404. package/dist/lib/fleet-data.d.ts.map +1 -1
  405. package/dist/lib/fleet-data.js +37 -9
  406. package/dist/lib/fleet-data.js.map +1 -1
  407. package/dist/lib/fleet-render.js +1 -1
  408. package/dist/lib/fleet-render.js.map +1 -1
  409. package/dist/lib/git-identity.d.ts +302 -0
  410. package/dist/lib/git-identity.d.ts.map +1 -0
  411. package/dist/lib/git-identity.js +546 -0
  412. package/dist/lib/git-identity.js.map +1 -0
  413. package/dist/lib/harness/console/announce.d.ts +45 -0
  414. package/dist/lib/harness/console/announce.d.ts.map +1 -0
  415. package/dist/lib/harness/console/announce.js +48 -0
  416. package/dist/lib/harness/console/announce.js.map +1 -0
  417. package/dist/lib/harness/console/announce.test.d.ts +2 -0
  418. package/dist/lib/harness/console/announce.test.d.ts.map +1 -0
  419. package/dist/lib/harness/console/announce.test.js +104 -0
  420. package/dist/lib/harness/console/announce.test.js.map +1 -0
  421. package/dist/lib/harness/console/by-session.d.ts +50 -0
  422. package/dist/lib/harness/console/by-session.d.ts.map +1 -0
  423. package/dist/lib/harness/console/by-session.js +83 -0
  424. package/dist/lib/harness/console/by-session.js.map +1 -0
  425. package/dist/lib/harness/console/by-session.test.d.ts +2 -0
  426. package/dist/lib/harness/console/by-session.test.d.ts.map +1 -0
  427. package/dist/lib/harness/console/by-session.test.js +86 -0
  428. package/dist/lib/harness/console/by-session.test.js.map +1 -0
  429. package/dist/lib/harness/console/console.d.ts +67 -0
  430. package/dist/lib/harness/console/console.d.ts.map +1 -0
  431. package/dist/lib/harness/console/console.js +373 -0
  432. package/dist/lib/harness/console/console.js.map +1 -0
  433. package/dist/lib/harness/console/console.test.d.ts +2 -0
  434. package/dist/lib/harness/console/console.test.d.ts.map +1 -0
  435. package/dist/lib/harness/console/console.test.js +269 -0
  436. package/dist/lib/harness/console/console.test.js.map +1 -0
  437. package/dist/lib/harness/console/decision-request.d.ts +32 -0
  438. package/dist/lib/harness/console/decision-request.d.ts.map +1 -0
  439. package/dist/lib/harness/console/decision-request.js +112 -0
  440. package/dist/lib/harness/console/decision-request.js.map +1 -0
  441. package/dist/lib/harness/console/decision-request.test.d.ts +2 -0
  442. package/dist/lib/harness/console/decision-request.test.d.ts.map +1 -0
  443. package/dist/lib/harness/console/decision-request.test.js +75 -0
  444. package/dist/lib/harness/console/decision-request.test.js.map +1 -0
  445. package/dist/lib/harness/console/fixtures.d.ts +16 -0
  446. package/dist/lib/harness/console/fixtures.d.ts.map +1 -0
  447. package/dist/lib/harness/console/fixtures.js +49 -0
  448. package/dist/lib/harness/console/fixtures.js.map +1 -0
  449. package/dist/lib/harness/console/index.d.ts +15 -0
  450. package/dist/lib/harness/console/index.d.ts.map +1 -0
  451. package/dist/lib/harness/console/index.js +14 -0
  452. package/dist/lib/harness/console/index.js.map +1 -0
  453. package/dist/lib/harness/console/rank.d.ts +73 -0
  454. package/dist/lib/harness/console/rank.d.ts.map +1 -0
  455. package/dist/lib/harness/console/rank.js +113 -0
  456. package/dist/lib/harness/console/rank.js.map +1 -0
  457. package/dist/lib/harness/console/rank.test.d.ts +2 -0
  458. package/dist/lib/harness/console/rank.test.d.ts.map +1 -0
  459. package/dist/lib/harness/console/rank.test.js +124 -0
  460. package/dist/lib/harness/console/rank.test.js.map +1 -0
  461. package/dist/lib/harness/console/render.d.ts +22 -0
  462. package/dist/lib/harness/console/render.d.ts.map +1 -0
  463. package/dist/lib/harness/console/render.js +65 -0
  464. package/dist/lib/harness/console/render.js.map +1 -0
  465. package/dist/lib/harness/console/render.test.d.ts +2 -0
  466. package/dist/lib/harness/console/render.test.d.ts.map +1 -0
  467. package/dist/lib/harness/console/render.test.js +96 -0
  468. package/dist/lib/harness/console/render.test.js.map +1 -0
  469. package/dist/lib/harness/console/replay-cli.test.d.ts +2 -0
  470. package/dist/lib/harness/console/replay-cli.test.d.ts.map +1 -0
  471. package/dist/lib/harness/console/replay-cli.test.js +96 -0
  472. package/dist/lib/harness/console/replay-cli.test.js.map +1 -0
  473. package/dist/lib/harness/console/replay.d.ts +36 -0
  474. package/dist/lib/harness/console/replay.d.ts.map +1 -0
  475. package/dist/lib/harness/console/replay.js +59 -0
  476. package/dist/lib/harness/console/replay.js.map +1 -0
  477. package/dist/lib/harness/console/replay.test.d.ts +2 -0
  478. package/dist/lib/harness/console/replay.test.d.ts.map +1 -0
  479. package/dist/lib/harness/console/replay.test.js +81 -0
  480. package/dist/lib/harness/console/replay.test.js.map +1 -0
  481. package/dist/lib/harness/console/turn-reader.d.ts +50 -0
  482. package/dist/lib/harness/console/turn-reader.d.ts.map +1 -0
  483. package/dist/lib/harness/console/turn-reader.js +184 -0
  484. package/dist/lib/harness/console/turn-reader.js.map +1 -0
  485. package/dist/lib/harness/console/turn-reader.test.d.ts +2 -0
  486. package/dist/lib/harness/console/turn-reader.test.d.ts.map +1 -0
  487. package/dist/lib/harness/console/turn-reader.test.js +108 -0
  488. package/dist/lib/harness/console/turn-reader.test.js.map +1 -0
  489. package/dist/lib/harness/console/types.d.ts +109 -0
  490. package/dist/lib/harness/console/types.d.ts.map +1 -0
  491. package/dist/lib/harness/console/types.js +2 -0
  492. package/dist/lib/harness/console/types.js.map +1 -0
  493. package/dist/lib/harness/contract.d.ts +229 -0
  494. package/dist/lib/harness/contract.d.ts.map +1 -0
  495. package/dist/lib/harness/contract.js +22 -0
  496. package/dist/lib/harness/contract.js.map +1 -0
  497. package/dist/lib/harness/credential.d.ts +23 -0
  498. package/dist/lib/harness/credential.d.ts.map +1 -0
  499. package/dist/lib/harness/credential.js +81 -0
  500. package/dist/lib/harness/credential.js.map +1 -0
  501. package/dist/lib/harness/credential.test.d.ts +2 -0
  502. package/dist/lib/harness/credential.test.d.ts.map +1 -0
  503. package/dist/lib/harness/credential.test.js +74 -0
  504. package/dist/lib/harness/credential.test.js.map +1 -0
  505. package/dist/lib/harness/evaluate.d.ts +390 -0
  506. package/dist/lib/harness/evaluate.d.ts.map +1 -0
  507. package/dist/lib/harness/evaluate.js +988 -0
  508. package/dist/lib/harness/evaluate.js.map +1 -0
  509. package/dist/lib/harness/evaluate.test.d.ts +2 -0
  510. package/dist/lib/harness/evaluate.test.d.ts.map +1 -0
  511. package/dist/lib/harness/evaluate.test.js +621 -0
  512. package/dist/lib/harness/evaluate.test.js.map +1 -0
  513. package/dist/lib/harness/extract.d.ts +152 -0
  514. package/dist/lib/harness/extract.d.ts.map +1 -0
  515. package/dist/lib/harness/extract.js +1601 -0
  516. package/dist/lib/harness/extract.js.map +1 -0
  517. package/dist/lib/harness/gate.d.ts +48 -0
  518. package/dist/lib/harness/gate.d.ts.map +1 -0
  519. package/dist/lib/harness/gate.js +60 -0
  520. package/dist/lib/harness/gate.js.map +1 -0
  521. package/dist/lib/harness/gate.test.d.ts +2 -0
  522. package/dist/lib/harness/gate.test.d.ts.map +1 -0
  523. package/dist/lib/harness/gate.test.js +111 -0
  524. package/dist/lib/harness/gate.test.js.map +1 -0
  525. package/dist/lib/harness/self-check.d.ts +59 -0
  526. package/dist/lib/harness/self-check.d.ts.map +1 -0
  527. package/dist/lib/harness/self-check.js +56 -0
  528. package/dist/lib/harness/self-check.js.map +1 -0
  529. package/dist/lib/harness/self-check.test.d.ts +2 -0
  530. package/dist/lib/harness/self-check.test.d.ts.map +1 -0
  531. package/dist/lib/harness/self-check.test.js +43 -0
  532. package/dist/lib/harness/self-check.test.js.map +1 -0
  533. package/dist/lib/harness/transcript.d.ts +65 -0
  534. package/dist/lib/harness/transcript.d.ts.map +1 -0
  535. package/dist/lib/harness/transcript.js +144 -0
  536. package/dist/lib/harness/transcript.js.map +1 -0
  537. package/dist/lib/harness/transcript.test.d.ts +2 -0
  538. package/dist/lib/harness/transcript.test.d.ts.map +1 -0
  539. package/dist/lib/harness/transcript.test.js +118 -0
  540. package/dist/lib/harness/transcript.test.js.map +1 -0
  541. package/dist/lib/harness-wiring.d.ts +145 -0
  542. package/dist/lib/harness-wiring.d.ts.map +1 -0
  543. package/dist/lib/harness-wiring.js +280 -0
  544. package/dist/lib/harness-wiring.js.map +1 -0
  545. package/dist/lib/hook-staleness.d.ts +95 -0
  546. package/dist/lib/hook-staleness.d.ts.map +1 -0
  547. package/dist/lib/hook-staleness.js +304 -0
  548. package/dist/lib/hook-staleness.js.map +1 -0
  549. package/dist/lib/jsonl.d.ts +270 -2
  550. package/dist/lib/jsonl.d.ts.map +1 -1
  551. package/dist/lib/jsonl.js +472 -76
  552. package/dist/lib/jsonl.js.map +1 -1
  553. package/dist/lib/memory.d.ts +350 -23
  554. package/dist/lib/memory.d.ts.map +1 -1
  555. package/dist/lib/memory.js +751 -38
  556. package/dist/lib/memory.js.map +1 -1
  557. package/dist/lib/otel-env.d.ts +90 -0
  558. package/dist/lib/otel-env.d.ts.map +1 -0
  559. package/dist/lib/otel-env.js +98 -0
  560. package/dist/lib/otel-env.js.map +1 -0
  561. package/dist/lib/project-config.d.ts +167 -0
  562. package/dist/lib/project-config.d.ts.map +1 -1
  563. package/dist/lib/project-config.js +321 -5
  564. package/dist/lib/project-config.js.map +1 -1
  565. package/dist/lib/projects-registry.d.ts +82 -0
  566. package/dist/lib/projects-registry.d.ts.map +1 -0
  567. package/dist/lib/projects-registry.js +145 -0
  568. package/dist/lib/projects-registry.js.map +1 -0
  569. package/dist/lib/projects-registry.test.d.ts +2 -0
  570. package/dist/lib/projects-registry.test.d.ts.map +1 -0
  571. package/dist/lib/projects-registry.test.js +176 -0
  572. package/dist/lib/projects-registry.test.js.map +1 -0
  573. package/dist/lib/repo-guard-scope.d.ts +126 -0
  574. package/dist/lib/repo-guard-scope.d.ts.map +1 -0
  575. package/dist/lib/repo-guard-scope.js +249 -0
  576. package/dist/lib/repo-guard-scope.js.map +1 -0
  577. package/dist/lib/report-format.d.ts +132 -0
  578. package/dist/lib/report-format.d.ts.map +1 -0
  579. package/dist/lib/report-format.js +317 -0
  580. package/dist/lib/report-format.js.map +1 -0
  581. package/dist/lib/roster.d.ts +99 -0
  582. package/dist/lib/roster.d.ts.map +1 -0
  583. package/dist/lib/roster.js +336 -0
  584. package/dist/lib/roster.js.map +1 -0
  585. package/dist/lib/roster.test.d.ts +15 -0
  586. package/dist/lib/roster.test.d.ts.map +1 -0
  587. package/dist/lib/roster.test.js +299 -0
  588. package/dist/lib/roster.test.js.map +1 -0
  589. package/dist/lib/runtime/codex-adapter.d.ts.map +1 -1
  590. package/dist/lib/runtime/codex-adapter.js +5 -0
  591. package/dist/lib/runtime/codex-adapter.js.map +1 -1
  592. package/dist/lib/runtime/codex-config.d.ts +129 -0
  593. package/dist/lib/runtime/codex-config.d.ts.map +1 -1
  594. package/dist/lib/runtime/codex-config.js +225 -0
  595. package/dist/lib/runtime/codex-config.js.map +1 -1
  596. package/dist/lib/runtime/identity.d.ts +72 -0
  597. package/dist/lib/runtime/identity.d.ts.map +1 -0
  598. package/dist/lib/runtime/identity.js +128 -0
  599. package/dist/lib/runtime/identity.js.map +1 -0
  600. package/dist/lib/standards.d.ts +99 -0
  601. package/dist/lib/standards.d.ts.map +1 -0
  602. package/dist/lib/standards.js +201 -0
  603. package/dist/lib/standards.js.map +1 -0
  604. package/dist/lib/team-identity.d.ts +134 -0
  605. package/dist/lib/team-identity.d.ts.map +1 -0
  606. package/dist/lib/team-identity.js +193 -0
  607. package/dist/lib/team-identity.js.map +1 -0
  608. package/dist/lib/templates.d.ts +29 -2
  609. package/dist/lib/templates.d.ts.map +1 -1
  610. package/dist/lib/templates.js +1042 -82
  611. package/dist/lib/templates.js.map +1 -1
  612. package/dist/lib/terminal-ui.d.ts.map +1 -1
  613. package/dist/lib/terminal-ui.js +12 -1
  614. package/dist/lib/terminal-ui.js.map +1 -1
  615. package/dist/lib/test-project.d.ts +95 -0
  616. package/dist/lib/test-project.d.ts.map +1 -0
  617. package/dist/lib/test-project.js +103 -0
  618. package/dist/lib/test-project.js.map +1 -0
  619. package/dist/lib/vault.d.ts +60 -0
  620. package/dist/lib/vault.d.ts.map +1 -0
  621. package/dist/lib/vault.js +102 -0
  622. package/dist/lib/vault.js.map +1 -0
  623. package/dist/lib/vault.test.d.ts +17 -0
  624. package/dist/lib/vault.test.d.ts.map +1 -0
  625. package/dist/lib/vault.test.js +169 -0
  626. package/dist/lib/vault.test.js.map +1 -0
  627. package/dist/lib/window-view.d.ts +63 -0
  628. package/dist/lib/window-view.d.ts.map +1 -0
  629. package/dist/lib/window-view.js +217 -0
  630. package/dist/lib/window-view.js.map +1 -0
  631. package/dist/lib/window-view.test.d.ts +2 -0
  632. package/dist/lib/window-view.test.d.ts.map +1 -0
  633. package/dist/lib/window-view.test.js +168 -0
  634. package/dist/lib/window-view.test.js.map +1 -0
  635. package/dist/lib/worktree-sync.d.ts +439 -0
  636. package/dist/lib/worktree-sync.d.ts.map +1 -0
  637. package/dist/lib/worktree-sync.js +1167 -0
  638. package/dist/lib/worktree-sync.js.map +1 -0
  639. package/dist/lib/worktree.d.ts +58 -1
  640. package/dist/lib/worktree.d.ts.map +1 -1
  641. package/dist/lib/worktree.js +91 -4
  642. package/dist/lib/worktree.js.map +1 -1
  643. package/dist/standards/decision-request.md +98 -0
  644. package/dist/standards/fail-loud-standard.md +495 -0
  645. package/dist/standards/po-communication-standard.md +126 -0
  646. package/dist/standards/report-format.md +128 -0
  647. package/dist/standards/writing-standard.md +382 -0
  648. package/package.json +3 -2
  649. package/scripts/generate-claude.mjs +119 -46
@@ -4,9 +4,32 @@
4
4
  * Creates a new agent team worktree, initialises team memories, and
5
5
  * creates a catalog entry.
6
6
  */
7
+ import { type CliBuildResult } from '../lib/cli-build.js';
8
+ import { type CredentialProvisionOutcome } from '../lib/coordination-token.js';
9
+ /**
10
+ * Row 10's remedy for a 403 in a project the coordination service creates on
11
+ * login (#507). The compiled-project remedy ("an operator creates a grant", or
12
+ * row 9's "add the team to PROVISIONED_ROSTERS") is wrong there: the project is
13
+ * in no compiled roster by design. Fixed text: the service's 403 is
14
+ * byte-identical whether the team exists or not, and this adds nothing that
15
+ * tells the two apart.
16
+ */
17
+ export declare const SELF_SERVICE_REFUSED_DETAIL: string;
18
+ import { type CoordinationUrlSource } from '../lib/coordination-client.js';
7
19
  export interface CreateOptions {
8
- roleguide: string;
20
+ /**
21
+ * The team roleguide. Optional for `--recheck` ONLY, which resolves it from
22
+ * the worktree and the catalog entry rather than from the command line (#76).
23
+ * Every other path refuses without it.
24
+ */
25
+ roleguide?: string;
9
26
  name?: string;
27
+ /**
28
+ * Read the completion rows for an existing team and print them. Writes
29
+ * nothing: no slot, no worktree, no memory, no catalog entry, no credential
30
+ * (#76, #316 change D).
31
+ */
32
+ recheck?: boolean;
10
33
  /** Override project root (used when calling from `new project` where cwd differs from output dir). */
11
34
  projectRoot?: string;
12
35
  /**
@@ -123,6 +146,44 @@ export declare class BehavioralContractError extends Error {
123
146
  readonly code = "behavioral-contract-refused";
124
147
  constructor(message: string);
125
148
  }
149
+ /**
150
+ * Refusal from the provisioning IDENTITY check (#39).
151
+ *
152
+ * A separate class from BehavioralContractError because the two failures have
153
+ * different remedies: the marker contract is a missing block and carries a
154
+ * documented rollback flag, this one is a roleguide written for another project
155
+ * and carries no override at all. A THROW for the same reason as above —
156
+ * `mx-agent new project` catches it and keeps the half-built project usable.
157
+ */
158
+ export declare class RoleguideIdentityError extends Error {
159
+ readonly code = "roleguide-identity-refused";
160
+ constructor(message: string);
161
+ }
162
+ /**
163
+ * Failure of the post-creation completion check (#48).
164
+ *
165
+ * A THROW rather than a `process.exit` for the same reason as the two above:
166
+ * `mx-agent new project` catches it and keeps the project it has already built
167
+ * usable, and the top-level `provision`/`create` actions catch, print the
168
+ * message, and exit 1 — so a direct invocation still fails with a non-zero
169
+ * status. The message names every row that did not hold AND every artifact that
170
+ * does exist, because nothing is deleted and the operator has to finish by hand
171
+ * (#5).
172
+ */
173
+ export declare class CompletionCheckError extends Error {
174
+ readonly code = "completion-check-failed";
175
+ constructor(message: string);
176
+ }
177
+ /** Whether `message` is one of the three refusals above. */
178
+ export declare function isCatalogPreconditionRefusal(message: string): boolean;
179
+ export type CatalogRemedyState = 'pushed' | 'committed' | 'unstarted';
180
+ declare function catalogRemedyLines(i: {
181
+ state: CatalogRemedyState;
182
+ slug: string;
183
+ catalogRelPath: string;
184
+ roleguidesDir: string;
185
+ branch: string | null;
186
+ }): string[];
126
187
  /**
127
188
  * The directories a `--roleguide` argument may resolve inside.
128
189
  *
@@ -185,6 +246,836 @@ export interface ValidatedRoleguide {
185
246
  /** Complete file bytes as read from the validated descriptor; null if unreadable. */
186
247
  raw: string | null;
187
248
  }
249
+ /** One place a roleguide names a project other than the one it is provisioned into. */
250
+ export interface RoleguideIdentityMismatch {
251
+ /** 1-based line number, so the operator can open the file at the defect. */
252
+ line: number;
253
+ /** Exactly what the roleguide says. Drawn from a closed character class, so it is safe to print. */
254
+ found: string;
255
+ /** What this project requires in its place. */
256
+ expected: string;
257
+ kind: 'memory-prefix' | 'product-declaration' | 'unfilled-placeholder';
258
+ }
259
+ /**
260
+ * The ONE file that is meant to be provisioned with its placeholders intact.
261
+ *
262
+ * `templates.ts` copies `team-builder.md` verbatim into every new project, so its
263
+ * memory names cannot name a project and must stay `<PROJECT_SLUG>-` (#34). Every
264
+ * other roleguide belongs to one project and is filled before it is provisioned;
265
+ * a placeholder left in one of those is an unfinished roleguide, and provisioning
266
+ * it produced a team whose every instruction told it to read a memory that does
267
+ * not exist.
268
+ *
269
+ * IDENTIFIED BY EXACT PATH AND SLUG, not by basename. `allowedRoleguideRoots`
270
+ * admits the whole project root, and `mx-agent-system/teams/team-builder.md`
271
+ * already exists, so a basename test handed the exception to any
272
+ * `<anywhere>/team-builder.md` — provisioned under any slug, on any team. The
273
+ * path is compared relative to the root the file was validated under, so it is
274
+ * the configured roleguides directory or nothing, and the slug must be the
275
+ * team-builder slug as well: the exception exists for one file provisioning one
276
+ * team, and both halves are cheap to require.
277
+ */
278
+ declare function isPlaceholderRoleguide(roleguideAbs: string | null, owningRoot: string | null, roleguidesDir: string, slug: string): boolean;
279
+ /**
280
+ * Every place the roleguide names a project other than `projectSlug`.
281
+ *
282
+ * Pure: takes the bytes the contract already validated, touches no filesystem.
283
+ * Returns an empty array when the roleguide belongs here, or when the project
284
+ * configures no `projectSlug` — with no configured identity there is nothing to
285
+ * compare against, and `teamMemorySpecs` then writes unprefixed memory names.
286
+ *
287
+ * Two things are checked, and only two, because only these two exist in the files
288
+ * this project actually writes:
289
+ * (a) team-memory keys whose prefix is not this project's;
290
+ * (b) a quoted `product:` declaration naming another project.
291
+ * The team's own unprefixed spelling (`<team>-leader-state`) is accepted:
292
+ * `leaderStateNameCandidates` (`lib/memory.ts`) still resolves it, so it is legacy,
293
+ * not foreign. A prefix that starts with a template token is accepted too, for the
294
+ * reasons on TEMPLATE_PREFIX_RE below.
295
+ */
296
+ declare function checkRoleguideIdentity(text: string, teamSlug: string, projectSlug: string,
297
+ /**
298
+ * True ONLY for the bundled team-builder roleguide, decided by the caller with
299
+ * `isPlaceholderRoleguide` (exact path + slug). A boolean rather than a
300
+ * filename, so nothing downstream can re-derive the exception from a basename.
301
+ */
302
+ allowUnfilledPlaceholders?: boolean): RoleguideIdentityMismatch[];
303
+ /**
304
+ * The skeleton placeholders still standing in `text`, deduped, in the order they
305
+ * first appear. Pure: reads no filesystem.
306
+ */
307
+ declare function remainingPlaceholders(text: string): string[];
308
+ /**
309
+ * Bracketed tokens that are neither a shipped placeholder nor a known prose
310
+ * metavariable, deduped, in first-appearance order. Pure.
311
+ */
312
+ declare function unrecognizedBracketTokens(text: string): string[];
313
+ /** `N placeholders remain: <A>, <B>, ... (team-builder step 5)`. */
314
+ declare function placeholderRowDetail(remaining: string[]): string;
315
+ /** One row of the table, as parsed, before any name validation. */
316
+ interface AnchorTableRow {
317
+ /** The Name cell with surrounding whitespace and code-span backticks removed. */
318
+ name: string;
319
+ /** 1-based line number in the roleguide copy, so an operator can open the defect. */
320
+ line: number;
321
+ /** The row exactly as written, for the refusal message. Sanitized before printing. */
322
+ raw: string;
323
+ }
324
+ /**
325
+ * Roleguide text a refusal is about to print, made safe to print.
326
+ *
327
+ * The roleguide is operator-supplied and this is the first place its raw bytes
328
+ * reach the terminal: row 13 prints only tokens drawn from a closed set, and
329
+ * `safeDetail` in `lib/memory.ts` does this same job for mx's output. A refusal
330
+ * that names the raw row is worth much more than one that does not, so the row
331
+ * is printed with C0 and C1 control characters removed (an ESC sequence in a
332
+ * roleguide would otherwise rewrite the operator's terminal), inner whitespace
333
+ * collapsed to single spaces, and the result truncated.
334
+ */
335
+ declare function safeRowText(raw: string): string;
336
+ /**
337
+ * Read the Named Memory Anchors table out of a roleguide.
338
+ *
339
+ * Pure: takes text, touches no filesystem, creates nothing. Returns the rows or
340
+ * one refusal, never a partial list, because a partial list is what would seed a
341
+ * partial set of memories.
342
+ *
343
+ * TOLERATED, each because the three live roleguides already disagree and a
344
+ * parser keyed to any of them would refuse a file that ships today:
345
+ * * heading level. `bootstrap-leader.md:512` uses `##`, `surface-leader.md:440`
346
+ * and the skeleton use `###`.
347
+ * * column-header casing. `bootstrap-leader.md:514` writes `Updated when`,
348
+ * `surface-leader.md:442` writes `Updated When`.
349
+ * * separator width. `|---|---|---|` and `|------|---------|-------------|`.
350
+ * * column order. The Name column is found by its header, not by position.
351
+ * * a comment or prose line between the heading and the table. The skeleton
352
+ * carries one as of #190, stating that the table is machine-parsed.
353
+ *
354
+ * REFUSED, each with the raw row or the heading named:
355
+ * * two tables under the heading. Silently taking the first is the exact shape
356
+ * of the defect this parser exists to fix (security pre-ruling S3).
357
+ * * no table under the heading, and no heading at all.
358
+ * * a row that does not open and close with a pipe, or whose cell count
359
+ * differs from the header's — the two ways a wrapped or truncated row reads.
360
+ * * an escaped `\|`, or a pipe inside a code span, because neither survives
361
+ * the split and this parser will not guess where the cell boundary was.
362
+ *
363
+ * OUT OF SCOPE, and safe by construction: HTML tables, nested tables and
364
+ * reference-style links in the Name cell. No roleguide uses them, and because
365
+ * the design is refuse-unless-confident they reach the refusal path rather than
366
+ * being mis-parsed.
367
+ *
368
+ * Content inside a fenced code block is skipped throughout — for the heading
369
+ * scan, the section boundary and the table scan. A fence is not a table, and
370
+ * `product-leader.md:587` shows the case that matters: an example table fenced
371
+ * for a reader to copy. Skipping it is a ruling, not an oversight; a table the
372
+ * author hid inside a fence is not found, and the heading then holds no table,
373
+ * which refuses.
374
+ */
375
+ declare function parseAnchorTable(text: string): {
376
+ ok: true;
377
+ rows: AnchorTableRow[];
378
+ } | {
379
+ ok: false;
380
+ detail: string;
381
+ };
382
+ /** One accepted anchor: the name to seed and the suffix its seed body is built from. */
383
+ interface ValidatedAnchor {
384
+ name: string;
385
+ suffix: string;
386
+ line: number;
387
+ }
388
+ /**
389
+ * Every row checked against this run's slug and this project's catalog, as one
390
+ * verdict for the whole table.
391
+ *
392
+ * ALL-OR-NOTHING, and this is the condition with two recorded incidents behind
393
+ * it (security pre-ruling M1, `create.ts:2848-2857`). `bootstrapTeamMemories`
394
+ * refuses to create over a taken name, deliberately, because
395
+ * `mx memories create --name` is an upsert. A run that seeded three anchors and
396
+ * then refused on the fourth would leave those three names permanently taken for
397
+ * that slug, and no later run for that slug could ever assert rows 3 to 5. So
398
+ * the first refused row refuses the table, the caller seeds nothing, and every
399
+ * name stays free for the run that passes.
400
+ */
401
+ declare function validateAnchorRows(rows: AnchorTableRow[], i: {
402
+ projectSlug: string;
403
+ teamSlug: string;
404
+ otherSlugs: string[];
405
+ }): {
406
+ ok: true;
407
+ anchors: ValidatedAnchor[];
408
+ } | {
409
+ ok: false;
410
+ detail: string;
411
+ };
412
+ /**
413
+ * What the anchor stage decided, as five outcomes rather than two.
414
+ *
415
+ * `exempt` and `not-reached` are silent and seed the three the old way; `ok`
416
+ * seeds N; `refused` and `could-not-run` seed NOTHING and fail the run. Passed,
417
+ * failed and could-not-run are three results
418
+ * (`mx-agent-system/standards/fail-loud-standard.md`), and a stage that could
419
+ * not read the file is not a stage that found no extra anchors.
420
+ */
421
+ type AnchorStage =
422
+ /** The bundled team-builder roleguide. Never parsed (M6). */
423
+ {
424
+ kind: 'exempt';
425
+ }
426
+ /** Row 13 already refuses this run, so nothing is seeded and nothing is parsed. */
427
+ | {
428
+ kind: 'not-reached';
429
+ } | {
430
+ kind: 'ok';
431
+ anchors: ValidatedAnchor[];
432
+ extras: ValidatedAnchor[];
433
+ } | {
434
+ kind: 'refused';
435
+ detail: string;
436
+ } | {
437
+ kind: 'could-not-run';
438
+ detail: string;
439
+ };
440
+ /**
441
+ * The anchor stage, run at step 6c beside row 13's gate.
442
+ *
443
+ * ORDER IS THE POINT, twice over.
444
+ *
445
+ * The `isPlaceholderRoleguide` exemption is asked FIRST (security pre-ruling
446
+ * M6). `roleguides/team-builder.md` is the one file meant to travel with its
447
+ * placeholders intact (#34); it has no anchors table at all, only a checklist
448
+ * item naming one, so a parser that ran before the exemption would refuse
449
+ * `provision --name team-builder` on a file that is correct as written.
450
+ *
451
+ * And the whole stage runs BEFORE step 7, which is the first step that writes
452
+ * anything outside the new worktree. Everything the earlier steps made is inside
453
+ * the worktree and `git worktree remove` clears it; a named memory is not
454
+ * clearable that way. This is the same reason row 13's verdict is computed here
455
+ * rather than at the row, and it is the same incident: a run that took the three
456
+ * names and then refused left rows 3 to 5 unassertable for that slug forever.
457
+ */
458
+ declare function anchorStage(i: {
459
+ roleguideInWorktree: string | null;
460
+ unfilledPlaceholdersAllowed: boolean;
461
+ willRefuseAtRow13: boolean;
462
+ projectSlug: string;
463
+ teamSlug: string;
464
+ /** Null when the catalog could not be read; `[]` when it is genuinely empty. */
465
+ otherSlugs: string[] | null;
466
+ }): AnchorStage;
467
+ /** `a`, `b`, ... `z`, `aa`. The letter on rows `3a`, `3b`, ... (I2). */
468
+ declare function anchorRowLetter(index: number): string;
469
+ /** What provisioning knows about a team before that team has run anything. */
470
+ interface RoleguideIdentity {
471
+ /** Validated by SLUG_RE in runCreate before this is called. */
472
+ slug: string;
473
+ /** Validated by isValidProjectSlug in runCreate; empty is the documented default. */
474
+ projectSlug: string;
475
+ /** The new team's worktree, relative to the project root. */
476
+ worktreeRel: string;
477
+ /** The coordination marker inside that worktree, relative to the project root. */
478
+ coordinationMarkerRel: string;
479
+ /** The team's catalog entry, relative to the project root. */
480
+ catalogEntryRel: string;
481
+ }
482
+ /**
483
+ * Build a team's first roleguide from the embedded skeleton (#83 B2).
484
+ *
485
+ * Fills the IDENTITY slice and nothing else: the team slug, the project slug,
486
+ * the three memory names, the codeContext block, the worktree, the coordination
487
+ * marker and the catalog entry. Every remaining placeholder is a judgement, so it
488
+ * stays literal and row 13 names it until a person fills it.
489
+ *
490
+ * Pure, and the input set is two validated slugs plus two configured directory
491
+ * names checked against SAFE_REL_PATH_RE. No operator free text reaches the
492
+ * output, which matters because this file becomes a team's every-turn context.
493
+ */
494
+ declare function generateRoleguide(id: RoleguideIdentity): string;
495
+ /**
496
+ * Whether ONE seeded memory holds the shape provisioning claims to have written.
497
+ *
498
+ * Pure, and separate from the read, so the failure paths are unit-testable
499
+ * without an mx call: a seed with the block removed, a seed carrying an unedited
500
+ * `[ok | needs-human | blocked]` placeholder, a codeContext missing a field.
501
+ *
502
+ * The leader-state check ends at `parseLeaderState`, the reader `mx-agent window`
503
+ * uses, rather than at a local restatement of its rules. "Asserted" then means
504
+ * "the fleet view can read this", which is the claim #6 is about; a copy of the
505
+ * rules could pass while the parser returns `unknown`.
506
+ */
507
+ declare function assessSeedShape(input: {
508
+ content: string;
509
+ codeContext: unknown;
510
+ leaderState: boolean;
511
+ /**
512
+ * Whether `product` is one of the required fields. False when the project
513
+ * configures no slug: `codeContextJson` drops an empty value rather than
514
+ * writing `product: ""`, so requiring it would fail rows 3 to 5 on every
515
+ * provision in a project without an `mx-agent.config.json`. Row 0 reports the
516
+ * same absence, in the same run, for the same reason.
517
+ */
518
+ requireProduct: boolean;
519
+ }): {
520
+ ok: boolean;
521
+ detail: string;
522
+ };
523
+ /**
524
+ * POST-CREATION EXISTENCE ASSERTIONS (#48) — the completion check.
525
+ *
526
+ * The completion contract in `mx-agent-system/roleguides/team-builder.md`
527
+ * ("What a Complete Provisioned Team Looks Like") has twelve rows. Until this
528
+ * change the system asserted ONE of them: row 6, the exit code, which says only
529
+ * that the command did not crash. `platform` exited 0 and was still born holding
530
+ * another product's roleguide, and the v2 Step 1 rehearsal (2026-08-21) found
531
+ * rows 1 to 5 passing only after two hand repairs.
532
+ *
533
+ * So provisioning now verifies what it claims to have made, after its last write:
534
+ * the roleguide copy, the catalog entry, and the three named memories, by reading
535
+ * them back. Rows this version does not check print as not asserted BY NUMBER, so
536
+ * an operator reading "Team Created!" knows exactly what that success covered.
537
+ *
538
+ * Row 0 is the identity check this iteration added; it is outside the contract's
539
+ * twelve and is numbered 0 rather than renumbering the rest. Row 13 is the
540
+ * placeholder scan (#83 B3), numbered after them for the same reason.
541
+ */
542
+ interface CompletionRow {
543
+ /**
544
+ * Row number: 0 is identity, 1 to 12 are the contract's own rows in its order,
545
+ * 13 is the placeholder scan, 14 is the CLI build (#123) and 15 is the
546
+ * per-team git identity (#440).
547
+ */
548
+ n: number;
549
+ label: string;
550
+ asserted: boolean;
551
+ /** Why, when `asserted` is false: outside this version's scope, missing, or could-not-run. */
552
+ detail: string;
553
+ /**
554
+ * Whether THIS version claims to check the row. A required row that did not
555
+ * hold makes provisioning exit non-zero; a row outside the version's scope
556
+ * prints as not asserted and changes nothing.
557
+ */
558
+ required: boolean;
559
+ /**
560
+ * The row could not be RUN, as opposed to having run and not held (#290 Should
561
+ * Fix 4). Passed, failed and could-not-run are three outcomes
562
+ * (mx-agent-system/standards/fail-loud-standard.md) and row 10 printed the last
563
+ * two with the same verdict: a 403 (the service decided) and a 503 (the service
564
+ * never answered) both read `not asserted`, which sends an operator to create a
565
+ * grant on the evidence of an outage.
566
+ *
567
+ * A required row that could not run still fails the creation. It is not a pass.
568
+ * What changes is the word, and therefore the remedy the operator reads.
569
+ */
570
+ couldNotRun?: boolean;
571
+ /**
572
+ * The row failed because the memory NAME was already taken. Different remedy
573
+ * from every other failure: re-running provisioning cannot clear it, because
574
+ * the name is still taken on the second pass too.
575
+ */
576
+ nameTaken?: boolean;
577
+ /**
578
+ * The row also read the artifact back and asserted its SHAPE, not just that
579
+ * this run made it (#6). Printed as `asserted (shape)`, so a reader can tell
580
+ * the two claims apart at the row.
581
+ */
582
+ shapeAsserted?: boolean;
583
+ /**
584
+ * The artifact this row asserts EXISTS and differs from what this run would
585
+ * have written (#316 review round 2, red-team finding 3).
586
+ *
587
+ * The row still asserts: the team has the memory, or the catalog entry, and
588
+ * that is the claim the label makes. What a green row alone could not say is
589
+ * that its content is not this run's, and the verdict column now says it.
590
+ * Nothing was overwritten to produce this state, which is the point of it.
591
+ */
592
+ stale?: boolean;
593
+ /**
594
+ * Row 12 only (#32): whether the coordination service URL resolved. A row can
595
+ * be not asserted overall and still have had ONE of its parts checked, so this
596
+ * names that part instead of letting a resolved URL read as nothing at all.
597
+ * Set to false when no level held a URL.
598
+ */
599
+ urlAsserted?: boolean;
600
+ /**
601
+ * Row 9 (#77): one of the row's two committed artifacts holds the slug and the
602
+ * other does not. Printed as `partly asserted`, the same state row 12 reaches
603
+ * through `urlAsserted`, and counted as NOT asserted, because the claim the
604
+ * label makes needs both files.
605
+ */
606
+ partlyAsserted?: boolean;
607
+ /** Which precedence level produced the URL: env, config, or project. */
608
+ urlSource?: string;
609
+ /**
610
+ * The project declares a coordination URL and a higher level resolved a
611
+ * DIFFERENT one. The row says so, because "coordination URL from config" reads
612
+ * as agreement when it is silent about the file the operator is looking at.
613
+ */
614
+ urlMismatch?: boolean;
615
+ /**
616
+ * An anchor the roleguide's table names beyond the three (#190). Prints as
617
+ * `3a`, `3b`, ... after row 5. Rows 0 to 14 leave this unset and keep their
618
+ * numbers, so `team-builder.md`, the completion-contract memory and #34's
619
+ * embedded-copy test all stay aligned (security pre-ruling I2).
620
+ */
621
+ extraSuffixIndex?: number;
622
+ /**
623
+ * The memory name this row is about, for rows 3 to 5 and every `3a` row.
624
+ * Carried on the row rather than re-derived from `memoryNames[n - 3]`, which
625
+ * cannot index a row numbered `3a`.
626
+ */
627
+ memoryName?: string;
628
+ /** Printed above this row. Set on the first `3a` row only. */
629
+ sectionHeading?: string;
630
+ }
631
+ interface CompletionInputs {
632
+ slug: string;
633
+ projectSlug: string;
634
+ baseBranch: string;
635
+ /** Where the roleguide should now sit in the new worktree; null when nothing was copied. */
636
+ roleguideInWorktree: string | null;
637
+ /**
638
+ * The new worktree's root, which row 1 reads `.mx-code-context.json` back
639
+ * from (#62). Optional: a caller that does not pass it gets the row's missing
640
+ * branch, because a check that cannot look is not a check that passed.
641
+ */
642
+ worktreePath?: string;
643
+ /**
644
+ * The calling checkout, which rows 9 and 10 read `origin/<baseBranch>` from
645
+ * (#77). Optional, and absent makes row 9 could-not-run: a check with no
646
+ * repository to read is not a check that passed.
647
+ */
648
+ projectRoot?: string;
649
+ /**
650
+ * What `fetchOrigin` returned at step 0c. Row 9 reads a remote-tracking ref,
651
+ * and a failed fetch leaves that ref of unknown age, so `false` and omitted
652
+ * both make the row could-not-run rather than absent.
653
+ */
654
+ fetchOk?: boolean;
655
+ catalogEntry: string;
656
+ /**
657
+ * Whether the project has an `origin` remote (#51). Row 2 asserts a different
658
+ * fact in each case: with an `origin` the entry is on the base branch, checked
659
+ * before anything was created; without one, provisioning wrote it into the
660
+ * scaffolded project and the row reads that file back. Optional, and absent
661
+ * reads as no origin, which is the branch that reads the filesystem.
662
+ */
663
+ hasOrigin?: boolean;
664
+ /**
665
+ * The entry's path on the remote base branch, `/`-separated, which row 2 names
666
+ * when the project has an `origin`. The branch itself comes from `baseBranch`.
667
+ * Defaults to the catalog module's default directory.
668
+ */
669
+ catalogOnOriginMainPath?: string;
670
+ /**
671
+ * The roleguide's path on the base branch, project-relative, which row 7 reads
672
+ * off `origin/<baseBranch>` (#406 part 1). Derived by the caller from the
673
+ * destination its own copy step used, never from the operator's `--roleguide`
674
+ * string, for the reason row 1 states about its own path.
675
+ *
676
+ * ABSENT is could-not-run, never `absent`: a run that copied no roleguide has
677
+ * no path to look for, and a row that did not look is not a row that failed.
678
+ */
679
+ roleguideOnBasePath?: string;
680
+ memoryNames: string[];
681
+ /**
682
+ * True ONLY for the bundled team-builder roleguide, decided by the caller with
683
+ * `isPlaceholderRoleguide` (exact path + slug), the same decision the identity
684
+ * gate makes. That one file is copied into projects whose slug it cannot know,
685
+ * so its placeholders are the design and row 13 asserts on them. A boolean
686
+ * rather than a filename, so nothing here can re-derive the exception from a
687
+ * basename.
688
+ */
689
+ unfilledPlaceholdersAllowed?: boolean;
690
+ /**
691
+ * Whether step 7 was skipped because the roleguide still holds placeholders.
692
+ * The names must stay free for the run that passes row 13, so rows 3 to 5 say
693
+ * the memories were not created rather than reporting them missing.
694
+ */
695
+ memoriesSkippedForPlaceholders?: boolean;
696
+ /**
697
+ * The environment row 8 resolves the start slug against (#410). Defaults to
698
+ * this process's environment, which is the one a session launched from this
699
+ * run would inherit, so a caller cannot forget to pass it and turn the row
700
+ * green by omission. Tests pass a literal rather than mutating `process.env`.
701
+ */
702
+ startEnv?: NodeJS.ProcessEnv;
703
+ /** Whether the mx CLI answered `--version`. False makes rows 3 to 5 could-not-run, not absent. */
704
+ mxAvailable: boolean;
705
+ /**
706
+ * What this run's create call reported for each memory name, in `memoryNames`
707
+ * order. Absent when memories were never attempted (no mx), which rows 3 to 5
708
+ * then report as could-not-run.
709
+ */
710
+ /**
711
+ * Which precedence level held a coordination service URL when provisioning
712
+ * ran, or null when none did. Resolved BEFORE the seed step writes the global
713
+ * config, so row 12 reports where the URL came from rather than where it now
714
+ * sits. Optional: a caller that does not resolve it gets the not-asserted row.
715
+ */
716
+ coordinationUrlSource?: CoordinationUrlSource | null;
717
+ /**
718
+ * Whether the committed project config names a different URL than the level
719
+ * that won. Compared with trailing slashes and surrounding space removed, so a
720
+ * formatting difference is not reported as a disagreement.
721
+ */
722
+ coordinationUrlMismatch?: boolean;
723
+ creations?: Array<{
724
+ id: string | null;
725
+ preExisting: boolean;
726
+ ok: boolean;
727
+ probeConclusive: boolean;
728
+ probeReason?: string;
729
+ /** What the pre-existence probe read, when it found the name taken. */
730
+ preExistingRead?: {
731
+ content: string;
732
+ codeContext: unknown;
733
+ };
734
+ }>;
735
+ /**
736
+ * What the roleguide anchor stage decided (#190).
737
+ *
738
+ * ABSENT means no `3a` row prints and the output is what it was before #190,
739
+ * byte for byte. Three paths reach that: the bundled team-builder roleguide
740
+ * (exempt, M6), a run row 13 already refuses, and any caller written before
741
+ * this field existed.
742
+ */
743
+ anchors?: {
744
+ kind: 'refused';
745
+ detail: string;
746
+ } | {
747
+ kind: 'could-not-run';
748
+ detail: string;
749
+ } | {
750
+ kind: 'ok';
751
+ extras: Array<{
752
+ name: string;
753
+ suffix: string;
754
+ }>;
755
+ };
756
+ /**
757
+ * What this run's create call reported for each extra anchor, in `anchors.extras`
758
+ * order. Absent when the extras were never attempted, which the rows then
759
+ * report as could-not-run — the same reading `creations` gets for rows 3 to 5.
760
+ */
761
+ extraCreations?: Array<NonNullable<CompletionInputs['creations']>[number] & {
762
+ /**
763
+ * The memory name this result belongs to. Rows are matched on THIS, never
764
+ * on position: the list `create.ts` validated and the list `lib/memory.ts`
765
+ * returned are built in two files, and `dedupeSuffixes` drops a suffix
766
+ * silently rather than refusing. If those two lists ever disagreed, a
767
+ * positional zip would print one anchor's creation result under another
768
+ * anchor's name instead of erroring (security review Should Fix 2).
769
+ */
770
+ name: string;
771
+ }>;
772
+ /**
773
+ * What the row-10 credential probe concluded, for a credential-endpoint
774
+ * project (#288). Pre-resolved by the caller, in the pattern `build`,
775
+ * `creations` and `anchors` already use: the probe is an HTTP request and
776
+ * `checkCompletionRows` is synchronous.
777
+ *
778
+ * ABSENT is could-not-run, never `absent`: a row that did not look is not a
779
+ * row that passed. Ignored entirely for a Key Vault project, which keeps the
780
+ * vault read.
781
+ */
782
+ credential?: CredentialProvisionOutcome;
783
+ /**
784
+ * What step 6e's build decided (#123). Row 14 reads it.
785
+ *
786
+ * ABSENT is its own answer, and it is not `built`: a caller written before this
787
+ * field existed did not build, and a row that did not look is not a row that
788
+ * passed (`create.ts:1115-1117`). The row prints could-not-run in that case.
789
+ */
790
+ build?: CliBuildResult;
791
+ /**
792
+ * What a memory that ALREADY EXISTED says about itself, by name (#316 change B).
793
+ *
794
+ * Set by a resumed run and by `--recheck`, and by nothing else. A fresh
795
+ * creation passes none, so rows 3 to 5 read exactly what they read before this
796
+ * field existed: a pre-existing name is a red row, because a first run cannot
797
+ * attribute a memory it did not write.
798
+ *
799
+ * A resume can. The name was taken by the interrupted run FOR THIS TEAM, which
800
+ * `preExistingOwnership` establishes from the memory's own codeContext, and a
801
+ * row that stayed red would make the team unfinishable — the whole of #5.
802
+ */
803
+ memoryStates?: MemoryStateRow[];
804
+ /**
805
+ * What the catalog entry says about itself, when this command is the writer of
806
+ * it (#316 review round 2). Absent on a fresh creation and on every project
807
+ * whose entry is on the base branch, which leaves row 2 exactly as it was.
808
+ */
809
+ catalogState?: {
810
+ kind: 'present' | 'present-stale' | 'absent';
811
+ detail: string;
812
+ };
813
+ /**
814
+ * Row 10 was answered by reading the cache and nothing else (#316 change D,
815
+ * red-team Major 6). `--recheck` writes nothing, so it cannot ask the service
816
+ * whether a credential is obtainable; it can only see whether one is already
817
+ * cached. The row says so in its own words rather than reading like the
818
+ * probe ran.
819
+ */
820
+ credentialCheckedByCacheOnly?: boolean;
821
+ }
822
+ /**
823
+ * Build all sixteen rows. Reads the filesystem and, for rows 3 to 5, the mx CLI;
824
+ * writes nothing and deletes nothing, because a failure here must leave every
825
+ * artifact that DOES exist in place for a resume (#5).
826
+ */
827
+ declare function checkCompletionRows(i: CompletionInputs): CompletionRow[];
828
+ /**
829
+ * Row 15, read back from the worktree's own git config.
830
+ *
831
+ * IT READS THE ARTIFACT, NOT THE WRITE'S RETURN VALUE, so it takes no input
832
+ * beyond what every other row already has. Same reason row 14 re-reads
833
+ * `dist/index.js` rather than trusting the build result (`create.ts:3377-3380`)
834
+ * and row 1 re-reads the roleguide copy: the row reports what exists now. It
835
+ * also means `--recheck`, which writes nothing, gets a real answer from the same
836
+ * function rather than a permanently blank row.
837
+ *
838
+ * IT ASSERTS ISOLATION, NOT PRESENCE. The name matching the slug is not enough:
839
+ * the shared config could hold that string for reasons of its own, and a row
840
+ * that accepted it would report PASS for the exact defect this work exists to
841
+ * prevent (#440, comment 5555843161: "a rehearsal would report PASS"). So the
842
+ * row also requires that the EFFECTIVE `user.name` resolve from this worktree's
843
+ * own `config.worktree` file.
844
+ *
845
+ * THE CLASSIFICATION IS `describeTeamGitIdentityState`, NOT A COPY OF ITS RULES.
846
+ * This row and the `## Git Identity` block in `CLAUDE.local.md`
847
+ * (`lib/claude.ts:567`) are two renderings of one fact, and the creation test on
848
+ * #440 part A found them disagreeing on a real run: the row reported could-not-run
849
+ * and the block, gated only on `teamSlug` being non-empty, said the identity had
850
+ * been written. Both now branch on the one `isolated` boolean that function
851
+ * returns, so no state produces one claim from the row and the opposite from the
852
+ * file.
853
+ *
854
+ * COULD-NOT-RUN IS ITS OWN OUTCOME, for the reason rows 7, 8, 9 and 10 state
855
+ * about theirs (mx-agent-system/standards/fail-loud-standard.md). With
856
+ * `extensions.worktreeConfig` off, git refuses `--worktree` outright, so nothing
857
+ * was written AND nothing could be read: that is not a check that ran and found
858
+ * the wrong value, and the operator's next action is a one-time repository
859
+ * change rather than a re-provision.
860
+ *
861
+ * `required: false`, at row 8's tier and for a sharper reason than row 8's.
862
+ * Making it required changes whether `provision` exits non-zero, which is a
863
+ * separate decision with its own reach — and today `extensions.worktreeConfig`
864
+ * is off on this repository, so a required row would refuse EVERY provision
865
+ * until a change this command must not make has been made by hand. It becomes a
866
+ * candidate for `required: true` once the extension is on fleet-wide.
867
+ */
868
+ declare function gitIdentityRow(worktreePath: string | undefined, slug: string): CompletionRow;
869
+ /**
870
+ * One line per row, each `row N: asserted` or `row N: not asserted`.
871
+ *
872
+ * Sixteen rows plus one per anchor the roleguide’s table names beyond the three
873
+ * (#190). The extras print as `3a`, `3b`, ... under their own heading, after row
874
+ * 5 and before row 6, so an operator sees exactly which names were created at
875
+ * the moment they were created. Every accepted anchor is printed by name and
876
+ * none is filtered: a denylist of "confusing" names would be unbounded, and a
877
+ * near-miss name is inert because `parseLeaderState` and `mx-agent window`
878
+ * resolve by exact name (security pre-ruling S4).
879
+ *
880
+ * With no extras the header and the rows are what they were before #190, byte
881
+ * for byte, which is what criterion 1 asserts.
882
+ */
883
+ declare function printCompletionRows(rows: CompletionRow[]): void;
884
+ /**
885
+ * A step between the first durable write and the completion check that did not
886
+ * finish (#316 change C).
887
+ *
888
+ * Those steps used to call `process.exit(1)` (`create.ts:3605`, `:3643` at
889
+ * `7d336e0`) or throw whatever the boundary threw. Either way the run ended with
890
+ * a bare message, no completion check ran, and the operator was left with a
891
+ * worktree and no statement of what was in it — the state #5 records. A typed
892
+ * throw carries the step name to one handler in `runCreate`, which prints the
893
+ * row table and the resume instruction, the shape `CompletionCheckError`
894
+ * already uses.
895
+ */
896
+ export declare class ProvisioningStepError extends Error {
897
+ readonly step: string;
898
+ readonly code = "provisioning-step-failed";
899
+ constructor(step: string, message: string);
900
+ }
901
+ /**
902
+ * Refusal from the RESUME identity check (#316 change A, red-team Critical 3).
903
+ *
904
+ * Its own class for the reason `RoleguideIdentityError` is one: the remedy
905
+ * differs. This one means the worktree at the path this run computed was
906
+ * provisioned for another team or from another roleguide, and the fix is a
907
+ * different `--name`, never an override.
908
+ */
909
+ export declare class ResumeIdentityError extends Error {
910
+ readonly code = "resume-identity-refused";
911
+ constructor(message: string);
912
+ }
913
+ /** What a worktree says about itself, gathered read-only. */
914
+ export interface WorktreeIdentity {
915
+ /** `team` from `.mx-code-context.json`, or null when the file is absent or holds none. */
916
+ team: string | null;
917
+ /** `product` from the same file. */
918
+ product: string | null;
919
+ /** The roleguide `CLAUDE.local.md` points at, as the run that wrote it named it. */
920
+ roleguide: string | null;
921
+ }
922
+ /** Read both identity artifacts out of an existing worktree. Never throws. */
923
+ export declare function readWorktreeIdentity(worktreePath: string): WorktreeIdentity;
924
+ export type ResumeIdentityVerdict =
925
+ /** An artifact answered and it names this run's team and roleguide. */
926
+ {
927
+ kind: 'match';
928
+ evidence: string;
929
+ }
930
+ /** Nothing in the worktree names a team yet — the state #5's failure leaves. */
931
+ | {
932
+ kind: 'unestablished';
933
+ evidence: string;
934
+ }
935
+ /** An artifact names something else. Both names are carried so the refusal can print them. */
936
+ | {
937
+ kind: 'mismatch';
938
+ field: 'team' | 'product' | 'roleguide';
939
+ worktreeTeam: string;
940
+ runTeam: string;
941
+ worktreeValue: string;
942
+ runValue: string;
943
+ };
944
+ /**
945
+ * Does the worktree at this path belong to the team this run is provisioning?
946
+ *
947
+ * PURE, and it never guesses. Three verdicts rather than two: a worktree that
948
+ * declares nothing is not a worktree that declares this team. The caller resumes
949
+ * on `unestablished` and says so in its output, because the only worktree that
950
+ * reaches this path with no identity is one interrupted before step 6 wrote a
951
+ * file, and its directory name is already built from this run's slug.
952
+ *
953
+ * The roleguide comparison is by BASENAME. Both strings are whatever the
954
+ * operator typed on the two runs (`--roleguide ./x.md` and `--roleguide x.md`
955
+ * name one file), and a project keeps its roleguides in one configured
956
+ * directory, so the filename is the identity and the spelling is not.
957
+ */
958
+ export declare function checkResumeIdentity(i: {
959
+ worktree: WorktreeIdentity;
960
+ runTeam: string;
961
+ runProduct: string;
962
+ /** This run's roleguide, as the operator named it. Null when none was given. */
963
+ runRoleguide: string | null;
964
+ }): ResumeIdentityVerdict;
965
+ export declare function provisionLockPath(worktreePath: string): string;
966
+ export type ProvisionLockClaim = {
967
+ ok: true;
968
+ path: string;
969
+ release: () => void;
970
+ } | {
971
+ ok: false;
972
+ path: string;
973
+ detail: string;
974
+ };
975
+ /**
976
+ * Take the lock, or report who holds it. Never throws.
977
+ *
978
+ * A lock whose owner is gone, or that cannot be parsed and is older than
979
+ * {@link PROVISION_LOCK_STALE_MS}, is cleared loudly and the create is retried
980
+ * once — a permanent refusal after a SIGKILL would be exactly the repair this
981
+ * change exists to remove. The retry is another exclusive create, so a racer
982
+ * that got there first still wins.
983
+ */
984
+ export declare function claimProvisionLock(worktreePath: string, slug: string): ProvisionLockClaim;
985
+ /**
986
+ * The five points a deliberately interrupted run is cut at, plus the two
987
+ * credential-cache variants.
988
+ *
989
+ * The qa-tester measures what fraction of interrupted runs a second `provision`
990
+ * brings to a full row table, and that needs the interruption to be
991
+ * reproducible from the command line rather than from a patched build.
992
+ */
993
+ declare const FAULT_STEPS: readonly ["worktree", "claude-config", "memories", "catalog", "credential-cache-write", "credential-cache-write-once"];
994
+ export type FaultStep = (typeof FAULT_STEPS)[number];
995
+ /** The variable that names the injection point. Honoured in test builds only. */
996
+ export declare const FAULT_ENV = "MX_PROVISION_FAIL_AFTER";
997
+ /**
998
+ * The second switch, required as well as the test-build gate (red-team round 2,
999
+ * finding 5).
1000
+ *
1001
+ * `NODE_ENV=test` is set by tooling that has nothing to do with this command, so
1002
+ * one variable naming a step could be honoured in a shell nobody meant to inject
1003
+ * in. Two variables, one of which exists for no other purpose, cannot be reached
1004
+ * by accident.
1005
+ */
1006
+ export declare const FAULT_ARM_ENV = "MX_PROVISION_FAULT_INJECTION";
1007
+ /** Whether a coordination service URL names this host. Unparseable is not loopback. */
1008
+ export declare function isLoopbackServiceUrl(url: string | undefined): boolean;
1009
+ /**
1010
+ * Which step to fail after, or null.
1011
+ *
1012
+ * REFUSED OUTSIDE A TEST BUILD, and the refusal is printed rather than silent:
1013
+ * an operator who set the variable expecting an interruption has to learn that
1014
+ * the run they are watching is a normal one. Passed, failed and could-not-run
1015
+ * are three outcomes, and so are honoured, refused and unset.
1016
+ */
1017
+ export declare function faultInjectionStep(env?: NodeJS.ProcessEnv): FaultStep | null;
1018
+ /**
1019
+ * What a named memory that ALREADY EXISTS says about itself.
1020
+ *
1021
+ * `present` and `present, stale` are both this team's memory, so both assert the
1022
+ * row: a resumed creation whose memories were seeded by the interrupted run is
1023
+ * complete on rows 3 to 5, and refusing them is what made a half-created team
1024
+ * unfinishable (#5). The other three are the states the fresh-creation path
1025
+ * already reports, kept apart for the same reason it keeps them apart.
1026
+ */
1027
+ export type MemoryPresence = 'present' | 'present-stale' | 'not-this-team' | 'malformed' | 'could-not-run';
1028
+ export interface MemoryStateRow {
1029
+ name: string;
1030
+ presence: MemoryPresence;
1031
+ detail: string;
1032
+ }
1033
+ /**
1034
+ * Does a standing memory's classification meet the claim rows 3 to 5 make?
1035
+ *
1036
+ * ONE PREDICATE, because two readers ask the same question of the same five
1037
+ * states: the row builder below, and the `memoriesOk` flag that gates the
1038
+ * warning and the DoD checklist line at the end of the run. Two copies were free
1039
+ * to disagree about one name, and they did: on 2026-09-19 a re-provision printed
1040
+ * `Some team memories failed to initialise` in the run whose rows 3 to 5 had just
1041
+ * read all three memories back (#471).
1042
+ *
1043
+ * `present-stale` holds. The memory is there, this team owns it, and its shape
1044
+ * passed; only the seed fields differ from what this run would have written, and
1045
+ * the row prints its own `stale` verdict word for that. `not-this-team`,
1046
+ * `malformed` and `could-not-run` do not hold.
1047
+ */
1048
+ export declare function memoryStateHolds(presence: MemoryPresence): boolean;
1049
+ /**
1050
+ * Classify a standing memory against what THIS run would have written.
1051
+ *
1052
+ * PURE. The read is performed by the caller, because the two callers read from
1053
+ * two places: a resume reads what the create path's pre-existence probe already
1054
+ * fetched (no extra call to the backend), and `--recheck` reads by name because
1055
+ * it makes no create call at all.
1056
+ *
1057
+ * WHAT `stale` COMPARES, and what it does not. The four codeContext fields and
1058
+ * the leader-state `- Linkage:` line, which is every part of the seed that is
1059
+ * not a clock reading. Timestamps are not compared: every seed carries one and
1060
+ * every re-read would differ. The detail names the FIELD that differs and never
1061
+ * its value — a memory's content is service output, and a value quoted into a
1062
+ * completion row is untrusted text on an operator's terminal.
1063
+ */
1064
+ export declare function memoryPresenceState(i: {
1065
+ name: string;
1066
+ leaderState: boolean;
1067
+ requireProduct: boolean;
1068
+ read: {
1069
+ content: string;
1070
+ codeContext: unknown;
1071
+ } | null;
1072
+ ownership: 'this-team' | 'not-this-team' | 'unconfirmed' | undefined;
1073
+ /** What this run would have seeded, when it can build it. */
1074
+ expected: {
1075
+ codeContext: Record<string, string>;
1076
+ content: string | null;
1077
+ } | null;
1078
+ }): MemoryStateRow;
188
1079
  export declare function runCreate(options: CreateOptions): Promise<void>;
189
1080
  /**
190
1081
  * Test-only surface for the two filesystem-containment helpers.
@@ -194,9 +1085,39 @@ export declare function runCreate(options: CreateOptions): Promise<void>;
194
1085
  * inferred from a refusal message. Not part of the command API.
195
1086
  */
196
1087
  export declare const __testing: {
1088
+ catalogRemedyLines: typeof catalogRemedyLines;
197
1089
  reanchorContained: typeof reanchorContained;
198
1090
  writeContained: typeof writeContained;
199
1091
  allowedRoleguideRoots: typeof allowedRoleguideRoots;
1092
+ checkRoleguideIdentity: typeof checkRoleguideIdentity;
1093
+ checkCompletionRows: typeof checkCompletionRows;
1094
+ printCompletionRows: typeof printCompletionRows;
1095
+ isPlaceholderRoleguide: typeof isPlaceholderRoleguide;
1096
+ assessSeedShape: typeof assessSeedShape;
1097
+ generateRoleguide: typeof generateRoleguide;
1098
+ remainingPlaceholders: typeof remainingPlaceholders;
1099
+ placeholderRowDetail: typeof placeholderRowDetail;
1100
+ SKELETON_PLACEHOLDERS: ReadonlySet<string>;
1101
+ PROSE_METAVARIABLES: ReadonlySet<string>;
1102
+ unrecognizedBracketTokens: typeof unrecognizedBracketTokens;
1103
+ DRAFT_MARKER_RE: RegExp;
1104
+ DRAFT_MARKER_DETAIL: string;
1105
+ parseAnchorTable: typeof parseAnchorTable;
1106
+ validateAnchorRows: typeof validateAnchorRows;
1107
+ anchorStage: typeof anchorStage;
1108
+ anchorRowLetter: typeof anchorRowLetter;
1109
+ safeRowText: typeof safeRowText;
1110
+ MEMORY_KEY_RE: RegExp;
1111
+ TEAM_MEMORY_SUFFIXES: readonly ["leader-state", "iteration-log", "known-issues"];
1112
+ MAX_ANCHOR_ROWS: number;
1113
+ checkResumeIdentity: typeof checkResumeIdentity;
1114
+ readWorktreeIdentity: typeof readWorktreeIdentity;
1115
+ memoryPresenceState: typeof memoryPresenceState;
1116
+ claimProvisionLock: typeof claimProvisionLock;
1117
+ provisionLockPath: typeof provisionLockPath;
1118
+ faultInjectionStep: typeof faultInjectionStep;
1119
+ isLoopbackServiceUrl: typeof isLoopbackServiceUrl;
1120
+ gitIdentityRow: typeof gitIdentityRow;
200
1121
  };
201
1122
  export {};
202
1123
  //# sourceMappingURL=create.d.ts.map