@memnexus-ai/mx-agent-cli 0.1.296 → 0.1.298
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/agent-config/hooks/gh-pr-edit-guard.sh +21 -9
- package/dist/agent-config/settings.json +7 -1
- package/dist/commands/check.d.ts +20 -0
- package/dist/commands/check.d.ts.map +1 -0
- package/dist/commands/check.js +30 -0
- package/dist/commands/check.js.map +1 -0
- package/dist/commands/create.d.ts +36 -0
- package/dist/commands/create.d.ts.map +1 -1
- package/dist/commands/create.js +85 -8
- package/dist/commands/create.js.map +1 -1
- package/dist/commands/gh.d.ts +38 -0
- package/dist/commands/gh.d.ts.map +1 -0
- package/dist/commands/gh.js +162 -0
- package/dist/commands/gh.js.map +1 -0
- package/dist/commands/git-credential.d.ts +22 -0
- package/dist/commands/git-credential.d.ts.map +1 -0
- package/dist/commands/git-credential.js +53 -0
- package/dist/commands/git-credential.js.map +1 -0
- package/dist/commands/new.d.ts +24 -0
- package/dist/commands/new.d.ts.map +1 -1
- package/dist/commands/new.js +56 -5
- package/dist/commands/new.js.map +1 -1
- package/dist/commands/pr-set-body.d.ts +120 -35
- package/dist/commands/pr-set-body.d.ts.map +1 -1
- package/dist/commands/pr-set-body.js +343 -108
- package/dist/commands/pr-set-body.js.map +1 -1
- package/dist/commands/pr-sync.d.ts +2 -1
- package/dist/commands/pr-sync.d.ts.map +1 -1
- package/dist/commands/pr-sync.js +129 -32
- package/dist/commands/pr-sync.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +82 -2
- package/dist/index.js.map +1 -1
- package/dist/lib/check-run.d.ts +131 -0
- package/dist/lib/check-run.d.ts.map +1 -0
- package/dist/lib/check-run.js +291 -0
- package/dist/lib/check-run.js.map +1 -0
- package/dist/lib/coordination-token.d.ts +33 -1
- package/dist/lib/coordination-token.d.ts.map +1 -1
- package/dist/lib/coordination-token.js +138 -9
- package/dist/lib/coordination-token.js.map +1 -1
- package/dist/lib/gh-remote.d.ts +20 -0
- package/dist/lib/gh-remote.d.ts.map +1 -1
- package/dist/lib/gh-remote.js +26 -0
- package/dist/lib/gh-remote.js.map +1 -1
- package/dist/lib/gh-token-run.d.ts +551 -0
- package/dist/lib/gh-token-run.d.ts.map +1 -0
- package/dist/lib/gh-token-run.js +1246 -0
- package/dist/lib/gh-token-run.js.map +1 -0
- package/dist/lib/git-credential.d.ts +120 -0
- package/dist/lib/git-credential.d.ts.map +1 -0
- package/dist/lib/git-credential.js +204 -0
- package/dist/lib/git-credential.js.map +1 -0
- package/dist/lib/github-app-token.d.ts +288 -0
- package/dist/lib/github-app-token.d.ts.map +1 -0
- package/dist/lib/github-app-token.js +519 -0
- package/dist/lib/github-app-token.js.map +1 -0
- package/dist/lib/memory.d.ts.map +1 -1
- package/dist/lib/memory.js +35 -2
- package/dist/lib/memory.js.map +1 -1
- package/dist/lib/repo-guard-state-dirs.d.ts +39 -0
- package/dist/lib/repo-guard-state-dirs.d.ts.map +1 -0
- package/dist/lib/repo-guard-state-dirs.js +170 -0
- package/dist/lib/repo-guard-state-dirs.js.map +1 -0
- package/dist/standards/decision-request.md +6 -57
- package/dist/standards/po-communication-standard.md +0 -34
- package/dist/standards/report-format.md +0 -90
- package/dist/standards/writing-standard.md +0 -312
- package/package.json +3 -1
- package/dist/__tests__/agent-attribution.test.d.ts +0 -16
- package/dist/__tests__/agent-attribution.test.d.ts.map +0 -1
- package/dist/__tests__/agent-attribution.test.js +0 -250
- package/dist/__tests__/agent-attribution.test.js.map +0 -1
- package/dist/__tests__/agents-md-canonicalization.test.d.ts +0 -23
- package/dist/__tests__/agents-md-canonicalization.test.d.ts.map +0 -1
- package/dist/__tests__/agents-md-canonicalization.test.js +0 -319
- package/dist/__tests__/agents-md-canonicalization.test.js.map +0 -1
- package/dist/__tests__/behavioral-compliance.test.d.ts +0 -8
- package/dist/__tests__/behavioral-compliance.test.d.ts.map +0 -1
- package/dist/__tests__/behavioral-compliance.test.js +0 -226
- package/dist/__tests__/behavioral-compliance.test.js.map +0 -1
- package/dist/__tests__/behavioral-extraction.test.d.ts +0 -12
- package/dist/__tests__/behavioral-extraction.test.d.ts.map +0 -1
- package/dist/__tests__/behavioral-extraction.test.js +0 -330
- package/dist/__tests__/behavioral-extraction.test.js.map +0 -1
- package/dist/__tests__/behavioral-git-read.test.d.ts +0 -21
- package/dist/__tests__/behavioral-git-read.test.d.ts.map +0 -1
- package/dist/__tests__/behavioral-git-read.test.js +0 -955
- package/dist/__tests__/behavioral-git-read.test.js.map +0 -1
- package/dist/__tests__/behavioral-injection.test.d.ts +0 -13
- package/dist/__tests__/behavioral-injection.test.d.ts.map +0 -1
- package/dist/__tests__/behavioral-injection.test.js +0 -384
- package/dist/__tests__/behavioral-injection.test.js.map +0 -1
- package/dist/__tests__/binary-smoke.test.d.ts +0 -12
- package/dist/__tests__/binary-smoke.test.d.ts.map +0 -1
- package/dist/__tests__/binary-smoke.test.js +0 -88
- package/dist/__tests__/binary-smoke.test.js.map +0 -1
- package/dist/__tests__/bootstrap-behavioral-contract.test.d.ts +0 -18
- package/dist/__tests__/bootstrap-behavioral-contract.test.d.ts.map +0 -1
- package/dist/__tests__/bootstrap-behavioral-contract.test.js +0 -104
- package/dist/__tests__/bootstrap-behavioral-contract.test.js.map +0 -1
- package/dist/__tests__/bundle-config.test.d.ts +0 -18
- package/dist/__tests__/bundle-config.test.d.ts.map +0 -1
- package/dist/__tests__/bundle-config.test.js +0 -123
- package/dist/__tests__/bundle-config.test.js.map +0 -1
- package/dist/__tests__/catalog-interaction.test.d.ts +0 -25
- package/dist/__tests__/catalog-interaction.test.d.ts.map +0 -1
- package/dist/__tests__/catalog-interaction.test.js +0 -269
- package/dist/__tests__/catalog-interaction.test.js.map +0 -1
- package/dist/__tests__/catalog-named-memories.test.d.ts +0 -2
- package/dist/__tests__/catalog-named-memories.test.d.ts.map +0 -1
- package/dist/__tests__/catalog-named-memories.test.js +0 -204
- package/dist/__tests__/catalog-named-memories.test.js.map +0 -1
- package/dist/__tests__/catalog-origin-main.test.d.ts +0 -15
- package/dist/__tests__/catalog-origin-main.test.d.ts.map +0 -1
- package/dist/__tests__/catalog-origin-main.test.js +0 -305
- package/dist/__tests__/catalog-origin-main.test.js.map +0 -1
- package/dist/__tests__/catalog.test.d.ts +0 -2
- package/dist/__tests__/catalog.test.d.ts.map +0 -1
- package/dist/__tests__/catalog.test.js +0 -131
- package/dist/__tests__/catalog.test.js.map +0 -1
- package/dist/__tests__/claude-local-sanitizer.test.d.ts +0 -24
- package/dist/__tests__/claude-local-sanitizer.test.d.ts.map +0 -1
- package/dist/__tests__/claude-local-sanitizer.test.js +0 -906
- package/dist/__tests__/claude-local-sanitizer.test.js.map +0 -1
- package/dist/__tests__/claude-md-compose.test.d.ts +0 -17
- package/dist/__tests__/claude-md-compose.test.d.ts.map +0 -1
- package/dist/__tests__/claude-md-compose.test.js +0 -119
- package/dist/__tests__/claude-md-compose.test.js.map +0 -1
- package/dist/__tests__/claude-sync.test.d.ts +0 -2
- package/dist/__tests__/claude-sync.test.d.ts.map +0 -1
- package/dist/__tests__/claude-sync.test.js +0 -571
- package/dist/__tests__/claude-sync.test.js.map +0 -1
- package/dist/__tests__/cli-build-integration.test.d.ts +0 -2
- package/dist/__tests__/cli-build-integration.test.d.ts.map +0 -1
- package/dist/__tests__/cli-build-integration.test.js +0 -64
- package/dist/__tests__/cli-build-integration.test.js.map +0 -1
- package/dist/__tests__/cli-build.test.d.ts +0 -2
- package/dist/__tests__/cli-build.test.d.ts.map +0 -1
- package/dist/__tests__/cli-build.test.js +0 -640
- package/dist/__tests__/cli-build.test.js.map +0 -1
- package/dist/__tests__/codex-agent-gate.test.d.ts +0 -2
- package/dist/__tests__/codex-agent-gate.test.d.ts.map +0 -1
- package/dist/__tests__/codex-agent-gate.test.js +0 -480
- package/dist/__tests__/codex-agent-gate.test.js.map +0 -1
- package/dist/__tests__/codex-deploy-config.test.d.ts +0 -2
- package/dist/__tests__/codex-deploy-config.test.d.ts.map +0 -1
- package/dist/__tests__/codex-deploy-config.test.js +0 -1230
- package/dist/__tests__/codex-deploy-config.test.js.map +0 -1
- package/dist/__tests__/codex-trust-keys.test.d.ts +0 -2
- package/dist/__tests__/codex-trust-keys.test.d.ts.map +0 -1
- package/dist/__tests__/codex-trust-keys.test.js +0 -731
- package/dist/__tests__/codex-trust-keys.test.js.map +0 -1
- package/dist/__tests__/codex-write-race.test.d.ts +0 -2
- package/dist/__tests__/codex-write-race.test.d.ts.map +0 -1
- package/dist/__tests__/codex-write-race.test.js +0 -2253
- package/dist/__tests__/codex-write-race.test.js.map +0 -1
- package/dist/__tests__/completion-rows-discriminate.test.d.ts +0 -20
- package/dist/__tests__/completion-rows-discriminate.test.d.ts.map +0 -1
- package/dist/__tests__/completion-rows-discriminate.test.js +0 -481
- package/dist/__tests__/completion-rows-discriminate.test.js.map +0 -1
- package/dist/__tests__/config-command.test.d.ts +0 -9
- package/dist/__tests__/config-command.test.d.ts.map +0 -1
- package/dist/__tests__/config-command.test.js +0 -75
- package/dist/__tests__/config-command.test.js.map +0 -1
- package/dist/__tests__/config-fidelity-archived-symlinks.test.d.ts +0 -2
- package/dist/__tests__/config-fidelity-archived-symlinks.test.d.ts.map +0 -1
- package/dist/__tests__/config-fidelity-archived-symlinks.test.js +0 -127
- package/dist/__tests__/config-fidelity-archived-symlinks.test.js.map +0 -1
- package/dist/__tests__/config-fidelity-display.test.d.ts +0 -2
- package/dist/__tests__/config-fidelity-display.test.d.ts.map +0 -1
- package/dist/__tests__/config-fidelity-display.test.js +0 -77
- package/dist/__tests__/config-fidelity-display.test.js.map +0 -1
- package/dist/__tests__/config-fidelity-unreadable-fixture.d.ts +0 -32
- package/dist/__tests__/config-fidelity-unreadable-fixture.d.ts.map +0 -1
- package/dist/__tests__/config-fidelity-unreadable-fixture.js +0 -37
- package/dist/__tests__/config-fidelity-unreadable-fixture.js.map +0 -1
- package/dist/__tests__/config-fidelity.test.d.ts +0 -16
- package/dist/__tests__/config-fidelity.test.d.ts.map +0 -1
- package/dist/__tests__/config-fidelity.test.js +0 -2679
- package/dist/__tests__/config-fidelity.test.js.map +0 -1
- package/dist/__tests__/config-generation-gate.test.d.ts +0 -46
- package/dist/__tests__/config-generation-gate.test.d.ts.map +0 -1
- package/dist/__tests__/config-generation-gate.test.js +0 -435
- package/dist/__tests__/config-generation-gate.test.js.map +0 -1
- package/dist/__tests__/config-generation.test.d.ts +0 -7
- package/dist/__tests__/config-generation.test.d.ts.map +0 -1
- package/dist/__tests__/config-generation.test.js +0 -141
- package/dist/__tests__/config-generation.test.js.map +0 -1
- package/dist/__tests__/config-sync.test.d.ts +0 -10
- package/dist/__tests__/config-sync.test.d.ts.map +0 -1
- package/dist/__tests__/config-sync.test.js +0 -268
- package/dist/__tests__/config-sync.test.js.map +0 -1
- package/dist/__tests__/coordination-401-production-wiring.test.d.ts +0 -19
- package/dist/__tests__/coordination-401-production-wiring.test.d.ts.map +0 -1
- package/dist/__tests__/coordination-401-production-wiring.test.js +0 -286
- package/dist/__tests__/coordination-401-production-wiring.test.js.map +0 -1
- package/dist/__tests__/coordination-401-recovery.test.d.ts +0 -22
- package/dist/__tests__/coordination-401-recovery.test.d.ts.map +0 -1
- package/dist/__tests__/coordination-401-recovery.test.js +0 -601
- package/dist/__tests__/coordination-401-recovery.test.js.map +0 -1
- package/dist/__tests__/coordination-brief-pin.test.d.ts +0 -20
- package/dist/__tests__/coordination-brief-pin.test.d.ts.map +0 -1
- package/dist/__tests__/coordination-brief-pin.test.js +0 -66
- package/dist/__tests__/coordination-brief-pin.test.js.map +0 -1
- package/dist/__tests__/coordination-brief.test.d.ts +0 -9
- package/dist/__tests__/coordination-brief.test.d.ts.map +0 -1
- package/dist/__tests__/coordination-brief.test.js +0 -290
- package/dist/__tests__/coordination-brief.test.js.map +0 -1
- package/dist/__tests__/coordination-client.test.d.ts +0 -9
- package/dist/__tests__/coordination-client.test.d.ts.map +0 -1
- package/dist/__tests__/coordination-client.test.js +0 -517
- package/dist/__tests__/coordination-client.test.js.map +0 -1
- package/dist/__tests__/coordination-command.test.d.ts +0 -9
- package/dist/__tests__/coordination-command.test.d.ts.map +0 -1
- package/dist/__tests__/coordination-command.test.js +0 -1082
- package/dist/__tests__/coordination-command.test.js.map +0 -1
- package/dist/__tests__/coordination-credential-endpoint.test.d.ts +0 -24
- package/dist/__tests__/coordination-credential-endpoint.test.d.ts.map +0 -1
- package/dist/__tests__/coordination-credential-endpoint.test.js +0 -1292
- package/dist/__tests__/coordination-credential-endpoint.test.js.map +0 -1
- package/dist/__tests__/coordination-expected-team.test.d.ts +0 -19
- package/dist/__tests__/coordination-expected-team.test.d.ts.map +0 -1
- package/dist/__tests__/coordination-expected-team.test.js +0 -423
- package/dist/__tests__/coordination-expected-team.test.js.map +0 -1
- package/dist/__tests__/coordination-fallback.test.d.ts +0 -9
- package/dist/__tests__/coordination-fallback.test.d.ts.map +0 -1
- package/dist/__tests__/coordination-fallback.test.js +0 -192
- package/dist/__tests__/coordination-fallback.test.js.map +0 -1
- package/dist/__tests__/coordination-file-guards.test.d.ts +0 -29
- package/dist/__tests__/coordination-file-guards.test.d.ts.map +0 -1
- package/dist/__tests__/coordination-file-guards.test.js +0 -380
- package/dist/__tests__/coordination-file-guards.test.js.map +0 -1
- package/dist/__tests__/coordination-history.test.d.ts +0 -8
- package/dist/__tests__/coordination-history.test.d.ts.map +0 -1
- package/dist/__tests__/coordination-history.test.js +0 -447
- package/dist/__tests__/coordination-history.test.js.map +0 -1
- package/dist/__tests__/coordination-memory.test.d.ts +0 -14
- package/dist/__tests__/coordination-memory.test.d.ts.map +0 -1
- package/dist/__tests__/coordination-memory.test.js +0 -401
- package/dist/__tests__/coordination-memory.test.js.map +0 -1
- package/dist/__tests__/coordination-mode.test.d.ts +0 -13
- package/dist/__tests__/coordination-mode.test.d.ts.map +0 -1
- package/dist/__tests__/coordination-mode.test.js +0 -180
- package/dist/__tests__/coordination-mode.test.js.map +0 -1
- package/dist/__tests__/coordination-plain-shell-commands.test.d.ts +0 -22
- package/dist/__tests__/coordination-plain-shell-commands.test.d.ts.map +0 -1
- package/dist/__tests__/coordination-plain-shell-commands.test.js +0 -1875
- package/dist/__tests__/coordination-plain-shell-commands.test.js.map +0 -1
- package/dist/__tests__/coordination-provision.test.d.ts +0 -12
- package/dist/__tests__/coordination-provision.test.d.ts.map +0 -1
- package/dist/__tests__/coordination-provision.test.js +0 -103
- package/dist/__tests__/coordination-provision.test.js.map +0 -1
- package/dist/__tests__/coordination-render.test.d.ts +0 -9
- package/dist/__tests__/coordination-render.test.d.ts.map +0 -1
- package/dist/__tests__/coordination-render.test.js +0 -335
- package/dist/__tests__/coordination-render.test.js.map +0 -1
- package/dist/__tests__/coordination-setup.test.d.ts +0 -6
- package/dist/__tests__/coordination-setup.test.d.ts.map +0 -1
- package/dist/__tests__/coordination-setup.test.js +0 -448
- package/dist/__tests__/coordination-setup.test.js.map +0 -1
- package/dist/__tests__/coordination-status-plain-shell.test.d.ts +0 -19
- package/dist/__tests__/coordination-status-plain-shell.test.d.ts.map +0 -1
- package/dist/__tests__/coordination-status-plain-shell.test.js +0 -332
- package/dist/__tests__/coordination-status-plain-shell.test.js.map +0 -1
- package/dist/__tests__/coordination-status-registration.test.d.ts +0 -16
- package/dist/__tests__/coordination-status-registration.test.d.ts.map +0 -1
- package/dist/__tests__/coordination-status-registration.test.js +0 -480
- package/dist/__tests__/coordination-status-registration.test.js.map +0 -1
- package/dist/__tests__/coordination-token-multitenant.test.d.ts +0 -11
- package/dist/__tests__/coordination-token-multitenant.test.d.ts.map +0 -1
- package/dist/__tests__/coordination-token-multitenant.test.js +0 -106
- package/dist/__tests__/coordination-token-multitenant.test.js.map +0 -1
- package/dist/__tests__/coordination-token.test.d.ts +0 -11
- package/dist/__tests__/coordination-token.test.d.ts.map +0 -1
- package/dist/__tests__/coordination-token.test.js +0 -201
- package/dist/__tests__/coordination-token.test.js.map +0 -1
- package/dist/__tests__/coordination-wiring.test.d.ts +0 -11
- package/dist/__tests__/coordination-wiring.test.d.ts.map +0 -1
- package/dist/__tests__/coordination-wiring.test.js +0 -43
- package/dist/__tests__/coordination-wiring.test.js.map +0 -1
- package/dist/__tests__/creation-pr-class-check.test.d.ts +0 -17
- package/dist/__tests__/creation-pr-class-check.test.d.ts.map +0 -1
- package/dist/__tests__/creation-pr-class-check.test.js +0 -346
- package/dist/__tests__/creation-pr-class-check.test.js.map +0 -1
- package/dist/__tests__/creation-step6a-push-check.test.d.ts +0 -15
- package/dist/__tests__/creation-step6a-push-check.test.d.ts.map +0 -1
- package/dist/__tests__/creation-step6a-push-check.test.js +0 -150
- package/dist/__tests__/creation-step6a-push-check.test.js.map +0 -1
- package/dist/__tests__/decision-check.test.d.ts +0 -2
- package/dist/__tests__/decision-check.test.d.ts.map +0 -1
- package/dist/__tests__/decision-check.test.js +0 -105
- package/dist/__tests__/decision-check.test.js.map +0 -1
- package/dist/__tests__/digest-fail-closed.test.d.ts +0 -16
- package/dist/__tests__/digest-fail-closed.test.d.ts.map +0 -1
- package/dist/__tests__/digest-fail-closed.test.js +0 -248
- package/dist/__tests__/digest-fail-closed.test.js.map +0 -1
- package/dist/__tests__/digest-team-omission.test.d.ts +0 -15
- package/dist/__tests__/digest-team-omission.test.d.ts.map +0 -1
- package/dist/__tests__/digest-team-omission.test.js +0 -247
- package/dist/__tests__/digest-team-omission.test.js.map +0 -1
- package/dist/__tests__/doctor-config-fidelity.test.d.ts +0 -19
- package/dist/__tests__/doctor-config-fidelity.test.d.ts.map +0 -1
- package/dist/__tests__/doctor-config-fidelity.test.js +0 -324
- package/dist/__tests__/doctor-config-fidelity.test.js.map +0 -1
- package/dist/__tests__/doctor-framework-version.test.d.ts +0 -2
- package/dist/__tests__/doctor-framework-version.test.d.ts.map +0 -1
- package/dist/__tests__/doctor-framework-version.test.js +0 -146
- package/dist/__tests__/doctor-framework-version.test.js.map +0 -1
- package/dist/__tests__/doctor-worktree-path.test.d.ts +0 -17
- package/dist/__tests__/doctor-worktree-path.test.d.ts.map +0 -1
- package/dist/__tests__/doctor-worktree-path.test.js +0 -158
- package/dist/__tests__/doctor-worktree-path.test.js.map +0 -1
- package/dist/__tests__/doctor.test.d.ts +0 -20
- package/dist/__tests__/doctor.test.d.ts.map +0 -1
- package/dist/__tests__/doctor.test.js +0 -849
- package/dist/__tests__/doctor.test.js.map +0 -1
- package/dist/__tests__/event-shipper.test.d.ts +0 -16
- package/dist/__tests__/event-shipper.test.d.ts.map +0 -1
- package/dist/__tests__/event-shipper.test.js +0 -287
- package/dist/__tests__/event-shipper.test.js.map +0 -1
- package/dist/__tests__/fleet-data.test.d.ts +0 -2
- package/dist/__tests__/fleet-data.test.d.ts.map +0 -1
- package/dist/__tests__/fleet-data.test.js +0 -501
- package/dist/__tests__/fleet-data.test.js.map +0 -1
- package/dist/__tests__/fleet-devpod.test.d.ts +0 -12
- package/dist/__tests__/fleet-devpod.test.d.ts.map +0 -1
- package/dist/__tests__/fleet-devpod.test.js +0 -260
- package/dist/__tests__/fleet-devpod.test.js.map +0 -1
- package/dist/__tests__/fleet-tmux.test.d.ts +0 -2
- package/dist/__tests__/fleet-tmux.test.d.ts.map +0 -1
- package/dist/__tests__/fleet-tmux.test.js +0 -289
- package/dist/__tests__/fleet-tmux.test.js.map +0 -1
- package/dist/__tests__/fleet.test.d.ts +0 -16
- package/dist/__tests__/fleet.test.d.ts.map +0 -1
- package/dist/__tests__/fleet.test.js +0 -75
- package/dist/__tests__/fleet.test.js.map +0 -1
- package/dist/__tests__/generate-claude.test.d.ts +0 -18
- package/dist/__tests__/generate-claude.test.d.ts.map +0 -1
- package/dist/__tests__/generate-claude.test.js +0 -1015
- package/dist/__tests__/generate-claude.test.js.map +0 -1
- package/dist/__tests__/gh-remote.test.d.ts +0 -2
- package/dist/__tests__/gh-remote.test.d.ts.map +0 -1
- package/dist/__tests__/gh-remote.test.js +0 -136
- package/dist/__tests__/gh-remote.test.js.map +0 -1
- package/dist/__tests__/git-env.test.d.ts +0 -14
- package/dist/__tests__/git-env.test.d.ts.map +0 -1
- package/dist/__tests__/git-env.test.js +0 -131
- package/dist/__tests__/git-env.test.js.map +0 -1
- package/dist/__tests__/git-identity-isolation.test.d.ts +0 -33
- package/dist/__tests__/git-identity-isolation.test.d.ts.map +0 -1
- package/dist/__tests__/git-identity-isolation.test.js +0 -626
- package/dist/__tests__/git-identity-isolation.test.js.map +0 -1
- package/dist/__tests__/harness-extract.test.d.ts +0 -19
- package/dist/__tests__/harness-extract.test.d.ts.map +0 -1
- package/dist/__tests__/harness-extract.test.js +0 -566
- package/dist/__tests__/harness-extract.test.js.map +0 -1
- package/dist/__tests__/harness-wiring.test.d.ts +0 -16
- package/dist/__tests__/harness-wiring.test.d.ts.map +0 -1
- package/dist/__tests__/harness-wiring.test.js +0 -469
- package/dist/__tests__/harness-wiring.test.js.map +0 -1
- package/dist/__tests__/hook-completeness.test.d.ts +0 -13
- package/dist/__tests__/hook-completeness.test.d.ts.map +0 -1
- package/dist/__tests__/hook-completeness.test.js +0 -238
- package/dist/__tests__/hook-completeness.test.js.map +0 -1
- package/dist/__tests__/hook-heal.test.d.ts +0 -8
- package/dist/__tests__/hook-heal.test.d.ts.map +0 -1
- package/dist/__tests__/hook-heal.test.js +0 -156
- package/dist/__tests__/hook-heal.test.js.map +0 -1
- package/dist/__tests__/human-turn-classifier.test.d.ts +0 -17
- package/dist/__tests__/human-turn-classifier.test.d.ts.map +0 -1
- package/dist/__tests__/human-turn-classifier.test.js +0 -311
- package/dist/__tests__/human-turn-classifier.test.js.map +0 -1
- package/dist/__tests__/init-coordination-url.test.d.ts +0 -11
- package/dist/__tests__/init-coordination-url.test.d.ts.map +0 -1
- package/dist/__tests__/init-coordination-url.test.js +0 -217
- package/dist/__tests__/init-coordination-url.test.js.map +0 -1
- package/dist/__tests__/isolation-probe.test.d.ts +0 -15
- package/dist/__tests__/isolation-probe.test.d.ts.map +0 -1
- package/dist/__tests__/isolation-probe.test.js +0 -611
- package/dist/__tests__/isolation-probe.test.js.map +0 -1
- package/dist/__tests__/leader-lock.test.d.ts +0 -12
- package/dist/__tests__/leader-lock.test.d.ts.map +0 -1
- package/dist/__tests__/leader-lock.test.js +0 -293
- package/dist/__tests__/leader-lock.test.js.map +0 -1
- package/dist/__tests__/memory-archive-checks.test.d.ts +0 -22
- package/dist/__tests__/memory-archive-checks.test.d.ts.map +0 -1
- package/dist/__tests__/memory-archive-checks.test.js +0 -748
- package/dist/__tests__/memory-archive-checks.test.js.map +0 -1
- package/dist/__tests__/memory-archive-prep.test.d.ts +0 -8
- package/dist/__tests__/memory-archive-prep.test.d.ts.map +0 -1
- package/dist/__tests__/memory-archive-prep.test.js +0 -524
- package/dist/__tests__/memory-archive-prep.test.js.map +0 -1
- package/dist/__tests__/memory-autocreate.test.d.ts +0 -10
- package/dist/__tests__/memory-autocreate.test.d.ts.map +0 -1
- package/dist/__tests__/memory-autocreate.test.js +0 -709
- package/dist/__tests__/memory-autocreate.test.js.map +0 -1
- package/dist/__tests__/memory-log-result.test.d.ts +0 -13
- package/dist/__tests__/memory-log-result.test.d.ts.map +0 -1
- package/dist/__tests__/memory-log-result.test.js +0 -149
- package/dist/__tests__/memory-log-result.test.js.map +0 -1
- package/dist/__tests__/memory-named-exists.test.d.ts +0 -16
- package/dist/__tests__/memory-named-exists.test.d.ts.map +0 -1
- package/dist/__tests__/memory-named-exists.test.js +0 -288
- package/dist/__tests__/memory-named-exists.test.js.map +0 -1
- package/dist/__tests__/message-bus.test.d.ts +0 -10
- package/dist/__tests__/message-bus.test.d.ts.map +0 -1
- package/dist/__tests__/message-bus.test.js +0 -526
- package/dist/__tests__/message-bus.test.js.map +0 -1
- package/dist/__tests__/monitor.test.d.ts +0 -6
- package/dist/__tests__/monitor.test.d.ts.map +0 -1
- package/dist/__tests__/monitor.test.js +0 -458
- package/dist/__tests__/monitor.test.js.map +0 -1
- package/dist/__tests__/mx-agent-cli-pin-validation.test.d.ts +0 -2
- package/dist/__tests__/mx-agent-cli-pin-validation.test.d.ts.map +0 -1
- package/dist/__tests__/mx-agent-cli-pin-validation.test.js +0 -232
- package/dist/__tests__/mx-agent-cli-pin-validation.test.js.map +0 -1
- package/dist/__tests__/mx-agent-cli-version-pin.test.d.ts +0 -2
- package/dist/__tests__/mx-agent-cli-version-pin.test.d.ts.map +0 -1
- package/dist/__tests__/mx-agent-cli-version-pin.test.js +0 -236
- package/dist/__tests__/mx-agent-cli-version-pin.test.js.map +0 -1
- package/dist/__tests__/new-project-first-team.test.d.ts +0 -15
- package/dist/__tests__/new-project-first-team.test.d.ts.map +0 -1
- package/dist/__tests__/new-project-first-team.test.js +0 -444
- package/dist/__tests__/new-project-first-team.test.js.map +0 -1
- package/dist/__tests__/otel-env.test.d.ts +0 -2
- package/dist/__tests__/otel-env.test.d.ts.map +0 -1
- package/dist/__tests__/otel-env.test.js +0 -127
- package/dist/__tests__/otel-env.test.js.map +0 -1
- package/dist/__tests__/pager-fail-closed.test.d.ts +0 -19
- package/dist/__tests__/pager-fail-closed.test.d.ts.map +0 -1
- package/dist/__tests__/pager-fail-closed.test.js +0 -229
- package/dist/__tests__/pager-fail-closed.test.js.map +0 -1
- package/dist/__tests__/pr-set-body.test.d.ts +0 -29
- package/dist/__tests__/pr-set-body.test.d.ts.map +0 -1
- package/dist/__tests__/pr-set-body.test.js +0 -314
- package/dist/__tests__/pr-set-body.test.js.map +0 -1
- package/dist/__tests__/prior-sync-failure.test.d.ts +0 -2
- package/dist/__tests__/prior-sync-failure.test.d.ts.map +0 -1
- package/dist/__tests__/prior-sync-failure.test.js +0 -81
- package/dist/__tests__/prior-sync-failure.test.js.map +0 -1
- package/dist/__tests__/project-config.test.d.ts +0 -2
- package/dist/__tests__/project-config.test.d.ts.map +0 -1
- package/dist/__tests__/project-config.test.js +0 -458
- package/dist/__tests__/project-config.test.js.map +0 -1
- package/dist/__tests__/provision-behavioral-contract.test.d.ts +0 -13
- package/dist/__tests__/provision-behavioral-contract.test.d.ts.map +0 -1
- package/dist/__tests__/provision-behavioral-contract.test.js +0 -548
- package/dist/__tests__/provision-behavioral-contract.test.js.map +0 -1
- package/dist/__tests__/provision-catalog-precondition.test.d.ts +0 -26
- package/dist/__tests__/provision-catalog-precondition.test.d.ts.map +0 -1
- package/dist/__tests__/provision-catalog-precondition.test.js +0 -622
- package/dist/__tests__/provision-catalog-precondition.test.js.map +0 -1
- package/dist/__tests__/provision-completion-rows.test.d.ts +0 -17
- package/dist/__tests__/provision-completion-rows.test.d.ts.map +0 -1
- package/dist/__tests__/provision-completion-rows.test.js +0 -3473
- package/dist/__tests__/provision-completion-rows.test.js.map +0 -1
- package/dist/__tests__/provision-copy-containment.test.d.ts +0 -19
- package/dist/__tests__/provision-copy-containment.test.d.ts.map +0 -1
- package/dist/__tests__/provision-copy-containment.test.js +0 -187
- package/dist/__tests__/provision-copy-containment.test.js.map +0 -1
- package/dist/__tests__/provision-identity-gate.test.d.ts +0 -20
- package/dist/__tests__/provision-identity-gate.test.d.ts.map +0 -1
- package/dist/__tests__/provision-identity-gate.test.js +0 -602
- package/dist/__tests__/provision-identity-gate.test.js.map +0 -1
- package/dist/__tests__/provision-resume.test.d.ts +0 -26
- package/dist/__tests__/provision-resume.test.d.ts.map +0 -1
- package/dist/__tests__/provision-resume.test.js +0 -1344
- package/dist/__tests__/provision-resume.test.js.map +0 -1
- package/dist/__tests__/provision-roleguide-anchors.test.d.ts +0 -27
- package/dist/__tests__/provision-roleguide-anchors.test.d.ts.map +0 -1
- package/dist/__tests__/provision-roleguide-anchors.test.js +0 -747
- package/dist/__tests__/provision-roleguide-anchors.test.js.map +0 -1
- package/dist/__tests__/provision-row12-stub-server.test.d.ts +0 -21
- package/dist/__tests__/provision-row12-stub-server.test.d.ts.map +0 -1
- package/dist/__tests__/provision-row12-stub-server.test.js +0 -264
- package/dist/__tests__/provision-row12-stub-server.test.js.map +0 -1
- package/dist/__tests__/provision-skeleton-fill.test.d.ts +0 -16
- package/dist/__tests__/provision-skeleton-fill.test.d.ts.map +0 -1
- package/dist/__tests__/provision-skeleton-fill.test.js +0 -490
- package/dist/__tests__/provision-skeleton-fill.test.js.map +0 -1
- package/dist/__tests__/provision-step8-commit.test.d.ts +0 -40
- package/dist/__tests__/provision-step8-commit.test.d.ts.map +0 -1
- package/dist/__tests__/provision-step8-commit.test.js +0 -529
- package/dist/__tests__/provision-step8-commit.test.js.map +0 -1
- package/dist/__tests__/provision-teambuilder-flow.test.d.ts +0 -22
- package/dist/__tests__/provision-teambuilder-flow.test.d.ts.map +0 -1
- package/dist/__tests__/provision-teambuilder-flow.test.js +0 -253
- package/dist/__tests__/provision-teambuilder-flow.test.js.map +0 -1
- package/dist/__tests__/provision-write-integrity.test.d.ts +0 -18
- package/dist/__tests__/provision-write-integrity.test.d.ts.map +0 -1
- package/dist/__tests__/provision-write-integrity.test.js +0 -141
- package/dist/__tests__/provision-write-integrity.test.js.map +0 -1
- package/dist/__tests__/repo-guard-wiring.test.d.ts +0 -21
- package/dist/__tests__/repo-guard-wiring.test.d.ts.map +0 -1
- package/dist/__tests__/repo-guard-wiring.test.js +0 -638
- package/dist/__tests__/repo-guard-wiring.test.js.map +0 -1
- package/dist/__tests__/report-format.test.d.ts +0 -2
- package/dist/__tests__/report-format.test.d.ts.map +0 -1
- package/dist/__tests__/report-format.test.js +0 -219
- package/dist/__tests__/report-format.test.js.map +0 -1
- package/dist/__tests__/row15-detail-sanitizer.test.d.ts +0 -20
- package/dist/__tests__/row15-detail-sanitizer.test.d.ts.map +0 -1
- package/dist/__tests__/row15-detail-sanitizer.test.js +0 -61
- package/dist/__tests__/row15-detail-sanitizer.test.js.map +0 -1
- package/dist/__tests__/rows-9-10-zero-remotes.test.d.ts +0 -32
- package/dist/__tests__/rows-9-10-zero-remotes.test.d.ts.map +0 -1
- package/dist/__tests__/rows-9-10-zero-remotes.test.js +0 -203
- package/dist/__tests__/rows-9-10-zero-remotes.test.js.map +0 -1
- package/dist/__tests__/runtime-claude-adapter.test.d.ts +0 -2
- package/dist/__tests__/runtime-claude-adapter.test.d.ts.map +0 -1
- package/dist/__tests__/runtime-claude-adapter.test.js +0 -70
- package/dist/__tests__/runtime-claude-adapter.test.js.map +0 -1
- package/dist/__tests__/runtime-codex-adapter.test.d.ts +0 -2
- package/dist/__tests__/runtime-codex-adapter.test.d.ts.map +0 -1
- package/dist/__tests__/runtime-codex-adapter.test.js +0 -558
- package/dist/__tests__/runtime-codex-adapter.test.js.map +0 -1
- package/dist/__tests__/runtime-codex-config.test.d.ts +0 -2
- package/dist/__tests__/runtime-codex-config.test.d.ts.map +0 -1
- package/dist/__tests__/runtime-codex-config.test.js +0 -1421
- package/dist/__tests__/runtime-codex-config.test.js.map +0 -1
- package/dist/__tests__/runtime-codex-gateway-pilot.test.d.ts +0 -2
- package/dist/__tests__/runtime-codex-gateway-pilot.test.d.ts.map +0 -1
- package/dist/__tests__/runtime-codex-gateway-pilot.test.js +0 -309
- package/dist/__tests__/runtime-codex-gateway-pilot.test.js.map +0 -1
- package/dist/__tests__/runtime-codex-gateway-provider.test.d.ts +0 -2
- package/dist/__tests__/runtime-codex-gateway-provider.test.d.ts.map +0 -1
- package/dist/__tests__/runtime-codex-gateway-provider.test.js +0 -163
- package/dist/__tests__/runtime-codex-gateway-provider.test.js.map +0 -1
- package/dist/__tests__/runtime-codex-guard-proof.test.d.ts +0 -2
- package/dist/__tests__/runtime-codex-guard-proof.test.d.ts.map +0 -1
- package/dist/__tests__/runtime-codex-guard-proof.test.js +0 -822
- package/dist/__tests__/runtime-codex-guard-proof.test.js.map +0 -1
- package/dist/__tests__/runtime-codex-version-pin.test.d.ts +0 -2
- package/dist/__tests__/runtime-codex-version-pin.test.d.ts.map +0 -1
- package/dist/__tests__/runtime-codex-version-pin.test.js +0 -86
- package/dist/__tests__/runtime-codex-version-pin.test.js.map +0 -1
- package/dist/__tests__/runtime-identity.test.d.ts +0 -2
- package/dist/__tests__/runtime-identity.test.d.ts.map +0 -1
- package/dist/__tests__/runtime-identity.test.js +0 -117
- package/dist/__tests__/runtime-identity.test.js.map +0 -1
- package/dist/__tests__/runtime-resolve.test.d.ts +0 -2
- package/dist/__tests__/runtime-resolve.test.d.ts.map +0 -1
- package/dist/__tests__/runtime-resolve.test.js +0 -172
- package/dist/__tests__/runtime-resolve.test.js.map +0 -1
- package/dist/__tests__/security-posture.test.d.ts +0 -8
- package/dist/__tests__/security-posture.test.d.ts.map +0 -1
- package/dist/__tests__/security-posture.test.js +0 -82
- package/dist/__tests__/security-posture.test.js.map +0 -1
- package/dist/__tests__/session-model.test.d.ts +0 -2
- package/dist/__tests__/session-model.test.d.ts.map +0 -1
- package/dist/__tests__/session-model.test.js +0 -74
- package/dist/__tests__/session-model.test.js.map +0 -1
- package/dist/__tests__/session-pause-provisioning.test.d.ts +0 -19
- package/dist/__tests__/session-pause-provisioning.test.d.ts.map +0 -1
- package/dist/__tests__/session-pause-provisioning.test.js +0 -115
- package/dist/__tests__/session-pause-provisioning.test.js.map +0 -1
- package/dist/__tests__/session-reclamation.test.d.ts +0 -15
- package/dist/__tests__/session-reclamation.test.d.ts.map +0 -1
- package/dist/__tests__/session-reclamation.test.js +0 -73
- package/dist/__tests__/session-reclamation.test.js.map +0 -1
- package/dist/__tests__/session-record-disclosure.test.d.ts +0 -24
- package/dist/__tests__/session-record-disclosure.test.d.ts.map +0 -1
- package/dist/__tests__/session-record-disclosure.test.js +0 -494
- package/dist/__tests__/session-record-disclosure.test.js.map +0 -1
- package/dist/__tests__/session-status.test.d.ts +0 -11
- package/dist/__tests__/session-status.test.d.ts.map +0 -1
- package/dist/__tests__/session-status.test.js +0 -76
- package/dist/__tests__/session-status.test.js.map +0 -1
- package/dist/__tests__/session.test.d.ts +0 -15
- package/dist/__tests__/session.test.d.ts.map +0 -1
- package/dist/__tests__/session.test.js +0 -366
- package/dist/__tests__/session.test.js.map +0 -1
- package/dist/__tests__/shim-deploy-safety.test.d.ts +0 -24
- package/dist/__tests__/shim-deploy-safety.test.d.ts.map +0 -1
- package/dist/__tests__/shim-deploy-safety.test.js +0 -174
- package/dist/__tests__/shim-deploy-safety.test.js.map +0 -1
- package/dist/__tests__/slug-validation.test.d.ts +0 -13
- package/dist/__tests__/slug-validation.test.d.ts.map +0 -1
- package/dist/__tests__/slug-validation.test.js +0 -202
- package/dist/__tests__/slug-validation.test.js.map +0 -1
- package/dist/__tests__/standards-injection.test.d.ts +0 -2
- package/dist/__tests__/standards-injection.test.d.ts.map +0 -1
- package/dist/__tests__/standards-injection.test.js +0 -179
- package/dist/__tests__/standards-injection.test.js.map +0 -1
- package/dist/__tests__/start-config-conflict.test.d.ts +0 -17
- package/dist/__tests__/start-config-conflict.test.d.ts.map +0 -1
- package/dist/__tests__/start-config-conflict.test.js +0 -101
- package/dist/__tests__/start-config-conflict.test.js.map +0 -1
- package/dist/__tests__/start-interactive-role.test.d.ts +0 -22
- package/dist/__tests__/start-interactive-role.test.d.ts.map +0 -1
- package/dist/__tests__/start-interactive-role.test.js +0 -204
- package/dist/__tests__/start-interactive-role.test.js.map +0 -1
- package/dist/__tests__/start-rebase-never-ran.test.d.ts +0 -25
- package/dist/__tests__/start-rebase-never-ran.test.d.ts.map +0 -1
- package/dist/__tests__/start-rebase-never-ran.test.js +0 -227
- package/dist/__tests__/start-rebase-never-ran.test.js.map +0 -1
- package/dist/__tests__/start-report-generation-capture.test.d.ts +0 -17
- package/dist/__tests__/start-report-generation-capture.test.d.ts.map +0 -1
- package/dist/__tests__/start-report-generation-capture.test.js +0 -127
- package/dist/__tests__/start-report-generation-capture.test.js.map +0 -1
- package/dist/__tests__/start-report-integration.test.d.ts +0 -12
- package/dist/__tests__/start-report-integration.test.d.ts.map +0 -1
- package/dist/__tests__/start-report-integration.test.js +0 -138
- package/dist/__tests__/start-report-integration.test.js.map +0 -1
- package/dist/__tests__/start-runtime-wiring.test.d.ts +0 -31
- package/dist/__tests__/start-runtime-wiring.test.d.ts.map +0 -1
- package/dist/__tests__/start-runtime-wiring.test.js +0 -735
- package/dist/__tests__/start-runtime-wiring.test.js.map +0 -1
- package/dist/__tests__/start-stash.test.d.ts +0 -2
- package/dist/__tests__/start-stash.test.d.ts.map +0 -1
- package/dist/__tests__/start-stash.test.js +0 -131
- package/dist/__tests__/start-stash.test.js.map +0 -1
- package/dist/__tests__/start-sync-hardstop.test.d.ts +0 -15
- package/dist/__tests__/start-sync-hardstop.test.d.ts.map +0 -1
- package/dist/__tests__/start-sync-hardstop.test.js +0 -280
- package/dist/__tests__/start-sync-hardstop.test.js.map +0 -1
- package/dist/__tests__/start-team-identity.test.d.ts +0 -25
- package/dist/__tests__/start-team-identity.test.d.ts.map +0 -1
- package/dist/__tests__/start-team-identity.test.js +0 -307
- package/dist/__tests__/start-team-identity.test.js.map +0 -1
- package/dist/__tests__/startup-health-render.test.d.ts +0 -11
- package/dist/__tests__/startup-health-render.test.d.ts.map +0 -1
- package/dist/__tests__/startup-health-render.test.js +0 -60
- package/dist/__tests__/startup-health-render.test.js.map +0 -1
- package/dist/__tests__/startup-policy.test.d.ts +0 -2
- package/dist/__tests__/startup-policy.test.d.ts.map +0 -1
- package/dist/__tests__/startup-policy.test.js +0 -27
- package/dist/__tests__/startup-policy.test.js.map +0 -1
- package/dist/__tests__/startup-report.test.d.ts +0 -13
- package/dist/__tests__/startup-report.test.d.ts.map +0 -1
- package/dist/__tests__/startup-report.test.js +0 -278
- package/dist/__tests__/startup-report.test.js.map +0 -1
- package/dist/__tests__/startup-shipper.test.d.ts +0 -13
- package/dist/__tests__/startup-shipper.test.d.ts.map +0 -1
- package/dist/__tests__/startup-shipper.test.js +0 -149
- package/dist/__tests__/startup-shipper.test.js.map +0 -1
- package/dist/__tests__/stream-input-controller.test.d.ts +0 -10
- package/dist/__tests__/stream-input-controller.test.d.ts.map +0 -1
- package/dist/__tests__/stream-input-controller.test.js +0 -167
- package/dist/__tests__/stream-input-controller.test.js.map +0 -1
- package/dist/__tests__/team-memory-commands.test.d.ts +0 -11
- package/dist/__tests__/team-memory-commands.test.d.ts.map +0 -1
- package/dist/__tests__/team-memory-commands.test.js +0 -240
- package/dist/__tests__/team-memory-commands.test.js.map +0 -1
- package/dist/__tests__/team-name-propagation.test.d.ts +0 -13
- package/dist/__tests__/team-name-propagation.test.d.ts.map +0 -1
- package/dist/__tests__/team-name-propagation.test.js +0 -198
- package/dist/__tests__/team-name-propagation.test.js.map +0 -1
- package/dist/__tests__/team-token-probe.test.d.ts +0 -16
- package/dist/__tests__/team-token-probe.test.d.ts.map +0 -1
- package/dist/__tests__/team-token-probe.test.js +0 -295
- package/dist/__tests__/team-token-probe.test.js.map +0 -1
- package/dist/__tests__/template-budget.test.d.ts +0 -2
- package/dist/__tests__/template-budget.test.d.ts.map +0 -1
- package/dist/__tests__/template-budget.test.js +0 -119
- package/dist/__tests__/template-budget.test.js.map +0 -1
- package/dist/__tests__/template-sync.test.d.ts +0 -19
- package/dist/__tests__/template-sync.test.d.ts.map +0 -1
- package/dist/__tests__/template-sync.test.js +0 -480
- package/dist/__tests__/template-sync.test.js.map +0 -1
- package/dist/__tests__/test-project.test.d.ts +0 -18
- package/dist/__tests__/test-project.test.d.ts.map +0 -1
- package/dist/__tests__/test-project.test.js +0 -465
- package/dist/__tests__/test-project.test.js.map +0 -1
- package/dist/__tests__/tracked-instruction-files.test.d.ts +0 -21
- package/dist/__tests__/tracked-instruction-files.test.d.ts.map +0 -1
- package/dist/__tests__/tracked-instruction-files.test.js +0 -489
- package/dist/__tests__/tracked-instruction-files.test.js.map +0 -1
- package/dist/__tests__/unlock.test.d.ts +0 -11
- package/dist/__tests__/unlock.test.d.ts.map +0 -1
- package/dist/__tests__/unlock.test.js +0 -100
- package/dist/__tests__/unlock.test.js.map +0 -1
- package/dist/__tests__/usage-per-call-grouping.test.d.ts +0 -25
- package/dist/__tests__/usage-per-call-grouping.test.d.ts.map +0 -1
- package/dist/__tests__/usage-per-call-grouping.test.js +0 -952
- package/dist/__tests__/usage-per-call-grouping.test.js.map +0 -1
- package/dist/__tests__/usage-pricing.test.d.ts +0 -20
- package/dist/__tests__/usage-pricing.test.d.ts.map +0 -1
- package/dist/__tests__/usage-pricing.test.js +0 -176
- package/dist/__tests__/usage-pricing.test.js.map +0 -1
- package/dist/__tests__/usage-subagent-discovery.test.d.ts +0 -17
- package/dist/__tests__/usage-subagent-discovery.test.d.ts.map +0 -1
- package/dist/__tests__/usage-subagent-discovery.test.js +0 -213
- package/dist/__tests__/usage-subagent-discovery.test.js.map +0 -1
- package/dist/__tests__/verify-hooks-check-all.test.d.ts +0 -32
- package/dist/__tests__/verify-hooks-check-all.test.d.ts.map +0 -1
- package/dist/__tests__/verify-hooks-check-all.test.js +0 -563
- package/dist/__tests__/verify-hooks-check-all.test.js.map +0 -1
- package/dist/__tests__/verify-hooks-heal-log.test.d.ts +0 -11
- package/dist/__tests__/verify-hooks-heal-log.test.d.ts.map +0 -1
- package/dist/__tests__/verify-hooks-heal-log.test.js +0 -172
- package/dist/__tests__/verify-hooks-heal-log.test.js.map +0 -1
- package/dist/__tests__/worker-cap.test.d.ts +0 -14
- package/dist/__tests__/worker-cap.test.d.ts.map +0 -1
- package/dist/__tests__/worker-cap.test.js +0 -97
- package/dist/__tests__/worker-cap.test.js.map +0 -1
- package/dist/__tests__/worktree-link-repair.test.d.ts +0 -2
- package/dist/__tests__/worktree-link-repair.test.d.ts.map +0 -1
- package/dist/__tests__/worktree-link-repair.test.js +0 -471
- package/dist/__tests__/worktree-link-repair.test.js.map +0 -1
- package/dist/__tests__/worktree-sync-fixture.test.d.ts +0 -17
- package/dist/__tests__/worktree-sync-fixture.test.d.ts.map +0 -1
- package/dist/__tests__/worktree-sync-fixture.test.js +0 -519
- package/dist/__tests__/worktree-sync-fixture.test.js.map +0 -1
- package/dist/__tests__/worktree-sync-hardening.test.d.ts +0 -13
- package/dist/__tests__/worktree-sync-hardening.test.d.ts.map +0 -1
- package/dist/__tests__/worktree-sync-hardening.test.js +0 -919
- package/dist/__tests__/worktree-sync-hardening.test.js.map +0 -1
- package/dist/__tests__/worktree-sync-shell-free.test.d.ts +0 -25
- package/dist/__tests__/worktree-sync-shell-free.test.d.ts.map +0 -1
- package/dist/__tests__/worktree-sync-shell-free.test.js +0 -185
- package/dist/__tests__/worktree-sync-shell-free.test.js.map +0 -1
- package/dist/__tests__/worktree.test.d.ts +0 -2
- package/dist/__tests__/worktree.test.d.ts.map +0 -1
- package/dist/__tests__/worktree.test.js +0 -168
- package/dist/__tests__/worktree.test.js.map +0 -1
- package/dist/lib/code-context-file.test.d.ts +0 -19
- package/dist/lib/code-context-file.test.d.ts.map +0 -1
- package/dist/lib/code-context-file.test.js +0 -202
- package/dist/lib/code-context-file.test.js.map +0 -1
- package/dist/lib/harness/console/announce.test.d.ts +0 -2
- package/dist/lib/harness/console/announce.test.d.ts.map +0 -1
- package/dist/lib/harness/console/announce.test.js +0 -104
- package/dist/lib/harness/console/announce.test.js.map +0 -1
- package/dist/lib/harness/console/by-session.test.d.ts +0 -2
- package/dist/lib/harness/console/by-session.test.d.ts.map +0 -1
- package/dist/lib/harness/console/by-session.test.js +0 -86
- package/dist/lib/harness/console/by-session.test.js.map +0 -1
- package/dist/lib/harness/console/console.test.d.ts +0 -2
- package/dist/lib/harness/console/console.test.d.ts.map +0 -1
- package/dist/lib/harness/console/console.test.js +0 -269
- package/dist/lib/harness/console/console.test.js.map +0 -1
- package/dist/lib/harness/console/decision-request.test.d.ts +0 -2
- package/dist/lib/harness/console/decision-request.test.d.ts.map +0 -1
- package/dist/lib/harness/console/decision-request.test.js +0 -75
- package/dist/lib/harness/console/decision-request.test.js.map +0 -1
- package/dist/lib/harness/console/rank.test.d.ts +0 -2
- package/dist/lib/harness/console/rank.test.d.ts.map +0 -1
- package/dist/lib/harness/console/rank.test.js +0 -124
- package/dist/lib/harness/console/rank.test.js.map +0 -1
- package/dist/lib/harness/console/render.test.d.ts +0 -2
- package/dist/lib/harness/console/render.test.d.ts.map +0 -1
- package/dist/lib/harness/console/render.test.js +0 -96
- package/dist/lib/harness/console/render.test.js.map +0 -1
- package/dist/lib/harness/console/replay-cli.test.d.ts +0 -2
- package/dist/lib/harness/console/replay-cli.test.d.ts.map +0 -1
- package/dist/lib/harness/console/replay-cli.test.js +0 -96
- package/dist/lib/harness/console/replay-cli.test.js.map +0 -1
- package/dist/lib/harness/console/replay.test.d.ts +0 -2
- package/dist/lib/harness/console/replay.test.d.ts.map +0 -1
- package/dist/lib/harness/console/replay.test.js +0 -81
- package/dist/lib/harness/console/replay.test.js.map +0 -1
- package/dist/lib/harness/console/turn-reader.test.d.ts +0 -2
- package/dist/lib/harness/console/turn-reader.test.d.ts.map +0 -1
- package/dist/lib/harness/console/turn-reader.test.js +0 -108
- package/dist/lib/harness/console/turn-reader.test.js.map +0 -1
- package/dist/lib/harness/credential.test.d.ts +0 -2
- package/dist/lib/harness/credential.test.d.ts.map +0 -1
- package/dist/lib/harness/credential.test.js +0 -74
- package/dist/lib/harness/credential.test.js.map +0 -1
- package/dist/lib/harness/evaluate.test.d.ts +0 -2
- package/dist/lib/harness/evaluate.test.d.ts.map +0 -1
- package/dist/lib/harness/evaluate.test.js +0 -621
- package/dist/lib/harness/evaluate.test.js.map +0 -1
- package/dist/lib/harness/gate.test.d.ts +0 -2
- package/dist/lib/harness/gate.test.d.ts.map +0 -1
- package/dist/lib/harness/gate.test.js +0 -111
- package/dist/lib/harness/gate.test.js.map +0 -1
- package/dist/lib/harness/self-check.test.d.ts +0 -2
- package/dist/lib/harness/self-check.test.d.ts.map +0 -1
- package/dist/lib/harness/self-check.test.js +0 -43
- package/dist/lib/harness/self-check.test.js.map +0 -1
- package/dist/lib/harness/transcript.test.d.ts +0 -2
- package/dist/lib/harness/transcript.test.d.ts.map +0 -1
- package/dist/lib/harness/transcript.test.js +0 -118
- package/dist/lib/harness/transcript.test.js.map +0 -1
- package/dist/lib/projects-registry.test.d.ts +0 -2
- package/dist/lib/projects-registry.test.d.ts.map +0 -1
- package/dist/lib/projects-registry.test.js +0 -176
- package/dist/lib/projects-registry.test.js.map +0 -1
- package/dist/lib/roster.test.d.ts +0 -15
- package/dist/lib/roster.test.d.ts.map +0 -1
- package/dist/lib/roster.test.js +0 -299
- package/dist/lib/roster.test.js.map +0 -1
- package/dist/lib/vault.test.d.ts +0 -17
- package/dist/lib/vault.test.d.ts.map +0 -1
- package/dist/lib/vault.test.js +0 -169
- package/dist/lib/vault.test.js.map +0 -1
- package/dist/lib/window-view.test.d.ts +0 -2
- package/dist/lib/window-view.test.d.ts.map +0 -1
- package/dist/lib/window-view.test.js +0 -168
- package/dist/lib/window-view.test.js.map +0 -1
- package/dist/standards/fail-loud-standard.md +0 -495
- package/dist/standards/known-issues-standard.md +0 -380
- package/dist/standards/rulings.md +0 -104
|
@@ -1,1421 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Codex config generators (#4227 Phase 1, tasks 1.5/1.10/1.11 — FR-5, FR-7, FR-9, FR-16).
|
|
3
|
-
*
|
|
4
|
-
* The hooks.json assertions are MUTATION-PINNED against the shape actually verified
|
|
5
|
-
* on codex-cli 0.145.0 (see codex-config.ts's header for the probe record). A wrong
|
|
6
|
-
* top-level key does not raise under Codex — it prints an error item and the session
|
|
7
|
-
* runs on with hooks inert — so a schema regression here would be invisible in
|
|
8
|
-
* production. These tests are the only thing standing between that and a silent
|
|
9
|
-
* loss of both containment guards.
|
|
10
|
-
*/
|
|
11
|
-
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
|
|
12
|
-
import { spawnSync } from 'child_process';
|
|
13
|
-
import { existsSync, mkdirSync, mkdtempSync, readFileSync, realpathSync, rmSync, statSync, symlinkSync, writeFileSync } from 'fs';
|
|
14
|
-
import { join, resolve } from 'path';
|
|
15
|
-
import { tmpdir } from 'os';
|
|
16
|
-
import { AGENTS_OVERRIDE_FILENAME, CODEX_AGENT_GATE_COMMAND, CODEX_APPROVAL_POLICY, CODEX_CANONICAL_FOLD_NOTICE, CODEX_CONFIG_FILENAME, CODEX_DEFAULT_MODEL, CODEX_HOOKS_FILENAME, CODEX_MARKER_DEGRADATION_NOTICE, CODEX_SANDBOX_MODE, PHASE1_PORTED_GUARDS, PROJECT_DOC_MAX_BYTES, VERIFIED_CODEX_VERSION, assertNoHooksGrant, buildAgentsOverride, buildCodexConfigToml, buildCodexHooksJson, codexAgentGateCommand, codexHookCommand, codexHookTrustKeysForDoc, codexHookTrustPreconditions, deployCodexConfig, measureInstructionChain, phase1HookEntries, resolveGitWritableRoots, resolveMemnexusMcpServer, readDeployedHooksDoc, tomlString, } from '../lib/runtime/codex-config.js';
|
|
17
|
-
import { buildClaudeLocalContent } from '../lib/claude.js';
|
|
18
|
-
let root;
|
|
19
|
-
let worktree;
|
|
20
|
-
beforeEach(() => {
|
|
21
|
-
root = mkdtempSync(join(tmpdir(), 'mx-codex-root-'));
|
|
22
|
-
worktree = mkdtempSync(join(tmpdir(), 'mx-codex-wt-'));
|
|
23
|
-
});
|
|
24
|
-
afterEach(() => {
|
|
25
|
-
rmSync(root, { recursive: true, force: true });
|
|
26
|
-
rmSync(worktree, { recursive: true, force: true });
|
|
27
|
-
});
|
|
28
|
-
describe('buildCodexConfigToml — FR-7 MCP + instruction fallback', () => {
|
|
29
|
-
it('configures the MemNexus MCP server', () => {
|
|
30
|
-
const toml = buildCodexConfigToml({ projectRoot: root });
|
|
31
|
-
expect(toml).toContain('[mcp_servers.memnexus]');
|
|
32
|
-
expect(toml).toContain('command = "mx"');
|
|
33
|
-
expect(toml).toContain('args = ["mcp", "serve"]');
|
|
34
|
-
});
|
|
35
|
-
it('reads the server definition from .mcp.json so both runtimes share one source', () => {
|
|
36
|
-
writeFileSync(join(root, '.mcp.json'), JSON.stringify({ mcpServers: { memnexus: { command: 'mx-custom', args: ['mcp', 'serve', '--flag'] } } }));
|
|
37
|
-
const toml = buildCodexConfigToml({ projectRoot: root });
|
|
38
|
-
expect(toml).toContain('command = "mx-custom"');
|
|
39
|
-
expect(toml).toContain('args = ["mcp", "serve", "--flag"]');
|
|
40
|
-
});
|
|
41
|
-
it('falls back to the known-good invocation when .mcp.json is missing or corrupt', () => {
|
|
42
|
-
expect(resolveMemnexusMcpServer(root)).toEqual({ name: 'memnexus', command: 'mx', args: ['mcp', 'serve'] });
|
|
43
|
-
writeFileSync(join(root, '.mcp.json'), 'not json {');
|
|
44
|
-
expect(resolveMemnexusMcpServer(root).command).toBe('mx');
|
|
45
|
-
writeFileSync(join(root, '.mcp.json'), JSON.stringify({ mcpServers: {} }));
|
|
46
|
-
expect(resolveMemnexusMcpServer(root).command).toBe('mx');
|
|
47
|
-
});
|
|
48
|
-
it('sets the CLAUDE.md instruction fallback bridge', () => {
|
|
49
|
-
expect(buildCodexConfigToml({ projectRoot: root })).toContain('project_doc_fallback_filenames = ["CLAUDE.md"]');
|
|
50
|
-
});
|
|
51
|
-
it('pins the Phase 1 model by default and honours an override', () => {
|
|
52
|
-
expect(buildCodexConfigToml({ projectRoot: root })).toContain(`model = "${CODEX_DEFAULT_MODEL}"`);
|
|
53
|
-
expect(buildCodexConfigToml({ projectRoot: root, model: 'gpt-5.6-terra' })).toContain('model = "gpt-5.6-terra"');
|
|
54
|
-
});
|
|
55
|
-
it('escapes TOML string metacharacters instead of emitting a broken file', () => {
|
|
56
|
-
writeFileSync(join(root, '.mcp.json'), JSON.stringify({ mcpServers: { memnexus: { command: 'mx "quoted"\\path', args: [] } } }));
|
|
57
|
-
expect(buildCodexConfigToml({ projectRoot: root })).toContain('command = "mx \\"quoted\\"\\\\path"');
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
describe('buildCodexConfigToml — declared boundary (MF3a)', () => {
|
|
61
|
-
it('declares sandbox_mode explicitly rather than inheriting the operator\'s config', () => {
|
|
62
|
-
// The previous generator declared NO sandbox mode, so the session inherited
|
|
63
|
-
// whatever ~/.codex/config.toml said — on a machine with a trusted project entry,
|
|
64
|
-
// that is no boundary at all.
|
|
65
|
-
expect(buildCodexConfigToml({ projectRoot: root })).toContain('sandbox_mode = "workspace-write"');
|
|
66
|
-
expect(CODEX_SANDBOX_MODE).toBe('workspace-write');
|
|
67
|
-
});
|
|
68
|
-
it('declares an explicit approval policy', () => {
|
|
69
|
-
expect(buildCodexConfigToml({ projectRoot: root })).toContain('approval_policy = "never"');
|
|
70
|
-
expect(CODEX_APPROVAL_POLICY).toBe('never');
|
|
71
|
-
});
|
|
72
|
-
it('declares project_doc_max_bytes, and it equals the constant FR-5 measures against', () => {
|
|
73
|
-
// Drift guard, same pattern as runtime-codex-version-pin.test.ts: the cap the
|
|
74
|
-
// generator writes and the cap measureInstructionChain enforces are ONE constant.
|
|
75
|
-
// A declared boundary nobody measures against is not checkable.
|
|
76
|
-
const toml = buildCodexConfigToml({ projectRoot: root });
|
|
77
|
-
expect(toml).toContain(`project_doc_max_bytes = ${PROJECT_DOC_MAX_BYTES}`);
|
|
78
|
-
const match = toml.match(/^project_doc_max_bytes = (\d+)$/m);
|
|
79
|
-
expect(match).not.toBeNull();
|
|
80
|
-
expect(Number(match[1])).toBe(PROJECT_DOC_MAX_BYTES);
|
|
81
|
-
expect(measureInstructionChain(worktree).cap).toBe(PROJECT_DOC_MAX_BYTES);
|
|
82
|
-
});
|
|
83
|
-
it('asserts PRESENCE, not just the absence of danger flags', () => {
|
|
84
|
-
const toml = buildCodexConfigToml({ projectRoot: root });
|
|
85
|
-
// Both properties matter and they are not the same claim.
|
|
86
|
-
expect(toml).toMatch(/^sandbox_mode = /m);
|
|
87
|
-
expect(toml).toMatch(/^approval_policy = /m);
|
|
88
|
-
expect(toml).not.toContain('danger-full-access');
|
|
89
|
-
expect(toml).not.toContain('dangerously');
|
|
90
|
-
});
|
|
91
|
-
});
|
|
92
|
-
describe('tomlString — control-character hardening (S5)', () => {
|
|
93
|
-
it('escapes newlines, carriage returns and tabs', () => {
|
|
94
|
-
expect(tomlString('a\nb')).toBe('"a\\nb"');
|
|
95
|
-
expect(tomlString('a\rb')).toBe('"a\\rb"');
|
|
96
|
-
expect(tomlString('a\tb')).toBe('"a\\tb"');
|
|
97
|
-
});
|
|
98
|
-
it('escapes other C0 controls and DEL as TOML \\u escapes', () => {
|
|
99
|
-
expect(tomlString('a\u0001b')).toBe('"a\\u0001b"');
|
|
100
|
-
expect(tomlString('a\u007fb')).toBe('"a\\u007fb"');
|
|
101
|
-
expect(tomlString('a\u0000b')).toBe('"a\\u0000b"');
|
|
102
|
-
});
|
|
103
|
-
it('still escapes quotes and backslashes', () => {
|
|
104
|
-
expect(tomlString('a"b\\c')).toBe('"a\\"b\\\\c"');
|
|
105
|
-
});
|
|
106
|
-
it('emits no raw newline for a smuggled multi-line MCP command', () => {
|
|
107
|
-
// A raw newline in a TOML basic string makes the whole document invalid, which
|
|
108
|
-
// would take sandbox_mode, approval_policy and the MCP server down with it.
|
|
109
|
-
writeFileSync(join(root, '.mcp.json'), JSON.stringify({ mcpServers: { memnexus: { command: 'mx"\nsandbox_mode = "danger-full-access', args: [] } } }));
|
|
110
|
-
const toml = buildCodexConfigToml({ projectRoot: root });
|
|
111
|
-
const commandLines = toml.split('\n').filter((l) => l.startsWith('command = '));
|
|
112
|
-
expect(commandLines).toHaveLength(1);
|
|
113
|
-
// The injected directive did not become its own line.
|
|
114
|
-
expect(toml).not.toMatch(/^sandbox_mode = "danger-full-access/m);
|
|
115
|
-
expect(toml).toContain('sandbox_mode = "workspace-write"');
|
|
116
|
-
});
|
|
117
|
-
it('leaves ordinary text untouched', () => {
|
|
118
|
-
expect(tomlString('mx')).toBe('"mx"');
|
|
119
|
-
expect(tomlString('gpt-5.5')).toBe('"gpt-5.5"');
|
|
120
|
-
});
|
|
121
|
-
});
|
|
122
|
-
describe('buildCodexHooksJson — SubagentStart eligibility gate (MF2)', () => {
|
|
123
|
-
function hooks(provenGuards) {
|
|
124
|
-
const doc = JSON.parse(buildCodexHooksJson({ worktreePath: worktree, ...(provenGuards ? { provenGuards } : {}) }));
|
|
125
|
-
return doc.hooks;
|
|
126
|
-
}
|
|
127
|
-
it('registers a SubagentStart hook — the runtime call site for the eligibility check', () => {
|
|
128
|
-
expect(hooks().SubagentStart).toHaveLength(1);
|
|
129
|
-
expect(hooks().SubagentStart[0].hooks[0].command).toContain('internal-codex-agent-gate');
|
|
130
|
-
});
|
|
131
|
-
it('uses no matcher, so the gate sees every subagent spawn', () => {
|
|
132
|
-
expect(hooks().SubagentStart[0].matcher).toBeUndefined();
|
|
133
|
-
});
|
|
134
|
-
it('passes NO proven guards by default — the pre-G-7 state refuses everything', () => {
|
|
135
|
-
expect(hooks().SubagentStart[0].hooks[0].command).not.toContain('--proven-guards');
|
|
136
|
-
});
|
|
137
|
-
it('passes the proven guards when a paired proof exists', () => {
|
|
138
|
-
const cmd = hooks(['git-mutation-guard', 'named-memory-write-guard']).SubagentStart[0].hooks[0].command;
|
|
139
|
-
expect(cmd).toContain('--proven-guards git-mutation-guard,named-memory-write-guard');
|
|
140
|
-
});
|
|
141
|
-
it('drops guard names that are not plain identifiers (no argument injection)', () => {
|
|
142
|
-
const cmd = hooks(['git-mutation-guard', 'evil; rm -rf /', '--proven-guards']).SubagentStart[0].hooks[0].command;
|
|
143
|
-
// Asserted on the whole generated string, wrapper included: the only guard name
|
|
144
|
-
// that survives is the identifier, and nothing else is appended to the invocation.
|
|
145
|
-
expect(cmd).toBe(codexAgentGateCommand(['git-mutation-guard']));
|
|
146
|
-
expect(cmd).toContain(`${CODEX_AGENT_GATE_COMMAND} --proven-guards git-mutation-guard'`);
|
|
147
|
-
expect(cmd).not.toContain('rm -rf');
|
|
148
|
-
});
|
|
149
|
-
it('mentions the gate in the generated description', () => {
|
|
150
|
-
const doc = JSON.parse(buildCodexHooksJson({ worktreePath: worktree }));
|
|
151
|
-
// #4857: the description has to name the event that actually fires, or the
|
|
152
|
-
// next reader is told the same untrue thing the last one was.
|
|
153
|
-
expect(doc.description).toMatch(/PreToolUse/);
|
|
154
|
-
// #4859: and it must not claim per-agent eligibility on a runtime that has no
|
|
155
|
-
// agent identity. It says what the gate really does — refuses every spawn.
|
|
156
|
-
expect(doc.description).toMatch(/REFUSES EVERY SPAWN/);
|
|
157
|
-
expect(doc.description).toMatch(/no agent identity/);
|
|
158
|
-
});
|
|
159
|
-
});
|
|
160
|
-
describe('buildCodexHooksJson — FR-9 / task 1.10 schema (verified codex-cli 0.145.0)', () => {
|
|
161
|
-
function parsed() {
|
|
162
|
-
return JSON.parse(buildCodexHooksJson({ worktreePath: worktree }));
|
|
163
|
-
}
|
|
164
|
-
function preToolUse() {
|
|
165
|
-
return parsed().hooks.PreToolUse;
|
|
166
|
-
}
|
|
167
|
-
/** The ported `.claude/hooks/*.sh` wrappers, as opposed to the #4857 spawn gate. */
|
|
168
|
-
function guardGroups() {
|
|
169
|
-
return preToolUse().filter((g) => g.hooks[0].command.includes('.claude/hooks/'));
|
|
170
|
-
}
|
|
171
|
-
it('has ONLY the two top-level keys Codex accepts — `description` and `hooks`', () => {
|
|
172
|
-
// Verified: any other top-level key produces "unknown field …, expected
|
|
173
|
-
// `description` or `hooks`" and the whole hooks config is dropped.
|
|
174
|
-
expect(Object.keys(parsed()).sort()).toEqual(['description', 'hooks']);
|
|
175
|
-
});
|
|
176
|
-
it('nests events INSIDE `hooks`, not at the top level', () => {
|
|
177
|
-
const doc = parsed();
|
|
178
|
-
expect(doc).not.toHaveProperty('PreToolUse');
|
|
179
|
-
expect(doc.hooks).toHaveProperty('PreToolUse');
|
|
180
|
-
});
|
|
181
|
-
it('matches on `Bash` — the tool_name Codex actually sends for its shell tool', () => {
|
|
182
|
-
// Guard groups only. Since #4857 the PreToolUse array also carries the spawn
|
|
183
|
-
// gate, which matches on the spawn tools instead — see the dedicated describe.
|
|
184
|
-
for (const group of guardGroups())
|
|
185
|
-
expect(group.matcher).toBe('Bash');
|
|
186
|
-
});
|
|
187
|
-
it('uses the PascalCase event names Codex expects for both registered events', () => {
|
|
188
|
-
const hooks = parsed().hooks;
|
|
189
|
-
expect(Object.keys(hooks).sort()).toEqual(['PreToolUse', 'SubagentStart']);
|
|
190
|
-
expect(hooks).not.toHaveProperty('pre_tool_use');
|
|
191
|
-
expect(hooks).not.toHaveProperty('subagent_start');
|
|
192
|
-
});
|
|
193
|
-
it('registers exactly the two Phase 1 containment guards, no more', () => {
|
|
194
|
-
const groups = guardGroups();
|
|
195
|
-
expect(groups).toHaveLength(2);
|
|
196
|
-
// …and the guards come FIRST, because Codex keys hook trust on
|
|
197
|
-
// `<file>:pre_tool_use:<group index>:<hook index>`. Prepending anything renumbers
|
|
198
|
-
// them and silently invalidates their trust grants (#4857).
|
|
199
|
-
expect(preToolUse().slice(0, 2)).toEqual(groups);
|
|
200
|
-
const commands = groups.map((g) => g.hooks[0].command).join('\n');
|
|
201
|
-
for (const guard of PHASE1_PORTED_GUARDS)
|
|
202
|
-
expect(commands).toContain(guard);
|
|
203
|
-
// Phase 2's category-(a) hooks must NOT appear yet — task 2.1 extends this.
|
|
204
|
-
for (const later of ['worktree-guard.sh', 'mx-guard-hook.sh', 'ci-validate-hook.sh', 'deploy-verification-reminder.sh']) {
|
|
205
|
-
expect(commands).not.toContain(later);
|
|
206
|
-
}
|
|
207
|
-
});
|
|
208
|
-
it('declares each handler as a command handler', () => {
|
|
209
|
-
const groups = parsed().hooks.PreToolUse;
|
|
210
|
-
for (const group of groups)
|
|
211
|
-
expect(group.hooks[0].type).toBe('command');
|
|
212
|
-
});
|
|
213
|
-
it('resolves the script relative to a directory, interpolating no path (S4)', () => {
|
|
214
|
-
const cmd = codexHookCommand('git-mutation-guard.sh');
|
|
215
|
-
expect(cmd).toContain('${CLAUDE_PROJECT_DIR:-');
|
|
216
|
-
expect(cmd).toContain('.claude/hooks/git-mutation-guard.sh');
|
|
217
|
-
});
|
|
218
|
-
it('never embeds a filesystem path, so an apostrophe in the checkout cannot break out (S4)', () => {
|
|
219
|
-
// The pre-fix command interpolated the worktree path into a single-quoted shell
|
|
220
|
-
// string twice; a path like /workspaces/harry's-repo closed the quote and executed
|
|
221
|
-
// the remainder as shell words. The command is now path-free.
|
|
222
|
-
const cmd = codexHookCommand('git-mutation-guard.sh');
|
|
223
|
-
expect(cmd).not.toMatch(/\/tmp|\/workspace/);
|
|
224
|
-
// Exactly one single-quoted region: opened once, closed once.
|
|
225
|
-
expect(cmd.split("'").length - 1).toBe(2);
|
|
226
|
-
});
|
|
227
|
-
it('refuses to generate a hook for a script name with shell metacharacters (S4)', () => {
|
|
228
|
-
for (const bad of ["evil'; rm -rf /; #.sh", 'a b.sh', '../../etc/passwd.sh', '$(id).sh', 'plain']) {
|
|
229
|
-
expect(() => codexHookCommand(bad)).toThrow(/unsafe script name/);
|
|
230
|
-
}
|
|
231
|
-
});
|
|
232
|
-
it('generated hook commands contain no unbalanced quoting for any Phase 1 guard', () => {
|
|
233
|
-
const doc = JSON.parse(buildCodexHooksJson({ worktreePath: "/tmp/harry's-repo" }));
|
|
234
|
-
for (const group of doc.hooks.PreToolUse) {
|
|
235
|
-
const cmd = group.hooks[0].command;
|
|
236
|
-
// Guard wrappers and the spawn gate each hold exactly one single-quoted region:
|
|
237
|
-
// opened once, closed once. Neither may carry an apostrophe from the path (S4).
|
|
238
|
-
expect(cmd.split("'").length - 1).toBe(2);
|
|
239
|
-
expect(cmd).not.toContain("harry's");
|
|
240
|
-
}
|
|
241
|
-
});
|
|
242
|
-
it('says in its own description that it is inert without hook trust', () => {
|
|
243
|
-
expect(String(parsed().description)).toMatch(/NOT ENFORCED unless Codex hook trust/);
|
|
244
|
-
});
|
|
245
|
-
it('phase1HookEntries is PreToolUse/Bash for both guards', () => {
|
|
246
|
-
expect(phase1HookEntries()).toEqual([
|
|
247
|
-
{ script: 'git-mutation-guard.sh', event: 'PreToolUse', matcher: 'Bash' },
|
|
248
|
-
{ script: 'named-memory-write-guard.sh', event: 'PreToolUse', matcher: 'Bash' },
|
|
249
|
-
]);
|
|
250
|
-
});
|
|
251
|
-
it('emits valid JSON (a parse failure under Codex is silent, so it must never ship)', () => {
|
|
252
|
-
expect(() => JSON.parse(buildCodexHooksJson({ worktreePath: worktree }))).not.toThrow();
|
|
253
|
-
});
|
|
254
|
-
});
|
|
255
|
-
/**
|
|
256
|
-
* #4227 G-7 defect: the generated hook was inert under Codex and ALLOWED.
|
|
257
|
-
*
|
|
258
|
-
* These tests EXECUTE the generated command string rather than pattern-matching it.
|
|
259
|
-
* The shipped bug — `H="$CLAUDE_PROJECT_DIR/…"; [ -f "$H" ] && exec bash "$H" || exit 0`
|
|
260
|
-
* with CLAUDE_PROJECT_DIR unset under Codex — passed every string assertion above
|
|
261
|
-
* while exiting 0 on `git reset --hard` in a live session. Only running it catches that.
|
|
262
|
-
*
|
|
263
|
-
* MUTATION CHECK: restoring the old command body makes `fails closed` exit 0 and fail.
|
|
264
|
-
*/
|
|
265
|
-
describe('codexHookCommand — resolution and fail direction (executed, not matched)', () => {
|
|
266
|
-
/** Run the generated command with a controlled env and cwd, as Codex would. */
|
|
267
|
-
const runHook = (script, opts) => {
|
|
268
|
-
const r = spawnSync('bash', ['-c', codexHookCommand(script)], {
|
|
269
|
-
cwd: opts.cwd,
|
|
270
|
-
// Deliberately NOT `...process.env`: the whole defect is a dependence on an
|
|
271
|
-
// ambient variable, so the test must control the environment completely.
|
|
272
|
-
env: { PATH: process.env.PATH ?? '/usr/bin:/bin', ...(opts.env ?? {}) },
|
|
273
|
-
encoding: 'utf-8',
|
|
274
|
-
input: '{}',
|
|
275
|
-
});
|
|
276
|
-
return { status: r.status, stderr: r.stderr ?? '' };
|
|
277
|
-
};
|
|
278
|
-
/**
|
|
279
|
-
* A worktree-shaped tree whose guard script records that it ran, then blocks.
|
|
280
|
-
*
|
|
281
|
-
* The `.git` entry is not decoration: since #4852 the upward walk accepts a
|
|
282
|
-
* `.claude/hooks/` directory only at a repository boundary, so a fixture without one
|
|
283
|
-
* is not a repository root and the walk correctly refuses to resolve there. `marker`
|
|
284
|
-
* picks which shape of boundary — a `.git` DIRECTORY is a main checkout, a `.git`
|
|
285
|
-
* FILE is a linked worktree, and linked worktrees are the normal case in this repo.
|
|
286
|
-
*/
|
|
287
|
-
const makeTree = (script, opts = {}) => {
|
|
288
|
-
const root = realpathSync(mkdtempSync(join(tmpdir(), 'codex-hook-')));
|
|
289
|
-
mkdirSync(join(root, '.claude', 'hooks'), { recursive: true });
|
|
290
|
-
writeFileSync(join(root, '.claude', 'hooks', script), `#!/bin/bash\necho "${opts.tag ?? 'GUARD-RAN'}" >&2\nexit 2\n`);
|
|
291
|
-
const marker = opts.marker ?? 'dir';
|
|
292
|
-
if (marker === 'dir')
|
|
293
|
-
mkdirSync(join(root, '.git'));
|
|
294
|
-
else if (marker === 'file')
|
|
295
|
-
writeFileSync(join(root, '.git'), `gitdir: ${root}/../.git/worktrees/x\n`);
|
|
296
|
-
mkdirSync(join(root, 'nested', 'deeper'), { recursive: true });
|
|
297
|
-
return root;
|
|
298
|
-
};
|
|
299
|
-
const GUARD = 'git-mutation-guard.sh';
|
|
300
|
-
let tree = '';
|
|
301
|
-
let empty = '';
|
|
302
|
-
beforeEach(() => {
|
|
303
|
-
tree = makeTree(GUARD);
|
|
304
|
-
empty = realpathSync(mkdtempSync(join(tmpdir(), 'codex-nohook-')));
|
|
305
|
-
});
|
|
306
|
-
afterEach(() => {
|
|
307
|
-
for (const d of [tree, empty])
|
|
308
|
-
if (d && existsSync(d))
|
|
309
|
-
rmSync(d, { recursive: true, force: true });
|
|
310
|
-
});
|
|
311
|
-
it('FAILS CLOSED with no CLAUDE_PROJECT_DIR and no resolvable guard', () => {
|
|
312
|
-
const { status, stderr } = runHook(GUARD, { cwd: empty });
|
|
313
|
-
// The bug shipped `exit 0` here. Exit 2 is Codex's block contract.
|
|
314
|
-
expect(status).toBe(2);
|
|
315
|
-
expect(stderr).toContain('BLOCKED');
|
|
316
|
-
expect(stderr).toContain('could not be resolved');
|
|
317
|
-
expect(stderr).not.toContain('GUARD-RAN');
|
|
318
|
-
});
|
|
319
|
-
it('FAILS CLOSED with CLAUDE_PROJECT_DIR set to the empty string', () => {
|
|
320
|
-
// `${VAR:-…}` must treat empty as absent; `${VAR-…}` would resolve to "/.claude/…"
|
|
321
|
-
// — the exact path the defective command produced.
|
|
322
|
-
const { status, stderr } = runHook(GUARD, { cwd: empty, env: { CLAUDE_PROJECT_DIR: '' } });
|
|
323
|
-
expect(status).toBe(2);
|
|
324
|
-
expect(stderr).toContain('BLOCKED');
|
|
325
|
-
});
|
|
326
|
-
it('FAILS CLOSED when CLAUDE_PROJECT_DIR points somewhere with no guard installed', () => {
|
|
327
|
-
const { status, stderr } = runHook(GUARD, { cwd: empty, env: { CLAUDE_PROJECT_DIR: empty } });
|
|
328
|
-
expect(status).toBe(2);
|
|
329
|
-
expect(stderr).toContain('BLOCKED');
|
|
330
|
-
});
|
|
331
|
-
it('the refusal names the guard, the search, and the remedy', () => {
|
|
332
|
-
const { stderr } = runHook(GUARD, { cwd: empty });
|
|
333
|
-
expect(stderr).toContain(GUARD);
|
|
334
|
-
expect(stderr).toContain('CLAUDE_PROJECT_DIR');
|
|
335
|
-
expect(stderr).toContain('mx-agent start');
|
|
336
|
-
// Fail-loud standard: it must say it refused, not merely that it looked.
|
|
337
|
-
expect(stderr).toMatch(/fail closed|Refusing the command/);
|
|
338
|
-
});
|
|
339
|
-
it('runs the guard when CLAUDE_PROJECT_DIR is set (the mx-agent start path)', () => {
|
|
340
|
-
const { status, stderr } = runHook(GUARD, { cwd: empty, env: { CLAUDE_PROJECT_DIR: tree } });
|
|
341
|
-
expect(stderr).toContain('GUARD-RAN');
|
|
342
|
-
expect(status).toBe(2);
|
|
343
|
-
});
|
|
344
|
-
it('runs the guard from CLAUDE_WORKTREE_PATH when CLAUDE_PROJECT_DIR is absent', () => {
|
|
345
|
-
const { stderr } = runHook(GUARD, { cwd: empty, env: { CLAUDE_WORKTREE_PATH: tree } });
|
|
346
|
-
expect(stderr).toContain('GUARD-RAN');
|
|
347
|
-
});
|
|
348
|
-
it('runs the guard with NO env at all, by walking up from the working directory', () => {
|
|
349
|
-
// This is the case that makes the hook work in a Codex session mx-agent did not
|
|
350
|
-
// launch — session 2 of the G-7 run. Without the walk it can only fail closed.
|
|
351
|
-
const { stderr } = runHook(GUARD, { cwd: join(tree, 'nested', 'deeper') });
|
|
352
|
-
expect(stderr).toContain('GUARD-RAN');
|
|
353
|
-
});
|
|
354
|
-
it('terminates at / instead of looping when nothing is found', () => {
|
|
355
|
-
const { status } = runHook(GUARD, { cwd: '/', env: { CLAUDE_PROJECT_DIR: '/' } });
|
|
356
|
-
expect(status).toBe(2);
|
|
357
|
-
});
|
|
358
|
-
it('every Phase 1 guard in the generated hooks.json fails closed, not just one', () => {
|
|
359
|
-
const doc = JSON.parse(buildCodexHooksJson({ worktreePath: worktree }));
|
|
360
|
-
// Guard wrappers only. The spawn gate in the same array is a different command
|
|
361
|
-
// with its own executed fail-closed tests (codex-agent-gate.test.ts) — it refuses
|
|
362
|
-
// too, but with the gate's wording, not the guard wrapper's.
|
|
363
|
-
for (const group of doc.hooks.PreToolUse.filter((g) => g.hooks[0].command.includes('.claude/hooks/'))) {
|
|
364
|
-
const r = spawnSync('bash', ['-c', group.hooks[0].command], {
|
|
365
|
-
cwd: empty,
|
|
366
|
-
env: { PATH: process.env.PATH ?? '/usr/bin:/bin' },
|
|
367
|
-
encoding: 'utf-8',
|
|
368
|
-
input: '{}',
|
|
369
|
-
});
|
|
370
|
-
expect(r.status).toBe(2);
|
|
371
|
-
expect(r.stderr).toContain('BLOCKED');
|
|
372
|
-
}
|
|
373
|
-
});
|
|
374
|
-
});
|
|
375
|
-
/**
|
|
376
|
-
* SF-27 (#4852): the upward walk resolved the NEAREST ancestor `.claude/hooks/`, so
|
|
377
|
-
* nested agent-worktree debris shadowed the canonical guard.
|
|
378
|
-
*
|
|
379
|
-
* Fail direction was already right for "found nothing" (exit 2). This is the other
|
|
380
|
-
* half: "found the WRONG one" executed it. The realistic payload is a STALE guard —
|
|
381
|
-
* a copy predating the bypass closures in #4811/#4812/#4814/#4829 — which runs,
|
|
382
|
-
* allows, and reports nothing.
|
|
383
|
-
*
|
|
384
|
-
* Every test EXECUTES the generated command through real bash against a fixture tree.
|
|
385
|
-
* The two guard bodies print DIFFERENT tags, so which one ran is observable rather
|
|
386
|
-
* than inferred.
|
|
387
|
-
*
|
|
388
|
-
* MUTATION CHECK: delete the `[ -e "$d/.git" ]` boundary test, or the case-glob skip
|
|
389
|
-
* for the `.claude/worktrees/` segment, from codexHookCommand and `the canonical guard
|
|
390
|
-
* runs, not the nested shadow` fails with SHADOW-RAN. Verified 2026-08-02.
|
|
391
|
-
*/
|
|
392
|
-
describe('codexHookCommand — the walk stops at a repository boundary (#4852 / SF-27)', () => {
|
|
393
|
-
const GUARD = 'git-mutation-guard.sh';
|
|
394
|
-
const trees = [];
|
|
395
|
-
/**
|
|
396
|
-
* `env` is built from scratch, so PWD is ABSENT unless a test passes it. That is not
|
|
397
|
-
* a detail: with PWD unset bash sets it from getcwd, i.e. to the physical path, and
|
|
398
|
-
* the SF-1 symlink bypass is then unreachable and untestable. Tests that care about
|
|
399
|
-
* the logical-vs-physical distinction pass PWD explicitly, exactly as a real shell
|
|
400
|
-
* would export it to the hook process.
|
|
401
|
-
*/
|
|
402
|
-
const runHook = (cwd, env = {}) => {
|
|
403
|
-
const r = spawnSync('bash', ['-c', codexHookCommand(GUARD)], {
|
|
404
|
-
cwd,
|
|
405
|
-
env: { PATH: process.env.PATH ?? '/usr/bin:/bin', ...env },
|
|
406
|
-
encoding: 'utf-8',
|
|
407
|
-
input: '{}',
|
|
408
|
-
});
|
|
409
|
-
return { status: r.status, stderr: r.stderr ?? '' };
|
|
410
|
-
};
|
|
411
|
-
/** A checkout root: `.git` marker (`dir` = main repo, `file` = linked worktree). */
|
|
412
|
-
const makeRepo = (marker, tag) => {
|
|
413
|
-
const root = realpathSync(mkdtempSync(join(tmpdir(), 'codex-sf27-')));
|
|
414
|
-
trees.push(root);
|
|
415
|
-
if (marker === 'dir')
|
|
416
|
-
mkdirSync(join(root, '.git'));
|
|
417
|
-
else if (marker === 'file')
|
|
418
|
-
writeFileSync(join(root, '.git'), 'gitdir: /elsewhere/.git/worktrees/x\n');
|
|
419
|
-
if (tag) {
|
|
420
|
-
mkdirSync(join(root, '.claude', 'hooks'), { recursive: true });
|
|
421
|
-
writeFileSync(join(root, '.claude', 'hooks', GUARD), `#!/bin/bash\necho "${tag}" >&2\nexit 2\n`);
|
|
422
|
-
}
|
|
423
|
-
return root;
|
|
424
|
-
};
|
|
425
|
-
/** Plant `.claude/worktrees/<name>/` debris — a linked worktree with its own guard. */
|
|
426
|
-
const plantDebris = (root, name, tag) => {
|
|
427
|
-
const nested = join(root, '.claude', 'worktrees', name);
|
|
428
|
-
mkdirSync(join(nested, '.claude', 'hooks'), { recursive: true });
|
|
429
|
-
writeFileSync(join(nested, '.git'), `gitdir: ${root}/.git/worktrees/${name}\n`);
|
|
430
|
-
writeFileSync(join(nested, '.claude', 'hooks', GUARD), `#!/bin/bash\necho "${tag}" >&2\nexit 2\n`);
|
|
431
|
-
mkdirSync(join(nested, 'src'), { recursive: true });
|
|
432
|
-
return nested;
|
|
433
|
-
};
|
|
434
|
-
afterEach(() => {
|
|
435
|
-
while (trees.length) {
|
|
436
|
-
const d = trees.pop();
|
|
437
|
-
if (d && existsSync(d))
|
|
438
|
-
rmSync(d, { recursive: true, force: true });
|
|
439
|
-
}
|
|
440
|
-
});
|
|
441
|
-
it('the canonical guard runs, not the nested shadow (the SF-27 defect)', () => {
|
|
442
|
-
// 16 such nested checkouts were measured in the main repo on 2026-08-01.
|
|
443
|
-
const repo = makeRepo('dir', 'CANONICAL-RAN');
|
|
444
|
-
const nested = plantDebris(repo, 'agent-X', 'SHADOW-RAN');
|
|
445
|
-
const { status, stderr } = runHook(join(nested, 'src'));
|
|
446
|
-
expect(stderr).toContain('CANONICAL-RAN');
|
|
447
|
-
expect(stderr).not.toContain('SHADOW-RAN');
|
|
448
|
-
expect(status).toBe(2);
|
|
449
|
-
});
|
|
450
|
-
it('skips the debris even when it is the only .claude/hooks in the chain — refuses', () => {
|
|
451
|
-
// Nothing canonical above it: the shadow must not become the fallback. A stale
|
|
452
|
-
// guard is not a safe substitute for no guard; refusing is.
|
|
453
|
-
const repo = makeRepo('dir', null);
|
|
454
|
-
const nested = plantDebris(repo, 'agent-Y', 'SHADOW-RAN');
|
|
455
|
-
const { status, stderr } = runHook(join(nested, 'src'));
|
|
456
|
-
expect(status).toBe(2);
|
|
457
|
-
expect(stderr).toContain('BLOCKED');
|
|
458
|
-
expect(stderr).not.toContain('SHADOW-RAN');
|
|
459
|
-
});
|
|
460
|
-
it('resolves in a legitimate linked worktree, where .git is a FILE not a directory', () => {
|
|
461
|
-
// `-d` instead of `-e` would break every linked worktree in this repo.
|
|
462
|
-
const repo = makeRepo('file', 'LINKED-RAN');
|
|
463
|
-
mkdirSync(join(repo, 'a', 'b'), { recursive: true });
|
|
464
|
-
const { stderr } = runHook(join(repo, 'a', 'b'));
|
|
465
|
-
expect(stderr).toContain('LINKED-RAN');
|
|
466
|
-
});
|
|
467
|
-
it('resolves in a main checkout, where .git is a directory', () => {
|
|
468
|
-
const repo = makeRepo('dir', 'MAIN-RAN');
|
|
469
|
-
mkdirSync(join(repo, 'a', 'b'), { recursive: true });
|
|
470
|
-
expect(runHook(join(repo, 'a', 'b')).stderr).toContain('MAIN-RAN');
|
|
471
|
-
});
|
|
472
|
-
it('refuses in a directory tree that is not a repository at all', () => {
|
|
473
|
-
// `.claude/hooks/` present but no `.git`: not a checkout root, so not a boundary.
|
|
474
|
-
const loose = makeRepo('none', 'LOOSE-RAN');
|
|
475
|
-
mkdirSync(join(loose, 'a'), { recursive: true });
|
|
476
|
-
const { status, stderr } = runHook(join(loose, 'a'));
|
|
477
|
-
expect(status).toBe(2);
|
|
478
|
-
expect(stderr).not.toContain('LOOSE-RAN');
|
|
479
|
-
});
|
|
480
|
-
it('does not escape upward past a checkout that has no guard deployed (the quiet widening)', () => {
|
|
481
|
-
// Issue (b) in #4852: an inner checkout with hooks undeployed borrowed the parent
|
|
482
|
-
// repository's guard. The boundary ends the walk at the inner root, guard or not.
|
|
483
|
-
const outer = makeRepo('dir', 'PARENT-RAN');
|
|
484
|
-
const inner = join(outer, 'sub');
|
|
485
|
-
mkdirSync(join(inner, 'work'), { recursive: true });
|
|
486
|
-
writeFileSync(join(inner, '.git'), 'gitdir: /elsewhere/.git/worktrees/sub\n');
|
|
487
|
-
const { status, stderr } = runHook(join(inner, 'work'));
|
|
488
|
-
expect(status).toBe(2);
|
|
489
|
-
expect(stderr).toContain('BLOCKED');
|
|
490
|
-
expect(stderr).not.toContain('PARENT-RAN');
|
|
491
|
-
});
|
|
492
|
-
it('starts the walk at the PHYSICAL cwd, so a symlinked PWD cannot hide the debris (SF-1)', () => {
|
|
493
|
-
// The segment skip is a lexical test on the path string. `$PWD` is inherited and
|
|
494
|
-
// holds the LOGICAL path — bash keeps it across a symlinked cwd — so a cwd reached
|
|
495
|
-
// through an alias whose logical path omits `.claude/worktrees/` passed the skip
|
|
496
|
-
// and the debris guard ran. `pwd -P` resolves via getcwd instead.
|
|
497
|
-
//
|
|
498
|
-
// MUTATION: revert `d="$(pwd -P)"` to `d="$PWD"` and this test fails with
|
|
499
|
-
// SHADOW-RAN. It is the only test in this file that pins the physical resolution.
|
|
500
|
-
const repo = makeRepo('dir', 'CANONICAL-RAN');
|
|
501
|
-
const nested = plantDebris(repo, 'agent-S', 'SHADOW-RAN');
|
|
502
|
-
const aliasRoot = realpathSync(mkdtempSync(join(tmpdir(), 'codex-alias-')));
|
|
503
|
-
trees.push(aliasRoot);
|
|
504
|
-
const alias = join(aliasRoot, 'link');
|
|
505
|
-
symlinkSync(nested, alias);
|
|
506
|
-
// The logical path holds no `.claude/worktrees/` segment; the physical one does.
|
|
507
|
-
expect(alias).not.toContain('.claude/worktrees/');
|
|
508
|
-
expect(realpathSync(alias)).toContain(join('.claude', 'worktrees'));
|
|
509
|
-
const { stderr } = runHook(alias, { PWD: alias });
|
|
510
|
-
expect(stderr).toContain('CANONICAL-RAN');
|
|
511
|
-
expect(stderr).not.toContain('SHADOW-RAN');
|
|
512
|
-
});
|
|
513
|
-
it('refuses an anchor that points into debris, rather than trusting it (SF-4)', () => {
|
|
514
|
-
// Anchor trust is otherwise intact — see the two tests below. But an anchor
|
|
515
|
-
// pointing INTO `.claude/worktrees/` is never legitimate: that tree is another
|
|
516
|
-
// checkout's business. Trusting it ran the stale shadow guard directly, with no
|
|
517
|
-
// walk involved and so no segment skip to catch it.
|
|
518
|
-
const repo = makeRepo('dir', 'CANONICAL-RAN');
|
|
519
|
-
const nested = plantDebris(repo, 'agent-A', 'SHADOW-RAN');
|
|
520
|
-
for (const key of ['CLAUDE_PROJECT_DIR', 'CLAUDE_WORKTREE_PATH']) {
|
|
521
|
-
const { status, stderr } = runHook(repo, { [key]: nested });
|
|
522
|
-
expect(stderr).not.toContain('SHADOW-RAN');
|
|
523
|
-
expect(stderr).toContain('BLOCKED');
|
|
524
|
-
expect(status).toBe(2);
|
|
525
|
-
}
|
|
526
|
-
});
|
|
527
|
-
it('refuses a BARE-RELATIVE anchor naming debris, which needs no leading slash (SF-9)', () => {
|
|
528
|
-
// `*/.claude/worktrees/*` requires a literal slash before `.claude`, so the
|
|
529
|
-
// relative spelling — resolved by the shell against the cwd — slipped past the
|
|
530
|
-
// SF-4 test and ran the shadow guard. Anchors come from the environment, which
|
|
531
|
-
// this code does not constrain, so both spellings must be covered.
|
|
532
|
-
//
|
|
533
|
-
// MUTATION: drop the `|.claude/worktrees/*` alternative and this test fails with
|
|
534
|
-
// SHADOW-RAN.
|
|
535
|
-
const repo = makeRepo('dir', 'CANONICAL-RAN');
|
|
536
|
-
plantDebris(repo, 'agent-X', 'SHADOW-RAN');
|
|
537
|
-
const relative = join('.claude', 'worktrees', 'agent-X');
|
|
538
|
-
expect(relative.startsWith('/')).toBe(false);
|
|
539
|
-
for (const key of ['CLAUDE_PROJECT_DIR', 'CLAUDE_WORKTREE_PATH']) {
|
|
540
|
-
// cwd is the repo root, so the relative anchor resolves onto the debris.
|
|
541
|
-
const { status, stderr } = runHook(repo, { [key]: relative });
|
|
542
|
-
expect(stderr).not.toContain('SHADOW-RAN');
|
|
543
|
-
expect(stderr).toContain('BLOCKED');
|
|
544
|
-
expect(status).toBe(2);
|
|
545
|
-
}
|
|
546
|
-
});
|
|
547
|
-
it('refuses an anchor that is a SYMLINK to debris, not just one spelled as debris', () => {
|
|
548
|
-
// The segment test is lexical, so it was applied to whatever string the
|
|
549
|
-
// environment supplied. A symlink to a debris directory carries no
|
|
550
|
-
// `.claude/worktrees/` segment in its own path, so it passed the pattern, and the
|
|
551
|
-
// guard-presence test then followed the link and ran the shadow. Same
|
|
552
|
-
// logical-vs-physical asymmetry SF-1 fixed for the walk, left behind on the anchor.
|
|
553
|
-
//
|
|
554
|
-
// MUTATION: drop `a="$(cd -P -- "$a" 2>/dev/null && pwd -P)"` and this fails with
|
|
555
|
-
// SHADOW-RAN.
|
|
556
|
-
const repo = makeRepo('dir', 'CANONICAL-RAN');
|
|
557
|
-
const nested = plantDebris(repo, 'agent-L', 'SHADOW-RAN');
|
|
558
|
-
const aliasRoot = realpathSync(mkdtempSync(join(tmpdir(), 'codex-anchor-')));
|
|
559
|
-
trees.push(aliasRoot);
|
|
560
|
-
const alias = join(aliasRoot, 'link');
|
|
561
|
-
symlinkSync(nested, alias);
|
|
562
|
-
expect(alias).not.toContain('.claude/worktrees/');
|
|
563
|
-
for (const key of ['CLAUDE_PROJECT_DIR', 'CLAUDE_WORKTREE_PATH']) {
|
|
564
|
-
const { status, stderr } = runHook(repo, { [key]: alias });
|
|
565
|
-
expect(stderr).not.toContain('SHADOW-RAN');
|
|
566
|
-
expect(stderr).toContain('BLOCKED');
|
|
567
|
-
expect(status).toBe(2);
|
|
568
|
-
}
|
|
569
|
-
});
|
|
570
|
-
it('an anchor naming a nonexistent directory REFUSES, and does not fall through to the walk', () => {
|
|
571
|
-
// Pins the ordering, not just the outcome. `[ -n "$a" ]` runs on the RAW anchor,
|
|
572
|
-
// before normalisation. Normalising first would turn an unresolvable anchor into
|
|
573
|
-
// the empty string, fail that test, and start the walk — converting a fail-closed
|
|
574
|
-
// refusal into a search. The canonical guard sits at the cwd here, so a
|
|
575
|
-
// fall-through would be visible as CANONICAL-RAN.
|
|
576
|
-
const repo = makeRepo('dir', 'CANONICAL-RAN');
|
|
577
|
-
for (const key of ['CLAUDE_PROJECT_DIR', 'CLAUDE_WORKTREE_PATH']) {
|
|
578
|
-
const { status, stderr } = runHook(repo, { [key]: join(repo, 'no-such-dir') });
|
|
579
|
-
expect(stderr).toContain('BLOCKED');
|
|
580
|
-
expect(stderr).not.toContain('CANONICAL-RAN');
|
|
581
|
-
expect(status).toBe(2);
|
|
582
|
-
}
|
|
583
|
-
});
|
|
584
|
-
it('a trusted anchor short-circuits the walk entirely, boundary or not', () => {
|
|
585
|
-
// CLAUDE_PROJECT_DIR / CLAUDE_WORKTREE_PATH are set by code that already knows the
|
|
586
|
-
// answer. They are checked once, with no `.git` requirement and no walk.
|
|
587
|
-
const anchor = makeRepo('none', 'ANCHOR-RAN');
|
|
588
|
-
const other = makeRepo('dir', 'CANONICAL-RAN');
|
|
589
|
-
mkdirSync(join(other, 'deep'), { recursive: true });
|
|
590
|
-
expect(runHook(join(other, 'deep'), { CLAUDE_PROJECT_DIR: anchor }).stderr).toContain('ANCHOR-RAN');
|
|
591
|
-
expect(runHook(join(other, 'deep'), { CLAUDE_WORKTREE_PATH: anchor }).stderr).toContain('ANCHOR-RAN');
|
|
592
|
-
});
|
|
593
|
-
it('an anchor without the guard refuses instead of falling back to the walk', () => {
|
|
594
|
-
// The anchor is an assertion about where the guard lives. If it is wrong, the
|
|
595
|
-
// right answer is to say so, not to search for a guard somewhere else.
|
|
596
|
-
const anchor = makeRepo('dir', null);
|
|
597
|
-
const other = makeRepo('dir', 'CANONICAL-RAN');
|
|
598
|
-
mkdirSync(join(other, 'deep'), { recursive: true });
|
|
599
|
-
const { status, stderr } = runHook(join(other, 'deep'), { CLAUDE_PROJECT_DIR: anchor });
|
|
600
|
-
expect(status).toBe(2);
|
|
601
|
-
expect(stderr).toContain('BLOCKED');
|
|
602
|
-
expect(stderr).not.toContain('CANONICAL-RAN');
|
|
603
|
-
});
|
|
604
|
-
it('still terminates at / rather than looping, with no anchor and no repository', () => {
|
|
605
|
-
const { status } = runHook('/');
|
|
606
|
-
expect(status).toBe(2);
|
|
607
|
-
});
|
|
608
|
-
it('the refusal explains the boundary, so the failure is diagnosable', () => {
|
|
609
|
-
const repo = makeRepo('dir', null);
|
|
610
|
-
const nested = plantDebris(repo, 'agent-Z', 'SHADOW-RAN');
|
|
611
|
-
const { stderr } = runHook(join(nested, 'src'));
|
|
612
|
-
expect(stderr).toContain('.claude/worktrees/');
|
|
613
|
-
expect(stderr).toMatch(/repository root/);
|
|
614
|
-
expect(stderr).toMatch(/fail closed|Refusing the command/);
|
|
615
|
-
});
|
|
616
|
-
it('the debris segment matches DEST_DEBRIS_DIR in generate-claude.mjs, so a rename breaks a test (SF-3)', () => {
|
|
617
|
-
// Two files now encode the same fact about Claude Code: agent worktrees are parked
|
|
618
|
-
// at `.claude/worktrees/`. generate-claude.mjs skips that subtree when scanning,
|
|
619
|
-
// this wrapper refuses to resolve a guard inside it. If Claude Code renames the
|
|
620
|
-
// directory and only the generator is updated, SF-27 reopens silently — the walk
|
|
621
|
-
// would resolve into debris again with every test here still green.
|
|
622
|
-
//
|
|
623
|
-
// DEST_DEBRIS_DIR is a module-private const, so it is read as text rather than
|
|
624
|
-
// imported. A read that finds nothing fails loudly instead of asserting vacuously.
|
|
625
|
-
const generator = join(import.meta.dirname, '..', '..', 'scripts', 'generate-claude.mjs');
|
|
626
|
-
const source = readFileSync(generator, 'utf-8');
|
|
627
|
-
const match = /^const DEST_DEBRIS_DIR = '([^']+)';$/m.exec(source);
|
|
628
|
-
expect(match, `DEST_DEBRIS_DIR not found in ${generator}`).not.toBeNull();
|
|
629
|
-
const debrisDir = match[1];
|
|
630
|
-
expect(debrisDir).toBe('worktrees');
|
|
631
|
-
for (const guard of PHASE1_PORTED_GUARDS) {
|
|
632
|
-
expect(codexHookCommand(guard)).toContain(`.claude/${debrisDir}/`);
|
|
633
|
-
}
|
|
634
|
-
});
|
|
635
|
-
// ── S4 invariants: the bound must not have cost the path-free, byte-identical body ──
|
|
636
|
-
it('keeps exactly one single-quoted region and no apostrophes (S4)', () => {
|
|
637
|
-
for (const guard of PHASE1_PORTED_GUARDS) {
|
|
638
|
-
const cmd = codexHookCommand(guard);
|
|
639
|
-
// Two apostrophes total: the ones opening and closing `bash -c '…'`.
|
|
640
|
-
expect(cmd.split("'").length - 1).toBe(2);
|
|
641
|
-
const body = cmd.slice(cmd.indexOf("'") + 1, cmd.lastIndexOf("'"));
|
|
642
|
-
expect(body).not.toContain("'");
|
|
643
|
-
}
|
|
644
|
-
});
|
|
645
|
-
it('embeds no filesystem path, so the body is byte-identical in every worktree (S4)', () => {
|
|
646
|
-
// Hook trust is keyed on sha256(hooks.json). One interpolated path would give each
|
|
647
|
-
// worktree its own hash and therefore its own human trust grant.
|
|
648
|
-
const a = buildCodexHooksJson({ worktreePath: '/workspace' });
|
|
649
|
-
const b = buildCodexHooksJson({ worktreePath: "/tmp/harry's-repo/.claude/worktrees/agent-1" });
|
|
650
|
-
expect(a).toBe(b);
|
|
651
|
-
for (const guard of PHASE1_PORTED_GUARDS) {
|
|
652
|
-
expect(codexHookCommand(guard)).not.toMatch(/\/tmp|\/workspace|harry/);
|
|
653
|
-
}
|
|
654
|
-
});
|
|
655
|
-
});
|
|
656
|
-
/**
|
|
657
|
-
* #4859 security review SF-1: the spawn gate must fail closed when ITS OWN binary
|
|
658
|
-
* cannot be resolved.
|
|
659
|
-
*
|
|
660
|
-
* The registered command was the bare `mx-agent internal-codex-agent-gate`. With
|
|
661
|
-
* mx-agent off the PATH the hook process inherits, the shell exits 127; Codex blocks
|
|
662
|
-
* only on exit 2 and allows on everything else, so 127 is an ALLOW and every spawn
|
|
663
|
-
* proceeds ungated. That is the #4227 G-7 fail-open again, this time in the control
|
|
664
|
-
* that is the last blocker on Codex opt-in.
|
|
665
|
-
*
|
|
666
|
-
* These tests EXECUTE the command taken out of the generated hooks.json. The previous
|
|
667
|
-
* fail-closed test was narrowed to commands containing `.claude/hooks/`, so it ran the
|
|
668
|
-
* two guard wrappers and none of the gate; string assertions cannot see an exit code.
|
|
669
|
-
*
|
|
670
|
-
* MUTATION CHECK: returning `CODEX_AGENT_GATE_COMMAND` unwrapped from
|
|
671
|
-
* codexAgentGateCommand makes `fails closed` observe 127 and fail.
|
|
672
|
-
*/
|
|
673
|
-
describe('spawn gate command — fail direction when mx-agent is unresolvable (executed)', () => {
|
|
674
|
-
/** A PATH holding bash and provably nothing else — no mx-agent to resolve. */
|
|
675
|
-
let bareBin = '';
|
|
676
|
-
beforeEach(() => {
|
|
677
|
-
bareBin = realpathSync(mkdtempSync(join(tmpdir(), 'codex-gate-path-')));
|
|
678
|
-
// The wrapper starts `bash -c`, so bash itself must stay resolvable; everything
|
|
679
|
-
// else, mx-agent included, must not be.
|
|
680
|
-
symlinkSync('/bin/bash', join(bareBin, 'bash'));
|
|
681
|
-
});
|
|
682
|
-
afterEach(() => {
|
|
683
|
-
if (bareBin && existsSync(bareBin))
|
|
684
|
-
rmSync(bareBin, { recursive: true, force: true });
|
|
685
|
-
});
|
|
686
|
-
/** Every PreToolUse/SubagentStart group whose command is the gate, as Codex sees it. */
|
|
687
|
-
const gateCommands = (provenGuards) => {
|
|
688
|
-
const doc = JSON.parse(buildCodexHooksJson({ worktreePath: worktree, ...(provenGuards ? { provenGuards } : {}) }));
|
|
689
|
-
const all = [...doc.hooks.PreToolUse, ...doc.hooks.SubagentStart];
|
|
690
|
-
const cmds = all
|
|
691
|
-
.map((g) => g.hooks[0].command)
|
|
692
|
-
.filter((c) => c.includes('internal-codex-agent-gate'));
|
|
693
|
-
expect(cmds).toHaveLength(2); // the PreToolUse spawn matcher and SubagentStart
|
|
694
|
-
return cmds;
|
|
695
|
-
};
|
|
696
|
-
const run = (command, path) => {
|
|
697
|
-
const r = spawnSync('/bin/bash', ['-c', command], {
|
|
698
|
-
cwd: bareBin,
|
|
699
|
-
// Deliberately NOT `...process.env`: the defect is a dependence on an ambient
|
|
700
|
-
// PATH, so the test must control the environment completely.
|
|
701
|
-
env: { PATH: path },
|
|
702
|
-
encoding: 'utf-8',
|
|
703
|
-
input: '{}',
|
|
704
|
-
});
|
|
705
|
-
return { status: r.status, stderr: r.stderr ?? '' };
|
|
706
|
-
};
|
|
707
|
-
it('the test PATH really cannot resolve mx-agent (otherwise the case below is vacuous)', () => {
|
|
708
|
-
const r = spawnSync('/bin/bash', ['-c', 'command -v mx-agent'], {
|
|
709
|
-
env: { PATH: bareBin },
|
|
710
|
-
encoding: 'utf-8',
|
|
711
|
-
});
|
|
712
|
-
expect(r.status).not.toBe(0);
|
|
713
|
-
expect((r.stdout ?? '').trim()).toBe('');
|
|
714
|
-
});
|
|
715
|
-
it('FAILS CLOSED — every registered gate command exits 2, not 127, with no mx-agent', () => {
|
|
716
|
-
for (const command of gateCommands(['git-mutation-guard'])) {
|
|
717
|
-
const { status, stderr } = run(command, bareBin);
|
|
718
|
-
// 127 is what the bare command produced, and Codex reads it as ALLOW.
|
|
719
|
-
expect(status).not.toBe(127);
|
|
720
|
-
expect(status).toBe(2);
|
|
721
|
-
expect(stderr).toContain('BLOCKED');
|
|
722
|
-
}
|
|
723
|
-
});
|
|
724
|
-
it('the refusal says the binary is missing, that it refused, and how to fix it', () => {
|
|
725
|
-
const { stderr } = run(gateCommands()[0], bareBin);
|
|
726
|
-
expect(stderr).toContain('mx-agent');
|
|
727
|
-
expect(stderr).toContain('not on PATH');
|
|
728
|
-
// Fail-loud standard: it must say it refused the spawn, not merely that it looked.
|
|
729
|
-
expect(stderr).toMatch(/Refusing the spawn|fail\s*closed/);
|
|
730
|
-
expect(stderr).toMatch(/install|mx-agent start/);
|
|
731
|
-
});
|
|
732
|
-
it('EXECS the gate, arguments intact, when mx-agent IS resolvable', () => {
|
|
733
|
-
// A shim on the PATH stands in for the real binary: it records the argv it was
|
|
734
|
-
// given and exits 2, so this asserts the success branch reaches the gate with
|
|
735
|
-
// `--proven-guards` attached, and that the wrapper forwards the exit code.
|
|
736
|
-
writeFileSync(join(bareBin, 'mx-agent'), '#!/bin/bash\necho "GATE-RAN $*" >&2\nexit 2\n', { mode: 0o755 });
|
|
737
|
-
const { status, stderr } = run(gateCommands(['git-mutation-guard'])[0], bareBin);
|
|
738
|
-
expect(stderr).toContain('GATE-RAN internal-codex-agent-gate --proven-guards git-mutation-guard');
|
|
739
|
-
expect(stderr).not.toContain('BLOCKED');
|
|
740
|
-
expect(status).toBe(2);
|
|
741
|
-
});
|
|
742
|
-
});
|
|
743
|
-
describe('codexHookTrustPreconditions — the guards are inert until trust exists', () => {
|
|
744
|
-
it('reports both preconditions unmet when the Codex config has no trust records', () => {
|
|
745
|
-
const codexHome = join(worktree, 'fake-codex-home');
|
|
746
|
-
mkdirSync(codexHome, { recursive: true });
|
|
747
|
-
writeFileSync(join(codexHome, 'config.toml'), 'model = "gpt-5.5"\n');
|
|
748
|
-
const results = codexHookTrustPreconditions({ worktreePath: worktree, codexHome });
|
|
749
|
-
expect(results.map((r) => r.id).sort()).toEqual(['hook-trust', 'project-trust']);
|
|
750
|
-
expect(results.every((r) => !r.satisfied)).toBe(true);
|
|
751
|
-
});
|
|
752
|
-
/**
|
|
753
|
-
* ─── #4864 / SF-2 (KI-CODEX-TRUST-PRECONDITION-ANY-NOT-ALL) ──────────────────
|
|
754
|
-
*
|
|
755
|
-
* The predicate used to be `sections.some(record has enabled + hash)` — path-agnostic
|
|
756
|
-
* and entry-agnostic. So a grant for `/workspace/.codex/hooks.json` reported hook
|
|
757
|
-
* trust SATISFIED for a team worktree whose own hooks.json had ZERO records and whose
|
|
758
|
-
* hooks were therefore silently inert. That is the same false green as #4849: the
|
|
759
|
-
* banner said the guards were live while nothing was enforcing.
|
|
760
|
-
*
|
|
761
|
-
* These tests pin the replacement: the required keys are derived from the DEPLOYED
|
|
762
|
-
* document, prefixed with THIS worktree's hooks path, and EVERY one of them needs a
|
|
763
|
-
* usable record.
|
|
764
|
-
*
|
|
765
|
-
* MUTATION CHECK: replacing the per-key `every` with the old `sections.some(...)`
|
|
766
|
-
* makes 'a grant for another path is not a grant for this worktree' and
|
|
767
|
-
* 'one ungranted entry is enough to fail' both fail.
|
|
768
|
-
*/
|
|
769
|
-
describe('hook trust is PER ENTRY and PATH-AWARE (#4864, SF-2)', () => {
|
|
770
|
-
const codexHomeFor = (body) => {
|
|
771
|
-
const codexHome = join(worktree, 'fake-codex-home');
|
|
772
|
-
mkdirSync(codexHome, { recursive: true });
|
|
773
|
-
writeFileSync(join(codexHome, 'config.toml'), body);
|
|
774
|
-
return codexHome;
|
|
775
|
-
};
|
|
776
|
-
const deployHooks = () => {
|
|
777
|
-
mkdirSync(join(worktree, '.codex'), { recursive: true });
|
|
778
|
-
writeFileSync(join(worktree, CODEX_HOOKS_FILENAME), buildCodexHooksJson({ worktreePath: worktree }));
|
|
779
|
-
};
|
|
780
|
-
const keys = () => codexHookTrustKeysForDoc(join(worktree, CODEX_HOOKS_FILENAME), readDeployedHooksDoc(worktree));
|
|
781
|
-
const grantAll = () => keys().map((k) => `[hooks.state."${k}"]\nenabled = true\ntrusted_hash = "sha256:aa"\n`).join('\n');
|
|
782
|
-
const satisfied = (codexHome) => codexHookTrustPreconditions({ worktreePath: worktree, codexHome }).find((r) => r.id === 'hook-trust')
|
|
783
|
-
?.satisfied ?? false;
|
|
784
|
-
it('derives one key per hook entry, in the generator\'s own group order', () => {
|
|
785
|
-
deployHooks();
|
|
786
|
-
const hooksPath = join(worktree, CODEX_HOOKS_FILENAME);
|
|
787
|
-
// Three PreToolUse entries (two guards, then the appended spawn gate) and one
|
|
788
|
-
// SubagentStart entry. The key format is Codex's own, read off a real
|
|
789
|
-
// ~/.codex/config.toml: <path>:<snake_case event>:<group>:<hook>.
|
|
790
|
-
expect(keys()).toEqual([
|
|
791
|
-
`${hooksPath}:pre_tool_use:0:0`,
|
|
792
|
-
`${hooksPath}:pre_tool_use:1:0`,
|
|
793
|
-
`${hooksPath}:pre_tool_use:2:0`,
|
|
794
|
-
`${hooksPath}:subagent_start:0:0`,
|
|
795
|
-
]);
|
|
796
|
-
});
|
|
797
|
-
it('is SATISFIED only when every entry has an enabled record with a hash', () => {
|
|
798
|
-
deployHooks();
|
|
799
|
-
expect(satisfied(codexHomeFor(grantAll()))).toBe(true);
|
|
800
|
-
});
|
|
801
|
-
it('a grant for another path is not a grant for this worktree (the false green)', () => {
|
|
802
|
-
deployHooks();
|
|
803
|
-
const foreign = grantAll().replaceAll(join(worktree, CODEX_HOOKS_FILENAME), '/workspace/.codex/hooks.json');
|
|
804
|
-
const codexHome = codexHomeFor(foreign);
|
|
805
|
-
expect(satisfied(codexHome)).toBe(false);
|
|
806
|
-
const detail = codexHookTrustPreconditions({ worktreePath: worktree, codexHome }).find((r) => r.id === 'hook-trust')?.detail;
|
|
807
|
-
// It names the ungranted ENTRIES, not a vague "hooks are untrusted".
|
|
808
|
-
expect(detail).toContain('4 of 4 entries have NO usable trust record');
|
|
809
|
-
expect(detail).toContain(`${join(worktree, CODEX_HOOKS_FILENAME)}:pre_tool_use:0:0`);
|
|
810
|
-
});
|
|
811
|
-
it('one ungranted entry is enough to fail — ANY is not ALL', () => {
|
|
812
|
-
deployHooks();
|
|
813
|
-
const all = keys();
|
|
814
|
-
const partial = all
|
|
815
|
-
.slice(0, all.length - 1)
|
|
816
|
-
.map((k) => `[hooks.state."${k}"]\nenabled = true\ntrusted_hash = "sha256:aa"\n`)
|
|
817
|
-
.join('\n');
|
|
818
|
-
const codexHome = codexHomeFor(partial);
|
|
819
|
-
expect(satisfied(codexHome)).toBe(false);
|
|
820
|
-
expect(codexHookTrustPreconditions({ worktreePath: worktree, codexHome }).find((r) => r.id === 'hook-trust')?.detail).toContain('1 of 4 entries');
|
|
821
|
-
});
|
|
822
|
-
it.each([
|
|
823
|
-
['a disabled record', 'enabled = false\ntrusted_hash = "sha256:aa"'],
|
|
824
|
-
['a record with an empty hash', 'enabled = true\ntrusted_hash = ""'],
|
|
825
|
-
['a record with no hash at all', 'enabled = true'],
|
|
826
|
-
])('%s does not count as granted', (_label, body) => {
|
|
827
|
-
deployHooks();
|
|
828
|
-
const all = keys();
|
|
829
|
-
const text = all
|
|
830
|
-
.map((k, i) => i === 0
|
|
831
|
-
? `[hooks.state."${k}"]\n${body}\n`
|
|
832
|
-
: `[hooks.state."${k}"]\nenabled = true\ntrusted_hash = "sha256:aa"\n`)
|
|
833
|
-
.join('\n');
|
|
834
|
-
expect(satisfied(codexHomeFor(text))).toBe(false);
|
|
835
|
-
});
|
|
836
|
-
it('NO deployed hooks.json is unmet, not vacuously satisfied', () => {
|
|
837
|
-
// An empty required-key set must never read as "all keys granted".
|
|
838
|
-
expect(satisfied(codexHomeFor('model = "gpt-5.5"\n'))).toBe(false);
|
|
839
|
-
mkdirSync(join(worktree, '.codex'), { recursive: true });
|
|
840
|
-
writeFileSync(join(worktree, CODEX_HOOKS_FILENAME), '{"hooks":{}}');
|
|
841
|
-
expect(satisfied(codexHomeFor(''))).toBe(false);
|
|
842
|
-
});
|
|
843
|
-
it('an unparseable hooks.json is unmet, and says so', () => {
|
|
844
|
-
mkdirSync(join(worktree, '.codex'), { recursive: true });
|
|
845
|
-
writeFileSync(join(worktree, CODEX_HOOKS_FILENAME), 'not json');
|
|
846
|
-
const codexHome = codexHomeFor('');
|
|
847
|
-
expect(satisfied(codexHome)).toBe(false);
|
|
848
|
-
expect(codexHookTrustPreconditions({ worktreePath: worktree, codexHome }).find((r) => r.id === 'hook-trust')?.detail).toContain('No readable');
|
|
849
|
-
});
|
|
850
|
-
});
|
|
851
|
-
// ── NEW-12: the predicate reads the VALUE, not the presence of a header ──────
|
|
852
|
-
describe('project trust reads trust_level, not the section header (NEW-12)', () => {
|
|
853
|
-
function projectTrust(configBody, path = worktree) {
|
|
854
|
-
const codexHome = join(worktree, 'fake-codex-home');
|
|
855
|
-
mkdirSync(codexHome, { recursive: true });
|
|
856
|
-
writeFileSync(join(codexHome, 'config.toml'), configBody);
|
|
857
|
-
return (codexHookTrustPreconditions({ worktreePath: path, codexHome }).find((r) => r.id === 'project-trust')?.satisfied ?? false);
|
|
858
|
-
}
|
|
859
|
-
// Six states, one table. The middle four all reported SATISFIED under the old
|
|
860
|
-
// presence regex — including "untrusted", the value Codex itself writes when an
|
|
861
|
-
// operator DECLINES the trust prompt.
|
|
862
|
-
it.each([
|
|
863
|
-
['trust_level = "trusted"', `[projects."WT"]\ntrust_level = "trusted"\n`, true],
|
|
864
|
-
['trust_level = "untrusted" (operator DECLINED)', `[projects."WT"]\ntrust_level = "untrusted"\n`, false],
|
|
865
|
-
['commented-out header', `# [projects."WT"]\n# trust_level = "trusted"\n`, false],
|
|
866
|
-
['header with no trust_level key', `[projects."WT"]\nsome_other_key = 1\n`, false],
|
|
867
|
-
['no entry at all', 'model = "gpt-5.5"\n', false],
|
|
868
|
-
[
|
|
869
|
-
'commented duplicate above the real entry — the real entry wins',
|
|
870
|
-
`# [projects."WT"]\n# trust_level = "trusted"\n[projects."WT"]\ntrust_level = "untrusted"\n`,
|
|
871
|
-
false,
|
|
872
|
-
],
|
|
873
|
-
])('%s → satisfied=%s', (_label, body, expected) => {
|
|
874
|
-
expect(projectTrust(body.replaceAll('WT', worktree))).toBe(expected);
|
|
875
|
-
});
|
|
876
|
-
it('a commented-out DENIAL above a real grant still reads as trusted', () => {
|
|
877
|
-
expect(projectTrust(`# trust_level = "untrusted"\n[projects."${worktree}"]\ntrust_level = "trusted"\n`)).toBe(true);
|
|
878
|
-
});
|
|
879
|
-
it('does not accept a trust_level that merely starts with "trusted"', () => {
|
|
880
|
-
expect(projectTrust(`[projects."${worktree}"]\ntrust_level = "trusted-ish"\n`)).toBe(false);
|
|
881
|
-
});
|
|
882
|
-
it('stops at the next section header — a later section cannot grant trust', () => {
|
|
883
|
-
expect(projectTrust(`[projects."${worktree}"]\n[projects."/somewhere/else"]\ntrust_level = "trusted"\n`)).toBe(false);
|
|
884
|
-
});
|
|
885
|
-
it('names the value it actually read in the detail', () => {
|
|
886
|
-
const codexHome = join(worktree, 'fake-codex-home');
|
|
887
|
-
mkdirSync(codexHome, { recursive: true });
|
|
888
|
-
writeFileSync(join(codexHome, 'config.toml'), `[projects."${worktree}"]\ntrust_level = "untrusted"\n`);
|
|
889
|
-
const detail = codexHookTrustPreconditions({ worktreePath: worktree, codexHome }).find((r) => r.id === 'project-trust')?.detail;
|
|
890
|
-
expect(detail).toContain('trust_level = "untrusted"');
|
|
891
|
-
});
|
|
892
|
-
});
|
|
893
|
-
// ── NEW-13: same defect, same fix, on the hook-trust predicate ───────────────
|
|
894
|
-
describe('hook trust reads the record, not a mention of it (NEW-13)', () => {
|
|
895
|
-
// KEY is substituted for the placeholder `abc` (#4864): records are now looked up
|
|
896
|
-
// by the entry keys of THIS worktree's deployed hooks.json, so the value semantics
|
|
897
|
-
// this table pins have to be exercised on a key that is actually required. Every
|
|
898
|
-
// OTHER required entry gets a full grant, so the table still varies exactly one
|
|
899
|
-
// record and the result still turns on that record alone.
|
|
900
|
-
function hookTrust(configBody) {
|
|
901
|
-
mkdirSync(join(worktree, '.codex'), { recursive: true });
|
|
902
|
-
writeFileSync(join(worktree, CODEX_HOOKS_FILENAME), buildCodexHooksJson({ worktreePath: worktree }));
|
|
903
|
-
const allKeys = codexHookTrustKeysForDoc(join(worktree, CODEX_HOOKS_FILENAME), readDeployedHooksDoc(worktree));
|
|
904
|
-
const [key, ...rest] = allKeys;
|
|
905
|
-
const others = rest
|
|
906
|
-
.map((k) => `[hooks.state."${k}"]\nenabled = true\ntrusted_hash = "sha256:aa"\n`)
|
|
907
|
-
.join('\n');
|
|
908
|
-
const codexHome = join(worktree, 'fake-codex-home');
|
|
909
|
-
mkdirSync(codexHome, { recursive: true });
|
|
910
|
-
writeFileSync(join(codexHome, 'config.toml'), `${configBody.replaceAll('abc', key)}\n${others}`);
|
|
911
|
-
return (codexHookTrustPreconditions({ worktreePath: worktree, codexHome }).find((r) => r.id === 'hook-trust')?.satisfied ?? false);
|
|
912
|
-
}
|
|
913
|
-
it.each([
|
|
914
|
-
['enabled record with a hash', '[hooks.state."abc"]\nenabled = true\ntrusted_hash = "deadbeef"\n', true],
|
|
915
|
-
['commented-out record', '# [hooks.state."abc"]\n# enabled = true\n# trusted_hash = "deadbeef"\n', false],
|
|
916
|
-
['record disabled', '[hooks.state."abc"]\nenabled = false\ntrusted_hash = "deadbeef"\n', false],
|
|
917
|
-
['record with no hash', '[hooks.state."abc"]\nenabled = true\n', false],
|
|
918
|
-
['empty hash', '[hooks.state."abc"]\nenabled = true\ntrusted_hash = ""\n', false],
|
|
919
|
-
['only a prose mention', '# remember to set hooks.state trusted_hash one day\n', false],
|
|
920
|
-
])('%s → satisfied=%s', (_label, body, expected) => {
|
|
921
|
-
expect(hookTrust(body)).toBe(expected);
|
|
922
|
-
});
|
|
923
|
-
});
|
|
924
|
-
it('detects project trust for THIS worktree only', () => {
|
|
925
|
-
const codexHome = join(worktree, 'fake-codex-home');
|
|
926
|
-
mkdirSync(codexHome, { recursive: true });
|
|
927
|
-
writeFileSync(join(codexHome, 'config.toml'), `[projects."${worktree}"]\ntrust_level = "trusted"\n`);
|
|
928
|
-
const results = codexHookTrustPreconditions({ worktreePath: worktree, codexHome });
|
|
929
|
-
expect(results.find((r) => r.id === 'project-trust')?.satisfied).toBe(true);
|
|
930
|
-
const other = codexHookTrustPreconditions({ worktreePath: `${worktree}-other`, codexHome });
|
|
931
|
-
expect(other.find((r) => r.id === 'project-trust')?.satisfied).toBe(false);
|
|
932
|
-
});
|
|
933
|
-
it('treats a missing Codex config as unmet, not as satisfied', () => {
|
|
934
|
-
const results = codexHookTrustPreconditions({ worktreePath: worktree, codexHome: join(worktree, 'absent') });
|
|
935
|
-
expect(results.every((r) => !r.satisfied)).toBe(true);
|
|
936
|
-
});
|
|
937
|
-
});
|
|
938
|
-
describe('buildAgentsOverride — FR-7 / FR-16 single instruction source', () => {
|
|
939
|
-
const baseOpts = () => ({
|
|
940
|
-
projectRoot: root,
|
|
941
|
-
worktreePath: worktree,
|
|
942
|
-
worktreeName: 'demo',
|
|
943
|
-
branch: 'worktree/demo',
|
|
944
|
-
slot: 0,
|
|
945
|
-
});
|
|
946
|
-
it('carries the CLAUDE.local.md generator output verbatim', () => {
|
|
947
|
-
const claudeLocal = buildClaudeLocalContent(baseOpts());
|
|
948
|
-
const override = buildAgentsOverride(baseOpts());
|
|
949
|
-
expect(override.content).toContain(claudeLocal.content);
|
|
950
|
-
});
|
|
951
|
-
it('reads ONE source, so a marker change cannot land on Claude and miss Codex', () => {
|
|
952
|
-
// The proof is structural: the override is the Claude content plus a prefix
|
|
953
|
-
// (and, when present, the folded canonical content).
|
|
954
|
-
const claudeLocal = buildClaudeLocalContent(baseOpts());
|
|
955
|
-
const override = buildAgentsOverride(baseOpts());
|
|
956
|
-
expect(override.content).toBe(`${CODEX_MARKER_DEGRADATION_NOTICE}\n\n${claudeLocal.content}\n`);
|
|
957
|
-
});
|
|
958
|
-
// ── The override REPLACES AGENTS.md (probed on codex-cli 0.145.0) ──────────
|
|
959
|
-
// Verified via `codex debug prompt-input`: with both files present only the
|
|
960
|
-
// override's content reached the model, at caps of 200/600/1000/32768 bytes; with
|
|
961
|
-
// the override removed, AGENTS.md reached the model. The PRD called this file the
|
|
962
|
-
// CLAUDE.local.md equivalent, but those two are ADDITIVE on Claude.
|
|
963
|
-
it('folds the canonical AGENTS.md content in, because Codex ignores AGENTS.md otherwise', () => {
|
|
964
|
-
writeFileSync(join(worktree, 'AGENTS.md'), '# CANONICAL-INSTRUCTIONS\nprior art gate etc.\n');
|
|
965
|
-
const override = buildAgentsOverride(baseOpts());
|
|
966
|
-
expect(override.hasCanonicalContent).toBe(true);
|
|
967
|
-
expect(override.content).toContain('# CANONICAL-INSTRUCTIONS');
|
|
968
|
-
expect(override.content).toContain(CODEX_CANONICAL_FOLD_NOTICE);
|
|
969
|
-
});
|
|
970
|
-
it('puts the canonical content FIRST and the local override LAST (NEW-4)', () => {
|
|
971
|
-
// project_doc_max_bytes truncates this file from the END, silently. Canonical
|
|
972
|
-
// AGENTS.md carries standing security policy; the worktree-local override carries
|
|
973
|
-
// this session's context. Truncation must cost local context, not policy.
|
|
974
|
-
writeFileSync(join(worktree, 'AGENTS.md'), '# CANONICAL-INSTRUCTIONS\n');
|
|
975
|
-
const content = buildAgentsOverride(baseOpts()).content;
|
|
976
|
-
expect(content.indexOf('# CANONICAL-INSTRUCTIONS')).toBeLessThan(content.indexOf('Worktree Isolation Context'));
|
|
977
|
-
// The degradation notice still leads the file.
|
|
978
|
-
expect(content.indexOf(CODEX_MARKER_DEGRADATION_NOTICE)).toBe(0);
|
|
979
|
-
expect(content.indexOf(CODEX_CANONICAL_FOLD_NOTICE)).toBeLessThan(content.indexOf('Worktree Isolation Context'));
|
|
980
|
-
});
|
|
981
|
-
it('reports hasCanonicalContent=false when there is no AGENTS.md to fold', () => {
|
|
982
|
-
const override = buildAgentsOverride(baseOpts());
|
|
983
|
-
expect(override.hasCanonicalContent).toBe(false);
|
|
984
|
-
expect(override.content).not.toContain(CODEX_CANONICAL_FOLD_NOTICE);
|
|
985
|
-
});
|
|
986
|
-
it('treats an empty AGENTS.md as nothing to fold', () => {
|
|
987
|
-
writeFileSync(join(worktree, 'AGENTS.md'), ' \n\n');
|
|
988
|
-
expect(buildAgentsOverride(baseOpts()).hasCanonicalContent).toBe(false);
|
|
989
|
-
});
|
|
990
|
-
it('states the declared degradation in the file itself', () => {
|
|
991
|
-
expect(buildAgentsOverride(baseOpts()).content).toMatch(/reads this file once, at session start/);
|
|
992
|
-
expect(buildAgentsOverride(baseOpts()).content).toMatch(/NOT re-injected per turn/);
|
|
993
|
-
});
|
|
994
|
-
it('carries the behavioral marker block when the roleguide has one', () => {
|
|
995
|
-
writeFileSync(join(root, 'CLAUDE.local.md'), '# Root local\n\n<!-- behavioral-start -->\nPRIOR ART GATE\n<!-- behavioral-end -->\n');
|
|
996
|
-
const override = buildAgentsOverride(baseOpts());
|
|
997
|
-
expect(override.content).toContain('PRIOR ART GATE');
|
|
998
|
-
});
|
|
999
|
-
it('propagates the missing-block warning rather than swallowing it', () => {
|
|
1000
|
-
const override = buildAgentsOverride({ ...baseOpts(), teamSlug: 'team-that-does-not-exist' });
|
|
1001
|
-
expect(override.hasBehavioralBlock).toBe(false);
|
|
1002
|
-
expect(override.warning).toMatch(/Behavioral block MISSING/);
|
|
1003
|
-
});
|
|
1004
|
-
});
|
|
1005
|
-
describe('measureInstructionChain — FR-5 budget against the ONE file Codex reads (S10)', () => {
|
|
1006
|
-
it('is silent under budget', () => {
|
|
1007
|
-
writeFileSync(join(worktree, 'AGENTS.md'), 'x'.repeat(1000));
|
|
1008
|
-
const m = measureInstructionChain(worktree);
|
|
1009
|
-
expect(m.bytes).toBe(1000);
|
|
1010
|
-
expect(m.cap).toBe(PROJECT_DOC_MAX_BYTES);
|
|
1011
|
-
expect(m.overBudget).toBe(false);
|
|
1012
|
-
expect(m.readFile).toBe('AGENTS.md');
|
|
1013
|
-
});
|
|
1014
|
-
it('counts ONLY the override when both exist — it REPLACES AGENTS.md, it does not add to it', () => {
|
|
1015
|
-
// The pre-fix version summed the two and reported 150 for a chain that does not
|
|
1016
|
-
// exist: Codex reads the override alone. Over-counting is the small problem; the
|
|
1017
|
-
// large one is that it implied AGENTS.md was being read when it was not.
|
|
1018
|
-
writeFileSync(join(worktree, 'AGENTS.md'), 'x'.repeat(100));
|
|
1019
|
-
writeFileSync(join(worktree, AGENTS_OVERRIDE_FILENAME), 'y'.repeat(50));
|
|
1020
|
-
const m = measureInstructionChain(worktree);
|
|
1021
|
-
expect(m.bytes).toBe(50);
|
|
1022
|
-
expect(m.readFile).toBe(AGENTS_OVERRIDE_FILENAME);
|
|
1023
|
-
});
|
|
1024
|
-
it('records the ignored candidates with their own sizes (per-file reporting)', () => {
|
|
1025
|
-
writeFileSync(join(worktree, 'AGENTS.md'), 'x'.repeat(100));
|
|
1026
|
-
writeFileSync(join(worktree, AGENTS_OVERRIDE_FILENAME), 'y'.repeat(50));
|
|
1027
|
-
writeFileSync(join(worktree, 'CLAUDE.md'), 'z'.repeat(10));
|
|
1028
|
-
const m = measureInstructionChain(worktree);
|
|
1029
|
-
expect(m.files).toEqual([
|
|
1030
|
-
{ path: AGENTS_OVERRIDE_FILENAME, bytes: 50, read: true },
|
|
1031
|
-
{ path: 'AGENTS.md', bytes: 100, read: false },
|
|
1032
|
-
{ path: 'CLAUDE.md', bytes: 10, read: false },
|
|
1033
|
-
]);
|
|
1034
|
-
});
|
|
1035
|
-
it('flags an over-cap file', () => {
|
|
1036
|
-
writeFileSync(join(worktree, 'AGENTS.md'), 'x'.repeat(PROJECT_DOC_MAX_BYTES + 1));
|
|
1037
|
-
expect(measureInstructionChain(worktree).overBudget).toBe(true);
|
|
1038
|
-
});
|
|
1039
|
-
it('does NOT flag over-budget when only an IGNORED file is oversized', () => {
|
|
1040
|
-
// AGENTS.md is not read when the override exists, so its size cannot blow a cap
|
|
1041
|
-
// that never applies to it.
|
|
1042
|
-
writeFileSync(join(worktree, 'AGENTS.md'), 'x'.repeat(PROJECT_DOC_MAX_BYTES + 1));
|
|
1043
|
-
writeFileSync(join(worktree, AGENTS_OVERRIDE_FILENAME), 'y'.repeat(10));
|
|
1044
|
-
expect(measureInstructionChain(worktree).overBudget).toBe(false);
|
|
1045
|
-
});
|
|
1046
|
-
it('falls back to CLAUDE.md only when neither AGENTS file exists', () => {
|
|
1047
|
-
writeFileSync(join(worktree, 'CLAUDE.md'), 'z'.repeat(300));
|
|
1048
|
-
expect(measureInstructionChain(worktree).readFile).toBe('CLAUDE.md');
|
|
1049
|
-
writeFileSync(join(worktree, 'AGENTS.md'), 'x'.repeat(10));
|
|
1050
|
-
expect(measureInstructionChain(worktree).readFile).toBe('AGENTS.md');
|
|
1051
|
-
});
|
|
1052
|
-
it('measures against the cap it is given, defaulting to PROJECT_DOC_MAX_BYTES', () => {
|
|
1053
|
-
writeFileSync(join(worktree, 'AGENTS.md'), 'x'.repeat(500));
|
|
1054
|
-
expect(measureInstructionChain(worktree).cap).toBe(PROJECT_DOC_MAX_BYTES);
|
|
1055
|
-
const tight = measureInstructionChain(worktree, 100);
|
|
1056
|
-
expect(tight.cap).toBe(100);
|
|
1057
|
-
expect(tight.overBudget).toBe(true);
|
|
1058
|
-
});
|
|
1059
|
-
it('reports zero and no read file on an empty worktree instead of throwing', () => {
|
|
1060
|
-
const m = measureInstructionChain(worktree);
|
|
1061
|
-
expect(m.bytes).toBe(0);
|
|
1062
|
-
expect(m.readFile).toBeNull();
|
|
1063
|
-
});
|
|
1064
|
-
});
|
|
1065
|
-
describe('deployCodexConfig — idempotent artifact deployment', () => {
|
|
1066
|
-
const opts = () => ({
|
|
1067
|
-
projectRoot: root,
|
|
1068
|
-
worktreePath: worktree,
|
|
1069
|
-
worktreeName: 'demo',
|
|
1070
|
-
branch: 'worktree/demo',
|
|
1071
|
-
slot: 0,
|
|
1072
|
-
});
|
|
1073
|
-
it('writes all three artifacts', () => {
|
|
1074
|
-
const result = deployCodexConfig(opts());
|
|
1075
|
-
expect(result.written.sort()).toEqual([AGENTS_OVERRIDE_FILENAME, CODEX_CONFIG_FILENAME, CODEX_HOOKS_FILENAME].sort());
|
|
1076
|
-
expect(existsSync(join(worktree, CODEX_CONFIG_FILENAME))).toBe(true);
|
|
1077
|
-
expect(existsSync(join(worktree, CODEX_HOOKS_FILENAME))).toBe(true);
|
|
1078
|
-
expect(existsSync(join(worktree, AGENTS_OVERRIDE_FILENAME))).toBe(true);
|
|
1079
|
-
});
|
|
1080
|
-
it('is idempotent — a second deploy produces byte-identical hook config', () => {
|
|
1081
|
-
deployCodexConfig(opts());
|
|
1082
|
-
const first = readFileSync(join(worktree, CODEX_HOOKS_FILENAME), 'utf-8');
|
|
1083
|
-
deployCodexConfig(opts());
|
|
1084
|
-
expect(readFileSync(join(worktree, CODEX_HOOKS_FILENAME), 'utf-8')).toBe(first);
|
|
1085
|
-
});
|
|
1086
|
-
it('overwrites a tampered hooks.json rather than leaving it in place', () => {
|
|
1087
|
-
deployCodexConfig(opts());
|
|
1088
|
-
writeFileSync(join(worktree, CODEX_HOOKS_FILENAME), '{"hooks":{}}');
|
|
1089
|
-
deployCodexConfig(opts());
|
|
1090
|
-
expect(readFileSync(join(worktree, CODEX_HOOKS_FILENAME), 'utf-8')).toContain('git-mutation-guard.sh');
|
|
1091
|
-
});
|
|
1092
|
-
it('warns when the file Codex reads is over the cap, naming per-file sizes (S10)', () => {
|
|
1093
|
-
writeFileSync(join(worktree, 'AGENTS.md'), 'x'.repeat(PROJECT_DOC_MAX_BYTES + 1));
|
|
1094
|
-
const result = deployCodexConfig(opts());
|
|
1095
|
-
const warning = result.warnings.find((w) => w.includes('project_doc_max_bytes'));
|
|
1096
|
-
expect(warning).toMatch(/over the \d+-byte project_doc_max_bytes/);
|
|
1097
|
-
expect(warning).toMatch(/TRUNCATED silently/);
|
|
1098
|
-
expect(warning).toMatch(/Per-file sizes:/);
|
|
1099
|
-
expect(warning).toMatch(/\(read\)/);
|
|
1100
|
-
});
|
|
1101
|
-
it('surfaces the unmet hook-trust preconditions with the deployment', () => {
|
|
1102
|
-
const result = deployCodexConfig(opts());
|
|
1103
|
-
expect(result.trust.map((t) => t.id).sort()).toEqual(['hook-trust', 'project-trust']);
|
|
1104
|
-
});
|
|
1105
|
-
it('names the project-trust consequence as the WHOLE project config, not just hooks (S6)', () => {
|
|
1106
|
-
const trust = deployCodexConfig(opts()).trust.find((t) => t.id === 'project-trust');
|
|
1107
|
-
expect(trust?.detail).toMatch(/ENTIRE project-local configuration/);
|
|
1108
|
-
expect(trust?.detail).toMatch(/sandbox_mode, approval_policy and the MemNexus MCP server/);
|
|
1109
|
-
});
|
|
1110
|
-
it('warns by name for each MISSING guard script (S9)', () => {
|
|
1111
|
-
// The generated wrapper fails open when the script is absent, so a registered hook
|
|
1112
|
-
// with no script on disk is a guard that silently does nothing.
|
|
1113
|
-
const warnings = deployCodexConfig(opts()).warnings.join('\n');
|
|
1114
|
-
for (const script of PHASE1_PORTED_GUARDS) {
|
|
1115
|
-
expect(warnings).toContain(`Guard script .claude/hooks/${script} is MISSING`);
|
|
1116
|
-
}
|
|
1117
|
-
});
|
|
1118
|
-
it('does not warn about guard scripts that are present', () => {
|
|
1119
|
-
mkdirSync(join(worktree, '.claude', 'hooks'), { recursive: true });
|
|
1120
|
-
for (const script of PHASE1_PORTED_GUARDS) {
|
|
1121
|
-
writeFileSync(join(worktree, '.claude', 'hooks', script), '#!/bin/bash\nexit 0\n');
|
|
1122
|
-
}
|
|
1123
|
-
expect(deployCodexConfig(opts()).warnings.join('\n')).not.toMatch(/Guard script .* is MISSING/);
|
|
1124
|
-
});
|
|
1125
|
-
it('warns when there is no canonical AGENTS.md to fold into the override', () => {
|
|
1126
|
-
expect(deployCodexConfig(opts()).warnings.join('\n')).toMatch(/this session gets isolation context and behavioral markers but NO canonical instructions/);
|
|
1127
|
-
});
|
|
1128
|
-
/**
|
|
1129
|
-
* REPLACES 'threads provenGuards through to the SubagentStart gate' (#4864).
|
|
1130
|
-
*
|
|
1131
|
-
* That behaviour is now a defect, not a feature. Hook trust is keyed per entry and
|
|
1132
|
-
* bound to the entry's bytes, and the G-7 proof artifact is bound to the sha256 of
|
|
1133
|
-
* the whole file. If the deployed hooks.json carried the proven-guard list, then the
|
|
1134
|
-
* first launch after the guards were proven would write DIFFERENT bytes than the
|
|
1135
|
-
* human granted trust for — every entry untrusted, every guard inert, which is the
|
|
1136
|
-
* #4849 state reached by succeeding at G-7 — and the proof would be stale against
|
|
1137
|
-
* its own consequence, oscillating forever.
|
|
1138
|
-
*
|
|
1139
|
-
* MUTATION CHECK: restoring the `provenGuards` forwarding in deployCodexConfig makes
|
|
1140
|
-
* this fail.
|
|
1141
|
-
*/
|
|
1142
|
-
it('NEVER writes a proven-guard list into the deployed hooks.json — the bytes are fixed', () => {
|
|
1143
|
-
deployCodexConfig(opts());
|
|
1144
|
-
const text = readFileSync(join(worktree, CODEX_HOOKS_FILENAME), 'utf-8');
|
|
1145
|
-
expect(text).not.toContain('--proven-guards');
|
|
1146
|
-
// Byte-identical to the no-argument generator: the file is the same in every
|
|
1147
|
-
// worktree, so one human trust grant covers the fleet.
|
|
1148
|
-
expect(text).toBe(buildCodexHooksJson({ worktreePath: worktree }));
|
|
1149
|
-
});
|
|
1150
|
-
});
|
|
1151
|
-
/**
|
|
1152
|
-
* ─── writable_roots: the git directory lives OUTSIDE the worktree ───────────────
|
|
1153
|
-
*
|
|
1154
|
-
* A live Codex session on 2026-07-31 could not run `git stash`:
|
|
1155
|
-
* "Unable to create '/workspace/.git/worktrees/<name>/index.lock': Read-only file
|
|
1156
|
-
* system". `sandbox_mode = "workspace-write"` with no [sandbox_workspace_write]
|
|
1157
|
-
* section makes the session directory the only writable root, and a worktree's `.git`
|
|
1158
|
-
* is a pointer file to a directory outside it — so every git write failed.
|
|
1159
|
-
*
|
|
1160
|
-
* THE FIRST FIX — one root, the git dir — DID NOT WORK AND WAS UNSAFE. Direct
|
|
1161
|
-
* observation of the sandbox mount table (`codex sandbox`, real sandbox, no model
|
|
1162
|
-
* call) showed Codex re-binds `<common>/worktrees/<name>` READ-ONLY after applying
|
|
1163
|
-
* writable_roots, so the nested path a parent root was supposed to cover came back
|
|
1164
|
-
* read-only and index.lock still failed. The same root also granted write to
|
|
1165
|
-
* `<common>/hooks`, whose contents execute OUTSIDE the sandbox on the next git
|
|
1166
|
-
* command — a sandbox escape.
|
|
1167
|
-
*
|
|
1168
|
-
* These tests are the regression gate for the corrected, least-privilege set. Two
|
|
1169
|
-
* MUTATION CHECKS below re-create the two ways this can regress — a `hooks`-granting
|
|
1170
|
-
* root, and a dropped per-worktree admin path — and prove the assertions REJECT them,
|
|
1171
|
-
* so a test that would pass with the fix undone cannot masquerade as coverage.
|
|
1172
|
-
*/
|
|
1173
|
-
/** Run git for test fixtures. Identity is passed per-invocation, never written to a global config. */
|
|
1174
|
-
function git(cwd, ...args) {
|
|
1175
|
-
const r = spawnSync('git', ['-c', 'user.name=t', '-c', 'user.email=t@example.invalid', '-c', 'commit.gpgsign=false', '-C', cwd, ...args], { encoding: 'utf-8', stdio: 'pipe' });
|
|
1176
|
-
if (r.status !== 0)
|
|
1177
|
-
throw new Error(`git ${args.join(' ')} failed: ${r.stderr}`);
|
|
1178
|
-
}
|
|
1179
|
-
/** Parse `writable_roots = [...]` out of a generated config, or null when absent. */
|
|
1180
|
-
function parseWritableRoots(toml) {
|
|
1181
|
-
const section = toml.split(/^\[sandbox_workspace_write\]$/m)[1];
|
|
1182
|
-
if (section === undefined)
|
|
1183
|
-
return null;
|
|
1184
|
-
const line = section.split(/^\[/m)[0].match(/^writable_roots = \[(.*)\]$/m);
|
|
1185
|
-
if (!line)
|
|
1186
|
-
return null;
|
|
1187
|
-
return [...line[1].matchAll(/"((?:[^"\\]|\\.)*)"/g)].map((m) => m[1].replace(/\\(.)/g, '$1'));
|
|
1188
|
-
}
|
|
1189
|
-
/**
|
|
1190
|
-
* The path-coverage question Codex asks, reproduced without Codex: under
|
|
1191
|
-
* `workspace-write`, a write is permitted when the target sits inside the session
|
|
1192
|
-
* directory or inside a declared writable root.
|
|
1193
|
-
*/
|
|
1194
|
-
function wouldPermitWrite(toml, sessionDir, target) {
|
|
1195
|
-
const roots = [sessionDir, ...(parseWritableRoots(toml) ?? [])];
|
|
1196
|
-
return roots.some((r) => target === r || target.startsWith(r.endsWith('/') ? r : `${r}/`));
|
|
1197
|
-
}
|
|
1198
|
-
describe('buildCodexConfigToml — writable_roots covers the git directory', () => {
|
|
1199
|
-
let repo;
|
|
1200
|
-
beforeEach(() => {
|
|
1201
|
-
repo = realpathSync(mkdtempSync(join(tmpdir(), 'mx-codex-repo-')));
|
|
1202
|
-
git(repo, 'init', '-q', '-b', 'main');
|
|
1203
|
-
writeFileSync(join(repo, 'f.txt'), 'x');
|
|
1204
|
-
git(repo, 'add', 'f.txt');
|
|
1205
|
-
git(repo, 'commit', '-qm', 'init');
|
|
1206
|
-
});
|
|
1207
|
-
afterEach(() => {
|
|
1208
|
-
rmSync(repo, { recursive: true, force: true });
|
|
1209
|
-
});
|
|
1210
|
-
describe('linked worktree — the shape every agent team runs in', () => {
|
|
1211
|
-
let wt;
|
|
1212
|
-
beforeEach(() => {
|
|
1213
|
-
wt = join(repo, 'wt-linked');
|
|
1214
|
-
git(repo, 'worktree', 'add', '-q', '-b', 'feature', wt);
|
|
1215
|
-
// The defining property: .git is a POINTER FILE, not a directory.
|
|
1216
|
-
expect(statSync(join(wt, '.git')).isFile()).toBe(true);
|
|
1217
|
-
});
|
|
1218
|
-
it('emits exactly the four least-privilege roots — three common subdirs + the admin dir', () => {
|
|
1219
|
-
const toml = buildCodexConfigToml({ projectRoot: root, worktreePath: wt });
|
|
1220
|
-
expect(toml).toContain('[sandbox_workspace_write]');
|
|
1221
|
-
expect(parseWritableRoots(toml)).toEqual([
|
|
1222
|
-
join(repo, '.git', 'objects'),
|
|
1223
|
-
join(repo, '.git', 'refs'),
|
|
1224
|
-
join(repo, '.git', 'logs'),
|
|
1225
|
-
join(repo, '.git', 'worktrees', 'wt-linked'),
|
|
1226
|
-
]);
|
|
1227
|
-
});
|
|
1228
|
-
it('NEVER emits the git dir or the common dir itself — that is the hooks escape', () => {
|
|
1229
|
-
const roots = parseWritableRoots(buildCodexConfigToml({ projectRoot: root, worktreePath: wt })) ?? [];
|
|
1230
|
-
expect(roots).not.toContain(join(repo, '.git'));
|
|
1231
|
-
// …so `<common>/hooks` — the ONLY hooks directory git actually runs, since `hooks`
|
|
1232
|
-
// is a git COMMON path even for a linked worktree — stays read-only. That is the
|
|
1233
|
-
// whole point: a file there executes outside the sandbox on the next git command.
|
|
1234
|
-
const toml = buildCodexConfigToml({ projectRoot: root, worktreePath: wt });
|
|
1235
|
-
expect(wouldPermitWrite(toml, wt, join(repo, '.git', 'hooks', 'post-commit'))).toBe(false);
|
|
1236
|
-
// Proof that the common dir is where hooks resolve, so the writable admin dir is
|
|
1237
|
-
// not an equivalent grant: git reports the common path for `hooks`.
|
|
1238
|
-
const hooksPath = spawnSync('git', ['-C', wt, 'rev-parse', '--git-path', 'hooks'], {
|
|
1239
|
-
encoding: 'utf-8',
|
|
1240
|
-
}).stdout.trim();
|
|
1241
|
-
expect(resolve(wt, hooksPath)).toBe(join(repo, '.git', 'hooks'));
|
|
1242
|
-
});
|
|
1243
|
-
it('permits the exact write that failed live: <common>/worktrees/<name>/index.lock', () => {
|
|
1244
|
-
const toml = buildCodexConfigToml({ projectRoot: root, worktreePath: wt });
|
|
1245
|
-
const indexLock = join(repo, '.git', 'worktrees', 'wt-linked', 'index.lock');
|
|
1246
|
-
expect(existsSync(join(repo, '.git', 'worktrees', 'wt-linked'))).toBe(true);
|
|
1247
|
-
expect(wouldPermitWrite(toml, wt, indexLock)).toBe(true);
|
|
1248
|
-
});
|
|
1249
|
-
it('MUTATION CHECK (no-section) — the assertions FAIL against the original pre-fix config', () => {
|
|
1250
|
-
// The generator as it first shipped: identical except the section is absent. If
|
|
1251
|
-
// this block ever passes, the tests above are not testing what they claim to.
|
|
1252
|
-
const toml = buildCodexConfigToml({ projectRoot: root, worktreePath: wt });
|
|
1253
|
-
const preFix = toml.replace(/# Git write boundary[\s\S]*?\n\n/, '');
|
|
1254
|
-
expect(preFix).not.toContain('[sandbox_workspace_write]');
|
|
1255
|
-
expect(parseWritableRoots(preFix)).toBeNull();
|
|
1256
|
-
expect(wouldPermitWrite(preFix, wt, join(repo, '.git', 'worktrees', 'wt-linked', 'index.lock'))).toBe(false);
|
|
1257
|
-
// And the fixed config differs from it — i.e. the section really is emitted.
|
|
1258
|
-
expect(toml).not.toBe(preFix);
|
|
1259
|
-
});
|
|
1260
|
-
it('MUTATION CHECK (hooks) — a root that grants hooks/ is rejected, not emitted', () => {
|
|
1261
|
-
// Re-create the broad-root config that "fixed" the stash failure. Two things must
|
|
1262
|
-
// hold: the hooks-coverage assertion catches it, and the code refuses to build it.
|
|
1263
|
-
const broad = buildCodexConfigToml({ projectRoot: root, worktreePath: wt }).replace(/^writable_roots = \[.*\]$/m, `writable_roots = ["${join(repo, '.git')}"]`);
|
|
1264
|
-
expect(wouldPermitWrite(broad, wt, join(repo, '.git', 'hooks', 'post-commit'))).toBe(true);
|
|
1265
|
-
expect(() => assertNoHooksGrant([join(repo, '.git')], [join(repo, '.git')])).toThrow(/sandbox escape/);
|
|
1266
|
-
// A subdir root is fine; the git-dir root is not — the discriminator is real.
|
|
1267
|
-
expect(() => assertNoHooksGrant([join(repo, '.git', 'objects')], [join(repo, '.git')])).not.toThrow();
|
|
1268
|
-
});
|
|
1269
|
-
it('MUTATION CHECK (dropped admin dir) — the exact bug being fixed is caught', () => {
|
|
1270
|
-
// Drop `<common>/worktrees/<name>` from the emitted set, which is what relying on
|
|
1271
|
-
// the parent root amounted to. index.lock must then be denied.
|
|
1272
|
-
const toml = buildCodexConfigToml({ projectRoot: root, worktreePath: wt });
|
|
1273
|
-
const adminDir = join(repo, '.git', 'worktrees', 'wt-linked');
|
|
1274
|
-
const dropped = toml.replace(new RegExp(`,\\s*"${adminDir.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}"`), '');
|
|
1275
|
-
expect(parseWritableRoots(dropped)).not.toContain(adminDir);
|
|
1276
|
-
expect(wouldPermitWrite(dropped, wt, join(adminDir, 'index.lock'))).toBe(false);
|
|
1277
|
-
// The real config still permits it — so the mutation, not the fixture, is the cause.
|
|
1278
|
-
expect(wouldPermitWrite(toml, wt, join(adminDir, 'index.lock'))).toBe(true);
|
|
1279
|
-
});
|
|
1280
|
-
it('covers objects, refs and refs/stash — commit, branch and stash, not just staging', () => {
|
|
1281
|
-
const toml = buildCodexConfigToml({ projectRoot: root, worktreePath: wt });
|
|
1282
|
-
for (const p of [
|
|
1283
|
-
join(repo, '.git', 'objects', 'ab', 'cdef'),
|
|
1284
|
-
join(repo, '.git', 'refs', 'heads', 'feature'),
|
|
1285
|
-
join(repo, '.git', 'refs', 'stash'),
|
|
1286
|
-
join(repo, '.git', 'logs', 'HEAD'),
|
|
1287
|
-
join(repo, '.git', 'worktrees', 'wt-linked', 'index.lock'),
|
|
1288
|
-
join(repo, '.git', 'worktrees', 'wt-linked', 'HEAD'),
|
|
1289
|
-
join(repo, '.git', 'worktrees', 'wt-linked', 'rebase-merge', 'done'),
|
|
1290
|
-
]) {
|
|
1291
|
-
expect(wouldPermitWrite(toml, wt, p)).toBe(true);
|
|
1292
|
-
}
|
|
1293
|
-
});
|
|
1294
|
-
it('KNOWN GAP — packed-refs at the git-dir top level is NOT writable', () => {
|
|
1295
|
-
// Documented limitation, asserted so it cannot change unnoticed: `git gc` and
|
|
1296
|
-
// `git pack-refs` will fail in a Codex session. Covering it means granting the
|
|
1297
|
-
// git-dir top level, which reopens the hooks escape. Decision item, not a bug fix.
|
|
1298
|
-
const toml = buildCodexConfigToml({ projectRoot: root, worktreePath: wt });
|
|
1299
|
-
expect(wouldPermitWrite(toml, wt, join(repo, '.git', 'packed-refs'))).toBe(false);
|
|
1300
|
-
});
|
|
1301
|
-
it('does not grant write to the main working tree, its siblings, or another team\'s gitdir', () => {
|
|
1302
|
-
const toml = buildCodexConfigToml({ projectRoot: root, worktreePath: wt });
|
|
1303
|
-
expect(wouldPermitWrite(toml, wt, join(repo, 'f.txt'))).toBe(false);
|
|
1304
|
-
expect(wouldPermitWrite(toml, wt, join(repo, 'other-worktree', 'secrets'))).toBe(false);
|
|
1305
|
-
expect(wouldPermitWrite(toml, wt, join(repo, '.github', 'workflows', 'ci.yml'))).toBe(false);
|
|
1306
|
-
// The broad root granted this; the narrow set must not.
|
|
1307
|
-
expect(wouldPermitWrite(toml, wt, join(repo, '.git', 'worktrees', 'other-team', 'index'))).toBe(false);
|
|
1308
|
-
expect(wouldPermitWrite(toml, wt, join(repo, '.git', 'config'))).toBe(false);
|
|
1309
|
-
});
|
|
1310
|
-
it('keeps every previously declared setting exactly as it was', () => {
|
|
1311
|
-
const toml = buildCodexConfigToml({ projectRoot: root, worktreePath: wt });
|
|
1312
|
-
expect(toml).toContain(`sandbox_mode = "${CODEX_SANDBOX_MODE}"`);
|
|
1313
|
-
expect(toml).toContain(`approval_policy = "${CODEX_APPROVAL_POLICY}"`);
|
|
1314
|
-
expect(toml).toContain(`project_doc_max_bytes = ${PROJECT_DOC_MAX_BYTES}`);
|
|
1315
|
-
expect(toml).toContain('project_doc_fallback_filenames = ["CLAUDE.md"]');
|
|
1316
|
-
expect(toml).toContain('[mcp_servers.memnexus]');
|
|
1317
|
-
// Widening writable_roots is the fix; weakening the sandbox is not.
|
|
1318
|
-
expect(toml).not.toContain('danger-full-access');
|
|
1319
|
-
});
|
|
1320
|
-
it('puts every top-level key before the first table header (valid TOML)', () => {
|
|
1321
|
-
const toml = buildCodexConfigToml({ projectRoot: root, worktreePath: wt });
|
|
1322
|
-
const lines = toml.split('\n').filter((l) => l.trim() !== '' && !l.trim().startsWith('#'));
|
|
1323
|
-
const firstTable = lines.findIndex((l) => l.startsWith('['));
|
|
1324
|
-
const strayKey = lines.findIndex((l, i) => i > firstTable && /^(model|sandbox_mode|approval_policy|project_doc)/.test(l));
|
|
1325
|
-
expect(firstTable).toBeGreaterThan(0);
|
|
1326
|
-
expect(strayKey).toBe(-1);
|
|
1327
|
-
// ... and the sandbox table precedes the MCP table, each key under its own header.
|
|
1328
|
-
expect(lines.indexOf('[sandbox_workspace_write]')).toBeLessThan(lines.indexOf('[mcp_servers.memnexus]'));
|
|
1329
|
-
});
|
|
1330
|
-
});
|
|
1331
|
-
describe('plain repository — `mx-agent new project` outside this monorepo', () => {
|
|
1332
|
-
it('emits three roots and NO worktrees entry — git dir and common dir are the same', () => {
|
|
1333
|
-
// Codex read-only-binds a `.git` directory inside the working tree too (verified
|
|
1334
|
-
// on 0.145.0), so a plain clone needs these roots exactly as a worktree does.
|
|
1335
|
-
expect(statSync(join(repo, '.git')).isDirectory()).toBe(true);
|
|
1336
|
-
const toml = buildCodexConfigToml({ projectRoot: root, worktreePath: repo });
|
|
1337
|
-
expect(parseWritableRoots(toml)).toEqual([
|
|
1338
|
-
join(repo, '.git', 'objects'),
|
|
1339
|
-
join(repo, '.git', 'refs'),
|
|
1340
|
-
join(repo, '.git', 'logs'),
|
|
1341
|
-
]);
|
|
1342
|
-
expect(parseWritableRoots(toml)).not.toContain(join(repo, '.git'));
|
|
1343
|
-
expect(wouldPermitWrite(toml, join(repo, 'src'), join(repo, '.git', 'objects', 'ab', 'cd'))).toBe(true);
|
|
1344
|
-
expect(wouldPermitWrite(toml, join(repo, 'src'), join(repo, '.git', 'hooks', 'post-commit'))).toBe(false);
|
|
1345
|
-
});
|
|
1346
|
-
});
|
|
1347
|
-
describe('resolveGitWritableRoots', () => {
|
|
1348
|
-
it('emits the per-worktree admin dir explicitly rather than relying on its parent', () => {
|
|
1349
|
-
const wt = join(repo, 'wt2');
|
|
1350
|
-
git(repo, 'worktree', 'add', '-q', '-b', 'f2', wt);
|
|
1351
|
-
const { roots, diagnostics } = resolveGitWritableRoots(wt);
|
|
1352
|
-
expect(roots).toEqual([
|
|
1353
|
-
join(repo, '.git', 'objects'),
|
|
1354
|
-
join(repo, '.git', 'refs'),
|
|
1355
|
-
join(repo, '.git', 'logs'),
|
|
1356
|
-
join(repo, '.git', 'worktrees', 'wt2'),
|
|
1357
|
-
]);
|
|
1358
|
-
expect(roots).not.toContain(join(repo, '.git'));
|
|
1359
|
-
expect(diagnostics).toEqual([]);
|
|
1360
|
-
});
|
|
1361
|
-
it('resolves from the .git pointer file when git itself cannot answer', () => {
|
|
1362
|
-
// Detached copy: a `gitdir:` pointer with no reachable repository, so `git
|
|
1363
|
-
// rev-parse` fails and the file-reading fallback is the only path left.
|
|
1364
|
-
const orphan = mkdtempSync(join(tmpdir(), 'mx-codex-orphan-'));
|
|
1365
|
-
writeFileSync(join(orphan, '.git'), `gitdir: ${join(repo, '.git', 'worktrees', 'gone')}\n`);
|
|
1366
|
-
const { roots } = resolveGitWritableRoots(orphan);
|
|
1367
|
-
expect(roots).toEqual([
|
|
1368
|
-
join(repo, '.git', 'objects'),
|
|
1369
|
-
join(repo, '.git', 'refs'),
|
|
1370
|
-
join(repo, '.git', 'logs'),
|
|
1371
|
-
join(repo, '.git', 'worktrees', 'gone'),
|
|
1372
|
-
]);
|
|
1373
|
-
expect(roots).not.toContain(join(repo, '.git'));
|
|
1374
|
-
rmSync(orphan, { recursive: true, force: true });
|
|
1375
|
-
});
|
|
1376
|
-
it('warns instead of silently emitting nothing when resolution fails', () => {
|
|
1377
|
-
// The pre-fix failure mode was silence. A directory that is not a repository must
|
|
1378
|
-
// produce a warning naming the consequence.
|
|
1379
|
-
const notARepo = mkdtempSync(join(tmpdir(), 'mx-codex-norepo-'));
|
|
1380
|
-
const { roots, diagnostics } = resolveGitWritableRoots(notARepo);
|
|
1381
|
-
expect(roots).toEqual([]);
|
|
1382
|
-
expect(diagnostics).toHaveLength(1);
|
|
1383
|
-
expect(diagnostics[0].level).toBe('warn');
|
|
1384
|
-
expect(diagnostics[0].code).toBe('codex-git-dir-unresolved');
|
|
1385
|
-
expect(diagnostics[0].message).toMatch(/every git write .* will fail/);
|
|
1386
|
-
rmSync(notARepo, { recursive: true, force: true });
|
|
1387
|
-
});
|
|
1388
|
-
});
|
|
1389
|
-
describe('deployCodexConfig', () => {
|
|
1390
|
-
it('writes the section for the worktree it deploys into, not the project root', () => {
|
|
1391
|
-
const wt = join(repo, 'wt3');
|
|
1392
|
-
git(repo, 'worktree', 'add', '-q', '-b', 'f3', wt);
|
|
1393
|
-
deployCodexConfig({ projectRoot: root, worktreePath: wt, worktreeName: 'wt3', branch: 'f3', slot: 0 });
|
|
1394
|
-
const toml = readFileSync(join(wt, CODEX_CONFIG_FILENAME), 'utf-8');
|
|
1395
|
-
expect(parseWritableRoots(toml)).toEqual([
|
|
1396
|
-
join(repo, '.git', 'objects'),
|
|
1397
|
-
join(repo, '.git', 'refs'),
|
|
1398
|
-
join(repo, '.git', 'logs'),
|
|
1399
|
-
join(repo, '.git', 'worktrees', 'wt3'),
|
|
1400
|
-
]);
|
|
1401
|
-
});
|
|
1402
|
-
it('surfaces the unresolved-git-dir warning to the launch banner', () => {
|
|
1403
|
-
const result = deployCodexConfig({
|
|
1404
|
-
projectRoot: root,
|
|
1405
|
-
worktreePath: worktree, // a bare temp dir: not a git repository
|
|
1406
|
-
worktreeName: 'demo',
|
|
1407
|
-
branch: null,
|
|
1408
|
-
slot: 0,
|
|
1409
|
-
});
|
|
1410
|
-
expect(result.warnings.join('\n')).toMatch(/Could not resolve the git directory/);
|
|
1411
|
-
});
|
|
1412
|
-
});
|
|
1413
|
-
});
|
|
1414
|
-
describe('version pinning', () => {
|
|
1415
|
-
it('pins the Codex version whose behaviour was probed for this adapter', () => {
|
|
1416
|
-
// Bumping this constant without re-running the hook/sandbox/stdin probes is the
|
|
1417
|
-
// defect that let the 0.142.4 → 0.145.0 sandbox change remove containment.
|
|
1418
|
-
expect(VERIFIED_CODEX_VERSION).toBe('0.145.0');
|
|
1419
|
-
});
|
|
1420
|
-
});
|
|
1421
|
-
//# sourceMappingURL=runtime-codex-config.test.js.map
|