@andrioid/paseo-attention-span 0.7.6 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/OVERVIEW.md +6 -6
- package/client/attention-screen.tsx +18 -11
- package/client/coverage-settings.tsx +20 -1
- package/client/item-actions.ts +8 -4
- package/client/item-row.tsx +5 -5
- package/docs/architecture.md +7 -5
- package/docs/screenshots/desktop-dark-doing-clear.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.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-waiting-too-long.png +0 -0
- package/docs/screenshots/desktop-dark-waiting.png +0 -0
- package/docs/screenshots/phone-dark-doing.png +0 -0
- package/docs/screenshots/phone-dark-history.png +0 -0
- package/docs/screenshots/phone-light-next-up-filtered.png +0 -0
- package/index.server.ts +2 -1
- package/package.json +1 -1
- package/requirements.yaml +2 -2
- package/server/classify.ts +23 -12
- package/server/fetch.ts +1 -1
- package/server/fixture.ts +2 -1
- package/server/github-types.ts +5 -1
- package/server/markdown.ts +4 -1
- package/server/queries.ts +8 -3
- package/server/rules.ts +8 -4
- package/server/service.ts +13 -5
- package/server/setup.ts +3 -3
- package/server/store.ts +8 -3
- package/server/view.ts +11 -4
- package/shared/attention.ts +9 -2
- package/shared/config.ts +2 -0
- package/shared/item-view.ts +8 -2
- package/shared/rpc.ts +4 -1
- package/shared/setup.ts +2 -0
package/OVERVIEW.md
CHANGED
|
@@ -10,21 +10,21 @@ This is the tab you'll live in. Items are grouped by reason: someone's waiting f
|
|
|
10
10
|
|
|
11
11
|
At the top is **Wrap up**. It lists merged, closed or handed-off work that still has a Paseo session open. Archive puts the session and its worktree away. It leaves alone worktrees another session still uses, and your own checkout. It also checks for uncommitted or unpushed work first, because there's no Undo.
|
|
12
12
|
|
|
13
|
-

|
|
14
14
|
|
|
15
15
|
Every item has one main button that matches why it's there: Reply, Review, Fix CI, Merge. Open the item to see every action, each with a line saying what it'll do. I wanted buttons you can press without wondering what's about to happen to your repo.
|
|
16
16
|
|
|
17
|
-

|
|
18
18
|
|
|
19
19
|
Mentions clear when you reply or react. Team mentions don't count, because "@everyone-in-backend" isn't really a question for *me*. If something's just an FYI, dismiss it.
|
|
20
20
|
|
|
21
21
|
## Waiting
|
|
22
22
|
|
|
23
|
-
This is your work where someone else has the next move: a review you asked for, CI running, a question nobody's answered. It's grouped by who you're waiting on. After three days an item turns amber, but only when a nudge would be fair. **Copy list** gives you that person's items as Markdown, ready to paste into a message.
|
|
23
|
+
This is your work where someone else has the next move: a review you asked for, CI running, a question nobody's answered, someone you tagged who hasn't replied. It's grouped by who you're waiting on. After three days an item turns amber, but only when a nudge would be fair. **Copy list** gives you that person's items as Markdown, ready to paste into a message.
|
|
24
24
|
|
|
25
25
|
Otherwise there's nothing to do here, and that's kind of the point. It's tracked, so you can stop holding it in your head.
|
|
26
26
|
|
|
27
|
-

|
|
28
28
|
|
|
29
29
|
## Next up
|
|
30
30
|
|
|
@@ -32,7 +32,7 @@ For when your plate is clear. It does happen. Issues assigned to you come first,
|
|
|
32
32
|
|
|
33
33
|
**Start** launches an agent that reads the issue and proposes a plan. **New issue** (also in ⌘K) takes a line or two, and an agent turns that into a proper issue. It checks for duplicates and shows you the result before anything goes to GitHub.
|
|
34
34
|
|
|
35
|
-

|
|
36
36
|
|
|
37
37
|
## History
|
|
38
38
|
|
|
@@ -40,7 +40,7 @@ What you finished in recent weeks, grouped by week. There's a copy button per we
|
|
|
40
40
|
|
|
41
41
|
Things other people did to your work, like merging your PR or taking an issue over, wait at the top until you've seen them. None of it is a to-do, but it shouldn't happen behind your back either.
|
|
42
42
|
|
|
43
|
-

