@lannguyensi/harness 0.64.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +64 -0
- package/README.md +46 -42
- package/dist/cli/add/index.js +17 -21
- package/dist/cli/add/index.js.map +1 -1
- package/dist/cli/adopt/derive.d.ts +2 -2
- package/dist/cli/adopt/derive.js +2 -19
- package/dist/cli/adopt/derive.js.map +1 -1
- package/dist/cli/adopt/index.d.ts +1 -1
- package/dist/cli/adopt/index.js +1 -12
- package/dist/cli/adopt/index.js.map +1 -1
- package/dist/cli/apply/apply.d.ts +20 -35
- package/dist/cli/apply/apply.js +61 -136
- package/dist/cli/apply/apply.js.map +1 -1
- package/dist/cli/apply/generate-codex-config.js +10 -58
- package/dist/cli/apply/generate-codex-config.js.map +1 -1
- package/dist/cli/apply/generate-memory-index.js +1 -2
- package/dist/cli/apply/generate-memory-index.js.map +1 -1
- package/dist/cli/apply/generate-opencode-config.d.ts +2 -10
- package/dist/cli/apply/generate-opencode-config.js +74 -113
- package/dist/cli/apply/generate-opencode-config.js.map +1 -1
- package/dist/cli/apply/generate-settings.d.ts +11 -64
- package/dist/cli/apply/generate-settings.js +27 -132
- package/dist/cli/apply/generate-settings.js.map +1 -1
- package/dist/cli/apply/index.d.ts +1 -1
- package/dist/cli/apply/index.js +1 -1
- package/dist/cli/apply/index.js.map +1 -1
- package/dist/cli/apply/install-codex-config.d.ts +153 -1
- package/dist/cli/apply/install-codex-config.js +445 -70
- package/dist/cli/apply/install-codex-config.js.map +1 -1
- package/dist/cli/apply/next-steps.d.ts +7 -0
- package/dist/cli/apply/next-steps.js +13 -1
- package/dist/cli/apply/next-steps.js.map +1 -1
- package/dist/cli/bounded-stdin.d.ts +0 -23
- package/dist/cli/bounded-stdin.js +2 -49
- package/dist/cli/bounded-stdin.js.map +1 -1
- package/dist/cli/describe.d.ts +1 -1
- package/dist/cli/describe.js +0 -3
- package/dist/cli/describe.js.map +1 -1
- package/dist/cli/diff/engine.d.ts +0 -11
- package/dist/cli/diff/engine.js +1 -17
- package/dist/cli/diff/engine.js.map +1 -1
- package/dist/cli/diff/index.js +14 -25
- package/dist/cli/diff/index.js.map +1 -1
- package/dist/cli/doctor/claude-mcp.d.ts +4 -19
- package/dist/cli/doctor/claude-mcp.js +11 -22
- package/dist/cli/doctor/claude-mcp.js.map +1 -1
- package/dist/cli/doctor/codex.d.ts +12 -14
- package/dist/cli/doctor/codex.js +31 -144
- package/dist/cli/doctor/codex.js.map +1 -1
- package/dist/cli/doctor/format.js +23 -345
- package/dist/cli/doctor/format.js.map +1 -1
- package/dist/cli/doctor/hook-liveness.d.ts +56 -0
- package/dist/cli/doctor/hook-liveness.js +455 -0
- package/dist/cli/doctor/hook-liveness.js.map +1 -0
- package/dist/cli/doctor/index.d.ts +13 -87
- package/dist/cli/doctor/index.js +57 -713
- package/dist/cli/doctor/index.js.map +1 -1
- package/dist/cli/doctor/opencode.d.ts +2 -1
- package/dist/cli/doctor/opencode.js.map +1 -1
- package/dist/cli/doctor/types.d.ts +21 -387
- package/dist/cli/doctor/types.js.map +1 -1
- package/dist/cli/drain-stdio.d.ts +31 -0
- package/dist/cli/drain-stdio.js +76 -0
- package/dist/cli/drain-stdio.js.map +1 -0
- package/dist/cli/export.d.ts +3 -1
- package/dist/cli/export.js +7 -16
- package/dist/cli/export.js.map +1 -1
- package/dist/cli/gate/codex-disable.d.ts +29 -0
- package/dist/cli/gate/codex-disable.js +195 -0
- package/dist/cli/gate/codex-disable.js.map +1 -0
- package/dist/cli/gate/codex-enable.d.ts +41 -0
- package/dist/cli/gate/codex-enable.js +127 -0
- package/dist/cli/gate/codex-enable.js.map +1 -0
- package/dist/cli/gate/codex-snapshot.d.ts +208 -0
- package/dist/cli/gate/codex-snapshot.js +402 -0
- package/dist/cli/gate/codex-snapshot.js.map +1 -0
- package/dist/cli/gate/disable.d.ts +9 -0
- package/dist/cli/gate/disable.js +263 -28
- package/dist/cli/gate/disable.js.map +1 -1
- package/dist/cli/gate/enable.d.ts +26 -6
- package/dist/cli/gate/enable.js +152 -80
- package/dist/cli/gate/enable.js.map +1 -1
- package/dist/cli/gate/link-chain.d.ts +53 -0
- package/dist/cli/gate/link-chain.js +122 -0
- package/dist/cli/gate/link-chain.js.map +1 -0
- package/dist/cli/gate/snapshot.d.ts +289 -12
- package/dist/cli/gate/snapshot.js +481 -22
- package/dist/cli/gate/snapshot.js.map +1 -1
- package/dist/cli/index.d.ts +0 -9
- package/dist/cli/index.js +9 -2131
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/init/composer.d.ts +3 -6
- package/dist/cli/init/composer.js +6 -370
- package/dist/cli/init/composer.js.map +1 -1
- package/dist/cli/init/dependencies.d.ts +1 -2
- package/dist/cli/init/dependencies.js +4 -80
- package/dist/cli/init/dependencies.js.map +1 -1
- package/dist/cli/init/detect.js +5 -4
- package/dist/cli/init/detect.js.map +1 -1
- package/dist/cli/init/interactive.d.ts +1 -23
- package/dist/cli/init/interactive.js +33 -247
- package/dist/cli/init/interactive.js.map +1 -1
- package/dist/cli/init/profiles.d.ts +2 -2
- package/dist/cli/init/profiles.js +51 -245
- package/dist/cli/init/profiles.js.map +1 -1
- package/dist/cli/init/templates.d.ts +2 -37
- package/dist/cli/init/templates.js +25 -1237
- package/dist/cli/init/templates.js.map +1 -1
- package/dist/cli/list.d.ts +1 -1
- package/dist/cli/list.js +1 -38
- package/dist/cli/list.js.map +1 -1
- package/dist/cli/loader.d.ts +15 -1
- package/dist/cli/loader.js +56 -39
- package/dist/cli/loader.js.map +1 -1
- package/dist/cli/main.js +7 -2
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/migrate-home/index.js +2 -2
- package/dist/cli/migrate-home/index.js.map +1 -1
- package/dist/cli/pack/add.js +1 -1
- package/dist/cli/pack/add.js.map +1 -1
- package/dist/cli/pack/hook-bootstrap.d.ts +5 -164
- package/dist/cli/pack/hook-bootstrap.js +15 -291
- package/dist/cli/pack/hook-bootstrap.js.map +1 -1
- package/dist/cli/pack/hook-branch-protection.d.ts +28 -21
- package/dist/cli/pack/hook-branch-protection.js +365 -340
- package/dist/cli/pack/hook-branch-protection.js.map +1 -1
- package/dist/cli/pack/index.d.ts +0 -1
- package/dist/cli/pack/index.js +0 -1
- package/dist/cli/pack/index.js.map +1 -1
- package/dist/cli/pack/list.js +1 -6
- package/dist/cli/pack/list.js.map +1 -1
- package/dist/cli/pack/mutate.d.ts +7 -9
- package/dist/cli/pack/mutate.js +6 -9
- package/dist/cli/pack/mutate.js.map +1 -1
- package/dist/cli/pack/reseed.d.ts +2 -2
- package/dist/cli/pack/reseed.js +16 -22
- package/dist/cli/pack/reseed.js.map +1 -1
- package/dist/cli/{delegate/register.d.ts → register-gate-group.d.ts} +1 -1
- package/dist/cli/register-gate-group.js +348 -0
- package/dist/cli/register-gate-group.js.map +1 -0
- package/dist/cli/register-inspect-group.d.ts +6 -0
- package/dist/cli/register-inspect-group.js +189 -0
- package/dist/cli/register-inspect-group.js.map +1 -0
- package/dist/cli/register-operator-lifecycle.d.ts +1 -1
- package/dist/cli/register-operator-lifecycle.js +3 -100
- package/dist/cli/register-operator-lifecycle.js.map +1 -1
- package/dist/cli/register-pack-group.d.ts +5 -0
- package/dist/cli/register-pack-group.js +134 -0
- package/dist/cli/register-pack-group.js.map +1 -0
- package/dist/cli/{register-audit-group.d.ts → register-setup-group.d.ts} +1 -1
- package/dist/cli/register-setup-group.js +495 -0
- package/dist/cli/register-setup-group.js.map +1 -0
- package/dist/cli/remove/index.d.ts +0 -14
- package/dist/cli/remove/index.js +2 -115
- package/dist/cli/remove/index.js.map +1 -1
- package/dist/cli/remove/mutate.d.ts +0 -2
- package/dist/cli/remove/mutate.js +1 -19
- package/dist/cli/remove/mutate.js.map +1 -1
- package/dist/cli/remove/register.js +2 -19
- package/dist/cli/remove/register.js.map +1 -1
- package/dist/cli/shell-quote.d.ts +7 -0
- package/dist/cli/shell-quote.js +17 -0
- package/dist/cli/shell-quote.js.map +1 -0
- package/dist/cli/uninstall/index.d.ts +4 -2
- package/dist/cli/uninstall/index.js +15 -7
- package/dist/cli/uninstall/index.js.map +1 -1
- package/dist/cli/uninstall/register.js +6 -4
- package/dist/cli/uninstall/register.js.map +1 -1
- package/dist/cli/uninstall/snapshot.d.ts +15 -0
- package/dist/cli/uninstall/snapshot.js +38 -0
- package/dist/cli/uninstall/snapshot.js.map +1 -1
- package/dist/cli/validate/checks.d.ts +0 -77
- package/dist/cli/validate/checks.js +3 -1049
- package/dist/cli/validate/checks.js.map +1 -1
- package/dist/cli/validate/index.js +19 -15
- package/dist/cli/validate/index.js.map +1 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.js +0 -3
- package/dist/index.js.map +1 -1
- package/dist/io/claude-mcp.d.ts +1 -1
- package/dist/io/claude-mcp.js +27 -14
- package/dist/io/claude-mcp.js.map +1 -1
- package/dist/io/harness-lock.js +2 -2
- package/dist/io/harness-lock.js.map +1 -1
- package/dist/io/lock.d.ts +0 -26
- package/dist/io/lock.js +10 -27
- package/dist/io/lock.js.map +1 -1
- package/dist/io/merge-settings.js +6 -4
- package/dist/io/merge-settings.js.map +1 -1
- package/dist/io/project-name.d.ts +22 -39
- package/dist/io/project-name.js +25 -42
- package/dist/io/project-name.js.map +1 -1
- package/dist/io/read-regular-file.d.ts +103 -40
- package/dist/io/read-regular-file.js +196 -35
- package/dist/io/read-regular-file.js.map +1 -1
- package/dist/io/restart-hints.js +3 -6
- package/dist/io/restart-hints.js.map +1 -1
- package/dist/io/version-compare.d.ts +1 -3
- package/dist/io/version-compare.js +1 -3
- package/dist/io/version-compare.js.map +1 -1
- package/dist/io/write-regular-file.d.ts +30 -0
- package/dist/io/write-regular-file.js +85 -0
- package/dist/io/write-regular-file.js.map +1 -0
- package/dist/overrides/index.d.ts +1 -0
- package/dist/overrides/index.js +1 -0
- package/dist/overrides/index.js.map +1 -1
- package/dist/overrides/merge-layers.d.ts +43 -0
- package/dist/overrides/merge-layers.js +76 -0
- package/dist/overrides/merge-layers.js.map +1 -0
- package/dist/overrides/merge.d.ts +16 -0
- package/dist/overrides/merge.js +21 -8
- package/dist/overrides/merge.js.map +1 -1
- package/dist/policy-packs/builtin/branch-protection-runtime.d.ts +4 -69
- package/dist/policy-packs/builtin/branch-protection-runtime.js +12 -84
- package/dist/policy-packs/builtin/branch-protection-runtime.js.map +1 -1
- package/dist/policy-packs/builtin/branch-protection.d.ts +7 -30
- package/dist/policy-packs/builtin/branch-protection.js +56 -89
- package/dist/policy-packs/builtin/branch-protection.js.map +1 -1
- package/dist/policy-packs/config-check.d.ts +7 -5
- package/dist/policy-packs/config-check.js +2 -2
- package/dist/policy-packs/config-check.js.map +1 -1
- package/dist/policy-packs/expand.d.ts +1 -3
- package/dist/policy-packs/expand.js +5 -42
- package/dist/policy-packs/expand.js.map +1 -1
- package/dist/policy-packs/index.d.ts +3 -3
- package/dist/policy-packs/index.js +2 -2
- package/dist/policy-packs/index.js.map +1 -1
- package/dist/policy-packs/registry.d.ts +9 -38
- package/dist/policy-packs/registry.js +5 -65
- package/dist/policy-packs/registry.js.map +1 -1
- package/dist/policy-packs/runtime.d.ts +0 -4
- package/dist/policy-packs/runtime.js +9 -22
- package/dist/policy-packs/runtime.js.map +1 -1
- package/dist/policy-packs/types.d.ts +0 -19
- package/dist/policy-packs/ux-compare.d.ts +1 -11
- package/dist/policy-packs/ux-compare.js +6 -42
- package/dist/policy-packs/ux-compare.js.map +1 -1
- package/dist/policy-packs/ux-drift-check.d.ts +5 -5
- package/dist/policy-packs/ux-drift-check.js +17 -22
- package/dist/policy-packs/ux-drift-check.js.map +1 -1
- package/dist/policy-packs/version-check.d.ts +5 -26
- package/dist/policy-packs/version-check.js +19 -74
- package/dist/policy-packs/version-check.js.map +1 -1
- package/dist/probes/memory.d.ts +1 -1
- package/dist/probes/memory.js +1 -1
- package/dist/probes/memory.js.map +1 -1
- package/dist/runtime/agent-facing.d.ts +9 -0
- package/dist/runtime/agent-facing.js +28 -14
- package/dist/runtime/agent-facing.js.map +1 -1
- package/dist/runtime/bounded-text.d.ts +15 -0
- package/dist/runtime/bounded-text.js +27 -0
- package/dist/runtime/bounded-text.js.map +1 -0
- package/dist/runtime/git-branch.d.ts +125 -0
- package/dist/runtime/git-branch.js +381 -0
- package/dist/runtime/git-branch.js.map +1 -0
- package/dist/runtime/hermetic-spawn-guard.d.ts +2 -2
- package/dist/runtime/hermetic-spawn-guard.js +24 -34
- package/dist/runtime/hermetic-spawn-guard.js.map +1 -1
- package/dist/runtime/home-dir.js +3 -2
- package/dist/runtime/home-dir.js.map +1 -1
- package/dist/runtime/tool-name-aliases.d.ts +0 -6
- package/dist/runtime/tool-name-aliases.js +5 -18
- package/dist/runtime/tool-name-aliases.js.map +1 -1
- package/dist/schema/grounding.d.ts +7 -54
- package/dist/schema/grounding.js +10 -12
- package/dist/schema/grounding.js.map +1 -1
- package/dist/schema/hooks.d.ts +39 -136
- package/dist/schema/hooks.js +3 -6
- package/dist/schema/hooks.js.map +1 -1
- package/dist/schema/index.d.ts +114 -3828
- package/dist/schema/index.js +41 -80
- package/dist/schema/index.js.map +1 -1
- package/dist/schema/memory.d.ts +54 -131
- package/dist/schema/memory.js +2 -2
- package/dist/schema/memory.js.map +1 -1
- package/dist/schema/policy-packs.d.ts +3 -45
- package/dist/schema/policy-packs.js +7 -13
- package/dist/schema/policy-packs.js.map +1 -1
- package/dist/schema/policy-ux.d.ts +7 -0
- package/dist/schema/policy-ux.js +18 -0
- package/dist/schema/policy-ux.js.map +1 -0
- package/dist/schema/removed-keys.d.ts +185 -0
- package/dist/schema/removed-keys.js +531 -0
- package/dist/schema/removed-keys.js.map +1 -0
- package/dist/schema/tools.d.ts +30 -268
- package/dist/schema/tools.js +4 -4
- package/dist/schema/tools.js.map +1 -1
- package/package.json +5 -16
- package/dist/cli/approve/branch-protection.d.ts +0 -69
- package/dist/cli/approve/branch-protection.js +0 -144
- package/dist/cli/approve/branch-protection.js.map +0 -1
- package/dist/cli/approve/risk.d.ts +0 -112
- package/dist/cli/approve/risk.js +0 -197
- package/dist/cli/approve/risk.js.map +0 -1
- package/dist/cli/approve/stdin-report.d.ts +0 -57
- package/dist/cli/approve/stdin-report.js +0 -145
- package/dist/cli/approve/stdin-report.js.map +0 -1
- package/dist/cli/approve/understanding.d.ts +0 -410
- package/dist/cli/approve/understanding.js +0 -996
- package/dist/cli/approve/understanding.js.map +0 -1
- package/dist/cli/audit.d.ts +0 -80
- package/dist/cli/audit.js +0 -252
- package/dist/cli/audit.js.map +0 -1
- package/dist/cli/delegate/index.d.ts +0 -76
- package/dist/cli/delegate/index.js +0 -444
- package/dist/cli/delegate/index.js.map +0 -1
- package/dist/cli/delegate/register.js +0 -90
- package/dist/cli/delegate/register.js.map +0 -1
- package/dist/cli/doctor/auto-approve-mode.d.ts +0 -37
- package/dist/cli/doctor/auto-approve-mode.js +0 -80
- package/dist/cli/doctor/auto-approve-mode.js.map +0 -1
- package/dist/cli/doctor/bypass-without-auto-approve.d.ts +0 -38
- package/dist/cli/doctor/bypass-without-auto-approve.js +0 -95
- package/dist/cli/doctor/bypass-without-auto-approve.js.map +0 -1
- package/dist/cli/doctor/codex-config-drift.d.ts +0 -28
- package/dist/cli/doctor/codex-config-drift.js +0 -240
- package/dist/cli/doctor/codex-config-drift.js.map +0 -1
- package/dist/cli/doctor/expire-on-tool-match.d.ts +0 -15
- package/dist/cli/doctor/expire-on-tool-match.js +0 -58
- package/dist/cli/doctor/expire-on-tool-match.js.map +0 -1
- package/dist/cli/doctor/rogue-ledger.d.ts +0 -53
- package/dist/cli/doctor/rogue-ledger.js +0 -153
- package/dist/cli/doctor/rogue-ledger.js.map +0 -1
- package/dist/cli/doctor/session-start-preflight-setup-version.d.ts +0 -83
- package/dist/cli/doctor/session-start-preflight-setup-version.js +0 -114
- package/dist/cli/doctor/session-start-preflight-setup-version.js.map +0 -1
- package/dist/cli/doctor/settings-drift.d.ts +0 -25
- package/dist/cli/doctor/settings-drift.js +0 -213
- package/dist/cli/doctor/settings-drift.js.map +0 -1
- package/dist/cli/doctor/toolchain-parity.d.ts +0 -63
- package/dist/cli/doctor/toolchain-parity.js +0 -154
- package/dist/cli/doctor/toolchain-parity.js.map +0 -1
- package/dist/cli/doctor/ug-auto-approvals.d.ts +0 -40
- package/dist/cli/doctor/ug-auto-approvals.js +0 -91
- package/dist/cli/doctor/ug-auto-approvals.js.map +0 -1
- package/dist/cli/doctor/ug-delegations.d.ts +0 -26
- package/dist/cli/doctor/ug-delegations.js +0 -121
- package/dist/cli/doctor/ug-delegations.js.map +0 -1
- package/dist/cli/doctor/ug-inflight.d.ts +0 -35
- package/dist/cli/doctor/ug-inflight.js +0 -57
- package/dist/cli/doctor/ug-inflight.js.map +0 -1
- package/dist/cli/doctor/understanding-mode-env.d.ts +0 -51
- package/dist/cli/doctor/understanding-mode-env.js +0 -98
- package/dist/cli/doctor/understanding-mode-env.js.map +0 -1
- package/dist/cli/dry-run.d.ts +0 -58
- package/dist/cli/dry-run.js +0 -283
- package/dist/cli/dry-run.js.map +0 -1
- package/dist/cli/enriched-event.d.ts +0 -35
- package/dist/cli/enriched-event.js +0 -60
- package/dist/cli/enriched-event.js.map +0 -1
- package/dist/cli/event-input.d.ts +0 -28
- package/dist/cli/event-input.js +0 -73
- package/dist/cli/event-input.js.map +0 -1
- package/dist/cli/explain-action.d.ts +0 -25
- package/dist/cli/explain-action.js +0 -57
- package/dist/cli/explain-action.js.map +0 -1
- package/dist/cli/explain-policy.d.ts +0 -147
- package/dist/cli/explain-policy.js +0 -248
- package/dist/cli/explain-policy.js.map +0 -1
- package/dist/cli/explain.d.ts +0 -31
- package/dist/cli/explain.js +0 -159
- package/dist/cli/explain.js.map +0 -1
- package/dist/cli/gc/index.d.ts +0 -63
- package/dist/cli/gc/index.js +0 -566
- package/dist/cli/gc/index.js.map +0 -1
- package/dist/cli/pack/approve-escape.d.ts +0 -19
- package/dist/cli/pack/approve-escape.js +0 -190
- package/dist/cli/pack/approve-escape.js.map +0 -1
- package/dist/cli/pack/auto-approve-path.d.ts +0 -146
- package/dist/cli/pack/auto-approve-path.js +0 -462
- package/dist/cli/pack/auto-approve-path.js.map +0 -1
- package/dist/cli/pack/hook-codex-post-tool-use.d.ts +0 -25
- package/dist/cli/pack/hook-codex-post-tool-use.js +0 -160
- package/dist/cli/pack/hook-codex-post-tool-use.js.map +0 -1
- package/dist/cli/pack/hook-codex-pre-tool-use.d.ts +0 -48
- package/dist/cli/pack/hook-codex-pre-tool-use.js +0 -474
- package/dist/cli/pack/hook-codex-pre-tool-use.js.map +0 -1
- package/dist/cli/pack/hook-codex-stop.d.ts +0 -35
- package/dist/cli/pack/hook-codex-stop.js +0 -329
- package/dist/cli/pack/hook-codex-stop.js.map +0 -1
- package/dist/cli/pack/hook-codex-user-prompt-submit.d.ts +0 -24
- package/dist/cli/pack/hook-codex-user-prompt-submit.js +0 -93
- package/dist/cli/pack/hook-codex-user-prompt-submit.js.map +0 -1
- package/dist/cli/pack/hook-post-merge-gate-record.d.ts +0 -37
- package/dist/cli/pack/hook-post-merge-gate-record.js +0 -190
- package/dist/cli/pack/hook-post-merge-gate-record.js.map +0 -1
- package/dist/cli/pack/hook-post-merge-gate.d.ts +0 -34
- package/dist/cli/pack/hook-post-merge-gate.js +0 -277
- package/dist/cli/pack/hook-post-merge-gate.js.map +0 -1
- package/dist/cli/pack/hook-post-tool-use.d.ts +0 -45
- package/dist/cli/pack/hook-post-tool-use.js +0 -137
- package/dist/cli/pack/hook-post-tool-use.js.map +0 -1
- package/dist/cli/pack/hook-pre-tool-use.d.ts +0 -92
- package/dist/cli/pack/hook-pre-tool-use.js +0 -1328
- package/dist/cli/pack/hook-pre-tool-use.js.map +0 -1
- package/dist/cli/pack/hook-runtime-reality.d.ts +0 -63
- package/dist/cli/pack/hook-runtime-reality.js +0 -210
- package/dist/cli/pack/hook-runtime-reality.js.map +0 -1
- package/dist/cli/pack/hook-solution-acceptance-writeguard.d.ts +0 -32
- package/dist/cli/pack/hook-solution-acceptance-writeguard.js +0 -438
- package/dist/cli/pack/hook-solution-acceptance-writeguard.js.map +0 -1
- package/dist/cli/pack/hook-solution-acceptance.d.ts +0 -157
- package/dist/cli/pack/hook-solution-acceptance.js +0 -530
- package/dist/cli/pack/hook-solution-acceptance.js.map +0 -1
- package/dist/cli/pack/hook-stay-in-scope.d.ts +0 -37
- package/dist/cli/pack/hook-stay-in-scope.js +0 -128
- package/dist/cli/pack/hook-stay-in-scope.js.map +0 -1
- package/dist/cli/pack/hook-subagent-start.d.ts +0 -23
- package/dist/cli/pack/hook-subagent-start.js +0 -88
- package/dist/cli/pack/hook-subagent-start.js.map +0 -1
- package/dist/cli/pack/hook-subagent-stop.d.ts +0 -19
- package/dist/cli/pack/hook-subagent-stop.js +0 -41
- package/dist/cli/pack/hook-subagent-stop.js.map +0 -1
- package/dist/cli/pack/hook-track-active-claim.d.ts +0 -27
- package/dist/cli/pack/hook-track-active-claim.js +0 -275
- package/dist/cli/pack/hook-track-active-claim.js.map +0 -1
- package/dist/cli/pack/transcript-report-scan.d.ts +0 -71
- package/dist/cli/pack/transcript-report-scan.js +0 -359
- package/dist/cli/pack/transcript-report-scan.js.map +0 -1
- package/dist/cli/pack/understanding-report-schema-hint.d.ts +0 -26
- package/dist/cli/pack/understanding-report-schema-hint.js +0 -120
- package/dist/cli/pack/understanding-report-schema-hint.js.map +0 -1
- package/dist/cli/pack/upgrade.d.ts +0 -32
- package/dist/cli/pack/upgrade.js +0 -273
- package/dist/cli/pack/upgrade.js.map +0 -1
- package/dist/cli/pause/index.d.ts +0 -113
- package/dist/cli/pause/index.js +0 -251
- package/dist/cli/pause/index.js.map +0 -1
- package/dist/cli/pause-check.d.ts +0 -22
- package/dist/cli/pause-check.js +0 -54
- package/dist/cli/pause-check.js.map +0 -1
- package/dist/cli/policy/intercept.d.ts +0 -233
- package/dist/cli/policy/intercept.js +0 -1022
- package/dist/cli/policy/intercept.js.map +0 -1
- package/dist/cli/policy/risk-envelope-enrichment.d.ts +0 -40
- package/dist/cli/policy/risk-envelope-enrichment.js +0 -110
- package/dist/cli/policy/risk-envelope-enrichment.js.map +0 -1
- package/dist/cli/record/index.d.ts +0 -81
- package/dist/cli/record/index.js +0 -348
- package/dist/cli/record/index.js.map +0 -1
- package/dist/cli/register-audit-group.js +0 -91
- package/dist/cli/register-audit-group.js.map +0 -1
- package/dist/cli/resolve-env.d.ts +0 -32
- package/dist/cli/resolve-env.js +0 -46
- package/dist/cli/resolve-env.js.map +0 -1
- package/dist/cli/session-export/index.d.ts +0 -46
- package/dist/cli/session-export/index.js +0 -169
- package/dist/cli/session-export/index.js.map +0 -1
- package/dist/cli/session-export/redact.d.ts +0 -22
- package/dist/cli/session-export/redact.js +0 -47
- package/dist/cli/session-export/redact.js.map +0 -1
- package/dist/cli/session-export/transcript.d.ts +0 -24
- package/dist/cli/session-export/transcript.js +0 -164
- package/dist/cli/session-export/transcript.js.map +0 -1
- package/dist/cli/session-start/branch-check.d.ts +0 -18
- package/dist/cli/session-start/branch-check.js +0 -140
- package/dist/cli/session-start/branch-check.js.map +0 -1
- package/dist/cli/session-start/index.d.ts +0 -121
- package/dist/cli/session-start/index.js +0 -591
- package/dist/cli/session-start/index.js.map +0 -1
- package/dist/cli/session-start/shared-options.d.ts +0 -103
- package/dist/cli/session-start/shared-options.js +0 -107
- package/dist/cli/session-start/shared-options.js.map +0 -1
- package/dist/cli/session-start/stale-base-check.d.ts +0 -46
- package/dist/cli/session-start/stale-base-check.js +0 -352
- package/dist/cli/session-start/stale-base-check.js.map +0 -1
- package/dist/cli/session-start/toolchain-parity.d.ts +0 -267
- package/dist/cli/session-start/toolchain-parity.js +0 -797
- package/dist/cli/session-start/toolchain-parity.js.map +0 -1
- package/dist/cli/smoke/assertions.d.ts +0 -46
- package/dist/cli/smoke/assertions.js +0 -170
- package/dist/cli/smoke/assertions.js.map +0 -1
- package/dist/cli/smoke/index.d.ts +0 -76
- package/dist/cli/smoke/index.js +0 -245
- package/dist/cli/smoke/index.js.map +0 -1
- package/dist/cli/smoke/runner.d.ts +0 -55
- package/dist/cli/smoke/runner.js +0 -134
- package/dist/cli/smoke/runner.js.map +0 -1
- package/dist/cli/smoke/stream-parser.d.ts +0 -65
- package/dist/cli/smoke/stream-parser.js +0 -115
- package/dist/cli/smoke/stream-parser.js.map +0 -1
- package/dist/cli/test-risk.d.ts +0 -27
- package/dist/cli/test-risk.js +0 -38
- package/dist/cli/test-risk.js.map +0 -1
- package/dist/io/display-path.d.ts +0 -11
- package/dist/io/display-path.js +0 -29
- package/dist/io/display-path.js.map +0 -1
- package/dist/io/duration.d.ts +0 -5
- package/dist/io/duration.js +0 -50
- package/dist/io/duration.js.map +0 -1
- package/dist/io/extract.d.ts +0 -79
- package/dist/io/extract.js +0 -226
- package/dist/io/extract.js.map +0 -1
- package/dist/io/ledger-record.d.ts +0 -83
- package/dist/io/ledger-record.js +0 -301
- package/dist/io/ledger-record.js.map +0 -1
- package/dist/io/read-json-dir-entries.d.ts +0 -36
- package/dist/io/read-json-dir-entries.js +0 -48
- package/dist/io/read-json-dir-entries.js.map +0 -1
- package/dist/io/safe-json-parse.d.ts +0 -5
- package/dist/io/safe-json-parse.js +0 -21
- package/dist/io/safe-json-parse.js.map +0 -1
- package/dist/policies/index.d.ts +0 -5
- package/dist/policies/index.js +0 -6
- package/dist/policies/index.js.map +0 -1
- package/dist/policies/ledger-client.d.ts +0 -113
- package/dist/policies/ledger-client.js +0 -500
- package/dist/policies/ledger-client.js.map +0 -1
- package/dist/policies/producers.d.ts +0 -12
- package/dist/policies/producers.js +0 -61
- package/dist/policies/producers.js.map +0 -1
- package/dist/policies/requires.d.ts +0 -75
- package/dist/policies/requires.js +0 -240
- package/dist/policies/requires.js.map +0 -1
- package/dist/policies/timestamp.d.ts +0 -14
- package/dist/policies/timestamp.js +0 -36
- package/dist/policies/timestamp.js.map +0 -1
- package/dist/policy-packs/builtin/permission-profiles.d.ts +0 -11
- package/dist/policy-packs/builtin/permission-profiles.js +0 -74
- package/dist/policy-packs/builtin/permission-profiles.js.map +0 -1
- package/dist/policy-packs/builtin/post-merge-gate-runtime.d.ts +0 -286
- package/dist/policy-packs/builtin/post-merge-gate-runtime.js +0 -397
- package/dist/policy-packs/builtin/post-merge-gate-runtime.js.map +0 -1
- package/dist/policy-packs/builtin/post-merge-gate.d.ts +0 -56
- package/dist/policy-packs/builtin/post-merge-gate.js +0 -347
- package/dist/policy-packs/builtin/post-merge-gate.js.map +0 -1
- package/dist/policy-packs/builtin/solution-acceptance-reconnect.d.ts +0 -50
- package/dist/policy-packs/builtin/solution-acceptance-reconnect.js +0 -151
- package/dist/policy-packs/builtin/solution-acceptance-reconnect.js.map +0 -1
- package/dist/policy-packs/builtin/solution-acceptance-runtime.d.ts +0 -323
- package/dist/policy-packs/builtin/solution-acceptance-runtime.js +0 -672
- package/dist/policy-packs/builtin/solution-acceptance-runtime.js.map +0 -1
- package/dist/policy-packs/builtin/solution-acceptance.d.ts +0 -45
- package/dist/policy-packs/builtin/solution-acceptance.js +0 -226
- package/dist/policy-packs/builtin/solution-acceptance.js.map +0 -1
- package/dist/policy-packs/builtin/understanding-before-execution/active-claim.d.ts +0 -25
- package/dist/policy-packs/builtin/understanding-before-execution/active-claim.js +0 -94
- package/dist/policy-packs/builtin/understanding-before-execution/active-claim.js.map +0 -1
- package/dist/policy-packs/builtin/understanding-before-execution/auto-approve-default.d.ts +0 -35
- package/dist/policy-packs/builtin/understanding-before-execution/auto-approve-default.js +0 -86
- package/dist/policy-packs/builtin/understanding-before-execution/auto-approve-default.js.map +0 -1
- package/dist/policy-packs/builtin/understanding-before-execution/auto-approve.d.ts +0 -210
- package/dist/policy-packs/builtin/understanding-before-execution/auto-approve.js +0 -361
- package/dist/policy-packs/builtin/understanding-before-execution/auto-approve.js.map +0 -1
- package/dist/policy-packs/builtin/understanding-before-execution/delegation-markers.d.ts +0 -304
- package/dist/policy-packs/builtin/understanding-before-execution/delegation-markers.js +0 -734
- package/dist/policy-packs/builtin/understanding-before-execution/delegation-markers.js.map +0 -1
- package/dist/policy-packs/builtin/understanding-before-execution/expiry-reason.d.ts +0 -36
- package/dist/policy-packs/builtin/understanding-before-execution/expiry-reason.js +0 -73
- package/dist/policy-packs/builtin/understanding-before-execution/expiry-reason.js.map +0 -1
- package/dist/policy-packs/builtin/understanding-before-execution/index.d.ts +0 -19
- package/dist/policy-packs/builtin/understanding-before-execution/index.js +0 -83
- package/dist/policy-packs/builtin/understanding-before-execution/index.js.map +0 -1
- package/dist/policy-packs/builtin/understanding-before-execution/inflight-records.d.ts +0 -135
- package/dist/policy-packs/builtin/understanding-before-execution/inflight-records.js +0 -643
- package/dist/policy-packs/builtin/understanding-before-execution/inflight-records.js.map +0 -1
- package/dist/policy-packs/builtin/understanding-before-execution/ledger.d.ts +0 -25
- package/dist/policy-packs/builtin/understanding-before-execution/ledger.js +0 -56
- package/dist/policy-packs/builtin/understanding-before-execution/ledger.js.map +0 -1
- package/dist/policy-packs/builtin/understanding-before-execution/lifecycle.d.ts +0 -20
- package/dist/policy-packs/builtin/understanding-before-execution/lifecycle.js +0 -106
- package/dist/policy-packs/builtin/understanding-before-execution/lifecycle.js.map +0 -1
- package/dist/policy-packs/builtin/understanding-before-execution/markers.d.ts +0 -126
- package/dist/policy-packs/builtin/understanding-before-execution/markers.js +0 -245
- package/dist/policy-packs/builtin/understanding-before-execution/markers.js.map +0 -1
- package/dist/policy-packs/builtin/understanding-before-execution/measured-permission-modes.d.ts +0 -29
- package/dist/policy-packs/builtin/understanding-before-execution/measured-permission-modes.js +0 -82
- package/dist/policy-packs/builtin/understanding-before-execution/measured-permission-modes.js.map +0 -1
- package/dist/policy-packs/builtin/understanding-before-execution/permission-mode-observations.d.ts +0 -71
- package/dist/policy-packs/builtin/understanding-before-execution/permission-mode-observations.js +0 -175
- package/dist/policy-packs/builtin/understanding-before-execution/permission-mode-observations.js.map +0 -1
- package/dist/policy-packs/builtin/understanding-before-execution/persisted-reports.d.ts +0 -625
- package/dist/policy-packs/builtin/understanding-before-execution/persisted-reports.js +0 -1076
- package/dist/policy-packs/builtin/understanding-before-execution/persisted-reports.js.map +0 -1
- package/dist/policy-packs/builtin/understanding-before-execution/post-tool-use-boundary.d.ts +0 -128
- package/dist/policy-packs/builtin/understanding-before-execution/post-tool-use-boundary.js +0 -213
- package/dist/policy-packs/builtin/understanding-before-execution/post-tool-use-boundary.js.map +0 -1
- package/dist/policy-packs/builtin/understanding-before-execution/stay-in-scope-config.d.ts +0 -129
- package/dist/policy-packs/builtin/understanding-before-execution/stay-in-scope-config.js +0 -166
- package/dist/policy-packs/builtin/understanding-before-execution/stay-in-scope-config.js.map +0 -1
- package/dist/policy-packs/builtin/understanding-before-execution/task-markers.d.ts +0 -164
- package/dist/policy-packs/builtin/understanding-before-execution/task-markers.js +0 -275
- package/dist/policy-packs/builtin/understanding-before-execution/task-markers.js.map +0 -1
- package/dist/policy-packs/builtin/understanding-before-execution-runtime.d.ts +0 -1
- package/dist/policy-packs/builtin/understanding-before-execution-runtime.js +0 -10
- package/dist/policy-packs/builtin/understanding-before-execution-runtime.js.map +0 -1
- package/dist/policy-packs/builtin/understanding-before-execution.d.ts +0 -526
- package/dist/policy-packs/builtin/understanding-before-execution.js +0 -1078
- package/dist/policy-packs/builtin/understanding-before-execution.js.map +0 -1
- package/dist/policy-packs/permission-translator.d.ts +0 -9
- package/dist/policy-packs/permission-translator.js +0 -76
- package/dist/policy-packs/permission-translator.js.map +0 -1
- package/dist/runtime/action-envelope.d.ts +0 -64
- package/dist/runtime/action-envelope.js +0 -46
- package/dist/runtime/action-envelope.js.map +0 -1
- package/dist/runtime/approval-signing.d.ts +0 -111
- package/dist/runtime/approval-signing.js +0 -384
- package/dist/runtime/approval-signing.js.map +0 -1
- package/dist/runtime/bash-match-facts.d.ts +0 -60
- package/dist/runtime/bash-match-facts.js +0 -196
- package/dist/runtime/bash-match-facts.js.map +0 -1
- package/dist/runtime/bash-match-registry.d.ts +0 -112
- package/dist/runtime/bash-match-registry.js +0 -406
- package/dist/runtime/bash-match-registry.js.map +0 -1
- package/dist/runtime/bash-prefix-parse.d.ts +0 -31
- package/dist/runtime/bash-prefix-parse.js +0 -576
- package/dist/runtime/bash-prefix-parse.js.map +0 -1
- package/dist/runtime/command-normalize.d.ts +0 -658
- package/dist/runtime/command-normalize.js +0 -2410
- package/dist/runtime/command-normalize.js.map +0 -1
- package/dist/runtime/deletion-target-resolve.d.ts +0 -28
- package/dist/runtime/deletion-target-resolve.js +0 -1078
- package/dist/runtime/deletion-target-resolve.js.map +0 -1
- package/dist/runtime/destructive-shell-floor.d.ts +0 -19
- package/dist/runtime/destructive-shell-floor.js +0 -611
- package/dist/runtime/destructive-shell-floor.js.map +0 -1
- package/dist/runtime/environment-resolver.d.ts +0 -36
- package/dist/runtime/environment-resolver.js +0 -138
- package/dist/runtime/environment-resolver.js.map +0 -1
- package/dist/runtime/git-context.d.ts +0 -201
- package/dist/runtime/git-context.js +0 -422
- package/dist/runtime/git-context.js.map +0 -1
- package/dist/runtime/index.d.ts +0 -12
- package/dist/runtime/index.js +0 -13
- package/dist/runtime/index.js.map +0 -1
- package/dist/runtime/intercept.d.ts +0 -623
- package/dist/runtime/intercept.js +0 -1384
- package/dist/runtime/intercept.js.map +0 -1
- package/dist/runtime/kube-context.d.ts +0 -16
- package/dist/runtime/kube-context.js +0 -63
- package/dist/runtime/kube-context.js.map +0 -1
- package/dist/runtime/kubectl-target-parse.d.ts +0 -31
- package/dist/runtime/kubectl-target-parse.js +0 -249
- package/dist/runtime/kubectl-target-parse.js.map +0 -1
- package/dist/runtime/ledger-add.d.ts +0 -16
- package/dist/runtime/ledger-add.js +0 -150
- package/dist/runtime/ledger-add.js.map +0 -1
- package/dist/runtime/ledger-writer.d.ts +0 -27
- package/dist/runtime/ledger-writer.js +0 -46
- package/dist/runtime/ledger-writer.js.map +0 -1
- package/dist/runtime/pause-sentinel.d.ts +0 -60
- package/dist/runtime/pause-sentinel.js +0 -156
- package/dist/runtime/pause-sentinel.js.map +0 -1
- package/dist/runtime/pending-approval.d.ts +0 -23
- package/dist/runtime/pending-approval.js +0 -67
- package/dist/runtime/pending-approval.js.map +0 -1
- package/dist/runtime/read-only-bash.d.ts +0 -141
- package/dist/runtime/read-only-bash.js +0 -2204
- package/dist/runtime/read-only-bash.js.map +0 -1
- package/dist/runtime/recovery-git-commit.d.ts +0 -22
- package/dist/runtime/recovery-git-commit.js +0 -284
- package/dist/runtime/recovery-git-commit.js.map +0 -1
- package/dist/runtime/reject-malformed-session-id.d.ts +0 -8
- package/dist/runtime/reject-malformed-session-id.js +0 -16
- package/dist/runtime/reject-malformed-session-id.js.map +0 -1
- package/dist/runtime/risk-classifier.d.ts +0 -38
- package/dist/runtime/risk-classifier.js +0 -311
- package/dist/runtime/risk-classifier.js.map +0 -1
- package/dist/runtime/session-id.d.ts +0 -113
- package/dist/runtime/session-id.js +0 -193
- package/dist/runtime/session-id.js.map +0 -1
- package/dist/runtime/shell-word.d.ts +0 -62
- package/dist/runtime/shell-word.js +0 -410
- package/dist/runtime/shell-word.js.map +0 -1
- package/dist/runtime/task-providers/agent-tasks.d.ts +0 -105
- package/dist/runtime/task-providers/agent-tasks.js +0 -247
- package/dist/runtime/task-providers/agent-tasks.js.map +0 -1
- package/dist/runtime/when-eval.d.ts +0 -62
- package/dist/runtime/when-eval.js +0 -212
- package/dist/runtime/when-eval.js.map +0 -1
- package/dist/runtime/workflow-policies.d.ts +0 -207
- package/dist/runtime/workflow-policies.js +0 -596
- package/dist/runtime/workflow-policies.js.map +0 -1
- package/dist/schema/audit.d.ts +0 -71
- package/dist/schema/audit.js +0 -32
- package/dist/schema/audit.js.map +0 -1
- package/dist/schema/doctor.d.ts +0 -25
- package/dist/schema/doctor.js +0 -23
- package/dist/schema/doctor.js.map +0 -1
- package/dist/schema/environments.d.ts +0 -215
- package/dist/schema/environments.js +0 -101
- package/dist/schema/environments.js.map +0 -1
- package/dist/schema/extract.d.ts +0 -9
- package/dist/schema/extract.js +0 -86
- package/dist/schema/extract.js.map +0 -1
- package/dist/schema/permission-profiles.d.ts +0 -2292
- package/dist/schema/permission-profiles.js +0 -60
- package/dist/schema/permission-profiles.js.map +0 -1
- package/dist/schema/policies.d.ts +0 -974
- package/dist/schema/policies.js +0 -298
- package/dist/schema/policies.js.map +0 -1
- package/dist/schema/requires.d.ts +0 -131
- package/dist/schema/requires.js +0 -88
- package/dist/schema/requires.js.map +0 -1
- package/dist/schema/risk.d.ts +0 -144
- package/dist/schema/risk.js +0 -194
- package/dist/schema/risk.js.map +0 -1
- package/dist/schema/session-start-preflight.d.ts +0 -10
- package/dist/schema/session-start-preflight.js +0 -106
- package/dist/schema/session-start-preflight.js.map +0 -1
- package/dist/schema/stale-base-check.d.ts +0 -18
- package/dist/schema/stale-base-check.js +0 -37
- package/dist/schema/stale-base-check.js.map +0 -1
- package/dist/schema/toolchain-parity.d.ts +0 -21
- package/dist/schema/toolchain-parity.js +0 -48
- package/dist/schema/toolchain-parity.js.map +0 -1
- package/dist/schema/workflows.d.ts +0 -519
- package/dist/schema/workflows.js +0 -81
- package/dist/schema/workflows.js.map +0 -1
- package/scripts/runtime-reality-docker-probe.mjs +0 -71
|
@@ -1,21 +1,37 @@
|
|
|
1
1
|
// Snapshot file format + I/O for `harness gate disable` / `harness gate enable`.
|
|
2
2
|
//
|
|
3
|
-
// A snapshot is the on-disk record of
|
|
4
|
-
// captures (a) which hook groups
|
|
5
|
-
// (b) the SHA-256 of `settings.json`
|
|
6
|
-
// removal, and (c) the path the
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
3
|
+
// A snapshot is the on-disk record of the `gate disable` calls made against
|
|
4
|
+
// one settings.json since the last restore. It captures (a) which hook groups
|
|
5
|
+
// were removed and where they came from, (b) the SHA-256 of `settings.json`
|
|
6
|
+
// before the first removal and after the latest one, and (c) the path the
|
|
7
|
+
// original was backed up to. There is at most ONE live snapshot per
|
|
8
|
+
// settings.json: a second `gate disable` merges its groups into it while the
|
|
9
|
+
// file is still in the state that snapshot left. `gate enable` restores that
|
|
10
|
+
// snapshot, refuses to restore over a settings.json the operator has edited
|
|
11
|
+
// since unless the result is exactly the pre-disable file (`--force`
|
|
12
|
+
// overrides), writes the removed groups back into place and then retires the
|
|
13
|
+
// snapshot (renamed to `*.restored.json`, kept for audit, never applied
|
|
14
|
+
// again). A removed group counts as back only when the file holds an
|
|
15
|
+
// unchanged copy of it; a group that merely shares its event and matcher is
|
|
16
|
+
// taken for it only under `--force`.
|
|
10
17
|
//
|
|
11
18
|
// The format is intentionally narrow: no compression, no transform, just
|
|
12
19
|
// the literal JSON groups as they were read out of settings.json.
|
|
13
20
|
import * as crypto from "node:crypto";
|
|
14
21
|
import * as fs from "node:fs";
|
|
15
22
|
import * as path from "node:path";
|
|
23
|
+
import { kernelEntry, walkLinkChain } from "./link-chain.js";
|
|
24
|
+
import { shellQuote } from "../shell-quote.js";
|
|
16
25
|
export const SNAPSHOT_BASENAME_PREFIX = "harness.gate-disable.";
|
|
17
26
|
export const SNAPSHOT_BASENAME_SUFFIX = ".json";
|
|
18
|
-
|
|
27
|
+
/** Written by this version. Adds `step` on every removed group and `merges`. */
|
|
28
|
+
export const SNAPSHOT_VERSION = 2;
|
|
29
|
+
/** Written by releases before a second disable merged into the live snapshot; still restorable. */
|
|
30
|
+
export const LEGACY_SNAPSHOT_VERSION = 1;
|
|
31
|
+
/** A retired snapshot keeps its name with this suffix instead of plain `.json`. */
|
|
32
|
+
export const RETIRED_SNAPSHOT_SUFFIX = ".restored.json";
|
|
33
|
+
/** A snapshot whose groups were carried into a snapshot at another place keeps its name with this suffix. */
|
|
34
|
+
export const SUPERSEDED_SNAPSHOT_SUFFIX = ".superseded.json";
|
|
19
35
|
export function sha256Hex(input) {
|
|
20
36
|
return crypto.createHash("sha256").update(input).digest("hex");
|
|
21
37
|
}
|
|
@@ -37,9 +53,11 @@ export function backupPath(settingsPath, now) {
|
|
|
37
53
|
* Return all gate-disable snapshot paths in `settingsDir`, newest-first
|
|
38
54
|
* by mtime. Missing directory returns []. Any file that isn't a valid
|
|
39
55
|
* snapshot is silently skipped — `gate enable` re-parses the candidates
|
|
40
|
-
* and surfaces format errors at that point.
|
|
56
|
+
* and surfaces format errors at that point. `prefix` selects the snapshot
|
|
57
|
+
* family: the Claude settings snapshots by default, the Codex ones when the
|
|
58
|
+
* Codex gate passes its own prefix (`codex-snapshot.ts`).
|
|
41
59
|
*/
|
|
42
|
-
export function listSnapshots(settingsDir) {
|
|
60
|
+
export function listSnapshots(settingsDir, prefix = SNAPSHOT_BASENAME_PREFIX) {
|
|
43
61
|
let names;
|
|
44
62
|
try {
|
|
45
63
|
names = fs.readdirSync(settingsDir);
|
|
@@ -49,7 +67,7 @@ export function listSnapshots(settingsDir) {
|
|
|
49
67
|
}
|
|
50
68
|
const candidates = [];
|
|
51
69
|
for (const name of names) {
|
|
52
|
-
if (!name.startsWith(
|
|
70
|
+
if (!name.startsWith(prefix))
|
|
53
71
|
continue;
|
|
54
72
|
if (!name.endsWith(SNAPSHOT_BASENAME_SUFFIX))
|
|
55
73
|
continue;
|
|
@@ -67,6 +85,33 @@ export function listSnapshots(settingsDir) {
|
|
|
67
85
|
candidates.sort((a, b) => b.mtimeMs - a.mtimeMs);
|
|
68
86
|
return candidates.map((c) => c.filePath);
|
|
69
87
|
}
|
|
88
|
+
/**
|
|
89
|
+
* The reason a parsed snapshot lacks one of the required string fields or
|
|
90
|
+
* its `filter` object, or null when it has them all. Shared by the Claude
|
|
91
|
+
* and Codex snapshot readers so the two cannot drift apart.
|
|
92
|
+
*/
|
|
93
|
+
export function snapshotFieldProblem(filePath, obj, stringFields) {
|
|
94
|
+
for (const field of stringFields) {
|
|
95
|
+
if (typeof obj[field] !== "string") {
|
|
96
|
+
return `snapshot ${filePath} is missing string field "${field}"`;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
if (typeof obj["filter"] !== "object" || obj["filter"] === null) {
|
|
100
|
+
return `snapshot ${filePath} is missing object field "filter"`;
|
|
101
|
+
}
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Whether a snapshot's recorded `settingsPath` names a file: only its
|
|
106
|
+
* basename tells which directory entry the snapshot belongs to, so a path
|
|
107
|
+
* that has none (empty, or ending in `.` or `..`) records no target.
|
|
108
|
+
*/
|
|
109
|
+
function hasRecordedTarget(recorded) {
|
|
110
|
+
if (typeof recorded !== "string")
|
|
111
|
+
return false;
|
|
112
|
+
const name = path.basename(recorded);
|
|
113
|
+
return name !== "" && name !== "." && name !== "..";
|
|
114
|
+
}
|
|
70
115
|
/**
|
|
71
116
|
* Parse a snapshot file. Validates structural shape only — the body's
|
|
72
117
|
* `removed[].group` payload is opaque (preserved verbatim from
|
|
@@ -91,29 +136,443 @@ export function readSnapshot(filePath) {
|
|
|
91
136
|
return { ok: false, reason: `snapshot ${filePath} is not a JSON object` };
|
|
92
137
|
}
|
|
93
138
|
const obj = parsed;
|
|
94
|
-
if (obj["version"] !== SNAPSHOT_VERSION) {
|
|
139
|
+
if (obj["version"] !== SNAPSHOT_VERSION && obj["version"] !== LEGACY_SNAPSHOT_VERSION) {
|
|
140
|
+
return {
|
|
141
|
+
ok: false,
|
|
142
|
+
reason: `snapshot ${filePath} has unsupported version ${JSON.stringify(obj["version"])}; ` +
|
|
143
|
+
`expected ${LEGACY_SNAPSHOT_VERSION} or ${SNAPSHOT_VERSION}`,
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
if (!hasRecordedTarget(obj["settingsPath"])) {
|
|
95
147
|
return {
|
|
96
148
|
ok: false,
|
|
97
|
-
reason: `snapshot ${filePath} has
|
|
149
|
+
reason: `snapshot ${filePath} has no recorded target (its "settingsPath" is missing or empty), so it cannot be ` +
|
|
150
|
+
`matched to a settings file`,
|
|
98
151
|
};
|
|
99
152
|
}
|
|
100
|
-
|
|
153
|
+
const problem = snapshotFieldProblem(filePath, obj, [
|
|
101
154
|
"createdAt",
|
|
102
155
|
"settingsPath",
|
|
103
156
|
"settingsBackupPath",
|
|
104
157
|
"settingsBeforeSha256",
|
|
105
158
|
"settingsAfterSha256",
|
|
106
|
-
])
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
if (typeof obj["filter"] !== "object" || obj["filter"] === null) {
|
|
112
|
-
return { ok: false, reason: `snapshot ${filePath} is missing object field "filter"` };
|
|
113
|
-
}
|
|
159
|
+
]);
|
|
160
|
+
if (problem !== null)
|
|
161
|
+
return { ok: false, reason: problem };
|
|
114
162
|
if (!Array.isArray(obj["removed"])) {
|
|
115
163
|
return { ok: false, reason: `snapshot ${filePath} is missing array field "removed"` };
|
|
116
164
|
}
|
|
117
165
|
return { ok: true, snapshot: obj };
|
|
118
166
|
}
|
|
167
|
+
/** The name a snapshot is renamed to once retired. The file stays for audit. */
|
|
168
|
+
export function retiredSnapshotPath(snapPath) {
|
|
169
|
+
return `${snapPath.slice(0, -SNAPSHOT_BASENAME_SUFFIX.length)}${RETIRED_SNAPSHOT_SUFFIX}`;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Retire `snapPath` as superseded (rename it, keep it for audit) and return
|
|
173
|
+
* the new path: its groups were merged into a snapshot beside the file they
|
|
174
|
+
* were removed from, so it is not restored and never offered again.
|
|
175
|
+
*/
|
|
176
|
+
export function supersedeSnapshot(snapPath) {
|
|
177
|
+
const to = `${snapPath.slice(0, -SNAPSHOT_BASENAME_SUFFIX.length)}${SUPERSEDED_SNAPSHOT_SUFFIX}`;
|
|
178
|
+
fs.renameSync(snapPath, to);
|
|
179
|
+
return to;
|
|
180
|
+
}
|
|
181
|
+
/** Retire `snapPath` (rename it, keep it for audit) and return the new path. */
|
|
182
|
+
export function retireSnapshot(snapPath) {
|
|
183
|
+
const to = retiredSnapshotPath(snapPath);
|
|
184
|
+
fs.renameSync(snapPath, to);
|
|
185
|
+
return to;
|
|
186
|
+
}
|
|
187
|
+
/** Whether two names differ at most in letter case or Unicode normalization form. */
|
|
188
|
+
function foldsTo(a, b) {
|
|
189
|
+
return a.normalize("NFC").toLowerCase() === b.normalize("NFC").toLowerCase();
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Whether `recordedName`, in `dir`, is the directory entry `targetName`
|
|
193
|
+
* names. The same spelling is, by definition: snapshots sit beside their
|
|
194
|
+
* file and record its basename, so the name is the identity. A spelling that
|
|
195
|
+
* differs only in letter case or normalization is the same entry only on a
|
|
196
|
+
* filesystem that folds those (APFS by default), which `lstat` tells: both
|
|
197
|
+
* names must resolve to one regular file (neither a symlink) whose link
|
|
198
|
+
* count is 1, so no second name of that inode could be the one that matched.
|
|
199
|
+
* Every other name is another entry (a hard link, a symlink, a renamed file):
|
|
200
|
+
* restoring through it would write a new file at that name and leave the
|
|
201
|
+
* recorded file as the disable left it.
|
|
202
|
+
*
|
|
203
|
+
* `symlinks` lets the entry be a symlink itself (a symlinked Codex config,
|
|
204
|
+
* which the gate edits at its resolved target): two spellings then name one
|
|
205
|
+
* entry when `lstat` gives both the same device and inode and a link count of
|
|
206
|
+
* 1, as for a regular file. The Claude gate never sets it.
|
|
207
|
+
*/
|
|
208
|
+
export function namesSameEntry(dir, recordedName, targetName, opts = {}) {
|
|
209
|
+
if (recordedName === targetName)
|
|
210
|
+
return true;
|
|
211
|
+
if (!foldsTo(recordedName, targetName))
|
|
212
|
+
return false;
|
|
213
|
+
let recorded;
|
|
214
|
+
let target;
|
|
215
|
+
try {
|
|
216
|
+
recorded = fs.lstatSync(path.join(dir, recordedName), { bigint: true });
|
|
217
|
+
target = fs.lstatSync(path.join(dir, targetName), { bigint: true });
|
|
218
|
+
}
|
|
219
|
+
catch {
|
|
220
|
+
return false;
|
|
221
|
+
}
|
|
222
|
+
const kind = (st) => st.isFile() ? "file" : opts.symlinks === true && st.isSymbolicLink() ? "link" : null;
|
|
223
|
+
return (kind(recorded) !== null &&
|
|
224
|
+
kind(recorded) === kind(target) &&
|
|
225
|
+
recorded.dev === target.dev &&
|
|
226
|
+
recorded.ino === target.ino &&
|
|
227
|
+
recorded.nlink === 1n &&
|
|
228
|
+
target.nlink === 1n);
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* The spelling of `settingsPath` the gate builds every other path from: the
|
|
232
|
+
* backup, the snapshot, the listing beside it, and the atomic write's temp
|
|
233
|
+
* file. A spelling with a `..` segment is replaced by its directory as the
|
|
234
|
+
* kernel resolves it (`kernelEntry`, which the Codex gate uses as well), so
|
|
235
|
+
* no path built from it is folded into another directory; every other
|
|
236
|
+
* spelling is kept as given and the paths the gate prints read the way they
|
|
237
|
+
* were written.
|
|
238
|
+
*/
|
|
239
|
+
export function settingsOwnEntry(settingsPath) {
|
|
240
|
+
return kernelEntry(settingsPath);
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* The file `gate disable` and `gate enable` read and write for `settingsPath`.
|
|
244
|
+
* That is the path itself unless its last component is a symlink (a dotfiles
|
|
245
|
+
* setup): then it is the entry the link leads to, which may sit in another
|
|
246
|
+
* directory. Writing through the resolved entry keeps the link a link, and
|
|
247
|
+
* the snapshots sit beside the file itself, so a disable through either
|
|
248
|
+
* spelling is found by an enable through the other. Every hop of the chain is
|
|
249
|
+
* resolved the way the kernel resolves it (`walkLinkChain`, the walker the
|
|
250
|
+
* Codex gate uses too), so the file is the one reading through the path
|
|
251
|
+
* gives, `..` in a link text included. A link whose file is gone resolves to
|
|
252
|
+
* where the file would be, so the snapshots taken for it are still found; a
|
|
253
|
+
* link whose text passes through a directory that is gone resolves to that
|
|
254
|
+
* text as written (nothing can sit beside it). A path that is no link, and a
|
|
255
|
+
* loop, resolve to the path's own entry (`settingsOwnEntry`).
|
|
256
|
+
*/
|
|
257
|
+
export function resolveSettingsEntry(settingsPath) {
|
|
258
|
+
const { chain, end } = walkLinkChain(settingsPath);
|
|
259
|
+
if (chain.length === 1 || end === "loop")
|
|
260
|
+
return settingsOwnEntry(settingsPath);
|
|
261
|
+
// Every hop after the first is a physical directory and a name (the file's real path), unless the walk ended
|
|
262
|
+
// in a directory that is gone: then it is the link text as written.
|
|
263
|
+
return chain[chain.length - 1] ?? settingsPath;
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* The identity of a file across spellings of its directory, or the path itself
|
|
267
|
+
* when it cannot be resolved. The native `realpath` takes `d/..` through the
|
|
268
|
+
* real location of `d`, as the listing that found the file did.
|
|
269
|
+
*/
|
|
270
|
+
function fileIdentity(file) {
|
|
271
|
+
try {
|
|
272
|
+
return fs.realpathSync.native(file);
|
|
273
|
+
}
|
|
274
|
+
catch {
|
|
275
|
+
return file;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* The live (not retired) snapshots that were taken for `settingsPath`,
|
|
280
|
+
* newest first by `createdAt`. Snapshots always sit beside their file, so
|
|
281
|
+
* only the basename of the recorded settings path counts, never how the
|
|
282
|
+
* directory was spelled when it was written (relative to some other working
|
|
283
|
+
* directory, or through a symlink): a snapshot belongs to the file when the
|
|
284
|
+
* target names the directory entry that basename names (`namesSameEntry`:
|
|
285
|
+
* the same spelling, or another spelling of the one entry on a
|
|
286
|
+
* case-insensitive filesystem). When `settingsPath` is itself a symlink
|
|
287
|
+
* (`resolveSettingsEntry`), the directory of the file it leads to is searched
|
|
288
|
+
* too, with the resolved entry as the target there: the snapshot of a disable
|
|
289
|
+
* made through the other spelling sits beside that file. A hard link to the
|
|
290
|
+
* file, a renamed file, or a snapshot found beside the file a symlink leads
|
|
291
|
+
* to but recorded under the symlink's own name is another entry, so a
|
|
292
|
+
* snapshot recorded for one is foreign to the other, whether or not the files
|
|
293
|
+
* exist. A snapshot for another settings file in the same directory is
|
|
294
|
+
* listed in `skippedForeign`, never dropped silently. A live snapshot that
|
|
295
|
+
* cannot be read, or records no target, is an error: its target cannot be
|
|
296
|
+
* told, so neither disable nor enable may go on as if it did not exist.
|
|
297
|
+
*/
|
|
298
|
+
export function listLiveSnapshots(settingsPath) {
|
|
299
|
+
const own = settingsOwnEntry(settingsPath);
|
|
300
|
+
const resolved = resolveSettingsEntry(settingsPath);
|
|
301
|
+
const places = [{ dir: path.dirname(own), name: path.basename(own) }];
|
|
302
|
+
if (resolved !== own) {
|
|
303
|
+
places.push({ dir: path.dirname(resolved), name: path.basename(resolved) });
|
|
304
|
+
}
|
|
305
|
+
const live = new Map();
|
|
306
|
+
const foreign = new Map();
|
|
307
|
+
for (const { dir, name: targetName } of places) {
|
|
308
|
+
for (const file of listSnapshots(dir)) {
|
|
309
|
+
if (file.endsWith(RETIRED_SNAPSHOT_SUFFIX) || file.endsWith(SUPERSEDED_SNAPSHOT_SUFFIX))
|
|
310
|
+
continue;
|
|
311
|
+
const id = fileIdentity(file);
|
|
312
|
+
const read = readSnapshot(file);
|
|
313
|
+
if (!read.ok)
|
|
314
|
+
return { ok: false, reason: read.reason, path: file };
|
|
315
|
+
const recordedName = path.basename(read.snapshot.settingsPath);
|
|
316
|
+
if (!namesSameEntry(dir, recordedName, targetName)) {
|
|
317
|
+
const recordedPath = path.join(dir, recordedName);
|
|
318
|
+
foreign.set(id, {
|
|
319
|
+
path: file,
|
|
320
|
+
settingsPath: recordedPath,
|
|
321
|
+
settingsExists: fs.existsSync(recordedPath),
|
|
322
|
+
settingsBackupPath: read.snapshot.settingsBackupPath,
|
|
323
|
+
});
|
|
324
|
+
continue;
|
|
325
|
+
}
|
|
326
|
+
live.set(id, { path: file, snapshot: read.snapshot });
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
const liveList = [...live.values()];
|
|
330
|
+
liveList.sort((a, b) => {
|
|
331
|
+
if (a.snapshot.createdAt !== b.snapshot.createdAt) {
|
|
332
|
+
return a.snapshot.createdAt < b.snapshot.createdAt ? 1 : -1;
|
|
333
|
+
}
|
|
334
|
+
return a.path < b.path ? 1 : -1;
|
|
335
|
+
});
|
|
336
|
+
// A snapshot the other spelling's directory owns is not foreign to the file.
|
|
337
|
+
const skippedForeign = [...foreign].filter(([id]) => !live.has(id)).map(([, f]) => f);
|
|
338
|
+
return { ok: true, live: liveList, skippedForeign };
|
|
339
|
+
}
|
|
340
|
+
const READ_ONLY_CODES = new Set(["EACCES", "EPERM", "EROFS"]);
|
|
341
|
+
/** Whether a write failed because the directory or filesystem does not allow it to be written. */
|
|
342
|
+
export function isReadOnlyWriteError(err) {
|
|
343
|
+
const code = err?.code;
|
|
344
|
+
return typeof code === "string" && READ_ONLY_CODES.has(code);
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* What a gate refusal says first when the file a settings symlink leads to
|
|
348
|
+
* cannot be written where it sits: what the link is and what refuses. EACCES
|
|
349
|
+
* and EROFS come from the directory (the gate writes a temp file beside the
|
|
350
|
+
* file and renames it into place); EPERM can come from the file or from the
|
|
351
|
+
* directory (an immutable flag, a sticky directory), so it names both without
|
|
352
|
+
* saying which. Each verb adds its own way out.
|
|
353
|
+
*/
|
|
354
|
+
export function readOnlyLinkTargetText(settingsPath, entry, err) {
|
|
355
|
+
const code = err.code;
|
|
356
|
+
const refuses = code === "EPERM"
|
|
357
|
+
? `the file ${entry} or the directory ${path.dirname(entry)} that holds it`
|
|
358
|
+
: `the directory ${path.dirname(entry)} that holds that file`;
|
|
359
|
+
return `${settingsPath} is a symlink to ${entry}, and ${refuses} cannot be written (${code}), so the gate cannot write there.`;
|
|
360
|
+
}
|
|
361
|
+
/** What a read-only refusal tells the operator to make writable: the directory, and for EPERM the file too. */
|
|
362
|
+
export function readOnlyWritablePlace(entry, err) {
|
|
363
|
+
return err.code === "EPERM"
|
|
364
|
+
? `${entry} and ${path.dirname(entry)}`
|
|
365
|
+
: path.dirname(entry);
|
|
366
|
+
}
|
|
367
|
+
/** The command that puts a copy of the file a symlink leads to in place of the link. */
|
|
368
|
+
export function copyOverLinkCommand(settingsPath, entry) {
|
|
369
|
+
const copy = `${settingsPath}.copy`;
|
|
370
|
+
return `cp ${shellQuote(entry)} ${shellQuote(copy)} && mv ${shellQuote(copy)} ${shellQuote(settingsPath)}`;
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* How a command prints a `--settings` target so that it works as printed: a
|
|
374
|
+
* path with a character the shell would act on (a space, a quote, `~`, `=`,
|
|
375
|
+
* `%`, `$`) is single-quoted by the one quoting helper the gate shares.
|
|
376
|
+
*/
|
|
377
|
+
export function settingsFlag(settingsPath) {
|
|
378
|
+
return `--settings ${shellQuote(settingsPath)}`;
|
|
379
|
+
}
|
|
380
|
+
function groupMatcherOf(group) {
|
|
381
|
+
if (group === null || typeof group !== "object" || Array.isArray(group))
|
|
382
|
+
return null;
|
|
383
|
+
const m = group["matcher"];
|
|
384
|
+
return typeof m === "string" ? m : null;
|
|
385
|
+
}
|
|
386
|
+
/** `PreToolUse matcher="Bash"`: how a message names a removed group. */
|
|
387
|
+
export function groupLabel(event, group) {
|
|
388
|
+
return `${event} matcher=${JSON.stringify(groupMatcherOf(group))}`;
|
|
389
|
+
}
|
|
390
|
+
/** The `command` strings of a hook group's hooks, in order; empty for a malformed group. */
|
|
391
|
+
export function groupCommands(group) {
|
|
392
|
+
if (group === null || typeof group !== "object" || Array.isArray(group))
|
|
393
|
+
return [];
|
|
394
|
+
const inner = group["hooks"];
|
|
395
|
+
const cmds = [];
|
|
396
|
+
for (const h of Array.isArray(inner) ? inner : []) {
|
|
397
|
+
if (h !== null && typeof h === "object" && !Array.isArray(h)) {
|
|
398
|
+
const cmd = h["command"];
|
|
399
|
+
if (typeof cmd === "string")
|
|
400
|
+
cmds.push(cmd);
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
return cmds;
|
|
404
|
+
}
|
|
405
|
+
function commandsText(group) {
|
|
406
|
+
const cmds = groupCommands(group);
|
|
407
|
+
return cmds.length === 0 ? "no command" : cmds.map((c) => `\`${c}\``).join(", ");
|
|
408
|
+
}
|
|
409
|
+
/**
|
|
410
|
+
* How a refusal names a removed group that is still missing: its event and
|
|
411
|
+
* matcher plus its commands, so that when another group shares the matcher
|
|
412
|
+
* the operator can tell which one is out of the file.
|
|
413
|
+
*/
|
|
414
|
+
export function missingLabel(entry) {
|
|
415
|
+
return `${groupLabel(entry.event, entry.group)} running ${commandsText(entry.group)}`;
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
* JSON with the keys of every object sorted, so two groups compare equal
|
|
419
|
+
* whatever order an editor or an apply wrote their keys in.
|
|
420
|
+
*/
|
|
421
|
+
function canonicalJson(value) {
|
|
422
|
+
return JSON.stringify(value, (_key, v) => v !== null && typeof v === "object" && !Array.isArray(v)
|
|
423
|
+
? Object.fromEntries(Object.entries(v).sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0)))
|
|
424
|
+
: v);
|
|
425
|
+
}
|
|
426
|
+
/** Names a changed group and the commands of both versions, so the operator can tell whether it is the gate's. */
|
|
427
|
+
export function changedLabel(changed) {
|
|
428
|
+
const was = commandsText(changed.entry.group);
|
|
429
|
+
const now = commandsText(changed.current);
|
|
430
|
+
return (`${groupLabel(changed.entry.event, changed.entry.group)}: the snapshot's group runs ${was}, ` +
|
|
431
|
+
`the file's group runs ${now}${was === now ? " (they differ in another field)" : ""}`);
|
|
432
|
+
}
|
|
433
|
+
/**
|
|
434
|
+
* What putting a snapshot's removed groups back into `current` would do. The
|
|
435
|
+
* entries are paired with the groups of the file one to one: first every
|
|
436
|
+
* entry with a deep-equal group of the same event (`alreadyBack`), then each
|
|
437
|
+
* entry left over, in the order the snapshot recorded them, with the first
|
|
438
|
+
* group still unpaired that has its event and matcher (`changed`). The rest
|
|
439
|
+
* are spliced in at their recorded positions: each removal step recorded its
|
|
440
|
+
* indices against the array as it stood just before that step, so the steps
|
|
441
|
+
* are undone newest first, and inside a step by event and ascending index (an
|
|
442
|
+
* earlier insertion never shifts a later insertion's target index past the
|
|
443
|
+
* array end).
|
|
444
|
+
*/
|
|
445
|
+
export function planRestore(current, snapshot) {
|
|
446
|
+
const hooks = {};
|
|
447
|
+
const unpaired = new Map();
|
|
448
|
+
for (const [event, groups] of Object.entries(current)) {
|
|
449
|
+
hooks[event] = groups.slice();
|
|
450
|
+
unpaired.set(event, groups.slice());
|
|
451
|
+
}
|
|
452
|
+
const take = (entry, same) => {
|
|
453
|
+
const pool = unpaired.get(entry.event) ?? [];
|
|
454
|
+
const at = pool.findIndex(same);
|
|
455
|
+
return at === -1 ? [] : pool.splice(at, 1);
|
|
456
|
+
};
|
|
457
|
+
const alreadyBack = [];
|
|
458
|
+
const leftover = [];
|
|
459
|
+
for (const entry of snapshot.removed) {
|
|
460
|
+
const wanted = canonicalJson(entry.group);
|
|
461
|
+
if (take(entry, (g) => canonicalJson(g) === wanted).length > 0)
|
|
462
|
+
alreadyBack.push(entry);
|
|
463
|
+
else
|
|
464
|
+
leftover.push(entry);
|
|
465
|
+
}
|
|
466
|
+
const changed = [];
|
|
467
|
+
const missing = [];
|
|
468
|
+
for (const entry of leftover) {
|
|
469
|
+
const matcher = groupMatcherOf(entry.group);
|
|
470
|
+
const [match] = take(entry, (g) => groupMatcherOf(g) === matcher);
|
|
471
|
+
if (match !== undefined)
|
|
472
|
+
changed.push({ entry, current: match });
|
|
473
|
+
else
|
|
474
|
+
missing.push(entry);
|
|
475
|
+
}
|
|
476
|
+
const restored = missing.sort((a, b) => {
|
|
477
|
+
const stepA = a.step ?? 0;
|
|
478
|
+
const stepB = b.step ?? 0;
|
|
479
|
+
if (stepA !== stepB)
|
|
480
|
+
return stepB - stepA;
|
|
481
|
+
if (a.event !== b.event)
|
|
482
|
+
return a.event < b.event ? -1 : 1;
|
|
483
|
+
return a.index - b.index;
|
|
484
|
+
});
|
|
485
|
+
for (const entry of restored) {
|
|
486
|
+
const arr = hooks[entry.event] ?? [];
|
|
487
|
+
arr.splice(Math.min(entry.index, arr.length), 0, entry.group);
|
|
488
|
+
hooks[entry.event] = arr;
|
|
489
|
+
}
|
|
490
|
+
return { hooks, restored, alreadyBack, changed };
|
|
491
|
+
}
|
|
492
|
+
/**
|
|
493
|
+
* The settings text `gate enable` writes when it puts `plan`'s groups back
|
|
494
|
+
* into the parsed settings file `obj`: `obj` with its `hooks` key replaced by
|
|
495
|
+
* `plan.hooks` (and removed when the plan holds no group at all).
|
|
496
|
+
*/
|
|
497
|
+
export function restoredSettingsText(obj, hooks) {
|
|
498
|
+
const newObj = { ...obj };
|
|
499
|
+
if (Object.keys(hooks).length === 0) {
|
|
500
|
+
delete newObj["hooks"];
|
|
501
|
+
}
|
|
502
|
+
else {
|
|
503
|
+
newObj["hooks"] = hooks;
|
|
504
|
+
}
|
|
505
|
+
return `${JSON.stringify(newObj, null, 2)}\n`;
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* The one decision of why `harness gate enable` refuses a snapshot against
|
|
509
|
+
* the current settings.json unless it was called with `--force`, or null when
|
|
510
|
+
* it restores or retires it without one:
|
|
511
|
+
* - `"changed-group"`: the file holds a group with the event and matcher of a
|
|
512
|
+
* removed one but other content, which may be another hook sharing the
|
|
513
|
+
* matcher, so it never counts as back on its own;
|
|
514
|
+
* - `"edited-settings"`: the file is not the state the snapshot left and the
|
|
515
|
+
* groups that are still missing do not add up to the pre-disable file, so
|
|
516
|
+
* a restore would write over an operator edit.
|
|
517
|
+
* The current file already matching the pre-disable state, and a snapshot
|
|
518
|
+
* whose every group is back, never refuse: nothing is put back. A changed
|
|
519
|
+
* group wins when both hold, as `gate enable` refuses for it before it
|
|
520
|
+
* reaches the edit check. `gate enable` throws on it, and `harness doctor`
|
|
521
|
+
* calls it to decide whether its warning for a gate-disabled hook must name
|
|
522
|
+
* `--force`; the two callers never re-implement the conditions.
|
|
523
|
+
*/
|
|
524
|
+
export function claudeEnableRefusal(currentSha, currentObj, plan, snapshot) {
|
|
525
|
+
if (currentSha === snapshot.settingsBeforeSha256)
|
|
526
|
+
return null;
|
|
527
|
+
if (plan.changed.length > 0)
|
|
528
|
+
return "changed-group";
|
|
529
|
+
if (plan.restored.length === 0)
|
|
530
|
+
return null;
|
|
531
|
+
const restoredSha = sha256Hex(restoredSettingsText(currentObj, plan.hooks));
|
|
532
|
+
if (currentSha !== snapshot.settingsAfterSha256 && restoredSha !== snapshot.settingsBeforeSha256) {
|
|
533
|
+
return "edited-settings";
|
|
534
|
+
}
|
|
535
|
+
return null;
|
|
536
|
+
}
|
|
537
|
+
/**
|
|
538
|
+
* The live snapshots a plain `harness gate enable` applies on its next call,
|
|
539
|
+
* in the order it applies them, from `listLiveSnapshots`' newest-first list.
|
|
540
|
+
* `gate enable` restores ONE snapshot per call and retires it, so today it is
|
|
541
|
+
* the newest alone: an older snapshot waits until that restore changed the
|
|
542
|
+
* file, which is exactly why its own refusal against the CURRENT file is not
|
|
543
|
+
* what the next plain enable will decide. `harness doctor` asks this question
|
|
544
|
+
* before it words the warning for a gate-disabled hook, and `gate enable` takes
|
|
545
|
+
* its snapshot through it too, so the two cannot drift apart on which one
|
|
546
|
+
* decides.
|
|
547
|
+
*/
|
|
548
|
+
export function nextEnableSnapshots(live) {
|
|
549
|
+
return live.slice(0, 1);
|
|
550
|
+
}
|
|
551
|
+
/**
|
|
552
|
+
* The `hooks` of a parsed settings.json as the gate reads them: an array of
|
|
553
|
+
* groups per event, each array copied, so a caller never mutates the parsed
|
|
554
|
+
* document. A `hooks` key that is absent reads as no groups at all; any other
|
|
555
|
+
* shape the gate refuses to read is a failure reason, not a guess:
|
|
556
|
+
* `hooks-not-object` when the field itself is not an object, and
|
|
557
|
+
* `event-not-array` naming the first event whose value is not an array.
|
|
558
|
+
* `gate enable` turns the two reasons into its two refusal messages, and
|
|
559
|
+
* `harness doctor` reads them the same way when it asks the gate what a
|
|
560
|
+
* plain `gate enable` would do with the file it compares; the two never
|
|
561
|
+
* re-implement the walk.
|
|
562
|
+
*/
|
|
563
|
+
export function parseSettingsHooks(doc) {
|
|
564
|
+
const rawHooks = doc["hooks"];
|
|
565
|
+
const hooks = {};
|
|
566
|
+
if (rawHooks === undefined)
|
|
567
|
+
return { ok: true, hooks };
|
|
568
|
+
if (rawHooks === null || typeof rawHooks !== "object" || Array.isArray(rawHooks)) {
|
|
569
|
+
return { ok: false, reason: "hooks-not-object" };
|
|
570
|
+
}
|
|
571
|
+
for (const [event, groups] of Object.entries(rawHooks)) {
|
|
572
|
+
if (!Array.isArray(groups))
|
|
573
|
+
return { ok: false, reason: "event-not-array", event };
|
|
574
|
+
hooks[event] = groups.slice();
|
|
575
|
+
}
|
|
576
|
+
return { ok: true, hooks };
|
|
577
|
+
}
|
|
119
578
|
//# sourceMappingURL=snapshot.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snapshot.js","sourceRoot":"","sources":["../../../src/cli/gate/snapshot.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,EAAE;AACF,wEAAwE;AACxE,wEAAwE;AACxE,sEAAsE;AACtE,yEAAyE;AACzE,0EAA0E;AAC1E,4EAA4E;AAC5E,iDAAiD;AACjD,EAAE;AACF,yEAAyE;AACzE,kEAAkE;AAElE,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,MAAM,CAAC,MAAM,wBAAwB,GAAG,uBAAuB,CAAC;AAChE,MAAM,CAAC,MAAM,wBAAwB,GAAG,OAAO,CAAC;AAChD,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAU,CAAC;AAoC3C,MAAM,UAAU,SAAS,CAAC,KAAsB;IAC9C,OAAO,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACjE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,YAAoB,EAAE,GAAS;IAC1D,MAAM,KAAK,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IACnD,OAAO,IAAI,CAAC,IAAI,CACd,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,EAC1B,GAAG,wBAAwB,GAAG,KAAK,GAAG,wBAAwB,EAAE,CACjE,CAAC;AACJ,CAAC;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AA8B,EAAE,CAAC;IAC5C,IAAI,QAAQ,KAAK,SAAS;QAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;IACvD,IAAI,QAAQ,KAAK,IAAI,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QACjF,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,kBAAkB,EAAE,CAAC;IACnD,CAAC;IACD,KAAK,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QACvD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;YAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,iBAAiB,EAAE,KAAK,EAAE,CAAC;QACnF,KAAK,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,KAAK,EAAE,CAAC;IAChC,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;AAC7B,CAAC"}
|
package/dist/cli/index.d.ts
CHANGED
|
@@ -1,18 +1,9 @@
|
|
|
1
1
|
import { Command } from "commander";
|
|
2
2
|
export declare function defaultVersionProbe(cmd: readonly string[]): string | null;
|
|
3
|
-
import { type RogueLedgerScanOptions } from "./doctor/rogue-ledger.js";
|
|
4
3
|
export interface RunOptions {
|
|
5
4
|
argv?: string[];
|
|
6
5
|
stdout?: (s: string) => void;
|
|
7
6
|
stderr?: (s: string) => void;
|
|
8
|
-
/**
|
|
9
|
-
* Test-injection knob for `harness doctor --rm-rogue-ledgers`. When set,
|
|
10
|
-
* both the initial scan (forwarded to `doctor()`) and the post-deletion
|
|
11
|
-
* re-scan use these options instead of the runtime `os.homedir()` /
|
|
12
|
-
* `process.cwd()` defaults. This makes the re-scan fully hermetic in unit
|
|
13
|
-
* tests without spawning real filesystem side-effects.
|
|
14
|
-
*/
|
|
15
|
-
rogueLedgerScanOptions?: Partial<RogueLedgerScanOptions>;
|
|
16
7
|
}
|
|
17
8
|
export declare function buildProgram(opts?: RunOptions): Command;
|
|
18
9
|
export declare function run(opts?: RunOptions): Promise<number>;
|