@lannguyensi/harness 0.63.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 +90 -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 -338
- 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 -705
- 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 -378
- 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 +15 -2607
- 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 -243
- 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/register-gate-group.d.ts +5 -0
- 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 +5 -0
- package/dist/cli/register-operator-lifecycle.js +20 -0
- package/dist/cli/register-operator-lifecycle.js.map +1 -0
- 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-setup-group.d.ts +5 -0
- 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.d.ts +5 -0
- package/dist/cli/remove/register.js +25 -0
- package/dist/cli/remove/register.js.map +1 -0
- 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.d.ts +5 -0
- package/dist/cli/uninstall/register.js +171 -0
- package/dist/cli/uninstall/register.js.map +1 -0
- 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 -443
- package/dist/cli/delegate/index.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/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 -46
- package/dist/cli/dry-run.js +0 -250
- package/dist/cli/dry-run.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 -20
- package/dist/cli/explain-action.js +0 -27
- package/dist/cli/explain-action.js.map +0 -1
- package/dist/cli/explain-policy.d.ts +0 -135
- package/dist/cli/explain-policy.js +0 -266
- 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 -337
- 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 -1020
- 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 -108
- 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/resolve-env.d.ts +0 -32
- package/dist/cli/resolve-env.js +0 -47
- 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 -26
- package/dist/cli/test-risk.js +0 -34
- 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 -618
- 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 -93
- 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 -620
- package/dist/policy-packs/builtin/understanding-before-execution/persisted-reports.js +0 -1047
- 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 -1074
- 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 -494
- package/dist/runtime/intercept.js +0 -1313
- 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 -103
- package/dist/runtime/task-providers/agent-tasks.js +0 -245
- 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,95 +0,0 @@
|
|
|
1
|
-
// Doctor finding for the Mac-mini incident shape (task 8f637efd,
|
|
2
|
-
// docs/decisions/2026-08-27-ug-auto-mode-approval.md, "Amendment: install
|
|
3
|
-
// default"): a session ran under `bypassPermissions` (observed on the
|
|
4
|
-
// PreToolUse payload by the hook itself, see
|
|
5
|
-
// permission-mode-observations.ts) but `auto_approve` is missing, or
|
|
6
|
-
// present without covering `bypassPermissions` for `claude-code`. In
|
|
7
|
-
// that shape every gated call in the session falls through to the manual
|
|
8
|
-
// `harness approve understanding` prompt, which is exactly the gap the
|
|
9
|
-
// operator hit: the pack expects an unattended session under
|
|
10
|
-
// `bypassPermissions` to have opted in, and nothing said otherwise.
|
|
11
|
-
//
|
|
12
|
-
// This check reads ONLY the hook-written observation
|
|
13
|
-
// (`.permission-mode-observations/`), never the ledger and never the
|
|
14
|
-
// persisted report: both are agent-writable, and the evidence-ledger
|
|
15
|
-
// trust boundary this pack already enforces for approval
|
|
16
|
-
// (docs/okf/evidence-ledger-trust-boundary.md) applies to a doctor
|
|
17
|
-
// finding just as much as to a gate decision: a fact the AGENT can write
|
|
18
|
-
// must not be what tells the operator "you meant to opt in and didn't".
|
|
19
|
-
//
|
|
20
|
-
// Deliberately advisory (⚠), never an error: an operator who runs
|
|
21
|
-
// `bypassPermissions` sessions on the manual approval path on purpose
|
|
22
|
-
// (never wanting unattended auto-approval) is not misconfigured.
|
|
23
|
-
//
|
|
24
|
-
// THE OBSERVATION IS UNSIGNED (review round 3, F2). "Never the ledger,
|
|
25
|
-
// never the persisted report" above is about the WRITE PATH (this
|
|
26
|
-
// finding does not trust an agent-writable ledger row or report field),
|
|
27
|
-
// not a claim that the observation itself is tamper-proof: unlike the
|
|
28
|
-
// approval marker, `permission-mode-observations.ts`'s record carries no
|
|
29
|
-
// signature, so it is evidence that `harness pack hook pre-tool-use` was
|
|
30
|
-
// invoked with a given `session_id`/`permission_mode` on its stdin, not
|
|
31
|
-
// proof that a particular session actually ran under that mode: an
|
|
32
|
-
// already-approved session (or anything else able to invoke the hook
|
|
33
|
-
// binary directly) can write, or forge, one. That is exactly why this
|
|
34
|
-
// finding stays advisory-only and never feeds a gate or an approval: the
|
|
35
|
-
// operator who reads it decides what it means. Signing the observation
|
|
36
|
-
// was considered and rejected: a signature would only prove the hook
|
|
37
|
-
// signed the record, not that the named session actually ran under that
|
|
38
|
-
// mode, and it would open a second, unconditional signing surface for
|
|
39
|
-
// the marker-signing key (not a path to mint an approval marker, which
|
|
40
|
-
// stays namespaced by markerId). See
|
|
41
|
-
// docs/decisions/2026-08-27-ug-auto-mode-approval.md's "Amendment:
|
|
42
|
-
// permission-mode observation stays unsigned" for the full reasoning and
|
|
43
|
-
// the reopen criterion.
|
|
44
|
-
import { CLAUDE_CODE_HARNESS, harnessAllowed, listPermissionModeObservations, parseAutoApprove, permissionModeAllowed, renderAutoApproveSnippet, sanitizeForDisplay, } from "../../policy-packs/builtin/understanding-before-execution-runtime.js";
|
|
45
|
-
import { findEnabledUnderstandingPack } from "./understanding-mode-env.js";
|
|
46
|
-
/** The one payload literal this finding cares about (T1, see the ADR's signal table). */
|
|
47
|
-
const BYPASS_MODE = "bypassPermissions";
|
|
48
|
-
/**
|
|
49
|
-
* Pure(-ish): manifest + `generatedDir` in, a finding out (or
|
|
50
|
-
* `undefined` when there is nothing to flag). Only fires when:
|
|
51
|
-
* - the `understanding-before-execution` pack is declared AND enabled
|
|
52
|
-
* (mirrors every sibling advisory's gate: a pack that never runs
|
|
53
|
-
* has no auto-approve path to be missing);
|
|
54
|
-
* - at least one of the newest `recentSessions` hook-written
|
|
55
|
-
* observations records `permissionMode === "bypassPermissions"`;
|
|
56
|
-
* - `auto_approve` does NOT cover that combination today: either the
|
|
57
|
-
* block is absent/malformed (`parseAutoApprove` returns `null`), or
|
|
58
|
-
* `bypassPermissions` is not in `when`, or `claude-code` is not in
|
|
59
|
-
* `harnesses` (an operator who opted Codex in alone, dropping
|
|
60
|
-
* Claude Code, still has this exact gap on the Claude Code side).
|
|
61
|
-
*
|
|
62
|
-
* Reports the NEWEST qualifying observation only: this is a "you have
|
|
63
|
-
* at least one gap" flag, not a per-session audit; `ugAutoApprovals`
|
|
64
|
-
* already owns the full listing idiom for that.
|
|
65
|
-
*/
|
|
66
|
-
export function checkBypassWithoutAutoApprove(manifest, generatedDir, opts) {
|
|
67
|
-
const pack = findEnabledUnderstandingPack(manifest);
|
|
68
|
-
if (!pack)
|
|
69
|
-
return undefined;
|
|
70
|
-
const observations = listPermissionModeObservations(generatedDir, {
|
|
71
|
-
windowSize: opts.recentSessions,
|
|
72
|
-
});
|
|
73
|
-
const bypassObserved = observations.entries.find((e) => e.permissionMode === BYPASS_MODE);
|
|
74
|
-
if (!bypassObserved)
|
|
75
|
-
return undefined;
|
|
76
|
-
const autoApprove = parseAutoApprove(pack.config["auto_approve"]);
|
|
77
|
-
const covered = permissionModeAllowed(autoApprove, BYPASS_MODE) &&
|
|
78
|
-
harnessAllowed(autoApprove, CLAUDE_CODE_HARNESS);
|
|
79
|
-
if (covered)
|
|
80
|
-
return undefined;
|
|
81
|
-
// Sanitise at the render boundary as well, not only in the reader
|
|
82
|
-
// (mirrors persisted-reports.ts): both fields are payload-controlled.
|
|
83
|
-
const sessionId = sanitizeForDisplay(bypassObserved.sessionId);
|
|
84
|
-
const observedAt = sanitizeForDisplay(bypassObserved.observedAt);
|
|
85
|
-
return {
|
|
86
|
-
sessionId,
|
|
87
|
-
observedAt,
|
|
88
|
-
message: `bypassPermissions observed for session ${sessionId} (${observedAt}) but auto_approve does not cover it (hook-written, unsigned self-report; confirm from your own launch settings before enabling auto_approve); every gated call in that session needed a manual approval`,
|
|
89
|
-
detail: [
|
|
90
|
-
"run `harness pack upgrade understanding-before-execution` to insert the block below, or add it by hand under policy_packs[understanding-before-execution].config:",
|
|
91
|
-
...renderAutoApproveSnippet(0).split("\n"),
|
|
92
|
-
],
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
//# sourceMappingURL=bypass-without-auto-approve.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bypass-without-auto-approve.js","sourceRoot":"","sources":["../../../src/cli/doctor/bypass-without-auto-approve.ts"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,0EAA0E;AAC1E,sEAAsE;AACtE,6CAA6C;AAC7C,qEAAqE;AACrE,qEAAqE;AACrE,yEAAyE;AACzE,uEAAuE;AACvE,6DAA6D;AAC7D,oEAAoE;AACpE,EAAE;AACF,qDAAqD;AACrD,qEAAqE;AACrE,qEAAqE;AACrE,yDAAyD;AACzD,mEAAmE;AACnE,yEAAyE;AACzE,wEAAwE;AACxE,EAAE;AACF,kEAAkE;AAClE,sEAAsE;AACtE,iEAAiE;AACjE,EAAE;AACF,uEAAuE;AACvE,kEAAkE;AAClE,wEAAwE;AACxE,sEAAsE;AACtE,yEAAyE;AACzE,yEAAyE;AACzE,wEAAwE;AACxE,mEAAmE;AACnE,qEAAqE;AACrE,sEAAsE;AACtE,yEAAyE;AACzE,uEAAuE;AACvE,qEAAqE;AACrE,wEAAwE;AACxE,sEAAsE;AACtE,uEAAuE;AACvE,qCAAqC;AACrC,mEAAmE;AACnE,yEAAyE;AACzE,wBAAwB;AAExB,OAAO,EACL,mBAAmB,EACnB,cAAc,EACd,8BAA8B,EAC9B,gBAAgB,EAChB,qBAAqB,EACrB,wBAA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IAAI,CAAC;SAC3C;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { Manifest } from "../../schema/index.js";
|
|
2
|
-
export interface CodexConfigDriftSection {
|
|
3
|
-
/** ⚠ lines; each rolls into warningCount. */
|
|
4
|
-
warnings: string[];
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* Whether the manifest's `understanding-before-execution` pack has opted
|
|
8
|
-
* Codex into the `auto_approve` path (`auto_approve.harnesses` contains
|
|
9
|
-
* `"codex"`). Pure and side-effect-free: reuses the same fail-closed
|
|
10
|
-
* parser the Codex PreToolUse hook itself consults
|
|
11
|
-
* (`attemptAutoApproval` in `../pack/auto-approve-path.ts`), so a
|
|
12
|
-
* malformed `auto_approve` block resolves to "not opted in" here too,
|
|
13
|
-
* never a guess.
|
|
14
|
-
*/
|
|
15
|
-
export declare function isCodexOptedIntoAutoApprove(manifest: Manifest): boolean;
|
|
16
|
-
export interface BuildCodexConfigDriftOptions {
|
|
17
|
-
/** `harness.generated/` for the manifest in use; kept for shape-parity with `BuildSettingsDriftOptions` (`driftCheckOpts` in index.ts is shared between both), unused by this check (see module header: no baseline exists to read here). */
|
|
18
|
-
generatedDir: string;
|
|
19
|
-
/** `harness.lock` path for the manifest in use; kept for the same shape-parity reason as `generatedDir`, unused by this check. */
|
|
20
|
-
lockPath: string;
|
|
21
|
-
/** Resolves the repo-scoped candidate file (`<cwd>/.codex/config.toml`). */
|
|
22
|
-
cwd: string;
|
|
23
|
-
/** Operator home; resolves the default `$CODEX_HOME` when the env var is unset. */
|
|
24
|
-
home: string;
|
|
25
|
-
/** Env for `CODEX_HOME` resolution. */
|
|
26
|
-
env: NodeJS.ProcessEnv;
|
|
27
|
-
}
|
|
28
|
-
export declare function buildCodexConfigDrift(opts: BuildCodexConfigDriftOptions): CodexConfigDriftSection;
|
|
@@ -1,240 +0,0 @@
|
|
|
1
|
-
// Codex counterpart of settings-drift.ts (ADR
|
|
2
|
-
// docs/decisions/2026-08-27-ug-auto-mode-approval.md, threat model (c),
|
|
3
|
-
// "Audit and doctor"), follow-up of slice 2 (agent-tasks f59ea0eb).
|
|
4
|
-
//
|
|
5
|
-
// `approval_policy = "never"` is the MEASURED signal: dogfood/ug-auto-
|
|
6
|
-
// mode-signals/README.md section (l) (Codex TUI) shows `tui-config-never`
|
|
7
|
-
// (`config.toml`: `approval_policy = "never"`) reports `bypassPermissions`
|
|
8
|
-
// where the otherwise-comparable `tui-default` shape (no `approval_policy`
|
|
9
|
-
// set) reports `default`, and section (k) (Codex exec) shows the same
|
|
10
|
-
// key discriminating `exec-onrequest`/`exec-onfailure` (`bypassPermissions`
|
|
11
|
-
// regardless, exec auto-approves almost everything headless) from nothing
|
|
12
|
-
// special, i.e. exec's own vocabulary does not turn on this key either
|
|
13
|
-
// way there. The `default_permissions` full-access check below is NOT a
|
|
14
|
-
// measured signal in the same sense: section (k)'s exec rows show
|
|
15
|
-
// `config-perm-fullaccess` (`default_permissions = ":danger-full-access"`)
|
|
16
|
-
// and `config-perm-readonly` (`default_permissions = ":read-only"`) both
|
|
17
|
-
// reporting `bypassPermissions`, i.e. this key does not discriminate
|
|
18
|
-
// `permission_mode` at all under `codex exec`, and section (l)'s TUI
|
|
19
|
-
// table has no `default_permissions`-via-`config.toml` row at all (the
|
|
20
|
-
// one full-access TUI shape, `tui-perm-full-access`, was set through the
|
|
21
|
-
// `/permissions` menu, not this config key, per
|
|
22
|
-
// `payloads/codex-tui-perm-full-access.config.toml`). This check flags
|
|
23
|
-
// `default_permissions` as a threat-model heuristic on a key the operator
|
|
24
|
-
// can set (it is documented Codex config surface that plausibly feeds a
|
|
25
|
-
// yet-unmeasured code path), not because measurement showed it moving
|
|
26
|
-
// `permission_mode`.
|
|
27
|
-
//
|
|
28
|
-
// Either key pre-sets the trusted `when`-allowlist signal the Codex
|
|
29
|
-
// auto-approval path (`src/cli/pack/auto-approve-path.ts`,
|
|
30
|
-
// `CODEX_HARNESS`) consumes, the same way `permissions.defaultMode` does
|
|
31
|
-
// for Claude Code (settings-drift.ts's module header, threat model (c)).
|
|
32
|
-
//
|
|
33
|
-
// Gated on the pack's `auto_approve.harnesses` actually listing `codex`
|
|
34
|
-
// (`isCodexOptedIntoAutoApprove` below): a repo that never opted Codex
|
|
35
|
-
// into the auto path has no live Codex `permission_mode` signal for this
|
|
36
|
-
// key to pre-set, so warning there would be noise unconnected to any
|
|
37
|
-
// live risk (mirrors the per-harness gate `attemptAutoApproval` itself
|
|
38
|
-
// applies before the `when` allowlist, `auto-approve.ts`'s module
|
|
39
|
-
// header).
|
|
40
|
-
//
|
|
41
|
-
// Unlike settings-drift.ts's `permissions.defaultMode` check, this is
|
|
42
|
-
// NOT drift-gated (warn only when the live value differs from the
|
|
43
|
-
// apply-time baseline): `approval_policy = "never"` is a real live risk
|
|
44
|
-
// the moment it is present, whether or not it was already there at the
|
|
45
|
-
// last `harness apply`, so this check always warns while present and
|
|
46
|
-
// opted in. There is no apply-time three-way distinction to annotate
|
|
47
|
-
// with either: harness never snapshots the operator's live, whole
|
|
48
|
-
// `config.toml` (only `harness apply --runtime codex --install`'s own
|
|
49
|
-
// generated hook block, merged in place by `install-codex-config.ts`,
|
|
50
|
-
// ever lands in `.last-apply`'s `"codex/config.toml"` entry), and
|
|
51
|
-
// `apply.ts` never records a `kind: "target"` lock entry for the
|
|
52
|
-
// installed Codex config path the way it does for Claude Code's
|
|
53
|
-
// `--target` write, so there is no baseline to compare the live value
|
|
54
|
-
// against and no lock entry to tell a harness-touched file apart from
|
|
55
|
-
// one it has never seen. Every warning below therefore carries the same
|
|
56
|
-
// constant `NO_SNAPSHOT_SUFFIX`, reporting presence, not drift.
|
|
57
|
-
//
|
|
58
|
-
// Fail-open, like every other doctor check in this family: a missing or
|
|
59
|
-
// unreadable candidate file resolves to "nothing to report" for that
|
|
60
|
-
// file, and a candidate whose TOML this module's minimal scanner cannot
|
|
61
|
-
// make sense of (an unterminated quoted string) adds ONE diagnostic
|
|
62
|
-
// line, never a thrown error; the keys that did parse from the rest of
|
|
63
|
-
// that same file are still evaluated and can still warn.
|
|
64
|
-
//
|
|
65
|
-
// No full TOML parser: none is a dependency of this package (checked
|
|
66
|
-
// before writing this file), and `install-codex-config.ts` itself never
|
|
67
|
-
// parses the operator's config.toml into an object either, it locates
|
|
68
|
-
// harness's own managed block by string search. This module only needs
|
|
69
|
-
// two ROOT-LEVEL (not inside any `[table]`) string-valued keys, so a
|
|
70
|
-
// small line-oriented scanner is enough: it accepts a bare or quoted key
|
|
71
|
-
// (`approval_policy = ...` and `"approval_policy" = ...`), skips over
|
|
72
|
-
// multi-line basic/literal string bodies (`"""`/`'''`) so a body line
|
|
73
|
-
// that happens to look like `key = "value"` inside one is never
|
|
74
|
-
// mistaken for a root-level assignment, and does not attempt custom
|
|
75
|
-
// `[profiles.*]` tables: a profile-scoped `approval_policy` under
|
|
76
|
-
// `[profiles.<name>]` is out of scope and not detected today (see the
|
|
77
|
-
// task's constraints).
|
|
78
|
-
import * as fs from "node:fs";
|
|
79
|
-
import * as path from "node:path";
|
|
80
|
-
import { PACK_NAME as UNDERSTANDING_PACK_NAME } from "../../policy-packs/builtin/understanding-before-execution.js";
|
|
81
|
-
import { CODEX_HARNESS, harnessAllowed, parseAutoApprove, } from "../../policy-packs/builtin/understanding-before-execution/auto-approve.js";
|
|
82
|
-
import { tildeize } from "./settings-drift.js";
|
|
83
|
-
/** Every warning line carries this: harness keeps no apply-time snapshot of a live Codex config.toml (see module header). */
|
|
84
|
-
const NO_SNAPSHOT_SUFFIX = " (harness keeps no apply-time snapshot of this file; presence only)";
|
|
85
|
-
/**
|
|
86
|
-
* Whether the manifest's `understanding-before-execution` pack has opted
|
|
87
|
-
* Codex into the `auto_approve` path (`auto_approve.harnesses` contains
|
|
88
|
-
* `"codex"`). Pure and side-effect-free: reuses the same fail-closed
|
|
89
|
-
* parser the Codex PreToolUse hook itself consults
|
|
90
|
-
* (`attemptAutoApproval` in `../pack/auto-approve-path.ts`), so a
|
|
91
|
-
* malformed `auto_approve` block resolves to "not opted in" here too,
|
|
92
|
-
* never a guess.
|
|
93
|
-
*/
|
|
94
|
-
export function isCodexOptedIntoAutoApprove(manifest) {
|
|
95
|
-
const pack = manifest.policy_packs.find((p) => p.name === UNDERSTANDING_PACK_NAME && p.enabled !== false);
|
|
96
|
-
if (!pack)
|
|
97
|
-
return false;
|
|
98
|
-
const cfg = parseAutoApprove(pack.config["auto_approve"], null);
|
|
99
|
-
return harnessAllowed(cfg, CODEX_HARNESS);
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Scan the ROOT-LEVEL (before the first `[table]` header) `key = "..."`
|
|
103
|
-
* assignments in a Codex `config.toml` body. Returns the string-valued
|
|
104
|
-
* keys found, plus `malformed: true` when a candidate assignment opens a
|
|
105
|
-
* single-line quoted string that never closes on the same line (the one
|
|
106
|
-
* shape this scanner treats as broken TOML rather than "not a string /
|
|
107
|
-
* not a key we track"). A multi-line basic/literal string (`"""`/`'''`)
|
|
108
|
-
* is a different, valid TOML shape: every line up to and including its
|
|
109
|
-
* closing delimiter is skipped rather than scanned as assignments, and
|
|
110
|
-
* skipping it never sets `malformed`. Non-string values (numbers,
|
|
111
|
-
* booleans, arrays, inline tables) are silently skipped too, not flagged
|
|
112
|
-
* malformed: this scanner has no opinion about them. The key itself may
|
|
113
|
-
* be bare (`approval_policy`) or a quoted TOML key
|
|
114
|
-
* (`"approval_policy"` / `'approval_policy'`); either form is accepted.
|
|
115
|
-
*/
|
|
116
|
-
function scanRootLevelStringKeys(raw) {
|
|
117
|
-
const values = {};
|
|
118
|
-
let malformed = false;
|
|
119
|
-
let multilineDelim = null;
|
|
120
|
-
for (const rawLine of raw.split(/\r?\n/)) {
|
|
121
|
-
if (multilineDelim !== null) {
|
|
122
|
-
// Inside a multi-line basic/literal string body: this line is
|
|
123
|
-
// string content, never a root-level assignment, however much it
|
|
124
|
-
// may look like one. Only the closing delimiter ends the skip.
|
|
125
|
-
if (rawLine.includes(multilineDelim))
|
|
126
|
-
multilineDelim = null;
|
|
127
|
-
continue;
|
|
128
|
-
}
|
|
129
|
-
const line = rawLine.trim();
|
|
130
|
-
if (line.length === 0 || line.startsWith("#"))
|
|
131
|
-
continue;
|
|
132
|
-
// A `[table]` or `[[array-of-tables]]` header ends the root-level
|
|
133
|
-
// scope for every key from here on; this module only tracks
|
|
134
|
-
// root-level keys.
|
|
135
|
-
if (line.startsWith("["))
|
|
136
|
-
break;
|
|
137
|
-
const eq = line.indexOf("=");
|
|
138
|
-
if (eq === -1)
|
|
139
|
-
continue;
|
|
140
|
-
let key = line.slice(0, eq).trim();
|
|
141
|
-
if ((key.startsWith('"') && key.endsWith('"') && key.length >= 2) ||
|
|
142
|
-
(key.startsWith("'") && key.endsWith("'") && key.length >= 2)) {
|
|
143
|
-
key = key.slice(1, -1);
|
|
144
|
-
}
|
|
145
|
-
if (!/^[A-Za-z0-9_-]+$/.test(key))
|
|
146
|
-
continue;
|
|
147
|
-
const valuePart = line.slice(eq + 1).trim();
|
|
148
|
-
if (valuePart.startsWith('"""') || valuePart.startsWith("'''")) {
|
|
149
|
-
const delim = valuePart.slice(0, 3);
|
|
150
|
-
// A closing delimiter later on this same line makes it a
|
|
151
|
-
// single-line multi-line-string literal; this scanner does not
|
|
152
|
-
// track such values (out of scope, same as any other value shape
|
|
153
|
-
// it has no opinion about), it just must not treat the rest of
|
|
154
|
-
// the file as still inside the string.
|
|
155
|
-
if (valuePart.indexOf(delim, 3) === -1)
|
|
156
|
-
multilineDelim = delim;
|
|
157
|
-
continue;
|
|
158
|
-
}
|
|
159
|
-
const parsed = matchTomlString(valuePart);
|
|
160
|
-
if (parsed === null) {
|
|
161
|
-
if (valuePart.startsWith('"') || valuePart.startsWith("'"))
|
|
162
|
-
malformed = true;
|
|
163
|
-
continue;
|
|
164
|
-
}
|
|
165
|
-
values[key] = parsed;
|
|
166
|
-
}
|
|
167
|
-
return { values, malformed };
|
|
168
|
-
}
|
|
169
|
-
/** A basic (`"..."`) or literal (`'...'`) single-line TOML string, or `null` if `value` is not one. */
|
|
170
|
-
function matchTomlString(value) {
|
|
171
|
-
if (value.startsWith('"')) {
|
|
172
|
-
const m = /^"((?:[^"\\]|\\.)*)"/.exec(value);
|
|
173
|
-
if (!m)
|
|
174
|
-
return null;
|
|
175
|
-
return (m[1] ?? "")
|
|
176
|
-
.replace(/\\"/g, '"')
|
|
177
|
-
.replace(/\\n/g, "\n")
|
|
178
|
-
.replace(/\\t/g, "\t")
|
|
179
|
-
.replace(/\\\\/g, "\\");
|
|
180
|
-
}
|
|
181
|
-
if (value.startsWith("'")) {
|
|
182
|
-
const m = /^'([^']*)'/.exec(value);
|
|
183
|
-
if (!m)
|
|
184
|
-
return null;
|
|
185
|
-
return m[1] ?? "";
|
|
186
|
-
}
|
|
187
|
-
return null;
|
|
188
|
-
}
|
|
189
|
-
function checkOneFile(file, warnings) {
|
|
190
|
-
let raw;
|
|
191
|
-
try {
|
|
192
|
-
raw = fs.readFileSync(file.absolutePath, "utf8");
|
|
193
|
-
}
|
|
194
|
-
catch {
|
|
195
|
-
return;
|
|
196
|
-
}
|
|
197
|
-
const scan = scanRootLevelStringKeys(raw);
|
|
198
|
-
if (scan.malformed) {
|
|
199
|
-
warnings.push(`${file.displayLabel}: unreadable/invalid Codex config TOML`);
|
|
200
|
-
// Keep going: a malformed line elsewhere in the file must not hide a
|
|
201
|
-
// risky key that DID parse from a different line of the same file.
|
|
202
|
-
}
|
|
203
|
-
const approvalPolicy = scan.values["approval_policy"];
|
|
204
|
-
if (approvalPolicy === "never") {
|
|
205
|
-
warnings.push(`approval_policy = "never" set in ${file.displayLabel}${NO_SNAPSHOT_SUFFIX}`);
|
|
206
|
-
}
|
|
207
|
-
const defaultPermissions = scan.values["default_permissions"];
|
|
208
|
-
if (defaultPermissions !== undefined) {
|
|
209
|
-
const stripped = defaultPermissions.startsWith(":")
|
|
210
|
-
? defaultPermissions.slice(1)
|
|
211
|
-
: defaultPermissions;
|
|
212
|
-
if (stripped === "danger-full-access") {
|
|
213
|
-
warnings.push(`default_permissions = ${JSON.stringify(defaultPermissions)} (full access) set in ${file.displayLabel}${NO_SNAPSHOT_SUFFIX}`);
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
export function buildCodexConfigDrift(opts) {
|
|
218
|
-
const warnings = [];
|
|
219
|
-
const codexHomeEnv = opts.env["CODEX_HOME"];
|
|
220
|
-
const codexHomeFromEnv = typeof codexHomeEnv === "string" && codexHomeEnv.trim().length > 0;
|
|
221
|
-
const codexHomeDir = codexHomeFromEnv ? codexHomeEnv : path.join(opts.home, ".codex");
|
|
222
|
-
const codexHomeConfigPath = path.join(codexHomeDir, "config.toml");
|
|
223
|
-
const candidates = [
|
|
224
|
-
{
|
|
225
|
-
absolutePath: path.resolve(codexHomeConfigPath),
|
|
226
|
-
displayLabel: codexHomeFromEnv
|
|
227
|
-
? "$CODEX_HOME/config.toml"
|
|
228
|
-
: tildeize(codexHomeConfigPath, opts.home),
|
|
229
|
-
},
|
|
230
|
-
{
|
|
231
|
-
absolutePath: path.resolve(opts.cwd, ".codex", "config.toml"),
|
|
232
|
-
displayLabel: ".codex/config.toml",
|
|
233
|
-
},
|
|
234
|
-
];
|
|
235
|
-
for (const c of candidates) {
|
|
236
|
-
checkOneFile(c, warnings);
|
|
237
|
-
}
|
|
238
|
-
return { warnings };
|
|
239
|
-
}
|
|
240
|
-
//# sourceMappingURL=codex-config-drift.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"codex-config-drift.js","sourceRoot":"","sources":["../../../src/cli/doctor/codex-config-drift.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,wEAAwE;AACxE,oEAAoE;AACpE,EAAE;AACF,uEAAuE;AACvE,0EAA0E;AAC1E,2EAA2E;AAC3E,2EAA2E;AAC3E,sEAAsE;AACtE,4EAA4E;AAC5E,0EAA0E;AAC1E,uEAAuE;AACvE,wEAAwE;AACxE,kEAAkE;AAClE,2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AM,mBAAmB,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,aAAa,CAAC,CAAC;IAEnE,MAAM,UAAU,GAA2B;QACzC;YACE,YAAY,EAAE,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC;YAC/C,YAAY,EAAE,gBAAgB;gBAC5B,CAAC,CAAC,yBAAyB;gBAC3B,CAAC,CAAC,QAAQ,CAAC,mBAAmB,EAAE,IAAI,CAAC,IAAI,CAAC;SAC7C;QACD;YACE,YAAY,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,EAAE,aAAa,CAAC;YAC7D,YAAY,EAAE,oBAAoB;SACnC;KACF,CAAC;IAEF,KAAK,MAAM,CAAC,IAAI,UAAU,EAAE,CAAC;QAC3B,YAAY,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;IAC5B,CAAC;IAED,OAAO,EAAE,QAAQ,EAAE,CAAC;AACtB,CAAC"}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import * as fs from "node:fs";
|
|
2
|
-
export interface RogueLedgerDb {
|
|
3
|
-
/** Absolute path to the rogue ledger.db file. */
|
|
4
|
-
path: string;
|
|
5
|
-
/** Absolute path to the rogue `~` directory (the cleanup target). */
|
|
6
|
-
rogueDir: string;
|
|
7
|
-
}
|
|
8
|
-
export interface RogueLedgerScanOptions {
|
|
9
|
-
homeDir: string;
|
|
10
|
-
cwd: string;
|
|
11
|
-
/**
|
|
12
|
-
* Test injection: override fs operations. realpathSync is included so
|
|
13
|
-
* fixtures can simulate symlinks-with-same-target without actually
|
|
14
|
-
* creating cross-tmpdir symlinks (which surface differently on macOS
|
|
15
|
-
* and Linux because of /tmp -> /private/tmp resolution).
|
|
16
|
-
*/
|
|
17
|
-
fsInterface?: Pick<typeof fs, "existsSync" | "statSync" | "lstatSync" | "readdirSync" | "realpathSync">;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Walk a small set of well-known parent directories for a literal `~`
|
|
21
|
-
* subdirectory that contains `.evidence-ledger/ledger.db`. Best-effort:
|
|
22
|
-
* unreadable directories are silently skipped. Returns deduplicated
|
|
23
|
-
* results (by realpath) sorted by path for stable rendering.
|
|
24
|
-
*/
|
|
25
|
-
export declare function scanForRogueLedgers(opts: RogueLedgerScanOptions): RogueLedgerDb[];
|
|
26
|
-
export interface DeleteRogueLedgersOptions {
|
|
27
|
-
/**
|
|
28
|
-
* When true, skip per-hit confirmation prompts and delete immediately.
|
|
29
|
-
* Maps to `harness doctor --rm-rogue-ledgers --yes`.
|
|
30
|
-
*/
|
|
31
|
-
yes?: boolean;
|
|
32
|
-
/**
|
|
33
|
-
* Test injection: called per hit with the rogueDir path; returns true to
|
|
34
|
-
* confirm deletion, false to skip. When omitted and `yes` is false,
|
|
35
|
-
* production code prompts via readline on stdin.
|
|
36
|
-
* Same knob pattern as `mcpProbe` / `fsInterface` elsewhere in doctor.
|
|
37
|
-
*/
|
|
38
|
-
promptFn?: (rogueDir: string) => Promise<boolean>;
|
|
39
|
-
}
|
|
40
|
-
export interface DeleteRogueLedgersResult {
|
|
41
|
-
/** Hits that were confirmed and whose rogueDir was removed. */
|
|
42
|
-
deleted: RogueLedgerDb[];
|
|
43
|
-
/** Hits that were skipped (operator declined or safety check failed). */
|
|
44
|
-
skipped: RogueLedgerDb[];
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Delete confirmed rogue ledger directories.
|
|
48
|
-
*
|
|
49
|
-
* Safety invariant: only deletes `hit.rogueDir` (the literal-tilde `~`
|
|
50
|
-
* directory), never its parent. Any hit whose rogueDir basename is not
|
|
51
|
-
* exactly `~` is silently skipped as a belt-and-suspenders guard.
|
|
52
|
-
*/
|
|
53
|
-
export declare function deleteRogueLedgers(hits: RogueLedgerDb[], opts?: DeleteRogueLedgersOptions): Promise<DeleteRogueLedgersResult>;
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
// Detect leftover rogue evidence-ledger DBs from the literal-tilde
|
|
2
|
-
// `EVIDENCE_LEDGER_DB` env leak (root cause + fix: agent-tasks/42d224a6,
|
|
3
|
-
// harness PR #101). The env block expanded `~/.evidence-ledger/ledger.db`
|
|
4
|
-
// as a literal directory name relative to the grounding-mcp cwd, so
|
|
5
|
-
// every spawn cwd grew a sibling `~/.evidence-ledger/ledger.db` tree.
|
|
6
|
-
//
|
|
7
|
-
// The fix removed the env block, so no new rogue DBs appear. The existing
|
|
8
|
-
// ones on disk are harmless orphans, but they take up space and confuse
|
|
9
|
-
// forensics ("why do I have three identical-shape ledger DBs?"). This
|
|
10
|
-
// scan flags them so the operator can `rm -rf` at their convenience.
|
|
11
|
-
//
|
|
12
|
-
// Scan scope is bounded by design: the literal `~` directory only ever
|
|
13
|
-
// appears one level deep under wherever grounding-mcp was spawned. The
|
|
14
|
-
// well-known spawn-cwd locations are: $HOME (when claude-code spawns from
|
|
15
|
-
// the user's home), $HOME/git/<repo> (the per-repo working tree), and
|
|
16
|
-
// $PWD (whatever directory the operator invoked harness from). No
|
|
17
|
-
// recursion past one level: we are not a generic disk-cleanup tool.
|
|
18
|
-
import * as fs from "node:fs";
|
|
19
|
-
import * as path from "node:path";
|
|
20
|
-
import * as readline from "node:readline/promises";
|
|
21
|
-
const ROGUE_DIRNAME = "~";
|
|
22
|
-
const LEDGER_RELPATH = path.join(".evidence-ledger", "ledger.db");
|
|
23
|
-
function hasRogueLedgerUnder(parent, fsi) {
|
|
24
|
-
// lstat (not stat) the `~` dir: a symlink at <parent>/~ pointing at
|
|
25
|
-
// /etc or at the real ~/.evidence-ledger would otherwise yield a
|
|
26
|
-
// false-positive flag (read-only, no security impact, but the
|
|
27
|
-
// operator gets nudged to rm -rf an arbitrary target). The orphan
|
|
28
|
-
// pattern we care about is a *real* literal-tilde directory.
|
|
29
|
-
const rogueDir = path.join(parent, ROGUE_DIRNAME);
|
|
30
|
-
if (!fsi.existsSync(rogueDir))
|
|
31
|
-
return null;
|
|
32
|
-
try {
|
|
33
|
-
if (fsi.lstatSync(rogueDir).isSymbolicLink())
|
|
34
|
-
return null;
|
|
35
|
-
}
|
|
36
|
-
catch {
|
|
37
|
-
return null;
|
|
38
|
-
}
|
|
39
|
-
const candidate = path.join(rogueDir, LEDGER_RELPATH);
|
|
40
|
-
if (!fsi.existsSync(candidate))
|
|
41
|
-
return null;
|
|
42
|
-
try {
|
|
43
|
-
if (!fsi.statSync(candidate).isFile())
|
|
44
|
-
return null;
|
|
45
|
-
}
|
|
46
|
-
catch {
|
|
47
|
-
return null;
|
|
48
|
-
}
|
|
49
|
-
return { path: candidate, rogueDir };
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Dedup key for a hit: prefer the realpath of the ledger.db file so two
|
|
53
|
-
* parent dirs that symlink to the same physical location collapse into a
|
|
54
|
-
* single hit. Falls back to the joined path when realpath is unavailable
|
|
55
|
-
* (EACCES on a strict-mode mount, ENOENT during a race with deletion).
|
|
56
|
-
* The fallback preserves the v1 dedup behavior so existing fixtures
|
|
57
|
-
* stay stable.
|
|
58
|
-
*/
|
|
59
|
-
function dedupKey(hit, fsi) {
|
|
60
|
-
try {
|
|
61
|
-
return fsi.realpathSync(hit.path);
|
|
62
|
-
}
|
|
63
|
-
catch {
|
|
64
|
-
return hit.path;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Walk a small set of well-known parent directories for a literal `~`
|
|
69
|
-
* subdirectory that contains `.evidence-ledger/ledger.db`. Best-effort:
|
|
70
|
-
* unreadable directories are silently skipped. Returns deduplicated
|
|
71
|
-
* results (by realpath) sorted by path for stable rendering.
|
|
72
|
-
*/
|
|
73
|
-
export function scanForRogueLedgers(opts) {
|
|
74
|
-
const fsi = opts.fsInterface ?? fs;
|
|
75
|
-
const seen = new Set();
|
|
76
|
-
const out = [];
|
|
77
|
-
const consider = (parent) => {
|
|
78
|
-
const hit = hasRogueLedgerUnder(parent, fsi);
|
|
79
|
-
if (!hit)
|
|
80
|
-
return;
|
|
81
|
-
const key = dedupKey(hit, fsi);
|
|
82
|
-
if (seen.has(key))
|
|
83
|
-
return;
|
|
84
|
-
seen.add(key);
|
|
85
|
-
out.push(hit);
|
|
86
|
-
};
|
|
87
|
-
consider(opts.homeDir);
|
|
88
|
-
consider(opts.cwd);
|
|
89
|
-
const gitParent = path.join(opts.homeDir, "git");
|
|
90
|
-
if (fsi.existsSync(gitParent)) {
|
|
91
|
-
let entries = [];
|
|
92
|
-
try {
|
|
93
|
-
entries = fsi.readdirSync(gitParent, { withFileTypes: true });
|
|
94
|
-
}
|
|
95
|
-
catch {
|
|
96
|
-
entries = [];
|
|
97
|
-
}
|
|
98
|
-
for (const e of entries) {
|
|
99
|
-
if (!e.isDirectory())
|
|
100
|
-
continue;
|
|
101
|
-
consider(path.join(gitParent, e.name));
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
out.sort((a, b) => a.path.localeCompare(b.path));
|
|
105
|
-
return out;
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Delete confirmed rogue ledger directories.
|
|
109
|
-
*
|
|
110
|
-
* Safety invariant: only deletes `hit.rogueDir` (the literal-tilde `~`
|
|
111
|
-
* directory), never its parent. Any hit whose rogueDir basename is not
|
|
112
|
-
* exactly `~` is silently skipped as a belt-and-suspenders guard.
|
|
113
|
-
*/
|
|
114
|
-
export async function deleteRogueLedgers(hits, opts = {}) {
|
|
115
|
-
const deleted = [];
|
|
116
|
-
const skipped = [];
|
|
117
|
-
for (const hit of hits) {
|
|
118
|
-
// Safety: only ever remove a directory whose basename is the literal `~`.
|
|
119
|
-
if (path.basename(hit.rogueDir) !== "~") {
|
|
120
|
-
skipped.push(hit);
|
|
121
|
-
continue;
|
|
122
|
-
}
|
|
123
|
-
let confirmed;
|
|
124
|
-
if (opts.yes) {
|
|
125
|
-
confirmed = true;
|
|
126
|
-
}
|
|
127
|
-
else if (opts.promptFn) {
|
|
128
|
-
confirmed = await opts.promptFn(hit.rogueDir);
|
|
129
|
-
}
|
|
130
|
-
else {
|
|
131
|
-
confirmed = await defaultDeletePrompt(hit.rogueDir);
|
|
132
|
-
}
|
|
133
|
-
if (confirmed) {
|
|
134
|
-
fs.rmSync(hit.rogueDir, { recursive: true, force: true });
|
|
135
|
-
deleted.push(hit);
|
|
136
|
-
}
|
|
137
|
-
else {
|
|
138
|
-
skipped.push(hit);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
return { deleted, skipped };
|
|
142
|
-
}
|
|
143
|
-
async function defaultDeletePrompt(rogueDir) {
|
|
144
|
-
const rl = readline.createInterface({ input: process.stdin, output: process.stderr });
|
|
145
|
-
try {
|
|
146
|
-
const answer = await rl.question(`Delete rogue directory ${rogueDir}? (y/N) `);
|
|
147
|
-
return answer.trim().toLowerCase() === "y";
|
|
148
|
-
}
|
|
149
|
-
finally {
|
|
150
|
-
rl.close();
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
//# sourceMappingURL=rogue-ledger.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rogue-ledger.js","sourceRoot":"","sources":["../../../src/cli/doctor/rogue-ledger.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,yEAAyE;AACzE,0EAA0E;AAC1E,oEAAoE;AACpE,sEAAsE;AACtE,EAAE;AACF,0EAA0E;AAC1E,wEAAwE;AACxE,sEAAsE;AACtE,qEAAqE;AACrE,EAAE;AACF,uEAAuE;AACvE,uEAAuE;AACvE,0EAA0E;AAC1E,sEAAsE;AACtE,kEAAkE;AAClE,oEAAoE;AAEpE,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,QAAQ,MAAM,wBAAwB,CAAC;AAqBnD,MAAM,aAAa,GAAG,GAAG,CAAC;AAC1B,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE,WAAW,CAAC,CAAC;AAElE,SAAS,mBAAmB,CAC1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