@kana-ai/edgar-ext-github 0.1.2 → 0.1.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/README.md +130 -74
- package/dist/src/api/app.d.ts +25 -6
- package/dist/src/api/app.js +72 -9
- package/dist/src/api/client.d.ts +9 -6
- package/dist/src/api/client.js +58 -19
- package/dist/src/api/commits.d.ts +4 -0
- package/dist/src/api/commits.js +69 -0
- package/dist/src/api/failures.d.ts +4 -0
- package/dist/src/api/failures.js +14 -1
- package/dist/src/feed/alerts.d.ts +9 -3
- package/dist/src/feed/alerts.js +66 -6
- package/dist/src/feed/service.d.ts +10 -1
- package/dist/src/feed/service.js +79 -16
- package/dist/src/index.d.ts +97 -1
- package/dist/src/index.js +17 -4
- package/dist/src/schemas/config.d.ts +1 -0
- package/dist/src/schemas/config.js +73 -29
- package/dist/src/schemas/github.d.ts +121 -1
- package/dist/src/schemas/github.js +37 -2
- package/dist/src/schemas/tools.d.ts +159 -2
- package/dist/src/schemas/tools.js +129 -6
- package/dist/src/tools/alerts.js +1 -0
- package/dist/src/tools/branch.d.ts +12 -0
- package/dist/src/tools/branch.js +69 -1
- package/dist/src/tools/pull-request.d.ts +55 -7
- package/dist/src/tools/pull-request.js +131 -42
- package/dist/src/tools/revert.d.ts +27 -0
- package/dist/src/tools/revert.js +98 -0
- package/dist/src/tools/screenshot.d.ts +1 -1
- package/dist/src/tools/screenshot.js +25 -11
- package/dist/src/tracker/cards.d.ts +1 -1
- package/dist/src/tracker/cards.js +84 -8
- package/dist/src/tracker/comments.d.ts +14 -2
- package/dist/src/tracker/comments.js +100 -4
- package/dist/src/tracker/port.d.ts +1 -1
- package/dist/src/tracker/port.js +4 -6
- package/dist/src/tracker/read-link.d.ts +2 -0
- package/dist/src/tracker/read-link.js +23 -0
- package/dist/src/tracker/states.d.ts +14 -3
- package/dist/src/tracker/states.js +37 -6
- package/dist/src/tracker/tools.d.ts +27 -0
- package/dist/src/tracker/tools.js +63 -7
- package/dist/src/tracker/transitions.d.ts +14 -3
- package/dist/src/tracker/transitions.js +57 -10
- package/edgar-extension.json +121 -7
- package/package.json +3 -3
- package/schemas/attach_screenshot.in.json +19 -0
- package/schemas/config.json +49 -23
- package/schemas/create_card.in.json +4 -0
- package/schemas/delete_closed_branches.in.json +26 -0
- package/schemas/delete_closed_branches.out.json +22 -0
- package/schemas/find_revert_pull_request.in.json +21 -0
- package/schemas/find_revert_pull_request.out.json +14 -0
- package/schemas/list_pull_requests.out.json +5 -1
- package/schemas/mark_seen.in.json +11 -0
- package/schemas/mark_seen.out.json +10 -0
- package/schemas/merged_pull_request.in.json +17 -0
- package/schemas/merged_pull_request.out.json +18 -0
- package/schemas/open_pull_request.in.json +73 -1
- package/schemas/park.in.json +15 -0
- package/schemas/park.out.json +10 -0
- package/schemas/pull_request_state.out.json +10 -1
- package/schemas/release_follow_ups.in.json +5 -0
- package/schemas/retitle.in.json +16 -0
- package/schemas/retitle.out.json +13 -0
- package/schemas/revert_pull_request.in.json +11 -0
- package/schemas/revert_pull_request.out.json +14 -0
- package/schemas/set_priority.in.json +16 -0
- package/schemas/set_priority.out.json +10 -0
- package/schemas/update_pull_request.in.json +28 -1
- package/schemas/wait_for_review.out.json +10 -1
|
@@ -29,10 +29,19 @@ export const openPullRequest = {
|
|
|
29
29
|
input: z.object({
|
|
30
30
|
repo: z.string().min(1),
|
|
31
31
|
branch: z.string().min(1),
|
|
32
|
+
base: z
|
|
33
|
+
.string()
|
|
34
|
+
.min(1)
|
|
35
|
+
.optional()
|
|
36
|
+
.describe("the branch the pull request merges into, the service's default_branch; the default is default_base"),
|
|
32
37
|
title: z.string().min(1),
|
|
33
38
|
body: z.string(),
|
|
34
39
|
review: z.string(),
|
|
35
40
|
labels: z.array(z.string().min(1)).optional().describe("labels the pull request gets"),
|
|
41
|
+
card: z
|
|
42
|
+
.looseObject({ id: z.string().min(1), title: z.string().min(1), url: z.string().optional() })
|
|
43
|
+
.optional()
|
|
44
|
+
.describe("the run's card: the title becomes `<id>: <title>`, and the body opens with its link"),
|
|
36
45
|
large_diff_lines: z
|
|
37
46
|
.number()
|
|
38
47
|
.int()
|
|
@@ -45,14 +54,34 @@ export const openPullRequest = {
|
|
|
45
54
|
.describe("a line the body carries when the change touches a file under prefix"),
|
|
46
55
|
checks: z
|
|
47
56
|
.object({
|
|
48
|
-
results: z.array(z.object({
|
|
57
|
+
results: z.array(z.object({
|
|
58
|
+
check: z.string().min(1),
|
|
59
|
+
exit_code: z.number().int().nullable(),
|
|
60
|
+
pre_existing: z.boolean().optional(),
|
|
61
|
+
runs: z.number().int().positive().optional(),
|
|
62
|
+
})),
|
|
49
63
|
})
|
|
50
64
|
.optional()
|
|
51
|
-
.describe("the output of a check stage: the body lists each check that passed under Verified, and each other check under Not verified"),
|
|
65
|
+
.describe("the output of a check stage: the body lists each check that passed under Verified, saying when it passed only on its second run, and each other check under Not verified, with a failure that the check gave on the base commit too named as one the change did not cause"),
|
|
52
66
|
not_verified: z
|
|
53
67
|
.array(z.string())
|
|
54
68
|
.optional()
|
|
55
69
|
.describe("what the author of the change did not check, one line each, under Not verified"),
|
|
70
|
+
proof: z
|
|
71
|
+
.object({
|
|
72
|
+
outcome: z.enum(["passed", "failed", "not_run"]),
|
|
73
|
+
command: z.string(),
|
|
74
|
+
exit_code: z.number().int().nullable().optional(),
|
|
75
|
+
output_tail: z.string().optional(),
|
|
76
|
+
reason: z.string().optional(),
|
|
77
|
+
on_base: z.enum(["failed", "passed", "unknown"]).optional(),
|
|
78
|
+
})
|
|
79
|
+
.optional()
|
|
80
|
+
.describe('the output of a `check = "proof"` stage: the body says how the change\'s own proof ended, whether it failed on the base commit, and the end of its output, as advice that blocks nothing'),
|
|
81
|
+
proof_passes: z
|
|
82
|
+
.string()
|
|
83
|
+
.optional()
|
|
84
|
+
.describe("what the author of the change said passing looks like, beside its proof"),
|
|
56
85
|
related: z
|
|
57
86
|
.union([httpsUrl, z.array(httpsUrl).max(5)])
|
|
58
87
|
.optional()
|
|
@@ -70,11 +99,17 @@ export const notePullRequest = {
|
|
|
70
99
|
input: byUrl.extend({ text: z.string().min(1) }),
|
|
71
100
|
output: z.object({ url: z.string() }),
|
|
72
101
|
};
|
|
73
|
-
/** The input and output of `attach_screenshot`: `shot` is the output of a stage that took a picture, a PNG of the sandbox with what it shows, or why there is none. */
|
|
102
|
+
/** The input and output of `attach_screenshot`: `shot` is the output of a stage that took a picture, a PNG of the sandbox with what it shows, the `url` EDGAR serves it at when it is in the project's storage and the `video` of a recorded flow, or why there is none. */
|
|
74
103
|
export const attachScreenshot = {
|
|
75
104
|
input: byUrl.extend({
|
|
76
105
|
shot: z.union([
|
|
77
|
-
z.object({
|
|
106
|
+
z.object({
|
|
107
|
+
path: z.string().min(1),
|
|
108
|
+
bytes: z.int().min(0),
|
|
109
|
+
caption: z.string().min(1),
|
|
110
|
+
url: z.url({ protocol: /^https$/ }).optional(),
|
|
111
|
+
video: z.object({ path: z.string().min(1), bytes: z.int().min(0) }).optional(),
|
|
112
|
+
}),
|
|
78
113
|
z.object({ missing: z.string().min(1) }),
|
|
79
114
|
]),
|
|
80
115
|
}),
|
|
@@ -88,6 +123,7 @@ export const updatePullRequest = {
|
|
|
88
123
|
input: byUrl.extend(openPullRequest.input.pick({
|
|
89
124
|
title: true,
|
|
90
125
|
body: true,
|
|
126
|
+
card: true,
|
|
91
127
|
large_diff_lines: true,
|
|
92
128
|
path_notices: true,
|
|
93
129
|
checks: true,
|
|
@@ -140,6 +176,24 @@ export const listPullRequests = {
|
|
|
140
176
|
.array(z.object({ url: z.string(), state: z.enum(["open", "closed"]) }))
|
|
141
177
|
.describe("with merged_within_hours, the pull requests of its `Goes with:` line that are not merged; empty otherwise"),
|
|
142
178
|
})),
|
|
179
|
+
complete: z
|
|
180
|
+
.boolean()
|
|
181
|
+
.describe("false when a repository's list came back a full page of 100, so one past them is not listed"),
|
|
182
|
+
}),
|
|
183
|
+
};
|
|
184
|
+
/** The input and output of `delete_closed_branches`: each edgar/ branch of a closed pull request that it deleted. */
|
|
185
|
+
export const deleteClosedBranches = {
|
|
186
|
+
input: z.object({
|
|
187
|
+
services: listPullRequests.input.shape.services,
|
|
188
|
+
closed_within_hours: z
|
|
189
|
+
.number()
|
|
190
|
+
.int()
|
|
191
|
+
.min(1)
|
|
192
|
+
.max(720)
|
|
193
|
+
.describe("the pull requests closed, merged or not, within this many hours"),
|
|
194
|
+
}),
|
|
195
|
+
output: z.object({
|
|
196
|
+
deleted: z.array(z.object({ pull_request: z.string(), branch: z.string() })),
|
|
143
197
|
}),
|
|
144
198
|
};
|
|
145
199
|
/** The input and output of `wait_for_merge`. */
|
|
@@ -169,6 +223,14 @@ export const pullRequestState = {
|
|
|
169
223
|
.string()
|
|
170
224
|
.nullable()
|
|
171
225
|
.describe("the repository of the head branch as owner/name, a fork's for a fork; null when it was deleted"),
|
|
226
|
+
mergeable: z
|
|
227
|
+
.boolean()
|
|
228
|
+
.nullable()
|
|
229
|
+
.describe("false when the open pull request conflicts with its base branch; null while GitHub computes it, and once it is merged or closed"),
|
|
230
|
+
base_commit: z
|
|
231
|
+
.string()
|
|
232
|
+
.optional()
|
|
233
|
+
.describe("with mergeable false: the newest commit of the base branch, to merge into the head"),
|
|
172
234
|
}),
|
|
173
235
|
};
|
|
174
236
|
/** The input and output of `merge_pull_request`. */
|
|
@@ -378,9 +440,22 @@ export const createCardTool = {
|
|
|
378
440
|
input: z.object({ spec: cardSpec, parent: z.string().min(1).exactOptional() }),
|
|
379
441
|
output: z.object({ id: z.string(), url: z.string() }),
|
|
380
442
|
};
|
|
381
|
-
/** The input and output of `
|
|
443
|
+
/** The input and output of `park`. */
|
|
444
|
+
export const parkTool = {
|
|
445
|
+
input: z.object({ card: z.string().min(1), waits_for: z.string().min(1) }),
|
|
446
|
+
output: z.object({ id: z.string() }),
|
|
447
|
+
};
|
|
448
|
+
/** Where `release_follow_ups` moves the cards that wait for a card. */
|
|
449
|
+
export const followUpColumn = z.enum(["ready", "waiting_on_person"]);
|
|
450
|
+
/** The input and output of `release_follow_ups`. A close with no merge holds the waiting cards for a person, as a merge releases them. */
|
|
382
451
|
export const releaseFollowUpsTool = {
|
|
383
|
-
input: z.object({
|
|
452
|
+
input: z.object({
|
|
453
|
+
card: z.string().min(1),
|
|
454
|
+
pull_request: z.string().min(1),
|
|
455
|
+
column: followUpColumn
|
|
456
|
+
.exactOptional()
|
|
457
|
+
.describe("where the waiting cards move: ready, the default, after a merge; waiting_on_person after a close with no merge"),
|
|
458
|
+
}),
|
|
384
459
|
output: z.object({ released: z.array(z.string()) }),
|
|
385
460
|
};
|
|
386
461
|
/** The input and output of `find_cards`. */
|
|
@@ -440,6 +515,16 @@ export const batchCardsTool = {
|
|
|
440
515
|
.describe("the ids of `only` that are not open cards of the batch; absent when none is"),
|
|
441
516
|
}),
|
|
442
517
|
};
|
|
518
|
+
/** The input and output of `set_priority`. */
|
|
519
|
+
export const setPriorityTool = {
|
|
520
|
+
input: z.object({
|
|
521
|
+
card: z.string().min(1),
|
|
522
|
+
priority: z
|
|
523
|
+
.enum(["urgent", "high", "medium", "low"])
|
|
524
|
+
.describe("the priority from EDGAR's analysis; a card that has one already keeps it"),
|
|
525
|
+
}),
|
|
526
|
+
output: z.object({ id: z.string() }),
|
|
527
|
+
};
|
|
443
528
|
/** The input and output of `count_sighting`. */
|
|
444
529
|
export const countSightingTool = {
|
|
445
530
|
input: z.object({
|
|
@@ -499,3 +584,41 @@ export const handBackTool = {
|
|
|
499
584
|
.describe("the login the card was assigned to before, or an empty text for nobody"),
|
|
500
585
|
}),
|
|
501
586
|
};
|
|
587
|
+
/** The input and output of `retitle`. */
|
|
588
|
+
export const retitleTool = {
|
|
589
|
+
input: z.object({
|
|
590
|
+
card: z.string().min(1),
|
|
591
|
+
text: z
|
|
592
|
+
.string()
|
|
593
|
+
.min(1)
|
|
594
|
+
.describe("a stage's summary of the card; its first sentence becomes the title"),
|
|
595
|
+
}),
|
|
596
|
+
output: z.object({ id: z.string(), title: z.string() }),
|
|
597
|
+
};
|
|
598
|
+
/** The input and output of `merged_pull_request`: the newest merged pull request of a card's edgar/ branch. */
|
|
599
|
+
export const mergedPullRequest = {
|
|
600
|
+
input: z.object({
|
|
601
|
+
repo: z.string().min(1).describe("the repository of the card's service"),
|
|
602
|
+
card: z.string().min(1).describe("the card's id, as its edgar/<card>- branch names it"),
|
|
603
|
+
}),
|
|
604
|
+
output: z.object({
|
|
605
|
+
url: z.string(),
|
|
606
|
+
merged_at: z.string().describe("when it merged, as GitHub gives it"),
|
|
607
|
+
commit: z.string().describe("the merge commit"),
|
|
608
|
+
}),
|
|
609
|
+
};
|
|
610
|
+
/** The input and output of `revert_pull_request`: the pull request that reverts a merged one. */
|
|
611
|
+
export const revertPullRequest = {
|
|
612
|
+
input: byUrl,
|
|
613
|
+
output: z.object({ url: z.string(), state }),
|
|
614
|
+
};
|
|
615
|
+
/** The input and output of `find_revert_pull_request`, the lookup of `revert_pull_request`. */
|
|
616
|
+
export const findRevertPullRequest = {
|
|
617
|
+
input: z.object({ operation_id: z.string().min(1), input: byUrl }),
|
|
618
|
+
output: z.object({ url: z.string(), state }),
|
|
619
|
+
};
|
|
620
|
+
/** The input and output of `mark_seen`. */
|
|
621
|
+
export const markSeenTool = {
|
|
622
|
+
input: z.object({ card: z.string().min(1) }),
|
|
623
|
+
output: z.object({ id: z.string() }),
|
|
624
|
+
};
|
package/dist/src/tools/alerts.js
CHANGED
|
@@ -33,6 +33,7 @@ export const alertTools = {
|
|
|
33
33
|
* shortcut: a person who dismissed with the same reason and the same comment is read as this call, so the undo opens that alert again; upgrade when GitHub's answer says which call dismissed it.
|
|
34
34
|
*/
|
|
35
35
|
dismiss_dependabot_alert: defineTool({
|
|
36
|
+
publishes: true,
|
|
36
37
|
description: "Dismiss a Dependabot alert of a repository with one of GitHub's reasons and a comment; every call needs a person's approval",
|
|
37
38
|
input: dismissDependabotAlert.input,
|
|
38
39
|
output: dismissDependabotAlert.output,
|
|
@@ -7,3 +7,15 @@ export declare const pushBranch: import("@kana-ai/edgar-sdk").Tool<{
|
|
|
7
7
|
branch: string;
|
|
8
8
|
commit: string;
|
|
9
9
|
}, never>;
|
|
10
|
+
/** Only a branch that still exists is deleted, so a repository that deletes head branches on merge leaves those to GitHub, and a sweep that runs again sends no second delete; a delete answered 404 or 422 found the branch gone already. A branch of another repository, such as a fork, a branch with no card, such as edgar/screenshots, and a branch that is its pull request's base are never deleted. shortcut: one page of 100 closed pull requests per repository, as `list_pull_requests` reads; upgrade to `Link` pagination when a repository closes more within the window. */
|
|
11
|
+
export declare const deleteClosedBranches: import("@kana-ai/edgar-sdk").Tool<{
|
|
12
|
+
services: {
|
|
13
|
+
repo: string;
|
|
14
|
+
}[];
|
|
15
|
+
closed_within_hours: number;
|
|
16
|
+
}, {
|
|
17
|
+
deleted: {
|
|
18
|
+
pull_request: string;
|
|
19
|
+
branch: string;
|
|
20
|
+
}[];
|
|
21
|
+
}, "GITHUB_TOKEN">;
|
package/dist/src/tools/branch.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { defineTool, done, err, ok, permanentFailure, portFailure, } from "@kana-ai/edgar-sdk";
|
|
2
|
-
import {
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { apiAccess, github } from "#api/client";
|
|
4
|
+
import { closedPull, gitRef, pull } from "#schemas/github";
|
|
5
|
+
import { deleteClosedBranches as deleteSchema, pushBranch as schema } from "#schemas/tools";
|
|
6
|
+
import { cardOf, headOf, repoPath } from "#tools/pull-request";
|
|
3
7
|
function pushable(branch) {
|
|
4
8
|
return /^edgar\/[\w.-]+(?:\/[\w.-]+)*$/.test(branch) && !branch.includes("..");
|
|
5
9
|
}
|
|
@@ -46,3 +50,67 @@ export const pushBranch = defineTool({
|
|
|
46
50
|
return done({ branch: target, commit: commit.value });
|
|
47
51
|
},
|
|
48
52
|
});
|
|
53
|
+
/** The edgar/ branches of `repo` whose pull request closed at or after `since`, deleted once no open pull request uses them. */
|
|
54
|
+
async function deleteClosed(ctx, repo, since) {
|
|
55
|
+
const listed = await github(ctx, "GET", `/repos/${repo}/pulls?state=closed&sort=updated&direction=desc&per_page=100`, z.array(closedPull));
|
|
56
|
+
if (!listed.ok)
|
|
57
|
+
return listed;
|
|
58
|
+
const closed = new Map();
|
|
59
|
+
for (const p of listed.value) {
|
|
60
|
+
const branch = p.head.ref;
|
|
61
|
+
const own = p.head.repo?.full_name.toLowerCase() === repo;
|
|
62
|
+
const recent = p.closed_at !== null && Date.parse(p.closed_at) >= since;
|
|
63
|
+
if (own && recent && cardOf(branch) !== null && branch !== p.base.ref && !closed.has(branch))
|
|
64
|
+
closed.set(branch, p.html_url);
|
|
65
|
+
}
|
|
66
|
+
if (closed.size === 0)
|
|
67
|
+
return ok([]);
|
|
68
|
+
const refs = await github(ctx, "GET", `/repos/${repo}/git/matching-refs/heads/edgar`, z.array(gitRef));
|
|
69
|
+
if (!refs.ok)
|
|
70
|
+
return refs;
|
|
71
|
+
const existing = new Set(refs.value.map(({ ref }) => ref.replace(/^refs\/heads\//, "")));
|
|
72
|
+
const deleted = [];
|
|
73
|
+
for (const [branch, url] of closed) {
|
|
74
|
+
if (!existing.has(branch))
|
|
75
|
+
continue;
|
|
76
|
+
const open = await github(ctx, "GET", `/repos/${repo}/pulls?state=open&head=${headOf(repo, branch)}`, z.array(pull));
|
|
77
|
+
if (!open.ok)
|
|
78
|
+
return open;
|
|
79
|
+
if (open.value.length > 0)
|
|
80
|
+
continue;
|
|
81
|
+
const ref = branch.split("/").map(encodeURIComponent).join("/");
|
|
82
|
+
const gone = await github(ctx, "DELETE", `/repos/${repo}/git/refs/heads/${ref}`, z.null());
|
|
83
|
+
if (gone.ok) {
|
|
84
|
+
deleted.push({ pull_request: url, branch });
|
|
85
|
+
}
|
|
86
|
+
else if (gone.error.kind === "not_found" || gone.error.kind === "invalid") {
|
|
87
|
+
ctx.log(`${branch} of ${repo} is not deleted: ${gone.error.message}`);
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
return gone;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return ok(deleted);
|
|
94
|
+
}
|
|
95
|
+
/** Only a branch that still exists is deleted, so a repository that deletes head branches on merge leaves those to GitHub, and a sweep that runs again sends no second delete; a delete answered 404 or 422 found the branch gone already. A branch of another repository, such as a fork, a branch with no card, such as edgar/screenshots, and a branch that is its pull request's base are never deleted. shortcut: one page of 100 closed pull requests per repository, as `list_pull_requests` reads; upgrade to `Link` pagination when a repository closes more within the window. */
|
|
96
|
+
export const deleteClosedBranches = defineTool({
|
|
97
|
+
description: "Delete the edgar/ branch of each pull request of each service's repository on github.com that closed, merged or not, within closed_within_hours, once no open pull request uses it",
|
|
98
|
+
input: deleteSchema.input,
|
|
99
|
+
output: deleteSchema.output,
|
|
100
|
+
...apiAccess,
|
|
101
|
+
side_effect: true,
|
|
102
|
+
undo: "none",
|
|
103
|
+
undo_reason: "A deleted branch belongs to a pull request that is already closed, and its commits stay reachable from that pull request.",
|
|
104
|
+
execute: async ({ services, closed_within_hours }, ctx) => {
|
|
105
|
+
const since = Date.now() - closed_within_hours * 3_600_000;
|
|
106
|
+
const repos = new Set(services.flatMap(({ repo }) => repoPath(repo) ?? []));
|
|
107
|
+
const deleted = [];
|
|
108
|
+
for (const repo of repos) {
|
|
109
|
+
const swept = await deleteClosed(ctx, repo, since);
|
|
110
|
+
if (!swept.ok)
|
|
111
|
+
return swept.error;
|
|
112
|
+
deleted.push(...swept.value);
|
|
113
|
+
}
|
|
114
|
+
return done({ deleted });
|
|
115
|
+
},
|
|
116
|
+
});
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { type Reply } from "#api/client";
|
|
3
|
-
import { review } from "#schemas/github";
|
|
4
|
-
import { openPullRequest, type reviewStates } from "#schemas/tools";
|
|
3
|
+
import { pull, review } from "#schemas/github";
|
|
4
|
+
import { openPullRequest, type reviewStates, type state } from "#schemas/tools";
|
|
5
|
+
type Card = NonNullable<z.infer<typeof openPullRequest.input>["card"]>;
|
|
6
|
+
/** A pull request's state, `merged` once it merged. */
|
|
7
|
+
export declare function stateOf(value: z.infer<typeof pull>): z.infer<typeof state>;
|
|
5
8
|
/** `owner/name` in lower case from `owner/name`, an SSH remote or an HTTPS URL of github.com: GitHub names are not case-sensitive, so one repository has one name in every key. */
|
|
6
9
|
export declare function repoPath(repo: string): string | undefined;
|
|
7
10
|
/** The API path of a pull request from its `https://github.com/<owner>/<name>/pull/<n>` URL. */
|
|
@@ -14,6 +17,8 @@ export declare function reviewState(reviews: readonly z.infer<typeof review>[],
|
|
|
14
17
|
export declare function repoOf(repo: string): Reply<string>;
|
|
15
18
|
/** The API path of a pull request URL, or `invalid_input`. */
|
|
16
19
|
export declare function pullOf(url: string): Reply<string>;
|
|
20
|
+
/** The `head` query value of `branch` in `repo`, as `owner:branch`, encoded. */
|
|
21
|
+
export declare function headOf(repo: string, branch: string): string;
|
|
17
22
|
/** The large change line past `largeLines` changed lines, then each path notice whose prefix a file is under, once each. */
|
|
18
23
|
export declare function changeNotices(files: readonly {
|
|
19
24
|
readonly filename: string;
|
|
@@ -22,18 +27,31 @@ export declare function changeNotices(files: readonly {
|
|
|
22
27
|
readonly prefix: string;
|
|
23
28
|
readonly notice: string;
|
|
24
29
|
}[]): string[];
|
|
25
|
-
/**
|
|
30
|
+
/** A pull request's title for its card, `<id>: <card title>`, so a reviewer sees the card at a glance; with no card, the title as written. */
|
|
31
|
+
export declare function titleOf(title: string, card: Card | undefined): string;
|
|
32
|
+
/** The first line of a body for its card: its link, or its id when the card has no address. */
|
|
33
|
+
export declare function cardLine(card: Card | undefined): string;
|
|
34
|
+
/** The proof of a change as the body shows it. "Verified" lists each check that ended with exit code 0, and says when that was only on its second run, from the check stage's own results and from no words of a model. "Not verified" lists each other check, then each thing the author did not check; a check with no exit code did not run, because a check before it failed, or did not end, and a failure that the check gave on the base commit too says that the change did not cause it. With `checks`, "Verified" is there also when it is empty, so a reader can tell that nothing passed, or that nothing ran, from a body with no proof. "Not verified" says that nothing is outstanding only when the author gave a list and it is empty. With neither input, the body has no proof. */
|
|
26
35
|
export declare function proofOf(checks: z.infer<typeof openPullRequest.input>["checks"], notVerified: readonly string[] | undefined): string[];
|
|
36
|
+
/** How the change's own proof ended, as advice that blocks nothing: the command, its outcome from the proof stage's exit code and from no words of a model, whether a proof that passed failed on the base commit, what the author said passing looks like, and the end of its output folded away. With no `proof`, the body says nothing of it. */
|
|
37
|
+
export declare function ownProofOf(proof: z.infer<typeof openPullRequest.input>["proof"], passes: string | undefined): string[];
|
|
27
38
|
/** The pull request tools of the GitHub extension, by the name the manifest gives them. */
|
|
28
39
|
export declare const pullRequestTools: {
|
|
29
|
-
/** A retry after a lost answer gets 422 for the pull request its earlier attempt opened: a 422 reads the branch's open pull request back and returns it, and stays `invalid` when there is none. */
|
|
40
|
+
/** The pull request merges into `base`, the service's own default branch, else into `default_base`. A retry after a lost answer gets 422 for the pull request its earlier attempt opened: a 422 reads the branch's open pull request back and returns it, and stays `invalid` when there is none. */
|
|
30
41
|
open_pull_request: import("@kana-ai/edgar-sdk").Tool<{
|
|
31
42
|
repo: string;
|
|
32
43
|
branch: string;
|
|
44
|
+
base?: string | undefined;
|
|
33
45
|
title: string;
|
|
34
46
|
body: string;
|
|
35
47
|
review: string;
|
|
36
48
|
labels?: string[] | undefined;
|
|
49
|
+
card?: {
|
|
50
|
+
[x: string]: unknown;
|
|
51
|
+
id: string;
|
|
52
|
+
title: string;
|
|
53
|
+
url?: string | undefined;
|
|
54
|
+
} | undefined;
|
|
37
55
|
large_diff_lines?: number | undefined;
|
|
38
56
|
path_notices?: {
|
|
39
57
|
prefix: string;
|
|
@@ -43,19 +61,36 @@ export declare const pullRequestTools: {
|
|
|
43
61
|
results: {
|
|
44
62
|
check: string;
|
|
45
63
|
exit_code: number | null;
|
|
64
|
+
pre_existing?: boolean | undefined;
|
|
65
|
+
runs?: number | undefined;
|
|
46
66
|
}[];
|
|
47
67
|
} | undefined;
|
|
48
68
|
not_verified?: string[] | undefined;
|
|
69
|
+
proof?: {
|
|
70
|
+
outcome: "failed" | "not_run" | "passed";
|
|
71
|
+
command: string;
|
|
72
|
+
exit_code?: number | null | undefined;
|
|
73
|
+
output_tail?: string | undefined;
|
|
74
|
+
reason?: string | undefined;
|
|
75
|
+
on_base?: "failed" | "passed" | "unknown" | undefined;
|
|
76
|
+
} | undefined;
|
|
77
|
+
proof_passes?: string | undefined;
|
|
49
78
|
related?: string | string[] | undefined;
|
|
50
79
|
}, {
|
|
51
80
|
url: string;
|
|
52
81
|
number: number;
|
|
53
82
|
}, "GITHUB_TOKEN">;
|
|
54
|
-
/** The review line of the first body is left out: that review read the change before this one. */
|
|
83
|
+
/** The review line of the first body is left out: that review read the change before this one. The notices compare the change with the pull request's own base. */
|
|
55
84
|
update_pull_request: import("@kana-ai/edgar-sdk").Tool<{
|
|
56
85
|
url: string;
|
|
57
86
|
title: string;
|
|
58
87
|
body: string;
|
|
88
|
+
card?: {
|
|
89
|
+
[x: string]: unknown;
|
|
90
|
+
id: string;
|
|
91
|
+
title: string;
|
|
92
|
+
url?: string | undefined;
|
|
93
|
+
} | undefined;
|
|
59
94
|
large_diff_lines?: number | undefined;
|
|
60
95
|
path_notices?: {
|
|
61
96
|
prefix: string;
|
|
@@ -65,6 +100,8 @@ export declare const pullRequestTools: {
|
|
|
65
100
|
results: {
|
|
66
101
|
check: string;
|
|
67
102
|
exit_code: number | null;
|
|
103
|
+
pre_existing?: boolean | undefined;
|
|
104
|
+
runs?: number | undefined;
|
|
68
105
|
}[];
|
|
69
106
|
} | undefined;
|
|
70
107
|
not_verified?: string[] | undefined;
|
|
@@ -78,6 +115,11 @@ export declare const pullRequestTools: {
|
|
|
78
115
|
path: string;
|
|
79
116
|
bytes: number;
|
|
80
117
|
caption: string;
|
|
118
|
+
url?: string | undefined;
|
|
119
|
+
video?: {
|
|
120
|
+
path: string;
|
|
121
|
+
bytes: number;
|
|
122
|
+
} | undefined;
|
|
81
123
|
} | {
|
|
82
124
|
missing: string;
|
|
83
125
|
};
|
|
@@ -130,7 +172,7 @@ export declare const pullRequestTools: {
|
|
|
130
172
|
url: string;
|
|
131
173
|
state: "closed" | "merged" | "open";
|
|
132
174
|
}, "GITHUB_TOKEN">;
|
|
133
|
-
/** A pull request whose head is in another repository, such as a fork, is left out: its branch name proves nothing. shortcut: one page of 100 per repository, so with `merged_within_hours` a merge past the 100 closed pull requests updated last is not read; upgrade to `Link` pagination when a repository closes more within the window. */
|
|
175
|
+
/** A pull request whose head is in another repository, such as a fork, is left out: its branch name proves nothing. shortcut: one page of 100 per repository, so with `merged_within_hours` a merge past the 100 closed pull requests updated last is not read; a full page sets `complete` to false and logs the repository; upgrade to `Link` pagination when a repository closes more within the window. */
|
|
134
176
|
list_pull_requests: import("@kana-ai/edgar-sdk").Tool<{
|
|
135
177
|
services: {
|
|
136
178
|
repo: string;
|
|
@@ -146,6 +188,7 @@ export declare const pullRequestTools: {
|
|
|
146
188
|
state: "closed" | "open";
|
|
147
189
|
}[];
|
|
148
190
|
}[];
|
|
191
|
+
complete: boolean;
|
|
149
192
|
}, "GITHUB_TOKEN">;
|
|
150
193
|
pull_request_state: import("@kana-ai/edgar-sdk").Tool<{
|
|
151
194
|
url: string;
|
|
@@ -159,8 +202,10 @@ export declare const pullRequestTools: {
|
|
|
159
202
|
commit: string;
|
|
160
203
|
branch: string;
|
|
161
204
|
head_repo: string | null;
|
|
205
|
+
mergeable: boolean | null;
|
|
206
|
+
base_commit?: string | undefined;
|
|
162
207
|
}, "GITHUB_TOKEN">;
|
|
163
|
-
/** The recheck of a `wait` stage: a recheck's `done` ends the wait, so an open pull request with no deciding review answers `skipped`. */
|
|
208
|
+
/** The recheck of a `wait` stage: a recheck's `done` ends the wait, so an open pull request with no deciding review and no conflict answers `skipped`. */
|
|
164
209
|
wait_for_review: import("@kana-ai/edgar-sdk").Tool<{
|
|
165
210
|
url: string;
|
|
166
211
|
}, {
|
|
@@ -173,6 +218,8 @@ export declare const pullRequestTools: {
|
|
|
173
218
|
commit: string;
|
|
174
219
|
branch: string;
|
|
175
220
|
head_repo: string | null;
|
|
221
|
+
mergeable: boolean | null;
|
|
222
|
+
base_commit?: string | undefined;
|
|
176
223
|
}, "GITHUB_TOKEN">;
|
|
177
224
|
/** The recheck of a `wait` stage that ends on the merge or the close of a pull request, and on nothing else, so an approval does not end it. */
|
|
178
225
|
wait_for_merge: import("@kana-ai/edgar-sdk").Tool<{
|
|
@@ -193,3 +240,4 @@ export declare const pullRequestTools: {
|
|
|
193
240
|
commit: string;
|
|
194
241
|
}, "GITHUB_TOKEN">;
|
|
195
242
|
};
|
|
243
|
+
export {};
|