@intentius/chant 0.124.87 → 0.124.89
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/action-pins.d.ts +1 -0
- package/dist/action-pins.d.ts.map +1 -1
- package/dist/action-pins.js +2 -0
- package/dist/actor.d.ts +47 -0
- package/dist/actor.d.ts.map +1 -0
- package/dist/actor.js +56 -0
- package/dist/bundle-check.d.ts +20 -5
- package/dist/bundle-check.d.ts.map +1 -1
- package/dist/bundle-check.js +20 -5
- package/dist/chant-install.d.ts +98 -0
- package/dist/chant-install.d.ts.map +1 -1
- package/dist/chant-install.js +203 -2
- package/dist/ci-base.d.ts +30 -0
- package/dist/ci-base.d.ts.map +1 -0
- package/dist/ci-base.js +33 -0
- package/dist/ci-comment-commands.d.ts +177 -0
- package/dist/ci-comment-commands.d.ts.map +1 -0
- package/dist/ci-comment-commands.js +325 -0
- package/dist/ci-comment-replies.d.ts +40 -0
- package/dist/ci-comment-replies.d.ts.map +1 -0
- package/dist/ci-comment-replies.js +59 -0
- package/dist/ci-commit.d.ts +1 -1
- package/dist/ci-commit.d.ts.map +1 -1
- package/dist/ci-commit.js +1 -2
- package/dist/ci-control.d.ts +1 -1
- package/dist/ci-control.d.ts.map +1 -1
- package/dist/ci-control.js +1 -1
- package/dist/ci-evidence-claims.d.ts +59 -0
- package/dist/ci-evidence-claims.d.ts.map +1 -0
- package/dist/ci-evidence-claims.js +87 -0
- package/dist/ci-evidence-from-job.d.ts +128 -0
- package/dist/ci-evidence-from-job.d.ts.map +1 -0
- package/dist/ci-evidence-from-job.js +203 -0
- package/dist/ci-evidence-jobs.d.ts +68 -4
- package/dist/ci-evidence-jobs.d.ts.map +1 -1
- package/dist/ci-evidence-jobs.js +82 -5
- package/dist/ci-handover.d.ts +12 -0
- package/dist/ci-handover.d.ts.map +1 -1
- package/dist/ci-handover.js +15 -3
- package/dist/ci-identity.d.ts +32 -6
- package/dist/ci-identity.d.ts.map +1 -1
- package/dist/ci-identity.js +40 -8
- package/dist/ci-image.d.ts +65 -10
- package/dist/ci-image.d.ts.map +1 -1
- package/dist/ci-image.js +101 -22
- package/dist/ci-jobs.d.ts +1 -1
- package/dist/ci-jobs.d.ts.map +1 -1
- package/dist/ci-jobs.js +7 -2
- package/dist/ci-login.d.ts +75 -13
- package/dist/ci-login.d.ts.map +1 -1
- package/dist/ci-login.js +89 -37
- package/dist/ci-note-commands.d.ts +63 -3
- package/dist/ci-note-commands.d.ts.map +1 -1
- package/dist/ci-note-commands.js +69 -35
- package/dist/ci-product-words.d.ts +62 -1
- package/dist/ci-product-words.d.ts.map +1 -1
- package/dist/ci-product-words.js +52 -1
- package/dist/ci-product.d.ts +52 -2
- package/dist/ci-product.d.ts.map +1 -1
- package/dist/ci-product.js +51 -2
- package/dist/cli/commands/build.d.ts.map +1 -1
- package/dist/cli/commands/build.js +29 -2
- package/dist/cli/handlers/approve-confirm.d.ts +14 -0
- package/dist/cli/handlers/approve-confirm.d.ts.map +1 -1
- package/dist/cli/handlers/approve-confirm.js +46 -0
- package/dist/cli/handlers/approve.d.ts.map +1 -1
- package/dist/cli/handlers/approve.js +2 -1
- package/dist/cli/handlers/build.d.ts +1 -1
- package/dist/cli/handlers/build.d.ts.map +1 -1
- package/dist/cli/handlers/build.js +22 -1
- package/dist/cli/handlers/ci-check.d.ts +1 -1
- package/dist/cli/handlers/ci-check.d.ts.map +1 -1
- package/dist/cli/handlers/ci-check.js +37 -7
- package/dist/cli/handlers/ci-evidence.d.ts.map +1 -1
- package/dist/cli/handlers/ci-evidence.js +255 -20
- package/dist/cli/handlers/ci-forge-check.d.ts.map +1 -1
- package/dist/cli/handlers/ci-forge-check.js +34 -17
- package/dist/cli/handlers/components.d.ts.map +1 -1
- package/dist/cli/handlers/components.js +3 -1
- package/dist/cli/handlers/generated-check.d.ts +11 -0
- package/dist/cli/handlers/generated-check.d.ts.map +1 -0
- package/dist/cli/handlers/generated-check.js +71 -0
- package/dist/cli/handlers/lifecycle.d.ts.map +1 -1
- package/dist/cli/handlers/lifecycle.js +3 -0
- package/dist/cli/handlers/local-chant.d.ts +13 -0
- package/dist/cli/handlers/local-chant.d.ts.map +1 -1
- package/dist/cli/handlers/local-chant.js +42 -1
- package/dist/cli/handlers/lock.d.ts.map +1 -1
- package/dist/cli/handlers/lock.js +121 -4
- package/dist/cli/handlers/pr-comment.d.ts +21 -0
- package/dist/cli/handlers/pr-comment.d.ts.map +1 -0
- package/dist/cli/handlers/pr-comment.js +112 -0
- package/dist/cli/handlers/pr-env.d.ts.map +1 -1
- package/dist/cli/handlers/pr-env.js +6 -3
- package/dist/cli/handlers/pr.d.ts +23 -1
- package/dist/cli/handlers/pr.d.ts.map +1 -1
- package/dist/cli/handlers/pr.js +97 -14
- package/dist/cli/handlers/promote.d.ts.map +1 -1
- package/dist/cli/handlers/promote.js +2 -1
- package/dist/cli/handlers/release.d.ts.map +1 -1
- package/dist/cli/handlers/release.js +11 -2
- package/dist/cli/handlers/run-wave.d.ts.map +1 -1
- package/dist/cli/handlers/run-wave.js +36 -2
- package/dist/cli/handlers/run.d.ts.map +1 -1
- package/dist/cli/handlers/run.js +2 -1
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +60 -4
- package/dist/cli/parse-args.d.ts.map +1 -1
- package/dist/cli/parse-args.js +82 -0
- package/dist/cli/registry.d.ts +35 -0
- package/dist/cli/registry.d.ts.map +1 -1
- package/dist/components/auto-release.d.ts.map +1 -1
- package/dist/components/auto-release.js +2 -1
- package/dist/components/check-hooks.d.ts +10 -0
- package/dist/components/check-hooks.d.ts.map +1 -1
- package/dist/components/check-hooks.js +18 -0
- package/dist/components/pr-checks.d.ts +169 -0
- package/dist/components/pr-checks.d.ts.map +1 -0
- package/dist/components/pr-checks.js +180 -0
- package/dist/components/pr-pipeline.d.ts +38 -0
- package/dist/components/pr-pipeline.d.ts.map +1 -1
- package/dist/components/pr-pipeline.js +6 -1
- package/dist/components/product-pipeline.d.ts +58 -2
- package/dist/components/product-pipeline.d.ts.map +1 -1
- package/dist/components/product-pipeline.js +76 -9
- package/dist/components/product-plan.d.ts +445 -7
- package/dist/components/product-plan.d.ts.map +1 -1
- package/dist/components/product-plan.js +426 -15
- package/dist/config.d.ts +10 -6
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +11 -6
- package/dist/control/consumers.d.ts +6 -0
- package/dist/control/consumers.d.ts.map +1 -1
- package/dist/control/consumers.js +6 -0
- package/dist/dead-guards.d.ts.map +1 -1
- package/dist/dead-guards.js +9 -6
- package/dist/discovery/files.d.ts +1 -1
- package/dist/discovery/files.js +1 -1
- package/dist/drift-issue.d.ts +20 -3
- package/dist/drift-issue.d.ts.map +1 -1
- package/dist/drift-issue.js +16 -0
- package/dist/drift-record.d.ts +52 -5
- package/dist/drift-record.d.ts.map +1 -1
- package/dist/drift-record.js +46 -6
- package/dist/floor-table.d.ts +6 -6
- package/dist/floor-table.d.ts.map +1 -1
- package/dist/floor-table.data.d.ts.map +1 -1
- package/dist/floor-table.data.js +81 -21
- package/dist/floor-table.js +10 -7
- package/dist/forge-check/contract.d.ts +19 -1
- package/dist/forge-check/contract.d.ts.map +1 -1
- package/dist/forge-check/contract.js +8 -2
- package/dist/forge-check/index.d.ts +4 -0
- package/dist/forge-check/index.d.ts.map +1 -1
- package/dist/forge-check/index.js +4 -0
- package/dist/forge-flags.d.ts +10 -0
- package/dist/forge-flags.d.ts.map +1 -1
- package/dist/forge-flags.js +31 -0
- package/dist/forge-remote.d.ts +47 -0
- package/dist/forge-remote.d.ts.map +1 -0
- package/dist/forge-remote.js +69 -0
- package/dist/gate-resume-run.d.ts +9 -1
- package/dist/gate-resume-run.d.ts.map +1 -1
- package/dist/gate-resume-run.js +26 -3
- package/dist/generated-check.d.ts +88 -0
- package/dist/generated-check.d.ts.map +1 -0
- package/dist/generated-check.js +248 -0
- package/dist/image-pins.d.ts +26 -0
- package/dist/image-pins.d.ts.map +1 -0
- package/dist/image-pins.js +19 -0
- package/dist/lexicon.d.ts +27 -0
- package/dist/lexicon.d.ts.map +1 -1
- package/dist/lifecycle/git.d.ts +11 -0
- package/dist/lifecycle/git.d.ts.map +1 -1
- package/dist/lifecycle/git.js +30 -3
- package/dist/lifecycle/publish-npm.d.ts +26 -0
- package/dist/lifecycle/publish-npm.d.ts.map +1 -1
- package/dist/lifecycle/publish-npm.js +76 -4
- package/dist/lifecycle/reach-locks.d.ts +131 -0
- package/dist/lifecycle/reach-locks.d.ts.map +1 -0
- package/dist/lifecycle/reach-locks.js +118 -0
- package/dist/lifecycle/release-cut.d.ts +3 -1
- package/dist/lifecycle/release-cut.d.ts.map +1 -1
- package/dist/lifecycle/release-cut.js +15 -0
- package/dist/lifecycle/release-images.d.ts +22 -1
- package/dist/lifecycle/release-images.d.ts.map +1 -1
- package/dist/lifecycle/release-images.js +26 -3
- package/dist/lifecycle/release-ledger.d.ts +4 -3
- package/dist/lifecycle/release-ledger.d.ts.map +1 -1
- package/dist/lifecycle/release-ledger.js +3 -2
- package/dist/local-chant.d.ts +57 -3
- package/dist/local-chant.d.ts.map +1 -1
- package/dist/local-chant.js +122 -13
- package/dist/notify-product.d.ts +12 -3
- package/dist/notify-product.d.ts.map +1 -1
- package/dist/notify-product.js +10 -6
- package/dist/op/activities/source-release.d.ts.map +1 -1
- package/dist/op/activities/source-release.js +2 -1
- package/dist/op/activities/source-rollback.d.ts.map +1 -1
- package/dist/op/activities/source-rollback.js +2 -1
- package/dist/op/index.d.ts +2 -0
- package/dist/op/index.d.ts.map +1 -1
- package/dist/op/index.js +1 -0
- package/dist/op/op-waves-evidence-jobs.d.ts +97 -0
- package/dist/op/op-waves-evidence-jobs.d.ts.map +1 -0
- package/dist/op/op-waves-evidence-jobs.js +118 -0
- package/dist/op/op-waves-evidence.d.ts +12 -1
- package/dist/op/op-waves-evidence.d.ts.map +1 -1
- package/dist/op/op-waves-evidence.js +23 -2
- package/dist/op/op-waves-render-spec.d.ts +100 -0
- package/dist/op/op-waves-render-spec.d.ts.map +1 -0
- package/dist/op/op-waves-render-spec.js +162 -0
- package/dist/op/op-waves-run.d.ts +14 -1
- package/dist/op/op-waves-run.d.ts.map +1 -1
- package/dist/op/op-waves-run.js +56 -4
- package/dist/op/op-waves.d.ts +12 -0
- package/dist/op/op-waves.d.ts.map +1 -1
- package/dist/op/op-waves.js +14 -1
- package/dist/op/schedule-overdue.d.ts +39 -2
- package/dist/op/schedule-overdue.d.ts.map +1 -1
- package/dist/op/schedule-overdue.js +148 -10
- package/dist/op/wave-stop.d.ts +64 -0
- package/dist/op/wave-stop.d.ts.map +1 -0
- package/dist/op/wave-stop.js +127 -0
- package/dist/planned-files.d.ts +76 -0
- package/dist/planned-files.d.ts.map +1 -0
- package/dist/planned-files.js +108 -0
- package/dist/pr-forge-job.d.ts +22 -0
- package/dist/pr-forge-job.d.ts.map +1 -0
- package/dist/pr-forge-job.js +46 -0
- package/dist/pr-forge-reads.d.ts +21 -1
- package/dist/pr-forge-reads.d.ts.map +1 -1
- package/dist/pr-forge-reads.js +19 -1
- package/dist/pr-forge.d.ts +7 -1
- package/dist/pr-forge.d.ts.map +1 -1
- package/dist/pr-forge.js +7 -2
- package/dist/pr-loop.d.ts +3 -6
- package/dist/pr-loop.d.ts.map +1 -1
- package/dist/pr-loop.js +4 -81
- package/dist/pr-plan-note.d.ts +121 -0
- package/dist/pr-plan-note.d.ts.map +1 -1
- package/dist/pr-plan-note.js +104 -1
- package/dist/pr-plan-record.d.ts +47 -0
- package/dist/pr-plan-record.d.ts.map +1 -0
- package/dist/pr-plan-record.js +89 -0
- package/dist/pr-post.d.ts +68 -3
- package/dist/pr-post.d.ts.map +1 -1
- package/dist/pr-post.js +218 -13
- package/dist/pr-requires.d.ts +8 -0
- package/dist/pr-requires.d.ts.map +1 -1
- package/dist/pr-requires.js +3 -1
- package/dist/pr-status.d.ts +16 -0
- package/dist/pr-status.d.ts.map +1 -0
- package/dist/pr-status.js +90 -0
- package/dist/ref-gate-init.d.ts +90 -0
- package/dist/ref-gate-init.d.ts.map +1 -0
- package/dist/ref-gate-init.js +155 -0
- package/dist/ref-gate-rules.d.ts +19 -0
- package/dist/ref-gate-rules.d.ts.map +1 -0
- package/dist/ref-gate-rules.js +17 -0
- package/dist/release-floors.d.ts +100 -16
- package/dist/release-floors.d.ts.map +1 -1
- package/dist/release-floors.js +101 -17
- package/dist/render-module.d.ts +15 -0
- package/dist/render-module.d.ts.map +1 -0
- package/dist/render-module.js +73 -0
- package/dist/state-migration.d.ts +24 -1
- package/dist/state-migration.d.ts.map +1 -1
- package/dist/state-migration.js +39 -4
- package/dist/state-unlock.d.ts +32 -1
- package/dist/state-unlock.d.ts.map +1 -1
- package/dist/state-unlock.js +31 -0
- package/dist/wave-runtime.mjs +307 -297
- package/dist/workspace/ci-green-cli.d.ts.map +1 -1
- package/dist/workspace/ci-green-cli.js +15 -8
- package/dist/workspace/drift-cli.d.ts +1 -1
- package/dist/workspace/drift-cli.d.ts.map +1 -1
- package/dist/workspace/drift-cli.js +5 -12
- package/dist/workspace/forge-work.d.ts +3 -2
- package/dist/workspace/forge-work.d.ts.map +1 -1
- package/dist/workspace/forge-work.js +7 -17
- package/dist/workspace/lexicon-outputs.js +2 -2
- package/dist/workspace/release-train.d.ts.map +1 -1
- package/dist/workspace/release-train.js +2 -1
- package/dist/workspace/release-workflow.d.ts +27 -3
- package/dist/workspace/release-workflow.d.ts.map +1 -1
- package/dist/workspace/release-workflow.js +52 -7
- package/dist/workspace/trust/check-evidence-report.d.ts +25 -2
- package/dist/workspace/trust/check-evidence-report.d.ts.map +1 -1
- package/dist/workspace/trust/check-evidence-report.js +28 -8
- package/dist/workspace/trust/check-evidence.d.ts +13 -1
- package/dist/workspace/trust/check-evidence.d.ts.map +1 -1
- package/dist/workspace/trust/check-evidence.js +8 -3
- package/dist/workspace/trust/evidence.d.ts +5 -0
- package/dist/workspace/trust/evidence.d.ts.map +1 -1
- package/dist/workspace/trust/evidence.js +5 -0
- package/dist/workspace/trust/open-evidence.d.ts +67 -0
- package/dist/workspace/trust/open-evidence.d.ts.map +1 -0
- package/dist/workspace/trust/open-evidence.js +92 -0
- package/dist/workspace/trust/ref-gate-cli.d.ts +10 -1
- package/dist/workspace/trust/ref-gate-cli.d.ts.map +1 -1
- package/dist/workspace/trust/ref-gate-cli.js +93 -11
- package/dist/workspace/trust/ref-gate.d.ts +61 -2
- package/dist/workspace/trust/ref-gate.d.ts.map +1 -1
- package/dist/workspace/trust/ref-gate.js +72 -7
- package/dist/workspace/workspace-run.d.ts.map +1 -1
- package/dist/workspace/workspace-run.js +2 -1
- package/package.json +1 -1
- package/src/action-pins.ts +2 -0
- package/src/actor.test.ts +78 -0
- package/src/actor.ts +79 -0
- package/src/bundle-check.test.ts +22 -0
- package/src/bundle-check.ts +33 -5
- package/src/chant-install.test.ts +108 -1
- package/src/chant-install.ts +242 -2
- package/src/ci-base.test.ts +41 -0
- package/src/ci-base.ts +43 -0
- package/src/ci-comment-commands.test.ts +376 -0
- package/src/ci-comment-commands.ts +389 -0
- package/src/ci-comment-replies.ts +78 -0
- package/src/ci-commit.test.ts +51 -6
- package/src/ci-commit.ts +1 -2
- package/src/ci-control.ts +1 -0
- package/src/ci-evidence-claims.ts +102 -0
- package/src/ci-evidence-from-job.test.ts +165 -0
- package/src/ci-evidence-from-job.ts +251 -0
- package/src/ci-evidence-jobs.ts +88 -6
- package/src/ci-handover.ts +16 -3
- package/src/ci-identity.test.ts +3 -3
- package/src/ci-identity.ts +51 -11
- package/src/ci-image.test.ts +187 -16
- package/src/ci-image.ts +157 -25
- package/src/ci-jobs.ts +7 -2
- package/src/ci-login.test.ts +131 -3
- package/src/ci-login.token-drop.test.ts +204 -0
- package/src/ci-login.ts +137 -39
- package/src/ci-note-commands.ts +104 -41
- package/src/ci-product-words.ts +89 -0
- package/src/ci-product.ts +62 -1
- package/src/cli/commands/__fixtures__/source-dir-root/migrations/0001-init/backfill.ts +3 -0
- package/src/cli/commands/build.test.ts +41 -0
- package/src/cli/commands/build.ts +27 -2
- package/src/cli/handlers/approve-confirm.test.ts +35 -0
- package/src/cli/handlers/approve-confirm.ts +44 -0
- package/src/cli/handlers/approve.ts +2 -1
- package/src/cli/handlers/build-source-dir.test.ts +4 -0
- package/src/cli/handlers/build.ts +20 -2
- package/src/cli/handlers/ci-check.ts +37 -7
- package/src/cli/handlers/ci-evidence-open.test.ts +164 -0
- package/src/cli/handlers/ci-evidence.ts +233 -18
- package/src/cli/handlers/ci-forge-check.ts +22 -9
- package/src/cli/handlers/components.ts +3 -1
- package/src/cli/handlers/generated-check.ts +69 -0
- package/src/cli/handlers/lifecycle.test.ts +20 -0
- package/src/cli/handlers/lifecycle.ts +4 -0
- package/src/cli/handlers/local-chant.ts +39 -1
- package/src/cli/handlers/lock-reach.test.ts +103 -0
- package/src/cli/handlers/lock.ts +100 -4
- package/src/cli/handlers/pr-comment.ts +104 -0
- package/src/cli/handlers/pr-env.ts +6 -3
- package/src/cli/handlers/pr-record.test.ts +1 -1
- package/src/cli/handlers/pr.ts +93 -15
- package/src/cli/handlers/promote.ts +2 -1
- package/src/cli/handlers/release.e2e.test.ts +35 -0
- package/src/cli/handlers/release.ts +14 -2
- package/src/cli/handlers/run-wave.ts +35 -2
- package/src/cli/handlers/run.ts +2 -1
- package/src/cli/main.ts +60 -4
- package/src/cli/parse-args.ts +58 -0
- package/src/cli/registry.ts +35 -0
- package/src/components/auto-release.ts +2 -1
- package/src/components/check-hooks.ts +22 -0
- package/src/components/check-report-summary.test.ts +78 -0
- package/src/components/pr-checks.ts +254 -0
- package/src/components/pr-pipeline.ts +43 -1
- package/src/components/product-pipeline.ts +113 -9
- package/src/components/product-plan.test.ts +140 -1
- package/src/components/product-plan.ts +707 -20
- package/src/config.ts +13 -8
- package/src/control/consumers.ts +7 -0
- package/src/dead-guards.test.ts +27 -5
- package/src/dead-guards.ts +9 -6
- package/src/discovery/files.ts +1 -1
- package/src/drift-issue.test.ts +29 -1
- package/src/drift-issue.ts +28 -3
- package/src/drift-record.test.ts +45 -0
- package/src/drift-record.ts +71 -6
- package/src/floor-table.data.ts +81 -21
- package/src/floor-table.ts +12 -9
- package/src/forge-check/contract.ts +23 -2
- package/src/forge-check/forge-check.test.ts +25 -0
- package/src/forge-check/index.ts +4 -0
- package/src/forge-flags.test.ts +25 -1
- package/src/forge-flags.ts +34 -0
- package/src/forge-remote.test.ts +37 -0
- package/src/forge-remote.ts +79 -0
- package/src/gate-resume-run.ts +27 -3
- package/src/generated-check.e2e.test.ts +118 -0
- package/src/generated-check.test.ts +170 -0
- package/src/generated-check.ts +310 -0
- package/src/image-pins.ts +31 -0
- package/src/lexicon.ts +28 -0
- package/src/lifecycle/git.test.ts +48 -0
- package/src/lifecycle/git.ts +27 -4
- package/src/lifecycle/publish-npm.ts +87 -4
- package/src/lifecycle/reach-locks.test.ts +87 -0
- package/src/lifecycle/reach-locks.ts +169 -0
- package/src/lifecycle/release-catalog.test.ts +2 -2
- package/src/lifecycle/release-cut.ts +17 -1
- package/src/lifecycle/release-images-dockerfile.test.ts +20 -0
- package/src/lifecycle/release-images.test.ts +100 -0
- package/src/lifecycle/release-images.ts +38 -3
- package/src/lifecycle/release-ledger.ts +4 -3
- package/src/local-chant.e2e.test.ts +81 -6
- package/src/local-chant.test.ts +22 -3
- package/src/local-chant.ts +130 -13
- package/src/notify-product.ts +19 -8
- package/src/op/activities/source-release.ts +2 -1
- package/src/op/activities/source-rollback.ts +2 -1
- package/src/op/gate-resume.test.ts +27 -0
- package/src/op/index.ts +10 -0
- package/src/op/op-waves-evidence-jobs.ts +140 -0
- package/src/op/op-waves-evidence.test.ts +36 -3
- package/src/op/op-waves-evidence.ts +23 -3
- package/src/op/op-waves-notify-words.test.ts +18 -0
- package/src/op/op-waves-render-spec.test.ts +160 -0
- package/src/op/op-waves-render-spec.ts +171 -0
- package/src/op/op-waves-run.ts +59 -3
- package/src/op/op-waves.ts +16 -2
- package/src/op/schedule-overdue.test.ts +126 -1
- package/src/op/schedule-overdue.ts +164 -12
- package/src/op/wave-stop.test.ts +72 -0
- package/src/op/wave-stop.ts +137 -0
- package/src/planned-files.test.ts +80 -0
- package/src/planned-files.ts +134 -0
- package/src/pr-forge-job.test.ts +53 -0
- package/src/pr-forge-job.ts +46 -0
- package/src/pr-forge-reads-compare.test.ts +2 -1
- package/src/pr-forge-reads.ts +37 -1
- package/src/pr-forge.ts +14 -3
- package/src/pr-loop-narrowed.test.ts +2 -1
- package/src/pr-loop-words.test.ts +2 -1
- package/src/pr-loop.test.ts +1 -2
- package/src/pr-loop.ts +4 -80
- package/src/pr-plan-note.ts +184 -3
- package/src/pr-plan-record.test.ts +75 -0
- package/src/pr-plan-record.ts +101 -0
- package/src/pr-post-plan-note.test.ts +60 -0
- package/src/pr-post-replan.test.ts +144 -0
- package/src/pr-post-subject.test.ts +230 -0
- package/src/pr-post.test.ts +32 -1
- package/src/pr-post.ts +254 -15
- package/src/pr-requires.test.ts +20 -0
- package/src/pr-requires.ts +10 -1
- package/src/pr-status.ts +91 -0
- package/src/ref-gate-init.ts +208 -0
- package/src/ref-gate-rules.ts +26 -0
- package/src/release-floors.ts +139 -17
- package/src/render-module.ts +73 -0
- package/src/state-migration-record.test.ts +89 -0
- package/src/state-migration.test.ts +1 -1
- package/src/state-migration.ts +52 -4
- package/src/state-unlock.test.ts +33 -1
- package/src/state-unlock.ts +49 -1
- package/src/workspace/ci-green-cli.ts +14 -7
- package/src/workspace/ci-green-workflow.test.ts +32 -1
- package/src/workspace/drift-cli.ts +6 -18
- package/src/workspace/forge-work.ts +7 -14
- package/src/workspace/lexicon-outputs.ts +2 -2
- package/src/workspace/release-train.ts +2 -1
- package/src/workspace/release-workflow.test.ts +104 -3
- package/src/workspace/release-workflow.ts +60 -9
- package/src/workspace/trust/check-evidence-report.ts +39 -8
- package/src/workspace/trust/check-evidence.test.ts +5 -0
- package/src/workspace/trust/check-evidence.ts +17 -5
- package/src/workspace/trust/evidence.ts +5 -0
- package/src/workspace/trust/open-evidence.ts +129 -0
- package/src/workspace/trust/ref-gate-cli.ts +88 -10
- package/src/workspace/trust/ref-gate-pieces.test.ts +220 -0
- package/src/workspace/trust/ref-gate.e2e.test.ts +17 -0
- package/src/workspace/trust/ref-gate.test.ts +10 -0
- package/src/workspace/trust/ref-gate.ts +87 -6
- package/src/workspace/workspace-run.ts +2 -1
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* #4979: `chant lock --reach` end to end, in a clone of a bare remote that
|
|
3
|
+
* holds a pull request's head at `refs/pull/<n>/head`: the head is fetched
|
|
4
|
+
* and checked, the reach line reads the change from git, and what it prints
|
|
5
|
+
* is locked on `chant/lifecycle` and pushed.
|
|
6
|
+
*/
|
|
7
|
+
import { execFileSync } from "node:child_process";
|
|
8
|
+
import { mkdirSync, mkdtempSync, realpathSync, writeFileSync } from "node:fs";
|
|
9
|
+
import { tmpdir } from "node:os";
|
|
10
|
+
import { join } from "node:path";
|
|
11
|
+
import { afterEach, describe, expect, test, vi } from "vitest";
|
|
12
|
+
import { commandRegistry, parseArgs } from "../main";
|
|
13
|
+
import { resolveCommand } from "../registry";
|
|
14
|
+
|
|
15
|
+
const home = process.cwd();
|
|
16
|
+
|
|
17
|
+
function git(cwd: string, ...args: string[]): string {
|
|
18
|
+
return execFileSync("git", args, { cwd, encoding: "utf-8", stdio: ["ignore", "pipe", "pipe"] }).trim();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** A bare remote with main and pull request 7's head, which changes envs/dev, and a clone of main. */
|
|
22
|
+
function world(): { clone: string; remote: string; base: string; head: string } {
|
|
23
|
+
const root = realpathSync(mkdtempSync(join(tmpdir(), "chant-lock-reach-")));
|
|
24
|
+
const remote = join(root, "remote.git");
|
|
25
|
+
git(root, "init", "-q", "--bare", "-b", "main", remote);
|
|
26
|
+
const work = join(root, "work");
|
|
27
|
+
mkdirSync(work);
|
|
28
|
+
git(work, "init", "-q", "-b", "main");
|
|
29
|
+
for (const [k, v] of [["user.email", "test@chant.dev"], ["user.name", "Test"], ["commit.gpgsign", "false"]]) git(work, "config", k!, v!);
|
|
30
|
+
mkdirSync(join(work, "envs", "dev"), { recursive: true });
|
|
31
|
+
mkdirSync(join(work, "envs", "prod"), { recursive: true });
|
|
32
|
+
writeFileSync(join(work, "envs", "dev", "main.tf"), "# dev\n");
|
|
33
|
+
writeFileSync(join(work, "envs", "prod", "main.tf"), "# prod\n");
|
|
34
|
+
git(work, "add", ".");
|
|
35
|
+
git(work, "commit", "-q", "-m", "init");
|
|
36
|
+
const base = git(work, "rev-parse", "HEAD");
|
|
37
|
+
git(work, "remote", "add", "origin", remote);
|
|
38
|
+
git(work, "push", "-q", "origin", "main");
|
|
39
|
+
writeFileSync(join(work, "envs", "dev", "main.tf"), "# dev, changed\n");
|
|
40
|
+
git(work, "commit", "-q", "-am", "change dev");
|
|
41
|
+
const head = git(work, "rev-parse", "HEAD");
|
|
42
|
+
git(work, "push", "-q", "origin", `${head}:refs/pull/7/head`);
|
|
43
|
+
const clone = join(root, "clone");
|
|
44
|
+
git(root, "clone", "-q", remote, clone);
|
|
45
|
+
for (const [k, v] of [["user.email", "test@chant.dev"], ["user.name", "Test"], ["commit.gpgsign", "false"]]) git(clone, "config", k!, v!);
|
|
46
|
+
return { clone, remote, base, head };
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
async function run(argv: string[], env: Record<string, string>): Promise<{ code: number; err: string }> {
|
|
50
|
+
let err = "";
|
|
51
|
+
vi.spyOn(console, "log").mockImplementation(() => undefined);
|
|
52
|
+
vi.spyOn(console, "error").mockImplementation((s) => void (err += String(s) + "\n"));
|
|
53
|
+
vi.spyOn(console, "warn").mockImplementation(() => undefined);
|
|
54
|
+
const saved = Object.fromEntries(Object.keys(env).map((k) => [k, process.env[k]]));
|
|
55
|
+
Object.assign(process.env, env);
|
|
56
|
+
try {
|
|
57
|
+
const args = parseArgs(argv);
|
|
58
|
+
const match = resolveCommand(args, commandRegistry);
|
|
59
|
+
const code = await match!.def.handler({ args, plugins: [], serializers: [] });
|
|
60
|
+
return { code: code ?? 0, err };
|
|
61
|
+
} finally {
|
|
62
|
+
for (const [k, v] of Object.entries(saved)) {
|
|
63
|
+
if (v === undefined) delete process.env[k];
|
|
64
|
+
else process.env[k] = v;
|
|
65
|
+
}
|
|
66
|
+
vi.restoreAllMocks();
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// The forge's API is a port nothing listens on: the status post is a warning, and no other holder needs asking.
|
|
71
|
+
const forgeEnv = { GITHUB_REPOSITORY: "acme/infra", GITHUB_TOKEN: "t", GITHUB_API_URL: "http://127.0.0.1:9", CHANT_LOCK_REACH: 'git diff --name-only "$BASE_SHA" "$HEAD_SHA" | cut -d/ -f1-2 | sort -u' };
|
|
72
|
+
|
|
73
|
+
afterEach(() => process.chdir(home));
|
|
74
|
+
|
|
75
|
+
describe("chant lock --reach (#4979)", () => {
|
|
76
|
+
test("locks what the reach line prints for the pull request's head, and pushes chant/lifecycle", async () => {
|
|
77
|
+
const w = world();
|
|
78
|
+
process.chdir(w.clone);
|
|
79
|
+
const got = await run(["lock", "--reach", "--pr", "7", "--head", w.head, "--base", w.base, "--stage", "plan", "--gate", "tf-apply", "--forge", "github"], forgeEnv);
|
|
80
|
+
expect(got.err).toMatch(/pull request 7 holds envs\/dev on tf-apply/);
|
|
81
|
+
expect(got.code).toBe(0);
|
|
82
|
+
const locks = JSON.parse(git(w.remote, "show", "chant/lifecycle:_locks/tf-apply.json")) as { locks: Record<string, { pr: number; stage: string; head: string }> };
|
|
83
|
+
expect(Object.keys(locks.locks)).toEqual(["envs/dev"]);
|
|
84
|
+
expect(locks.locks["envs/dev"]).toMatchObject({ pr: 7, stage: "plan", head: w.head });
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
test("a head that moved since the job started locks nothing, and the job passes", async () => {
|
|
88
|
+
const w = world();
|
|
89
|
+
process.chdir(w.clone);
|
|
90
|
+
const got = await run(["lock", "--reach", "--pr", "7", "--head", w.base, "--base", w.base, "--stage", "plan", "--forge", "github"], forgeEnv);
|
|
91
|
+
expect(got.code).toBe(0);
|
|
92
|
+
expect(got.err).toMatch(/pull request 7 moved to .*, so the run of that push locks it/);
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
test("is refused without the line, the forge, or the two commits", async () => {
|
|
96
|
+
const w = world();
|
|
97
|
+
process.chdir(w.clone);
|
|
98
|
+
expect((await run(["lock", "--reach", "--pr", "7", "--head", w.head, "--base", w.base, "--forge", "github"], { ...forgeEnv, CHANT_LOCK_REACH: "" })).err).toMatch(/CHANT_LOCK_REACH, which is not set/);
|
|
99
|
+
expect((await run(["lock", "--reach", "--pr", "7", "--head", w.head, "--base", w.base], forgeEnv)).err).toMatch(/give --forge github, gitlab or forgejo/);
|
|
100
|
+
expect((await run(["lock", "--reach", "--pr", "7", "--head", w.head, "--forge", "github"], forgeEnv)).err).toMatch(/from --base <sha> to --head <sha>/);
|
|
101
|
+
expect((await run(["lock", "--reach", "envs/dev", "--pr", "7", "--head", w.head, "--base", w.base, "--forge", "github"], forgeEnv)).err).toMatch(/drop the names/);
|
|
102
|
+
});
|
|
103
|
+
});
|
package/src/cli/handlers/lock.ts
CHANGED
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
* chant lock <target>... --pr <n> [--stage plan|apply|lock] [--head <sha>] [--by <who>] [--gate <name>] [--forge <kind>] [--json]
|
|
7
7
|
* chant lock --from-report <pr-plan.json> --pr <n> [--stage plan] [--forge <kind>] [--json]
|
|
8
8
|
* chant lock --keep --pr <n> [--head <sha>] [--gate <name>] [--forge <kind>] [--json]
|
|
9
|
+
* chant lock --reach --pr <n> --head <sha> --base <sha> --forge <kind> [--stage plan|apply|lock] [--gate <name>] [--json]
|
|
10
|
+
* chant lock --reach --open --base <sha> --forge gitlab [--branch <name>] [--stage plan] [--gate <name>] [--json]
|
|
9
11
|
* chant lock --list [--gate <name>] [--json]
|
|
10
12
|
* chant lock --alive <run>
|
|
11
13
|
* chant unlock --pr <n> [<target>...] [--gate <name>] [--json]
|
|
@@ -20,6 +22,13 @@
|
|
|
20
22
|
* a member is on the resource lock grain (#4552) the report carries
|
|
21
23
|
* `lockTargets`, its row keys, and those are locked instead.
|
|
22
24
|
*
|
|
25
|
+
* `--reach` (#4979) locks what a change reaches by the pipeline's reach line
|
|
26
|
+
* in `CHANT_LOCK_REACH`, which prints target names one a line from the
|
|
27
|
+
* change's files read as data (../../lifecycle/reach-locks.ts). chant first
|
|
28
|
+
* fetches the pull request's head and checks it is `--head`. With `--open`
|
|
29
|
+
* (GitLab's plan notes pipeline) every open merge request into the branch is
|
|
30
|
+
* locked, and a holder that is no longer open releases its locks.
|
|
31
|
+
*
|
|
23
32
|
* `--list` prints the target locks, then the apply rows of the gate's rows
|
|
24
33
|
* file (#4552, #4594), each with the run that holds it and when it took it.
|
|
25
34
|
*
|
|
@@ -53,8 +62,11 @@ import { CHANT_EXIT } from "../../exit-codes";
|
|
|
53
62
|
import { resolve } from "node:path";
|
|
54
63
|
import type { CommandContext } from "../registry";
|
|
55
64
|
import { formatError, formatInfo, formatSuccess, formatWarning } from "../format";
|
|
56
|
-
import { FORGE_KINDS,
|
|
65
|
+
import { FORGE_KINDS, type ForgeKind, type PrForge } from "../../pr-forge";
|
|
66
|
+
// #4964: a status for a pull_request run's merge preview goes on the pull request's head.
|
|
67
|
+
import { forgeFromJobEnv } from "../../pr-forge-job";
|
|
57
68
|
import { PR_APPLY_GATE } from "../../pr-loop";
|
|
69
|
+
import { actorFromEnv } from "../../actor";
|
|
58
70
|
import {
|
|
59
71
|
describeHeldTargetLocks,
|
|
60
72
|
readTargetLocks,
|
|
@@ -65,6 +77,7 @@ import {
|
|
|
65
77
|
TARGET_LOCK_STAGES,
|
|
66
78
|
type TargetLockStage,
|
|
67
79
|
} from "../../lifecycle/target-lock";
|
|
80
|
+
import { LOCK_REACH_ENV, reachedTargets, reachOpen } from "../../lifecycle/reach-locks";
|
|
68
81
|
|
|
69
82
|
/** The exit for a target another open pull request holds: `CHANT_EXIT.held`, 5 (#4553). */
|
|
70
83
|
const HELD_EXIT_CODE = CHANT_EXIT.held;
|
|
@@ -93,7 +106,7 @@ function forgeOf(ctx: CommandContext): PrForge | undefined | { error: string } {
|
|
|
93
106
|
if (kind === undefined) return undefined;
|
|
94
107
|
if (!(FORGE_KINDS as readonly string[]).includes(kind)) return { error: `--forge ${kind} is not one of ${FORGE_KINDS.join(", ")}` };
|
|
95
108
|
try {
|
|
96
|
-
return
|
|
109
|
+
return forgeFromJobEnv(kind as ForgeKind);
|
|
97
110
|
} catch (err) {
|
|
98
111
|
return { error: err instanceof Error ? err.message : String(err) };
|
|
99
112
|
}
|
|
@@ -194,13 +207,29 @@ export async function runLock(ctx: CommandContext): Promise<number> {
|
|
|
194
207
|
return 0;
|
|
195
208
|
}
|
|
196
209
|
|
|
210
|
+
// #4979: GitLab's lock job, in the target branch's plan notes pipeline, locks what every open merge request reaches.
|
|
211
|
+
if (args.lockReach && args.open) return runReachOpen(ctx, gate);
|
|
197
212
|
if (args.pr === undefined) return fail("chant lock needs the pull or merge request that holds the locks: --pr <n>", "chant lock --list prints the locks held now.");
|
|
198
213
|
const stage = (args.lockStage ?? "lock") as TargetLockStage;
|
|
199
214
|
if (!(TARGET_LOCK_STAGES as readonly string[]).includes(stage)) return fail(`--stage ${args.lockStage} is not one of ${TARGET_LOCK_STAGES.join(", ")}`);
|
|
200
215
|
|
|
201
216
|
let targets = targetsOf(ctx);
|
|
202
217
|
let head = args.head;
|
|
203
|
-
if (args.
|
|
218
|
+
if (args.lockReach) {
|
|
219
|
+
// #4979: the targets the change reaches, from the pipeline's reach line, after the head is fetched and checked.
|
|
220
|
+
if (targets.length > 0 || args.fromReport || args.keepLocks) return fail("--reach locks what the reach line prints; drop the names, --from-report and --keep");
|
|
221
|
+
const line = process.env[LOCK_REACH_ENV] ?? "";
|
|
222
|
+
if (!line.trim()) return fail(`--reach runs the reach line in ${LOCK_REACH_ENV}, which is not set`, "The generated lock job sets it from the product plan's reach.");
|
|
223
|
+
if (args.forge === undefined || !(FORGE_KINDS as readonly string[]).includes(args.forge)) return fail("--reach fetches the pull request's head from the forge: give --forge github, gitlab or forgejo");
|
|
224
|
+
if (!head || args.base === undefined) return fail("--reach measures the change from --base <sha> to --head <sha>");
|
|
225
|
+
const reached = reachedTargets({ forge: args.forge as ForgeKind, pr: args.pr, head, base: args.base, line });
|
|
226
|
+
if ("error" in reached) return fail(reached.error);
|
|
227
|
+
if ("moved" in reached) {
|
|
228
|
+
console.error(formatInfo(reached.moved));
|
|
229
|
+
return 0;
|
|
230
|
+
}
|
|
231
|
+
targets = reached.targets;
|
|
232
|
+
} else if (args.keepLocks) {
|
|
204
233
|
if (targets.length > 0 || args.fromReport) return fail("--keep keeps the locks the pull request holds; drop the names and --from-report");
|
|
205
234
|
let file;
|
|
206
235
|
try {
|
|
@@ -224,7 +253,7 @@ export async function runLock(ctx: CommandContext): Promise<number> {
|
|
|
224
253
|
const forge = forgeOf(ctx);
|
|
225
254
|
if (forge && "error" in forge) return fail(forge.error);
|
|
226
255
|
const isOpen = forge?.pullRequestOpen?.bind(forge);
|
|
227
|
-
const by = args.by ??
|
|
256
|
+
const by = args.by ?? actorFromEnv();
|
|
228
257
|
const name = prName(forge);
|
|
229
258
|
|
|
230
259
|
let result;
|
|
@@ -261,6 +290,73 @@ export async function runLock(ctx: CommandContext): Promise<number> {
|
|
|
261
290
|
return 0;
|
|
262
291
|
}
|
|
263
292
|
|
|
293
|
+
/**
|
|
294
|
+
* `chant lock --reach --open --base <sha> --forge gitlab [--branch <name>]`
|
|
295
|
+
* (#4979): GitLab's lock job, in a pipeline of the target branch. Every
|
|
296
|
+
* open merge request from the project that merges into the branch (default
|
|
297
|
+
* `CI_COMMIT_BRANCH`) takes the locks of what its change reaches, and a
|
|
298
|
+
* holder that is no longer open releases its locks. Exit 3 when another
|
|
299
|
+
* merge request holds what one reaches, 1 when a reach could not be read.
|
|
300
|
+
*/
|
|
301
|
+
async function runReachOpen(ctx: CommandContext, gate: string): Promise<number> {
|
|
302
|
+
const { args } = ctx;
|
|
303
|
+
const line = process.env[LOCK_REACH_ENV] ?? "";
|
|
304
|
+
if (!line.trim()) return fail(`--reach runs the reach line in ${LOCK_REACH_ENV}, which is not set`);
|
|
305
|
+
if (args.pr !== undefined || targetsOf(ctx).length > 0) return fail("--open locks every open merge request; drop --pr and the names");
|
|
306
|
+
if (args.base === undefined) return fail("--reach measures each change from --base <sha>, the target branch's commit");
|
|
307
|
+
const stage = (args.lockStage ?? "plan") as TargetLockStage;
|
|
308
|
+
if (!(TARGET_LOCK_STAGES as readonly string[]).includes(stage)) return fail(`--stage ${args.lockStage} is not one of ${TARGET_LOCK_STAGES.join(", ")}`);
|
|
309
|
+
const forge = forgeOf(ctx);
|
|
310
|
+
if (!forge) return fail("--open asks the forge for the open merge requests: give --forge gitlab");
|
|
311
|
+
if ("error" in forge) return fail(forge.error);
|
|
312
|
+
const branch = args.branch ?? process.env.CI_COMMIT_BRANCH ?? "";
|
|
313
|
+
if (!branch) return fail("--open locks the merge requests into one branch: give --branch <name>, or run it in a branch pipeline");
|
|
314
|
+
if (!forge.openPullRequests || !forge.pullRequestOpen) return fail(`the ${forge.kind} client cannot list the open merge requests`);
|
|
315
|
+
const isOpen = forge.pullRequestOpen.bind(forge);
|
|
316
|
+
const name = prName(forge);
|
|
317
|
+
let open;
|
|
318
|
+
try {
|
|
319
|
+
open = await forge.openPullRequests(branch);
|
|
320
|
+
} catch (err) {
|
|
321
|
+
return fail(`could not list the open merge requests into ${branch}: ${err instanceof Error ? err.message : String(err)}`);
|
|
322
|
+
}
|
|
323
|
+
const by = actorFromEnv();
|
|
324
|
+
const { outcomes, released } = await reachOpen({
|
|
325
|
+
forge: forge.kind,
|
|
326
|
+
base: args.base,
|
|
327
|
+
line,
|
|
328
|
+
branch,
|
|
329
|
+
open,
|
|
330
|
+
isOpen,
|
|
331
|
+
take: async (pr, head, targets) => {
|
|
332
|
+
const r = await takeTargetLocks(gate, targets, { pr, by, at: new Date().toISOString(), stage, head }, { isOpen, releaseStalePlan: stage === "plan" });
|
|
333
|
+
if (r.ok) {
|
|
334
|
+
await postStatus(forge, head, "success", r.taken.length > 0 ? `holds ${r.taken.join(", ")}` : "reaches no target");
|
|
335
|
+
return { ok: true, released: r.released };
|
|
336
|
+
}
|
|
337
|
+
await postStatus(forge, head, "failure", `locked by ${[...new Set(r.held.map((h) => h.pr))].map(name).join(", ")}: ${r.held.map((h) => h.target).join(", ")}`);
|
|
338
|
+
return { ok: false, held: `${describeHeldTargetLocks(r.held, name)}, so ${name(pr)} is not locked` };
|
|
339
|
+
},
|
|
340
|
+
holders: async () => [...new Set(Object.values((await readTargetLocks(gate)).locks).map((l) => l.pr))].sort((a, b) => a - b),
|
|
341
|
+
release: async (pr) => (await releaseTargetLocks(gate, pr)).released,
|
|
342
|
+
});
|
|
343
|
+
let code = 0;
|
|
344
|
+
for (const o of outcomes) {
|
|
345
|
+
if (o.kind === "locked") console.error(formatSuccess(`${name(o.pr)} ${o.targets.length > 0 ? `holds ${o.targets.join(", ")}` : "reaches no target"} on ${gate}${o.released.length > 0 ? `; released ${o.released.join(", ")}, which it no longer reaches` : ""}`));
|
|
346
|
+
else if (o.kind === "skipped") console.error(formatInfo(o.text));
|
|
347
|
+
else if (o.kind === "held") {
|
|
348
|
+
console.error(formatError({ message: o.text }));
|
|
349
|
+
if (code === 0) code = HELD_EXIT_CODE;
|
|
350
|
+
} else {
|
|
351
|
+
console.error(formatError({ message: `${name(o.pr)}: ${o.text}` }));
|
|
352
|
+
code = 1;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
for (const r of released) console.error(formatInfo(`${name(r.pr)} is not open, so its locks on ${r.targets.join(", ")} are released`));
|
|
356
|
+
if (args.json) console.log(JSON.stringify({ gate, outcomes, released }, null, 2));
|
|
357
|
+
return code;
|
|
358
|
+
}
|
|
359
|
+
|
|
264
360
|
/** chant unlock */
|
|
265
361
|
export async function runUnlock(ctx: CommandContext): Promise<number> {
|
|
266
362
|
const { args } = ctx;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `chant components pr-comment --forge github|forgejo` (#4946): the comment
|
|
3
|
+
* job of GitHub's and Forgejo's product pipeline.
|
|
4
|
+
*
|
|
5
|
+
* It reads the `issue_comment` event from `GITHUB_EVENT_PATH`, and the jobs
|
|
6
|
+
* the pipeline has from `CHANT_COMMENT_JOBS` (JSON, written by the
|
|
7
|
+
* generator), and answers the comment when no other job of the pipeline
|
|
8
|
+
* does (`../../ci-comment-commands.ts`): a refusal, a command no job runs,
|
|
9
|
+
* or the re-run of a merged pull request's apply. The words are the
|
|
10
|
+
* product's, as its bin set them.
|
|
11
|
+
*
|
|
12
|
+
* It runs at the target branch's commit with the job's token
|
|
13
|
+
* (`GITHUB_TOKEN`), so none of the change's code runs here, and it loads no
|
|
14
|
+
* plugins.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { readFileSync } from "node:fs";
|
|
18
|
+
import { activeProductWords } from "../../ci-product-words";
|
|
19
|
+
import { answerProductComment, COMMENT_JOBS_ENV, commentRuns, type CommentJobs } from "../../ci-comment-commands";
|
|
20
|
+
import { forgeFromEnv, forgeTargetFromEnv, type PrForge } from "../../pr-forge";
|
|
21
|
+
import { forgeReadsFor } from "../../pr-forge-reads";
|
|
22
|
+
import { formatError, formatInfo } from "../format";
|
|
23
|
+
import type { CommandContext } from "../registry";
|
|
24
|
+
|
|
25
|
+
const fail = (message: string): number => {
|
|
26
|
+
console.error(formatError({ message }));
|
|
27
|
+
return 1;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
/** The jobs named in {@link COMMENT_JOBS_ENV}: each a boolean, `targets` a list of names, and anything else is refused. */
|
|
31
|
+
export function commentJobsFromEnv(raw: string | undefined): CommentJobs {
|
|
32
|
+
if (raw === undefined || raw.trim() === "") return {};
|
|
33
|
+
const v: unknown = JSON.parse(raw);
|
|
34
|
+
if (typeof v !== "object" || v === null || Array.isArray(v)) throw new Error(`${COMMENT_JOBS_ENV} is a JSON object of the jobs the pipeline has`);
|
|
35
|
+
const known = new Set(["preview", "applyBeforeMerge", "applyOnMerge", "locks", "agent", "commits", "actions", "skipForks", "targets", "noPlanFlags", "waves"]);
|
|
36
|
+
const jobs: Record<string, unknown> = {};
|
|
37
|
+
for (const [k, x] of Object.entries(v)) {
|
|
38
|
+
if (!known.has(k)) throw new Error(`${COMMENT_JOBS_ENV} names ${JSON.stringify(k)}, which is not one of ${[...known].join(", ")}`);
|
|
39
|
+
// #4979: the waves' op and count, for a wave stop on a re-run.
|
|
40
|
+
if (k === "waves") {
|
|
41
|
+
const w = x as { op?: unknown; count?: unknown } | null;
|
|
42
|
+
if (!w || typeof w !== "object" || typeof w.op !== "string" || !/^[A-Za-z0-9][A-Za-z0-9_.-]{0,127}$/.test(w.op) || !Number.isInteger(w.count) || (w.count as number) < 1) throw new Error(`${COMMENT_JOBS_ENV}.waves is { op, count }: the waves' op name and how many waves there are`);
|
|
43
|
+
jobs.waves = { op: w.op, count: w.count };
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
if (k === "targets") {
|
|
47
|
+
if (!Array.isArray(x) || x.some((t) => typeof t !== "string" || !/^[A-Za-z0-9][A-Za-z0-9_-]*$/.test(t))) throw new Error(`${COMMENT_JOBS_ENV}.targets is a list of target names`);
|
|
48
|
+
if (x.length > 0) jobs.targets = x;
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
if (typeof x !== "boolean") throw new Error(`${COMMENT_JOBS_ENV}.${k} is true or false`);
|
|
52
|
+
if (x) jobs[k] = true;
|
|
53
|
+
}
|
|
54
|
+
return jobs as CommentJobs;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export async function runComponentsPrComment(ctx: CommandContext): Promise<number> {
|
|
58
|
+
const { args } = ctx;
|
|
59
|
+
const kind = args.forge;
|
|
60
|
+
if (kind !== "github" && kind !== "forgejo") return fail("pr-comment answers a GitHub or Forgejo comment: --forge github|forgejo (GitLab's notes are polled by pr-notes)");
|
|
61
|
+
const env = process.env;
|
|
62
|
+
const eventPath = env.GITHUB_EVENT_PATH;
|
|
63
|
+
if (!eventPath) return fail("pr-comment reads the comment from the event file, and GITHUB_EVENT_PATH is not set");
|
|
64
|
+
let event: unknown;
|
|
65
|
+
let jobs: CommentJobs;
|
|
66
|
+
let poster: PrForge;
|
|
67
|
+
let target: ReturnType<typeof forgeTargetFromEnv>;
|
|
68
|
+
try {
|
|
69
|
+
event = JSON.parse(readFileSync(eventPath, "utf8"));
|
|
70
|
+
jobs = commentJobsFromEnv(env[COMMENT_JOBS_ENV]);
|
|
71
|
+
poster = forgeFromEnv(kind, env);
|
|
72
|
+
target = forgeTargetFromEnv(env, { kind });
|
|
73
|
+
} catch (err) {
|
|
74
|
+
return fail(err instanceof Error ? err.message : String(err));
|
|
75
|
+
}
|
|
76
|
+
const repository = (event as { repository?: { default_branch?: unknown } } | null)?.repository;
|
|
77
|
+
const base = args.branch ?? (typeof repository?.default_branch === "string" ? repository.default_branch : undefined);
|
|
78
|
+
if (!base) return fail("pr-comment needs the default branch: --branch <name>, or repository.default_branch in the event");
|
|
79
|
+
const outcome = await answerProductComment({
|
|
80
|
+
forge: kind,
|
|
81
|
+
event,
|
|
82
|
+
repo: target.repo,
|
|
83
|
+
reads: forgeReadsFor(target),
|
|
84
|
+
poster,
|
|
85
|
+
runs: commentRuns({ apiBase: target.apiBase, repo: target.repo, token: target.token }),
|
|
86
|
+
words: activeProductWords(),
|
|
87
|
+
base,
|
|
88
|
+
jobs,
|
|
89
|
+
env,
|
|
90
|
+
// #4979: the wave stop goes on this checkout's chant/lifecycle, which the job pushes with its token.
|
|
91
|
+
...(jobs.waves
|
|
92
|
+
? {
|
|
93
|
+
stops: async (op, sha, stop) => {
|
|
94
|
+
const { setWaveStop } = await import("../../op/wave-stop");
|
|
95
|
+
await setWaveStop(op, sha, stop);
|
|
96
|
+
},
|
|
97
|
+
}
|
|
98
|
+
: {}),
|
|
99
|
+
});
|
|
100
|
+
const line = `pr-comment: ${outcome.reason}`;
|
|
101
|
+
if (outcome.fail) return fail(line);
|
|
102
|
+
console.error(formatInfo(line));
|
|
103
|
+
return 0;
|
|
104
|
+
}
|
|
@@ -74,11 +74,14 @@ import {
|
|
|
74
74
|
import { forgePrEnvPublisher, lifecyclePrEnvPorts } from "../../components/pr-env-ports";
|
|
75
75
|
import { applyPrSet, type PrPlanSet } from "../../components/pr-run";
|
|
76
76
|
import { prOp } from "../../pr-loop";
|
|
77
|
-
import { FORGE_KINDS,
|
|
77
|
+
import { FORGE_KINDS, forgePrincipalOf, type ForgeKind, type PrForge } from "../../pr-forge";
|
|
78
|
+
// #4964: a status for a pull_request run's merge preview goes on the pull request's head.
|
|
79
|
+
import { forgeFromJobEnv } from "../../pr-forge-job";
|
|
78
80
|
import { formatError, formatInfo, formatWarning } from "../format";
|
|
79
81
|
import { withComponentEndpoint } from "../component-endpoint";
|
|
80
82
|
import type { CommandContext } from "../registry";
|
|
81
83
|
import type { Prepared } from "./pr";
|
|
84
|
+
import { actorFromEnv } from "../../actor";
|
|
82
85
|
|
|
83
86
|
const USAGE = "chant components pr-env up --base <ref> --pr <n> [--no-push] | post --pr <n> --head <sha> | down --pr <n> [--reason closed|expired] | sweep";
|
|
84
87
|
|
|
@@ -102,14 +105,14 @@ function forgeOf(ctx: CommandContext): PrForge | undefined | number {
|
|
|
102
105
|
if (kind === undefined || ctx.args.noStatus) return undefined;
|
|
103
106
|
if (!(FORGE_KINDS as readonly string[]).includes(kind)) return fail(`--forge ${kind} is not one of ${FORGE_KINDS.join(", ")}`);
|
|
104
107
|
try {
|
|
105
|
-
return
|
|
108
|
+
return forgeFromJobEnv(kind as ForgeKind);
|
|
106
109
|
} catch (err) {
|
|
107
110
|
return fail(err instanceof Error ? err.message : String(err));
|
|
108
111
|
}
|
|
109
112
|
}
|
|
110
113
|
|
|
111
114
|
function actor(): string {
|
|
112
|
-
return process.env
|
|
115
|
+
return actorFromEnv(process.env, "chant");
|
|
113
116
|
}
|
|
114
117
|
|
|
115
118
|
function memberOf(ctx: CommandContext): string | undefined {
|
|
@@ -14,7 +14,7 @@ import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";
|
|
|
14
14
|
import type { DriverComponent } from "../../components/driver";
|
|
15
15
|
import type { DeployContext } from "../../components/capability";
|
|
16
16
|
import type { ParsedArgs } from "../registry";
|
|
17
|
-
import { prStatusState } from "../../pr-
|
|
17
|
+
import { prStatusState } from "../../pr-status";
|
|
18
18
|
|
|
19
19
|
const HEAD = "a".repeat(40);
|
|
20
20
|
const BASE = "b".repeat(40);
|