@andrioid/paseo-attention-span 0.4.7 → 0.4.9
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 +8 -6
- package/client/attention-screen.tsx +77 -34
- package/client/card.tsx +3 -3
- package/client/data.ts +9 -3
- package/client/sessions.ts +2 -2
- package/client/sheet.tsx +2 -2
- package/client/ui.tsx +72 -6
- package/docs/architecture.md +4 -3
- package/docs/screenshots/desktop-dark-doing-acknowledge.png +0 -0
- package/docs/screenshots/desktop-dark-doing-clear.png +0 -0
- package/docs/screenshots/desktop-dark-doing-issue-sheet.png +0 -0
- package/docs/screenshots/desktop-dark-doing-reviewers.png +0 -0
- package/docs/screenshots/desktop-dark-doing-sheet.png +0 -0
- package/docs/screenshots/desktop-dark-doing.png +0 -0
- package/docs/screenshots/desktop-dark-history-reviewed.png +0 -0
- package/docs/screenshots/desktop-dark-history.png +0 -0
- package/docs/screenshots/desktop-dark-next-up.png +0 -0
- package/docs/screenshots/desktop-dark-settings.png +0 -0
- package/docs/screenshots/desktop-dark-setup.png +0 -0
- package/docs/screenshots/desktop-dark-waiting-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-light-next-up-filtered.png +0 -0
- package/package.json +2 -2
- package/requirements.yaml +5 -2
- package/server/classify.ts +31 -18
- package/server/fixture.ts +2 -2
- package/server/rules.ts +10 -15
- package/server/store.ts +13 -4
- package/server/view.ts +5 -2
- package/shared/attention.ts +19 -6
- package/shared/hint.ts +21 -0
- package/docs/screenshots/desktop-dark-doing-too-long.png +0 -0
package/OVERVIEW.md
CHANGED
|
@@ -6,7 +6,7 @@ There are four tabs. I think of them as a little story: what needs me now, what'
|
|
|
6
6
|
|
|
7
7
|
## Doing: what needs you now
|
|
8
8
|
|
|
9
|
-
This is the one you'll live in. It's split by reason: someone's waiting for your reply, someone answered your question, a review's been requested, CI's failing, changes were requested, it's ready to merge, it needs upstream,
|
|
9
|
+
This is the one you'll live in. It's split by reason: someone's waiting for your reply, someone answered your question, a review's been requested, CI's failing, changes were requested, it's ready to merge, it needs upstream, nobody's been asked to review it yet, or it's one of your drafts. Only things you can act on, though. Nudging people lives in Waiting.
|
|
10
10
|
|
|
11
11
|

|
|
12
12
|
|
|
@@ -37,15 +37,17 @@ A PR you opened isn't waiting on anyone until you've asked someone to review it,
|
|
|
37
37
|
|
|
38
38
|

|
|
39
39
|
|
|
40
|
-
Anything that's sat in Waiting for more than three days shows up here too, under **Waiting too long**. Usually that means someone forgot, and sometimes the someone is me.
|
|
41
|
-
|
|
42
|
-

|
|
43
|
-
|
|
44
40
|
## Waiting: out of your hands
|
|
45
41
|
|
|
46
42
|
This is your work where someone else has the next move: the review you asked for, the reviewer looking again, CI running, or a question you asked that nobody's answered yet. Only questions count: a comment that just tells people something, even one that tags them, isn't waiting on anyone.
|
|
47
43
|
|
|
48
|
-
It's grouped by who you're waiting on, whoever blocks the most first, and each item says why and for how long. Work with a session that's running or needs you leads its group. Who counts only when it's on record: the reviewers you asked, the reviewer who asked for changes, or the people you tagged in your question. Work that waits on nobody in particular, like CI or a repo rule, sits at the bottom rather than under a guess.
|
|
44
|
+
It's grouped by who you're waiting on, whoever blocks the most first, and each item says why and for how long. Work with a session that's running or needs you leads its group. Who counts only when it's on record: the reviewers you asked, the reviewer who asked for changes, or the people you tagged in your question. Work that waits on nobody in particular, like CI or a repo rule, sits at the bottom rather than under a guess.
|
|
45
|
+
|
|
46
|
+
Your PRs in Doing show up here too while someone you asked still hasn't reviewed them, even once they're approved. Merging is your call, but you might still want to nudge the person you asked.
|
|
47
|
+
|
|
48
|
+
After three days an item's age turns amber, with a little ⌛. Usually that means someone forgot, and sometimes the someone is me. It only does that when a nudge would be fair, so not while CI is failing or still running, or while there are conflicts, changes to make or a reply you owe. Point at it to see why.
|
|
49
|
+
|
|
50
|
+

