@andrioid/paseo-attention-span 0.4.8 → 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 +17 -35
- package/client/card.tsx +3 -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-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 +4 -3
- package/server/classify.ts +20 -17
- package/server/fixture.ts +1 -1
- package/server/rules.ts +10 -15
- package/server/store.ts +13 -4
- package/server/view.ts +5 -2
- package/shared/attention.ts +15 -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
|
|
|
@@ -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",
|
|
@@ -569,17 +568,17 @@ type Sheet = "item" | "acknowledge" | "reviewers" | "reviewers-after-ready" | nu
|
|
|
569
568
|
// A session on an item that has no session action of its own starts with this prompt; it's editable first.
|
|
570
569
|
const fallbackKind = (item: Item): SessionKind => (item.target.kind === "issue" ? "start" : "review");
|
|
571
570
|
|
|
572
|
-
//
|
|
573
|
-
|
|
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[] {
|
|
574
574
|
const { wait } = item;
|
|
575
|
-
if (!wait) return [];
|
|
575
|
+
if (!wait || !inWaiting) return [];
|
|
576
576
|
const age = ago(wait.since);
|
|
577
|
-
|
|
578
|
-
return [
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
];
|
|
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}` }];
|
|
583
582
|
}
|
|
584
583
|
|
|
585
584
|
// "Review 2h", "Question 3d": why and how long, to lead a line in a nudge [WAI-03].
|
|
@@ -596,7 +595,7 @@ function ItemRow({ item, first, actions, group }: { item: Item; first: boolean;
|
|
|
596
595
|
const styles = useStyles();
|
|
597
596
|
// An open session leads; without one, the item's own action does [SES-03].
|
|
598
597
|
const sessions = itemSessions(actions.agents, item);
|
|
599
|
-
const own = [...waitChips(item, !!group), ...item.chips];
|
|
598
|
+
const own = [...waitChips(item, !!group, actions.config.waitingTooLongDays), ...item.chips];
|
|
600
599
|
const chips = sessions[0] ? [...own, agentSignal(sessions[0])] : own;
|
|
601
600
|
// The group names one; the card names the rest [WAI-01].
|
|
602
601
|
const others = group?.who ? (item.waitingOn ?? []).filter((who) => !samePerson(who, group.who!)) : [];
|
|
@@ -929,23 +928,6 @@ function ReviewerSheet({
|
|
|
929
928
|
// reads like Waiting, and whose comments are left like Changes requested [ATT-19].
|
|
930
929
|
const ROLE_ICON: Record<PersonRole | "waiting", IconName> = { waiting: "hourglass", author: "pencil", changes: "changes" };
|
|
931
930
|
|
|
932
|
-
// A line that says what it means in words on hover, and to screen readers; phones rely on the icon [ATT-19]. The words sit
|
|
933
|
-
// beside the line in its flow, not floating over it, so a card's clipping can't cut them off: they wrap where space runs out.
|
|
934
|
-
function Explained({ text, children }: { text: string; children: ReactNode }) {
|
|
935
|
-
const styles = useStyles();
|
|
936
|
-
const [hovered, setHovered] = useState(false);
|
|
937
|
-
return (
|
|
938
|
-
<View accessibilityLabel={text} onPointerEnter={() => setHovered(true)} onPointerLeave={() => setHovered(false)} style={{ alignSelf: "flex-start", flexDirection: "row", alignItems: "center", gap: 8 }}>
|
|
939
|
-
<View style={{ flexShrink: 0 }}>{children}</View>
|
|
940
|
-
{hovered ? (
|
|
941
|
-
<View style={{ flexShrink: 1, backgroundColor: styles.c.surface2, borderColor: styles.c.border, borderWidth: 1, borderRadius: 6, paddingVertical: 2, paddingHorizontal: 8 }}>
|
|
942
|
-
<Text style={{ color: styles.c.foreground, fontSize: 12 }}>{text}</Text>
|
|
943
|
-
</View>
|
|
944
|
-
) : null}
|
|
945
|
-
</View>
|
|
946
|
-
);
|
|
947
|
-
}
|
|
948
|
-
|
|
949
931
|
// The icon sits tight against the faces it explains, apart from the name and time, so they read as one.
|
|
950
932
|
function Badged({ role, children }: { role: keyof typeof ROLE_ICON; children: ReactNode }) {
|
|
951
933
|
const styles = useStyles();
|
|
@@ -965,7 +947,7 @@ function PersonQuote({ person, expanded }: { person: NonNullable<Item["person"]>
|
|
|
965
947
|
if (!person.snippet && person.role) {
|
|
966
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`;
|
|
967
949
|
return (
|
|
968
|
-
<
|
|
950
|
+
<Hint text={text}>
|
|
969
951
|
<View style={styles.row}>
|
|
970
952
|
<Badged role={person.role}>
|
|
971
953
|
<Avatar url={person.avatarUrl} bot={person.bot} />
|
|
@@ -973,7 +955,7 @@ function PersonQuote({ person, expanded }: { person: NonNullable<Item["person"]>
|
|
|
973
955
|
{name}
|
|
974
956
|
{person.role === "author" ? null : <Text style={styles.muted}>· {ago(person.since)}</Text>}
|
|
975
957
|
</View>
|
|
976
|
-
</
|
|
958
|
+
</Hint>
|
|
977
959
|
);
|
|
978
960
|
}
|
|
979
961
|
const line = (
|
|
@@ -1013,7 +995,7 @@ function WaitingOnLine({ people, asked, expanded }: { people: WaitingOn[]; asked
|
|
|
1013
995
|
return (
|
|
1014
996
|
<View style={{ gap: 6 }}>
|
|
1015
997
|
{people.map((who) => (
|
|
1016
|
-
<
|
|
998
|
+
<Hint key={who.login} text={explain([who.login], who.since)}>
|
|
1017
999
|
<View style={styles.row}>
|
|
1018
1000
|
<Badged role="waiting">
|
|
1019
1001
|
<Avatar url={who.avatarUrl} team={who.team} />
|
|
@@ -1021,14 +1003,14 @@ function WaitingOnLine({ people, asked, expanded }: { people: WaitingOn[]; asked
|
|
|
1021
1003
|
{name(who.login)}
|
|
1022
1004
|
{since(who.since)}
|
|
1023
1005
|
</View>
|
|
1024
|
-
</
|
|
1006
|
+
</Hint>
|
|
1025
1007
|
))}
|
|
1026
1008
|
</View>
|
|
1027
1009
|
);
|
|
1028
1010
|
}
|
|
1029
1011
|
const earliest = people.map((who) => who.since).sort()[0];
|
|
1030
1012
|
return (
|
|
1031
|
-
<
|
|
1013
|
+
<Hint text={explain(people.map((who) => who.login), earliest)}>
|
|
1032
1014
|
<View style={styles.row}>
|
|
1033
1015
|
<Badged role="waiting">
|
|
1034
1016
|
<View style={{ flexDirection: "row", alignItems: "center", gap: 4 }}>
|
|
@@ -1043,7 +1025,7 @@ function WaitingOnLine({ people, asked, expanded }: { people: WaitingOn[]; asked
|
|
|
1043
1025
|
{hovered ? name(hovered) : null}
|
|
1044
1026
|
{since(earliest)}
|
|
1045
1027
|
</View>
|
|
1046
|
-
</
|
|
1028
|
+
</Hint>
|
|
1047
1029
|
);
|
|
1048
1030
|
}
|
|
1049
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/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
|
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.
|
|
@@ -64,7 +64,7 @@ functional:
|
|
|
64
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.
|
|
65
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.
|
|
66
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; so that I know someone I wanted to read it still hasn't before I merge or move on.
|
|
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.
|
|
68
68
|
upstream:
|
|
69
69
|
As a developer, I can:
|
|
70
70
|
UPS-01: see my pull requests that conflict with their base; so that pull requests needing updates from upstream are easy to fix.
|
|
@@ -84,6 +84,7 @@ functional:
|
|
|
84
84
|
SES-06: start sessions even when no agent profiles are configured; so that Attention Span works before I've set anything up.
|
|
85
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.
|
|
86
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.
|
|
87
88
|
next_up:
|
|
88
89
|
As a developer, I can:
|
|
89
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.
|
|
@@ -99,7 +100,7 @@ functional:
|
|
|
99
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.
|
|
100
101
|
waiting:
|
|
101
102
|
As a developer, I can:
|
|
102
|
-
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.
|
|
103
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.
|
|
104
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.
|
|
105
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
|
|
|
@@ -196,23 +196,22 @@ export function classify({ data, details, config, now }: ClassifyInput): Attenti
|
|
|
196
196
|
stale: s.stale,
|
|
197
197
|
asked: s.asked,
|
|
198
198
|
replied,
|
|
199
|
-
tooLong: daysSince(waitingSince, now) >= config.waitingTooLongDays,
|
|
200
199
|
};
|
|
201
200
|
// Every PR of mine has a section; the tests check that a rule always holds.
|
|
202
201
|
const section = pick(PR_RULES, flags) ?? "wait_review";
|
|
203
|
-
const
|
|
204
|
-
const
|
|
202
|
+
const actions = PR_RULES[section]?.actions?.(flags) ?? [];
|
|
203
|
+
const tooLong = daysSince(waitingSince, now) >= config.waitingTooLongDays;
|
|
205
204
|
const rulesBlocked = rulesBlock(flags);
|
|
206
205
|
// Who it waits on, only from what GitHub records: who I asked, and while it waits for the reviewer after my reply, who
|
|
207
206
|
// asked for changes; while CI runs, only who I asked. Someone who reviewed and wasn't asked again owes nothing. A rule,
|
|
208
207
|
// not a person, holds up a PR the rules block [WAI-02, PRS-13].
|
|
209
|
-
const waits = !rulesBlocked &&
|
|
208
|
+
const waits = !rulesBlocked && SECTIONS[section].tab === "waiting";
|
|
210
209
|
const changers = replied && !flags.ciPending ? bottom.latestReviews.nodes.filter((review) => review.state === "CHANGES_REQUESTED").map((review) => review.author) : [];
|
|
211
210
|
const asked = bottom.reviewRequests.nodes.map((request) => requested(request.requestedReviewer));
|
|
212
211
|
// In Doing, approved or not, whoever I asked that hasn't reviewed yet: people and teams, not bots. An approved PR stays
|
|
213
|
-
// mine to merge, but I see who meant to read it still hasn't
|
|
214
|
-
// block waits on nobody
|
|
215
|
-
const outstanding = SECTIONS[section].tab === "doing" &&
|
|
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) : [];
|
|
216
215
|
const waitingOn = waits ? reviewers([...changers, ...asked].filter(isOther), waitingSince) : outstanding;
|
|
217
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
|
|
218
217
|
// running when nobody's on it [WAI-01].
|
|
@@ -243,8 +242,8 @@ export function classify({ data, details, config, now }: ClassifyInput): Attenti
|
|
|
243
242
|
section,
|
|
244
243
|
actions,
|
|
245
244
|
chips,
|
|
246
|
-
// Waiting
|
|
247
|
-
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,
|
|
248
247
|
person:
|
|
249
248
|
waiting ??
|
|
250
249
|
(section === "answered" ? answer : undefined) ??
|
|
@@ -279,6 +278,9 @@ export function classify({ data, details, config, now }: ClassifyInput): Attenti
|
|
|
279
278
|
stack,
|
|
280
279
|
own,
|
|
281
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,
|
|
282
284
|
chips: [...lead.chips, ...(stack.length > 1 ? [chip(`stack of ${stack.length}`)] : [])],
|
|
283
285
|
othersActivityAt: latest(lead.othersActivityAt, other?.othersActivityAt),
|
|
284
286
|
};
|
|
@@ -346,8 +348,10 @@ export function classify({ data, details, config, now }: ClassifyInput): Attenti
|
|
|
346
348
|
url: lead?.url ?? bottom.url,
|
|
347
349
|
chips: [...(lead ? [chip(`PR #${bottom.number}`)] : []), ...unit.chips],
|
|
348
350
|
person: issueWaiting ?? unit.person,
|
|
349
|
-
|
|
350
|
-
|
|
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,
|
|
351
355
|
actions: issueWaiting ? replyActions(issueWaiting) : unit.actions,
|
|
352
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)),
|
|
353
357
|
// Actions on GitHub act on my PRs, from my bottom one; Review checks out the top of the stack [ATT-04].
|
|
@@ -382,7 +386,7 @@ export function classify({ data, details, config, now }: ClassifyInput): Attenti
|
|
|
382
386
|
});
|
|
383
387
|
}
|
|
384
388
|
|
|
385
|
-
// 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].
|
|
386
390
|
// My own PRs are listed above, or handed over and left out [PRS-08].
|
|
387
391
|
for (const [key, issue] of threads) {
|
|
388
392
|
const found = answers.get(key);
|
|
@@ -392,13 +396,13 @@ export function classify({ data, details, config, now }: ClassifyInput): Attenti
|
|
|
392
396
|
const section = pick(ISSUE_RULES, flags);
|
|
393
397
|
if (!section) continue;
|
|
394
398
|
listed.add(key);
|
|
395
|
-
const label = ISSUE_RULES[section]?.label?.(flags);
|
|
396
399
|
const since = person?.since ?? mine;
|
|
400
|
+
const tooLong = daysSince(since, now) >= config.waitingTooLongDays;
|
|
397
401
|
items.push({
|
|
398
402
|
...plain(issue, kind, section),
|
|
399
403
|
person,
|
|
400
404
|
waitingOn: section !== "answered" && tagged.length > 0 ? tagged : undefined,
|
|
401
|
-
wait: section === "answered" ? undefined : { reason: "question", since,
|
|
405
|
+
wait: section === "answered" ? undefined : { reason: "question", since, ...(tooLong ? { tooLong } : {}) },
|
|
402
406
|
actions: section === "answered" ? replyActions(person) : [],
|
|
403
407
|
// A new answer brings back a dismissed one [ATT-08].
|
|
404
408
|
othersActivityAt: person ? latest(...(person.comments ?? []).map((c) => c.createdAt)) : EPOCH,
|
|
@@ -452,7 +456,7 @@ export function threadState(
|
|
|
452
456
|
thread: IssueNode,
|
|
453
457
|
me: string,
|
|
454
458
|
now: Date,
|
|
455
|
-
config: Pick<AttentionConfig, "mentionDays" | "
|
|
459
|
+
config: Pick<AttentionConfig, "mentionDays" | "followThreads">,
|
|
456
460
|
): { flags: IssueState; person?: Person; mine: string; tagged: WaitingOn[] } | null {
|
|
457
461
|
const authored = thread.author?.login.toLowerCase() === me;
|
|
458
462
|
const people = thread.comments.nodes.filter((c) => c.author && c.author.__typename !== "Bot");
|
|
@@ -474,7 +478,6 @@ export function threadState(
|
|
|
474
478
|
question: run.some((comment) => asksQuestion(comment.bodyHTML)),
|
|
475
479
|
answered: unread.length > 0,
|
|
476
480
|
fresh: recent(mine),
|
|
477
|
-
tooLong: daysSince(mine, now) >= config.waitingTooLongDays,
|
|
478
481
|
};
|
|
479
482
|
const tagged = flags.mineLast ? taggedSince(run, me, thread.url) : [];
|
|
480
483
|
const last = unread.at(-1);
|
package/server/fixture.ts
CHANGED
|
@@ -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", latestReviews: { nodes: [{ author: alice, state: "APPROVED", submittedAt: daysAgo(
|
|
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,7 +57,9 @@ 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
|
|
|
64
65
|
export type PersonRole = "author" | "changes";
|
|
@@ -88,14 +89,16 @@ export interface WaitingOn {
|
|
|
88
89
|
since: string;
|
|
89
90
|
}
|
|
90
91
|
|
|
91
|
-
// 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].
|
|
92
94
|
export interface Wait {
|
|
93
95
|
// In a word or two: "review", "re-review", "question". None where the chips already say, like blocked by repo rules.
|
|
94
96
|
reason?: string;
|
|
95
97
|
// Since I asked, tagged, pushed or replied.
|
|
96
98
|
since: string;
|
|
97
|
-
//
|
|
98
|
-
|
|
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;
|
|
99
102
|
}
|
|
100
103
|
|
|
101
104
|
// Waiting's work under someone it waits on, longest wait first; the last group, without anyone, is work no person holds up.
|
|
@@ -172,6 +175,12 @@ export function checkoutPr(kind: SessionKind, target: Pick<Target, "number" | "h
|
|
|
172
175
|
return kind === "review" && top && target.stack!.length > 1 ? { number: top.number, head: top.head } : { number: target.number, head: target.headRefName };
|
|
173
176
|
}
|
|
174
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
|
+
|
|
175
184
|
export interface SubRow {
|
|
176
185
|
key: string;
|
|
177
186
|
number: number;
|
|
@@ -194,7 +203,7 @@ export interface Item {
|
|
|
194
203
|
url: string;
|
|
195
204
|
chips: Chip[];
|
|
196
205
|
person?: Person;
|
|
197
|
-
// 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].
|
|
198
207
|
waitingOn?: WaitingOn[];
|
|
199
208
|
wait?: Wait;
|
|
200
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
|