@andrioid/paseo-attention-span 0.6.1 → 0.7.1
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/OVERVIEW.md +2 -0
- package/client/attention-screen.tsx +4 -1
- package/client/entity.tsx +15 -3
- package/client/icons.ts +2 -0
- package/client/item-actions.ts +49 -1
- package/client/next-up.tsx +49 -7
- package/client/pickers.tsx +4 -3
- package/client/ui.tsx +4 -1
- package/client/wrap-up.tsx +51 -4
- package/docs/architecture.md +4 -3
- package/docs/screenshots/desktop-dark-doing-acknowledge.png +0 -0
- package/docs/screenshots/desktop-dark-doing-clear.png +0 -0
- package/docs/screenshots/desktop-dark-doing-issue-sheet.png +0 -0
- package/docs/screenshots/desktop-dark-doing-reviewers.png +0 -0
- package/docs/screenshots/desktop-dark-doing-sheet.png +0 -0
- package/docs/screenshots/desktop-dark-doing-wrap-dirty.png +0 -0
- package/docs/screenshots/desktop-dark-doing-wrap-multi.png +0 -0
- package/docs/screenshots/desktop-dark-doing-wrap.png +0 -0
- package/docs/screenshots/desktop-dark-doing.png +0 -0
- package/docs/screenshots/desktop-dark-history-filtered.png +0 -0
- package/docs/screenshots/desktop-dark-history-groups.png +0 -0
- package/docs/screenshots/desktop-dark-history.png +0 -0
- package/docs/screenshots/desktop-dark-next-up-setup.png +0 -0
- package/docs/screenshots/desktop-dark-next-up.png +0 -0
- package/docs/screenshots/desktop-dark-settings.png +0 -0
- package/docs/screenshots/desktop-dark-setup.png +0 -0
- package/docs/screenshots/desktop-dark-waiting-too-long.png +0 -0
- package/docs/screenshots/desktop-dark-waiting.png +0 -0
- package/docs/screenshots/phone-dark-doing.png +0 -0
- package/docs/screenshots/phone-dark-history.png +0 -0
- package/docs/screenshots/phone-light-next-up-filtered.png +0 -0
- package/index.server.ts +2 -0
- package/package.json +1 -1
- package/requirements.yaml +4 -0
- package/server/classify.ts +44 -3
- package/server/context.ts +95 -3
- package/server/fetch.ts +29 -3
- package/server/fixture.ts +21 -5
- package/server/github-types.ts +15 -1
- package/server/queries.ts +15 -1
- package/server/references.ts +12 -0
- package/server/service.ts +90 -11
- package/server/store.ts +17 -2
- package/server/view.ts +24 -4
- package/shared/attention.ts +39 -2
- package/shared/item-view.ts +5 -4
- package/shared/next-up-filter.ts +19 -0
- package/shared/prompts.ts +39 -22
- package/shared/rpc.ts +4 -0
- package/shared/wrap-up.ts +34 -9
package/requirements.yaml
CHANGED
|
@@ -38,6 +38,7 @@ functional:
|
|
|
38
38
|
ATT-19: tell at a glance what each person shown on an item is to it: someone I'm waiting on, who opened it, or whose comments are left to address, with an icon by their picture and the meaning in words when I point at it; so that a face and a time never leave me guessing.
|
|
39
39
|
ATT-20: tell which item a card is on every tab by its number first, then its repository with the repository's name standing out from its owner, which my own repositories leave out; so that cards from several repositories scan without reading each one in full.
|
|
40
40
|
ATT-22: wrap up finished or out-of-my-hands work whose Paseo sessions are still open, archiving them, and the sub-agents they started, safely: naming unsaved changes and the open terminals archiving closes first, in a sheet shaped like Paseo's own, keeping worktrees another session lives in, leaving a row that says why a worktree stayed until it goes or is dismissed, and acknowledging what others did once it succeeds; so that leftover sessions get cleaned up without losing work or resurfacing old changes.
|
|
41
|
+
ATT-24: see in Wrap up an open issue whose grouped pull requests have all merged, with none still open for it, asking "Close #12?", and close it as completed with Undo or keep it open until another of them merges; so that finished work doesn't leave issues open behind it.
|
|
41
42
|
mentions:
|
|
42
43
|
As a developer, I can:
|
|
43
44
|
MEN-01: see open threads where a person mentioned me and is still waiting for my response; so that I only hear about mentions when someone is waiting for me.
|
|
@@ -50,6 +51,7 @@ functional:
|
|
|
50
51
|
reviews:
|
|
51
52
|
As a developer, I can:
|
|
52
53
|
REV-01: see pull requests where my review is requested by name; so that I don't hold up others.
|
|
54
|
+
REV-02: see a pull request whose review was re-requested after I reviewed it marked "Review again", with its Review session given what I said last time and focused on the commits since my last review; so that a second look costs less than the first.
|
|
53
55
|
own_pull_requests:
|
|
54
56
|
As a developer, I can:
|
|
55
57
|
PRS-01: see my pull requests whose checks fail; so that I fix them before they block review or merge.
|
|
@@ -87,6 +89,7 @@ functional:
|
|
|
87
89
|
SES-07: start a session on an issue in the repository its code lives in, chosen right there the first time; so that issues kept in a separate repository work without editing files.
|
|
88
90
|
SES-08: see sessions started outside Attention Span on the item of the pull request their workspace is linked to, or of the session whose worktree they share, or of my merged or closed pull request whose branch their worktree is on, as "Continue session", including finished work in Wrap up; so that I don't start duplicate work and can clean up what I left open.
|
|
89
91
|
SES-09: tell sessions reviewing someone else's pull request from work on my own in Paseo's sidebar, by a name like "Review PR 123: title"; so that I know which kind of work a workspace holds.
|
|
92
|
+
SES-10: stay where I am when I start a session on an item, told it started, with the item offering to open it; so that I can start several in a row without finding my place again.
|
|
90
93
|
next_up:
|
|
91
94
|
As a developer, I can:
|
|
92
95
|
NXT-01: see open issues nobody is assigned to, apart from the work that needs me; so that I can get an idea of what to do next.
|
|
@@ -102,6 +105,7 @@ functional:
|
|
|
102
105
|
NXT-11: close an issue from Next up as completed or not planned, with an optional comment, and undo it; so that work that's done or won't be done stops being suggested.
|
|
103
106
|
NXT-12: see which open GitHub projects my Next up issues are on, and where on each board, once my gh login may read projects, with Settings saying the one command that allows it until then; so that I know whether work is planned or just an idea, without Next up breaking for anyone who hasn't allowed it.
|
|
104
107
|
NXT-13: see a calm scene in Next up when it has nothing at all to show, pointing me to Settings, plainly when it has nowhere to look and quietly when it found nothing to pick up, the latter only once a refresh has confirmed it; so that an empty Next up says how to fill it rather than looking broken.
|
|
108
|
+
NXT-14: group unclaimed issues by repository, each under its name, the repository with the most important issue first and NXT-02's order within each, offered whenever more than one repository is shown, and have my choice remembered; so that I can see which project each issue belongs to when I have many going.
|
|
105
109
|
waiting:
|
|
106
110
|
As a developer, I can:
|
|
107
111
|
WAI-01: see my work that is waiting on others, grouped by who it waits on with whoever blocks the most first, bots after people, and work no person holds up last, each group with work that has an active session first, and each card saying why it waits and for how long, including my pull requests in Doing that wait on whom I asked, where a pull request waits for review only once someone has been asked, and a thread only once my last words ask a question; so that I know that work is tracked and who is blocking me most.
|
package/server/classify.ts
CHANGED
|
@@ -3,7 +3,9 @@ import {
|
|
|
3
3
|
baseItem,
|
|
4
4
|
type Attention,
|
|
5
5
|
type Chip,
|
|
6
|
+
type CloseAsk,
|
|
6
7
|
type Item,
|
|
8
|
+
type LastReview,
|
|
7
9
|
type NextUpIssue,
|
|
8
10
|
type IssueProject,
|
|
9
11
|
type Person,
|
|
@@ -297,14 +299,22 @@ export function classify({ data, details, config, now }: ClassifyInput): Attenti
|
|
|
297
299
|
};
|
|
298
300
|
};
|
|
299
301
|
|
|
300
|
-
//
|
|
302
|
+
// My last review of a PR asking for it again. GitHub drops my request once I review, so a request alongside a review of
|
|
303
|
+
// mine is a re-request; a push since then without one doesn't list it at all [REV-02].
|
|
304
|
+
const lastReview = (pr: PullRequestNode): LastReview | undefined => {
|
|
305
|
+
const review = pr.latestReviews.nodes.find((r) => isMe(r.author));
|
|
306
|
+
if (!review) return undefined;
|
|
307
|
+
return { at: review.submittedAt ?? EPOCH, ...(review.commit?.oid ? { oid: review.commit.oid } : {}) };
|
|
308
|
+
};
|
|
309
|
+
|
|
310
|
+
// Others' PRs in a stack that ask for my review: one Review for them all [REV-01, ATT-04], marked when it's asked again [REV-02].
|
|
301
311
|
const reviewPart = (stack: PullRequestNode[]): Part => {
|
|
302
312
|
const waiting = stack.map((pr) => mentions.get(prKey(pr))).find(Boolean);
|
|
303
313
|
const lastCommitAt = latest(...stack.map((pr) => state(pr).lastCommitAt));
|
|
304
314
|
return {
|
|
305
315
|
section: waiting ? "reply" : "review",
|
|
306
316
|
actions: waiting ? [...replyActions(waiting), "review"] : ["review"],
|
|
307
|
-
chips: stack.some((pr) => state(pr).ciFailing) ? [chip("CI failing", "bad")] : [],
|
|
317
|
+
chips: [...(stack.some(lastReview) ? [chip("review again")] : []), ...(stack.some((pr) => state(pr).ciFailing) ? [chip("CI failing", "bad")] : [])],
|
|
308
318
|
person: waiting ?? author(stack[0].author, lastCommitAt),
|
|
309
319
|
othersActivityAt: latest(...stack.map((pr) => state(pr).othersActivityAt), lastCommitAt, waiting?.since),
|
|
310
320
|
};
|
|
@@ -351,7 +361,10 @@ export function classify({ data, details, config, now }: ClassifyInput): Attenti
|
|
|
351
361
|
headRefOid: pr.headRefOid,
|
|
352
362
|
defaultBranch: pr.repository.defaultBranchRef?.name,
|
|
353
363
|
mergeMethod: mergeMethodFor(pr, config),
|
|
354
|
-
stack: stack.map((p) =>
|
|
364
|
+
stack: stack.map((p) => {
|
|
365
|
+
const reviewed = isOwn(p) ? undefined : lastReview(p);
|
|
366
|
+
return { number: p.number, head: p.headRefName, base: p.baseRefName, ...(isOwn(p) ? {} : { review: true as const }), ...(reviewed ? { reviewed } : {}) };
|
|
367
|
+
}),
|
|
355
368
|
});
|
|
356
369
|
|
|
357
370
|
// One item per issue: my PRs grouped under the issue they work on [ATT-03]. Otherwise one per unit, led by its bottom PR.
|
|
@@ -484,6 +497,34 @@ export function classifyHistory(data: HistoryResult): Item[] {
|
|
|
484
497
|
return items.sort(order);
|
|
485
498
|
}
|
|
486
499
|
|
|
500
|
+
// Open issues my merged PRs worked on, picked as History picks a closed one, where no PR for it is still open, mine or
|
|
501
|
+
// anyone's that GitHub links: Wrap up offers to close each [ATT-24, ATT-03]. My open PRs grouped under one are in the live
|
|
502
|
+
// feed, so the view leaves those out.
|
|
503
|
+
export function classifyCloseAsks(data: HistoryResult): CloseAsk[] {
|
|
504
|
+
const referenced = new Map(Object.entries(data.referenced ?? {}));
|
|
505
|
+
// Closed issues count as issues too, so a PR that worked on one isn't put under another it mentions.
|
|
506
|
+
const closed = new Set(compact(data.closed.nodes).map(prKey));
|
|
507
|
+
const me = data.viewer?.login.toLowerCase();
|
|
508
|
+
const asks = new Map<string, CloseAsk>();
|
|
509
|
+
for (const pr of compact(data.merged.nodes)) {
|
|
510
|
+
const linked = { repo: pr.repository.nameWithOwner, body: pr.body, linked: pr.closingIssuesReferences.nodes.map(prKey) };
|
|
511
|
+
const key = issueFor([linked], (ref) => closed.has(ref) || referenced.has(ref));
|
|
512
|
+
const issue = key ? referenced.get(key) : undefined;
|
|
513
|
+
if (!key || !issue || issue.state !== "OPEN" || (issue.closedByPullRequestsReferences?.nodes ?? []).some((other) => other.state === "OPEN")) continue;
|
|
514
|
+
const ask = asks.get(key) ?? { key, repo: issue.repository.nameWithOwner, number: issue.number, title: issue.title, url: issue.url, prs: [], mergedAt: pr.mergedAt };
|
|
515
|
+
// Its branch, so a session on it still finds its row once the issue is closed; who merged it, as History says [ATT-22, HIS-05].
|
|
516
|
+
const by = pr.mergedBy?.login;
|
|
517
|
+
ask.prs.push({
|
|
518
|
+
key: prKey(pr), number: pr.number, title: pr.title, url: pr.url, draft: false, chips: [], attention: false, mergedAt: pr.mergedAt,
|
|
519
|
+
...(pr.headRefName ? { headRefName: pr.headRefName } : {}),
|
|
520
|
+
...(by && me && by.toLowerCase() !== me ? { mergedBy: by } : {}),
|
|
521
|
+
});
|
|
522
|
+
if (pr.mergedAt > ask.mergedAt) ask.mergedAt = pr.mergedAt;
|
|
523
|
+
asks.set(key, ask);
|
|
524
|
+
}
|
|
525
|
+
return [...asks.values()].map((ask) => ({ ...ask, prs: ask.prs.sort((a, b) => a.mergedAt!.localeCompare(b.mergedAt!)) }));
|
|
526
|
+
}
|
|
527
|
+
|
|
487
528
|
// Whether my last comment on a thread is the last one from a person, and if not, the recent comments since that I haven't 👍'd.
|
|
488
529
|
// On a thread I opened, my opening counts as my last word until I comment. Bots don't count [MEN-05]. Only the last comments
|
|
489
530
|
// are fetched: on someone else's thread, once mine is out of them the conversation has moved on.
|
package/server/context.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ownStack, type StackPr, type Target } from "../shared/attention";
|
|
1
|
+
import { ownStack, reviewAgain, type StackPr, type Target } from "../shared/attention";
|
|
2
2
|
import type { SessionKind } from "../shared/config";
|
|
3
3
|
import { graphql, runGh } from "./gh";
|
|
4
4
|
|
|
@@ -49,14 +49,106 @@ export async function sessionContext(kind: SessionKind, target: Target): Promise
|
|
|
49
49
|
if (kind === "address") return reviewFeedback(target);
|
|
50
50
|
|
|
51
51
|
// Review of a stack: every branch, with a link to each PR asking for my review; the agent reads what it needs [ATT-04].
|
|
52
|
+
// Asked again, what I said last time and what changed since, on each PR I reviewed [REV-02].
|
|
52
53
|
const stack = target.stack ?? [];
|
|
54
|
+
const again = kind === "review" ? reviewAgainContext(target) : Promise.resolve("");
|
|
53
55
|
if (kind === "review" && stack.length > 1) {
|
|
54
56
|
const lines = stack.map((pr) => `${branchLine(pr)}${pr.review ? `, review requested: https://github.com/${target.repo}/pull/${pr.number}` : ", mine"}`);
|
|
55
|
-
return `Stack, bottom first:\n${lines.join("\n")}
|
|
57
|
+
return join(`Stack, bottom first:\n${lines.join("\n")}`, await again);
|
|
56
58
|
}
|
|
57
59
|
|
|
58
60
|
// review, start: the whole description and the latest comments.
|
|
59
|
-
|
|
61
|
+
const [talk, since] = await Promise.all([conversation(ref, target), again]);
|
|
62
|
+
return join(talk, since);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const join = (...parts: string[]) => parts.filter(Boolean).join("\n\n");
|
|
66
|
+
|
|
67
|
+
const MY_REVIEWS = 5;
|
|
68
|
+
const MY_THREADS = 100;
|
|
69
|
+
|
|
70
|
+
// For each PR asking for my review again: my last reviews and the threads I'm in, with what came after, and how to find
|
|
71
|
+
// the commits since the one I reviewed, whether the branch moved on, was rebased, or lost it [REV-02]. Empty when none
|
|
72
|
+
// asks again.
|
|
73
|
+
export async function reviewAgainContext(target: Target): Promise<string> {
|
|
74
|
+
const prs = reviewAgain(target);
|
|
75
|
+
const named = (target.stack?.length ?? 0) > 1;
|
|
76
|
+
const blocks = await Promise.all(prs.map((pr) => lastReview(target.repo, pr, named)));
|
|
77
|
+
return join(...blocks);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
async function lastReview(repo: string, stacked: StackPr, named: boolean): Promise<string> {
|
|
81
|
+
type Author = { login: string } | null;
|
|
82
|
+
type Review = { author: Author; state: string; body: string; submittedAt: string | null; commit: { oid: string } | null };
|
|
83
|
+
type Thread = { isResolved: boolean; path: string; line: number | null; comments: { totalCount: number; nodes: { author: Author; body: string }[] } };
|
|
84
|
+
const [owner, name] = repo.split("/");
|
|
85
|
+
const { number } = stacked;
|
|
86
|
+
// My reviews only, by login, so others' reviews since can't crowd mine out; submitted ones only, as a review I've
|
|
87
|
+
// started and not sent isn't where I left off.
|
|
88
|
+
const { login } = (await graphql<{ viewer: { login: string } }>("query { viewer { login } }")).viewer;
|
|
89
|
+
const data = await graphql<{
|
|
90
|
+
repository: { pullRequest: { url: string; baseRefName: string; headRefOid: string; reviews: { nodes: Review[] }; reviewThreads: { totalCount: number; nodes: Thread[] } } };
|
|
91
|
+
}>(
|
|
92
|
+
`query($owner: String!, $name: String!, $number: Int!, $login: String!) {
|
|
93
|
+
repository(owner: $owner, name: $name) {
|
|
94
|
+
pullRequest(number: $number) {
|
|
95
|
+
url baseRefName headRefOid
|
|
96
|
+
reviews(last: ${MY_REVIEWS * 4}, author: $login, states: [APPROVED, CHANGES_REQUESTED, COMMENTED, DISMISSED]) { nodes { author { login } state body submittedAt commit { oid } } }
|
|
97
|
+
reviewThreads(first: ${MY_THREADS}) { totalCount nodes { isResolved path line comments(first: ${THREAD_COMMENTS}) { totalCount nodes { author { login } body } } } }
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}`,
|
|
101
|
+
{ owner, name, number, login },
|
|
102
|
+
);
|
|
103
|
+
const me = login.toLowerCase();
|
|
104
|
+
const mine = (author: Author) => author?.login.toLowerCase() === me;
|
|
105
|
+
const pr = data.repository.pullRequest;
|
|
106
|
+
const reviews = pr.reviews.nodes.filter((r) => mine(r.author));
|
|
107
|
+
const latest = reviews.at(-1);
|
|
108
|
+
const title = `Your last review${named ? ` of #${number}` : ""}`;
|
|
109
|
+
// Where GitHub's answer has none, the list's own reading of it still says when, and on which commit.
|
|
110
|
+
const reviewed = latest ? latest.commit?.oid : stacked.reviewed?.oid;
|
|
111
|
+
const when = latest ? `${latest.state.toLowerCase()}${latest.submittedAt ? ` on ${latest.submittedAt}` : ""}` : `on ${stacked.reviewed?.at ?? "an earlier date"}`;
|
|
112
|
+
|
|
113
|
+
const who = (author: Author) => (mine(author) ? "you" : `@${author?.login ?? "ghost"}`);
|
|
114
|
+
const said = reviews
|
|
115
|
+
.filter((r) => r.body.trim())
|
|
116
|
+
.slice(-MY_REVIEWS)
|
|
117
|
+
.map((r) => `- ${r.state.toLowerCase()}${r.submittedAt ? `, ${r.submittedAt}` : ""}: ${clip(r.body, 1500)}`);
|
|
118
|
+
const threads = pr.reviewThreads.nodes
|
|
119
|
+
.filter((t) => t.comments.nodes.some((c) => mine(c.author)))
|
|
120
|
+
.map((t) => {
|
|
121
|
+
const comments = t.comments.nodes.map((c) => ` ${who(c.author)}: ${clip(c.body, 800).replace(/\n/g, "\n ")}`);
|
|
122
|
+
const more = notShown(t.comments.totalCount - t.comments.nodes.length, "more comments", pr.url);
|
|
123
|
+
return [`- ${t.path}${t.line ? `:${t.line}` : ""} (${t.isResolved ? "resolved" : "unresolved"})`, ...comments, more && ` ${more}`].filter(Boolean).join("\n");
|
|
124
|
+
});
|
|
125
|
+
// A long thread I'm not in among its first comments may still have mine further down; say how many weren't read through.
|
|
126
|
+
const longThreads = pr.reviewThreads.nodes.filter((t) => t.comments.totalCount > t.comments.nodes.length && !t.comments.nodes.some((c) => mine(c.author))).length;
|
|
127
|
+
const unread = longThreads ? `${longThreads === 1 ? "1 long review thread was" : `${longThreads} long review threads were`} read only to comment ${THREAD_COMMENTS} and may have yours further down; see ${pr.url}` : "";
|
|
128
|
+
const laterThreads = notShown(pr.reviewThreads.totalCount - pr.reviewThreads.nodes.length, "more review threads, some maybe yours", pr.url);
|
|
129
|
+
|
|
130
|
+
return join(
|
|
131
|
+
`${title}: ${when}.\n${sinceSteps(reviewed, pr.headRefOid, pr.baseRefName)}`,
|
|
132
|
+
said.length ? `What you wrote in your reviews:\n${said.join("\n")}` : "",
|
|
133
|
+
threads.length ? `Review threads you're in, with the replies:\n${threads.join("\n")}` : "",
|
|
134
|
+
unread,
|
|
135
|
+
laterThreads,
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// How to find the commits since the one I reviewed: they follow it, perhaps with the base merged in, or the branch was
|
|
140
|
+
// rebased or force-pushed past it. The
|
|
141
|
+
// rebase case compares the two versions from where they meet, as the base may have moved too, a stack's parent with it.
|
|
142
|
+
function sinceSteps(reviewed: string | undefined, head: string, base: string): string {
|
|
143
|
+
if (!reviewed) return `GitHub no longer has the commit you reviewed, so review the whole diff against ${base} and say you couldn't narrow it down.`;
|
|
144
|
+
if (reviewed === head) return `No commits since: the head is still ${head}. What's new is in the replies below.`;
|
|
145
|
+
return [
|
|
146
|
+
`You reviewed commit ${reviewed}; the head is now ${head}.`,
|
|
147
|
+
`- \`git fetch origin ${reviewed} ${head}\``,
|
|
148
|
+
`- If \`git merge-base --is-ancestor ${reviewed} ${head}\`: the new commits are \`git log ${reviewed}..${head}\`, their changes \`git diff ${reviewed}..${head}\`. If one of them merges ${base} in, what came with it isn't the PR's: review the author's own commits (\`git log --first-parent --no-merges ${reviewed}..${head}\`, each with \`git show\`) and the merge's conflict resolutions (\`git show --remerge-diff <merge>\`) instead of the whole diff.`,
|
|
149
|
+
`- Otherwise the branch was rebased or force-pushed: compare the two versions with \`git range-diff ${reviewed}...${head}\`. Commits that came with ${base} or a rebased parent show up too, as added, dropped or matched; leave those out.`,
|
|
150
|
+
`- If ${reviewed} can't be fetched, review the whole diff against ${base} and say you couldn't narrow it down.`,
|
|
151
|
+
].join("\n");
|
|
60
152
|
}
|
|
61
153
|
|
|
62
154
|
const branchLine = (pr: StackPr) => `- #${pr.number}: ${pr.head} (on ${pr.base})`;
|
package/server/fetch.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type { IssueField } from "../shared/setup";
|
|
|
4
4
|
import { type ChangeLedger, changeCandidates, nextLedger, reopenCandidates, withGotIt } from "./changes";
|
|
5
5
|
import { issueBoardIds } from "./classify";
|
|
6
6
|
import type { graphql, graphqlResult } from "./gh";
|
|
7
|
-
import type { AssignmentSubject, Details, HistoryResult, LinkedIssue, LiveResult, MergeStateStatus, PullRequestNode, ReopenSubject } from "./github-types";
|
|
7
|
+
import type { AssignmentSubject, Details, HistoryResult, LinkedIssue, LiveResult, MergeStateStatus, PullRequestNode, ReferencedIssue, ReopenSubject } from "./github-types";
|
|
8
8
|
import { searchWithProjects } from "./projects";
|
|
9
9
|
import {
|
|
10
10
|
ASSIGNMENT_BATCH,
|
|
@@ -21,6 +21,8 @@ import {
|
|
|
21
21
|
PROJECTS_PROBE,
|
|
22
22
|
projectStatusesQuery,
|
|
23
23
|
type ProjectStatusesResult,
|
|
24
|
+
REFERENCED_BATCH,
|
|
25
|
+
referencedIssuesQuery,
|
|
24
26
|
reopenQuery,
|
|
25
27
|
requiredChecks,
|
|
26
28
|
type SearchName,
|
|
@@ -28,7 +30,7 @@ import {
|
|
|
28
30
|
searchVariables,
|
|
29
31
|
type UnclaimedSearch,
|
|
30
32
|
} from "./queries";
|
|
31
|
-
import { toLookUp } from "./references";
|
|
33
|
+
import { type IssueRef, mergedToLookUp, toLookUp } from "./references";
|
|
32
34
|
|
|
33
35
|
// What the service asks GitHub, one request shape each [GH-01]. Previews answer from made-up data instead (fixture.ts).
|
|
34
36
|
|
|
@@ -56,6 +58,8 @@ export interface GitHub {
|
|
|
56
58
|
changes(ledger: ChangeLedger, data: LiveResult, now: Date, config: AttentionConfig, gotIt: () => string[]): Promise<ChangeLedger>;
|
|
57
59
|
// From the oldest week's Monday in the device's `timeZone` [HIS-01].
|
|
58
60
|
history(config: AttentionConfig, now: Date, timeZone: string): Promise<HistoryResult>;
|
|
61
|
+
// The issues Wrap up asks to close, looked up again on the live refresh: closed since, or a PR opened for them [ATT-24].
|
|
62
|
+
issues(refs: IssueRef[]): Promise<Record<string, ReferencedIssue>>;
|
|
59
63
|
// The single-select fields of these orgs, merged by name [NXT-04].
|
|
60
64
|
issueFields(owners: string[]): Promise<IssueField[]>;
|
|
61
65
|
}
|
|
@@ -75,8 +79,9 @@ export function gitHub(gh: Gh): GitHub {
|
|
|
75
79
|
probeProjects: () => gh.graphqlResult<{ viewer: { projectsV2: unknown } | null }>(PROJECTS_PROBE, {}, { timeoutMs: PROBE_TIMEOUT_MS }).catch((error: Error) => error),
|
|
76
80
|
live: (config, now, unclaimed, projects) => searchLive(gh, config, now, unclaimed, projects),
|
|
77
81
|
changes: (ledger, data, now, config, gotIt) => trackChanges(gh, ledger, data, now, config, gotIt),
|
|
78
|
-
history: (config, now, timeZone) => gh
|
|
82
|
+
history: (config, now, timeZone) => searchHistory(gh, config, now, timeZone),
|
|
79
83
|
issueFields: (owners) => issueFields(gh, owners),
|
|
84
|
+
issues: (refs) => lookUpIssues(gh, refs),
|
|
80
85
|
};
|
|
81
86
|
}
|
|
82
87
|
|
|
@@ -177,6 +182,27 @@ export async function projectStatuses(gh: Gh, ids: string[], problems: string[])
|
|
|
177
182
|
return Object.fromEntries([...found].flatMap(([id, board]) => (board?.field?.options ? [[id, board.field.options]] : [])));
|
|
178
183
|
}
|
|
179
184
|
|
|
185
|
+
// History's searches, then whether the issues my merged PRs refer to are still open, so Wrap up can offer to close one
|
|
186
|
+
// whose work is done [HIS-01, ATT-24]. A lookup that fails only leaves those out until the next fetch.
|
|
187
|
+
async function searchHistory(gh: Gh, config: AttentionConfig, now: Date, timeZone: string): Promise<HistoryResult> {
|
|
188
|
+
const data = await gh.graphql<HistoryResult>(searchQuery(HISTORY_SEARCHES, true), variables(config, HISTORY_SEARCHES, now, timeZone));
|
|
189
|
+
// Search answers {} for what isn't a PR or issue.
|
|
190
|
+
const refs = mergedToLookUp(data.merged.nodes.filter((pr) => pr?.repository), data.closed.nodes.filter((issue) => issue?.repository));
|
|
191
|
+
if (refs.length === 0) return data;
|
|
192
|
+
return { ...data, referenced: await lookUpIssues(gh, refs) };
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// Issues by reference, a batch per request: whether each is open, and the open PRs GitHub links to it [ATT-24, GH-01].
|
|
196
|
+
// What a failed request asked about is left out, so it's taken as unknown, never as closed or free.
|
|
197
|
+
async function lookUpIssues(gh: Gh, refs: IssueRef[]): Promise<Record<string, ReferencedIssue>> {
|
|
198
|
+
if (refs.length === 0) return {};
|
|
199
|
+
const found = await lookupBatches<IssueRef, { issueOrPullRequest: Partial<ReferencedIssue> | null }>(gh, refs, "i", referencedIssuesQuery, {
|
|
200
|
+
size: REFERENCED_BATCH,
|
|
201
|
+
problem: (message) => console.error("Couldn't check the issues my merged PRs refer to:", message),
|
|
202
|
+
});
|
|
203
|
+
return Object.fromEntries([...found].flatMap(([, node]) => (node?.issueOrPullRequest?.repository ? [[prKey(node.issueOrPullRequest as ReferencedIssue), node.issueOrPullRequest as ReferencedIssue]] : [])));
|
|
204
|
+
}
|
|
205
|
+
|
|
180
206
|
// My PRs' merge state, a few per request in parallel, as GitHub only works it out for a few at a time; search's answer
|
|
181
207
|
// for more is BLOCKED for all [PRS-13]. A request that fails leaves its PRs to search's answer.
|
|
182
208
|
async function mergeStates(gh: Gh, prs: PullRequestNode[]): Promise<Details["mergeState"]> {
|
package/server/fixture.ts
CHANGED
|
@@ -128,7 +128,7 @@ export function builders(now: Date) {
|
|
|
128
128
|
};
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
-
function search(parts: Partial<{ [K in Exclude<keyof SearchResult, "viewer">]: SearchResult[K]["nodes"] }>): SearchResult {
|
|
131
|
+
function search(parts: Partial<{ [K in Exclude<keyof SearchResult, "viewer" | "referenced">]: SearchResult[K]["nodes"] }>): SearchResult {
|
|
132
132
|
const nodes = <K extends keyof typeof parts>(key: K) => ({ nodes: parts[key] ?? [] });
|
|
133
133
|
return {
|
|
134
134
|
viewer: { login: "me", id: "U_me" },
|
|
@@ -223,6 +223,9 @@ export function fixture(now: Date): { data: SearchResult; details: Details } {
|
|
|
223
223
|
// Bob's stack asking for my review: one item with one Review [ATT-04].
|
|
224
224
|
pr(196, { title: "Price rules: data model", author: bob, headRefName: "rules-1", commits: commit("SUCCESS", 0.4) }),
|
|
225
225
|
pr(197, { title: "Price rules: admin screen", author: bob, baseRefName: "rules-1", headRefName: "rules-2", commits: commit("SUCCESS", 0.3) }),
|
|
226
|
+
// Asked again after I reviewed: one with the Review session still open, one without [REV-02].
|
|
227
|
+
pr(198, { title: "Show shipping estimates at checkout", author: alice, latestReviews: { nodes: [{ author: me, state: "CHANGES_REQUESTED", submittedAt: daysAgo(2), commit: { oid: "oid198old" } }] }, commits: commit("SUCCESS", 0.2) }),
|
|
228
|
+
pr(199, { title: "Group order emails by customer", author: bob, latestReviews: { nodes: [{ author: me, state: "COMMENTED", submittedAt: daysAgo(3), commit: { oid: "oid199old" } }] }, commits: commit("SUCCESS", 0.5) }),
|
|
226
229
|
],
|
|
227
230
|
mentions: [
|
|
228
231
|
mention(95, [comment(bob, "@me should reminders go out on weekends too, or only on workdays?", 0.5)], { title: "Customers forget unpaid invoices", author: bob }),
|
|
@@ -272,6 +275,8 @@ export function fixture(now: Date): { data: SearchResult; details: Details } {
|
|
|
272
275
|
assigned: [
|
|
273
276
|
{ ...pickable(150, fields("🏔 P1 High", "🐇 Small (0.5-2d)", "🔙 Backend"), 20, "Bug", "Orders export times out for big shops"), ...onBoard(TODO_BOARD, "In progress") },
|
|
274
277
|
{ ...pickable(151, fields("🏕P2 Medium", "🐟 Tiny (< 4h)", "🔙 Backend"), 5, "Bug", "Price list import skips quoted rows", ISSUES_REPO), ...onBoard(TODO_BOARD, "Todo") },
|
|
278
|
+
// Its PRs, #194 and #195, merged into a feature branch, so GitHub left it open: Wrap up asks to close it [ATT-24].
|
|
279
|
+
{ ...pickable(152, fields("🏕P2 Medium", "🐇 Small (0.5-2d)", "🖌 Frontend"), 12, "Feature", "Customer statements as PDF"), ...onBoard(TODO_BOARD, "In progress") },
|
|
275
280
|
],
|
|
276
281
|
// Found by the preview config's Next up sources [NXT-09].
|
|
277
282
|
unclaimed: [
|
|
@@ -284,10 +289,11 @@ export function fixture(now: Date): { data: SearchResult; details: Details } {
|
|
|
284
289
|
sources: ["org:acme"],
|
|
285
290
|
},
|
|
286
291
|
{ ...pickable(162, fields("🏝 P3 Low", "🐇 Small (0.5-2d)", "🔙 Backend"), 30, "Debt", "Merge the two import commands"), ...onBoard(TODO_BOARD, "Backlog"), sources: ["org:acme"] },
|
|
287
|
-
|
|
292
|
+
// In another repository, so Unclaimed has some to group [NXT-14].
|
|
293
|
+
{ ...pickable(163, fields("🏝 P3 Low", "🐇 Small (0.5-2d)", "🖌 Frontend"), 8, "Bug", "Moving a task in the calendar loses its colour", "acme/web"), ...onBoard(TODO_BOARD, "Todo"), sources: ["org:acme"] },
|
|
288
294
|
{ ...pickable(164, fields("🏝 P3 Low", "🦑 Large (1-2w)", "📱 Mobile app"), 60, "Feature", "Offline mode for time tracking"), ...onBoard(IDEAS_BOARD, "Exploring"), sources: ["org:acme"] },
|
|
289
295
|
// On a board without a status yet.
|
|
290
|
-
{ ...pickable(166, { Effort: "🐂 Medium (2-5d)", Scope: "🖌 Frontend" }, 150, "Feature", "Dark mode for the planner"), ...onBoard(IDEAS_BOARD), sources: ["org:acme"] },
|
|
296
|
+
{ ...pickable(166, { Effort: "🐂 Medium (2-5d)", Scope: "🖌 Frontend" }, 150, "Feature", "Dark mode for the planner", "acme/web"), ...onBoard(IDEAS_BOARD), sources: ["org:acme"] },
|
|
291
297
|
// On no board.
|
|
292
298
|
{ ...pickable(165, {}, 3, "Task", "Devcontainers for pull requests", "me/tool"), projectItems: { nodes: [] }, sources: ["mine"] },
|
|
293
299
|
],
|
|
@@ -300,6 +306,8 @@ export function fixture(now: Date): { data: SearchResult; details: Details } {
|
|
|
300
306
|
merged(179, "Move invoices to the new queue", 1),
|
|
301
307
|
merged(173, "Speed up the order list", 9, 174),
|
|
302
308
|
merged(175, "Remove the old importer", 16),
|
|
309
|
+
{ ...merged(194, "Statement layout", 1), body: "First of two for #152" },
|
|
310
|
+
{ ...merged(195, "Statement PDF download", 3 / 24), body: "Second of two for #152" },
|
|
303
311
|
],
|
|
304
312
|
reviewed: [
|
|
305
313
|
{ number: 190, title: "Add the VAT export", url: `https://github.com/${REPO}/pull/190`, mergedAt: daysAgo(1), mergedBy: { login: "alice" }, repository, author: alice, labels: labels("feature") },
|
|
@@ -317,8 +325,10 @@ export function fixture(now: Date): { data: SearchResult; details: Details } {
|
|
|
317
325
|
{ id: "I_188", number: 188, title: "Export fails on empty months", url: `https://github.com/${REPO}/issues/188`, closedAt: daysAgo(6 / 24), stateReason: "COMPLETED", repository, timelineItems: { nodes: [{ actor: { login: "alice" } }] } },
|
|
318
326
|
],
|
|
319
327
|
});
|
|
328
|
+
// The open issue #194 and #195 refer to, looked up after History's search [ATT-24].
|
|
329
|
+
const statements = { number: 152, title: "Customer statements as PDF", url: `https://github.com/${REPO}/issues/152`, state: "OPEN", repository, closedByPullRequestsReferences: { nodes: [] } };
|
|
320
330
|
return {
|
|
321
|
-
data,
|
|
331
|
+
data: { ...data, referenced: { [key(152)]: statements } },
|
|
322
332
|
details: {
|
|
323
333
|
behind: { [key(103)]: 1, [key(106)]: 12, [key(108)]: 139, [key(110)]: 2307, [key(114)]: 3, [key(115)]: 40 },
|
|
324
334
|
fieldOptions: { acme: { Priority: ["🌋 P0 Urgent", "🏔 P1 High", "🏕P2 Medium", "🏝 P3 Low"] } },
|
|
@@ -335,7 +345,7 @@ export function fixture(now: Date): { data: SearchResult; details: Details } {
|
|
|
335
345
|
function fixtureNow(now: Date, quiet: boolean): ReturnType<typeof fixture> {
|
|
336
346
|
const { data, details } = fixture(now);
|
|
337
347
|
if (!quiet) return { data, details };
|
|
338
|
-
const empty = Object.fromEntries(Object.entries(data).map(([key, value]) => [key, key === "viewer" ? value : { nodes: [] }]));
|
|
348
|
+
const empty = Object.fromEntries(Object.entries(data).map(([key, value]) => [key, key === "viewer" ? value : key === "referenced" ? {} : { nodes: [] }]));
|
|
339
349
|
return { data: empty as unknown as SearchResult, details };
|
|
340
350
|
}
|
|
341
351
|
|
|
@@ -381,6 +391,7 @@ export function fixtureGotIt(now: Date): string[] {
|
|
|
381
391
|
// #113 waits on CI while its Fix CI session works, though Fix CI isn't one of its actions any more.
|
|
382
392
|
// #120's was started outside Attention Span, in a workspace Paseo linked to the PR, so it has no kind [SES-08].
|
|
383
393
|
// #197's too, so it shows on its stack, led by #196 [ATT-04].
|
|
394
|
+
// #198 is asked to be reviewed again while its Review session is still open: the card opens it [REV-02].
|
|
384
395
|
const agent = (
|
|
385
396
|
id: string,
|
|
386
397
|
itemKey: string,
|
|
@@ -421,11 +432,14 @@ export const FIXTURE_AGENTS: AgentSummary[] = [
|
|
|
421
432
|
agent("agent-113", `${REPO}#113`, "fix", "running", 2),
|
|
422
433
|
agent("agent-120", `${REPO}#120`, undefined, "running", 3),
|
|
423
434
|
agent("agent-197", `${REPO}#197`, undefined, "idle", 15),
|
|
435
|
+
agent("agent-198", `${REPO}#198`, "review", "idle", 2880, false, undefined, "Review PR 198: Show shipping estimates at checkout"),
|
|
424
436
|
// Wrap up: finished work whose sessions are all idle [ATT-22].
|
|
425
437
|
agent("agent-183", `${REPO}#183`, "fix", "idle", 20, false, sessionWorkspace("retry-webhooks", false, 0), "Retry webhooks"),
|
|
426
438
|
// Its sheet counts lines and names the terminals archiving closes, as Paseo's own sheet would.
|
|
427
439
|
agent("agent-186", `${REPO}#186`, "fix", "idle", 40, false, { ...sessionWorkspace("split-invoice-pdf", true, 1, true, 2)!, dirtyLines: { added: 12, deleted: 3 }, terminals: ["dev", "shell"] }, "Split invoice PDF"),
|
|
428
440
|
agent("agent-190", `${REPO}#190`, "review", "idle", 60, false, sessionWorkspace("add-vat-export", false, 0), "Review PR 190: Add the VAT export"),
|
|
441
|
+
// On a PR under an issue Wrap up asks to close: it joins that row [ATT-24].
|
|
442
|
+
agent("agent-195", `${REPO}#195`, "fix", "idle", 10, false, sessionWorkspace("statement-pdf-download", false, 0), "Statement PDF download"),
|
|
429
443
|
// With a review sub-agent it started, archived along with it.
|
|
430
444
|
{ ...agent("agent-172", `${REPO}#172`, "fix", "idle", 240, false, sessionWorkspace("fix-vat-credit-notes", false, 0), "Fix VAT on credit notes"), subAgents: { count: 1, working: false } },
|
|
431
445
|
agent("agent-172b", `${REPO}#172`, "address", "idle", 250, false, sessionWorkspace("credit-note-tests", undefined, undefined), "Credit note tests"),
|
|
@@ -484,6 +498,8 @@ export function fixturePort(store: Store, dir: string): Port {
|
|
|
484
498
|
changes: async (ledger, _data, now) => ({ ...ledger, events: quiet() ? [] : fixtureChanges(now), gotIt: fixtureGotIt(now) }),
|
|
485
499
|
history: async (_config, now) => fixtureNow(now, quiet()).data,
|
|
486
500
|
issueFields: async () => FIXTURE_ISSUE_FIELDS,
|
|
501
|
+
// Asked issues are as History found them [ATT-24].
|
|
502
|
+
issues: async () => (quiet() ? {} : (fixture(new Date()).data.referenced ?? {})),
|
|
487
503
|
},
|
|
488
504
|
// Previews have no Paseo agents, but archiving still acknowledges, so their screenshots can show the cleanup.
|
|
489
505
|
paseo: { projectRepos: async () => [], archive: async () => ({ ok: true, kept: [] }) },
|
package/server/github-types.ts
CHANGED
|
@@ -61,7 +61,8 @@ export interface PullRequestNode {
|
|
|
61
61
|
commits: Nodes<{ commit: { committedDate: string; statusCheckRollup: { state: string } | null } }>;
|
|
62
62
|
// A person, or a team by its "org/slug"; null when it can't be seen.
|
|
63
63
|
reviewRequests: Nodes<{ requestedReviewer: RequestedReviewer | null }>;
|
|
64
|
-
|
|
64
|
+
// The commit each review was made on, so a review asked for again can start from it [REV-02].
|
|
65
|
+
latestReviews: Nodes<{ author: Actor | null; state: string; submittedAt: string | null; commit?: { oid: string } | null }>;
|
|
65
66
|
reviewThreads: Nodes<ReviewThread>;
|
|
66
67
|
comments: Nodes<Comment>;
|
|
67
68
|
}
|
|
@@ -204,6 +205,19 @@ export interface HistoryResult {
|
|
|
204
205
|
merged: Nodes<{ number: number; title: string; url: string; headRefName?: string; body?: string; mergedAt: string; mergedBy?: { login: string } | null; repository: Repo; closingIssuesReferences: Nodes<{ number: number; repository: Repo }> } & Labels>;
|
|
205
206
|
reviewed: Nodes<{ number: number; title: string; url: string; mergedAt: string; mergedBy?: { login: string } | null; repository: Repo; author: Actor | null } & Labels>;
|
|
206
207
|
closed: Nodes<{ number: number; title: string; url: string; closedAt: string; stateReason: string | null; repository: Repo; issueType?: { name: string } | null; timelineItems?: Nodes<{ actor?: { login: string } | null }> } & Labels>;
|
|
208
|
+
// Looked up after the search: "owner/name#number" -> an issue my merged PRs refer to, open or closed; PRs are left out
|
|
209
|
+
// [ATT-24]. Missing when nothing was looked up.
|
|
210
|
+
referenced?: Record<string, ReferencedIssue>;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
export interface ReferencedIssue {
|
|
214
|
+
number: number;
|
|
215
|
+
title: string;
|
|
216
|
+
url: string;
|
|
217
|
+
state: string;
|
|
218
|
+
repository: Repo;
|
|
219
|
+
// Anyone's open PRs GitHub links to it.
|
|
220
|
+
closedByPullRequestsReferences?: Nodes<{ state: string }>;
|
|
207
221
|
}
|
|
208
222
|
|
|
209
223
|
export type SearchResult = LiveResult & HistoryResult;
|
package/server/queries.ts
CHANGED
|
@@ -101,7 +101,7 @@ const FRAGMENTS: Record<string, string> = {
|
|
|
101
101
|
closingIssuesReferences(first: 5) { nodes { number title url repository { nameWithOwner } } }
|
|
102
102
|
commits(last: 1) { nodes { commit { committedDate statusCheckRollup { state } } } }
|
|
103
103
|
reviewRequests(first: 5) { nodes { requestedReviewer { ... on User { ...author } ... on Bot { ...author } ... on Team { __typename combinedSlug avatarUrl } } } }
|
|
104
|
-
latestReviews(first: 10) { nodes { author { ...author } state submittedAt } }
|
|
104
|
+
latestReviews(first: 10) { nodes { author { ...author } state submittedAt commit { oid } } }
|
|
105
105
|
reviewThreads(last: 30) {
|
|
106
106
|
nodes {
|
|
107
107
|
isResolved
|
|
@@ -257,6 +257,20 @@ export function reopenQuery(ids: string[]): string {
|
|
|
257
257
|
return `query Reopened {\n${fields.join("\n")}\n}`;
|
|
258
258
|
}
|
|
259
259
|
|
|
260
|
+
// The issues my merged PRs refer to, a batch per request: whether each is still open, and the open PRs GitHub links to
|
|
261
|
+
// it, anyone's, as a PR still open means the work isn't done [ATT-24, GH-01]. PRs answer nothing.
|
|
262
|
+
export const REFERENCED_BATCH = 50;
|
|
263
|
+
export function referencedIssuesQuery(refs: IssueRef[]): string {
|
|
264
|
+
const fields = refs.map(
|
|
265
|
+
(ref, index) => `i${index}: ${repository(ref.repo)} {
|
|
266
|
+
issueOrPullRequest(number: ${ref.number}) { ... on Issue { number title url state repository { nameWithOwner }
|
|
267
|
+
closedByPullRequestsReferences(first: 5, includeClosedPrs: false) { nodes { state } }
|
|
268
|
+
} }
|
|
269
|
+
}`,
|
|
270
|
+
);
|
|
271
|
+
return `query Referenced {\n${fields.join("\n")}\n}`;
|
|
272
|
+
}
|
|
273
|
+
|
|
260
274
|
export function prKey(node: { repository: { nameWithOwner: string }; number: number }): string {
|
|
261
275
|
return `${node.repository.nameWithOwner}#${node.number}`;
|
|
262
276
|
}
|
package/server/references.ts
CHANGED
|
@@ -68,3 +68,15 @@ export function toLookUp(prs: (Node & { body?: string; closingIssuesReferences:
|
|
|
68
68
|
for (const pr of prs) for (const ref of mentionedRefs(pr.body, pr.repository.nameWithOwner)) if (!known.has(refKey(ref))) wanted.set(refKey(ref), ref);
|
|
69
69
|
return [...wanted.values()].slice(0, max);
|
|
70
70
|
}
|
|
71
|
+
|
|
72
|
+
// The issues my merged PRs refer to that History doesn't know closed, at most `max`, to ask whether they're still open
|
|
73
|
+
// [ATT-24]. My merged PRs themselves are known to be PRs.
|
|
74
|
+
export function mergedToLookUp(merged: { number: number; body?: string; repository: { nameWithOwner: string }; closingIssuesReferences: { nodes: Node[] } }[], closed: Node[], max = 100): IssueRef[] {
|
|
75
|
+
const known = new Set([...merged, ...closed].map(nodeKey));
|
|
76
|
+
const wanted = new Map<string, IssueRef>();
|
|
77
|
+
for (const pr of merged) {
|
|
78
|
+
const linked = pr.closingIssuesReferences.nodes.map((node) => ({ repo: node.repository.nameWithOwner, number: node.number }));
|
|
79
|
+
for (const ref of [...linked, ...mentionedRefs(pr.body, pr.repository.nameWithOwner)]) if (!known.has(refKey(ref))) wanted.set(refKey(ref), ref);
|
|
80
|
+
}
|
|
81
|
+
return [...wanted.values()].slice(0, max);
|
|
82
|
+
}
|