|
|
49
51
|
|
|
50
52
|
When someone needs a nudge, **Copy list** next to their name copies their items oldest first, one line each like "Review 2h: [title](link)", ready to paste into a message. Otherwise there's nothing to do here. That's the point. It's tracked, so you can stop holding it in your head.
|
|
51
53
|
|
|
@@ -4,7 +4,7 @@ import { Markdown, Modal, TextInput, useToast } from "@getpaseo/plugin/client/ui
|
|
|
4
4
|
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
|
5
5
|
import { type ReactNode, useState } from "react";
|
|
6
6
|
import { Pressable, ScrollView, Text, View } from "react-native";
|
|
7
|
-
import { type ActionId, type AgentSummary, type AttentionView, type Chip, checkoutPr, type FailingChecks, type Item, itemSessions, liftActive, looseSessions, type NextUpIssue, ownStack, type Reviewer, type Section, type SectionId, SECTIONS, type SubRow, TAB_FEED, type TabId, type Target, type WaitingGroup, type WaitingOn } from "../shared/attention";
|
|
7
|
+
import { type ActionId, type AgentSummary, type AttentionView, type Chip, checkoutPr, type FailingChecks, type Item, itemSessions, liftActive, looseSessions, type NextUpIssue, ownStack, type PersonRole, type Reviewer, type Section, type SectionId, SECTIONS, type SubRow, TAB_FEED, type TabId, type Target, type WaitingGroup, type WaitingOn } from "../shared/attention";
|
|
8
8
|
import { type AttentionConfig, nextUpSources, type SessionKind } from "../shared/config";
|
|
9
9
|
import { ago, linkList, repoLabel } from "../shared/format";
|
|
10
10
|
import { isClear } from "../shared/still";
|
|
@@ -24,7 +24,7 @@ import { FeedbackAsk, FeedbackLine, type FeedbackScreen, FeedbackSheet } from ".
|
|
|
24
24
|
import { branchWorkspaces, type FetchProviders, findCheckout, githubProjects, itemAgents, listProfiles, noProjectMessage, resolveAgentConfig, startSession } from "./sessions";
|
|
25
25
|
import { SetupChecklist } from "./setup";
|
|
26
26
|
import { UpdateNotice } from "./update";
|
|
27
|
-
import { Avatar, Button, KeepStyles, Loading, Meta, SectionHeader, SpinningIcon, StylesProvider, TablerIcon, Toggle, useCopy, useHover, useStyles } from "./ui";
|
|
27
|
+
import { Avatar, Button, Hint, KeepStyles, Loading, Meta, SectionHeader, SpinningIcon, StylesProvider, TablerIcon, Toggle, useCopy, useHover, useStyles } from "./ui";
|
|
28
28
|
|
|
29
29
|
// The agent icon marks every action that starts an agent session; the rest act on GitHub right away [ATT-13].
|
|
30
30
|
const ACTION_ICONS: Record<ActionId, IconName> = {
|
|
@@ -118,7 +118,6 @@ const SECTION_ICONS: Record<SectionId, IconName> = {
|
|
|
118
118
|
changes: "changes",
|
|
119
119
|
ready: "merge",
|
|
120
120
|
upstream: "branch",
|
|
121
|
-
too_long: "hourglass",
|
|
122
121
|
needs_reviewer: "claim",
|
|
123
122
|
drafts: "pencil",
|
|
124
123
|
wait_review: "review",
|
|
@@ -314,7 +313,9 @@ function AttentionList({
|
|
|
314
313
|
const feed = view.feeds[TAB_FEED[tab]];
|
|
315
314
|
// Calm only once a refresh that worked says Doing is empty [ATT-18].
|
|
316
315
|
const clear = isClear(view, !!attention.error);
|
|
317
|
-
|
|
316
|
+
// ⟳ turns for any refresh of this tab's feed, but only my own press locks it: the cached view can still say a background one runs after it's done.
|
|
317
|
+
const pressed = attention.isRefreshing(TAB_FEED[tab]);
|
|
318
|
+
const refreshing = feed.refreshing || attention.isFetching || pressed;
|
|
318
319
|
const counts: Record<TabId, number> = {
|
|
319
320
|
history: view.history.filter((item) => item.section === "done").length,
|
|
320
321
|
doing: view.count,
|
|
@@ -389,7 +390,8 @@ function AttentionList({
|
|
|
389
390
|
<Pressable
|
|
390
391
|
accessibilityRole="button"
|
|
391
392
|
accessibilityLabel="Refresh now"
|
|
392
|
-
accessibilityState={{ busy: refreshing }}
|
|
393
|
+
accessibilityState={{ busy: refreshing, disabled: pressed }}
|
|
394
|
+
disabled={pressed}
|
|
393
395
|
style={styles.row}
|
|
394
396
|
onPress={() => void attention.refreshNow(TAB_FEED[tab]).catch(() => {})}
|
|
395
397
|
>
|
|
@@ -566,17 +568,17 @@ type Sheet = "item" | "acknowledge" | "reviewers" | "reviewers-after-ready" | nu
|
|
|
566
568
|
// A session on an item that has no session action of its own starts with this prompt; it's editable first.
|
|
567
569
|
const fallbackKind = (item: Item): SessionKind => (item.target.kind === "issue" ? "start" : "review");
|
|
568
570
|
|
|
569
|
-
//
|
|
570
|
-
|
|
571
|
+
// 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
|
|
572
|
+
// fair, the age itself turns amber with ⌛ and says so in words [WAI-01, ATT-11].
|
|
573
|
+
function waitChips(item: Item, inWaiting: boolean, tooLongDays: number): Chip[] {
|
|
571
574
|
const { wait } = item;
|
|
572
|
-
if (!wait) return [];
|
|
575
|
+
if (!wait || !inWaiting) return [];
|
|
573
576
|
const age = ago(wait.since);
|
|
574
|
-
|
|
575
|
-
return [
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
];
|
|
577
|
+
const reason: Chip[] = wait.reason ? [{ text: wait.reason, tone: "neutral" }] : [];
|
|
578
|
+
if (!wait.tooLong) return [...reason, { text: age, tone: "neutral" }];
|
|
579
|
+
const since = wait.reason === "question" ? "you asked" : "your last push or reply";
|
|
580
|
+
const limit = `${tooLongDays} day${tooLongDays === 1 ? "" : "s"}`;
|
|
581
|
+
return [...reason, { text: age, tone: "warn", icon: "hourglass", hint: `Waited too long: ${age} since ${since}, more than ${limit}` }];
|
|
580
582
|
}
|
|
581
583
|
|
|
582
584
|
// "Review 2h", "Question 3d": why and how long, to lead a line in a nudge [WAI-03].
|
|
@@ -593,11 +595,11 @@ function ItemRow({ item, first, actions, group }: { item: Item; first: boolean;
|
|
|
593
595
|
const styles = useStyles();
|
|
594
596
|
// An open session leads; without one, the item's own action does [SES-03].
|
|
595
597
|
const sessions = itemSessions(actions.agents, item);
|
|
596
|
-
const own = [...waitChips(item, !!group), ...item.chips];
|
|
598
|
+
const own = [...waitChips(item, !!group, actions.config.waitingTooLongDays), ...item.chips];
|
|
597
599
|
const chips = sessions[0] ? [...own, agentSignal(sessions[0])] : own;
|
|
598
600
|
// The group names one; the card names the rest [WAI-01].
|
|
599
601
|
const others = group?.who ? (item.waitingOn ?? []).filter((who) => !samePerson(who, group.who!)) : [];
|
|
600
|
-
const waitingOn = group ? null : item.waitingOn ? <WaitingOnLine people={item.waitingOn} expanded={false} /> : null;
|
|
602
|
+
const waitingOn = group ? null : item.waitingOn ? <WaitingOnLine people={item.waitingOn} asked={item.wait?.reason === "question"} expanded={false} /> : null;
|
|
601
603
|
const alsoOn = others.length ? <Text style={styles.muted}>also waiting on {others.map((who) => who.login).join(", ")}</Text> : null;
|
|
602
604
|
const [sheet, setSheet] = useState<Sheet>(null);
|
|
603
605
|
const [confirm, setConfirm] = useState<"merge" | "close" | null>(null);
|
|
@@ -717,7 +719,7 @@ function ItemSheet({ item, chips, sessions, actions, ...handlers }: { item: Item
|
|
|
717
719
|
<>
|
|
718
720
|
<Meta facts={meta} chips={chips} />
|
|
719
721
|
{item.person ? <PersonQuote person={item.person} expanded /> : null}
|
|
720
|
-
{item.waitingOn ? <WaitingOnLine people={item.waitingOn} expanded /> : null}
|
|
722
|
+
{item.waitingOn ? <WaitingOnLine people={item.waitingOn} asked={item.wait?.reason === "question"} expanded /> : null}
|
|
721
723
|
{item.children.length > 0 ? <StackLine rows={item.children} merged={!!item.closedAt} links /> : null}
|
|
722
724
|
</>
|
|
723
725
|
}
|
|
@@ -922,13 +924,44 @@ function ReviewerSheet({
|
|
|
922
924
|
);
|
|
923
925
|
}
|
|
924
926
|
|
|
927
|
+
// What a face on a card is to it, where no quote says it: the icon of the tab or section that means the same, so whom I wait on
|
|
928
|
+
// reads like Waiting, and whose comments are left like Changes requested [ATT-19].
|
|
929
|
+
const ROLE_ICON: Record<PersonRole | "waiting", IconName> = { waiting: "hourglass", author: "pencil", changes: "changes" };
|
|
930
|
+
|
|
931
|
+
// The icon sits tight against the faces it explains, apart from the name and time, so they read as one.
|
|
932
|
+
function Badged({ role, children }: { role: keyof typeof ROLE_ICON; children: ReactNode }) {
|
|
933
|
+
const styles = useStyles();
|
|
934
|
+
return (
|
|
935
|
+
<View style={{ flexDirection: "row", alignItems: "center", gap: 2 }}>
|
|
936
|
+
<TablerIcon name={ROLE_ICON[role]} size={16} color={styles.c.foregroundMuted} />
|
|
937
|
+
{children}
|
|
938
|
+
</View>
|
|
939
|
+
);
|
|
940
|
+
}
|
|
941
|
+
|
|
925
942
|
// Who is waiting on me, or who I'm waiting on.
|
|
926
943
|
function PersonQuote({ person, expanded }: { person: NonNullable<Item["person"]>; expanded: boolean }) {
|
|
927
944
|
const styles = useStyles();
|
|
945
|
+
const name = <Text style={{ color: styles.c.foreground, fontSize: 12, fontWeight: "600" }}>{person.login}</Text>;
|
|
946
|
+
// An author line says who, not when: its time meant something different on each tab [ATT-19].
|
|
947
|
+
if (!person.snippet && person.role) {
|
|
948
|
+
const text = person.role === "author" ? `Opened by ${person.login}` : `${person.login}'s comments are left to address, since your last push ${ago(person.since)} ago`;
|
|
949
|
+
return (
|
|
950
|
+
<Hint text={text}>
|
|
951
|
+
<View style={styles.row}>
|
|
952
|
+
<Badged role={person.role}>
|
|
953
|
+
<Avatar url={person.avatarUrl} bot={person.bot} />
|
|
954
|
+
</Badged>
|
|
955
|
+
{name}
|
|
956
|
+
{person.role === "author" ? null : <Text style={styles.muted}>· {ago(person.since)}</Text>}
|
|
957
|
+
</View>
|
|
958
|
+
</Hint>
|
|
959
|
+
);
|
|
960
|
+
}
|
|
928
961
|
const line = (
|
|
929
962
|
<View style={styles.row}>
|
|
930
963
|
<Avatar url={person.avatarUrl} bot={person.bot} />
|
|
931
|
-
|
|
964
|
+
{name}
|
|
932
965
|
<Text style={styles.muted}>· {ago(person.since)}</Text>
|
|
933
966
|
</View>
|
|
934
967
|
);
|
|
@@ -947,7 +980,8 @@ function PersonQuote({ person, expanded }: { person: NonNullable<Item["person"]>
|
|
|
947
980
|
const MAX_FACES = 5;
|
|
948
981
|
|
|
949
982
|
// Who my work waits on: one by name, several by picture, named on hover, and each by name in the sheet [WAI-02].
|
|
950
|
-
|
|
983
|
+
// On an issue they're who my question tagged; on a PR, reviewers since my last push or reply [WAI-02, ATT-19].
|
|
984
|
+
function WaitingOnLine({ people, asked, expanded }: { people: WaitingOn[]; asked: boolean; expanded: boolean }) {
|
|
951
985
|
const styles = useStyles();
|
|
952
986
|
const [hovered, setHovered] = useState<string | null>(null);
|
|
953
987
|
const name = (login: string) => (
|
|
@@ -956,33 +990,42 @@ function WaitingOnLine({ people, expanded }: { people: WaitingOn[]; expanded: bo
|
|
|
956
990
|
</Text>
|
|
957
991
|
);
|
|
958
992
|
const since = (at: string) => <Text style={styles.muted}>· {ago(at)}</Text>;
|
|
993
|
+
const explain = (logins: string[], at: string) => `Waiting on ${logins.join(", ")} since ${asked ? "you asked" : "your last push or reply"}, ${ago(at)} ago`;
|
|
959
994
|
if (expanded || people.length === 1) {
|
|
960
995
|
return (
|
|
961
996
|
<View style={{ gap: 6 }}>
|
|
962
997
|
{people.map((who) => (
|
|
963
|
-
<
|
|
964
|
-
<
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
998
|
+
<Hint key={who.login} text={explain([who.login], who.since)}>
|
|
999
|
+
<View style={styles.row}>
|
|
1000
|
+
<Badged role="waiting">
|
|
1001
|
+
<Avatar url={who.avatarUrl} team={who.team} />
|
|
1002
|
+
</Badged>
|
|
1003
|
+
{name(who.login)}
|
|
1004
|
+
{since(who.since)}
|
|
1005
|
+
</View>
|
|
1006
|
+
</Hint>
|
|
968
1007
|
))}
|
|
969
1008
|
</View>
|
|
970
1009
|
);
|
|
971
1010
|
}
|
|
972
1011
|
const earliest = people.map((who) => who.since).sort()[0];
|
|
973
1012
|
return (
|
|
974
|
-
<
|
|
975
|
-
<View style={
|
|
976
|
-
|
|
977
|
-
<View
|
|
978
|
-
|
|
1013
|
+
<Hint text={explain(people.map((who) => who.login), earliest)}>
|
|
1014
|
+
<View style={styles.row}>
|
|
1015
|
+
<Badged role="waiting">
|
|
1016
|
+
<View style={{ flexDirection: "row", alignItems: "center", gap: 4 }}>
|
|
1017
|
+
{people.slice(0, MAX_FACES).map((who) => (
|
|
1018
|
+
<View key={who.login} onPointerEnter={() => setHovered(who.login)} onPointerLeave={() => setHovered((current) => (current === who.login ? null : current))}>
|
|
1019
|
+
<Avatar url={who.avatarUrl} team={who.team} />
|
|
1020
|
+
</View>
|
|
1021
|
+
))}
|
|
1022
|
+
{people.length > MAX_FACES ? <Text style={styles.muted}>+{people.length - MAX_FACES}</Text> : null}
|
|
979
1023
|
</View>
|
|
980
|
-
|
|
981
|
-
{
|
|
1024
|
+
</Badged>
|
|
1025
|
+
{hovered ? name(hovered) : null}
|
|
1026
|
+
{since(earliest)}
|
|
982
1027
|
</View>
|
|
983
|
-
|
|
984
|
-
{since(earliest)}
|
|
985
|
-
</View>
|
|
1028
|
+
</Hint>
|
|
986
1029
|
);
|
|
987
1030
|
}
|
|
988
1031
|
|
package/client/card.tsx
CHANGED
|
@@ -3,7 +3,7 @@ import { type ReactNode, useState } from "react";
|
|
|
3
3
|
import { ActivityIndicator, Pressable, Text, View } from "react-native";
|
|
4
4
|
import type { Chip } from "../shared/attention";
|
|
5
5
|
import type { IconName } from "./icons";
|
|
6
|
-
import { Button, Meta, TablerIcon, toneColor, useStyles } from "./ui";
|
|
6
|
+
import { Button, HintArea, Meta, TablerIcon, toneColor, useStyles } from "./ui";
|
|
7
7
|
|
|
8
8
|
// Every card in every list has this anatomy; tabs fill it in with data and slots, not layout [ATT-05].
|
|
9
9
|
//
|
|
@@ -79,7 +79,7 @@ export function CardRow({ first, mark, title, meta, accessibilityLabel, onOpen,
|
|
|
79
79
|
<View style={first ? null : styles.divider}>
|
|
80
80
|
<View style={styles.item}>
|
|
81
81
|
<Mark {...mark} />
|
|
82
|
-
<
|
|
82
|
+
<HintArea style={styles.body}>
|
|
83
83
|
<Pressable accessibilityRole="button" accessibilityLabel={accessibilityLabel ?? `${title}, more`} onPress={onOpen} style={{ gap: 6 }}>
|
|
84
84
|
<Text style={styles.title} numberOfLines={2}>
|
|
85
85
|
{title}
|
|
@@ -90,7 +90,7 @@ export function CardRow({ first, mark, title, meta, accessibilityLabel, onOpen,
|
|
|
90
90
|
{/* On phones the actions sit under the text, labelled, so mixed actions stay readable. */}
|
|
91
91
|
{styles.compact ? actions : null}
|
|
92
92
|
{confirm ? <ConfirmBar {...confirm} /> : null}
|
|
93
|
-
</
|
|
93
|
+
</HintArea>
|
|
94
94
|
{styles.compact ? null : actions}
|
|
95
95
|
</View>
|
|
96
96
|
{overlay}
|
package/client/data.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { useRpc } from "@getpaseo/plugin/client";
|
|
2
|
-
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
|
2
|
+
import { useMutation, useMutationState, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
3
3
|
import { useCallback } from "react";
|
|
4
4
|
import type { AttentionView, FeedId } from "../shared/attention";
|
|
5
5
|
import { getAttention } from "../shared/rpc";
|
|
6
6
|
|
|
7
7
|
export const VIEW_QUERY_KEY = ["attention-span", "view"] as const;
|
|
8
|
+
const REFRESH_KEY = ["attention-span", "refresh"] as const;
|
|
8
9
|
|
|
9
10
|
// The server owns the GitHub refresh schedule; the app only reads its cache [FRESH-01, GH-01].
|
|
10
11
|
export function useAttention() {
|
|
@@ -18,6 +19,11 @@ export function useAttention() {
|
|
|
18
19
|
});
|
|
19
20
|
const setView = useCallback((view: AttentionView) => queryClient.setQueryData(VIEW_QUERY_KEY, view), [queryClient]);
|
|
20
21
|
// ⟳ fetches only the feed behind the tab I'm on.
|
|
21
|
-
const
|
|
22
|
-
|
|
22
|
+
const refresh = useMutation({ mutationKey: REFRESH_KEY, mutationFn: (feed: FeedId) => fetchAttention({ refresh: feed }), onSuccess: setView });
|
|
23
|
+
const refreshNow = refresh.mutateAsync;
|
|
24
|
+
// The server answers ⟳ only once its refresh is done, so the view can't say it's running; the pending call does.
|
|
25
|
+
// Kept in the query client, so it still shows after leaving the screen and coming back mid-refresh.
|
|
26
|
+
const pendingFeeds = useMutationState({ filters: { mutationKey: REFRESH_KEY, status: "pending" }, select: (mutation) => mutation.state.variables as FeedId });
|
|
27
|
+
const isRefreshing = useCallback((feed: FeedId) => pendingFeeds.includes(feed), [pendingFeeds]);
|
|
28
|
+
return { ...query, setView, refreshNow, isRefreshing };
|
|
23
29
|
}
|
package/client/sessions.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { usePaseo } from "@getpaseo/plugin/client";
|
|
2
|
-
import { type AgentSummary, checkoutPr, type Target } from "../shared/attention";
|
|
2
|
+
import { type AgentSummary, checkoutPr, sessionTitle, type Target } from "../shared/attention";
|
|
3
3
|
import { linkedSessions } from "../shared/linked-sessions";
|
|
4
4
|
import { chooseAgent, type ReadyProvider } from "../shared/providers";
|
|
5
5
|
import { type AttentionConfig, codeRepoFor, githubRepoOf, SessionKind } from "../shared/config";
|
|
@@ -163,7 +163,7 @@ export async function startSession(paseo: Paseo, input: StartSession): Promise<s
|
|
|
163
163
|
const project = checkout.project;
|
|
164
164
|
if (!project) throw new Error(noProjectMessage(checkout, target));
|
|
165
165
|
const { agent: agentConfig } = await resolveAgentConfig(paseo, input.fetchProviders, input.kind, input.config, input.profileId);
|
|
166
|
-
const title =
|
|
166
|
+
const title = sessionTitle(input.kind, target);
|
|
167
167
|
|
|
168
168
|
const workspace = input.workspaceId
|
|
169
169
|
? paseo.workspaces.ref(input.workspaceId)
|
package/client/sheet.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import type { ReactNode } from "react";
|
|
|
4
4
|
import { Pressable, Text, View } from "react-native";
|
|
5
5
|
import type { Chip, ItemDetails } from "../shared/attention";
|
|
6
6
|
import type { IconName } from "./icons";
|
|
7
|
-
import { Button, KeepStyles, Loading, Signal, TablerIcon, toneColor, useCopy, useHover, useStyles } from "./ui";
|
|
7
|
+
import { Button, HintArea, KeepStyles, Loading, Signal, TablerIcon, toneColor, useCopy, useHover, useStyles } from "./ui";
|
|
8
8
|
|
|
9
9
|
// Tapping a card opens its sheet: what the card knows, every action saying what it will do, then what's fetched [ATT-06].
|
|
10
10
|
// Fetched details go last, so the actions don't move when they arrive. A bottom sheet on phones, a dialog on desktop.
|
|
@@ -30,7 +30,7 @@ export function ActionSheet({ title, top, entries, bottom, onClose }: { title: s
|
|
|
30
30
|
<Modal title={title} open onOpenChange={(open) => (open ? null : onClose())}>
|
|
31
31
|
<Modal.Content>
|
|
32
32
|
<KeepStyles styles={styles}>
|
|
33
|
-
<
|
|
33
|
+
<HintArea style={{ gap: 10 }}>{top}</HintArea>
|
|
34
34
|
<View style={[styles.card, { backgroundColor: styles.c.surface2 }]}>
|
|
35
35
|
{entries.map((entry, index) => (
|
|
36
36
|
<Entry key={entry.key} entry={entry} first={index === 0} />
|
package/client/ui.tsx
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { PluginScreenProps } from "@getpaseo/plugin/client";
|
|
2
2
|
import { copyText, Icon, useToast } from "@getpaseo/plugin/client/ui";
|
|
3
|
-
import { createContext, type ReactNode, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
4
|
-
import { ActivityIndicator, Animated, Easing, Image, Platform, Pressable, Text, View } from "react-native";
|
|
3
|
+
import { createContext, type ReactNode, type RefObject, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
4
|
+
import { ActivityIndicator, Animated, Dimensions, Easing, Image, Platform, Pressable, type StyleProp, Text, View, type ViewStyle } from "react-native";
|
|
5
5
|
import type { Chip } from "../shared/attention";
|
|
6
|
+
import { HINT_GAP, type HintPlacement, hintPlacement } from "../shared/hint";
|
|
6
7
|
import { ICONS, type IconName } from "./icons";
|
|
7
8
|
|
|
8
9
|
// Shared look: theme colors only, tighter on compact layouts [REACH-01].
|
|
@@ -86,22 +87,87 @@ export function toneColor(styles: Styles, tone: Chip["tone"]): string {
|
|
|
86
87
|
return { good: styles.c.statusSuccess, bad: styles.c.statusDanger, warn: styles.c.statusWarning, neutral: styles.c.foregroundMuted }[tone];
|
|
87
88
|
}
|
|
88
89
|
|
|
89
|
-
// A state that matters, as a colored dot (or its icon) and text.
|
|
90
|
-
export function Signal({ text, tone, icon }: Chip) {
|
|
90
|
+
// A state that matters, as a colored dot (or its icon) and text, explained on hover where it has a hint.
|
|
91
|
+
export function Signal({ text, tone, icon, hint }: Chip) {
|
|
91
92
|
const styles = useStyles();
|
|
92
93
|
const color = toneColor(styles, tone);
|
|
93
|
-
|
|
94
|
+
const signal = (
|
|
94
95
|
<View style={[styles.row, { gap: 5 }]}>
|
|
95
96
|
{icon ? <TablerIcon name={icon} size={13} color={color} /> : <View style={{ width: 7, height: 7, borderRadius: 4, backgroundColor: color }} />}
|
|
96
97
|
<Text style={{ color, fontSize: 12, fontWeight: "500" }}>{text}</Text>
|
|
97
98
|
</View>
|
|
98
99
|
);
|
|
100
|
+
return hint ? (
|
|
101
|
+
<Hint text={hint} inline>
|
|
102
|
+
{signal}
|
|
103
|
+
</Hint>
|
|
104
|
+
) : (
|
|
105
|
+
signal
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Where hints may spread: a card's text column, a sheet's top. Whatever holds it clips what runs past, so a hint stays inside.
|
|
110
|
+
const HintBounds = createContext<RefObject<View | null> | null>(null);
|
|
111
|
+
|
|
112
|
+
export function HintArea({ style, children }: { style?: StyleProp<ViewStyle>; children: ReactNode }) {
|
|
113
|
+
const ref = useRef<View>(null);
|
|
114
|
+
return (
|
|
115
|
+
<HintBounds.Provider value={ref}>
|
|
116
|
+
<View ref={ref} style={style}>
|
|
117
|
+
{children}
|
|
118
|
+
</View>
|
|
119
|
+
</HintBounds.Provider>
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// Resting the pointer this long shows a hint; passing over doesn't.
|
|
124
|
+
const HINT_DELAY_MS = 300;
|
|
125
|
+
|
|
126
|
+
// What something means, in words: on hover after a moment, and always to screen readers. It floats over the layout rather
|
|
127
|
+
// than in it, so showing it moves nothing, and it's sized to the room left in its HintArea: beside the content, wrapping
|
|
128
|
+
// upward, or above it where there's too little room beside. Touch has no hover, so there the label is all [ATT-19, ATT-11].
|
|
129
|
+
export function Hint({ text, inline, children }: { text: string; inline?: boolean; children: ReactNode }) {
|
|
130
|
+
const styles = useStyles();
|
|
131
|
+
const bounds = useContext(HintBounds);
|
|
132
|
+
const self = useRef<View>(null);
|
|
133
|
+
const timer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);
|
|
134
|
+
const [placement, setPlacement] = useState<HintPlacement | null>(null);
|
|
135
|
+
useEffect(() => () => clearTimeout(timer.current), []);
|
|
136
|
+
const show = () => {
|
|
137
|
+
clearTimeout(timer.current);
|
|
138
|
+
timer.current = setTimeout(() => {
|
|
139
|
+
self.current?.measureInWindow((x, _y, width) => {
|
|
140
|
+
const place = (left: number, right: number) => setPlacement(hintPlacement(x, width, left, right));
|
|
141
|
+
if (bounds?.current) bounds.current.measureInWindow((left, _top, boundsWidth) => place(left, left + boundsWidth));
|
|
142
|
+
else place(HINT_GAP, Dimensions.get("window").width - HINT_GAP);
|
|
143
|
+
});
|
|
144
|
+
}, HINT_DELAY_MS);
|
|
145
|
+
};
|
|
146
|
+
const hide = () => {
|
|
147
|
+
clearTimeout(timer.current);
|
|
148
|
+
setPlacement(null);
|
|
149
|
+
};
|
|
150
|
+
const where: ViewStyle =
|
|
151
|
+
placement?.side === "beside" ? { left: "100%", marginLeft: HINT_GAP, bottom: -2 } : { left: placement?.offset ?? 0, bottom: "100%", marginBottom: 4 };
|
|
152
|
+
return (
|
|
153
|
+
// Raised while shown: every view is its own layer here, so the words would otherwise sit under whatever follows.
|
|
154
|
+
<View ref={self} accessibilityLabel={text} onPointerEnter={show} onPointerLeave={hide} style={[inline ? null : { alignSelf: "flex-start" }, placement ? { zIndex: 10 } : null]}>
|
|
155
|
+
{children}
|
|
156
|
+
{placement ? (
|
|
157
|
+
<View pointerEvents="none" style={[{ position: "absolute", width: placement.width, alignItems: "flex-start", zIndex: 10 }, where]}>
|
|
158
|
+
<View style={{ backgroundColor: styles.c.surface2, borderColor: styles.c.border, borderWidth: 1, borderRadius: 6, paddingVertical: 2, paddingHorizontal: 8 }}>
|
|
159
|
+
<Text style={{ color: styles.c.foreground, fontSize: 12, lineHeight: 16 }}>{text}</Text>
|
|
160
|
+
</View>
|
|
161
|
+
</View>
|
|
162
|
+
) : null}
|
|
163
|
+
</View>
|
|
164
|
+
);
|
|
99
165
|
}
|
|
100
166
|
|
|
101
167
|
// The line under a title: facts as quiet text joined by "·", then signals [ATT-05].
|
|
102
168
|
export function Meta({ facts, chips }: { facts: string[]; chips: Chip[] }) {
|
|
103
169
|
const styles = useStyles();
|
|
104
|
-
const quiet = (chip: Chip) => chip.tone === "neutral" && !chip.icon;
|
|
170
|
+
const quiet = (chip: Chip) => chip.tone === "neutral" && !chip.icon && !chip.hint;
|
|
105
171
|
const text = [...facts, ...chips.filter(quiet).map((chip) => chip.text)];
|
|
106
172
|
const signals = chips.filter((chip) => !quiet(chip));
|
|
107
173
|
return (
|
package/docs/architecture.md
CHANGED
|
@@ -50,11 +50,13 @@ The tabs tell the story of my work, left to right: what I finished, what needs m
|
|
|
50
50
|
|---|---|
|
|
51
51
|
| History | The last `historyWeeks` (default 4) by week, newest first, in the device's time zone: issues assigned to me that closed, with the PRs that closed them, and my other merged PRs [HIS-01]. Per week, a collapsed "Reviewed (n)" lists others' merged PRs I reviewed [HIS-02]. The copy icon on a week's heading copies its finished items, not the reviews, as a Markdown list of links; 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
52
|
| 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 comment is the last from a person, bots don't count, and my comments since someone else last spoke 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; a statement, tagged or not, waits on nobody and 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, the people and teams my comments 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; 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.
|
|
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 comment is the last from a person, bots don't count, and my comments since someone else last spoke 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; a statement, tagged or not, waits on nobody and 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, the people and teams my comments 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; 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 or question; 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
54
|
| Next up | *Assigned to you* [NXT-06], then *Unclaimed* [NXT-01] |
|
|
55
55
|
|
|
56
56
|
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 "repo #number", when it happened and signal chips, then content only some lists have (tags, 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. Marks and signals take a tone, never a raw theme color, because some themes draw `accent` close to white.
|
|
57
57
|
|
|
58
|
+
Something whose meaning isn't obvious, like a face on a card or an amber age, explains itself with `Hint` in `client/ui.tsx` [ATT-19, ATT-11]: its text is the screen-reader label, and on desktop it shows after a 300 ms rest of the pointer. It floats over the layout rather than in it, so showing it moves nothing, and it's sized to the room left in the nearest `HintArea` (a card's text column, a sheet's top), beside its content and wrapping upward, or above it where there's too little room beside. A chip takes one through `hint`.
|
|
59
|
+
|
|
58
60
|
Screenshots, from the preview's made-up data, are in [screenshots/](screenshots/). Refresh them with `npm run screenshots`.
|
|
59
61
|
|
|
60
62
|
| Doing | History | Next up (phone) |
|
|
@@ -74,7 +76,6 @@ Top to bottom. Each item appears once, under its most urgent reason [ATT-02]. `s
|
|
|
74
76
|
| Changes requested | My PRs with requested changes or unresolved threads [PRS-02] |
|
|
75
77
|
| Ready to merge | My approved PRs without conflicts or failing checks, that GitHub's rules let me merge [PRS-03, PRS-13] |
|
|
76
78
|
| Needs upstream | My PRs with conflicts or an out-of-sync stack [UPS-01, UPS-02] |
|
|
77
|
-
| Waiting too long | Waiting items older than `waitingTooLongDays` (default 3); it's mine to nudge [ATT-11] |
|
|
78
79
|
| 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 |
|
|
79
80
|
| My drafts | My drafts, with their own state tags [PRS-05, PRS-06] |
|
|
80
81
|
|
|
@@ -93,7 +94,7 @@ Top to bottom. Each item appears once, under its most urgent reason [ATT-02]. `s
|
|
|
93
94
|
2. a stacked PR no longer builds on its parent's head,
|
|
94
95
|
3. it is ready to merge (CI ran against an old base).
|
|
95
96
|
Otherwise the behind count is shown on rows that appear anyway, but never puts an item on the list by itself. Its chip stays neutral; only conflicts are flagged, in red.
|
|
96
|
-
- **Repo rules** [PRS-13]: GitHub's `mergeStateStatus` says whether branch protection and rulesets let a PR merge now, but not which rule blocks it. Approvals already show in `reviewDecision`, conflicts in `mergeable`, and running CI blocks too, so a block only counts as a rule's when none of those explain it: an approved PR without conflicts, failing checks, requested changes or running CI. It then waits in Waiting for review with a "blocked by repo rules" chip, no Merge and no person, and never
|
|
97
|
+
- **Repo rules** [PRS-13]: GitHub's `mergeStateStatus` says whether branch protection and rulesets let a PR merge now, but not which rule blocks it. Approvals already show in `reviewDecision`, conflicts in `mergeable`, and running CI blocks too, so a block only counts as a rule's when none of those explain it: an approved PR without conflicts, failing checks, requested changes or running CI. It then waits in Waiting for review with a "blocked by repo rules" chip, no Merge and no person, and its age never turns amber: there's nobody to nudge. Needs a reviewer offers Merge only when GitHub doesn't say blocked. `UNKNOWN` (not computed yet) decides nothing. GitHub works out the merge state for at most five PRs per request; asked about more, through search, a repo's PR list or aliases alike, it says `BLOCKED` for all of them (seen 2026-11-04). So the state is asked five PRs per request, in parallel, and search's answer is only the fallback when a request fails.
|
|
97
98
|
- **Required checks** [PRS-14]: the details request asks which checks on each of my PRs the repo requires (`isRequired`). Where some are required, only they count: failing optional checks leave the PR ready with an "optional checks failing" chip, and optional ones still running don't hold up Merge. A required check that hasn't reported yet isn't listed, so GitHub blocking while CI runs counts as CI running. Where none are required, every check counts.
|
|
98
99
|
- **Stale draft** [PRS-07]: a draft untouched for 30 days offers Refresh and Close instead of Rebase.
|
|
99
100
|
|
|
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@andrioid/paseo-attention-span",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.9",
|
|
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": {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"docs/screenshots/desktop-dark-doing-issue-sheet.png",
|
|
30
30
|
"docs/screenshots/desktop-dark-doing-reviewers.png",
|
|
31
31
|
"docs/screenshots/desktop-dark-doing-sheet.png",
|
|
32
|
-
"docs/screenshots/desktop-dark-
|
|
32
|
+
"docs/screenshots/desktop-dark-waiting-too-long.png",
|
|
33
33
|
"docs/screenshots/desktop-dark-doing.png",
|
|
34
34
|
"docs/screenshots/desktop-dark-history-reviewed.png",
|
|
35
35
|
"docs/screenshots/desktop-dark-history.png",
|
package/requirements.yaml
CHANGED
|
@@ -27,7 +27,7 @@ functional:
|
|
|
27
27
|
ATT-07: see whether an item already has a Paseo session and what its agent is doing; so that I don't start duplicate work.
|
|
28
28
|
ATT-08: dismiss an item until something new happens on it; so that FYIs stop taking up space.
|
|
29
29
|
ATT-09: notice how many items need me from anywhere in Paseo; so that I don't have to open Attention Span to check.
|
|
30
|
-
ATT-11: see work
|
|
30
|
+
ATT-11: see in Waiting which work has waited on others for too long, marked on its age and explained when I point at it, only where a nudge is fair (not while the next step is mine or CI is still running), and on my own issues however long ago that was; so that stalled work gets nudged, while Doing keeps only what I can act on.
|
|
31
31
|
ATT-12: open any item on GitHub; so that I can do what Attention Span doesn't cover.
|
|
32
32
|
ATT-13: tell at a glance which actions start an agent session and which change GitHub right away; so that I know what a tap will do.
|
|
33
33
|
ATT-14: undo a change on GitHub right after making it, where GitHub allows; so that a mis-tap costs nothing without confirming every action.
|
|
@@ -35,6 +35,7 @@ functional:
|
|
|
35
35
|
ATT-16: see recent comments without a mention on issues and pull requests I opened, until I reply, react or dismiss them; so that answers to my questions don't get lost, while other people's threads stay out unless someone tags me.
|
|
36
36
|
ATT-17: choose to follow threads I've commented on, so recent replies after mine there show without a tag, off by default; so that surfacing other people's threads is my choice, and the list stays signal, not noise.
|
|
37
37
|
ATT-18: see a calm, restful scene in Doing when nothing needs me, only once a refresh has confirmed it; so that a clear list feels like rest rather than a blank page, and calm never stands in for a check that failed or hasn't run.
|
|
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.
|
|
38
39
|
mentions:
|
|
39
40
|
As a developer, I can:
|
|
40
41
|
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.
|
|
@@ -63,6 +64,7 @@ functional:
|
|
|
63
64
|
PRS-12: see my pull requests that nobody has been asked to review, and ask people or teams from there, or merge where nobody reviews; so that work doesn't sit as "waiting" when nobody has the next move.
|
|
64
65
|
PRS-13: see an approved pull request that the repo's rules still block as waiting, without Merge; so that Merge is offered only when GitHub would allow it.
|
|
65
66
|
PRS-14: have checks the repo doesn't require not hold up a pull request, where the repo requires others; so that a failing or slow optional check doesn't keep finished work from shipping.
|
|
67
|
+
PRS-15: see on my pull requests in Doing whom I asked to review and who hasn't yet, approved or not, and find those pull requests in Waiting under each of them too; so that I know someone I wanted to read it still hasn't before I merge or move on, and can nudge them.
|
|
66
68
|
upstream:
|
|
67
69
|
As a developer, I can:
|
|
68
70
|
UPS-01: see my pull requests that conflict with their base; so that pull requests needing updates from upstream are easy to fix.
|
|
@@ -82,6 +84,7 @@ functional:
|
|
|
82
84
|
SES-06: start sessions even when no agent profiles are configured; so that Attention Span works before I've set anything up.
|
|
83
85
|
SES-07: start a session on an issue in the repository its code lives in, chosen right there the first time; so that issues kept in a separate repository work without editing files.
|
|
84
86
|
SES-08: see sessions started outside Attention Span on the item of the pull request their workspace is linked to, or of the session whose worktree they share, as "Continue session"; so that I don't start duplicate work.
|
|
87
|
+
SES-09: tell sessions reviewing someone else's pull request from work on my own in Paseo's sidebar, by a name like "Review PR 123: title"; so that I know which kind of work a workspace holds.
|
|
85
88
|
next_up:
|
|
86
89
|
As a developer, I can:
|
|
87
90
|
NXT-01: see open issues nobody is assigned to, apart from the work that needs me; so that I can get an idea of what to do next.
|
|
@@ -97,7 +100,7 @@ functional:
|
|
|
97
100
|
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.
|
|
98
101
|
waiting:
|
|
99
102
|
As a developer, I can:
|
|
100
|
-
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
|
|
103
|
+
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.
|
|
101
104
|
WAI-02: see who my waiting work waits on: reviewers I asked, reviewers who asked for changes and people I tagged in my unanswered question, and nobody where none of those apply; so that I know whom to nudge without guessing.
|
|
102
105
|
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.
|
|
103
106
|
history:
|
package/server/classify.ts
CHANGED
|
@@ -20,7 +20,7 @@ import type { Actor, Comment, Details, HistoryResult, IssueNode, LinkedIssue, Li
|
|
|
20
20
|
import { asksQuestion, excerpt, plainText, taggedIn } from "./markdown";
|
|
21
21
|
import { prKey } from "./queries";
|
|
22
22
|
import { issueFor } from "./references";
|
|
23
|
-
import { ISSUE_RULES, type IssueState, pick, PR_RULES, type PrState, replyActions, rulesBlock } from "./rules";
|
|
23
|
+
import { ISSUE_RULES, type IssueState, nudgeable, pick, PR_RULES, type PrState, replyActions, rulesBlock } from "./rules";
|
|
24
24
|
|
|
25
25
|
// Turns one refresh worth of GitHub data into what needs me. Pure, so every rule is testable.
|
|
26
26
|
|
|
@@ -53,6 +53,12 @@ const behindChip = (count: number, base: string) => chip(`${count} behind ${base
|
|
|
53
53
|
const person = (actor: Actor | null | undefined, since: string): Person | undefined =>
|
|
54
54
|
actor ? { login: actor.login, avatarUrl: actor.avatarUrl, bot: actor.__typename === "Bot", since } : undefined;
|
|
55
55
|
|
|
56
|
+
// Who opened it, which their line says with an icon rather than a quote [ATT-19].
|
|
57
|
+
const author = (actor: Actor | null | undefined, since: string): Person | undefined => {
|
|
58
|
+
const who = person(actor, since);
|
|
59
|
+
return who ? { ...who, role: "author" } : undefined;
|
|
60
|
+
};
|
|
61
|
+
|
|
56
62
|
// Search returns empty objects for result types a fragment doesn't cover.
|
|
57
63
|
const compact = <T>(nodes: (T | null | undefined)[]) => nodes.filter((node): node is T => !!node && Object.keys(node).length > 0);
|
|
58
64
|
|
|
@@ -190,20 +196,23 @@ export function classify({ data, details, config, now }: ClassifyInput): Attenti
|
|
|
190
196
|
stale: s.stale,
|
|
191
197
|
asked: s.asked,
|
|
192
198
|
replied,
|
|
193
|
-
tooLong: daysSince(waitingSince, now) >= config.waitingTooLongDays,
|
|
194
199
|
};
|
|
195
200
|
// Every PR of mine has a section; the tests check that a rule always holds.
|
|
196
201
|
const section = pick(PR_RULES, flags) ?? "wait_review";
|
|
197
|
-
const
|
|
198
|
-
const
|
|
202
|
+
const actions = PR_RULES[section]?.actions?.(flags) ?? [];
|
|
203
|
+
const tooLong = daysSince(waitingSince, now) >= config.waitingTooLongDays;
|
|
199
204
|
const rulesBlocked = rulesBlock(flags);
|
|
200
205
|
// Who it waits on, only from what GitHub records: who I asked, and while it waits for the reviewer after my reply, who
|
|
201
206
|
// asked for changes; while CI runs, only who I asked. Someone who reviewed and wasn't asked again owes nothing. A rule,
|
|
202
207
|
// not a person, holds up a PR the rules block [WAI-02, PRS-13].
|
|
203
|
-
const waits = !rulesBlocked &&
|
|
208
|
+
const waits = !rulesBlocked && SECTIONS[section].tab === "waiting";
|
|
204
209
|
const changers = replied && !flags.ciPending ? bottom.latestReviews.nodes.filter((review) => review.state === "CHANGES_REQUESTED").map((review) => review.author) : [];
|
|
205
210
|
const asked = bottom.reviewRequests.nodes.map((request) => requested(request.requestedReviewer));
|
|
206
|
-
|
|
211
|
+
// In Doing, approved or not, whoever I asked that hasn't reviewed yet: people and teams, not bots. An approved PR stays
|
|
212
|
+
// mine to merge, but I see who meant to read it still hasn't, and it waits on them in Waiting too, for a nudge. A PR the
|
|
213
|
+
// repo's rules block waits on nobody [PRS-15, PRS-13].
|
|
214
|
+
const outstanding = SECTIONS[section].tab === "doing" && !rulesBlocked ? reviewers(asked.filter(isOther), waitingSince).filter((who) => !who.bot) : [];
|
|
215
|
+
const waitingOn = waits ? reviewers([...changers, ...asked].filter(isOther), waitingSince) : outstanding;
|
|
207
216
|
// Why it waits, where the chips don't already say: approved ones say so, so do the rules that block them, and so does CI
|
|
208
217
|
// running when nobody's on it [WAI-01].
|
|
209
218
|
const reason =
|
|
@@ -233,12 +242,12 @@ export function classify({ data, details, config, now }: ClassifyInput): Attenti
|
|
|
233
242
|
section,
|
|
234
243
|
actions,
|
|
235
244
|
chips,
|
|
236
|
-
// Waiting
|
|
237
|
-
wait:
|
|
245
|
+
// In Waiting, and from Doing while it waits on whom I asked; too long once nudging them is fair [WAI-01, PRS-15, ATT-11].
|
|
246
|
+
wait: SECTIONS[section].tab === "waiting" || outstanding.length > 0 ? { reason, since: waitingSince, ...(tooLong && nudgeable(flags) && !rulesBlocked ? { tooLong } : {}) } : undefined,
|
|
238
247
|
person:
|
|
239
248
|
waiting ??
|
|
240
249
|
(section === "answered" ? answer : undefined) ??
|
|
241
|
-
(section === "changes" && s.botThreadsOnly ? { login: "review bot", bot: true, since: s.lastCommitAt } : undefined),
|
|
250
|
+
(section === "changes" && s.botThreadsOnly ? { login: "review bot", bot: true, since: s.lastCommitAt, role: "changes" as const } : undefined),
|
|
242
251
|
waitingOn: waitingOn.length > 0 ? waitingOn : undefined,
|
|
243
252
|
othersActivityAt: latest(...stack.map((pr) => state(pr).othersActivityAt), waiting?.since, answer?.since),
|
|
244
253
|
};
|
|
@@ -252,7 +261,7 @@ export function classify({ data, details, config, now }: ClassifyInput): Attenti
|
|
|
252
261
|
section: waiting ? "reply" : "review",
|
|
253
262
|
actions: waiting ? [...replyActions(waiting), "review"] : ["review"],
|
|
254
263
|
chips: stack.some((pr) => state(pr).ciFailing) ? [chip("CI failing", "bad")] : [],
|
|
255
|
-
person: waiting ??
|
|
264
|
+
person: waiting ?? author(stack[0].author, lastCommitAt),
|
|
256
265
|
othersActivityAt: latest(...stack.map((pr) => state(pr).othersActivityAt), lastCommitAt, waiting?.since),
|
|
257
266
|
};
|
|
258
267
|
};
|
|
@@ -269,6 +278,9 @@ export function classify({ data, details, config, now }: ClassifyInput): Attenti
|
|
|
269
278
|
stack,
|
|
270
279
|
own,
|
|
271
280
|
actions: [...new Set([...lead.actions, ...(other?.actions ?? [])])],
|
|
281
|
+
// Whom my PRs wait on stays, even where reviewing the rest of the stack leads, so they're in Waiting too [PRS-15].
|
|
282
|
+
waitingOn: lead.waitingOn ?? other?.waitingOn,
|
|
283
|
+
wait: lead.wait ?? other?.wait,
|
|
272
284
|
chips: [...lead.chips, ...(stack.length > 1 ? [chip(`stack of ${stack.length}`)] : [])],
|
|
273
285
|
othersActivityAt: latest(lead.othersActivityAt, other?.othersActivityAt),
|
|
274
286
|
};
|
|
@@ -336,8 +348,10 @@ export function classify({ data, details, config, now }: ClassifyInput): Attenti
|
|
|
336
348
|
url: lead?.url ?? bottom.url,
|
|
337
349
|
chips: [...(lead ? [chip(`PR #${bottom.number}`)] : []), ...unit.chips],
|
|
338
350
|
person: issueWaiting ?? unit.person,
|
|
339
|
-
|
|
340
|
-
|
|
351
|
+
// A reply on the issue is mine first, but its PRs still wait on whom I asked, in Waiting too; not too long while I owe
|
|
352
|
+
// that reply [PRS-15, ATT-11].
|
|
353
|
+
waitingOn: unit.waitingOn,
|
|
354
|
+
wait: issueWaiting && unit.wait ? { reason: unit.wait.reason, since: unit.wait.since } : unit.wait,
|
|
341
355
|
actions: issueWaiting ? replyActions(issueWaiting) : unit.actions,
|
|
342
356
|
children: lead ? grouped.flatMap((u) => u.stack.map((pr, i) => subRow(pr, i, u.stack))) : unit.stack.slice(1).map((pr, i) => subRow(pr, i + 1, unit.stack)),
|
|
343
357
|
// Actions on GitHub act on my PRs, from my bottom one; Review checks out the top of the stack [ATT-04].
|
|
@@ -372,7 +386,7 @@ export function classify({ data, details, config, now }: ClassifyInput): Attenti
|
|
|
372
386
|
});
|
|
373
387
|
}
|
|
374
388
|
|
|
375
|
-
// Issues and others' PRs I'm in: answered, or waiting on others
|
|
389
|
+
// Issues and others' PRs I'm in: answered, or waiting on others, too long after waitingTooLongDays [WAI-01, ATT-11, ATT-16].
|
|
376
390
|
// My own PRs are listed above, or handed over and left out [PRS-08].
|
|
377
391
|
for (const [key, issue] of threads) {
|
|
378
392
|
const found = answers.get(key);
|
|
@@ -382,13 +396,13 @@ export function classify({ data, details, config, now }: ClassifyInput): Attenti
|
|
|
382
396
|
const section = pick(ISSUE_RULES, flags);
|
|
383
397
|
if (!section) continue;
|
|
384
398
|
listed.add(key);
|
|
385
|
-
const label = ISSUE_RULES[section]?.label?.(flags);
|
|
386
399
|
const since = person?.since ?? mine;
|
|
400
|
+
const tooLong = daysSince(since, now) >= config.waitingTooLongDays;
|
|
387
401
|
items.push({
|
|
388
402
|
...plain(issue, kind, section),
|
|
389
403
|
person,
|
|
390
404
|
waitingOn: section !== "answered" && tagged.length > 0 ? tagged : undefined,
|
|
391
|
-
wait: section === "answered" ? undefined : { reason: "question", since,
|
|
405
|
+
wait: section === "answered" ? undefined : { reason: "question", since, ...(tooLong ? { tooLong } : {}) },
|
|
392
406
|
actions: section === "answered" ? replyActions(person) : [],
|
|
393
407
|
// A new answer brings back a dismissed one [ATT-08].
|
|
394
408
|
othersActivityAt: person ? latest(...(person.comments ?? []).map((c) => c.createdAt)) : EPOCH,
|
|
@@ -429,7 +443,7 @@ export function classifyHistory(data: HistoryResult): Item[] {
|
|
|
429
443
|
if (issue) issue.children.push({ key: prKey(pr), number: pr.number, title: pr.title, url: pr.url, draft: false, chips: [], attention: false });
|
|
430
444
|
else items.push(kinded({ ...plain(pr, "pr", "done"), closedAt: pr.mergedAt }, pr));
|
|
431
445
|
}
|
|
432
|
-
for (const pr of compact(data.reviewed.nodes)) items.push(kinded({ ...plain(pr, "pr", "reviewed"), closedAt: pr.mergedAt, person:
|
|
446
|
+
for (const pr of compact(data.reviewed.nodes)) items.push(kinded({ ...plain(pr, "pr", "reviewed"), closedAt: pr.mergedAt, person: author(pr.author, pr.mergedAt) }, pr));
|
|
433
447
|
return items.sort(order);
|
|
434
448
|
}
|
|
435
449
|
|
|
@@ -442,7 +456,7 @@ export function threadState(
|
|
|
442
456
|
thread: IssueNode,
|
|
443
457
|
me: string,
|
|
444
458
|
now: Date,
|
|
445
|
-
config: Pick<AttentionConfig, "mentionDays" | "
|
|
459
|
+
config: Pick<AttentionConfig, "mentionDays" | "followThreads">,
|
|
446
460
|
): { flags: IssueState; person?: Person; mine: string; tagged: WaitingOn[] } | null {
|
|
447
461
|
const authored = thread.author?.login.toLowerCase() === me;
|
|
448
462
|
const people = thread.comments.nodes.filter((c) => c.author && c.author.__typename !== "Bot");
|
|
@@ -464,7 +478,6 @@ export function threadState(
|
|
|
464
478
|
question: run.some((comment) => asksQuestion(comment.bodyHTML)),
|
|
465
479
|
answered: unread.length > 0,
|
|
466
480
|
fresh: recent(mine),
|
|
467
|
-
tooLong: daysSince(mine, now) >= config.waitingTooLongDays,
|
|
468
481
|
};
|
|
469
482
|
const tagged = flags.mineLast ? taggedSince(run, me, thread.url) : [];
|
|
470
483
|
const last = unread.at(-1);
|
package/server/fixture.ts
CHANGED
|
@@ -152,7 +152,7 @@ export function fixture(now: Date): { data: SearchResult; details: Details } {
|
|
|
152
152
|
|
|
153
153
|
const data = search({
|
|
154
154
|
mine: [
|
|
155
|
-
pr(101, { title: "Show delivery dates on the order page" }, "FAILURE"),
|
|
155
|
+
pr(101, { title: "Show delivery dates on the order page", reviewRequests: { nodes: [{ requestedReviewer: alice }, { requestedReviewer: bot }] } }, "FAILURE"),
|
|
156
156
|
pr(102, { title: "Retry webhook deliveries with backoff", reviewThreads: { nodes: [thread(alice, 1), thread(bot, 2)] } }),
|
|
157
157
|
pr(103, { title: "Fetch supplier price files nightly", reviewDecision: "APPROVED", closingIssuesReferences: closes(90, "Supplier prices are a week out of date") }),
|
|
158
158
|
pr(104, { title: "Move price-file login into a service", isDraft: true, baseRefName: "branch-103", headRefName: "branch-104" }),
|
|
@@ -167,7 +167,7 @@ export function fixture(now: Date): { data: SearchResult; details: Details } {
|
|
|
167
167
|
pr(111, { title: "Faster product search", reviewRequests: { nodes: [{ requestedReviewer: bob }] }, commits: commit("SUCCESS", 0.3) }),
|
|
168
168
|
pr(112, { title: "Translate the checkout emails", reviewDecision: "CHANGES_REQUESTED", latestReviews: { nodes: [{ author: alice, state: "CHANGES_REQUESTED", submittedAt: daysAgo(2) }] }, commits: commit("SUCCESS", 1) }),
|
|
169
169
|
pr(113, { title: "Upgrade the payment SDK", reviewRequests: { nodes: [{ requestedReviewer: bob }, { requestedReviewer: alice }] } }, "PENDING"),
|
|
170
|
-
pr(114, { title: "Cache exchange rates daily", reviewDecision: "APPROVED" }),
|
|
170
|
+
pr(114, { title: "Cache exchange rates daily", reviewDecision: "APPROVED", latestReviews: { nodes: [{ author: alice, state: "APPROVED", submittedAt: daysAgo(8) }] }, reviewRequests: { nodes: [{ requestedReviewer: bob }] }, commits: commit("SUCCESS", 9) }),
|
|
171
171
|
pr(115, { title: "Split the settings page into tabs", isDraft: true, mergeable: "CONFLICTING" }),
|
|
172
172
|
pr(116, { title: "Try a faster PDF renderer", isDraft: true }, "FAILURE"),
|
|
173
173
|
pr(117, { title: "Harden the upload endpoint", reviewThreads: { nodes: [thread(bot, 1)] } }),
|
package/server/rules.ts
CHANGED
|
@@ -7,8 +7,6 @@ export interface Rule<S> {
|
|
|
7
7
|
when: (s: S) => boolean;
|
|
8
8
|
// The first is the card's main action.
|
|
9
9
|
actions?: (s: S) => ActionId[];
|
|
10
|
-
// What it waits for, for Waiting too long's chip.
|
|
11
|
-
label?: (s: S) => string;
|
|
12
10
|
}
|
|
13
11
|
export type Rules<S> = { [K in SectionId]?: Rule<S> };
|
|
14
12
|
|
|
@@ -48,15 +46,15 @@ export interface PrState {
|
|
|
48
46
|
asked: boolean;
|
|
49
47
|
// I replied to the reviewer, or pushed after changes were requested.
|
|
50
48
|
replied: boolean;
|
|
51
|
-
// Waited at least waitingTooLongDays [ATT-11].
|
|
52
|
-
tooLong: boolean;
|
|
53
49
|
}
|
|
54
50
|
|
|
55
51
|
// Approved and nothing I know of in the way, yet GitHub's rules still block it: signed commits, a required check that never
|
|
56
52
|
// reported, a resolved-conversations rule, and the like. Nothing for me to do here, so it waits [PRS-13].
|
|
57
53
|
export const rulesBlock = (s: PrState) => !s.draft && s.mergeBlocked && s.approved && !s.ciPending && !s.ciFailing && !s.changes && !s.conflicts;
|
|
58
54
|
|
|
59
|
-
|
|
55
|
+
// Fair to nudge whoever it waits on once it has waited too long: not while the next step is mine (failing CI, conflicts or a
|
|
56
|
+
// stack out of sync, changes to make, a reply I owe), nor while CI runs, which a reviewer may fairly wait out [ATT-11].
|
|
57
|
+
export const nudgeable = (s: PrState) => !s.draft && !s.waiting && !s.answer && !s.ciFailing && !s.ciPending && !s.changes && !s.blocked;
|
|
60
58
|
|
|
61
59
|
// Merge only once CI passed against the current base [PRS-04, UPS-07]. Until then, auto-merge if the repo allows it [PRS-10].
|
|
62
60
|
function readyActions(s: PrState): ActionId[] {
|
|
@@ -83,8 +81,6 @@ export const PR_RULES: Rules<PrState> = {
|
|
|
83
81
|
// Blocked while CI runs counts as waiting on CI, which auto-merge covers [PRS-10, PRS-13].
|
|
84
82
|
ready: { when: (s) => !s.draft && s.approved && !s.conflicts && !s.ciFailing && !s.changes && !(s.autoMerge && s.ciPending) && !rulesBlock(s), actions: readyActions },
|
|
85
83
|
upstream: { when: (s) => !s.draft && s.blocked, actions: () => ["rebase"] },
|
|
86
|
-
// After too long it's mine to nudge [ATT-11]; a rule has no one to nudge [PRS-13].
|
|
87
|
-
too_long: { when: (s) => !s.draft && s.asked && s.tooLong && !rulesBlock(s), label: waitingFor },
|
|
88
84
|
// Mine until I ask someone, even while CI runs. Merge, for repos where nobody reviews, once CI passed on the current base
|
|
89
85
|
// and GitHub's rules allow it [PRS-12, PRS-04, PRS-13].
|
|
90
86
|
needs_reviewer: {
|
|
@@ -92,10 +88,11 @@ export const PR_RULES: Rules<PrState> = {
|
|
|
92
88
|
actions: (s) => (!s.ciFailing && !s.ciPending && s.behindBy === 0 && !s.mergeBlocked ? ["request_review", "merge"] : ["request_review"]),
|
|
93
89
|
},
|
|
94
90
|
drafts: { when: (s) => s.draft, actions: draftActions },
|
|
95
|
-
// Otherwise it waits on others: CI, the reviewer after my reply, or a review
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
91
|
+
// Otherwise it waits on others: CI, the reviewer after my reply, or a review, however long; Waiting says when that's too
|
|
92
|
+
// long [WAI-01, ATT-11]. Blocked by rules waits with reviews [PRS-13].
|
|
93
|
+
wait_review: { when: (s) => !s.draft && s.asked && !s.ciPending && (!s.replied || rulesBlock(s)) },
|
|
94
|
+
wait_reviewer: { when: (s) => !s.draft && s.asked && !s.ciPending && s.replied && !rulesBlock(s) },
|
|
95
|
+
wait_ci: { when: (s) => !s.draft && s.asked && s.ciPending },
|
|
99
96
|
};
|
|
100
97
|
|
|
101
98
|
// ---- Issues and others' PRs I'm in [WAI-01, ATT-16] ----
|
|
@@ -113,8 +110,6 @@ export interface IssueState {
|
|
|
113
110
|
answered: boolean;
|
|
114
111
|
// My last comment is within mentionDays.
|
|
115
112
|
fresh: boolean;
|
|
116
|
-
// My last comment is at least waitingTooLongDays old.
|
|
117
|
-
tooLong: boolean;
|
|
118
113
|
}
|
|
119
114
|
|
|
120
115
|
// An issue may match none, and then isn't listed: an answer I 👍'd needs nothing more, nor an old thread of someone else's.
|
|
@@ -123,7 +118,7 @@ export const ISSUE_RULES: Rules<IssueState> = {
|
|
|
123
118
|
// A recent comment after mine, without mentioning me: mine until I reply, 👍 it or dismiss it [ATT-16].
|
|
124
119
|
// On someone else's thread only when I've allowed replies without a tag [ATT-17].
|
|
125
120
|
answered: { when: (s) => s.answered && (s.authored || s.follow) },
|
|
126
|
-
//
|
|
127
|
-
|
|
121
|
+
// My question waits on an answer: on my own issues however long ago, on others' only while fresh. Waiting says when it's
|
|
122
|
+
// waited too long [WAI-01, ATT-11].
|
|
128
123
|
wait_answer: { when: (s) => s.mineLast && s.question && (s.authored || s.fresh) },
|
|
129
124
|
};
|
package/server/store.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { mkdir, readFile, rename, stat, writeFile } from "node:fs/promises";
|
|
|
2
2
|
import { homedir } from "node:os";
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
import { z } from "zod";
|
|
5
|
-
import type
|
|
5
|
+
import { type Attention, type Item, type SectionId, SECTIONS } from "../shared/attention";
|
|
6
6
|
import { AttentionConfig, FIELD_ROLES, type FieldRole, sameField } from "../shared/config";
|
|
7
7
|
import type { Pending } from "./view";
|
|
8
8
|
|
|
@@ -14,6 +14,8 @@ const OLD_DIR = join(homedir(), ".config", "paseo-github-attention");
|
|
|
14
14
|
const CONFIG = join(DIR, "config.json");
|
|
15
15
|
const STATE = join(DIR, "state.json");
|
|
16
16
|
|
|
17
|
+
const knownSections = (items: unknown): boolean => Array.isArray(items) && items.every((item) => Object.hasOwn(SECTIONS, (item as Item)?.section));
|
|
18
|
+
|
|
17
19
|
export const State = z.object({
|
|
18
20
|
// Item key -> others' activity and section when dismissed [ATT-08].
|
|
19
21
|
dismissed: z.record(z.string(), z.object({ at: z.string(), section: z.custom<SectionId>() })).default({}),
|
|
@@ -27,12 +29,19 @@ export const State = z.object({
|
|
|
27
29
|
skippedUpdate: z.string().nullable().default(null).catch(null),
|
|
28
30
|
// My Paseo projects' GitHub repos when last listed, for refreshes before the app has connected [NXT-08].
|
|
29
31
|
projectRepos: z.array(z.string()).default([]),
|
|
30
|
-
// The last fetch of each feed. A cache from an older version is dropped rather than shown wrong
|
|
32
|
+
// The last fetch of each feed. A cache from an older version is dropped rather than shown wrong, like one with an item in a
|
|
33
|
+
// section that's gone (Waiting too long was one) [ATT-11].
|
|
31
34
|
live: z
|
|
32
|
-
.object({
|
|
35
|
+
.object({
|
|
36
|
+
fetchedAt: z.string(),
|
|
37
|
+
attention: z.custom<Attention>(
|
|
38
|
+
(value) =>
|
|
39
|
+
knownSections((value as Attention)?.items) && (value as Attention).unclaimed?.every?.((issue) => Array.isArray(issue.sources) && Array.isArray(issue.openPrs)),
|
|
40
|
+
),
|
|
41
|
+
})
|
|
33
42
|
.nullable()
|
|
34
43
|
.catch(null),
|
|
35
|
-
history: z.object({ fetchedAt: z.string(), items: z.custom<Item[]>(
|
|
44
|
+
history: z.object({ fetchedAt: z.string(), items: z.custom<Item[]>(knownSections) }).nullable().catch(null),
|
|
36
45
|
});
|
|
37
46
|
export type State = z.infer<typeof State>;
|
|
38
47
|
|
package/server/view.ts
CHANGED
|
@@ -94,7 +94,7 @@ export function isDismissed(item: Item, dismissed: State["dismissed"]): boolean
|
|
|
94
94
|
|
|
95
95
|
// 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
|
|
96
96
|
// can't be nudged, and last the work no person holds up. Each one's work oldest first; the screen lifts work with an active
|
|
97
|
-
// session.
|
|
97
|
+
// session. My PRs in Doing that wait on whom I asked are here too, so nudging them is one list [WAI-01, WAI-03, PRS-15].
|
|
98
98
|
export function waitingGroups(items: Item[]): WaitingGroup[] {
|
|
99
99
|
const oldest = (list: Item[]) => list.map((item) => item.wait?.since ?? "").sort()[0] ?? "";
|
|
100
100
|
const people = new Map<string, WaitingGroup>();
|
|
@@ -122,6 +122,9 @@ export function waitingGroups(items: Item[]): WaitingGroup[] {
|
|
|
122
122
|
return nobody.length ? [...groups, { items: nobody.sort(byWait) }] : groups;
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
+
// Waiting's work: its own sections, and my PRs in Doing while they wait on someone I asked [WAI-01, PRS-15].
|
|
126
|
+
const inWaiting = (item: Item) => SECTIONS[item.section].tab === "waiting" || (SECTIONS[item.section].tab === "doing" && !!item.wait && !!item.waitingOn?.length);
|
|
127
|
+
|
|
125
128
|
export function buildView(attention: Attention | null, history: Item[], dismissed: State["dismissed"], meta: ViewMeta): AttentionView {
|
|
126
129
|
const items = [...(attention?.items ?? []), ...history];
|
|
127
130
|
const visible = items.filter((item) => !isDismissed(item, dismissed));
|
|
@@ -135,7 +138,7 @@ export function buildView(attention: Attention | null, history: Item[], dismisse
|
|
|
135
138
|
login: attention?.login ?? null,
|
|
136
139
|
count: doing.reduce((sum, section) => sum + section.items.length, 0),
|
|
137
140
|
doing,
|
|
138
|
-
waiting: waitingGroups(visible.filter(
|
|
141
|
+
waiting: waitingGroups(visible.filter(inWaiting)),
|
|
139
142
|
history: visible.filter((item) => SECTIONS[item.section].tab === "history"),
|
|
140
143
|
assigned: attention?.assigned ?? [],
|
|
141
144
|
unclaimed: attention?.unclaimed ?? [],
|
package/shared/attention.ts
CHANGED
|
@@ -19,7 +19,6 @@ export const SECTIONS = {
|
|
|
19
19
|
changes: { tab: "doing", title: "Changes requested" },
|
|
20
20
|
ready: { tab: "doing", title: "Ready to merge" },
|
|
21
21
|
upstream: { tab: "doing", title: "Needs upstream" },
|
|
22
|
-
too_long: { tab: "doing", title: "Waiting too long" },
|
|
23
22
|
// Nobody has the next move until I ask someone [PRS-12].
|
|
24
23
|
needs_reviewer: { tab: "doing", title: "Needs a reviewer" },
|
|
25
24
|
drafts: { tab: "doing", title: "My drafts" },
|
|
@@ -58,12 +57,18 @@ export interface Chip {
|
|
|
58
57
|
text: string;
|
|
59
58
|
tone: "good" | "bad" | "warn" | "neutral";
|
|
60
59
|
// In place of the dot, where a picture says it better.
|
|
61
|
-
icon?: "thumbUp";
|
|
60
|
+
icon?: "thumbUp" | "hourglass";
|
|
61
|
+
// What it means in words, on hover and to screen readers [ATT-11, ATT-19].
|
|
62
|
+
hint?: string;
|
|
62
63
|
}
|
|
63
64
|
|
|
65
|
+
export type PersonRole = "author" | "changes";
|
|
66
|
+
|
|
64
67
|
// The person (or bot) I'm waiting on, or who is waiting on me.
|
|
65
68
|
export interface Person {
|
|
66
69
|
login: string;
|
|
70
|
+
// What they are to the item, where no quote says it: who opened it, or whose comments are left to address [ATT-19].
|
|
71
|
+
role?: PersonRole;
|
|
67
72
|
avatarUrl?: string;
|
|
68
73
|
bot: boolean;
|
|
69
74
|
since: string;
|
|
@@ -84,14 +89,16 @@ export interface WaitingOn {
|
|
|
84
89
|
since: string;
|
|
85
90
|
}
|
|
86
91
|
|
|
87
|
-
// What my
|
|
92
|
+
// What my work waits for: on items in Waiting, and on my PRs in Doing that wait on reviewers too, which Waiting lists as
|
|
93
|
+
// well [WAI-01, PRS-15].
|
|
88
94
|
export interface Wait {
|
|
89
95
|
// In a word or two: "review", "re-review", "question". None where the chips already say, like blocked by repo rules.
|
|
90
96
|
reason?: string;
|
|
91
97
|
// Since I asked, tagged, pushed or replied.
|
|
92
98
|
since: string;
|
|
93
|
-
//
|
|
94
|
-
|
|
99
|
+
// Waited at least waitingTooLongDays, where nudging is fair: not while the next step is mine, like failing CI, conflicts,
|
|
100
|
+
// changes to make or a reply I owe, nor while CI runs [ATT-11].
|
|
101
|
+
tooLong?: boolean;
|
|
95
102
|
}
|
|
96
103
|
|
|
97
104
|
// Waiting's work under someone it waits on, longest wait first; the last group, without anyone, is work no person holds up.
|
|
@@ -168,6 +175,12 @@ export function checkoutPr(kind: SessionKind, target: Pick<Target, "number" | "h
|
|
|
168
175
|
return kind === "review" && top && target.stack!.length > 1 ? { number: top.number, head: top.head } : { number: target.number, head: target.headRefName };
|
|
169
176
|
}
|
|
170
177
|
|
|
178
|
+
// The name of a session and its new workspace; a review says so, apart from work on my own PRs [SES-09].
|
|
179
|
+
export function sessionTitle(kind: SessionKind, target: Pick<Target, "kind" | "number" | "title">): string {
|
|
180
|
+
const item = `${target.kind === "pr" ? "PR" : "Issue"} ${target.number}: ${target.title}`;
|
|
181
|
+
return (kind === "review" ? `Review ${item}` : item).slice(0, 120);
|
|
182
|
+
}
|
|
183
|
+
|
|
171
184
|
export interface SubRow {
|
|
172
185
|
key: string;
|
|
173
186
|
number: number;
|
|
@@ -190,7 +203,7 @@ export interface Item {
|
|
|
190
203
|
url: string;
|
|
191
204
|
chips: Chip[];
|
|
192
205
|
person?: Person;
|
|
193
|
-
// Waiting and
|
|
206
|
+
// Whom it waits on: in Waiting, and on my PRs in Doing whom I asked that hasn't reviewed yet [WAI-02, PRS-15].
|
|
194
207
|
waitingOn?: WaitingOn[];
|
|
195
208
|
wait?: Wait;
|
|
196
209
|
actions: ActionId[];
|
package/shared/hint.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Where a hint goes, from window coordinates: its content spans [x, x + width], and the area it may spread in [left, right]
|
|
2
|
+
// (a card's text column, which clips what runs past). Beside the content where there's room, else above it, never past the
|
|
3
|
+
// area's edges [ATT-19].
|
|
4
|
+
|
|
5
|
+
export const HINT_GAP = 8;
|
|
6
|
+
// Less room than this beside the content, and the hint goes above it instead.
|
|
7
|
+
export const HINT_MIN_WIDTH = 160;
|
|
8
|
+
|
|
9
|
+
export type HintPlacement =
|
|
10
|
+
| { side: "beside"; width: number }
|
|
11
|
+
// offset: from the content's left edge; negative where it shifts left to make room.
|
|
12
|
+
| { side: "above"; width: number; offset: number };
|
|
13
|
+
|
|
14
|
+
export function hintPlacement(x: number, width: number, left: number, right: number): HintPlacement {
|
|
15
|
+
const beside = right - (x + width) - HINT_GAP;
|
|
16
|
+
if (beside >= HINT_MIN_WIDTH) return { side: "beside", width: beside };
|
|
17
|
+
// From the content's left edge to the area's right; where that's too narrow, as wide as needed by shifting left, but never
|
|
18
|
+
// wider than the area.
|
|
19
|
+
const span = Math.min(Math.max(HINT_MIN_WIDTH, right - x), right - left);
|
|
20
|
+
return { side: "above", width: span, offset: Math.min(0, right - span - x) };
|
|
21
|
+
}
|
|
Binary file
|