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