@andrioid/paseo-attention-span 0.4.5 → 0.4.7
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 +7 -3
- package/client/attention-screen.tsx +26 -8
- package/client/coverage-settings.tsx +64 -2
- package/client/still.tsx +129 -0
- package/docs/architecture.md +3 -1
- 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/index.server.ts +2 -0
- package/package.json +2 -1
- package/requirements.yaml +2 -1
- package/server/classify.ts +5 -5
- package/server/fixture.ts +8 -0
- package/server/queries.ts +12 -5
- package/server/service.ts +39 -6
- package/server/setup.ts +4 -2
- package/server/store.ts +17 -1
- package/shared/config.ts +22 -3
- package/shared/rpc.ts +6 -1
- package/shared/setup.ts +11 -0
- package/shared/still.ts +20 -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.
|
|
@@ -49,7 +53,7 @@ When someone needs a nudge, **Copy list** next to their name copies their items
|
|
|
49
53
|
|
|
50
54
|
## Next up: for when your plate is clear
|
|
51
55
|
|
|
52
|
-
It does happen. Next up lists issues assigned to you first, because finishing what you've taken seems polite, and then open issues nobody's claimed. If your org uses issue fields for priority and effort, it ranks by those, so the important quick wins float to the top. Each issue shows its repo, priority, effort and scope, and whether someone already has a PR open for it. That last one has saved me from duplicating a colleague's work more than once.
|
|
56
|
+
It does happen. Next up lists issues assigned to you first, because finishing what you've taken seems polite, and then open issues nobody's claimed. If your org uses issue fields for priority and effort, it ranks by those, so the important quick wins float to the top. Fields called Priority, Effort and Scope are picked up on their own; if yours are called something else, pick them in Settings. Each issue shows its repo, priority, effort and scope, and whether someone already has a PR open for it. That last one has saved me from duplicating a colleague's work more than once.
|
|
53
57
|
|
|
54
58
|

