@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,519 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The control repo's dispatch (#4568), shared by terragucci and plywood.
|
|
3
|
+
*
|
|
4
|
+
* A member repo's pipeline, once its apply on the default branch succeeded,
|
|
5
|
+
* sends one dispatch to the control repo: a `repository_dispatch` on GitHub,
|
|
6
|
+
* a pipeline trigger on GitLab, a workflow dispatch on Forgejo. The control
|
|
7
|
+
* repo's own pipeline then runs that member's dependents with `chant
|
|
8
|
+
* workspace run --dependents-of <member> --op <op>`. The member holds a
|
|
9
|
+
* token for that one call and no other access to the control repo.
|
|
10
|
+
*
|
|
11
|
+
* Lifted from terragucci's `control-repo.ts` (INTENTIUS/terragucci
|
|
12
|
+
* 18f6431595, packages/terragucci/src/control-repo.ts). What changed on the
|
|
13
|
+
* way into chant:
|
|
14
|
+
*
|
|
15
|
+
* - The names a person sees come from the product's words (#4550): the
|
|
16
|
+
* dispatch's event type is `<product>-applied`, the pipeline file
|
|
17
|
+
* `<product>-dependents.yml`, the status `<product>/<control stage>`.
|
|
18
|
+
* The variables a job reads stay chant's (`CHANT_CONTROL_*`), as every
|
|
19
|
+
* job variable does under #4550.
|
|
20
|
+
* - The token never reaches a command line. The generated script feeds it
|
|
21
|
+
* to curl on stdin (`-H @-`, `--form token=<-`), where terragucci's put it
|
|
22
|
+
* in curl's argv. The step maps the product's secret into
|
|
23
|
+
* {@link CONTROL_TOKEN_ENV} and nothing else reads it; a plan job drops it
|
|
24
|
+
* with the forge tokens ({@link CONTROL_TOKEN_VARS}, ../ci-handover.ts).
|
|
25
|
+
* - The request is built once ({@link controlDispatchRequest}) and both the
|
|
26
|
+
* script and {@link dispatchControl}, the in-process sender a product's
|
|
27
|
+
* bin calls, send that request.
|
|
28
|
+
*
|
|
29
|
+
* This module imports types and the words alone, so a product bundle can
|
|
30
|
+
* carry it.
|
|
31
|
+
*/
|
|
32
|
+
import { productStatusContext, resolveProductWords } from "../ci-product-words.js";
|
|
33
|
+
/** A member or Op name as the control repo's workspace spells them. The dispatch carries both into a shell line and a JSON string. */
|
|
34
|
+
export const CONTROL_NAME = /^[A-Za-z0-9][A-Za-z0-9._/-]{0,127}$/;
|
|
35
|
+
/** A branch name the dispatch may carry into a URL and a shell line. */
|
|
36
|
+
export const CONTROL_REF = /^[A-Za-z0-9][A-Za-z0-9._/-]{0,127}$/;
|
|
37
|
+
/** A secret's name, as GitHub, Forgejo and GitLab allow it. */
|
|
38
|
+
export const CONTROL_SECRET_NAME = /^[A-Za-z_][A-Za-z0-9_]{0,127}$/;
|
|
39
|
+
/** The variable the dispatch step reads the dispatch token from. The step maps the product's secret into it. */
|
|
40
|
+
export const CONTROL_TOKEN_ENV = "CHANT_CONTROL_TOKEN";
|
|
41
|
+
/** The variable a job that reads the control repo (estate ownership) takes the read-only token from. Never the dispatch token. */
|
|
42
|
+
export const CONTROL_READ_TOKEN_ENV = "CHANT_CONTROL_READ_TOKEN";
|
|
43
|
+
/**
|
|
44
|
+
* The control repo's token variables. A job that runs a change's code starts
|
|
45
|
+
* without them, as it starts without the forge tokens: pass these as
|
|
46
|
+
* `extra` to `dropForgeTokens` (../ci-handover.ts), or unset them on GitLab,
|
|
47
|
+
* where a CI/CD variable reaches every job.
|
|
48
|
+
*/
|
|
49
|
+
export const CONTROL_TOKEN_VARS = [CONTROL_TOKEN_ENV, CONTROL_READ_TOKEN_ENV];
|
|
50
|
+
/** The secret a member's dispatch token is kept in when the product names none. */
|
|
51
|
+
export const CONTROL_TOKEN_SECRET = "CHANT_CONTROL_TOKEN";
|
|
52
|
+
/** The secret the read-only token is kept in when the product names none. */
|
|
53
|
+
export const CONTROL_READ_TOKEN_SECRET = "CHANT_CONTROL_READ_TOKEN";
|
|
54
|
+
/** The variables a GitLab trigger carries, and the environment of the control repo's step. */
|
|
55
|
+
export const CONTROL_MEMBER_VAR = "CHANT_CONTROL_MEMBER";
|
|
56
|
+
export const CONTROL_OP_VAR = "CHANT_CONTROL_OP";
|
|
57
|
+
export const CONTROL_SHA_VAR = "CHANT_CONTROL_SHA";
|
|
58
|
+
/** The variable the apply outcome travels in (#4617): the member's dispatch step reads it, a GitLab trigger sets it, the control repo's step reads it. */
|
|
59
|
+
export const CONTROL_OUTCOME_VAR = "CHANT_CONTROL_OUTCOME";
|
|
60
|
+
export const CONTROL_APPLY_OUTCOMES = ["applied", "partial", "unchanged", "waiting", "failed"];
|
|
61
|
+
/** The outcomes after which the control repo runs the member's dependents: something applied. A dispatch with no outcome (the pull request loop's, sent on green only) runs them too. */
|
|
62
|
+
export const CONTROL_RUNS_DEPENDENTS = ["applied", "partial"];
|
|
63
|
+
/** The branch a GitLab or Forgejo dispatch runs on when the settings name none. */
|
|
64
|
+
export const CONTROL_REF_DEFAULT = "main";
|
|
65
|
+
/** The `npx` line the control repo's job runs chant with: the chant its own package.json pins. */
|
|
66
|
+
export const CONTROL_CHANT_COMMAND = "npx --no-install chant";
|
|
67
|
+
/** Settings a product's config is wrong in; `problems` lists each one. */
|
|
68
|
+
export class ControlConfigError extends Error {
|
|
69
|
+
constructor(message, problems = [message]) {
|
|
70
|
+
super(message);
|
|
71
|
+
this.problems = problems;
|
|
72
|
+
this.name = "ControlConfigError";
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/** A project key taken apart. A scheme and a `.git` suffix are dropped. terragucci's `parseProjectKey` (config.ts:2445). */
|
|
76
|
+
export function parseProjectKey(key) {
|
|
77
|
+
const clean = key.replace(/^https?:\/\//, "").replace(/\.git$/, "").replace(/\/+$/, "");
|
|
78
|
+
const parts = clean.split("/");
|
|
79
|
+
if (parts.length < 3 || parts.some((p) => p === "")) {
|
|
80
|
+
throw new ControlConfigError(`project key "${key}" must be <host>/<owner>/<name>, such as github.com/acme/infra`);
|
|
81
|
+
}
|
|
82
|
+
const [host, ...rest] = parts;
|
|
83
|
+
return { key, host: host, path: rest.join("/"), owner: rest.slice(0, -1).join("/"), name: rest[rest.length - 1] };
|
|
84
|
+
}
|
|
85
|
+
/** The forge a host belongs to, when the host says so. terragucci's `forgeFromHost` (config.ts:2456). */
|
|
86
|
+
export function forgeFromHost(host) {
|
|
87
|
+
const h = host.toLowerCase().replace(/:\d+$/, "");
|
|
88
|
+
if (h === "github.com" || h.startsWith("github."))
|
|
89
|
+
return "github";
|
|
90
|
+
if (h === "gitlab.com" || h.startsWith("gitlab.") || h.includes(".gitlab."))
|
|
91
|
+
return "gitlab";
|
|
92
|
+
if (h === "codeberg.org" || h.startsWith("forgejo.") || h.startsWith("gitea.") || h.includes("forgejo"))
|
|
93
|
+
return "forgejo";
|
|
94
|
+
return undefined;
|
|
95
|
+
}
|
|
96
|
+
/** The REST base of a forge at `host`. */
|
|
97
|
+
export function forgeApiBase(forge, host) {
|
|
98
|
+
const h = host.toLowerCase();
|
|
99
|
+
if (forge === "github")
|
|
100
|
+
return h === "github.com" ? "https://api.github.com" : `https://${host}/api/v3`;
|
|
101
|
+
if (forge === "gitlab")
|
|
102
|
+
return `https://${host}/api/v4`;
|
|
103
|
+
return `https://${host}/api/v1`;
|
|
104
|
+
}
|
|
105
|
+
const FORGES = ["github", "gitlab", "forgejo"];
|
|
106
|
+
/** The problems with `control`, each naming its key under `where`. terragucci's `controlProblems` (config.ts:494). */
|
|
107
|
+
export function controlSettingsProblems(input, where = "control") {
|
|
108
|
+
if (typeof input !== "object" || input === null || Array.isArray(input))
|
|
109
|
+
return [`${where} must be a mapping with repo and op`];
|
|
110
|
+
const v = input;
|
|
111
|
+
const out = [];
|
|
112
|
+
let host;
|
|
113
|
+
if (typeof v.repo !== "string")
|
|
114
|
+
out.push(`${where}.repo must name the control repo, such as github.com/acme/control`);
|
|
115
|
+
else {
|
|
116
|
+
try {
|
|
117
|
+
host = parseProjectKey(v.repo).host;
|
|
118
|
+
}
|
|
119
|
+
catch (e) {
|
|
120
|
+
out.push(`${where}.repo: ${e.message}`);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
if (!(typeof v.op === "string" && CONTROL_NAME.test(v.op)))
|
|
124
|
+
out.push(`${where}.op must name the Op the control repo runs on this repo's dependents, such as deploy`);
|
|
125
|
+
if (v.forge !== undefined && !FORGES.includes(v.forge))
|
|
126
|
+
out.push(`${where}.forge must be one of ${FORGES.join(", ")}`);
|
|
127
|
+
if (host !== undefined && v.forge === undefined && !forgeFromHost(host))
|
|
128
|
+
out.push(`${where}.forge is needed: ${v.repo}'s host does not say which forge it is`);
|
|
129
|
+
if (v.member !== undefined && !(typeof v.member === "string" && CONTROL_NAME.test(v.member)))
|
|
130
|
+
out.push(`${where}.member must be this repo's name in the control repo's workspace`);
|
|
131
|
+
if (v.tokenSecret !== undefined && !(typeof v.tokenSecret === "string" && CONTROL_SECRET_NAME.test(v.tokenSecret)))
|
|
132
|
+
out.push(`${where}.tokenSecret must name the secret holding the dispatch token, such as ${CONTROL_TOKEN_SECRET}`);
|
|
133
|
+
if (v.readTokenSecret !== undefined && !(typeof v.readTokenSecret === "string" && CONTROL_SECRET_NAME.test(v.readTokenSecret)))
|
|
134
|
+
out.push(`${where}.readTokenSecret must name the secret holding a read-only token for the control repo, such as ${CONTROL_READ_TOKEN_SECRET}`);
|
|
135
|
+
else if (typeof v.readTokenSecret === "string" && v.readTokenSecret === (v.tokenSecret ?? CONTROL_TOKEN_SECRET)) {
|
|
136
|
+
out.push(`${where}.readTokenSecret must not be the dispatch token's secret (${v.readTokenSecret}): the plan job runs the change's code`);
|
|
137
|
+
}
|
|
138
|
+
if (v.ref !== undefined && !(typeof v.ref === "string" && CONTROL_REF.test(v.ref)))
|
|
139
|
+
out.push(`${where}.ref must be a branch name`);
|
|
140
|
+
if (v.apiBase !== undefined && !(typeof v.apiBase === "string" && /^https?:\/\/[^\s'"]+$/.test(v.apiBase)))
|
|
141
|
+
out.push(`${where}.apiBase must be an http(s) URL`);
|
|
142
|
+
return out;
|
|
143
|
+
}
|
|
144
|
+
/** `control` with its defaults filled in. `fallbackMember` is the repo's name, used when `control.member` is unset. */
|
|
145
|
+
export function resolveControlTarget(input, fallbackMember) {
|
|
146
|
+
const problems = controlSettingsProblems(input);
|
|
147
|
+
if (problems.length > 0)
|
|
148
|
+
throw new ControlConfigError(problems.join("; "), problems);
|
|
149
|
+
const pk = parseProjectKey(input.repo);
|
|
150
|
+
const forge = input.forge ?? forgeFromHost(pk.host);
|
|
151
|
+
const member = input.member ?? fallbackMember;
|
|
152
|
+
if (!CONTROL_NAME.test(member))
|
|
153
|
+
throw new ControlConfigError(`control.member: "${member}" is not a name the control repo's workspace can hold; set control.member`);
|
|
154
|
+
return {
|
|
155
|
+
repo: input.repo,
|
|
156
|
+
host: pk.host,
|
|
157
|
+
path: pk.path,
|
|
158
|
+
forge,
|
|
159
|
+
apiBase: (input.apiBase ?? forgeApiBase(forge, pk.host)).replace(/\/+$/, ""),
|
|
160
|
+
op: input.op,
|
|
161
|
+
member,
|
|
162
|
+
ref: input.ref ?? CONTROL_REF_DEFAULT,
|
|
163
|
+
tokenSecret: input.tokenSecret ?? CONTROL_TOKEN_SECRET,
|
|
164
|
+
readTokenSecret: input.readTokenSecret ?? CONTROL_READ_TOKEN_SECRET,
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
/** The event type of the GitHub `repository_dispatch` a member sends: `<product>-applied`. */
|
|
168
|
+
export function controlDispatchEvent(wordsIn = {}) {
|
|
169
|
+
return `${resolveProductWords(wordsIn).product}-applied`;
|
|
170
|
+
}
|
|
171
|
+
/** The control repo's pipeline file name: `<product>-dependents.yml`. */
|
|
172
|
+
export function controlPipelineFileName(wordsIn = {}) {
|
|
173
|
+
return `${resolveProductWords(wordsIn).product}-dependents.yml`;
|
|
174
|
+
}
|
|
175
|
+
/** Where the control repo's pipeline file goes, beside the repo's own, on each forge. */
|
|
176
|
+
export function controlPipelinePath(forge, wordsIn = {}) {
|
|
177
|
+
const file = controlPipelineFileName(wordsIn);
|
|
178
|
+
return forge === "github" ? `.github/workflows/${file}` : forge === "forgejo" ? `.forgejo/workflows/${file}` : `.gitlab/${file}`;
|
|
179
|
+
}
|
|
180
|
+
/** The commit status that marks a commit whose apply the control repo was told about: `<product>/<control stage>`. */
|
|
181
|
+
export function controlStatusContext(wordsIn = {}) {
|
|
182
|
+
return productStatusContext(resolveProductWords(wordsIn), "control");
|
|
183
|
+
}
|
|
184
|
+
const SHA = /^[0-9a-f]{7,64}$/;
|
|
185
|
+
function checkDispatch(d) {
|
|
186
|
+
if (!CONTROL_NAME.test(d.member))
|
|
187
|
+
throw new ControlConfigError(`the dispatch's member "${d.member}" is not a name the control repo's workspace can hold`);
|
|
188
|
+
if (!CONTROL_NAME.test(d.op))
|
|
189
|
+
throw new ControlConfigError(`the dispatch's op "${d.op}" is not an Op name`);
|
|
190
|
+
if (!SHA.test(d.sha))
|
|
191
|
+
throw new ControlConfigError(`the dispatch names no commit sha ("${d.sha}")`);
|
|
192
|
+
if (d.outcome !== undefined && !CONTROL_APPLY_OUTCOMES.includes(d.outcome))
|
|
193
|
+
throw new ControlConfigError(`the dispatch's outcome "${d.outcome}" is not one of ${CONTROL_APPLY_OUTCOMES.join(", ")}`);
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* The request that tells the control repo `d.member` applied: GitHub's
|
|
197
|
+
* `POST /repos/<path>/dispatches`, GitLab's `POST
|
|
198
|
+
* /projects/<id>/trigger/pipeline`, Forgejo's `POST
|
|
199
|
+
* /repos/<path>/actions/workflows/<file>/dispatches`.
|
|
200
|
+
*/
|
|
201
|
+
export function controlDispatchRequest(target, d, wordsIn = {}) {
|
|
202
|
+
checkDispatch(d);
|
|
203
|
+
if (!CONTROL_REF.test(target.ref))
|
|
204
|
+
throw new ControlConfigError(`control.ref "${target.ref}" is not a branch name`);
|
|
205
|
+
if (target.forge === "github") {
|
|
206
|
+
return {
|
|
207
|
+
url: `${target.apiBase}/repos/${target.path}/dispatches`,
|
|
208
|
+
method: "POST",
|
|
209
|
+
headers: { Accept: "application/vnd.github+json", "Content-Type": "application/json" },
|
|
210
|
+
body: { json: { event_type: controlDispatchEvent(wordsIn), client_payload: { member: d.member, op: d.op, sha: d.sha, ...(d.outcome ? { outcome: d.outcome } : {}) } } },
|
|
211
|
+
token: { in: "header", name: "Authorization", scheme: "Bearer" },
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
if (target.forge === "gitlab") {
|
|
215
|
+
return {
|
|
216
|
+
url: `${target.apiBase}/projects/${encodeURIComponent(target.path)}/trigger/pipeline`,
|
|
217
|
+
method: "POST",
|
|
218
|
+
headers: {},
|
|
219
|
+
body: {
|
|
220
|
+
form: [
|
|
221
|
+
["ref", target.ref],
|
|
222
|
+
[`variables[${CONTROL_MEMBER_VAR}]`, d.member],
|
|
223
|
+
[`variables[${CONTROL_OP_VAR}]`, d.op],
|
|
224
|
+
[`variables[${CONTROL_SHA_VAR}]`, d.sha],
|
|
225
|
+
...(d.outcome ? [[`variables[${CONTROL_OUTCOME_VAR}]`, d.outcome]] : []),
|
|
226
|
+
],
|
|
227
|
+
},
|
|
228
|
+
token: { in: "form", field: "token" },
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
return {
|
|
232
|
+
url: `${target.apiBase}/repos/${target.path}/actions/workflows/${controlPipelineFileName(wordsIn)}/dispatches`,
|
|
233
|
+
method: "POST",
|
|
234
|
+
headers: { Accept: "application/json", "Content-Type": "application/json" },
|
|
235
|
+
body: { json: { ref: target.ref, inputs: { member: d.member, op: d.op, sha: d.sha, ...(d.outcome ? { outcome: d.outcome } : {}) } } },
|
|
236
|
+
token: { in: "header", name: "Authorization", scheme: "token" },
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
/** A dispatch the control repo's forge did not take. */
|
|
240
|
+
export class ControlDispatchError extends Error {
|
|
241
|
+
constructor(message, status) {
|
|
242
|
+
super(message);
|
|
243
|
+
this.status = status;
|
|
244
|
+
this.name = "ControlDispatchError";
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Sends one dispatch in process, for a product's bin that tells the control
|
|
249
|
+
* repo from its own command (terragucci's comment apply). A status other
|
|
250
|
+
* than 2xx throws {@link ControlDispatchError} with the status and the
|
|
251
|
+
* forge's answer, the token cut out of it.
|
|
252
|
+
*/
|
|
253
|
+
export async function dispatchControl(target, d, opts = {}) {
|
|
254
|
+
const token = opts.token ?? (opts.env ?? process.env)[CONTROL_TOKEN_ENV];
|
|
255
|
+
if (!token)
|
|
256
|
+
throw new ControlDispatchError(`${CONTROL_TOKEN_ENV} is not set, so ${target.repo} was not told that ${d.member} applied`, undefined);
|
|
257
|
+
const req = controlDispatchRequest(target, d, opts.words);
|
|
258
|
+
const headers = { ...req.headers };
|
|
259
|
+
let body;
|
|
260
|
+
if ("json" in req.body)
|
|
261
|
+
body = JSON.stringify(req.body.json);
|
|
262
|
+
else {
|
|
263
|
+
const form = new URLSearchParams();
|
|
264
|
+
if (req.token.in === "form")
|
|
265
|
+
form.append(req.token.field, token);
|
|
266
|
+
for (const [k, v] of req.body.form)
|
|
267
|
+
form.append(k, v);
|
|
268
|
+
body = form.toString();
|
|
269
|
+
headers["Content-Type"] = "application/x-www-form-urlencoded";
|
|
270
|
+
}
|
|
271
|
+
if (req.token.in === "header")
|
|
272
|
+
headers[req.token.name] = `${req.token.scheme} ${token}`;
|
|
273
|
+
const fetchImpl = opts.fetch ?? globalThis.fetch;
|
|
274
|
+
let res;
|
|
275
|
+
try {
|
|
276
|
+
res = await fetchImpl(req.url, { method: req.method, headers, body });
|
|
277
|
+
}
|
|
278
|
+
catch (e) {
|
|
279
|
+
throw new ControlDispatchError(`the dispatch to ${target.repo} could not be sent: ${String(e.message ?? e).split(token).join("***")}`, undefined);
|
|
280
|
+
}
|
|
281
|
+
if (res.status < 200 || res.status > 299) {
|
|
282
|
+
const answer = (await res.text().catch(() => "")).slice(0, 400).split(token).join("***");
|
|
283
|
+
throw new ControlDispatchError(`${target.repo} refused the dispatch (HTTP ${res.status}): ${answer}`, res.status);
|
|
284
|
+
}
|
|
285
|
+
return { status: res.status };
|
|
286
|
+
}
|
|
287
|
+
/** A value that passed {@link CONTROL_NAME} or {@link CONTROL_REF} is safe in a single-quoted shell word. */
|
|
288
|
+
function sq(v, re) {
|
|
289
|
+
if (!re.test(v))
|
|
290
|
+
throw new ControlConfigError(`not a safe name: ${v}`);
|
|
291
|
+
return `'${v}'`;
|
|
292
|
+
}
|
|
293
|
+
/** A URL from the target, checked to hold nothing a single-quoted shell word can't. */
|
|
294
|
+
function sqUrl(url) {
|
|
295
|
+
if (!/^https?:\/\/[A-Za-z0-9._~:/?#\[\]@!$&()*+,;=%-]+$/.test(url) || url.includes("'"))
|
|
296
|
+
throw new ControlConfigError(`not a safe URL: ${url}`);
|
|
297
|
+
return `'${url}'`;
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* The member's step: one request to the control repo's forge with the
|
|
301
|
+
* member's name, the Op and the commit that applied, read from
|
|
302
|
+
* `$CHANT_CONTROL_SHA`. The token is read from {@link CONTROL_TOKEN_ENV} and
|
|
303
|
+
* reaches curl on its stdin, never its argv or the log. A status other than
|
|
304
|
+
* 2xx fails the step with the status and the forge's answer.
|
|
305
|
+
*/
|
|
306
|
+
export function controlDispatchScript(target, opts = {}) {
|
|
307
|
+
const words = resolveProductWords(opts.words ?? {});
|
|
308
|
+
const label = words.product;
|
|
309
|
+
const req = controlDispatchRequest(target, { member: target.member, op: target.op, sha: "0000000" }, words);
|
|
310
|
+
const tok = CONTROL_TOKEN_ENV;
|
|
311
|
+
const lines = [
|
|
312
|
+
"set -u",
|
|
313
|
+
`member=${sq(target.member, CONTROL_NAME)}`,
|
|
314
|
+
`op=${sq(target.op, CONTROL_NAME)}`,
|
|
315
|
+
// The sha may come from another job's output: it is data, and only a commit sha goes into the request.
|
|
316
|
+
`sha="\${${CONTROL_SHA_VAR}:-}"`,
|
|
317
|
+
`case "$sha" in ""|*[!0-9a-f]*) echo "${label}: the dispatch names no commit sha, so ${target.repo} was not told" >&2; exit 1 ;; esac`,
|
|
318
|
+
...(opts.outcome
|
|
319
|
+
? [
|
|
320
|
+
`outcome="\${${CONTROL_OUTCOME_VAR}:-}"`,
|
|
321
|
+
`case "$outcome" in ${CONTROL_APPLY_OUTCOMES.join("|")}) ;; *) echo "${label}: the waves' outcome (\\"$outcome\\") is not one of ${CONTROL_APPLY_OUTCOMES.join(", ")}, so ${target.repo} was not told" >&2; exit 1 ;; esac`,
|
|
322
|
+
]
|
|
323
|
+
: []),
|
|
324
|
+
`[ -n "\${${tok}:-}" ] || { echo "${label}: ${tok} is empty; map the ${target.tokenSecret} secret into it, so ${target.repo} can be told" >&2; exit 1; }`,
|
|
325
|
+
...(opts.sentCheck ? [`if [ "$(${opts.sentCheck} 2>/dev/null)" = 1 ]; then echo "${label}: ${target.repo} was told about \${sha:0:8} already"; exit 0; fi`] : []),
|
|
326
|
+
'answer="$(mktemp)"',
|
|
327
|
+
];
|
|
328
|
+
let send;
|
|
329
|
+
if ("json" in req.body) {
|
|
330
|
+
const carried = opts.outcome ? `,"outcome":"'"$outcome"'"` : "";
|
|
331
|
+
const json = target.forge === "github"
|
|
332
|
+
? `{"event_type":"${controlDispatchEvent(words)}","client_payload":{"member":"'"$member"'","op":"'"$op"'","sha":"'"$sha"'"${carried}}}`
|
|
333
|
+
: `{"ref":"${target.ref}","inputs":{"member":"'"$member"'","op":"'"$op"'","sha":"'"$sha"'"${carried}}}`;
|
|
334
|
+
const auth = req.token.in === "header" ? `${req.token.name}: ${req.token.scheme} %s\\n` : "";
|
|
335
|
+
const headers = Object.entries(req.headers).map(([k, v]) => `-H '${k}: ${v}'`);
|
|
336
|
+
send = `code="$(printf '${auth}' "$${tok}" | curl -sS -o "$answer" -w '%{http_code}' -X POST -H @- ${headers.join(" ")} -d '${json}' ${sqUrl(req.url)})"`;
|
|
337
|
+
}
|
|
338
|
+
else {
|
|
339
|
+
// The same fields controlDispatchRequest lists, with the shell's values in place of the placeholders.
|
|
340
|
+
const fields = [
|
|
341
|
+
`--form ${sq(`ref=${target.ref}`, /^ref=[A-Za-z0-9._/-]+$/)}`,
|
|
342
|
+
`--form "variables[${CONTROL_MEMBER_VAR}]=$member"`,
|
|
343
|
+
`--form "variables[${CONTROL_OP_VAR}]=$op"`,
|
|
344
|
+
`--form "variables[${CONTROL_SHA_VAR}]=$sha"`,
|
|
345
|
+
...(opts.outcome ? [`--form "variables[${CONTROL_OUTCOME_VAR}]=$outcome"`] : []),
|
|
346
|
+
];
|
|
347
|
+
send = `code="$(printf '%s' "$${tok}" | curl -sS -o "$answer" -w '%{http_code}' -X POST --form 'token=<-' ${fields.join(" ")} ${sqUrl(req.url)})"`;
|
|
348
|
+
}
|
|
349
|
+
const mark = opts.markSent ? `; ${opts.markSent}` : "";
|
|
350
|
+
return [
|
|
351
|
+
...lines,
|
|
352
|
+
`${send} || { echo "${label}: the dispatch to ${target.repo} could not be sent" >&2; exit 1; }`,
|
|
353
|
+
`case "$code" in 2??) echo "${label}: told ${target.repo} that $member ${opts.outcome ? "ran its waves ($outcome)" : "applied"} (HTTP $code)"${mark} ;; *) echo "${label}: ${target.repo} refused the dispatch (HTTP $code): $(head -c 400 "$answer")" >&2; exit 1 ;; esac`,
|
|
354
|
+
].join("\n");
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* The script line that records a dispatch carrying an outcome (#4617):
|
|
358
|
+
* `recordControlAppliedFromEnv` from the control repo's own install of
|
|
359
|
+
* `@intentius/chant/ci-control`, which appends to `_control/applied.jsonl`
|
|
360
|
+
* and pushes `chant/lifecycle`. An install without it says so and records
|
|
361
|
+
* nothing; a failed record or push is a warning, never the job's failure.
|
|
362
|
+
*/
|
|
363
|
+
function recordAppliedLine(label) {
|
|
364
|
+
const js = [
|
|
365
|
+
'const m = await import("@intentius/chant/ci-control");',
|
|
366
|
+
`if (typeof m.recordControlAppliedFromEnv !== "function") { console.error("${label}: this chant does not record applies; pin a newer @intentius/chant to keep them"); process.exit(0); }`,
|
|
367
|
+
"const r = await m.recordControlAppliedFromEnv();",
|
|
368
|
+
`if (r.skipped) console.error("${label}: no apply recorded: " + r.skipped); else console.error("${label}: recorded " + r.recorded.member + " " + r.recorded.outcome + " at " + r.recorded.sha.slice(0, 12));`,
|
|
369
|
+
`if (r.pushWarning) console.error("${label}: " + r.pushWarning);`,
|
|
370
|
+
].join(" ");
|
|
371
|
+
return `[ -z "$outcome" ] || node --input-type=module -e '${js}' || echo "${label}: the apply of $member was not recorded" >&2`;
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* The control repo's step: runs the member's dependents. The member, the Op
|
|
375
|
+
* and the outcome arrive in the environment (a dispatch's payload is data,
|
|
376
|
+
* never part of the script) and are checked against {@link CONTROL_NAME}
|
|
377
|
+
* and {@link CONTROL_APPLY_OUTCOMES} before they reach a command line. A
|
|
378
|
+
* dispatch that carries an outcome is recorded first (#4617), and its
|
|
379
|
+
* dependents run only when something applied ({@link CONTROL_RUNS_DEPENDENTS}).
|
|
380
|
+
*/
|
|
381
|
+
export function controlDependentsScript(opts = {}) {
|
|
382
|
+
const label = opts.label ?? "chant";
|
|
383
|
+
const chant = opts.command ?? CONTROL_CHANT_COMMAND;
|
|
384
|
+
return [
|
|
385
|
+
"set -eu",
|
|
386
|
+
`member="\${${CONTROL_MEMBER_VAR}:-}"`,
|
|
387
|
+
`op="\${${CONTROL_OP_VAR}:-}"`,
|
|
388
|
+
`outcome="\${${CONTROL_OUTCOME_VAR}:-}"`,
|
|
389
|
+
`re='${CONTROL_NAME.source}'`,
|
|
390
|
+
`[[ $member =~ $re && $op =~ $re ]] || { echo "${label}: the dispatch names no usable member and Op (member=\\"$member\\", op=\\"$op\\")" >&2; exit 2; }`,
|
|
391
|
+
`case "$outcome" in ""|${CONTROL_APPLY_OUTCOMES.join("|")}) ;; *) echo "${label}: the dispatch's outcome (\\"$outcome\\") is not one of ${CONTROL_APPLY_OUTCOMES.join(", ")}" >&2; exit 2 ;; esac`,
|
|
392
|
+
"npm ci",
|
|
393
|
+
recordAppliedLine(label),
|
|
394
|
+
`case "$outcome" in ""|${CONTROL_RUNS_DEPENDENTS.join("|")}) ;; *) echo "${label}: $member's waves ended $outcome and applied nothing, so its dependents do not run"; exit 0 ;; esac`,
|
|
395
|
+
`${chant} workspace run --dependents-of "$member" --op "$op" --json`,
|
|
396
|
+
].join("\n");
|
|
397
|
+
}
|
|
398
|
+
/** The first chant with `chant workspace run --dependents-of`, which the control repo's package.json pins. terragucci's `CONTROL_CHANT_FLOOR`. */
|
|
399
|
+
export const CONTROL_DEPENDENTS_FLOOR = "0.124.47";
|
|
400
|
+
/** The control repo's pipeline for `forge`, in the product's words. */
|
|
401
|
+
export function controlPipelineSpec(forge, wordsIn = {}, opts = {}) {
|
|
402
|
+
const words = resolveProductWords(wordsIn);
|
|
403
|
+
const product = words.product;
|
|
404
|
+
const gitlab = forge === "gitlab";
|
|
405
|
+
const member = gitlab ? `$${CONTROL_MEMBER_VAR}` : "${{ github.event.client_payload.member || inputs.member }}";
|
|
406
|
+
const op = gitlab ? `$${CONTROL_OP_VAR}` : "${{ github.event.client_payload.op || inputs.op }}";
|
|
407
|
+
const sha = gitlab ? `$${CONTROL_SHA_VAR}` : "${{ github.event.client_payload.sha || inputs.sha }}";
|
|
408
|
+
const outcome = "${{ github.event.client_payload.outcome || inputs.outcome }}";
|
|
409
|
+
const bin = words.bin ?? product;
|
|
410
|
+
const notes = [
|
|
411
|
+
`the repo's package.json must pin @intentius/chant at ${CONTROL_DEPENDENTS_FLOOR} or later, which has \`chant workspace run --dependents-of\``,
|
|
412
|
+
...(gitlab
|
|
413
|
+
? [`add \`- local: ${controlPipelinePath(forge, words)}\` to the include list of .gitlab-ci.yml, and create a pipeline trigger token under Settings > CI/CD > Pipeline trigger tokens for each member's ${CONTROL_TOKEN_SECRET} variable`]
|
|
414
|
+
: forge === "github"
|
|
415
|
+
? [`give each member a ${CONTROL_TOKEN_SECRET} secret: a token that may send a repository_dispatch to this repo and do nothing else`]
|
|
416
|
+
: [`give each member a ${CONTROL_TOKEN_SECRET} secret: a token that may dispatch workflows in this repo and do nothing else`]),
|
|
417
|
+
gitlab
|
|
418
|
+
? "a dispatch that carries an outcome is recorded on chant/lifecycle; the job pushes it with its own token, so let the CI job token push to this repo or the record stays in the job"
|
|
419
|
+
: "a dispatch that carries an outcome is recorded on chant/lifecycle, which the job pushes with its own token (contents: write)",
|
|
420
|
+
];
|
|
421
|
+
return {
|
|
422
|
+
forge,
|
|
423
|
+
path: controlPipelinePath(forge, words),
|
|
424
|
+
header: [
|
|
425
|
+
`# A member repo's pipeline sends a dispatch here after its apply succeeds; this`,
|
|
426
|
+
"# runs that member's dependents with `chant workspace run --dependents-of`.",
|
|
427
|
+
`# Run \`${bin} control init\` to rewrite it rather than editing it here.`,
|
|
428
|
+
],
|
|
429
|
+
event: controlDispatchEvent(words),
|
|
430
|
+
inputs: {
|
|
431
|
+
member: { description: "The member whose dependents run", required: true, type: "string" },
|
|
432
|
+
op: { description: "The Op to run on them", required: true, type: "string" },
|
|
433
|
+
sha: { description: "The member's commit that applied", required: false, type: "string" },
|
|
434
|
+
outcome: { description: `What the member's waves did: ${CONTROL_APPLY_OUTCOMES.join(", ")}`, required: false, type: "string" },
|
|
435
|
+
},
|
|
436
|
+
env: gitlab ? {} : { [CONTROL_MEMBER_VAR]: member, [CONTROL_OP_VAR]: op, [CONTROL_SHA_VAR]: sha, [CONTROL_OUTCOME_VAR]: outcome },
|
|
437
|
+
script: controlDependentsScript({ label: product, ...(opts.command ? { command: opts.command } : {}) }),
|
|
438
|
+
group: `${product}-dependents-${member}`,
|
|
439
|
+
rule: `$CI_PIPELINE_SOURCE == "trigger" && $${CONTROL_MEMBER_VAR} && $${CONTROL_OP_VAR}`,
|
|
440
|
+
notes,
|
|
441
|
+
};
|
|
442
|
+
}
|
|
443
|
+
/** The control dispatch job's name in a member's pipeline. */
|
|
444
|
+
export const CONTROL_DISPATCH_JOB = "control-dispatch";
|
|
445
|
+
/**
|
|
446
|
+
* The member's dispatch job for a pipeline on `memberForge`. `sha` is the
|
|
447
|
+
* expression the job reads the applied commit from, as the forge spells it:
|
|
448
|
+
* a wave job's `green-sha` output, `${{ github.sha }}`, `$CI_COMMIT_SHA`.
|
|
449
|
+
*/
|
|
450
|
+
export function controlDispatchJob(memberForge, target, sha, opts = {}) {
|
|
451
|
+
const words = resolveProductWords(opts.words ?? {});
|
|
452
|
+
const gitlab = memberForge === "gitlab";
|
|
453
|
+
if (!CONTROL_SECRET_NAME.test(target.tokenSecret))
|
|
454
|
+
throw new ControlConfigError(`control.tokenSecret "${target.tokenSecret}" is not a secret's name`);
|
|
455
|
+
const script = controlDispatchScript(target, { ...opts, words });
|
|
456
|
+
return {
|
|
457
|
+
name: CONTROL_DISPATCH_JOB,
|
|
458
|
+
stepName: `Tell the control repo ${target.repo} that ${target.member} applied`,
|
|
459
|
+
env: gitlab ? { [CONTROL_SHA_VAR]: sha } : { [CONTROL_TOKEN_ENV]: `\${{ secrets.${target.tokenSecret} }}`, [CONTROL_SHA_VAR]: sha },
|
|
460
|
+
// GitLab hands every job each CI/CD variable; the token's variable is the product's secret name, read here alone.
|
|
461
|
+
script: gitlab && target.tokenSecret !== CONTROL_TOKEN_ENV ? `${CONTROL_TOKEN_ENV}="\${${target.tokenSecret}:-}"\n${script}` : script,
|
|
462
|
+
context: controlStatusContext(words),
|
|
463
|
+
};
|
|
464
|
+
}
|
|
465
|
+
/** The variable naming a checkout of the control repo a note job reads the facts from (#4617). */
|
|
466
|
+
export const CONTROL_DIR_ENV = "CHANT_CONTROL_DIR";
|
|
467
|
+
/** The control repo's ledger branch, which holds its entries and apply records. */
|
|
468
|
+
const CONTROL_LIFECYCLE_REF = "refs/heads/chant/lifecycle";
|
|
469
|
+
/**
|
|
470
|
+
* The step a pull request note job runs before it posts, when the pipeline
|
|
471
|
+
* names a control repo (#4619): a read-only fetch of the control repo's
|
|
472
|
+
* `chant/lifecycle`, so `pr-post` marks the cross-stack edges from its
|
|
473
|
+
* entries and apply records ({@link CONTROL_DIR_ENV}, ./edges.ts). The token
|
|
474
|
+
* is the read secret, never the dispatch token's, and reaches git as a
|
|
475
|
+
* header through git's environment for that one fetch, never the command
|
|
476
|
+
* line or a config file. Nothing of the control repo is checked out, so
|
|
477
|
+
* none of its files run.
|
|
478
|
+
*/
|
|
479
|
+
export function controlNoteCheckout(memberForge, target, wordsIn = {}) {
|
|
480
|
+
const words = resolveProductWords(wordsIn);
|
|
481
|
+
const label = words.product;
|
|
482
|
+
if (!CONTROL_SECRET_NAME.test(target.readTokenSecret))
|
|
483
|
+
throw new ControlConfigError(`control.readTokenSecret "${target.readTokenSecret}" is not a secret's name`);
|
|
484
|
+
// A loopback forge in a test answers on http; every other control repo on https.
|
|
485
|
+
const scheme = /^http:\/\//.test(target.apiBase) ? "http" : "https";
|
|
486
|
+
const url = sqUrl(`${scheme}://${target.host}/${target.path}.git`);
|
|
487
|
+
const repo = target.repo.replace(/[^A-Za-z0-9._:\/-]/g, "");
|
|
488
|
+
const gitlab = memberForge === "gitlab";
|
|
489
|
+
// GitLab's job token authenticates as gitlab-ci-token; a token from a secret as oauth2 on GitLab and as the token alone elsewhere.
|
|
490
|
+
const user = target.forge === "gitlab" ? "oauth2" : "x-access-token";
|
|
491
|
+
const tok = CONTROL_READ_TOKEN_ENV;
|
|
492
|
+
const read = gitlab
|
|
493
|
+
? [
|
|
494
|
+
`${tok}="\${${target.readTokenSecret}:-}"`,
|
|
495
|
+
`chant_control_user=${user}`,
|
|
496
|
+
`if [ -z "$${tok}" ] && [ -n "\${CI_JOB_TOKEN:-}" ]; then ${tok}="$CI_JOB_TOKEN"; chant_control_user=gitlab-ci-token; fi`,
|
|
497
|
+
]
|
|
498
|
+
: [`chant_control_user=${user}`];
|
|
499
|
+
const set = gitlab ? `export ${CONTROL_DIR_ENV}="$chant_control_dir"` : `echo "${CONTROL_DIR_ENV}=$chant_control_dir" >>"$GITHUB_ENV"`;
|
|
500
|
+
const script = [
|
|
501
|
+
...read,
|
|
502
|
+
'chant_control_dir="$(mktemp -d "${RUNNER_TEMP:-${TMPDIR:-/tmp}}/chant-control.XXXXXX")"',
|
|
503
|
+
// No token (a public control repo): git sends no header.
|
|
504
|
+
'chant_control_count=0; chant_control_header=""',
|
|
505
|
+
`if [ -n "\${${tok}:-}" ]; then chant_control_count=1; chant_control_header="AUTHORIZATION: basic $(printf '%s:%s' "$chant_control_user" "$${tok}" | base64 | tr -d '\\n')"; fi`,
|
|
506
|
+
`if git init -q "$chant_control_dir" && GIT_TERMINAL_PROMPT=0 GIT_CONFIG_COUNT="$chant_control_count" GIT_CONFIG_KEY_0=http.extraheader GIT_CONFIG_VALUE_0="$chant_control_header" git -C "$chant_control_dir" fetch --quiet --no-tags --depth 1 ${url} '+${CONTROL_LIFECYCLE_REF}:${CONTROL_LIFECYCLE_REF}'; then`,
|
|
507
|
+
` ${set}`,
|
|
508
|
+
` echo "${label}: read the control repo ${repo}'s chant/lifecycle, so the note marks its cross-stack edges"`,
|
|
509
|
+
"else",
|
|
510
|
+
` echo "${label}: could not read the control repo ${repo}'s chant/lifecycle, so its cross-stack edges stay unknown" >&2`,
|
|
511
|
+
"fi",
|
|
512
|
+
`unset chant_control_header chant_control_count chant_control_user ${tok}`,
|
|
513
|
+
].join("\n");
|
|
514
|
+
return {
|
|
515
|
+
stepName: `Read the control repo ${repo}'s records, read-only, for the cross-stack edges`,
|
|
516
|
+
env: gitlab ? {} : { [tok]: `\${{ secrets.${target.readTokenSecret} || github.token }}` },
|
|
517
|
+
script,
|
|
518
|
+
};
|
|
519
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cross-stack edges marked stale, current or unknown (#4617).
|
|
3
|
+
*
|
|
4
|
+
* A member here reads a stack that no member of this workspace applies (a
|
|
5
|
+
* Pulumi `StackReference` the pulumi lexicon lists as outside, #4547). When
|
|
6
|
+
* a control repo governs the repositories, its entries say which project
|
|
7
|
+
* owns that stack (an entry's `estates`), and its apply records
|
|
8
|
+
* (./applied.ts) say when that project last applied. The edge is:
|
|
9
|
+
*
|
|
10
|
+
* - `stale`: the owner applied after the reader last updated, so the reader
|
|
11
|
+
* holds outputs that may have changed since;
|
|
12
|
+
* - `current`: the reader updated after the owner's last apply;
|
|
13
|
+
* - `unknown`: no entry claims the stack, two do, the owner has no apply on
|
|
14
|
+
* record, the reader has never updated, or the control repo was not read.
|
|
15
|
+
*
|
|
16
|
+
* The reader's last update is the time its stack export records (Pulumi's
|
|
17
|
+
* `deployment.manifest.time`). Only names and times are compared: never an
|
|
18
|
+
* output's value.
|
|
19
|
+
*/
|
|
20
|
+
import type { ControlEntry } from "./records.js";
|
|
21
|
+
import { CONTROL_DIR_ENV } from "./dispatch.js";
|
|
22
|
+
import type { ControlAppliedRecord } from "./applied.js";
|
|
23
|
+
/** One read of a stack outside the workspace, as the plan found it. */
|
|
24
|
+
export interface CrossStackRead {
|
|
25
|
+
/** The member that reads it. */
|
|
26
|
+
member: string;
|
|
27
|
+
/** The stack's name as the program wrote it: `<org>/<project>/<stack>`, `<project>/<stack>` or `<stack>`. */
|
|
28
|
+
stack: string;
|
|
29
|
+
/** When the reader last updated, from its export. Absent when it has never updated. */
|
|
30
|
+
lastUpdate?: string;
|
|
31
|
+
}
|
|
32
|
+
/** A cross-stack edge with its mark. */
|
|
33
|
+
export interface CrossStackEdge extends CrossStackRead {
|
|
34
|
+
status: "stale" | "current" | "unknown";
|
|
35
|
+
/** The project the control repo's entries give the stack to. */
|
|
36
|
+
owner?: string;
|
|
37
|
+
/** The owner's newest apply on record. */
|
|
38
|
+
ownerApplied?: {
|
|
39
|
+
at: string;
|
|
40
|
+
sha: string;
|
|
41
|
+
outcome: string;
|
|
42
|
+
};
|
|
43
|
+
/** Why the mark is what it is, in a few words. */
|
|
44
|
+
why: string;
|
|
45
|
+
}
|
|
46
|
+
/** What the control repo says, as {@link markCrossStackEdges} reads it. */
|
|
47
|
+
export interface ControlEdgeFacts {
|
|
48
|
+
entries: readonly ControlEntry[];
|
|
49
|
+
/** Each member's newest apply (`latestControlApplies`). */
|
|
50
|
+
applies: ReadonlyMap<string, ControlAppliedRecord>;
|
|
51
|
+
}
|
|
52
|
+
/** The member name a project's dispatch carries: its entry's `settings.member`, else the repository's name. */
|
|
53
|
+
export declare function controlMemberOf(entry: Pick<ControlEntry, "project" | "settings">): string | undefined;
|
|
54
|
+
/** Each read marked from the control repo's facts; with no facts, every edge is unknown. Sorted by member, then stack. */
|
|
55
|
+
export declare function markCrossStackEdges(reads: readonly CrossStackRead[], facts: ControlEdgeFacts | undefined): CrossStackEdge[];
|
|
56
|
+
/**
|
|
57
|
+
* The control repo's facts read from a checkout of it (`dir`, with its
|
|
58
|
+
* `chant/lifecycle` fetched), or undefined when it cannot be read. Entries
|
|
59
|
+
* are read leniently: the note marks what it can.
|
|
60
|
+
*/
|
|
61
|
+
export declare function readControlEdgeFacts(dir: string): Promise<ControlEdgeFacts | undefined>;
|
|
62
|
+
/** The variable naming a checkout of the control repo a note job reads the facts from ({@link controlNoteCheckout} sets it). */
|
|
63
|
+
export { CONTROL_DIR_ENV };
|
|
64
|
+
/**
|
|
65
|
+
* A report with its cross-stack edges marked again from `facts` (#4617).
|
|
66
|
+
* Only each edge's reader, stack and last update are taken from the report;
|
|
67
|
+
* the mark, the owner and the owner's apply come from the facts, so a
|
|
68
|
+
* report that names a mark of its own never shows it.
|
|
69
|
+
*/
|
|
70
|
+
export declare function remarkCrossStackEdges<T extends {
|
|
71
|
+
crossStackEdges?: CrossStackEdge[];
|
|
72
|
+
}>(report: T, facts: ControlEdgeFacts | undefined): T;
|
|
73
|
+
/** The facts from the checkout {@link CONTROL_DIR_ENV} names, or undefined when it names none or it cannot be read. */
|
|
74
|
+
export declare function controlEdgeFactsFromEnv(env?: Record<string, string | undefined>): Promise<ControlEdgeFacts | undefined>;
|
|
75
|
+
//# sourceMappingURL=edges.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edges.d.ts","sourceRoot":"","sources":["../../src/control/edges.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAmB,MAAM,YAAY,CAAC;AAC9D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAEtD,uEAAuE;AACvE,MAAM,WAAW,cAAc;IAC7B,gCAAgC;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,6GAA6G;IAC7G,KAAK,EAAE,MAAM,CAAC;IACd,uFAAuF;IACvF,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,wCAAwC;AACxC,MAAM,WAAW,cAAe,SAAQ,cAAc;IACpD,MAAM,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC;IACxC,gEAAgE;IAChE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0CAA0C;IAC1C,YAAY,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5D,kDAAkD;IAClD,GAAG,EAAE,MAAM,CAAC;CACb;AAED,2EAA2E;AAC3E,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,SAAS,YAAY,EAAE,CAAC;IACjC,2DAA2D;IAC3D,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;CACpD;AAuBD,+GAA+G;AAC/G,wBAAgB,eAAe,CAAC,KAAK,EAAE,IAAI,CAAC,YAAY,EAAE,SAAS,GAAG,UAAU,CAAC,GAAG,MAAM,GAAG,SAAS,CASrG;AAED,0HAA0H;AAC1H,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,SAAS,cAAc,EAAE,EAAE,KAAK,EAAE,gBAAgB,GAAG,SAAS,GAAG,cAAc,EAAE,CAkC3H;AAED;;;;GAIG;AACH,wBAAsB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC,CAU7F;AAED,gIAAgI;AAChI,OAAO,EAAE,eAAe,EAAE,CAAC;AAE3B;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,SAAS;IAAE,eAAe,CAAC,EAAE,cAAc,EAAE,CAAA;CAAE,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,gBAAgB,GAAG,SAAS,GAAG,CAAC,CASzI;AAED,uHAAuH;AACvH,wBAAsB,uBAAuB,CAAC,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAe,GAAG,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC,CAG1I"}
|