@blogic-cz/agent-tools 1.6.7 → 1.6.9
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/README.md +8 -0
- package/dist/db-tool/schema.d.ts.map +1 -1
- package/dist/gh-tool/pr/commands.d.ts +3 -2
- package/dist/gh-tool/pr/commands.d.ts.map +1 -1
- package/dist/gh-tool/pr/core.d.ts +29 -8
- package/dist/gh-tool/pr/core.d.ts.map +1 -1
- package/dist/gh-tool/workflow.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/db-tool/schema.ts +9 -8
- package/src/gh-tool/pr/commands.ts +9 -2
- package/src/gh-tool/pr/core.ts +116 -55
- package/src/gh-tool/workflow.ts +27 -17
package/README.md
CHANGED
|
@@ -295,6 +295,14 @@ bun gh-tool gist delete --id <gist-id> --confirm
|
|
|
295
295
|
|
|
296
296
|
Gists are secret by default. `gist delete` prints a dry run unless `--confirm` is passed. `gist edit` requires a content or mutation flag and never opens an editor.
|
|
297
297
|
|
|
298
|
+
`pr create` refuses when an open PR already matches the head and base branches. Pass
|
|
299
|
+
`--update-if-exists` to update that open PR explicitly. Output includes `updated: true`
|
|
300
|
+
for an update and `updated: false` for a new PR. Only open PRs are selected, and their
|
|
301
|
+
state is rechecked before editing. A concurrent close or merge after that read can still
|
|
302
|
+
race with the edit. Bare or current heads match the selected repository owner's PRs;
|
|
303
|
+
use `--head owner:branch` to opt into updating a fork's PR. `pr edit --body ""` clears
|
|
304
|
+
the body; `pr view` always includes `body`.
|
|
305
|
+
|
|
298
306
|
### Stacked pull requests
|
|
299
307
|
|
|
300
308
|
GitHub's native stacked PRs refuse the GraphQL merge and require the asynchronous REST
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/db-tool/schema.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,uCAAuC,CAAC;AAEvE,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG;IAAE,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAQjG;AAED,eAAO,MAAM,cAAc;IACzB,MAAM;IASN,OAAO,cAAc,MAAM;
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/db-tool/schema.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,uCAAuC,CAAC;AAEvE,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG;IAAE,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAQjG;AAED,eAAO,MAAM,cAAc;IACzB,MAAM;IASN,OAAO,cAAc,MAAM;IA+B3B,aAAa;CAoBd,CAAC;AAEF,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAED,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC"}
|
|
@@ -114,7 +114,6 @@ export declare const fetchReviewTriage: (prNumber: number | null, format?: "json
|
|
|
114
114
|
state: string;
|
|
115
115
|
isDraft: boolean;
|
|
116
116
|
mergeable: "MERGEABLE" | "CONFLICTING" | "UNKNOWN";
|
|
117
|
-
body: string;
|
|
118
117
|
author: {
|
|
119
118
|
login: string;
|
|
120
119
|
is_bot: boolean;
|
|
@@ -122,6 +121,7 @@ export declare const fetchReviewTriage: (prNumber: number | null, format?: "json
|
|
|
122
121
|
reviewDecision: "APPROVED" | "CHANGES_REQUESTED" | "REVIEW_REQUIRED" | "";
|
|
123
122
|
reviewRequests: import("#gh/types").ReviewRequest[];
|
|
124
123
|
headRefOid?: string;
|
|
124
|
+
body: string;
|
|
125
125
|
headSha: string | null;
|
|
126
126
|
baseSha: string | null;
|
|
127
127
|
};
|
|
@@ -196,7 +196,8 @@ export declare const prCreateCommand: Command.Command<"create", {
|
|
|
196
196
|
readonly head: Option.Option<string>;
|
|
197
197
|
readonly repo: Option.Option<string>;
|
|
198
198
|
readonly title: string;
|
|
199
|
-
|
|
199
|
+
readonly updateIfExists: boolean;
|
|
200
|
+
}, {}, import("#gh/service").GhError, import("effect/unstable/process/ChildProcessSpawner").ChildProcessSpawner | GitHubService>;
|
|
200
201
|
export declare const prEditCommand: Command.Command<"edit", {
|
|
201
202
|
readonly base: Option.Option<string>;
|
|
202
203
|
readonly body: Option.Option<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../../src/gh-tool/pr/commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAe,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAW,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEjD,OAAO,KAAK,EAAE,WAAW,EAAkB,MAAM,WAAW,CAAC;AAG7D,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAiGhD,eAAO,MAAM,cAAc,cAAe,MAAM,4FAM/C,CAAC;AAiCF,eAAO,MAAM,aAAa,OAAQ,MAAM,aAAa,MAAM;;;;;;gDA6BvD,CAAC;AAEL,KAAK,mBAAmB,GAAG;IACzB,QAAQ,CAAC,6BAA6B,EAAE,MAAM,CAAC;IAC/C,QAAQ,CAAC,2BAA2B,EAAE,MAAM,CAAC;IAC7C,QAAQ,CAAC,4BAA4B,EAAE,MAAM,CAAC;CAC/C,CAAC;AAEF,KAAK,0BAA0B,GAAG;IAChC,QAAQ,CAAC,MAAM,EAAE,OAAO,GAAG,qBAAqB,CAAC;IACjD,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;CACrC,CAAC;AAEF,eAAO,MAAM,oBAAoB,YACtB,mBAAmB,UACpB,SAAS,WAAW,EAAE,KAC7B,0BAQF,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are const fetchPRView: (prNumber: number | null) => Effect.Effect<{
|
|
|
14
14
|
state: string;
|
|
15
15
|
isDraft: boolean;
|
|
16
16
|
mergeable: "MERGEABLE" | "CONFLICTING" | "UNKNOWN";
|
|
17
|
-
body: string;
|
|
18
17
|
author: {
|
|
19
18
|
login: string;
|
|
20
19
|
is_bot: boolean;
|
|
@@ -22,6 +21,7 @@ export declare const fetchPRView: (prNumber: number | null) => Effect.Effect<{
|
|
|
22
21
|
reviewDecision: "APPROVED" | "CHANGES_REQUESTED" | "REVIEW_REQUIRED" | "";
|
|
23
22
|
reviewRequests: import("#gh/types").ReviewRequest[];
|
|
24
23
|
headRefOid?: string;
|
|
24
|
+
body: string;
|
|
25
25
|
headSha: string | null;
|
|
26
26
|
baseSha: string | null;
|
|
27
27
|
}, import("#gh/service").GhError, GitHubService>;
|
|
@@ -34,7 +34,6 @@ export declare const viewPR: (prNumber: number | null) => Effect.Effect<{
|
|
|
34
34
|
state: string;
|
|
35
35
|
isDraft: boolean;
|
|
36
36
|
mergeable: "MERGEABLE" | "CONFLICTING" | "UNKNOWN";
|
|
37
|
-
body: string;
|
|
38
37
|
author: {
|
|
39
38
|
login: string;
|
|
40
39
|
is_bot: boolean;
|
|
@@ -42,6 +41,7 @@ export declare const viewPR: (prNumber: number | null) => Effect.Effect<{
|
|
|
42
41
|
reviewDecision: "APPROVED" | "CHANGES_REQUESTED" | "REVIEW_REQUIRED" | "";
|
|
43
42
|
reviewRequests: import("#gh/types").ReviewRequest[];
|
|
44
43
|
headRefOid?: string;
|
|
44
|
+
body: string;
|
|
45
45
|
headSha: string | null;
|
|
46
46
|
baseSha: string | null;
|
|
47
47
|
}, import("#gh/service").GhError, GitHubService>;
|
|
@@ -78,7 +78,6 @@ export declare const waitForMergeable: (pr: number | null, timeoutSeconds: numbe
|
|
|
78
78
|
state: string;
|
|
79
79
|
isDraft: boolean;
|
|
80
80
|
mergeable: "MERGEABLE" | "CONFLICTING" | "UNKNOWN";
|
|
81
|
-
body: string;
|
|
82
81
|
author: {
|
|
83
82
|
login: string;
|
|
84
83
|
is_bot: boolean;
|
|
@@ -86,6 +85,7 @@ export declare const waitForMergeable: (pr: number | null, timeoutSeconds: numbe
|
|
|
86
85
|
reviewDecision: "APPROVED" | "CHANGES_REQUESTED" | "REVIEW_REQUIRED" | "";
|
|
87
86
|
reviewRequests: import("#gh/types").ReviewRequest[];
|
|
88
87
|
headRefOid?: string;
|
|
88
|
+
body: string;
|
|
89
89
|
headSha: string | null;
|
|
90
90
|
baseSha: string | null;
|
|
91
91
|
}, import("#gh/service").GhError, GitHubService>;
|
|
@@ -95,7 +95,28 @@ export declare const createPR: (opts: {
|
|
|
95
95
|
body: string;
|
|
96
96
|
draft: boolean;
|
|
97
97
|
head: string | null;
|
|
98
|
-
|
|
98
|
+
updateIfExists?: boolean;
|
|
99
|
+
}) => Effect.Effect<{
|
|
100
|
+
number: number;
|
|
101
|
+
url: string;
|
|
102
|
+
title: string;
|
|
103
|
+
headRefName: string;
|
|
104
|
+
baseRefName: string;
|
|
105
|
+
state: string;
|
|
106
|
+
isDraft: boolean;
|
|
107
|
+
mergeable: "MERGEABLE" | "CONFLICTING" | "UNKNOWN";
|
|
108
|
+
author: {
|
|
109
|
+
login: string;
|
|
110
|
+
is_bot: boolean;
|
|
111
|
+
};
|
|
112
|
+
reviewDecision: "APPROVED" | "CHANGES_REQUESTED" | "REVIEW_REQUIRED" | "";
|
|
113
|
+
reviewRequests: import("#gh/types").ReviewRequest[];
|
|
114
|
+
headRefOid?: string;
|
|
115
|
+
body: string;
|
|
116
|
+
headSha: string | null;
|
|
117
|
+
baseSha: string | null;
|
|
118
|
+
updated: boolean;
|
|
119
|
+
}, import("#gh/service").GhError, import("effect/unstable/process/ChildProcessSpawner").ChildProcessSpawner | GitHubService>;
|
|
99
120
|
export declare const mergePR: (opts: {
|
|
100
121
|
pr: number;
|
|
101
122
|
strategy: MergeStrategy;
|
|
@@ -115,7 +136,6 @@ export declare const closePR: (opts: {
|
|
|
115
136
|
state: string;
|
|
116
137
|
isDraft: boolean;
|
|
117
138
|
mergeable: "MERGEABLE" | "CONFLICTING" | "UNKNOWN";
|
|
118
|
-
body: string;
|
|
119
139
|
author: {
|
|
120
140
|
login: string;
|
|
121
141
|
is_bot: boolean;
|
|
@@ -123,6 +143,7 @@ export declare const closePR: (opts: {
|
|
|
123
143
|
reviewDecision: "APPROVED" | "CHANGES_REQUESTED" | "REVIEW_REQUIRED" | "";
|
|
124
144
|
reviewRequests: import("#gh/types").ReviewRequest[];
|
|
125
145
|
headRefOid?: string;
|
|
146
|
+
body: string;
|
|
126
147
|
headSha: string | null;
|
|
127
148
|
baseSha: string | null;
|
|
128
149
|
}, import("#gh/service").GhError, GitHubService>;
|
|
@@ -137,7 +158,6 @@ export declare const readyPR: (opts: {
|
|
|
137
158
|
state: string;
|
|
138
159
|
isDraft: boolean;
|
|
139
160
|
mergeable: "MERGEABLE" | "CONFLICTING" | "UNKNOWN";
|
|
140
|
-
body: string;
|
|
141
161
|
author: {
|
|
142
162
|
login: string;
|
|
143
163
|
is_bot: boolean;
|
|
@@ -145,6 +165,7 @@ export declare const readyPR: (opts: {
|
|
|
145
165
|
reviewDecision: "APPROVED" | "CHANGES_REQUESTED" | "REVIEW_REQUIRED" | "";
|
|
146
166
|
reviewRequests: import("#gh/types").ReviewRequest[];
|
|
147
167
|
headRefOid?: string;
|
|
168
|
+
body: string;
|
|
148
169
|
headSha: string | null;
|
|
149
170
|
baseSha: string | null;
|
|
150
171
|
wasAlreadyReady: boolean;
|
|
@@ -160,7 +181,6 @@ export declare const draftPR: (opts: {
|
|
|
160
181
|
state: string;
|
|
161
182
|
isDraft: boolean;
|
|
162
183
|
mergeable: "MERGEABLE" | "CONFLICTING" | "UNKNOWN";
|
|
163
|
-
body: string;
|
|
164
184
|
author: {
|
|
165
185
|
login: string;
|
|
166
186
|
is_bot: boolean;
|
|
@@ -168,6 +188,7 @@ export declare const draftPR: (opts: {
|
|
|
168
188
|
reviewDecision: "APPROVED" | "CHANGES_REQUESTED" | "REVIEW_REQUIRED" | "";
|
|
169
189
|
reviewRequests: import("#gh/types").ReviewRequest[];
|
|
170
190
|
headRefOid?: string;
|
|
191
|
+
body: string;
|
|
171
192
|
headSha: string | null;
|
|
172
193
|
baseSha: string | null;
|
|
173
194
|
wasAlreadyDraft: boolean;
|
|
@@ -186,7 +207,6 @@ export declare const editPR: (opts: {
|
|
|
186
207
|
state: string;
|
|
187
208
|
isDraft: boolean;
|
|
188
209
|
mergeable: "MERGEABLE" | "CONFLICTING" | "UNKNOWN";
|
|
189
|
-
body: string;
|
|
190
210
|
author: {
|
|
191
211
|
login: string;
|
|
192
212
|
is_bot: boolean;
|
|
@@ -194,6 +214,7 @@ export declare const editPR: (opts: {
|
|
|
194
214
|
reviewDecision: "APPROVED" | "CHANGES_REQUESTED" | "REVIEW_REQUIRED" | "";
|
|
195
215
|
reviewRequests: import("#gh/types").ReviewRequest[];
|
|
196
216
|
headRefOid?: string;
|
|
217
|
+
body: string;
|
|
197
218
|
headSha: string | null;
|
|
198
219
|
baseSha: string | null;
|
|
199
220
|
}, import("#gh/service").GhError, GitHubService>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../src/gh-tool/pr/core.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,MAAM,EAAkB,MAAM,QAAQ,CAAC;AAE1E,OAAO,KAAK,EACV,cAAc,EACd,WAAW,EACX,iBAAiB,EAEjB,WAAW,EACX,aAAa,EACb,MAAM,EAGN,iBAAiB,EAIlB,MAAM,WAAW,CAAC;AAEnB,OAAO,KAAK,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AA4O5C,eAAO,MAAM,qBAAqB,QAAwB,CAAC;AAS3D,eAAO,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ChB,MAAM;SACR,MAAM;YACH,MAAM,GAAG,IAAI;sBACH,SAAS,MAAM,EAAE,GAAG,IAAI;qBACzB,OAAO;eACb,OAAO;YACV,MAAM;UACR,MAAM,GAAG,IAAI;;;;;;;;;;;;;;;;;;;;;;8CAmEnB,CAAC;AAMH,eAAO,MAAM,mBAAmB;;;;;;;kDA8C/B,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;;kDAaqD,CAAC;AAEtF,eAAO,MAAM,mBAAmB;;;;kDAa+C,CAAC;AAEhF,eAAO,MAAM,mBAAmB;;;;;kDAsB2D,CAAC;AAE5F,eAAO,MAAM,oBAAoB;;;;;kDAiBoD,CAAC;AAEtF,eAAO,MAAM,qBAAqB;;;;kDAamC,CAAC;AAEtE,eAAO,MAAM,kBAAkB;;;;;;kDAgD6C,CAAC;AAE7E,eAAO,MAAM,oBAAoB;;;;;;kDA6BiE,CAAC;AAEnG,eAAO,MAAM,sBAAsB;;;;;;;kDAwClC,CAAC;AAEF,eAAO,MAAM,0BAA0B;;;;;kDAyBtC,CAAC"}
|
package/package.json
CHANGED
package/src/db-tool/schema.ts
CHANGED
|
@@ -42,14 +42,15 @@ export const SCHEMA_QUERIES = {
|
|
|
42
42
|
c.data_type as type,
|
|
43
43
|
c.is_nullable = 'YES' as nullable,
|
|
44
44
|
c.column_default as default_value,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
45
|
+
EXISTS (
|
|
46
|
+
SELECT 1 FROM information_schema.table_constraints tc
|
|
47
|
+
JOIN information_schema.key_column_usage kcu
|
|
48
|
+
ON kcu.constraint_schema = tc.constraint_schema
|
|
49
|
+
AND kcu.constraint_name = tc.constraint_name
|
|
50
|
+
WHERE tc.table_schema = c.table_schema
|
|
51
|
+
AND tc.table_name = c.table_name
|
|
52
|
+
AND kcu.column_name = c.column_name
|
|
53
|
+
AND tc.constraint_type = 'PRIMARY KEY'
|
|
53
54
|
) as is_primary_key
|
|
54
55
|
FROM information_schema.columns c
|
|
55
56
|
WHERE c.table_name = '${escapedTableName}'
|
|
@@ -610,8 +610,12 @@ export const prCreateCommand = Command.make(
|
|
|
610
610
|
),
|
|
611
611
|
repo: repoOption,
|
|
612
612
|
title: Flag.String("title").pipe(Flag.withDescription("PR title")),
|
|
613
|
+
updateIfExists: Flag.Boolean("update-if-exists").pipe(
|
|
614
|
+
Flag.withDescription("Update an existing open PR matching the head and base branches"),
|
|
615
|
+
Flag.withDefault(false),
|
|
616
|
+
),
|
|
613
617
|
},
|
|
614
|
-
({ base, body, bodyFile, bodyStdin, draft, format, head, repo, title }) =>
|
|
618
|
+
({ base, body, bodyFile, bodyStdin, draft, format, head, repo, title, updateIfExists }) =>
|
|
615
619
|
withRepo(
|
|
616
620
|
repo,
|
|
617
621
|
Effect.gen(function* () {
|
|
@@ -633,11 +637,14 @@ export const prCreateCommand = Command.make(
|
|
|
633
637
|
draft,
|
|
634
638
|
head: Option.getOrNull(head),
|
|
635
639
|
title,
|
|
640
|
+
updateIfExists,
|
|
636
641
|
});
|
|
637
642
|
yield* logFormatted(info, format);
|
|
638
643
|
}),
|
|
639
644
|
),
|
|
640
|
-
).pipe(
|
|
645
|
+
).pipe(
|
|
646
|
+
Command.withDescription("Create a PR; updating an existing open PR requires --update-if-exists"),
|
|
647
|
+
);
|
|
641
648
|
|
|
642
649
|
export const prEditCommand = Command.make(
|
|
643
650
|
"edit",
|
package/src/gh-tool/pr/core.ts
CHANGED
|
@@ -437,6 +437,7 @@ export const fetchPRView = Effect.fn("pr.fetchPRView")(function* (prNumber: numb
|
|
|
437
437
|
const info = yield* gh.runGhJson<PRViewInfo & { headRefOid?: string }>(args);
|
|
438
438
|
return {
|
|
439
439
|
...info,
|
|
440
|
+
body: info.body ?? "",
|
|
440
441
|
headSha: info.headRefOid ?? info.headSha ?? null,
|
|
441
442
|
baseSha: info.baseSha ?? null,
|
|
442
443
|
};
|
|
@@ -687,45 +688,114 @@ export const createPR = Effect.fn("pr.createPR")(function* (opts: {
|
|
|
687
688
|
body: string;
|
|
688
689
|
draft: boolean;
|
|
689
690
|
head: string | null;
|
|
691
|
+
updateIfExists?: boolean;
|
|
690
692
|
}) {
|
|
691
693
|
const gh = yield* GitHubService;
|
|
692
694
|
yield* validatePRTitle(opts.title);
|
|
693
695
|
|
|
694
696
|
// Default to the repo's real default branch instead of a hardcoded "test" — an omitted --base
|
|
695
697
|
// must never silently open a PR against the wrong trunk (L1).
|
|
696
|
-
const
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
const
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
698
|
+
const repo = yield* gh.getRepoInfo();
|
|
699
|
+
const baseBranch = opts.base ?? repo.defaultBranch;
|
|
700
|
+
const head =
|
|
701
|
+
opts.head ?? (yield* runLocalCommand("git", ["symbolic-ref", "--short", "HEAD"])).stdout;
|
|
702
|
+
const headSeparator = head.indexOf(":");
|
|
703
|
+
const headOwner = (
|
|
704
|
+
headSeparator === -1 ? repo.owner : head.slice(0, headSeparator)
|
|
705
|
+
).toLowerCase();
|
|
706
|
+
const headBranch = headSeparator === -1 ? head : head.slice(headSeparator + 1);
|
|
707
|
+
const lookupArgs = [
|
|
708
|
+
"pr",
|
|
709
|
+
"list",
|
|
710
|
+
"--repo",
|
|
711
|
+
`${repo.owner}/${repo.name}`,
|
|
712
|
+
"--state",
|
|
713
|
+
"open",
|
|
714
|
+
"--head",
|
|
715
|
+
headBranch,
|
|
716
|
+
"--base",
|
|
717
|
+
baseBranch,
|
|
718
|
+
"--json",
|
|
719
|
+
"number,url,title,headRefName,baseRefName,state,isDraft,mergeable,headRepositoryOwner",
|
|
720
|
+
"--limit",
|
|
721
|
+
"2",
|
|
722
|
+
];
|
|
723
|
+
type Candidate = PRInfo & { headRepositoryOwner?: { login: string } };
|
|
724
|
+
const candidates = yield* gh.runGhJson<Candidate[]>(lookupArgs);
|
|
725
|
+
// The limited query may include another fork's branch. Refuse a saturated result
|
|
726
|
+
// rather than assuming an owner-filtered match beyond the limit does not exist.
|
|
727
|
+
if (candidates.length > 1) {
|
|
728
|
+
return yield* new GitHubCommandError({
|
|
729
|
+
command: "pr create",
|
|
730
|
+
exitCode: 1,
|
|
731
|
+
stderr: "Multiple open pull requests match the head and base branches.",
|
|
732
|
+
message: "Multiple open pull requests match the head and base branches.",
|
|
733
|
+
hint: "Select the intended PR with 'pr edit --pr <number>'.",
|
|
734
|
+
});
|
|
735
|
+
}
|
|
736
|
+
const branchCandidate = candidates.find(
|
|
737
|
+
(pr) => pr.state === "OPEN" && pr.headRefName === headBranch && pr.baseRefName === baseBranch,
|
|
738
|
+
);
|
|
739
|
+
if (branchCandidate !== undefined && !branchCandidate.headRepositoryOwner?.login) {
|
|
740
|
+
return yield* new GitHubCommandError({
|
|
741
|
+
command: "pr create",
|
|
742
|
+
exitCode: 1,
|
|
743
|
+
stderr: "Cannot establish the existing PR's head repository owner.",
|
|
744
|
+
message: "Cannot establish the existing PR's head repository owner.",
|
|
745
|
+
});
|
|
746
|
+
}
|
|
747
|
+
if (
|
|
748
|
+
opts.updateIfExists === true &&
|
|
749
|
+
headSeparator === -1 &&
|
|
750
|
+
branchCandidate !== undefined &&
|
|
751
|
+
branchCandidate.headRepositoryOwner?.login.toLowerCase() !== headOwner
|
|
752
|
+
) {
|
|
753
|
+
return yield* new GitHubCommandError({
|
|
754
|
+
command: "pr create",
|
|
755
|
+
exitCode: 1,
|
|
756
|
+
stderr: `PR #${branchCandidate.number} belongs to a different head repository owner.`,
|
|
757
|
+
message: `PR #${branchCandidate.number} belongs to a different head repository owner.`,
|
|
758
|
+
hint: "Use --head owner:branch to explicitly select a fork's PR, or 'pr edit --pr <number>'.",
|
|
759
|
+
});
|
|
760
|
+
}
|
|
761
|
+
const existing = candidates.find(
|
|
762
|
+
(pr) =>
|
|
763
|
+
pr.state === "OPEN" &&
|
|
764
|
+
pr.headRefName === headBranch &&
|
|
765
|
+
pr.baseRefName === baseBranch &&
|
|
766
|
+
pr.headRepositoryOwner?.login.toLowerCase() === headOwner,
|
|
767
|
+
);
|
|
768
|
+
if (existing !== undefined) {
|
|
769
|
+
if (opts.updateIfExists !== true) {
|
|
770
|
+
return yield* new GitHubCommandError({
|
|
771
|
+
command: "pr create",
|
|
772
|
+
exitCode: 1,
|
|
773
|
+
stderr: `Open PR #${existing.number} already exists for ${headBranch} -> ${baseBranch}.`,
|
|
774
|
+
message: `Open PR #${existing.number} already exists for ${headBranch} -> ${baseBranch}.`,
|
|
775
|
+
hint: "Use --update-if-exists to update it, or 'pr edit --pr <number>'.",
|
|
776
|
+
});
|
|
777
|
+
}
|
|
778
|
+
const current = yield* fetchPRView(existing.number);
|
|
779
|
+
if (
|
|
780
|
+
current.state !== "OPEN" ||
|
|
781
|
+
current.headRefName !== headBranch ||
|
|
782
|
+
current.baseRefName !== baseBranch
|
|
783
|
+
) {
|
|
784
|
+
return yield* new GitHubCommandError({
|
|
785
|
+
command: "pr create",
|
|
786
|
+
exitCode: 1,
|
|
787
|
+
stderr: `PR #${existing.number} no longer matches an open PR for the requested branches.`,
|
|
788
|
+
message: `PR #${existing.number} no longer matches an open PR for the requested branches.`,
|
|
789
|
+
hint: "Refresh the PR state before retrying.",
|
|
790
|
+
});
|
|
791
|
+
}
|
|
792
|
+
const info = yield* editPR({
|
|
793
|
+
pr: existing.number,
|
|
725
794
|
title: opts.title,
|
|
726
795
|
body: opts.body,
|
|
727
796
|
base: null,
|
|
728
797
|
});
|
|
798
|
+
return { ...info, updated: true };
|
|
729
799
|
}
|
|
730
800
|
|
|
731
801
|
const createArgs = [
|
|
@@ -749,32 +819,25 @@ export const createPR = Effect.fn("pr.createPR")(function* (opts: {
|
|
|
749
819
|
|
|
750
820
|
const createResult = yield* gh.runGh(createArgs);
|
|
751
821
|
|
|
752
|
-
if (opts.head === null) {
|
|
753
|
-
return yield* viewPR(null);
|
|
754
|
-
}
|
|
755
|
-
|
|
756
822
|
const urlMatch = createResult.stdout.match(/\/pull\/(\d+)/);
|
|
757
823
|
if (urlMatch?.[1]) {
|
|
758
|
-
return yield* viewPR(Number(urlMatch[1]));
|
|
824
|
+
return { ...(yield* viewPR(Number(urlMatch[1]))), updated: false };
|
|
759
825
|
}
|
|
760
826
|
|
|
761
|
-
const prs = yield* gh.runGhJson<
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
"
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
]);
|
|
771
|
-
if (prs.length > 0) {
|
|
772
|
-
return prs[0] as PRInfo;
|
|
827
|
+
const prs = yield* gh.runGhJson<Candidate[]>(lookupArgs);
|
|
828
|
+
if (
|
|
829
|
+
prs.length === 1 &&
|
|
830
|
+
prs[0]?.state === "OPEN" &&
|
|
831
|
+
prs[0].headRefName === headBranch &&
|
|
832
|
+
prs[0].baseRefName === baseBranch &&
|
|
833
|
+
prs[0].headRepositoryOwner?.login.toLowerCase() === headOwner
|
|
834
|
+
) {
|
|
835
|
+
return { ...(yield* viewPR(prs[0].number)), updated: false };
|
|
773
836
|
}
|
|
774
837
|
|
|
775
838
|
return yield* Effect.fail(
|
|
776
839
|
new GitHubCommandError({
|
|
777
|
-
command: `gh pr create --head ${
|
|
840
|
+
command: `gh pr create --head ${headBranch}`,
|
|
778
841
|
exitCode: 0,
|
|
779
842
|
stderr: "Pull request was created but could not be resolved by head branch.",
|
|
780
843
|
message: "Pull request was created but could not be resolved by head branch.",
|
|
@@ -1241,7 +1304,7 @@ export const editPR = Effect.fn("pr.editPR")(function* (opts: {
|
|
|
1241
1304
|
body: string | null;
|
|
1242
1305
|
base: string | null;
|
|
1243
1306
|
}) {
|
|
1244
|
-
if (
|
|
1307
|
+
if (opts.title === null && opts.body === null && opts.base === null) {
|
|
1245
1308
|
return yield* Effect.fail(
|
|
1246
1309
|
new GitHubCommandError({
|
|
1247
1310
|
command: "pr edit",
|
|
@@ -1262,10 +1325,8 @@ export const editPR = Effect.fn("pr.editPR")(function* (opts: {
|
|
|
1262
1325
|
// GitHub rejects a base change on a stacked PR with a bare 422. Say what the state is and
|
|
1263
1326
|
// which operation changes it, rather than letting the validation error through.
|
|
1264
1327
|
if (opts.base !== null) {
|
|
1265
|
-
const stackView = yield* readStack({ pr: opts.pr })
|
|
1266
|
-
|
|
1267
|
-
);
|
|
1268
|
-
if (stackView?.isStacked === true) {
|
|
1328
|
+
const stackView = yield* readStack({ pr: opts.pr });
|
|
1329
|
+
if (stackView.isStacked === true) {
|
|
1269
1330
|
return yield* new GitHubCommandError({
|
|
1270
1331
|
command: "pr edit --base",
|
|
1271
1332
|
exitCode: 1,
|
|
@@ -1284,13 +1345,13 @@ export const editPR = Effect.fn("pr.editPR")(function* (opts: {
|
|
|
1284
1345
|
`repos/${repo.owner}/${repo.name}/pulls/${opts.pr}`,
|
|
1285
1346
|
];
|
|
1286
1347
|
|
|
1287
|
-
if (opts.title) {
|
|
1348
|
+
if (opts.title !== null) {
|
|
1288
1349
|
editArgs.push("-f", `title=${opts.title}`);
|
|
1289
1350
|
}
|
|
1290
|
-
if (opts.body) {
|
|
1351
|
+
if (opts.body !== null) {
|
|
1291
1352
|
editArgs.push("-f", `body=${opts.body}`);
|
|
1292
1353
|
}
|
|
1293
|
-
if (opts.base) {
|
|
1354
|
+
if (opts.base !== null) {
|
|
1294
1355
|
editArgs.push("-f", `base=${opts.base}`);
|
|
1295
1356
|
}
|
|
1296
1357
|
|
package/src/gh-tool/workflow.ts
CHANGED
|
@@ -154,7 +154,7 @@ const fetchLogs = Effect.fn("workflow.fetchLogs")(function* (
|
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
if (jobId !== null) {
|
|
157
|
-
args.push("--log", "--job", String(jobId));
|
|
157
|
+
args.push(failedOnly ? "--log-failed" : "--log", "--job", String(jobId));
|
|
158
158
|
} else if (failedOnly) {
|
|
159
159
|
args.push("--log-failed");
|
|
160
160
|
} else {
|
|
@@ -459,12 +459,13 @@ export function parseRawJobLogs(raw: string): LogEntry[] {
|
|
|
459
459
|
let currentStep = "(unknown)";
|
|
460
460
|
|
|
461
461
|
for (const rawLine of raw.split("\n")) {
|
|
462
|
-
const
|
|
462
|
+
const cliLine = rawLine.match(/^[^\t]+\t([^\t]+)\t(\uFEFF?\d{4}-\d{2}-\d{2}T[\d:.]+Z\s?.*)$/);
|
|
463
|
+
const line = (cliLine?.[2] ?? rawLine).replace(/^\uFEFF/, "").replace(/\r$/, "");
|
|
463
464
|
|
|
464
465
|
// Step group markers
|
|
465
466
|
const groupMatch = line.match(/##\[group\](.+)/);
|
|
466
467
|
if (groupMatch) {
|
|
467
|
-
currentStep = groupMatch[1].trim();
|
|
468
|
+
if (!cliLine) currentStep = groupMatch[1].trim();
|
|
468
469
|
continue;
|
|
469
470
|
}
|
|
470
471
|
if (line.includes("##[endgroup]")) continue;
|
|
@@ -472,7 +473,7 @@ export function parseRawJobLogs(raw: string): LogEntry[] {
|
|
|
472
473
|
const cleaned = cleanLogLine(line);
|
|
473
474
|
if (cleaned.length === 0) continue;
|
|
474
475
|
|
|
475
|
-
entries.push({ step: currentStep, message: cleaned });
|
|
476
|
+
entries.push({ step: cliLine?.[1] ?? currentStep, message: cleaned });
|
|
476
477
|
}
|
|
477
478
|
|
|
478
479
|
return entries;
|
|
@@ -512,7 +513,9 @@ export const diagnoseLogEntries = (entries: readonly LogEntry[]): LogDiagnosis =
|
|
|
512
513
|
const text = lines.join("\n");
|
|
513
514
|
const find = (pattern: RegExp) => lines.find((line) => pattern.test(line)) ?? null;
|
|
514
515
|
const testsStarted =
|
|
515
|
-
/\b(vitest|jest|pytest|go test|cargo test|test suites?|tests? (?:run|failed))\b/i.test(
|
|
516
|
+
/\b(vitest|jest|pytest|tunit|go test|cargo test|test suites?|tests? (?:run|failed)|running tests?)\b/i.test(
|
|
517
|
+
text,
|
|
518
|
+
)
|
|
516
519
|
? true
|
|
517
520
|
: /\b(install|checkout|restore|setup)\b/i.test(text)
|
|
518
521
|
? false
|
|
@@ -526,6 +529,7 @@ export const diagnoseLogEntries = (entries: readonly LogEntry[]): LogDiagnosis =
|
|
|
526
529
|
"network",
|
|
527
530
|
/econnreset|enotfound|network.*(?:error|timeout)|connection (?:reset|refused)|could not resolve host/i,
|
|
528
531
|
],
|
|
532
|
+
["test_failure", /\[Test Failure\]|Assertion(?:Error|Exception)/i],
|
|
529
533
|
["timeout", /timed? ?out|deadline exceeded/i],
|
|
530
534
|
["lint_failure", /\b(?:eslint|oxlint|lint)\b.*(?:error|failed)|lint failed/i],
|
|
531
535
|
["build_failure", /\b(?:build|compile|typescript)\b.*(?:error|failed)|compilation failed/i],
|
|
@@ -604,7 +608,8 @@ const filterFailedStepEntries = Effect.fn("workflow.filterFailedStepEntries")(fu
|
|
|
604
608
|
|
|
605
609
|
if (failedStepNames.size === 0) return entries;
|
|
606
610
|
|
|
607
|
-
|
|
611
|
+
const filtered = entries.filter((e) => failedStepNames.has(e.step));
|
|
612
|
+
return filtered.length > 0 ? filtered : entries;
|
|
608
613
|
});
|
|
609
614
|
|
|
610
615
|
export const fetchJobLogs = Effect.fn("workflow.fetchJobLogs")(function* (opts: {
|
|
@@ -641,23 +646,28 @@ export const fetchJobLogs = Effect.fn("workflow.fetchJobLogs")(function* (opts:
|
|
|
641
646
|
|
|
642
647
|
const jobId = opts.jobId ?? (yield* resolveJobId(opts.runId, opts.job, opts.repo));
|
|
643
648
|
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
649
|
+
const apiLogs = Effect.suspend(() =>
|
|
650
|
+
gh
|
|
651
|
+
.runGh(["api", `repos/${owner}/${repoName}/actions/jobs/${jobId}/logs`])
|
|
652
|
+
.pipe(Effect.map((r) => r.stdout)),
|
|
653
|
+
);
|
|
654
|
+
const cliLogs = fetchLogs(opts.runId, opts.failedStepsOnly, jobId, opts.repo).pipe(
|
|
655
|
+
Effect.map((r) => r.log),
|
|
656
|
+
);
|
|
657
|
+
const raw = opts.failedStepsOnly
|
|
658
|
+
? yield* cliLogs.pipe(
|
|
659
|
+
Effect.flatMap((log) => (log.trim() ? Effect.succeed(log) : apiLogs)),
|
|
660
|
+
Effect.catchTag("GitHubCommandError", () => apiLogs),
|
|
661
|
+
)
|
|
662
|
+
: yield* apiLogs.pipe(Effect.catchTag("GitHubCommandError", () => cliLogs));
|
|
654
663
|
|
|
655
664
|
let entries = parseRawJobLogs(raw);
|
|
656
665
|
|
|
657
666
|
if (opts.failedStepsOnly) {
|
|
658
667
|
if (Array.isArray(opts.failedStepNames) && opts.failedStepNames.length > 0) {
|
|
659
668
|
const wanted = new Set(opts.failedStepNames);
|
|
660
|
-
|
|
669
|
+
const filtered = entries.filter((e) => wanted.has(e.step));
|
|
670
|
+
if (filtered.length > 0) entries = filtered;
|
|
661
671
|
} else {
|
|
662
672
|
entries = yield* filterFailedStepEntries(opts.runId, jobId, entries, opts.repo);
|
|
663
673
|
}
|