|
|
44
44
|
|
|
45
45
|
## Agent sessions
|
|
46
46
|
|
|
@@ -15,7 +15,7 @@ import { cleanSingle, unreadChanges, wrapItems } from "../shared/wrap-up";
|
|
|
15
15
|
import { nudgeLead, tabCounts } from "../shared/item-view";
|
|
16
16
|
import { useAttention } from "./data";
|
|
17
17
|
import type { IconName } from "./icons";
|
|
18
|
-
import { type Actions, useItemActions } from "./item-actions";
|
|
18
|
+
import { type Actions, type Undoable, useItemActions } from "./item-actions";
|
|
19
19
|
import { Card } from "./item-row";
|
|
20
20
|
import { InProgress } from "./in-progress";
|
|
21
21
|
import { type IssueRowProps, NextUpList } from "./next-up";
|
|
@@ -247,19 +247,14 @@ function AttentionList({
|
|
|
247
247
|
) : !sessionsKnown ? (
|
|
248
248
|
<Loading text="Checking your sessions…" />
|
|
249
249
|
) : null}
|
|
250
|
-
{view.
|
|
251
|
-
<Pressable
|
|
252
|
-
accessibilityRole="button"
|
|
253
|
-
style={clear ? { alignSelf: "center", opacity: 0.7 } : undefined}
|
|
254
|
-
onPress={act.restoreDismissed}
|
|
255
|
-
>
|
|
256
|
-
<Text style={styles.muted}>{view.dismissedCount} dismissed · show them again</Text>
|
|
257
|
-
</Pressable>
|
|
258
|
-
) : null}
|
|
250
|
+
<ShowDismissed count={view.dismissed.doing} undoable={act.undoable} centered={clear} onPress={() => act.restoreDismissed("doing")} />
|
|
259
251
|
</>
|
|
260
252
|
) : null}
|
|
261
253
|
{tab === "waiting" ? (
|
|
262
|
-
|
|
254
|
+
<>
|
|
255
|
+
{calm.waiting ? <Still shore="jetty" title="Nobody's holding you up." line="Nothing to chase." /> : <Waiting groups={view.waiting} actions={actions} />}
|
|
256
|
+
<ShowDismissed count={view.dismissed.waiting} undoable={act.undoable} centered={calm.waiting} onPress={() => act.restoreDismissed("waiting")} />
|
|
257
|
+
</>
|
|
263
258
|
) : null}
|
|
264
259
|
{tab === "next" ? (
|
|
265
260
|
<NextUpList
|
|
@@ -347,6 +342,18 @@ function Sections({ sections, started, actions, issueRow }: { sections: Section[
|
|
|
347
342
|
);
|
|
348
343
|
}
|
|
349
344
|
|
|
345
|
+
// A tab's dismissed items, to bring back; not while the Undo of one just dismissed is still offered. Undo rows go when
|
|
346
|
+
// the tab changes, so the ones showing are this tab's [ATT-08].
|
|
347
|
+
function ShowDismissed({ count, undoable, centered, onPress }: { count: number; undoable: Undoable[]; centered: boolean; onPress: () => void }) {
|
|
348
|
+
const styles = useStyles();
|
|
349
|
+
if (count <= undoable.filter((row) => row.dismissal).length) return null;
|
|
350
|
+
return (
|
|
351
|
+
<Pressable accessibilityRole="button" style={centered ? { alignSelf: "center", opacity: 0.7 } : undefined} onPress={onPress}>
|
|
352
|
+
<Text style={styles.muted}>{count} dismissed · show them again</Text>
|
|
353
|
+
</Pressable>
|
|
354
|
+
);
|
|
355
|
+
}
|
|
356
|
+
|
|
350
357
|
// Waiting by who it waits on, each with a list to copy for a nudge, oldest first; a bot gets none, as there's nobody to send
|
|
351
358
|
// it to. Last, the work no person holds up. Cards with an active session lead their group [WAI-01, WAI-03].
|
|
352
359
|
function Waiting({ groups, actions }: { groups: WaitingGroup[]; actions: Actions }) {
|
|
@@ -34,6 +34,7 @@ function Coverage() {
|
|
|
34
34
|
const save = useRpc(rpc.setCoverage);
|
|
35
35
|
const saveNextUp = useRpc(rpc.setNextUpSources);
|
|
36
36
|
const saveFollow = useRpc(rpc.setFollowThreads);
|
|
37
|
+
const saveOnlyQuestions = useRpc(rpc.setOnlyQuestionsWait);
|
|
37
38
|
const saveFields = useRpc(rpc.setNextUpFields);
|
|
38
39
|
const coverage = useQuery({ queryKey: COVERAGE_QUERY_KEY, queryFn: () => fetchCoverage({}) });
|
|
39
40
|
const [saving, setSaving] = useState(false);
|
|
@@ -47,7 +48,7 @@ function Coverage() {
|
|
|
47
48
|
</SettingsCard>
|
|
48
49
|
</SettingsSection>
|
|
49
50
|
);
|
|
50
|
-
const { orgs, repos, nextUp, fields, followThreads } = coverage.data;
|
|
51
|
+
const { orgs, repos, nextUp, fields, followThreads, onlyQuestionsWait } = coverage.data;
|
|
51
52
|
// A file that doesn't parse is left for the person who edited it.
|
|
52
53
|
if (coverage.data.error)
|
|
53
54
|
return (
|
|
@@ -131,6 +132,24 @@ function Coverage() {
|
|
|
131
132
|
: "Only tags bring other people's threads back. Your own issues and PRs show any recent reply."}
|
|
132
133
|
</Text>
|
|
133
134
|
</View>
|
|
135
|
+
<View style={{ gap: 8 }}>
|
|
136
|
+
<SettingsSection title="Waiting">
|
|
137
|
+
<SettingsCard>
|
|
138
|
+
<SettingsSwitch
|
|
139
|
+
label="Only questions wait"
|
|
140
|
+
hint="A comment that tags someone waits on them only if it asks a question"
|
|
141
|
+
value={onlyQuestionsWait}
|
|
142
|
+
disabled={saving}
|
|
143
|
+
onValueChange={(on) => void write({ onlyQuestionsWait: on }, () => saveOnlyQuestions({ on }))}
|
|
144
|
+
/>
|
|
145
|
+
</SettingsCard>
|
|
146
|
+
</SettingsSection>
|
|
147
|
+
<Text style={[styles.muted, CAPTION]}>
|
|
148
|
+
{onlyQuestionsWait
|
|
149
|
+
? "Your issues and comments wait on someone only when they ask a question. Tagging someone without asking waits on nobody."
|
|
150
|
+
: "Your issues and comments wait on whoever they tag, and on an answer to any question, until someone replies."}
|
|
151
|
+
</Text>
|
|
152
|
+
</View>
|
|
134
153
|
<View style={{ gap: 4 }}>
|
|
135
154
|
{error ? <Text style={styles.danger}>{error}</Text> : null}
|
|
136
155
|
{/* Until more moves here, point to the file for the rest. */}
|
package/client/item-actions.ts
CHANGED
|
@@ -2,8 +2,8 @@ import type { RpcInput, RpcOutput } from "@getpaseo/plugin";
|
|
|
2
2
|
import { openExternalUrl, type PluginScreenProps, usePaseo, useRpc } from "@getpaseo/plugin/client";
|
|
3
3
|
import { useToast } from "@getpaseo/plugin/client/ui";
|
|
4
4
|
import { useQueryClient } from "@tanstack/react-query";
|
|
5
|
-
import { useState } from "react";
|
|
6
|
-
import type { ActionId, AgentSummary, AttentionView, HistoryFilter, IssueCloseReason, Item, NextUpIssue, Target, WrapItem } from "../shared/attention";
|
|
5
|
+
import { useRef, useState } from "react";
|
|
6
|
+
import type { ActionId, AgentSummary, AttentionView, DismissTab, HistoryFilter, IssueCloseReason, Item, NextUpIssue, Target, WrapItem } from "../shared/attention";
|
|
7
7
|
import type { AttentionConfig, SessionKind } from "../shared/config";
|
|
8
8
|
import { summarizeRerun } from "../shared/checks";
|
|
9
9
|
import { ALL_NOTES, ALL_WRAP } from "../shared/got-it";
|
|
@@ -124,6 +124,8 @@ export function useItemActions(attention: ReturnType<typeof useAttention>, navig
|
|
|
124
124
|
// makes a Wrap up row go away after its screenshot [ATT-22].
|
|
125
125
|
const [archivedSessions, setArchivedSessions] = useState<ReadonlySet<string>>(new Set());
|
|
126
126
|
const [undoable, setUndoable] = useState<Undoable[]>([]);
|
|
127
|
+
// Bumped when the tab changes and its Undo rows go, so a change still running then adds none to the next tab [ATT-08].
|
|
128
|
+
const undoTab = useRef(0);
|
|
127
129
|
const [placing, setPlacing] = useState<Placing | null>(null);
|
|
128
130
|
const [options, setOptions] = useState<OptionsSpec | null>(null);
|
|
129
131
|
const view = attention.data;
|
|
@@ -142,9 +144,11 @@ export function useItemActions(attention: ReturnType<typeof useAttention>, navig
|
|
|
142
144
|
// A change from one tap, without confirming: Undo instead, where it can be taken back [SAFE-01, ATT-08, ATT-14].
|
|
143
145
|
// The server answers each with the list after it, so nothing needs a refresh.
|
|
144
146
|
function change(key: string, label: string, work: () => Promise<AttentionView>, done: string, undo?: () => Promise<AttentionView>, dismissal?: boolean) {
|
|
147
|
+
const tab = undoTab.current;
|
|
145
148
|
void run(key, label, async () => {
|
|
146
149
|
attention.setView(await work());
|
|
147
150
|
if (!undo) return toast.show(done, { variant: "success" });
|
|
151
|
+
if (tab !== undoTab.current) return;
|
|
148
152
|
const id = Date.now() + Math.random();
|
|
149
153
|
setUndoable((rows) => [...rows, { id, text: done, undo: async () => attention.setView(await undo()), dismissal }]);
|
|
150
154
|
});
|
|
@@ -386,13 +390,13 @@ export function useItemActions(attention: ReturnType<typeof useAttention>, navig
|
|
|
386
390
|
busy,
|
|
387
391
|
archivedSessions,
|
|
388
392
|
undoable,
|
|
389
|
-
clearUndo: () => setUndoable([]),
|
|
393
|
+
clearUndo: () => ((undoTab.current += 1), setUndoable([])),
|
|
390
394
|
undo: (row: Undoable) =>
|
|
391
395
|
void run(String(row.id), "Undo", async () => {
|
|
392
396
|
await row.undo();
|
|
393
397
|
setUndoable((rows) => rows.filter((other) => other.id !== row.id));
|
|
394
398
|
}),
|
|
395
|
-
restoreDismissed: () => void run("restore", "Restore", async () => (attention.setView(await restore({})), setUndoable([]))),
|
|
399
|
+
restoreDismissed: (tab: DismissTab) => void run("restore", "Restore", async () => (attention.setView(await restore({ tab })), setUndoable([]))),
|
|
396
400
|
placing,
|
|
397
401
|
place,
|
|
398
402
|
cancelPlacing: () => setPlacing(null),
|
package/client/item-row.tsx
CHANGED
|
@@ -9,7 +9,7 @@ import type { SessionKind } from "../shared/config";
|
|
|
9
9
|
import { failingList, groupLabel, rerunHistory, summarizeRerun } from "../shared/checks";
|
|
10
10
|
import { ago } from "../shared/format";
|
|
11
11
|
import { noteBusy } from "../shared/got-it";
|
|
12
|
-
import { actionLabel, alsoWaitingOn, cardStack, cardWhen, copiesLink, rerunState, sessionSignal, type SheetStep, sheetPlan, soleStep, stackMetaChips, targetUrl, waitChips } from "../shared/item-view";
|
|
12
|
+
import { actionLabel, alsoWaitingOn, cardStack, cardWhen, copiesLink, rerunState, sessionSignal, type SheetStep, sheetPlan, soleStep, stackMetaChips, targetUrl, waitChips, waitedSince } from "../shared/item-view";
|
|
13
13
|
import { CardList, CardRow } from "./card";
|
|
14
14
|
import { PlaceText } from "./entity";
|
|
15
15
|
import type { IconName } from "./icons";
|
|
@@ -125,7 +125,7 @@ export function ItemRow({ item, first, actions, group }: { item: Item; first: bo
|
|
|
125
125
|
const waits = waitChips(item, !!group, actions.config.waitingTooLongDays);
|
|
126
126
|
// The group names one; the card names the rest [WAI-01].
|
|
127
127
|
const others = alsoWaitingOn(item, group?.who);
|
|
128
|
-
const waitingOn = group ? null : item.waitingOn ? <WaitingOnLine people={item.waitingOn}
|
|
128
|
+
const waitingOn = group ? null : item.waitingOn ? <WaitingOnLine people={item.waitingOn} reason={item.wait?.reason} expanded={false} /> : null;
|
|
129
129
|
const alsoOn = others.length ? <Text style={styles.muted}>also waiting on {others.join(", ")}</Text> : null;
|
|
130
130
|
const [sheet, setSheet] = useState<Sheet>(null);
|
|
131
131
|
const [confirm, setConfirm] = useState<"merge" | "close" | null>(null);
|
|
@@ -246,7 +246,7 @@ function ItemSheet({ item, waitChips, sessions, actions, ...handlers }: { item:
|
|
|
246
246
|
{/* Number first, as on the card; the sheet always names the owner, even of my own repos [ATT-20]. */}
|
|
247
247
|
<Meta lead={<PlaceText place={{ repo: item.repo, number: item.number, login: null }} />} facts={meta} chips={[...waitChips, ...stackMetaChips(item, targetRow)]} />
|
|
248
248
|
{item.person ? <PersonQuote person={item.person} expanded /> : null}
|
|
249
|
-
{item.waitingOn ? <WaitingOnLine people={item.waitingOn}
|
|
249
|
+
{item.waitingOn ? <WaitingOnLine people={item.waitingOn} reason={item.wait?.reason} expanded /> : null}
|
|
250
250
|
{item.children.length > 0 ? <StackLine rows={item.children} links target={targetRow?.key} /> : null}
|
|
251
251
|
</>
|
|
252
252
|
}
|
|
@@ -351,7 +351,7 @@ const MAX_FACES = 5;
|
|
|
351
351
|
|
|
352
352
|
// Who my work waits on: one by name, several by picture, named on hover, and each by name in the sheet [WAI-02].
|
|
353
353
|
// On an issue they're who my question tagged; on a PR, reviewers since my last push or reply [WAI-02, ATT-19].
|
|
354
|
-
function WaitingOnLine({ people,
|
|
354
|
+
function WaitingOnLine({ people, reason, expanded }: { people: WaitingOn[]; reason: string | undefined; expanded: boolean }) {
|
|
355
355
|
const styles = useStyles();
|
|
356
356
|
const [hovered, setHovered] = useState<string | null>(null);
|
|
357
357
|
const name = (login: string) => (
|
|
@@ -360,7 +360,7 @@ function WaitingOnLine({ people, asked, expanded }: { people: WaitingOn[]; asked
|
|
|
360
360
|
</Text>
|
|
361
361
|
);
|
|
362
362
|
const since = (at: string) => <Text style={styles.muted}>· {ago(at)}</Text>;
|
|
363
|
-
const explain = (logins: string[], at: string) => `Waiting on ${logins.join(", ")} since ${
|
|
363
|
+
const explain = (logins: string[], at: string) => `Waiting on ${logins.join(", ")} since ${waitedSince(reason)}, ${ago(at)} ago`;
|
|
364
364
|
if (expanded || people.length === 1) {
|
|
365
365
|
return (
|
|
366
366
|
<View style={{ gap: 6 }}>
|
package/docs/architecture.md
CHANGED
|
@@ -29,12 +29,13 @@ flowchart LR
|
|
|
29
29
|
- With several hosts, each runs its own copy, with its own `gh` login, `config.json` and `state.json`. Paseo shows one sidebar row for all of them and switches hosts with the picker in the screen's header; the row follows the host in view, else the one picked last.
|
|
30
30
|
- **GitHub access** goes through the host's existing `gh` login. The plugin stores no token [SEC-01]. Projects need the `read:project` scope, which `gh auth login` doesn't ask for; Next up reads them only once the login has it [NXT-12].
|
|
31
31
|
- **Setup checklist** [SET-01]: when a refresh fails, the screen asks the server what setup needs (`gh api user` for whether `gh` is there and who it's signed in as, and whether `config.json` parses). If `gh` is missing or signed out, or the file is broken, a checklist takes the tabs' place. Each line says how to fix it, and Check again refreshes. It also lists what's covered, the Paseo projects with a GitHub remote, and which profile sessions will use. Other failures, like a network error, stay a red line above the tabs.
|
|
32
|
-
- **Settings screen** [SRC-02], under Settings → Plugins → Attention Span and the gear next to ⟳: orgs and repos, one per row. Each is checked with `gh api users/<org>` (it must be an organization, since searches use `org:`) or `gh api repos/<owner>/<name>` before it's saved, and GitHub's exact name is kept. Saving rewrites only `orgs` and `repos` in `config.json`, refuses a file that doesn't parse, and refreshes the lists. A Replies section has one switch, Follow threads I've commented on, which writes only `followThreads` [ATT-17].
|
|
32
|
+
- **Settings screen** [SRC-02], under Settings → Plugins → Attention Span and the gear next to ⟳: orgs and repos, one per row. Each is checked with `gh api users/<org>` (it must be an organization, since searches use `org:`) or `gh api repos/<owner>/<name>` before it's saved, and GitHub's exact name is kept. Saving rewrites only `orgs` and `repos` in `config.json`, refuses a file that doesn't parse, and refreshes the lists. A Replies section has one switch, Follow threads I've commented on, which writes only `followThreads` [ATT-17]. A Waiting section has one switch, Only questions wait, which writes only `onlyQuestionsWait` [WAI-01].
|
|
33
33
|
- **Local files** live in `~/.config/paseo-attention-span/`:
|
|
34
34
|
- `config.json`, edited by hand, except `orgs` and `repos` (the settings screen) and `codeRepos`, which the screen can add to:
|
|
35
35
|
- orgs and repos [SRC-01]
|
|
36
36
|
- a profile per reason: `review` for Review, `default` for everything else
|
|
37
37
|
- `followThreads` (default off, also under Settings → Replies → Follow threads I've commented on): recent replies after mine on other people's threads show under Answered [ATT-17]
|
|
38
|
+
- `onlyQuestionsWait` (default off, also under Settings → Waiting → Only questions wait): my words wait on whom they tag only if they ask a question; off, a tag alone waits [WAI-01]
|
|
38
39
|
- `waitingTooLongDays` (default 3) [ATT-11] and `refreshMinutes` (default 15) [FRESH-01], `historyWeeks` (default 4) [HIS-01]
|
|
39
40
|
- optional prompt templates that replace the built-in ones [SES-04]
|
|
40
41
|
- optional merge method per repo [PRS-04]
|
|
@@ -50,7 +51,7 @@ The tabs tell the story of my work, left to right: what I finished, what needs m
|
|
|
50
51
|
|---|---|
|
|
51
52
|
| History | The last `historyWeeks` (default 4) by week, newest first, in the device's time zone [HIS-01]; which items each week shows and copies is `shared/history-report.ts`, drawn by `client/history.tsx`. Above the weeks, **Changed by others** lists the unread notes, newest first: my PR merged or closed unmerged by someone else, an issue assigned to me closed by someone else as completed or not planned, a PR of mine reopened by someone else after Attention Span saw it closed, my PR or issue taken over or handed on, or me unassigned from an issue. Each is a row in the same words ("merged by dave 2h ago", "closed by alice 6h ago as completed", "reopened by bob 1h ago", "phil took over", "bob unassigned you 8d ago"), its tile showing what happened [HIS-07]. **Got it**, an icon-only check in the main action's style, clears one (Undo brings it back); with two or more, a ghost **✓ Mark all as read** clears the notes on screen, one Undo bringing them all back, and the two wait for each other in `shared/got-it.ts`. A note about work already in Doing's Wrap up waits there instead, because archiving it is the acknowledgement; unread notes expire after `mentionDays` (default 30). They never count in Doing's count, the sidebar's or the horizon, and the History tab shows a green dot and says "unread changes" to screen readers while any is unread. **Filter** between the notes and the weeks opens a sheet, *Show in each week*: Finished (always, disabled), Reviewed and Changed by others, both off at first and remembered in `state.json`; the button reads "Filter · n" in green when on. With Reviewed on, each week shows a labelled **Reviewed** list of others' merged PRs I reviewed [HIS-02]; with Changed by others on, a labelled list of its cleared notes that aren't already finished work, like a PR closed unmerged, a handover or a reopen [HIS-06, HIS-07]. These replace the old collapsed disclosures. Each week's count is its finished items. A PR of mine someone else merged says so: "merged 2h ago by dave", with its copied line unchanged; under the issue it closed, its row in the sheet says "merged by dave" [HIS-05]. An issue someone else closed says "closed 6h ago by alice" too. A merge or issue close the live refresh sees fills its week at once, before History's daily fetch; when the fetch catches up, its richer card takes the live one's place [HIS-07]. A PR of mine the live refresh sees merged that History doesn't list, merged on GitHub say, has History fetched once its search has caught up (`SETTLE_MS` later), once per PR, so a search slow to show it doesn't fetch on every refresh [FRESH-03]. A PR that left my hands isn't listed as done even once its new owner merges it; a handover cleared into a week stays there if the work comes back to me, but doesn't hide what I later finish [HIS-06]. The copy icon on a week's heading copies what's shown as Markdown lists of links, per kind: Finished, plus Reviewed when shown, separated by `## Finished` and `## Reviewed` headings; never Changed by others; an issue and the PRs that closed it are one line, linking the issue; an issue closed as not planned isn't copied, and PRs that referred to it are listed on their own [HIS-03]. Each card has a plain chip (bug, feature or task) for what kind of work it was, and each copied line leads with its emoji: 🐞, 🚀 or 🔧; a PR of none of those leads with 🔀 and has no chip, an issue of none leads with nothing [HIS-04]. The first of these that names a kind decides: the issue type, the labels (bug beats feature beats task), a Conventional Commit title prefix (`fix:` bug, `feat:` feature, `chore:`, `refactor:`, `docs:`, `build:`, `ci:`, `test:`, `perf:`, `style:` task). Types and labels match only as whole names, ignoring case, emoji and wrappers like `type:` or `kind/`, so "bug", "Type: Bug 🐞" and "kind/bug" count but "not a bug" and "bug bash" don't. Until History is fetched again, what I just finished uses the issue type and title only. |
|
|
52
53
|
| Doing | The sections below |
|
|
53
|
-
| Waiting | My work where someone else has the next move [WAI-01]: *Waiting for review* (while GitHub records a review as owed: a pending request, or an approval or requested changes; or approved but blocked by a repo rule [PRS-13]), *Waiting for the reviewer* (after I replied or pushed), *CI running*, *Questions I asked* (threads where my
|
|
54
|
+
| Waiting | My work where someone else has the next move [WAI-01]: *Waiting for review* (while GitHub records a review as owed: a pending request, or an approval or requested changes; or approved but blocked by a repo rule [PRS-13]), *Waiting for the reviewer* (after I replied or pushed), *CI running*, *Questions I asked* (threads where my words are the last from a person, bots don't count, and my words since someone else last spoke tag someone or ask something: a question mark outside quotes, code and links, read from GitHub's rendered comments (`bodyHTML`) so code and links count however they were written. On an issue I opened, its opening is my first words, when the fetched comments reach back to it. With `onlyQuestionsWait` on (Settings → Waiting → Only questions wait, off by default) a statement waits on nobody, tagged or not; with it off, a tagged statement waits on whom it tags. An untagged statement isn't listed): on my own issues however old, on others' only while my comment is within `mentionDays` [ATT-11]. Each shows who it waits on, never a guess [WAI-02]: on a PR, the reviewers currently requested and, after I replied, whoever requested changes, but nobody when a repo rule blocks it; on a question or tag, the people and teams my words since the last answer tag, read from GitHub's rendered comments (`bodyHTML`), where only real accounts and teams I can see are linked, never in code; bots aren't tags: GitHub links no app (`@github-actions`), links some to an organization (`@dependabot`), which is nobody to nudge, and `@renovate[bot]` to a user followed by `[bot]`, and all of those are skipped; tags in quotes don't count, and only the last 10 comments are read. Waiting groups it all by who it waits on, not by those reasons [WAI-01]: one group per person or team (a person tagged with other capitals is one), whoever blocks the most items first, ties by whose oldest item has waited longest, then requested bots, who can't be nudged, and last *Not on a person* for work nobody is on record for. In each group, work with a session that needs me leads, then one that's working, then the rest, oldest first; a finished session I've seen doesn't lift it. Work waiting on several is under each, saying "also waiting on" the rest, and counts once in the tab. Each card says why it waits (review, re-review, question or tagged; nothing where its chips say, like approved, blocked by repo rules, or CI running) and since when. A group's **Copy list** copies its items oldest first as a Markdown list, each line led by why and how long ("- Review 2h: [title](url)"), for a nudge; a requested bot gets none [WAI-03]. My PRs in Doing that wait on people or teams I asked, approved or not, are listed here too, under each of them [PRS-15]. Once something has waited `waitingTooLongDays` (default 3), its age turns amber with ⌛ and says so on hover, but only where a nudge is fair: not while CI fails or runs, nor with conflicts, changes to make or a reply I owe (`nudgeable` in `server/rules.ts`) [ATT-11]. In Doing, one person shows by name, several by picture, named on hover and in the sheet. |
|
|
54
55
|
| Next up | *Assigned to you* [NXT-06], then *Unclaimed* [NXT-01] |
|
|
55
56
|
|
|
56
57
|
Every card in every tab is the same component, `CardRow` in `client/card.tsx` [ATT-05]: a tinted mark for what it is, a title of at most two lines, then the item's number, its repo (the name brighter than the owner, which my own repos leave out) [ATT-20], when it happened and signal chips, then content only some lists have (pills, a quote, a stack line), and its actions: on the right on desktop, labelled under the text on phones. A change on GitHub asks first in a `ConfirmBar` on the card [SAFE-01]. Tabs differ only in what they pass in: each maps its data to the card's mark, meta, actions and slots. What an item's card and sheet show, and in what order, is decided in `shared/item-view.ts` and drawn by `client/item-row.tsx`; the actions behind them are `useItemActions` in `client/item-actions.ts`. Marks and signals take a tone, never a raw theme color, because some themes draw `accent` close to white. How an item itself is shown, its number and repo and an issue's pills, lives in `client/entity.tsx` (`PlaceText`, `IssuePills`, `ProjectPill`, `FieldPill`, GitHub's option colors), so cards and sheets compose the same pieces rather than format their own; `client/ui.tsx` keeps the generic ones (`Meta`, `Pill`, `Signal`).
|
|
@@ -99,7 +100,7 @@ Top to bottom. Each item appears once, under its most urgent reason [ATT-02]. `s
|
|
|
99
100
|
- **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]. PR cards and linked stack rows share state marks: open green, draft muted, closed unmerged red and merged purple; each stack row uses its own state, with merge timestamps supporting older saved rows. Cards show their main action and one Details chevron; Keep open and Dismiss live in the sheet. Close-issue prompts also offer the shared Start a session / Start another session entry, opening the usual session options on the issue. Their navigation lists all matching sessions, including working sessions; archive eligibility stays separate. 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
101
|
- **Close #12?** [ATT-24] (`classifyCloseAsks` in `server/classify.ts`): after History's searches, the issues my merged PRs close, by GitHub's link or a closing keyword, 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 also closes. 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`).
|
|
101
102
|
|
|
102
|
-
- **Dismiss** [ATT-08] hides an item until someone other than me comments, reviews or pushes, or its reason changes. My
|
|
103
|
+
- **Dismiss** [ATT-08], in the sheet of Doing and Waiting items, hides an item until someone other than me comments, reviews or pushes, or its reason changes. It also comes back when I add to it: my new words on a thread, or a push, review reply or conversation comment on my PR; a comment, like a nudge, doesn't restart the wait's age (`mineAt` on the item). My other actions and CI reruns don't bring it back. A PR of mine in both Doing and Waiting is one item, hidden from both. Doing and Waiting each say how many of theirs are dismissed, "n dismissed · show them again", and bring back only theirs.
|
|
103
104
|
- **Behind base** [UPS-07] only matters when:
|
|
104
105
|
1. the PR conflicts with its base,
|
|
105
106
|
2. a stacked PR no longer builds on its parent's head,
|
|
@@ -119,7 +120,7 @@ Projects are extra, so they never cost the searches they ride on (`server/projec
|
|
|
119
120
|
|
|
120
121
|
## Actions
|
|
121
122
|
|
|
122
|
-
A card shows its main action and ›. Tapping the card or › opens its **sheet**, a bottom sheet on phones and a dialog on desktop [ATT-06]. When the sheet would hold a single action, as on
|
|
123
|
+
A card shows its main action and ›. Tapping the card or › opens its **sheet**, a bottom sheet on phones and a dialog on desktop [ATT-06]. When the sheet would hold a single action, as on History cards where it's only Open PR (or issue) on GitHub, the card shows that action instead of ›; Doing and Waiting cards always have Dismiss too, so they show ›; tapping the card still opens the sheet. History cards also have a copy icon that copies the item's URL [ATT-15]. Top to bottom, the sheet has:
|
|
123
124
|
|
|
124
125
|
1. **What the card knows:** repo#number, its chips, the full quote and the full stack. Each PR in the stack opens on GitHub, so an issue's PRs are a tap away [ATT-12]. On an issue, the PR its actions apply to is tinted in the stack and says "actions apply here", and its chips are said once, on its row: the top keeps only what the row doesn't say [ATT-04].
|
|
125
126
|
2. **Every action,** each with a line saying what it will do, in one list, with what takes the item off my list or gives it up (Dismiss, Unclaim, Close issue, Close PR) apart below the work, icons quiet. A session action's line asks first: it ends in "…" and opens Options, since the card's button is the one-tap start [SES-01, SES-02]. Once a session of that kind runs, the line opens it instead and shows its state as a badge (working, idle, needs you, failed) [SES-03, ATT-07]. Then Open issue or Open PR on GitHub [ATT-12], with a copy icon at its end that copies the URL without adding a line [ATT-15]. An issue with a PR splits that line in two halves of the same weight, "Open issue #90" and "Open PR #103 · 1 of 2", each with its own copy icon, side by side on desktop and one above the other on phones: the PR is the one its actions apply to (in Next up, the first open PR against it), so reaching it doesn't mean going through the issue on GitHub. Then a muted "Start a session…" ("Start another session…" once there is one) for a session with no action preset [SES-02], and Dismiss [ATT-08].
|
|
@@ -205,7 +206,8 @@ One GraphQL request per search, sent in parallel (`server/fetch.ts`; the service
|
|
|
205
206
|
- `is:open mentions:@me updated:>=<30 days ago>` (fetching the description, recent comments, review-thread comments, their IDs for 👍, and `viewerHasReacted`)
|
|
206
207
|
- `is:issue is:open assignee:@me`
|
|
207
208
|
- `is:open involves:@me updated:>=<30 days ago> sort:updated-desc`, 100 at most, issues and PRs with their last 10 conversation comments, as for mentions (for Answered and fresh questions) [ATT-16]
|
|
208
|
-
- `is:issue is:open author:@me commenter:@me sort:updated-desc`, 50 at most, no date limit, the same fields (questions on my own issues nobody answered, however old) [ATT-11]
|
|
209
|
+
- `is:issue is:open author:@me commenter:@me sort:updated-desc`, 50 at most, no date limit, the same fields plus the opening (questions and tags on my own issues nobody answered, however old) [ATT-11, WAI-01]
|
|
210
|
+
- `is:issue is:open author:@me -commenter:@me sort:updated-desc`, 50 at most, no date limit, the same fields (an opening on my own issue that tags someone or asks, before a person comments; bots' comments don't count), apart from the one above so these don't crowd out questions [WAI-01]
|
|
209
211
|
- `is:pr is:closed author:@me closed:>=<30 days ago> sort:updated-desc`, 50 at most, with `mergedBy`, the last close event's actor and assignees [HIS-07]
|
|
210
212
|
- `is:issue is:closed assignee:@me closed:>=<30 days ago> sort:updated-desc`, 50 at most, with `stateReason` and the last close event's actor (an issue someone else closed) [HIS-07]
|
|
211
213
|
- `is:issue is:open no:assignee` (Next up, with issue type and field values, and projects when the login may read them [NXT-12]; one request per source [NXT-09], skipped when there's nowhere to look [NXT-08]). "My repos" needs my login, taken from the last fetch or asked once with `viewer { login }`
|
|
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
|
@@ -77,7 +77,7 @@ export default function contribute(server: PluginServerContext) {
|
|
|
77
77
|
return ready(() => attention.dismissKept(workspaceId)).then(shown);
|
|
78
78
|
});
|
|
79
79
|
server.on("workspace.archived", ({ workspace }) => void ready(() => attention.forgetKept(workspace.id)));
|
|
80
|
-
server.handle(rpc.restoreDismissed, () => ready(() => attention.restoreDismissed()).then(shown));
|
|
80
|
+
server.handle(rpc.restoreDismissed, ({ tab }) => ready(() => attention.restoreDismissed(tab)).then(shown));
|
|
81
81
|
server.handle(rpc.setCodeRepo, ({ issueRepo, codeRepo }) => ready(() => attention.setCodeRepo(issueRepo, codeRepo)).then(shown));
|
|
82
82
|
server.handle(rpc.setupStatus, () => setupStatus(store, answers.ghStatus));
|
|
83
83
|
server.handle(rpc.getCoverage, () => configStatus(store));
|
|
@@ -87,6 +87,7 @@ export default function contribute(server: PluginServerContext) {
|
|
|
87
87
|
server.handle(rpc.issueFields, () => ready(async () => ({ fields: await attention.issueFields() })));
|
|
88
88
|
server.handle(rpc.setNextUpFields, (fields) => ready(() => attention.setNextUpFields(fields)).then(() => ({ ok: true as const })));
|
|
89
89
|
server.handle(rpc.setFollowThreads, ({ on }) => ready(() => attention.setFollowThreads(on)).then(() => ({ ok: true as const })));
|
|
90
|
+
server.handle(rpc.setOnlyQuestionsWait, ({ on }) => ready(() => attention.setOnlyQuestionsWait(on)).then(() => ({ ok: true as const })));
|
|
90
91
|
server.handle(rpc.myOrgs, async () => ({ orgs: await answers.myOrgs() }));
|
|
91
92
|
server.handle(rpc.setScopes, ({ scopes }) => ready(() => attention.setScopes(scopes)).then(() => ({ ok: true as const })));
|
|
92
93
|
server.handle(rpc.setSources, ({ sources }) => ready(() => attention.setSources(sources)).then(() => ({ ok: true as const })));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@andrioid/paseo-attention-span",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.1",
|
|
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
|
@@ -109,8 +109,8 @@ functional:
|
|
|
109
109
|
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.
|
|
110
110
|
waiting:
|
|
111
111
|
As a developer, I can:
|
|
112
|
-
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.
|
|
113
|
-
WAI-02: see who my waiting work waits on: reviewers I asked, reviewers who asked for changes and people I tagged in my unanswered
|
|
112
|
+
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, the opening of an issue I opened included, ask a question or tag someone, or only a question when I choose that only questions wait; so that I know that work is tracked and who is blocking me most.
|
|
113
|
+
WAI-02: see who my waiting work waits on: reviewers I asked, reviewers who asked for changes and people I tagged in my unanswered words but not bots, and nobody where none of those apply; so that I know whom to nudge without guessing.
|
|
114
114
|
WAI-03: copy the list of my work waiting on one person or team, oldest first, each line a Markdown link led by why and for how long, like "Review 2h: [title](link)"; so that nudging them is one paste they can skim.
|
|
115
115
|
WAI-04: see a calm scene in Waiting when nothing waits on anyone, only once a refresh has confirmed it; so that being blocked by nobody feels like rest rather than a blank page.
|
|
116
116
|
history:
|
package/server/classify.ts
CHANGED
|
@@ -46,6 +46,7 @@ interface Part {
|
|
|
46
46
|
waitingOn?: WaitingOn[];
|
|
47
47
|
wait?: Item["wait"];
|
|
48
48
|
othersActivityAt: string;
|
|
49
|
+
mineAt?: string;
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
const EPOCH = "1970-01-01T00:00:00Z";
|
|
@@ -137,6 +138,8 @@ function prState(
|
|
|
137
138
|
// Requested changes stay mine until I push after them.
|
|
138
139
|
changes: onMe.length > 0 || (pr.reviewDecision === "CHANGES_REQUESTED" && !(lastCommitAt > changesRequestedAt)),
|
|
139
140
|
repliedAt: latest(...unresolved.filter((thread) => isMe(last(thread)?.author)).map((thread) => last(thread)?.createdAt)),
|
|
141
|
+
// My last conversation comment, like a nudge: it brings a dismissed PR back, but doesn't restart its wait [ATT-08].
|
|
142
|
+
commentedAt: latest(...pr.comments.nodes.filter((c) => isMe(c.author)).map((c) => c.createdAt)),
|
|
140
143
|
lastCommitAt,
|
|
141
144
|
behindBy,
|
|
142
145
|
// A stacked PR no longer builds on its parent's latest version [UPS-02].
|
|
@@ -194,9 +197,9 @@ export function classify({ data, details, config, now }: ClassifyInput): Attenti
|
|
|
194
197
|
if (waiting) mentions.set(prKey(node), waiting);
|
|
195
198
|
}
|
|
196
199
|
|
|
197
|
-
// What each thread I'm in is waiting for: an answer, or me [ATT-16].
|
|
200
|
+
// What each thread I'm in is waiting for: an answer, or me [ATT-16]. Several searches can find one; it's the same thread.
|
|
198
201
|
const threads = new Map<string, IssueNode>();
|
|
199
|
-
for (const node of [...compact(data.involved.nodes), ...compact(data.asked.nodes)]) threads.set(prKey(node), node);
|
|
202
|
+
for (const node of [...compact(data.involved.nodes), ...compact(data.asked.nodes), ...compact(data.opened.nodes)]) threads.set(prKey(node), node);
|
|
200
203
|
const answers = new Map<string, NonNullable<ReturnType<typeof threadState>>>();
|
|
201
204
|
for (const [key, node] of threads) {
|
|
202
205
|
const found = threadState(node, me, now, config);
|
|
@@ -296,6 +299,7 @@ export function classify({ data, details, config, now }: ClassifyInput): Attenti
|
|
|
296
299
|
(section === "changes" && s.botThreadsOnly ? { login: "review bot", bot: true, since: s.lastCommitAt, role: "changes" as const } : undefined),
|
|
297
300
|
waitingOn: waitingOn.length > 0 ? waitingOn : undefined,
|
|
298
301
|
othersActivityAt: latest(...stack.map((pr) => state(pr).othersActivityAt), waiting?.since, answer?.since),
|
|
302
|
+
mineAt: latest(waitingSince, ...stack.map((pr) => state(pr).commentedAt)),
|
|
299
303
|
};
|
|
300
304
|
};
|
|
301
305
|
|
|
@@ -337,6 +341,7 @@ export function classify({ data, details, config, now }: ClassifyInput): Attenti
|
|
|
337
341
|
wait: lead.wait ?? other?.wait,
|
|
338
342
|
chips: [...lead.chips, ...(stack.length > 1 ? [chip(`stack of ${stack.length}`)] : [])],
|
|
339
343
|
othersActivityAt: latest(lead.othersActivityAt, other?.othersActivityAt),
|
|
344
|
+
mineAt: latest(lead.mineAt, other?.mineAt),
|
|
340
345
|
};
|
|
341
346
|
});
|
|
342
347
|
type Unit = (typeof units)[number];
|
|
@@ -408,6 +413,7 @@ export function classify({ data, details, config, now }: ClassifyInput): Attenti
|
|
|
408
413
|
// Actions on GitHub act on my PRs, from my bottom one; Review checks out the top of the stack [ATT-04].
|
|
409
414
|
target: target(unit.own[0] ?? bottom, unit.stack),
|
|
410
415
|
othersActivityAt: latest(...grouped.map((u) => u.othersActivityAt), issueWaiting?.since),
|
|
416
|
+
mineAt: latest(...grouped.map((u) => u.mineAt)),
|
|
411
417
|
});
|
|
412
418
|
}
|
|
413
419
|
|
|
@@ -436,10 +442,11 @@ export function classify({ data, details, config, now }: ClassifyInput): Attenti
|
|
|
436
442
|
...plain(issue, kind, section),
|
|
437
443
|
person,
|
|
438
444
|
waitingOn: section !== "answered" && tagged.length > 0 ? tagged : undefined,
|
|
439
|
-
wait: section === "answered" ? undefined : { reason: "question", since, ...(tooLong ? { tooLong } : {}) },
|
|
445
|
+
wait: section === "answered" ? undefined : { reason: flags.question ? "question" : "tagged", since, ...(tooLong ? { tooLong } : {}) },
|
|
440
446
|
actions: section === "answered" ? replyActions(person) : [],
|
|
441
|
-
// A new answer brings back a dismissed one [ATT-08].
|
|
447
|
+
// A new answer brings back a dismissed one, and so do my new words [ATT-08].
|
|
442
448
|
othersActivityAt: person ? latest(...(person.comments ?? []).map((c) => c.createdAt)) : EPOCH,
|
|
449
|
+
mineAt: mine,
|
|
443
450
|
});
|
|
444
451
|
}
|
|
445
452
|
|
|
@@ -525,37 +532,41 @@ export function classifyCloseAsks(data: HistoryResult): CloseAsk[] {
|
|
|
525
532
|
return [...asks.values()].map((ask) => ({ ...ask, prs: ask.prs.sort((a, b) => a.mergedAt!.localeCompare(b.mergedAt!)) }));
|
|
526
533
|
}
|
|
527
534
|
|
|
528
|
-
// Whether my last
|
|
529
|
-
// On a thread I opened,
|
|
535
|
+
// Whether my last words on a thread are the last from a person, and if not, the recent comments since that I haven't 👍'd.
|
|
536
|
+
// On a thread I opened, its opening is my first words: when every comment was fetched, it's in my words since someone else
|
|
537
|
+
// last spoke, and its tags and questions count as a comment's do. Bots don't count [MEN-05, WAI-01]. Only the last comments
|
|
530
538
|
// are fetched: on someone else's thread, once mine is out of them the conversation has moved on.
|
|
531
539
|
export function threadState(
|
|
532
540
|
thread: IssueNode,
|
|
533
541
|
me: string,
|
|
534
542
|
now: Date,
|
|
535
|
-
config: Pick<AttentionConfig, "mentionDays" | "followThreads">,
|
|
543
|
+
config: Pick<AttentionConfig, "mentionDays" | "followThreads" | "onlyQuestionsWait">,
|
|
536
544
|
): { flags: IssueState; person?: Person; mine: string; tagged: WaitingOn[] } | null {
|
|
537
545
|
const authored = thread.author?.login.toLowerCase() === me;
|
|
538
|
-
const
|
|
546
|
+
const all = thread.comments.totalCount === undefined || thread.comments.totalCount <= thread.comments.nodes.length;
|
|
547
|
+
const opening: Comment[] = authored && all ? [{ author: thread.author, bodyHTML: thread.bodyHTML, createdAt: thread.createdAt }] : [];
|
|
548
|
+
const people = [...opening, ...thread.comments.nodes.filter((c) => c.author && c.author.__typename !== "Bot")];
|
|
539
549
|
const index = people.findLastIndex((c) => c.author?.login.toLowerCase() === me);
|
|
540
550
|
if (index < 0 && !authored) return null;
|
|
541
551
|
const mine = index < 0 ? thread.createdAt : people[index].createdAt;
|
|
542
552
|
const after = people.slice(index + 1);
|
|
543
553
|
const recent = (at: string) => daysSince(at, now) < config.mentionDays;
|
|
544
554
|
const unread = after.filter((c) => recent(c.createdAt) && !c.reactionGroups?.some((group) => group.viewerHasReacted));
|
|
545
|
-
// My
|
|
555
|
+
// My words since someone else last spoke; bots don't end the run.
|
|
546
556
|
let first = index;
|
|
547
557
|
while (first > 0 && people[first - 1].author?.login.toLowerCase() === me) first -= 1;
|
|
548
558
|
const run = index >= 0 ? people.slice(first, index + 1) : [];
|
|
559
|
+
const tagged = index >= 0 && after.length === 0 ? taggedSince(run, me, thread.url) : [];
|
|
549
560
|
const flags: IssueState = {
|
|
550
561
|
authored,
|
|
551
562
|
follow: config.followThreads,
|
|
552
|
-
// Opening a thread isn't asking a question; a comment is.
|
|
553
563
|
mineLast: index >= 0 && after.length === 0,
|
|
554
564
|
question: run.some((comment) => asksQuestion(comment.bodyHTML)),
|
|
565
|
+
tags: tagged.length > 0,
|
|
566
|
+
onlyQuestions: config.onlyQuestionsWait,
|
|
555
567
|
answered: unread.length > 0,
|
|
556
568
|
fresh: recent(mine),
|
|
557
569
|
};
|
|
558
|
-
const tagged = flags.mineLast ? taggedSince(run, me, thread.url) : [];
|
|
559
570
|
const last = unread.at(-1);
|
|
560
571
|
if (!last?.author) return { flags, mine, tagged };
|
|
561
572
|
return {
|
|
@@ -574,7 +585,7 @@ export function threadState(
|
|
|
574
585
|
};
|
|
575
586
|
}
|
|
576
587
|
|
|
577
|
-
// Who my
|
|
588
|
+
// Who my words since someone else last spoke tag, each from the first that tags them; only the fetched comments
|
|
578
589
|
// count. A tag gives just a name, so a person's picture is GitHub's for that name [WAI-02].
|
|
579
590
|
function taggedSince(run: Comment[], me: string, url: string): WaitingOn[] {
|
|
580
591
|
const origin = new URL(url).origin;
|
package/server/fetch.ts
CHANGED
|
@@ -110,7 +110,7 @@ export async function searchLive(gh: Gh, config: AttentionConfig, now: Date, unc
|
|
|
110
110
|
};
|
|
111
111
|
const merge = (parts: Partial<LiveResult>[]) => Object.assign({}, ...parts) as LiveResult;
|
|
112
112
|
const forDetails = Promise.all([search("mine"), search("reviews"), search("assigned"), searchUnclaimed()]);
|
|
113
|
-
const others = Promise.all([search("mentions"), search("involved"), search("asked"), search("ended"), search("closedIssues")]);
|
|
113
|
+
const others = Promise.all([search("mentions"), search("involved"), search("asked"), search("opened"), search("ended"), search("closedIssues")]);
|
|
114
114
|
const afterThem = forDetails.then((parts) => details(gh, config, merge(parts), projects.on, projects.problems));
|
|
115
115
|
const [first, rest, found] = await Promise.all([forDetails, others, afterThem]);
|
|
116
116
|
return { data: merge([...first, ...rest]), details: found };
|
package/server/fixture.ts
CHANGED
|
@@ -137,6 +137,7 @@ export function builders(now: Date) {
|
|
|
137
137
|
mentions: nodes("mentions") as SearchResult["mentions"],
|
|
138
138
|
involved: nodes("involved") as SearchResult["involved"],
|
|
139
139
|
asked: nodes("asked") as SearchResult["asked"],
|
|
140
|
+
opened: nodes("opened") as SearchResult["opened"],
|
|
140
141
|
assigned: nodes("assigned") as SearchResult["assigned"],
|
|
141
142
|
unclaimed: nodes("unclaimed") as SearchResult["unclaimed"],
|
|
142
143
|
merged: nodes("merged") as SearchResult["merged"],
|
|
@@ -264,7 +265,7 @@ export function fixture(now: Date): { data: SearchResult; details: Details } {
|
|
|
264
265
|
),
|
|
265
266
|
// A comment on my PR's conversation [ATT-16].
|
|
266
267
|
issue(111, [comment(bob, "Big change. Could you split the index migration into its own PR?", 0.2)], "Faster product search", { __typename: "PullRequest", author: me, createdAt: daysAgo(2) }),
|
|
267
|
-
// A statement that tags someone
|
|
268
|
+
// A statement that tags someone waits on them, unless only questions wait [WAI-01].
|
|
268
269
|
issue(145, [comment(me, "@bob deployed the fix to staging.", 0.5, { bodyHTML: `<p>${tag("bob")} deployed the fix to staging.</p>` })], "Checkout hangs on slow networks"),
|
|
269
270
|
// Someone else's old thread where people kept going after me: not mine to follow [ATT-16].
|
|
270
271
|
issue(144, [comment(me, "Same here on 2.3", 400), comment(bob, "+1", 300)], "Crash on startup"),
|
package/server/github-types.ts
CHANGED
|
@@ -89,11 +89,14 @@ export interface IssueNode {
|
|
|
89
89
|
__typename?: "Issue" | "PullRequest";
|
|
90
90
|
createdAt: string;
|
|
91
91
|
author: Actor | null;
|
|
92
|
+
// GitHub's rendering of its opening, where tags of real accounts are links [WAI-01, WAI-02].
|
|
93
|
+
bodyHTML?: string;
|
|
92
94
|
number: number;
|
|
93
95
|
title: string;
|
|
94
96
|
url: string;
|
|
95
97
|
repository: Repo;
|
|
96
|
-
comments
|
|
98
|
+
// How many conversation comments there are, to tell whether the fetched ones reach back to the opening.
|
|
99
|
+
comments: Nodes<Comment> & { totalCount?: number };
|
|
97
100
|
}
|
|
98
101
|
|
|
99
102
|
export interface PickableNode {
|
|
@@ -129,6 +132,7 @@ export interface LiveResult {
|
|
|
129
132
|
mentions: Nodes<MentionNode>;
|
|
130
133
|
involved: Nodes<IssueNode>;
|
|
131
134
|
asked: Nodes<IssueNode>;
|
|
135
|
+
opened: Nodes<IssueNode>;
|
|
132
136
|
assigned: Nodes<PickableNode>;
|
|
133
137
|
unclaimed: Nodes<PickableNode>;
|
|
134
138
|
// My PRs closed lately [HIS-07].
|
package/server/markdown.ts
CHANGED
|
@@ -96,10 +96,13 @@ export function asksQuestion(html: string | undefined): boolean {
|
|
|
96
96
|
|
|
97
97
|
// People and teams tagged in a comment, from GitHub's rendering of it: GitHub links a tag only to an account that exists and
|
|
98
98
|
// a team I can see, and never in code. Tags in quoted replies are someone else's words, so they don't count [WAI-02].
|
|
99
|
+
// Bots don't count either: GitHub links no app like @github-actions or @copilot, links @dependabot and @coderabbitai to an
|
|
100
|
+
// organization, which is nobody to nudge, and @renovate[bot] to the user before its "[bot]" [WAI-02].
|
|
99
101
|
export function taggedIn(html: string | undefined): { login: string; team: boolean }[] {
|
|
100
102
|
const text = ownWords(html);
|
|
101
103
|
const tags: { login: string; team: boolean }[] = [];
|
|
102
|
-
for (const [, attributes] of text.matchAll(/<a\b([^>]*)
|
|
104
|
+
for (const [, attributes, bot] of text.matchAll(/<a\b([^>]*)>[\s\S]*?<\/a>(\[bot\])?/g)) {
|
|
105
|
+
if (bot || /\bdata-hovercard-type="organization"/.test(attributes)) continue;
|
|
103
106
|
const kind = /\bclass="[^"]*\b(user|team)-mention\b/.exec(attributes)?.[1];
|
|
104
107
|
const path = /\bhref="(?:https?:\/\/[^/"]+)?([^"?#]*)/.exec(attributes)?.[1] ?? "";
|
|
105
108
|
const team = /^\/orgs\/([^/]+)\/teams\/([^/]+)\/?$/.exec(path);
|
package/server/queries.ts
CHANGED
|
@@ -5,8 +5,8 @@ import type { IssueRef } from "./references";
|
|
|
5
5
|
|
|
6
6
|
// An issue or PR with its last conversation comments [ATT-16], rendered too for who my questions tag [WAI-02].
|
|
7
7
|
const THREAD = `__typename
|
|
8
|
-
... on Issue { number title url createdAt author { ...author } repository { nameWithOwner } comments(last: 10) { nodes { ...comment bodyHTML } } }
|
|
9
|
-
... on PullRequest { number title url createdAt author { ...author } repository { nameWithOwner } comments(last: 10) { nodes { ...comment bodyHTML } } }`;
|
|
8
|
+
... on Issue { number title url createdAt bodyHTML author { ...author } repository { nameWithOwner } comments(last: 10) { totalCount nodes { ...comment bodyHTML } } }
|
|
9
|
+
... on PullRequest { number title url createdAt bodyHTML author { ...author } repository { nameWithOwner } comments(last: 10) { totalCount nodes { ...comment bodyHTML } } }`;
|
|
10
10
|
|
|
11
11
|
// Each search with how many results it asks for and what it reads of each.
|
|
12
12
|
const SEARCHES = {
|
|
@@ -26,6 +26,8 @@ const SEARCHES = {
|
|
|
26
26
|
involved: { first: 100, nodes: THREAD },
|
|
27
27
|
// My own issues where I commented, for questions nobody answered however old [ATT-11].
|
|
28
28
|
asked: { first: 50, nodes: THREAD },
|
|
29
|
+
// My own issues I haven't commented on, for an opening that tags someone or asks, however old [WAI-01].
|
|
30
|
+
opened: { first: 50, nodes: THREAD },
|
|
29
31
|
assigned: { first: 50, nodes: "...pickable" },
|
|
30
32
|
unclaimed: { first: 100, nodes: "...pickable" },
|
|
31
33
|
// My PRs closed lately, with who merged or closed them, for Changed by others [HIS-07]. Who closed one comes from its last
|
|
@@ -225,8 +227,11 @@ export function searchVariables(config: AttentionConfig, now: Date, timeZone?: s
|
|
|
225
227
|
closedIssues: `is:issue is:closed assignee:@me closed:>=${since} sort:updated-desc ${scope}`,
|
|
226
228
|
// Threads I opened, commented on, was assigned or mentioned in, active lately: answers, and fresh questions [ATT-16].
|
|
227
229
|
involved: `is:open involves:@me updated:>=${since} sort:updated-desc ${scope}`,
|
|
228
|
-
// On my own issues a question nobody answered stays however old [ATT-11]. Newest first, so old ones go last.
|
|
230
|
+
// On my own issues a question or tag nobody answered stays however old [ATT-11, WAI-01]. Newest first, so old ones go last.
|
|
229
231
|
asked: `is:issue is:open author:@me commenter:@me sort:updated-desc ${scope}`,
|
|
232
|
+
// And the rest of my own issues, where my opening may still be my last words, as only bots commented: `asked` can't find
|
|
233
|
+
// them before I comment [WAI-01]. Kept apart, so they don't crowd out the questions above.
|
|
234
|
+
opened: `is:issue is:open author:@me -commenter:@me sort:updated-desc ${scope}`,
|
|
230
235
|
// History [HIS-01, HIS-02]
|
|
231
236
|
merged: `is:pr is:merged author:@me merged:>=${history} ${scope}`,
|
|
232
237
|
reviewed: `is:pr is:merged reviewed-by:@me -author:@me merged:>=${history} ${scope}`,
|
package/server/rules.ts
CHANGED
|
@@ -104,8 +104,12 @@ export interface IssueState {
|
|
|
104
104
|
follow: boolean;
|
|
105
105
|
// My comment is the last one from a person; bots don't count [MEN-05].
|
|
106
106
|
mineLast: boolean;
|
|
107
|
-
// My
|
|
107
|
+
// My words since someone else last spoke ask something [WAI-01].
|
|
108
108
|
question: boolean;
|
|
109
|
+
// My words since someone else last spoke tag someone [WAI-01, WAI-02].
|
|
110
|
+
tags: boolean;
|
|
111
|
+
// Only questions wait: a statement waits on nobody, even one that tags someone. The onlyQuestionsWait setting [WAI-01].
|
|
112
|
+
onlyQuestions: boolean;
|
|
109
113
|
// A person commented after me (or after I opened it) within mentionDays, and I haven't 👍'd it [MEN-02].
|
|
110
114
|
answered: boolean;
|
|
111
115
|
// My last comment is within mentionDays.
|
|
@@ -118,7 +122,7 @@ export const ISSUE_RULES: Rules<IssueState> = {
|
|
|
118
122
|
// A recent comment after mine, without mentioning me: mine until I reply, 👍 it or dismiss it [ATT-16].
|
|
119
123
|
// On someone else's thread only when I've allowed replies without a tag [ATT-17].
|
|
120
124
|
answered: { when: (s) => s.answered && (s.authored || s.follow) },
|
|
121
|
-
// My question waits on an answer: on my own issues however long ago, on others' only
|
|
122
|
-
// waited too long [WAI-01, ATT-11].
|
|
123
|
-
wait_answer: { when: (s) => s.mineLast && s.question && (s.authored || s.fresh) },
|
|
125
|
+
// My question, or a tag unless only questions wait, waits on an answer: on my own issues however long ago, on others' only
|
|
126
|
+
// while fresh. Waiting says when it's waited too long [WAI-01, ATT-11].
|
|
127
|
+
wait_answer: { when: (s) => s.mineLast && (s.question || (s.tags && !s.onlyQuestions)) && (s.authored || s.fresh) },
|
|
124
128
|
};
|
package/server/service.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Attention, type AttentionView, baseItem, type CloseAsk, type FeedId, type FeedStatus, type HistoryFilter, type Item, memberKeys, type ProjectsAccess, type Reviewer } from "../shared/attention";
|
|
1
|
+
import { type Attention, type AttentionView, baseItem, type CloseAsk, type DismissTab, type FeedId, type FeedStatus, type HistoryFilter, type Item, memberKeys, type ProjectsAccess, type Reviewer } from "../shared/attention";
|
|
2
2
|
import type { PluginHandlerContext } from "@getpaseo/plugin/server";
|
|
3
3
|
import { AttentionConfig, type FieldRole } from "../shared/config";
|
|
4
4
|
import { newIssueRepos } from "../shared/new-issue";
|
|
@@ -12,7 +12,7 @@ import type { Port } from "./port";
|
|
|
12
12
|
import { historySince, isTimeZone, type UnclaimedSearch, unclaimedSearches } from "./queries";
|
|
13
13
|
import type { Details, LiveResult, ReferencedIssue } from "./github-types";
|
|
14
14
|
import { State } from "./store";
|
|
15
|
-
import { applyPending, buildView, doneItem, type Effect, isPending, type Pending, SETTLE_MS } from "./view";
|
|
15
|
+
import { applyPending, buildView, dismissedIn, doneItem, type Effect, isPending, type Pending, SETTLE_MS } from "./view";
|
|
16
16
|
import { keySet, uniqueKeys } from "../shared/names";
|
|
17
17
|
|
|
18
18
|
// History changes only when I finish something, so it's fetched daily, on ⟳ in its tab and after a merge.
|
|
@@ -102,7 +102,7 @@ export class AttentionService {
|
|
|
102
102
|
async dismiss(key: string): Promise<AttentionView> {
|
|
103
103
|
const item = this.items().find((candidate) => candidate.key === key);
|
|
104
104
|
if (item) {
|
|
105
|
-
this.state.dismissed[key] = { at: item.othersActivityAt, section: item.section };
|
|
105
|
+
this.state.dismissed[key] = { at: item.othersActivityAt, section: item.section, ...(item.mineAt ? { mine: item.mineAt } : {}) };
|
|
106
106
|
await this.save();
|
|
107
107
|
}
|
|
108
108
|
return this.view();
|
|
@@ -133,8 +133,10 @@ export class AttentionService {
|
|
|
133
133
|
return this.view();
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
-
|
|
137
|
-
|
|
136
|
+
// A tab's dismissed items, or all of them [ATT-08].
|
|
137
|
+
async restoreDismissed(tab?: DismissTab): Promise<AttentionView> {
|
|
138
|
+
if (!tab) this.state.dismissed = {};
|
|
139
|
+
else for (const key of dismissedIn(this.items(), this.state.dismissed, tab)) delete this.state.dismissed[key];
|
|
138
140
|
await this.save();
|
|
139
141
|
return this.view();
|
|
140
142
|
}
|
|
@@ -254,6 +256,12 @@ export class AttentionService {
|
|
|
254
256
|
await this.refresh("live").catch(() => {});
|
|
255
257
|
}
|
|
256
258
|
|
|
259
|
+
// Only questions wait [WAI-01]. Only the live feed has threads.
|
|
260
|
+
async setOnlyQuestionsWait(on: boolean): Promise<void> {
|
|
261
|
+
this.config = await this.port.store.saveOnlyQuestionsWait(on);
|
|
262
|
+
await this.refresh("live").catch(() => {});
|
|
263
|
+
}
|
|
264
|
+
|
|
257
265
|
async setScopes(scopes: string[]): Promise<void> {
|
|
258
266
|
this.state.scopes = scopes;
|
|
259
267
|
await this.save();
|
package/server/setup.ts
CHANGED
|
@@ -23,11 +23,11 @@ export async function ghStatus(): Promise<SetupStatus["gh"]> {
|
|
|
23
23
|
|
|
24
24
|
export async function configStatus(store: Pick<Store, "loadConfig">): Promise<ConfigStatus> {
|
|
25
25
|
try {
|
|
26
|
-
const { orgs, repos, nextUp, followThreads } = await store.loadConfig();
|
|
26
|
+
const { orgs, repos, nextUp, followThreads, onlyQuestionsWait } = await store.loadConfig();
|
|
27
27
|
const fields = Object.fromEntries(FIELD_ROLES.flatMap((role) => (nextUp[role] === undefined ? [] : [[role, nextUp[role]?.field ?? null]])));
|
|
28
|
-
return { error: null, orgs, repos, nextUp: { mine: nextUp.mine, orgs: nextUp.orgs, repos: nextUp.repos }, fields, followThreads };
|
|
28
|
+
return { error: null, orgs, repos, nextUp: { mine: nextUp.mine, orgs: nextUp.orgs, repos: nextUp.repos }, fields, followThreads, onlyQuestionsWait };
|
|
29
29
|
} catch (error) {
|
|
30
|
-
return { error: (error as Error).message, orgs: [], repos: [], nextUp: { mine: false, orgs: [], repos: [] }, fields: {}, followThreads: false };
|
|
30
|
+
return { error: (error as Error).message, orgs: [], repos: [], nextUp: { mine: false, orgs: [], repos: [] }, fields: {}, followThreads: false, onlyQuestionsWait: false };
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
|
package/server/store.ts
CHANGED
|
@@ -19,8 +19,8 @@ export const OLD_DIR = CHOSEN_DIR ? undefined : join(homedir(), ".config", "pase
|
|
|
19
19
|
const knownSections = (items: unknown): boolean => Array.isArray(items) && items.every((item) => Object.hasOwn(SECTIONS, (item as Item)?.section));
|
|
20
20
|
|
|
21
21
|
export const State = z.object({
|
|
22
|
-
// Item key -> others' activity and
|
|
23
|
-
dismissed: z.record(z.string(), z.object({ at: z.string(), section: z.custom<SectionId>() })).default({}),
|
|
22
|
+
// Item key -> others' activity, section, and my latest words or push, when dismissed [ATT-08].
|
|
23
|
+
dismissed: z.record(z.string(), z.object({ at: z.string(), section: z.custom<SectionId>(), mine: z.string().optional() })).default({}),
|
|
24
24
|
// Item key -> what I just changed on GitHub, until a fetch shows it [FRESH-02].
|
|
25
25
|
pending: z.record(z.string(), z.custom<Pending>((value) => typeof (value as Pending)?.at === "string" && !!(value as Pending)?.effect)).default({}).catch({}),
|
|
26
26
|
// Scopes ticked in Next up's filter; none means all [NXT-03].
|
|
@@ -162,6 +162,11 @@ export function createStore(dir: string, oldDir?: string) {
|
|
|
162
162
|
return updateConfig((file) => ({ ...file, followThreads }));
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
+
// Whether only questions wait, from settings [WAI-01].
|
|
166
|
+
function saveOnlyQuestionsWait(onlyQuestionsWait: boolean): Promise<AttentionConfig> {
|
|
167
|
+
return updateConfig((file) => ({ ...file, onlyQuestionsWait }));
|
|
168
|
+
}
|
|
169
|
+
|
|
165
170
|
// What the screen writes changes only its own keys; everything else in the file is kept as it is.
|
|
166
171
|
// A file that doesn't read or parse is left alone.
|
|
167
172
|
async function updateConfig(change: (file: Record<string, unknown>) => Record<string, unknown>): Promise<AttentionConfig> {
|
|
@@ -192,6 +197,6 @@ export function createStore(dir: string, oldDir?: string) {
|
|
|
192
197
|
await writeAtomically(state, JSON.stringify(saved, null, 2));
|
|
193
198
|
}
|
|
194
199
|
|
|
195
|
-
return { moveOldFiles, loadConfig, saveCodeRepo, saveCoverage, saveNextUpSources, saveNextUpFields, saveFollowThreads, loadState, saveState };
|
|
200
|
+
return { moveOldFiles, loadConfig, saveCodeRepo, saveCoverage, saveNextUpSources, saveNextUpFields, saveFollowThreads, saveOnlyQuestionsWait, loadState, saveState };
|
|
196
201
|
}
|
|
197
202
|
export type Store = ReturnType<typeof createStore>;
|
package/server/view.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Attention, type AttentionView, baseItem, type Chip, type CloseAsk, type FeedId, type FeedStatus, type HistoryFilter, type Item, type NextUpIssue, type Section, SECTION_ORDER, SECTIONS, type TabId, type WaitingGroup } from "../shared/attention";
|
|
1
|
+
import { type Attention, type AttentionView, baseItem, type Chip, type CloseAsk, type DismissTab, type FeedId, type FeedStatus, type HistoryFilter, type Item, type NextUpIssue, type Section, SECTION_ORDER, SECTIONS, type TabId, type WaitingGroup } from "../shared/attention";
|
|
2
2
|
import type { AttentionConfig } from "../shared/config";
|
|
3
3
|
import type { KeptRow } from "../shared/archive";
|
|
4
4
|
import type { NewIssueInfo } from "../shared/new-issue";
|
|
@@ -93,10 +93,17 @@ export function applyPending(attention: Attention | null, history: Item[], pendi
|
|
|
93
93
|
return { attention: { ...attention, items, assigned, unclaimed }, history: [...done, ...history] };
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
// A dismissed item stays hidden until someone else does something on it
|
|
96
|
+
// A dismissed item stays hidden until someone else does something on it, its reason changes, or I add words or push to it
|
|
97
|
+
// [ATT-08].
|
|
97
98
|
export function isDismissed(item: Item, dismissed: State["dismissed"]): boolean {
|
|
98
99
|
const entry = dismissed[item.key];
|
|
99
|
-
return !!entry && entry.section === item.section && item.othersActivityAt <= entry.at;
|
|
100
|
+
return !!entry && entry.section === item.section && item.othersActivityAt <= entry.at && !(entry.mine && item.mineAt && item.mineAt > entry.mine);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// The keys of a tab's dismissed items: Doing's, or Waiting's, where my Doing PRs that wait on others are too [ATT-08, PRS-15].
|
|
104
|
+
export function dismissedIn(items: Item[], dismissed: State["dismissed"], tab: DismissTab): string[] {
|
|
105
|
+
const inTab = tab === "doing" ? (item: Item) => SECTIONS[item.section].tab === "doing" : inWaiting;
|
|
106
|
+
return items.filter((item) => inTab(item) && isDismissed(item, dismissed)).map((item) => item.key);
|
|
100
107
|
}
|
|
101
108
|
|
|
102
109
|
// Waiting by who it waits on, so I know whom to nudge: whoever blocks the most first, ties by the longest wait, then bots, who
|
|
@@ -185,6 +192,6 @@ export function buildView(attention: Attention | null, fetched: Item[], dismisse
|
|
|
185
192
|
unclaimed: marked(attention?.unclaimed ?? []),
|
|
186
193
|
unclaimedFrom: attention?.unclaimedFrom ?? "config",
|
|
187
194
|
projects: attention?.projects ?? [],
|
|
188
|
-
|
|
195
|
+
dismissed: { doing: dismissedIn(items, dismissed, "doing").length, waiting: dismissedIn(items, dismissed, "waiting").length },
|
|
189
196
|
};
|
|
190
197
|
}
|
package/shared/attention.ts
CHANGED
|
@@ -111,7 +111,7 @@ export interface WaitingOn {
|
|
|
111
111
|
// What my work waits for: on items in Waiting, and on my PRs in Doing that wait on reviewers too, which Waiting lists as
|
|
112
112
|
// well [WAI-01, PRS-15].
|
|
113
113
|
export interface Wait {
|
|
114
|
-
// In a word or two: "review", "re-review", "question". None where the chips already say, like blocked by repo rules.
|
|
114
|
+
// In a word or two: "review", "re-review", "question", "tagged". None where the chips already say, like blocked by repo rules.
|
|
115
115
|
reason?: string;
|
|
116
116
|
// Since I asked, tagged, pushed or replied.
|
|
117
117
|
since: string;
|
|
@@ -254,6 +254,9 @@ export interface Item {
|
|
|
254
254
|
target: Target;
|
|
255
255
|
// Latest activity by someone else, for bringing back dismissed items [ATT-08].
|
|
256
256
|
othersActivityAt: string;
|
|
257
|
+
// My latest words or push on it, which bring back a dismissed wait too: my comments on a thread, or a push, review reply or
|
|
258
|
+
// conversation comment on my PR [ATT-08].
|
|
259
|
+
mineAt?: string;
|
|
257
260
|
// History only: when it merged or closed.
|
|
258
261
|
closedAt?: string;
|
|
259
262
|
// History only: what kind of work it was, when that can be told [HIS-04].
|
|
@@ -515,6 +518,9 @@ export interface FeedStatus {
|
|
|
515
518
|
error: string | null;
|
|
516
519
|
}
|
|
517
520
|
|
|
521
|
+
// The tabs whose items can be dismissed [ATT-08].
|
|
522
|
+
export type DismissTab = "doing" | "waiting";
|
|
523
|
+
|
|
518
524
|
// What the client renders: dismissed items removed, grouped per tab.
|
|
519
525
|
export interface AttentionView {
|
|
520
526
|
feeds: Record<FeedId, FeedStatus>;
|
|
@@ -537,7 +543,8 @@ export interface AttentionView {
|
|
|
537
543
|
unclaimedFrom: UnclaimedSource;
|
|
538
544
|
// The projects Next up's issues are on [NXT-03, NXT-12].
|
|
539
545
|
projects: ProjectInfo[];
|
|
540
|
-
|
|
546
|
+
// How many of each tab's items are dismissed, for its "show them again" [ATT-08].
|
|
547
|
+
dismissed: Record<DismissTab, number>;
|
|
541
548
|
// Scopes ticked in Next up's filter; none means all [NXT-03].
|
|
542
549
|
scopes: string[];
|
|
543
550
|
// Sources ticked in Next up's filter; none means all [NXT-09].
|
package/shared/config.ts
CHANGED
|
@@ -40,6 +40,8 @@ export const AttentionConfig = z.object({
|
|
|
40
40
|
// Follow threads I've commented on: a recent reply after mine on someone else's thread shows without a tag.
|
|
41
41
|
// Off: only my own threads and mentions [ATT-17].
|
|
42
42
|
followThreads: z.boolean().default(false),
|
|
43
|
+
// Only questions wait: my words that tag someone wait on them only if they ask something. Off: a tag alone waits [WAI-01].
|
|
44
|
+
onlyQuestionsWait: z.boolean().default(false),
|
|
43
45
|
// How many weeks History shows [HIS-01].
|
|
44
46
|
historyWeeks: z.number().int().positive().default(4),
|
|
45
47
|
// Unclaimed issues to pick from [NXT-04]. With no sources chosen, Next up looks in `orgs` and `repos` [NXT-08].
|
package/shared/item-view.ts
CHANGED
|
@@ -125,7 +125,8 @@ export function sheetPlan(item: Item, sessions: AgentSummary[]): SheetStep[] {
|
|
|
125
125
|
steps.push({ kind: "github", ...(pr ? { pr } : {}) });
|
|
126
126
|
// Nothing's left to start on once it's merged or closed, or out of my hands; a note is cleared with Got it, not dismissed [HIS-07].
|
|
127
127
|
if (!item.closedAt && !item.change) steps.push({ kind: "start", any: sessions.length > 0, session: fallbackKind(item) });
|
|
128
|
-
|
|
128
|
+
// Doing and Waiting can be dismissed, apart at the bottom; History and Next up can't [ATT-08].
|
|
129
|
+
if ((SECTIONS[item.section].tab === "doing" || SECTIONS[item.section].tab === "waiting") && !item.change) steps.push({ kind: "dismiss" });
|
|
129
130
|
return steps;
|
|
130
131
|
}
|
|
131
132
|
|
|
@@ -153,6 +154,11 @@ export function rerunState(details: { data?: { failing: FailingChecks[] }; isLoa
|
|
|
153
154
|
return { state: "ready", failing, runIds: summary.runIds };
|
|
154
155
|
}
|
|
155
156
|
|
|
157
|
+
// What a wait counts from, in words: my question, my tag, or my last push or reply [WAI-01].
|
|
158
|
+
export function waitedSince(reason: string | undefined): string {
|
|
159
|
+
return reason === "question" ? "you asked" : reason === "tagged" ? "you tagged them" : "your last push or reply";
|
|
160
|
+
}
|
|
161
|
+
|
|
156
162
|
// Why it waits and how long, in Waiting only; Doing says what's mine to do. Once it has waited too long, where nudging is
|
|
157
163
|
// fair, the age itself turns amber with ⌛ and says so in words [WAI-01, ATT-11].
|
|
158
164
|
export function waitChips(item: Item, inWaiting: boolean, tooLongDays: number, now = new Date()): Chip[] {
|
|
@@ -161,7 +167,7 @@ export function waitChips(item: Item, inWaiting: boolean, tooLongDays: number, n
|
|
|
161
167
|
const age = ago(wait.since, now);
|
|
162
168
|
const reason: Chip[] = wait.reason ? [{ text: wait.reason, tone: "neutral" }] : [];
|
|
163
169
|
if (!wait.tooLong) return [...reason, { text: age, tone: "neutral" }];
|
|
164
|
-
const since = wait.reason
|
|
170
|
+
const since = waitedSince(wait.reason);
|
|
165
171
|
const limit = `${tooLongDays} day${tooLongDays === 1 ? "" : "s"}`;
|
|
166
172
|
return [...reason, { text: age, tone: "warn", icon: "hourglass", hint: `Waited too long: ${age} since ${since}, more than ${limit}` }];
|
|
167
173
|
}
|
package/shared/rpc.ts
CHANGED
|
@@ -50,7 +50,8 @@ export const archiveWorktree = defineRpc({
|
|
|
50
50
|
output: z.custom<ArchiveOutcome>(),
|
|
51
51
|
});
|
|
52
52
|
export const dismissKept = defineRpc({ name: "attention.dismiss-kept", input: z.object({ workspaceId: z.string() }), output: view });
|
|
53
|
-
|
|
53
|
+
// One tab's dismissed items back, or every tab's [ATT-08].
|
|
54
|
+
export const restoreDismissed = defineRpc({ name: "attention.restore-dismissed", input: z.object({ tab: z.enum(["doing", "waiting"]).optional() }), output: view });
|
|
54
55
|
// Adds one entry to codeRepos in config.json [SES-07].
|
|
55
56
|
export const setCodeRepo = defineRpc({ name: "config.set-code-repo", input: z.object({ issueRepo: z.string(), codeRepo: z.string() }), output: view });
|
|
56
57
|
// What the setup checklist shows when nothing loads [SET-01].
|
|
@@ -68,6 +69,8 @@ const fieldChoice = z.string().nullable().optional();
|
|
|
68
69
|
export const setNextUpFields = defineRpc({ name: "config.set-next-up-fields", input: z.object({ priority: fieldChoice, effort: fieldChoice, scope: fieldChoice }), output: done });
|
|
69
70
|
// Replies on others' threads without a tag, from settings [ATT-17].
|
|
70
71
|
export const setFollowThreads = defineRpc({ name: "config.set-follow-threads", input: z.object({ on: z.boolean() }), output: done });
|
|
72
|
+
// Only questions wait, from settings [WAI-01].
|
|
73
|
+
export const setOnlyQuestionsWait = defineRpc({ name: "config.set-only-questions-wait", input: z.object({ on: z.boolean() }), output: done });
|
|
71
74
|
export const myOrgs = defineRpc({ name: "config.my-orgs", input: z.object({}), output: z.object({ orgs: z.array(z.string()) }) });
|
|
72
75
|
// Remember the scopes and sources ticked in Next up's filter [NXT-03, NXT-09].
|
|
73
76
|
export const setScopes = defineRpc({ name: "next-up.scopes", input: z.object({ scopes: z.array(z.string()) }), output: done });
|
package/shared/setup.ts
CHANGED
|
@@ -14,6 +14,8 @@ export interface ConfigStatus {
|
|
|
14
14
|
fields: Partial<Record<FieldRole, string | null>>;
|
|
15
15
|
// Replies on others' threads count without a tag [ATT-17].
|
|
16
16
|
followThreads: boolean;
|
|
17
|
+
// A tag waits only if it asks a question [WAI-01].
|
|
18
|
+
onlyQuestionsWait: boolean;
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
export interface SetupStatus {
|