@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
package/dist/lib/claude.d.ts
CHANGED
|
@@ -192,6 +192,15 @@ export declare function buildClaudeLocalContent(opts: ClaudeLocalOptions): Build
|
|
|
192
192
|
* logged them itself.
|
|
193
193
|
*/
|
|
194
194
|
export declare function writeClaudeLocal(opts: ClaudeLocalOptions): WriteClaudeLocalResult;
|
|
195
|
+
export declare function behavioralPointerLine(roleguideRelPath: string): string;
|
|
196
|
+
/**
|
|
197
|
+
* The roleguide path a written `CLAUDE.local.md` names, or null.
|
|
198
|
+
*
|
|
199
|
+
* Null for a file with no such line, an empty value, one over
|
|
200
|
+
* {@link POINTER_VALUE_MAX}, or one holding a backtick or a line break: the
|
|
201
|
+
* value comes off disk and reaches a comparison and a printed refusal.
|
|
202
|
+
*/
|
|
203
|
+
export declare function readBehavioralPointer(localMdContent: string): string | null;
|
|
195
204
|
/**
|
|
196
205
|
* Pull the injected behavioral block back out of a written CLAUDE.local.md.
|
|
197
206
|
* Returns null when the file carries no block at all.
|
|
@@ -258,36 +267,57 @@ export declare function syncClaudeConfig(worktreePath: string, opts?: {
|
|
|
258
267
|
baseBranch?: string;
|
|
259
268
|
configSource?: string;
|
|
260
269
|
}): void;
|
|
270
|
+
export declare function verifyAndHealHooks(worktreePath: string, opts?: {
|
|
271
|
+
baseBranch?: string;
|
|
272
|
+
configSource?: string;
|
|
273
|
+
}): void;
|
|
274
|
+
/** What healStaleHooks did. Five outcomes, because three would collapse two. */
|
|
275
|
+
export type StaleHealOutcome = 'fresh' | 'healed' | 'still-stale' | 'could-not-compare' | 'generator-failed';
|
|
276
|
+
export interface StaleHealResult {
|
|
277
|
+
outcome: StaleHealOutcome;
|
|
278
|
+
/** Hook basenames that were behind the source before the regeneration. */
|
|
279
|
+
before: string[];
|
|
280
|
+
/** Hook basenames still behind it afterwards. */
|
|
281
|
+
after: string[];
|
|
282
|
+
/**
|
|
283
|
+
* Why the comparison could not be made, or what the generator said. Never a
|
|
284
|
+
* value taken from the worktree's own settings or config: `checkHookStaleness`
|
|
285
|
+
* bounds every name it reports and reports unnamed cases by count.
|
|
286
|
+
*/
|
|
287
|
+
detail: string[];
|
|
288
|
+
baseBranch: string;
|
|
289
|
+
}
|
|
261
290
|
/**
|
|
262
|
-
*
|
|
263
|
-
*
|
|
264
|
-
* `origin/<baseBranch>` when any is missing.
|
|
291
|
+
* Regenerate `.claude/` when a REGISTERED hook is present but behind
|
|
292
|
+
* `origin/<baseBranch>` (#306).
|
|
265
293
|
*
|
|
266
|
-
* WHY
|
|
267
|
-
* hook
|
|
268
|
-
*
|
|
269
|
-
*
|
|
270
|
-
*
|
|
271
|
-
*
|
|
272
|
-
*
|
|
273
|
-
* dropped or malformed registration heals rather than silently passing.
|
|
294
|
+
* WHY THIS IS SEPARATE FROM verifyAndHealHooks. Completeness asks whether a
|
|
295
|
+
* registered hook EXISTS; `checkHookCompleteness` returns complete for a file
|
|
296
|
+
* that is present and stale, and `verifyAndHealHooks` returns early on complete.
|
|
297
|
+
* So the remedy the staleness line printed, `mx-agent verify-hooks --heal`, did
|
|
298
|
+
* nothing at all for the state it was printed about. Measured by the qa-tester
|
|
299
|
+
* at 583ebf9 (PR #309): heal reported completeness OK and exit 0, and the same
|
|
300
|
+
* STALE line printed again, twice.
|
|
274
301
|
*
|
|
275
|
-
*
|
|
276
|
-
*
|
|
277
|
-
*
|
|
278
|
-
*
|
|
279
|
-
*
|
|
302
|
+
* WHY IT IS NOT CALLED FROM verifyAndHealHooks. That function also runs on the
|
|
303
|
+
* `mx-agent start` path (`start.ts:1300`), where `syncClaudeConfig`
|
|
304
|
+
* (`claude.ts:1059`) has already regenerated `.claude/` unconditionally from
|
|
305
|
+
* the same ref. Calling it there would add a second regeneration to every
|
|
306
|
+
* session start in every worktree for a state that path has already fixed. This
|
|
307
|
+
* is invoked from the `--heal` command only, which is where the ineffective
|
|
308
|
+
* remedy was.
|
|
280
309
|
*
|
|
281
|
-
*
|
|
282
|
-
*
|
|
283
|
-
*
|
|
284
|
-
*
|
|
285
|
-
*
|
|
310
|
+
* COULD-NOT-COMPARE IS NOT HEALED. When the check cannot compare (no
|
|
311
|
+
* `origin/<baseBranch>`, no git, an unusable config value) nothing is
|
|
312
|
+
* regenerated and the outcome says so. Regenerating on an unreadable verdict
|
|
313
|
+
* would rewrite the permission layer on no evidence.
|
|
314
|
+
*
|
|
315
|
+
* Never throws.
|
|
286
316
|
*/
|
|
287
|
-
export declare function
|
|
317
|
+
export declare function healStaleHooks(worktreePath: string, opts?: {
|
|
288
318
|
baseBranch?: string;
|
|
289
319
|
configSource?: string;
|
|
290
|
-
}):
|
|
320
|
+
}): StaleHealResult;
|
|
291
321
|
/**
|
|
292
322
|
* Deploy managed hooks to a worktree from the global cache (~/.mx-agent/hooks/).
|
|
293
323
|
* Always overwrites existing hook files to ensure stale versions in older
|
package/dist/lib/claude.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude.d.ts","sourceRoot":"","sources":["../../src/lib/claude.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"claude.d.ts","sourceRoot":"","sources":["../../src/lib/claude.ts"],"names":[],"mappings":"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"}
|
package/dist/lib/claude.js
CHANGED
|
@@ -13,8 +13,23 @@ import { removeLock, updateChildPid } from './leader-lock.js';
|
|
|
13
13
|
import { startupReport, reportSuccess, reportWarning, reportDim } from './startup-report.js';
|
|
14
14
|
import { assessSettingsPosture } from './security-posture.js';
|
|
15
15
|
import { checkHookCompleteness } from './hook-completeness.js';
|
|
16
|
+
import { checkHookStaleness } from './hook-staleness.js';
|
|
17
|
+
import { launchIdentityEnv, sessionIdentity } from './runtime/identity.js';
|
|
18
|
+
import { OTEL_ENDPOINT_KEY, OTEL_PROTOCOL_KEY, OTEL_TOKEN_KEY, otelEnv, } from './otel-env.js';
|
|
19
|
+
import { getConfigValue } from './config.js';
|
|
16
20
|
import { sanitizeForMessage, checkBehavioralInjection, checkBehavioralCompleteness, checkRoleguideMarkers, extractMarkerBlock, describeBehavioralProblem, resolveBehavioralInjection, REQUIRED_BEHAVIORAL_ELEMENTS, } from './behavioral-injection.js';
|
|
17
|
-
import { DEFAULT_SESSION_MODEL } from './project-config.js';
|
|
21
|
+
import { DEFAULT_SESSION_MODEL, loadProjectConfig, resolveProjectConfig } from './project-config.js';
|
|
22
|
+
// ONE definition of the team's git address and its trailer (#440 A). The
|
|
23
|
+
// isolation block below states them to the session; `commands/create.ts` writes
|
|
24
|
+
// the matching config into the worktree. Two copies of either literal would
|
|
25
|
+
// drift the moment one was edited, and the session would then be told to sign
|
|
26
|
+
// commits as an address the config does not set.
|
|
27
|
+
// `describeTeamGitIdentityState` is the third shared definition and the one that
|
|
28
|
+
// keeps this block honest: row 15 and this block branch on the same boolean from
|
|
29
|
+
// the same function, so the file cannot claim an identity the row could not read
|
|
30
|
+
// (#440 part A).
|
|
31
|
+
import { teamGitEmail, teamCoAuthorTrailer, describeTeamGitIdentityState, } from './git-identity.js';
|
|
32
|
+
import { testProjectEnv } from './test-project.js';
|
|
18
33
|
import { resolveStandards } from './standards.js';
|
|
19
34
|
// ── Logging helpers ───────────────────────────────────────────────────
|
|
20
35
|
// These print exactly as before AND mirror a plain-text copy into the
|
|
@@ -309,6 +324,85 @@ export function extractBehavioralContent(projectRoot, teamSlug, teamsDir = 'mx-a
|
|
|
309
324
|
roleguideRelPath: r.roleguideRelPath,
|
|
310
325
|
};
|
|
311
326
|
}
|
|
327
|
+
/**
|
|
328
|
+
* The `## Git Identity` block, in the ONE wording that is true of this worktree.
|
|
329
|
+
*
|
|
330
|
+
* TWO VARIANTS, CHOSEN BY `state.isolated`, which is the same boolean completion
|
|
331
|
+
* row 15 asserts on (`commands/create.ts:3420`). Written: this worktree's own
|
|
332
|
+
* `config.worktree` supplies the team's name and email. Not written: it does
|
|
333
|
+
* not, and the block says so, names the author commits will actually carry, and
|
|
334
|
+
* keeps the trailer instruction because the trailer is then the only per-team
|
|
335
|
+
* attribution left.
|
|
336
|
+
*
|
|
337
|
+
* THE REFUSED VARIANT IS NOT SILENCE. Deleting the block would leave a session
|
|
338
|
+
* with no statement about its own attribution at all, and the trailer
|
|
339
|
+
* instruction is the half that still works when the config write refused. It
|
|
340
|
+
* would also make an absent block ambiguous between "no team" and "team, no
|
|
341
|
+
* identity", which is the distinction this whole change exists to make.
|
|
342
|
+
*
|
|
343
|
+
* IT NAMES NO REMEDY THE SESSION COULD RUN. The fix for the common refusal is
|
|
344
|
+
* `git config extensions.worktreeConfig true` on the SHARED repository, and this
|
|
345
|
+
* file is standing instructions for a team session that must not change state
|
|
346
|
+
* every other team reads. Row 15 carries that command, for the operator. The
|
|
347
|
+
* block tells the session to report the state and names the one command it must
|
|
348
|
+
* NOT reach for.
|
|
349
|
+
*
|
|
350
|
+
* EVERY INTERPOLATED VALUE IS SANITIZED. The slug arrives already sanitized from
|
|
351
|
+
* the caller. `effectiveAuthor`, `reason` and `effectiveNameOrigin` come out of
|
|
352
|
+
* a git config file this command does not own; the first two are sanitized in
|
|
353
|
+
* `describeTeamGitIdentityState` and the path is sanitized here.
|
|
354
|
+
*/
|
|
355
|
+
function gitIdentityBlock(safeTeamSlug, state) {
|
|
356
|
+
const trailerAndCaveat = `The address is under \`mx-agent.local\` and resolves to no GitHub account. The trailer stays in the
|
|
357
|
+
commit body as text and shows as an unlinked co-author. It records which worktree produced a
|
|
358
|
+
commit; it is not a GitHub identity and it proves nothing about who the session was.`;
|
|
359
|
+
if (state.isolated) {
|
|
360
|
+
return `
|
|
361
|
+
## Git Identity
|
|
362
|
+
|
|
363
|
+
This worktree commits as its own team. \`mx-agent provision\` set \`user.name\` and \`user.email\` here
|
|
364
|
+
with \`git config --worktree\`, so they apply to this worktree and to no other (#440).
|
|
365
|
+
|
|
366
|
+
- **Author:** \`${safeTeamSlug} <${teamGitEmail(safeTeamSlug)}>\`
|
|
367
|
+
- End every commit message with this trailer, so the attribution survives a squash merge onto the
|
|
368
|
+
base branch: \`${teamCoAuthorTrailer(safeTeamSlug)}\`
|
|
369
|
+
|
|
370
|
+
${trailerAndCaveat}
|
|
371
|
+
|
|
372
|
+
If \`git log -1\` in this worktree shows an author that is not the one above, say so rather than
|
|
373
|
+
working around it: the per-worktree config is missing or was overwritten.
|
|
374
|
+
`;
|
|
375
|
+
}
|
|
376
|
+
const authorBullet = state.effectiveAuthor === null
|
|
377
|
+
? '- **Author your commits will actually carry:** git would not report one.'
|
|
378
|
+
: `- **Author your commits will actually carry:** \`${state.effectiveAuthor}\`, resolved from
|
|
379
|
+
${state.effectiveNameOrigin === null
|
|
380
|
+
? 'a file git would not name'
|
|
381
|
+
: `\`${sanitizeForMessage(state.effectiveNameOrigin)}\``}, which every worktree of this repository shares.`;
|
|
382
|
+
return `
|
|
383
|
+
## Git Identity
|
|
384
|
+
|
|
385
|
+
**This worktree does NOT commit as its own team.** \`mx-agent provision\` sets \`user.name\` and
|
|
386
|
+
\`user.email\` per worktree with \`git config --worktree\`, and here it wrote neither:
|
|
387
|
+
${sanitizeForMessage(state.reason, 240)}.
|
|
388
|
+
|
|
389
|
+
${authorBullet}
|
|
390
|
+
- **Intended author, NOT in force:** \`${safeTeamSlug} <${teamGitEmail(safeTeamSlug)}>\`. Do not
|
|
391
|
+
describe a commit from this worktree as coming from this team.
|
|
392
|
+
- End every commit message with this trailer anyway. It is the only per-team attribution available
|
|
393
|
+
in this state, and it survives a squash merge onto the base branch:
|
|
394
|
+
\`${teamCoAuthorTrailer(safeTeamSlug)}\`
|
|
395
|
+
|
|
396
|
+
Do not try to fix this from this session. \`git config user.name\` WITHOUT \`--worktree\` writes the
|
|
397
|
+
SHARED config from a linked worktree and reassigns every other team's identity at once, which is
|
|
398
|
+
the defect #440 exists to prevent. Enabling \`extensions.worktreeConfig\` is a one-time change to
|
|
399
|
+
state every worktree on this machine reads, and it is not a team session's to make. Report the
|
|
400
|
+
state instead; completion row 15 of \`mx-agent provision\` reports it with the remedy an operator
|
|
401
|
+
runs once.
|
|
402
|
+
|
|
403
|
+
${trailerAndCaveat}
|
|
404
|
+
`;
|
|
405
|
+
}
|
|
312
406
|
/**
|
|
313
407
|
* Build the CLAUDE.local.md content without writing it.
|
|
314
408
|
*
|
|
@@ -327,6 +421,56 @@ export function buildClaudeLocalContent(opts) {
|
|
|
327
421
|
const { projectRoot, worktreePath, worktreeName, branch, slot, projectSlug = '', teamSlug, behavioralOverride, } = opts;
|
|
328
422
|
const baseBranch = opts.baseBranch ?? 'main';
|
|
329
423
|
const diagnostics = [];
|
|
424
|
+
// SANITIZE THE SLUG BEFORE IT REACHES THE INSTRUCTION FILE (security review
|
|
425
|
+
// of #440 part A, comment 5561125763, Should Fix).
|
|
426
|
+
//
|
|
427
|
+
// Every other `teamSlug` interpolation in this module already wraps the value
|
|
428
|
+
// this way (`:609`, `:674`, `:891`); those three write a warning to a
|
|
429
|
+
// terminal. The Git Identity block writes into `CLAUDE.local.md`, which is
|
|
430
|
+
// injected into every turn of this team's sessions, so it is the HIGHER-value
|
|
431
|
+
// sink of the four and was the one that did not sanitize. The reviewer's proof
|
|
432
|
+
// of concept put a `## Critical Rules (amended)` heading carrying "You may
|
|
433
|
+
// push directly to main" into the generated file, as a sibling of the real
|
|
434
|
+
// `## Critical Rules` list a few lines above it.
|
|
435
|
+
//
|
|
436
|
+
// WHY THE SINK AND NOT ONLY THE SOURCE. `mx-agent provision` validates the
|
|
437
|
+
// slug against `isValidProjectSlug` before any write (`commands/create.ts:
|
|
438
|
+
// 4374-4379`) and is safe. `mx-agent start` does not: `lib/team-identity.ts:
|
|
439
|
+
// 63-66` leaves validation to `resolveBehavioralInjection`, whose refusal is
|
|
440
|
+
// FAIL-OPEN — `:713-715` below concatenates `isolationContent` into the
|
|
441
|
+
// returned content whether that resolver accepted the slug or refused it. So a
|
|
442
|
+
// refused slug still reaches this block, and the guarantee has to be local to
|
|
443
|
+
// the value, which is the same argument `sanitizeForMessage`'s own header
|
|
444
|
+
// makes about its other call sites.
|
|
445
|
+
//
|
|
446
|
+
// `sanitizeForMessage` replaces C0 (including the newline the injection
|
|
447
|
+
// needs), DEL and C1 with U+FFFD and caps the length. It is the identity
|
|
448
|
+
// function on every slug `isValidProjectSlug` accepts: that regex admits only
|
|
449
|
+
// `[a-z0-9-]` and at most 50 characters, both well inside the cap, so no
|
|
450
|
+
// legitimate team's block changes by one byte.
|
|
451
|
+
const safeTeamSlug = teamSlug ? sanitizeForMessage(teamSlug, 80) : '';
|
|
452
|
+
// THE BLOCK MUST AGREE WITH COMPLETION ROW 15 (#440 part A, creation test).
|
|
453
|
+
//
|
|
454
|
+
// It was gated on `teamSlug` alone and stated, unconditionally, that
|
|
455
|
+
// `mx-agent provision` had set `user.name` and `user.email` here. On a
|
|
456
|
+
// repository with `extensions.worktreeConfig` off — which is every worktree of
|
|
457
|
+
// `/workspace/.git` today, so it is the outcome for every team provisioned
|
|
458
|
+
// now — `writeTeamGitIdentity` refuses and writes nothing, row 15 reports
|
|
459
|
+
// could-not-run, and this file said the opposite. The creation test measured
|
|
460
|
+
// both on one run: the row reported could-not-run and the block named
|
|
461
|
+
// `creation-probe <creation-probe@mx-agent.local>` while commits from that
|
|
462
|
+
// worktree carried the shared identity. `CLAUDE.local.md` is injected into
|
|
463
|
+
// every turn of the team's sessions, which makes it the highest-leverage place
|
|
464
|
+
// in the system to state something untrue.
|
|
465
|
+
//
|
|
466
|
+
// THE STATE IS READ FROM GIT, not threaded down from `writeTeamGitIdentity`.
|
|
467
|
+
// `mx-agent start` regenerates this file on every session and never calls the
|
|
468
|
+
// writer, so a threaded write outcome would be available on the provisioning
|
|
469
|
+
// path and absent on the one that runs far more often. Reading means both
|
|
470
|
+
// consumers branch on the one `isolated` boolean
|
|
471
|
+
// `describeTeamGitIdentityState` returns, so there is no state where the row
|
|
472
|
+
// reports could-not-run and the file claims an identity was written.
|
|
473
|
+
const gitIdentity = teamSlug ? describeTeamGitIdentityState(worktreePath, teamSlug) : null;
|
|
330
474
|
// Check if main workspace has a CLAUDE.local.md to merge
|
|
331
475
|
let mainLocalContent = '';
|
|
332
476
|
const mainLocalMdPath = join(projectRoot, 'CLAUDE.local.md');
|
|
@@ -359,7 +503,7 @@ You are working in an isolated worktree. Follow these rules strictly.
|
|
|
359
503
|
4. **Do not switch branches.** Stay on \`${branch || 'your current branch'}\`. Branch switching is blocked.
|
|
360
504
|
5. **Do not merge or push to main.** Create a PR instead using \`gh pr create\`.
|
|
361
505
|
6. **Push to your branch** with \`git push -u origin ${branch || '<your-branch>'}\`.
|
|
362
|
-
${projectSlug ? `
|
|
506
|
+
${gitIdentity ? gitIdentityBlock(safeTeamSlug, gitIdentity) : ''}${projectSlug ? `
|
|
363
507
|
## Memory Key Scope
|
|
364
508
|
|
|
365
509
|
This project uses a scoped prefix for all named memories to prevent collisions across projects sharing the same MemNexus account.
|
|
@@ -453,7 +597,7 @@ Today's date is ${new Date().toISOString().slice(0, 10)}.
|
|
|
453
597
|
if (behavioral.ok && behavioral.content && behavioral.roleguideRelPath) {
|
|
454
598
|
behavioralBlock =
|
|
455
599
|
`# ${behavioral.displayName} — Behavioral Checks (every-turn reinforcement)\n\n` +
|
|
456
|
-
|
|
600
|
+
`${behavioralPointerLine(behavioral.roleguideRelPath)}\n\n` +
|
|
457
601
|
`${behavioral.content}\n\n---\n\n`;
|
|
458
602
|
// Record the EXACT inserted text so the verifier can assert the delivered
|
|
459
603
|
// file contains it verbatim (#4707 SF-1).
|
|
@@ -552,6 +696,43 @@ export function writeClaudeLocal(opts) {
|
|
|
552
696
|
}
|
|
553
697
|
return { written, path: localMdPath, behavioral: built.behavioral };
|
|
554
698
|
}
|
|
699
|
+
/**
|
|
700
|
+
* The pointer line that names which roleguide a worktree was provisioned from.
|
|
701
|
+
*
|
|
702
|
+
* ONE DEFINITION, because two consumers read and write it (red-team round 2,
|
|
703
|
+
* finding 1). This module writes it into `CLAUDE.local.md`, and
|
|
704
|
+
* `commands/create.ts` reads it back as half of the resume identity check
|
|
705
|
+
* (#316). A second copy of the literal in the reader would drift the moment
|
|
706
|
+
* either sentence was edited, and the failure would be silent: the reader would
|
|
707
|
+
* answer "this worktree names no roleguide", which the resume path treats as
|
|
708
|
+
* nothing to compare and lets through.
|
|
709
|
+
*/
|
|
710
|
+
const POINTER_PREFIX = '> These checks are pinned here so they re-inject on every conversation turn. '
|
|
711
|
+
+ 'The full charter, scope, agent roster, and start-of-session checklist live in `';
|
|
712
|
+
const POINTER_SUFFIX = '` (read once at session start).';
|
|
713
|
+
/** Longest roleguide path the reader will take out of the line. */
|
|
714
|
+
const POINTER_VALUE_MAX = 240;
|
|
715
|
+
export function behavioralPointerLine(roleguideRelPath) {
|
|
716
|
+
return `${POINTER_PREFIX}${roleguideRelPath}${POINTER_SUFFIX}`;
|
|
717
|
+
}
|
|
718
|
+
/**
|
|
719
|
+
* The roleguide path a written `CLAUDE.local.md` names, or null.
|
|
720
|
+
*
|
|
721
|
+
* Null for a file with no such line, an empty value, one over
|
|
722
|
+
* {@link POINTER_VALUE_MAX}, or one holding a backtick or a line break: the
|
|
723
|
+
* value comes off disk and reaches a comparison and a printed refusal.
|
|
724
|
+
*/
|
|
725
|
+
export function readBehavioralPointer(localMdContent) {
|
|
726
|
+
const at = localMdContent.indexOf(POINTER_PREFIX);
|
|
727
|
+
if (at === -1)
|
|
728
|
+
return null;
|
|
729
|
+
const rest = localMdContent.slice(at + POINTER_PREFIX.length);
|
|
730
|
+
const end = rest.indexOf(POINTER_SUFFIX);
|
|
731
|
+
if (end <= 0 || end > POINTER_VALUE_MAX)
|
|
732
|
+
return null;
|
|
733
|
+
const value = rest.slice(0, end);
|
|
734
|
+
return /[\r\n`]/.test(value) ? null : value;
|
|
735
|
+
}
|
|
555
736
|
/**
|
|
556
737
|
* The header line `writeClaudeLocal` puts above an injected block. The written
|
|
557
738
|
* file never contains the markers themselves, so this is the only thing a
|
|
@@ -935,11 +1116,11 @@ function generatorScriptPath() {
|
|
|
935
1116
|
* (hooks block dropped) and an UNRESOLVABLE hook reference as unhealthy, so a
|
|
936
1117
|
* dropped or malformed registration heals rather than silently passing.
|
|
937
1118
|
*
|
|
938
|
-
* HEAL SOURCE. `--permission-from-git origin/<baseBranch
|
|
939
|
-
* + hooks/ from the reviewed remote snapshot
|
|
940
|
-
* gracefully to the last-known-good cache when
|
|
941
|
-
* missing guardrails.
|
|
942
|
-
*
|
|
1119
|
+
* HEAL SOURCE. `--permission-from-git origin/<baseBranch> --skip-behavioral-layer`
|
|
1120
|
+
* rewrites settings.json + hooks/ from the reviewed remote snapshot
|
|
1121
|
+
* (tamper-resistant) and degrades gracefully to the last-known-good cache when
|
|
1122
|
+
* offline — the right restore for missing guardrails. It writes NOTHING else:
|
|
1123
|
+
* see regeneratePermissionLayer for why the second flag is load-bearing (#247).
|
|
943
1124
|
*
|
|
944
1125
|
* FAILURE MODEL — fail OPEN on availability. A generator failure (or a heal that
|
|
945
1126
|
* does not restore every file) warns LOUDLY, naming every still-unhealthy guard,
|
|
@@ -947,6 +1128,37 @@ function generatorScriptPath() {
|
|
|
947
1128
|
* silent-degradation risk into an availability outage; the loud, named warning
|
|
948
1129
|
* keeps the degradation from being silent. Never throws.
|
|
949
1130
|
*/
|
|
1131
|
+
/**
|
|
1132
|
+
* The ONE write path both self-heals use: regenerate the PERMISSION LAYER
|
|
1133
|
+
* (settings.json + hooks/) from `origin/<baseBranch>`. Extracted so the
|
|
1134
|
+
* completeness heal and the staleness heal cannot drift into two different ways
|
|
1135
|
+
* of rewriting it.
|
|
1136
|
+
*
|
|
1137
|
+
* `--skip-behavioral-layer` IS THE WHOLE OF WHAT THIS FUNCTION REGENERATES.
|
|
1138
|
+
* Without it `--permission-from-git` runs `generateClaudeConfigForBoot`, whose
|
|
1139
|
+
* steps 3 to 6 write agents/, skills/, commands/ and rules/ from the WORKING
|
|
1140
|
+
* TREE, and `generateClaudeConfig` rewrites the whole tree on every call. So a
|
|
1141
|
+
* heal firing after `syncClaudeConfig` reverted the origin-sourced behavioural
|
|
1142
|
+
* layers to working-tree content, on a worktree that may be many commits behind,
|
|
1143
|
+
* while its success line named only the hooks it restored (#247, red-team
|
|
1144
|
+
* Critical 1). A heal asked for a missing hook restores that hook.
|
|
1145
|
+
*
|
|
1146
|
+
* The container-boot invocation of `generateClaudeConfigForBoot` is unchanged:
|
|
1147
|
+
* it passes no such flag, and a real container boot still refreshes behavioural
|
|
1148
|
+
* config from local edits, which is a prior red-team CRITICAL 1 fix.
|
|
1149
|
+
*/
|
|
1150
|
+
function regeneratePermissionLayer(worktreePath, baseBranch, configSource) {
|
|
1151
|
+
const r = spawnSync(process.execPath, [
|
|
1152
|
+
generatorScriptPath(),
|
|
1153
|
+
'--repo-root', worktreePath,
|
|
1154
|
+
'--dest', join(worktreePath, '.claude'),
|
|
1155
|
+
'--permission-from-git', `origin/${baseBranch}`,
|
|
1156
|
+
'--skip-behavioral-layer',
|
|
1157
|
+
'--config-source', configSource,
|
|
1158
|
+
'--quiet',
|
|
1159
|
+
], { cwd: worktreePath, encoding: 'utf-8', stdio: 'pipe' });
|
|
1160
|
+
return { status: r.status, stderr: r.stderr ? String(r.stderr).trim() : '' };
|
|
1161
|
+
}
|
|
950
1162
|
export function verifyAndHealHooks(worktreePath, opts = {}) {
|
|
951
1163
|
const baseBranch = opts.baseBranch ?? 'main';
|
|
952
1164
|
const configSource = opts.configSource ?? 'mx-agent-system/agent-config';
|
|
@@ -956,14 +1168,7 @@ export function verifyAndHealHooks(worktreePath, opts = {}) {
|
|
|
956
1168
|
const problems = describeHookProblems(before);
|
|
957
1169
|
logWarning(`Hook completeness problem${problems.length === 1 ? '' : 's'} ` +
|
|
958
1170
|
`(${problems.length}): ${problems.join(', ')} — regenerating from origin/${baseBranch}`);
|
|
959
|
-
const genResult =
|
|
960
|
-
generatorScriptPath(),
|
|
961
|
-
'--repo-root', worktreePath,
|
|
962
|
-
'--dest', join(worktreePath, '.claude'),
|
|
963
|
-
'--permission-from-git', `origin/${baseBranch}`,
|
|
964
|
-
'--config-source', configSource,
|
|
965
|
-
'--quiet',
|
|
966
|
-
], { cwd: worktreePath, encoding: 'utf-8', stdio: 'pipe' });
|
|
1171
|
+
const genResult = regeneratePermissionLayer(worktreePath, baseBranch, configSource);
|
|
967
1172
|
if (genResult.status !== 0) {
|
|
968
1173
|
logWarning(`Hook self-heal generator FAILED — session continues with UNHEALTHY guard${problems.length === 1 ? '' : 's'}: ` +
|
|
969
1174
|
`${problems.join(', ')}` +
|
|
@@ -978,9 +1183,70 @@ export function verifyAndHealHooks(worktreePath, opts = {}) {
|
|
|
978
1183
|
else {
|
|
979
1184
|
logWarning(`Hook self-heal INCOMPLETE — still unhealthy after regeneration: ${describeHookProblems(after).join(', ')}. ` +
|
|
980
1185
|
`Recover manually: node mx-agent-system/cli/scripts/generate-claude.mjs ` +
|
|
981
|
-
`--repo-root ${worktreePath} --permission-from-git origin/${baseBranch}`
|
|
1186
|
+
`--repo-root ${worktreePath} --permission-from-git origin/${baseBranch} ` +
|
|
1187
|
+
`--skip-behavioral-layer`);
|
|
982
1188
|
}
|
|
983
1189
|
}
|
|
1190
|
+
/**
|
|
1191
|
+
* Regenerate `.claude/` when a REGISTERED hook is present but behind
|
|
1192
|
+
* `origin/<baseBranch>` (#306).
|
|
1193
|
+
*
|
|
1194
|
+
* WHY THIS IS SEPARATE FROM verifyAndHealHooks. Completeness asks whether a
|
|
1195
|
+
* registered hook EXISTS; `checkHookCompleteness` returns complete for a file
|
|
1196
|
+
* that is present and stale, and `verifyAndHealHooks` returns early on complete.
|
|
1197
|
+
* So the remedy the staleness line printed, `mx-agent verify-hooks --heal`, did
|
|
1198
|
+
* nothing at all for the state it was printed about. Measured by the qa-tester
|
|
1199
|
+
* at 583ebf9 (PR #309): heal reported completeness OK and exit 0, and the same
|
|
1200
|
+
* STALE line printed again, twice.
|
|
1201
|
+
*
|
|
1202
|
+
* WHY IT IS NOT CALLED FROM verifyAndHealHooks. That function also runs on the
|
|
1203
|
+
* `mx-agent start` path (`start.ts:1300`), where `syncClaudeConfig`
|
|
1204
|
+
* (`claude.ts:1059`) has already regenerated `.claude/` unconditionally from
|
|
1205
|
+
* the same ref. Calling it there would add a second regeneration to every
|
|
1206
|
+
* session start in every worktree for a state that path has already fixed. This
|
|
1207
|
+
* is invoked from the `--heal` command only, which is where the ineffective
|
|
1208
|
+
* remedy was.
|
|
1209
|
+
*
|
|
1210
|
+
* COULD-NOT-COMPARE IS NOT HEALED. When the check cannot compare (no
|
|
1211
|
+
* `origin/<baseBranch>`, no git, an unusable config value) nothing is
|
|
1212
|
+
* regenerated and the outcome says so. Regenerating on an unreadable verdict
|
|
1213
|
+
* would rewrite the permission layer on no evidence.
|
|
1214
|
+
*
|
|
1215
|
+
* Never throws.
|
|
1216
|
+
*/
|
|
1217
|
+
export function healStaleHooks(worktreePath, opts = {}) {
|
|
1218
|
+
const baseBranch = opts.baseBranch ?? 'main';
|
|
1219
|
+
const configSource = opts.configSource ?? 'mx-agent-system/agent-config';
|
|
1220
|
+
const base = { before: [], after: [], baseBranch };
|
|
1221
|
+
const before = checkHookStaleness(worktreePath, { baseBranch, configSource });
|
|
1222
|
+
if (before.verdict === 'COULD_NOT_COMPARE') {
|
|
1223
|
+
return { ...base, outcome: 'could-not-compare', detail: before.undetermined };
|
|
1224
|
+
}
|
|
1225
|
+
if (before.verdict === 'FRESH')
|
|
1226
|
+
return { ...base, outcome: 'fresh', detail: [] };
|
|
1227
|
+
const staleNames = before.stale.map((h) => h.name);
|
|
1228
|
+
const gen = regeneratePermissionLayer(worktreePath, baseBranch, configSource);
|
|
1229
|
+
if (gen.status !== 0) {
|
|
1230
|
+
return {
|
|
1231
|
+
...base, outcome: 'generator-failed', before: staleNames,
|
|
1232
|
+
after: staleNames, detail: gen.stderr ? [gen.stderr] : [],
|
|
1233
|
+
};
|
|
1234
|
+
}
|
|
1235
|
+
// Re-run the same comparison rather than trusting the generator's exit code:
|
|
1236
|
+
// the question is whether the deployed bytes now equal the source bytes, and
|
|
1237
|
+
// only the check answers that.
|
|
1238
|
+
const after = checkHookStaleness(worktreePath, { baseBranch, configSource });
|
|
1239
|
+
if (after.verdict === 'FRESH') {
|
|
1240
|
+
return { ...base, outcome: 'healed', before: staleNames, detail: [] };
|
|
1241
|
+
}
|
|
1242
|
+
if (after.verdict === 'COULD_NOT_COMPARE') {
|
|
1243
|
+
return { ...base, outcome: 'could-not-compare', before: staleNames, detail: after.undetermined };
|
|
1244
|
+
}
|
|
1245
|
+
return {
|
|
1246
|
+
...base, outcome: 'still-stale', before: staleNames,
|
|
1247
|
+
after: after.stale.map((h) => h.name), detail: [],
|
|
1248
|
+
};
|
|
1249
|
+
}
|
|
984
1250
|
/**
|
|
985
1251
|
* Flatten a HookCompletenessResult into a labeled, human-readable problem list
|
|
986
1252
|
* for a warning line: missing-on-disk paths, expected-but-unregistered guards,
|
|
@@ -1211,6 +1477,29 @@ export async function launchClaudeSession(opts) {
|
|
|
1211
1477
|
CLAUDE_WORKTREE_SLOT: String(slot),
|
|
1212
1478
|
CLAUDE_WORKTREE_BRANCH: branch || '',
|
|
1213
1479
|
CLAUDE_TEAM_NAME: teamName,
|
|
1480
|
+
// The test project, for a test team's session and for nothing else (#259).
|
|
1481
|
+
//
|
|
1482
|
+
// EMPTY FOR EVERY REAL TEAM, so their launches are byte-identical to before.
|
|
1483
|
+
// A test team's worktree is a checkout of a repository whose config names
|
|
1484
|
+
// project `mx-agent`, so without this the session would resolve `mx-agent`,
|
|
1485
|
+
// ask for a credential its roster does not hold, and be refused. The value
|
|
1486
|
+
// selects a client-side identity only: the service reads the project off
|
|
1487
|
+
// the token, never off a client assertion.
|
|
1488
|
+
...testProjectEnv(teamName, resolveProjectConfig(loadProjectConfig(worktreePath)).projectSlug),
|
|
1489
|
+
// Runtime-neutral identity, in the shape the observability `sessions` table
|
|
1490
|
+
// is keyed on. Purely additive: the CLAUDE_* names above are what the hooks
|
|
1491
|
+
// read and are unchanged, so this adds variables and alters nothing.
|
|
1492
|
+
...launchIdentityEnv({ teamName, worktreeName, branch }),
|
|
1493
|
+
// Native telemetry, and ONLY when an operator has configured an endpoint.
|
|
1494
|
+
// Empty block otherwise, so an un-opted-in fleet is byte-identical to before.
|
|
1495
|
+
// Claude Code only: Codex does not read these, which is why this sits here
|
|
1496
|
+
// rather than beside the identity block in the shared module.
|
|
1497
|
+
...otelEnv(sessionIdentity({ teamName, worktreeName, branch }), {
|
|
1498
|
+
endpoint: getConfigValue(OTEL_ENDPOINT_KEY),
|
|
1499
|
+
token: getConfigValue(OTEL_TOKEN_KEY),
|
|
1500
|
+
protocol: getConfigValue(OTEL_PROTOCOL_KEY),
|
|
1501
|
+
env: process.env,
|
|
1502
|
+
}),
|
|
1214
1503
|
};
|
|
1215
1504
|
console.log();
|
|
1216
1505
|
console.log(chalk.bold(' Starting Claude Code...'));
|