@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,36 +0,0 @@
|
|
|
1
|
-
import type { EnvironmentResolver, MatchableEnvironment } from "../schema/index.js";
|
|
2
|
-
import type { ActionEnvelope } from "./action-envelope.js";
|
|
3
|
-
export type EnvironmentConfidence = "high" | "medium" | "low";
|
|
4
|
-
export interface EnvironmentResolution {
|
|
5
|
-
/** Resolved environment, or `unknown` when no resolver matched. */
|
|
6
|
-
name: MatchableEnvironment;
|
|
7
|
-
/**
|
|
8
|
-
* `high` when two or more signals (unioned across every resolver
|
|
9
|
-
* asserting the winning environment) back the result, `medium` for a
|
|
10
|
-
* single signal, `low` for `unknown` (no signal matched at all).
|
|
11
|
-
*/
|
|
12
|
-
confidence: EnvironmentConfidence;
|
|
13
|
-
/** Matched signal descriptors that back the result, for explainability. */
|
|
14
|
-
signals: string[];
|
|
15
|
-
/** Name of the resolver whose environment won, or `null` when unresolved. */
|
|
16
|
-
resolver: string | null;
|
|
17
|
-
}
|
|
18
|
-
/** Ambient inputs the resolver matches signals against. */
|
|
19
|
-
export interface SignalInputs {
|
|
20
|
-
/** Environment variables, for `env_var_patterns`. */
|
|
21
|
-
env: Record<string, string | undefined>;
|
|
22
|
-
/** Current kube context name, for `kube_context_patterns`. "" when unknown. */
|
|
23
|
-
kubeContext: string;
|
|
24
|
-
/** Current kube namespace, for `kube_namespace_patterns`. "" when unknown. */
|
|
25
|
-
kubeNamespace: string;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Resolve the target environment of an Action Envelope.
|
|
29
|
-
*
|
|
30
|
-
* Pure: envelope + resolvers + ambient inputs in, resolution out, no
|
|
31
|
-
* I/O. When resolvers disagree, the most-dangerous environment wins
|
|
32
|
-
* (`ENV_PRECEDENCE`). Signals from every fired resolver that asserts the
|
|
33
|
-
* winning environment are unioned for explainability. When nothing
|
|
34
|
-
* matches, the result is `unknown` — deliberately not a safe default.
|
|
35
|
-
*/
|
|
36
|
-
export declare function resolveEnvironment(envelope: ActionEnvelope, resolvers: readonly EnvironmentResolver[], inputs: SignalInputs): EnvironmentResolution;
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
// Phase 7 #4 — Context Resolver.
|
|
2
|
-
//
|
|
3
|
-
// Classifies an Action Envelope's target environment by matching the
|
|
4
|
-
// manifest's `environments.resolvers[]` signals. The Risk Gate stage
|
|
5
|
-
// that reads the `environments:` schema vocabulary shipped in
|
|
6
|
-
// Phase 7 #1.
|
|
7
|
-
//
|
|
8
|
-
// STATUS: invoked by `harness resolve-env` (Phase 7 #4). NOT yet
|
|
9
|
-
// consumed by `harness policy intercept` — wiring the runtime through
|
|
10
|
-
// the resolver is Phase 7 #5. See docs/risk-gate.md and docs/ROADMAP.md.
|
|
11
|
-
//
|
|
12
|
-
// "Unknown is not safe": when no resolver matches, the environment is
|
|
13
|
-
// `unknown` — not a safe default. The Phase 7 #5 policy evaluator must
|
|
14
|
-
// treat `unknown` as risk-bearing. `MatchableEnvironmentSchema` already
|
|
15
|
-
// admits `unknown` so a `policy.when.environment.name` clause can gate
|
|
16
|
-
// on it.
|
|
17
|
-
//
|
|
18
|
-
// Design source: lava-ice-logs/2026-04-30/harness-risk-gate-extension.md
|
|
19
|
-
// (design phase C).
|
|
20
|
-
// Most-dangerous-wins precedence: when resolvers disagree, the earlier
|
|
21
|
-
// entry here is the resolved environment. `unknown` is the implicit
|
|
22
|
-
// fallback and is not a resolver-assertable value.
|
|
23
|
-
const ENV_PRECEDENCE = [
|
|
24
|
-
"production",
|
|
25
|
-
"staging",
|
|
26
|
-
"dev",
|
|
27
|
-
"local",
|
|
28
|
-
];
|
|
29
|
-
/**
|
|
30
|
-
* Convert a `*`-glob to an anchored RegExp. Only `*` is special (the
|
|
31
|
-
* Phase 7 #1 signal patterns are simple, e.g. `main`, `release/*`); all
|
|
32
|
-
* other regex metacharacters are escaped literally.
|
|
33
|
-
*/
|
|
34
|
-
function globToRegExp(glob) {
|
|
35
|
-
const escaped = glob
|
|
36
|
-
.replace(/[.+^${}()|[\]\\?]/g, "\\$&")
|
|
37
|
-
.replace(/\*/g, ".*");
|
|
38
|
-
return new RegExp(`^${escaped}$`);
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Match one resolver's signals against the envelope + ambient inputs.
|
|
42
|
-
* Signals are OR-ed: a resolver fires when ANY signal matches. Returns
|
|
43
|
-
* the matched signal descriptors (empty when the resolver did not fire).
|
|
44
|
-
*
|
|
45
|
-
* Per-signal-kind semantics: `branch_patterns` and
|
|
46
|
-
* `kube_namespace_patterns` are globs, `kube_context_patterns` are
|
|
47
|
-
* regexes, `env_var_patterns` are substrings of the variable's value.
|
|
48
|
-
*/
|
|
49
|
-
function matchResolver(resolver, envelope, inputs) {
|
|
50
|
-
const matched = [];
|
|
51
|
-
const sig = resolver.signals;
|
|
52
|
-
const branch = envelope.session.branch;
|
|
53
|
-
if (sig.branch_patterns !== undefined && branch !== "") {
|
|
54
|
-
for (const p of sig.branch_patterns) {
|
|
55
|
-
if (globToRegExp(p).test(branch)) {
|
|
56
|
-
matched.push(`branch:${branch} ~ ${p}`);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
if (sig.env_var_patterns !== undefined) {
|
|
61
|
-
for (const evp of sig.env_var_patterns) {
|
|
62
|
-
const value = inputs.env[evp.var];
|
|
63
|
-
if (typeof value !== "string")
|
|
64
|
-
continue;
|
|
65
|
-
for (const p of evp.patterns) {
|
|
66
|
-
if (value.includes(p)) {
|
|
67
|
-
matched.push(`env:${evp.var} contains "${p}"`);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
if (sig.kube_context_patterns !== undefined && inputs.kubeContext !== "") {
|
|
73
|
-
for (const p of sig.kube_context_patterns) {
|
|
74
|
-
let re;
|
|
75
|
-
try {
|
|
76
|
-
re = new RegExp(p);
|
|
77
|
-
}
|
|
78
|
-
catch {
|
|
79
|
-
continue;
|
|
80
|
-
}
|
|
81
|
-
if (re.test(inputs.kubeContext)) {
|
|
82
|
-
matched.push(`kube-context:${inputs.kubeContext} ~ /${p}/`);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
if (sig.kube_namespace_patterns !== undefined &&
|
|
87
|
-
inputs.kubeNamespace !== "") {
|
|
88
|
-
for (const p of sig.kube_namespace_patterns) {
|
|
89
|
-
if (globToRegExp(p).test(inputs.kubeNamespace)) {
|
|
90
|
-
matched.push(`kube-namespace:${inputs.kubeNamespace} ~ ${p}`);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
return matched;
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Resolve the target environment of an Action Envelope.
|
|
98
|
-
*
|
|
99
|
-
* Pure: envelope + resolvers + ambient inputs in, resolution out, no
|
|
100
|
-
* I/O. When resolvers disagree, the most-dangerous environment wins
|
|
101
|
-
* (`ENV_PRECEDENCE`). Signals from every fired resolver that asserts the
|
|
102
|
-
* winning environment are unioned for explainability. When nothing
|
|
103
|
-
* matches, the result is `unknown` — deliberately not a safe default.
|
|
104
|
-
*/
|
|
105
|
-
export function resolveEnvironment(envelope, resolvers, inputs) {
|
|
106
|
-
const fired = [];
|
|
107
|
-
for (const resolver of resolvers) {
|
|
108
|
-
const signals = matchResolver(resolver, envelope, inputs);
|
|
109
|
-
if (signals.length > 0)
|
|
110
|
-
fired.push({ resolver, signals });
|
|
111
|
-
}
|
|
112
|
-
if (fired.length === 0) {
|
|
113
|
-
return { name: "unknown", confidence: "low", signals: [], resolver: null };
|
|
114
|
-
}
|
|
115
|
-
let best = fired[0];
|
|
116
|
-
for (const f of fired) {
|
|
117
|
-
if (ENV_PRECEDENCE.indexOf(f.resolver.environment) <
|
|
118
|
-
ENV_PRECEDENCE.indexOf(best.resolver.environment)) {
|
|
119
|
-
best = f;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
// Union the signals of every fired resolver that asserts the winning
|
|
123
|
-
// environment, so the explanation is complete when several resolvers
|
|
124
|
-
// agree. `resolver` names the highest-precedence (first-found) one.
|
|
125
|
-
const winningEnv = best.resolver.environment;
|
|
126
|
-
const signals = [
|
|
127
|
-
...new Set(fired
|
|
128
|
-
.filter((f) => f.resolver.environment === winningEnv)
|
|
129
|
-
.flatMap((f) => f.signals)),
|
|
130
|
-
].sort();
|
|
131
|
-
return {
|
|
132
|
-
name: winningEnv,
|
|
133
|
-
confidence: signals.length >= 2 ? "high" : "medium",
|
|
134
|
-
signals,
|
|
135
|
-
resolver: best.resolver.name,
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
//# sourceMappingURL=environment-resolver.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"environment-resolver.js","sourceRoot":"","sources":["../../src/runtime/environment-resolver.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
export interface GitRepoContext {
|
|
2
|
-
/** Basename of the work-tree root, or "" when `cwd` is not in a repo. */
|
|
3
|
-
repo: string;
|
|
4
|
-
/**
|
|
5
|
-
* Current branch name, or "" when not in a repo or HEAD is detached
|
|
6
|
-
* (a raw SHA, there is no branch to name).
|
|
7
|
-
*/
|
|
8
|
-
branch: string;
|
|
9
|
-
/**
|
|
10
|
-
* Current HEAD commit sha (40 lowercase hex chars), or "" when not in
|
|
11
|
-
* a repo or the sha could not be resolved. On a detached HEAD this is
|
|
12
|
-
* the raw sha from `.git/HEAD`; on a branch it is the sha pointed at
|
|
13
|
-
* by `.git/refs/heads/<branch>` (or the matching entry in
|
|
14
|
-
* `.git/packed-refs` when the loose ref is absent). Used by the
|
|
15
|
-
* `at_head:true` requires-flag so a preflight whose recorded HEAD
|
|
16
|
-
* equals the current HEAD satisfies the gate regardless of age.
|
|
17
|
-
*/
|
|
18
|
-
sha: string;
|
|
19
|
-
}
|
|
20
|
-
export interface GitEntry {
|
|
21
|
-
/** Directory that contains the `.git` entry (the work-tree root). */
|
|
22
|
-
worktreeRoot: string;
|
|
23
|
-
/** Resolved git directory — for a `.git` file, its `gitdir:` target. */
|
|
24
|
-
gitDir: string;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Walk up from `startDir` looking for a `.git` entry. Handles both the
|
|
28
|
-
* common `.git` directory and the `.git` *file* form used by linked
|
|
29
|
-
* worktrees and submodules. The walk is bounded so a pathologically
|
|
30
|
-
* deep cwd cannot spin.
|
|
31
|
-
*
|
|
32
|
-
* Exported (task T-001, record-verbs) so `cli/record/index.ts` can
|
|
33
|
-
* locate the same `.git` directory this module resolves `repo`/
|
|
34
|
-
* `branch`/`sha` from, without re-walking the tree with duplicate
|
|
35
|
-
* logic — its base-branch resolution needs the raw git directory (to
|
|
36
|
-
* read `refs/remotes/origin/HEAD` / `packed-refs`), which
|
|
37
|
-
* `resolveGitContext`'s return shape does not expose. Behavior is
|
|
38
|
-
* unchanged; this is a visibility-only change.
|
|
39
|
-
*/
|
|
40
|
-
export declare function findGitEntry(startDir: string): GitEntry | null;
|
|
41
|
-
/**
|
|
42
|
-
* Resolve `{ repo, branch, sha }` for a working directory. Returns empty
|
|
43
|
-
* strings (never throws) when `cwd` is not inside a git work tree, or
|
|
44
|
-
* when any individual lookup fails: callers treat "" as "unknown" and
|
|
45
|
-
* fall through to their own behaviour.
|
|
46
|
-
*/
|
|
47
|
-
export declare function resolveGitContext(cwd: string): GitRepoContext;
|
|
48
|
-
/**
|
|
49
|
-
* Resolve the remote's default branch name from `<gitDir>/refs/remotes/
|
|
50
|
-
* origin/HEAD`. Loose symbolic ref first (the normal shape: `ref: refs/
|
|
51
|
-
* remotes/origin/<name>`, written by `git clone` / `git remote set-head
|
|
52
|
-
* origin -a`). When that loose file is absent, falls back to
|
|
53
|
-
* `packed-refs`: some git versions / tooling pack `refs/remotes/origin/
|
|
54
|
-
* HEAD` as a plain `<sha> <ref>` entry instead of a symref, which loses
|
|
55
|
-
* the branch NAME directly — recovered here by matching that sha
|
|
56
|
-
* against another packed `refs/remotes/origin/<name>` entry that shares
|
|
57
|
-
* it (mirrors the loose-then-packed shape `resolveBranchSha` uses
|
|
58
|
-
* above, adapted since packed-refs has no symref concept). Returns null
|
|
59
|
-
* when neither source resolves a name.
|
|
60
|
-
*/
|
|
61
|
-
export declare function resolveOriginHeadBase(gitDir: string): string | null;
|
|
62
|
-
/**
|
|
63
|
-
* Resolve the actual shared git directory for `gitDir`, following the
|
|
64
|
-
* `commondir` file linked worktrees write. `git worktree add` gives each
|
|
65
|
-
* worktree its own private `.git` FILE pointing at `<main>/.git/
|
|
66
|
-
* worktrees/<name>/` (what `findGitEntry` returns as `gitDir`), but
|
|
67
|
-
* `refs/remotes/origin/HEAD` and `packed-refs` are NOT duplicated there
|
|
68
|
-
* — they live only in the shared common dir, reachable via that
|
|
69
|
-
* per-worktree directory's own `commondir` file (a path, normally
|
|
70
|
-
* `../..`, relative to the per-worktree directory itself; see
|
|
71
|
-
* `git-worktree(1)`). Without this indirection, `resolveOriginHeadBase`
|
|
72
|
-
* would look for those refs in the empty per-worktree directory and
|
|
73
|
-
* always miss. Returns `gitDir` unchanged when no `commondir` file
|
|
74
|
-
* exists (the normal, non-worktree case).
|
|
75
|
-
*/
|
|
76
|
-
export declare function resolveCommonDir(gitDir: string): string;
|
|
77
|
-
/**
|
|
78
|
-
* Derive the project-layer name for `cwd`: the basename of the
|
|
79
|
-
* directory that CONTAINS the repository's shared git common dir (the
|
|
80
|
-
* main checkout), so every linked worktree of one repository resolves
|
|
81
|
-
* the same name, unlike `resolveGitContext(cwd).repo`, which names the
|
|
82
|
-
* checkout directory itself and therefore differs per worktree. Feeds
|
|
83
|
-
* `LoaderOptions.project` (the same seam every command's own
|
|
84
|
-
* `--project <name>` flag already uses) for `harness session-start
|
|
85
|
-
* preflight`, `harness explain-policy`, and `harness doctor` alike (one
|
|
86
|
-
* helper, three consumers, so the three cannot silently disagree on
|
|
87
|
-
* what "this repository's project name" means).
|
|
88
|
-
*
|
|
89
|
-
* Resolution:
|
|
90
|
-
* - `findGitEntry(cwd)` walks up to the `.git` entry, exactly like
|
|
91
|
-
* `resolveGitContext`.
|
|
92
|
-
* - `resolveCommonDir(entry.gitDir)` follows a linked worktree's
|
|
93
|
-
* `commondir` file to the shared common dir (a no-op for the main
|
|
94
|
-
* checkout, which has none).
|
|
95
|
-
* - The COMMON DIR's basename is normally literally `.git` (a
|
|
96
|
-
* directory or, in a linked worktree's private gitdir, the resolved
|
|
97
|
-
* target of a `.git` FILE): in that shape the project name is one
|
|
98
|
-
* level further up, the basename of the directory THAT CONTAINS the
|
|
99
|
-
* common dir, i.e. the main checkout's own directory name.
|
|
100
|
-
* - For a BARE repository (`git init --bare`, or a linked worktree
|
|
101
|
-
* created FROM one), there is no `.git` wrapper at all, the common
|
|
102
|
-
* dir IS the bare directory itself (its basename is not `.git`), so
|
|
103
|
-
* that basename is the project name directly, with no extra `..`
|
|
104
|
-
* step. This is the one shape where going up an extra level would
|
|
105
|
-
* be wrong (it would name the bare directory's PARENT instead), and
|
|
106
|
-
* the `.git` SUFFIX in a conventionally-named bare directory (e.g.
|
|
107
|
-
* `myrepo.git`) is kept, not stripped.
|
|
108
|
-
* - A SUBMODULE checkout (`git submodule add`) derives the submodule's
|
|
109
|
-
* OWN name, not its superproject's: a submodule's `.git` FILE points
|
|
110
|
-
* at a private gitdir under the superproject's `.git/modules/<name>/`
|
|
111
|
-
* tree, which has no `commondir` file of its own (that mechanism is
|
|
112
|
-
* for linked worktrees, not submodules), so `resolveCommonDir` is a
|
|
113
|
-
* no-op and the submodule's own checkout directory basename applies
|
|
114
|
-
* directly, same as a normal (non-worktree) repo.
|
|
115
|
-
* - A `git init --separate-git-dir=<dir>` checkout derives the GIT
|
|
116
|
-
* DIR's own basename, NOT the work tree's: the `.git` file at the
|
|
117
|
-
* work tree root points at `<dir>` with no `commondir` file either
|
|
118
|
-
* (again a linked-worktree-only mechanism), so `resolveCommonDir` is
|
|
119
|
-
* a no-op and `<dir>`'s own basename (e.g. `sepgit.git`) is the
|
|
120
|
-
* derived name, exactly like the bare-repository shape above; the
|
|
121
|
-
* work tree's own directory name never enters into it.
|
|
122
|
-
*
|
|
123
|
-
* Returns `null` when `cwd` is not inside a git work tree (mirrors
|
|
124
|
-
* `resolveGitContext`'s "" for the same case), when `entry.gitDir`
|
|
125
|
-
* could not be resolved at all (an unreadable `.git` FILE, see
|
|
126
|
-
* `findGitEntry`'s doc comment; in that case this falls back to the
|
|
127
|
-
* checkout directory's own basename, the same value `repo` would
|
|
128
|
-
* carry, rather than guessing at a common dir it has no path to), or
|
|
129
|
-
* when the resolved name fails {@link isValidProjectName} (review
|
|
130
|
-
* round 3, decision D-028's security finding: an untrusted on-disk
|
|
131
|
-
* `commondir`/`.git` FILE value must never hand a caller a name like
|
|
132
|
-
* `""`, `"."`, `".."`, or one containing a path separator, since every
|
|
133
|
-
* consumer joins it straight into a filesystem path,
|
|
134
|
-
* `resolvePaths`/`src/cli/loader.ts`; task `e904f25a` extended the same
|
|
135
|
-
* exit to a name containing a control character, which no consumer could
|
|
136
|
-
* render safely). A rejection here is silent by design: no project
|
|
137
|
-
* override layer resolves for that repository and the base/machine value
|
|
138
|
-
* applies, exactly as for a repository that simply has no layer on disk.
|
|
139
|
-
* Never throws.
|
|
140
|
-
*
|
|
141
|
-
* REALPATH (task c88461c1, review round 3 residual; task `1c4eb3ea`
|
|
142
|
-
* of the batch-44 follow-up run): the common dir is resolved through
|
|
143
|
-
* `fs.realpathSync` BEFORE taking its basename, so a checkout reached
|
|
144
|
-
* through a symlink (an operator's own convenience symlink, or a
|
|
145
|
-
* second clone path) derives the SAME project name as the real
|
|
146
|
-
* directory it points at, matching D-021a's "repository identity is
|
|
147
|
-
* the common dir" rule: two paths to one repository must resolve one
|
|
148
|
-
* project layer, not two. Best-effort: `realpathSync` failing (a
|
|
149
|
-
* dangling symlink, a permissions error) falls back to the
|
|
150
|
-
* un-resolved common dir rather than throwing, so a repository that
|
|
151
|
-
* was reachable before this change stays reachable.
|
|
152
|
-
*/
|
|
153
|
-
export declare function deriveProjectName(cwd: string): string | null;
|
|
154
|
-
export interface ResolveScopedProjectNameOptions<T> {
|
|
155
|
-
/** An explicit `--project <name>` value, when the caller has one. Wins outright. */
|
|
156
|
-
project?: string;
|
|
157
|
-
/** The cwd to derive a project name from via {@link deriveProjectName}. */
|
|
158
|
-
cwd: string;
|
|
159
|
-
/**
|
|
160
|
-
* What to return when neither `project` nor `deriveProjectName(cwd)`
|
|
161
|
-
* produced a name. Callers disagreed on this value before this helper
|
|
162
|
-
* existed: `harness doctor` used `null`, the `session_start_preflight`
|
|
163
|
-
* producer used its own already-resolved `repo` basename. Naming it
|
|
164
|
-
* here makes that difference a visible, per-call-site argument instead
|
|
165
|
-
* of an accident of two copies of the same expression drifting apart
|
|
166
|
-
* (task `f1eb1c5c`; see docs/CLI.md's PER-REPO SCOPING section).
|
|
167
|
-
*/
|
|
168
|
-
fallback: T;
|
|
169
|
-
}
|
|
170
|
-
/**
|
|
171
|
-
* Shared `opts.project ?? deriveProjectName(cwd) ?? fallback` resolution,
|
|
172
|
-
* used by two of the three producers of a per-repo-scoped
|
|
173
|
-
* `session_start_preflight` project name: `harness doctor`'s second,
|
|
174
|
-
* project-scoped load and the `session_start_preflight` producer. Both
|
|
175
|
-
* surfaces agree on the first two terms (an explicit `--project`, then
|
|
176
|
-
* the cwd-derived name); only the fallback differs by call site, and
|
|
177
|
-
* this helper takes it as an explicit argument so that difference is
|
|
178
|
-
* named rather than duplicated inline. The third producer,
|
|
179
|
-
* `harness explain-policy` (`src/cli/explain-policy.ts`), keeps its own
|
|
180
|
-
* copy of the same expression with a third fallback (`undefined`);
|
|
181
|
-
* folding it into this helper is deliberately out of scope of task
|
|
182
|
-
* `f1eb1c5c`. No observable behaviour change versus either surface's
|
|
183
|
-
* own prior inline expression, other than doctor's `cwd` expression
|
|
184
|
-
* now being evaluated eagerly (see the call site): this only extracts
|
|
185
|
-
* the shared shape.
|
|
186
|
-
*/
|
|
187
|
-
export declare function resolveScopedProjectName<T>(opts: ResolveScopedProjectNameOptions<T>): string | T;
|
|
188
|
-
/**
|
|
189
|
-
* `{project}` value validation and safe display now live in
|
|
190
|
-
* `src/io/project-name.ts` (task `b5e6ccb0`): `buildLockEntries`
|
|
191
|
-
* (`src/io/harness-lock.ts`) is itself a `{project}` sink, and `io/` may
|
|
192
|
-
* not import from `runtime/` (`io-no-upward-imports`,
|
|
193
|
-
* `.dependency-cruiser.cjs`), so the shared logic moved down rather than
|
|
194
|
-
* `harness-lock.ts` re-implementing it. Re-exported here so every
|
|
195
|
-
* existing consumer that imports `isValidProjectName` /
|
|
196
|
-
* `sanitizeProjectForDisplay` from `../runtime/git-context.js` keeps
|
|
197
|
-
* working unchanged; see `src/io/project-name.ts` for the doc comments
|
|
198
|
-
* (the sink inventory, the two-screen rationale, the display-stripping
|
|
199
|
-
* invariant).
|
|
200
|
-
*/
|
|
201
|
-
export { isValidProjectName, sanitizeProjectForDisplay } from "../io/project-name.js";
|