@blogic-cz/agent-tools 1.6.8 → 1.6.10
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 +9 -1
- package/dist/credential-guard/index.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/credential-guard/index.ts +113 -10
- 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
|
|
@@ -648,7 +656,7 @@ That's it. The hook reads tool input from stdin, runs the guard, and exits with
|
|
|
648
656
|
|
|
649
657
|
The guard permits static `printenv` reads and simple `echo`/`printf` expansions only for exact names in `credentialGuard.allowedEnvironmentVariables`. The default list is empty. Multiple names are allowed only when each name is approved. Approved environment values may be displayed, but redirecting their pipeline or passing them to an executor stays blocked.
|
|
650
658
|
|
|
651
|
-
Python inline programs and quoted stdin heredocs can also display approved values through `os.getenv("NAME")`, `os.environ.get("NAME", "default")`, or `os.environ["NAME"]`. The complete program must
|
|
659
|
+
Python inline programs and quoted stdin heredocs can also display approved values through `os.getenv("NAME")`, `os.environ.get("NAME", "default")`, or `os.environ["NAME"]`. The complete program must import unaliased `os`, plus `json` for JSON display, followed by `print(...)` statements. `json.dumps(...)` supports dictionaries and lists of approved reads, including comprehensions over a nonempty literal list of approved names. Every dictionary key and environment read must use an approved name. Each projection has at most 16 entries; the program has at most 65,536 characters. Computed or unbounded names, aliases, escaped or interpolated strings, additional statements, and whole-environment output remain unsupported. The same redirection and pipeline restrictions apply.
|
|
652
660
|
|
|
653
661
|
Literal assignments such as `F=README.md; cat "$F"` work in supported static commands. Bounded proofs also support a literal `for` loop over a fixed list, a single ASCII-letter path binding such as `cd PATH && A=docs/report.md && shasum -a 256 "$A"` or `F=README.md; cat "$F"`, including the existing `git add -- "$T/file"` form, and literal path braces such as `rg -n -i PATTERN src/{a,b} docs/{guide,api}.md`. Path braces work with supported passive text commands and `cat`, and support one unquoted comma list per path, at most 16 members per list and 32 generated paths per command, within 64 KiB. Nested braces, ranges, empty members, mixed quoting, command positions, and compound commands remain unsupported. Path bindings accept literal values and `;`, newline, or `&&` sequencing; a binding conditional on successful `cd` is proved only for uses in that same `&&` list. Their uses must be supported read-only file operands or explicit `git add --` paths. Rebinding, executable operands, startup-variable names, and uncertain scopes cannot establish this proof. Loop binders are a single lowercase letter or `T`, and their uses must occupy supported data operands. Every body command and expanded path is checked; unsupported control flow, mutations such as `printf -v`, and unknown command roles cannot establish the proof. Other variable assignments and brace expansions retain conservative refusal. Fully quoted literal braces remain usable in static searches.
|
|
654
662
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/credential-guard/index.ts"],"names":[],"mappings":"AAAA;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AED,2CAA2C;AAC3C,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAEpE;AAED,2CAA2C;AAC3C,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAEpE;AAMD;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,CAAC,EAAE,qBAAqB,GAAG,eAAe,CA4VrF;AAQD,kEAAkE;AAClE,eAAO,MAAM,uBAAuB,UA5nGD,SAAS,UAAU,UAAU,KAAK,IA4nGM,CAAC;AAE5E,oDAAoD;AACpD,eAAO,MAAM,aAAa,YA9nGC,MAAM,KAAK;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,IA8nGjB,CAAC;AAExD,yEAAyE;AACzE,eAAO,MAAM,aAAa,aAhoGE,MAAM,KAAK,OAgoGgB,CAAC;AAExD,yDAAyD;AACzD,eAAO,MAAM,aAAa,aAloGE,MAAM,KAAK,OAkoGgB,CAAC;AAExD,oEAAoE;AACpE,eAAO,MAAM,sBAAsB,YApoGC,MAAM,KAAK,OAooG0B,CAAC;AAE1E,iDAAiD;AACjD,eAAO,MAAM,iBAAiB,YAtoGC,MAAM,KAAK;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,IAsoGf,CAAC;AAEhE,wDAAwD;AACxD,eAAO,MAAM,kBAAkB,YAxoGC,MAAM,KAAK,OAwoGsB,CAAC;AAElE,8EAA8E;AAC9E,eAAO,MAAM,kBAAkB,YA1oGC,MAAM,KAAK,MAAM,GAAG,IA0oGa,CAAC"}
|
|
@@ -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;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CAAC,CAAC;AAEhF,eAAO,MAAM,kBAAkB,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,UAC1D,CAAC,QACH,aAAa,CAAC,MAAM,CAAC;;EAW5B,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;;;oDAgCjC,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;;oDAiBsD,CAAC;AAE1F,eAAO,MAAM,0BAA0B;;;;oDAuBtC,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;;;;;;oDAgDpC,CAAC;AA2EF,eAAO,MAAM,cAAc,6HAG1B,CAAC"}
|
|
@@ -14,7 +14,6 @@ export declare 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,OA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AAA;KAAE,CAAC,CAAC;CAClF,eACY,MAAM,GAAG,IAAI,UAClB,OAAO,kBACC,MAAM;;;;;;;;;;CAiBtB,CAAC;AAmHH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAOjD;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,EAAE,CAuBvD;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,QAAQ,EAAE,GAAG,MAAM,CAa5D;AAgBD,eAAO,MAAM,kBAAkB,YAAa,SAAS,QAAQ,EAAE,KAAG,YA6CjE,CAAC;AA2DF,eAAO,MAAM,YAAY;WAChB,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
|
@@ -1608,8 +1608,10 @@ function isAllowedPythonEnvironmentRead(argv: string[], allowedNames: Set<string
|
|
|
1608
1608
|
return false;
|
|
1609
1609
|
|
|
1610
1610
|
const program = argv[index] ?? "";
|
|
1611
|
+
if (program.length > 65_536) return false;
|
|
1611
1612
|
let position = 0;
|
|
1612
1613
|
let foundRead = false;
|
|
1614
|
+
let importedJson = false;
|
|
1613
1615
|
const skipInlineWhitespace = () => {
|
|
1614
1616
|
while (/[\t ]/.test(program[position] ?? "")) position++;
|
|
1615
1617
|
};
|
|
@@ -1619,7 +1621,12 @@ function isAllowedPythonEnvironmentRead(argv: string[], allowedNames: Set<string
|
|
|
1619
1621
|
return true;
|
|
1620
1622
|
};
|
|
1621
1623
|
const takeIdentifier = (value: string): boolean => {
|
|
1622
|
-
if (
|
|
1624
|
+
if (
|
|
1625
|
+
!program.startsWith(value, position) ||
|
|
1626
|
+
/[A-Za-z0-9_]/.test(program[position + value.length] ?? "")
|
|
1627
|
+
)
|
|
1628
|
+
return false;
|
|
1629
|
+
position += value.length;
|
|
1623
1630
|
return true;
|
|
1624
1631
|
};
|
|
1625
1632
|
const takeString = (): string | undefined => {
|
|
@@ -1638,8 +1645,14 @@ function isAllowedPythonEnvironmentRead(argv: string[], allowedNames: Set<string
|
|
|
1638
1645
|
position++;
|
|
1639
1646
|
return value;
|
|
1640
1647
|
};
|
|
1641
|
-
const takeEnvironmentRead = (): boolean => {
|
|
1648
|
+
const takeEnvironmentRead = (variable?: string): boolean => {
|
|
1642
1649
|
skipInlineWhitespace();
|
|
1650
|
+
const takeName = (): boolean => {
|
|
1651
|
+
skipInlineWhitespace();
|
|
1652
|
+
if (variable !== undefined) return takeIdentifier(variable);
|
|
1653
|
+
const name = takeString();
|
|
1654
|
+
return name !== undefined && allowedNames.has(name);
|
|
1655
|
+
};
|
|
1643
1656
|
const start = position;
|
|
1644
1657
|
if (!takeIdentifier("os")) return false;
|
|
1645
1658
|
if (!take(".")) {
|
|
@@ -1648,8 +1661,7 @@ function isAllowedPythonEnvironmentRead(argv: string[], allowedNames: Set<string
|
|
|
1648
1661
|
}
|
|
1649
1662
|
if (takeIdentifier("getenv")) {
|
|
1650
1663
|
if (!take("(")) return false;
|
|
1651
|
-
|
|
1652
|
-
if (name === undefined || !allowedNames.has(name)) return false;
|
|
1664
|
+
if (!takeName()) return false;
|
|
1653
1665
|
skipInlineWhitespace();
|
|
1654
1666
|
if (take(",")) {
|
|
1655
1667
|
if (takeString() === undefined) return false;
|
|
@@ -1662,8 +1674,7 @@ function isAllowedPythonEnvironmentRead(argv: string[], allowedNames: Set<string
|
|
|
1662
1674
|
if (!takeIdentifier("environ")) return false;
|
|
1663
1675
|
if (take(".")) {
|
|
1664
1676
|
if (!takeIdentifier("get") || !take("(")) return false;
|
|
1665
|
-
|
|
1666
|
-
if (name === undefined || !allowedNames.has(name)) return false;
|
|
1677
|
+
if (!takeName()) return false;
|
|
1667
1678
|
skipInlineWhitespace();
|
|
1668
1679
|
if (take(",")) {
|
|
1669
1680
|
if (takeString() === undefined) return false;
|
|
@@ -1674,15 +1685,91 @@ function isAllowedPythonEnvironmentRead(argv: string[], allowedNames: Set<string
|
|
|
1674
1685
|
return true;
|
|
1675
1686
|
}
|
|
1676
1687
|
if (!take("[")) return false;
|
|
1677
|
-
|
|
1678
|
-
if (name === undefined || !allowedNames.has(name)) return false;
|
|
1688
|
+
if (!takeName()) return false;
|
|
1679
1689
|
skipInlineWhitespace();
|
|
1680
1690
|
if (!take("]")) return false;
|
|
1681
1691
|
foundRead = true;
|
|
1682
1692
|
return true;
|
|
1683
1693
|
};
|
|
1694
|
+
const takeApprovedNames = (): boolean => {
|
|
1695
|
+
if (!take("[")) return false;
|
|
1696
|
+
for (let count = 0; count < 16; count++) {
|
|
1697
|
+
const name = takeString();
|
|
1698
|
+
if (name === undefined || !allowedNames.has(name)) return false;
|
|
1699
|
+
skipInlineWhitespace();
|
|
1700
|
+
if (take("]")) return true;
|
|
1701
|
+
if (!take(",")) return false;
|
|
1702
|
+
skipInlineWhitespace();
|
|
1703
|
+
if (take("]")) return true;
|
|
1704
|
+
}
|
|
1705
|
+
return false;
|
|
1706
|
+
};
|
|
1707
|
+
const takeComprehension = (): boolean => {
|
|
1708
|
+
const dictionary = take("{");
|
|
1709
|
+
if (!dictionary && !take("[")) return false;
|
|
1710
|
+
skipInlineWhitespace();
|
|
1711
|
+
const variable = dictionary
|
|
1712
|
+
? /^[A-Za-z_][A-Za-z0-9_]*/.exec(program.slice(position))?.[0]
|
|
1713
|
+
: /^os\.(?:getenv\(|environ(?:\.get\(|\[))[\t ]*([A-Za-z_][A-Za-z0-9_]*)/.exec(
|
|
1714
|
+
program.slice(position),
|
|
1715
|
+
)?.[1];
|
|
1716
|
+
if (!variable || ["os", "json", "print"].includes(variable)) return false;
|
|
1717
|
+
if (dictionary) {
|
|
1718
|
+
if (!takeIdentifier(variable)) return false;
|
|
1719
|
+
skipInlineWhitespace();
|
|
1720
|
+
if (!take(":")) return false;
|
|
1721
|
+
}
|
|
1722
|
+
if (!takeEnvironmentRead(variable)) return false;
|
|
1723
|
+
const loop = new RegExp(`[\\t ]+for[\\t ]+${variable}[\\t ]+in[\\t ]+`, "y");
|
|
1724
|
+
loop.lastIndex = position;
|
|
1725
|
+
const match = loop.exec(program);
|
|
1726
|
+
if (!match) return false;
|
|
1727
|
+
position = loop.lastIndex;
|
|
1728
|
+
if (!takeApprovedNames()) return false;
|
|
1729
|
+
skipInlineWhitespace();
|
|
1730
|
+
return take(dictionary ? "}" : "]");
|
|
1731
|
+
};
|
|
1732
|
+
const takeProjection = (): boolean => {
|
|
1733
|
+
const start = position;
|
|
1734
|
+
const previousRead = foundRead;
|
|
1735
|
+
if (takeComprehension()) return true;
|
|
1736
|
+
position = start;
|
|
1737
|
+
foundRead = previousRead;
|
|
1738
|
+
const dictionary = take("{");
|
|
1739
|
+
if (!dictionary && !take("[")) return false;
|
|
1740
|
+
const close = dictionary ? "}" : "]";
|
|
1741
|
+
for (let count = 0; count < 16; count++) {
|
|
1742
|
+
if (dictionary) {
|
|
1743
|
+
const key = takeString();
|
|
1744
|
+
if (key === undefined || !allowedNames.has(key)) return false;
|
|
1745
|
+
skipInlineWhitespace();
|
|
1746
|
+
if (!take(":")) return false;
|
|
1747
|
+
}
|
|
1748
|
+
if (!takeEnvironmentRead()) return false;
|
|
1749
|
+
skipInlineWhitespace();
|
|
1750
|
+
if (take(close)) return true;
|
|
1751
|
+
if (!take(",")) return false;
|
|
1752
|
+
skipInlineWhitespace();
|
|
1753
|
+
if (take(close)) return true;
|
|
1754
|
+
}
|
|
1755
|
+
return false;
|
|
1756
|
+
};
|
|
1757
|
+
const takeJsonDisplay = (): boolean => {
|
|
1758
|
+
if (!importedJson || !takeIdentifier("json") || !take(".dumps")) return false;
|
|
1759
|
+
skipInlineWhitespace();
|
|
1760
|
+
if (!take("(")) return false;
|
|
1761
|
+
skipInlineWhitespace();
|
|
1762
|
+
if (!takeProjection()) return false;
|
|
1763
|
+
skipInlineWhitespace();
|
|
1764
|
+
return take(")");
|
|
1765
|
+
};
|
|
1684
1766
|
const takeExpression = (): boolean => {
|
|
1685
|
-
const takeTerm = (): boolean =>
|
|
1767
|
+
const takeTerm = (): boolean => {
|
|
1768
|
+
skipInlineWhitespace();
|
|
1769
|
+
return program.startsWith("json", position)
|
|
1770
|
+
? takeJsonDisplay()
|
|
1771
|
+
: takeString() !== undefined || takeEnvironmentRead();
|
|
1772
|
+
};
|
|
1686
1773
|
if (!takeTerm()) return false;
|
|
1687
1774
|
skipInlineWhitespace();
|
|
1688
1775
|
while (take("+")) {
|
|
@@ -1718,10 +1805,26 @@ function isAllowedPythonEnvironmentRead(argv: string[], allowedNames: Set<string
|
|
|
1718
1805
|
skipInlineWhitespace();
|
|
1719
1806
|
if (!takeIdentifier("import")) return false;
|
|
1720
1807
|
skipInlineWhitespace();
|
|
1721
|
-
|
|
1808
|
+
const jsonFirst = takeIdentifier("json");
|
|
1809
|
+
if (!jsonFirst && !takeIdentifier("os")) return false;
|
|
1810
|
+
importedJson = jsonFirst;
|
|
1811
|
+
skipInlineWhitespace();
|
|
1812
|
+
if (take(",")) {
|
|
1813
|
+
skipInlineWhitespace();
|
|
1814
|
+
if (!takeIdentifier(jsonFirst ? "os" : "json")) return false;
|
|
1815
|
+
importedJson = true;
|
|
1816
|
+
} else if (jsonFirst) return false;
|
|
1722
1817
|
skipInlineWhitespace();
|
|
1723
1818
|
if (!(take(";") || take("\n") || take("\r\n"))) return false;
|
|
1724
1819
|
skipSeparators();
|
|
1820
|
+
if (!importedJson && takeIdentifier("import")) {
|
|
1821
|
+
skipInlineWhitespace();
|
|
1822
|
+
if (!takeIdentifier("json")) return false;
|
|
1823
|
+
importedJson = true;
|
|
1824
|
+
skipInlineWhitespace();
|
|
1825
|
+
if (!(take(";") || take("\n") || take("\r\n"))) return false;
|
|
1826
|
+
skipSeparators();
|
|
1827
|
+
}
|
|
1725
1828
|
while (position < program.length) {
|
|
1726
1829
|
if (!takePrint()) return false;
|
|
1727
1830
|
skipInlineWhitespace();
|
|
@@ -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
|
}
|