@intentius/chant 0.124.54 → 0.124.56
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/__fixtures__/estate-ledger.d.ts +13 -0
- package/dist/__fixtures__/estate-ledger.d.ts.map +1 -0
- package/dist/__fixtures__/estate-ledger.js +67 -0
- package/dist/__fixtures__/oidc-emulator.d.ts +11 -1
- package/dist/__fixtures__/oidc-emulator.d.ts.map +1 -1
- package/dist/__fixtures__/oidc-emulator.js +26 -2
- package/dist/__fixtures__/product-words.d.ts +78 -0
- package/dist/__fixtures__/product-words.d.ts.map +1 -0
- package/dist/__fixtures__/product-words.js +43 -0
- package/dist/__golden__/wave-loop/op-by-apply-after-fails.json +10 -2
- package/dist/__golden__/wave-loop/op-by-apply-hold.json +20 -4
- package/dist/__golden__/wave-loop/op-by-apply-ignored.json +10 -2
- package/dist/__golden__/wave-loop/op-by-apply-pass.json +10 -2
- package/dist/__golden__/wave-loop/op-by-apply-skip.json +10 -2
- package/dist/__golden__/wave-loop/op-discover-rest-stops.json +22 -6
- package/dist/__golden__/wave-loop/op-discover-rest.json +44 -12
- package/dist/__golden__/wave-loop/op-discover-wide.json +12 -3
- package/dist/__golden__/wave-loop/op-held-on.json +28 -7
- package/dist/__golden__/wave-loop/op-hooks-apply-fails.json +22 -6
- package/dist/__golden__/wave-loop/op-hooks-fail-after-apply.json +22 -6
- package/dist/__golden__/wave-loop/op-hooks-fail-before-apply.json +4 -2
- package/dist/__golden__/wave-loop/op-hooks-held.json +26 -8
- package/dist/__golden__/wave-loop/op-hooks-hold-before-apply.json +18 -4
- package/dist/__golden__/wave-loop/op-hooks-pass.json +22 -6
- package/dist/__golden__/wave-loop/op-hooks-share.json +20 -7
- package/dist/__golden__/wave-loop/op-outcome-held.json +12 -3
- package/dist/__golden__/wave-loop/op-outcome-replan-approved.json +16 -5
- package/dist/__golden__/wave-loop/op-outcome-replan-forever.json +48 -21
- package/dist/__golden__/wave-loop/op-outcome-replan.json +16 -5
- package/dist/__golden__/wave-loop/op-outcome-stood-down.json +12 -3
- package/dist/__golden__/wave-loop/op-outcome-unreadable.json +12 -3
- package/dist/__golden__/wave-loop/op-overridden.json +28 -7
- package/dist/__golden__/wave-loop/op-per-run.json +20 -4
- package/dist/__golden__/wave-loop/op-point.json +18 -4
- package/dist/__golden__/wave-loop/op-pr-review.json +10 -2
- package/dist/__golden__/wave-loop/op-spend-change-only.json +10 -2
- package/dist/__golden__/wave-loop/op-spend.json +10 -2
- package/dist/__golden__/wave-loop/op-wave-commands.json +56 -13
- package/dist/__golden__/wave-loop/op-wide.json +20 -4
- package/dist/bucket-check/azure.d.ts +108 -0
- package/dist/bucket-check/azure.d.ts.map +1 -0
- package/dist/bucket-check/azure.js +258 -0
- package/dist/bucket-check/fixtures/azure.json +153 -0
- package/dist/bucket-check/fixtures/gcs.json +148 -0
- package/dist/bucket-check/fixtures/s3.json +277 -0
- package/dist/bucket-check/gcs.d.ts +77 -0
- package/dist/bucket-check/gcs.d.ts.map +1 -0
- package/dist/bucket-check/gcs.js +202 -0
- package/dist/bucket-check/index.d.ts +48 -0
- package/dist/bucket-check/index.d.ts.map +1 -0
- package/dist/bucket-check/index.js +44 -0
- package/dist/bucket-check/s3.d.ts +116 -0
- package/dist/bucket-check/s3.d.ts.map +1 -0
- package/dist/bucket-check/s3.js +362 -0
- package/dist/bucket-check/types.d.ts +66 -0
- package/dist/bucket-check/types.d.ts.map +1 -0
- package/dist/bucket-check/types.js +31 -0
- package/dist/bucket-check/wire.d.ts +27 -0
- package/dist/bucket-check/wire.d.ts.map +1 -0
- package/dist/bucket-check/wire.js +32 -0
- package/dist/bucket-check.d.ts +6 -0
- package/dist/bucket-check.d.ts.map +1 -0
- package/dist/bucket-check.js +5 -0
- package/dist/capabilities/templates.d.ts.map +1 -1
- package/dist/capabilities/templates.js +1 -2
- package/dist/change-set.d.ts.map +1 -1
- package/dist/change-set.js +2 -3
- package/dist/ci-agent.d.ts +381 -0
- package/dist/ci-agent.d.ts.map +1 -0
- package/dist/ci-agent.js +832 -0
- package/dist/ci-audit/attribution.d.ts +111 -0
- package/dist/ci-audit/attribution.d.ts.map +1 -0
- package/dist/ci-audit/attribution.js +194 -0
- package/dist/ci-audit/audit-log.d.ts +144 -0
- package/dist/ci-audit/audit-log.d.ts.map +1 -0
- package/dist/ci-audit/audit-log.js +149 -0
- package/dist/ci-audit/index.d.ts +12 -0
- package/dist/ci-audit/index.d.ts.map +1 -0
- package/dist/ci-audit/index.js +12 -0
- package/dist/ci-audit/unrecorded.d.ts +74 -0
- package/dist/ci-audit/unrecorded.d.ts.map +1 -0
- package/dist/ci-audit/unrecorded.js +95 -0
- package/dist/ci-audit.d.ts +3 -0
- package/dist/ci-audit.d.ts.map +1 -0
- package/dist/ci-audit.js +2 -0
- package/dist/ci-control.d.ts +42 -0
- package/dist/ci-control.d.ts.map +1 -0
- package/dist/ci-control.js +41 -0
- package/dist/ci-estate/delivery.d.ts +137 -0
- package/dist/ci-estate/delivery.d.ts.map +1 -0
- package/dist/ci-estate/delivery.js +311 -0
- package/dist/ci-estate/overdue.d.ts +34 -0
- package/dist/ci-estate/overdue.d.ts.map +1 -0
- package/dist/ci-estate/overdue.js +58 -0
- package/dist/ci-estate/page.d.ts +134 -0
- package/dist/ci-estate/page.d.ts.map +1 -0
- package/dist/ci-estate/page.js +233 -0
- package/dist/ci-estate/rows.d.ts +118 -0
- package/dist/ci-estate/rows.d.ts.map +1 -0
- package/dist/ci-estate/rows.js +126 -0
- package/dist/ci-estate.d.ts +92 -0
- package/dist/ci-estate.d.ts.map +1 -0
- package/dist/ci-estate.js +82 -0
- package/dist/ci-handover.d.ts +29 -5
- package/dist/ci-handover.d.ts.map +1 -1
- package/dist/ci-handover.js +50 -16
- package/dist/ci-identity.d.ts +82 -7
- package/dist/ci-identity.d.ts.map +1 -1
- package/dist/ci-identity.js +86 -15
- package/dist/ci-job-guard.d.ts +139 -0
- package/dist/ci-job-guard.d.ts.map +1 -0
- package/dist/ci-job-guard.js +287 -0
- package/dist/ci-jobs.d.ts +7 -0
- package/dist/ci-jobs.d.ts.map +1 -1
- package/dist/ci-jobs.js +7 -0
- package/dist/ci-product-words.d.ts +296 -0
- package/dist/ci-product-words.d.ts.map +1 -0
- package/dist/ci-product-words.js +407 -0
- package/dist/ci-product.d.ts +117 -0
- package/dist/ci-product.d.ts.map +1 -0
- package/dist/ci-product.js +113 -0
- package/dist/ci-respond-run.d.ts +73 -0
- package/dist/ci-respond-run.d.ts.map +1 -0
- package/dist/ci-respond-run.js +247 -0
- package/dist/ci-respond.d.ts +189 -0
- package/dist/ci-respond.d.ts.map +1 -0
- package/dist/ci-respond.js +285 -0
- package/dist/cli/commands/audit.d.ts +2 -2
- package/dist/cli/commands/audit.d.ts.map +1 -1
- package/dist/cli/commands/audit.js +3 -2
- package/dist/cli/commands/carve.js +2 -2
- package/dist/cli/commands/init.d.ts +2 -0
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +1 -1
- package/dist/cli/handlers/agent.d.ts +17 -0
- package/dist/cli/handlers/agent.d.ts.map +1 -0
- package/dist/cli/handlers/agent.js +114 -0
- package/dist/cli/handlers/approve-confirm.d.ts +84 -0
- package/dist/cli/handlers/approve-confirm.d.ts.map +1 -0
- package/dist/cli/handlers/approve-confirm.js +142 -0
- package/dist/cli/handlers/approve.d.ts.map +1 -1
- package/dist/cli/handlers/approve.js +19 -1
- package/dist/cli/handlers/audit-log.d.ts +12 -0
- package/dist/cli/handlers/audit-log.d.ts.map +1 -0
- package/dist/cli/handlers/audit-log.js +81 -0
- package/dist/cli/handlers/build.d.ts +7 -0
- package/dist/cli/handlers/build.d.ts.map +1 -1
- package/dist/cli/handlers/build.js +124 -1
- package/dist/cli/handlers/ci-check-job.d.ts +11 -0
- package/dist/cli/handlers/ci-check-job.d.ts.map +1 -0
- package/dist/cli/handlers/ci-check-job.js +27 -0
- package/dist/cli/handlers/ci-check.d.ts +3 -0
- package/dist/cli/handlers/ci-check.d.ts.map +1 -0
- package/dist/cli/handlers/ci-check.js +63 -0
- package/dist/cli/handlers/ci-forge-check.d.ts +3 -0
- package/dist/cli/handlers/ci-forge-check.d.ts.map +1 -0
- package/dist/cli/handlers/ci-forge-check.js +89 -0
- package/dist/cli/handlers/e2e-safe-run.d.ts +12 -0
- package/dist/cli/handlers/e2e-safe-run.d.ts.map +1 -0
- package/dist/cli/handlers/e2e-safe-run.js +23 -0
- package/dist/cli/handlers/fan-out.js +4 -0
- package/dist/cli/handlers/gate-pending.d.ts +11 -0
- package/dist/cli/handlers/gate-pending.d.ts.map +1 -0
- package/dist/cli/handlers/gate-pending.js +44 -0
- package/dist/cli/handlers/init.d.ts.map +1 -1
- package/dist/cli/handlers/init.js +1 -0
- package/dist/cli/handlers/ledger.js +1 -1
- package/dist/cli/handlers/lifecycle-drift.d.ts +6 -2
- package/dist/cli/handlers/lifecycle-drift.d.ts.map +1 -1
- package/dist/cli/handlers/lifecycle-drift.js +7 -2
- package/dist/cli/handlers/lock.d.ts.map +1 -1
- package/dist/cli/handlers/lock.js +64 -5
- package/dist/cli/handlers/notify-relay.d.ts +15 -0
- package/dist/cli/handlers/notify-relay.d.ts.map +1 -0
- package/dist/cli/handlers/notify-relay.js +130 -0
- package/dist/cli/handlers/pr-env.d.ts.map +1 -1
- package/dist/cli/handlers/pr-env.js +42 -11
- package/dist/cli/handlers/pr.d.ts +43 -3
- package/dist/cli/handlers/pr.d.ts.map +1 -1
- package/dist/cli/handlers/pr.js +908 -205
- package/dist/cli/handlers/promote.d.ts.map +1 -1
- package/dist/cli/handlers/promote.js +21 -2
- package/dist/cli/handlers/release.d.ts.map +1 -1
- package/dist/cli/handlers/release.js +3 -0
- package/dist/cli/handlers/run-wave.d.ts +8 -0
- package/dist/cli/handlers/run-wave.d.ts.map +1 -1
- package/dist/cli/handlers/run-wave.js +160 -2
- package/dist/cli/handlers/run.d.ts +6 -1
- package/dist/cli/handlers/run.d.ts.map +1 -1
- package/dist/cli/handlers/run.js +86 -1
- package/dist/cli/handlers/serve.d.ts.map +1 -1
- package/dist/cli/handlers/serve.js +10 -1
- package/dist/cli/main.d.ts +11 -1
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +178 -13
- package/dist/cli/mcp/ledger-tools.d.ts +36 -0
- package/dist/cli/mcp/ledger-tools.d.ts.map +1 -0
- package/dist/cli/mcp/ledger-tools.js +122 -0
- package/dist/cli/mcp/product-tools.d.ts +78 -0
- package/dist/cli/mcp/product-tools.d.ts.map +1 -0
- package/dist/cli/mcp/product-tools.js +93 -0
- package/dist/cli/mcp/read-only.d.ts +34 -0
- package/dist/cli/mcp/read-only.d.ts.map +1 -0
- package/dist/cli/mcp/read-only.js +61 -0
- package/dist/cli/mcp/report-tools.d.ts +48 -0
- package/dist/cli/mcp/report-tools.d.ts.map +1 -0
- package/dist/cli/mcp/report-tools.js +128 -0
- package/dist/cli/mcp/server.d.ts +28 -1
- package/dist/cli/mcp/server.d.ts.map +1 -1
- package/dist/cli/mcp/server.js +86 -15
- package/dist/cli/mcp-config.d.ts +9 -2
- package/dist/cli/mcp-config.d.ts.map +1 -1
- package/dist/cli/mcp-config.js +8 -3
- package/dist/cli/parse-args.d.ts.map +1 -1
- package/dist/cli/parse-args.js +164 -3
- package/dist/cli/registry.d.ts +73 -0
- package/dist/cli/registry.d.ts.map +1 -1
- package/dist/cloud-lister/sigv4.d.ts +42 -7
- package/dist/cloud-lister/sigv4.d.ts.map +1 -1
- package/dist/cloud-lister/sigv4.js +72 -22
- package/dist/components/adoption.d.ts +69 -0
- package/dist/components/adoption.d.ts.map +1 -0
- package/dist/components/adoption.js +92 -0
- package/dist/components/apply-lease.d.ts +19 -0
- package/dist/components/apply-lease.d.ts.map +1 -0
- package/dist/components/apply-lease.js +41 -0
- package/dist/components/capability.d.ts +159 -5
- package/dist/components/capability.d.ts.map +1 -1
- package/dist/components/capability.js +39 -6
- package/dist/components/check-hooks.d.ts +116 -0
- package/dist/components/check-hooks.d.ts.map +1 -0
- package/dist/components/check-hooks.js +192 -0
- package/dist/components/check-steps.d.ts +74 -0
- package/dist/components/check-steps.d.ts.map +1 -0
- package/dist/components/check-steps.js +102 -0
- package/dist/components/ci-services.d.ts +57 -0
- package/dist/components/ci-services.d.ts.map +1 -0
- package/dist/components/ci-services.js +60 -0
- package/dist/components/cli-support.d.ts +13 -0
- package/dist/components/cli-support.d.ts.map +1 -1
- package/dist/components/cli-support.js +10 -2
- package/dist/components/driver.d.ts +32 -3
- package/dist/components/driver.d.ts.map +1 -1
- package/dist/components/driver.js +59 -5
- package/dist/components/fan-out-run.d.ts +12 -0
- package/dist/components/fan-out-run.d.ts.map +1 -1
- package/dist/components/fan-out-run.js +56 -16
- package/dist/components/groups.d.ts.map +1 -1
- package/dist/components/groups.js +23 -5
- package/dist/components/pr-env-ledger.d.ts +32 -0
- package/dist/components/pr-env-ledger.d.ts.map +1 -0
- package/dist/components/pr-env-ledger.js +38 -0
- package/dist/components/pr-env-ports.d.ts +12 -0
- package/dist/components/pr-env-ports.d.ts.map +1 -1
- package/dist/components/pr-env-ports.js +13 -3
- package/dist/components/pr-env-run.d.ts +6 -0
- package/dist/components/pr-env-run.d.ts.map +1 -1
- package/dist/components/pr-env-run.js +3 -2
- package/dist/components/pr-environment.d.ts +32 -4
- package/dist/components/pr-environment.d.ts.map +1 -1
- package/dist/components/pr-environment.js +26 -8
- package/dist/components/pr-pipeline.d.ts +297 -5
- package/dist/components/pr-pipeline.d.ts.map +1 -1
- package/dist/components/pr-pipeline.js +329 -18
- package/dist/components/pr-policy.d.ts +26 -2
- package/dist/components/pr-policy.d.ts.map +1 -1
- package/dist/components/pr-policy.js +41 -7
- package/dist/components/pr-run.d.ts +71 -0
- package/dist/components/pr-run.d.ts.map +1 -1
- package/dist/components/pr-run.js +91 -7
- package/dist/components/pr-targets.d.ts +24 -0
- package/dist/components/pr-targets.d.ts.map +1 -0
- package/dist/components/pr-targets.js +48 -0
- package/dist/components/product-pipeline.d.ts +250 -0
- package/dist/components/product-pipeline.d.ts.map +1 -0
- package/dist/components/product-pipeline.js +212 -0
- package/dist/components/promote.d.ts +6 -0
- package/dist/components/promote.d.ts.map +1 -1
- package/dist/components/promote.js +4 -1
- package/dist/components/release-compile.d.ts +22 -1
- package/dist/components/release-compile.d.ts.map +1 -1
- package/dist/components/release-compile.js +85 -0
- package/dist/components/release-promote.d.ts +15 -1
- package/dist/components/release-promote.d.ts.map +1 -1
- package/dist/components/release-promote.js +67 -2
- package/dist/components/repo-lock.d.ts +27 -0
- package/dist/components/repo-lock.d.ts.map +1 -0
- package/dist/components/repo-lock.js +49 -0
- package/dist/components/row-lease.d.ts +84 -0
- package/dist/components/row-lease.d.ts.map +1 -0
- package/dist/components/row-lease.js +110 -0
- package/dist/components/wave-plan.d.ts +42 -0
- package/dist/components/wave-plan.d.ts.map +1 -1
- package/dist/components/wave-plan.js +72 -4
- package/dist/control/applied.d.ts +89 -0
- package/dist/control/applied.d.ts.map +1 -0
- package/dist/control/applied.js +175 -0
- package/dist/control/consumers.d.ts +78 -0
- package/dist/control/consumers.d.ts.map +1 -0
- package/dist/control/consumers.js +172 -0
- package/dist/control/dispatch.d.ts +334 -0
- package/dist/control/dispatch.d.ts.map +1 -0
- package/dist/control/dispatch.js +519 -0
- package/dist/control/edges.d.ts +75 -0
- package/dist/control/edges.d.ts.map +1 -0
- package/dist/control/edges.js +133 -0
- package/dist/control/reconcile.d.ts +120 -0
- package/dist/control/reconcile.d.ts.map +1 -0
- package/dist/control/reconcile.js +178 -0
- package/dist/control/records.d.ts +187 -0
- package/dist/control/records.d.ts.map +1 -0
- package/dist/control/records.js +307 -0
- package/dist/discovery/sandbox/bundle.d.ts.map +1 -1
- package/dist/discovery/sandbox/bundle.js +25 -1
- package/dist/e2e-harness/bucket.d.ts +21 -0
- package/dist/e2e-harness/bucket.d.ts.map +1 -0
- package/dist/e2e-harness/bucket.js +61 -0
- package/dist/e2e-harness/claim.d.ts +70 -0
- package/dist/e2e-harness/claim.d.ts.map +1 -0
- package/dist/e2e-harness/claim.js +98 -0
- package/dist/e2e-harness/driver.d.ts +64 -0
- package/dist/e2e-harness/driver.d.ts.map +1 -0
- package/dist/e2e-harness/driver.js +243 -0
- package/dist/e2e-harness/forgejo.d.ts +77 -0
- package/dist/e2e-harness/forgejo.d.ts.map +1 -0
- package/dist/e2e-harness/forgejo.js +205 -0
- package/dist/e2e-harness/git.d.ts +32 -0
- package/dist/e2e-harness/git.d.ts.map +1 -0
- package/dist/e2e-harness/git.js +67 -0
- package/dist/e2e-harness/index.d.ts +22 -0
- package/dist/e2e-harness/index.d.ts.map +1 -0
- package/dist/e2e-harness/index.js +48 -0
- package/dist/e2e-harness/jobs.d.ts +8 -0
- package/dist/e2e-harness/jobs.d.ts.map +1 -0
- package/dist/e2e-harness/jobs.js +34 -0
- package/dist/e2e-harness/pins.d.ts +45 -0
- package/dist/e2e-harness/pins.d.ts.map +1 -0
- package/dist/e2e-harness/pins.js +44 -0
- package/dist/e2e-harness/ports.d.ts +113 -0
- package/dist/e2e-harness/ports.d.ts.map +1 -0
- package/dist/e2e-harness/ports.js +4 -0
- package/dist/e2e-harness/reports.d.ts +45 -0
- package/dist/e2e-harness/reports.d.ts.map +1 -0
- package/dist/e2e-harness/reports.js +57 -0
- package/dist/e2e-harness/safe-run-cli.d.ts +17 -0
- package/dist/e2e-harness/safe-run-cli.d.ts.map +1 -0
- package/dist/e2e-harness/safe-run-cli.js +43 -0
- package/dist/e2e-harness/safe-run.d.ts +61 -0
- package/dist/e2e-harness/safe-run.d.ts.map +1 -0
- package/dist/e2e-harness/safe-run.js +172 -0
- package/dist/e2e-harness/scenario.d.ts +11 -0
- package/dist/e2e-harness/scenario.d.ts.map +1 -0
- package/dist/e2e-harness/scenario.js +89 -0
- package/dist/e2e-harness/schemas/demo-cycle.schema.json +282 -0
- package/dist/e2e-harness/schemas/demo-step.schema.json +245 -0
- package/dist/e2e-harness/schemas/e2e-claim-row.schema.json +33 -0
- package/dist/e2e-harness/schemas/e2e-claims.schema.json +18 -0
- package/dist/e2e-harness/schemas/e2e-scenario.schema.json +150 -0
- package/dist/e2e-harness/schemas/index.d.ts +191 -0
- package/dist/e2e-harness/schemas/index.d.ts.map +1 -0
- package/dist/e2e-harness/schemas/index.js +62 -0
- package/dist/e2e-harness/stack.d.ts +124 -0
- package/dist/e2e-harness/stack.d.ts.map +1 -0
- package/dist/e2e-harness/stack.js +207 -0
- package/dist/e2e-harness/steps.d.ts +11 -0
- package/dist/e2e-harness/steps.d.ts.map +1 -0
- package/dist/e2e-harness/steps.js +22 -0
- package/dist/e2e-harness.d.ts +3 -0
- package/dist/e2e-harness.d.ts.map +1 -0
- package/dist/e2e-harness.js +2 -0
- package/dist/engine-facts.d.ts.map +1 -1
- package/dist/engine-facts.js +1 -2
- package/dist/exit-codes.d.ts +54 -0
- package/dist/exit-codes.d.ts.map +1 -0
- package/dist/exit-codes.js +55 -0
- package/dist/forge-check/check.d.ts +63 -0
- package/dist/forge-check/check.d.ts.map +1 -0
- package/dist/forge-check/check.js +139 -0
- package/dist/forge-check/contract.d.ts +152 -0
- package/dist/forge-check/contract.d.ts.map +1 -0
- package/dist/forge-check/contract.js +118 -0
- package/dist/forge-check/forge.d.ts +42 -0
- package/dist/forge-check/forge.d.ts.map +1 -0
- package/dist/forge-check/forge.js +338 -0
- package/dist/forge-check/index.d.ts +24 -0
- package/dist/forge-check/index.d.ts.map +1 -0
- package/dist/forge-check/index.js +23 -0
- package/dist/forge-check/pulumi.d.ts +44 -0
- package/dist/forge-check/pulumi.d.ts.map +1 -0
- package/dist/forge-check/pulumi.js +184 -0
- package/dist/forge-check/read-only.d.ts +26 -0
- package/dist/forge-check/read-only.d.ts.map +1 -0
- package/dist/forge-check/read-only.js +53 -0
- package/dist/forge-check/trust.d.ts +94 -0
- package/dist/forge-check/trust.d.ts.map +1 -0
- package/dist/forge-check/trust.js +532 -0
- package/dist/forge-check/types.d.ts +80 -0
- package/dist/forge-check/types.d.ts.map +1 -0
- package/dist/forge-check/types.js +18 -0
- package/dist/forge-check.d.ts +6 -0
- package/dist/forge-check.d.ts.map +1 -0
- package/dist/forge-check.js +5 -0
- package/dist/gate-decision.d.ts +1 -0
- package/dist/gate-decision.d.ts.map +1 -1
- package/dist/gate-decision.js +2 -0
- package/dist/gate-policy.d.ts +47 -1
- package/dist/gate-policy.d.ts.map +1 -1
- package/dist/gate-policy.js +50 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/lexicon.d.ts +152 -6
- package/dist/lexicon.d.ts.map +1 -1
- package/dist/lifecycle/adoption-file.d.ts +24 -0
- package/dist/lifecycle/adoption-file.d.ts.map +1 -1
- package/dist/lifecycle/adoption-file.js +1 -2
- package/dist/lifecycle/cloud-index.d.ts.map +1 -1
- package/dist/lifecycle/cloud-index.js +1 -2
- package/dist/lifecycle/gate-applied.d.ts +6 -0
- package/dist/lifecycle/gate-applied.d.ts.map +1 -1
- package/dist/lifecycle/gate-ledger.d.ts +29 -0
- package/dist/lifecycle/gate-ledger.d.ts.map +1 -1
- package/dist/lifecycle/gate-ledger.js +10 -1
- package/dist/lifecycle/gate-pending-by-plan.d.ts +75 -0
- package/dist/lifecycle/gate-pending-by-plan.d.ts.map +1 -0
- package/dist/lifecycle/gate-pending-by-plan.js +96 -0
- package/dist/lifecycle/gated-request-digest.d.ts +28 -0
- package/dist/lifecycle/gated-request-digest.d.ts.map +1 -0
- package/dist/lifecycle/gated-request-digest.js +35 -0
- package/dist/lifecycle/gated-request.d.ts +126 -0
- package/dist/lifecycle/gated-request.d.ts.map +1 -0
- package/dist/lifecycle/gated-request.js +204 -0
- package/dist/lifecycle/identity-match.d.ts +15 -0
- package/dist/lifecycle/identity-match.d.ts.map +1 -1
- package/dist/lifecycle/identity-match.js +11 -6
- package/dist/lifecycle/index-diff.d.ts +40 -0
- package/dist/lifecycle/index-diff.d.ts.map +1 -1
- package/dist/lifecycle/index-diff.js +1 -2
- package/dist/lifecycle/index-document.d.ts.map +1 -1
- package/dist/lifecycle/index-document.js +1 -2
- package/dist/lifecycle/index-import.d.ts +4 -1
- package/dist/lifecycle/index-import.d.ts.map +1 -1
- package/dist/lifecycle/index-import.js +29 -32
- package/dist/lifecycle/ledger-read.d.ts.map +1 -1
- package/dist/lifecycle/ledger-read.js +7 -3
- package/dist/lifecycle/lock-rows.d.ts +76 -0
- package/dist/lifecycle/lock-rows.d.ts.map +1 -0
- package/dist/lifecycle/lock-rows.js +140 -0
- package/dist/lifecycle/query.d.ts +50 -3
- package/dist/lifecycle/query.d.ts.map +1 -1
- package/dist/lifecycle/query.js +97 -7
- package/dist/lifecycle/release-catalog-site.d.ts +66 -0
- package/dist/lifecycle/release-catalog-site.d.ts.map +1 -0
- package/dist/lifecycle/release-catalog-site.js +232 -0
- package/dist/lifecycle/release-catalog.d.ts +201 -0
- package/dist/lifecycle/release-catalog.d.ts.map +1 -0
- package/dist/lifecycle/release-catalog.js +198 -0
- package/dist/lifecycle/release-changelog.d.ts +41 -0
- package/dist/lifecycle/release-changelog.d.ts.map +1 -0
- package/dist/lifecycle/release-changelog.js +38 -0
- package/dist/lifecycle/release-cut.d.ts +1 -0
- package/dist/lifecycle/release-cut.d.ts.map +1 -1
- package/dist/lifecycle/release-cut.js +1 -1
- package/dist/lifecycle/release-ledger.d.ts +16 -0
- package/dist/lifecycle/release-ledger.d.ts.map +1 -1
- package/dist/lifecycle/release-ledger.js +9 -0
- package/dist/lifecycle/release-publish.d.ts +43 -22
- package/dist/lifecycle/release-publish.d.ts.map +1 -1
- package/dist/lifecycle/release-read.d.ts.map +1 -1
- package/dist/lifecycle/release-read.js +3 -0
- package/dist/lifecycle/release-status.d.ts +106 -0
- package/dist/lifecycle/release-status.d.ts.map +1 -0
- package/dist/lifecycle/release-status.js +115 -0
- package/dist/lifecycle/resource-lock.d.ts +120 -0
- package/dist/lifecycle/resource-lock.d.ts.map +1 -0
- package/dist/lifecycle/resource-lock.js +317 -0
- package/dist/lifecycle/retention.d.ts.map +1 -1
- package/dist/lifecycle/retention.js +3 -0
- package/dist/lifecycle/run-ledger.d.ts.map +1 -1
- package/dist/lifecycle/run-ledger.js +9 -1
- package/dist/lifecycle/snapshot-store-s3.d.ts +36 -3
- package/dist/lifecycle/snapshot-store-s3.d.ts.map +1 -1
- package/dist/lifecycle/snapshot-store-s3.js +9 -44
- package/dist/lifecycle/snapshot-store.d.ts.map +1 -1
- package/dist/lifecycle/snapshot-store.js +1 -2
- package/dist/lifecycle/target-lock.d.ts +15 -0
- package/dist/lifecycle/target-lock.d.ts.map +1 -1
- package/dist/lifecycle/target-lock.js +25 -10
- package/dist/lifecycle/wave-plans.d.ts +23 -7
- package/dist/lifecycle/wave-plans.d.ts.map +1 -1
- package/dist/lifecycle/wave-plans.js +9 -2
- package/dist/mcp/types.d.ts +7 -0
- package/dist/mcp/types.d.ts.map +1 -1
- package/dist/notify-product.d.ts +43 -0
- package/dist/notify-product.d.ts.map +1 -0
- package/dist/notify-product.js +58 -0
- package/dist/notify-relay.d.ts +197 -0
- package/dist/notify-relay.d.ts.map +1 -0
- package/dist/notify-relay.js +321 -0
- package/dist/notify.d.ts +44 -4
- package/dist/notify.d.ts.map +1 -1
- package/dist/notify.js +77 -14
- package/dist/object-store/azure-blob.d.ts +129 -0
- package/dist/object-store/azure-blob.d.ts.map +1 -0
- package/dist/object-store/azure-blob.js +341 -0
- package/dist/object-store/common.d.ts +108 -0
- package/dist/object-store/common.d.ts.map +1 -0
- package/dist/object-store/common.js +80 -0
- package/dist/object-store/errors.d.ts +28 -0
- package/dist/object-store/errors.d.ts.map +1 -0
- package/dist/object-store/errors.js +21 -0
- package/dist/object-store/from-env.d.ts +18 -0
- package/dist/object-store/from-env.d.ts.map +1 -0
- package/dist/object-store/from-env.js +22 -0
- package/dist/object-store/gcs.d.ts +106 -0
- package/dist/object-store/gcs.d.ts.map +1 -0
- package/dist/object-store/gcs.js +393 -0
- package/dist/object-store/index.d.ts +9 -0
- package/dist/object-store/index.d.ts.map +1 -0
- package/dist/object-store/index.js +8 -0
- package/dist/object-store/s3.d.ts +146 -0
- package/dist/object-store/s3.d.ts.map +1 -0
- package/dist/object-store/s3.js +306 -0
- package/dist/op/activities/converge.d.ts.map +1 -1
- package/dist/op/activities/converge.js +2 -1
- package/dist/op/activities/index.d.ts +1 -1
- package/dist/op/activities/index.d.ts.map +1 -1
- package/dist/op/activities/index.js +1 -1
- package/dist/op/activities/review-agent.d.ts +55 -2
- package/dist/op/activities/review-agent.d.ts.map +1 -1
- package/dist/op/activities/review-agent.js +65 -5
- package/dist/op/approval-status.d.ts +103 -0
- package/dist/op/approval-status.d.ts.map +1 -0
- package/dist/op/approval-status.js +197 -0
- package/dist/op/gate.d.ts +29 -1
- package/dist/op/gate.d.ts.map +1 -1
- package/dist/op/gate.js +59 -23
- package/dist/op/generate-pipeline.d.ts.map +1 -1
- package/dist/op/generate-pipeline.js +7 -1
- package/dist/op/index.d.ts +12 -1
- package/dist/op/index.d.ts.map +1 -1
- package/dist/op/index.js +7 -1
- package/dist/op/op-waves-after-plan.d.ts +137 -0
- package/dist/op/op-waves-after-plan.d.ts.map +1 -0
- package/dist/op/op-waves-after-plan.js +163 -0
- package/dist/op/op-waves-capability-spec.d.ts +63 -0
- package/dist/op/op-waves-capability-spec.d.ts.map +1 -0
- package/dist/op/op-waves-capability-spec.js +115 -0
- package/dist/op/op-waves-capability.d.ts +197 -0
- package/dist/op/op-waves-capability.d.ts.map +1 -0
- package/dist/op/op-waves-capability.js +311 -0
- package/dist/op/op-waves-events.d.ts +54 -0
- package/dist/op/op-waves-events.d.ts.map +1 -0
- package/dist/op/op-waves-events.js +122 -0
- package/dist/op/op-waves-notify.d.ts +7 -1
- package/dist/op/op-waves-notify.d.ts.map +1 -1
- package/dist/op/op-waves-notify.js +35 -16
- package/dist/op/op-waves-release-port.d.ts +18 -0
- package/dist/op/op-waves-release-port.d.ts.map +1 -0
- package/dist/op/op-waves-release-port.js +61 -0
- package/dist/op/op-waves-release.d.ts +92 -0
- package/dist/op/op-waves-release.d.ts.map +1 -0
- package/dist/op/op-waves-release.js +96 -0
- package/dist/op/op-waves-run.d.ts +182 -6
- package/dist/op/op-waves-run.d.ts.map +1 -1
- package/dist/op/op-waves-run.js +1076 -44
- package/dist/op/op-waves-stand-down.d.ts +60 -0
- package/dist/op/op-waves-stand-down.d.ts.map +1 -0
- package/dist/op/op-waves-stand-down.js +96 -0
- package/dist/op/op-waves.d.ts +187 -8
- package/dist/op/op-waves.d.ts.map +1 -1
- package/dist/op/op-waves.js +203 -19
- package/dist/op/runtime.d.ts +95 -0
- package/dist/op/runtime.d.ts.map +1 -1
- package/dist/op/runtime.js +18 -0
- package/dist/op/stage-hooks.d.ts +45 -7
- package/dist/op/stage-hooks.d.ts.map +1 -1
- package/dist/op/stage-hooks.js +61 -3
- package/dist/op/steward-beside.d.ts.map +1 -1
- package/dist/op/steward-beside.js +2 -1
- package/dist/op/types.d.ts +2 -2
- package/dist/op/types.d.ts.map +1 -1
- package/dist/op/types.js +3 -2
- package/dist/otlp-metrics.d.ts +38 -0
- package/dist/otlp-metrics.d.ts.map +1 -0
- package/dist/otlp-metrics.js +82 -0
- package/dist/otlp.d.ts +249 -0
- package/dist/otlp.d.ts.map +1 -0
- package/dist/otlp.js +425 -0
- package/dist/override-gate.d.ts.map +1 -1
- package/dist/override-gate.js +5 -0
- package/dist/parallelism.d.ts +17 -0
- package/dist/parallelism.d.ts.map +1 -0
- package/dist/parallelism.js +33 -0
- package/dist/policy-packs.d.ts +69 -0
- package/dist/policy-packs.d.ts.map +1 -0
- package/dist/policy-packs.js +205 -0
- package/dist/policy-source.d.ts +51 -0
- package/dist/policy-source.d.ts.map +1 -0
- package/dist/policy-source.js +102 -0
- package/dist/pr-forge.d.ts +40 -0
- package/dist/pr-forge.d.ts.map +1 -1
- package/dist/pr-forge.js +146 -37
- package/dist/pr-loop.d.ts +158 -11
- package/dist/pr-loop.d.ts.map +1 -1
- package/dist/pr-loop.js +302 -44
- package/dist/pr-merge.d.ts +64 -0
- package/dist/pr-merge.d.ts.map +1 -0
- package/dist/pr-merge.js +78 -0
- package/dist/pr-post.d.ts +86 -1
- package/dist/pr-post.d.ts.map +1 -1
- package/dist/pr-post.js +141 -5
- package/dist/pr-report-url.d.ts +32 -4
- package/dist/pr-report-url.d.ts.map +1 -1
- package/dist/pr-report-url.js +45 -5
- package/dist/pr-requires.d.ts +13 -2
- package/dist/pr-requires.d.ts.map +1 -1
- package/dist/pr-requires.js +14 -0
- package/dist/release-floors.d.ts +1 -1
- package/dist/release-floors.js +1 -1
- package/dist/run-event.d.ts +26 -1
- package/dist/run-event.d.ts.map +1 -1
- package/dist/run-event.js +3 -1
- package/dist/scheduled-op-cloud.d.ts +32 -0
- package/dist/scheduled-op-cloud.d.ts.map +1 -0
- package/dist/scheduled-op-cloud.js +69 -0
- package/dist/sorted-json.d.ts +10 -0
- package/dist/sorted-json.d.ts.map +1 -0
- package/dist/sorted-json.js +14 -0
- package/dist/terraform/credentials.d.ts +59 -0
- package/dist/terraform/credentials.d.ts.map +1 -0
- package/dist/terraform/credentials.js +149 -0
- package/dist/utils.d.ts +1 -4
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +1 -9
- package/dist/wave-runtime.d.ts +1 -1
- package/dist/wave-runtime.js +2 -2
- package/dist/wave-runtime.mjs +405 -287
- package/dist/workspace/chant-migrations/chud-lexicon-exit.d.ts.map +1 -1
- package/dist/workspace/chant-migrations/chud-lexicon-exit.js +4 -1
- package/dist/workspace/ci-lock-grain.d.ts +17 -0
- package/dist/workspace/ci-lock-grain.d.ts.map +1 -0
- package/dist/workspace/ci-lock-grain.js +21 -0
- package/dist/workspace/ci-run.d.ts +2 -1
- package/dist/workspace/ci-run.d.ts.map +1 -1
- package/dist/workspace/ci-run.js +10 -3
- package/dist/workspace/declaration.d.ts +16 -4
- package/dist/workspace/declaration.d.ts.map +1 -1
- package/dist/workspace/declaration.js +5 -2
- package/dist/workspace/declaration.schema.json +27 -3
- package/dist/workspace/drift-cli.d.ts.map +1 -1
- package/dist/workspace/drift-cli.js +8 -3
- package/dist/workspace/exit-cli.d.ts +1 -1
- package/dist/workspace/exit-cli.d.ts.map +1 -1
- package/dist/workspace/exit-cli.js +2 -1
- package/dist/workspace/import-fetch.d.ts +4 -2
- package/dist/workspace/import-fetch.d.ts.map +1 -1
- package/dist/workspace/import-fetch.js +4 -2
- package/dist/workspace/import-init.d.ts.map +1 -1
- package/dist/workspace/import-init.js +4 -2
- package/dist/workspace/ledger.schema.json +7 -3
- package/dist/workspace/lineage-upgrade-cli.d.ts +1 -1
- package/dist/workspace/lineage-upgrade-cli.d.ts.map +1 -1
- package/dist/workspace/lineage-upgrade-cli.js +2 -1
- package/dist/workspace/pr-report.schema.json +79 -3
- package/dist/workspace/promote.d.ts +1 -1
- package/dist/workspace/promote.d.ts.map +1 -1
- package/dist/workspace/promote.js +2 -1
- package/dist/workspace/records-cli.d.ts +2 -2
- package/dist/workspace/records-cli.d.ts.map +1 -1
- package/dist/workspace/records-cli.js +3 -2
- package/dist/workspace/release-catalog.schema.json +277 -0
- package/dist/workspace/run-event.schema.json +18 -1
- package/dist/workspace/work-cli.d.ts +3 -1
- package/dist/workspace/work-cli.d.ts.map +1 -1
- package/dist/workspace/work-cli.js +7 -2
- package/dist/workspace/workspace-run.d.ts.map +1 -1
- package/dist/workspace/workspace-run.js +2 -1
- package/package.json +21 -1
- package/src/__fixtures__/estate-ledger.ts +101 -0
- package/src/__fixtures__/oidc-emulator.ts +31 -2
- package/src/__fixtures__/product-words.ts +44 -0
- package/src/__golden__/wave-loop/op-by-apply-after-fails.json +10 -2
- package/src/__golden__/wave-loop/op-by-apply-hold.json +20 -4
- package/src/__golden__/wave-loop/op-by-apply-ignored.json +10 -2
- package/src/__golden__/wave-loop/op-by-apply-pass.json +10 -2
- package/src/__golden__/wave-loop/op-by-apply-skip.json +10 -2
- package/src/__golden__/wave-loop/op-discover-rest-stops.json +22 -6
- package/src/__golden__/wave-loop/op-discover-rest.json +44 -12
- package/src/__golden__/wave-loop/op-discover-wide.json +12 -3
- package/src/__golden__/wave-loop/op-held-on.json +28 -7
- package/src/__golden__/wave-loop/op-hooks-apply-fails.json +22 -6
- package/src/__golden__/wave-loop/op-hooks-fail-after-apply.json +22 -6
- package/src/__golden__/wave-loop/op-hooks-fail-before-apply.json +4 -2
- package/src/__golden__/wave-loop/op-hooks-held.json +26 -8
- package/src/__golden__/wave-loop/op-hooks-hold-before-apply.json +18 -4
- package/src/__golden__/wave-loop/op-hooks-pass.json +22 -6
- package/src/__golden__/wave-loop/op-hooks-share.json +20 -7
- package/src/__golden__/wave-loop/op-outcome-held.json +12 -3
- package/src/__golden__/wave-loop/op-outcome-replan-approved.json +16 -5
- package/src/__golden__/wave-loop/op-outcome-replan-forever.json +48 -21
- package/src/__golden__/wave-loop/op-outcome-replan.json +16 -5
- package/src/__golden__/wave-loop/op-outcome-stood-down.json +12 -3
- package/src/__golden__/wave-loop/op-outcome-unreadable.json +12 -3
- package/src/__golden__/wave-loop/op-overridden.json +28 -7
- package/src/__golden__/wave-loop/op-per-run.json +20 -4
- package/src/__golden__/wave-loop/op-point.json +18 -4
- package/src/__golden__/wave-loop/op-pr-review.json +10 -2
- package/src/__golden__/wave-loop/op-spend-change-only.json +10 -2
- package/src/__golden__/wave-loop/op-spend.json +10 -2
- package/src/__golden__/wave-loop/op-wave-commands.json +56 -13
- package/src/__golden__/wave-loop/op-wide.json +20 -4
- package/src/bucket-check/azure.ts +307 -0
- package/src/bucket-check/bucket-check.test.ts +210 -0
- package/src/bucket-check/fixtures/azure.json +153 -0
- package/src/bucket-check/fixtures/gcs.json +148 -0
- package/src/bucket-check/fixtures/s3.json +277 -0
- package/src/bucket-check/gcs.ts +257 -0
- package/src/bucket-check/index.ts +61 -0
- package/src/bucket-check/s3.ts +433 -0
- package/src/bucket-check/types.ts +75 -0
- package/src/bucket-check/wire.ts +50 -0
- package/src/bucket-check.ts +5 -0
- package/src/capabilities/templates.test.ts +2 -3
- package/src/capabilities/templates.ts +1 -2
- package/src/cdk/advise.test.ts +1 -1
- package/src/change-set-bundle.test.ts +0 -1
- package/src/change-set.ts +2 -3
- package/src/ci-agent.test.ts +348 -0
- package/src/ci-agent.ts +1025 -0
- package/src/ci-audit/__fixtures__/cloudtrail-lookup-bucket.json +37 -0
- package/src/ci-audit/__fixtures__/cloudtrail-writes-window.json +59 -0
- package/src/ci-audit/attribution.ts +260 -0
- package/src/ci-audit/audit-log.ts +220 -0
- package/src/ci-audit/ci-audit.test.ts +175 -0
- package/src/ci-audit/index.ts +15 -0
- package/src/ci-audit/unrecorded.ts +140 -0
- package/src/ci-audit.ts +2 -0
- package/src/ci-control.ts +173 -0
- package/src/ci-estate/delivery.ts +433 -0
- package/src/ci-estate/overdue.ts +81 -0
- package/src/ci-estate/page.ts +343 -0
- package/src/ci-estate/rows.ts +251 -0
- package/src/ci-estate.test.ts +281 -0
- package/src/ci-estate.ts +175 -0
- package/src/ci-handover.ts +67 -16
- package/src/ci-identity-database.test.ts +54 -0
- package/src/ci-identity-pulumi.test.ts +163 -0
- package/src/ci-identity-targets.test.ts +3 -1
- package/src/ci-identity.ts +123 -22
- package/src/ci-job-guard.test.ts +154 -0
- package/src/ci-job-guard.ts +319 -0
- package/src/ci-jobs.ts +8 -0
- package/src/ci-product-comment-targets.test.ts +45 -0
- package/src/ci-product-words.test.ts +101 -0
- package/src/ci-product-words.ts +565 -0
- package/src/ci-product.ts +226 -0
- package/src/ci-respond-run.ts +291 -0
- package/src/ci-respond.test.ts +264 -0
- package/src/ci-respond.ts +412 -0
- package/src/ci-shared-reads.test.ts +145 -0
- package/src/cli/commands/audit.test.ts +1 -1
- package/src/cli/commands/audit.ts +3 -2
- package/src/cli/commands/carve.test.ts +1 -1
- package/src/cli/commands/carve.ts +2 -2
- package/src/cli/commands/init.ts +3 -1
- package/src/cli/component-wave-args.test.ts +16 -0
- package/src/cli/handlers/agent.ts +126 -0
- package/src/cli/handlers/approve-confirm.test.ts +276 -0
- package/src/cli/handlers/approve-confirm.ts +200 -0
- package/src/cli/handlers/approve.ts +18 -1
- package/src/cli/handlers/audit-log.ts +74 -0
- package/src/cli/handlers/build-pr-loop-flags.test.ts +98 -0
- package/src/cli/handlers/build.test.ts +7 -0
- package/src/cli/handlers/build.ts +113 -1
- package/src/cli/handlers/ci-check-job.test.ts +114 -0
- package/src/cli/handlers/ci-check-job.ts +33 -0
- package/src/cli/handlers/ci-check.ts +63 -0
- package/src/cli/handlers/ci-forge-check.ts +91 -0
- package/src/cli/handlers/e2e-safe-run.ts +27 -0
- package/src/cli/handlers/fan-out.test.ts +10 -10
- package/src/cli/handlers/fan-out.ts +5 -0
- package/src/cli/handlers/gate-pending.ts +46 -0
- package/src/cli/handlers/init.ts +1 -0
- package/src/cli/handlers/ledger.ts +1 -1
- package/src/cli/handlers/lifecycle-drift.ts +7 -2
- package/src/cli/handlers/lock.test.ts +29 -2
- package/src/cli/handlers/lock.ts +66 -6
- package/src/cli/handlers/notify-relay.ts +130 -0
- package/src/cli/handlers/pr-before-merge.test.ts +2 -1
- package/src/cli/handlers/pr-deploy-inputs.test.ts +7 -7
- package/src/cli/handlers/pr-env.ts +48 -11
- package/src/cli/handlers/pr-plan-comment-targets.test.ts +166 -0
- package/src/cli/handlers/pr-plan-flags.test.ts +161 -0
- package/src/cli/handlers/pr-plan-targets.test.ts +155 -0
- package/src/cli/handlers/pr-waves-blocked.test.ts +5 -0
- package/src/cli/handlers/pr-waves.test.ts +8 -2
- package/src/cli/handlers/pr.test.ts +8 -8
- package/src/cli/handlers/pr.ts +879 -205
- package/src/cli/handlers/promote.test.ts +5 -5
- package/src/cli/handlers/promote.ts +22 -2
- package/src/cli/handlers/release.ts +2 -0
- package/src/cli/handlers/run-components-exit.test.ts +7 -7
- package/src/cli/handlers/run-wave.ts +144 -2
- package/src/cli/handlers/run.test.ts +6 -4
- package/src/cli/handlers/run.ts +86 -1
- package/src/cli/handlers/serve.ts +10 -1
- package/src/cli/main.test.ts +1 -1
- package/src/cli/main.ts +180 -13
- package/src/cli/mcp/ledger-tools.ts +126 -0
- package/src/cli/mcp/product-tools.test.ts +123 -0
- package/src/cli/mcp/product-tools.ts +129 -0
- package/src/cli/mcp/read-only.test.ts +134 -0
- package/src/cli/mcp/read-only.ts +68 -0
- package/src/cli/mcp/report-tools.ts +135 -0
- package/src/cli/mcp/server.test.ts +5 -4
- package/src/cli/mcp/server.ts +90 -16
- package/src/cli/mcp-config.ts +8 -3
- package/src/cli/parse-args.ts +119 -2
- package/src/cli/registry.ts +73 -0
- package/src/cloud-lister/sigv4.ts +80 -23
- package/src/components/adoption.test.ts +140 -0
- package/src/components/adoption.ts +140 -0
- package/src/components/apply-lease.ts +49 -0
- package/src/components/capability.ts +180 -6
- package/src/components/check-hooks.test.ts +66 -0
- package/src/components/check-hooks.ts +255 -0
- package/src/components/check-steps.test.ts +70 -0
- package/src/components/check-steps.ts +158 -0
- package/src/components/ci-services.test.ts +51 -0
- package/src/components/ci-services.ts +82 -0
- package/src/components/cli-support.ts +23 -2
- package/src/components/driver.test.ts +3 -3
- package/src/components/driver.ts +73 -6
- package/src/components/fan-out-run.ts +68 -18
- package/src/components/groups.ts +21 -4
- package/src/components/plan-flags.test.ts +46 -0
- package/src/components/pr-comment-preview-targets.test.ts +34 -0
- package/src/components/pr-comment-preview.test.ts +54 -0
- package/src/components/pr-env-ledger.test.ts +9 -0
- package/src/components/pr-env-ledger.ts +42 -0
- package/src/components/pr-env-ports.ts +29 -4
- package/src/components/pr-env-run-bundle.test.ts +2 -14
- package/src/components/pr-env-run.test.ts +19 -0
- package/src/components/pr-env-run.ts +12 -2
- package/src/components/pr-environment.test.ts +29 -0
- package/src/components/pr-environment.ts +40 -8
- package/src/components/pr-pipeline-runners.test.ts +80 -0
- package/src/components/pr-pipeline.test.ts +15 -0
- package/src/components/pr-pipeline.ts +498 -18
- package/src/components/pr-policy.ts +45 -7
- package/src/components/pr-run.test.ts +1 -1
- package/src/components/pr-run.ts +138 -11
- package/src/components/pr-stale-job.test.ts +34 -0
- package/src/components/pr-targets.test.ts +35 -0
- package/src/components/pr-targets.ts +45 -0
- package/src/components/product-pipeline.test.ts +200 -0
- package/src/components/product-pipeline.ts +383 -0
- package/src/components/promote.ts +10 -1
- package/src/components/release-compile.ts +87 -1
- package/src/components/release-promote.ts +65 -1
- package/src/components/repo-lock.ts +52 -0
- package/src/components/row-lease.test.ts +490 -0
- package/src/components/row-lease.ts +167 -0
- package/src/components/wave-plan-policy.test.ts +19 -0
- package/src/components/wave-plan.ts +96 -6
- package/src/control/__fixtures__/consumers/apps/consumers.json +15 -0
- package/src/control/__fixtures__/consumers/infra/consumers.json +23 -0
- package/src/control/applied.test.ts +148 -0
- package/src/control/applied.ts +191 -0
- package/src/control/consumers.test.ts +129 -0
- package/src/control/consumers.ts +192 -0
- package/src/control/control.test.ts +302 -0
- package/src/control/dispatch.ts +699 -0
- package/src/control/edges.test.ts +112 -0
- package/src/control/edges.ts +164 -0
- package/src/control/note-checkout.test.ts +91 -0
- package/src/control/reconcile.ts +250 -0
- package/src/control/records.ts +395 -0
- package/src/discovery/sandbox/bundle.ts +25 -1
- package/src/e2e-harness/__project__/chant.config.ts +4 -0
- package/src/e2e-harness/__project__/src/compose.ts +33 -0
- package/src/e2e-harness/bucket.ts +69 -0
- package/src/e2e-harness/claim.test.ts +150 -0
- package/src/e2e-harness/claim.ts +140 -0
- package/src/e2e-harness/driver.test.ts +304 -0
- package/src/e2e-harness/driver.ts +294 -0
- package/src/e2e-harness/forgejo.ts +267 -0
- package/src/e2e-harness/git.ts +96 -0
- package/src/e2e-harness/index.ts +50 -0
- package/src/e2e-harness/jobs.ts +35 -0
- package/src/e2e-harness/pins.ts +52 -0
- package/src/e2e-harness/ports.ts +130 -0
- package/src/e2e-harness/reports.ts +79 -0
- package/src/e2e-harness/safe-run-cli.test.ts +102 -0
- package/src/e2e-harness/safe-run-cli.ts +54 -0
- package/src/e2e-harness/safe-run.ts +198 -0
- package/src/e2e-harness/scenario.ts +89 -0
- package/src/e2e-harness/schemas/README.md +62 -0
- package/src/e2e-harness/schemas/demo-cycle.schema.json +282 -0
- package/src/e2e-harness/schemas/demo-step.schema.json +245 -0
- package/src/e2e-harness/schemas/e2e-claim-row.schema.json +33 -0
- package/src/e2e-harness/schemas/e2e-claims.schema.json +18 -0
- package/src/e2e-harness/schemas/e2e-scenario.schema.json +150 -0
- package/src/e2e-harness/schemas/index.ts +220 -0
- package/src/e2e-harness/schemas.test.ts +145 -0
- package/src/e2e-harness/stack.test.ts +124 -0
- package/src/e2e-harness/stack.ts +306 -0
- package/src/e2e-harness/steps.ts +30 -0
- package/src/e2e-harness.ts +2 -0
- package/src/engine-facts.test.ts +2 -3
- package/src/engine-facts.ts +1 -2
- package/src/exit-codes.test.ts +32 -0
- package/src/exit-codes.ts +61 -0
- package/src/forge-check/check.ts +155 -0
- package/src/forge-check/contract.ts +215 -0
- package/src/forge-check/forge-check.test.ts +427 -0
- package/src/forge-check/forge.ts +318 -0
- package/src/forge-check/index.ts +43 -0
- package/src/forge-check/pulumi.ts +192 -0
- package/src/forge-check/read-only.ts +56 -0
- package/src/forge-check/trust.ts +527 -0
- package/src/forge-check/types.ts +78 -0
- package/src/forge-check.ts +5 -0
- package/src/gate-decision-bundle.test.ts +11 -0
- package/src/gate-decision.ts +3 -0
- package/src/gate-policy.ts +92 -3
- package/src/gated-waves-bundle.test.ts +0 -1
- package/src/index.ts +2 -0
- package/src/lexicon.ts +143 -6
- package/src/lifecycle/adoption-file.ts +1 -2
- package/src/lifecycle/cloud-index.test.ts +2 -3
- package/src/lifecycle/cloud-index.ts +1 -2
- package/src/lifecycle/control-entries-ledger.test.ts +69 -0
- package/src/lifecycle/gate-applied.ts +6 -0
- package/src/lifecycle/gate-ledger.ts +35 -1
- package/src/lifecycle/gate-pending-by-plan.test.ts +69 -0
- package/src/lifecycle/gate-pending-by-plan.ts +133 -0
- package/src/lifecycle/gated-request-digest.ts +49 -0
- package/src/lifecycle/gated-request-ledger.test.ts +53 -0
- package/src/lifecycle/gated-request.ts +279 -0
- package/src/lifecycle/identity-match.ts +25 -6
- package/src/lifecycle/index-diff.ts +1 -2
- package/src/lifecycle/index-document.ts +1 -2
- package/src/lifecycle/index-import.test.ts +14 -0
- package/src/lifecycle/index-import.ts +54 -34
- package/src/lifecycle/ledger-read.ts +7 -3
- package/src/lifecycle/lock-rows.test.ts +109 -0
- package/src/lifecycle/lock-rows.ts +167 -0
- package/src/lifecycle/publish-target-context.test.ts +108 -0
- package/src/lifecycle/query.test.ts +2 -3
- package/src/lifecycle/query.ts +109 -8
- package/src/lifecycle/release-catalog-site.test.ts +142 -0
- package/src/lifecycle/release-catalog-site.ts +291 -0
- package/src/lifecycle/release-catalog.test.ts +192 -0
- package/src/lifecycle/release-catalog.ts +353 -0
- package/src/lifecycle/release-changelog.test.ts +70 -0
- package/src/lifecycle/release-changelog.ts +71 -0
- package/src/lifecycle/release-cut.ts +2 -2
- package/src/lifecycle/release-ledger.ts +19 -0
- package/src/lifecycle/release-publish.ts +45 -22
- package/src/lifecycle/release-read.ts +2 -0
- package/src/lifecycle/release-status.test.ts +185 -0
- package/src/lifecycle/release-status.ts +175 -0
- package/src/lifecycle/resource-lock.test.ts +175 -0
- package/src/lifecycle/resource-lock.ts +354 -0
- package/src/lifecycle/retention.ts +2 -0
- package/src/lifecycle/run-ledger.ts +7 -1
- package/src/lifecycle/snapshot-store-s3.ts +9 -45
- package/src/lifecycle/snapshot-store.ts +1 -2
- package/src/lifecycle/target-lock.ts +24 -9
- package/src/lifecycle/wave-plans.ts +33 -5
- package/src/mcp/types.ts +7 -0
- package/src/notify-product.ts +76 -0
- package/src/notify-relay.test.ts +213 -0
- package/src/notify-relay.ts +407 -0
- package/src/notify.ts +95 -14
- package/src/object-store/azure-blob.ts +374 -0
- package/src/object-store/common.ts +133 -0
- package/src/object-store/errors.ts +26 -0
- package/src/object-store/from-env.ts +36 -0
- package/src/object-store/gcs.ts +436 -0
- package/src/object-store/index.ts +8 -0
- package/src/object-store/object-store.test.ts +130 -0
- package/src/object-store/s3.ts +350 -0
- package/src/op/activities/converge.ts +2 -1
- package/src/op/activities/index.ts +1 -1
- package/src/op/activities/review-agent.open.test.ts +78 -0
- package/src/op/activities/review-agent.test.ts +13 -0
- package/src/op/activities/review-agent.ts +89 -5
- package/src/op/approval-status.test.ts +134 -0
- package/src/op/approval-status.ts +235 -0
- package/src/op/gate-review.test.ts +2 -1
- package/src/op/gate.ts +81 -22
- package/src/op/generate-pipeline.ts +7 -1
- package/src/op/index.ts +23 -0
- package/src/op/op-waves-after-plan.test.ts +288 -0
- package/src/op/op-waves-after-plan.ts +238 -0
- package/src/op/op-waves-capability-spec.ts +133 -0
- package/src/op/op-waves-capability.test.ts +217 -0
- package/src/op/op-waves-capability.ts +370 -0
- package/src/op/op-waves-events.ts +135 -0
- package/src/op/op-waves-notify-words.test.ts +149 -0
- package/src/op/op-waves-notify.ts +41 -16
- package/src/op/op-waves-parallelism.test.ts +89 -0
- package/src/op/op-waves-pull-request.test.ts +219 -0
- package/src/op/op-waves-release-port.ts +64 -0
- package/src/op/op-waves-release.test.ts +209 -0
- package/src/op/op-waves-release.ts +132 -0
- package/src/op/op-waves-run-record.test.ts +32 -0
- package/src/op/op-waves-run.ts +1235 -52
- package/src/op/op-waves-stand-down.test.ts +240 -0
- package/src/op/op-waves-stand-down.ts +107 -0
- package/src/op/op-waves-trace.test.ts +205 -0
- package/src/op/op-waves.test.ts +112 -0
- package/src/op/op-waves.ts +320 -22
- package/src/op/runtime.ts +107 -0
- package/src/op/stage-hooks-hold-record.test.ts +41 -0
- package/src/op/stage-hooks.ts +91 -12
- package/src/op/steward-beside.ts +2 -1
- package/src/op/types.ts +3 -2
- package/src/otlp-metrics.ts +96 -0
- package/src/otlp.test.ts +243 -0
- package/src/otlp.ts +543 -0
- package/src/override-gate-bundle.test.ts +2 -0
- package/src/override-gate.ts +4 -0
- package/src/parallelism.test.ts +38 -0
- package/src/parallelism.ts +33 -0
- package/src/policy-packs.ts +230 -0
- package/src/policy-source.test.ts +256 -0
- package/src/policy-source.ts +111 -0
- package/src/pr-forge-bundle.test.ts +1 -1
- package/src/pr-forge.ts +175 -33
- package/src/pr-loop-bundle.test.ts +7 -3
- package/src/pr-loop-narrowed.test.ts +63 -0
- package/src/pr-loop-words.test.ts +155 -0
- package/src/pr-loop.ts +398 -52
- package/src/pr-merge.test.ts +100 -0
- package/src/pr-merge.ts +105 -0
- package/src/pr-post-stale.test.ts +163 -0
- package/src/pr-post.ts +190 -5
- package/src/pr-report-url.ts +61 -6
- package/src/pr-requires.test.ts +37 -1
- package/src/pr-requires.ts +16 -2
- package/src/product-subpaths-plain-node.e2e.test.ts +212 -0
- package/src/release-floors.ts +1 -1
- package/src/run-event.ts +28 -1
- package/src/scheduled-op-cloud.ts +68 -0
- package/src/sorted-json.ts +17 -0
- package/src/stage-hooks-bundle.test.ts +6 -0
- package/src/terraform/credentials.test.ts +77 -0
- package/src/terraform/credentials.ts +162 -0
- package/src/utils.ts +2 -11
- package/src/wave-loop-golden.test.ts +2 -1
- package/src/wave-runtime.ts +2 -2
- package/src/workspace/chant-migrations/chud-lexicon-exit.ts +4 -1
- package/src/workspace/ci-lock-grain.test.ts +31 -0
- package/src/workspace/ci-lock-grain.ts +29 -0
- package/src/workspace/ci-report-url.test.ts +1 -1
- package/src/workspace/ci-run.test.ts +1 -1
- package/src/workspace/ci-run.ts +10 -3
- package/src/workspace/declaration.schema.json +27 -3
- package/src/workspace/declaration.test.ts +1 -1
- package/src/workspace/declaration.ts +26 -10
- package/src/workspace/drift-cli.ts +8 -3
- package/src/workspace/exit-cli.ts +2 -1
- package/src/workspace/import-fetch.ts +4 -2
- package/src/workspace/import-init.ts +4 -2
- package/src/workspace/ledger.schema.json +7 -3
- package/src/workspace/lineage-upgrade-cli.ts +2 -1
- package/src/workspace/pr-report.schema.json +79 -3
- package/src/workspace/promote.ts +2 -1
- package/src/workspace/records-cli.ts +3 -2
- package/src/workspace/release-catalog.schema.json +277 -0
- package/src/workspace/run-event.schema.json +18 -1
- package/src/workspace/work-cli.ts +8 -2
- package/src/workspace/workspace-run.ts +2 -1
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Policy packs read at base (#4613): the CrossGuard packs a Pulumi preview
|
|
3
|
+
* runs, copied out of the commit the change is measured from, as the Rego of
|
|
4
|
+
* `ci.policy` is (`./components/pr-policy.ts`). A pull request cannot loosen
|
|
5
|
+
* or delete a pack that judges it, nor its `--policy-pack-config` file.
|
|
6
|
+
*
|
|
7
|
+
* Two lists meet here:
|
|
8
|
+
*
|
|
9
|
+
* - `ci.policy.packs` in the declaration at base: each `dir` relative to the
|
|
10
|
+
* declaration's directory, or to the top of `ci.policy.source` when one is
|
|
11
|
+
* set. A listed pack that is not there is an error, and the preview does
|
|
12
|
+
* not run: a pack the base requires is never skipped.
|
|
13
|
+
* - The step's own packs (`pulumi-up`'s `policyPacks`), from the step input
|
|
14
|
+
* the head's component file gives. Each one inside the repository is
|
|
15
|
+
* copied from base. One the base does not have was added by the change and
|
|
16
|
+
* runs once it merges; one that differs on the head runs as the base has
|
|
17
|
+
* it. Each case is a note. A pack outside the repository (an install the
|
|
18
|
+
* job's image holds) is no part of the change and runs where it is.
|
|
19
|
+
*
|
|
20
|
+
* A copy holds the files git tracks. A pack's installed dependencies are
|
|
21
|
+
* not policy, so when the checkout's pack directory has `node_modules`,
|
|
22
|
+
* `venv` or `.venv`, the copy links to it.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import { execFileSync, spawnSync } from "node:child_process";
|
|
26
|
+
import { existsSync, mkdirSync, mkdtempSync, realpathSync, rmSync, symlinkSync, writeFileSync } from "node:fs";
|
|
27
|
+
import { tmpdir } from "node:os";
|
|
28
|
+
import { isAbsolute, join, relative, resolve } from "node:path";
|
|
29
|
+
import type { GatePolicyPack } from "./gate-policy";
|
|
30
|
+
import type { ResolvedGatePolicySource } from "./policy-source";
|
|
31
|
+
import { gitTop, gitTree, resolveCommit, type WorkspaceTree } from "./workspace/tree";
|
|
32
|
+
|
|
33
|
+
/** One pack as the preview runs it: copied from base, or outside the repository as it stands. */
|
|
34
|
+
export interface PolicyPackAtBase {
|
|
35
|
+
/** The directory the engine reads. */
|
|
36
|
+
dir: string;
|
|
37
|
+
/** The `--policy-pack-config` file the engine reads. */
|
|
38
|
+
config?: string;
|
|
39
|
+
/** Where the pack came from, for notes and the plan: `ci.policy.packs` or the step. */
|
|
40
|
+
from: "declaration" | "step";
|
|
41
|
+
/** The pack as named: its path in the repository or the source, or the absolute path outside it. */
|
|
42
|
+
name: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** The packs a preview runs, the lines saying what changed hands, and how to remove the copies. */
|
|
46
|
+
export interface PolicyPacksAtBase {
|
|
47
|
+
/** The commit the packs were read at. */
|
|
48
|
+
base: string;
|
|
49
|
+
packs: PolicyPackAtBase[];
|
|
50
|
+
/** One line per step pack that was left out or read from base in place of the head's copy. */
|
|
51
|
+
notes: string[];
|
|
52
|
+
/** The shared source `ci.policy.packs` was read from, with its commit. */
|
|
53
|
+
source?: ResolvedGatePolicySource;
|
|
54
|
+
/** The scratch directory holding the copies. */
|
|
55
|
+
scratch: string;
|
|
56
|
+
cleanup: () => void;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface PolicyPacksAtBaseOptions {
|
|
60
|
+
/** Where the step runs: the stack's directory. The workspace and its repository are found from here. */
|
|
61
|
+
cwd: string;
|
|
62
|
+
/** The commit the caller reads policy at, `DeployContext.policyBase`. */
|
|
63
|
+
base: string;
|
|
64
|
+
/** The step's packs, each `dir` and `config` absolute or relative to `cwd`. */
|
|
65
|
+
stepPacks?: readonly GatePolicyPack[];
|
|
66
|
+
/** Where the scratch directory goes, such as the step's own scratch, which then removes the copies with it. Default the OS temp dir. */
|
|
67
|
+
tmp?: string;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const posix = (p: string): string => p.split("\\").join("/");
|
|
71
|
+
const LINKED = ["node_modules", "venv", ".venv"];
|
|
72
|
+
|
|
73
|
+
/** Whether the working tree's `rel` (under `top`) differs from `commit`'s, tracked or untracked. */
|
|
74
|
+
function differsOnHead(top: string, commit: string, rel: string): boolean {
|
|
75
|
+
const diff = spawnSync("git", ["-C", top, "diff", "--quiet", commit, "--", rel], { stdio: "ignore" });
|
|
76
|
+
if (diff.status !== 0) return true;
|
|
77
|
+
try {
|
|
78
|
+
return execFileSync("git", ["-C", top, "ls-files", "--others", "--exclude-standard", "--", rel], { encoding: "utf-8", stdio: ["ignore", "pipe", "ignore"] }).trim() !== "";
|
|
79
|
+
} catch {
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** Link the installs a checkout's pack directory holds into its copy. */
|
|
85
|
+
function linkInstalls(copy: string, checkoutDir: string | undefined): void {
|
|
86
|
+
if (!checkoutDir) return;
|
|
87
|
+
for (const name of LINKED) {
|
|
88
|
+
const there = join(checkoutDir, name);
|
|
89
|
+
if (existsSync(there) && !existsSync(join(copy, name))) {
|
|
90
|
+
try {
|
|
91
|
+
symlinkSync(there, join(copy, name), "dir");
|
|
92
|
+
} catch {
|
|
93
|
+
// A pack that cannot see its installs fails in the engine, which names it.
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
let copied = 0;
|
|
100
|
+
|
|
101
|
+
/** Copy directory `from` of `tree` to `to` on disk. */
|
|
102
|
+
function copyTree(tree: WorkspaceTree, from: string, to: string): void {
|
|
103
|
+
mkdirSync(to, { recursive: true });
|
|
104
|
+
for (const entry of tree.list(from) ?? []) {
|
|
105
|
+
const src = from === "" ? entry.name : `${from}/${entry.name}`;
|
|
106
|
+
const dest = join(to, entry.name);
|
|
107
|
+
if (entry.type === "dir") copyTree(tree, src, dest);
|
|
108
|
+
else writeFileSync(dest, tree.bytes ? tree.bytes(src) : tree.read(src));
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/** Copy one file out of `tree` into `dir`, keeping its name. */
|
|
113
|
+
function copyFile(tree: WorkspaceTree, path: string, dir: string): string {
|
|
114
|
+
const out = join(dir, `${copied++}-${path.split("/").pop()!}`);
|
|
115
|
+
writeFileSync(out, tree.bytes ? tree.bytes(path) : tree.read(path));
|
|
116
|
+
return out;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* The packs a preview at `cwd` runs, read at `base`: `ci.policy.packs` from
|
|
121
|
+
* the declaration (or its source) and the step's own, each copied from
|
|
122
|
+
* there. Returns why none can be read when the base or the source cannot
|
|
123
|
+
* be, or a pack `ci.policy.packs` lists is missing.
|
|
124
|
+
*/
|
|
125
|
+
export async function policyPacksAtBase(options: PolicyPacksAtBaseOptions): Promise<PolicyPacksAtBase | { error: string }> {
|
|
126
|
+
const cwd = resolve(options.cwd);
|
|
127
|
+
const top = gitTop(cwd);
|
|
128
|
+
if (!top) return { error: `policy packs are read at base ${options.base.slice(0, 12)}, and ${cwd} is not in a git repository` };
|
|
129
|
+
const commit = resolveCommit(top, options.base);
|
|
130
|
+
if (!commit) return { error: `policy packs are read at base, and ${options.base} names no commit in ${top}` };
|
|
131
|
+
const scratch = mkdtempSync(join(options.tmp ?? tmpdir(), "chant-policy-packs-"));
|
|
132
|
+
const cleanup = (): void => rmSync(scratch, { recursive: true, force: true });
|
|
133
|
+
const fail = (error: string): { error: string } => {
|
|
134
|
+
cleanup();
|
|
135
|
+
return { error };
|
|
136
|
+
};
|
|
137
|
+
const packs: PolicyPackAtBase[] = [];
|
|
138
|
+
const notes: string[] = [];
|
|
139
|
+
const realCwd = realpathSync(cwd);
|
|
140
|
+
const whole = gitTree(top, commit);
|
|
141
|
+
const export1 = (tree: WorkspaceTree, path: string): string | { error: string } => {
|
|
142
|
+
const into = join(scratch, `pack-${packs.length}-${path.split("/").pop() || "root"}`);
|
|
143
|
+
try {
|
|
144
|
+
copyTree(tree, path, into);
|
|
145
|
+
} catch (err) {
|
|
146
|
+
return { error: `the policy pack ${path} could not be read: ${err instanceof Error ? err.message : String(err)}` };
|
|
147
|
+
}
|
|
148
|
+
return into;
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
// ci.policy.packs, from the declaration at base or its source.
|
|
152
|
+
let source: ResolvedGatePolicySource | undefined;
|
|
153
|
+
const taken = new Set<string>();
|
|
154
|
+
try {
|
|
155
|
+
const { prLoopPolicyAt } = await import("./components/pr-policy");
|
|
156
|
+
const read = prLoopPolicyAt(cwd, commit);
|
|
157
|
+
const declared = read.settings?.packs ?? [];
|
|
158
|
+
if (declared.length > 0) {
|
|
159
|
+
if (read.error !== undefined) return fail(read.error);
|
|
160
|
+
if (!read.tree) return fail(`ci.policy.packs at ${commit.slice(0, 12)} could not be read`);
|
|
161
|
+
source = read.source;
|
|
162
|
+
const { locateWorkspace } = await import("./workspace/which-chant");
|
|
163
|
+
const located = locateWorkspace(cwd, commit);
|
|
164
|
+
const where = source ? `${source.repo}@${source.ref} (${source.commit.slice(0, 12)})` : `the declaration at ${commit.slice(0, 12)}`;
|
|
165
|
+
for (const p of declared) {
|
|
166
|
+
const dir = p.dir.replace(/^\.\/+/, "").replace(/\/+$/, "");
|
|
167
|
+
if (read.tree.stat(dir) !== "dir") return fail(`ci.policy.packs names ${p.dir}, which is not a directory in ${where}`);
|
|
168
|
+
const copy = export1(read.tree, dir);
|
|
169
|
+
if (typeof copy !== "string") return fail(copy.error);
|
|
170
|
+
let config: string | undefined;
|
|
171
|
+
if (p.config) {
|
|
172
|
+
if (read.tree.stat(p.config) !== "file") return fail(`ci.policy.packs names the config ${p.config}, which is not a file in ${where}`);
|
|
173
|
+
config = copyFile(read.tree, p.config, scratch);
|
|
174
|
+
}
|
|
175
|
+
// A pack in the workspace links the checkout's installs; one from the source has none here.
|
|
176
|
+
const checkoutDir = source ? undefined : join(located.rootOnDisk, dir);
|
|
177
|
+
linkInstalls(copy, checkoutDir);
|
|
178
|
+
if (!source) taken.add(posix(join(located.root === "." ? "" : located.root, dir)));
|
|
179
|
+
packs.push({ dir: copy, ...(config ? { config } : {}), from: "declaration", name: dir });
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
} catch (err) {
|
|
183
|
+
return fail(err instanceof Error ? err.message : String(err));
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// The step's own packs, each from base when it is in the repository.
|
|
187
|
+
for (const p of options.stepPacks ?? []) {
|
|
188
|
+
const abs = isAbsolute(p.dir) ? p.dir : resolve(cwd, p.dir);
|
|
189
|
+
let real: string;
|
|
190
|
+
try {
|
|
191
|
+
real = realpathSync(abs);
|
|
192
|
+
} catch {
|
|
193
|
+
real = abs;
|
|
194
|
+
}
|
|
195
|
+
const rel = posix(relative(top, real));
|
|
196
|
+
if (rel === "" || rel.startsWith("..") || isAbsolute(rel)) {
|
|
197
|
+
packs.push({ dir: abs, ...(p.config ? { config: isAbsolute(p.config) ? p.config : resolve(cwd, p.config) } : {}), from: "step", name: abs });
|
|
198
|
+
continue;
|
|
199
|
+
}
|
|
200
|
+
if (taken.has(rel)) continue;
|
|
201
|
+
const shown = posix(relative(realCwd, real)) || ".";
|
|
202
|
+
if (whole.stat(rel) !== "dir") {
|
|
203
|
+
notes.push(`the policy pack ${shown} is not at base ${commit.slice(0, 12)}, so it runs once this change merges`);
|
|
204
|
+
continue;
|
|
205
|
+
}
|
|
206
|
+
if (differsOnHead(top, commit, rel)) notes.push(`the policy pack ${shown} differs on this change; the copy at base ${commit.slice(0, 12)} runs`);
|
|
207
|
+
const copy = export1(whole, rel);
|
|
208
|
+
if (typeof copy !== "string") return fail(copy.error);
|
|
209
|
+
linkInstalls(copy, real);
|
|
210
|
+
let config: string | undefined;
|
|
211
|
+
if (p.config) {
|
|
212
|
+
const cabs = isAbsolute(p.config) ? p.config : resolve(cwd, p.config);
|
|
213
|
+
let creal: string;
|
|
214
|
+
try {
|
|
215
|
+
creal = realpathSync(cabs);
|
|
216
|
+
} catch {
|
|
217
|
+
creal = cabs;
|
|
218
|
+
}
|
|
219
|
+
const crel = posix(relative(top, creal));
|
|
220
|
+
if (crel.startsWith("..") || isAbsolute(crel)) config = cabs;
|
|
221
|
+
else if (whole.stat(crel) !== "file") notes.push(`the policy pack config ${posix(relative(realCwd, creal))} is not at base ${commit.slice(0, 12)}, so ${shown} runs with its own defaults`);
|
|
222
|
+
else {
|
|
223
|
+
if (differsOnHead(top, commit, crel)) notes.push(`the policy pack config ${posix(relative(realCwd, creal))} differs on this change; the copy at base ${commit.slice(0, 12)} runs`);
|
|
224
|
+
config = copyFile(whole, crel, scratch);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
packs.push({ dir: copy, ...(config ? { config } : {}), from: "step", name: rel });
|
|
228
|
+
}
|
|
229
|
+
return { base: commit, packs, notes, ...(source ? { source } : {}), scratch, cleanup };
|
|
230
|
+
}
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `ci.policy.source` and policy packs read at base (#4613). The shared
|
|
3
|
+
* policy repository is a local bare repository reached through file://, so
|
|
4
|
+
* nothing reaches a network. The engine is a fake that reads the policy
|
|
5
|
+
* directory it is handed and prints opa's result shape, so a test sees which
|
|
6
|
+
* copy of a rule judged the change.
|
|
7
|
+
*/
|
|
8
|
+
import { afterAll, describe, expect, test } from "vitest";
|
|
9
|
+
import { execFileSync } from "node:child_process";
|
|
10
|
+
import { existsSync, mkdirSync, mkdtempSync, readFileSync, realpathSync, rmSync, writeFileSync } from "node:fs";
|
|
11
|
+
import { join } from "node:path";
|
|
12
|
+
import { tmpdir } from "node:os";
|
|
13
|
+
import { composeChangeSet } from "./change-set";
|
|
14
|
+
import { assertGatePolicySettings, type GatePolicyExec } from "./gate-policy";
|
|
15
|
+
import { assertGatePolicySource, fetchGatePolicySource, shownPolicyRepo } from "./policy-source";
|
|
16
|
+
import { policyPacksAtBase } from "./policy-packs";
|
|
17
|
+
import { prLoopPolicyAt, prPolicyReport, runPrPolicy, type PrPolicyInput } from "./components/pr-policy";
|
|
18
|
+
|
|
19
|
+
const scratch: string[] = [];
|
|
20
|
+
afterAll(() => {
|
|
21
|
+
for (const d of scratch) rmSync(d, { recursive: true, force: true });
|
|
22
|
+
});
|
|
23
|
+
const tmp = (): string => {
|
|
24
|
+
const d = realpathSync(mkdtempSync(join(tmpdir(), "policy-source-")));
|
|
25
|
+
scratch.push(d);
|
|
26
|
+
return d;
|
|
27
|
+
};
|
|
28
|
+
const git = (cwd: string, ...args: string[]): string => execFileSync("git", args, { cwd, encoding: "utf-8" }).trim();
|
|
29
|
+
const ident = (repo: string): void => {
|
|
30
|
+
git(repo, "config", "user.email", "t@example.com");
|
|
31
|
+
git(repo, "config", "user.name", "t");
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/** A bare policy repository with tag v1 (`deny_bucket_delete`), then main moved on to v2 (no rule). */
|
|
35
|
+
function policyRepo(): { bare: string; url: string; v1: string; v2: string } {
|
|
36
|
+
const work = tmp();
|
|
37
|
+
git(work, "init", "-q", "-b", "main");
|
|
38
|
+
ident(work);
|
|
39
|
+
mkdirSync(join(work, "rego"));
|
|
40
|
+
mkdirSync(join(work, "packs", "aws-guard"), { recursive: true });
|
|
41
|
+
writeFileSync(join(work, "rego", "main.rego"), "package main\n# deny_bucket_delete\n");
|
|
42
|
+
writeFileSync(join(work, "packs", "aws-guard", "index.ts"), "// shared no-public-bucket v1\n");
|
|
43
|
+
git(work, "add", ".");
|
|
44
|
+
git(work, "commit", "-q", "-m", "v1");
|
|
45
|
+
git(work, "tag", "v1");
|
|
46
|
+
const v1 = git(work, "rev-parse", "HEAD");
|
|
47
|
+
writeFileSync(join(work, "rego", "main.rego"), "package main\n# nothing\n");
|
|
48
|
+
git(work, "commit", "-q", "-am", "v2");
|
|
49
|
+
const v2 = git(work, "rev-parse", "HEAD");
|
|
50
|
+
const bare = join(tmp(), "policy.git");
|
|
51
|
+
git(work, "clone", "-q", "--bare", work, bare);
|
|
52
|
+
return { bare, url: `file://${bare}`, v1, v2 };
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const declaration = (policy: unknown) => ({
|
|
56
|
+
name: "acme",
|
|
57
|
+
schema: 1,
|
|
58
|
+
members: [{ name: "infra", dir: "infra", kind: "other", because: "test" }],
|
|
59
|
+
ci: { policy },
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
/** A workspace repo whose base declares `policy`, and whose head commit rewrites it to `headPolicy`. */
|
|
63
|
+
function workspace(policy: unknown, files: Record<string, string> = {}, headPolicy?: unknown, headFiles: Record<string, string> = {}): { repo: string; base: string } {
|
|
64
|
+
const repo = tmp();
|
|
65
|
+
git(repo, "init", "-q", "-b", "main");
|
|
66
|
+
ident(repo);
|
|
67
|
+
mkdirSync(join(repo, "infra"), { recursive: true });
|
|
68
|
+
writeFileSync(join(repo, "infra", "Pulumi.yaml"), "name: infra\nruntime: nodejs\n");
|
|
69
|
+
writeFileSync(join(repo, "chant.workspace.json"), JSON.stringify(declaration(policy)));
|
|
70
|
+
for (const [p, text] of Object.entries(files)) {
|
|
71
|
+
mkdirSync(join(repo, p, ".."), { recursive: true });
|
|
72
|
+
writeFileSync(join(repo, p), text);
|
|
73
|
+
}
|
|
74
|
+
git(repo, "add", ".");
|
|
75
|
+
git(repo, "commit", "-q", "-m", "base");
|
|
76
|
+
const base = git(repo, "rev-parse", "HEAD");
|
|
77
|
+
if (headPolicy !== undefined) writeFileSync(join(repo, "chant.workspace.json"), JSON.stringify(declaration(headPolicy)));
|
|
78
|
+
for (const [p, text] of Object.entries(headFiles)) {
|
|
79
|
+
mkdirSync(join(repo, p, ".."), { recursive: true });
|
|
80
|
+
writeFileSync(join(repo, p), text);
|
|
81
|
+
}
|
|
82
|
+
if (headPolicy !== undefined || Object.keys(headFiles).length > 0) {
|
|
83
|
+
git(repo, "add", ".");
|
|
84
|
+
git(repo, "commit", "-q", "-m", "head");
|
|
85
|
+
}
|
|
86
|
+
return { repo, base };
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const input = (base: string): PrPolicyInput => ({ version: 1, stage: "apply", op: "pr-7", gate: "pr-apply", env: "prod", pr: 7, base, head: "h".repeat(40), changeSet: composeChangeSet([]) });
|
|
90
|
+
|
|
91
|
+
/** An opa stand-in: the rules it finds named in the policy directory's main.rego match. */
|
|
92
|
+
const readsRego: GatePolicyExec = (argv) => {
|
|
93
|
+
const dir = argv[argv.indexOf("--data") + 1]!;
|
|
94
|
+
const text = readFileSync(join(dir, "main.rego"), "utf-8");
|
|
95
|
+
const value: Record<string, unknown> = {};
|
|
96
|
+
if (text.includes("deny_bucket_delete")) value.deny_bucket_delete = ["the bucket is deleted"];
|
|
97
|
+
return { status: 0, stdout: JSON.stringify({ result: [{ expressions: [{ value }] }] }), stderr: "" };
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
describe("the settings (#4613)", () => {
|
|
101
|
+
test("a source is { repo, ref, path? } and refuses anything else", () => {
|
|
102
|
+
expect(() => assertGatePolicySource("s", { repo: "https://git.example.com/org/policy.git", ref: "v1" })).not.toThrow();
|
|
103
|
+
expect(() => assertGatePolicySource("s", { repo: "git@git.example.com:org/policy.git", ref: "main", path: "rego" })).not.toThrow();
|
|
104
|
+
expect(() => assertGatePolicySource("s", { repo: "file:///srv/policy.git", ref: "0123456789abcdef0123456789abcdef01234567" })).not.toThrow();
|
|
105
|
+
expect(() => assertGatePolicySource("s", { repo: "--upload-pack=x", ref: "v1" })).toThrow(/git URL/);
|
|
106
|
+
expect(() => assertGatePolicySource("s", { repo: "https://git.example.com/p.git", ref: "-x" })).toThrow(/tag, a branch or a commit/);
|
|
107
|
+
expect(() => assertGatePolicySource("s", { repo: "https://git.example.com/p.git", ref: "a..b" })).toThrow(/tag, a branch or a commit/);
|
|
108
|
+
expect(() => assertGatePolicySource("s", { repo: "https://git.example.com/p.git", ref: "v1", path: "../x" })).toThrow(/inside the source/);
|
|
109
|
+
expect(() => assertGatePolicySource("s", { repo: "https://git.example.com/p.git", ref: "v1", branch: "x" })).toThrow(/not a setting/);
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
test("ci.policy takes source and packs, and refuses path beside source", () => {
|
|
113
|
+
const source = { repo: "https://git.example.com/p.git", ref: "v1" };
|
|
114
|
+
expect(() => assertGatePolicySettings("ci.policy", { engine: "opa", source })).not.toThrow();
|
|
115
|
+
expect(() => assertGatePolicySettings("ci.policy", { packs: [{ dir: "packs/aws-guard", config: "packs/aws-guard.json" }] })).not.toThrow();
|
|
116
|
+
expect(() => assertGatePolicySettings("ci.policy", { path: "policy", source })).toThrow(/cannot both be set/);
|
|
117
|
+
expect(() => assertGatePolicySettings("ci.policy", { packs: [] })).toThrow(/non-empty list/);
|
|
118
|
+
expect(() => assertGatePolicySettings("ci.policy", { packs: [{ dir: "/abs" }] })).toThrow(/inside the workspace/);
|
|
119
|
+
expect(() => assertGatePolicySettings("ci.policy", { packs: [{ config: "x.json" }] })).toThrow(/dir is required/);
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
test("a repository's user and password stay out of what is shown", () => {
|
|
123
|
+
expect(shownPolicyRepo("https://bot:s3cret@git.example.com/org/policy.git")).toBe("https://git.example.com/org/policy.git");
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
describe("fetching the source over a local bare repository", () => {
|
|
128
|
+
test("a tag, a branch and a commit each give the commit they name", () => {
|
|
129
|
+
const p = policyRepo();
|
|
130
|
+
const tag = fetchGatePolicySource({ repo: p.url, ref: "v1", path: "rego" });
|
|
131
|
+
const branch = fetchGatePolicySource({ repo: p.url, ref: "main", path: "rego" });
|
|
132
|
+
const commit = fetchGatePolicySource({ repo: p.url, ref: p.v1, path: "rego" });
|
|
133
|
+
for (const f of [tag, branch, commit]) if ("error" in f) throw new Error(f.error);
|
|
134
|
+
if ("error" in tag || "error" in branch || "error" in commit) return;
|
|
135
|
+
expect(tag.source).toEqual({ repo: p.url, ref: "v1", commit: p.v1, path: "rego" });
|
|
136
|
+
expect(branch.source.commit).toBe(p.v2);
|
|
137
|
+
expect(commit.source.commit).toBe(p.v1);
|
|
138
|
+
expect(tag.tree.read("rego/main.rego")).toContain("deny_bucket_delete");
|
|
139
|
+
for (const f of [tag, branch, commit]) f.cleanup();
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
test("a ref the repository lacks, or a repository that is not there, is an error naming the source", () => {
|
|
143
|
+
const p = policyRepo();
|
|
144
|
+
const missing = fetchGatePolicySource({ repo: p.url, ref: "v9" });
|
|
145
|
+
expect("error" in missing && missing.error).toMatch(/v9 is not a tag, branch or commit there/);
|
|
146
|
+
const gone = fetchGatePolicySource({ repo: `file://${join(tmp(), "nothing.git")}`, ref: "v1" });
|
|
147
|
+
expect("error" in gone && gone.error).toMatch(/^ci\.policy\.source: could not read/);
|
|
148
|
+
});
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
describe("the Rego of a source judges the change (#4613)", () => {
|
|
152
|
+
test("the source's rule at its ref judges, and the report names the commit", () => {
|
|
153
|
+
const p = policyRepo();
|
|
154
|
+
const ws = workspace({ engine: "opa", source: { repo: p.url, ref: "v1", path: "rego" } });
|
|
155
|
+
const read = prLoopPolicyAt(join(ws.repo, "infra"), ws.base);
|
|
156
|
+
expect(read.source).toEqual({ repo: p.url, ref: "v1", commit: p.v1, path: "rego" });
|
|
157
|
+
const verdict = runPrPolicy(read, input(ws.base), readsRego)!;
|
|
158
|
+
expect(verdict.result).toBe("denied");
|
|
159
|
+
expect(verdict.rules).toEqual(["main.deny_bucket_delete"]);
|
|
160
|
+
expect(prPolicyReport(verdict, ws.base).source).toEqual({ repo: p.url, ref: "v1", commit: p.v1, path: "rego" });
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
test("a head that repoints the source at a looser ref is still judged by the base's", () => {
|
|
164
|
+
const p = policyRepo();
|
|
165
|
+
const ws = workspace({ engine: "opa", source: { repo: p.url, ref: "v1", path: "rego" } }, {}, { engine: "opa", source: { repo: p.url, ref: "main", path: "rego" } });
|
|
166
|
+
const read = prLoopPolicyAt(join(ws.repo, "infra"), ws.base);
|
|
167
|
+
expect(read.source?.commit).toBe(p.v1);
|
|
168
|
+
expect(runPrPolicy(read, input(ws.base), readsRego)!.result).toBe("denied");
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
test("a workspace rule changed on the head is judged by the base rule", () => {
|
|
172
|
+
const ws = workspace({ engine: "opa", path: "policy" }, { "policy/main.rego": "package main\n# deny_bucket_delete\n" }, undefined, { "policy/main.rego": "package main\n# loosened\n" });
|
|
173
|
+
const read = prLoopPolicyAt(join(ws.repo, "infra"), ws.base);
|
|
174
|
+
expect(read.source).toBeUndefined();
|
|
175
|
+
const verdict = runPrPolicy(read, input(ws.base), readsRego)!;
|
|
176
|
+
expect(verdict.result).toBe("denied");
|
|
177
|
+
expect(verdict.source).toBeUndefined();
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
test("a source that cannot be fetched is an error verdict, so nothing applies", () => {
|
|
181
|
+
const ws = workspace({ engine: "opa", source: { repo: `file://${join(tmp(), "nothing.git")}`, ref: "v1" } });
|
|
182
|
+
const read = prLoopPolicyAt(join(ws.repo, "infra"), ws.base);
|
|
183
|
+
expect(read.error).toMatch(/could not read/);
|
|
184
|
+
expect(runPrPolicy(read, input(ws.base), readsRego)!.result).toBe("error");
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
test("a source with no Rego directory at the ref is an error", () => {
|
|
188
|
+
const p = policyRepo();
|
|
189
|
+
const ws = workspace({ engine: "opa", source: { repo: p.url, ref: "v1", path: "missing" } });
|
|
190
|
+
const verdict = runPrPolicy(prLoopPolicyAt(join(ws.repo, "infra"), ws.base), input(ws.base), readsRego)!;
|
|
191
|
+
expect(verdict.result).toBe("error");
|
|
192
|
+
expect(verdict.error).toMatch(/missing does not exist in .*@v1/);
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
test("ci.policy with only packs runs no Rego when there is no policy directory", () => {
|
|
196
|
+
const ws = workspace({ packs: [{ dir: "packs/aws-guard" }] }, { "packs/aws-guard/index.ts": "// v1\n" });
|
|
197
|
+
expect(runPrPolicy(prLoopPolicyAt(join(ws.repo, "infra"), ws.base), input(ws.base), readsRego)).toBeUndefined();
|
|
198
|
+
});
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
describe("CrossGuard packs read at base (#4613)", () => {
|
|
202
|
+
test("a step pack changed on the head runs as the base has it, with a note", async () => {
|
|
203
|
+
const ws = workspace({ engine: "opa" }, { "infra/guard/index.ts": "// mandatory no-public-bucket\n", "infra/guard.json": '{"no-public-bucket":"mandatory"}' }, undefined, {
|
|
204
|
+
"infra/guard/index.ts": "// advisory no-public-bucket\n",
|
|
205
|
+
"infra/guard.json": '{"no-public-bucket":"advisory"}',
|
|
206
|
+
});
|
|
207
|
+
const got = await policyPacksAtBase({ cwd: join(ws.repo, "infra"), base: ws.base, stepPacks: [{ dir: "guard", config: "guard.json" }], tmp: tmp() });
|
|
208
|
+
if ("error" in got) throw new Error(got.error);
|
|
209
|
+
expect(got.packs).toHaveLength(1);
|
|
210
|
+
expect(readFileSync(join(got.packs[0]!.dir, "index.ts"), "utf-8")).toContain("mandatory");
|
|
211
|
+
expect(readFileSync(got.packs[0]!.config!, "utf-8")).toContain("mandatory");
|
|
212
|
+
expect(got.notes.join("\n")).toMatch(/guard differs on this change/);
|
|
213
|
+
expect(got.notes.join("\n")).toMatch(/guard\.json differs on this change/);
|
|
214
|
+
got.cleanup();
|
|
215
|
+
expect(existsSync(got.scratch)).toBe(false);
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
test("a step pack the base does not have runs once the change merges", async () => {
|
|
219
|
+
const ws = workspace({ engine: "opa" }, {}, undefined, { "infra/new-guard/index.ts": "// new\n" });
|
|
220
|
+
const got = await policyPacksAtBase({ cwd: join(ws.repo, "infra"), base: ws.base, stepPacks: [{ dir: "new-guard" }], tmp: tmp() });
|
|
221
|
+
if ("error" in got) throw new Error(got.error);
|
|
222
|
+
expect(got.packs).toEqual([]);
|
|
223
|
+
expect(got.notes).toEqual([expect.stringMatching(/new-guard is not at base .*runs once this change merges/)]);
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
test("a pack outside the repository is used where it stands", async () => {
|
|
227
|
+
const outside = tmp();
|
|
228
|
+
const ws = workspace({ engine: "opa" });
|
|
229
|
+
const got = await policyPacksAtBase({ cwd: join(ws.repo, "infra"), base: ws.base, stepPacks: [{ dir: outside }], tmp: tmp() });
|
|
230
|
+
if ("error" in got) throw new Error(got.error);
|
|
231
|
+
expect(got.packs).toEqual([{ dir: outside, from: "step", name: outside }]);
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
test("ci.policy.packs at base runs even when the head drops it from the declaration", async () => {
|
|
235
|
+
const ws = workspace({ packs: [{ dir: "packs/aws-guard" }] }, { "packs/aws-guard/index.ts": "// base pack\n" }, { engine: "opa" }, { "packs/aws-guard/index.ts": "// head pack\n" });
|
|
236
|
+
const got = await policyPacksAtBase({ cwd: join(ws.repo, "infra"), base: ws.base, tmp: tmp() });
|
|
237
|
+
if ("error" in got) throw new Error(got.error);
|
|
238
|
+
expect(got.packs.map((p) => [p.from, p.name])).toEqual([["declaration", "packs/aws-guard"]]);
|
|
239
|
+
expect(readFileSync(join(got.packs[0]!.dir, "index.ts"), "utf-8")).toContain("base pack");
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
test("ci.policy.packs comes from the source when one is set, at the ref the base names", async () => {
|
|
243
|
+
const p = policyRepo();
|
|
244
|
+
const ws = workspace({ source: { repo: p.url, ref: "v1", path: "rego" }, packs: [{ dir: "packs/aws-guard" }] });
|
|
245
|
+
const got = await policyPacksAtBase({ cwd: join(ws.repo, "infra"), base: ws.base, tmp: tmp() });
|
|
246
|
+
if ("error" in got) throw new Error(got.error);
|
|
247
|
+
expect(got.source?.commit).toBe(p.v1);
|
|
248
|
+
expect(readFileSync(join(got.packs[0]!.dir, "index.ts"), "utf-8")).toContain("shared no-public-bucket v1");
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
test("a pack ci.policy.packs lists that is not there is an error, so the preview does not run", async () => {
|
|
252
|
+
const ws = workspace({ packs: [{ dir: "packs/gone" }] });
|
|
253
|
+
const got = await policyPacksAtBase({ cwd: join(ws.repo, "infra"), base: ws.base, tmp: tmp() });
|
|
254
|
+
expect("error" in got && got.error).toMatch(/packs\/gone, which is not a directory/);
|
|
255
|
+
});
|
|
256
|
+
});
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A shared policy source (#4613): `ci.policy.source`, a git repository and
|
|
3
|
+
* ref that several workspaces read one rule set from.
|
|
4
|
+
*
|
|
5
|
+
* The source is named in the declaration, which the jobs read at base, so a
|
|
6
|
+
* pull request cannot point its own policy at another repository or ref.
|
|
7
|
+
* The ref is fetched once per job into a scratch repository under the OS
|
|
8
|
+
* temp dir, never the working tree, and the commit it named is kept, so the
|
|
9
|
+
* report and the wave's decision name the rules a verdict used.
|
|
10
|
+
*
|
|
11
|
+
* A tag or branch is fetched alone, at depth 1. A commit the server does not
|
|
12
|
+
* hand out by itself is found after fetching every branch and tag. The
|
|
13
|
+
* job's own git credentials, if any, reach the repository; a URL's user and
|
|
14
|
+
* password are left out of every message and record.
|
|
15
|
+
*
|
|
16
|
+
* Like `./gate-policy.ts`, this module imports only node built-ins and the
|
|
17
|
+
* git tree reader, so a product can bundle it.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { spawnSync } from "node:child_process";
|
|
21
|
+
import { mkdtempSync, rmSync } from "node:fs";
|
|
22
|
+
import { tmpdir } from "node:os";
|
|
23
|
+
import { join } from "node:path";
|
|
24
|
+
import { gitTree, type WorkspaceTree } from "./workspace/tree";
|
|
25
|
+
import type { GatePolicySource, ResolvedGatePolicySource } from "./gate-policy";
|
|
26
|
+
|
|
27
|
+
// The source's shape and its check live in `./gate-policy.ts`, so the gate
|
|
28
|
+
// policy bundles alone (#4294) without this module's git fetch.
|
|
29
|
+
export { assertGatePolicySource, type GatePolicySource, type ResolvedGatePolicySource } from "./gate-policy";
|
|
30
|
+
|
|
31
|
+
/** The first chant that reads `ci.policy.source` and `ci.policy.packs`; a declaration that sets either needs this `minReader`. */
|
|
32
|
+
export const CI_POLICY_SOURCE_FLOOR = "0.124.55";
|
|
33
|
+
|
|
34
|
+
/** A fetched source: its record, and its tree at the commit, rooted at the repository's top. */
|
|
35
|
+
export interface FetchedGatePolicySource {
|
|
36
|
+
source: ResolvedGatePolicySource;
|
|
37
|
+
tree: WorkspaceTree;
|
|
38
|
+
/** Removes the scratch repository. The tree reads nothing after it. */
|
|
39
|
+
cleanup: () => void;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** The repository URL with its user and password left out. */
|
|
43
|
+
export function shownPolicyRepo(url: string): string {
|
|
44
|
+
return url.replace(/^([a-z+]+:\/\/)[^/@]*@/, "$1");
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function gitIn(dir: string, args: string[]): { status: number | null; stdout: string; stderr: string } {
|
|
48
|
+
const r = spawnSync("git", ["-C", dir, "-c", "init.defaultBranch=main", "-c", "advice.detachedHead=false", ...args], {
|
|
49
|
+
encoding: "utf-8",
|
|
50
|
+
maxBuffer: 64 * 1024 * 1024,
|
|
51
|
+
env: { ...process.env, GIT_TERMINAL_PROMPT: "0" },
|
|
52
|
+
});
|
|
53
|
+
return { status: r.error ? null : r.status, stdout: r.stdout ?? "", stderr: `${r.stderr ?? ""}${r.error ? r.error.message : ""}` };
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Fetch `source` at its ref into a scratch repository. Returns its tree at
|
|
58
|
+
* the commit the ref named, or why it could not be read. A missing Rego
|
|
59
|
+
* directory is not an error here: the caller decides whether it needs one.
|
|
60
|
+
*/
|
|
61
|
+
export function fetchGatePolicySource(source: GatePolicySource, opts: { tmp?: string } = {}): FetchedGatePolicySource | { error: string } {
|
|
62
|
+
const repo = shownPolicyRepo(source.repo);
|
|
63
|
+
const shown = `${repo}@${source.ref}`;
|
|
64
|
+
const dest = mkdtempSync(join(opts.tmp ?? tmpdir(), "chant-policy-source-"));
|
|
65
|
+
const cleanup = (): void => rmSync(dest, { recursive: true, force: true });
|
|
66
|
+
const fail = (why: string): { error: string } => {
|
|
67
|
+
cleanup();
|
|
68
|
+
return { error: `ci.policy.source: could not read ${shown}: ${why.split(source.repo).join(repo)}` };
|
|
69
|
+
};
|
|
70
|
+
if (gitIn(dest, ["init", "-q", "--bare"]).status !== 0) return fail("git init failed");
|
|
71
|
+
let fetched = gitIn(dest, ["fetch", "-q", "--no-tags", "--depth", "1", "--", source.repo, source.ref]);
|
|
72
|
+
let commit = fetched.status === 0 ? gitIn(dest, ["rev-parse", "--verify", "--quiet", "FETCH_HEAD^{commit}"]).stdout.trim() : "";
|
|
73
|
+
if (!commit) {
|
|
74
|
+
fetched = gitIn(dest, ["fetch", "-q", "--", source.repo, "+refs/heads/*:refs/remotes/source/*", "+refs/tags/*:refs/tags/*"]);
|
|
75
|
+
if (fetched.status !== 0) return fail(fetched.stderr.trim().split("\n").pop() || `git fetch exited ${fetched.status}`);
|
|
76
|
+
commit = gitIn(dest, ["rev-parse", "--verify", "--quiet", `${source.ref}^{commit}`]).stdout.trim();
|
|
77
|
+
if (!commit) commit = gitIn(dest, ["rev-parse", "--verify", "--quiet", `refs/remotes/source/${source.ref}^{commit}`]).stdout.trim();
|
|
78
|
+
if (!commit) return fail(`${source.ref} is not a tag, branch or commit there`);
|
|
79
|
+
}
|
|
80
|
+
let tree: WorkspaceTree;
|
|
81
|
+
try {
|
|
82
|
+
tree = gitTree(dest, commit);
|
|
83
|
+
} catch (err) {
|
|
84
|
+
return fail(`could not list ${commit.slice(0, 12)}: ${err instanceof Error ? err.message : String(err)}`);
|
|
85
|
+
}
|
|
86
|
+
const path = (source.path ?? "policy").replace(/^\.\/+/, "").replace(/\/+$/, "");
|
|
87
|
+
return { source: { repo, ref: source.ref, commit, path }, tree, cleanup };
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const fetchedOnce = new Map<string, FetchedGatePolicySource | { error: string }>();
|
|
91
|
+
let exitHooked = false;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* {@link fetchGatePolicySource}, once per repository and ref in this
|
|
95
|
+
* process: a job that judges many runs, or plans many stacks, fetches the
|
|
96
|
+
* source one time. The scratch repositories go when the process exits.
|
|
97
|
+
*/
|
|
98
|
+
export function fetchGatePolicySourceOnce(source: GatePolicySource): FetchedGatePolicySource | { error: string } {
|
|
99
|
+
const key = `${source.repo}\0${source.ref}\0${source.path ?? ""}`;
|
|
100
|
+
const known = fetchedOnce.get(key);
|
|
101
|
+
if (known) return known;
|
|
102
|
+
const got = fetchGatePolicySource(source);
|
|
103
|
+
fetchedOnce.set(key, got);
|
|
104
|
+
if (!exitHooked) {
|
|
105
|
+
exitHooked = true;
|
|
106
|
+
process.once("exit", () => {
|
|
107
|
+
for (const f of fetchedOnce.values()) if ("cleanup" in f) f.cleanup();
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
return got;
|
|
111
|
+
}
|
|
@@ -34,7 +34,7 @@ describe("the pr-forge bundle", () => {
|
|
|
34
34
|
expect(inputs.filter((i) => pattern.test(i)), String(pattern)).toEqual([]);
|
|
35
35
|
}
|
|
36
36
|
expect(inputs.map((i) => i.replace(/^.*?packages\//, "packages/")).sort()).toEqual(["packages/core/src/pr-forge.ts"]);
|
|
37
|
-
// About
|
|
37
|
+
// About 55.9 KB today, after the pull request authors (#4000), pullRequestOpen for target locks (#4293), the four requires checks of an apply before merge (#4301) the approver filter (#4337) the approved fields (#4287) the plan job's GitLab note (#4328) and GitLab's open merge requests for stale notes (#4628).
|
|
38
38
|
expect(result.outputFiles.reduce((n, f) => n + f.contents.byteLength, 0)).toBeLessThan(56 * 1024);
|
|
39
39
|
});
|
|
40
40
|
});
|