@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
package/dist/cli/event-input.js
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
// Shared tool-event input handling for the Risk Gate verbs that take a
|
|
2
|
-
// tool-event JSON file: `harness explain-action`, `harness test-risk`,
|
|
3
|
-
// `harness resolve-env`, and `harness explain-policy`.
|
|
4
|
-
//
|
|
5
|
-
// Each applies the same not-found / malformed / non-object guards,
|
|
6
|
-
// resolves the same ambient `EnvelopeContext` (git, host, user, now),
|
|
7
|
-
// and builds the Action Envelope. This module is that shared front end
|
|
8
|
-
// so every verb stays byte-identical in how it reads and normalizes
|
|
9
|
-
// its input.
|
|
10
|
-
import * as fs from "node:fs";
|
|
11
|
-
import * as os from "node:os";
|
|
12
|
-
import { buildActionEnvelope, resolveGitContext, } from "../runtime/index.js";
|
|
13
|
-
import { EX_NOINPUT, HarnessExitError } from "./exit-codes.js";
|
|
14
|
-
function safeUser() {
|
|
15
|
-
try {
|
|
16
|
-
return os.userInfo().username;
|
|
17
|
-
}
|
|
18
|
-
catch {
|
|
19
|
-
return "";
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
function safeHost() {
|
|
23
|
-
try {
|
|
24
|
-
return os.hostname();
|
|
25
|
-
}
|
|
26
|
-
catch {
|
|
27
|
-
return "";
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Read a tool-event JSON file and build its Action Envelope.
|
|
32
|
-
*
|
|
33
|
-
* Throws `HarnessExitError(EX_NOINPUT)` when the file is missing, is not
|
|
34
|
-
* valid JSON, or does not decode to a JSON object. A well-formed but
|
|
35
|
-
* sparse event (e.g. `{}`) is accepted: the envelope builder fills
|
|
36
|
-
* absent fields with empty values rather than throwing. `verb` only
|
|
37
|
-
* prefixes the error messages so the operator sees which command failed.
|
|
38
|
-
*/
|
|
39
|
-
export function loadEventEnvelope(eventPath, seams = {}, verb = "explain-action") {
|
|
40
|
-
let raw;
|
|
41
|
-
try {
|
|
42
|
-
raw = fs.readFileSync(eventPath, "utf8");
|
|
43
|
-
}
|
|
44
|
-
catch {
|
|
45
|
-
throw new HarnessExitError(`${verb}: event file not found or unreadable: ${eventPath}`, EX_NOINPUT);
|
|
46
|
-
}
|
|
47
|
-
let parsed;
|
|
48
|
-
try {
|
|
49
|
-
parsed = JSON.parse(raw);
|
|
50
|
-
}
|
|
51
|
-
catch (err) {
|
|
52
|
-
throw new HarnessExitError(`${verb}: malformed event JSON in ${eventPath}: ${err.message}`, EX_NOINPUT);
|
|
53
|
-
}
|
|
54
|
-
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
|
|
55
|
-
const got = parsed === null ? "null" : Array.isArray(parsed) ? "array" : typeof parsed;
|
|
56
|
-
throw new HarnessExitError(`${verb}: event JSON must be an object, got ${got}`, EX_NOINPUT);
|
|
57
|
-
}
|
|
58
|
-
const event = parsed;
|
|
59
|
-
const fallbackCwd = seams.cwdFallback ?? process.cwd();
|
|
60
|
-
const cwd = typeof event.cwd === "string" && event.cwd.length > 0
|
|
61
|
-
? event.cwd
|
|
62
|
-
: fallbackCwd;
|
|
63
|
-
const resolveGit = seams.resolveGit ?? resolveGitContext;
|
|
64
|
-
const envelope = buildActionEnvelope(event, {
|
|
65
|
-
cwd,
|
|
66
|
-
git: resolveGit(cwd),
|
|
67
|
-
user: seams.user ?? safeUser(),
|
|
68
|
-
host: seams.host ?? safeHost(),
|
|
69
|
-
now: seams.now ?? new Date(),
|
|
70
|
-
});
|
|
71
|
-
return { event, envelope };
|
|
72
|
-
}
|
|
73
|
-
//# sourceMappingURL=event-input.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"event-input.js","sourceRoot":"","sources":["../../src/cli/event-input.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,uEAAuE;AACvE,uDAAuD;AACvD,EAAE;AACF,mEAAmE;AACnE,sEAAsE;AACtE,uEAAuE;AACvE,oEAAoE;AACpE,aAAa;AAEb,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EACL,mBAAmB,EACnB,iBAAiB,GAIlB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAqB/D,SAAS,QAAQ;IACf,IAAI,CAAC;QACH,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC;IAChC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAED,SAAS,QAAQ;IACf,IAAI,CAAC;QACH,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC;IACvB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,iBAAiB,CAC/B,SAAiB,EACjB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CAAC;IAClB,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,IAAI,iBAAiB,CAAC;IAEzD,MAAM,QAAQ,GAAG,mBAAmB,CAAC,KAAK,EAAE;QAC1C,GAAG;QACH,GAAG,EAAE,UAAU,CAAC,GAAG,CAAC;QACpB,IAAI,EAAE,KAAK,CAAC,IAAI,IAAI,QAAQ,EAAE;QAC9B,IAAI,EAAE,KAAK,CAAC,IAAI,IAAI,QAAQ,EAAE;QAC9B,GAAG,EAAE,KAAK,CAAC,GAAG,IAAI,IAAI,IAAI,EAAE;KAC7B,CAAC,CAAC;IAEH,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;AAC7B,CAAC"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { ActionEnvelope } from "../runtime/index.js";
|
|
2
|
-
import { type Manifest } from "../schema/index.js";
|
|
3
|
-
import { type EnrichmentSeams } from "./enriched-event.js";
|
|
4
|
-
import { type EventInputSeams } from "./event-input.js";
|
|
5
|
-
import { type LoaderOptions } from "./loader.js";
|
|
6
|
-
export interface ExplainActionOptions extends EventInputSeams, EnrichmentSeams, LoaderOptions {
|
|
7
|
-
/** Inject the resolved manifest (tests); bypasses `loadManifest`. */
|
|
8
|
-
manifest?: Manifest;
|
|
9
|
-
/** Path to the tool-event JSON file. */
|
|
10
|
-
eventPath: string;
|
|
11
|
-
/** Emit JSON instead of YAML. */
|
|
12
|
-
json?: boolean;
|
|
13
|
-
}
|
|
14
|
-
export interface ExplainActionResult {
|
|
15
|
-
output: string;
|
|
16
|
-
envelope: ActionEnvelope;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Build and render the Action Envelope for a tool-event JSON file.
|
|
20
|
-
*
|
|
21
|
-
* Throws `HarnessExitError(EX_NOINPUT)` when the file is missing, is not
|
|
22
|
-
* valid JSON, or does not decode to a JSON object (see
|
|
23
|
-
* `loadEventEnvelope`). A well-formed but sparse event is accepted.
|
|
24
|
-
*/
|
|
25
|
-
export declare function explainAction(opts: ExplainActionOptions): ExplainActionResult;
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
// Phase 7 #2 — `harness explain-action` CLI entrypoint.
|
|
2
|
-
//
|
|
3
|
-
// Debug verb for the Risk Gate. Reads a tool-event JSON file (the
|
|
4
|
-
// Claude Code PreToolUse hook payload shape), builds the Action
|
|
5
|
-
// Envelope, and prints it. This is the inspection surface for the
|
|
6
|
-
// envelope normalization that Phase 7 #3-#5 build the classifier,
|
|
7
|
-
// resolver, and policy evaluator on top of.
|
|
8
|
-
//
|
|
9
|
-
// File read, JSON guards, and envelope build live in the shared
|
|
10
|
-
// `event-input` front end; this module only renders the result.
|
|
11
|
-
import * as fs from "node:fs";
|
|
12
|
-
import { stringify as stringifyYaml } from "yaml";
|
|
13
|
-
import { parseBashPrefix } from "../runtime/bash-prefix-parse.js";
|
|
14
|
-
import { parseManifest } from "../schema/index.js";
|
|
15
|
-
import { enrichLoadedEvent } from "./enriched-event.js";
|
|
16
|
-
import { loadEventEnvelope } from "./event-input.js";
|
|
17
|
-
import { loadManifest, resolvePaths } from "./loader.js";
|
|
18
|
-
import { readBashCommand } from "./policy/risk-envelope-enrichment.js";
|
|
19
|
-
function manifestFor(event, opts) {
|
|
20
|
-
if (opts.manifest)
|
|
21
|
-
return opts.manifest;
|
|
22
|
-
const command = event.tool_name === "Bash" ? readBashCommand(event.tool_input) : null;
|
|
23
|
-
const branchTarget = command === null ? null : parseBashPrefix(command).branchTarget;
|
|
24
|
-
if (branchTarget === null)
|
|
25
|
-
return parseManifest({ version: 1 });
|
|
26
|
-
// With no `--config` and no manifest at the default location there are no
|
|
27
|
-
// resolvers, so the branch-switch upgrade is a no-op: use the empty
|
|
28
|
-
// manifest, as for any other command. An explicit `--config` that is
|
|
29
|
-
// missing, and a manifest that is invalid, still fail loudly.
|
|
30
|
-
if (opts.configPath === undefined && !fs.existsSync(resolvePaths(opts).base)) {
|
|
31
|
-
return parseManifest({ version: 1 });
|
|
32
|
-
}
|
|
33
|
-
return loadManifest(opts).manifest;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Build and render the Action Envelope for a tool-event JSON file.
|
|
37
|
-
*
|
|
38
|
-
* Throws `HarnessExitError(EX_NOINPUT)` when the file is missing, is not
|
|
39
|
-
* valid JSON, or does not decode to a JSON object (see
|
|
40
|
-
* `loadEventEnvelope`). A well-formed but sparse event is accepted.
|
|
41
|
-
*/
|
|
42
|
-
export function explainAction(opts) {
|
|
43
|
-
const loaded = loadEventEnvelope(opts.eventPath, opts, "explain-action");
|
|
44
|
-
// Print the envelope the hook builds: after its Bash-prefix enrichment
|
|
45
|
-
// (leading `cd`, `git switch|checkout`; task 8b891e83). The manifest is
|
|
46
|
-
// consulted only by the branch-switch upgrade (it compares what the
|
|
47
|
-
// resolvers say for the two branches), so it is loaded only for a
|
|
48
|
-
// command with a leading `git switch|checkout`; every other event, and a
|
|
49
|
-
// machine with no manifest at the default location, keeps working with
|
|
50
|
-
// the empty manifest, as before.
|
|
51
|
-
const { envelope } = enrichLoadedEvent(loaded, manifestFor(loaded.event, opts), opts);
|
|
52
|
-
const output = opts.json
|
|
53
|
-
? `${JSON.stringify(envelope, null, 2)}\n`
|
|
54
|
-
: stringifyYaml(envelope, { lineWidth: 0 });
|
|
55
|
-
return { output, envelope };
|
|
56
|
-
}
|
|
57
|
-
//# sourceMappingURL=explain-action.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"explain-action.js","sourceRoot":"","sources":["../../src/cli/explain-action.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,EAAE;AACF,kEAAkE;AAClE,gEAAgE;AAChE,kEAAkE;AAClE,kEAAkE;AAClE,4CAA4C;AAC5C,EAAE;AACF,gEAAgE;AAChE,gEAAgE;AAEhE,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,MAAM,CAAC;AAElD,OAAO,EAAE,e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EAAE,IAAI,EAAE,gBAAgB,CAAC,CAAC;IACzE,uEAAuE;IACvE,wEAAwE;IACxE,oEAAoE;IACpE,kEAAkE;IAClE,yEAAyE;IACzE,uEAAuE;IACvE,iCAAiC;IACjC,MAAM,EAAE,QAAQ,EAAE,GAAG,iBAAiB,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC;IACtF,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI;QACtB,CAAC,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI;QAC1C,CAAC,CAAC,aAAa,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC;IAC9C,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;AAC9B,CAAC"}
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
import { type DeletionTargetVerdict, type EnvironmentResolution, type RiskProfile, type WhenClauseResult } from "../runtime/index.js";
|
|
2
|
-
import type { Manifest } from "../schema/index.js";
|
|
3
|
-
import { type EventInputSeams } from "./event-input.js";
|
|
4
|
-
import { type LoaderOptions } from "./loader.js";
|
|
5
|
-
export interface ExplainPolicyOptions extends EventInputSeams, LoaderOptions {
|
|
6
|
-
/** Path to the tool-event JSON file (the `--event` argument). */
|
|
7
|
-
eventPath: string;
|
|
8
|
-
/** Emit JSON instead of YAML. */
|
|
9
|
-
json?: boolean;
|
|
10
|
-
/** Inject the resolved manifest (tests); bypasses `loadManifest`. */
|
|
11
|
-
manifest?: Manifest;
|
|
12
|
-
/** Inject env vars for `env_var_patterns` (tests); defaults to `process.env`. */
|
|
13
|
-
env?: Record<string, string | undefined>;
|
|
14
|
-
/** Inject the kube context (tests); bypasses `~/.kube/config`. */
|
|
15
|
-
kubeContext?: string;
|
|
16
|
-
/** Inject the kube namespace (tests); bypasses `~/.kube/config`. */
|
|
17
|
-
kubeNamespace?: string;
|
|
18
|
-
/**
|
|
19
|
-
* cwd `session_start_preflight.setup`'s per-repo project layer is
|
|
20
|
-
* derived from when `opts.project` is absent (task c88461c1, review
|
|
21
|
-
* round 2, decision D-021b): the same `deriveProjectName` helper
|
|
22
|
-
* `harness session-start preflight` and `harness doctor` also feed
|
|
23
|
-
* their own `loadManifest` call from, so all three consumers agree on
|
|
24
|
-
* which project layer applies to a given cwd instead of `explain-
|
|
25
|
-
* policy` silently reporting the base/machine value for a repo whose
|
|
26
|
-
* producer is actually reading a project layer. Defaults to
|
|
27
|
-
* `process.cwd()`; tests inject a fixture repo dir to stay hermetic
|
|
28
|
-
* against the real cwd.
|
|
29
|
-
*/
|
|
30
|
-
cwd?: string;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Which resolved layer decided `session_start_preflight.setup` (task
|
|
34
|
-
* c88461c1): "project" when the resolved project-override layer
|
|
35
|
-
* itself declares the key, "machine" when a resolved machine-override
|
|
36
|
-
* layer declares it (and no project layer does), "base" otherwise
|
|
37
|
-
* (the base manifest, or the schema default when nothing declares the
|
|
38
|
-
* key at all). Mirrors the loader's own last-wins precedence
|
|
39
|
-
* (`applyLayers(baseRaw, ...machineLayers, projectLayer)`,
|
|
40
|
-
* `src/overrides/merge.ts`): the project layer is checked first since
|
|
41
|
-
* it is the highest-precedence layer, then machine layers from the
|
|
42
|
-
* last-applied (highest-precedence) one back to the first.
|
|
43
|
-
*
|
|
44
|
-
* "unresolvable" (task c88461c1, review round 3 residual; task
|
|
45
|
-
* `1c4eb3ea` of the batch-44 follow-up run): the cwd-derived project-scoped SECOND
|
|
46
|
-
* load itself threw (a malformed project layer, an unreadable file).
|
|
47
|
-
* Deliberately NOT "base": the base/machine values were never actually
|
|
48
|
-
* re-read on this path (the plain load above them; see the round-3
|
|
49
|
-
* comment this residual corrected), so attributing the result to
|
|
50
|
-
* "base" would claim a value the base layer may not carry. `setup`
|
|
51
|
-
* degrades to `false` alongside it, matching the producer's own
|
|
52
|
-
* `setupEnabled` catch (`src/cli/session-start/index.ts`), so the two
|
|
53
|
-
* agree on a scoped-load failure instead of only on a healthy load.
|
|
54
|
-
*/
|
|
55
|
-
export type SessionStartPreflightLayerSource = "base" | "machine" | "project" | "unresolvable";
|
|
56
|
-
interface ExplainPolicyProjection {
|
|
57
|
-
policy: string;
|
|
58
|
-
description: string;
|
|
59
|
-
trigger: {
|
|
60
|
-
event: string;
|
|
61
|
-
match?: string;
|
|
62
|
-
path_match?: string;
|
|
63
|
-
bash_match?: string;
|
|
64
|
-
matched: boolean;
|
|
65
|
-
};
|
|
66
|
-
classifier: RiskProfile;
|
|
67
|
-
environment: EnvironmentResolution;
|
|
68
|
-
/**
|
|
69
|
-
* Which parts of the hook's evaluation this verb mirrors and which it
|
|
70
|
-
* deliberately does not (task 7c3919a2). `envelope_enrichment` lists the
|
|
71
|
-
* Bash-prefix merges shared with `harness policy intercept`;
|
|
72
|
-
* `not_evaluated` lists what the hook does that this hypothetical,
|
|
73
|
-
* read-free verb does not.
|
|
74
|
-
*/
|
|
75
|
-
parity: {
|
|
76
|
-
envelope_enrichment: string[];
|
|
77
|
-
not_evaluated: string[];
|
|
78
|
-
/**
|
|
79
|
-
* Per-event (task 8b891e83): true when the Bash prefix remainder
|
|
80
|
-
* (what follows a leading `cd`/`VAR=value`/`git switch` prefix) is a
|
|
81
|
-
* `kubectl` command carrying an explicit `--context`/`--namespace`/
|
|
82
|
-
* `-n`. The hook merges that target into its environment resolution
|
|
83
|
-
* upgrade-only; this verb never does (`not_evaluated` lists
|
|
84
|
-
* `kubectl_target` statically), so `true` tells the operator the
|
|
85
|
-
* `applies` verdict below was computed WITHOUT a merge the hook
|
|
86
|
-
* would perform for this very event. `false` means no such target
|
|
87
|
-
* was found, i.e. the skipped merge would have been a no-op.
|
|
88
|
-
*/
|
|
89
|
-
kubectl_target_present: boolean;
|
|
90
|
-
};
|
|
91
|
-
/** Static deletion-target verdict (task d03af8f6); null when the
|
|
92
|
-
* event's command is not a recognized deletion verb. */
|
|
93
|
-
deletion_target: DeletionTargetVerdict | null;
|
|
94
|
-
/**
|
|
95
|
-
* Resolved `session_start_preflight` config (task 30183330), shown
|
|
96
|
-
* only when the explained policy is one of the init-generated
|
|
97
|
-
* `preflight-before-*` gates (name starts with `preflight-before-`):
|
|
98
|
-
* this is the knob that decides whether the `harness session-start
|
|
99
|
-
* preflight` / `harness preflight` producer passes `--setup` to the
|
|
100
|
-
* `preflight run` invocation whose `ready:true` result these policies
|
|
101
|
-
* gate on. Omitted for every other policy; it has no bearing on
|
|
102
|
-
* their evaluation (review round 3 residual; task `1c4eb3ea`: the
|
|
103
|
-
* scoped SECOND load below this field's assignment site runs ONLY
|
|
104
|
-
* when this condition is already true, so a policy this block is
|
|
105
|
-
* never rendered for never pays for that extra load either).
|
|
106
|
-
* `source` (task c88461c1) names which resolved layer decided the
|
|
107
|
-
* value: `"base"` (also covers an injected `opts.manifest`, which
|
|
108
|
-
* carries no per-layer provenance to attribute), `"machine"`,
|
|
109
|
-
* `"project"` (the cwd-derived per-repo layer), or `"unresolvable"`
|
|
110
|
-
* (review round 3 residual; task `1c4eb3ea`: the scoped load itself
|
|
111
|
-
* threw, `setup` degrades to `false` alongside it). This function
|
|
112
|
-
* derives that project name itself, from `opts.cwd`, via the SAME
|
|
113
|
-
* `deriveProjectName` helper `harness session-start preflight` feeds
|
|
114
|
-
* through `LoaderOptions.project` (review round 2, decision D-021b:
|
|
115
|
-
* without this, an operator running `explain-policy` with no
|
|
116
|
-
* `--project` in a repo that DOES have a project layer would see the
|
|
117
|
-
* base/machine value while the producer itself reads the project
|
|
118
|
-
* layer, see src/cli/session-start/index.ts).
|
|
119
|
-
*/
|
|
120
|
-
session_start_preflight?: {
|
|
121
|
-
setup: boolean;
|
|
122
|
-
source: SessionStartPreflightLayerSource;
|
|
123
|
-
};
|
|
124
|
-
when: {
|
|
125
|
-
declared: false;
|
|
126
|
-
} | {
|
|
127
|
-
declared: true;
|
|
128
|
-
matched: boolean;
|
|
129
|
-
clauses: WhenClauseResult[];
|
|
130
|
-
unclassifiedFallback: boolean;
|
|
131
|
-
};
|
|
132
|
-
/** trigger AND when — would this policy fire on this event? */
|
|
133
|
-
applies: boolean;
|
|
134
|
-
}
|
|
135
|
-
export interface ExplainPolicyResult {
|
|
136
|
-
output: string;
|
|
137
|
-
projection: ExplainPolicyProjection;
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Explain whether `policyName` applies to the event at `opts.eventPath`.
|
|
141
|
-
*
|
|
142
|
-
* Throws `HarnessExitError(EX_USAGE)` when the named policy is not
|
|
143
|
-
* declared in the manifest, and `HarnessExitError(EX_NOINPUT)` (via
|
|
144
|
-
* `loadEventEnvelope`) when the event file is missing or malformed.
|
|
145
|
-
*/
|
|
146
|
-
export declare function explainPolicy(policyName: string, opts: ExplainPolicyOptions): ExplainPolicyResult;
|
|
147
|
-
export {};
|
|
@@ -1,248 +0,0 @@
|
|
|
1
|
-
// Phase 7 #5 — `harness explain-policy` CLI entrypoint.
|
|
2
|
-
//
|
|
3
|
-
// Risk Gate debug verb: given a policy name and a tool-event JSON file,
|
|
4
|
-
// explain whether the policy would APPLY to that event, and why. A
|
|
5
|
-
// policy applies only when its `trigger:` matches AND — when declared —
|
|
6
|
-
// every `when:` clause holds against the enriched Action Envelope. This
|
|
7
|
-
// verb shows both verdicts side by side: the trigger match, the Risk
|
|
8
|
-
// Classifier profile, the resolved environment, and a per-clause `when:`
|
|
9
|
-
// breakdown, so an operator authoring a risk policy sees exactly which
|
|
10
|
-
// clause admitted an action or held it back.
|
|
11
|
-
//
|
|
12
|
-
// Distinct from `harness explain <policy> --trace`: that replays the
|
|
13
|
-
// LAST recorded decision from the evidence ledger; `explain-policy`
|
|
14
|
-
// evaluates a hypothetical event live and reads nothing from the ledger.
|
|
15
|
-
import * as fs from "node:fs";
|
|
16
|
-
import { parse as parseYaml, stringify as stringifyYaml } from "yaml";
|
|
17
|
-
import { classifyRisk, deriveProjectName, evaluateWhen, policyMatchesEvent, resolveDeletionTarget, resolveEnvironment, } from "../runtime/index.js";
|
|
18
|
-
import { parseKubectlTarget } from "../runtime/kubectl-target-parse.js";
|
|
19
|
-
import { extractShellCommand } from "../runtime/tool-name-aliases.js";
|
|
20
|
-
import { DEFAULT_SAFE_DELETION_ROOTS } from "../schema/risk.js";
|
|
21
|
-
import { enrichLoadedEvent } from "./enriched-event.js";
|
|
22
|
-
import { loadEventEnvelope } from "./event-input.js";
|
|
23
|
-
import { EX_USAGE, HarnessExitError } from "./exit-codes.js";
|
|
24
|
-
import { loadManifest } from "./loader.js";
|
|
25
|
-
/**
|
|
26
|
-
* Does `filePath`'s raw YAML explicitly declare `session_start_preflight.setup`?
|
|
27
|
-
*
|
|
28
|
-
* "Declare" means KEY PRESENCE, not "holds a boolean" (review round 2,
|
|
29
|
-
* finding: a tombstone, `session_start_preflight: null` or `{setup:
|
|
30
|
-
* null}`, both honoured by `mergeValue` in src/overrides/merge.ts as
|
|
31
|
-
* "delete whatever a lower layer set, falling back to the schema
|
|
32
|
-
* default", is exactly as much a deliberate declaration by THIS layer
|
|
33
|
-
* as `setup: true`/`false` is; it just resolves to a different final
|
|
34
|
-
* value. Attributing a tombstoned layer's decision to whichever lower
|
|
35
|
-
* layer happens to also declare the key (or to "base" when none does)
|
|
36
|
-
* would name the WRONG layer as the one that decided the merged
|
|
37
|
-
* result.
|
|
38
|
-
*/
|
|
39
|
-
function layerDeclaresSetup(filePath) {
|
|
40
|
-
try {
|
|
41
|
-
const raw = fs.readFileSync(filePath, "utf8");
|
|
42
|
-
const parsed = parseYaml(raw);
|
|
43
|
-
if (parsed === null || typeof parsed !== "object")
|
|
44
|
-
return false;
|
|
45
|
-
if (!("session_start_preflight" in parsed))
|
|
46
|
-
return false;
|
|
47
|
-
const block = parsed.session_start_preflight;
|
|
48
|
-
if (block === null)
|
|
49
|
-
return true; // whole-block tombstone
|
|
50
|
-
if (typeof block !== "object" || Array.isArray(block))
|
|
51
|
-
return false;
|
|
52
|
-
return "setup" in block;
|
|
53
|
-
}
|
|
54
|
-
catch {
|
|
55
|
-
return false;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Re-reads the resolved layer files (independent of the already-merged
|
|
60
|
-
* `manifest` object, which no longer carries per-layer provenance once
|
|
61
|
-
* `applyLayers` has folded them together) to attribute the decided
|
|
62
|
-
* `session_start_preflight.setup` value to the layer that set it.
|
|
63
|
-
*/
|
|
64
|
-
function resolveSessionStartPreflightSource(resolved) {
|
|
65
|
-
if (resolved.projectLayer !== null && layerDeclaresSetup(resolved.projectLayer)) {
|
|
66
|
-
return "project";
|
|
67
|
-
}
|
|
68
|
-
for (let i = resolved.machineLayers.length - 1; i >= 0; i--) {
|
|
69
|
-
if (layerDeclaresSetup(resolved.machineLayers[i]))
|
|
70
|
-
return "machine";
|
|
71
|
-
}
|
|
72
|
-
return "base";
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Explain whether `policyName` applies to the event at `opts.eventPath`.
|
|
76
|
-
*
|
|
77
|
-
* Throws `HarnessExitError(EX_USAGE)` when the named policy is not
|
|
78
|
-
* declared in the manifest, and `HarnessExitError(EX_NOINPUT)` (via
|
|
79
|
-
* `loadEventEnvelope`) when the event file is missing or malformed.
|
|
80
|
-
*/
|
|
81
|
-
export function explainPolicy(policyName, opts) {
|
|
82
|
-
// `resolved` is only available on the real `loadManifest(opts)` path:
|
|
83
|
-
// an injected `opts.manifest` already IS the merged result and
|
|
84
|
-
// carries no per-layer provenance, so `session_start_preflight.source`
|
|
85
|
-
// falls back to "base" in that case (see the field's doc comment).
|
|
86
|
-
//
|
|
87
|
-
// PLAIN load (task c88461c1, review round 3, decision D-028): every
|
|
88
|
-
// check this verb performs against `manifest` below -- finding the
|
|
89
|
-
// named policy, trigger matching, the Risk Classifier, environment
|
|
90
|
-
// resolution, deletion-target resolution, and the `when:` evaluation
|
|
91
|
-
// -- reads the base/machine/explicit-`--project` manifest only, an
|
|
92
|
-
// explicit `opts.project` still wins outright but NOTHING is derived
|
|
93
|
-
// from cwd here. This mirrors `harness policy intercept`
|
|
94
|
-
// (src/cli/policy/intercept.ts) and `harness dry-run`
|
|
95
|
-
// (src/cli/dry-run.ts), the two enforcement-facing verbs that decide
|
|
96
|
-
// a policy's real trigger verdict: neither ever consults a derived
|
|
97
|
-
// project layer, so this manifest must not either, or an operator's
|
|
98
|
-
// "would this apply" answer could disagree with what actually
|
|
99
|
-
// enforces. Only `session_start_preflight.setup` (and its `source`
|
|
100
|
-
// attribution) below get a project-scoped SECOND load: routing a
|
|
101
|
-
// derived layer through THIS one, unrelated load would let it
|
|
102
|
-
// silently reach the policy engine this verb evaluates, for zero
|
|
103
|
-
// benefit to the one key that needs it.
|
|
104
|
-
let manifest;
|
|
105
|
-
let resolvedPaths;
|
|
106
|
-
if (opts.manifest) {
|
|
107
|
-
manifest = opts.manifest;
|
|
108
|
-
}
|
|
109
|
-
else {
|
|
110
|
-
const loaded = loadManifest(opts);
|
|
111
|
-
manifest = loaded.manifest;
|
|
112
|
-
resolvedPaths = loaded.resolved;
|
|
113
|
-
}
|
|
114
|
-
const policy = manifest.policies.find((p) => p.name === policyName);
|
|
115
|
-
if (!policy) {
|
|
116
|
-
const available = manifest.policies.map((p) => p.name).join(", ") || "(none)";
|
|
117
|
-
throw new HarnessExitError(`no policy named "${policyName}" declared; available: ${available}`, EX_USAGE);
|
|
118
|
-
}
|
|
119
|
-
// `session_start_preflight.setup` / `source` (task c88461c1, review
|
|
120
|
-
// round 2 decision D-021b; scope narrowed to this one key, review
|
|
121
|
-
// round 3 decision D-028; gated on the name-prefix check below,
|
|
122
|
-
// review round 3 residual, task `1c4eb3ea`): an explicit
|
|
123
|
-
// `opts.project` still wins outright; otherwise derive the project
|
|
124
|
-
// name from `opts.cwd` (defaulting to `process.cwd()`) via the SAME
|
|
125
|
-
// `deriveProjectName` the two other producers reach through
|
|
126
|
-
// `resolveScopedProjectName` (src/runtime/git-context.ts; this verb keeps
|
|
127
|
-
// its own copy with an `undefined` fallback, task f1eb1c5c), so this
|
|
128
|
-
// verb's `setup`/`source` reflect the layer the producer would read for
|
|
129
|
-
// this cwd, WITHOUT letting that derived layer reach the policy evaluation above. An injected
|
|
130
|
-
// `opts.manifest` carries no per-layer provenance to re-derive from
|
|
131
|
-
// and always reports "base" (unchanged from before this task).
|
|
132
|
-
//
|
|
133
|
-
// ONLY COMPUTED FOR `preflight-before-*` POLICIES (moved behind this
|
|
134
|
-
// check, review round 3 residual, task `1c4eb3ea`): the block below
|
|
135
|
-
// is rendered into the projection ONLY for those policies (see
|
|
136
|
-
// `ExplainPolicyProjection.session_start_preflight`'s doc comment),
|
|
137
|
-
// so a caller explaining any OTHER policy no longer pays for a
|
|
138
|
-
// second manifest load whose result it can never see.
|
|
139
|
-
let sessionStartPreflightSetup = false;
|
|
140
|
-
let sessionStartPreflightSource = "base";
|
|
141
|
-
if (policy.name.startsWith("preflight-before-")) {
|
|
142
|
-
sessionStartPreflightSetup = manifest.session_start_preflight.setup;
|
|
143
|
-
sessionStartPreflightSource = resolvedPaths
|
|
144
|
-
? resolveSessionStartPreflightSource(resolvedPaths)
|
|
145
|
-
: "base";
|
|
146
|
-
if (!opts.manifest) {
|
|
147
|
-
try {
|
|
148
|
-
const scoped = loadManifest({
|
|
149
|
-
...opts,
|
|
150
|
-
project: opts.project ?? deriveProjectName(opts.cwd ?? process.cwd()) ?? undefined,
|
|
151
|
-
});
|
|
152
|
-
sessionStartPreflightSetup = scoped.manifest.session_start_preflight.setup;
|
|
153
|
-
sessionStartPreflightSource = resolveSessionStartPreflightSource(scoped.resolved);
|
|
154
|
-
}
|
|
155
|
-
catch {
|
|
156
|
-
// Review round 3 residual, task `1c4eb3ea`: degrade to
|
|
157
|
-
// setup:false / source:"unresolvable" rather than keeping the
|
|
158
|
-
// plain load's values, matching the producer's own
|
|
159
|
-
// `setupEnabled` catch (`src/cli/session-start/index.ts`),
|
|
160
|
-
// which degrades to `setup: false` on the identical failure
|
|
161
|
-
// instead of falling back to a base/machine value it never
|
|
162
|
-
// actually re-read on this path. "base" would misattribute
|
|
163
|
-
// the result to a layer this function never consulted here.
|
|
164
|
-
sessionStartPreflightSetup = false;
|
|
165
|
-
sessionStartPreflightSource = "unresolvable";
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
const loaded = loadEventEnvelope(opts.eventPath, opts, "explain-policy");
|
|
170
|
-
const { event } = loaded;
|
|
171
|
-
// Envelope enrichment shared with `harness policy intercept` (task
|
|
172
|
-
// 7c3919a2): the leading Bash prefix (inline `VAR=value`, `cd <path>
|
|
173
|
-
// &&`, `git switch|checkout <branch> &&`) is parsed and merged into
|
|
174
|
-
// the resolver inputs by the SAME helper the hook uses (through
|
|
175
|
-
// `enrichLoadedEvent`, shared with `resolve-env`, `test-risk` and
|
|
176
|
-
// `explain-action`, task 8b891e83), so this verb cannot report
|
|
177
|
-
// `unknown` for a command the hook resolves to `production`. Only the
|
|
178
|
-
// envelope enrichment is shared; this verb still reads no ledger or
|
|
179
|
-
// evidence.
|
|
180
|
-
const { envelope, enrichment, kube } = enrichLoadedEvent(loaded, manifest, opts);
|
|
181
|
-
const classifier = classifyRisk(envelope, manifest.risk.classifiers);
|
|
182
|
-
const environment = resolveEnvironment(envelope, manifest.environments.resolvers, {
|
|
183
|
-
env: enrichment.env,
|
|
184
|
-
kubeContext: kube.context,
|
|
185
|
-
kubeNamespace: kube.namespace,
|
|
186
|
-
});
|
|
187
|
-
// Static deletion-target resolution (task d03af8f6) — same "raw
|
|
188
|
-
// command only, no ambient cwd/env" contract as the runtime's own
|
|
189
|
-
// `enrichEnvelope`. See `deletion-target-resolve.ts`.
|
|
190
|
-
const explainShellCommand = extractShellCommand({ raw_input: envelope.raw_input });
|
|
191
|
-
const deletionTarget = explainShellCommand === null
|
|
192
|
-
? null
|
|
193
|
-
: resolveDeletionTarget(explainShellCommand, manifest.risk.safe_deletion_roots ?? DEFAULT_SAFE_DELETION_ROOTS);
|
|
194
|
-
const triggerMatched = policyMatchesEvent(policy, event);
|
|
195
|
-
const whenEval = policy.when !== undefined
|
|
196
|
-
? evaluateWhen(policy.when, { risk: classifier, environment, deletionTarget })
|
|
197
|
-
: undefined;
|
|
198
|
-
// Same remainder the hook feeds `parseKubectlTarget` (after the
|
|
199
|
-
// prefix consumed `cd`/`VAR=value`/`git switch`); flag only, no merge.
|
|
200
|
-
const kubectlSubject = enrichment.riskBashCommand === null
|
|
201
|
-
? null
|
|
202
|
-
: enrichment.riskBashCommand.slice(enrichment.bashPrefix?.remainderStart ?? 0);
|
|
203
|
-
const kubectlTarget = kubectlSubject === null ? null : parseKubectlTarget(kubectlSubject);
|
|
204
|
-
const kubectlTargetPresent = kubectlTarget !== null && (kubectlTarget.context !== null || kubectlTarget.namespace !== null);
|
|
205
|
-
const projection = {
|
|
206
|
-
policy: policy.name,
|
|
207
|
-
description: policy.description,
|
|
208
|
-
trigger: {
|
|
209
|
-
event: policy.trigger.event,
|
|
210
|
-
...(policy.trigger.match !== undefined && { match: policy.trigger.match }),
|
|
211
|
-
...(policy.trigger.path_match !== undefined && {
|
|
212
|
-
path_match: policy.trigger.path_match,
|
|
213
|
-
}),
|
|
214
|
-
...(policy.trigger.bash_match !== undefined && {
|
|
215
|
-
bash_match: policy.trigger.bash_match,
|
|
216
|
-
}),
|
|
217
|
-
matched: triggerMatched,
|
|
218
|
-
},
|
|
219
|
-
classifier,
|
|
220
|
-
environment,
|
|
221
|
-
parity: {
|
|
222
|
-
envelope_enrichment: ["inline_env", "cd_git_context", "branch_switch_upgrade"],
|
|
223
|
-
not_evaluated: ["ledger_requires", "kubectl_target"],
|
|
224
|
-
kubectl_target_present: kubectlTargetPresent,
|
|
225
|
-
},
|
|
226
|
-
deletion_target: deletionTarget,
|
|
227
|
-
...(policy.name.startsWith("preflight-before-") && {
|
|
228
|
-
session_start_preflight: {
|
|
229
|
-
setup: sessionStartPreflightSetup,
|
|
230
|
-
source: sessionStartPreflightSource,
|
|
231
|
-
},
|
|
232
|
-
}),
|
|
233
|
-
when: whenEval
|
|
234
|
-
? {
|
|
235
|
-
declared: true,
|
|
236
|
-
matched: whenEval.matched,
|
|
237
|
-
clauses: whenEval.clauses,
|
|
238
|
-
unclassifiedFallback: whenEval.unclassifiedFallback,
|
|
239
|
-
}
|
|
240
|
-
: { declared: false },
|
|
241
|
-
applies: triggerMatched && (whenEval ? whenEval.matched : true),
|
|
242
|
-
};
|
|
243
|
-
const output = opts.json
|
|
244
|
-
? `${JSON.stringify(projection, null, 2)}\n`
|
|
245
|
-
: stringifyYaml(projection, { lineWidth: 0 });
|
|
246
|
-
return { output, projection };
|
|
247
|
-
}
|
|
248
|
-
//# sourceMappingURL=explain-policy.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"explain-policy.js","sourceRoot":"","sources":["../../src/cli/explain-policy.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,EAAE;AACF,wEAAwE;AACxE,mEAAmE;AACnE,wEAAwE;AACxE,wEAAwE;AACxE,qEAAqE;AACrE,yEAAyE;AACzE,uEAAuE;AACvE,6CAA6C;AAC7C,EAAE;AACF,qEAAqE;AACrE,oEAAoE;AACpE,yEAAyE;AAEzE,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,MAAM,CAAC;AACtE,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,YAAY,EACZ,kBAAkB,EAClB,qBAAqB,EACrB,kBAAkB,GAKnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAEtE,OAAO,EAAE,2BAA2B,EAAE,MAAM,mBAAmB,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD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AE,gBAAgB,EAAE,uBAAuB,CAAC;YAC9E,aAAa,EAAE,CAAC,iBAAiB,EAAE,gBAAgB,CAAC;YACpD,sBAAsB,EAAE,oBAAoB;SAC7C;QACD,eAAe,EAAE,cAAc;QAC/B,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,mBAAmB,CAAC,IAAI;YACjD,uBAAuB,EAAE;gBACvB,KAAK,EAAE,0BAA0B;gBACjC,MAAM,EAAE,2BAA2B;aACpC;SACF,CAAC;QACF,IAAI,EAAE,QAAQ;YACZ,CAAC,CAAC;gBACE,QAAQ,EAAE,IAAI;gBACd,OAAO,EAAE,QAAQ,CAAC,OAAO;gBACzB,OAAO,EAAE,QAAQ,CAAC,OAAO;gBACzB,oBAAoB,EAAE,QAAQ,CAAC,oBAAoB;aACpD;YACH,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE;QACvB,OAAO,EAAE,cAAc,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;KAChE,CAAC;IAEF,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI;QACtB,CAAC,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI;QAC5C,CAAC,CAAC,aAAa,CAAC,UAAU,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC;IAChD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC;AAChC,CAAC"}
|
package/dist/cli/explain.d.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { type LedgerQueryResult } from "../policies/index.js";
|
|
2
|
-
import { type PolicyDecisionPayload } from "../io/ledger-record.js";
|
|
3
|
-
import { type ResolveReadSessionOptions } from "../runtime/session-id.js";
|
|
4
|
-
import { type LoaderOptions } from "./loader.js";
|
|
5
|
-
export type ExplainDecisionFilter = PolicyDecisionPayload["outcome"];
|
|
6
|
-
export interface ExplainOptions extends LoaderOptions {
|
|
7
|
-
json?: boolean;
|
|
8
|
-
trace?: boolean;
|
|
9
|
-
/** Session whose audit log to inspect for `--trace`. */
|
|
10
|
-
sessionId?: string;
|
|
11
|
-
/**
|
|
12
|
-
* Read-path session resolution overrides (tests). When `sessionId` is
|
|
13
|
-
* not given, `resolveReadSessionId` discovers the live session from
|
|
14
|
-
* the newest Claude Code transcript; this seam lets tests stub that
|
|
15
|
-
* scan so they stay hermetic.
|
|
16
|
-
*/
|
|
17
|
-
sessionDiscovery?: ResolveReadSessionOptions;
|
|
18
|
-
/**
|
|
19
|
-
* When true, ignore the policy-name argument and trace the most recent
|
|
20
|
-
* decision recorded in the ledger (any policy). Implies --trace.
|
|
21
|
-
*/
|
|
22
|
-
last?: boolean;
|
|
23
|
-
/** When `last` is set, only consider decisions of this outcome. */
|
|
24
|
-
decisionFilter?: ExplainDecisionFilter;
|
|
25
|
-
/** Override the ledger fetcher (tests). */
|
|
26
|
-
fetchLedger?: (sessionId: string) => Promise<LedgerQueryResult>;
|
|
27
|
-
}
|
|
28
|
-
export interface ExplainResult {
|
|
29
|
-
output: string;
|
|
30
|
-
}
|
|
31
|
-
export declare function explain(policyName: string | undefined, opts?: ExplainOptions): Promise<ExplainResult>;
|