@andrioid/paseo-attention-span 0.4.4 β 0.4.6
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 +5 -1
- package/client/attention-screen.tsx +37 -11
- package/client/still.tsx +129 -0
- package/docs/architecture.md +5 -3
- package/docs/screenshots/desktop-dark-doing-clear.png +0 -0
- package/docs/screenshots/desktop-dark-doing.png +0 -0
- package/docs/screenshots/desktop-dark-history-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-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 -1
- package/requirements.yaml +2 -0
- package/server/classify.ts +11 -4
- package/server/fixture.ts +20 -5
- package/server/github-types.ts +6 -3
- package/server/queries.ts +4 -3
- package/server/view.ts +10 -3
- package/shared/attention.ts +5 -0
- package/shared/format.ts +7 -4
- package/shared/still.ts +20 -0
- package/shared/work.ts +76 -0
package/OVERVIEW.md
CHANGED
|
@@ -12,6 +12,10 @@ This is the one you'll live in. It's split by reason: someone's waiting for your
|
|
|
12
12
|
|
|
13
13
|
Each item shows up once, under whichever reason is most urgent. An issue and the PRs that close it count as one item, and so does a stack of PRs. A stack is one change wearing several PRs, so it shouldn't take up five rows.
|
|
14
14
|
|
|
15
|
+
When there's nothing in it, you get a quiet horizon that follows the time of day instead of a blank page. It only shows up once a refresh has actually checked, so it never says you're clear when it doesn't know.
|
|
16
|
+
|
|
17
|
+

|
|
18
|
+
|
|
15
19
|
Mentions only count while the person is still waiting for you. Reply or react and it's gone. On your own issues and PRs, a new comment from the last 30 days shows up under **Answered** even if it doesn't tag you. On other people's threads only tags count. The point is to pick out the signal, and most of what happens in threads you once commented on isn't. If you do want those replies, turn on **Follow threads I've commented on** in Settings. Team mentions are left out entirely, because "@everyone-in-backend" is not really a question for *me*. And if something's just an FYI, dismiss it. It stays gone until something new happens on it.
|
|
16
20
|
|
|
17
21
|
Every item has one main button that matches why it's there: Reply, Review, Fix CI, Merge. Open the item and you get every action, each with a line saying what it'll do. I wanted buttons you can press without wondering what's about to happen to your repo.
|
|
@@ -67,7 +71,7 @@ Some orgs keep issues in a separate repo from the code. When that happens, the f
|
|
|
67
71
|
|
|
68
72
|
The issues and PRs you finished in recent weeks, grouped by week, plus the PRs you reviewed that got merged. Reviews are work too, even if nobody counts them.
|
|
69
73
|
|
|
70
|
-
There's a copy button per week that gives you a Markdown list of links. That's my standup prep now, and it takes about four seconds.
|
|
74
|
+
There's a copy button per week that gives you a Markdown list of links, each led by what kind of work it was: π bug, π feature, π§ task, or π for a PR that's none of those. The kind comes from the issue type, else the labels, else a title like "fix: β¦", so it works whether or not your repos use issue types. Cards show it too. Issues closed as not planned stay out of the list. That's my standup prep now, and it takes about four seconds.
|
|
71
75
|
|
|
72
76
|

