@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,395 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The control repo's entries (#4568): its projects and its shared defaults,
|
|
3
|
+
* as `control-entry` records on the control repo's workspace ledger.
|
|
4
|
+
*
|
|
5
|
+
* terragucci kept these as `chant workspace records` files committed to the
|
|
6
|
+
* control repo (packages/terragucci/src/control-records.ts at 18f6431595).
|
|
7
|
+
* Under the ci-products ruling (records go on the ledger, never product git
|
|
8
|
+
* writes; #4551) they are lines of `_control/entries.jsonl` on the control
|
|
9
|
+
* repo's `chant/lifecycle` branch, appended through the same git layer every
|
|
10
|
+
* other ledger here uses, under the member prefix of the directory they are
|
|
11
|
+
* written from.
|
|
12
|
+
*
|
|
13
|
+
* The file is a log. Each line is one version of one entry: a project's
|
|
14
|
+
* (`entry: project`, `project: <host>/<owner>/<name>`) or the defaults'
|
|
15
|
+
* (`entry: defaults`). An entry's current version is its newest line; a
|
|
16
|
+
* `retired` version closes it, and a project that comes back gets a new id.
|
|
17
|
+
* Each line names the digest of the version it replaces (`prev`), so a write
|
|
18
|
+
* that raced another is refused rather than lost, as terragucci's `amend
|
|
19
|
+
* --expect` refused it, and a reader finds a broken chain.
|
|
20
|
+
*
|
|
21
|
+
* What an entry's `settings` hold is the product's: chant checks the shape
|
|
22
|
+
* of the record, and the product passes a `validate` that checks its
|
|
23
|
+
* settings the way its config would.
|
|
24
|
+
*
|
|
25
|
+
* Neither write pushes: call `pushLifecycleReport` after, the two-step shape
|
|
26
|
+
* every ledger here uses.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
import { createHash } from "node:crypto";
|
|
30
|
+
import { parseProjectKey } from "./dispatch";
|
|
31
|
+
|
|
32
|
+
/** The ledger directory and file the entries are kept in. */
|
|
33
|
+
export const CONTROL_LEDGER_DIR = "_control";
|
|
34
|
+
export const CONTROL_LEDGER_FILE = "entries.jsonl";
|
|
35
|
+
|
|
36
|
+
/** The record kind, as each line names it. */
|
|
37
|
+
export const CONTROL_ENTRY_KIND = "control-entry";
|
|
38
|
+
/** The prefix of an entry's id: `ctl-001`. */
|
|
39
|
+
export const CONTROL_ID_PREFIX = "ctl";
|
|
40
|
+
|
|
41
|
+
export const CONTROL_ENTRY_KINDS = ["project", "defaults"] as const;
|
|
42
|
+
export type ControlEntryKind = (typeof CONTROL_ENTRY_KINDS)[number];
|
|
43
|
+
export type ControlEntryState = "active" | "retired";
|
|
44
|
+
|
|
45
|
+
/** One line of `_control/entries.jsonl`: one version of one entry. */
|
|
46
|
+
export interface ControlEntryRecord {
|
|
47
|
+
version: 1;
|
|
48
|
+
kind: typeof CONTROL_ENTRY_KIND;
|
|
49
|
+
/** `ctl-<n>`, three digits or more. */
|
|
50
|
+
id: string;
|
|
51
|
+
entry: ControlEntryKind;
|
|
52
|
+
/** The project's key; null for the defaults. */
|
|
53
|
+
project: string | null;
|
|
54
|
+
state: ControlEntryState;
|
|
55
|
+
/** The project's settings, or the defaults, as the product's config holds them. */
|
|
56
|
+
settings: Record<string, unknown>;
|
|
57
|
+
/** The estates this project owns. Empty for the defaults. */
|
|
58
|
+
estates: string[];
|
|
59
|
+
/** The product that wrote it: `terragucci`, `plywood`. */
|
|
60
|
+
product: string;
|
|
61
|
+
/** When it was written, ISO 8601. */
|
|
62
|
+
at: string;
|
|
63
|
+
/** Who wrote it, when known. */
|
|
64
|
+
by?: string;
|
|
65
|
+
/** The digest of the version this one replaces; null for an entry's first. */
|
|
66
|
+
prev: string | null;
|
|
67
|
+
/** sha256 over the canonical JSON of every other field. */
|
|
68
|
+
digest: string;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** An entry's current version, as a product reads it. */
|
|
72
|
+
export interface ControlEntry {
|
|
73
|
+
id: string;
|
|
74
|
+
entry: ControlEntryKind;
|
|
75
|
+
/** The project's key; undefined for the defaults. */
|
|
76
|
+
project?: string;
|
|
77
|
+
settings: Record<string, unknown>;
|
|
78
|
+
estates: string[];
|
|
79
|
+
digest: string;
|
|
80
|
+
at: string;
|
|
81
|
+
by?: string;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** Records the control repo's entries are wrong in; `problems` lists each one. */
|
|
85
|
+
export class ControlRecordsError extends Error {
|
|
86
|
+
constructor(
|
|
87
|
+
message: string,
|
|
88
|
+
readonly problems: string[] = [message],
|
|
89
|
+
) {
|
|
90
|
+
super(message);
|
|
91
|
+
this.name = "ControlRecordsError";
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** A write refused because the entry changed since it was read. */
|
|
96
|
+
export class ControlEntryConflict extends ControlRecordsError {
|
|
97
|
+
constructor(message: string) {
|
|
98
|
+
super(message);
|
|
99
|
+
this.name = "ControlEntryConflict";
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function canonical(v: unknown): unknown {
|
|
104
|
+
if (Array.isArray(v)) return v.map(canonical);
|
|
105
|
+
if (v && typeof v === "object") return Object.fromEntries(Object.keys(v).sort().map((k) => [k, canonical((v as Record<string, unknown>)[k])]));
|
|
106
|
+
return v;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/** The digest of a record: sha256 over the canonical JSON of every field but `digest`. */
|
|
110
|
+
export function controlEntryDigest(record: Omit<ControlEntryRecord, "digest">): string {
|
|
111
|
+
const { digest: _drop, ...rest } = record as ControlEntryRecord;
|
|
112
|
+
return `sha256:${createHash("sha256").update(JSON.stringify(canonical(rest))).digest("hex")}`;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const ID = new RegExp(`^${CONTROL_ID_PREFIX}-[0-9]{3,}$`);
|
|
116
|
+
|
|
117
|
+
/** The problems with one parsed line, or [] when it is a record. */
|
|
118
|
+
export function controlEntryRecordProblems(v: unknown): string[] {
|
|
119
|
+
if (typeof v !== "object" || v === null || Array.isArray(v)) return ["not an object"];
|
|
120
|
+
const r = v as Record<string, unknown>;
|
|
121
|
+
const out: string[] = [];
|
|
122
|
+
if (r.version !== 1) out.push("version must be 1");
|
|
123
|
+
if (r.kind !== CONTROL_ENTRY_KIND) out.push(`kind must be ${CONTROL_ENTRY_KIND}`);
|
|
124
|
+
if (!(typeof r.id === "string" && ID.test(r.id))) out.push(`id must be ${CONTROL_ID_PREFIX}-<three digits or more>`);
|
|
125
|
+
if (!CONTROL_ENTRY_KINDS.includes(r.entry as ControlEntryKind)) out.push("entry must be project or defaults");
|
|
126
|
+
if (r.entry === "project" && !(typeof r.project === "string" && r.project.length > 0)) out.push("a project entry names its project");
|
|
127
|
+
if (r.entry === "defaults" && r.project !== null) out.push("the defaults name no project");
|
|
128
|
+
if (r.state !== "active" && r.state !== "retired") out.push("state must be active or retired");
|
|
129
|
+
if (typeof r.settings !== "object" || r.settings === null || Array.isArray(r.settings)) out.push("settings must be an object");
|
|
130
|
+
if (!(Array.isArray(r.estates) && r.estates.every((e) => typeof e === "string" && e.length > 0) && new Set(r.estates).size === r.estates.length)) out.push("estates must be distinct names");
|
|
131
|
+
if (r.entry === "defaults" && Array.isArray(r.estates) && r.estates.length > 0) out.push("the defaults own no estates");
|
|
132
|
+
if (!(typeof r.product === "string" && r.product.length > 0)) out.push("product must name the product that wrote it");
|
|
133
|
+
if (!(typeof r.at === "string" && !Number.isNaN(Date.parse(r.at)))) out.push("at must be a time");
|
|
134
|
+
if (r.by !== undefined && typeof r.by !== "string") out.push("by must be a string");
|
|
135
|
+
if (!(r.prev === null || typeof r.prev === "string")) out.push("prev must be a digest or null");
|
|
136
|
+
if (typeof r.digest !== "string") out.push("digest is missing");
|
|
137
|
+
else if (out.length === 0 && controlEntryDigest(r as unknown as ControlEntryRecord) !== r.digest) out.push("digest does not match the record");
|
|
138
|
+
return out;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/** Every line of the file, each a record or the problems that kept it out. */
|
|
142
|
+
export function parseControlEntries(text: string | null | undefined): { records: ControlEntryRecord[]; malformed: Array<{ line: number; problems: string[] }> } {
|
|
143
|
+
const records: ControlEntryRecord[] = [];
|
|
144
|
+
const malformed: Array<{ line: number; problems: string[] }> = [];
|
|
145
|
+
(text ?? "").split("\n").forEach((raw, i) => {
|
|
146
|
+
if (!raw.trim()) return;
|
|
147
|
+
let v: unknown;
|
|
148
|
+
try {
|
|
149
|
+
v = JSON.parse(raw);
|
|
150
|
+
} catch {
|
|
151
|
+
malformed.push({ line: i + 1, problems: ["not JSON"] });
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
const problems = controlEntryRecordProblems(v);
|
|
155
|
+
if (problems.length > 0) malformed.push({ line: i + 1, problems });
|
|
156
|
+
else records.push(v as ControlEntryRecord);
|
|
157
|
+
});
|
|
158
|
+
return { records, malformed };
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/** The key an entry is one of: its project, or `defaults`. */
|
|
162
|
+
function keyOf(r: Pick<ControlEntryRecord, "entry" | "project">): string {
|
|
163
|
+
return r.entry === "defaults" ? "defaults" : r.project!;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Each entry's current version from the log, oldest first: the newest line
|
|
168
|
+
* of each id, left out when it is retired. A version whose `prev` is not the
|
|
169
|
+
* digest of the one before it, or two active ids for one project (or for
|
|
170
|
+
* the defaults), is a problem.
|
|
171
|
+
*/
|
|
172
|
+
export function currentControlEntries(records: readonly ControlEntryRecord[]): { entries: ControlEntry[]; problems: string[] } {
|
|
173
|
+
const problems: string[] = [];
|
|
174
|
+
const newest = new Map<string, ControlEntryRecord>();
|
|
175
|
+
for (const r of records) {
|
|
176
|
+
const before = newest.get(r.id);
|
|
177
|
+
if ((before?.digest ?? null) !== r.prev) problems.push(`${r.id} at ${r.at} replaces ${r.prev ?? "nothing"}, but its version before was ${before?.digest ?? "none"}`);
|
|
178
|
+
if (before && keyOf(before) !== keyOf(r)) problems.push(`${r.id} moved from ${keyOf(before)} to ${keyOf(r)}; an id keeps its project`);
|
|
179
|
+
newest.set(r.id, r);
|
|
180
|
+
}
|
|
181
|
+
const entries: ControlEntry[] = [];
|
|
182
|
+
const byKey = new Map<string, string>();
|
|
183
|
+
for (const r of newest.values()) {
|
|
184
|
+
if (r.state === "retired") continue;
|
|
185
|
+
const key = keyOf(r);
|
|
186
|
+
const prior = byKey.get(key);
|
|
187
|
+
if (prior) problems.push(`${key} has two active entries, ${prior} and ${r.id}; retire one`);
|
|
188
|
+
else byKey.set(key, r.id);
|
|
189
|
+
if (r.entry === "project") {
|
|
190
|
+
try {
|
|
191
|
+
parseProjectKey(r.project!);
|
|
192
|
+
} catch (e) {
|
|
193
|
+
problems.push(`${r.id}: ${(e as Error).message}`);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
entries.push({
|
|
197
|
+
id: r.id,
|
|
198
|
+
entry: r.entry,
|
|
199
|
+
...(r.project !== null ? { project: r.project } : {}),
|
|
200
|
+
settings: r.settings,
|
|
201
|
+
estates: r.estates,
|
|
202
|
+
digest: r.digest,
|
|
203
|
+
at: r.at,
|
|
204
|
+
...(r.by !== undefined ? { by: r.by } : {}),
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
return { entries, problems };
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Where the entries are read from and appended to. {@link gitControlLedger}
|
|
212
|
+
* is the control repo's `chant/lifecycle`; a test passes one in memory.
|
|
213
|
+
*/
|
|
214
|
+
export interface ControlLedgerPort {
|
|
215
|
+
/** The file's text, or null when the branch or the file is absent. */
|
|
216
|
+
read(): Promise<string | null>;
|
|
217
|
+
/** Append one line, committed with `message`. Returns the commit. Does not push. */
|
|
218
|
+
append(line: string, message: string): Promise<string>;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/** The control repo's `_control/entries.jsonl` on its local `chant/lifecycle`, under the member prefix of `cwd`. */
|
|
222
|
+
export function gitControlLedger(opts: { cwd?: string } = {}): ControlLedgerPort {
|
|
223
|
+
return {
|
|
224
|
+
async read() {
|
|
225
|
+
const { readBlobFromPath } = await import("../lifecycle/git");
|
|
226
|
+
return readBlobFromPath(CONTROL_LEDGER_DIR, CONTROL_LEDGER_FILE, opts);
|
|
227
|
+
},
|
|
228
|
+
async append(line, message) {
|
|
229
|
+
const { appendLedgerLine } = await import("../lifecycle/git");
|
|
230
|
+
return appendLedgerLine(CONTROL_LEDGER_DIR, CONTROL_LEDGER_FILE, line, message, opts);
|
|
231
|
+
},
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/** Checks one entry's settings the way the product's config would; returns the problems. */
|
|
236
|
+
export type ControlSettingsValidator = (entry: ControlEntryKind, project: string | undefined, settings: Record<string, unknown>) => string[];
|
|
237
|
+
|
|
238
|
+
/** What a read takes. */
|
|
239
|
+
export interface ReadControlEntriesOptions {
|
|
240
|
+
/** The product's check of each entry's settings. */
|
|
241
|
+
validate?: ControlSettingsValidator;
|
|
242
|
+
/** Read past malformed lines rather than refuse. Default false. */
|
|
243
|
+
lenient?: boolean;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/** The control repo's current entries, each checked. A problem anywhere refuses the read, unless `lenient`. */
|
|
247
|
+
export async function readControlEntries(port: ControlLedgerPort, opts: ReadControlEntriesOptions = {}): Promise<ControlEntry[]> {
|
|
248
|
+
const { records, malformed } = parseControlEntries(await port.read());
|
|
249
|
+
const { entries, problems } = currentControlEntries(records);
|
|
250
|
+
const all = [...malformed.map((m) => `${CONTROL_LEDGER_DIR}/${CONTROL_LEDGER_FILE}:${m.line}: ${m.problems.join(", ")}`), ...problems];
|
|
251
|
+
if (opts.validate) for (const e of entries) for (const p of opts.validate(e.entry, e.project, e.settings)) all.push(`${e.id} (${e.project ?? "defaults"}): ${p}`);
|
|
252
|
+
if (all.length > 0 && !opts.lenient) throw new ControlRecordsError(`the control repo's entries have ${all.length} problem(s):\n ${all.join("\n ")}`, all);
|
|
253
|
+
return entries;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/** The entries as a product's control config holds them: the defaults, and each project's settings by key. */
|
|
257
|
+
export function controlConfig(entries: readonly ControlEntry[]): { defaults?: Record<string, unknown>; projects: Record<string, Record<string, unknown>> } {
|
|
258
|
+
const defaults = entries.find((e) => e.entry === "defaults");
|
|
259
|
+
const projects: Record<string, Record<string, unknown>> = {};
|
|
260
|
+
for (const e of entries.filter((x) => x.entry === "project").sort((a, b) => a.project!.localeCompare(b.project!))) projects[e.project!] = e.settings;
|
|
261
|
+
return { ...(defaults ? { defaults: defaults.settings } : {}), projects };
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/** Who claims each estate in the entries: estate name to project keys. Read at each plan; nothing is kept between plans. */
|
|
265
|
+
export function estateClaims(entries: readonly ControlEntry[]): Map<string, string[]> {
|
|
266
|
+
const claims = new Map<string, string[]>();
|
|
267
|
+
for (const e of entries) {
|
|
268
|
+
if (e.entry !== "project") continue;
|
|
269
|
+
for (const estate of e.estates) claims.set(estate, [...(claims.get(estate) ?? []), e.project!]);
|
|
270
|
+
}
|
|
271
|
+
return claims;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/** What a write takes besides the entry. */
|
|
275
|
+
export interface ControlWriteOptions {
|
|
276
|
+
/** The product writing it. */
|
|
277
|
+
product: string;
|
|
278
|
+
by?: string;
|
|
279
|
+
validate?: ControlSettingsValidator;
|
|
280
|
+
/** The digest the caller read the entry at. A write over a different current version is refused. */
|
|
281
|
+
expect?: string;
|
|
282
|
+
/** Build the line and check it, append nothing. */
|
|
283
|
+
dryRun?: boolean;
|
|
284
|
+
/** The clock. Default now. */
|
|
285
|
+
now?: () => Date;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/** One write's outcome. */
|
|
289
|
+
export interface ControlPutResult {
|
|
290
|
+
id: string;
|
|
291
|
+
/** created: a new entry. updated: a new version of the active one. unchanged: it already held these settings. retired: closed. */
|
|
292
|
+
status: "created" | "updated" | "unchanged" | "retired";
|
|
293
|
+
/** The version written, or the current one when unchanged. */
|
|
294
|
+
record?: ControlEntryRecord;
|
|
295
|
+
/** The ledger commit, when one was written. */
|
|
296
|
+
commit?: string;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
const same = (a: unknown, b: unknown): boolean => JSON.stringify(canonical(a)) === JSON.stringify(canonical(b));
|
|
300
|
+
|
|
301
|
+
function nextId(records: readonly ControlEntryRecord[]): string {
|
|
302
|
+
const n = records.reduce((max, r) => Math.max(max, Number(r.id.slice(CONTROL_ID_PREFIX.length + 1))), 0) + 1;
|
|
303
|
+
return `${CONTROL_ID_PREFIX}-${String(n).padStart(3, "0")}`;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
async function writeVersion(port: ControlLedgerPort, fields: Omit<ControlEntryRecord, "digest">, opts: ControlWriteOptions, message: string): Promise<{ record: ControlEntryRecord; commit?: string }> {
|
|
307
|
+
const record: ControlEntryRecord = { ...fields, digest: controlEntryDigest(fields) };
|
|
308
|
+
const problems = controlEntryRecordProblems(record);
|
|
309
|
+
if (problems.length > 0) throw new ControlRecordsError(`not a control entry: ${problems.join(", ")}`, problems);
|
|
310
|
+
if (opts.dryRun) return { record };
|
|
311
|
+
return { record, commit: await port.append(JSON.stringify(record), message) };
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* Creates the project's (or the defaults') entry, or writes a new version
|
|
316
|
+
* of the active one. With `expect`, a current version whose digest differs
|
|
317
|
+
* is refused ({@link ControlEntryConflict}). `estates` left out keeps the
|
|
318
|
+
* entry's.
|
|
319
|
+
*/
|
|
320
|
+
export async function putControlEntry(
|
|
321
|
+
port: ControlLedgerPort,
|
|
322
|
+
want: { entry: ControlEntryKind; project?: string; settings: Record<string, unknown>; estates?: string[] },
|
|
323
|
+
opts: ControlWriteOptions,
|
|
324
|
+
): Promise<ControlPutResult> {
|
|
325
|
+
if (want.entry === "project" && !want.project) throw new ControlRecordsError("a project entry needs the project's key");
|
|
326
|
+
if (want.entry === "defaults" && (want.project || want.estates?.length)) throw new ControlRecordsError("the defaults take no project key and own no estates");
|
|
327
|
+
if (want.entry === "project") parseProjectKey(want.project!);
|
|
328
|
+
const problems = opts.validate?.(want.entry, want.project, want.settings) ?? [];
|
|
329
|
+
if (problems.length > 0) throw new ControlRecordsError(`${want.project ?? "defaults"}: ${problems.join("; ")}`, problems);
|
|
330
|
+
const { records, malformed } = parseControlEntries(await port.read());
|
|
331
|
+
if (malformed.length > 0) throw new ControlRecordsError(`the control repo's entries have malformed lines (${malformed.map((m) => m.line).join(", ")}); fix them before writing`);
|
|
332
|
+
const { entries } = currentControlEntries(records);
|
|
333
|
+
const key = want.entry === "defaults" ? "defaults" : want.project!;
|
|
334
|
+
const current = entries.find((e) => (want.entry === "defaults" ? e.entry === "defaults" : e.project === want.project));
|
|
335
|
+
if (opts.expect !== undefined && opts.expect !== (current?.digest ?? "")) {
|
|
336
|
+
throw new ControlEntryConflict(`${key} changed since it was read (now ${current?.digest ?? "absent"}, read at ${opts.expect || "absent"}); read it again`);
|
|
337
|
+
}
|
|
338
|
+
const at = (opts.now ?? (() => new Date()))().toISOString();
|
|
339
|
+
const base = { version: 1 as const, kind: CONTROL_ENTRY_KIND as typeof CONTROL_ENTRY_KIND, product: opts.product, at, ...(opts.by !== undefined ? { by: opts.by } : {}) };
|
|
340
|
+
if (!current) {
|
|
341
|
+
const out = await writeVersion(
|
|
342
|
+
port,
|
|
343
|
+
{ ...base, id: nextId(records), entry: want.entry, project: want.project ?? null, state: "active", settings: want.settings, estates: want.estates ?? [], prev: null },
|
|
344
|
+
opts,
|
|
345
|
+
`Control entry ${key} created`,
|
|
346
|
+
);
|
|
347
|
+
return { id: out.record.id, status: "created", ...out };
|
|
348
|
+
}
|
|
349
|
+
const estates = want.estates ?? current.estates;
|
|
350
|
+
if (same(current.settings, want.settings) && same(current.estates, estates)) return { id: current.id, status: "unchanged" };
|
|
351
|
+
const out = await writeVersion(
|
|
352
|
+
port,
|
|
353
|
+
{ ...base, id: current.id, entry: current.entry, project: current.project ?? null, state: "active", settings: want.settings, estates, prev: current.digest },
|
|
354
|
+
opts,
|
|
355
|
+
`Control entry ${key} updated`,
|
|
356
|
+
);
|
|
357
|
+
return { id: current.id, status: "updated", ...out };
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
/** Retires a project's active entry: the closed state, so the project is no longer read. */
|
|
361
|
+
export async function retireControlEntry(port: ControlLedgerPort, project: string, opts: ControlWriteOptions): Promise<ControlPutResult> {
|
|
362
|
+
const { records } = parseControlEntries(await port.read());
|
|
363
|
+
const current = currentControlEntries(records).entries.find((e) => e.project === project);
|
|
364
|
+
if (!current) throw new ControlRecordsError(`no active entry for ${project} in the control repo`);
|
|
365
|
+
if (opts.expect !== undefined && opts.expect !== current.digest) throw new ControlEntryConflict(`${project} changed since it was read; read it again`);
|
|
366
|
+
const at = (opts.now ?? (() => new Date()))().toISOString();
|
|
367
|
+
const out = await writeVersion(
|
|
368
|
+
port,
|
|
369
|
+
{ version: 1, kind: CONTROL_ENTRY_KIND, id: current.id, entry: "project", project, state: "retired", settings: current.settings, estates: current.estates, product: opts.product, at, ...(opts.by !== undefined ? { by: opts.by } : {}), prev: current.digest },
|
|
370
|
+
opts,
|
|
371
|
+
`Control entry ${project} retired`,
|
|
372
|
+
);
|
|
373
|
+
return { id: current.id, status: "retired", ...out };
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
/**
|
|
377
|
+
* Writes a control config (the defaults and each project's settings) as
|
|
378
|
+
* entries: one per project and one for the defaults. Moves a control repo
|
|
379
|
+
* off a config file, or off terragucci's record files, onto the ledger.
|
|
380
|
+
*/
|
|
381
|
+
export async function importControlConfig(
|
|
382
|
+
port: ControlLedgerPort,
|
|
383
|
+
config: { defaults?: Record<string, unknown>; projects: Record<string, Record<string, unknown>>; estates?: Record<string, string[]> },
|
|
384
|
+
opts: ControlWriteOptions,
|
|
385
|
+
): Promise<Array<ControlPutResult & { entry: string }>> {
|
|
386
|
+
if (Object.keys(config.projects).length === 0) throw new ControlRecordsError("only a control repo's config, which lists projects, becomes entries");
|
|
387
|
+
const out: Array<ControlPutResult & { entry: string }> = [];
|
|
388
|
+
const { expect: _one, ...each } = opts;
|
|
389
|
+
if (config.defaults) out.push({ entry: "defaults", ...(await putControlEntry(port, { entry: "defaults", settings: config.defaults }, each)) });
|
|
390
|
+
for (const [project, settings] of Object.entries(config.projects)) {
|
|
391
|
+
const estates = config.estates?.[project];
|
|
392
|
+
out.push({ entry: project, ...(await putControlEntry(port, { entry: "project", project, settings, ...(estates ? { estates } : {}) }, each)) });
|
|
393
|
+
}
|
|
394
|
+
return out;
|
|
395
|
+
}
|
|
@@ -4,6 +4,7 @@ import { createRequire } from "node:module";
|
|
|
4
4
|
import { tmpdir } from "node:os";
|
|
5
5
|
import { dirname, join, resolve as resolvePath } from "node:path";
|
|
6
6
|
import { SOURCE_EXPORT_CONDITIONS } from "../../module-source";
|
|
7
|
+
import { chantPackageSourceTarget } from "../../ts-loader";
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* chant #1045 Phase 2 — bundles the generated sandbox driver (`./driver.ts`)
|
|
@@ -185,6 +186,29 @@ function externalTrustedPackagesPlugin(): { plugin: esbuild.Plugin; readPaths: s
|
|
|
185
186
|
return { plugin, readPaths };
|
|
186
187
|
}
|
|
187
188
|
|
|
189
|
+
/**
|
|
190
|
+
* chant#4591: chant core's exports give an ESM import its compiled
|
|
191
|
+
* `dist/*.js` (the `import` condition), so a product can load the installed
|
|
192
|
+
* chant under plain Node. esbuild always matches `import`. The driver names
|
|
193
|
+
* chant's own modules by their `src/*.ts` path (`chantSourceDir`), so a
|
|
194
|
+
* project's or a compiled lexicon's import of `@intentius/chant` has to land
|
|
195
|
+
* on that same source, or the bundle carries a second copy of core with its
|
|
196
|
+
* own registries and classes. Lexicons are left alone: they bundle from the
|
|
197
|
+
* `dist/*.js` they ship, as before.
|
|
198
|
+
*/
|
|
199
|
+
function chantCoreSourcePlugin(): esbuild.Plugin {
|
|
200
|
+
return {
|
|
201
|
+
name: "chant-sandbox-core-source",
|
|
202
|
+
setup(build) {
|
|
203
|
+
build.onResolve({ filter: /^@intentius\/chant(?:\/.*)?$/ }, (args) => {
|
|
204
|
+
if (!args.importer) return undefined;
|
|
205
|
+
const target = chantPackageSourceTarget(args.path, args.importer);
|
|
206
|
+
return target === undefined ? undefined : { path: target };
|
|
207
|
+
});
|
|
208
|
+
},
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
|
|
188
212
|
export interface BundleResult {
|
|
189
213
|
/** Absolute, REALPATH'd path to the bundled entry file — this and {@link bundleDir} are what the caller grants `--allow-fs-read` to. macOS's `/tmp` is a symlink to `/private/tmp`; an un-canonicalized path here would silently fail to match Node's own (already-canonicalized) permission check. */
|
|
190
214
|
bundlePath: string;
|
|
@@ -225,7 +249,7 @@ export async function bundleDriver(driverSource: string): Promise<BundleResult>
|
|
|
225
249
|
// Setting `conditions` replaces esbuild's default ["module"], so it is
|
|
226
250
|
// kept, and compiled the option is left out as before.
|
|
227
251
|
...(SOURCE_EXPORT_CONDITIONS.length > 0 ? { conditions: ["module", ...SOURCE_EXPORT_CONDITIONS] } : {}),
|
|
228
|
-
plugins: [plugin],
|
|
252
|
+
plugins: [chantCoreSourcePlugin(), plugin],
|
|
229
253
|
});
|
|
230
254
|
} catch (err) {
|
|
231
255
|
rmSync(bundleDir, { recursive: true, force: true });
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The e2e harness's compose project (chant#4587), the whole stack:
|
|
3
|
+
* floci, Forgejo and forgejo-runner with the docker executor on one network,
|
|
4
|
+
* and the sql emulator's ClickHouse and Postgres behind the `sql` profile.
|
|
5
|
+
* The services are ../../stack.ts's, and every image is ../../pins.ts's.
|
|
6
|
+
*
|
|
7
|
+
* The project name comes from CHANT_E2E_PROJECT at build time (default
|
|
8
|
+
* chant-e2e) and names the network, the containers and the volumes; pass the
|
|
9
|
+
* same name to `docker compose -p`. Host ports bind to 127.0.0.1 and move
|
|
10
|
+
* with CHANT_E2E_FLOCI_PORT, CHANT_E2E_FORGEJO_PORT, CHANT_E2E_CLICKHOUSE_PORT
|
|
11
|
+
* and CHANT_E2E_POSTGRES_PORT.
|
|
12
|
+
*
|
|
13
|
+
* chant build <this dir>/src --lexicon docker -o compose.yaml
|
|
14
|
+
* docker compose -p chant-e2e -f compose.yaml up -d
|
|
15
|
+
* docker compose -p chant-e2e -f compose.yaml --profile sql up -d
|
|
16
|
+
*
|
|
17
|
+
* A product with its own words or ports writes the same few lines with its
|
|
18
|
+
* own options to harnessStack.
|
|
19
|
+
*/
|
|
20
|
+
import { Network, Service, Volume } from "@intentius/chant-lexicon-docker";
|
|
21
|
+
import { harnessStack } from "../../stack";
|
|
22
|
+
|
|
23
|
+
const h = harnessStack({ project: process.env.CHANT_E2E_PROJECT ?? "chant-e2e" });
|
|
24
|
+
|
|
25
|
+
export const harness = new Network(h.network);
|
|
26
|
+
export const forgejoData = new Volume(h.volumes.forgejoData);
|
|
27
|
+
export const runnerData = new Volume(h.volumes.runnerData);
|
|
28
|
+
|
|
29
|
+
export const floci = new Service(h.services.floci);
|
|
30
|
+
export const forgejo = new Service(h.services.forgejo);
|
|
31
|
+
export const forgejoRunner = new Service(h.services.forgejoRunner);
|
|
32
|
+
export const clickhouse = new Service(h.services.clickhouse);
|
|
33
|
+
export const postgres = new Service(h.services.postgres);
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A bucket, for real: one bucket in the harness's floci, path-style S3 over
|
|
3
|
+
* http (chant#4587, from the fan-out demo's lib/bucket.ts). floci takes
|
|
4
|
+
* unsigned requests, so the driver needs no AWS CLI on the host. chant's
|
|
5
|
+
* reports under `--report-url` are read from here.
|
|
6
|
+
*/
|
|
7
|
+
import type { Bucket } from "./ports";
|
|
8
|
+
|
|
9
|
+
const TIMEOUT_MS = 30_000;
|
|
10
|
+
|
|
11
|
+
export class FlociBucket implements Bucket {
|
|
12
|
+
/** `endpoint` is floci as the driver reaches it, http://localhost:<port>. */
|
|
13
|
+
constructor(
|
|
14
|
+
private readonly endpoint: string,
|
|
15
|
+
private readonly bucket: string,
|
|
16
|
+
) {}
|
|
17
|
+
|
|
18
|
+
private url(key = ""): string {
|
|
19
|
+
return `${this.endpoint.replace(/\/$/, "")}/${this.bucket}${key ? `/${key.split("/").map(encodeURIComponent).join("/")}` : ""}`;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** The bucket itself. An existing one is kept. */
|
|
23
|
+
async create(): Promise<void> {
|
|
24
|
+
const res = await fetch(this.url(), { method: "PUT", signal: AbortSignal.timeout(TIMEOUT_MS) });
|
|
25
|
+
if (!res.ok && res.status !== 409) throw new Error(`floci PUT ${this.bucket} answered ${res.status}`);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
async get(key: string): Promise<string | null> {
|
|
29
|
+
const res = await fetch(this.url(key), { signal: AbortSignal.timeout(TIMEOUT_MS) });
|
|
30
|
+
if (res.status === 404 || res.status === 403) return null;
|
|
31
|
+
if (!res.ok) throw new Error(`floci GET ${key} answered ${res.status}`);
|
|
32
|
+
return res.text();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async put(key: string, body: string, contentType: string): Promise<void> {
|
|
36
|
+
const res = await fetch(this.url(key), {
|
|
37
|
+
method: "PUT",
|
|
38
|
+
headers: { "content-type": contentType },
|
|
39
|
+
body,
|
|
40
|
+
signal: AbortSignal.timeout(TIMEOUT_MS),
|
|
41
|
+
});
|
|
42
|
+
if (!res.ok) throw new Error(`floci PUT ${key} answered ${res.status}`);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
async list(prefix: string): Promise<string[]> {
|
|
46
|
+
const keys: string[] = [];
|
|
47
|
+
let token: string | undefined;
|
|
48
|
+
for (;;) {
|
|
49
|
+
const q = new URLSearchParams({ "list-type": "2", prefix, ...(token ? { "continuation-token": token } : {}) });
|
|
50
|
+
const res = await fetch(`${this.url()}?${q.toString()}`, { signal: AbortSignal.timeout(TIMEOUT_MS) });
|
|
51
|
+
if (!res.ok) throw new Error(`floci list ${prefix} answered ${res.status}`);
|
|
52
|
+
const xml = await res.text();
|
|
53
|
+
for (const m of xml.matchAll(/<Key>([^<]*)<\/Key>/g)) keys.push(decodeXml(m[1]!));
|
|
54
|
+
const next = /<NextContinuationToken>([^<]*)<\/NextContinuationToken>/.exec(xml)?.[1];
|
|
55
|
+
if (!next || !/<IsTruncated>true<\/IsTruncated>/.test(xml)) break;
|
|
56
|
+
token = decodeXml(next);
|
|
57
|
+
}
|
|
58
|
+
return keys;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
async delete(key: string): Promise<void> {
|
|
62
|
+
const res = await fetch(this.url(key), { method: "DELETE", signal: AbortSignal.timeout(TIMEOUT_MS) });
|
|
63
|
+
if (!res.ok && res.status !== 404) throw new Error(`floci DELETE ${key} answered ${res.status}`);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function decodeXml(s: string): string {
|
|
68
|
+
return s.replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'").replace(/&/g, "&");
|
|
69
|
+
}
|