@kana-ai/edgar-ext-github 0.1.4 → 0.1.6
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 +39 -33
- package/dist/src/index.d.ts +30 -0
- package/dist/src/index.js +2 -0
- package/dist/src/schemas/github.d.ts +53 -0
- package/dist/src/schemas/github.js +18 -0
- package/dist/src/schemas/tools.d.ts +41 -0
- package/dist/src/schemas/tools.js +59 -3
- package/dist/src/tools/branch.d.ts +2 -1
- package/dist/src/tools/branch.js +6 -9
- package/dist/src/tools/checks.js +8 -4
- package/dist/src/tools/owners.d.ts +34 -0
- package/dist/src/tools/owners.js +182 -0
- package/dist/src/tools/pull-request.d.ts +11 -2
- package/dist/src/tools/pull-request.js +87 -20
- package/dist/src/tracker/states.d.ts +1 -1
- package/dist/src/tracker/states.js +4 -1
- package/dist/src/tracker/tools.d.ts +2 -0
- package/edgar-extension.json +25 -1
- package/package.json +3 -3
- package/schemas/code_owners.in.json +11 -0
- package/schemas/code_owners.out.json +47 -0
- package/schemas/create_card.in.json +8 -0
- package/schemas/list_pull_requests.in.json +5 -0
- package/schemas/list_pull_requests.out.json +5 -0
- package/schemas/open_pull_request.in.json +18 -2
- package/schemas/open_pull_request.out.json +4 -0
- package/schemas/push_branch.in.json +5 -0
- package/schemas/request_reviewers.in.json +27 -0
- package/schemas/request_reviewers.out.json +17 -0
- package/schemas/update_pull_request.in.json +8 -2
|
@@ -153,9 +153,21 @@ export function changeNotices(files, largeLines, paths) {
|
|
|
153
153
|
.map((p) => p.notice);
|
|
154
154
|
return [...large, ...new Set(touched)];
|
|
155
155
|
}
|
|
156
|
-
/**
|
|
156
|
+
/** The longest title, so the merge commit's subject that holds it stays readable in `git log`. */
|
|
157
|
+
const TITLE_LIMIT = 72;
|
|
158
|
+
/**
|
|
159
|
+
* A pull request's title, `<id>: <title>` for its card, so a reviewer sees the card at a glance. Past 72 characters, the words before a trailing `[tag]` are cut where a word ends, and the tag stays whole: a repository can start a build from a tag in the merge commit's message, which holds the title.
|
|
160
|
+
*/
|
|
157
161
|
export function titleOf(title, card) {
|
|
158
|
-
|
|
162
|
+
const full = (card === undefined ? title : `${card.id}: ${title}`).trim().replaceAll(/\s+/g, " ");
|
|
163
|
+
if (full.length <= TITLE_LIMIT)
|
|
164
|
+
return full;
|
|
165
|
+
const tag = /(?: ?\[[^[\]]+\])+$/.exec(full)?.[0] ?? "";
|
|
166
|
+
const room = Math.max(0, TITLE_LIMIT - tag.length);
|
|
167
|
+
const words = full.slice(0, full.length - tag.length).slice(0, room + 1);
|
|
168
|
+
const end = words.lastIndexOf(" ");
|
|
169
|
+
const kept = (end > 0 ? words.slice(0, end) : words.slice(0, room)).replace(/[\s,;:-]+$/, "");
|
|
170
|
+
return kept === "" ? tag.trim() : `${kept}${tag}`;
|
|
159
171
|
}
|
|
160
172
|
/** The first line of a body for its card: its link, or its id when the card has no address. */
|
|
161
173
|
export function cardLine(card) {
|
|
@@ -173,8 +185,8 @@ export function proofOf(checks, notVerified) {
|
|
|
173
185
|
const passed = results
|
|
174
186
|
.filter((r) => r.exit_code === 0)
|
|
175
187
|
.map((r) => r.runs === 2
|
|
176
|
-
? `- ${name(r.check)} passed on its second run, after a failure`
|
|
177
|
-
: `- ${name(r.check)} passed`);
|
|
188
|
+
? `- ${name(r.check)} passed on its second run, after a failure${coverageOf(r.covered)}`
|
|
189
|
+
: `- ${name(r.check)} passed${coverageOf(r.covered)}`);
|
|
178
190
|
const open = [
|
|
179
191
|
...results
|
|
180
192
|
.filter((r) => r.exit_code !== 0)
|
|
@@ -182,7 +194,7 @@ export function proofOf(checks, notVerified) {
|
|
|
182
194
|
? `- ${name(r.check)} did not run or did not end`
|
|
183
195
|
: r.pre_existing === true
|
|
184
196
|
? `- ${name(r.check)} ended with exit code ${String(r.exit_code)}, and fails the same way on the base commit, so this change did not cause it`
|
|
185
|
-
: `- ${name(r.check)} ended with exit code ${String(r.exit_code)}`),
|
|
197
|
+
: `- ${name(r.check)} ended with exit code ${String(r.exit_code)}${coverageOf(r.covered)}`),
|
|
186
198
|
...(notVerified ?? [])
|
|
187
199
|
.map((item) => item.trim().replaceAll(/\s+/g, " "))
|
|
188
200
|
.filter((item) => item !== "")
|
|
@@ -198,6 +210,18 @@ export function proofOf(checks, notVerified) {
|
|
|
198
210
|
...(open.length === 0 ? outstanding : [section("Not verified", open.join("\n"))]),
|
|
199
211
|
];
|
|
200
212
|
}
|
|
213
|
+
/** The most changed files that one check's line names. */
|
|
214
|
+
const COVERED_SHOWN = 5;
|
|
215
|
+
/** The changed files a check covers, as the end of its line: none when the check does not say which paths it covers. */
|
|
216
|
+
function coverageOf(covered) {
|
|
217
|
+
if (covered === undefined)
|
|
218
|
+
return "";
|
|
219
|
+
if (covered.length === 0)
|
|
220
|
+
return ", but it covers none of the changed files";
|
|
221
|
+
const shown = covered.slice(0, COVERED_SHOWN).map((path) => `\`${path.replaceAll("`", "")}\``);
|
|
222
|
+
const more = covered.length - shown.length;
|
|
223
|
+
return `, covering ${shown.join(", ")}${more > 0 ? ` and ${String(more)} more` : ""}`;
|
|
224
|
+
}
|
|
201
225
|
/** A section of a body: a heading at the level that a pull request description starts its sections with, then its text. */
|
|
202
226
|
function section(heading, text) {
|
|
203
227
|
return `## ${heading}\n\n${text}`;
|
|
@@ -208,11 +232,11 @@ function fenced(text) {
|
|
|
208
232
|
const fence = "`".repeat(longest + 1);
|
|
209
233
|
return `${fence}text\n${text}\n${fence}`;
|
|
210
234
|
}
|
|
211
|
-
/** What a proof that passed says by how it ended on the base commit: only a failure there
|
|
235
|
+
/** What a proof that passed says by how it ended on the base commit: only a failure there shows the fault. */
|
|
212
236
|
const onBase = {
|
|
213
|
-
failed: "It
|
|
214
|
-
passed: "It passes on the base commit
|
|
215
|
-
unknown: "It passed, but I could not tell whether it fails on the base commit, so it does not
|
|
237
|
+
failed: "It fails on the base commit, without the change, and passes with it, so it shows the fault and the fix.",
|
|
238
|
+
passed: "It also passes on the base commit, without the change, so it does not show the fault.",
|
|
239
|
+
unknown: "It passed, but I could not tell whether it fails on the base commit, without the change, so it does not show the fault.",
|
|
216
240
|
};
|
|
217
241
|
/** 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. */
|
|
218
242
|
export function ownProofOf(proof, passes) {
|
|
@@ -252,25 +276,52 @@ async function labelled(ctx, repo, made, labels) {
|
|
|
252
276
|
if (!added.ok)
|
|
253
277
|
ctx.log(`labels not added to ${made.html_url}: ${added.error.message}`);
|
|
254
278
|
}
|
|
255
|
-
return done({ url: made.html_url, number: made.number });
|
|
279
|
+
return done({ url: made.html_url, number: made.number, commit: made.head.sha });
|
|
256
280
|
}
|
|
281
|
+
/** The line that opens the body of a companion pull request, which the fix of its card is built on. */
|
|
282
|
+
const COMPANION_LEAD = "Merge this pull request first:";
|
|
257
283
|
/** The most pull requests that one read of a list gives. */
|
|
258
284
|
const PAGE = 100;
|
|
259
285
|
/** The first line of EDGAR's note on a pull request, which GitHub does not show, and the sentence under it that leads its list. */
|
|
260
286
|
const NOTE_MARK = "<!-- edgar:note -->";
|
|
261
287
|
const NOTE_LEAD = "EDGAR's notes on this pull request, oldest first:";
|
|
262
|
-
/**
|
|
263
|
-
|
|
264
|
-
|
|
288
|
+
/** The API path of the comments of the pull request at the API `path`. */
|
|
289
|
+
function commentsOf(path) {
|
|
290
|
+
return `${path.replace("/pulls/", "/issues/")}/comments`;
|
|
291
|
+
}
|
|
292
|
+
/** `text` as one item of EDGAR's note: a bullet, with its other lines indented under it. */
|
|
293
|
+
function itemOf(text) {
|
|
265
294
|
const [first = "", ...rest] = text
|
|
266
295
|
.trim()
|
|
267
296
|
.split(/\r?\n/)
|
|
268
297
|
.map((part) => part.trimEnd());
|
|
269
|
-
|
|
298
|
+
return [`- ${first}`, ...rest.map((part) => (part === "" ? "" : ` ${part}`))].join("\n");
|
|
299
|
+
}
|
|
300
|
+
/** EDGAR's note among the comments at the API path `comments`, the one that starts with the note's mark; none when there is none. */
|
|
301
|
+
async function noteOf(ctx, comments) {
|
|
270
302
|
const read = await github(ctx, "GET", `${comments}?per_page=100`, z.array(note));
|
|
303
|
+
if (!read.ok)
|
|
304
|
+
return read;
|
|
305
|
+
return ok(read.value.find((comment) => comment.body?.startsWith(NOTE_MARK) === true));
|
|
306
|
+
}
|
|
307
|
+
/** Whether EDGAR's note on the pull request at `url` holds `text` as one of its items, anywhere in the note. */
|
|
308
|
+
async function hasNoted(ctx, url, text) {
|
|
309
|
+
const path = pullOf(url);
|
|
310
|
+
if (!path.ok)
|
|
311
|
+
return path;
|
|
312
|
+
const read = await noteOf(ctx, commentsOf(path.value));
|
|
313
|
+
if (!read.ok)
|
|
314
|
+
return read;
|
|
315
|
+
return ok(`${read.value?.body ?? ""}\n`.includes(`\n${itemOf(text)}\n`));
|
|
316
|
+
}
|
|
317
|
+
/** Adds `text` as one item of EDGAR's one note on the pull request at the API `path`: the comment that starts with the note's mark, made when there is none. The item keeps the lines of `text`, indented under its bullet, so its paragraphs and lists stay. An item that is already the last one writes nothing. */
|
|
318
|
+
async function noted(ctx, path, text) {
|
|
319
|
+
const comments = commentsOf(path);
|
|
320
|
+
const line = itemOf(text);
|
|
321
|
+
const read = await noteOf(ctx, comments);
|
|
271
322
|
if (!read.ok)
|
|
272
323
|
return read.error;
|
|
273
|
-
const kept = read.value
|
|
324
|
+
const kept = read.value;
|
|
274
325
|
if (kept === undefined) {
|
|
275
326
|
const made = await github(ctx, "POST", comments, note, {
|
|
276
327
|
body: `${NOTE_MARK}\n${NOTE_LEAD}\n\n${line}`,
|
|
@@ -308,10 +359,17 @@ export const pullRequestTools = {
|
|
|
308
359
|
return repo.error;
|
|
309
360
|
const base = input.base ?? settings.data.default_base;
|
|
310
361
|
const notes = await noticesOf(ctx, repo.value, base, input);
|
|
311
|
-
const related =
|
|
312
|
-
|
|
362
|
+
const related = [
|
|
363
|
+
...(typeof input.related === "string" ? [input.related] : (input.related ?? [])),
|
|
364
|
+
...(input.after === undefined ? [] : [input.after]),
|
|
365
|
+
];
|
|
366
|
+
const body = bodyOf(cardLine(input.card), input.body, related.length === 0 ? "" : `Goes with: ${related.join(", ")}`, input.after === undefined
|
|
367
|
+
? ""
|
|
368
|
+
: `Merge ${input.after} first. This pull request is built on it, so its checks ran with that change, and its diff shows that change until it merges.`, input.first === undefined
|
|
369
|
+
? ""
|
|
370
|
+
: `${COMPANION_LEAD} the fix of the card is built on it, and EDGAR's note below links the fix. Why the fix needs it: ${input.first}`, ...notes, ...proofOf(input.checks, input.not_verified), ...ownProofOf(input.proof, input.proof_passes), input.review.trim() === ""
|
|
313
371
|
? ""
|
|
314
|
-
: `Before I opened this, a second model reviewed the change
|
|
372
|
+
: section("Review", `Before I opened this, a second model reviewed the change.\n\n${input.review.trim()}`), `edgar-operation: ${ctx.operation_id}`);
|
|
315
373
|
const labels = [...new Set([...settings.data.pr_labels, ...(input.labels ?? [])])];
|
|
316
374
|
const made = await github(ctx, "POST", `/repos/${repo.value}/pulls`, pull, {
|
|
317
375
|
title: titleOf(input.title, input.card),
|
|
@@ -500,13 +558,13 @@ export const pullRequestTools = {
|
|
|
500
558
|
return first === undefined ? skipped() : done({ url: first.html_url, state: stateOf(first) });
|
|
501
559
|
},
|
|
502
560
|
}),
|
|
503
|
-
/** 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. */
|
|
561
|
+
/** 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. With `unless_noted`, each merged pull request costs one read of its comments, so one that EDGAR's note already says was handled costs nothing more, here or in the tracker. */
|
|
504
562
|
list_pull_requests: defineTool({
|
|
505
563
|
description: "List the open pull requests on edgar/ branches of each service's repository on github.com, or with merged_within_hours the ones merged within that many hours; a service elsewhere has none here",
|
|
506
564
|
input: listPullRequests.input,
|
|
507
565
|
output: listPullRequests.output,
|
|
508
566
|
...apiAccess,
|
|
509
|
-
execute: async ({ services, merged_within_hours }, ctx) => {
|
|
567
|
+
execute: async ({ services, merged_within_hours, unless_noted }, ctx) => {
|
|
510
568
|
const repos = new Set();
|
|
511
569
|
for (const service of services) {
|
|
512
570
|
const repo = repoPath(service.repo);
|
|
@@ -535,14 +593,23 @@ export const pullRequestTools = {
|
|
|
535
593
|
const kept = since === undefined || (p.merged_at !== null && Date.parse(p.merged_at) >= since);
|
|
536
594
|
if (card === null || !own || !kept)
|
|
537
595
|
continue;
|
|
596
|
+
if (since !== undefined && unless_noted !== undefined) {
|
|
597
|
+
const already = await hasNoted(ctx, p.html_url, unless_noted);
|
|
598
|
+
if (!already.ok)
|
|
599
|
+
return already.error;
|
|
600
|
+
if (already.value)
|
|
601
|
+
continue;
|
|
602
|
+
}
|
|
538
603
|
const unmerged = since === undefined ? ok([]) : await unmergedOf(ctx, p.body);
|
|
539
604
|
if (!unmerged.ok)
|
|
540
605
|
return unmerged.error;
|
|
606
|
+
const companion = since !== undefined && (p.body ?? "").includes(`\n${COMPANION_LEAD} `);
|
|
541
607
|
pull_requests.push({
|
|
542
608
|
url: p.html_url,
|
|
543
609
|
branch: p.head.ref,
|
|
544
610
|
card,
|
|
545
611
|
unmerged: unmerged.value,
|
|
612
|
+
...(companion ? { companion } : {}),
|
|
546
613
|
});
|
|
547
614
|
}
|
|
548
615
|
}
|
|
@@ -67,7 +67,7 @@ export declare function trustOf(written: {
|
|
|
67
67
|
}, own: ReadonlySet<string>): Trust;
|
|
68
68
|
/** True when the issue is a card EDGAR still holds: closed, or open and in the table's scope. */
|
|
69
69
|
export declare function isHeld(settings: Settings, found: Issue, assignee: string | undefined): boolean;
|
|
70
|
-
/** The card of an issue that `isHeld` keeps, with the service of its repository in its block. An issue with no block gets a `request` block, because the block is where a card names its service. A block that does not read is `invalid` when `strict`, else carried as why, for the engine to refuse. `taken_by` is its first assignee that is a person: not a login of `own`, and not a bot; `taken_by_id` is the same login, which names one account at a time. `priority` is the one a `priority:urgent` or `priority:high` label gives, `trust` is its writer's by {@link trustOf}, and `written_by_id` is the writer's login. */
|
|
70
|
+
/** The card of an issue that `isHeld` keeps, with the service of its repository in its block. An issue with no block gets a `request` block, because the block is where a card names its service. A block that does not read is `invalid` when `strict`, else carried as why, for the engine to refuse. `taken_by` is its first assignee that is a person: not a login of `own`, and not a bot; `taken_by_id` is the same login, which names one account at a time. `priority` is the one a `priority:urgent` or `priority:high` label gives, `trust` is its writer's by {@link trustOf}, and `written_by_id` is the writer's login. `requested_by` is the writer too when they are a person, since GitHub names who assigned an issue only in its events, which a page of issues does not carry. */
|
|
71
71
|
export declare function toCard(settings: Settings, repo: Repo, found: Issue, strict: boolean, own: ReadonlySet<string>): Result<TrackedCard, Failure>;
|
|
72
72
|
/** EDGAR's own logins: the one it works as, and `[extensions.github.tracker] assignee`. An App with no `assignee` has none, since its `[bot]` login is never a person. */
|
|
73
73
|
export declare function ownLogins(ctx: GithubCtx, settings: Settings): Promise<Result<ReadonlySet<string>, Failure>>;
|
|
@@ -107,7 +107,7 @@ export function trustOf(written, own) {
|
|
|
107
107
|
export function isHeld(settings, found, assignee) {
|
|
108
108
|
return found.state === "closed" || inScope(settings, found, assignee);
|
|
109
109
|
}
|
|
110
|
-
/** The card of an issue that `isHeld` keeps, with the service of its repository in its block. An issue with no block gets a `request` block, because the block is where a card names its service. A block that does not read is `invalid` when `strict`, else carried as why, for the engine to refuse. `taken_by` is its first assignee that is a person: not a login of `own`, and not a bot; `taken_by_id` is the same login, which names one account at a time. `priority` is the one a `priority:urgent` or `priority:high` label gives, `trust` is its writer's by {@link trustOf}, and `written_by_id` is the writer's login. */
|
|
110
|
+
/** The card of an issue that `isHeld` keeps, with the service of its repository in its block. An issue with no block gets a `request` block, because the block is where a card names its service. A block that does not read is `invalid` when `strict`, else carried as why, for the engine to refuse. `taken_by` is its first assignee that is a person: not a login of `own`, and not a bot; `taken_by_id` is the same login, which names one account at a time. `priority` is the one a `priority:urgent` or `priority:high` label gives, `trust` is its writer's by {@link trustOf}, and `written_by_id` is the writer's login. `requested_by` is the writer too when they are a person, since GitHub names who assigned an issue only in its events, which a page of issues does not carry. */
|
|
111
111
|
export function toCard(settings, repo, found, strict, own) {
|
|
112
112
|
const description = found.body ?? "";
|
|
113
113
|
const block = readBlock(description);
|
|
@@ -118,6 +118,8 @@ export function toCard(settings, repo, found, strict, own) {
|
|
|
118
118
|
const taken = found.assignees?.find((person) => !own.has(person.login) && !person.login.endsWith("[bot]"))?.login;
|
|
119
119
|
const names = labelNames(found);
|
|
120
120
|
const priority = priorities.find(([label]) => names.includes(label))?.[1];
|
|
121
|
+
const writer = found.user?.login;
|
|
122
|
+
const asked = writer === undefined || own.has(writer) || writer.endsWith("[bot]") ? undefined : writer;
|
|
121
123
|
return ok({
|
|
122
124
|
id: cardId(repo, found.number),
|
|
123
125
|
title: found.title,
|
|
@@ -133,6 +135,7 @@ export function toCard(settings, repo, found, strict, own) {
|
|
|
133
135
|
...(priority === undefined ? {} : { priority }),
|
|
134
136
|
trust: trustOf(found, own),
|
|
135
137
|
...(found.user?.login === undefined ? {} : { written_by_id: found.user.login }),
|
|
138
|
+
...(asked === undefined ? {} : { requested_by: asked, requested_by_id: asked }),
|
|
136
139
|
});
|
|
137
140
|
}
|
|
138
141
|
/** The logins found so far, by the token that signs in, kept for the life of the process. */
|
package/edgar-extension.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"contract": 1,
|
|
3
3
|
"name": "github",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.6",
|
|
5
5
|
"config_schema": "schemas/config.json",
|
|
6
6
|
"secrets": [
|
|
7
7
|
{
|
|
@@ -252,6 +252,30 @@
|
|
|
252
252
|
"approval": "never",
|
|
253
253
|
"disabled": false
|
|
254
254
|
},
|
|
255
|
+
{
|
|
256
|
+
"name": "code_owners",
|
|
257
|
+
"description": "Find who should review a pull request: the owners that CODEOWNERS names for its files, else the at most two people who changed those files most and most recently in the last 12 months, never a bot or its author; skipped when there is none",
|
|
258
|
+
"input_schema": "schemas/code_owners.in.json",
|
|
259
|
+
"output_schema": "schemas/code_owners.out.json",
|
|
260
|
+
"secrets": ["GITHUB_TOKEN"],
|
|
261
|
+
"capabilities": ["network:api.github.com"],
|
|
262
|
+
"side_effect": false,
|
|
263
|
+
"approval": "never",
|
|
264
|
+
"disabled": false
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
"name": "request_reviewers",
|
|
268
|
+
"description": "Ask people and teams to review a pull request; skipped when there is no one to ask or GitHub cannot ask them",
|
|
269
|
+
"input_schema": "schemas/request_reviewers.in.json",
|
|
270
|
+
"output_schema": "schemas/request_reviewers.out.json",
|
|
271
|
+
"secrets": ["GITHUB_TOKEN"],
|
|
272
|
+
"capabilities": ["network:api.github.com"],
|
|
273
|
+
"side_effect": true,
|
|
274
|
+
"undo": "none",
|
|
275
|
+
"undo_reason": "A review request only asks; the people asked are still the right ones when a later stage is undone.",
|
|
276
|
+
"approval": "never",
|
|
277
|
+
"disabled": false
|
|
278
|
+
},
|
|
255
279
|
{
|
|
256
280
|
"name": "dependabot_alerts",
|
|
257
281
|
"description": "Read the Dependabot alerts of a repository, or one alert by number: package, severity, vulnerable range, first patched version, manifest and advisory ids",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kana-ai/edgar-ext-github",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "EDGAR extension for GitHub: push edgar/ branches, open, watch, close and merge pull requests, and track GitHub issues as cards.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
".": "./dist/src/index.js"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@kana-ai/edgar-contracts": "0.1.
|
|
27
|
-
"@kana-ai/edgar-sdk": "0.1.
|
|
26
|
+
"@kana-ai/edgar-contracts": "0.1.6",
|
|
27
|
+
"@kana-ai/edgar-sdk": "0.1.6",
|
|
28
28
|
"zod": "4.6.7"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"properties": {
|
|
5
|
+
"source": {
|
|
6
|
+
"type": "string",
|
|
7
|
+
"enum": ["codeowners", "history"],
|
|
8
|
+
"description": "codeowners: the CODEOWNERS file names them; history: they changed the files most, and most recently"
|
|
9
|
+
},
|
|
10
|
+
"reviewers": {
|
|
11
|
+
"type": "array",
|
|
12
|
+
"items": {
|
|
13
|
+
"type": "string"
|
|
14
|
+
},
|
|
15
|
+
"description": "the login of each person"
|
|
16
|
+
},
|
|
17
|
+
"team_reviewers": {
|
|
18
|
+
"type": "array",
|
|
19
|
+
"items": {
|
|
20
|
+
"type": "string"
|
|
21
|
+
},
|
|
22
|
+
"description": "the slug of each team that CODEOWNERS names"
|
|
23
|
+
},
|
|
24
|
+
"who_can_act": {
|
|
25
|
+
"minItems": 1,
|
|
26
|
+
"type": "array",
|
|
27
|
+
"items": {
|
|
28
|
+
"type": "object",
|
|
29
|
+
"properties": {
|
|
30
|
+
"github": {
|
|
31
|
+
"description": "the login of a person",
|
|
32
|
+
"type": "string"
|
|
33
|
+
},
|
|
34
|
+
"name": {
|
|
35
|
+
"description": "a team, as @org/slug",
|
|
36
|
+
"type": "string"
|
|
37
|
+
},
|
|
38
|
+
"why": {
|
|
39
|
+
"type": "string"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"required": ["why"]
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"required": ["source", "reviewers", "team_reviewers", "who_can_act"]
|
|
47
|
+
}
|
|
@@ -20,6 +20,11 @@
|
|
|
20
20
|
"type": "integer",
|
|
21
21
|
"minimum": 1,
|
|
22
22
|
"maximum": 720
|
|
23
|
+
},
|
|
24
|
+
"unless_noted": {
|
|
25
|
+
"description": "with merged_within_hours, leaves out each merged pull request whose EDGAR note already holds this text as one of its lines, so a merge that was handled is not listed again",
|
|
26
|
+
"type": "string",
|
|
27
|
+
"minLength": 1
|
|
23
28
|
}
|
|
24
29
|
},
|
|
25
30
|
"required": ["services"]
|
|
@@ -32,6 +32,11 @@
|
|
|
32
32
|
"required": ["url", "state"]
|
|
33
33
|
},
|
|
34
34
|
"description": "with merged_within_hours, the pull requests of its `Goes with:` line that are not merged; empty otherwise"
|
|
35
|
+
},
|
|
36
|
+
"companion": {
|
|
37
|
+
"description": "with merged_within_hours, a companion pull request: the fix of its card is built on it and moves the card when it merges",
|
|
38
|
+
"type": "boolean",
|
|
39
|
+
"const": true
|
|
35
40
|
}
|
|
36
41
|
},
|
|
37
42
|
"required": ["url", "branch", "card", "unmerged"]
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
"card": {
|
|
37
|
-
"description": "the run's card: the title becomes `<id>: <title>`, and the body opens with its link",
|
|
37
|
+
"description": "the run's card: the title becomes `<id>: <title>`, at most 72 characters with a trailing `[tag]` kept whole, and the body opens with its link",
|
|
38
38
|
"type": "object",
|
|
39
39
|
"properties": {
|
|
40
40
|
"id": {
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
}
|
|
78
78
|
},
|
|
79
79
|
"checks": {
|
|
80
|
-
"description": "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",
|
|
80
|
+
"description": "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, and the changed files each check covers, or that it covers none, when the check says which paths it covers",
|
|
81
81
|
"type": "object",
|
|
82
82
|
"properties": {
|
|
83
83
|
"results": {
|
|
@@ -108,6 +108,12 @@
|
|
|
108
108
|
"type": "integer",
|
|
109
109
|
"exclusiveMinimum": 0,
|
|
110
110
|
"maximum": 9007199254740991
|
|
111
|
+
},
|
|
112
|
+
"covered": {
|
|
113
|
+
"type": "array",
|
|
114
|
+
"items": {
|
|
115
|
+
"type": "string"
|
|
116
|
+
}
|
|
111
117
|
}
|
|
112
118
|
},
|
|
113
119
|
"required": ["check", "exit_code"]
|
|
@@ -179,6 +185,16 @@
|
|
|
179
185
|
}
|
|
180
186
|
}
|
|
181
187
|
]
|
|
188
|
+
},
|
|
189
|
+
"after": {
|
|
190
|
+
"description": "the companion pull request that this one is built on: the body says to merge it first",
|
|
191
|
+
"type": "string",
|
|
192
|
+
"format": "uri"
|
|
193
|
+
},
|
|
194
|
+
"first": {
|
|
195
|
+
"description": "for a companion pull request: why the fix of the card needs it; the body says to merge this one first",
|
|
196
|
+
"type": "string",
|
|
197
|
+
"minLength": 1
|
|
182
198
|
}
|
|
183
199
|
},
|
|
184
200
|
"required": ["repo", "branch", "title", "body", "review"]
|
|
@@ -15,6 +15,11 @@
|
|
|
15
15
|
"description": "the edgar/ branch on origin that gets the head of the sandbox: the branch of an open pull request",
|
|
16
16
|
"type": "string",
|
|
17
17
|
"minLength": 1
|
|
18
|
+
},
|
|
19
|
+
"suffix": {
|
|
20
|
+
"description": "with `branch`: the head of the sandbox goes to `<branch>-<suffix>` instead, so one sandbox opens a second pull request, such as a companion",
|
|
21
|
+
"type": "string",
|
|
22
|
+
"pattern": "^[a-z]+$"
|
|
18
23
|
}
|
|
19
24
|
},
|
|
20
25
|
"required": ["repo"]
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"properties": {
|
|
5
|
+
"url": {
|
|
6
|
+
"type": "string",
|
|
7
|
+
"minLength": 1
|
|
8
|
+
},
|
|
9
|
+
"reviewers": {
|
|
10
|
+
"type": "array",
|
|
11
|
+
"items": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"minLength": 1
|
|
14
|
+
},
|
|
15
|
+
"description": "the login of each person to ask"
|
|
16
|
+
},
|
|
17
|
+
"team_reviewers": {
|
|
18
|
+
"type": "array",
|
|
19
|
+
"items": {
|
|
20
|
+
"type": "string",
|
|
21
|
+
"minLength": 1
|
|
22
|
+
},
|
|
23
|
+
"description": "the slug of each team to ask"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"required": ["url", "reviewers", "team_reviewers"]
|
|
27
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"properties": {
|
|
5
|
+
"url": {
|
|
6
|
+
"type": "string"
|
|
7
|
+
},
|
|
8
|
+
"requested": {
|
|
9
|
+
"type": "array",
|
|
10
|
+
"items": {
|
|
11
|
+
"type": "string"
|
|
12
|
+
},
|
|
13
|
+
"description": "each login and team slug that GitHub now asks"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"required": ["url", "requested"]
|
|
17
|
+
}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"type": "string"
|
|
15
15
|
},
|
|
16
16
|
"card": {
|
|
17
|
-
"description": "the run's card: the title becomes `<id>: <title>`, and the body opens with its link",
|
|
17
|
+
"description": "the run's card: the title becomes `<id>: <title>`, at most 72 characters with a trailing `[tag]` kept whole, and the body opens with its link",
|
|
18
18
|
"type": "object",
|
|
19
19
|
"properties": {
|
|
20
20
|
"id": {
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
}
|
|
58
58
|
},
|
|
59
59
|
"checks": {
|
|
60
|
-
"description": "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",
|
|
60
|
+
"description": "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, and the changed files each check covers, or that it covers none, when the check says which paths it covers",
|
|
61
61
|
"type": "object",
|
|
62
62
|
"properties": {
|
|
63
63
|
"results": {
|
|
@@ -88,6 +88,12 @@
|
|
|
88
88
|
"type": "integer",
|
|
89
89
|
"exclusiveMinimum": 0,
|
|
90
90
|
"maximum": 9007199254740991
|
|
91
|
+
},
|
|
92
|
+
"covered": {
|
|
93
|
+
"type": "array",
|
|
94
|
+
"items": {
|
|
95
|
+
"type": "string"
|
|
96
|
+
}
|
|
91
97
|
}
|
|
92
98
|
},
|
|
93
99
|
"required": ["check", "exit_code"]
|