pr-merge-queue 0.0.0-stage → 0.0.0
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/LICENSE +201 -0
- package/README.md +125 -2
- package/dist/claim-pr/claim-pr.d.mts +45 -0
- package/dist/claim-pr/claim-pr.d.mts.map +1 -0
- package/dist/claim-pr/claim-pr.mjs +217 -0
- package/dist/claim-pr/claim-pr.mjs.map +1 -0
- package/dist/claim-pr/index.d.mts +2 -0
- package/dist/claim-pr/index.d.mts.map +1 -0
- package/dist/claim-pr/index.mjs +2 -0
- package/dist/claim-pr/index.mjs.map +1 -0
- package/dist/cmd/claim-pr.d.mts +3 -0
- package/dist/cmd/claim-pr.d.mts.map +1 -0
- package/dist/cmd/claim-pr.mjs +20 -0
- package/dist/cmd/claim-pr.mjs.map +1 -0
- package/dist/cmd/open-pr.d.mts +3 -0
- package/dist/cmd/open-pr.d.mts.map +1 -0
- package/dist/cmd/open-pr.mjs +20 -0
- package/dist/cmd/open-pr.mjs.map +1 -0
- package/dist/cmd/pr-report.d.mts +3 -0
- package/dist/cmd/pr-report.d.mts.map +1 -0
- package/dist/cmd/pr-report.mjs +20 -0
- package/dist/cmd/pr-report.mjs.map +1 -0
- package/dist/cmd/push-fixed-pr.d.mts +3 -0
- package/dist/cmd/push-fixed-pr.d.mts.map +1 -0
- package/dist/cmd/push-fixed-pr.mjs +20 -0
- package/dist/cmd/push-fixed-pr.mjs.map +1 -0
- package/dist/cmd/report-unowned-prs.d.mts +3 -0
- package/dist/cmd/report-unowned-prs.d.mts.map +1 -0
- package/dist/cmd/report-unowned-prs.mjs +20 -0
- package/dist/cmd/report-unowned-prs.mjs.map +1 -0
- package/dist/cmd/unblock-prs.d.mts +3 -0
- package/dist/cmd/unblock-prs.d.mts.map +1 -0
- package/dist/cmd/unblock-prs.mjs +19 -0
- package/dist/cmd/unblock-prs.mjs.map +1 -0
- package/dist/entry-point.d.mts +3 -0
- package/dist/entry-point.d.mts.map +1 -0
- package/dist/entry-point.mjs +3 -0
- package/dist/entry-point.mjs.map +1 -0
- package/dist/lib/cli-args.d.mts +27 -0
- package/dist/lib/cli-args.d.mts.map +1 -0
- package/dist/lib/cli-args.mjs +55 -0
- package/dist/lib/cli-args.mjs.map +1 -0
- package/dist/lib/github-api.d.mts +153 -0
- package/dist/lib/github-api.d.mts.map +1 -0
- package/dist/lib/github-api.mjs +291 -0
- package/dist/lib/github-api.mjs.map +1 -0
- package/dist/lib/index.d.mts +7 -0
- package/dist/lib/index.d.mts.map +1 -0
- package/dist/lib/index.mjs +7 -0
- package/dist/lib/index.mjs.map +1 -0
- package/dist/lib/json.d.mts +12 -0
- package/dist/lib/json.d.mts.map +1 -0
- package/dist/lib/json.mjs +28 -0
- package/dist/lib/json.mjs.map +1 -0
- package/dist/lib/log.d.mts +10 -0
- package/dist/lib/log.d.mts.map +1 -0
- package/dist/lib/log.mjs +13 -0
- package/dist/lib/log.mjs.map +1 -0
- package/dist/lib/shell.d.mts +18 -0
- package/dist/lib/shell.d.mts.map +1 -0
- package/dist/lib/shell.mjs +42 -0
- package/dist/lib/shell.mjs.map +1 -0
- package/dist/lib/time.d.mts +17 -0
- package/dist/lib/time.d.mts.map +1 -0
- package/dist/lib/time.mjs +35 -0
- package/dist/lib/time.mjs.map +1 -0
- package/dist/open-pr/github.d.mts +72 -0
- package/dist/open-pr/github.d.mts.map +1 -0
- package/dist/open-pr/github.mjs +249 -0
- package/dist/open-pr/github.mjs.map +1 -0
- package/dist/open-pr/index.d.mts +6 -0
- package/dist/open-pr/index.d.mts.map +1 -0
- package/dist/open-pr/index.mjs +6 -0
- package/dist/open-pr/index.mjs.map +1 -0
- package/dist/open-pr/main.d.mts +36 -0
- package/dist/open-pr/main.d.mts.map +1 -0
- package/dist/open-pr/main.mjs +204 -0
- package/dist/open-pr/main.mjs.map +1 -0
- package/dist/open-pr/options.d.mts +20 -0
- package/dist/open-pr/options.d.mts.map +1 -0
- package/dist/open-pr/options.mjs +66 -0
- package/dist/open-pr/options.mjs.map +1 -0
- package/dist/open-pr/steps.d.mts +23 -0
- package/dist/open-pr/steps.d.mts.map +1 -0
- package/dist/open-pr/steps.mjs +38 -0
- package/dist/open-pr/steps.mjs.map +1 -0
- package/dist/open-pr/types.d.mts +179 -0
- package/dist/open-pr/types.d.mts.map +1 -0
- package/dist/open-pr/types.mjs +20 -0
- package/dist/open-pr/types.mjs.map +1 -0
- package/dist/pr-report/github.d.mts +59 -0
- package/dist/pr-report/github.d.mts.map +1 -0
- package/dist/pr-report/github.mjs +561 -0
- package/dist/pr-report/github.mjs.map +1 -0
- package/dist/pr-report/index.d.mts +8 -0
- package/dist/pr-report/index.d.mts.map +1 -0
- package/dist/pr-report/index.mjs +8 -0
- package/dist/pr-report/index.mjs.map +1 -0
- package/dist/pr-report/linked-issues.d.mts +15 -0
- package/dist/pr-report/linked-issues.d.mts.map +1 -0
- package/dist/pr-report/linked-issues.mjs +39 -0
- package/dist/pr-report/linked-issues.mjs.map +1 -0
- package/dist/pr-report/main.d.mts +42 -0
- package/dist/pr-report/main.d.mts.map +1 -0
- package/dist/pr-report/main.mjs +163 -0
- package/dist/pr-report/main.mjs.map +1 -0
- package/dist/pr-report/options.d.mts +36 -0
- package/dist/pr-report/options.d.mts.map +1 -0
- package/dist/pr-report/options.mjs +90 -0
- package/dist/pr-report/options.mjs.map +1 -0
- package/dist/pr-report/queue.d.mts +28 -0
- package/dist/pr-report/queue.d.mts.map +1 -0
- package/dist/pr-report/queue.mjs +74 -0
- package/dist/pr-report/queue.mjs.map +1 -0
- package/dist/pr-report/render.d.mts +14 -0
- package/dist/pr-report/render.d.mts.map +1 -0
- package/dist/pr-report/render.mjs +318 -0
- package/dist/pr-report/render.mjs.map +1 -0
- package/dist/pr-report/repo-settings.d.mts +12 -0
- package/dist/pr-report/repo-settings.d.mts.map +1 -0
- package/dist/pr-report/repo-settings.mjs +22 -0
- package/dist/pr-report/repo-settings.mjs.map +1 -0
- package/dist/push-fixed-pr/index.d.mts +2 -0
- package/dist/push-fixed-pr/index.d.mts.map +1 -0
- package/dist/push-fixed-pr/index.mjs +2 -0
- package/dist/push-fixed-pr/index.mjs.map +1 -0
- package/dist/push-fixed-pr/push-fixed-pr.d.mts +54 -0
- package/dist/push-fixed-pr/push-fixed-pr.d.mts.map +1 -0
- package/dist/push-fixed-pr/push-fixed-pr.mjs +172 -0
- package/dist/push-fixed-pr/push-fixed-pr.mjs.map +1 -0
- package/dist/report-unowned-prs/index.d.mts +2 -0
- package/dist/report-unowned-prs/index.d.mts.map +1 -0
- package/dist/report-unowned-prs/index.mjs +2 -0
- package/dist/report-unowned-prs/index.mjs.map +1 -0
- package/dist/report-unowned-prs/report-unowned-prs.d.mts +49 -0
- package/dist/report-unowned-prs/report-unowned-prs.d.mts.map +1 -0
- package/dist/report-unowned-prs/report-unowned-prs.mjs +127 -0
- package/dist/report-unowned-prs/report-unowned-prs.mjs.map +1 -0
- package/dist/tsconfig.json +1 -0
- package/dist/unblock-prs/auto-fix.d.mts +45 -0
- package/dist/unblock-prs/auto-fix.d.mts.map +1 -0
- package/dist/unblock-prs/auto-fix.mjs +207 -0
- package/dist/unblock-prs/auto-fix.mjs.map +1 -0
- package/dist/unblock-prs/checks.d.mts +307 -0
- package/dist/unblock-prs/checks.d.mts.map +1 -0
- package/dist/unblock-prs/checks.mjs +372 -0
- package/dist/unblock-prs/checks.mjs.map +1 -0
- package/dist/unblock-prs/claims.d.mts +21 -0
- package/dist/unblock-prs/claims.d.mts.map +1 -0
- package/dist/unblock-prs/claims.mjs +23 -0
- package/dist/unblock-prs/claims.mjs.map +1 -0
- package/dist/unblock-prs/config.d.mts +487 -0
- package/dist/unblock-prs/config.d.mts.map +1 -0
- package/dist/unblock-prs/config.mjs +119 -0
- package/dist/unblock-prs/config.mjs.map +1 -0
- package/dist/unblock-prs/constants.d.mts +28 -0
- package/dist/unblock-prs/constants.d.mts.map +1 -0
- package/dist/unblock-prs/constants.mjs +28 -0
- package/dist/unblock-prs/constants.mjs.map +1 -0
- package/dist/unblock-prs/demotions.d.mts +42 -0
- package/dist/unblock-prs/demotions.d.mts.map +1 -0
- package/dist/unblock-prs/demotions.mjs +50 -0
- package/dist/unblock-prs/demotions.mjs.map +1 -0
- package/dist/unblock-prs/github.d.mts +739 -0
- package/dist/unblock-prs/github.d.mts.map +1 -0
- package/dist/unblock-prs/github.mjs +626 -0
- package/dist/unblock-prs/github.mjs.map +1 -0
- package/dist/unblock-prs/index.d.mts +25 -0
- package/dist/unblock-prs/index.d.mts.map +1 -0
- package/dist/unblock-prs/index.mjs +25 -0
- package/dist/unblock-prs/index.mjs.map +1 -0
- package/dist/unblock-prs/labels.d.mts +49 -0
- package/dist/unblock-prs/labels.d.mts.map +1 -0
- package/dist/unblock-prs/labels.mjs +49 -0
- package/dist/unblock-prs/labels.mjs.map +1 -0
- package/dist/unblock-prs/main.d.mts +179 -0
- package/dist/unblock-prs/main.d.mts.map +1 -0
- package/dist/unblock-prs/main.mjs +640 -0
- package/dist/unblock-prs/main.mjs.map +1 -0
- package/dist/unblock-prs/merge-after.d.mts +46 -0
- package/dist/unblock-prs/merge-after.d.mts.map +1 -0
- package/dist/unblock-prs/merge-after.mjs +65 -0
- package/dist/unblock-prs/merge-after.mjs.map +1 -0
- package/dist/unblock-prs/options.d.mts +35 -0
- package/dist/unblock-prs/options.d.mts.map +1 -0
- package/dist/unblock-prs/options.mjs +88 -0
- package/dist/unblock-prs/options.mjs.map +1 -0
- package/dist/unblock-prs/owner.d.mts +32 -0
- package/dist/unblock-prs/owner.d.mts.map +1 -0
- package/dist/unblock-prs/owner.mjs +63 -0
- package/dist/unblock-prs/owner.mjs.map +1 -0
- package/dist/unblock-prs/quiet.d.mts +21 -0
- package/dist/unblock-prs/quiet.d.mts.map +1 -0
- package/dist/unblock-prs/quiet.mjs +42 -0
- package/dist/unblock-prs/quiet.mjs.map +1 -0
- package/dist/unblock-prs/rebase.d.mts +120 -0
- package/dist/unblock-prs/rebase.d.mts.map +1 -0
- package/dist/unblock-prs/rebase.mjs +576 -0
- package/dist/unblock-prs/rebase.mjs.map +1 -0
- package/dist/unblock-prs/release.d.mts +62 -0
- package/dist/unblock-prs/release.d.mts.map +1 -0
- package/dist/unblock-prs/release.mjs +94 -0
- package/dist/unblock-prs/release.mjs.map +1 -0
- package/dist/unblock-prs/set-aside-comment.d.mts +20 -0
- package/dist/unblock-prs/set-aside-comment.d.mts.map +1 -0
- package/dist/unblock-prs/set-aside-comment.mjs +93 -0
- package/dist/unblock-prs/set-aside-comment.mjs.map +1 -0
- package/dist/unblock-prs/set-aside-detail.d.mts +41 -0
- package/dist/unblock-prs/set-aside-detail.d.mts.map +1 -0
- package/dist/unblock-prs/set-aside-detail.mjs +56 -0
- package/dist/unblock-prs/set-aside-detail.mjs.map +1 -0
- package/dist/unblock-prs/skips.d.mts +85 -0
- package/dist/unblock-prs/skips.d.mts.map +1 -0
- package/dist/unblock-prs/skips.mjs +141 -0
- package/dist/unblock-prs/skips.mjs.map +1 -0
- package/dist/unblock-prs/stack.d.mts +98 -0
- package/dist/unblock-prs/stack.d.mts.map +1 -0
- package/dist/unblock-prs/stack.mjs +141 -0
- package/dist/unblock-prs/stack.mjs.map +1 -0
- package/dist/unblock-prs/triage.d.mts +28 -0
- package/dist/unblock-prs/triage.d.mts.map +1 -0
- package/dist/unblock-prs/triage.mjs +396 -0
- package/dist/unblock-prs/triage.mjs.map +1 -0
- package/dist/unblock-prs/types.d.mts +793 -0
- package/dist/unblock-prs/types.d.mts.map +1 -0
- package/dist/unblock-prs/types.mjs +26 -0
- package/dist/unblock-prs/types.mjs.map +1 -0
- package/dist/unblock-prs/util.d.mts +23 -0
- package/dist/unblock-prs/util.d.mts.map +1 -0
- package/dist/unblock-prs/util.mjs +60 -0
- package/dist/unblock-prs/util.mjs.map +1 -0
- package/dist/unblock-prs/version-pr.d.mts +57 -0
- package/dist/unblock-prs/version-pr.d.mts.map +1 -0
- package/dist/unblock-prs/version-pr.mjs +79 -0
- package/dist/unblock-prs/version-pr.mjs.map +1 -0
- package/dist/unblock-prs/watch.d.mts +17 -0
- package/dist/unblock-prs/watch.d.mts.map +1 -0
- package/dist/unblock-prs/watch.mjs +128 -0
- package/dist/unblock-prs/watch.mjs.map +1 -0
- package/package.json +118 -3
- package/src/claim-pr/claim-pr.mts +380 -0
- package/src/claim-pr/claim-pr.test.mts +176 -0
- package/src/claim-pr/index.mts +1 -0
- package/src/cmd/claim-pr.mts +32 -0
- package/src/cmd/open-pr.mts +28 -0
- package/src/cmd/pr-report.mts +28 -0
- package/src/cmd/push-fixed-pr.mts +36 -0
- package/src/cmd/report-unowned-prs.mts +37 -0
- package/src/cmd/unblock-prs.mts +24 -0
- package/src/entry-point.mts +3 -0
- package/src/lib/cli-args.mts +86 -0
- package/src/lib/cli-args.test.mts +92 -0
- package/src/lib/github-api.mts +463 -0
- package/src/lib/github-api.test.mts +40 -0
- package/src/lib/index.mts +6 -0
- package/src/lib/json.mts +43 -0
- package/src/lib/json.test.mts +34 -0
- package/src/lib/log.mts +19 -0
- package/src/lib/log.test.mts +45 -0
- package/src/lib/shell.mts +52 -0
- package/src/lib/time.mts +49 -0
- package/src/open-pr/README.md +237 -0
- package/src/open-pr/github.mts +444 -0
- package/src/open-pr/index.mts +5 -0
- package/src/open-pr/main.mts +327 -0
- package/src/open-pr/options.mts +101 -0
- package/src/open-pr/options.test.mts +67 -0
- package/src/open-pr/steps.mts +57 -0
- package/src/open-pr/steps.test.mts +59 -0
- package/src/open-pr/types.mts +42 -0
- package/src/pr-report/README.md +244 -0
- package/src/pr-report/github.mts +911 -0
- package/src/pr-report/index.mts +7 -0
- package/src/pr-report/linked-issues.mts +51 -0
- package/src/pr-report/linked-issues.test.mts +65 -0
- package/src/pr-report/main.mts +257 -0
- package/src/pr-report/options.mts +140 -0
- package/src/pr-report/queue.mts +125 -0
- package/src/pr-report/render.mts +428 -0
- package/src/pr-report/render.test.mts +379 -0
- package/src/pr-report/repo-settings.mts +34 -0
- package/src/push-fixed-pr/index.mts +1 -0
- package/src/push-fixed-pr/push-fixed-pr.mts +276 -0
- package/src/push-fixed-pr/push-fixed-pr.test.mts +228 -0
- package/src/report-unowned-prs/index.mts +1 -0
- package/src/report-unowned-prs/report-unowned-prs.mts +190 -0
- package/src/report-unowned-prs/report-unowned-prs.test.mts +87 -0
- package/src/unblock-prs/README.md +1616 -0
- package/src/unblock-prs/auto-fix.mts +334 -0
- package/src/unblock-prs/auto-fix.test.mts +159 -0
- package/src/unblock-prs/checks.mts +538 -0
- package/src/unblock-prs/checks.test.mts +507 -0
- package/src/unblock-prs/claims.mts +33 -0
- package/src/unblock-prs/claims.test.mts +64 -0
- package/src/unblock-prs/config.mts +187 -0
- package/src/unblock-prs/config.schema.json +71 -0
- package/src/unblock-prs/config.test.mts +139 -0
- package/src/unblock-prs/constants.mts +33 -0
- package/src/unblock-prs/demotions.mts +73 -0
- package/src/unblock-prs/demotions.test.mts +100 -0
- package/src/unblock-prs/github.mts +1042 -0
- package/src/unblock-prs/github.test.mts +84 -0
- package/src/unblock-prs/index.mts +24 -0
- package/src/unblock-prs/labels.mts +70 -0
- package/src/unblock-prs/main.mts +1051 -0
- package/src/unblock-prs/merge-after.mts +117 -0
- package/src/unblock-prs/merge-after.test.mts +120 -0
- package/src/unblock-prs/options.mts +157 -0
- package/src/unblock-prs/owner.mts +91 -0
- package/src/unblock-prs/owner.test.mts +114 -0
- package/src/unblock-prs/quiet.mts +62 -0
- package/src/unblock-prs/quiet.test.mts +175 -0
- package/src/unblock-prs/rebase.mts +962 -0
- package/src/unblock-prs/release.mts +149 -0
- package/src/unblock-prs/release.test.mts +209 -0
- package/src/unblock-prs/set-aside-comment.mts +143 -0
- package/src/unblock-prs/set-aside-comment.test.mts +148 -0
- package/src/unblock-prs/set-aside-detail.mts +82 -0
- package/src/unblock-prs/set-aside-detail.test.mts +131 -0
- package/src/unblock-prs/skips.mts +215 -0
- package/src/unblock-prs/skips.test.mts +280 -0
- package/src/unblock-prs/stack.mts +220 -0
- package/src/unblock-prs/stack.test.mts +449 -0
- package/src/unblock-prs/triage.mts +669 -0
- package/src/unblock-prs/triage.test.mts +100 -0
- package/src/unblock-prs/types.mts +358 -0
- package/src/unblock-prs/util.mts +78 -0
- package/src/unblock-prs/util.test.mts +26 -0
- package/src/unblock-prs/version-pr.mts +112 -0
- package/src/unblock-prs/version-pr.test.mts +78 -0
- package/src/unblock-prs/watch.mts +219 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claim-pr.mjs","sourceRoot":"","sources":["../../src/cmd/claim-pr.mts"],"names":[],"mappings":";AAEA,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE/E,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;AAEvC,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;IACnD,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAE5B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,MAAM,IAAI,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;AAElC,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;IAC7B,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI,OAAO,aAAa,EAAE,CAAC,CAAC;IAE7C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE,CAC1D,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CACnC,CAAC;AAEF,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;IACzB,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAE5B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"open-pr.d.mts","sourceRoot":"","sources":["../../src/cmd/open-pr.mts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Arr, Result, unknownToString } from 'ts-data-forge';
|
|
3
|
+
import { HELP, openPullRequest, parseOptions } from '../open-pr/index.mjs';
|
|
4
|
+
const options = parseOptions(Arr.skip(process.argv, 2));
|
|
5
|
+
if (Result.isErr(options)) {
|
|
6
|
+
console.error(`${options.value}\n\n${HELP}`);
|
|
7
|
+
process.exit(1);
|
|
8
|
+
}
|
|
9
|
+
if (options.value === 'help') {
|
|
10
|
+
console.info(HELP);
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
const result = await openPullRequest(options.value).catch((error) => Result.err(unknownToString(error)));
|
|
14
|
+
if (Result.isErr(result)) {
|
|
15
|
+
console.error(result.value);
|
|
16
|
+
process.exit(1);
|
|
17
|
+
}
|
|
18
|
+
console.info(result.value);
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=open-pr.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"open-pr.mjs","sourceRoot":"","sources":["../../src/cmd/open-pr.mts"],"names":[],"mappings":";AAEA,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAE3E,MAAM,OAAO,GAAG,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;AAExD,IAAI,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;IAC1B,OAAO,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,KAAK,OAAO,IAAI,EAAE,CAAC,CAAC;IAE7C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,IAAI,OAAO,CAAC,KAAK,KAAK,MAAM,EAAE,CAAC;IAC7B,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACrB,CAAC;KAAM,CAAC;IACN,MAAM,MAAM,GAAG,MAAM,eAAe,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE,CAC3E,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CACnC,CAAC;IAEF,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;QACzB,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAE5B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pr-report.d.mts","sourceRoot":"","sources":["../../src/cmd/pr-report.mts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Arr, Result, unknownToString } from 'ts-data-forge';
|
|
3
|
+
import { HELP, parseOptions, prReport } from '../pr-report/index.mjs';
|
|
4
|
+
const options = parseOptions(Arr.skip(process.argv, 2));
|
|
5
|
+
if (Result.isErr(options)) {
|
|
6
|
+
console.error(`${options.value}\n\n${HELP}`);
|
|
7
|
+
process.exit(1);
|
|
8
|
+
}
|
|
9
|
+
if (options.value === 'help') {
|
|
10
|
+
console.info(HELP);
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
const result = await prReport(options.value).catch((error) => Result.err(unknownToString(error)));
|
|
14
|
+
if (Result.isErr(result)) {
|
|
15
|
+
console.error(result.value);
|
|
16
|
+
process.exit(1);
|
|
17
|
+
}
|
|
18
|
+
console.info(result.value);
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=pr-report.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pr-report.mjs","sourceRoot":"","sources":["../../src/cmd/pr-report.mts"],"names":[],"mappings":";AAEA,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAEtE,MAAM,OAAO,GAAG,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;AAExD,IAAI,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;IAC1B,OAAO,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,KAAK,OAAO,IAAI,EAAE,CAAC,CAAC;IAE7C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,IAAI,OAAO,CAAC,KAAK,KAAK,MAAM,EAAE,CAAC;IAC7B,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACrB,CAAC;KAAM,CAAC;IACN,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE,CACpE,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CACnC,CAAC;IAEF,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;QACzB,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAE5B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"push-fixed-pr.d.mts","sourceRoot":"","sources":["../../src/cmd/push-fixed-pr.mts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Arr, Result, unknownToString } from 'ts-data-forge';
|
|
3
|
+
import { PUSH_FIXED_PR_HELP, parsePushArgs, pushFixedPr, } from '../push-fixed-pr/index.mjs';
|
|
4
|
+
const argv = Arr.skip(process.argv, 2);
|
|
5
|
+
if (argv.includes('--help') || argv.includes('-h')) {
|
|
6
|
+
console.info(PUSH_FIXED_PR_HELP);
|
|
7
|
+
process.exit(0);
|
|
8
|
+
}
|
|
9
|
+
const args = parsePushArgs(argv);
|
|
10
|
+
if (typeof args === 'string') {
|
|
11
|
+
console.error(`${args}\n\n${PUSH_FIXED_PR_HELP}`);
|
|
12
|
+
process.exit(1);
|
|
13
|
+
}
|
|
14
|
+
const result = await pushFixedPr(args).catch((error) => Result.err(unknownToString(error)));
|
|
15
|
+
if (Result.isErr(result)) {
|
|
16
|
+
console.error(result.value);
|
|
17
|
+
process.exit(1);
|
|
18
|
+
}
|
|
19
|
+
console.info(result.value);
|
|
20
|
+
//# sourceMappingURL=push-fixed-pr.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"push-fixed-pr.mjs","sourceRoot":"","sources":["../../src/cmd/push-fixed-pr.mts"],"names":[],"mappings":";AAEA,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EACL,kBAAkB,EAClB,aAAa,EACb,WAAW,GACZ,MAAM,4BAA4B,CAAC;AAEpC,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;AAEvC,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;IACnD,OAAO,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;IAEjC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,MAAM,IAAI,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;AAEjC,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;IAC7B,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI,OAAO,kBAAkB,EAAE,CAAC,CAAC;IAElD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE,CAC9D,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CACnC,CAAC;AAEF,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;IACzB,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAE5B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report-unowned-prs.d.mts","sourceRoot":"","sources":["../../src/cmd/report-unowned-prs.mts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Arr, Result, unknownToString } from 'ts-data-forge';
|
|
3
|
+
import { REPORT_UNOWNED_PRS_HELP, reportUnownedPrs, } from '../report-unowned-prs/index.mjs';
|
|
4
|
+
const args = Arr.skip(process.argv, 2).filter((arg) => arg !== '--');
|
|
5
|
+
if (args.includes('--help') || args.includes('-h')) {
|
|
6
|
+
console.info(REPORT_UNOWNED_PRS_HELP);
|
|
7
|
+
process.exit(0);
|
|
8
|
+
}
|
|
9
|
+
const unknown = args.filter((arg) => arg !== '--dry-run');
|
|
10
|
+
if (Arr.isNonEmpty(unknown)) {
|
|
11
|
+
console.error(`unexpected argument: ${unknown.join(' ')}\n\n${REPORT_UNOWNED_PRS_HELP}`);
|
|
12
|
+
process.exit(1);
|
|
13
|
+
}
|
|
14
|
+
const result = await reportUnownedPrs(args.includes('--dry-run')).catch((error) => Result.err(unknownToString(error)));
|
|
15
|
+
if (Result.isErr(result)) {
|
|
16
|
+
console.error(result.value);
|
|
17
|
+
process.exit(1);
|
|
18
|
+
}
|
|
19
|
+
console.info(result.value);
|
|
20
|
+
//# sourceMappingURL=report-unowned-prs.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report-unowned-prs.mjs","sourceRoot":"","sources":["../../src/cmd/report-unowned-prs.mts"],"names":[],"mappings":";AAEA,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EACL,uBAAuB,EACvB,gBAAgB,GACjB,MAAM,iCAAiC,CAAC;AAEzC,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,KAAK,IAAI,CAAC,CAAC;AAErE,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;IACnD,OAAO,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;IAEtC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,KAAK,WAAW,CAAC,CAAC;AAE1D,IAAI,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;IAC5B,OAAO,CAAC,KAAK,CACX,wBAAwB,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,uBAAuB,EAAE,CAC1E,CAAC;IAEF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,CACrE,CAAC,KAAc,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CACvD,CAAC;AAEF,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;IACzB,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAE5B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unblock-prs.d.mts","sourceRoot":"","sources":["../../src/cmd/unblock-prs.mts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Arr, Result } from 'ts-data-forge';
|
|
3
|
+
import { HELP, parseOptions, unblockPrs } from '../unblock-prs/index.mjs';
|
|
4
|
+
const options = parseOptions(Arr.skip(process.argv, 2));
|
|
5
|
+
if (Result.isErr(options)) {
|
|
6
|
+
console.error(`${options.value}\n\n${HELP}`);
|
|
7
|
+
process.exit(2);
|
|
8
|
+
}
|
|
9
|
+
if (options.value === 'help') {
|
|
10
|
+
console.info(HELP);
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
const result = await unblockPrs(options.value);
|
|
14
|
+
if (Result.isErr(result)) {
|
|
15
|
+
console.error(result.value);
|
|
16
|
+
process.exit(1);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=unblock-prs.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unblock-prs.mjs","sourceRoot":"","sources":["../../src/cmd/unblock-prs.mts"],"names":[],"mappings":";AAEA,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAE1E,MAAM,OAAO,GAAG,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;AAExD,IAAI,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;IAC1B,OAAO,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,KAAK,OAAO,IAAI,EAAE,CAAC,CAAC;IAE7C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,IAAI,OAAO,CAAC,KAAK,KAAK,MAAM,EAAE,CAAC;IAC7B,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACrB,CAAC;KAAM,CAAC;IACN,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAE/C,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;QACzB,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAE5B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entry-point.d.mts","sourceRoot":"","sources":["../src/entry-point.mts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAEhC,OAAO,EAAE,cAAc,EAAE,KAAK,UAAU,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entry-point.mjs","sourceRoot":"","sources":["../src/entry-point.mts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAEhC,OAAO,EAAE,cAAc,EAAmB,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** Reading a command's arguments, and the values more than one command takes. */
|
|
2
|
+
import * as util from 'node:util';
|
|
3
|
+
import { Result } from 'ts-data-forge';
|
|
4
|
+
/**
|
|
5
|
+
* `util.parseArgs` over `args`, answering `'help'` when `-h` / `--help` was
|
|
6
|
+
* given and the values of `options` otherwise. `options` does not declare
|
|
7
|
+
* `help`; this does. Nothing throws: an unknown flag or a missing value is
|
|
8
|
+
* the error.
|
|
9
|
+
*/
|
|
10
|
+
export declare const parseCommandArgs: <const O extends util.ParseArgsOptionsConfig>(args: readonly string[], options: O) => Result<ReturnType<typeof util.parseArgs<Readonly<{
|
|
11
|
+
args: readonly string[];
|
|
12
|
+
options: O;
|
|
13
|
+
}>>>['values'] | 'help', string>;
|
|
14
|
+
/**
|
|
15
|
+
* `raw` as a positive whole number, or `fallback` when the flag was not
|
|
16
|
+
* given. Rejected rather than clamped otherwise: `-3` or `two` is a typo, and
|
|
17
|
+
* a command that quietly used the default instead would do something other
|
|
18
|
+
* than what was asked for.
|
|
19
|
+
*/
|
|
20
|
+
export declare const positiveInteger: (flag: string, raw: string | undefined, fallback: number) => Result<number, string>;
|
|
21
|
+
/**
|
|
22
|
+
* The pull request `raw` names, or `undefined` when it names none. `#1901`
|
|
23
|
+
* and `1901` both name the same one, and a person copying from GitHub will
|
|
24
|
+
* paste the first.
|
|
25
|
+
*/
|
|
26
|
+
export declare const pullRequestNumber: (raw: string) => number | undefined;
|
|
27
|
+
//# sourceMappingURL=cli-args.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-args.d.mts","sourceRoot":"","sources":["../../src/lib/cli-args.mts"],"names":[],"mappings":"AAAA,iFAAiF;AAEjF,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAO,MAAM,EAAmB,MAAM,eAAe,CAAC;AAE7D;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,GAAI,KAAK,CAAC,CAAC,SAAS,IAAI,CAAC,sBAAsB,QACpE,SAAS,MAAM,EAAE,WACd,CAAC,KACT,MAAM,CACL,UAAU,CACR,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC;IAAE,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IAAC,OAAO,EAAE,CAAC,CAAA;CAAE,CAAC,CAAC,CACzE,CAAC,QAAQ,CAAC,GACX,MAAM,EACR,MAAM,CA8BP,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,eAAe,SACpB,MAAM,OACP,MAAM,GAAG,SAAS,YACb,MAAM,KACf,MAAM,CAAC,MAAM,EAAE,MAAM,CAcvB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,QAAS,MAAM,KAAG,MAAM,GAAG,SAG1C,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
|
|
2
|
+
import * as util from 'node:util';
|
|
3
|
+
import { Num, Result, unknownToString } from 'ts-data-forge';
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
export const parseCommandArgs = (args, options) => {
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
const [first, ...rest] = args;
|
|
14
|
+
const argv = Array.from(first === '--' ? rest : args);
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
const help = Result.fromThrowable(() => util.parseArgs({
|
|
18
|
+
args: argv,
|
|
19
|
+
options: { help: { type: 'boolean', short: 'h' } },
|
|
20
|
+
strict: false,
|
|
21
|
+
}).values.help);
|
|
22
|
+
if (Result.isOk(help) && help.value === true) {
|
|
23
|
+
return Result.ok('help');
|
|
24
|
+
}
|
|
25
|
+
const parsed = Result.fromThrowable(() => util.parseArgs({ args: argv, options }));
|
|
26
|
+
return Result.isErr(parsed)
|
|
27
|
+
? Result.err(unknownToString(parsed.value))
|
|
28
|
+
: Result.ok(parsed.value.values);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
export const positiveInteger = (flag, raw, fallback) => {
|
|
37
|
+
if (raw === undefined) {
|
|
38
|
+
return Result.ok(fallback);
|
|
39
|
+
}
|
|
40
|
+
const parsed = /^[1-9]\d*$/u.test(raw)
|
|
41
|
+
? Result.unwrapOkOr(Num.safeParseInt(raw), undefined)
|
|
42
|
+
: undefined;
|
|
43
|
+
return parsed !== undefined && Number.isSafeInteger(parsed)
|
|
44
|
+
? Result.ok(parsed)
|
|
45
|
+
: Result.err(`--${flag} must be a positive whole number, got ${JSON.stringify(raw)}`);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
export const pullRequestNumber = (raw) => /^#?[1-9]\d*$/u.test(raw)
|
|
53
|
+
? Result.unwrapOkOr(Num.safeParseInt(raw.replace(/^#/u, '')), undefined)
|
|
54
|
+
: undefined;
|
|
55
|
+
//# sourceMappingURL=cli-args.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-args.mjs","sourceRoot":"","sources":["../../src/lib/cli-args.mts"],"names":[],"mappings":"AAAA,iFAAiF;AAEjF,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,GAAG,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;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,IAAY,EACZ,GAAuB,EACvB,QAAgB,EACQ,EAAE;IAC1B,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;QACtB,OAAO,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;IAC7B,CAAC;IAED,MAAM,MAAM,GAAG,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC;QACpC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,SAAS,CAAC;QACrD,CAAC,CAAC,SAAS,CAAC;IAEd,OAAO,MAAM,KAAK,SAAS,IAAI,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC;QACzD,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC;QACnB,CAAC,CAAC,MAAM,CAAC,GAAG,CACR,KAAK,IAAI,yCAAyC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CACxE,CAAC;AACR,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,GAAW,EAAsB,EAAE,CACnE,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC;IACvB,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,SAAS,CAAC;IACxE,CAAC,CAAC,SAAS,CAAC"}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The GitHub API over `fetch`, and the credential it needs, for every command.
|
|
3
|
+
*
|
|
4
|
+
* `open-pr` and `unblock-prs` used to shell out to `gh`. They do not any
|
|
5
|
+
* more, because the places they are most useful — a cloud container, a
|
|
6
|
+
* runner, a repository other than this one — are the places `gh` is least
|
|
7
|
+
* likely to be installed, while a token is already there. The
|
|
8
|
+
* API is the same one `gh` calls; only where the credential comes from
|
|
9
|
+
* differs, so `gh auth token` stays as the last resort for a machine set up
|
|
10
|
+
* that way with nothing exported.
|
|
11
|
+
*
|
|
12
|
+
* `mature-updates.mts` keeps a client of its own: it runs before
|
|
13
|
+
* `pnpm install`, when nothing this imports exists yet.
|
|
14
|
+
*/
|
|
15
|
+
import type { RepoRef } from 'pr-report-core';
|
|
16
|
+
import { Result } from 'ts-data-forge';
|
|
17
|
+
import * as t from 'ts-fortress';
|
|
18
|
+
import type { ReadonlyRecord } from 'ts-type-forge';
|
|
19
|
+
/** What every call here needs: who to talk to, and as whom. */
|
|
20
|
+
export type ApiContext = Readonly<{
|
|
21
|
+
repo: RepoRef;
|
|
22
|
+
token: string;
|
|
23
|
+
}>;
|
|
24
|
+
/**
|
|
25
|
+
* The token the environment holds, if any: `GH_TOKEN`, then `GITHUB_TOKEN`.
|
|
26
|
+
*
|
|
27
|
+
* That is the order `gh` reads them in, so that with both set every command
|
|
28
|
+
* here acts as the same account as `gh` would — the commands trust a comment
|
|
29
|
+
* by whose account wrote it, and `unblock-prs`'s set-aside comments were
|
|
30
|
+
* written through `gh` before it moved here. A workflow sets either only by passing it; Actions
|
|
31
|
+
* exports neither by itself. `github-settings-as-code` reads a list of its
|
|
32
|
+
* own, without `GITHUB_TOKEN`, and says why in `resolveAuthToken`.
|
|
33
|
+
*/
|
|
34
|
+
export declare const tokenFromEnv: () => string | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* The token to authenticate with: the environment first, `gh` only if it has
|
|
37
|
+
* to be. `GH_TOKEN` and `GITHUB_TOKEN` are what a runner and a container
|
|
38
|
+
* already set, and asking `gh` first would fail on exactly the machines this
|
|
39
|
+
* is for.
|
|
40
|
+
*/
|
|
41
|
+
export declare const resolveToken: () => Promise<Result<string, string>>;
|
|
42
|
+
/**
|
|
43
|
+
* The repository a command acts on, for every command here: `repoOption`
|
|
44
|
+
* (`--repo owner/name`) when given, else `origin`, else the root
|
|
45
|
+
* `package.json`.
|
|
46
|
+
*
|
|
47
|
+
* `origin` before the manifest because a fork's checkout names the fork
|
|
48
|
+
* there and the upstream in the manifest, and a command that reads the queue
|
|
49
|
+
* of one and pushes or comments on the other is worse than either. The
|
|
50
|
+
* manifest is for a checkout whose `origin` names no GitHub repository at
|
|
51
|
+
* all — a proxy remote in a container, a tree without `.git` — where it is
|
|
52
|
+
* the only thing left that says.
|
|
53
|
+
*/
|
|
54
|
+
export declare const resolveRepo: (repoOption?: string) => Promise<Result<RepoRef, string>>;
|
|
55
|
+
/** `owner/name`, as it is written everywhere else. */
|
|
56
|
+
export declare const parseRepoRef: (raw: string) => Result<RepoRef, string>;
|
|
57
|
+
/**
|
|
58
|
+
* The GitHub repository a remote or `repository.url` names, in the forms a
|
|
59
|
+
* checkout here is cloned with or a manifest declares:
|
|
60
|
+
* `https://github.com/owner/name(.git)`, `git+https://…`, and
|
|
61
|
+
* `git@github.com:owner/name(.git)`.
|
|
62
|
+
*/
|
|
63
|
+
export declare const repoOfUrl: (url: string) => RepoRef | undefined;
|
|
64
|
+
/**
|
|
65
|
+
* The token and the repository, for a command that calls {@link rest}.
|
|
66
|
+
* `repoOption` is a `--repo owner/name` the command was given, if any
|
|
67
|
+
* ({@link resolveRepo}).
|
|
68
|
+
*/
|
|
69
|
+
export declare const resolveApiContext: (repoOption?: string) => Promise<Result<ApiContext, string>>;
|
|
70
|
+
/**
|
|
71
|
+
* One REST call, resolving to the parsed body. A non-2xx becomes an error
|
|
72
|
+
* naming the status and what GitHub said about it, because "403" on its own
|
|
73
|
+
* sends the reader to the wrong place.
|
|
74
|
+
*/
|
|
75
|
+
export declare const rest: <A>(context: ApiContext, method: HttpMethod, path: string, schema: t.Type<A>, { query, body, withBodyHtml }?: RestOptions) => Promise<Result<A, string>>;
|
|
76
|
+
/**
|
|
77
|
+
* The login the token authenticates as. Outside `rest` because the route is
|
|
78
|
+
* not under the repository.
|
|
79
|
+
*/
|
|
80
|
+
export declare const viewerLogin: (token: string) => Promise<Result<string, string>>;
|
|
81
|
+
/** What a REST call may carry besides its path. */
|
|
82
|
+
export type RestOptions = Readonly<{
|
|
83
|
+
query?: ReadonlyRecord<string, string>;
|
|
84
|
+
body?: unknown;
|
|
85
|
+
/**
|
|
86
|
+
* Ask for `body_html` beside `body`: GitHub's rendering, which marks the
|
|
87
|
+
* closing keywords it recognized (`pr-report-core`'s
|
|
88
|
+
* `closingKeywordIssuesIn`).
|
|
89
|
+
*/
|
|
90
|
+
withBodyHtml?: boolean;
|
|
91
|
+
}>;
|
|
92
|
+
/**
|
|
93
|
+
* One GraphQL mutation. Two of `open-pr`'s four writes have no REST
|
|
94
|
+
* equivalent — GitHub exposes neither "mark ready for review" nor "enable
|
|
95
|
+
* auto-merge" there — so those go through here rather than through a
|
|
96
|
+
* different tool.
|
|
97
|
+
*/
|
|
98
|
+
export declare const graphql: (context: ApiContext, query: string, variables: GraphqlVariables) => Promise<Result<undefined, string>>;
|
|
99
|
+
/**
|
|
100
|
+
* One GraphQL request, resolving to its `data` validated by `schema`.
|
|
101
|
+
*
|
|
102
|
+
* GraphQL answers 200 to a failed request and puts the reason in `errors`,
|
|
103
|
+
* so that is checked rather than the status alone. A partial answer — `data`
|
|
104
|
+
* beside `errors` — is still a failure: what is missing from it is exactly
|
|
105
|
+
* what the caller asked for.
|
|
106
|
+
*/
|
|
107
|
+
export declare const graphqlQuery: <A>(context: ApiContext, query: string, variables: GraphqlVariables, schema: t.Type<A>) => Promise<Result<A, string>>;
|
|
108
|
+
/** What a GraphQL request's variables may hold: names, numbers and ids. */
|
|
109
|
+
export type GraphqlVariables = ReadonlyRecord<string, number | string>;
|
|
110
|
+
/** The methods the commands call the REST API with. */
|
|
111
|
+
export type HttpMethod = 'DELETE' | 'GET' | 'PATCH' | 'POST';
|
|
112
|
+
/**
|
|
113
|
+
* Adds `label` to a pull request. Labels hang off the issue, which is the
|
|
114
|
+
* same object as the pull request.
|
|
115
|
+
*/
|
|
116
|
+
export declare const addLabel: (context: ApiContext, prNumber: number, label: string) => Promise<Result<undefined, string>>;
|
|
117
|
+
/**
|
|
118
|
+
* Takes `label` off a pull request. A label already off is not an error, as
|
|
119
|
+
* it is not to `gh pr edit --remove-label`: GitHub answers 404, and what the
|
|
120
|
+
* caller wanted is true.
|
|
121
|
+
*/
|
|
122
|
+
export declare const removeLabel: (context: ApiContext, prNumber: number, label: string) => Promise<Result<undefined, string>>;
|
|
123
|
+
/** One request to the API, before anything is made of the answer. */
|
|
124
|
+
export type GitHubRequest = Readonly<{
|
|
125
|
+
url: string;
|
|
126
|
+
method: HttpMethod;
|
|
127
|
+
/** Absent for an anonymous read, which a public repository allows. */
|
|
128
|
+
token: string | undefined;
|
|
129
|
+
accept: string;
|
|
130
|
+
body: string | undefined;
|
|
131
|
+
}>;
|
|
132
|
+
/**
|
|
133
|
+
* Why a request came to nothing: the transport failing, or GitHub refusing
|
|
134
|
+
* with a status and what it said about it.
|
|
135
|
+
*/
|
|
136
|
+
export type GitHubRefusal = Readonly<{
|
|
137
|
+
message: string;
|
|
138
|
+
/**
|
|
139
|
+
* Whether the refusal is the rate limit being spent — the one failure a
|
|
140
|
+
* reader can do something about without reading the body of the answer.
|
|
141
|
+
*/
|
|
142
|
+
rateLimited: boolean;
|
|
143
|
+
}>;
|
|
144
|
+
/**
|
|
145
|
+
* The request itself, resolving to the response body as text. A transport
|
|
146
|
+
* failure and a refusal both become a {@link GitHubRefusal}; nothing here
|
|
147
|
+
* throws.
|
|
148
|
+
*
|
|
149
|
+
* The headers are assembled here rather than passed in, so that every call
|
|
150
|
+
* the commands make carries the same ones and there is one place to read.
|
|
151
|
+
*/
|
|
152
|
+
export declare const send: ({ url, method, token, accept, body, }: GitHubRequest) => Promise<Result<string, GitHubRefusal>>;
|
|
153
|
+
//# sourceMappingURL=github-api.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github-api.d.mts","sourceRoot":"","sources":["../../src/lib/github-api.mts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAG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