@blogic-cz/agent-tools 0.15.3 → 0.15.4
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/package.json +1 -1
- package/src/gh-tool/index.ts +2 -0
- package/src/gh-tool/pr/commands.ts +25 -0
- package/src/gh-tool/pr/core.ts +17 -0
- package/src/gh-tool/pr/index.ts +1 -0
package/package.json
CHANGED
package/src/gh-tool/index.ts
CHANGED
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
prCloseCommand,
|
|
26
26
|
prEditCommand,
|
|
27
27
|
prMergeCommand,
|
|
28
|
+
prReadyCommand,
|
|
28
29
|
prThreadsCommand,
|
|
29
30
|
prCommentsCommand,
|
|
30
31
|
prIssueCommentsCommand,
|
|
@@ -81,6 +82,7 @@ const prCommand = Command.make("pr", {}).pipe(
|
|
|
81
82
|
prCloseCommand,
|
|
82
83
|
prEditCommand,
|
|
83
84
|
prMergeCommand,
|
|
85
|
+
prReadyCommand,
|
|
84
86
|
prWaitMergeableCommand,
|
|
85
87
|
prThreadsCommand,
|
|
86
88
|
prCommentsCommand,
|
|
@@ -38,6 +38,7 @@ import {
|
|
|
38
38
|
fetchFailedChecks,
|
|
39
39
|
listPRs,
|
|
40
40
|
mergePR,
|
|
41
|
+
readyPR,
|
|
41
42
|
rerunChecks,
|
|
42
43
|
triggerChecks,
|
|
43
44
|
watchPRs,
|
|
@@ -644,6 +645,30 @@ export const prMergeCommand = Command.make(
|
|
|
644
645
|
),
|
|
645
646
|
).pipe(Command.withDescription("Merge a PR (dry-run by default, use --confirm to execute)"));
|
|
646
647
|
|
|
648
|
+
export const prReadyCommand = Command.make(
|
|
649
|
+
"ready",
|
|
650
|
+
{
|
|
651
|
+
format: formatOption,
|
|
652
|
+
pr: Flag.integer("pr").pipe(
|
|
653
|
+
Flag.withDescription("PR number (default: current branch PR)"),
|
|
654
|
+
Flag.optional,
|
|
655
|
+
),
|
|
656
|
+
repo: repoOption,
|
|
657
|
+
},
|
|
658
|
+
({ format, pr, repo }) =>
|
|
659
|
+
withRepo(
|
|
660
|
+
repo,
|
|
661
|
+
Effect.gen(function* () {
|
|
662
|
+
const result = yield* readyPR({ pr: Option.getOrNull(pr) });
|
|
663
|
+
yield* logFormatted(result, format);
|
|
664
|
+
}),
|
|
665
|
+
),
|
|
666
|
+
).pipe(
|
|
667
|
+
Command.withDescription(
|
|
668
|
+
"Mark a draft PR as ready for review (no-op if it's already ready for review)",
|
|
669
|
+
),
|
|
670
|
+
);
|
|
671
|
+
|
|
647
672
|
export const prChecksCommand = Command.make(
|
|
648
673
|
"checks",
|
|
649
674
|
{
|
package/src/gh-tool/pr/core.ts
CHANGED
|
@@ -972,6 +972,23 @@ export const closePR = Effect.fn("pr.closePR")(function* (opts: {
|
|
|
972
972
|
return yield* viewPR(opts.pr);
|
|
973
973
|
});
|
|
974
974
|
|
|
975
|
+
export const readyPR = Effect.fn("pr.readyPR")(function* (opts: { pr: number | null }) {
|
|
976
|
+
const gh = yield* GitHubService;
|
|
977
|
+
|
|
978
|
+
const info = yield* viewPR(opts.pr);
|
|
979
|
+
|
|
980
|
+
// Idempotent: a PR that's already ready needs no mutation, and `gh pr ready` on a
|
|
981
|
+
// non-draft PR is a no-op that would just add a pointless call.
|
|
982
|
+
if (!info.isDraft) {
|
|
983
|
+
return { ...info, wasAlreadyReady: true };
|
|
984
|
+
}
|
|
985
|
+
|
|
986
|
+
yield* gh.runGh(["pr", "ready", String(info.number)]);
|
|
987
|
+
|
|
988
|
+
const updated = yield* viewPR(info.number);
|
|
989
|
+
return { ...updated, wasAlreadyReady: false };
|
|
990
|
+
});
|
|
991
|
+
|
|
975
992
|
export const editPR = Effect.fn("pr.editPR")(function* (opts: {
|
|
976
993
|
pr: number;
|
|
977
994
|
title: string | null;
|