|
|
55
59
|
|
|
@@ -128,7 +132,7 @@ Everything else lives in `~/.config/paseo-attention-span/config.json` on the dae
|
|
|
128
132
|
- `prompts`: your own prompt template per session type, if you don't like mine.
|
|
129
133
|
- `mergeMethods`: squash, merge or rebase, per repo.
|
|
130
134
|
- `codeRepos`: where an issue repo's code lives. The screen asks and fills this in, so you probably won't touch it.
|
|
131
|
-
- `nextUp`: where Next up picks from
|
|
135
|
+
- `nextUp`: where Next up picks from and which org issue fields mean priority, effort and scope, both also in Settings. A field's `order` (best first) is the one thing here only the file sets, for when the org's own option order isn't the ranking you want.
|
|
132
136
|
- `refreshMinutes` (15), `waitingTooLongDays` (3), `staleDraftDays` (30), `mentionDays` (30) and `historyWeeks` (4).
|
|
133
137
|
|
|
134
138
|
## Your data
|
|
@@ -141,4 +145,4 @@ Everything else lives in `~/.config/paseo-attention-span/config.json` on the dae
|
|
|
141
145
|
## What it doesn't do (yet)
|
|
142
146
|
|
|
143
147
|
- github.com only. No other forges and no GitHub Enterprise, for now.
|
|
144
|
-
- Apart from orgs and
|
|
148
|
+
- Apart from orgs, repos and Next up, settings are edited by hand. Yes, in JSON. Sorry.
|
|
@@ -7,6 +7,7 @@ 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";
|
|
10
11
|
import { workEmoji } from "../shared/work";
|
|
11
12
|
import { ACTION_SESSION, renderPrompt } from "../shared/prompts";
|
|
12
13
|
import * as rpc from "../shared/rpc";
|
|
@@ -16,6 +17,7 @@ import { useAttention } from "./data";
|
|
|
16
17
|
import { CardList, CardRow, type CardProps } from "./card";
|
|
17
18
|
import type { IconName } from "./icons";
|
|
18
19
|
import { NextUpList } from "./next-up";
|
|
20
|
+
import { Still } from "./still";
|
|
19
21
|
import { agentSignal, sessionEntry, startAnotherEntry } from "./session-menu";
|
|
20
22
|
import { ActionSheet, DetailLines, type SheetEntry } from "./sheet";
|
|
21
23
|
import { FeedbackAsk, FeedbackLine, type FeedbackScreen, FeedbackSheet } from "./feedback";
|
|
@@ -310,6 +312,8 @@ function AttentionList({
|
|
|
310
312
|
|
|
311
313
|
// Each tab shows how fresh its own feed is.
|
|
312
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);
|
|
313
317
|
const refreshing = feed.refreshing || attention.isFetching;
|
|
314
318
|
const counts: Record<TabId, number> = {
|
|
315
319
|
history: view.history.filter((item) => item.section === "done").length,
|
|
@@ -373,7 +377,8 @@ function AttentionList({
|
|
|
373
377
|
};
|
|
374
378
|
|
|
375
379
|
return (
|
|
376
|
-
|
|
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]}>
|
|
377
382
|
<View style={[styles.row, { justifyContent: "space-between", flexWrap: "wrap" }]}>
|
|
378
383
|
<View style={styles.row}>
|
|
379
384
|
{TABS.map(({ id, label, icon }) => (
|
|
@@ -421,9 +426,13 @@ function AttentionList({
|
|
|
421
426
|
{tab === "history" ? <History items={view.history} actions={actions} /> : null}
|
|
422
427
|
{tab === "doing" ? (
|
|
423
428
|
<>
|
|
424
|
-
<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}
|
|
425
430
|
{view.dismissedCount > undoable.filter((row) => row.dismissal).length ? (
|
|
426
|
-
<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
|
+
>
|
|
427
436
|
<Text style={styles.muted}>{view.dismissedCount} dismissed · show them again</Text>
|
|
428
437
|
</Pressable>
|
|
429
438
|
) : null}
|
|
@@ -493,6 +502,7 @@ function AttentionList({
|
|
|
493
502
|
function Tab({ icon, label, count, active, onPress }: { icon: IconName; label: string; count: number; active: boolean; onPress: () => void }) {
|
|
494
503
|
const styles = useStyles();
|
|
495
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.
|
|
496
506
|
return (
|
|
497
507
|
<Pressable
|
|
498
508
|
accessibilityRole="tab"
|
|
@@ -501,14 +511,24 @@ function Tab({ icon, label, count, active, onPress }: { icon: IconName; label: s
|
|
|
501
511
|
onPress={onPress}
|
|
502
512
|
style={[styles.row, { gap: 6, paddingVertical: 7, paddingHorizontal: styles.compact ? 9 : 12, borderRadius: 9, backgroundColor: active ? styles.c.surface2 : "transparent" }]}
|
|
503
513
|
>
|
|
504
|
-
<TablerIcon name={icon} size={16} color={color} />
|
|
514
|
+
<TablerIcon name={icon} size={16} color={active ? styles.action : color} />
|
|
505
515
|
{/* On phones only the active tab is labelled, so four tabs fit. */}
|
|
506
516
|
{active || !styles.compact ? <Text style={{ color, fontSize: 14, fontWeight: active ? "600" : "400" }}>{label}</Text> : null}
|
|
507
|
-
<
|
|
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>
|
|
508
520
|
</Pressable>
|
|
509
521
|
);
|
|
510
522
|
}
|
|
511
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
|
+
|
|
512
532
|
interface Actions {
|
|
513
533
|
agents: AgentSummary[];
|
|
514
534
|
startWithOptions: (spec: OptionsSpec) => void;
|
|
@@ -966,9 +986,7 @@ function WaitingOnLine({ people, expanded }: { people: WaitingOn[]; expanded: bo
|
|
|
966
986
|
);
|
|
967
987
|
}
|
|
968
988
|
|
|
969
|
-
function Sections({ sections, actions
|
|
970
|
-
const styles = useStyles();
|
|
971
|
-
if (sections.length === 0) return <Text style={styles.text}>{empty}</Text>;
|
|
989
|
+
function Sections({ sections, actions }: { sections: Section[]; actions: Actions }) {
|
|
972
990
|
return sections.map((section) => (
|
|
973
991
|
<View key={section.id}>
|
|
974
992
|
<SectionHeader icon={SECTION_ICONS[section.id]} title={section.title} count={section.items.length} />
|
|
@@ -4,12 +4,14 @@ import { useQuery, useQueryClient } from "@tanstack/react-query";
|
|
|
4
4
|
import { useState } from "react";
|
|
5
5
|
import { Text, View } from "react-native";
|
|
6
6
|
import * as rpc from "../shared/rpc";
|
|
7
|
-
import
|
|
7
|
+
import { DEFAULT_FIELD, FIELD_ROLES, type FieldRole, sameField } from "../shared/config";
|
|
8
|
+
import type { ConfigStatus, CoverageKind, IssueField } from "../shared/setup";
|
|
8
9
|
import { VIEW_QUERY_KEY } from "./data";
|
|
9
10
|
import { Button, StylesProvider, useStyles } from "./ui";
|
|
10
11
|
|
|
11
12
|
const COVERAGE_QUERY_KEY = ["attention-span", "coverage"] as const;
|
|
12
13
|
const MY_ORGS_QUERY_KEY = ["attention-span", "my-orgs"] as const;
|
|
14
|
+
const FIELDS_QUERY_KEY = ["attention-span", "issue-fields"] as const;
|
|
13
15
|
// A caption belongs to the card above it, so it sits closer to that card than to the next heading.
|
|
14
16
|
const CAPTION = { marginTop: -24, marginBottom: 16 };
|
|
15
17
|
|
|
@@ -30,6 +32,7 @@ function Coverage() {
|
|
|
30
32
|
const save = useRpc(rpc.setCoverage);
|
|
31
33
|
const saveNextUp = useRpc(rpc.setNextUpSources);
|
|
32
34
|
const saveFollow = useRpc(rpc.setFollowThreads);
|
|
35
|
+
const saveFields = useRpc(rpc.setNextUpFields);
|
|
33
36
|
const coverage = useQuery({ queryKey: COVERAGE_QUERY_KEY, queryFn: () => fetchCoverage({}) });
|
|
34
37
|
const [saving, setSaving] = useState(false);
|
|
35
38
|
const [error, setError] = useState<string | null>(null);
|
|
@@ -42,7 +45,7 @@ function Coverage() {
|
|
|
42
45
|
</SettingsCard>
|
|
43
46
|
</SettingsSection>
|
|
44
47
|
);
|
|
45
|
-
const { orgs, repos, nextUp, followThreads } = coverage.data;
|
|
48
|
+
const { orgs, repos, nextUp, fields, followThreads } = coverage.data;
|
|
46
49
|
// A file that doesn't parse is left for the person who edited it.
|
|
47
50
|
if (coverage.data.error)
|
|
48
51
|
return (
|
|
@@ -61,6 +64,8 @@ function Coverage() {
|
|
|
61
64
|
await send();
|
|
62
65
|
queryClient.setQueryData(COVERAGE_QUERY_KEY, { ...coverage.data!, ...next });
|
|
63
66
|
await queryClient.invalidateQueries({ queryKey: VIEW_QUERY_KEY });
|
|
67
|
+
// Other orgs may have other fields.
|
|
68
|
+
if (next.orgs || next.repos || next.nextUp) void queryClient.invalidateQueries({ queryKey: FIELDS_QUERY_KEY });
|
|
64
69
|
} catch (failure) {
|
|
65
70
|
setError(`Saving failed: ${(failure as Error).message}`);
|
|
66
71
|
} finally {
|
|
@@ -106,6 +111,7 @@ function Coverage() {
|
|
|
106
111
|
: "None chosen: using your Paseo projects."}
|
|
107
112
|
</Text>
|
|
108
113
|
</View>
|
|
114
|
+
<NextUpFields value={fields} disabled={saving} onChange={(role, field) => write({ fields: { ...fields, [role]: field } }, () => saveFields({ [role]: field }))} />
|
|
109
115
|
<View style={{ gap: 8 }}>
|
|
110
116
|
<SettingsSection title="Replies">
|
|
111
117
|
<SettingsCard>
|
|
@@ -165,6 +171,62 @@ function NextUpSources({ value, disabled, onChange }: { value: ConfigStatus["nex
|
|
|
165
171
|
);
|
|
166
172
|
}
|
|
167
173
|
|
|
174
|
+
const ROLE_LABEL: Record<FieldRole, string> = { priority: "Priority", effort: "Effort", scope: "Scope" };
|
|
175
|
+
const ROLE_HINT: Record<FieldRole, string> = {
|
|
176
|
+
priority: "Ranks the list, in the field's order",
|
|
177
|
+
effort: "Breaks ties, in the field's order",
|
|
178
|
+
scope: "Adds a filter to Next up",
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
// Which org issue fields rank and filter Next up [NXT-04], picked from the fields its orgs have. Until I pick, a field
|
|
182
|
+
// named after the role is used, so an org with Priority and Effort needs no setup.
|
|
183
|
+
function NextUpFields({ value, disabled, onChange }: { value: ConfigStatus["fields"]; disabled: boolean; onChange: (role: FieldRole, field: string | null) => Promise<void> }) {
|
|
184
|
+
const styles = useStyles();
|
|
185
|
+
const fetchFields = useRpc(rpc.issueFields);
|
|
186
|
+
const available = useQuery({ queryKey: FIELDS_QUERY_KEY, queryFn: () => fetchFields({}) });
|
|
187
|
+
const fields: IssueField[] = available.data?.fields ?? [];
|
|
188
|
+
const find = (name: string | null | undefined) => fields.find((field) => sameField(field.name, name ?? undefined));
|
|
189
|
+
// What each role uses now: the chosen field, or the one named after it if an org has it. Names match without case,
|
|
190
|
+
// so a field typed "priority" shows as GitHub's "Priority".
|
|
191
|
+
const current = (role: FieldRole): string | null => {
|
|
192
|
+
const chosen = role in value ? (value[role] ?? null) : DEFAULT_FIELD[role];
|
|
193
|
+
return find(chosen)?.name ?? (role in value ? chosen : null);
|
|
194
|
+
};
|
|
195
|
+
const none = available.isLoading ? "Loading…" : "None";
|
|
196
|
+
|
|
197
|
+
return (
|
|
198
|
+
<View style={{ gap: 8 }}>
|
|
199
|
+
<SettingsSection title="Next up fields">
|
|
200
|
+
<SettingsCard>
|
|
201
|
+
{FIELD_ROLES.map((role) => {
|
|
202
|
+
const chosen = current(role);
|
|
203
|
+
// A field no org has any more still shows, so it can be seen and changed.
|
|
204
|
+
const missing = chosen && available.data && !find(chosen) ? [{ label: `${chosen} (not found)`, value: chosen }] : [];
|
|
205
|
+
const hint = !(role in value) && chosen ? `${ROLE_HINT[role]}. Picked by its name` : ROLE_HINT[role];
|
|
206
|
+
return (
|
|
207
|
+
<SettingsSelect
|
|
208
|
+
key={role}
|
|
209
|
+
label={ROLE_LABEL[role]}
|
|
210
|
+
hint={hint}
|
|
211
|
+
error={role === "priority" && available.error ? (available.error as Error).message : null}
|
|
212
|
+
value={chosen ?? ""}
|
|
213
|
+
options={[{ label: none, value: "" }, ...missing, ...fields.map((field) => ({ label: field.name, value: field.name }))]}
|
|
214
|
+
disabled={disabled || !available.data}
|
|
215
|
+
onValueChange={(field) => void onChange(role, field || null)}
|
|
216
|
+
/>
|
|
217
|
+
);
|
|
218
|
+
})}
|
|
219
|
+
</SettingsCard>
|
|
220
|
+
</SettingsSection>
|
|
221
|
+
<Text style={[styles.muted, CAPTION]}>
|
|
222
|
+
{available.data && fields.length === 0
|
|
223
|
+
? "None of the organizations Next up looks in have issue fields, so it lists issues oldest first."
|
|
224
|
+
: "Org issue fields from the organizations Next up looks in. Values rank in the order the organization lists them."}
|
|
225
|
+
</Text>
|
|
226
|
+
</View>
|
|
227
|
+
);
|
|
228
|
+
}
|
|
229
|
+
|
|
168
230
|
// Each name is checked on GitHub before it's saved; GitHub's exact name is what's kept.
|
|
169
231
|
function AddRow({ kind, placeholder, existing, disabled, onAdd }: { kind: CoverageKind; placeholder?: string; existing: string[]; disabled: boolean; onAdd: (name: string) => Promise<void> }) {
|
|
170
232
|
const styles = useStyles();
|
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,7 +44,7 @@ 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
|
|---|---|
|
|
@@ -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.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/index.server.ts
CHANGED
|
@@ -47,6 +47,8 @@ export default function contribute(server: PluginServerContext) {
|
|
|
47
47
|
server.handle(rpc.checkCoverage, ({ kind, name }) => checkCoverage(kind, name));
|
|
48
48
|
server.handle(rpc.setCoverage, ({ orgs, repos }) => ready(() => attention.setCoverage(orgs, repos)).then(() => ({ ok: true as const })));
|
|
49
49
|
server.handle(rpc.setNextUpSources, (sources) => ready(() => attention.setNextUpSources(sources)).then(() => ({ ok: true as const })));
|
|
50
|
+
server.handle(rpc.issueFields, () => ready(async () => ({ fields: await attention.issueFields() })));
|
|
51
|
+
server.handle(rpc.setNextUpFields, (fields) => ready(() => attention.setNextUpFields(fields)).then(() => ({ ok: true as const })));
|
|
50
52
|
server.handle(rpc.setFollowThreads, ({ on }) => ready(() => attention.setFollowThreads(on)).then(() => ({ ok: true as const })));
|
|
51
53
|
server.handle(rpc.myOrgs, async () => ({ orgs: await myOrgs() }));
|
|
52
54
|
server.handle(rpc.setScopes, ({ scopes }) => ready(() => attention.setScopes(scopes)).then(() => ({ ok: true as const })));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@andrioid/paseo-attention-span",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.7",
|
|
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.
|
|
@@ -86,7 +87,7 @@ functional:
|
|
|
86
87
|
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.
|
|
87
88
|
NXT-02: see unclaimed issues ordered by priority, then effort, then age; so that the most important quick wins come first.
|
|
88
89
|
NXT-03: filter unclaimed issues by scope, and have my choice remembered; so that I only see work I'd pick up.
|
|
89
|
-
NXT-04: choose in the app where unclaimed issues come from (my own repositories, organizations I belong to, or single repositories) and choose which issue fields the list uses; so that the plugin can be used elsewhere without editing files.
|
|
90
|
+
NXT-04: choose in the app where unclaimed issues come from (my own repositories, organizations I belong to, or single repositories) and choose which issue fields the list uses, with fields named Priority, Effort and Scope used until I do; so that the plugin can be used elsewhere without editing files.
|
|
90
91
|
NXT-05: claim an issue and start a session on it in one step; so that teammates see it's taken and I can start right away.
|
|
91
92
|
NXT-06: see issues assigned to me before unclaimed ones; so that I finish what I've taken before picking more.
|
|
92
93
|
NXT-07: claim an issue without starting a session, and give back one assigned to me; so that what I've taken matches what I'll do.
|
package/server/classify.ts
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
type Target,
|
|
14
14
|
type WaitingOn,
|
|
15
15
|
} from "../shared/attention";
|
|
16
|
-
import type
|
|
16
|
+
import { type AttentionConfig, FIELD_ROLES, type MergeMethod, nextUpField, sameField } from "../shared/config";
|
|
17
17
|
import { ago, daysSince } from "../shared/format";
|
|
18
18
|
import { workChip, workKind } from "../shared/work";
|
|
19
19
|
import type { Actor, Comment, Details, HistoryResult, IssueNode, LinkedIssue, LiveResult, MentionNode, PickableNode, PullRequestNode, RequestedReviewer } from "./github-types";
|
|
@@ -565,13 +565,13 @@ export function mergeMethodFor(pr: PullRequestNode, config: AttentionConfig): Me
|
|
|
565
565
|
// ---- Next up: issues by priority, effort, then age [NXT-02] ----
|
|
566
566
|
|
|
567
567
|
function rankIssues(nodes: PickableNode[], details: Details, config: AttentionConfig): NextUpIssue[] {
|
|
568
|
-
const
|
|
569
|
-
const valueOf = (node: PickableNode, field: string | undefined) =>
|
|
570
|
-
|
|
568
|
+
const [priority, effort, scope] = FIELD_ROLES.map((role) => nextUpField(config, role));
|
|
569
|
+
const valueOf = (node: PickableNode, field: string | undefined) => node.issueFieldValues.nodes.find((value) => sameField(value.field?.name, field))?.name;
|
|
570
|
+
const optionsOf = (field: string) => Object.entries(details.fieldOptions).find(([name]) => sameField(name, field))?.[1];
|
|
571
571
|
// Position in the configured order (matched by name), else in the field's own options; missing goes last.
|
|
572
572
|
const position = (value: string | undefined, ranked: { field: string; order?: string[] } | undefined) => {
|
|
573
573
|
if (!value || !ranked) return Infinity;
|
|
574
|
-
const order = ranked.order ??
|
|
574
|
+
const order = ranked.order ?? optionsOf(ranked.field) ?? [];
|
|
575
575
|
const index = order.findIndex((name) => value.toLowerCase().includes(name.toLowerCase()));
|
|
576
576
|
return index < 0 ? Infinity : index;
|
|
577
577
|
};
|
package/server/fixture.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AgentSummary, ItemDetails, Reviewer, ReviewerChoices, Target } from "../shared/attention";
|
|
2
2
|
import type { SessionKind } from "../shared/config";
|
|
3
|
+
import type { IssueField } from "../shared/setup";
|
|
3
4
|
import type { Actor, Comment, Details, IssueNode, MentionNode, PickableNode, PullRequestNode, SearchResult } from "./github-types";
|
|
4
5
|
|
|
5
6
|
// Made-up GitHub data for tests and for previews without GitHub (PASEO_ATTENTION_SPAN_FIXTURE=1).
|
|
@@ -12,6 +13,13 @@ export const FIXTURE_ORGS = ["acme"];
|
|
|
12
13
|
export const FIXTURE_REPOS = [REPO, ISSUES_REPO, "acme/web", "me/tool"];
|
|
13
14
|
// The orgs Next up's org picker offers in previews [NXT-04].
|
|
14
15
|
export const FIXTURE_MY_ORGS = ["acme", "globex"];
|
|
16
|
+
// The org issue fields settings offers for Next up [NXT-04].
|
|
17
|
+
export const FIXTURE_ISSUE_FIELDS: IssueField[] = [
|
|
18
|
+
{ name: "Effort", options: ["🐟 Tiny (< 4h)", "🐇 Small (0.5-2d)", "🐂 Medium (2-5d)", "🦑 Large (1-2w)"], orgs: ["acme"] },
|
|
19
|
+
{ name: "Priority", options: ["🌋 P0 Urgent", "🏔 P1 High", "🏕P2 Medium", "🏝 P3 Low"], orgs: ["acme"] },
|
|
20
|
+
{ name: "Scope", options: ["🔙 Backend", "🖌 Frontend", "🕵 Full-stack", "📱 Mobile app"], orgs: ["acme"] },
|
|
21
|
+
{ name: "Team", options: ["Platform", "Payments"], orgs: ["acme"] },
|
|
22
|
+
];
|
|
15
23
|
const repository = { nameWithOwner: REPO, squashMergeAllowed: true, defaultBranchRef: { name: "main" } };
|
|
16
24
|
const avatar = (id: number) => `https://avatars.githubusercontent.com/u/${id}?v=4`;
|
|
17
25
|
|
package/server/queries.ts
CHANGED
|
@@ -208,14 +208,21 @@ export function detailsQuery(prs: PullRequestNode[], orgs: string[], refs: Issue
|
|
|
208
208
|
issueOrPullRequest(number: ${ref.number}) { ... on Issue { number title url state repository { nameWithOwner } } }
|
|
209
209
|
}`),
|
|
210
210
|
);
|
|
211
|
-
orgs.forEach((org, index) =>
|
|
212
|
-
fields.push(`o${index}: organization(login: ${JSON.stringify(org)}) {
|
|
213
|
-
issueFields(first: 50) { nodes { ... on IssueFieldSingleSelect { name options { name } } } }
|
|
214
|
-
}`),
|
|
215
|
-
);
|
|
211
|
+
orgs.forEach((org, index) => fields.push(orgFields(`o${index}`, org)));
|
|
216
212
|
return { query: `query Details {\n${fields.join("\n")}\n}`, compares };
|
|
217
213
|
}
|
|
218
214
|
|
|
215
|
+
// An org's single-select issue fields with their options, in the org's order [NXT-02].
|
|
216
|
+
const orgFields = (alias: string, org: string) => `${alias}: organization(login: ${JSON.stringify(org)}) {
|
|
217
|
+
issueFields(first: 50) { nodes { ... on IssueFieldSingleSelect { name options { name } } } }
|
|
218
|
+
}`;
|
|
219
|
+
export type OrgFields = { issueFields?: { nodes: { name?: string; options?: { name: string }[] }[] } } | null;
|
|
220
|
+
|
|
221
|
+
// The fields settings offers for Next up, from every org it might pick from [NXT-04]. An owner that's a person fails only its own field.
|
|
222
|
+
export function issueFieldsQuery(orgs: string[]): string {
|
|
223
|
+
return `query IssueFields {\n${orgs.map((org, index) => orgFields(`o${index}`, org)).join("\n")}\n}`;
|
|
224
|
+
}
|
|
225
|
+
|
|
219
226
|
// GitHub works out at most this many PRs' merge state per request; asked about more, it says BLOCKED for all of them, even
|
|
220
227
|
// in search and in a repo's PR list. Seen on 2026-11-04 [PRS-13].
|
|
221
228
|
export const MERGE_STATE_BATCH = 5;
|
package/server/service.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import type { Attention, AttentionView, FeedId, FeedStatus, Item, Reviewer } from "../shared/attention";
|
|
2
2
|
import type { PluginHandlerContext } from "@getpaseo/plugin/server";
|
|
3
|
-
import { AttentionConfig, githubRepoOf } from "../shared/config";
|
|
3
|
+
import { AttentionConfig, type FieldRole, githubRepoOf, nextUpField } from "../shared/config";
|
|
4
|
+
import type { IssueField } from "../shared/setup";
|
|
4
5
|
import { classify, classifyHistory } from "./classify";
|
|
5
6
|
import { FIXTURE, graphql } from "./gh";
|
|
6
|
-
import { fixture, FIXTURE_AGENTS } from "./fixture";
|
|
7
|
+
import { fixture, FIXTURE_AGENTS, FIXTURE_ISSUE_FIELDS } from "./fixture";
|
|
7
8
|
import type { Details, HistoryResult, LinkedIssue, LiveResult, MergeStateStatus, PullRequestNode } from "./github-types";
|
|
8
|
-
import { type CheckContext, detailsQuery, HISTORY_SEARCHES, MERGE_STATE_BATCH, mergeStateQuery, mergeUnclaimed, prKey, requiredChecks, type SearchName, searchQuery, searchVariables, type UnclaimedSearch, unclaimedSearches } from "./queries";
|
|
9
|
+
import { type CheckContext, detailsQuery, HISTORY_SEARCHES, issueFieldsQuery, type OrgFields, MERGE_STATE_BATCH, mergeStateQuery, mergeUnclaimed, prKey, requiredChecks, type SearchName, searchQuery, searchVariables, type UnclaimedSearch, unclaimedSearches } from "./queries";
|
|
9
10
|
import { toLookUp } from "./references";
|
|
10
|
-
import { loadConfig, loadState, moveOldFiles, saveCodeRepo, saveCoverage, saveFollowThreads, saveNextUpSources, saveState, State } from "./store";
|
|
11
|
+
import { loadConfig, loadState, moveOldFiles, saveCodeRepo, saveCoverage, saveFollowThreads, saveNextUpFields, saveNextUpSources, saveState, State } from "./store";
|
|
11
12
|
import { applyPending, buildView, doneItem, type Effect, isPending, SETTLE_MS } from "./view";
|
|
12
13
|
|
|
13
14
|
// History changes only when I finish something, so it's fetched daily, on ⟳ in its tab and after a merge.
|
|
@@ -107,6 +108,36 @@ export class AttentionService {
|
|
|
107
108
|
await this.refresh("live").catch(() => {});
|
|
108
109
|
}
|
|
109
110
|
|
|
111
|
+
// Which org issue fields Next up uses, chosen in settings [NXT-04]. Only the live feed has Next up.
|
|
112
|
+
async setNextUpFields(fields: Partial<Record<FieldRole, string | null>>): Promise<void> {
|
|
113
|
+
this.config = await saveNextUpFields(fields);
|
|
114
|
+
await this.refresh("live").catch(() => {});
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// The single-select fields of every org Next up might pick from, merged by name, for settings [NXT-04]:
|
|
118
|
+
// the orgs chosen, the owners of the repos chosen and of my projects, and of the issues it last showed.
|
|
119
|
+
async issueFields(): Promise<IssueField[]> {
|
|
120
|
+
if (FIXTURE) return FIXTURE_ISSUE_FIELDS;
|
|
121
|
+
await this.reloadConfig().catch(() => {});
|
|
122
|
+
const { orgs, repos, nextUp } = this.config;
|
|
123
|
+
const live = this.state.live?.attention;
|
|
124
|
+
const shown = [...(live?.unclaimed ?? []), ...(live?.assigned ?? [])].map((issue) => issue.repo);
|
|
125
|
+
const owners = [...orgs, ...nextUp.orgs, ...[...repos, ...nextUp.repos, ...this.state.projectRepos, ...shown].map((repo) => repo.split("/")[0])];
|
|
126
|
+
const unique = [...new Map(owners.map((owner) => [owner.toLowerCase(), owner])).values()];
|
|
127
|
+
if (unique.length === 0) return [];
|
|
128
|
+
const result = await graphql<Record<string, OrgFields>>(issueFieldsQuery(unique));
|
|
129
|
+
const merged = new Map<string, IssueField>();
|
|
130
|
+
unique.forEach((org, index) => {
|
|
131
|
+
for (const field of result[`o${index}`]?.issueFields?.nodes ?? []) {
|
|
132
|
+
if (!field.name || !field.options) continue;
|
|
133
|
+
const known = merged.get(field.name.toLowerCase());
|
|
134
|
+
if (known) known.orgs.push(org);
|
|
135
|
+
else merged.set(field.name.toLowerCase(), { name: field.name, options: field.options.map((option) => option.name), orgs: [org] });
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
return [...merged.values()].sort((a, b) => a.name.localeCompare(b.name));
|
|
139
|
+
}
|
|
140
|
+
|
|
110
141
|
// Replies on others' threads without a tag [ATT-17]. Only the live feed has them.
|
|
111
142
|
async setFollowThreads(on: boolean): Promise<void> {
|
|
112
143
|
this.config = await saveFollowThreads(on);
|
|
@@ -265,8 +296,10 @@ export class AttentionService {
|
|
|
265
296
|
// Behind counts [UPS-07], required checks [PRS-14] and issue field option order [NXT-02].
|
|
266
297
|
private async details(data: Pick<LiveResult, "mine" | "assigned" | "unclaimed">): Promise<Details> {
|
|
267
298
|
const prs = data.mine.nodes.filter((pr) => pr?.headRefName && !pr.isCrossRepository);
|
|
268
|
-
const
|
|
269
|
-
|
|
299
|
+
const needsOptions = (["priority", "effort"] as const).some((role) => {
|
|
300
|
+
const field = nextUpField(this.config, role);
|
|
301
|
+
return field && !field.order;
|
|
302
|
+
});
|
|
270
303
|
const issues = [...data.unclaimed.nodes, ...data.assigned.nodes];
|
|
271
304
|
const orgs = needsOptions ? [...new Set(issues.map((issue) => issue?.repository?.nameWithOwner.split("/")[0]).filter(Boolean))] : [];
|
|
272
305
|
const refs = toLookUp(data.mine.nodes.filter((pr) => pr?.repository));
|
package/server/setup.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { FIELD_ROLES } from "../shared/config";
|
|
1
2
|
import type { ConfigStatus, CoverageCheck, CoverageKind, SetupStatus } from "../shared/setup";
|
|
2
3
|
import { FIXTURE_MY_ORGS, FIXTURE_ORGS, FIXTURE_REPOS } from "./fixture";
|
|
3
4
|
import { FIXTURE, graphql, runGh } from "./gh";
|
|
@@ -22,9 +23,10 @@ async function ghStatus(): Promise<SetupStatus["gh"]> {
|
|
|
22
23
|
export async function configStatus(): Promise<ConfigStatus> {
|
|
23
24
|
try {
|
|
24
25
|
const { orgs, repos, nextUp, followThreads } = await loadConfig();
|
|
25
|
-
|
|
26
|
+
const fields = Object.fromEntries(FIELD_ROLES.flatMap((role) => (nextUp[role] === undefined ? [] : [[role, nextUp[role]?.field ?? null]])));
|
|
27
|
+
return { error: null, orgs, repos, nextUp: { mine: nextUp.mine, orgs: nextUp.orgs, repos: nextUp.repos }, fields, followThreads };
|
|
26
28
|
} catch (error) {
|
|
27
|
-
return { error: (error as Error).message, orgs: [], repos: [], nextUp: { mine: false, orgs: [], repos: [] }, followThreads: false };
|
|
29
|
+
return { error: (error as Error).message, orgs: [], repos: [], nextUp: { mine: false, orgs: [], repos: [] }, fields: {}, followThreads: false };
|
|
28
30
|
}
|
|
29
31
|
}
|
|
30
32
|
|
package/server/store.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { homedir } from "node:os";
|
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import type { Attention, Item, SectionId } from "../shared/attention";
|
|
6
|
-
import { AttentionConfig } from "../shared/config";
|
|
6
|
+
import { AttentionConfig, FIELD_ROLES, type FieldRole, sameField } from "../shared/config";
|
|
7
7
|
import type { Pending } from "./view";
|
|
8
8
|
|
|
9
9
|
// Local files in ~/.config/paseo-attention-span/ [PRIV-01].
|
|
@@ -86,6 +86,22 @@ export function saveNextUpSources(sources: Pick<AttentionConfig["nextUp"], "mine
|
|
|
86
86
|
});
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
+
// Which org issue fields Next up uses, from settings [NXT-04]: null turns one off, a role left out is kept as it is.
|
|
90
|
+
// A field kept as it was keeps its order.
|
|
91
|
+
export function saveNextUpFields(fields: Partial<Record<FieldRole, string | null>>): Promise<AttentionConfig> {
|
|
92
|
+
return updateConfig((file) => {
|
|
93
|
+
const nextUp = file.nextUp && typeof file.nextUp === "object" ? (file.nextUp as Record<string, unknown>) : {};
|
|
94
|
+
const chosen = Object.fromEntries(
|
|
95
|
+
FIELD_ROLES.filter((role) => fields[role] !== undefined).map((role) => {
|
|
96
|
+
const before = nextUp[role] as { field?: unknown } | null | undefined;
|
|
97
|
+
const field = fields[role]!;
|
|
98
|
+
return [role, field === null ? null : before && typeof before.field === "string" && sameField(before.field, field) ? { ...before, field } : { field }];
|
|
99
|
+
}),
|
|
100
|
+
);
|
|
101
|
+
return { ...file, nextUp: { ...nextUp, ...chosen } };
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
|
|
89
105
|
// Whether replies on others' threads count without a tag, from settings [ATT-17].
|
|
90
106
|
export function saveFollowThreads(followThreads: boolean): Promise<AttentionConfig> {
|
|
91
107
|
return updateConfig((file) => ({ ...file, followThreads }));
|
package/shared/config.ts
CHANGED
|
@@ -48,9 +48,11 @@ export const AttentionConfig = z.object({
|
|
|
48
48
|
mine: z.boolean().default(false),
|
|
49
49
|
orgs: z.array(z.string()).default([]),
|
|
50
50
|
repos: z.array(z.string()).default([]),
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
// Which org issue fields rank and filter the list [NXT-02, NXT-03]. Left out, the field named after the role is used if
|
|
52
|
+
// the org has one; null turns it off.
|
|
53
|
+
priority: RankedField.nullable().optional(),
|
|
54
|
+
effort: RankedField.nullable().optional(),
|
|
55
|
+
scope: z.object({ field: z.string() }).nullable().optional(),
|
|
54
56
|
})
|
|
55
57
|
.default({ mine: false, orgs: [], repos: [] }),
|
|
56
58
|
});
|
|
@@ -70,6 +72,23 @@ export function nextUpSources({ nextUp }: Pick<AttentionConfig, "nextUp">): Next
|
|
|
70
72
|
];
|
|
71
73
|
}
|
|
72
74
|
|
|
75
|
+
// What Next up uses org issue fields for, chosen in settings [NXT-04].
|
|
76
|
+
export const FIELD_ROLES = ["priority", "effort", "scope"] as const;
|
|
77
|
+
export type FieldRole = (typeof FIELD_ROLES)[number];
|
|
78
|
+
// The field each role uses until I choose: one with the role's name, like "Priority".
|
|
79
|
+
export const DEFAULT_FIELD: Record<FieldRole, string> = { priority: "Priority", effort: "Effort", scope: "Scope" };
|
|
80
|
+
|
|
81
|
+
// The field a role uses: the chosen one, none if turned off, else the one named after it [NXT-04].
|
|
82
|
+
export function nextUpField({ nextUp }: Pick<AttentionConfig, "nextUp">, role: FieldRole): { field: string; order?: string[] } | undefined {
|
|
83
|
+
const chosen = nextUp[role];
|
|
84
|
+
return chosen === undefined ? { field: DEFAULT_FIELD[role] } : (chosen ?? undefined);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Org issue field names compare without case, as people type them in config.json.
|
|
88
|
+
export function sameField(a: string | undefined, b: string | undefined): boolean {
|
|
89
|
+
return !!a && !!b && a.toLowerCase() === b.toLowerCase();
|
|
90
|
+
}
|
|
91
|
+
|
|
73
92
|
// "owner/name" of a Paseo project with a GitHub remote, from its project key.
|
|
74
93
|
export function githubRepoOf(projectKey: string | null | undefined): string | null {
|
|
75
94
|
return /^remote:github\.com\/(.+)$/i.exec(projectKey ?? "")?.[1] ?? null;
|
package/shared/rpc.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { defineRpc } from "@getpaseo/plugin";
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import type { AttentionView, ItemDetails, ReviewerChoices, Target } from "./attention";
|
|
4
4
|
import { SessionKind } from "./config";
|
|
5
|
-
import type { ConfigStatus, CoverageCheck, SetupStatus } from "./setup";
|
|
5
|
+
import type { ConfigStatus, CoverageCheck, IssueField, SetupStatus } from "./setup";
|
|
6
6
|
import type { FeedbackInfo } from "./feedback";
|
|
7
7
|
import type { ReadyProvider } from "./providers";
|
|
8
8
|
import type { UpdateNotice } from "./update";
|
|
@@ -28,6 +28,11 @@ export const checkCoverage = defineRpc({ name: "config.check-coverage", input: z
|
|
|
28
28
|
export const setCoverage = defineRpc({ name: "config.set-coverage", input: z.object({ orgs: z.array(z.string()), repos: z.array(z.string()) }), output: done });
|
|
29
29
|
// Where Next up looks, chosen in settings [NXT-04]; orgs are picked from the ones I belong to.
|
|
30
30
|
export const setNextUpSources = defineRpc({ name: "config.set-next-up", input: z.object({ mine: z.boolean(), orgs: z.array(z.string()), repos: z.array(z.string()) }), output: done });
|
|
31
|
+
// The org issue fields settings offers for Next up, and which one each role uses [NXT-04].
|
|
32
|
+
export const issueFields = defineRpc({ name: "config.issue-fields", input: z.object({}), output: z.custom<{ fields: IssueField[] }>() });
|
|
33
|
+
// Only the roles given change; one left out keeps what config.json says, including finding its field by name.
|
|
34
|
+
const fieldChoice = z.string().nullable().optional();
|
|
35
|
+
export const setNextUpFields = defineRpc({ name: "config.set-next-up-fields", input: z.object({ priority: fieldChoice, effort: fieldChoice, scope: fieldChoice }), output: done });
|
|
31
36
|
// Replies on others' threads without a tag, from settings [ATT-17].
|
|
32
37
|
export const setFollowThreads = defineRpc({ name: "config.set-follow-threads", input: z.object({ on: z.boolean() }), output: done });
|
|
33
38
|
export const myOrgs = defineRpc({ name: "config.my-orgs", input: z.object({}), output: z.object({ orgs: z.array(z.string()) }) });
|
package/shared/setup.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { FieldRole } from "./config";
|
|
2
|
+
|
|
1
3
|
// What getting started needs, for the setup checklist [SET-01] and the settings screen [SRC-02].
|
|
2
4
|
|
|
3
5
|
export interface ConfigStatus {
|
|
@@ -7,6 +9,8 @@ export interface ConfigStatus {
|
|
|
7
9
|
repos: string[];
|
|
8
10
|
// Where Next up looks; none chosen falls back to `orgs` and `repos`, then my Paseo projects [NXT-04, NXT-08].
|
|
9
11
|
nextUp: { mine: boolean; orgs: string[]; repos: string[] };
|
|
12
|
+
// The issue field chosen for each role, null when turned off; a role left out uses the field named after it [NXT-04].
|
|
13
|
+
fields: Partial<Record<FieldRole, string | null>>;
|
|
10
14
|
// Replies on others' threads count without a tag [ATT-17].
|
|
11
15
|
followThreads: boolean;
|
|
12
16
|
}
|
|
@@ -29,3 +33,10 @@ export function blocks(status: SetupStatus): boolean {
|
|
|
29
33
|
// An org or repo checked on GitHub before it's saved: its exact name, or why it can't be added.
|
|
30
34
|
export type CoverageCheck = { name: string; error: null } | { name: null; error: string };
|
|
31
35
|
export type CoverageKind = "org" | "repo";
|
|
36
|
+
|
|
37
|
+
// A single-select issue field Next up can use, merged by name across the orgs that have it [NXT-04].
|
|
38
|
+
export interface IssueField {
|
|
39
|
+
name: string;
|
|
40
|
+
options: string[];
|
|
41
|
+
orgs: string[];
|
|
42
|
+
}
|
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
|
+
}
|