@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
package/dist/ci-login.js
CHANGED
|
@@ -23,8 +23,11 @@
|
|
|
23
23
|
* `/tmp`), mode 0600. Then it sets:
|
|
24
24
|
*
|
|
25
25
|
* AWS AWS_ROLE_ARN, AWS_WEB_IDENTITY_TOKEN_FILE, AWS_ROLE_SESSION_NAME,
|
|
26
|
-
* AWS_REGION
|
|
27
|
-
*
|
|
26
|
+
* with `region` AWS_REGION and AWS_DEFAULT_REGION (else the job
|
|
27
|
+
* keeps its own, #4930), and AWS_ENDPOINT_URL_STS with
|
|
28
|
+
* `endpoint`. With no role the job gets the token file and the
|
|
29
|
+
* session name alone, for a tool that assumes its own roles,
|
|
30
|
+
* such as Terragrunt's `credentials` (#4930)
|
|
28
31
|
* GCP GOOGLE_APPLICATION_CREDENTIALS and
|
|
29
32
|
* CLOUDSDK_AUTH_CREDENTIAL_FILE_OVERRIDE, an `external_account`
|
|
30
33
|
* file per service account that trades the token at Google's STS
|
|
@@ -37,9 +40,11 @@
|
|
|
37
40
|
*
|
|
38
41
|
* gcloud reads CLOUDSDK_AUTH_CREDENTIAL_FILE_OVERRIDE, so it needs no
|
|
39
42
|
* `gcloud auth login`. On GitHub and Forgejo the variables go to
|
|
40
|
-
* `$GITHUB_ENV
|
|
41
|
-
* login prints, which name files and hold no token, then
|
|
42
|
-
* variables and the spec. No file of variables is left to
|
|
43
|
+
* `$GITHUB_ENV`, which later steps read; on GitLab the script evaluates the
|
|
44
|
+
* `export` lines the login prints, which name files and hold no token, then
|
|
45
|
+
* unsets the token variables and the spec. No file of variables is left to
|
|
46
|
+
* delete. With {@link CloudLoginOptions.sameStep} every forge takes the
|
|
47
|
+
* GitLab form, so the step that logs in can run the tool too (#4930).
|
|
43
48
|
*
|
|
44
49
|
* Per target and per stage: the spec is a {@link CloudTradeSpec} without
|
|
45
50
|
* Pulumi, the plan or apply side of what `resolveCloudIdentity` gives, so a
|
|
@@ -47,7 +52,9 @@
|
|
|
47
52
|
* other targets take (#4332). The step then writes the
|
|
48
53
|
* {@link CLOUD_TARGETS_ENV} file the trade writes, each identity's
|
|
49
54
|
* variables in it, and a product hands each target's tool its own with
|
|
50
|
-
* `targetCloudEnv`, as after the trade.
|
|
55
|
+
* `targetCloudEnv`, as after the trade. The login sets no
|
|
56
|
+
* `CLOUD_TRADED_ENV`, which the trade does, so a product tells the login's
|
|
57
|
+
* targets file from a trade's (#4930).
|
|
51
58
|
*
|
|
52
59
|
* The functions return {@link OpWaveRunStep}s and the job's `idTokens`, the
|
|
53
60
|
* shape `OpWavesPipelineOptions.waveJobs[].before` and `recordPlans` take
|
|
@@ -55,8 +62,27 @@
|
|
|
55
62
|
* writing it into their files.
|
|
56
63
|
*/
|
|
57
64
|
import { CLOUD_TARGETS_ENV, IDENTITY_KEY, idTokenVar, } from "./ci-identity.js";
|
|
65
|
+
import { restartWithout } from "./ci-handover.js";
|
|
58
66
|
/** The variable the login step reads its {@link CloudLoginSpec} from, as JSON. */
|
|
59
67
|
export const LOGIN_SPEC_ENV = "CHANT_CLOUD_LOGIN";
|
|
68
|
+
/**
|
|
69
|
+
* The variable the login sets (#4912): the token files it wrote itself,
|
|
70
|
+
* joined by `:`. A runner's `tokenFile` is not among them.
|
|
71
|
+
* {@link LOGIN_CLEAR_TOKENS} empties them.
|
|
72
|
+
*/
|
|
73
|
+
export const LOGIN_TOKEN_FILES_ENV = "CHANT_CLOUD_TOKEN_FILES";
|
|
74
|
+
/**
|
|
75
|
+
* A shell line that empties each file {@link LOGIN_TOKEN_FILES_ENV} names
|
|
76
|
+
* (#4912), so a step that runs after the cloud's tool finds no token in
|
|
77
|
+
* them. It truncates and deletes nothing. The login's `restart` runs it
|
|
78
|
+
* when the step exits. A job whose login is a step of its own runs it in
|
|
79
|
+
* the step after the tool's last use.
|
|
80
|
+
*/
|
|
81
|
+
export const LOGIN_CLEAR_TOKENS = `(set -f; IFS=:; for f in \${${LOGIN_TOKEN_FILES_ENV}:-}; do [ ! -f "$f" ] || : > "$f"; done)`;
|
|
82
|
+
/** The marker of a step the login's `restart` started again (#4912): its login is done. */
|
|
83
|
+
export const LOGIN_RESTART_MARKER = "CHANT_CLOUD_LOGGED_IN";
|
|
84
|
+
/** The variables a GitHub or Forgejo step requests an OIDC token with. */
|
|
85
|
+
const ACTIONS_REQUEST_VARS = ["ACTIONS_ID_TOKEN_REQUEST_URL", "ACTIONS_ID_TOKEN_REQUEST_TOKEN"];
|
|
60
86
|
const LOGIN_CLOUDS = ["aws", "gcp", "azure"];
|
|
61
87
|
/** The provider's resource name without the `//iam.googleapis.com/` prefix, as ci-identity reads it. */
|
|
62
88
|
const providerPath = (p) => p.replace(/^(https:)?\/\/iam\.googleapis\.com\//, "");
|
|
@@ -72,8 +98,9 @@ export function cloudLoginSpec(spec) {
|
|
|
72
98
|
if (spec.azure?.database)
|
|
73
99
|
throw new Error("a cloud login gives Azure no database token: trade the token with ci-identity's trade step for azure.database");
|
|
74
100
|
const out = {};
|
|
101
|
+
// #4930: no default region, so the job's own stays. A named one stays where the spec put it, so the step renders as before.
|
|
75
102
|
if (spec.aws)
|
|
76
|
-
out.aws = { ...spec.aws,
|
|
103
|
+
out.aws = { ...spec.aws, audience: spec.aws.audience ?? "sts.amazonaws.com" };
|
|
77
104
|
if (spec.gcp) {
|
|
78
105
|
const provider = providerPath(spec.gcp.provider);
|
|
79
106
|
out.gcp = { ...spec.gcp, provider, audience: spec.gcp.audience ?? `https://iam.googleapis.com/${provider}` };
|
|
@@ -86,7 +113,8 @@ export function cloudLoginSpec(spec) {
|
|
|
86
113
|
continue;
|
|
87
114
|
const key = IDENTITY_KEY[cloud];
|
|
88
115
|
const ids = [c[key], ...(c.targets ?? []).map((t) => t[key])].filter((v) => v !== undefined);
|
|
89
|
-
|
|
116
|
+
// #4930: AWS with no role is the token file alone. GCP's credential file and Azure's variables name an identity.
|
|
117
|
+
if (ids.length === 0 && cloud !== "aws")
|
|
90
118
|
throw new Error(`the ${cloud} login names no identity: give it ${key}, or targets`);
|
|
91
119
|
for (const [k, v] of Object.entries(c)) {
|
|
92
120
|
if (typeof v === "string" && !SAFE.test(v))
|
|
@@ -123,6 +151,7 @@ export const LOGIN_JS = [
|
|
|
123
151
|
'const rand=()=>crypto.randomBytes(8).toString("hex");',
|
|
124
152
|
'const NO={github:"it needs permissions: id-token: write, and a pull request from a fork gets none",forgejo:"Forgejo serves one from version 15, with Forgejo Runner 12.5 or later, to a job with enable-openid-connect: true; on an older Forgejo give the cloud a tokenFile the runner provides"};',
|
|
125
153
|
// A cloud's token: the runner's file, else GitLab's id_tokens variable, else the forge's request URL, into a file of its own.
|
|
154
|
+
"const mine=[];",
|
|
126
155
|
"const tokenFile=async(cloud,s)=>{",
|
|
127
156
|
'if(s.tokenFile){const f=s.tokenFile.replace(/^\\$\\{?([A-Za-z_][A-Za-z0-9_]*)\\}?/,(m,v)=>process.env[v]||"");let t;try{t=fs.readFileSync(f,"utf8").trim()}catch{throw new Error(cloud+"\\u0027s tokenFile "+f+" cannot be read")}if(!t)throw new Error(cloud+"\\u0027s tokenFile "+f+" is empty");return f}',
|
|
128
157
|
'const name="CHANT_ID_TOKEN_"+cloud.toUpperCase();let v=process.env[name];',
|
|
@@ -133,18 +162,22 @@ export const LOGIN_JS = [
|
|
|
133
162
|
'if(!r.ok)throw new Error("the OIDC token request answered "+r.status);',
|
|
134
163
|
'try{v=JSON.parse(await r.text()).value}catch{throw new Error("the OIDC token request answered with no JSON")}}',
|
|
135
164
|
'if(!clean(v))throw new Error("the job\\u0027s OIDC token for "+cloud+" is not a token");',
|
|
136
|
-
'const f=tmp+"/chant-oidc-"+cloud+"-"+rand();fs.writeFileSync(f,v,{mode:0o600,flag:"wx"});return f};',
|
|
165
|
+
'const f=tmp+"/chant-oidc-"+cloud+"-"+rand();fs.writeFileSync(f,v,{mode:0o600,flag:"wx"});mine.push(f);return f};',
|
|
137
166
|
`const KEY=${JSON.stringify(IDENTITY_KEY)};`,
|
|
138
167
|
'const ids=(c)=>{const s=spec[c],l=[];if(s[KEY[c]])l.push(s[KEY[c]]);for(const t of s.targets||[])if(!l.includes(t[KEY[c]]))l.push(t[KEY[c]]);return l};',
|
|
139
168
|
"const vars={},said=[],by={};",
|
|
140
169
|
"const run=async()=>{",
|
|
141
170
|
'if(spec.aws){const a=spec.aws;const f=await tokenFile("aws",a);by.aws={};',
|
|
142
|
-
|
|
143
|
-
"
|
|
171
|
+
// #4930: the region only when the spec names one; with no role of the job's own, the token file and session name alone.
|
|
172
|
+
'const base={AWS_WEB_IDENTITY_TOKEN_FILE:f,AWS_ROLE_SESSION_NAME:a.sessionName||"chant",...(a.region?{AWS_REGION:a.region,AWS_DEFAULT_REGION:a.region}:{}),...(a.endpoint?{AWS_ENDPOINT_URL_STS:trim(a.endpoint)}:{})};',
|
|
173
|
+
'for(const role of ids("aws")){by.aws[role]={AWS_ROLE_ARN:role,...base};said.push(role)}',
|
|
174
|
+
'if(a.role)Object.assign(vars,by.aws[a.role]);else{Object.assign(vars,base);console.error("chant: wrote the aws OIDC token file, with no role of the job\\u0027s own")}}',
|
|
144
175
|
'if(spec.gcp){const c=spec.gcp;const f=await tokenFile("gcp",c);by.gcp={};',
|
|
145
176
|
'const sts=trim(c.stsEndpoint||"https://sts.googleapis.com"),iam=trim(c.iamEndpoint||"https://iamcredentials.googleapis.com");',
|
|
177
|
+
// #4912: stsEndpoint is Google's STS, or its full token URL (terragucci's `token_url`).
|
|
178
|
+
'const tu=/\\/token$/.test(sts)?sts:sts+"/v1/token";',
|
|
146
179
|
'for(const sa of ids("gcp")){const cf=tmp+"/chant-gcp-"+rand()+".json";',
|
|
147
|
-
'fs.writeFileSync(cf,JSON.stringify({type:"external_account",audience:"//iam.googleapis.com/"+c.provider,subject_token_type:"urn:ietf:params:oauth:token-type:jwt",token_url:
|
|
180
|
+
'fs.writeFileSync(cf,JSON.stringify({type:"external_account",audience:"//iam.googleapis.com/"+c.provider,subject_token_type:"urn:ietf:params:oauth:token-type:jwt",token_url:tu,service_account_impersonation_url:iam+"/v1/projects/-/serviceAccounts/"+sa+":generateAccessToken",credential_source:{file:f}})+"\\n",{mode:0o600,flag:"wx"});',
|
|
148
181
|
"by.gcp[sa]={GOOGLE_APPLICATION_CREDENTIALS:cf,CLOUDSDK_AUTH_CREDENTIAL_FILE_OVERRIDE:cf};said.push(sa)}",
|
|
149
182
|
"if(c.serviceAccount)Object.assign(vars,by.gcp[c.serviceAccount])}",
|
|
150
183
|
'if(spec.azure){const z=spec.azure;const f=await tokenFile("azure",z);by.azure={};',
|
|
@@ -158,6 +191,8 @@ export const LOGIN_JS = [
|
|
|
158
191
|
'const clouds=Object.keys(by);if(clouds.some((c)=>(spec[c].targets||[]).length>0)){',
|
|
159
192
|
'const doc={version:1,clouds:{}};for(const c of clouds){const s=spec[c];doc.clouds[c]={...(s[KEY[c]]?{default:s[KEY[c]]}:{}),targets:(s.targets||[]).map((t)=>({targets:t.targets,identity:t[KEY[c]]})),vars:by[c]}}',
|
|
160
193
|
`const tf=tmp+"/chant-cloud-targets-"+rand()+".json";fs.writeFileSync(tf,JSON.stringify(doc),{mode:0o600,flag:"wx"});vars.${CLOUD_TARGETS_ENV}=tf}`,
|
|
194
|
+
// #4912: the token files the login wrote, which LOGIN_CLEAR_TOKENS empties; a runner's own stays out.
|
|
195
|
+
`if(mine.length)vars.${LOGIN_TOKEN_FILES_ENV}=mine.join(":");`,
|
|
161
196
|
'for(const [k,v] of Object.entries(vars))if(!clean(v))throw new Error(k+" is not a value the job can hold");',
|
|
162
197
|
'if(format==="github-env")fs.appendFileSync(out,Object.entries(vars).map(([k,v])=>k+"="+v+"\\n").join(""));',
|
|
163
198
|
'else process.stdout.write(Object.entries(vars).map(([k,v])=>"export "+k+"="+Q+v.split(Q).join(Q+"\\\\"+Q+Q)+Q+"\\n").join(""));',
|
|
@@ -175,11 +210,36 @@ const stepName = (spec) => `Cloud login (chant ci-login: ${LOGIN_CLOUDS.filter((
|
|
|
175
210
|
export function loginLine(out, format, forge) {
|
|
176
211
|
return `(cd / && node -e '${LOGIN_JS}' "${out}" ${format} ${forge})`;
|
|
177
212
|
}
|
|
178
|
-
/**
|
|
179
|
-
|
|
213
|
+
/**
|
|
214
|
+
* The lines that log in and evaluate the variables in the shell that runs
|
|
215
|
+
* them, then unset what held them and `unset`: GitLab's script, and with
|
|
216
|
+
* `sameStep` (#4930) any forge's step. `exit` stops a script with `-e` off.
|
|
217
|
+
*/
|
|
218
|
+
function shellLines(spec, forge, unset, exit) {
|
|
219
|
+
return [
|
|
220
|
+
`export ${LOGIN_SPEC_ENV}=${sh(JSON.stringify(spec))}`,
|
|
221
|
+
// An assignment's status is its command substitution's, so a failed login stops the script.
|
|
222
|
+
`${GITLAB_LOGIN_VARS}="$${loginLine("-", "sh", forge)}"${exit ? " || exit 1" : ""}`,
|
|
223
|
+
`eval "$${GITLAB_LOGIN_VARS}"`,
|
|
224
|
+
`unset ${[GITLAB_LOGIN_VARS, LOGIN_SPEC_ENV, ...unset].join(" ")}`,
|
|
225
|
+
];
|
|
226
|
+
}
|
|
227
|
+
/** The `restart` option, filled: undefined without it. */
|
|
228
|
+
const restartOf = (options) => (options.restart ? (options.restart === true ? {} : options.restart) : undefined);
|
|
229
|
+
/** The trap a restarted login sets: the login's token files emptied when the step exits (#4912). */
|
|
230
|
+
const clearOnExit = `trap ${sh(LOGIN_CLEAR_TOKENS)} EXIT`;
|
|
231
|
+
/** A GitHub Actions or Forgejo Actions login: one step that appends the variables to `$GITHUB_ENV`, or with `sameStep` exports them in its own shell. */
|
|
232
|
+
function actionsLogin(forge, given, options = {}) {
|
|
180
233
|
const spec = cloudLoginSpec(given);
|
|
181
234
|
if (Object.keys(spec).length === 0)
|
|
182
235
|
return { steps: [], idTokens: {} };
|
|
236
|
+
const restart = restartOf(options);
|
|
237
|
+
if (restart) {
|
|
238
|
+
const lines = [`if [ -z "\${${LOGIN_RESTART_MARKER}:-}" ]; then`, ...shellLines(spec, forge, [], true), "fi", restartWithout(restart.shell ?? "bash", [...ACTIONS_REQUEST_VARS, ...(restart.also ?? [])], LOGIN_RESTART_MARKER), clearOnExit];
|
|
239
|
+
return { steps: [{ name: stepName(spec), run: lines }], idTokens: loginIdTokens(spec) };
|
|
240
|
+
}
|
|
241
|
+
if (options.sameStep)
|
|
242
|
+
return { steps: [{ name: stepName(spec), run: shellLines(spec, forge, [], true) }], idTokens: loginIdTokens(spec) };
|
|
183
243
|
return {
|
|
184
244
|
steps: [{ name: stepName(spec), run: [`export ${LOGIN_SPEC_ENV}=${sh(JSON.stringify(spec))}`, loginLine("$GITHUB_ENV", "github-env", forge)] }],
|
|
185
245
|
idTokens: loginIdTokens(spec),
|
|
@@ -191,8 +251,8 @@ function actionsLogin(forge, given) {
|
|
|
191
251
|
* variables to `$GITHUB_ENV`, so every later step has them. The job needs
|
|
192
252
|
* `id-token: write`, which `idTokens` asks chant's generators for.
|
|
193
253
|
*/
|
|
194
|
-
export function githubCloudLogin(spec) {
|
|
195
|
-
return actionsLogin("github", spec);
|
|
254
|
+
export function githubCloudLogin(spec, options) {
|
|
255
|
+
return actionsLogin("github", spec, options);
|
|
196
256
|
}
|
|
197
257
|
/**
|
|
198
258
|
* A Forgejo Actions job's cloud login (#4788), as on GitHub. Forgejo 15 with
|
|
@@ -201,10 +261,10 @@ export function githubCloudLogin(spec) {
|
|
|
201
261
|
* that asks for `id-token: write`. On an older Forgejo, give each cloud a
|
|
202
262
|
* `tokenFile` the runner provides; the job then requests none.
|
|
203
263
|
*/
|
|
204
|
-
export function forgejoCloudLogin(spec) {
|
|
205
|
-
return actionsLogin("forgejo", spec);
|
|
264
|
+
export function forgejoCloudLogin(spec, options) {
|
|
265
|
+
return actionsLogin("forgejo", spec, options);
|
|
206
266
|
}
|
|
207
|
-
/** The
|
|
267
|
+
/** The variable the login's `export` lines are kept in until the script evaluates them: GitLab's, and with `sameStep` any forge's (#4930). */
|
|
208
268
|
export const GITLAB_LOGIN_VARS = "CHANT_CLOUD_LOGIN_VARS";
|
|
209
269
|
/**
|
|
210
270
|
* A GitLab CI job's cloud login (#4788): script lines that write each
|
|
@@ -213,28 +273,20 @@ export const GITLAB_LOGIN_VARS = "CHANT_CLOUD_LOGIN_VARS";
|
|
|
213
273
|
* only in its file. The job's `id_tokens:` are `idTokens`, each
|
|
214
274
|
* `{ aud: <audience> }`.
|
|
215
275
|
*/
|
|
216
|
-
export function gitlabCloudLogin(given) {
|
|
276
|
+
export function gitlabCloudLogin(given, options = {}) {
|
|
217
277
|
const spec = cloudLoginSpec(given);
|
|
218
278
|
if (Object.keys(spec).length === 0)
|
|
219
279
|
return { steps: [], idTokens: {} };
|
|
220
280
|
const idTokens = loginIdTokens(spec);
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
`${GITLAB_LOGIN_VARS}="$${loginLine("-", "sh", "gitlab")}"`,
|
|
229
|
-
`eval "$${GITLAB_LOGIN_VARS}"`,
|
|
230
|
-
`unset ${[GITLAB_LOGIN_VARS, LOGIN_SPEC_ENV, ...Object.keys(idTokens)].join(" ")}`,
|
|
231
|
-
],
|
|
232
|
-
},
|
|
233
|
-
],
|
|
234
|
-
idTokens,
|
|
235
|
-
};
|
|
281
|
+
const restart = restartOf(options);
|
|
282
|
+
// A GitLab script is one shell already; sameStep adds `|| exit 1`, for a script with -e off.
|
|
283
|
+
const lines = shellLines(spec, "gitlab", Object.keys(idTokens), options.sameStep === true || restart !== undefined);
|
|
284
|
+
// #4912: GitLab's script is no file to restart; the id_tokens variables are unset above, `also` here.
|
|
285
|
+
if (restart)
|
|
286
|
+
lines.push(...(restart.also?.length ? [`unset ${restart.also.join(" ")}`] : []), clearOnExit);
|
|
287
|
+
return { steps: [{ name: stepName(spec), run: lines }], idTokens };
|
|
236
288
|
}
|
|
237
289
|
/** A job's cloud login on `forge` (#4788): {@link githubCloudLogin}, {@link gitlabCloudLogin} or {@link forgejoCloudLogin}. */
|
|
238
|
-
export function cloudLogin(forge, spec) {
|
|
239
|
-
return forge === "gitlab" ? gitlabCloudLogin(spec) : actionsLogin(forge, spec);
|
|
290
|
+
export function cloudLogin(forge, spec, options) {
|
|
291
|
+
return forge === "gitlab" ? gitlabCloudLogin(spec, options) : actionsLogin(forge, spec, options);
|
|
240
292
|
}
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
* token and holds no cloud credentials.
|
|
28
28
|
*/
|
|
29
29
|
import { type CiProductWords, type ParsedProductComment } from "./ci-product-words.js";
|
|
30
|
-
import { type GitlabForgeOptions, type PrForge } from "./pr-forge.js";
|
|
31
|
-
import type { ForgeReads, PullRequestDetail, PullRequestNote } from "./pr-forge-reads.js";
|
|
30
|
+
import { type ForgeKind, type GitlabForgeOptions, type PrForge } from "./pr-forge.js";
|
|
31
|
+
import type { ForgeReads, PullRequestDetail, PullRequestNote, RunJob, WorkflowRun } from "./pr-forge-reads.js";
|
|
32
32
|
export { GITLAB_NOTE_COMMANDS_VAR } from "./components/pr-pipeline.js";
|
|
33
33
|
/** How far back the poll reads: merge requests updated, and notes written, in this many minutes. */
|
|
34
34
|
export declare const NOTE_COMMANDS_WINDOW_MINUTES: number;
|
|
@@ -165,6 +165,56 @@ export interface NotePoll {
|
|
|
165
165
|
export declare function pollNoteCommands(o: NoteCommandsOptions): Promise<NotePoll>;
|
|
166
166
|
/** chant's apply jobs and terragucci's: `apply`, `apply-wave-<n>` and `apply-wave-<n>-share-<m>`, a member's prefixed with its name. */
|
|
167
167
|
export declare const APPLY_JOBS: RegExp;
|
|
168
|
+
/** What starting a merge commit's apply again came to: a reply alone, a run started (`ran`), or a forge answer that broke it. */
|
|
169
|
+
export type ApplyRetried = {
|
|
170
|
+
kind: "reply";
|
|
171
|
+
text: string;
|
|
172
|
+
} | {
|
|
173
|
+
kind: "ran";
|
|
174
|
+
text: string;
|
|
175
|
+
url?: string;
|
|
176
|
+
} | {
|
|
177
|
+
kind: "fail";
|
|
178
|
+
reason: string;
|
|
179
|
+
};
|
|
180
|
+
/** What {@link ApplyRerun} is told: the merge commit, the pull request's name in a reply, who asked, and the default branch. */
|
|
181
|
+
export interface ApplyRerunContext {
|
|
182
|
+
sha: string;
|
|
183
|
+
/** `!12`, or `pull request 12`. */
|
|
184
|
+
at: string;
|
|
185
|
+
user: string;
|
|
186
|
+
base: string;
|
|
187
|
+
/** The pattern the apply jobs matched, whose groups are the wave and the share. */
|
|
188
|
+
pattern: RegExp;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* How a forge starts a merge commit's apply again (#4946), once
|
|
192
|
+
* {@link retryApply} found the push run at the commit with apply jobs and no
|
|
193
|
+
* later apply. GitLab retries the first apply job that did not succeed
|
|
194
|
+
* ({@link gitlabRetry}); GitHub and Forgejo answer in ./ci-comment-commands.ts.
|
|
195
|
+
*/
|
|
196
|
+
export type ApplyRerun = (run: WorkflowRun, jobs: RunJob[], c: ApplyRerunContext) => Promise<ApplyRetried>;
|
|
197
|
+
/** What {@link retryApply} reads with. */
|
|
198
|
+
export interface ApplyRetryReads {
|
|
199
|
+
reads: ForgeReads;
|
|
200
|
+
/** chant's client: it reads the later commits' statuses. */
|
|
201
|
+
forge: Pick<PrForge, "commitStatuses">;
|
|
202
|
+
words: CiProductWords;
|
|
203
|
+
/** The default branch. */
|
|
204
|
+
base: string;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Start a merged pull request's apply again (#4785; shared with GitHub and
|
|
208
|
+
* Forgejo in #4946): the newest push run at the merge commit that has an
|
|
209
|
+
* apply job, refused when a later commit of the default branch already
|
|
210
|
+
* carries the product's apply status, since going back to this one would
|
|
211
|
+
* undo it. `rerun` is the forge's own start.
|
|
212
|
+
*/
|
|
213
|
+
export declare function retryApply(o: ApplyRetryReads, forgeKind: ForgeKind, mr: PullRequestDetail, user: string, run: Extract<NoteRun, {
|
|
214
|
+
kind: "retry";
|
|
215
|
+
}>, rerun: ApplyRerun): Promise<ApplyRetried>;
|
|
216
|
+
/** GitLab's start: retry the first apply job, by wave and share, that did not succeed; the jobs after it follow by themselves. */
|
|
217
|
+
export declare function gitlabRetry(pipelines: Pick<GitlabPipelines, "retryJob">): ApplyRerun;
|
|
168
218
|
/** The jobs chant's GitLab pipeline has, which {@link chantNoteRuns} starts. */
|
|
169
219
|
export interface ChantNoteJobs {
|
|
170
220
|
/** The comment preview (`--preview-comment`): a plan starts it with `CHANT_PREVIEW_PR`. Without it a plan starts a merge request pipeline. */
|
|
@@ -179,8 +229,18 @@ export interface ChantNoteJobs {
|
|
|
179
229
|
agent?: boolean;
|
|
180
230
|
/** The commit jobs, started with `CHANT_COMMIT_PR`, `CHANT_COMMIT` and `CHANT_COMMIT_ARG`. */
|
|
181
231
|
commits?: boolean;
|
|
232
|
+
/**
|
|
233
|
+
* The members the pipeline was written with (#4946), such as terragucci's
|
|
234
|
+
* roots: a plan or an action naming any other gets the words' `member`
|
|
235
|
+
* reply, and nothing starts. Absent: any member a comment may name.
|
|
236
|
+
*/
|
|
237
|
+
members?: readonly string[];
|
|
182
238
|
}
|
|
183
|
-
/**
|
|
239
|
+
/**
|
|
240
|
+
* What a command runs in chant's own GitLab pipeline, for the jobs it has.
|
|
241
|
+
* A command no job runs gets the words' reply for it (`words.replies`,
|
|
242
|
+
* #4946), else chant's.
|
|
243
|
+
*/
|
|
184
244
|
export declare function chantNoteRuns(jobs: ChantNoteJobs): NoteCommandRuns;
|
|
185
245
|
/** The directory on `chant/lifecycle` that keeps the notes the poll answered. */
|
|
186
246
|
export declare const NOTES_DIR = "_notes";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ci-note-commands.d.ts","sourceRoot":"","sources":["../src/ci-note-commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAIH,OAAO,
|
|
1
|
+
{"version":3,"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AM,CAEzD;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,IAAI,GAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,OAAO,CAiBlF"}
|
package/dist/ci-note-commands.js
CHANGED
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
import { GITLAB_AGENT_ASK_VAR, GITLAB_AGENT_PR_VAR } from "./ci-agent.js";
|
|
30
30
|
import { GITLAB_COMMIT_ARG_VAR, GITLAB_COMMIT_PR_VAR, GITLAB_COMMIT_WORD_VAR } from "./ci-commit.js";
|
|
31
31
|
import { parseProductComment, productStatusContext } from "./ci-product-words.js";
|
|
32
|
+
import { commandLine, commentTerms, forkReply, memberReply, notRunReply } from "./ci-comment-replies.js";
|
|
32
33
|
import { GITLAB_APPLY_PR_VAR, GITLAB_LOCK_PR_VAR, GITLAB_PREVIEW_PR_VAR, GITLAB_UNLOCK_PR_VAR, PREVIEW_COMMENT_ENV } from "./components/pr-pipeline.js";
|
|
33
34
|
import { ForgeApiError } from "./pr-forge.js";
|
|
34
35
|
export { GITLAB_NOTE_COMMANDS_VAR } from "./components/pr-pipeline.js";
|
|
@@ -204,17 +205,32 @@ async function answer(o, mr, note, least, at, me) {
|
|
|
204
205
|
}
|
|
205
206
|
return reply(`started pipeline${link(started)} to ${run.doing} for ${note.author}`, true, started.url);
|
|
206
207
|
}
|
|
207
|
-
case "retry":
|
|
208
|
-
|
|
208
|
+
case "retry": {
|
|
209
|
+
const done = await retryApply(o, "gitlab", mr, note.author, run, gitlabRetry(o.pipelines));
|
|
210
|
+
if (done.kind === "fail")
|
|
211
|
+
return broke(done.reason);
|
|
212
|
+
return reply(done.text, done.kind === "ran", done.kind === "ran" ? done.url : undefined);
|
|
213
|
+
}
|
|
209
214
|
}
|
|
210
215
|
}
|
|
211
216
|
/** chant's apply jobs and terragucci's: `apply`, `apply-wave-<n>` and `apply-wave-<n>-share-<m>`, a member's prefixed with its name. */
|
|
212
217
|
export const APPLY_JOBS = /^(?:[a-z0-9][a-z0-9-]*-)?apply(?:-wave-([1-9][0-9]*)(?:-share-([1-9][0-9]*))?)?$/;
|
|
213
218
|
const NOT_DONE = new Set(["created", "pending", "running", "waiting_for_resource", "preparing", "scheduled"]);
|
|
214
|
-
|
|
219
|
+
/**
|
|
220
|
+
* Start a merged pull request's apply again (#4785; shared with GitHub and
|
|
221
|
+
* Forgejo in #4946): the newest push run at the merge commit that has an
|
|
222
|
+
* apply job, refused when a later commit of the default branch already
|
|
223
|
+
* carries the product's apply status, since going back to this one would
|
|
224
|
+
* undo it. `rerun` is the forge's own start.
|
|
225
|
+
*/
|
|
226
|
+
export async function retryApply(o, forgeKind, mr, user, run, rerun) {
|
|
215
227
|
const { sha } = run;
|
|
216
228
|
const pattern = run.jobs ?? APPLY_JOBS;
|
|
217
|
-
const
|
|
229
|
+
const t = commentTerms(forgeKind);
|
|
230
|
+
const at = t.at(mr.number);
|
|
231
|
+
const gitlab = forgeKind === "gitlab";
|
|
232
|
+
const runWord = gitlab ? "pipeline" : "workflow run";
|
|
233
|
+
const reply = (text) => ({ kind: "reply", text });
|
|
218
234
|
// The newest push pipeline at the merge commit with an apply job: a branch pipeline, or a ci/green tag's.
|
|
219
235
|
let pipeline;
|
|
220
236
|
let jobs = [];
|
|
@@ -229,11 +245,11 @@ async function retry(o, mr, user, run, reply, broke) {
|
|
|
229
245
|
}
|
|
230
246
|
}
|
|
231
247
|
if (!pipeline)
|
|
232
|
-
return reply(`no
|
|
248
|
+
return reply(`no ${runWord} at the merge commit ${short(sha)} of ${at} has an apply job, so there is nothing to ${gitlab ? "retry" : "run again"}; push to ${o.base} again`);
|
|
233
249
|
newer = await o.reads.branchRuns(o.base, { event: "push", limit: NOTE_COMMANDS_NEWER_PIPELINES });
|
|
234
250
|
}
|
|
235
251
|
catch (e) {
|
|
236
|
-
return
|
|
252
|
+
return { kind: "fail", reason: `could not read the ${runWord}s at ${short(sha)} (${message(e)})` };
|
|
237
253
|
}
|
|
238
254
|
// A later commit whose apply started applied a newer tree: going back to this one would undo it.
|
|
239
255
|
const applyContext = productStatusContext(o.words, "apply");
|
|
@@ -244,46 +260,64 @@ async function retry(o, mr, user, run, reply, broke) {
|
|
|
244
260
|
applied = (await o.forge.commitStatuses?.(c))?.find((s) => s.context === applyContext);
|
|
245
261
|
}
|
|
246
262
|
catch (e) {
|
|
247
|
-
return
|
|
263
|
+
return { kind: "fail", reason: `could not read the statuses of ${short(c)} (${message(e)})` };
|
|
248
264
|
}
|
|
249
265
|
if (applied) {
|
|
250
|
-
const
|
|
251
|
-
return reply(`a later apply already ran on ${o.base} at ${short(c)}${
|
|
266
|
+
const link = applied.targetUrl && /^https?:\/\//.test(applied.targetUrl) ? ` (${applied.targetUrl})` : "";
|
|
267
|
+
return reply(`a later apply already ran on ${o.base} at ${short(c)}${link}, so the merge commit ${short(sha)} of ${at} is not applied: comment on the ${t.request} that commit came from, or push again`);
|
|
252
268
|
}
|
|
253
269
|
}
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
270
|
+
return rerun(pipeline, jobs, { sha, at, user, base: o.base, pattern });
|
|
271
|
+
}
|
|
272
|
+
/** GitLab's start: retry the first apply job, by wave and share, that did not succeed; the jobs after it follow by themselves. */
|
|
273
|
+
export function gitlabRetry(pipelines) {
|
|
274
|
+
return async (pipeline, jobs, { sha, at, user, base, pattern }) => {
|
|
275
|
+
const reply = (text) => ({ kind: "reply", text });
|
|
276
|
+
const order = (j) => {
|
|
277
|
+
const m = pattern.exec(j.name);
|
|
278
|
+
return [m?.[1] ? Number(m[1]) : 0, m?.[2] ? Number(m[2]) : 0];
|
|
279
|
+
};
|
|
280
|
+
const sorted = [...jobs].sort((a, b) => order(a)[0] - order(b)[0] || order(a)[1] - order(b)[1]);
|
|
281
|
+
const next = sorted.find((j) => j.status !== "success");
|
|
282
|
+
if (!next)
|
|
283
|
+
return reply(`every apply job of ${at}'s merge commit ${short(sha)} already succeeded`);
|
|
284
|
+
if (NOT_DONE.has(next.status))
|
|
285
|
+
return reply(`${next.name} at ${short(sha)} is ${next.status} already, so it is not retried`);
|
|
286
|
+
if (next.status !== "failed" && next.status !== "canceled") {
|
|
287
|
+
return reply(`${next.name} at ${short(sha)} was ${next.status}, and GitLab retries only a failed or canceled job; push to ${base} again`);
|
|
288
|
+
}
|
|
289
|
+
let retried;
|
|
290
|
+
try {
|
|
291
|
+
retried = await pipelines.retryJob(next.id);
|
|
292
|
+
}
|
|
293
|
+
catch (e) {
|
|
294
|
+
return { kind: "fail", reason: `could not retry ${next.name} of pipeline ${pipeline.id} (${message(e)})` };
|
|
295
|
+
}
|
|
296
|
+
const link = retried.url ? ` (${retried.url})` : "";
|
|
297
|
+
return { kind: "ran", text: `retried ${next.name} of ${at}'s merge commit ${short(sha)}${link} for ${user}; its gate decides again, and the jobs after it follow, each behind its own gate`, ...(retried.url ? { url: retried.url } : {}) };
|
|
257
298
|
};
|
|
258
|
-
const sorted = [...jobs].sort((a, b) => order(a)[0] - order(b)[0] || order(a)[1] - order(b)[1]);
|
|
259
|
-
const next = sorted.find((j) => j.status !== "success");
|
|
260
|
-
if (!next)
|
|
261
|
-
return reply(`every apply job of !${iid}'s merge commit ${short(sha)} already succeeded`);
|
|
262
|
-
if (NOT_DONE.has(next.status))
|
|
263
|
-
return reply(`${next.name} at ${short(sha)} is ${next.status} already, so it is not retried`);
|
|
264
|
-
if (next.status !== "failed" && next.status !== "canceled") {
|
|
265
|
-
return reply(`${next.name} at ${short(sha)} was ${next.status}, and GitLab retries only a failed or canceled job; push to ${o.base} again`);
|
|
266
|
-
}
|
|
267
|
-
let retried;
|
|
268
|
-
try {
|
|
269
|
-
retried = await o.pipelines.retryJob(next.id);
|
|
270
|
-
}
|
|
271
|
-
catch (e) {
|
|
272
|
-
return broke(`could not retry ${next.name} of pipeline ${pipeline.id} (${message(e)})`);
|
|
273
|
-
}
|
|
274
|
-
const link = retried.url ? ` (${retried.url})` : "";
|
|
275
|
-
return reply(`retried ${next.name} of !${iid}'s merge commit ${short(sha)}${link} for ${user}; its gate decides again, and the jobs after it follow, each behind its own gate`, true, retried.url);
|
|
276
299
|
}
|
|
277
|
-
/**
|
|
300
|
+
/**
|
|
301
|
+
* What a command runs in chant's own GitLab pipeline, for the jobs it has.
|
|
302
|
+
* A command no job runs gets the words' reply for it (`words.replies`,
|
|
303
|
+
* #4946), else chant's.
|
|
304
|
+
*/
|
|
278
305
|
export function chantNoteRuns(jobs) {
|
|
279
306
|
return ({ mr, note, parsed, base, words }) => {
|
|
280
307
|
const iid = String(mr.number);
|
|
281
308
|
const at = `!${mr.number}`;
|
|
282
|
-
const line = (kind) =>
|
|
309
|
+
const line = (kind) => commandLine(words, kind);
|
|
310
|
+
// #4946: a member outside the pipeline's is refused before anything starts, a fork's included.
|
|
311
|
+
const member = parsed.kind === "plan" || parsed.kind === "action" ? parsed.member : undefined;
|
|
312
|
+
if (member !== undefined && jobs.members && !jobs.members.includes(member))
|
|
313
|
+
return { kind: "reply", text: memberReply(words, member, jobs.members, "gitlab") };
|
|
283
314
|
if (!mr.sameRepo)
|
|
284
|
-
return { kind: "reply", text:
|
|
315
|
+
return { kind: "reply", text: forkReply(words, "gitlab") };
|
|
285
316
|
const open = mr.state === "open";
|
|
286
317
|
const intoBase = mr.base === undefined || mr.base === base;
|
|
318
|
+
// #4946: the product's sentence for an apply no job answers, in place of chant's, which say what the merge does.
|
|
319
|
+
if (parsed.kind === "apply" && !jobs.applyBeforeMerge && !jobs.applyOnMerge && words.replies?.apply !== undefined)
|
|
320
|
+
return { kind: "reply", text: words.replies.apply };
|
|
287
321
|
switch (parsed.kind) {
|
|
288
322
|
case "plan":
|
|
289
323
|
if (!open)
|
|
@@ -314,13 +348,13 @@ export function chantNoteRuns(jobs) {
|
|
|
314
348
|
case "lock":
|
|
315
349
|
case "unlock":
|
|
316
350
|
if (!jobs.locks)
|
|
317
|
-
return { kind: "reply", text:
|
|
351
|
+
return { kind: "reply", text: notRunReply(words, parsed.kind, "gitlab") };
|
|
318
352
|
if (parsed.kind === "lock" && !open)
|
|
319
353
|
return { kind: "reply", text: `${at} is not open, so it takes no lock` };
|
|
320
354
|
return { kind: "pipeline", ref: base, variables: { [parsed.kind === "lock" ? GITLAB_LOCK_PR_VAR : GITLAB_UNLOCK_PR_VAR]: iid }, doing: `${parsed.kind} the ${words.noun[1]} of ${at}` };
|
|
321
355
|
case "agent":
|
|
322
356
|
if (!jobs.agent)
|
|
323
|
-
return { kind: "reply", text:
|
|
357
|
+
return { kind: "reply", text: notRunReply(words, "agent", "gitlab") };
|
|
324
358
|
if (!open)
|
|
325
359
|
return { kind: "reply", text: `${at} is not open, so the agent does not run` };
|
|
326
360
|
if (mr.head === base)
|
|
@@ -59,7 +59,45 @@ export interface CiProductAlias {
|
|
|
59
59
|
command: CiProductCommand;
|
|
60
60
|
/** The variable that turns the alias on in a job (terragucci's `TG_ATLANTIS_COMMENTS`). Absent: always on. */
|
|
61
61
|
when?: string;
|
|
62
|
+
/**
|
|
63
|
+
* Flags of the other tool that the product has no counterpart for, each
|
|
64
|
+
* with the reply that refuses it (#4946), such as terragucci's `{ "-p":
|
|
65
|
+
* "a root goes by its path, not a project name: ..." }` on `atlantis
|
|
66
|
+
* plan`. A flag here is refused before the alias reads `-d`, so a product
|
|
67
|
+
* can refuse `atlantis apply -d` too. `--` refuses everything after it.
|
|
68
|
+
*/
|
|
69
|
+
refuse?: Record<string, string>;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* What a comment job replies to a command the pipeline runs no job for
|
|
73
|
+
* (#4946), in the product's own sentences. Each slot left out takes
|
|
74
|
+
* chant's. The comment job on GitHub and Forgejo and the note poll on
|
|
75
|
+
* GitLab both read these.
|
|
76
|
+
*/
|
|
77
|
+
export interface CiProductCommentReplies {
|
|
78
|
+
/** A plan comment where no job plans on a comment (GitHub and Forgejo; GitLab starts a merge request pipeline). */
|
|
79
|
+
plan?: string;
|
|
80
|
+
/** An apply comment where no job applies on a comment: neither an apply before merge nor the re-run of a merged pull request's apply. */
|
|
81
|
+
apply?: string;
|
|
82
|
+
/** A lock comment where the pipeline takes no locks. */
|
|
83
|
+
lock?: string;
|
|
84
|
+
/** An unlock comment where the pipeline takes no locks. */
|
|
85
|
+
unlock?: string;
|
|
86
|
+
/** An action comment where no workflow runs actions (GitHub and Forgejo; GitLab names the checkout to run it from). */
|
|
87
|
+
action?: string;
|
|
88
|
+
/** An agent comment where the agent is off. */
|
|
89
|
+
agent?: string;
|
|
90
|
+
/** Any command on a pull request from a fork. */
|
|
91
|
+
fork?: string;
|
|
92
|
+
/**
|
|
93
|
+
* A comment that names a member the pipeline was not written with, over
|
|
94
|
+
* `{member}` (the one named) and `{members}` (the pipeline's, each in
|
|
95
|
+
* backticks, sorted, comma separated).
|
|
96
|
+
*/
|
|
97
|
+
member?: string;
|
|
62
98
|
}
|
|
99
|
+
/** The reply slots, for checking a product's words. */
|
|
100
|
+
export declare const CI_PRODUCT_COMMENT_REPLIES: readonly (keyof CiProductCommentReplies)[];
|
|
63
101
|
/** The words a product passes. Every slot is optional; a missing one takes chant's. */
|
|
64
102
|
export interface CiProductWordsInput {
|
|
65
103
|
/** The status prefix, the note heading and the comment prefix: `chant`, `terragucci`, `plywood`. */
|
|
@@ -117,6 +155,8 @@ export interface CiProductWordsInput {
|
|
|
117
155
|
adoptMarkers?: string[];
|
|
118
156
|
/** What chant's notify sends under these words (#4610). */
|
|
119
157
|
notify?: CiProductNotifyWordsInput;
|
|
158
|
+
/** The replies to commands the pipeline runs no job for (#4946). Default: chant's. */
|
|
159
|
+
replies?: CiProductCommentReplies;
|
|
120
160
|
}
|
|
121
161
|
/** The notify slots a product passes (#4610). */
|
|
122
162
|
export interface CiProductNotifyWordsInput {
|
|
@@ -166,6 +206,8 @@ export interface CiProductWords {
|
|
|
166
206
|
bin?: string;
|
|
167
207
|
adoptMarkers: string[];
|
|
168
208
|
notify: CiProductNotifyWords;
|
|
209
|
+
/** The product's replies to commands no job runs (#4946), when it gives any. */
|
|
210
|
+
replies?: CiProductCommentReplies;
|
|
169
211
|
}
|
|
170
212
|
/** chant's own approve line. */
|
|
171
213
|
export declare const CHANT_APPROVE_TEMPLATE = "chant approve {op} {gate} --plan {digest} --approver {approver} {sign}";
|
|
@@ -312,6 +354,19 @@ export type ParsedProductComment =
|
|
|
312
354
|
export declare const COMMIT_COMMENT_ARG: RegExp;
|
|
313
355
|
/** The longest ask an agent comment may carry. */
|
|
314
356
|
export declare const PRODUCT_COMMENT_ASK_MAX = 2000;
|
|
357
|
+
/** {@link parseProductComment}'s options. */
|
|
358
|
+
export interface ProductCommentOptions {
|
|
359
|
+
/** Leave every comment for a commit word to the commit job (#4890): it is undefined here, a refused one included. */
|
|
360
|
+
leaveCommit?: boolean;
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* The commit word a comment names (#4890): its first two words, split on
|
|
364
|
+
* any space, are `/<product> <word>` and the words map `<word>` onto
|
|
365
|
+
* `commit`. The commit job replies to a refused comment by this rule
|
|
366
|
+
* (#4838), so a comment job that skips these never answers a comment the
|
|
367
|
+
* commit job answers. Undefined for any other comment.
|
|
368
|
+
*/
|
|
369
|
+
export declare function commitWordOf(words: CiProductWords, body: unknown): string | undefined;
|
|
315
370
|
/**
|
|
316
371
|
* Read a comment against the product's grammar (moved from terragucci's
|
|
317
372
|
* comment.ts). Undefined when it is not addressed to the product. A comment
|
|
@@ -324,8 +379,14 @@ export declare const PRODUCT_COMMENT_ASK_MAX = 2000;
|
|
|
324
379
|
* names the commit words that take one argument after them (#4820), each
|
|
325
380
|
* with the pattern it must match; it must also match
|
|
326
381
|
* {@link COMMIT_COMMENT_ARG}. Any other commit word takes nothing.
|
|
382
|
+
*
|
|
383
|
+
* `leaveCommit` (#4890) is for a comment job that is not the commit job: a
|
|
384
|
+
* comment for a commit word is undefined, a malformed one included
|
|
385
|
+
* ({@link commitWordOf}), because the commit job answers it, refusals and
|
|
386
|
+
* all (#4838). Without it, a malformed `/<product> <commit word> x` would
|
|
387
|
+
* get a reply from both jobs.
|
|
327
388
|
*/
|
|
328
|
-
export declare function parseProductComment(words: CiProductWords, body: unknown, env?: Record<string, string | undefined>, commitArgs?: Readonly<Record<string, RegExp
|
|
389
|
+
export declare function parseProductComment(words: CiProductWords, body: unknown, env?: Record<string, string | undefined>, commitArgs?: Readonly<Record<string, RegExp>>, options?: ProductCommentOptions): ParsedProductComment | undefined;
|
|
329
390
|
/**
|
|
330
391
|
* The variables the generated action job (#4654) hands the product's action
|
|
331
392
|
* verb: the comment that started it, on a comment, and the dispatch's two
|