@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/action-pins.d.ts
CHANGED
|
@@ -44,6 +44,7 @@ export declare const ACTION_PINS: {
|
|
|
44
44
|
readonly setupBun2: ActionPin;
|
|
45
45
|
readonly golangciLint9: ActionPin;
|
|
46
46
|
readonly dockerLogin4: ActionPin;
|
|
47
|
+
readonly dockerSetupQemu4: ActionPin;
|
|
47
48
|
readonly dockerSetupBuildx4: ActionPin;
|
|
48
49
|
readonly dockerMetadata6: ActionPin;
|
|
49
50
|
readonly dockerBuildPush7: ActionPin;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action-pins.d.ts","sourceRoot":"","sources":["../src/action-pins.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,gEAAgE;AAChE,eAAO,MAAM,gBAAgB,aAAa,CAAC;AAE3C,MAAM,WAAW,SAAS;IACxB,6DAA6D;IAC7D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,mDAAmD;IACnD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,mEAAmE;IACnE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB;AAID,eAAO,MAAM,WAAW
|
|
1
|
+
{"version":3,"file":"action-pins.d.ts","sourceRoot":"","sources":["../src/action-pins.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,gEAAgE;AAChE,eAAO,MAAM,gBAAgB,aAAa,CAAC;AAE3C,MAAM,WAAW,SAAS;IACxB,6DAA6D;IAC7D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,mDAAmD;IACnD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,mEAAmE;IACnE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB;AAID,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BsB,CAAC;AAE/C,6DAA6D;AAC7D,eAAO,MAAM,OAAO,MAAO,SAAS,KAAG,MAA8B,CAAC;AAKtE,8IAA8I;AAC9I,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAKhD;AAED,sKAAsK;AACtK,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAQtD;AAED,8IAA8I;AAC9I,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAI5E;AAED,mFAAmF;AACnF,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAGxD"}
|
package/dist/action-pins.js
CHANGED
|
@@ -36,6 +36,8 @@ export const ACTION_PINS = {
|
|
|
36
36
|
setupBun2: pin("oven-sh/setup-bun", "v2", "0c5077e51419868618aeaa5fe8019c62421857d6", "v2.2.0"),
|
|
37
37
|
golangciLint9: pin("golangci/golangci-lint-action", "v9", "ba0d7d2ec06a0ea1cb5fa41b2e4a3ab91d21278a", "v9.3.0"),
|
|
38
38
|
dockerLogin4: pin("docker/login-action", "v4", "81c6f93d4bc991e510b342a00b419b3bb4efc5c6", "v4.7.0"),
|
|
39
|
+
// #4876: the release workflow's QEMU binfmt setup for a `release.images` platform the runner can't run.
|
|
40
|
+
dockerSetupQemu4: pin("docker/setup-qemu-action", "v4", "99012661954931238ded8c8b007157a8430204e1", "v4.4.0"),
|
|
39
41
|
dockerSetupBuildx4: pin("docker/setup-buildx-action", "v4", "f87e5991a6d7451dcb8d9637bfbc97413f497069", "v4.4.1"),
|
|
40
42
|
dockerMetadata6: pin("docker/metadata-action", "v6", "dc802804100637a589fabce1cb79ff13a1411302", "v6.2.0"),
|
|
41
43
|
dockerBuildPush7: pin("docker/build-push-action", "v7", "c3c9e263c25d99ce0380d002d59b67737d91b0dc", "v7.4.0"),
|
package/dist/actor.d.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Who runs a command, when the caller names nobody (#4911): the forge's
|
|
3
|
+
* actor in a job (`GITHUB_ACTOR`, which Forgejo sets too, then
|
|
4
|
+
* `GITLAB_USER_LOGIN`), else the login (`USER`, `USERNAME` on Windows).
|
|
5
|
+
* The terraform and pulumi lexicons' gated requests and the products'
|
|
6
|
+
* requesters read it here rather than each writing the order, and so do
|
|
7
|
+
* chant's own CLI handlers and the records they write (#4952). A caller
|
|
8
|
+
* that refuses when nobody is named passes `""` as the fallback.
|
|
9
|
+
*
|
|
10
|
+
* {@link actorOf} is the same order with the two places a product's
|
|
11
|
+
* requester also looks (#4966): `GITHUB_TRIGGERING_ACTOR` ahead of the
|
|
12
|
+
* forge's actor, which names who re-ran a job rather than who started its
|
|
13
|
+
* run, and git's `user.name` in the checkout between the forge's actor and
|
|
14
|
+
* the login, which names the person at a laptop better than `$USER`.
|
|
15
|
+
*/
|
|
16
|
+
/** The actor fallback's variables, in the order {@link actorFromEnv} reads them. */
|
|
17
|
+
export declare const ACTOR_ENV_ORDER: readonly ["GITHUB_ACTOR", "GITLAB_USER_LOGIN", "USER", "USERNAME"];
|
|
18
|
+
/** The first of {@link ACTOR_ENV_ORDER} set to something other than blanks, else `fallback` (default `unknown`). */
|
|
19
|
+
export declare function actorFromEnv(env?: Record<string, string | undefined>, fallback?: string): string;
|
|
20
|
+
/** Which of the places {@link actorOf} reads, and the answer when none is set. */
|
|
21
|
+
export interface ActorOptions {
|
|
22
|
+
/** The variables. Default `process.env`. */
|
|
23
|
+
env?: Record<string, string | undefined>;
|
|
24
|
+
/** Read `GITHUB_TRIGGERING_ACTOR` first: who re-ran the job, ahead of who started the run. Default false. */
|
|
25
|
+
triggering?: boolean;
|
|
26
|
+
/** Read the forge's actor (`GITHUB_ACTOR`, `GITLAB_USER_LOGIN`). Default true. */
|
|
27
|
+
forge?: boolean;
|
|
28
|
+
/** A checkout whose git config is read after the forge's actor. Unset, git is not asked. */
|
|
29
|
+
repo?: string;
|
|
30
|
+
/** The git config keys read in `repo`, in order. Default `["user.name"]`. */
|
|
31
|
+
gitKeys?: readonly string[];
|
|
32
|
+
/** Read the login (`USER`, `USERNAME`) last. Default true. */
|
|
33
|
+
login?: boolean;
|
|
34
|
+
/** The answer when nothing is set. Default `unknown`; `""` for a caller that refuses. */
|
|
35
|
+
fallback?: string;
|
|
36
|
+
}
|
|
37
|
+
/** The places {@link actorOf} reads for `options`, in order: variable names, and `git:<key>` for a git config key. */
|
|
38
|
+
export declare function actorOrder(options?: Omit<ActorOptions, "env" | "fallback">): string[];
|
|
39
|
+
/**
|
|
40
|
+
* The first place of {@link actorOrder} set to something other than blanks,
|
|
41
|
+
* else `fallback` (#4966). With no options it answers as
|
|
42
|
+
* {@link actorFromEnv}. A git config key is read only when every place
|
|
43
|
+
* before it is empty, so a job with a forge actor runs no git.
|
|
44
|
+
*/
|
|
45
|
+
export declare function actorOf(options?: ActorOptions): string;
|
|
46
|
+
export { ACTOR_ORDER_FLOOR } from "./release-floors.js";
|
|
47
|
+
//# sourceMappingURL=actor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actor.d.ts","sourceRoot":"","sources":["../src/actor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,oFAAoF;AACpF,eAAO,MAAM,eAAe,YAAI,cAAc,EAAE,mBAAmB,EAAE,MAAM,EAAE,UAAU,CAAU,CAAC;AAElG,oHAAoH;AACpH,wBAAgB,YAAY,CAAC,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAe,EAAE,QAAQ,SAAY,GAAG,MAAM,CAMhH;AAED,kFAAkF;AAClF,MAAM,WAAW,YAAY;IAC3B,4CAA4C;IAC5C,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IACzC,6GAA6G;IAC7G,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,kFAAkF;IAClF,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,4FAA4F;IAC5F,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,6EAA6E;IAC7E,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B,8DAA8D;IAC9D,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,yFAAyF;IACzF,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,sHAAsH;AACtH,wBAAgB,UAAU,CAAC,OAAO,GAAE,IAAI,CAAC,YAAY,EAAE,KAAK,GAAG,UAAU,CAAM,GAAG,MAAM,EAAE,CAOzF;AAOD;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,OAAO,GAAE,YAAiB,GAAG,MAAM,CAO1D;AAED,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC"}
|
package/dist/actor.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Who runs a command, when the caller names nobody (#4911): the forge's
|
|
3
|
+
* actor in a job (`GITHUB_ACTOR`, which Forgejo sets too, then
|
|
4
|
+
* `GITLAB_USER_LOGIN`), else the login (`USER`, `USERNAME` on Windows).
|
|
5
|
+
* The terraform and pulumi lexicons' gated requests and the products'
|
|
6
|
+
* requesters read it here rather than each writing the order, and so do
|
|
7
|
+
* chant's own CLI handlers and the records they write (#4952). A caller
|
|
8
|
+
* that refuses when nobody is named passes `""` as the fallback.
|
|
9
|
+
*
|
|
10
|
+
* {@link actorOf} is the same order with the two places a product's
|
|
11
|
+
* requester also looks (#4966): `GITHUB_TRIGGERING_ACTOR` ahead of the
|
|
12
|
+
* forge's actor, which names who re-ran a job rather than who started its
|
|
13
|
+
* run, and git's `user.name` in the checkout between the forge's actor and
|
|
14
|
+
* the login, which names the person at a laptop better than `$USER`.
|
|
15
|
+
*/
|
|
16
|
+
import { spawnSync } from "node:child_process";
|
|
17
|
+
/** The actor fallback's variables, in the order {@link actorFromEnv} reads them. */
|
|
18
|
+
export const ACTOR_ENV_ORDER = ["GITHUB_ACTOR", "GITLAB_USER_LOGIN", "USER", "USERNAME"];
|
|
19
|
+
/** The first of {@link ACTOR_ENV_ORDER} set to something other than blanks, else `fallback` (default `unknown`). */
|
|
20
|
+
export function actorFromEnv(env = process.env, fallback = "unknown") {
|
|
21
|
+
for (const name of ACTOR_ENV_ORDER) {
|
|
22
|
+
const v = env[name]?.trim();
|
|
23
|
+
if (v)
|
|
24
|
+
return v;
|
|
25
|
+
}
|
|
26
|
+
return fallback;
|
|
27
|
+
}
|
|
28
|
+
/** The places {@link actorOf} reads for `options`, in order: variable names, and `git:<key>` for a git config key. */
|
|
29
|
+
export function actorOrder(options = {}) {
|
|
30
|
+
return [
|
|
31
|
+
...(options.triggering ? ["GITHUB_TRIGGERING_ACTOR"] : []),
|
|
32
|
+
...(options.forge === false ? [] : ["GITHUB_ACTOR", "GITLAB_USER_LOGIN"]),
|
|
33
|
+
...(options.repo !== undefined ? (options.gitKeys ?? ["user.name"]).map((k) => `git:${k}`) : []),
|
|
34
|
+
...(options.login === false ? [] : ["USER", "USERNAME"]),
|
|
35
|
+
];
|
|
36
|
+
}
|
|
37
|
+
function gitConfig(repo, key) {
|
|
38
|
+
const r = spawnSync("git", ["-C", repo, "config", key], { encoding: "utf-8", stdio: ["ignore", "pipe", "ignore"] });
|
|
39
|
+
return r.status === 0 ? r.stdout.trim() : undefined;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The first place of {@link actorOrder} set to something other than blanks,
|
|
43
|
+
* else `fallback` (#4966). With no options it answers as
|
|
44
|
+
* {@link actorFromEnv}. A git config key is read only when every place
|
|
45
|
+
* before it is empty, so a job with a forge actor runs no git.
|
|
46
|
+
*/
|
|
47
|
+
export function actorOf(options = {}) {
|
|
48
|
+
const env = options.env ?? process.env;
|
|
49
|
+
for (const place of actorOrder(options)) {
|
|
50
|
+
const v = (place.startsWith("git:") ? gitConfig(options.repo, place.slice(4)) : env[place])?.trim();
|
|
51
|
+
if (v)
|
|
52
|
+
return v;
|
|
53
|
+
}
|
|
54
|
+
return options.fallback ?? "unknown";
|
|
55
|
+
}
|
|
56
|
+
export { ACTOR_ORDER_FLOOR } from "./release-floors.js";
|
package/dist/bundle-check.d.ts
CHANGED
|
@@ -25,14 +25,29 @@ export interface EsbuildPluginLike {
|
|
|
25
25
|
} | undefined): void;
|
|
26
26
|
}): void;
|
|
27
27
|
}
|
|
28
|
+
/** What {@link chantExternalPlugin} keeps external, and where it records it. */
|
|
29
|
+
export interface ChantExternalOptions {
|
|
30
|
+
/**
|
|
31
|
+
* The chant packages whose imports may stay external (#4922). Default: the
|
|
32
|
+
* `@intentius/chant*` packages in the `dependencies` of `pkgDir`'s
|
|
33
|
+
* package.json, the ones an install of the published package brings. A
|
|
34
|
+
* product that bundles its lexicons (devDependencies) and depends only on
|
|
35
|
+
* `@intentius/chant` gets core external and the lexicons bundled.
|
|
36
|
+
*/
|
|
37
|
+
packages?: Iterable<string>;
|
|
38
|
+
/** Collects the specifiers left external. */
|
|
39
|
+
external?: Set<string>;
|
|
40
|
+
}
|
|
28
41
|
/**
|
|
29
42
|
* An esbuild plugin that leaves an `@intentius/chant*` import external when
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
43
|
+
* its package is one of `options.packages` (by default the package's chant
|
|
44
|
+
* `dependencies`, #4922) and the chant installed for `pkgDir` (where the bin
|
|
45
|
+
* runs) serves it as compiled JS, so the bundle runs the installed, pinned
|
|
46
|
+
* chant. Any other chant import goes on to the next plugin and esbuild, which
|
|
47
|
+
* bundle it. A bundled lexicon's own imports of core come through here too.
|
|
48
|
+
* The second argument may still be the `external` set alone.
|
|
34
49
|
*/
|
|
35
|
-
export declare function chantExternalPlugin(pkgDir: string,
|
|
50
|
+
export declare function chantExternalPlugin(pkgDir: string, options?: ChantExternalOptions | Set<string>): EsbuildPluginLike;
|
|
36
51
|
/**
|
|
37
52
|
* The bare specifiers a bundle imports: static `import` and `export ... from`,
|
|
38
53
|
* `import()` and `require()` of a string. Relative imports are left out, and
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundle-check.d.ts","sourceRoot":"","sources":["../src/bundle-check.ts"],"names":[],"mappings":"AA4EA,kHAAkH;AAClH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAMrF;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAOzF;AAED,gHAAgH;AAChH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAE3D;AAED,gHAAgH;AAChH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,KAAK,EAAE;QACX,SAAS,CAAC,OAAO,EAAE;YAAE,MAAM,EAAE,MAAM,CAAA;SAAE,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE;YAAE,IAAI,EAAE,MAAM,CAAA;SAAE,KAAK;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,QAAQ,EAAE,OAAO,CAAA;SAAE,GAAG,SAAS,GAAG,IAAI,CAAC;KACrI,GAAG,IAAI,CAAC;CACV;AAED;;;;;;
|
|
1
|
+
{"version":3,"file":"bundle-check.d.ts","sourceRoot":"","sources":["../src/bundle-check.ts"],"names":[],"mappings":"AA4EA,kHAAkH;AAClH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAMrF;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAOzF;AAED,gHAAgH;AAChH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAE3D;AAED,gHAAgH;AAChH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,KAAK,EAAE;QACX,SAAS,CAAC,OAAO,EAAE;YAAE,MAAM,EAAE,MAAM,CAAA;SAAE,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE;YAAE,IAAI,EAAE,MAAM,CAAA;SAAE,KAAK;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,QAAQ,EAAE,OAAO,CAAA;SAAE,GAAG,SAAS,GAAG,IAAI,CAAC;KACrI,GAAG,IAAI,CAAC;CACV;AAED,gFAAgF;AAChF,MAAM,WAAW,oBAAoB;IACnC;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC5B,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CACxB;AAUD;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,oBAAoB,GAAG,GAAG,CAAC,MAAM,CAAC,GAAG,iBAAiB,CAenH;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAQpD;AAED,mEAAmE;AACnE,wBAAgB,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED,kJAAkJ;AAClJ,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,oEAAoE;IACpE,IAAI,EAAE,MAAM,CAAC;CACd;AAED,gIAAgI;AAChI,MAAM,WAAW,iBAAiB;IAChC,sDAAsD;IACtD,MAAM,EAAE,MAAM,CAAC;IACf,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,wGAAwG;IACxG,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,qGAAqG;IACrG,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,WAAW,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,OAAO,CAAC;IACZ,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,6DAA6D;IAC7D,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kEAAkE;IAClE,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,8FAA8F;IAC9F,KAAK,EAAE,MAAM,CAAC;CACf;AAcD,kIAAkI;AAClI,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAMlD;AAED,8FAA8F;AAC9F,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS,CAInF;AASD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,GAAG,iBAAiB,CAwGxF"}
|
package/dist/bundle-check.js
CHANGED
|
@@ -111,18 +111,33 @@ export function chantRuntimeTarget(specifier, fromDir) {
|
|
|
111
111
|
export function chantServesCompiled(pkgDir) {
|
|
112
112
|
return chantRuntimeTarget("@intentius/chant", pkgDir) !== undefined;
|
|
113
113
|
}
|
|
114
|
+
/** The `@intentius/chant*` names in the `dependencies` of the package at `pkgDir`. */
|
|
115
|
+
function chantDependencies(pkgDir) {
|
|
116
|
+
const f = join(pkgDir, "package.json");
|
|
117
|
+
if (!existsSync(f))
|
|
118
|
+
return [];
|
|
119
|
+
const deps = JSON.parse(readFileSync(f, "utf8")).dependencies ?? {};
|
|
120
|
+
return Object.keys(deps).filter((n) => CHANT.test(n));
|
|
121
|
+
}
|
|
114
122
|
/**
|
|
115
123
|
* An esbuild plugin that leaves an `@intentius/chant*` import external when
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
124
|
+
* its package is one of `options.packages` (by default the package's chant
|
|
125
|
+
* `dependencies`, #4922) and the chant installed for `pkgDir` (where the bin
|
|
126
|
+
* runs) serves it as compiled JS, so the bundle runs the installed, pinned
|
|
127
|
+
* chant. Any other chant import goes on to the next plugin and esbuild, which
|
|
128
|
+
* bundle it. A bundled lexicon's own imports of core come through here too.
|
|
129
|
+
* The second argument may still be the `external` set alone.
|
|
120
130
|
*/
|
|
121
|
-
export function chantExternalPlugin(pkgDir,
|
|
131
|
+
export function chantExternalPlugin(pkgDir, options) {
|
|
132
|
+
const opts = options instanceof Set ? { external: options } : (options ?? {});
|
|
133
|
+
const external = opts.external;
|
|
134
|
+
const keep = new Set(opts.packages ?? chantDependencies(pkgDir));
|
|
122
135
|
return {
|
|
123
136
|
name: "chant-external",
|
|
124
137
|
setup(b) {
|
|
125
138
|
b.onResolve({ filter: CHANT }, (args) => {
|
|
139
|
+
if (!keep.has(CHANT.exec(args.path)[1]))
|
|
140
|
+
return undefined;
|
|
126
141
|
if (chantRuntimeTarget(args.path, pkgDir) === undefined)
|
|
127
142
|
return undefined;
|
|
128
143
|
external?.add(args.path);
|
package/dist/chant-install.d.ts
CHANGED
|
@@ -18,7 +18,17 @@
|
|
|
18
18
|
* {@link chantArgv} runs the package's `bin/chant` with the node running
|
|
19
19
|
* now: the bin picks the compiled CLI in an installed package and the source
|
|
20
20
|
* in a checkout (#3878), so a product never chooses between them.
|
|
21
|
+
*
|
|
22
|
+
* #4889: {@link runChant} spawns that chant and returns its output and its
|
|
23
|
+
* last `--json` document ({@link lastJsonLine}), and
|
|
24
|
+
* {@link installResolveFallback} and {@link fallbackImportArgs} resolve any
|
|
25
|
+
* bare specifier a file with no `node_modules` above it imports, in the
|
|
26
|
+
* product's process and in chant's children, from the product's install
|
|
27
|
+
* (SQL Yodeler's `resolve-fallback.ts` and `process.ts`, terragucci's
|
|
28
|
+
* `runChant` in `resume.ts`).
|
|
21
29
|
*/
|
|
30
|
+
/** The first chant with `runChant`, `lastJsonLine`, `installResolveFallback` and `fallbackImportArgs` in `@intentius/chant/chant-install` (#4889): a product runs chant and reads its `--json` document, and a file with no `node_modules` above it imports the product's packages, with no code of the product's own. */
|
|
31
|
+
export declare const CHANT_RUN_FLOOR = "0.124.88";
|
|
22
32
|
/** Where a chant package is installed. */
|
|
23
33
|
export interface ChantInstall {
|
|
24
34
|
/** The `@intentius/chant` package directory. */
|
|
@@ -96,5 +106,93 @@ export declare function chantResolveFallback(from: string): (specifier: string,
|
|
|
96
106
|
* repository needs chant in its own `node_modules`.
|
|
97
107
|
*/
|
|
98
108
|
export declare function installChantResolveFallback(from?: string): boolean;
|
|
109
|
+
/** A bare specifier: a package name, not a relative or absolute path, a URL, a `node:` builtin or a `#` import. */
|
|
110
|
+
export declare function isBareSpecifier(specifier: string): boolean;
|
|
111
|
+
/** Whether the file at `url` has a `node_modules` directory in its own directory or any above it. A URL that is not a file's counts as having one. */
|
|
112
|
+
export declare function hasNodeModulesAbove(url: unknown): boolean;
|
|
113
|
+
/**
|
|
114
|
+
* The file URL a bare specifier is retried from: a file beside the
|
|
115
|
+
* `node_modules` directory that holds `from` (by default this module, in
|
|
116
|
+
* the chant the product depends on), so the retry finds the product's own
|
|
117
|
+
* packages first; `from` itself when it is in no `node_modules`, as in a
|
|
118
|
+
* chant checkout. SQL Yodeler's `ownModules`.
|
|
119
|
+
*/
|
|
120
|
+
export declare function fallbackParent(from?: string): string;
|
|
121
|
+
/**
|
|
122
|
+
* A resolve hook (SQL Yodeler's `resolve-fallback.ts`): a bare specifier
|
|
123
|
+
* Node could not find, imported by a file with no `node_modules` in its
|
|
124
|
+
* directory or any above it, resolves from `parent`. chant's commit job
|
|
125
|
+
* runs a product's command in a git worktree outside the checkout the job
|
|
126
|
+
* installed, so a `chant.config.ts` or an Op there imports chant, its
|
|
127
|
+
* lexicons and the product by name and finds none of them. A file that has
|
|
128
|
+
* an install of its own, and any other failure, is left as Node reports it.
|
|
129
|
+
*/
|
|
130
|
+
export declare function bareResolveFallback(parent: string): (specifier: string, context: Record<string, unknown>, next: NextResolve) => ResolveResult;
|
|
131
|
+
/**
|
|
132
|
+
* Install {@link bareResolveFallback} once in this process, retrying from
|
|
133
|
+
* `parent` (default {@link fallbackParent}). A product's bin calls it before
|
|
134
|
+
* it loads a repository's `chant.config.ts` or Ops. Uses Node's
|
|
135
|
+
* `module.registerHooks` where it has one, else `module.register`. Returns
|
|
136
|
+
* whether it is installed: false on a Node with neither.
|
|
137
|
+
*/
|
|
138
|
+
export declare function installResolveFallback(parent?: string): boolean;
|
|
139
|
+
/**
|
|
140
|
+
* The node arguments that install {@link bareResolveFallback} in a chant
|
|
141
|
+
* child (`chant build`, `chant run`), before its own imports of the
|
|
142
|
+
* repository's files: one `--import` of a `data:` module, so it loads the
|
|
143
|
+
* same from a product's `src/` under tsx and from its bundle. Pass them as
|
|
144
|
+
* {@link chantArgv}'s `nodeArgs`, or {@link runChant}'s `resolveFallback`.
|
|
145
|
+
*/
|
|
146
|
+
export declare function fallbackImportArgs(parent?: string): string[];
|
|
147
|
+
/** What {@link runChant} returns once the child exits. */
|
|
148
|
+
export interface ChantRun {
|
|
149
|
+
/** The exit code; 128 when a signal ended it. */
|
|
150
|
+
code: number;
|
|
151
|
+
stdout: string;
|
|
152
|
+
stderr: string;
|
|
153
|
+
/** {@link lastJsonLine} of `stdout`: the `--json` document, when the command printed one. */
|
|
154
|
+
json?: unknown;
|
|
155
|
+
}
|
|
156
|
+
export interface RunChantOptions {
|
|
157
|
+
/** The directory chant runs in. Default the current one. */
|
|
158
|
+
cwd?: string;
|
|
159
|
+
/** The environment the child starts from, before {@link chantEnv}. Default `process.env`. */
|
|
160
|
+
env?: NodeJS.ProcessEnv;
|
|
161
|
+
/**
|
|
162
|
+
* A chant executable to run as it is (a product's `--chant` flag): no
|
|
163
|
+
* node in front of it, so `nodeArgs` and `resolveFallback` do not apply.
|
|
164
|
+
*/
|
|
165
|
+
chant?: string;
|
|
166
|
+
/** The install to run. Default {@link bundledChant}, else the first of `from` that {@link installedChant} finds, else `chant` on PATH. */
|
|
167
|
+
install?: ChantInstall;
|
|
168
|
+
/** Directories to look for an install from when this module is in none (terragucci looks from the repository). */
|
|
169
|
+
from?: readonly string[];
|
|
170
|
+
/** Node arguments before the bin, such as a product's own `--import`. */
|
|
171
|
+
nodeArgs?: readonly string[];
|
|
172
|
+
/** Install {@link bareResolveFallback} in the child (`true` from {@link fallbackParent}, or a parent URL). */
|
|
173
|
+
resolveFallback?: boolean | string;
|
|
174
|
+
/** `FORCE_COLOR=0` and `NO_COLOR=1`, for output a product reads. */
|
|
175
|
+
noColor?: boolean;
|
|
176
|
+
/** `inherit` writes the child's output to this process's and captures none. Default `pipe`. */
|
|
177
|
+
stdio?: "pipe" | "inherit";
|
|
178
|
+
/** Each chunk as it arrives, for output a person watches. */
|
|
179
|
+
onStdout?: (text: string) => void;
|
|
180
|
+
onStderr?: (text: string) => void;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Run `chant <args>` and resolve with its exit code, its output and its
|
|
184
|
+
* `--json` document (#4889; SQL Yodeler's `runChant`, terragucci's in
|
|
185
|
+
* `resume.ts`). The chant is the product's own ({@link chantArgv}) with its
|
|
186
|
+
* bin first on PATH ({@link chantEnv}). Never rejects on a non-zero exit;
|
|
187
|
+
* rejects when the child cannot start.
|
|
188
|
+
*/
|
|
189
|
+
export declare function runChant(args: readonly string[], options?: RunChantOptions): Promise<ChantRun>;
|
|
190
|
+
/**
|
|
191
|
+
* The last line of `stdout` that parses as a JSON object: chant prints its
|
|
192
|
+
* `--json` document as one line, after any log lines. A pretty-printed
|
|
193
|
+
* document is read from the first `{` to the end. Undefined when there is
|
|
194
|
+
* none.
|
|
195
|
+
*/
|
|
196
|
+
export declare function lastJsonLine(stdout: string): unknown;
|
|
99
197
|
export {};
|
|
100
198
|
//# sourceMappingURL=chant-install.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chant-install.d.ts","sourceRoot":"","sources":["../src/chant-install.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"chant-install.d.ts","sourceRoot":"","sources":["../src/chant-install.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAQH,0TAA0T;AAC1T,eAAO,MAAM,eAAe,aAAa,CAAC;AAE1C,0CAA0C;AAC1C,MAAM,WAAW,YAAY;IAC3B,gDAAgD;IAChD,IAAI,EAAE,MAAM,CAAC;IACb,+DAA+D;IAC/D,GAAG,EAAE,MAAM,CAAC;IACZ,qEAAqE;IACrE,MAAM,EAAE,MAAM,CAAC;IACf,gDAAgD;IAChD,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAsBD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,YAAY,GAAG,SAAS,CAWhF;AAID;;;;;;GAMG;AACH,wBAAgB,YAAY,IAAI,YAAY,GAAG,SAAS,CAMvD;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAAO,GAAG,MAAM,CAE/F;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,OAAO,GAAE;IAAE,OAAO,CAAC,EAAE,YAAY,CAAC;IAAC,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAAO,GAAG,MAAM,EAAE,CAInI;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,IAAI,GAAE,MAAM,CAAC,UAAwB,EAAE,OAAO,GAAE,YAAY,GAAG,SAA0B,GAAG,MAAM,CAAC,UAAU,CAGrI;AAED,oGAAoG;AACpG,eAAO,MAAM,eAAe,QAAuD,CAAC;AAIpF,UAAU,aAAa;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AACD,KAAK,WAAW,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,aAAa,CAAC;AAG3F;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,eAC5B,MAAM,WAAW,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,QAAQ,WAAW,KAAG,aAAa,CAU/F;AAID;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CAAC,IAAI,GAAE,MAAwB,GAAG,OAAO,CAQnF;AAID,mHAAmH;AACnH,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAE1D;AAED,sJAAsJ;AACtJ,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAQzD;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,IAAI,GAAE,MAAwB,GAAG,MAAM,CAMrE;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,eAC7B,MAAM,WAAW,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,QAAQ,WAAW,KAAG,aAAa,CAU/F;AAwCD;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,GAAE,MAAyB,GAAG,OAAO,CASjF;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,GAAE,MAAyB,GAAG,MAAM,EAAE,CAQ9E;AAID,0DAA0D;AAC1D,MAAM,WAAW,QAAQ;IACvB,iDAAiD;IACjD,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,6FAA6F;IAC7F,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,eAAe;IAC9B,4DAA4D;IAC5D,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,6FAA6F;IAC7F,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0IAA0I;IAC1I,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,kHAAkH;IAClH,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB,yEAAyE;IACzE,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC7B,8GAA8G;IAC9G,eAAe,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IACnC,oEAAoE;IACpE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,+FAA+F;IAC/F,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,OAAO,GAAE,eAAoB,GAAG,OAAO,CAAC,QAAQ,CAAC,CA0BlG;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAkBpD"}
|
package/dist/chant-install.js
CHANGED
|
@@ -18,11 +18,22 @@
|
|
|
18
18
|
* {@link chantArgv} runs the package's `bin/chant` with the node running
|
|
19
19
|
* now: the bin picks the compiled CLI in an installed package and the source
|
|
20
20
|
* in a checkout (#3878), so a product never chooses between them.
|
|
21
|
+
*
|
|
22
|
+
* #4889: {@link runChant} spawns that chant and returns its output and its
|
|
23
|
+
* last `--json` document ({@link lastJsonLine}), and
|
|
24
|
+
* {@link installResolveFallback} and {@link fallbackImportArgs} resolve any
|
|
25
|
+
* bare specifier a file with no `node_modules` above it imports, in the
|
|
26
|
+
* product's process and in chant's children, from the product's install
|
|
27
|
+
* (SQL Yodeler's `resolve-fallback.ts` and `process.ts`, terragucci's
|
|
28
|
+
* `runChant` in `resume.ts`).
|
|
21
29
|
*/
|
|
30
|
+
import { spawn } from "node:child_process";
|
|
22
31
|
import { existsSync, readFileSync } from "node:fs";
|
|
23
32
|
import * as nodeModule from "node:module";
|
|
24
|
-
import { delimiter, dirname, join, resolve } from "node:path";
|
|
25
|
-
import { fileURLToPath } from "node:url";
|
|
33
|
+
import { delimiter, dirname, join, resolve, sep } from "node:path";
|
|
34
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
35
|
+
/** The first chant with `runChant`, `lastJsonLine`, `installResolveFallback` and `fallbackImportArgs` in `@intentius/chant/chant-install` (#4889): a product runs chant and reads its `--json` document, and a file with no `node_modules` above it imports the product's packages, with no code of the product's own. */
|
|
36
|
+
export const CHANT_RUN_FLOOR = "0.124.88";
|
|
26
37
|
const PACKAGE = "@intentius/chant";
|
|
27
38
|
/** The install whose manifest is `<root>/package.json`, when it is chant's and names a bin that is there. */
|
|
28
39
|
function installAt(root) {
|
|
@@ -156,3 +167,193 @@ export function installChantResolveFallback(from = import.meta.url) {
|
|
|
156
167
|
flags[FALLBACK] = true;
|
|
157
168
|
return true;
|
|
158
169
|
}
|
|
170
|
+
// ── #4889: any bare specifier, for a file with no node_modules above it ────
|
|
171
|
+
/** A bare specifier: a package name, not a relative or absolute path, a URL, a `node:` builtin or a `#` import. */
|
|
172
|
+
export function isBareSpecifier(specifier) {
|
|
173
|
+
return !/^(\.{0,2}\/|[a-zA-Z][a-zA-Z0-9+.-]*:)/.test(specifier) && !specifier.startsWith("#");
|
|
174
|
+
}
|
|
175
|
+
/** Whether the file at `url` has a `node_modules` directory in its own directory or any above it. A URL that is not a file's counts as having one. */
|
|
176
|
+
export function hasNodeModulesAbove(url) {
|
|
177
|
+
if (typeof url !== "string" || !url.startsWith("file:"))
|
|
178
|
+
return true;
|
|
179
|
+
for (let dir = dirname(fileURLToPath(url));;) {
|
|
180
|
+
if (existsSync(join(dir, "node_modules")))
|
|
181
|
+
return true;
|
|
182
|
+
const up = dirname(dir);
|
|
183
|
+
if (up === dir)
|
|
184
|
+
return false;
|
|
185
|
+
dir = up;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* The file URL a bare specifier is retried from: a file beside the
|
|
190
|
+
* `node_modules` directory that holds `from` (by default this module, in
|
|
191
|
+
* the chant the product depends on), so the retry finds the product's own
|
|
192
|
+
* packages first; `from` itself when it is in no `node_modules`, as in a
|
|
193
|
+
* chant checkout. SQL Yodeler's `ownModules`.
|
|
194
|
+
*/
|
|
195
|
+
export function fallbackParent(from = import.meta.url) {
|
|
196
|
+
const path = from.startsWith("file:") ? fileURLToPath(from) : from;
|
|
197
|
+
const marker = `${sep}node_modules${sep}`;
|
|
198
|
+
const at = path.lastIndexOf(marker);
|
|
199
|
+
if (at < 0)
|
|
200
|
+
return from.startsWith("file:") ? from : pathToFileURL(from).href;
|
|
201
|
+
return pathToFileURL(join(path.slice(0, at), "chant-resolve-fallback.js")).href;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* A resolve hook (SQL Yodeler's `resolve-fallback.ts`): a bare specifier
|
|
205
|
+
* Node could not find, imported by a file with no `node_modules` in its
|
|
206
|
+
* directory or any above it, resolves from `parent`. chant's commit job
|
|
207
|
+
* runs a product's command in a git worktree outside the checkout the job
|
|
208
|
+
* installed, so a `chant.config.ts` or an Op there imports chant, its
|
|
209
|
+
* lexicons and the product by name and finds none of them. A file that has
|
|
210
|
+
* an install of its own, and any other failure, is left as Node reports it.
|
|
211
|
+
*/
|
|
212
|
+
export function bareResolveFallback(parent) {
|
|
213
|
+
return (specifier, context, next) => {
|
|
214
|
+
try {
|
|
215
|
+
return next(specifier, context);
|
|
216
|
+
}
|
|
217
|
+
catch (err) {
|
|
218
|
+
const code = err.code;
|
|
219
|
+
if (code !== "ERR_MODULE_NOT_FOUND" && code !== "MODULE_NOT_FOUND")
|
|
220
|
+
throw err;
|
|
221
|
+
if (!isBareSpecifier(specifier) || context.parentURL === parent || hasNodeModulesAbove(context.parentURL))
|
|
222
|
+
throw err;
|
|
223
|
+
return next(specifier, { ...context, parentURL: parent });
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* {@link bareResolveFallback} as module source for a child's `--import`,
|
|
229
|
+
* with `PARENT` bound: the same checks, written for Node's synchronous
|
|
230
|
+
* `registerHooks` and, on a Node without it, the asynchronous `register`,
|
|
231
|
+
* whose `next` returns a promise.
|
|
232
|
+
*/
|
|
233
|
+
function hooksSource(parent) {
|
|
234
|
+
return [
|
|
235
|
+
'import { existsSync } from "node:fs";',
|
|
236
|
+
'import { dirname, join } from "node:path";',
|
|
237
|
+
'import { fileURLToPath } from "node:url";',
|
|
238
|
+
`const PARENT = ${JSON.stringify(parent)};`,
|
|
239
|
+
'const bare = (s) => !/^(\\.{0,2}\\/|[a-zA-Z][a-zA-Z0-9+.-]*:)/.test(s) && !s.startsWith("#");',
|
|
240
|
+
"function installed(url) {",
|
|
241
|
+
' if (typeof url !== "string" || !url.startsWith("file:")) return true;',
|
|
242
|
+
" for (let d = dirname(fileURLToPath(url)); ; ) {",
|
|
243
|
+
' if (existsSync(join(d, "node_modules"))) return true;',
|
|
244
|
+
" const up = dirname(d);",
|
|
245
|
+
" if (up === d) return false;",
|
|
246
|
+
" d = up;",
|
|
247
|
+
" }",
|
|
248
|
+
"}",
|
|
249
|
+
"function retry(specifier, context, next, e) {",
|
|
250
|
+
' if (!e || (e.code !== "ERR_MODULE_NOT_FOUND" && e.code !== "MODULE_NOT_FOUND") || !bare(specifier) || context.parentURL === PARENT || installed(context.parentURL)) throw e;',
|
|
251
|
+
" return next(specifier, { ...context, parentURL: PARENT });",
|
|
252
|
+
"}",
|
|
253
|
+
"export function resolve(specifier, context, next) {",
|
|
254
|
+
" let r;",
|
|
255
|
+
" try { r = next(specifier, context); } catch (e) { return retry(specifier, context, next, e); }",
|
|
256
|
+
' return r && typeof r.then === "function" ? r.catch((e) => retry(specifier, context, next, e)) : r;',
|
|
257
|
+
"}",
|
|
258
|
+
].join("\n");
|
|
259
|
+
}
|
|
260
|
+
const dataUrl = (source) => `data:text/javascript,${encodeURIComponent(source)}`;
|
|
261
|
+
const BARE_FALLBACK = Symbol.for("chant.bareResolveFallback");
|
|
262
|
+
/**
|
|
263
|
+
* Install {@link bareResolveFallback} once in this process, retrying from
|
|
264
|
+
* `parent` (default {@link fallbackParent}). A product's bin calls it before
|
|
265
|
+
* it loads a repository's `chant.config.ts` or Ops. Uses Node's
|
|
266
|
+
* `module.registerHooks` where it has one, else `module.register`. Returns
|
|
267
|
+
* whether it is installed: false on a Node with neither.
|
|
268
|
+
*/
|
|
269
|
+
export function installResolveFallback(parent = fallbackParent()) {
|
|
270
|
+
const flags = globalThis;
|
|
271
|
+
if (flags[BARE_FALLBACK])
|
|
272
|
+
return true;
|
|
273
|
+
const m = nodeModule;
|
|
274
|
+
if (typeof m.registerHooks === "function")
|
|
275
|
+
m.registerHooks({ resolve: bareResolveFallback(parent) });
|
|
276
|
+
else if (typeof m.register === "function")
|
|
277
|
+
m.register(dataUrl(hooksSource(parent)));
|
|
278
|
+
else
|
|
279
|
+
return false;
|
|
280
|
+
flags[BARE_FALLBACK] = true;
|
|
281
|
+
return true;
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* The node arguments that install {@link bareResolveFallback} in a chant
|
|
285
|
+
* child (`chant build`, `chant run`), before its own imports of the
|
|
286
|
+
* repository's files: one `--import` of a `data:` module, so it loads the
|
|
287
|
+
* same from a product's `src/` under tsx and from its bundle. Pass them as
|
|
288
|
+
* {@link chantArgv}'s `nodeArgs`, or {@link runChant}'s `resolveFallback`.
|
|
289
|
+
*/
|
|
290
|
+
export function fallbackImportArgs(parent = fallbackParent()) {
|
|
291
|
+
const hooks = dataUrl(hooksSource(parent));
|
|
292
|
+
const registrar = [
|
|
293
|
+
'import * as m from "node:module";',
|
|
294
|
+
`import { resolve } from ${JSON.stringify(hooks)};`,
|
|
295
|
+
`if (typeof m.registerHooks === "function") m.registerHooks({ resolve }); else m.register(${JSON.stringify(hooks)});`,
|
|
296
|
+
].join("\n");
|
|
297
|
+
return ["--import", dataUrl(registrar)];
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Run `chant <args>` and resolve with its exit code, its output and its
|
|
301
|
+
* `--json` document (#4889; SQL Yodeler's `runChant`, terragucci's in
|
|
302
|
+
* `resume.ts`). The chant is the product's own ({@link chantArgv}) with its
|
|
303
|
+
* bin first on PATH ({@link chantEnv}). Never rejects on a non-zero exit;
|
|
304
|
+
* rejects when the child cannot start.
|
|
305
|
+
*/
|
|
306
|
+
export function runChant(args, options = {}) {
|
|
307
|
+
const install = options.chant === undefined ? (options.install ?? bundledChant() ?? installedChant(options.from ?? [])) : undefined;
|
|
308
|
+
const fallback = options.resolveFallback === true ? fallbackImportArgs() : typeof options.resolveFallback === "string" ? fallbackImportArgs(options.resolveFallback) : [];
|
|
309
|
+
const [command, ...argv] = install ? chantArgv(args, { install, nodeArgs: [...fallback, ...(options.nodeArgs ?? [])] }) : [options.chant ?? "chant", ...args];
|
|
310
|
+
const env = { ...chantEnv(options.env ?? process.env, install), ...(options.noColor ? { FORCE_COLOR: "0", NO_COLOR: "1" } : {}) };
|
|
311
|
+
const piped = options.stdio !== "inherit";
|
|
312
|
+
return new Promise((done, reject) => {
|
|
313
|
+
const child = spawn(command, argv, { cwd: options.cwd ?? process.cwd(), env, stdio: ["ignore", piped ? "pipe" : "inherit", piped ? "pipe" : "inherit"] });
|
|
314
|
+
let stdout = "";
|
|
315
|
+
let stderr = "";
|
|
316
|
+
child.stdout?.setEncoding("utf8");
|
|
317
|
+
child.stderr?.setEncoding("utf8");
|
|
318
|
+
child.stdout?.on("data", (chunk) => {
|
|
319
|
+
stdout += chunk;
|
|
320
|
+
options.onStdout?.(chunk);
|
|
321
|
+
});
|
|
322
|
+
child.stderr?.on("data", (chunk) => {
|
|
323
|
+
stderr += chunk;
|
|
324
|
+
options.onStderr?.(chunk);
|
|
325
|
+
});
|
|
326
|
+
child.on("error", reject);
|
|
327
|
+
child.on("close", (code, signal) => {
|
|
328
|
+
const json = lastJsonLine(stdout);
|
|
329
|
+
done({ code: code ?? (signal ? 128 : 1), stdout, stderr, ...(json !== undefined ? { json } : {}) });
|
|
330
|
+
});
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* The last line of `stdout` that parses as a JSON object: chant prints its
|
|
335
|
+
* `--json` document as one line, after any log lines. A pretty-printed
|
|
336
|
+
* document is read from the first `{` to the end. Undefined when there is
|
|
337
|
+
* none.
|
|
338
|
+
*/
|
|
339
|
+
export function lastJsonLine(stdout) {
|
|
340
|
+
const lines = stdout.split("\n").map((l) => l.trim()).filter((l) => l.startsWith("{"));
|
|
341
|
+
for (const line of lines.reverse()) {
|
|
342
|
+
try {
|
|
343
|
+
return JSON.parse(line);
|
|
344
|
+
}
|
|
345
|
+
catch {
|
|
346
|
+
// A log line that starts with "{"; keep looking.
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
const at = stdout.indexOf("{");
|
|
350
|
+
if (at >= 0) {
|
|
351
|
+
try {
|
|
352
|
+
return JSON.parse(stdout.slice(at));
|
|
353
|
+
}
|
|
354
|
+
catch {
|
|
355
|
+
// Not JSON.
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
return undefined;
|
|
359
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@intentius/chant/ci-base` (#4966): the base a CI job measures a change
|
|
3
|
+
* from, read off the job's own variables, so a product's check and policy
|
|
4
|
+
* steps need no rule of their own for it (terragucci's `policyBase`).
|
|
5
|
+
*
|
|
6
|
+
* - A pull request's job: its target branch, `origin/<target>`
|
|
7
|
+
* (`GITHUB_BASE_REF` on GitHub and Forgejo, GitLab's
|
|
8
|
+
* `CI_MERGE_REQUEST_TARGET_BRANCH_NAME`).
|
|
9
|
+
* - A push to a branch other than the default branch: `origin/<default>`,
|
|
10
|
+
* so a change that edits a check or a policy on a side branch is still
|
|
11
|
+
* judged by the default branch's.
|
|
12
|
+
* - A push to the default branch, or a job with no branch: no base, and
|
|
13
|
+
* the checkout's own files are the trusted ones.
|
|
14
|
+
*
|
|
15
|
+
* `chant ci check` takes it as its `--base` when none is given.
|
|
16
|
+
*
|
|
17
|
+
* This module imports nothing.
|
|
18
|
+
*/
|
|
19
|
+
export interface CiBaseOptions {
|
|
20
|
+
/** A base the caller already has (a flag, a product's own variable); it wins over everything. */
|
|
21
|
+
base?: string;
|
|
22
|
+
/** The default branch. Default GitLab's `CI_DEFAULT_BRANCH`; GitHub and Forgejo jobs carry none, so a product passes its own. */
|
|
23
|
+
defaultBranch?: string;
|
|
24
|
+
/** The remote the branches are fetched from. Default `origin`. */
|
|
25
|
+
remote?: string;
|
|
26
|
+
}
|
|
27
|
+
/** The base ref for the job `env` describes, as the module comment says; undefined when there is none. */
|
|
28
|
+
export declare function ciBaseRef(env?: Record<string, string | undefined>, options?: CiBaseOptions): string | undefined;
|
|
29
|
+
export { CI_BASE_REF_FLOOR } from "./release-floors.js";
|
|
30
|
+
//# sourceMappingURL=ci-base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ci-base.d.ts","sourceRoot":"","sources":["../src/ci-base.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,MAAM,WAAW,aAAa;IAC5B,iGAAiG;IACjG,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iIAAiI;IACjI,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kEAAkE;IAClE,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAID,0GAA0G;AAC1G,wBAAgB,SAAS,CAAC,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAe,EAAE,OAAO,GAAE,aAAkB,GAAG,MAAM,GAAG,SAAS,CAShI;AAED,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC"}
|
package/dist/ci-base.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@intentius/chant/ci-base` (#4966): the base a CI job measures a change
|
|
3
|
+
* from, read off the job's own variables, so a product's check and policy
|
|
4
|
+
* steps need no rule of their own for it (terragucci's `policyBase`).
|
|
5
|
+
*
|
|
6
|
+
* - A pull request's job: its target branch, `origin/<target>`
|
|
7
|
+
* (`GITHUB_BASE_REF` on GitHub and Forgejo, GitLab's
|
|
8
|
+
* `CI_MERGE_REQUEST_TARGET_BRANCH_NAME`).
|
|
9
|
+
* - A push to a branch other than the default branch: `origin/<default>`,
|
|
10
|
+
* so a change that edits a check or a policy on a side branch is still
|
|
11
|
+
* judged by the default branch's.
|
|
12
|
+
* - A push to the default branch, or a job with no branch: no base, and
|
|
13
|
+
* the checkout's own files are the trusted ones.
|
|
14
|
+
*
|
|
15
|
+
* `chant ci check` takes it as its `--base` when none is given.
|
|
16
|
+
*
|
|
17
|
+
* This module imports nothing.
|
|
18
|
+
*/
|
|
19
|
+
const set = (v) => (v && v.trim() ? v.trim() : undefined);
|
|
20
|
+
/** The base ref for the job `env` describes, as the module comment says; undefined when there is none. */
|
|
21
|
+
export function ciBaseRef(env = process.env, options = {}) {
|
|
22
|
+
const given = set(options.base);
|
|
23
|
+
if (given)
|
|
24
|
+
return given;
|
|
25
|
+
const remote = options.remote ?? "origin";
|
|
26
|
+
const target = set(env.GITHUB_BASE_REF) ?? set(env.CI_MERGE_REQUEST_TARGET_BRANCH_NAME);
|
|
27
|
+
if (target)
|
|
28
|
+
return `${remote}/${target}`;
|
|
29
|
+
const branch = set(env.GITHUB_REF_NAME) ?? set(env.CI_COMMIT_BRANCH);
|
|
30
|
+
const main = set(options.defaultBranch) ?? set(env.CI_DEFAULT_BRANCH);
|
|
31
|
+
return branch && main && branch !== main ? `${remote}/${main}` : undefined;
|
|
32
|
+
}
|
|
33
|
+
export { CI_BASE_REF_FLOOR } from "./release-floors.js";
|