@andrioid/paseo-attention-span 0.4.1 → 0.4.3
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/client/attention-screen.tsx +17 -13
- package/client/next-up.tsx +8 -10
- package/client/sessions.ts +2 -2
- package/docs/architecture.md +4 -4
- package/docs/screenshots/desktop-dark-doing-acknowledge.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-too-long.png +0 -0
- package/docs/screenshots/desktop-dark-doing.png +0 -0
- package/docs/screenshots/desktop-dark-history-reviewed.png +0 -0
- package/docs/screenshots/desktop-dark-history.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.png +0 -0
- package/docs/screenshots/phone-dark-doing.png +0 -0
- package/docs/screenshots/phone-light-next-up-filtered.png +0 -0
- package/package.json +1 -1
- package/requirements.yaml +1 -1
- package/server/classify.ts +63 -38
- package/server/context.ts +19 -6
- package/server/details.ts +4 -2
- package/server/fixture.ts +9 -1
- package/shared/attention.ts +21 -2
- package/shared/prompts.ts +31 -6
|
@@ -4,7 +4,7 @@ import { Markdown, Modal, TextInput, useToast } from "@getpaseo/plugin/client/ui
|
|
|
4
4
|
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
|
5
5
|
import { type ReactNode, useState } from "react";
|
|
6
6
|
import { Pressable, ScrollView, Text, View } from "react-native";
|
|
7
|
-
import { type ActionId, type AgentSummary, type AttentionView, type Chip, type FailingChecks, type Item, itemSessions, liftActive, looseSessions, type NextUpIssue, type Reviewer, type Section, type SectionId, SECTIONS, type SubRow, TAB_FEED, type TabId, type Target, type WaitingGroup, type WaitingOn } from "../shared/attention";
|
|
7
|
+
import { type ActionId, type AgentSummary, type AttentionView, type Chip, checkoutPr, type FailingChecks, type Item, itemSessions, liftActive, looseSessions, type NextUpIssue, ownStack, type Reviewer, type Section, type SectionId, SECTIONS, type SubRow, TAB_FEED, type TabId, type Target, type WaitingGroup, type WaitingOn } from "../shared/attention";
|
|
8
8
|
import { type AttentionConfig, nextUpSources, type SessionKind } from "../shared/config";
|
|
9
9
|
import { ago, linkList, repoLabel } from "../shared/format";
|
|
10
10
|
import { ACTION_SESSION, renderPrompt } from "../shared/prompts";
|
|
@@ -42,11 +42,12 @@ const ACTION_ICONS: Record<ActionId, IconName> = {
|
|
|
42
42
|
};
|
|
43
43
|
|
|
44
44
|
function actionLabel(action: ActionId, item: Item): string {
|
|
45
|
-
|
|
45
|
+
// Review takes the whole stack; Rebase, my PRs in it [ATT-04].
|
|
46
|
+
const stacked = ownStack(item.target).length > 1;
|
|
46
47
|
return {
|
|
47
48
|
reply: "Reply ↗",
|
|
48
49
|
acknowledge: "Acknowledge",
|
|
49
|
-
review: "Review",
|
|
50
|
+
review: (item.target.stack?.length ?? 0) > 1 ? "Review stack" : "Review",
|
|
50
51
|
fix: "Fix CI",
|
|
51
52
|
rerun: "Rerun failed jobs",
|
|
52
53
|
address: "Address comments",
|
|
@@ -67,13 +68,17 @@ function actionDetail(action: Exclude<ActionId, "rerun">, item: Item): string {
|
|
|
67
68
|
const { target } = item;
|
|
68
69
|
const pr = `#${target.number}`;
|
|
69
70
|
const base = target.baseRefName ?? target.defaultBranch ?? "its base";
|
|
70
|
-
const stacked = (target.
|
|
71
|
+
const stacked = ownStack(target).length > 1;
|
|
72
|
+
const asking = (target.stack ?? []).filter((p) => p.review);
|
|
71
73
|
const comments = item.person?.comments ?? [];
|
|
72
74
|
return {
|
|
73
75
|
reply: item.person ? `Opens ${item.person.login}'s comment on GitHub` : "Opens it on GitHub",
|
|
74
76
|
acknowledge:
|
|
75
77
|
comments.length === 1 ? `Reacts to ${comments[0].author}'s comment, which clears it` : `Pick which of the ${comments.length} waiting comments to react to`,
|
|
76
|
-
review:
|
|
78
|
+
review:
|
|
79
|
+
(target.stack?.length ?? 0) > 1
|
|
80
|
+
? `An agent reviews ${asking.map((p) => `#${p.number}`).join(", ") || "the stack"} in a checkout of the stack's top and reports back. Nothing is posted`
|
|
81
|
+
: "An agent reviews the PR in a checkout and reports back. Nothing is posted",
|
|
77
82
|
fix: "An agent reads the failing logs and commits a fix, without pushing",
|
|
78
83
|
address: "An agent works through the unresolved comments and applies the trivial ones, without pushing",
|
|
79
84
|
update: `GitHub rebases ${pr} onto ${base}`,
|
|
@@ -428,15 +433,14 @@ function AttentionList({
|
|
|
428
433
|
unclaimed={view.unclaimed}
|
|
429
434
|
unclaimedFrom={view.unclaimedFrom}
|
|
430
435
|
selected={view.scopes}
|
|
431
|
-
onSelect={(scopes) => {
|
|
432
|
-
attention.setView({ ...view, scopes });
|
|
433
|
-
saveScopes({ scopes }).catch((error) => toast.error(`Saving the filter failed: ${(error as Error).message}`));
|
|
434
|
-
}}
|
|
435
436
|
sources={nextUpSources(view.config)}
|
|
436
437
|
selectedSources={view.sources}
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
438
|
+
// One setView for both, so clearing scopes and sources together can't put either back.
|
|
439
|
+
onFilter={(change) => {
|
|
440
|
+
attention.setView({ ...view, ...change });
|
|
441
|
+
const failed = (error: Error) => toast.error(`Saving the filter failed: ${error.message}`);
|
|
442
|
+
if (change.scopes) saveScopes({ scopes: change.scopes }).catch(failed);
|
|
443
|
+
if (change.sources) saveSources({ sources: change.sources }).catch(failed);
|
|
440
444
|
}}
|
|
441
445
|
agents={actions.agents}
|
|
442
446
|
login={view.login}
|
|
@@ -1138,7 +1142,7 @@ function SessionOptions({ spec, actions, onClose }: { spec: OptionsSpec; actions
|
|
|
1138
1142
|
// Without a ready provider, still show the options; starting reports the error.
|
|
1139
1143
|
resolveAgentConfig(paseo, actions.fetchProviders, kind, actions.config).catch(() => ({ label: "No agent provider is ready" })),
|
|
1140
1144
|
]);
|
|
1141
|
-
const workspaces = checkout.project ? await branchWorkspaces(paseo, checkout.project.projectId, target.
|
|
1145
|
+
const workspaces = checkout.project ? await branchWorkspaces(paseo, checkout.project.projectId, checkoutPr(kind, target).head) : [];
|
|
1142
1146
|
return { prompt: renderPrompt(kind, target, context, actions.config), profiles, checkout, workspaces, defaultLabel: defaults.label };
|
|
1143
1147
|
},
|
|
1144
1148
|
staleTime: 60_000,
|
package/client/next-up.tsx
CHANGED
|
@@ -21,11 +21,11 @@ interface Props {
|
|
|
21
21
|
unclaimedFrom: UnclaimedSource;
|
|
22
22
|
// Scopes I ticked in the filter; none means all [NXT-03].
|
|
23
23
|
selected: string[];
|
|
24
|
-
onSelect: (scopes: string[]) => void;
|
|
25
24
|
// Where Next up looks, and the sources I ticked; none means all [NXT-09].
|
|
26
25
|
sources: NextUpSource[];
|
|
27
26
|
selectedSources: string[];
|
|
28
|
-
|
|
27
|
+
// Change either filter or both at once, so Clear empties both in one go.
|
|
28
|
+
onFilter: (change: { scopes?: string[]; sources?: string[] }) => void;
|
|
29
29
|
agents: AgentSummary[];
|
|
30
30
|
// Mine, so my repos show without the owner.
|
|
31
31
|
login: string | null;
|
|
@@ -41,10 +41,10 @@ interface Props {
|
|
|
41
41
|
onOpenAgent: (agentId: string) => void;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
type RowProps = Omit<Props, "assigned" | "unclaimed" | "unclaimedFrom" | "selected" | "
|
|
44
|
+
type RowProps = Omit<Props, "assigned" | "unclaimed" | "unclaimedFrom" | "selected" | "sources" | "selectedSources" | "onFilter">;
|
|
45
45
|
|
|
46
46
|
// Assigned issues first [NXT-06], then unclaimed ones [NXT-01]; both already ranked by the server [NXT-02].
|
|
47
|
-
export function NextUpList({ assigned, unclaimed, unclaimedFrom, selected,
|
|
47
|
+
export function NextUpList({ assigned, unclaimed, unclaimedFrom, selected, sources, selectedSources, onFilter, ...rowProps }: Props) {
|
|
48
48
|
const styles = useStyles();
|
|
49
49
|
const scopes = useMemo(() => [...new Set(unclaimed.map((issue) => issue.scope).filter((scope): scope is string => !!scope))].sort(), [unclaimed]);
|
|
50
50
|
// Filter by the scopes I picked last time [NXT-03]; a picked scope with no issues left is ignored.
|
|
@@ -54,8 +54,8 @@ export function NextUpList({ assigned, unclaimed, unclaimedFrom, selected, onSel
|
|
|
54
54
|
const shown = unclaimed.filter(
|
|
55
55
|
(issue) => (active.length === 0 || (issue.scope && active.includes(issue.scope))) && (activeSources.length === 0 || issue.sources.some((id) => activeSources.includes(id))),
|
|
56
56
|
);
|
|
57
|
-
const toggle = (scope: string) =>
|
|
58
|
-
const toggleSource = (id: string) =>
|
|
57
|
+
const toggle = (scope: string) => onFilter({ scopes: active.includes(scope) ? active.filter((s) => s !== scope) : [...active, scope] });
|
|
58
|
+
const toggleSource = (id: string) => onFilter({ sources: activeSources.includes(id) ? activeSources.filter((s) => s !== id) : [...activeSources, id] });
|
|
59
59
|
const narrowedBy = [activeSources.length ? "sources" : null, active.length ? "scopes" : null].filter(Boolean).join(" and ");
|
|
60
60
|
const [filtering, setFiltering] = useState(false);
|
|
61
61
|
const picked = active.length + activeSources.length;
|
|
@@ -92,10 +92,7 @@ export function NextUpList({ assigned, unclaimed, unclaimedFrom, selected, onSel
|
|
|
92
92
|
{filtering ? (
|
|
93
93
|
<FilterSheet
|
|
94
94
|
groups={groups}
|
|
95
|
-
onClear={() => {
|
|
96
|
-
onSelect([]);
|
|
97
|
-
onSelectSources([]);
|
|
98
|
-
}}
|
|
95
|
+
onClear={() => onFilter({ scopes: [], sources: [] })}
|
|
99
96
|
onClose={() => setFiltering(false)}
|
|
100
97
|
/>
|
|
101
98
|
) : null}
|
|
@@ -154,6 +151,7 @@ function FilterOption({ label, checked, first, onPress }: { label: string; check
|
|
|
154
151
|
<Pressable
|
|
155
152
|
accessibilityRole="checkbox"
|
|
156
153
|
accessibilityState={{ checked }}
|
|
154
|
+
aria-checked={checked}
|
|
157
155
|
accessibilityLabel={label}
|
|
158
156
|
onPress={onPress}
|
|
159
157
|
{...hover}
|
package/client/sessions.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { usePaseo } from "@getpaseo/plugin/client";
|
|
2
|
-
import type
|
|
2
|
+
import { type AgentSummary, checkoutPr, type Target } from "../shared/attention";
|
|
3
3
|
import { linkedSessions } from "../shared/linked-sessions";
|
|
4
4
|
import { chooseAgent, type ReadyProvider } from "../shared/providers";
|
|
5
5
|
import { type AttentionConfig, codeRepoFor, githubRepoOf, SessionKind } from "../shared/config";
|
|
@@ -176,7 +176,7 @@ export async function startSession(paseo: Paseo, input: StartSession): Promise<s
|
|
|
176
176
|
cwd: project.rootPath,
|
|
177
177
|
projectId: project.projectId,
|
|
178
178
|
action: "checkout",
|
|
179
|
-
checkoutSource: { kind: "change_request", forge: "github", number: target.number },
|
|
179
|
+
checkoutSource: { kind: "change_request", forge: "github", number: checkoutPr(input.kind, target).number },
|
|
180
180
|
}
|
|
181
181
|
: {
|
|
182
182
|
kind: "worktree",
|
package/docs/architecture.md
CHANGED
|
@@ -81,7 +81,7 @@ Top to bottom. Each item appears once, under its most urgent reason [ATT-02]. `s
|
|
|
81
81
|
## Rules
|
|
82
82
|
|
|
83
83
|
- **One item per issue** [ATT-03]: PRs are grouped under the issue they work on, across repos. GitHub links (`closingIssuesReferences`) only PRs into the default branch, so a stack's upper PRs are read too. For a stack, strongest evidence first: what GitHub links on any of its PRs, bottom first; then a closing keyword ("Closes #N") in any PR's description; then the one issue the bottom PR's description mentions ("First of three for #N"), and none when it mentions several. Code, quotes and template comments don't count. References from descriptions are looked up in the details request, and only open issues count, so a reference to a PR doesn't group. A PR without an issue is its own item. History does the same per merged PR, against the closed issues it lists.
|
|
84
|
-
- **One item per stack** [ATT-04]: a stack is followed through base/head branch names.
|
|
84
|
+
- **One item per stack** [ATT-04]: a stack is followed through base/head branch names, among my PRs and others' PRs requesting my review, whoever opened them; a PR from a fork never parents another. Only PRs those two searches return can be joined, so a PR in the stack that's neither mine nor asking for my review is left out. The item is led by the stack's bottom PR, with the rest listed beneath. My PRs in it are decided by their bottom PR, as before; others' PRs asking for my review add one Review for all of them, or a reply when one mentions me. Where a stack has both, its section is the more urgent of the two and it offers both, that one's actions first. GitHub actions act on my PRs, from my bottom one; a stack only asking for my review is never grouped under an issue. Sessions on any PR in the stack show on its item [SES-03, SES-08].
|
|
85
85
|
- **Answers** [ATT-16]: on an issue a PR of mine closes, an answer leads the item like a mention does. From the issue itself only what's on me counts; its PRs say how the work is going.
|
|
86
86
|
- **Mentions** [MEN-01..06]: a thread counts when a person @-mentioned me after my last comment, review or reaction there. Team mentions are ignored. A bot counts only when it opened a thread I need to resolve, and is marked with 🤖. The quote on a card is cut around the mention, so it's shown as plain text: links keep their text, Markdown marks and quoted replies go.
|
|
87
87
|
- **Handed over** [PRS-08]: my PRs assigned to someone else, and not to me, are left out. Mentions of me on them still count.
|
|
@@ -113,11 +113,11 @@ An agent icon (Tabler's `message-ai`, a speech bubble with "AI") marks every act
|
|
|
113
113
|
|---|---|---|
|
|
114
114
|
| Reply ↗ | Mention waiting | Opens the comment on GitHub [ATT-12] |
|
|
115
115
|
| Acknowledge | Mention waiting | Lists every waiting comment in full, rendered as Markdown with Paseo's renderer (cut after whole blocks, up to about 4,000 characters), all ticked; 👍 on the ones I keep ticked (`addReaction`), which clears them [MEN-07]. Undo removes them. |
|
|
116
|
-
| Review *(agent)* | Review requested | Session in a PR checkout using the review profile [SES-01] |
|
|
116
|
+
| Review *(agent)* | Review requested | Session in a PR checkout using the review profile [SES-01]. For a stack, "Review stack": one session in a checkout of the stack's top, whose prompt lists every branch and asks for a review of only the PRs requesting mine, each against its own base, with their descriptions and recent comments as context [ATT-04] |
|
|
117
117
|
| Fix CI / Address comments *(agent)* | CI failing / changes requested | Session with the failing log or unresolved threads in the prompt [SES-04] |
|
|
118
|
-
| Rerun failed jobs | CI failing, in the sheet | `gh run rerun --failed` for each failing GitHub Actions run of the PR, or of every PR in its stack. The sheet names the failed checks and how often they were rerun (`gh api …/runs/<id>`), fetched when it opens. Other status checks can't be rerun from here [PRS-09]. |
|
|
118
|
+
| Rerun failed jobs | CI failing, in the sheet | `gh run rerun --failed` for each failing GitHub Actions run of the PR, or of every PR of mine in its stack. The sheet names the failed checks and how often they were rerun (`gh api …/runs/<id>`), fetched when it opens. Other status checks can't be rerun from here [PRS-09]. |
|
|
119
119
|
| Update branch | Behind with no conflicts, not stacked | `updatePullRequestBranch` (rebase) [UPS-03] |
|
|
120
|
-
| Rebase / Refresh *(agent)* | Conflicts, any stacked PR, stale draft | Agent rebases the PR, or the
|
|
120
|
+
| Rebase / Refresh *(agent)* | Conflicts, any stacked PR, stale draft | Agent rebases the PR, or my PRs in the stack with `git rebase --update-refs`; others' branches in it are never pushed [UPS-04]. A clean rebase is pushed with `--force-with-lease` [UPS-06]. After resolving conflicts it stops and explains, and pushes only when I reply "push" in its session [UPS-05]. |
|
|
121
121
|
| Ready for review | My draft with CI not failing, no conflicts, not stale | `markPullRequestReadyForReview` on the bottom PR, then the reviewer picker below; Skip leaves it in *Needs a reviewer*. Undo converts it back to a draft [PRS-11] |
|
|
122
122
|
| Request review | Needs a reviewer | Opens a picker: GitHub's `suggestedReviewers` and the repo's teams (`gh api repos/<repo>/teams`), fetched when it opens; people who reviewed or were asked on my other PRs in the repo, from the last refresh; or any login or `org/team` typed in. Without `read:org` the teams are replaced by a line saying so. Sends `POST …/pulls/<n>/requested_reviewers`, which keeps who's already asked; Undo withdraws them with `DELETE` [PRS-12] |
|
|
123
123
|
| Merge (no reviewer) | Needs a reviewer, CI green on the current base | As Merge below, for repos where nobody reviews [PRS-12] |
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@andrioid/paseo-attention-span",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3",
|
|
4
4
|
"description": "For when your attention is spread thin: the GitHub issues and pull requests waiting on you, grouped by why, with one-tap Paseo sessions.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
package/requirements.yaml
CHANGED
|
@@ -21,7 +21,7 @@ functional:
|
|
|
21
21
|
ATT-01: see in one place the open issues and pull requests that need me; so that I don't depend on noisy GitHub notifications.
|
|
22
22
|
ATT-02: see why each item needs me, with items grouped by that reason; so that I know what to do about an item at a glance.
|
|
23
23
|
ATT-03: see an issue and the pull requests that resolve it as one item, led by the issue; so that related work isn't scattered across the list.
|
|
24
|
-
ATT-04: see
|
|
24
|
+
ATT-04: see any stack of dependent pull requests as one item, whoever opened them, with a session on any of its pull requests shown on it and, where my review is requested, one review for the whole stack; so that a stack is handled as the single change it is.
|
|
25
25
|
ATT-05: judge an item from the list without opening it; so that triage is quick and I'm not visually overloaded.
|
|
26
26
|
ATT-06: open an item for more detail and every action, each saying what it will do; so that the list stays minimal by default and pressing a button makes sense.
|
|
27
27
|
ATT-07: see whether an item already has a Paseo session and what its agent is doing; so that I don't start duplicate work.
|
package/server/classify.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
type ActionId,
|
|
2
3
|
type Attention,
|
|
3
4
|
type Chip,
|
|
4
5
|
type Item,
|
|
@@ -29,6 +30,17 @@ export interface ClassifyInput {
|
|
|
29
30
|
now: Date;
|
|
30
31
|
}
|
|
31
32
|
|
|
33
|
+
// My PRs in a stack, or others' asking for my review: what each says about the stack's item [ATT-04].
|
|
34
|
+
interface Part {
|
|
35
|
+
section: SectionId;
|
|
36
|
+
actions: ActionId[];
|
|
37
|
+
chips: Chip[];
|
|
38
|
+
person?: Person;
|
|
39
|
+
waitingOn?: WaitingOn[];
|
|
40
|
+
wait?: Item["wait"];
|
|
41
|
+
othersActivityAt: string;
|
|
42
|
+
}
|
|
43
|
+
|
|
32
44
|
const EPOCH = "1970-01-01T00:00:00Z";
|
|
33
45
|
const rank = (section: SectionId) => SECTION_ORDER.indexOf(section);
|
|
34
46
|
// Section order, then newest first.
|
|
@@ -71,8 +83,15 @@ export function classify({ data, details, config, now }: ClassifyInput): Attenti
|
|
|
71
83
|
// My PRs, minus those handed over to someone else [PRS-08].
|
|
72
84
|
const mine = compact(data.mine.nodes).filter((pr) => pr.assignees.nodes.length === 0 || pr.assignees.nodes.some(isMe));
|
|
73
85
|
|
|
74
|
-
//
|
|
75
|
-
const
|
|
86
|
+
// Others' PRs asking for my review [REV-01]. A PR of mine is mine, even if it asks me too.
|
|
87
|
+
const ownKeys = new Set(mine.map(prKey));
|
|
88
|
+
const requests = compact(data.reviews.nodes).filter((pr) => !ownKeys.has(prKey(pr)));
|
|
89
|
+
const isOwn = (pr: PullRequestNode) => ownKeys.has(prKey(pr));
|
|
90
|
+
|
|
91
|
+
// Stacks, followed through base/head branch names, among my PRs and those asking for my review, whoever opened them [ATT-04].
|
|
92
|
+
// A fork's branch isn't the repo's, so a PR from a fork is never a parent.
|
|
93
|
+
const prs = [...mine, ...requests];
|
|
94
|
+
const byHead = new Map(prs.filter((pr) => !pr.isCrossRepository).map((pr) => [`${pr.repository.nameWithOwner}\0${pr.headRefName}`, pr]));
|
|
76
95
|
const parentOf = (pr: PullRequestNode) => {
|
|
77
96
|
const parent = byHead.get(`${pr.repository.nameWithOwner}\0${pr.baseRefName}`);
|
|
78
97
|
return parent === pr ? undefined : parent;
|
|
@@ -83,9 +102,9 @@ export function classify({ data, details, config, now }: ClassifyInput): Attenti
|
|
|
83
102
|
if (seen.has(pr)) return;
|
|
84
103
|
seen.add(pr);
|
|
85
104
|
stack.push(pr);
|
|
86
|
-
for (const child of
|
|
105
|
+
for (const child of prs.filter((candidate) => parentOf(candidate) === pr)) walk(child, stack);
|
|
87
106
|
};
|
|
88
|
-
const byNumber = [...
|
|
107
|
+
const byNumber = [...prs].sort((a, b) => a.number - b.number);
|
|
89
108
|
for (const pr of byNumber) if (!parentOf(pr)) stacks.push([]), walk(pr, stacks[stacks.length - 1]);
|
|
90
109
|
for (const pr of byNumber) if (!seen.has(pr)) stacks.push([pr]); // cycles, in theory
|
|
91
110
|
|
|
@@ -141,8 +160,8 @@ export function classify({ data, details, config, now }: ClassifyInput): Attenti
|
|
|
141
160
|
const items: Item[] = [];
|
|
142
161
|
const listed = new Set<string>();
|
|
143
162
|
|
|
144
|
-
//
|
|
145
|
-
const
|
|
163
|
+
// My PRs in a stack, decided by their bottom PR [ATT-04].
|
|
164
|
+
const ownPart = (stack: PullRequestNode[]): Part => {
|
|
146
165
|
const bottom = stack[0];
|
|
147
166
|
const s = state(bottom);
|
|
148
167
|
const outOfSync = stack.slice(1).some((pr) => state(pr).outOfSync || state(pr).conflicts);
|
|
@@ -208,10 +227,8 @@ export function classify({ data, details, config, now }: ClassifyInput): Attenti
|
|
|
208
227
|
else if (section === "ready" && s.behindBy === 0) chips.push(chip(s.optionalPending ? "required checks passed" : "CI passed", "good"));
|
|
209
228
|
if (s.conflicts) chips.push(chip("conflicts", "bad"));
|
|
210
229
|
if (s.behindBy > 0) chips.push(behindChip(s.behindBy, base));
|
|
211
|
-
if (stack.length > 1) chips.push(chip(`stack of ${stack.length}`));
|
|
212
230
|
|
|
213
231
|
return {
|
|
214
|
-
stack,
|
|
215
232
|
section,
|
|
216
233
|
actions,
|
|
217
234
|
chips,
|
|
@@ -224,6 +241,36 @@ export function classify({ data, details, config, now }: ClassifyInput): Attenti
|
|
|
224
241
|
waitingOn: waitingOn.length > 0 ? waitingOn : undefined,
|
|
225
242
|
othersActivityAt: latest(...stack.map((pr) => state(pr).othersActivityAt), waiting?.since, answer?.since),
|
|
226
243
|
};
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
// Others' PRs in a stack that ask for my review: one Review for them all [REV-01, ATT-04].
|
|
247
|
+
const reviewPart = (stack: PullRequestNode[]): Part => {
|
|
248
|
+
const waiting = stack.map((pr) => mentions.get(prKey(pr))).find(Boolean);
|
|
249
|
+
const lastCommitAt = latest(...stack.map((pr) => state(pr).lastCommitAt));
|
|
250
|
+
return {
|
|
251
|
+
section: waiting ? "reply" : "review",
|
|
252
|
+
actions: waiting ? [...replyActions(waiting), "review"] : ["review"],
|
|
253
|
+
chips: stack.some((pr) => state(pr).ciFailing) ? [chip("CI failing", "bad")] : [],
|
|
254
|
+
person: waiting ?? person(stack[0].author, lastCommitAt),
|
|
255
|
+
othersActivityAt: latest(...stack.map((pr) => state(pr).othersActivityAt), lastCommitAt, waiting?.since),
|
|
256
|
+
};
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
// One unit per stack (or single PR), whoever opened it. Where it has both, its section is the more urgent of my PRs' and
|
|
260
|
+
// the review's, and it offers both, the winner's actions first [ATT-04].
|
|
261
|
+
const units = stacks.map((stack) => {
|
|
262
|
+
const own = stack.filter(isOwn);
|
|
263
|
+
const asking = stack.filter((pr) => !isOwn(pr));
|
|
264
|
+
const parts = [own.length ? ownPart(own) : undefined, asking.length ? reviewPart(asking) : undefined].filter((part) => !!part);
|
|
265
|
+
const [lead, other] = parts.sort((a, b) => rank(a.section) - rank(b.section));
|
|
266
|
+
return {
|
|
267
|
+
...lead,
|
|
268
|
+
stack,
|
|
269
|
+
own,
|
|
270
|
+
actions: [...new Set([...lead.actions, ...(other?.actions ?? [])])],
|
|
271
|
+
chips: [...lead.chips, ...(stack.length > 1 ? [chip(`stack of ${stack.length}`)] : [])],
|
|
272
|
+
othersActivityAt: latest(lead.othersActivityAt, other?.othersActivityAt),
|
|
273
|
+
};
|
|
227
274
|
});
|
|
228
275
|
type Unit = (typeof units)[number];
|
|
229
276
|
|
|
@@ -233,7 +280,8 @@ export function classify({ data, details, config, now }: ClassifyInput): Attenti
|
|
|
233
280
|
const chips: Chip[] = [];
|
|
234
281
|
if (stack.length > 1) chips.push(chip(`${index + 1}/${stack.length}`));
|
|
235
282
|
if (s.approved) chips.push(chip("approved", "good"));
|
|
236
|
-
|
|
283
|
+
// Only mine are mine to ask someone on [PRS-12].
|
|
284
|
+
if (isOwn(pr) && !pr.isDraft && !s.asked) chips.push(chip("no reviewer", "warn"));
|
|
237
285
|
if (s.ciFailing) chips.push(chip("CI failing", "bad"));
|
|
238
286
|
if (s.conflicts) chips.push(chip("conflicts", "bad"));
|
|
239
287
|
if (s.behindBy > 0) chips.push(behindChip(s.behindBy, parent ? `#${parent.number}` : pr.baseRefName));
|
|
@@ -252,16 +300,17 @@ export function classify({ data, details, config, now }: ClassifyInput): Attenti
|
|
|
252
300
|
headRefOid: pr.headRefOid,
|
|
253
301
|
defaultBranch: pr.repository.defaultBranchRef?.name,
|
|
254
302
|
mergeMethod: mergeMethodFor(pr, config),
|
|
255
|
-
stack: stack.map((p) => ({ number: p.number, head: p.headRefName, base: p.baseRefName })),
|
|
303
|
+
stack: stack.map((p) => ({ number: p.number, head: p.headRefName, base: p.baseRefName, ...(isOwn(p) ? {} : { review: true as const }) })),
|
|
256
304
|
});
|
|
257
305
|
|
|
258
|
-
// One item per issue: PRs grouped under the issue they work on [ATT-03]. Otherwise one per unit.
|
|
306
|
+
// One item per issue: my PRs grouped under the issue they work on [ATT-03]. Otherwise one per unit, led by its bottom PR.
|
|
259
307
|
const issues = new Map(Object.entries(details.issues));
|
|
260
308
|
for (const pr of mine) for (const issue of pr.closingIssuesReferences.nodes) issues.set(prKey(issue), issue);
|
|
261
309
|
const groups = new Map<string, { lead?: LinkedIssue; units: Unit[] }>();
|
|
262
310
|
for (const unit of units) {
|
|
263
311
|
const prs = unit.stack.map((pr) => ({ repo: pr.repository.nameWithOwner, body: pr.body, linked: pr.closingIssuesReferences.nodes.map(prKey) }));
|
|
264
|
-
|
|
312
|
+
// Only my work goes under an issue; a stack only asking for my review stays a pull request [REV-01].
|
|
313
|
+
const issue = unit.own.length > 0 ? issueFor(prs, (key) => issues.has(key)) : undefined;
|
|
265
314
|
const key = issue ?? prKey(unit.stack[0]);
|
|
266
315
|
groups.set(key, { lead: issue ? issues.get(issue) : undefined, units: [...(groups.get(key)?.units ?? []), unit] });
|
|
267
316
|
}
|
|
@@ -290,36 +339,12 @@ export function classify({ data, details, config, now }: ClassifyInput): Attenti
|
|
|
290
339
|
wait: issueWaiting ? undefined : unit.wait,
|
|
291
340
|
actions: issueWaiting ? replyActions(issueWaiting) : unit.actions,
|
|
292
341
|
children: lead ? grouped.flatMap((u) => u.stack.map((pr, i) => subRow(pr, i, u.stack))) : unit.stack.slice(1).map((pr, i) => subRow(pr, i + 1, unit.stack)),
|
|
293
|
-
|
|
342
|
+
// Actions on GitHub act on my PRs, from my bottom one; Review checks out the top of the stack [ATT-04].
|
|
343
|
+
target: target(unit.own[0] ?? bottom, unit.stack),
|
|
294
344
|
othersActivityAt: latest(...grouped.map((u) => u.othersActivityAt), issueWaiting?.since),
|
|
295
345
|
});
|
|
296
346
|
}
|
|
297
347
|
|
|
298
|
-
// Review requests [REV-01].
|
|
299
|
-
for (const pr of compact(data.reviews.nodes)) {
|
|
300
|
-
const key = prKey(pr);
|
|
301
|
-
if (listed.has(key)) continue;
|
|
302
|
-
listed.add(key);
|
|
303
|
-
const s = state(pr);
|
|
304
|
-
const waiting = mentions.get(key);
|
|
305
|
-
items.push({
|
|
306
|
-
key,
|
|
307
|
-
section: waiting ? "reply" : "review",
|
|
308
|
-
kind: "pr",
|
|
309
|
-
draft: pr.isDraft,
|
|
310
|
-
repo: pr.repository.nameWithOwner,
|
|
311
|
-
number: pr.number,
|
|
312
|
-
title: pr.title,
|
|
313
|
-
url: pr.url,
|
|
314
|
-
chips: s.ciFailing ? [chip("CI failing", "bad")] : [],
|
|
315
|
-
person: waiting ?? person(pr.author, s.lastCommitAt),
|
|
316
|
-
actions: waiting ? [...replyActions(waiting), "review"] : ["review"],
|
|
317
|
-
children: [],
|
|
318
|
-
target: target(pr, [pr]),
|
|
319
|
-
othersActivityAt: latest(s.othersActivityAt, s.lastCommitAt, waiting?.since),
|
|
320
|
-
});
|
|
321
|
-
}
|
|
322
|
-
|
|
323
348
|
// Remaining mentions, including other people's drafts [MEN-03].
|
|
324
349
|
for (const node of compact(data.mentions.nodes)) {
|
|
325
350
|
const key = prKey(node);
|
package/server/context.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { ownStack, type StackPr, type Target } from "../shared/attention";
|
|
2
2
|
import type { SessionKind } from "../shared/config";
|
|
3
3
|
import { graphql, runGh } from "./gh";
|
|
4
4
|
|
|
@@ -21,16 +21,29 @@ async function ghJson<T>(args: string[]): Promise<T> {
|
|
|
21
21
|
|
|
22
22
|
export async function sessionContext(kind: SessionKind, target: Target): Promise<string> {
|
|
23
23
|
const ref = [String(target.number), "--repo", target.repo];
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return `Branches, bottom first:\n${stack.map((pr) => `- #${pr.number}: ${pr.head} (on ${pr.base})`).join("\n")}`;
|
|
27
|
-
}
|
|
24
|
+
// Only my branches are rebased and pushed, never others' in the same stack [ATT-04].
|
|
25
|
+
if (kind === "rebase" || kind === "refresh") return `Branches, bottom first:\n${ownStack(target).map(branchLine).join("\n")}`;
|
|
28
26
|
if (kind === "fix") return failingChecks(ref, target.repo);
|
|
29
27
|
if (kind === "address") return reviewFeedback(target);
|
|
30
28
|
|
|
29
|
+
// Review of a stack: every branch, and the description and latest comments of each PR asking for my review [ATT-04].
|
|
30
|
+
const stack = target.stack ?? [];
|
|
31
|
+
if (kind === "review" && stack.length > 1) {
|
|
32
|
+
const asking = stack.filter((pr) => pr.review);
|
|
33
|
+
const lines = stack.map((pr) => `${branchLine(pr)}${pr.review ? ", review requested" : ", mine"}`);
|
|
34
|
+
const prs = await Promise.all(asking.map(async (pr) => `#${pr.number}\n${await conversation([String(pr.number), "--repo", target.repo], "pr")}`));
|
|
35
|
+
return [`Stack, bottom first:\n${lines.join("\n")}`, ...prs].join("\n\n");
|
|
36
|
+
}
|
|
37
|
+
|
|
31
38
|
// review, start: the description and the latest comments.
|
|
39
|
+
return conversation(ref, target.kind);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const branchLine = (pr: StackPr) => `- #${pr.number}: ${pr.head} (on ${pr.base})`;
|
|
43
|
+
|
|
44
|
+
async function conversation(ref: string[], kind: Target["kind"]): Promise<string> {
|
|
32
45
|
type View = { body: string; comments: { author: { login: string }; body: string }[] };
|
|
33
|
-
const view = await ghJson<View>([
|
|
46
|
+
const view = await ghJson<View>([kind === "pr" ? "pr" : "issue", "view", ...ref, "--json", "body,comments"]);
|
|
34
47
|
const comments = view.comments.slice(-5).map((c) => `@${c.author.login}: ${clip(c.body, 800)}`);
|
|
35
48
|
return [`Description:\n${clip(view.body) || "(empty)"}`, comments.length ? `Recent comments:\n${comments.join("\n\n")}` : ""].filter(Boolean).join("\n\n");
|
|
36
49
|
}
|
package/server/details.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type FailingChecks, type ItemDetails, ownStack, type Target } from "../shared/attention";
|
|
2
2
|
import { graphql, runGh } from "./gh";
|
|
3
3
|
|
|
4
4
|
// What an item's sheet shows beyond the card, fetched when it opens [ATT-06, GH-01].
|
|
@@ -32,7 +32,9 @@ const repository = (repo: string) => {
|
|
|
32
32
|
// One GraphQL request, plus one REST call per failing workflow run for its attempt number.
|
|
33
33
|
export async function itemDetails(subject: Subject, target: Target | undefined, checks: boolean): Promise<ItemDetails> {
|
|
34
34
|
const pr = target?.kind === "pr" ? target : undefined;
|
|
35
|
-
|
|
35
|
+
// Rerun covers my PRs in the stack, not others' asking for my review [ATT-04].
|
|
36
|
+
const mine = pr ? ownStack(pr) : [];
|
|
37
|
+
const numbers = pr ? (checks && mine.length > 0 ? mine.map((p) => p.number) : [pr.number]) : [];
|
|
36
38
|
const contexts = `commits(last: 1) { nodes { commit { statusCheckRollup { contexts(first: 100) { nodes {
|
|
37
39
|
__typename
|
|
38
40
|
... on CheckRun { name conclusion checkSuite { workflowRun { databaseId } } }
|
package/server/fixture.ts
CHANGED
|
@@ -174,7 +174,13 @@ export function fixture(now: Date): { data: SearchResult; details: Details } {
|
|
|
174
174
|
pr(128, { title: "Lazy-load product images", reviewDecision: "APPROVED", mergeStateStatus: "UNSTABLE" }, "FAILURE"),
|
|
175
175
|
pr(129, { title: "Compress API responses", reviewDecision: "APPROVED", mergeStateStatus: "UNSTABLE" }, "PENDING"),
|
|
176
176
|
],
|
|
177
|
-
reviews: [
|
|
177
|
+
reviews: [
|
|
178
|
+
pr(120, { title: "Add a status page", author: bob }),
|
|
179
|
+
pr(121, { title: "Rework the cart totals", author: alice }),
|
|
180
|
+
// Bob's stack asking for my review: one item with one Review [ATT-04].
|
|
181
|
+
pr(196, { title: "Price rules: data model", author: bob, headRefName: "rules-1", commits: commit("SUCCESS", 0.4) }),
|
|
182
|
+
pr(197, { title: "Price rules: admin screen", author: bob, baseRefName: "rules-1", headRefName: "rules-2", commits: commit("SUCCESS", 0.3) }),
|
|
183
|
+
],
|
|
178
184
|
mentions: [
|
|
179
185
|
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 }),
|
|
180
186
|
mention(121, [comment(alice, "@me could you look at the rounding in `totals.ts` first? That's the **risky** part.", 0.2)], { __typename: "PullRequest", title: "Rework the cart totals" }),
|
|
@@ -261,6 +267,7 @@ export function fixture(now: Date): { data: SearchResult; details: Details } {
|
|
|
261
267
|
// Each sits in its action's line in the sheet. Issue 90 has two: an old one with no kind, which leads, and Rebase stack on its PR.
|
|
262
268
|
// #113 waits on CI while its Fix CI session works, though Fix CI isn't one of its actions any more.
|
|
263
269
|
// #120's was started outside Attention Span, in a workspace Paseo linked to the PR, so it has no kind [SES-08].
|
|
270
|
+
// #197's too, so it shows on its stack, led by #196 [ATT-04].
|
|
264
271
|
const agent = (id: string, itemKey: string, kind: SessionKind | undefined, status: string, minutesAgo: number, requiresAttention = false): AgentSummary => ({
|
|
265
272
|
id,
|
|
266
273
|
itemKey,
|
|
@@ -280,6 +287,7 @@ export const FIXTURE_AGENTS: AgentSummary[] = [
|
|
|
280
287
|
agent("agent-103", `${REPO}#103`, "rebase", "running", 6),
|
|
281
288
|
agent("agent-113", `${REPO}#113`, "fix", "running", 2),
|
|
282
289
|
agent("agent-120", `${REPO}#120`, undefined, "running", 3),
|
|
290
|
+
agent("agent-197", `${REPO}#197`, undefined, "idle", 15),
|
|
283
291
|
];
|
|
284
292
|
|
|
285
293
|
export const FIXTURE_CONTEXT = "Context from GitHub would go here (fixture mode).";
|
package/shared/attention.ts
CHANGED
|
@@ -144,8 +144,27 @@ export interface Target {
|
|
|
144
144
|
headRefOid?: string;
|
|
145
145
|
defaultBranch?: string;
|
|
146
146
|
mergeMethod?: MergeMethod;
|
|
147
|
-
// Every PR in the stack, bottom first.
|
|
148
|
-
stack?:
|
|
147
|
+
// Every PR in the stack, bottom first: mine, and others' that ask for my review [ATT-04].
|
|
148
|
+
stack?: StackPr[];
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export interface StackPr {
|
|
152
|
+
number: number;
|
|
153
|
+
head: string;
|
|
154
|
+
base: string;
|
|
155
|
+
// Someone else's, asking for my review; the rest are mine.
|
|
156
|
+
review?: true;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// The PRs of mine in a target's stack: what Rebase, Refresh and Rerun act on. Others' branches are never pushed [ATT-04].
|
|
160
|
+
export function ownStack(target: Pick<Target, "stack">): StackPr[] {
|
|
161
|
+
return (target.stack ?? []).filter((pr) => !pr.review);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// The PR a session checks out: for Review of a stack, its top, which has every PR's changes; otherwise the target [ATT-04].
|
|
165
|
+
export function checkoutPr(kind: SessionKind, target: Pick<Target, "number" | "headRefName" | "stack">): { number: number; head?: string } {
|
|
166
|
+
const top = target.stack?.at(-1);
|
|
167
|
+
return kind === "review" && top && target.stack!.length > 1 ? { number: top.number, head: top.head } : { number: target.number, head: target.headRefName };
|
|
149
168
|
}
|
|
150
169
|
|
|
151
170
|
export interface SubRow {
|
package/shared/prompts.ts
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ActionId, ownStack, type Target } from "./attention";
|
|
2
2
|
import type { AttentionConfig, SessionKind } from "./config";
|
|
3
3
|
|
|
4
4
|
// Built-in prompt templates [SES-04]. A template in config.json replaces one.
|
|
5
|
-
// Placeholders: {{repo}} {{number}} {{title}} {{url}} {{head}} {{base}} {{stack}} {{context}}
|
|
5
|
+
// Placeholders: {{repo}} {{number}} {{title}} {{url}} {{head}} {{base}} {{stack}} {{review}} {{context}}
|
|
6
|
+
// For Review of a stack, {{head}} is its top branch and {{review}} the PRs asking for my review.
|
|
7
|
+
const SWEEP = `Browser sweep, only if you're equipped to (you can run this repo's app and have browser tools): work out which pages and screens the change affects and check each one. If you can't, skip this and say so. Don't spend the session getting the app to run.`;
|
|
8
|
+
|
|
6
9
|
export const PROMPT_TEMPLATES: Record<SessionKind, string> = {
|
|
7
10
|
review: `Review pull request {{repo}}#{{number}}: "{{title}}" ({{url}}). You are in a checkout of the PR branch.
|
|
8
11
|
|
|
9
12
|
1. Review: read the description and the diff against {{base}}.
|
|
10
13
|
2. Investigate: dig into anything risky or unclear in the code it touches.
|
|
11
|
-
3.
|
|
14
|
+
3. ${SWEEP}
|
|
12
15
|
4. Report back:
|
|
13
16
|
- Findings, most important first.
|
|
14
17
|
- Verdict: approve, request changes or comment, with a one-line reason.
|
|
@@ -59,6 +62,21 @@ Read the issue and the code it touches, then propose a plan before changing anyt
|
|
|
59
62
|
{{context}}`,
|
|
60
63
|
};
|
|
61
64
|
|
|
65
|
+
// Review of a stack, while config.json doesn't replace the review template: one session for every PR asking for my review [ATT-04].
|
|
66
|
+
export const REVIEW_STACK_TEMPLATE = `Review the pull requests {{review}} in {{repo}}, part of the stack {{stack}} (bottom first). You are in a checkout of the top branch, {{head}}, which has every PR's changes.
|
|
67
|
+
|
|
68
|
+
1. Review: for each of {{review}}, read its description and its diff against its own base (\`git diff origin/<base>...origin/<head>\`, branches below). Review only those; the rest of the stack is context.
|
|
69
|
+
2. Investigate: dig into anything risky or unclear in the code they touch.
|
|
70
|
+
3. ${SWEEP}
|
|
71
|
+
4. Report back, for each PR:
|
|
72
|
+
- Findings, most important first.
|
|
73
|
+
- Verdict: approve, request changes or comment, with a one-line reason.
|
|
74
|
+
- Draft review comments, ready to paste, each with file:line.
|
|
75
|
+
|
|
76
|
+
Do not post anything to GitHub.
|
|
77
|
+
|
|
78
|
+
{{context}}`;
|
|
79
|
+
|
|
62
80
|
export const ACTION_SESSION: Partial<Record<ActionId, SessionKind>> = {
|
|
63
81
|
review: "review",
|
|
64
82
|
fix: "fix",
|
|
@@ -74,15 +92,22 @@ export function renderPrompt(
|
|
|
74
92
|
context: string,
|
|
75
93
|
config: Pick<AttentionConfig, "prompts">,
|
|
76
94
|
): string {
|
|
77
|
-
const
|
|
95
|
+
const stack = target.stack ?? [];
|
|
96
|
+
const reviewStack = kind === "review" && stack.length > 1;
|
|
97
|
+
const template = config.prompts[kind] ?? (reviewStack ? REVIEW_STACK_TEMPLATE : PROMPT_TEMPLATES[kind]);
|
|
98
|
+
// Review reads the whole stack; the rest act on my PRs in it [ATT-04].
|
|
99
|
+
const shown = kind === "review" ? stack : ownStack(target);
|
|
100
|
+
const asking = stack.filter((pr) => pr.review);
|
|
101
|
+
const numbers = (prs: { number: number }[], join: string) => (prs.length ? prs : [{ number: target.number }]).map((pr) => `#${pr.number}`).join(join);
|
|
78
102
|
const values: Record<string, string> = {
|
|
79
103
|
repo: target.repo,
|
|
80
104
|
number: String(target.number),
|
|
81
105
|
title: target.title,
|
|
82
106
|
url: target.url,
|
|
83
|
-
head: target.headRefName ?? "",
|
|
107
|
+
head: (reviewStack ? stack.at(-1)?.head : target.headRefName) ?? "",
|
|
84
108
|
base: target.baseRefName ?? target.defaultBranch ?? "",
|
|
85
|
-
stack: (
|
|
109
|
+
stack: numbers(shown, " → "),
|
|
110
|
+
review: numbers(asking.length ? asking : shown, ", "),
|
|
86
111
|
context: context.trim(),
|
|
87
112
|
};
|
|
88
113
|
return template.replace(/\{\{(\w+)\}\}/g, (match, name: string) => values[name] ?? match).trim();
|