@andrioid/paseo-attention-span 0.7.0 → 0.7.2
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 -0
- package/client/entity.tsx +15 -3
- package/client/icons.ts +2 -0
- package/client/item-actions.ts +24 -0
- package/client/item-row.tsx +5 -55
- package/client/next-up.tsx +49 -7
- package/client/stack.tsx +57 -0
- package/client/ui.tsx +4 -1
- package/client/wrap-up.tsx +181 -49
- package/docs/architecture.md +3 -2
- 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-code-repo.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.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 +2 -0
- package/server/classify.ts +29 -0
- package/server/fetch.ts +29 -3
- package/server/fixture.ts +16 -5
- package/server/github-types.ts +13 -0
- package/server/queries.ts +14 -0
- 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 +26 -2
- package/shared/next-up-filter.ts +19 -0
- package/shared/rpc.ts +4 -0
- package/shared/wrap-up.ts +34 -9
package/client/wrap-up.tsx
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { useState } from "react";
|
|
2
|
+
import { useQuery } from "@tanstack/react-query";
|
|
3
|
+
import { openExternalUrl } from "@getpaseo/plugin/client";
|
|
2
4
|
import { Text, View } from "react-native";
|
|
3
5
|
import type { AgentSummary, WrapItem } from "../shared/attention";
|
|
4
6
|
import { type ArchiveOutcome, type KeptRow, keptText, sheetLines, type UnsavedSession, unsavedWords } from "../shared/archive";
|
|
@@ -6,8 +8,12 @@ import { allWrapBusy, wrapBusy } from "../shared/got-it";
|
|
|
6
8
|
import { cleanSingle, sessionCleanliness, sessionUnsaved } from "../shared/wrap-up";
|
|
7
9
|
import { CardList, CardRow } from "./card";
|
|
8
10
|
import { stateMark } from "./mark";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
+
import { type FetchDetails, itemDetailsQuery } from "./item-actions";
|
|
12
|
+
import { PlaceText } from "./entity";
|
|
13
|
+
import { StackLine } from "./stack";
|
|
14
|
+
import { sessionEntry } from "./session-menu";
|
|
15
|
+
import { ActionSheet, DETAILS_STALE_MS, DetailLines, Dialog, githubEntry, type SheetEntry, usePrefetchOnRest } from "./sheet";
|
|
16
|
+
import { Button, Meta, SectionHeader, useStyles } from "./ui";
|
|
11
17
|
|
|
12
18
|
// Doing's Wrap up: finished or out-of-my-hands work whose sessions are still open, and archiving them [ATT-22]. The screen
|
|
13
19
|
// assembles the rows and runs the archive; these draw them and ask before archiving anything unsaved or closing a terminal,
|
|
@@ -19,6 +25,7 @@ interface RowProps {
|
|
|
19
25
|
// Previews have made-up sessions: their snapshot is the answer, as there's no daemon to ask.
|
|
20
26
|
fixture: boolean;
|
|
21
27
|
openAgent: (agentId: string) => void;
|
|
28
|
+
fetchDetails: FetchDetails;
|
|
22
29
|
onArchive: (item: WrapItem, confirm: boolean, terminals?: string[]) => Promise<ArchiveOutcome | null>;
|
|
23
30
|
}
|
|
24
31
|
|
|
@@ -29,7 +36,22 @@ interface KeptProps {
|
|
|
29
36
|
}
|
|
30
37
|
|
|
31
38
|
// Finished or out-of-my-hands work whose Paseo sessions are all idle: the cleanup Doing owns [ATT-22].
|
|
32
|
-
|
|
39
|
+
interface AskProps {
|
|
40
|
+
// Close as completed, with Undo, or Keep open until another PR merges under it [ATT-24].
|
|
41
|
+
onCloseIssue: (item: WrapItem) => void;
|
|
42
|
+
onKeepOpen: (item: WrapItem) => void;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function WrapUp({
|
|
46
|
+
items,
|
|
47
|
+
onArchiveAll,
|
|
48
|
+
kept,
|
|
49
|
+
onArchiveWorktree,
|
|
50
|
+
onDismissKept,
|
|
51
|
+
onCloseIssue,
|
|
52
|
+
onKeepOpen,
|
|
53
|
+
...row
|
|
54
|
+
}: { items: WrapItem[]; onArchiveAll: () => Promise<void> } & RowProps & KeptProps & AskProps) {
|
|
33
55
|
const styles = useStyles();
|
|
34
56
|
const clean = items.filter(cleanSingle);
|
|
35
57
|
return (
|
|
@@ -53,9 +75,13 @@ export function WrapUp({ items, onArchiveAll, kept, onArchiveWorktree, onDismiss
|
|
|
53
75
|
}
|
|
54
76
|
/>
|
|
55
77
|
<CardList>
|
|
56
|
-
{items.map((item, index) =>
|
|
57
|
-
|
|
58
|
-
|
|
78
|
+
{items.map((item, index) =>
|
|
79
|
+
item.wrap.ask ? (
|
|
80
|
+
<AskRow key={item.key} item={item} first={index === 0} busy={row.busy} login={row.login} openSession={row.openAgent} fetchDetails={row.fetchDetails} onCloseIssue={onCloseIssue} onKeepOpen={onKeepOpen} />
|
|
81
|
+
) : (
|
|
82
|
+
<WrapRow key={item.key} item={item} first={index === 0} {...row} />
|
|
83
|
+
),
|
|
84
|
+
)}
|
|
59
85
|
{kept.map((keptRow, index) => (
|
|
60
86
|
<KeptWorktreeRow
|
|
61
87
|
key={keptRow.workspaceId}
|
|
@@ -73,16 +99,76 @@ export function WrapUp({ items, onArchiveAll, kept, onArchiveWorktree, onDismiss
|
|
|
73
99
|
);
|
|
74
100
|
}
|
|
75
101
|
|
|
102
|
+
// An open issue whose PRs of mine all merged: "Close #12? #34 and #35 merged 2h ago", Close #12, or × to keep it open until
|
|
103
|
+
// another merges. A session open on the work waits for the usual row, which closing leaves behind [ATT-24].
|
|
104
|
+
function AskRow({
|
|
105
|
+
item,
|
|
106
|
+
first,
|
|
107
|
+
busy,
|
|
108
|
+
login,
|
|
109
|
+
openSession,
|
|
110
|
+
fetchDetails,
|
|
111
|
+
onCloseIssue,
|
|
112
|
+
onKeepOpen,
|
|
113
|
+
}: { item: WrapItem; first: boolean; busy: ReadonlySet<string>; login: string | null; openSession: (agentId: string) => void; fetchDetails: FetchDetails } & AskProps) {
|
|
114
|
+
const [sheet, setSheet] = useState(false);
|
|
115
|
+
const open = () => setSheet(true);
|
|
116
|
+
const prefetch = usePrefetchOnRest(itemDetailsQuery(item, fetchDetails));
|
|
117
|
+
const close = () => setSheet(false);
|
|
118
|
+
const blocked = wrapBusy(busy, item.key);
|
|
119
|
+
const { sessions } = item.wrap;
|
|
120
|
+
const still = sessions.length > 1 ? ` · ${sessions.length} sessions still open` : sessions.length ? " · your session's still open" : "";
|
|
121
|
+
return (
|
|
122
|
+
<CardRow
|
|
123
|
+
first={first}
|
|
124
|
+
mark={stateMark(item)}
|
|
125
|
+
title={item.title}
|
|
126
|
+
meta={{ place: { repo: item.repo, number: item.number, login }, when: `Close #${item.number}? ${item.wrap.finish}${still}`, signals: [] }}
|
|
127
|
+
onOpen={open}
|
|
128
|
+
hover={prefetch}
|
|
129
|
+
busy={blocked}
|
|
130
|
+
primary={{ label: `Close #${item.number}`, accessibilityLabel: `Close #${item.number} as completed`, icon: "issueClosed", onPress: () => onCloseIssue(item) }}
|
|
131
|
+
secondary={[
|
|
132
|
+
{ label: `Details for #${item.number}`, icon: "chevronRight", onPress: open },
|
|
133
|
+
{ label: "Keep open", icon: "close", accessibilityLabel: `Keep #${item.number} open`, onPress: () => onKeepOpen(item) },
|
|
134
|
+
]}
|
|
135
|
+
overlay={
|
|
136
|
+
sheet ? (
|
|
137
|
+
<WrapItemSheet
|
|
138
|
+
item={item}
|
|
139
|
+
fetchDetails={fetchDetails}
|
|
140
|
+
openSession={openSession}
|
|
141
|
+
onClose={close}
|
|
142
|
+
entries={[
|
|
143
|
+
{
|
|
144
|
+
key: "close", label: `Close #${item.number}`, icon: "issueClosed",
|
|
145
|
+
detail: "Closes as completed, with Undo", disabled: blocked,
|
|
146
|
+
onPress: () => { close(); onCloseIssue(item); },
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
key: "keep", label: "Keep open", icon: "close",
|
|
150
|
+
detail: "Waits until another PR merges before asking again", housekeeping: true, disabled: blocked,
|
|
151
|
+
onPress: () => { close(); onKeepOpen(item); },
|
|
152
|
+
},
|
|
153
|
+
]}
|
|
154
|
+
/>
|
|
155
|
+
) : null
|
|
156
|
+
}
|
|
157
|
+
/>
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
|
|
76
161
|
// "merged by dave 2h ago · your session's still open": what finishing looked like, then the session it left behind [ATT-22].
|
|
77
162
|
function wrapMeta({ wrap }: WrapItem): string {
|
|
78
163
|
const still = wrap.review ? "your review session's still open" : wrap.sessions.length > 1 ? `${wrap.sessions.length} sessions still open` : "your session's still open";
|
|
79
164
|
return `${wrap.finish} · ${still}`;
|
|
80
165
|
}
|
|
81
166
|
|
|
82
|
-
function WrapRow({ item, first, busy, login, fixture, openAgent: openSession, onArchive }: { item: WrapItem; first: boolean } & RowProps) {
|
|
83
|
-
const styles = useStyles();
|
|
167
|
+
function WrapRow({ item, first, busy, login, fixture, openAgent: openSession, fetchDetails, onArchive }: { item: WrapItem; first: boolean } & RowProps) {
|
|
84
168
|
const { sessions } = item.wrap;
|
|
85
|
-
const [sheet, setSheet] = useState<"
|
|
169
|
+
const [sheet, setSheet] = useState<"item" | "dirty" | null>(null);
|
|
170
|
+
const open = () => setSheet("item");
|
|
171
|
+
const prefetch = usePrefetchOnRest(itemDetailsQuery(item, fetchDetails));
|
|
86
172
|
const [unsaved, setUnsaved] = useState<UnsavedSession[]>([]);
|
|
87
173
|
// The terminals the confirm sheet names, sent back with it: a terminal opened since brings the sheet back [ATT-22].
|
|
88
174
|
const [terminals, setTerminals] = useState<string[]>([]);
|
|
@@ -90,7 +176,7 @@ function WrapRow({ item, first, busy, login, fixture, openAgent: openSession, on
|
|
|
90
176
|
const [leaving, setLeaving] = useState<string[]>([]);
|
|
91
177
|
const dirty = sessions.some((session) => sessionCleanliness(session) === "dirty");
|
|
92
178
|
const press = async () => {
|
|
93
|
-
if (sessions.length > 1) return
|
|
179
|
+
if (sessions.length > 1) return open();
|
|
94
180
|
// A preview has no daemon to ask; its made-up snapshot is the answer. Elsewhere the server checks git too, so the sheet
|
|
95
181
|
// can name the files and commits it found.
|
|
96
182
|
if (sessionCleanliness(sessions[0]) !== "clean" && fixture) {
|
|
@@ -109,7 +195,7 @@ function WrapRow({ item, first, busy, login, fixture, openAgent: openSession, on
|
|
|
109
195
|
setSheet("dirty");
|
|
110
196
|
}
|
|
111
197
|
};
|
|
112
|
-
// The
|
|
198
|
+
// The item's archive entry asks the server first; unsaved work or open terminals it finds get the confirm that
|
|
113
199
|
// names them [ATT-22].
|
|
114
200
|
const confirm = async (confirm: boolean) => {
|
|
115
201
|
const outcome = await onArchive(item, confirm, confirm ? terminals : []);
|
|
@@ -126,7 +212,8 @@ function WrapRow({ item, first, busy, login, fixture, openAgent: openSession, on
|
|
|
126
212
|
when: wrapMeta(item),
|
|
127
213
|
signals: dirty ? [{ text: "unsaved changes", tone: "warn" }] : [],
|
|
128
214
|
}}
|
|
129
|
-
onOpen={
|
|
215
|
+
onOpen={open}
|
|
216
|
+
hover={prefetch}
|
|
130
217
|
busy={wrapBusy(busy, item.key)}
|
|
131
218
|
primary={{
|
|
132
219
|
label: sessions.length > 1 ? "Archive sessions" : "Archive session",
|
|
@@ -134,44 +221,29 @@ function WrapRow({ item, first, busy, login, fixture, openAgent: openSession, on
|
|
|
134
221
|
icon: "archive",
|
|
135
222
|
onPress: () => void press(),
|
|
136
223
|
}}
|
|
137
|
-
secondary={[{ label: `Details for #${item.number}`, icon: "chevronRight", onPress:
|
|
224
|
+
secondary={[{ label: `Details for #${item.number}`, icon: "chevronRight", onPress: open }]}
|
|
138
225
|
overlay={
|
|
139
|
-
sheet === "
|
|
140
|
-
<
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
) : null}
|
|
156
|
-
</View>
|
|
157
|
-
<Button label="Open" variant="ghost" onPress={() => openSession(session.id)} />
|
|
158
|
-
</View>
|
|
159
|
-
))}
|
|
160
|
-
</View>
|
|
161
|
-
<Text style={styles.muted}>
|
|
162
|
-
Archives {sessions.length} sessions. Their worktrees go too when no other session lives in them, closing their terminals
|
|
163
|
-
{sessions.some((session) => sessionCleanliness(session) === "unknown") ? "; the one that couldn't be checked may hold unsaved work" : ""}.
|
|
164
|
-
</Text>
|
|
165
|
-
<View style={[styles.row, { justifyContent: "flex-end" }]}>
|
|
166
|
-
<Button label="Cancel" onPress={() => setSheet(null)} />
|
|
167
|
-
<Button label={sessions.length === 2 ? "Archive both" : `Archive ${sessions.length}`} variant="danger" onPress={() => void confirm(false)} />
|
|
168
|
-
</View>
|
|
169
|
-
</Dialog>
|
|
226
|
+
sheet === "item" ? (
|
|
227
|
+
<WrapItemSheet
|
|
228
|
+
item={item}
|
|
229
|
+
fetchDetails={fetchDetails}
|
|
230
|
+
openSession={openSession}
|
|
231
|
+
onClose={() => setSheet(null)}
|
|
232
|
+
entries={[{
|
|
233
|
+
key: "archive",
|
|
234
|
+
label: sessions.length === 2 ? "Archive both" : sessions.length > 1 ? `Archive ${sessions.length} sessions` : "Archive session",
|
|
235
|
+
icon: "archive",
|
|
236
|
+
detail: "Archives the sessions and their worktrees when no other session lives in them. Asks before losing unsaved work or closing terminals.",
|
|
237
|
+
housekeeping: true,
|
|
238
|
+
disabled: wrapBusy(busy, item.key),
|
|
239
|
+
onPress: () => { setSheet(null); void (sessions.length > 1 ? confirm(false) : press()); },
|
|
240
|
+
}]}
|
|
241
|
+
/>
|
|
170
242
|
) : sheet === "dirty" ? (
|
|
171
243
|
<ArchiveSheet
|
|
172
244
|
title={leaving.length === 1 ? `Archive "${leaving[0]}"?` : sessions.length > 1 ? `Archive the sessions on #${item.number}?` : `Archive the session on #${item.number}?`}
|
|
173
245
|
unsaved={unsaved.length ? unsaved : [readingOf(sessions[0])]}
|
|
174
|
-
onOpen={() => openSession(unsaved[0]?.agentId ?? sessions[0].id)}
|
|
246
|
+
onOpen={() => { setSheet(null); openSession(unsaved[0]?.agentId ?? sessions[0].id); }}
|
|
175
247
|
onArchive={() => void confirm(true)}
|
|
176
248
|
onClose={() => setSheet(null)}
|
|
177
249
|
/>
|
|
@@ -181,7 +253,51 @@ function WrapRow({ item, first, busy, login, fixture, openAgent: openSession, on
|
|
|
181
253
|
);
|
|
182
254
|
}
|
|
183
255
|
|
|
184
|
-
//
|
|
256
|
+
// Wrap up owns its cleanup actions; the sheet uses the same details and entries as the other tabs [ATT-06, SES-03].
|
|
257
|
+
function WrapItemSheet({ item, fetchDetails, openSession, entries, onClose }: {
|
|
258
|
+
item: WrapItem;
|
|
259
|
+
fetchDetails: FetchDetails;
|
|
260
|
+
openSession: (agentId: string) => void;
|
|
261
|
+
entries: SheetEntry[];
|
|
262
|
+
onClose: () => void;
|
|
263
|
+
}) {
|
|
264
|
+
const details = useQuery({ ...itemDetailsQuery(item, fetchDetails), staleTime: DETAILS_STALE_MS });
|
|
265
|
+
const pr = item.children.find((child) => child.url === item.target.url) ?? item.children[0];
|
|
266
|
+
const shown = new Set(item.children.map((child) => child.url));
|
|
267
|
+
const extra = details.data && { ...details.data, linked: details.data.linked.filter((link) => !shown.has(link.url)) };
|
|
268
|
+
return (
|
|
269
|
+
<ActionSheet
|
|
270
|
+
title={item.title}
|
|
271
|
+
onClose={onClose}
|
|
272
|
+
top={
|
|
273
|
+
<>
|
|
274
|
+
<Meta lead={<PlaceText place={{ repo: item.repo, number: item.number, login: null }} />} facts={[item.wrap.finish]} chips={[]} />
|
|
275
|
+
{item.children.length > 0 ? <StackLine rows={item.children} merged={!!item.closedAt || !!item.wrap.ask} links /> : null}
|
|
276
|
+
</>
|
|
277
|
+
}
|
|
278
|
+
entries={[
|
|
279
|
+
...item.wrap.sessions.map((session) => ({
|
|
280
|
+
...sessionEntry(session, "Continue session", (id) => { onClose(); openSession(id); }),
|
|
281
|
+
detail: [session.title, sessionStateText(session), session.subAgents?.count ? `+${session.subAgents.count} sub-agent${session.subAgents.count === 1 ? "" : "s"}` : null].filter(Boolean).join(" · "),
|
|
282
|
+
})),
|
|
283
|
+
githubEntry(item, (url) => { onClose(); void openExternalUrl(url); }, pr),
|
|
284
|
+
...entries,
|
|
285
|
+
]}
|
|
286
|
+
bottom={
|
|
287
|
+
<DetailLines
|
|
288
|
+
details={extra}
|
|
289
|
+
loading={details.isLoading}
|
|
290
|
+
error={details.error}
|
|
291
|
+
linkedLabel={item.kind === "issue" ? "PR" : "Closes"}
|
|
292
|
+
expected={item.target.kind === "pr" ? 1 : 0}
|
|
293
|
+
sizeOf={item.kind === "issue" && item.target.kind === "pr" ? item.target.number : undefined}
|
|
294
|
+
/>
|
|
295
|
+
}
|
|
296
|
+
/>
|
|
297
|
+
);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
// What a session in Wrap up's item sheet says about its worktree [ATT-22].
|
|
185
301
|
function sessionStateText(session: AgentSummary): string {
|
|
186
302
|
const unsaved = sessionUnsaved(session);
|
|
187
303
|
if (!unsaved) return "idle · nothing unsaved";
|
|
@@ -235,6 +351,8 @@ function KeptWorktreeRow({
|
|
|
235
351
|
onArchive: KeptProps["onArchiveWorktree"];
|
|
236
352
|
onDismiss: (row: KeptRow) => void;
|
|
237
353
|
}) {
|
|
354
|
+
const [detailsOpen, setDetailsOpen] = useState(false);
|
|
355
|
+
const open = () => setDetailsOpen(true);
|
|
238
356
|
const [sheet, setSheet] = useState<{ unsaved: UnsavedSession[]; terminals: string[] } | null>(null);
|
|
239
357
|
const archive = async (confirm: boolean) => {
|
|
240
358
|
const outcome = await onArchive(row, confirm, confirm ? (sheet?.terminals ?? []) : []);
|
|
@@ -251,12 +369,26 @@ function KeptWorktreeRow({
|
|
|
251
369
|
mark={{ icon: "archive", tone: "neutral" }}
|
|
252
370
|
title={row.title}
|
|
253
371
|
meta={{ place: { repo: row.repo, number: row.number, login }, when: keptText(row), signals: [] }}
|
|
254
|
-
onOpen={
|
|
372
|
+
onOpen={open}
|
|
255
373
|
busy={busy}
|
|
256
374
|
primary={{ ...primary, accessibilityLabel: `${primary.label}: ${row.name}` }}
|
|
257
|
-
secondary={[
|
|
375
|
+
secondary={[
|
|
376
|
+
{ label: `Details for #${row.number}`, icon: "chevronRight", onPress: open },
|
|
377
|
+
{ label: "Dismiss", icon: "close", accessibilityLabel: `Dismiss: keep ${row.name}`, onPress: () => onDismiss(row) },
|
|
378
|
+
]}
|
|
258
379
|
overlay={
|
|
259
|
-
|
|
380
|
+
detailsOpen ? (
|
|
381
|
+
<ActionSheet
|
|
382
|
+
title={row.title}
|
|
383
|
+
onClose={() => setDetailsOpen(false)}
|
|
384
|
+
top={<Meta lead={<PlaceText place={{ repo: row.repo, number: row.number, login: null }} />} facts={[row.name, keptText(row)]} chips={[]} />}
|
|
385
|
+
entries={[
|
|
386
|
+
{ key: "primary", ...primary, detail: row.reason === "session" ? "Opens the session keeping this worktree" : "Checks the worktree before archiving; asks before losing unsaved work or closing terminals", disabled: busy, onPress: () => { setDetailsOpen(false); primary.onPress(); } },
|
|
387
|
+
{ key: "dismiss", label: "Dismiss", icon: "close", detail: "Keeps the worktree and removes this reminder", housekeeping: true, disabled: busy, onPress: () => { setDetailsOpen(false); onDismiss(row); } },
|
|
388
|
+
]}
|
|
389
|
+
bottom={null}
|
|
390
|
+
/>
|
|
391
|
+
) : sheet ? <ArchiveSheet title={`Archive "${row.name}"?`} unsaved={sheet.unsaved} onArchive={() => void archive(true)} onClose={() => setSheet(null)} /> : null
|
|
260
392
|
}
|
|
261
393
|
/>
|
|
262
394
|
);
|
package/docs/architecture.md
CHANGED
|
@@ -84,7 +84,7 @@ Top to bottom. Each item appears once, under its most urgent reason [ATT-02]. `s
|
|
|
84
84
|
| Needs upstream | My PRs with conflicts or an out-of-sync stack [UPS-01, UPS-02] |
|
|
85
85
|
| Needs a reviewer | My PRs nobody has been asked to review, even while CI runs [PRS-12]. Only what GitHub records counts as asked: a pending request, an approval or requested changes. GitHub drops a reviewer's request once they review, so a review that only commented, by a person or a bot, leaves it here to re-request; the repo, not us, decides whose approval counts |
|
|
86
86
|
| My drafts | My drafts, with their own state tags [PRS-05, PRS-06] |
|
|
87
|
-
| Wrap up | First, the cleanup: finished or out-of-my-hands work whose unarchived Paseo sessions are all idle, including a review session on someone else's merged PR [ATT-22]. It takes merged, closed and handed-off items, mine or anyone's, including my own PRs I closed without merging ("closed 3h ago, not merged", from the live closed search, never listed in History) and my merged PRs from the same search, which stand in until History has them (`ownClosed` in `server/changes.ts`; History's entry wins) [FRESH-03], as far back as History and its ledger keep, with no age cutoff of its own; a stack or issue group enters only when everything its sessions serve is done, and counts once; one session never makes two rows. A busy session keeps its row out until idle. Newest finish first, each row saying what happened and what is still open: "merged by dave 2h ago · your session's still open", "merged by alice 1d ago · your review session's still open", "2 sessions still open", with an amber "unsaved changes" where a worktree has them. **Archive session** (plural for several) archives the item's agents and the sub-agents they started; a worktree goes too only when it's Paseo's and no other session lives in it, never a local checkout. A sub-agent still running or starting, or flagged for anything but finished or failed (a permission, say), keeps its session's row out, like a busy session; a finished or failed one Paseo still flags for attention doesn't (`subAgentBusy`), as nobody opens a sub-agent and reporting back is its parent's job. One idle session with nothing uncommitted or unpushed archives at once; unsaved or unknown work, or a terminal open in a worktree that goes, asks first in a sheet shaped like Paseo's own "Archive workspace" one: 'Archive "Split invoice PDF"?' when the worktree goes with it (else "Archive the session on #186?"), then each session's lines in Paseo's words ("Uncommitted changes: 2 files (+12 −3)", "1 unpushed commit", "Couldn't check for unsaved changes") and a muted "Closes terminals: dev, shell", with Open session and Archive; a terminal that opened after the sheet brings it back; the multi sheet notes "+1 sub-agent" under a session that has them; several sessions open a sheet listing each one's state with Open; archiving from there checks first too, and any unsaved work it finds gets the naming confirm. **Archive all clean · n** sits in the header with 2+ rows and archives every clean single-session row; it and single archives wait for each other like Got it and Mark all. Success acknowledges exactly the changes present at that moment, so they go to their week as cleared rather than History's unread notes; so does archiving a session Attention Span started in Paseo itself, for what others did up to then, once no session it started is left on that work; a failure keeps the row and says why, and a worktree that stayed after its sessions went keeps a row in Wrap up, uncounted, saying why, briefly, beside the archive mark ("Fix flaky test still in it", "dev server opened meanwhile", "Paseo: worktree is locked") with a button for the reason (Open session, Archive worktree, Try again) and × to dismiss; it goes once the worktree is archived anywhere, and keeps the horizon away until then. Until the session list has loaded, or when it fails, Wrap up isn't known: Doing says so instead of showing the horizon. There is no Undo: Paseo's SDK can't restore a workspace and its agents, so the dirty check and confirmation are the safeguard instead. Its rows count in Doing's and the sidebar's count, and keep the horizon away. |
|
|
87
|
+
| Wrap up | First, the cleanup: finished or out-of-my-hands work whose unarchived Paseo sessions are all idle, including a review session on someone else's merged PR [ATT-22]. It takes merged, closed and handed-off items, mine or anyone's, including my own PRs I closed without merging ("closed 3h ago, not merged", from the live closed search, never listed in History) and my merged PRs from the same search, which stand in until History has them (`ownClosed` in `server/changes.ts`; History's entry wins) [FRESH-03], as far back as History and its ledger keep, with no age cutoff of its own; a stack or issue group enters only when everything its sessions serve is done, and counts once; one session never makes two rows. A busy session keeps its row out until idle. Newest finish first, each row saying what happened and what is still open: "merged by dave 2h ago · your session's still open", "merged by alice 1d ago · your review session's still open", "2 sessions still open", with an amber "unsaved changes" where a worktree has them. **Archive session** (plural for several) archives the item's agents and the sub-agents they started; a worktree goes too only when it's Paseo's and no other session lives in it, never a local checkout. A sub-agent still running or starting, or flagged for anything but finished or failed (a permission, say), keeps its session's row out, like a busy session; a finished or failed one Paseo still flags for attention doesn't (`subAgentBusy`), as nobody opens a sub-agent and reporting back is its parent's job. One idle session with nothing uncommitted or unpushed archives at once; unsaved or unknown work, or a terminal open in a worktree that goes, asks first in a sheet shaped like Paseo's own "Archive workspace" one: 'Archive "Split invoice PDF"?' when the worktree goes with it (else "Archive the session on #186?"), then each session's lines in Paseo's words ("Uncommitted changes: 2 files (+12 −3)", "1 unpushed commit", "Couldn't check for unsaved changes") and a muted "Closes terminals: dev, shell", with Open session and Archive; a terminal that opened after the sheet brings it back; the multi sheet notes "+1 sub-agent" under a session that has them; several sessions open a sheet listing each one's state with Open; archiving from there checks first too, and any unsaved work it finds gets the naming confirm. **Archive all clean · n** sits in the header with 2+ rows and archives every clean single-session row; it and single archives wait for each other like Got it and Mark all. Success acknowledges exactly the changes present at that moment, so they go to their week as cleared rather than History's unread notes; so does archiving a session Attention Span started in Paseo itself, for what others did up to then, once no session it started is left on that work; a failure keeps the row and says why, and a worktree that stayed after its sessions went keeps a row in Wrap up, uncounted, saying why, briefly, beside the archive mark ("Fix flaky test still in it", "dev server opened meanwhile", "Paseo: worktree is locked") with a button for the reason (Open session, Archive worktree, Try again) and × to dismiss; it goes once the worktree is archived anywhere, and keeps the horizon away until then. Until the session list has loaded, or when it fails, Wrap up isn't known: Doing says so instead of showing the horizon. There is no Undo: Paseo's SDK can't restore a workspace and its agents, so the dirty check and confirmation are the safeguard instead. Its rows count in Doing's and the sidebar's count, and keep the horizon away. An open issue whose PRs of mine have all merged, with no PR open for it, gets a row too, with or without a session: "Close #12? #34 and #35 merged 2h ago", **Close #12** (as completed, no comment, Undo reopens) and × for Keep open, which lasts until another PR of mine merges under it (Undo too); its merged PRs' idle sessions join that row instead of making their own, and once it's closed they're the usual row. Archive all clean leaves it [ATT-24]. |
|
|
88
88
|
|
|
89
89
|
**Nothing in Doing** shows a horizon instead of a list (`client/still.tsx`) [ATT-18], with "Nothing's on you. Enjoy the quiet." It follows the device's clock at fixed hours: a low sun in the morning (5–11), a high sun at midday (11–16), a setting sun in the evening (16–21), and a moon with a few stars at night, each in its own soft tint. It settles in on every arrival on the tab (the sky drifts up as it fades in, then its reflections, 700 ms; not with reduced motion), then holds still; when the hour changes while it's open, it crossfades. It shows only after a refresh that worked: before the first one there's a spinner, and after a failed one just the error. Items that are all dismissed count as clear; the "show them again" line sits faintly at the bottom. Wrap up's rows don't: the horizon waits until they're archived too [ATT-22]. Changed by others never touches Doing; it lives in History [HIS-07].
|
|
90
90
|
|
|
@@ -96,7 +96,8 @@ Top to bottom. Each item appears once, under its most urgent reason [ATT-02]. `s
|
|
|
96
96
|
- **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.
|
|
97
97
|
- **Handed over** [PRS-08]: my PRs assigned to someone else, and not to me, are left out. Mentions of me on them still count. A PR of mine with nobody assigned is mine.
|
|
98
98
|
- **Changed by others** [HIS-07] (`server/changes.ts`) keeps a ledger of what others did, in `state.json`, by GitHub's node ids, which a transfer keeps. Only someone else's doing counts; my own actions and others' pushes don't. Merges, unmerged closes and issue closes come from live searches: `mergedBy`, the last close event's actor, and an issue's `stateReason`. A PR that left my hands before it ended counts as the handover, not the merge; one assigned to someone after it ended is still my merge, and a PR someone else has waits a refresh for its lookup rather than be called a merge. Handovers come from GitHub's assign and unassign events, which are separate, never one "handover": a PR is looked up when it's assigned to someone else and not me, once per change of its assignees; it left my hands with whichever came last of my removal and the new owner's assignment, so a PR I took myself off is mine until someone takes it, and an earlier round's removal doesn't name who took it this time; an issue when it leaves my assigned search since the last refresh that worked. Leaving the search proves nothing (search lag, a coverage change, its 50 results), so only an unassign event of me by someone else counts; one closed by then is left to its close note. So unassignments are noticed only for issues Attention Span has seen assigned to me; on the first run none count as gone. A PR seen closed unmerged is tracked; once it drops out of the closed search, as a reopen takes it out, a batch asks for its state and last reopen event. A reopen removes the old close from its week whoever did it, and only someone else's is a note; a merged one stops being tracked, and nothing older than the ledger's window is tracked. A first run tracks from then on, so old closes don't replay as new. A failed lookup, or one node in it GitHub failed on (anything but not found), is asked again on the next refresh. A PR handed over isn't listed under the finished issue it closed either; when a cleared handover's work comes back to me it stays in its week, marked returned, so my later work on it is mine again. Events are kept `historyWeeks` + 1 weeks, or `mentionDays` if longer; unread notes expire after `mentionDays` for History's top section.
|
|
99
|
-
- **Wrap up** [ATT-22] (`shared/wrap-up.ts`, drawn by `client/wrap-up.tsx`) is assembled on the client from the sessions the screen and the sidebar already poll; the server archives and acknowledges. An item's identity is `memberKeys` in `shared/attention.ts`: its key, the PRs under it and the work a change note is about, spelled as GitHub spells them since Paseo's labels match exactly, and compared ignoring case (`shared/names.ts`, as all GitHub names are); Wrap up, archiving and acknowledging all use it. A finished item, reviewed PR, my own unmerged close, cleared change or unread change is a candidate; its sessions are the ones on any of its member keys. It enters when it has at least one unarchived session, every one is idle (not working and not needing me), none serves an item still in Doing or Waiting, and no session already belongs to another row. History lists a merged PR alone, as its branches are gone, so each live refresh remembers every open stack's and issue group's keys under each member (`groups` in `state.json`, kept as long as the ledger): a merged member whose remembered sibling is still open stays out, and so does its session. The screen freezes rows whose archive runs and Archive all clean while any row's archive runs (`shared/got-it.ts`). Archiving goes through `paseo.agents.ref(id).archive()`, sub-agents first (found by Paseo's `paseo.parent-agent-id` label, `subAgentsOf` in `shared/linked-sessions.ts`; one in another workspace is archived, its workspace left alone; archive lists every page of agents, archived ones too, so one under an archived sub-agent still counts, and a sub-agent that won't archive and stays open stops the archive before its session goes); a Paseo worktree is archived too, through `paseo.workspaces.archive`, which archives everything in it, only when every unarchived agent in it is being archived, and a local checkout never is. Workspaces are named as Paseo's sidebar names them: the title, else the branch. A worktree that stays is a `KeptRow` in `state.json` (`kept`) with its row's item; the `workspace.archived` hook forgets it, and remembers the workspace so an archive still running doesn't add it back, Dismiss forgets it, and Archive worktree or Try again runs the same checks on the worktree alone (`rpc.archiveWorktree`). Paseo closes a worktree's terminals when it archives it, so they're listed (`paseo.terminals.list`) right before archiving and named on the sheet; the confirm sends back the ids it named, and any other asks again. They're listed once more right before each worktree goes: one that opened while the sessions were being archived keeps its worktree, said in its kept row, as Paseo's SDK has no archive that checks and removes at once. Terminals that can't be listed don't keep the worktree, as Paseo would close them anyway. The plugin SDK says nothing of what a terminal runs, so an idle shell and a dev server are named alike. The dirty check reads Paseo's workspace snapshot and, for counts, `git status --porcelain`, `git diff --shortstat HEAD` for lines, and `git rev-list --count @{upstream}..HEAD` (with no upstream, `HEAD --not --remotes`) on the daemon host. Clean needs both answers: when either can't say, it's treated as dirty and the sheet says so (`unsavedOf` in `shared/archive.ts`, for the server and the screen alike). Agents and their status are listed again right before archiving, so a session that started working during the checks, or one that moved into the worktree, stops it. A session Attention Span started, archived in Paseo itself, is caught by the `agent.archived` hook in `index.server.ts` (`server/archived.ts`), even with the screen closed: once no other open session labelled with any key of its item's group is left, the group's changes up to the archive's `archivedAt` are acknowledged, so what others do later still shows. A sub-agent's archive, a restored session and a session without an item label acknowledge nothing; sessions linked only by their workspace neither acknowledge nor hold an acknowledgement back. Lists read every page, and a lookup that fails is tried again on the next hook event or list request, never taken as "none left"; tries are kept in memory, so an archive while the server isn't running, or one pending at a restart, isn't noticed, and Got it or Mark all clears its notes. A new list that brings other merged branches polls again at once, so a session linked by branch doesn't wait for the next round. When a session leaves the screen's 15-second poll (`useItemAgents` in `client/sessions.ts`, shared with the sidebar), the screen reads the server's view from memory first, so the notes acknowledged for it are cleared before its Wrap up row goes. Paseo's SDK has no `restoreWorkspace`, so there is no Undo; `server/archive.ts` confirms instead.
|
|
99
|
+
- **Wrap up** [ATT-22] (`shared/wrap-up.ts`, drawn by `client/wrap-up.tsx`) uses the shared `ActionSheet` on every card-body or Details tap, including close-issue prompts and kept worktrees [ATT-06]. Item sheets reuse the detail query, hover prefetch, session entries, linked-PR rows (`client/stack.tsx`) and GitHub links from the other tabs; cleanup is an explicit action, with unsaved-work and terminal confirmations kept separate. Wrap up is assembled on the client from the sessions the screen and the sidebar already poll; the server archives and acknowledges. An item's identity is `memberKeys` in `shared/attention.ts`: its key, the PRs under it and the work a change note is about, spelled as GitHub spells them since Paseo's labels match exactly, and compared ignoring case (`shared/names.ts`, as all GitHub names are); Wrap up, archiving and acknowledging all use it. A finished item, reviewed PR, my own unmerged close, cleared change or unread change is a candidate; its sessions are the ones on any of its member keys. It enters when it has at least one unarchived session, every one is idle (not working and not needing me), none serves an item still in Doing or Waiting, and no session already belongs to another row. History lists a merged PR alone, as its branches are gone, so each live refresh remembers every open stack's and issue group's keys under each member (`groups` in `state.json`, kept as long as the ledger): a merged member whose remembered sibling is still open stays out, and so does its session. The screen freezes rows whose archive runs and Archive all clean while any row's archive runs (`shared/got-it.ts`). Archiving goes through `paseo.agents.ref(id).archive()`, sub-agents first (found by Paseo's `paseo.parent-agent-id` label, `subAgentsOf` in `shared/linked-sessions.ts`; one in another workspace is archived, its workspace left alone; archive lists every page of agents, archived ones too, so one under an archived sub-agent still counts, and a sub-agent that won't archive and stays open stops the archive before its session goes); a Paseo worktree is archived too, through `paseo.workspaces.archive`, which archives everything in it, only when every unarchived agent in it is being archived, and a local checkout never is. Workspaces are named as Paseo's sidebar names them: the title, else the branch. A worktree that stays is a `KeptRow` in `state.json` (`kept`) with its row's item; the `workspace.archived` hook forgets it, and remembers the workspace so an archive still running doesn't add it back, Dismiss forgets it, and Archive worktree or Try again runs the same checks on the worktree alone (`rpc.archiveWorktree`). Paseo closes a worktree's terminals when it archives it, so they're listed (`paseo.terminals.list`) right before archiving and named on the sheet; the confirm sends back the ids it named, and any other asks again. They're listed once more right before each worktree goes: one that opened while the sessions were being archived keeps its worktree, said in its kept row, as Paseo's SDK has no archive that checks and removes at once. Terminals that can't be listed don't keep the worktree, as Paseo would close them anyway. The plugin SDK says nothing of what a terminal runs, so an idle shell and a dev server are named alike. The dirty check reads Paseo's workspace snapshot and, for counts, `git status --porcelain`, `git diff --shortstat HEAD` for lines, and `git rev-list --count @{upstream}..HEAD` (with no upstream, `HEAD --not --remotes`) on the daemon host. Clean needs both answers: when either can't say, it's treated as dirty and the sheet says so (`unsavedOf` in `shared/archive.ts`, for the server and the screen alike). Agents and their status are listed again right before archiving, so a session that started working during the checks, or one that moved into the worktree, stops it. A session Attention Span started, archived in Paseo itself, is caught by the `agent.archived` hook in `index.server.ts` (`server/archived.ts`), even with the screen closed: once no other open session labelled with any key of its item's group is left, the group's changes up to the archive's `archivedAt` are acknowledged, so what others do later still shows. A sub-agent's archive, a restored session and a session without an item label acknowledge nothing; sessions linked only by their workspace neither acknowledge nor hold an acknowledgement back. Lists read every page, and a lookup that fails is tried again on the next hook event or list request, never taken as "none left"; tries are kept in memory, so an archive while the server isn't running, or one pending at a restart, isn't noticed, and Got it or Mark all clears its notes. A new list that brings other merged branches polls again at once, so a session linked by branch doesn't wait for the next round. When a session leaves the screen's 15-second poll (`useItemAgents` in `client/sessions.ts`, shared with the sidebar), the screen reads the server's view from memory first, so the notes acknowledged for it are cleared before its Wrap up row goes. Paseo's SDK has no `restoreWorkspace`, so there is no Undo; `server/archive.ts` confirms instead.
|
|
100
|
+
- **Close #12?** [ATT-24] (`classifyCloseAsks` in `server/classify.ts`): after History's searches, the issues my merged PRs refer to that History doesn't know closed (`mergedToLookUp` in `server/references.ts`, at most 100) are looked up, a batch per request, for their state and the open PRs GitHub links to them, anyone's. A merged PR is put under an issue as `issueFor` picks one, counting History's closed issues as issues so a PR that closed one isn't put under another it mentions. An issue that's open, with no linked PR open, is asked about (`asks` in `state.json`'s History); as History is fetched daily, each live refresh looks the asked issues up again (`askOff`, one batched request while any is asked; one that can't be looked up keeps asking); the view leaves out one with a PR of mine open under it in the live feed (a mention or answer on the issue alone doesn't count), one Next up knows has anyone's PR open, one the live lookup found closed or with a PR open, one whose latest merge is older than History's weeks, one kept open (`keptOpen`: the latest merge then, so a later one asks again; kept for History's weeks, so an ask missing from one fetch doesn't lose it) and one I just closed. Closing goes through `rpc.closeIssue`, its done item carrying the merged PRs with their branches, so a session linked by branch keeps its row, whether the issue is assigned to me or not; as History's search only finds closed issues assigned to me, it's kept in `closedAsks` for History's weeks, listed in History with its PRs under it rather than alone, and Undo forgets it; Next up's card gets a "PRs merged" pill (`prsMerged`).
|
|
100
101
|
|
|
101
102
|
- **Dismiss** [ATT-08] hides an item until someone other than me comments, reviews or pushes, or its reason changes. My own actions and CI reruns don't bring it back.
|
|
102
103
|
- **Behind base** [UPS-07] only matters when:
|
|
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
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/index.server.ts
CHANGED
|
@@ -55,6 +55,7 @@ export default function contribute(server: PluginServerContext) {
|
|
|
55
55
|
}).then(shown),
|
|
56
56
|
);
|
|
57
57
|
server.handle(rpc.dismissItem, ({ key }) => ready(() => attention.dismiss(key)).then(shown));
|
|
58
|
+
server.handle(rpc.keepOpen, ({ key, on }) => ready(() => attention.keepOpen(key, on)).then(shown));
|
|
58
59
|
server.handle(rpc.undismissItem, ({ key }) => ready(() => attention.undismiss(key)).then(shown));
|
|
59
60
|
server.handle(rpc.gotIt, ({ ids, on }) => ready(() => attention.gotIt(ids, on)).then(shown));
|
|
60
61
|
server.handle(rpc.setHistoryFilter, ({ filter }) => ready(() => attention.setHistoryFilter(filter)).then(shown));
|
|
@@ -90,6 +91,7 @@ export default function contribute(server: PluginServerContext) {
|
|
|
90
91
|
server.handle(rpc.setScopes, ({ scopes }) => ready(() => attention.setScopes(scopes)).then(() => ({ ok: true as const })));
|
|
91
92
|
server.handle(rpc.setSources, ({ sources }) => ready(() => attention.setSources(sources)).then(() => ({ ok: true as const })));
|
|
92
93
|
server.handle(rpc.setProjectFilter, ({ projects }) => ready(() => attention.setProjectFilter(projects)).then(() => ({ ok: true as const })));
|
|
94
|
+
server.handle(rpc.setUnclaimedByRepo, ({ on }) => ready(() => attention.setUnclaimedByRepo(on)).then(shown));
|
|
93
95
|
server.handle(rpc.setNewIssueChoice, ({ repo, profileId }) => ready(() => attention.setNewIssueChoice(repo, profileId)).then(() => ({ ok: true as const })));
|
|
94
96
|
server.handle(rpc.projectsAccess, () => ready(() => attention.projectsAccess(true)));
|
|
95
97
|
server.handle(rpc.updateBranch, ({ key, target }) => act(key, () => updateBranch(target), chip("updating")));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@andrioid/paseo-attention-span",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
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
|
@@ -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.
|
|
@@ -104,6 +105,7 @@ functional:
|
|
|
104
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.
|
|
105
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.
|
|
106
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.
|
|
107
109
|
waiting:
|
|
108
110
|
As a developer, I can:
|
|
109
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,6 +3,7 @@ import {
|
|
|
3
3
|
baseItem,
|
|
4
4
|
type Attention,
|
|
5
5
|
type Chip,
|
|
6
|
+
type CloseAsk,
|
|
6
7
|
type Item,
|
|
7
8
|
type LastReview,
|
|
8
9
|
type NextUpIssue,
|
|
@@ -496,6 +497,34 @@ export function classifyHistory(data: HistoryResult): Item[] {
|
|
|
496
497
|
return items.sort(order);
|
|
497
498
|
}
|
|
498
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
|
+
|
|
499
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.
|
|
500
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
|
|
501
530
|
// are fetched: on someone else's thread, once mine is out of them the conversation has moved on.
|
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"]> {
|