|
|
73
77
|
|
|
@@ -7,6 +7,8 @@ import { Pressable, ScrollView, Text, View } from "react-native";
|
|
|
7
7
|
import { type ActionId, type AgentSummary, type AttentionView, type Chip, checkoutPr, type FailingChecks, type Item, itemSessions, liftActive, looseSessions, type NextUpIssue, ownStack, type Reviewer, type Section, type SectionId, SECTIONS, type SubRow, TAB_FEED, type TabId, type Target, type WaitingGroup, type WaitingOn } from "../shared/attention";
|
|
8
8
|
import { type AttentionConfig, nextUpSources, type SessionKind } from "../shared/config";
|
|
9
9
|
import { ago, linkList, repoLabel } from "../shared/format";
|
|
10
|
+
import { isClear } from "../shared/still";
|
|
11
|
+
import { workEmoji } from "../shared/work";
|
|
10
12
|
import { ACTION_SESSION, renderPrompt } from "../shared/prompts";
|
|
11
13
|
import * as rpc from "../shared/rpc";
|
|
12
14
|
import { type FeedbackKind, themeName } from "../shared/feedback";
|
|
@@ -15,6 +17,7 @@ import { useAttention } from "./data";
|
|
|
15
17
|
import { CardList, CardRow, type CardProps } from "./card";
|
|
16
18
|
import type { IconName } from "./icons";
|
|
17
19
|
import { NextUpList } from "./next-up";
|
|
20
|
+
import { Still } from "./still";
|
|
18
21
|
import { agentSignal, sessionEntry, startAnotherEntry } from "./session-menu";
|
|
19
22
|
import { ActionSheet, DetailLines, type SheetEntry } from "./sheet";
|
|
20
23
|
import { FeedbackAsk, FeedbackLine, type FeedbackScreen, FeedbackSheet } from "./feedback";
|
|
@@ -309,6 +312,8 @@ function AttentionList({
|
|
|
309
312
|
|
|
310
313
|
// Each tab shows how fresh its own feed is.
|
|
311
314
|
const feed = view.feeds[TAB_FEED[tab]];
|
|
315
|
+
// Calm only once a refresh that worked says Doing is empty [ATT-18].
|
|
316
|
+
const clear = isClear(view, !!attention.error);
|
|
312
317
|
const refreshing = feed.refreshing || attention.isFetching;
|
|
313
318
|
const counts: Record<TabId, number> = {
|
|
314
319
|
history: view.history.filter((item) => item.section === "done").length,
|
|
@@ -372,7 +377,8 @@ function AttentionList({
|
|
|
372
377
|
};
|
|
373
378
|
|
|
374
379
|
return (
|
|
375
|
-
|
|
380
|
+
// A clear Doing tab fills the screen, so its scene has room and the rest sits at the bottom [ATT-18].
|
|
381
|
+
<ScrollView style={styles.screen} contentContainerStyle={[styles.content, tab === "doing" && clear ? { flexGrow: 1 } : null]}>
|
|
376
382
|
<View style={[styles.row, { justifyContent: "space-between", flexWrap: "wrap" }]}>
|
|
377
383
|
<View style={styles.row}>
|
|
378
384
|
{TABS.map(({ id, label, icon }) => (
|
|
@@ -420,9 +426,13 @@ function AttentionList({
|
|
|
420
426
|
{tab === "history" ? <History items={view.history} actions={actions} /> : null}
|
|
421
427
|
{tab === "doing" ? (
|
|
422
428
|
<>
|
|
423
|
-
<Sections sections={view.doing} actions={actions}
|
|
429
|
+
{clear ? <Still /> : view.doing.length ? <Sections sections={view.doing} actions={actions} /> : !feed.fetchedAt && !feed.error ? <Loading text="Checking GitHubβ¦" /> : null}
|
|
424
430
|
{view.dismissedCount > undoable.filter((row) => row.dismissal).length ? (
|
|
425
|
-
<Pressable
|
|
431
|
+
<Pressable
|
|
432
|
+
accessibilityRole="button"
|
|
433
|
+
style={clear ? { alignSelf: "center", opacity: 0.7 } : undefined}
|
|
434
|
+
onPress={() => void run("restore", "Restore", async () => (attention.setView(await restore({})), setUndoable([])))}
|
|
435
|
+
>
|
|
426
436
|
<Text style={styles.muted}>{view.dismissedCount} dismissed Β· show them again</Text>
|
|
427
437
|
</Pressable>
|
|
428
438
|
) : null}
|
|
@@ -492,6 +502,7 @@ function AttentionList({
|
|
|
492
502
|
function Tab({ icon, label, count, active, onPress }: { icon: IconName; label: string; count: number; active: boolean; onPress: () => void }) {
|
|
493
503
|
const styles = useStyles();
|
|
494
504
|
const color = active ? styles.c.foreground : styles.c.foregroundMuted;
|
|
505
|
+
// A soft round badge for the count, a shade brighter on the open tab; green marks only where I am.
|
|
495
506
|
return (
|
|
496
507
|
<Pressable
|
|
497
508
|
accessibilityRole="tab"
|
|
@@ -500,14 +511,24 @@ function Tab({ icon, label, count, active, onPress }: { icon: IconName; label: s
|
|
|
500
511
|
onPress={onPress}
|
|
501
512
|
style={[styles.row, { gap: 6, paddingVertical: 7, paddingHorizontal: styles.compact ? 9 : 12, borderRadius: 9, backgroundColor: active ? styles.c.surface2 : "transparent" }]}
|
|
502
513
|
>
|
|
503
|
-
<TablerIcon name={icon} size={16} color={color} />
|
|
514
|
+
<TablerIcon name={icon} size={16} color={active ? styles.action : color} />
|
|
504
515
|
{/* On phones only the active tab is labelled, so four tabs fit. */}
|
|
505
516
|
{active || !styles.compact ? <Text style={{ color, fontSize: 14, fontWeight: active ? "600" : "400" }}>{label}</Text> : null}
|
|
506
|
-
<
|
|
517
|
+
<View style={{ minWidth: 20, alignItems: "center", paddingHorizontal: 6, paddingVertical: 1, borderRadius: 9, backgroundColor: tint(styles.c.foreground, active ? 0.14 : 0.08) }}>
|
|
518
|
+
<Text style={{ color, fontSize: 11, fontWeight: "500" }}>{count}</Text>
|
|
519
|
+
</View>
|
|
507
520
|
</Pressable>
|
|
508
521
|
);
|
|
509
522
|
}
|
|
510
523
|
|
|
524
|
+
// A theme colour, see-through, so a badge reads on any surface; colours that aren't #rrggbb fall back to none.
|
|
525
|
+
function tint(color: string, alpha: number): string {
|
|
526
|
+
const hex = /^#([0-9a-f]{6})/i.exec(color)?.[1];
|
|
527
|
+
if (!hex) return "transparent";
|
|
528
|
+
const [r, g, b] = [0, 2, 4].map((at) => parseInt(hex.slice(at, at + 2), 16));
|
|
529
|
+
return `rgba(${r}, ${g}, ${b}, ${alpha})`;
|
|
530
|
+
}
|
|
531
|
+
|
|
511
532
|
interface Actions {
|
|
512
533
|
agents: AgentSummary[];
|
|
513
534
|
startWithOptions: (spec: OptionsSpec) => void;
|
|
@@ -965,9 +986,7 @@ function WaitingOnLine({ people, expanded }: { people: WaitingOn[]; expanded: bo
|
|
|
965
986
|
);
|
|
966
987
|
}
|
|
967
988
|
|
|
968
|
-
function Sections({ sections, actions
|
|
969
|
-
const styles = useStyles();
|
|
970
|
-
if (sections.length === 0) return <Text style={styles.text}>{empty}</Text>;
|
|
989
|
+
function Sections({ sections, actions }: { sections: Section[]; actions: Actions }) {
|
|
971
990
|
return sections.map((section) => (
|
|
972
991
|
<View key={section.id}>
|
|
973
992
|
<SectionHeader icon={SECTION_ICONS[section.id]} title={section.title} count={section.items.length} />
|
|
@@ -1033,7 +1052,7 @@ function weekLabel(monday: Date): string {
|
|
|
1033
1052
|
}
|
|
1034
1053
|
|
|
1035
1054
|
// What I finished, by week, with reviews tucked away per week [HIS-01, HIS-02].
|
|
1036
|
-
// A week copies as a list of links to paste into a report; reviews stay out of it [HIS-03].
|
|
1055
|
+
// A week copies as a list of links to paste into a report, each led by its kind; reviews stay out of it [HIS-03, HIS-04].
|
|
1037
1056
|
function History({ items, actions }: { items: Item[]; actions: Actions }) {
|
|
1038
1057
|
const styles = useStyles();
|
|
1039
1058
|
const copy = useCopy();
|
|
@@ -1048,6 +1067,8 @@ function History({ items, actions }: { items: Item[]; actions: Actions }) {
|
|
|
1048
1067
|
for (const [week, all] of [...weeks].sort((a, b) => b[0] - a[0])) {
|
|
1049
1068
|
const done = all.filter((item) => item.section === "done").sort((a, b) => b.closedAt!.localeCompare(a.closedAt!));
|
|
1050
1069
|
const reviewed = all.filter((item) => item.section === "reviewed");
|
|
1070
|
+
// What was done, each led by its kind; not planned issues stay on screen but out of the report [HIS-03, HIS-04].
|
|
1071
|
+
const copied = done.filter((item) => !item.notPlanned);
|
|
1051
1072
|
const label = weekLabel(new Date(week));
|
|
1052
1073
|
blocks.push(
|
|
1053
1074
|
<View key={week} style={{ gap: 8 }}>
|
|
@@ -1056,12 +1077,17 @@ function History({ items, actions }: { items: Item[]; actions: Actions }) {
|
|
|
1056
1077
|
title={label}
|
|
1057
1078
|
count={done.length}
|
|
1058
1079
|
action={
|
|
1059
|
-
|
|
1080
|
+
copied.length > 0 ? (
|
|
1060
1081
|
<Button
|
|
1061
1082
|
icon="copy"
|
|
1062
1083
|
variant="ghost"
|
|
1063
1084
|
accessibilityLabel={`Copy links from ${label}`}
|
|
1064
|
-
onPress={() =>
|
|
1085
|
+
onPress={() =>
|
|
1086
|
+
copy(
|
|
1087
|
+
linkList(copied.map((item) => ({ title: item.title, url: item.url, mark: workEmoji(item) }))),
|
|
1088
|
+
`Copied ${copied.length} link${copied.length === 1 ? "" : "s"} from ${label}`,
|
|
1089
|
+
)
|
|
1090
|
+
}
|
|
1065
1091
|
/>
|
|
1066
1092
|
) : null
|
|
1067
1093
|
}
|
package/client/still.tsx
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { Icon } from "@getpaseo/plugin/client/ui";
|
|
2
|
+
import { useEffect, useRef, useState } from "react";
|
|
3
|
+
import { AccessibilityInfo, Animated, Easing, Platform, Text, View } from "react-native";
|
|
4
|
+
import { themeName } from "../shared/feedback";
|
|
5
|
+
import { type Scene, sceneAt } from "../shared/still";
|
|
6
|
+
import { useStyles } from "./ui";
|
|
7
|
+
|
|
8
|
+
// Doing with nothing in it: a horizon that follows the clock, and nothing that asks for anything [ATT-18].
|
|
9
|
+
// It settles in on every arrival, then stays still; the hour changing crossfades it.
|
|
10
|
+
|
|
11
|
+
// One tint per time of day, darker on light themes so it holds up on white.
|
|
12
|
+
const TINTS: Record<"dark" | "light", Record<Scene, string>> = {
|
|
13
|
+
dark: { morning: "#d4b47c", midday: "#8fbf9f", evening: "#d49a7e", night: "#a6a1cf" },
|
|
14
|
+
light: { morning: "#c49a4e", midday: "#5f9f76", evening: "#c97b5a", night: "#7f78b8" },
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
// Drawn on a 240 Γ 110 canvas; the waterline is at y = 66. Each layer is its own SVG so it can move on its own.
|
|
18
|
+
const W = 240;
|
|
19
|
+
const H = 110;
|
|
20
|
+
const svg = (body: string) =>
|
|
21
|
+
`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${W} ${H}" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round">${body}</svg>`;
|
|
22
|
+
|
|
23
|
+
const SKY: Record<Scene, string> = {
|
|
24
|
+
morning: svg(`<path d="M100 66a20 20 0 0 1 40 0"/>`),
|
|
25
|
+
midday: svg(`<circle cx="120" cy="30" r="16"/>`),
|
|
26
|
+
evening: svg(`<path d="M88 66a32 32 0 0 1 64 0"/>`),
|
|
27
|
+
night: svg(
|
|
28
|
+
`<path d="M126 18a16 16 0 1 0 14 22a12.5 12.5 0 0 1 -14 -22z"/>` +
|
|
29
|
+
[
|
|
30
|
+
[70, 24],
|
|
31
|
+
[168, 16],
|
|
32
|
+
[190, 40],
|
|
33
|
+
[52, 46],
|
|
34
|
+
]
|
|
35
|
+
.map(([x, y]) => `<circle cx="${x}" cy="${y}" r="1" fill="currentColor" stroke="none" opacity=".6"/>`)
|
|
36
|
+
.join(""),
|
|
37
|
+
),
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
// The sun's light on the water, fading downwards; wider under a low sun.
|
|
41
|
+
const WIDTHS: Record<Scene, number[]> = { morning: [40, 26, 12], midday: [24, 16, 8], evening: [56, 40, 20], night: [30, 18, 8] };
|
|
42
|
+
const WATER: Record<Scene, string> = Object.fromEntries(
|
|
43
|
+
(Object.keys(WIDTHS) as Scene[]).map((scene) => [
|
|
44
|
+
scene,
|
|
45
|
+
svg(WIDTHS[scene].map((width, i) => `<path d="M${W / 2 - width / 2} ${76 + i * 8}h${width}" stroke-opacity="${[0.45, 0.28, 0.15][i]}"/>`).join("")),
|
|
46
|
+
]),
|
|
47
|
+
) as Record<Scene, string>;
|
|
48
|
+
|
|
49
|
+
const LINE = { svg: svg(`<path d="M20 66h200"/>`) };
|
|
50
|
+
|
|
51
|
+
const SETTLE_MS = 700;
|
|
52
|
+
const CROSSFADE_MS = 4000;
|
|
53
|
+
const native = Platform.OS !== "web";
|
|
54
|
+
|
|
55
|
+
export function Still() {
|
|
56
|
+
const styles = useStyles();
|
|
57
|
+
const theme = themeName(styles.c.surface0);
|
|
58
|
+
const width = styles.compact ? 200 : 240;
|
|
59
|
+
const height = Math.round((width * H) / W);
|
|
60
|
+
|
|
61
|
+
// Arrival: the sky drifts up as it fades in, then the reflections draw in; skipped for reduced motion.
|
|
62
|
+
const arrive = useRef(new Animated.Value(0)).current;
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
let cancelled = false;
|
|
65
|
+
const settle = Animated.timing(arrive, { toValue: 1, duration: SETTLE_MS, easing: Easing.out(Easing.cubic), useNativeDriver: native });
|
|
66
|
+
AccessibilityInfo.isReduceMotionEnabled()
|
|
67
|
+
.catch(() => false)
|
|
68
|
+
.then((reduce) => {
|
|
69
|
+
if (cancelled) return;
|
|
70
|
+
if (reduce) arrive.setValue(1);
|
|
71
|
+
else settle.start();
|
|
72
|
+
});
|
|
73
|
+
return () => {
|
|
74
|
+
cancelled = true;
|
|
75
|
+
settle.stop();
|
|
76
|
+
};
|
|
77
|
+
}, [arrive]);
|
|
78
|
+
|
|
79
|
+
// The clock: checked every minute, and a new hour crossfades in slowly.
|
|
80
|
+
const [scene, setScene] = useState<Scene>(() => sceneAt(new Date()));
|
|
81
|
+
const [previous, setPrevious] = useState<Scene | null>(null);
|
|
82
|
+
const shown = useRef(scene);
|
|
83
|
+
const fade = useRef(new Animated.Value(1)).current;
|
|
84
|
+
useEffect(() => {
|
|
85
|
+
const timer = setInterval(() => {
|
|
86
|
+
const next = sceneAt(new Date());
|
|
87
|
+
if (next === shown.current) return;
|
|
88
|
+
setPrevious(shown.current);
|
|
89
|
+
setScene((shown.current = next));
|
|
90
|
+
fade.setValue(0);
|
|
91
|
+
Animated.timing(fade, { toValue: 1, duration: CROSSFADE_MS, easing: Easing.inOut(Easing.quad), useNativeDriver: native }).start(({ finished }) => finished && setPrevious(null));
|
|
92
|
+
}, 60_000);
|
|
93
|
+
return () => clearInterval(timer);
|
|
94
|
+
}, [fade]);
|
|
95
|
+
|
|
96
|
+
const skyIn = { opacity: arrive.interpolate({ inputRange: [0, 0.65, 1], outputRange: [0, 1, 1] }), transform: [{ translateY: arrive.interpolate({ inputRange: [0, 0.65, 1], outputRange: [6, 0, 0] }) }] };
|
|
97
|
+
const waterIn = { opacity: arrive.interpolate({ inputRange: [0, 0.35, 1], outputRange: [0, 0, 1] }) };
|
|
98
|
+
const fadeOut = fade.interpolate({ inputRange: [0, 1], outputRange: [1, 0] });
|
|
99
|
+
|
|
100
|
+
// SvgXml draws a size Γ size square; the canvas sits in its middle, so crop the square to the canvas.
|
|
101
|
+
const layer = (icon: { svg: string }, color: string) => (
|
|
102
|
+
<View style={{ position: "absolute", left: 0, right: 0, top: -(width - height) / 2 }}>
|
|
103
|
+
<Icon icon={icon} size={width} color={color} />
|
|
104
|
+
</View>
|
|
105
|
+
);
|
|
106
|
+
const scenery = (shown: Scene, opacity: Animated.AnimatedInterpolation<number> | Animated.Value) => (
|
|
107
|
+
<Animated.View key={shown} style={{ position: "absolute", inset: 0, opacity }}>
|
|
108
|
+
<Animated.View style={[{ position: "absolute", inset: 0 }, skyIn]}>{layer({ svg: SKY[shown] }, TINTS[theme][shown])}</Animated.View>
|
|
109
|
+
<Animated.View style={[{ position: "absolute", inset: 0 }, waterIn]}>{layer({ svg: WATER[shown] }, TINTS[theme][shown])}</Animated.View>
|
|
110
|
+
</Animated.View>
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
return (
|
|
114
|
+
// Upper two-fifths: a little above the middle, so it reads as a place, not a floating notice.
|
|
115
|
+
<View style={{ flex: 1, minHeight: styles.compact ? 300 : 360 }}>
|
|
116
|
+
<View style={{ flex: 2 }} />
|
|
117
|
+
<View accessible accessibilityLabel="Nothing needs you right now." style={{ alignItems: "center", gap: 12 }}>
|
|
118
|
+
<View style={{ width, height, overflow: "hidden" }} importantForAccessibility="no-hide-descendants" accessibilityElementsHidden>
|
|
119
|
+
<View style={{ position: "absolute", inset: 0, opacity: 0.6 }}>{layer(LINE, styles.c.foregroundMuted)}</View>
|
|
120
|
+
{previous ? scenery(previous, fadeOut) : null}
|
|
121
|
+
{scenery(scene, fade)}
|
|
122
|
+
</View>
|
|
123
|
+
<Text style={{ color: styles.c.foreground, fontSize: 17, fontWeight: "600", marginTop: 6 }}>Nothing's on you.</Text>
|
|
124
|
+
<Text style={[styles.muted, { fontSize: 13 }]}>Enjoy the quiet.</Text>
|
|
125
|
+
</View>
|
|
126
|
+
<View style={{ flex: 3 }} />
|
|
127
|
+
</View>
|
|
128
|
+
);
|
|
129
|
+
}
|
package/docs/architecture.md
CHANGED
|
@@ -44,11 +44,11 @@ flowchart LR
|
|
|
44
44
|
|
|
45
45
|
## Tabs
|
|
46
46
|
|
|
47
|
-
The tabs tell the story of my work, left to right: what I finished, what needs me, what waits on others, what's next. The screen opens on **Doing**, and the sidebar entry "Attention" shows Doing's count [ATT-09]. On phones only the active tab shows its label.
|
|
47
|
+
The tabs tell the story of my work, left to right: what I finished, what needs me, what waits on others, what's next. The screen opens on **Doing**, and the sidebar entry "Attention" shows Doing's count [ATT-09]. On phones only the active tab shows its label. Each tab's count sits in a soft badge, and only the open tab's icon is green.
|
|
48
48
|
|
|
49
49
|
| Tab | Shows |
|
|
50
50
|
|---|---|
|
|
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 [HIS-03]. |
|
|
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
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. *Waiting too long* items show here too, flagged "waited too long". 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]. Outside Waiting, as in *Waiting too long*, 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] |
|
|
@@ -78,6 +78,8 @@ Top to bottom. Each item appears once, under its most urgent reason [ATT-02]. `s
|
|
|
78
78
|
| 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
79
|
| My drafts | My drafts, with their own state tags [PRS-05, PRS-06] |
|
|
80
80
|
|
|
81
|
+
**Nothing in Doing** shows a horizon instead of a list (`client/still.tsx`) [ATT-18], with "Nothing's on you. Enjoy the quiet." It follows the device's clock at fixed hours: a low sun in the morning (5β11), a high sun at midday (11β16), a setting sun in the evening (16β21), and a moon with a few stars at night, each in its own soft tint. It settles in on every arrival on the tab (the sky drifts up as it fades in, then its reflections, 700 ms; not with reduced motion), then holds still; when the hour changes while it's open, it crossfades. It shows only after a refresh that worked: before the first one there's a spinner, and after a failed one just the error. Items that are all dismissed count as clear; the "show them again" line sits faintly at the bottom.
|
|
82
|
+
|
|
81
83
|
## Rules
|
|
82
84
|
|
|
83
85
|
- **One item per issue** [ATT-03]: PRs are grouped under the issue they work on, across repos. GitHub links (`closingIssuesReferences`) only PRs into the default branch, so a stack's upper PRs are read too. For a stack, strongest evidence first: what GitHub links on any of its PRs, bottom first; then a closing keyword ("Closes #N") in any PR's description; then the one issue the bottom PR's description mentions ("First of three for #N"), and none when it mentions several. Code, quotes and template comments don't count. References from descriptions are looked up in the details request, and only open issues count, so a reference to a PR doesn't group. A PR without an issue is its own item. History does the same per merged PR, against the closed issues it lists.
|
|
@@ -185,7 +187,7 @@ A live refresh is 8 requests and about 85 points, of the 5,000 GitHub allows per
|
|
|
185
187
|
|
|
186
188
|
### History
|
|
187
189
|
|
|
188
|
-
One request with three searches, each from the Monday `historyWeeks` back: `is:pr is:merged author:@me`, `is:pr is:merged reviewed-by:@me -author:@me`, `is:issue is:closed assignee:@me`. About
|
|
190
|
+
One request with three searches, each from the Monday `historyWeeks` back: `is:pr is:merged author:@me`, `is:pr is:merged reviewed-by:@me -author:@me`, `is:issue is:closed assignee:@me`. Each result brings up to 20 label names, and issues their type [HIS-04]. About 4 points, mostly the label lists.
|
|
189
191
|
|
|
190
192
|
Every search is scoped to the configured orgs and repos; Next up's unclaimed issues as described under Next up.
|
|
191
193
|
|
|
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.6",
|
|
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": {
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"assets/",
|
|
25
25
|
"requirements.yaml",
|
|
26
26
|
"docs/architecture.md",
|
|
27
|
+
"docs/screenshots/desktop-dark-doing-clear.png",
|
|
27
28
|
"docs/screenshots/desktop-dark-doing-acknowledge.png",
|
|
28
29
|
"docs/screenshots/desktop-dark-doing-issue-sheet.png",
|
|
29
30
|
"docs/screenshots/desktop-dark-doing-reviewers.png",
|
package/requirements.yaml
CHANGED
|
@@ -34,6 +34,7 @@ functional:
|
|
|
34
34
|
ATT-15: copy any item's GitHub link; so that I can share it without opening GitHub.
|
|
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
|
+
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.
|
|
37
38
|
mentions:
|
|
38
39
|
As a developer, I can:
|
|
39
40
|
MEN-01: see open threads where a person mentioned me and is still waiting for my response; so that I only hear about mentions when someone is waiting for me.
|
|
@@ -104,6 +105,7 @@ functional:
|
|
|
104
105
|
HIS-01: see the issues and pull requests I finished, grouped by week; so that I can tell others what I got done.
|
|
105
106
|
HIS-02: see pull requests I reviewed that merged, apart from my own work; so that I can tell others what I got done.
|
|
106
107
|
HIS-03: copy a week's finished work as a Markdown list of links; so that reporting progress is one paste.
|
|
108
|
+
HIS-04: see what kind of work each finished item was, bug, feature or task, from its issue type, else its labels, else a Conventional Commit title like "fix: β¦", on its card and leading its copied line like "- π [title](link)", with PRs of no kind led by π and issues closed as not planned left out of the copy; so that a busy week's report skims at a glance in any repo.
|
|
107
109
|
feedback:
|
|
108
110
|
As a developer, I can:
|
|
109
111
|
FB-01: tell the Attention Span project what to improve from the bottom of any tab, picking a problem, an idea or that I like it, with an agent that asks until it's clear, checks it against what's planned and already reported, and files it as an issue or a discussion, saying which and why, only once I approve the draft; so that feedback costs a minute and lands where it can be acted on or talked through.
|
package/server/classify.ts
CHANGED
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
} from "../shared/attention";
|
|
16
16
|
import type { AttentionConfig, MergeMethod } from "../shared/config";
|
|
17
17
|
import { ago, daysSince } from "../shared/format";
|
|
18
|
+
import { workChip, workKind } from "../shared/work";
|
|
18
19
|
import type { Actor, Comment, Details, HistoryResult, IssueNode, LinkedIssue, LiveResult, MentionNode, PickableNode, PullRequestNode, RequestedReviewer } from "./github-types";
|
|
19
20
|
import { asksQuestion, excerpt, plainText, taggedIn } from "./markdown";
|
|
20
21
|
import { prKey } from "./queries";
|
|
@@ -409,10 +410,16 @@ export function classify({ data, details, config, now }: ClassifyInput): Attenti
|
|
|
409
410
|
export function classifyHistory(data: HistoryResult): Item[] {
|
|
410
411
|
const items: Item[] = [];
|
|
411
412
|
const closed = new Map<string, Item>();
|
|
413
|
+
// What kind of work it was, on the card and its copied line [HIS-04].
|
|
414
|
+
const kinded = (item: Item, node: { title: string; labels?: { nodes: { name: string }[] }; issueType?: { name: string } | null }): Item => {
|
|
415
|
+
const work = workKind({ type: node.issueType?.name, labels: node.labels?.nodes.map((label) => label.name), title: node.title });
|
|
416
|
+
return work ? { ...item, work, chips: [workChip(work), ...item.chips] } : item;
|
|
417
|
+
};
|
|
412
418
|
for (const issue of compact(data.closed.nodes)) {
|
|
413
419
|
const notPlanned = issue.stateReason === "NOT_PLANNED";
|
|
414
|
-
const item = { ...plain(issue, "issue", "done"), closedAt: issue.closedAt, chips: notPlanned ? [chip("not planned")] : [] };
|
|
415
|
-
|
|
420
|
+
const item = kinded({ ...plain(issue, "issue", "done"), closedAt: issue.closedAt, chips: notPlanned ? [chip("not planned")] : [], ...(notPlanned ? { notPlanned: true as const } : {}) }, issue);
|
|
421
|
+
// Not planned issues get no PRs under them: the PRs were still done, so they're listed on their own [HIS-03].
|
|
422
|
+
if (!notPlanned) closed.set(prKey(issue), item);
|
|
416
423
|
items.push(item);
|
|
417
424
|
}
|
|
418
425
|
for (const pr of compact(data.merged.nodes)) {
|
|
@@ -420,9 +427,9 @@ export function classifyHistory(data: HistoryResult): Item[] {
|
|
|
420
427
|
const linked = { repo: pr.repository.nameWithOwner, body: pr.body, linked: pr.closingIssuesReferences.nodes.map(prKey) };
|
|
421
428
|
const issue = closed.get(issueFor([linked], (key) => closed.has(key)) ?? "");
|
|
422
429
|
if (issue) issue.children.push({ key: prKey(pr), number: pr.number, title: pr.title, url: pr.url, draft: false, chips: [], attention: false });
|
|
423
|
-
else items.push({ ...plain(pr, "pr", "done"), closedAt: pr.mergedAt });
|
|
430
|
+
else items.push(kinded({ ...plain(pr, "pr", "done"), closedAt: pr.mergedAt }, pr));
|
|
424
431
|
}
|
|
425
|
-
for (const pr of compact(data.reviewed.nodes)) items.push({ ...plain(pr, "pr", "reviewed"), closedAt: pr.mergedAt, person: person(pr.author, pr.mergedAt) });
|
|
432
|
+
for (const pr of compact(data.reviewed.nodes)) items.push(kinded({ ...plain(pr, "pr", "reviewed"), closedAt: pr.mergedAt, person: person(pr.author, pr.mergedAt) }, pr));
|
|
426
433
|
return items.sort(order);
|
|
427
434
|
}
|
|
428
435
|
|
package/server/fixture.ts
CHANGED
|
@@ -121,21 +121,25 @@ export function fixture(now: Date): { data: SearchResult; details: Details } {
|
|
|
121
121
|
const key = (n: number) => `${REPO}#${n}`;
|
|
122
122
|
const closes = (number: number, title: string) => ({ nodes: [{ number, title, url: `https://github.com/${REPO}/issues/${number}`, repository }] });
|
|
123
123
|
const fields = (priority: string, effort: string, scope: string) => ({ Priority: priority, Effort: effort, Scope: scope });
|
|
124
|
-
const
|
|
124
|
+
const labels = (...names: string[]) => ({ nodes: names.map((name) => ({ name })) });
|
|
125
|
+
const merged = (number: number, title: string, days: number, closesIssue?: number, ...names: string[]) => ({
|
|
125
126
|
number,
|
|
126
127
|
title,
|
|
127
128
|
url: `https://github.com/${REPO}/pull/${number}`,
|
|
128
129
|
mergedAt: daysAgo(days),
|
|
129
130
|
repository,
|
|
131
|
+
labels: labels(...names),
|
|
130
132
|
closingIssuesReferences: { nodes: closesIssue ? [{ number: closesIssue, repository }] : [] },
|
|
131
133
|
});
|
|
132
|
-
const closed = (number: number, title: string, days: number, stateReason = "COMPLETED") => ({
|
|
134
|
+
const closed = (number: number, title: string, days: number, stateReason = "COMPLETED", type?: string, ...names: string[]) => ({
|
|
133
135
|
number,
|
|
134
136
|
title,
|
|
135
137
|
url: `https://github.com/${REPO}/issues/${number}`,
|
|
136
138
|
closedAt: daysAgo(days),
|
|
137
139
|
stateReason,
|
|
138
140
|
repository,
|
|
141
|
+
issueType: type ? { name: type } : null,
|
|
142
|
+
labels: labels(...names),
|
|
139
143
|
});
|
|
140
144
|
|
|
141
145
|
const data = search({
|
|
@@ -243,13 +247,24 @@ export function fixture(now: Date): { data: SearchResult; details: Details } {
|
|
|
243
247
|
{ ...pickable(164, fields("π P3 Low", "π¦ Large (1-2w)", "π± Mobile app"), 60, "Feature", "Offline mode for time tracking"), sources: ["org:acme"] },
|
|
244
248
|
{ ...pickable(165, {}, 3, "Task", "Devcontainers for pull requests", "me/tool"), sources: ["mine"] },
|
|
245
249
|
],
|
|
246
|
-
merged: [
|
|
250
|
+
merged: [
|
|
251
|
+
merged(170, "Nightly backup check", 1, 171),
|
|
252
|
+
merged(172, "Fix VAT on credit notes", 3, undefined, "bug"),
|
|
253
|
+
merged(177, "chore: bump the build image", 4),
|
|
254
|
+
merged(178, "Tidy the settings screen", 5),
|
|
255
|
+
merged(173, "Speed up the order list", 9, 174),
|
|
256
|
+
merged(175, "Remove the old importer", 16),
|
|
257
|
+
],
|
|
247
258
|
reviewed: [
|
|
248
|
-
{ number: 180, title: "New onboarding checklist", url: `https://github.com/${REPO}/pull/180`, mergedAt: daysAgo(2), repository, author: alice },
|
|
259
|
+
{ number: 180, title: "New onboarding checklist", url: `https://github.com/${REPO}/pull/180`, mergedAt: daysAgo(2), repository, author: alice, labels: labels("feature") },
|
|
249
260
|
{ number: 181, title: "Bump dependencies", url: `https://github.com/${REPO}/pull/181`, mergedAt: daysAgo(4), repository, author: bob },
|
|
250
261
|
{ number: 182, title: "Sentry release tracking", url: `https://github.com/${REPO}/pull/182`, mergedAt: daysAgo(11), repository, author: alice },
|
|
251
262
|
],
|
|
252
|
-
closed: [
|
|
263
|
+
closed: [
|
|
264
|
+
closed(171, "Backups are never verified", 1, "COMPLETED", "Feature"),
|
|
265
|
+
closed(174, "Order list takes 8 seconds", 9, "COMPLETED", undefined, "type: bug"),
|
|
266
|
+
closed(176, "Dark mode for the admin", 10, "NOT_PLANNED", undefined, "enhancement"),
|
|
267
|
+
],
|
|
253
268
|
});
|
|
254
269
|
return {
|
|
255
270
|
data,
|
package/server/github-types.ts
CHANGED
|
@@ -120,10 +120,13 @@ export interface LiveResult {
|
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
// One request for all three [HIS-01, HIS-02].
|
|
123
|
+
// Labels say what kind of work a finished item was [HIS-04].
|
|
124
|
+
type Labels = { labels?: Nodes<{ name: string }> };
|
|
125
|
+
|
|
123
126
|
export interface HistoryResult {
|
|
124
|
-
merged: Nodes<{ number: number; title: string; url: string; body?: string; mergedAt: string; repository: Repo; closingIssuesReferences: Nodes<{ number: number; repository: Repo }> }>;
|
|
125
|
-
reviewed: Nodes<{ number: number; title: string; url: string; mergedAt: string; repository: Repo; author: Actor | null }>;
|
|
126
|
-
closed: Nodes<{ number: number; title: string; url: string; closedAt: string; stateReason: string | null; repository: Repo }>;
|
|
127
|
+
merged: Nodes<{ number: number; title: string; url: string; body?: string; mergedAt: string; repository: Repo; closingIssuesReferences: Nodes<{ number: number; repository: Repo }> } & Labels>;
|
|
128
|
+
reviewed: Nodes<{ number: number; title: string; url: string; mergedAt: string; repository: Repo; author: Actor | null } & Labels>;
|
|
129
|
+
closed: Nodes<{ number: number; title: string; url: string; closedAt: string; stateReason: string | null; repository: Repo; issueType?: { name: string } | null } & Labels>;
|
|
127
130
|
}
|
|
128
131
|
|
|
129
132
|
export type SearchResult = LiveResult & HistoryResult;
|
package/server/queries.ts
CHANGED
|
@@ -30,10 +30,11 @@ const SEARCHES = {
|
|
|
30
30
|
unclaimed: { first: 100, nodes: "...pickable" },
|
|
31
31
|
merged: {
|
|
32
32
|
first: 100,
|
|
33
|
-
nodes: "... on PullRequest { number title url body mergedAt repository { nameWithOwner } closingIssuesReferences(first: 3) { nodes { number repository { nameWithOwner } } } }",
|
|
33
|
+
nodes: "... on PullRequest { number title url body mergedAt repository { nameWithOwner } labels(first: 20) { nodes { name } } closingIssuesReferences(first: 3) { nodes { number repository { nameWithOwner } } } }",
|
|
34
34
|
},
|
|
35
|
-
reviewed: { first: 100, nodes: "... on PullRequest { number title url mergedAt repository { nameWithOwner } author { ...author } }" },
|
|
36
|
-
|
|
35
|
+
reviewed: { first: 100, nodes: "... on PullRequest { number title url mergedAt repository { nameWithOwner } author { ...author } labels(first: 20) { nodes { name } } }" },
|
|
36
|
+
// Labels and type say what kind of work each was [HIS-04].
|
|
37
|
+
closed: { first: 100, nodes: "... on Issue { number title url closedAt stateReason repository { nameWithOwner } issueType { name } labels(first: 20) { nodes { name } } }" },
|
|
37
38
|
};
|
|
38
39
|
export type SearchName = keyof typeof SEARCHES;
|
|
39
40
|
|
package/server/view.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type Attention, type AttentionView, type Chip, type FeedId, type FeedStatus, type Item, type NextUpIssue, type Section, SECTION_ORDER, SECTIONS, type TabId, type WaitingGroup } from "../shared/attention";
|
|
2
2
|
import type { AttentionConfig } from "../shared/config";
|
|
3
|
+
import { workChip, workKind } from "../shared/work";
|
|
3
4
|
import type { State } from "./store";
|
|
4
5
|
|
|
5
6
|
export interface ViewMeta {
|
|
@@ -42,6 +43,8 @@ export function isPending({ at, effect }: Pending, fetchedAt: Record<FeedId, str
|
|
|
42
43
|
export function doneItem(source: Item | NextUpIssue, closedAt: string, notPlanned = false): Item {
|
|
43
44
|
const { key, repo, number, title, url } = source;
|
|
44
45
|
const kind = "kind" in source ? source.kind : "issue";
|
|
46
|
+
// Labels come with the next History fetch; until then the issue type and title prefix tell what kind of work it was [HIS-04].
|
|
47
|
+
const work = workKind({ type: "type" in source ? source.type : undefined, title });
|
|
45
48
|
return {
|
|
46
49
|
key,
|
|
47
50
|
section: "done",
|
|
@@ -51,9 +54,12 @@ export function doneItem(source: Item | NextUpIssue, closedAt: string, notPlanne
|
|
|
51
54
|
number,
|
|
52
55
|
title,
|
|
53
56
|
url,
|
|
54
|
-
chips: notPlanned ? [{ text: "not planned", tone: "neutral" }] : [],
|
|
57
|
+
chips: [...(work ? [workChip(work)] : []), ...(notPlanned ? [{ text: "not planned", tone: "neutral" as const }] : [])],
|
|
58
|
+
...(work ? { work } : {}),
|
|
59
|
+
...(notPlanned ? { notPlanned: true as const } : {}),
|
|
55
60
|
actions: [],
|
|
56
|
-
|
|
61
|
+
// Not planned issues list their PRs on their own, as classifyHistory does [HIS-03].
|
|
62
|
+
children: "children" in source && !notPlanned ? source.children.map((child) => ({ ...child, draft: false, chips: [], attention: false })) : [],
|
|
57
63
|
target: { kind, repo, number, title, url },
|
|
58
64
|
othersActivityAt: "1970-01-01T00:00:00Z",
|
|
59
65
|
closedAt,
|
|
@@ -73,7 +79,8 @@ export function applyPending(attention: Attention | null, history: Item[], pendi
|
|
|
73
79
|
});
|
|
74
80
|
const assigned = [...attention.assigned.filter((issue) => !off(issue.key) && effect(issue.key) !== "unclaimed"), ...attention.unclaimed.filter((issue) => effect(issue.key) === "claimed")];
|
|
75
81
|
const unclaimed = [...attention.unclaimed.filter((issue) => !off(issue.key) && effect(issue.key) !== "claimed"), ...attention.assigned.filter((issue) => effect(issue.key) === "unclaimed")];
|
|
76
|
-
|
|
82
|
+
// PRs listed under their issue count as known too, so a merge doesn't show twice [HIS-01].
|
|
83
|
+
const known = new Set(history.flatMap((item) => [item.key, ...item.children.map((child) => child.key)]));
|
|
77
84
|
const done = Object.values(pending).flatMap(({ effect }) => (effect.kind === "done" && !known.has(effect.item.key) ? [effect.item] : []));
|
|
78
85
|
// History is newest first; what I just finished is newest of all.
|
|
79
86
|
return { attention: { ...attention, items, assigned, unclaimed }, history: [...done, ...history] };
|
package/shared/attention.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { AttentionConfig, MergeMethod, SessionKind } from "./config";
|
|
2
|
+
import type { WorkKind } from "./work";
|
|
2
3
|
|
|
3
4
|
// Tabs tell the story of my work: what I finished, what needs me, what waits on others, what's next.
|
|
4
5
|
export type TabId = "history" | "doing" | "waiting" | "next";
|
|
@@ -200,6 +201,10 @@ export interface Item {
|
|
|
200
201
|
othersActivityAt: string;
|
|
201
202
|
// History only: when it merged or closed.
|
|
202
203
|
closedAt?: string;
|
|
204
|
+
// History only: what kind of work it was, when that can be told [HIS-04].
|
|
205
|
+
work?: WorkKind;
|
|
206
|
+
// History only: an issue closed as not planned, kept out of the copied week [HIS-03].
|
|
207
|
+
notPlanned?: true;
|
|
203
208
|
}
|
|
204
209
|
|
|
205
210
|
// An issue to pick up: assigned to me [NXT-06] or nobody [NXT-01].
|
package/shared/format.ts
CHANGED
|
@@ -15,10 +15,13 @@ export function daysSince(iso: string, now: Date): number {
|
|
|
15
15
|
return (now.getTime() - new Date(iso).getTime()) / 86_400_000;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
// A Markdown bullet list of links, for pasting a week's work into a report
|
|
19
|
-
// long so it skims down the left edge:
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
// A Markdown bullet list of links, for pasting a week's work into a report, each led by what kind of work it was:
|
|
19
|
+
// "- π [title](url)" [HIS-03, HIS-04]; or a nudge, each led by why and how long so it skims down the left edge:
|
|
20
|
+
// "- Review 2h: [title](url)" [WAI-03].
|
|
21
|
+
export function linkList(items: { title: string; url: string; lead?: string; mark?: string }[]): string {
|
|
22
|
+
return items
|
|
23
|
+
.map(({ title, url, lead, mark }) => `- ${mark ? `${mark} ` : ""}${lead ? `${lead}: ` : ""}[${title.replace(/[[\]\\]/g, "\\$&")}](${url})`)
|
|
24
|
+
.join("\n");
|
|
22
25
|
}
|
|
23
26
|
|
|
24
27
|
// Where a card's item lives: "app" for my own repos, "acme/app" for anyone else's, so same-named repos don't blur [ATT-05, NXT-10].
|
package/shared/still.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { AttentionView } from "./attention";
|
|
2
|
+
|
|
3
|
+
// The empty Doing tab: a horizon that follows the device's clock [ATT-18].
|
|
4
|
+
export type Scene = "morning" | "midday" | "evening" | "night";
|
|
5
|
+
|
|
6
|
+
// Fixed local hours, the same every day: morning 5β11, midday 11β16, evening 16β21, night 21β5.
|
|
7
|
+
export function sceneAt(date: Date): Scene {
|
|
8
|
+
const hour = date.getHours();
|
|
9
|
+
if (hour >= 5 && hour < 11) return "morning";
|
|
10
|
+
if (hour >= 11 && hour < 16) return "midday";
|
|
11
|
+
if (hour >= 16 && hour < 21) return "evening";
|
|
12
|
+
return "night";
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// Calm only when it's true: Doing is empty after a refresh that worked. Dismissed items don't count;
|
|
16
|
+
// they're not on me until something new happens [ATT-08]. Loading, a failed refresh or none yet show plainly.
|
|
17
|
+
export function isClear(view: Pick<AttentionView, "doing" | "feeds">, failed = false): boolean {
|
|
18
|
+
const live = view.feeds.live;
|
|
19
|
+
return view.doing.length === 0 && !!live.fetchedAt && !live.error && !failed;
|
|
20
|
+
}
|
package/shared/work.ts
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
// What kind of work an issue or PR was, for History's chips and copied lines [HIS-04].
|
|
2
|
+
export type WorkKind = "bug" | "feature" | "task";
|
|
3
|
+
|
|
4
|
+
export const WORK_EMOJI: Record<WorkKind, string> = { bug: "π", feature: "π", task: "π§" };
|
|
5
|
+
// A PR that's none of the above still leads its copied line with something.
|
|
6
|
+
export const PR_EMOJI = "π";
|
|
7
|
+
|
|
8
|
+
// Most telling first: anything that says bug is a bug.
|
|
9
|
+
const RANK: WorkKind[] = ["bug", "feature", "task"];
|
|
10
|
+
|
|
11
|
+
// Issue type and label names, matched whole so "not a bug" and "bug bash" don't count.
|
|
12
|
+
const NAMES: Record<string, WorkKind> = {
|
|
13
|
+
bug: "bug",
|
|
14
|
+
bugs: "bug",
|
|
15
|
+
bugfix: "bug",
|
|
16
|
+
"bug fix": "bug",
|
|
17
|
+
"bug report": "bug",
|
|
18
|
+
defect: "bug",
|
|
19
|
+
regression: "bug",
|
|
20
|
+
feature: "feature",
|
|
21
|
+
features: "feature",
|
|
22
|
+
"feature request": "feature",
|
|
23
|
+
"new feature": "feature",
|
|
24
|
+
enhancement: "feature",
|
|
25
|
+
epic: "feature",
|
|
26
|
+
story: "feature",
|
|
27
|
+
"user story": "feature",
|
|
28
|
+
task: "task",
|
|
29
|
+
chore: "task",
|
|
30
|
+
maintenance: "task",
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
// Conventional Commit types: "fix: β¦", "feat(api)!: β¦". Some only make sense at the front of a title.
|
|
34
|
+
const PREFIXES: Record<string, WorkKind> = {
|
|
35
|
+
fix: "bug",
|
|
36
|
+
feat: "feature",
|
|
37
|
+
chore: "task",
|
|
38
|
+
refactor: "task",
|
|
39
|
+
docs: "task",
|
|
40
|
+
build: "task",
|
|
41
|
+
ci: "task",
|
|
42
|
+
test: "task",
|
|
43
|
+
perf: "task",
|
|
44
|
+
style: "task",
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
// "Type: Bug π", "kind/bug", "T-Feature" -> "bug", "bug", "feature".
|
|
48
|
+
function normalize(name: string): string {
|
|
49
|
+
return name
|
|
50
|
+
.toLowerCase()
|
|
51
|
+
.replace(/[^\p{L}\p{N}]+/gu, " ")
|
|
52
|
+
.trim()
|
|
53
|
+
.replace(/^(?:type|kind|t|issue type|category) /, "");
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const named = (name: string): WorkKind | undefined => NAMES[normalize(name)];
|
|
57
|
+
|
|
58
|
+
// The first source that says anything decides: issue type, then labels, then the title's prefix.
|
|
59
|
+
// Within labels, bug beats feature beats task. Unknown is a fine answer.
|
|
60
|
+
export function workKind({ type, labels = [], title }: { type?: string | null; labels?: string[]; title: string }): WorkKind | undefined {
|
|
61
|
+
const typed = type ? named(type) : undefined;
|
|
62
|
+
if (typed) return typed;
|
|
63
|
+
const labelled = new Set(labels.map(named));
|
|
64
|
+
const best = RANK.find((kind) => labelled.has(kind));
|
|
65
|
+
if (best) return best;
|
|
66
|
+
const prefix = /^\s*([a-z]+)(?:\([^)]*\))?!?:\s/i.exec(title)?.[1].toLowerCase();
|
|
67
|
+
return prefix ? PREFIXES[prefix] : undefined;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// What leads an item's copied line: its kind, a PR's own mark, or nothing.
|
|
71
|
+
export function workEmoji(item: { kind: "pr" | "issue"; work?: WorkKind }): string | undefined {
|
|
72
|
+
return item.work ? WORK_EMOJI[item.work] : item.kind === "pr" ? PR_EMOJI : undefined;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Chips are plain words like every other chip; the emoji are for the copied lines.
|
|
76
|
+
export const workChip = (kind: WorkKind) => ({ text: kind, tone: "neutral" as const });
|