@intentius/chant 0.124.54 → 0.124.55
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 +833 -0
- package/dist/ci-control.d.ts +42 -0
- package/dist/ci-control.d.ts.map +1 -0
- package/dist/ci-control.js +42 -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 +68 -0
- package/dist/ci-estate.d.ts.map +1 -0
- package/dist/ci-estate.js +83 -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 +87 -15
- package/dist/ci-product-words.d.ts +290 -0
- package/dist/ci-product-words.d.ts.map +1 -0
- package/dist/ci-product-words.js +373 -0
- package/dist/ci-product.d.ts +82 -0
- package/dist/ci-product.d.ts.map +1 -0
- package/dist/ci-product.js +78 -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/build.d.ts.map +1 -1
- package/dist/cli/handlers/build.js +43 -1
- 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 +34 -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/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 +38 -3
- package/dist/cli/handlers/pr.d.ts.map +1 -1
- package/dist/cli/handlers/pr.js +653 -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 +71 -1
- 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 +124 -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 +57 -3
- package/dist/cli/registry.d.ts +35 -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 +93 -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 +122 -5
- package/dist/components/capability.d.ts.map +1 -1
- package/dist/components/capability.js +14 -6
- package/dist/components/check-hooks.d.ts +113 -0
- package/dist/components/check-hooks.d.ts.map +1 -0
- package/dist/components/check-hooks.js +192 -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 +61 -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 +20 -3
- package/dist/components/driver.d.ts.map +1 -1
- package/dist/components/driver.js +24 -4
- 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 +19 -2
- 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 +39 -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 +31 -3
- package/dist/components/pr-environment.d.ts.map +1 -1
- package/dist/components/pr-environment.js +25 -7
- package/dist/components/pr-pipeline.d.ts +169 -3
- package/dist/components/pr-pipeline.d.ts.map +1 -1
- package/dist/components/pr-pipeline.js +184 -9
- 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 +63 -0
- package/dist/components/pr-run.d.ts.map +1 -1
- package/dist/components/pr-run.js +82 -3
- 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 +217 -0
- package/dist/components/product-pipeline.d.ts.map +1 -0
- package/dist/components/product-pipeline.js +193 -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 +34 -0
- package/dist/components/wave-plan.d.ts.map +1 -1
- package/dist/components/wave-plan.js +54 -2
- 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/engine-facts.d.ts.map +1 -1
- package/dist/engine-facts.js +1 -2
- package/dist/exit-codes.d.ts +48 -0
- package/dist/exit-codes.d.ts.map +1 -0
- package/dist/exit-codes.js +49 -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 +106 -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 +11 -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 +205 -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 -6
- 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 +10 -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 +86 -0
- package/dist/lifecycle/release-status.d.ts.map +1 -0
- package/dist/lifecycle/release-status.js +136 -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/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/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 +55 -0
- package/dist/op/op-waves-capability-spec.d.ts.map +1 -0
- package/dist/op/op-waves-capability-spec.js +94 -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 +97 -0
- package/dist/op/op-waves-run.d.ts +175 -4
- package/dist/op/op-waves-run.d.ts.map +1 -1
- package/dist/op/op-waves-run.js +981 -41
- 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 +97 -0
- package/dist/op/op-waves.d.ts +152 -8
- package/dist/op/op-waves.d.ts.map +1 -1
- package/dist/op/op-waves.js +161 -17
- package/dist/op/runtime.d.ts +91 -0
- package/dist/op/runtime.d.ts.map +1 -1
- package/dist/op/runtime.js +19 -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 +426 -0
- package/dist/override-gate.d.ts.map +1 -1
- package/dist/override-gate.js +5 -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 +103 -0
- package/dist/pr-forge.d.ts +40 -0
- package/dist/pr-forge.d.ts.map +1 -1
- package/dist/pr-forge.js +92 -0
- package/dist/pr-loop.d.ts +149 -11
- package/dist/pr-loop.d.ts.map +1 -1
- package/dist/pr-loop.js +283 -44
- package/dist/pr-post.d.ts +16 -0
- package/dist/pr-post.d.ts.map +1 -1
- package/dist/pr-post.js +26 -1
- 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 +46 -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 +4 -1
- 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 +390 -285
- 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 +12 -0
- package/dist/workspace/ci-lock-grain.d.ts.map +1 -0
- package/dist/workspace/ci-lock-grain.js +27 -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 +6 -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 +74 -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 +1026 -0
- package/src/ci-control.ts +174 -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 +176 -0
- package/src/ci-handover.ts +67 -16
- package/src/ci-identity-database.test.ts +55 -0
- package/src/ci-identity-pulumi.test.ts +163 -0
- package/src/ci-identity-targets.test.ts +6 -2
- package/src/ci-identity.ts +124 -22
- package/src/ci-product-words.test.ts +101 -0
- package/src/ci-product-words.ts +536 -0
- package/src/ci-product.ts +174 -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/build.test.ts +7 -0
- package/src/cli/handlers/build.ts +44 -1
- package/src/cli/handlers/ci-check.ts +33 -0
- package/src/cli/handlers/ci-forge-check.ts +91 -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-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 +655 -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 +65 -1
- 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.ts +126 -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 +42 -2
- package/src/cli/registry.ts +35 -0
- package/src/cloud-lister/sigv4.ts +80 -23
- package/src/components/adoption.test.ts +140 -0
- package/src/components/adoption.ts +141 -0
- package/src/components/apply-lease.ts +49 -0
- package/src/components/capability.ts +130 -6
- package/src/components/check-hooks.test.ts +66 -0
- package/src/components/check-hooks.ts +252 -0
- package/src/components/ci-services.test.ts +51 -0
- package/src/components/ci-services.ts +83 -0
- package/src/components/cli-support.ts +23 -2
- package/src/components/driver.test.ts +3 -3
- package/src/components/driver.ts +38 -5
- package/src/components/fan-out-run.ts +68 -18
- package/src/components/groups.ts +17 -2
- 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 +43 -0
- package/src/components/pr-env-ports.ts +29 -4
- package/src/components/pr-env-run-bundle.test.ts +8 -0
- 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 +39 -7
- package/src/components/pr-pipeline.test.ts +15 -0
- package/src/components/pr-pipeline.ts +274 -9
- package/src/components/pr-policy.ts +45 -7
- package/src/components/pr-run.test.ts +1 -1
- package/src/components/pr-run.ts +121 -5
- 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 +341 -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 +78 -4
- 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/engine-facts.test.ts +2 -3
- package/src/engine-facts.ts +1 -2
- package/src/exit-codes.test.ts +31 -0
- package/src/exit-codes.ts +55 -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 +13 -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 +95 -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 +70 -0
- package/src/lifecycle/gate-applied.ts +6 -0
- package/src/lifecycle/gate-ledger.ts +36 -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 +280 -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 -7
- 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 +193 -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 +20 -0
- package/src/lifecycle/release-publish.ts +45 -22
- package/src/lifecycle/release-read.ts +2 -0
- package/src/lifecycle/release-status.test.ts +186 -0
- package/src/lifecycle/release-status.ts +176 -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/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/gate.ts +81 -22
- package/src/op/generate-pipeline.ts +7 -1
- package/src/op/index.ts +21 -0
- package/src/op/op-waves-after-plan.test.ts +276 -0
- package/src/op/op-waves-after-plan.ts +238 -0
- package/src/op/op-waves-capability-spec.ts +113 -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-pull-request.test.ts +142 -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 +133 -0
- package/src/op/op-waves-run-record.test.ts +32 -0
- package/src/op/op-waves-run.ts +1142 -49
- package/src/op/op-waves-stand-down.test.ts +240 -0
- package/src/op/op-waves-stand-down.ts +108 -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 +261 -20
- package/src/op/runtime.ts +104 -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 +544 -0
- package/src/override-gate-bundle.test.ts +2 -0
- package/src/override-gate.ts +4 -0
- package/src/policy-packs.ts +230 -0
- package/src/policy-source.test.ts +256 -0
- package/src/policy-source.ts +112 -0
- package/src/pr-forge.ts +123 -0
- package/src/pr-loop-bundle.test.ts +6 -2
- package/src/pr-loop-words.test.ts +155 -0
- package/src/pr-loop.ts +371 -52
- package/src/pr-post.ts +32 -1
- package/src/pr-report-url.ts +62 -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 +211 -0
- package/src/release-floors.ts +1 -1
- package/src/run-event.ts +29 -1
- package/src/sorted-json.ts +17 -0
- package/src/stage-hooks-bundle.test.ts +8 -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 +30 -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 +6 -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 +74 -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,281 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The estate page, overdue drift checks and delivery metrics (#4612), over
|
|
3
|
+
* the fixture ledger in __fixtures__/estate-ledger.ts. A Terraform member
|
|
4
|
+
* (`network`) and a Pulumi member (`web`) go through the same code.
|
|
5
|
+
*/
|
|
6
|
+
import { describe, expect, test } from "vitest";
|
|
7
|
+
import { ESTATE_SCHEDULES, ESTATE_TABLES, NOW } from "./__fixtures__/estate-ledger";
|
|
8
|
+
import { TERRAGUCCI, PLYWOOD } from "./__fixtures__/product-words";
|
|
9
|
+
import { resolveProductWords } from "./ci-product-words";
|
|
10
|
+
import {
|
|
11
|
+
buildDelivery,
|
|
12
|
+
buildEstate,
|
|
13
|
+
buildLedgerEstate,
|
|
14
|
+
deliveryGauges,
|
|
15
|
+
doraMetricNames,
|
|
16
|
+
estateFiles,
|
|
17
|
+
estateRows,
|
|
18
|
+
ledgerOverdue,
|
|
19
|
+
otlpMetricsBody,
|
|
20
|
+
otlpMetricsFromEnv,
|
|
21
|
+
renderEstateHtml,
|
|
22
|
+
writeEstate,
|
|
23
|
+
} from "./ci-estate";
|
|
24
|
+
import type { OtlpFetch } from "./otlp";
|
|
25
|
+
|
|
26
|
+
const rows = estateRows(ESTATE_TABLES);
|
|
27
|
+
const tg = resolveProductWords(TERRAGUCCI);
|
|
28
|
+
const ply = resolveProductWords(PLYWOOD);
|
|
29
|
+
|
|
30
|
+
describe("estateRows", () => {
|
|
31
|
+
test("reads wave jobs, drift checks, gates, applies and pull request environments", () => {
|
|
32
|
+
expect(rows.members).toEqual(["network", "web"]);
|
|
33
|
+
// Every wave job, the deciding one included; the plain notify run is neither.
|
|
34
|
+
expect(rows.waves.map((w) => w.id)).toEqual(["r-a0", "r-a1", "r-a2", "r-b", "r-c", "r-d", "r-e"]);
|
|
35
|
+
expect(rows.waves.find((w) => w.id === "r-a0")).toMatchObject({ job: "decide", applied: [], digest: "dA" });
|
|
36
|
+
expect(rows.waves.find((w) => w.id === "r-a2")).toMatchObject({ job: "share", share: 1, applied: ["dns"], commit: "c1" });
|
|
37
|
+
// A WatchOp's label, or a Drift outcome alone, makes a drift check.
|
|
38
|
+
expect(rows.drift.map((d) => [d.id, d.drifted, d.roots])).toEqual([
|
|
39
|
+
["d-1", true, ["vpc"]],
|
|
40
|
+
["d-2", false, []],
|
|
41
|
+
["d-3", true, []],
|
|
42
|
+
]);
|
|
43
|
+
expect(rows.approved).toEqual([expect.objectContaining({ member: "network", op: "tf-apply", planDigest: "dA", approvedBy: "alice" })]);
|
|
44
|
+
expect(rows.prEnvs.map((p) => `${p.kind}:${p.env}`)).toEqual(["up:pr-9", "down:pr-9", "up:pr-12"]);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
test("driftOps names the drift checks, and deployOps counts plain runs as applies", () => {
|
|
48
|
+
const r = estateRows(ESTATE_TABLES, { driftOps: ["tf-drift"], deployOps: ["notify"] });
|
|
49
|
+
expect(r.drift.map((d) => d.id)).toEqual(["d-1", "d-2"]);
|
|
50
|
+
expect(r.waves.find((w) => w.id === "x-1")).toMatchObject({ spec: "notify", applied: ["notify"], failed: [] });
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
test("a ledger outside a workspace is named by project", () => {
|
|
54
|
+
const solo = { ...ESTATE_TABLES, runs: ESTATE_TABLES.runs.map((r) => ({ ...r, member: null })), gates: [], applies: [], pr_envs: [] };
|
|
55
|
+
expect(estateRows(solo, { project: "infra" }).members).toEqual(["infra"]);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
test("a malformed wave cell reads as no wave", () => {
|
|
59
|
+
const bad = { ...ESTATE_TABLES, runs: [{ ...ESTATE_TABLES.runs[4]!, wave: "{not json" }], gates: [], applies: [], pr_envs: [] };
|
|
60
|
+
expect(estateRows(bad).waves).toEqual([]);
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
describe("buildDelivery", () => {
|
|
65
|
+
const dora = buildDelivery(rows, { words: tg, now: NOW });
|
|
66
|
+
|
|
67
|
+
test("keeps terragucci's dora.json shape under the product's schema name", () => {
|
|
68
|
+
expect(dora.schema).toBe("terragucci.dora/v1");
|
|
69
|
+
expect(buildDelivery(rows, { words: ply, now: NOW }).schema).toBe("plywood.dora/v1");
|
|
70
|
+
expect(Object.keys(dora)).toEqual(["schema", "generated", "weeks", "window", "drift_window_seconds", "audit", "source", "estate", "projects"]);
|
|
71
|
+
expect(dora.window).toEqual({ from: "2026-09-07T00:00:00.000Z", to: "2026-10-27T12:00:00.000Z" });
|
|
72
|
+
expect(dora.audit).toBe(true);
|
|
73
|
+
expect(dora.projects.map((p) => p.project)).toEqual(["network", "web"]);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
test("share jobs of one wave count once, and the rate divides by the span the history covers", () => {
|
|
77
|
+
expect(dora.estate.deployments).toBe(3);
|
|
78
|
+
expect(dora.estate.span_seconds).toBe(609600);
|
|
79
|
+
expect(dora.estate.per_week).toBe(2.98);
|
|
80
|
+
expect(dora.projects[0]).toMatchObject({ deployments: 2, per_week: 1.98 });
|
|
81
|
+
expect(dora.projects[1]).toMatchObject({ deployments: 1, span_seconds: 510000, per_week: 1.19 });
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
test("lead time runs from the first job of the digest, split at the gate", () => {
|
|
85
|
+
const network = dora.projects[0]!.lead_time;
|
|
86
|
+
expect(network).toEqual({ changes: 2, median_seconds: 3300, before_gate_seconds: 450, at_gate_seconds: 1650, after_gate_seconds: 1200 });
|
|
87
|
+
expect(dora.projects[1]!.lead_time).toMatchObject({ changes: 1, median_seconds: 1200, at_gate_seconds: 0 });
|
|
88
|
+
expect(dora.estate.lead_time).toMatchObject({ changes: 3, median_seconds: 1200 });
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
test("a commit time starts a change earlier", () => {
|
|
92
|
+
const early = buildDelivery(rows, { now: NOW, commitTime: (c) => (c === "p1" ? Date.parse("2026-10-21T13:00:00.000Z") : null) });
|
|
93
|
+
expect(early.projects[1]!.lead_time.median_seconds).toBe(4800);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
test("change failure counts failed applies and applies drift followed", () => {
|
|
97
|
+
expect(dora.projects[0]!.change_failure).toEqual({ applies: 3, failed: 1, drifted: 1, rate: 0.666667 });
|
|
98
|
+
// Drift that names no stack matches any of the member's.
|
|
99
|
+
expect(dora.projects[1]!.change_failure).toEqual({ applies: 1, failed: 0, drifted: 1, rate: 1 });
|
|
100
|
+
expect(dora.estate.change_failure).toEqual({ applies: 4, failed: 1, drifted: 2, rate: 0.75 });
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
test("time to restore: a failed apply to the next apply of its roots, drift found to a clean check", () => {
|
|
104
|
+
expect(dora.projects[0]!.restore).toEqual({ restored: 2, open: 0, median_seconds: 50400, apply_restored: 1, drift_restored: 1 });
|
|
105
|
+
expect(dora.projects[1]!.restore).toMatchObject({ restored: 0, open: 1, median_seconds: null });
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
test("a row per week, oldest first", () => {
|
|
109
|
+
expect(dora.estate.trend).toHaveLength(8);
|
|
110
|
+
expect(dora.estate.trend.at(-2)).toEqual({ week: "2026-10-19", deployments: 3, applies: 4, failures: 3, lead_time_seconds: 1200, restore_seconds: 50400 });
|
|
111
|
+
expect(dora.estate.trend.at(-1)).toMatchObject({ week: "2026-10-26", deployments: 0, applies: 0 });
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
test("an empty ledger has no applies and no rates", () => {
|
|
115
|
+
const none = buildDelivery(estateRows({ runs: [], gates: [], applies: [], pr_envs: [] }), { now: NOW });
|
|
116
|
+
expect(none.audit).toBe(false);
|
|
117
|
+
expect(none.estate).toMatchObject({ deployments: 0, change_failure: { rate: null }, lead_time: { median_seconds: null } });
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
test("the gauges carry terragucci's metric names under its words", () => {
|
|
121
|
+
expect(doraMetricNames(tg)).toEqual({ deployments: "terragucci_dora_deployments_per_week", leadTime: "terragucci_dora_lead_time_seconds", failureRate: "terragucci_dora_change_failure_ratio", restore: "terragucci_dora_restore_seconds" });
|
|
122
|
+
const gauges = deliveryGauges(dora, tg);
|
|
123
|
+
expect(gauges.filter((g) => g.attributes.project === "*").map((g) => [g.name, g.attributes.segment ?? "", g.value])).toEqual([
|
|
124
|
+
["terragucci_dora_deployments_per_week", "", 2.98],
|
|
125
|
+
["terragucci_dora_lead_time_seconds", "total", 1200],
|
|
126
|
+
["terragucci_dora_lead_time_seconds", "before_gate", 600],
|
|
127
|
+
["terragucci_dora_lead_time_seconds", "at_gate", 0],
|
|
128
|
+
["terragucci_dora_lead_time_seconds", "after_gate", 0],
|
|
129
|
+
["terragucci_dora_change_failure_ratio", "", 0.75],
|
|
130
|
+
["terragucci_dora_restore_seconds", "", 50400],
|
|
131
|
+
]);
|
|
132
|
+
expect(doraMetricNames({ product: "sql-yodeler" }).deployments).toBe("sql_yodeler_dora_deployments_per_week");
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
describe("ledgerOverdue", () => {
|
|
137
|
+
const schedules = ESTATE_SCHEDULES.map((s) => ({ ...s, ...("members" in s ? { members: [...s.members] } : {}) }));
|
|
138
|
+
|
|
139
|
+
test("a member whose newest check is two fires old is overdue, in the product's words", () => {
|
|
140
|
+
const found = ledgerOverdue(rows, schedules, { words: tg, now: NOW });
|
|
141
|
+
expect(found).toEqual([
|
|
142
|
+
{
|
|
143
|
+
op: "tf-drift",
|
|
144
|
+
cron: "0 6 * * *",
|
|
145
|
+
since: "2026-10-24T06:05:00.000Z",
|
|
146
|
+
member: "network",
|
|
147
|
+
last: { id: "d-2", ended: "2026-10-24T06:05:00.000Z", status: "ok", runUrl: "https://forge.example/run/d-2" },
|
|
148
|
+
message: "terragucci drift checks of root `network` are overdue: the schedule `0 6 * * *` of `tf-drift` has fired at least twice and its last check on the ledger ended on 2026-10-24.",
|
|
149
|
+
},
|
|
150
|
+
]);
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
test("a member with no check is judged from when its schedule began, and skipped without it", () => {
|
|
154
|
+
const found = ledgerOverdue(rows, schedules, { words: ply, now: NOW, added: (op, m) => (op === "tf-drift" && m === "db" ? "2026-10-01T00:00:00.000Z" : undefined) });
|
|
155
|
+
expect(found.map((o) => [o.member, o.neverRan ?? false])).toEqual([["db", true], ["network", false]]);
|
|
156
|
+
expect(found[0]!.message).toBe("plywood drift checks of stack `db` are overdue: the schedule `0 6 * * *` of `tf-drift` has fired at least twice and no check is on the ledger since its schedule began on 2026-10-01.");
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
test("a check within its window is on time", () => {
|
|
160
|
+
expect(ledgerOverdue(rows, [{ op: "pulumi-drift", cron: "0 7 * * *" }], { now: NOW })).toEqual([]);
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
describe("buildEstate", () => {
|
|
165
|
+
const overdue = ledgerOverdue(rows, [{ op: "tf-drift", cron: "0 6 * * *" }], { words: tg, now: NOW });
|
|
166
|
+
const dora = buildDelivery(rows, { words: tg, now: NOW });
|
|
167
|
+
const estate = buildEstate(rows, dora, { words: tg, now: NOW, overdue, malformed: { runs: 2, gates: 0 } });
|
|
168
|
+
|
|
169
|
+
test("totals over the members, in terragucci's field names", () => {
|
|
170
|
+
expect(estate.schema).toBe("terragucci.estate/v1");
|
|
171
|
+
expect(estate.totals).toEqual({ projects: 2, waiting: 1, drifted_projects: 1, drifted_roots: 1, failed_roots: 0, unreadable: 2, overdue: 1, ephemeral: 1 });
|
|
172
|
+
expect(estate.dora).toEqual({ file: "dora.json", generated: "2026-10-27T12:00:00.000Z", deployments: 3 });
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
test("a Terraform member: the newest commit's waves, its drift check and its overdue schedule", () => {
|
|
176
|
+
const network = estate.projects[0]!;
|
|
177
|
+
expect(network).toMatchObject({ project: "network", status: "ok", drifted: 0, failed: 0, waiting: [] });
|
|
178
|
+
expect(network.apply).toEqual({ commit: "c3", waves: [expect.objectContaining({ stage: "tf-apply", wave: 1, roots: 1, changed: 1, applied: "2026-10-22T12:10:00.000Z", run: "r-c" })] });
|
|
179
|
+
expect(network.drift).toMatchObject({ stage: "tf-drift", changed: 0, run: "d-2" });
|
|
180
|
+
expect(network.overdue?.map((o) => o.op)).toEqual(["tf-drift"]);
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
test("a Pulumi member: a waiting wave, drift on no named stack, a live pull request environment", () => {
|
|
184
|
+
const web = estate.projects[1]!;
|
|
185
|
+
expect(web.waiting).toEqual([{ project: "web", wave: 1, commit: "p2", since: "2026-10-27T09:02:00.000Z", age_seconds: 10680, gate: "wave-1" }]);
|
|
186
|
+
expect(web.apply?.waves[0]).toMatchObject({ approval: "waiting", waiting_since: "2026-10-27T09:02:00.000Z", status: "gated" });
|
|
187
|
+
expect(web.drifted).toBe(1);
|
|
188
|
+
expect(web.ephemeral).toEqual([{ pr: 12, env: "pr-12", commit: "p12", applied: "2026-10-26T10:00:00.000Z", expires: "2026-10-29T10:00:00.000Z", run_url: "https://forge.example/run/pr12" }]);
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
test("an approved share is marked, and the newest runs come newest first", () => {
|
|
192
|
+
const share = estate.recent.find((r) => r.run === "r-a2");
|
|
193
|
+
expect(share).toMatchObject({ approval: "approved", share: 1 });
|
|
194
|
+
expect(estate.recent.slice(0, 3).map((r) => r.run)).toEqual(["r-e", "d-3", "d-2"]);
|
|
195
|
+
// The deciding job is not a run on the page.
|
|
196
|
+
expect(estate.recent.some((r) => r.run === "r-a0")).toBe(false);
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
test("a member the caller names with no row reads as no-index", () => {
|
|
200
|
+
const e = buildEstate(rows, undefined, { now: NOW, members: ["network", "db"] });
|
|
201
|
+
expect(e.projects[1]).toEqual({ project: "db", status: "no-index", waiting: [], drifted: 0, failed: 0 });
|
|
202
|
+
expect(e.dora).toBeUndefined();
|
|
203
|
+
});
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
describe("the page and its files", () => {
|
|
207
|
+
const built = buildLedgerEstate({ load: { data: { ...emptyData(), ...ESTATE_TABLES }, malformed: { ...emptyMalformed() } }, words: ply, now: NOW, schedules: [{ op: "tf-drift", cron: "0 6 * * *" }] });
|
|
208
|
+
|
|
209
|
+
test("one section per member, the delivery section, and the product's own sections", () => {
|
|
210
|
+
const html = renderEstateHtml(built.estate, built.dora, ply, { member: (p) => `<p class="mine">${p.project} extra</p>`, sections: [{ title: "Versions", html: "<p>v</p>" }] });
|
|
211
|
+
expect(html).toContain('<section class="member" id="member-network">');
|
|
212
|
+
expect(html).toContain('<section class="member" id="member-web">');
|
|
213
|
+
expect(html).toContain("<title>plywood estate</title>");
|
|
214
|
+
expect(html).toContain("2 stacks, 1 waiting");
|
|
215
|
+
expect(html).toContain("wave 1 waits at wave-1, for 2h 58m");
|
|
216
|
+
expect(html).toContain("plywood drift checks of stack `network` are overdue");
|
|
217
|
+
expect(html).toContain('<table id="dora">');
|
|
218
|
+
expect(html).toContain('<p class="mine">web extra</p>');
|
|
219
|
+
expect(html).toContain("<h2>Versions</h2>");
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
test("the files are estate.json, estate.html and dora.json", () => {
|
|
223
|
+
const files = estateFiles(built, ply);
|
|
224
|
+
expect(Object.keys(files)).toEqual(["estate.json", "estate.html", "dora.json"]);
|
|
225
|
+
expect(JSON.parse(files["dora.json"]!).schema).toBe("plywood.dora/v1");
|
|
226
|
+
expect(JSON.parse(files["estate.json"]!).projects.map((p: { project: string }) => p.project)).toEqual(["network", "web"]);
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
test("writeEstate puts each file under the prefix and sends the gauges to the metrics endpoint", async () => {
|
|
230
|
+
const put: Array<[string, string]> = [];
|
|
231
|
+
const sent: Array<{ url: string; body: string }> = [];
|
|
232
|
+
const fetch: OtlpFetch = async (url, init) => {
|
|
233
|
+
sent.push({ url, body: init.body });
|
|
234
|
+
return { ok: true, status: 200, text: async () => "" };
|
|
235
|
+
};
|
|
236
|
+
const result = await writeEstate(built, {
|
|
237
|
+
put: async (key, _body, type) => {
|
|
238
|
+
put.push([key, type]);
|
|
239
|
+
},
|
|
240
|
+
prefix: "/reports/estate/",
|
|
241
|
+
words: ply,
|
|
242
|
+
env: { OTEL_EXPORTER_OTLP_ENDPOINT: "http://127.0.0.1:4318" },
|
|
243
|
+
fetch,
|
|
244
|
+
});
|
|
245
|
+
expect(put).toEqual([
|
|
246
|
+
["reports/estate/estate.json", "application/json"],
|
|
247
|
+
["reports/estate/estate.html", "text/html; charset=utf-8"],
|
|
248
|
+
["reports/estate/dora.json", "application/json"],
|
|
249
|
+
]);
|
|
250
|
+
expect(result.keys).toHaveLength(3);
|
|
251
|
+
expect(result.metrics).toEqual({ sent: deliveryGauges(built.dora, ply).length });
|
|
252
|
+
expect(sent[0]!.url).toBe("http://127.0.0.1:4318/v1/metrics");
|
|
253
|
+
const body = JSON.parse(sent[0]!.body);
|
|
254
|
+
expect(body.resourceMetrics[0].resource.attributes).toContainEqual({ key: "service.name", value: { stringValue: "plywood" } });
|
|
255
|
+
expect(body.resourceMetrics[0].scopeMetrics[0].metrics.map((m: { name: string }) => m.name)).toContain("plywood_dora_deployments_per_week");
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
test("with no endpoint no gauge is sent, and a collector that fails is the problem", async () => {
|
|
259
|
+
const quiet = await writeEstate(built, { put: async () => {}, env: {} });
|
|
260
|
+
expect(quiet.metrics).toBeUndefined();
|
|
261
|
+
const failing: OtlpFetch = async () => ({ ok: false, status: 503, text: async () => "busy" });
|
|
262
|
+
const loud = await writeEstate(built, { put: async () => {}, env: { OTEL_EXPORTER_OTLP_METRICS_ENDPOINT: "http://127.0.0.1:4318/m" }, fetch: failing });
|
|
263
|
+
expect(loud.metrics).toEqual({ problem: "http://127.0.0.1:4318/m answered 503: busy" });
|
|
264
|
+
});
|
|
265
|
+
|
|
266
|
+
test("the metrics settings follow the OTLP variables", () => {
|
|
267
|
+
expect(otlpMetricsFromEnv({ OTEL_EXPORTER_OTLP_ENDPOINT: "http://c:4318", OTEL_METRICS_EXPORTER: "none" })).toBeUndefined();
|
|
268
|
+
expect(otlpMetricsFromEnv({ OTEL_EXPORTER_OTLP_ENDPOINT: "http://c:4318", OTEL_SDK_DISABLED: "true" })).toBeUndefined();
|
|
269
|
+
expect(otlpMetricsFromEnv({ OTEL_EXPORTER_OTLP_ENDPOINT: "http://c:4318", OTEL_EXPORTER_OTLP_PROTOCOL: "grpc" })?.skipped[0]).toMatch(/grpc/);
|
|
270
|
+
const body = otlpMetricsBody([{ name: "a", unit: "s", description: "d", value: 1.5, attributes: { project: "*" } }], { "service.name": "x" }, 7n, "0.0.0") as { resourceMetrics: { scopeMetrics: { metrics: unknown[] }[] }[] };
|
|
271
|
+
expect(body.resourceMetrics[0]!.scopeMetrics[0]!.metrics).toEqual([{ name: "a", unit: "s", description: "d", gauge: { dataPoints: [{ attributes: [{ key: "project", value: { stringValue: "*" } }], timeUnixNano: "7", asDouble: 1.5 } ] } }]);
|
|
272
|
+
});
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
function emptyData() {
|
|
276
|
+
return { resources: [], snapshots: [], runs: [], gates: [], deploys: [], releases: [], cuts: [], applies: [], pr_envs: [], control_entries: [], release_status: [] };
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
function emptyMalformed() {
|
|
280
|
+
return { resources: 0, snapshots: 0, runs: 0, gates: 0, deploys: 0, releases: 0, cuts: 0, applies: 0, pr_envs: 0, control_entries: 0, release_status: 0 };
|
|
281
|
+
}
|
package/src/ci-estate.ts
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@intentius/chant/ci-estate` (#4612): the estate page, overdue drift
|
|
3
|
+
* checks and delivery metrics, shared by the CI products built on chant
|
|
4
|
+
* (terragucci, plywood, sql-yodeler).
|
|
5
|
+
*
|
|
6
|
+
* Everything is read from the workspace ledger through the read contract's
|
|
7
|
+
* tables (`runs`, `gates`, `applies`, `pr_envs`; ./lifecycle/query.ts), so
|
|
8
|
+
* a Terraform member and a Pulumi member come out of the same code:
|
|
9
|
+
*
|
|
10
|
+
* - {@link ledgerOverdue}: each member whose scheduled drift check missed
|
|
11
|
+
* its window, by chant's two-fires rule, in the product's words.
|
|
12
|
+
* - {@link buildDelivery}: the four DORA metrics, written as `dora.json` in
|
|
13
|
+
* terragucci's shape, and {@link deliveryGauges} for OTLP
|
|
14
|
+
* ({@link sendOtlpGauges}, ./otlp-metrics.ts).
|
|
15
|
+
* - {@link buildEstate} and {@link renderEstateHtml}: `estate.json` and
|
|
16
|
+
* `estate.html`, a section per member, with room for a product's own
|
|
17
|
+
* sections.
|
|
18
|
+
* - {@link writeEstate}: all three files to the report store (`ci.reportUrl`,
|
|
19
|
+
* ./pr-report-url.ts, #4554), and the gauges when an endpoint is set.
|
|
20
|
+
*
|
|
21
|
+
* A product feature-detects this entry until the chant release that carries
|
|
22
|
+
* {@link CI_ESTATE_FLOOR} is its floor: `buildLedgerEstate` present means the
|
|
23
|
+
* rest is too. Before it, the product keeps its own estate code.
|
|
24
|
+
*/
|
|
25
|
+
import { NEXT_RELEASE } from "./release-floors";
|
|
26
|
+
import { CHANT_WORDS, type CiProductWords } from "./ci-product-words";
|
|
27
|
+
import type { QueryLoad } from "./lifecycle/query";
|
|
28
|
+
import type { ReportPut } from "./pr-report-url";
|
|
29
|
+
import { sendOtlpGauges, type OtlpGaugesSent } from "./otlp-metrics";
|
|
30
|
+
import type { OtlpFetch } from "./otlp";
|
|
31
|
+
import { buildDelivery, deliveryGauges, type Dora } from "./ci-estate/delivery";
|
|
32
|
+
import { ledgerOverdue, type DriftSchedule, type LedgerOverdue } from "./ci-estate/overdue";
|
|
33
|
+
import { buildEstate, ESTATE_FILES, renderEstateHtml, type Estate, type EstateSections } from "./ci-estate/page";
|
|
34
|
+
import { estateRows, type EstateRowOptions, type EstateRows, type EstateTables } from "./ci-estate/rows";
|
|
35
|
+
|
|
36
|
+
/** The first chant with `@intentius/chant/ci-estate` (#4612). */
|
|
37
|
+
export const CI_ESTATE_FLOOR = NEXT_RELEASE;
|
|
38
|
+
|
|
39
|
+
export { estateRows, type ApprovedApply, type DriftRun, type EstateRowOptions, type EstateRows, type EstateTables, type GateLine, type PrEnvLine, type WaveJob } from "./ci-estate/rows";
|
|
40
|
+
export {
|
|
41
|
+
appliesOf,
|
|
42
|
+
buildDelivery,
|
|
43
|
+
deliveryGauges,
|
|
44
|
+
doraMetricNames,
|
|
45
|
+
doraSchema,
|
|
46
|
+
driftIncidents,
|
|
47
|
+
duration,
|
|
48
|
+
median,
|
|
49
|
+
spanLabel,
|
|
50
|
+
weekStart,
|
|
51
|
+
DORA_FILE,
|
|
52
|
+
DORA_MIN_SPAN_SECONDS,
|
|
53
|
+
DORA_WEEKS,
|
|
54
|
+
DRIFT_WINDOW_SECONDS,
|
|
55
|
+
type DeliveryGauge,
|
|
56
|
+
type DeliveryOptions,
|
|
57
|
+
type Dora,
|
|
58
|
+
type DoraLeadTime,
|
|
59
|
+
type DoraMetrics,
|
|
60
|
+
type DoraProject,
|
|
61
|
+
type DoraWeek,
|
|
62
|
+
type DriftIncident,
|
|
63
|
+
} from "./ci-estate/delivery";
|
|
64
|
+
export { ledgerOverdue, type DriftSchedule, type LedgerOverdue, type LedgerOverdueOptions } from "./ci-estate/overdue";
|
|
65
|
+
export {
|
|
66
|
+
buildEstate,
|
|
67
|
+
esc,
|
|
68
|
+
estateSchema,
|
|
69
|
+
memberState,
|
|
70
|
+
renderDeliverySection,
|
|
71
|
+
renderEstateHtml,
|
|
72
|
+
ESTATE_FILES,
|
|
73
|
+
RECENT_RUNS,
|
|
74
|
+
type Estate,
|
|
75
|
+
type EstateOptions,
|
|
76
|
+
type EstatePrEnv,
|
|
77
|
+
type EstateProject,
|
|
78
|
+
type EstateRun,
|
|
79
|
+
type EstateSections,
|
|
80
|
+
type EstateWaiting,
|
|
81
|
+
} from "./ci-estate/page";
|
|
82
|
+
export { otlpMetricsBody, otlpMetricsFromEnv, sendOtlpGauges, type OtlpGauge, type OtlpGaugesSent, type OtlpMetricsConfig } from "./otlp-metrics";
|
|
83
|
+
|
|
84
|
+
export interface LedgerEstateInput extends EstateRowOptions {
|
|
85
|
+
/** The tables, as `loadQueryData` returned them (a `QueryLoad`), or the tables alone. */
|
|
86
|
+
load: QueryLoad | EstateTables;
|
|
87
|
+
words?: Pick<CiProductWords, "product" | "stages" | "noun">;
|
|
88
|
+
now?: Date;
|
|
89
|
+
/** The members, in order. Default every member the ledger names. */
|
|
90
|
+
members?: readonly string[];
|
|
91
|
+
/** The scheduled drift checks to judge. Default none. */
|
|
92
|
+
schedules?: readonly DriftSchedule[];
|
|
93
|
+
/** When a member's schedule began, for one with no check on record. */
|
|
94
|
+
added?: (op: string, member: string) => string | undefined;
|
|
95
|
+
/** A commit's time in milliseconds, or null; given, a change's lead time starts no later than its commit. */
|
|
96
|
+
commitTime?: (commit: string) => number | null;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface LedgerEstate {
|
|
100
|
+
rows: EstateRows;
|
|
101
|
+
estate: Estate;
|
|
102
|
+
dora: Dora;
|
|
103
|
+
overdue: LedgerOverdue[];
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const tablesOf = (load: QueryLoad | EstateTables): { tables: EstateTables; malformed?: Record<string, number> } =>
|
|
107
|
+
"data" in load ? { tables: load.data, malformed: load.malformed } : { tables: load };
|
|
108
|
+
|
|
109
|
+
/** The estate, the metrics and the overdue checks from one read of the ledger. */
|
|
110
|
+
export function buildLedgerEstate(input: LedgerEstateInput): LedgerEstate {
|
|
111
|
+
const words = input.words ?? CHANT_WORDS;
|
|
112
|
+
const now = input.now ?? new Date();
|
|
113
|
+
const { tables, malformed } = tablesOf(input.load);
|
|
114
|
+
const rows = estateRows(tables, { ...(input.project ? { project: input.project } : {}), ...(input.driftOps ? { driftOps: input.driftOps } : {}), ...(input.deployOps ? { deployOps: input.deployOps } : {}) });
|
|
115
|
+
const members = input.members ?? rows.members;
|
|
116
|
+
const overdue = ledgerOverdue(rows, input.schedules ?? [], { words, now, ...(input.added ? { added: input.added } : {}) });
|
|
117
|
+
const dora = buildDelivery(rows, { words, now, members, ...(input.commitTime ? { commitTime: input.commitTime } : {}) });
|
|
118
|
+
const estate = buildEstate(rows, dora, { words, now, members, overdue, ...(malformed ? { malformed } : {}) });
|
|
119
|
+
return { rows, estate, dora, overdue };
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/** The three files by name: `estate.json`, `estate.html` and `dora.json`. */
|
|
123
|
+
export function estateFiles(e: Pick<LedgerEstate, "estate" | "dora">, words: Pick<CiProductWords, "product" | "noun"> = CHANT_WORDS, sections: EstateSections = {}): Record<string, string> {
|
|
124
|
+
return {
|
|
125
|
+
[ESTATE_FILES.json]: JSON.stringify(e.estate, null, 2) + "\n",
|
|
126
|
+
[ESTATE_FILES.page]: renderEstateHtml(e.estate, e.dora, words, sections),
|
|
127
|
+
[ESTATE_FILES.dora]: JSON.stringify(e.dora, null, 2) + "\n",
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export interface WriteEstateOptions {
|
|
132
|
+
/** The report store's put (`reportPut(parseReportUrl(ci.reportUrl))`). */
|
|
133
|
+
put: ReportPut;
|
|
134
|
+
/** The key prefix below the report URL. Default `estate`. */
|
|
135
|
+
prefix?: string;
|
|
136
|
+
words?: Pick<CiProductWords, "product" | "noun">;
|
|
137
|
+
sections?: EstateSections;
|
|
138
|
+
/** Files a product adds beside the three, by name. */
|
|
139
|
+
extra?: Record<string, string>;
|
|
140
|
+
/** The environment the OTLP endpoint is read from. Default `process.env`. */
|
|
141
|
+
env?: NodeJS.ProcessEnv;
|
|
142
|
+
fetch?: OtlpFetch;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export interface WriteEstateResult {
|
|
146
|
+
/** The keys written, below the report URL. */
|
|
147
|
+
keys: string[];
|
|
148
|
+
/** The gauges: sent, or why not. Absent when no metrics endpoint is set. */
|
|
149
|
+
metrics?: OtlpGaugesSent;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/** Write the page, its JSON and `dora.json` to the report store, and send the gauges when an endpoint is set. */
|
|
153
|
+
export async function writeEstate(e: Pick<LedgerEstate, "estate" | "dora">, options: WriteEstateOptions): Promise<WriteEstateResult> {
|
|
154
|
+
const words = options.words ?? CHANT_WORDS;
|
|
155
|
+
const prefix = (options.prefix ?? "estate").replace(/^\/+|\/+$/g, "");
|
|
156
|
+
const files = { ...estateFiles(e, words, options.sections), ...(options.extra ?? {}) };
|
|
157
|
+
const keys: string[] = [];
|
|
158
|
+
for (const [name, body] of Object.entries(files)) {
|
|
159
|
+
const key = prefix ? `${prefix}/${name}` : name;
|
|
160
|
+
await options.put(key, body, name.endsWith(".html") ? "text/html; charset=utf-8" : "application/json");
|
|
161
|
+
keys.push(key);
|
|
162
|
+
}
|
|
163
|
+
const metrics = await sendOtlpGauges(deliveryGauges(e.dora, words), { ...(options.env ? { env: options.env } : {}), ...(options.fetch ? { fetch: options.fetch } : {}), product: words.product });
|
|
164
|
+
return { keys, ...(metrics ? { metrics } : {}) };
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Load the tables from the ledgers at `cwd`: every member's in a workspace,
|
|
169
|
+
* else the project's own, from the local `chant/lifecycle` branch, as
|
|
170
|
+
* `chant query` reads them. It never fetches.
|
|
171
|
+
*/
|
|
172
|
+
export async function readEstateLedger(cwd: string, members?: readonly string[]): Promise<QueryLoad> {
|
|
173
|
+
const { queryLedgers } = await import("./cli/handlers/query");
|
|
174
|
+
const { loadQueryData } = await import("./lifecycle/query");
|
|
175
|
+
return loadQueryData(await queryLedgers(cwd, members));
|
|
176
|
+
}
|
package/src/ci-handover.ts
CHANGED
|
@@ -110,26 +110,54 @@ export function handoverKeys(forge: HandoverForge): string[] {
|
|
|
110
110
|
/** The files the note job reads, which a report too large to hand on whole is cut to. */
|
|
111
111
|
export const HANDOVER_NOTE_FILES = ["pr-plan.json", "pr-note.md"] as const;
|
|
112
112
|
|
|
113
|
+
/**
|
|
114
|
+
* What a product changes in the handover (#4554). Left out, each is chant's
|
|
115
|
+
* own, and the scripts are the ones chant's generated jobs run.
|
|
116
|
+
*/
|
|
117
|
+
export interface HandoverOptions {
|
|
118
|
+
/** The files a report too large to hand on whole is cut to. Default {@link HANDOVER_NOTE_FILES}. */
|
|
119
|
+
noteFiles?: readonly string[];
|
|
120
|
+
/** The name the log lines start with. Default `chant`. */
|
|
121
|
+
label?: string;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/** A shell or JS string literal's body holds none of these, so a label or file name can't break out of the script. */
|
|
125
|
+
function assertPlain(what: string, values: readonly string[]): void {
|
|
126
|
+
for (const v of values) if (!/^[A-Za-z0-9._\/-]+$/.test(v)) throw new Error(`the handover's ${what} ${JSON.stringify(v)} may hold only letters, digits, dots, dashes, underscores and slashes`);
|
|
127
|
+
}
|
|
128
|
+
|
|
113
129
|
/**
|
|
114
130
|
* Packs the report directory (argv 1) into the step's output file (argv 2):
|
|
115
131
|
* every regular file, found without following a link, as gzipped JSON in
|
|
116
132
|
* base64, cut into the forge's chunks. A report too large is cut to
|
|
117
|
-
* {@link HANDOVER_NOTE_FILES}, and to none when even
|
|
133
|
+
* {@link HANDOVER_NOTE_FILES} (or `opts.noteFiles`), and to none when even
|
|
134
|
+
* those are too large.
|
|
118
135
|
*/
|
|
119
|
-
export function packJs(forge: HandoverForge): string {
|
|
136
|
+
export function packJs(forge: HandoverForge, opts: HandoverOptions = {}): string {
|
|
120
137
|
const { chunk, parts } = HANDOVER_LIMITS[forge];
|
|
138
|
+
const files = opts.noteFiles ?? HANDOVER_NOTE_FILES;
|
|
139
|
+
const label = opts.label ?? "chant";
|
|
140
|
+
assertPlain("note file", files);
|
|
141
|
+
assertPlain("label", [label]);
|
|
142
|
+
const own = opts.noteFiles === undefined && opts.label === undefined;
|
|
143
|
+
const tooLarge = own
|
|
144
|
+
? 'if(b.length>CHUNK*PARTS){b=pack({});console.error("chant: the plan report is too large to hand to the note job, even cut to the report and the note; it hands on none of it")}'
|
|
145
|
+
: `if(b.length>CHUNK*PARTS){b=pack({});console.error("${label}: the report is too large to hand to the next job, even cut to ${files.join(", ")}; it hands on none of it")}`;
|
|
146
|
+
const cut = own
|
|
147
|
+
? 'else console.error("chant: the plan report is too large to hand to the note job whole; it hands on pr-plan.json and pr-note.md")}'
|
|
148
|
+
: `else console.error("${label}: the report is too large to hand to the next job whole; it hands on ${files.join(", ")}")}`;
|
|
121
149
|
return [
|
|
122
150
|
'const fs=require("fs"),p=require("path"),z=require("zlib");',
|
|
123
151
|
"const [dir,out]=process.argv.slice(1);",
|
|
124
|
-
`const CHUNK=${chunk},PARTS=${parts},NOTE=${JSON.stringify(
|
|
152
|
+
`const CHUNK=${chunk},PARTS=${parts},NOTE=${JSON.stringify(files)};`,
|
|
125
153
|
"const all={};",
|
|
126
154
|
'const walk=(d,r)=>{let n=[];try{n=fs.readdirSync(d).sort()}catch{return}for(const x of n){const f=p.join(d,x),k=r?r+"/"+x:x;let s;try{s=fs.lstatSync(f)}catch{continue}if(s.isDirectory())walk(f,k);else if(s.isFile())all[k]=fs.readFileSync(f).toString("base64")}};',
|
|
127
155
|
'walk(dir,"");',
|
|
128
156
|
'const pack=(o)=>z.gzipSync(JSON.stringify(o)).toString("base64");',
|
|
129
157
|
"let b=pack(all);",
|
|
130
158
|
"if(b.length>CHUNK*PARTS){b=pack(Object.fromEntries(Object.entries(all).filter(([k])=>NOTE.includes(k))));",
|
|
131
|
-
|
|
132
|
-
|
|
159
|
+
tooLarge,
|
|
160
|
+
cut,
|
|
133
161
|
'let o="";for(let i=0;i*CHUNK<b.length;i++)o+="report_"+i+"="+b.slice(i*CHUNK,(i+1)*CHUNK)+"\\n";',
|
|
134
162
|
"fs.appendFileSync(out,o);",
|
|
135
163
|
].join("");
|
|
@@ -159,13 +187,18 @@ export const UNPACK_JS = [
|
|
|
159
187
|
/**
|
|
160
188
|
* The lines of the plan step, after {@link dropForgeTokens}: when the step
|
|
161
189
|
* ends, however it ends, its report directory (`dir`, from the directory the
|
|
162
|
-
* step starts in) goes into the step's outputs.
|
|
190
|
+
* step starts in) goes into the step's outputs. With `before`, the shell
|
|
191
|
+
* function it names runs first in the trap, such as a product's sweep of
|
|
192
|
+
* the processes the step started (#4554).
|
|
163
193
|
*/
|
|
164
|
-
export function handoverTrap(dir: string, forge: HandoverForge): string[] {
|
|
194
|
+
export function handoverTrap(dir: string, forge: HandoverForge, opts: HandoverOptions & { before?: string } = {}): string[] {
|
|
195
|
+
const label = opts.label ?? "chant";
|
|
196
|
+
if (opts.before !== undefined && !/^[A-Za-z_][A-Za-z0-9_]*$/.test(opts.before)) throw new Error(`the handover's before ${JSON.stringify(opts.before)} must be a shell function's name`);
|
|
197
|
+
const what = opts.label === undefined ? "the plan report could not be handed to the note job" : "the report could not be handed to the next job";
|
|
165
198
|
return [
|
|
166
199
|
`chant_report="$PWD/${dir}"`,
|
|
167
|
-
`chant_handover() { node -e '${packJs(forge)}' "$chant_report" "\${GITHUB_OUTPUT:-/dev/null}" || echo "
|
|
168
|
-
"trap chant_handover EXIT",
|
|
200
|
+
`chant_handover() { node -e '${packJs(forge, opts)}' "$chant_report" "\${GITHUB_OUTPUT:-/dev/null}" || echo "${label}: ${what}" >&2; }`,
|
|
201
|
+
opts.before ? `trap '${opts.before}; chant_handover' EXIT` : "trap chant_handover EXIT",
|
|
169
202
|
];
|
|
170
203
|
}
|
|
171
204
|
|
|
@@ -180,9 +213,11 @@ export function handoverOutputs(step: string, forge: HandoverForge): Record<stri
|
|
|
180
213
|
* heredoc whose end no JSON string can be, so the change's outputs stay data.
|
|
181
214
|
*/
|
|
182
215
|
export function takeOverScript(job: string, dir: string, forge: HandoverForge): string {
|
|
216
|
+
// #4554: the log lines name the job the report came from.
|
|
217
|
+
const unpack = job === "plan" ? UNPACK_JS : UNPACK_JS.replaceAll("the plan job", `the ${job} job`);
|
|
183
218
|
return [
|
|
184
219
|
"set -u",
|
|
185
|
-
`node -e '${
|
|
220
|
+
`node -e '${unpack}' ${dir} <<'END_OF_REPORT'`,
|
|
186
221
|
...handoverKeys(forge).map((k) => `\${{ toJSON(needs.${job}.outputs.${k}) }}`),
|
|
187
222
|
"END_OF_REPORT",
|
|
188
223
|
].join("\n");
|
|
@@ -191,6 +226,16 @@ export function takeOverScript(job: string, dir: string, forge: HandoverForge):
|
|
|
191
226
|
/** The variable the checkout script reads the job's token from. */
|
|
192
227
|
export const CHECKOUT_TOKEN_ENV = "CHANT_CHECKOUT_TOKEN";
|
|
193
228
|
|
|
229
|
+
/** What a product changes in {@link checkoutScript} (#4554). */
|
|
230
|
+
export interface CheckoutOptions {
|
|
231
|
+
/** The variable the job's token is read from. Default {@link CHECKOUT_TOKEN_ENV}. */
|
|
232
|
+
tokenEnv?: string;
|
|
233
|
+
/** A variable that, when the step sets it, names the ref to fetch and check out in place of the run's commit. */
|
|
234
|
+
refEnv?: string;
|
|
235
|
+
/** The remote-tracking ref a ref outside `refs/` is fetched into: `refs/remotes/origin/<headName>`. Default `chant-head`. */
|
|
236
|
+
headName?: string;
|
|
237
|
+
}
|
|
238
|
+
|
|
194
239
|
/**
|
|
195
240
|
* Checks the run's commit out with git, as actions/checkout does without
|
|
196
241
|
* credentials kept: `GITHUB_SHA` under `GITHUB_REF`. With `history`, every
|
|
@@ -204,7 +249,13 @@ export const CHECKOUT_TOKEN_ENV = "CHANT_CHECKOUT_TOKEN";
|
|
|
204
249
|
* private repository (`requireLifecycleLedger` in ./lifecycle/git.ts reads
|
|
205
250
|
* the local branch when the fetch fails).
|
|
206
251
|
*/
|
|
207
|
-
export function checkoutScript(history: boolean, ledger = false): string {
|
|
252
|
+
export function checkoutScript(history: boolean, ledger = false, opts: CheckoutOptions = {}): string {
|
|
253
|
+
const token = opts.tokenEnv ?? CHECKOUT_TOKEN_ENV;
|
|
254
|
+
const head = opts.headName ?? "chant-head";
|
|
255
|
+
for (const [k, v] of [["tokenEnv", token], ...(opts.refEnv !== undefined ? [["refEnv", opts.refEnv]] : [])] as const) {
|
|
256
|
+
if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(v)) throw new Error(`checkoutScript's ${k} ${JSON.stringify(v)} is not a variable name`);
|
|
257
|
+
}
|
|
258
|
+
if (!/^[A-Za-z0-9._-]+$/.test(head)) throw new Error(`checkoutScript's headName ${JSON.stringify(head)} is not a branch name`);
|
|
208
259
|
const fetchLine = history
|
|
209
260
|
? `git -c protocol.version=2 fetch -q --prune --no-recurse-submodules origin '+refs/heads/*:refs/remotes/origin/*' '+refs/tags/*:refs/tags/*' "+$want:$target"`
|
|
210
261
|
: 'git -c protocol.version=2 fetch -q --no-tags --prune --no-recurse-submodules --depth=1 origin "+$want:$target"';
|
|
@@ -213,18 +264,18 @@ export function checkoutScript(history: boolean, ledger = false): string {
|
|
|
213
264
|
'git config --global --add safe.directory "$PWD" 2>/dev/null || true',
|
|
214
265
|
"[ -d .git ] || git init -q .",
|
|
215
266
|
'git remote get-url origin >/dev/null 2>&1 || git remote add origin "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY"',
|
|
216
|
-
`if [ -n "\${${
|
|
217
|
-
` chant_auth="$(printf 'x-access-token:%s' "$${
|
|
267
|
+
`if [ -n "\${${token}:-}" ]; then`,
|
|
268
|
+
` chant_auth="$(printf 'x-access-token:%s' "$${token}" | base64 | tr -d '\\n')"`,
|
|
218
269
|
' export GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=http.extraheader GIT_CONFIG_VALUE_0="AUTHORIZATION: basic $chant_auth"',
|
|
219
270
|
" unset chant_auth",
|
|
220
271
|
"fi",
|
|
221
|
-
'ref="$GITHUB_REF"',
|
|
222
|
-
'want="$GITHUB_SHA"',
|
|
272
|
+
opts.refEnv ? `ref="\${${opts.refEnv}:-$GITHUB_REF}"` : 'ref="$GITHUB_REF"',
|
|
273
|
+
opts.refEnv ? `want="\${${opts.refEnv}:-$GITHUB_SHA}"` : 'want="$GITHUB_SHA"',
|
|
223
274
|
'case "$ref" in',
|
|
224
275
|
' refs/heads/*) target="refs/remotes/origin/${ref#refs/heads/}" ;;',
|
|
225
276
|
' refs/tags/*) target="$ref" ;;',
|
|
226
277
|
' refs/*) target="refs/remotes/${ref#refs/}" ;;',
|
|
227
|
-
|
|
278
|
+
` *) target="refs/remotes/origin/${head}" ;;`,
|
|
228
279
|
"esac",
|
|
229
280
|
"if git rev-parse -q --verify HEAD >/dev/null; then git clean -ffdxq; fi",
|
|
230
281
|
fetchLine,
|