@andrioid/paseo-attention-span 0.1.2 → 0.1.3

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 CHANGED
@@ -6,7 +6,7 @@ The screen has four tabs. A sidebar entry, Attention, shows how many items need
6
6
 
7
7
  - **Doing:** what needs you, in sections: waiting for your reply, review requested, CI failing, changes requested, ready to merge, needs upstream, waiting too long, and your drafts. Each item appears once, under its most urgent reason. An issue and the pull requests that close it are one item, and so is a stack of pull requests.
8
8
  - **Waiting:** your work where someone else has the next move.
9
- - **Next up:** issues assigned to you, then open issues nobody has claimed, ranked by priority and effort when your org uses issue fields for them. Unclaimed issues come from the repositories you choose, or else from your Paseo projects' repositories.
9
+ - **Next up:** issues assigned to you, then open issues nobody has claimed, ranked by priority and effort when your org uses issue fields for them. Unclaimed issues come from the sources you choose (your own repositories, your organizations or single repositories), and can be filtered by source, or else from your Paseo projects' repositories.
10
10
  - **History:** what you finished and reviewed in recent weeks.
11
11
 
12
12
  A mention only counts while the person is still waiting for you; replying or reacting clears it. Mentions of your teams are left out. You can dismiss an item until something new happens on it.
@@ -21,14 +21,14 @@ When `gh` is missing or signed out, or `config.json` can't be read, the screen s
21
21
 
22
22
  It works without configuration: the lists about you cover everything on GitHub that involves you, and Next up looks for unclaimed issues in your Paseo projects' repositories.
23
23
 
24
- To narrow it down, choose organizations and repositories under Settings, Plugins, Attention Span, or with the gear on the screen. Each one is checked on GitHub as you add it. Next up's unclaimed issues use them too, instead of your projects.
24
+ To narrow it down, choose organizations and repositories under Settings, Plugins, Attention Span, or with the gear on the screen. Each one is checked on GitHub as you add it. Next up's unclaimed issues use them too, instead of your projects, unless you choose Next up's own sources there.
25
25
 
26
26
  Everything else is set in `~/.config/paseo-attention-span/config.json` on the daemon host, which the settings screen also writes to:
27
27
  - `profiles`: the Paseo agent profile per session type. Reviews use `review`, everything else `default`, and a missing profile falls back to Paseo's defaults.
28
28
  - `prompts`: your own prompt template per session type, replacing the built-in one.
29
29
  - `mergeMethods`: squash, merge or rebase per repository.
30
30
  - `codeRepos`: where an issue repository's code lives, for issues kept apart from the code. The screen asks and fills this in when needed.
31
- - `nextUp`: which repositories to pick from, and the org issue fields for priority, effort and scope.
31
+ - `nextUp`: where to pick from (also in Settings), and the org issue fields for priority, effort and scope.
32
32
  - `refreshMinutes` (15), `waitingTooLongDays` (3), `staleDraftDays` (30), `mentionDays` (30) and `historyWeeks` (4).
33
33
 
34
34
  ## Actions
@@ -5,12 +5,13 @@ import { useQuery, useQueryClient } from "@tanstack/react-query";
5
5
  import { type ReactNode, useState } from "react";
6
6
  import { Pressable, ScrollView, Text, View } from "react-native";
7
7
  import { type ActionId, type AgentSummary, type Chip, type FailingChecks, type Item, type NextUpIssue, type Section, type SectionId, type SubRow, TAB_FEED, type TabId, type Target } from "../shared/attention";
8
- import type { AttentionConfig, SessionKind } from "../shared/config";
8
+ import { type AttentionConfig, nextUpSources, type SessionKind } from "../shared/config";
9
9
  import { ago, linkList } from "../shared/format";
10
10
  import { ACTION_SESSION, renderPrompt } from "../shared/prompts";
11
11
  import * as rpc from "../shared/rpc";
12
12
  import { blocks } from "../shared/setup";
13
13
  import { useAttention } from "./data";
14
+ import { CardList, CardRow, type CardProps } from "./card";
14
15
  import type { IconName } from "./icons";
15
16
  import { NextUpList } from "./next-up";
16
17
  import { ActionSheet, DetailLines, type SheetEntry } from "./sheet";
@@ -179,6 +180,9 @@ function AttentionList({ navigation, openSettings }: Pick<PluginScreenProps, "na
179
180
  const undismiss = useRpc(rpc.undismissItem);
180
181
  const restore = useRpc(rpc.restoreDismissed);
181
182
  const saveScopes = useRpc(rpc.setScopes);
183
+ const saveSources = useRpc(rpc.setSources);
184
+ const closeIssue = useRpc(rpc.closeIssue);
185
+ const reopenIssue = useRpc(rpc.reopenIssue);
182
186
  const update = useRpc(rpc.updateBranch);
183
187
  const merge = useRpc(rpc.mergePullRequest);
184
188
  const close = useRpc(rpc.closePullRequest);
@@ -298,14 +302,11 @@ function AttentionList({ navigation, openSettings }: Pick<PluginScreenProps, "na
298
302
  waiting: view.waiting.reduce((sum, section) => sum + section.items.length, 0),
299
303
  next: view.assigned.length + view.unclaimed.length,
300
304
  };
301
- // The repo is worth showing only when the list spans several.
302
- const repos = new Set([...view.doing, ...view.waiting].flatMap((section) => section.items.map((item) => item.repo)));
303
305
 
304
306
  const actions: Actions = {
305
307
  agents: view.fixtureAgents ?? agents.data ?? {},
306
308
  busy,
307
309
  config: view.config,
308
- showRepo: repos.size > 1,
309
310
  fetchContext,
310
311
  fetchDetails,
311
312
  defaultBranch,
@@ -426,6 +427,12 @@ function AttentionList({ navigation, openSettings }: Pick<PluginScreenProps, "na
426
427
  attention.setView({ ...view, scopes });
427
428
  saveScopes({ scopes }).catch((error) => toast.error(`Saving the filter failed: ${(error as Error).message}`));
428
429
  }}
430
+ sources={nextUpSources(view.config)}
431
+ selectedSources={view.sources}
432
+ onSelectSources={(sources) => {
433
+ attention.setView({ ...view, sources });
434
+ saveSources({ sources }).catch((error) => toast.error(`Saving the filter failed: ${(error as Error).message}`));
435
+ }}
429
436
  agents={actions.agents}
430
437
  busy={busy}
431
438
  fetchDetails={fetchDetails}
@@ -440,6 +447,12 @@ function AttentionList({ navigation, openSettings }: Pick<PluginScreenProps, "na
440
447
  const [take, giveBack] = [() => claim({ target }), () => unclaim({ target })];
441
448
  onGitHub(issue.key, on ? "Claim" : "Unclaim", on ? take : giveBack, `${on ? "Claimed" : "Unclaimed"} #${issue.number}`, on ? giveBack : take);
442
449
  }}
450
+ // Undo reopens; a comment already posted stays [NXT-11].
451
+ onCloseIssue={(issue, reason, comment) => {
452
+ const target = issueTarget(issue);
453
+ const done = `Closed #${issue.number} as ${reason === "completed" ? "completed" : "not planned"}`;
454
+ onGitHub(issue.key, "Close", () => closeIssue({ target, reason, comment: comment || undefined }), done, () => reopenIssue({ target }));
455
+ }}
443
456
  />
444
457
  ) : null}
445
458
  {placing ? <CodeRepoPicker issueRepo={placing.target.repo} missing={placing.missing} onPick={place} onClose={() => setPlacing(null)} /> : null}
@@ -470,7 +483,6 @@ interface Actions {
470
483
  agents: Record<string, AgentSummary>;
471
484
  busy: string | null;
472
485
  config: AttentionConfig;
473
- showRepo: boolean;
474
486
  fetchContext: FetchContext;
475
487
  fetchDetails: FetchDetails;
476
488
  defaultBranch: DefaultBranch;
@@ -483,10 +495,11 @@ interface Actions {
483
495
  started: (agentId: string) => Promise<void>;
484
496
  }
485
497
 
486
- function stateIcon(item: Item, c: ReturnType<typeof useStyles>["c"]): { name: IconName; color: string } {
487
- if (item.closedAt) return item.kind === "pr" ? { name: "merge", color: c.accent } : { name: "issueClosed", color: item.chips.length ? c.foregroundMuted : c.accent };
488
- if (item.kind === "issue") return { name: "issue", color: c.statusSuccess };
489
- return item.draft ? { name: "draft", color: c.foregroundMuted } : { name: "pr", color: c.statusSuccess };
498
+ // What the card is: open, draft, merged or closed. Urgency stays in the chips and section headers.
499
+ function stateMark(item: Item): CardProps["mark"] {
500
+ if (item.closedAt) return item.kind === "pr" ? { icon: "merge", tone: "good" } : { icon: "issueClosed", tone: item.chips.length ? "neutral" : "good" };
501
+ if (item.kind === "issue") return { icon: "issue", tone: "good" };
502
+ return item.draft ? { icon: "draft", tone: "neutral" } : { icon: "pr", tone: "good" };
490
503
  }
491
504
 
492
505
  // A card that works collapsed: its main action and ⋯. Tapping it opens the sheet with everything else [ATT-05, ATT-06].
@@ -495,19 +508,15 @@ const isRed = (chips: Chip[]) => chips.some((chip) => chip.tone === "bad");
495
508
  type Sheet = "item" | "acknowledge" | { options: SessionKind } | null;
496
509
 
497
510
  function ItemRow({ item, first, actions }: { item: Item; first: boolean; actions: Actions }) {
498
- const styles = useStyles();
499
511
  const agent = actions.agents[item.key];
500
512
  const chips = agent ? [...item.chips, agentSignal(agent)] : item.chips;
501
513
  const [sheet, setSheet] = useState<Sheet>(null);
502
514
  const [confirm, setConfirm] = useState<"merge" | "close" | null>(null);
503
- const [comment, setComment] = useState("");
504
515
  const sessionAction = item.actions.find((action) => ACTION_SESSION[action]);
505
516
  const sessionKind = sessionAction ? ACTION_SESSION[sessionAction] : undefined;
506
517
  const main = item.actions[0];
507
- const facts = [`#${item.number}`, ...(actions.showRepo ? [item.repo.split("/")[1]] : [])];
508
518
  // The full stack is in the sheet; the card shows the PRs that need attention [ATT-04].
509
519
  const children = item.children.filter((child) => child.attention || isRed(child.chips));
510
- const icon = stateIcon(item, styles.c);
511
520
  const open = () => setSheet("item");
512
521
  const copy = useCopy();
513
522
  const history = item.section === "done" || item.section === "reviewed";
@@ -522,67 +531,64 @@ function ItemRow({ item, first, actions }: { item: Item; first: boolean; actions
522
531
  // A menu with one action is a wasted tap: show that action instead of ⋯. The card still opens the sheet [ATT-06].
523
532
  const entries = sheetEntries(item, agent, actions, handlers);
524
533
  const only = entries.length === 1 ? entries[0] : undefined;
525
-
526
- const buttons = (
527
- <View style={styles.wrap}>
528
- {actions.busy === item.key ? (
529
- <Text style={styles.muted}>working…</Text>
530
- ) : agent && sessionKind ? (
531
- <Button label={CONTINUE_LABELS[sessionKind]} icon="agent" variant="calm" onPress={() => actions.openAgent(agent.id)} />
532
- ) : main ? (
533
- <Button label={actionLabel(main, item)} icon={ACTION_ICONS[main]} variant="calm" onPress={() => perform(main)} />
534
- ) : null}
535
- {only ? (
536
- <Button icon={only.icon} variant="ghost" accessibilityLabel={only.label} onPress={only.onPress} />
537
- ) : (
538
- <Button icon="dots" variant="ghost" accessibilityLabel="More actions" onPress={open} />
539
- )}
540
- {/* History is where I report from, so its cards copy their link in one tap [ATT-15]. */}
541
- {history ? <Button icon="copy" variant="ghost" accessibilityLabel={`Copy link to #${item.number}`} onPress={() => copy(item.url, `Copied link to #${item.number}`)} /> : null}
542
- </View>
543
- );
534
+ const confirmed = (action: "merge" | "close") => (comment: string) => (setConfirm(null), actions.confirm(item, action, comment));
544
535
 
545
536
  return (
546
- <View style={first ? null : styles.divider}>
547
- <View style={styles.item}>
548
- <View style={{ paddingTop: 3 }}>
549
- <TablerIcon name={icon.name} color={icon.color} size={18} />
550
- </View>
551
- <View style={styles.body}>
552
- <Pressable accessibilityRole="button" accessibilityLabel={`${item.title}, more`} onPress={open} style={{ gap: 6 }}>
553
- <Text style={styles.title} numberOfLines={styles.compact ? 2 : 1}>
554
- {item.title}
555
- </Text>
556
- <Meta facts={facts} chips={chips} />
537
+ <CardRow
538
+ first={first}
539
+ mark={stateMark(item)}
540
+ title={item.title}
541
+ meta={{
542
+ place: `${item.repo.split("/")[1]} #${item.number}`,
543
+ when: item.closedAt ? `${item.kind === "pr" ? "merged" : "closed"} ${ago(item.closedAt)} ago` : undefined,
544
+ signals: chips,
545
+ }}
546
+ extra={
547
+ item.person || children.length > 0 ? (
548
+ <>
557
549
  {item.person ? <PersonQuote person={item.person} expanded={false} /> : null}
558
550
  {children.length > 0 ? <StackLine rows={children} merged={!!item.closedAt} /> : null}
559
- </Pressable>
560
- {styles.compact ? buttons : null}
561
- {confirm ? (
562
- <View style={styles.panel}>
563
- <Text style={styles.text}>
564
- {confirm === "merge"
565
- ? `Merge PR ${item.target.number} into ${item.target.baseRefName} (${item.target.mergeMethod})?`
566
- : `Close PR ${item.target.number}? A comment is only posted if you write one.`}
567
- </Text>
568
- {confirm === "close" ? (
569
- <TextInput style={styles.input} placeholder="Closing comment (optional)" placeholderTextColor={styles.c.foregroundMuted} value={comment} onChangeText={setComment} multiline />
570
- ) : null}
571
- <View style={styles.wrap}>
572
- <Button label={confirm === "merge" ? "Merge" : "Close PR"} icon={confirm} variant="solid" onPress={() => (setConfirm(null), actions.confirm(item, confirm, comment))} />
573
- <Button label="Cancel" onPress={() => setConfirm(null)} />
574
- </View>
575
- </View>
576
- ) : null}
577
- </View>
578
- {styles.compact ? null : buttons}
579
- </View>
580
- {sheet === "item" ? (
581
- <ItemSheet item={item} agent={agent} actions={actions} {...handlers} />
582
- ) : null}
583
- {sheet === "acknowledge" ? <AcknowledgeSheet item={item} onReact={(ids) => (setSheet(null), actions.acknowledge(item, ids))} onClose={() => setSheet(null)} /> : null}
584
- {sheet && typeof sheet === "object" ? <SessionOptions item={item} kind={sheet.options} actions={actions} onClose={() => setSheet(null)} /> : null}
585
- </View>
551
+ </>
552
+ ) : null
553
+ }
554
+ onOpen={open}
555
+ busy={actions.busy === item.key}
556
+ primary={
557
+ agent && sessionKind
558
+ ? { label: CONTINUE_LABELS[sessionKind], icon: "agent", onPress: () => actions.openAgent(agent.id) }
559
+ : main
560
+ ? { label: actionLabel(main, item), icon: ACTION_ICONS[main], onPress: () => perform(main) }
561
+ : undefined
562
+ }
563
+ secondary={[
564
+ only ? { label: only.label, icon: only.icon, onPress: only.onPress } : { label: "More actions", icon: "dots", onPress: open },
565
+ // History is where I report from, so its cards copy their link in one tap [ATT-15].
566
+ ...(history ? [{ label: `Copy link to #${item.number}`, icon: "copy" as const, onPress: () => copy(item.url, `Copied link to #${item.number}`) }] : []),
567
+ ]}
568
+ confirm={
569
+ confirm === "merge"
570
+ ? {
571
+ text: `Merge PR ${item.target.number} into ${item.target.baseRefName} (${item.target.mergeMethod})?`,
572
+ choices: [{ label: "Merge", icon: "merge", solid: true, onConfirm: confirmed("merge") }],
573
+ onCancel: () => setConfirm(null),
574
+ }
575
+ : confirm === "close"
576
+ ? {
577
+ text: `Close PR ${item.target.number}? A comment is only posted if you write one.`,
578
+ comment: true,
579
+ choices: [{ label: "Close PR", icon: "close", solid: true, onConfirm: confirmed("close") }],
580
+ onCancel: () => setConfirm(null),
581
+ }
582
+ : null
583
+ }
584
+ overlay={
585
+ <>
586
+ {sheet === "item" ? <ItemSheet item={item} agent={agent} actions={actions} {...handlers} /> : null}
587
+ {sheet === "acknowledge" ? <AcknowledgeSheet item={item} onReact={(ids) => (setSheet(null), actions.acknowledge(item, ids))} onClose={() => setSheet(null)} /> : null}
588
+ {sheet && typeof sheet === "object" ? <SessionOptions item={item} kind={sheet.options} actions={actions} onClose={() => setSheet(null)} /> : null}
589
+ </>
590
+ }
591
+ />
586
592
  );
587
593
  }
588
594
 
@@ -741,13 +747,12 @@ function Sections({ sections, actions, empty }: { sections: Section[]; actions:
741
747
  }
742
748
 
743
749
  function Card({ items, actions }: { items: Item[]; actions: Actions }) {
744
- const styles = useStyles();
745
750
  return (
746
- <View style={styles.card}>
751
+ <CardList>
747
752
  {items.map((item, index) => (
748
753
  <ItemRow key={item.key} item={item} first={index === 0} actions={actions} />
749
754
  ))}
750
- </View>
755
+ </CardList>
751
756
  );
752
757
  }
753
758
 
@@ -827,7 +832,7 @@ function StackLine({ rows, merged, links = false }: { rows: SubRow[]; merged: bo
827
832
  <StackRow key={row.key} url={row.url} number={row.number} link={links}>
828
833
  <View style={{ width: 16, alignItems: "center" }}>
829
834
  <View style={{ width: 2, flex: 1, backgroundColor: index === 0 ? "transparent" : styles.c.border }} />
830
- <TablerIcon name={merged ? "merge" : row.draft ? "draft" : "pr"} size={14} color={merged ? styles.c.accent : row.draft ? styles.c.foregroundMuted : styles.c.statusSuccess} />
835
+ <TablerIcon name={merged ? "merge" : row.draft ? "draft" : "pr"} size={14} color={merged ? styles.c.statusSuccess : row.draft ? styles.c.foregroundMuted : styles.c.statusSuccess} />
831
836
  <View style={{ width: 2, flex: 1, backgroundColor: index === rows.length - 1 ? "transparent" : styles.c.border }} />
832
837
  </View>
833
838
  <View style={{ flex: 1, paddingVertical: 3, gap: 2 }}>
@@ -0,0 +1,129 @@
1
+ import { TextInput } from "@getpaseo/plugin/client/ui";
2
+ import { type ReactNode, useState } from "react";
3
+ import { Pressable, Text, View } from "react-native";
4
+ import type { Chip } from "../shared/attention";
5
+ import type { IconName } from "./icons";
6
+ import { Button, Meta, TablerIcon, toneColor, useStyles } from "./ui";
7
+
8
+ // Every card in every list has this anatomy; tabs fill it in with data and slots, not layout [ATT-05].
9
+ //
10
+ // [mark] title (2 lines at most) [actions] ← desktop
11
+ // place · when · signals
12
+ // extra (slot)
13
+ // [actions] ← phone, labelled
14
+ // confirm bar
15
+ //
16
+ // Colors come only from tones, so a card can't pick a theme color that some themes render plain.
17
+
18
+ export type Tone = Chip["tone"];
19
+
20
+ export interface CardAction {
21
+ label: string;
22
+ icon: IconName;
23
+ onPress: () => void;
24
+ // Defaults to the label.
25
+ accessibilityLabel?: string;
26
+ }
27
+
28
+ export interface ConfirmSpec {
29
+ text: string;
30
+ // A comment field whose text each choice receives.
31
+ comment?: boolean;
32
+ choices: { label: string; icon: IconName; solid?: boolean; onConfirm: (comment: string) => void }[];
33
+ onCancel: () => void;
34
+ }
35
+
36
+ export interface CardProps {
37
+ mark: { icon: IconName; tone: Tone };
38
+ title: string;
39
+ // "repo #number", then when it happened, then signals [ATT-05].
40
+ meta: { place: string; when?: string; signals: Chip[] };
41
+ // Defaults to "<title>, more".
42
+ accessibilityLabel?: string;
43
+ // Tapping the card opens its sheet [ATT-06].
44
+ onOpen: () => void;
45
+ // The labelled main action; secondary ones are icon-only (⋯, copy).
46
+ primary?: CardAction;
47
+ secondary: CardAction[];
48
+ // "working…" in place of the actions while a GitHub change runs.
49
+ busy?: boolean;
50
+ // Content only some lists have: tags, a quote, a stack line.
51
+ extra?: ReactNode;
52
+ confirm?: ConfirmSpec | null;
53
+ // Sheets and pickers opened from the card.
54
+ overlay?: ReactNode;
55
+ }
56
+
57
+ export function CardList({ children }: { children: ReactNode }) {
58
+ const styles = useStyles();
59
+ return <View style={styles.card}>{children}</View>;
60
+ }
61
+
62
+ export function CardRow({ first, mark, title, meta, accessibilityLabel, onOpen, primary, secondary, busy, extra, confirm, overlay }: CardProps & { first: boolean }) {
63
+ const styles = useStyles();
64
+ const actions = (
65
+ <View style={styles.wrap}>
66
+ {busy ? (
67
+ <Text style={styles.muted}>working…</Text>
68
+ ) : primary ? (
69
+ <Button label={primary.label} accessibilityLabel={primary.accessibilityLabel} icon={primary.icon} variant="calm" onPress={primary.onPress} />
70
+ ) : null}
71
+ {secondary.map((action) => (
72
+ <Button key={action.accessibilityLabel ?? action.label} icon={action.icon} variant="ghost" accessibilityLabel={action.accessibilityLabel ?? action.label} onPress={action.onPress} />
73
+ ))}
74
+ </View>
75
+ );
76
+ return (
77
+ <View style={first ? null : styles.divider}>
78
+ <View style={styles.item}>
79
+ <Mark {...mark} />
80
+ <View style={styles.body}>
81
+ <Pressable accessibilityRole="button" accessibilityLabel={accessibilityLabel ?? `${title}, more`} onPress={onOpen} style={{ gap: 6 }}>
82
+ <Text style={styles.title} numberOfLines={2}>
83
+ {title}
84
+ </Text>
85
+ <Meta facts={meta.when ? [meta.place, meta.when] : [meta.place]} chips={meta.signals} />
86
+ {extra}
87
+ </Pressable>
88
+ {/* On phones the actions sit under the text, labelled, so mixed actions stay readable. */}
89
+ {styles.compact ? actions : null}
90
+ {confirm ? <ConfirmBar {...confirm} /> : null}
91
+ </View>
92
+ {styles.compact ? null : actions}
93
+ </View>
94
+ {overlay}
95
+ </View>
96
+ );
97
+ }
98
+
99
+ // What the card is, as an icon on a softly tinted square.
100
+ export function Mark({ icon, tone }: { icon: IconName; tone: Tone }) {
101
+ const styles = useStyles();
102
+ const color = toneColor(styles, tone);
103
+ return (
104
+ <View style={{ width: 30, height: 30, borderRadius: 8, alignItems: "center", justifyContent: "center" }}>
105
+ <View style={{ position: "absolute", top: 0, left: 0, right: 0, bottom: 0, borderRadius: 8, backgroundColor: color, opacity: 0.16 }} />
106
+ <TablerIcon name={icon} size={17} color={color} />
107
+ </View>
108
+ );
109
+ }
110
+
111
+ // A change on GitHub asks first, on the card [SAFE-01].
112
+ export function ConfirmBar({ text, comment, choices, onCancel }: ConfirmSpec) {
113
+ const styles = useStyles();
114
+ const [value, setValue] = useState("");
115
+ return (
116
+ <View style={styles.panel}>
117
+ <Text style={styles.text}>{text}</Text>
118
+ {comment ? (
119
+ <TextInput style={styles.input} placeholder="Closing comment (optional)" placeholderTextColor={styles.c.foregroundMuted} value={value} onChangeText={setValue} multiline />
120
+ ) : null}
121
+ <View style={styles.wrap}>
122
+ {choices.map((choice) => (
123
+ <Button key={choice.label} label={choice.label} icon={choice.icon} variant={choice.solid ? "solid" : "plain"} onPress={() => choice.onConfirm(value)} />
124
+ ))}
125
+ <Button label="Cancel" variant="ghost" onPress={onCancel} />
126
+ </View>
127
+ </View>
128
+ );
129
+ }
@@ -1,5 +1,5 @@
1
1
  import { type PluginSurfaceProps, useRpc } from "@getpaseo/plugin/client";
2
- import { SettingsAction, SettingsCard, SettingsRow, SettingsSection, TextInput } from "@getpaseo/plugin/client/ui";
2
+ import { SettingsAction, SettingsCard, SettingsRow, SettingsSection, SettingsSelect, SettingsSwitch, TextInput } from "@getpaseo/plugin/client/ui";
3
3
  import { useQuery, useQueryClient } from "@tanstack/react-query";
4
4
  import { useState } from "react";
5
5
  import { Text, View } from "react-native";
@@ -9,8 +9,12 @@ import { VIEW_QUERY_KEY } from "./data";
9
9
  import { Button, StylesProvider, useStyles } from "./ui";
10
10
 
11
11
  const COVERAGE_QUERY_KEY = ["attention-span", "coverage"] as const;
12
+ const MY_ORGS_QUERY_KEY = ["attention-span", "my-orgs"] as const;
13
+ // A caption belongs to the card above it, so it sits closer to that card than to the next heading.
14
+ const CAPTION = { marginTop: -24, marginBottom: 16 };
12
15
 
13
- // Settings → Plugins → Attention Span: which orgs and repos the lists cover, saved to config.json [SRC-02].
16
+ // Settings → Plugins → Attention Span: which orgs and repos the lists cover, and where Next up looks,
17
+ // saved to config.json [SRC-02, NXT-04].
14
18
  export function CoverageSettings({ theme, layout }: PluginSurfaceProps) {
15
19
  return (
16
20
  <StylesProvider theme={theme} compact={layout.compact}>
@@ -24,6 +28,7 @@ function Coverage() {
24
28
  const queryClient = useQueryClient();
25
29
  const fetchCoverage = useRpc(rpc.getCoverage);
26
30
  const save = useRpc(rpc.setCoverage);
31
+ const saveNextUp = useRpc(rpc.setNextUpSources);
27
32
  const coverage = useQuery({ queryKey: COVERAGE_QUERY_KEY, queryFn: () => fetchCoverage({}) });
28
33
  const [saving, setSaving] = useState(false);
29
34
  const [error, setError] = useState<string | null>(null);
@@ -36,7 +41,7 @@ function Coverage() {
36
41
  </SettingsCard>
37
42
  </SettingsSection>
38
43
  );
39
- const { orgs, repos } = coverage.data;
44
+ const { orgs, repos, nextUp } = coverage.data;
40
45
  // A file that doesn't parse is left for the person who edited it.
41
46
  if (coverage.data.error)
42
47
  return (
@@ -48,11 +53,11 @@ function Coverage() {
48
53
  );
49
54
 
50
55
  // Saving refreshes the lists on the daemon; the screen picks them up on its next read.
51
- async function persist(next: Pick<ConfigStatus, "orgs" | "repos">) {
56
+ async function write(next: Partial<ConfigStatus>, send: () => Promise<unknown>) {
52
57
  setSaving(true);
53
58
  setError(null);
54
59
  try {
55
- await save(next);
60
+ await send();
56
61
  queryClient.setQueryData(COVERAGE_QUERY_KEY, { ...coverage.data!, ...next });
57
62
  await queryClient.invalidateQueries({ queryKey: VIEW_QUERY_KEY });
58
63
  } catch (failure) {
@@ -61,6 +66,9 @@ function Coverage() {
61
66
  setSaving(false);
62
67
  }
63
68
  }
69
+ const persist = (next: Pick<ConfigStatus, "orgs" | "repos">) => write(next, () => save(next));
70
+ const persistNextUp = (next: ConfigStatus["nextUp"]) => write({ nextUp: next }, () => saveNextUp(next));
71
+ const chosen = nextUp.mine || nextUp.orgs.length > 0 || nextUp.repos.length > 0;
64
72
 
65
73
  return (
66
74
  <View style={{ gap: 24 }}>
@@ -72,21 +80,33 @@ function Coverage() {
72
80
  <AddRow kind="org" existing={orgs} disabled={saving} onAdd={(name) => persist({ orgs: [...orgs, name], repos })} />
73
81
  </SettingsCard>
74
82
  </SettingsSection>
75
- <SettingsSection title="Repositories">
76
- <SettingsCard>
77
- {repos.map((repo) => (
78
- <SettingsAction key={repo} label={repo} actionLabel="Remove" disabled={saving} onPress={() => void persist({ orgs, repos: repos.filter((other) => other !== repo) })} />
79
- ))}
80
- <AddRow kind="repo" existing={repos} disabled={saving} onAdd={(name) => persist({ orgs, repos: [...repos, name] })} />
81
- </SettingsCard>
82
- </SettingsSection>
83
- <View style={{ gap: 4 }}>
84
- {error ? <Text style={styles.danger}>{error}</Text> : null}
85
- <Text style={styles.muted}>
83
+ <View style={{ gap: 8 }}>
84
+ <SettingsSection title="Repositories">
85
+ <SettingsCard>
86
+ {repos.map((repo) => (
87
+ <SettingsAction key={repo} label={repo} actionLabel="Remove" disabled={saving} onPress={() => void persist({ orgs, repos: repos.filter((other) => other !== repo) })} />
88
+ ))}
89
+ <AddRow kind="repo" existing={repos} disabled={saving} onAdd={(name) => persist({ orgs, repos: [...repos, name] })} />
90
+ </SettingsCard>
91
+ </SettingsSection>
92
+ <Text style={[styles.muted, CAPTION]}>
86
93
  {orgs.length || repos.length
87
- ? "Attention Span only shows pull requests and issues from the organizations and repositories above. Next up suggests unclaimed issues from them too."
88
- : "With none chosen, Attention Span shows everything on GitHub that involves you, and Next up suggests issues from your Paseo projects' repositories."}
94
+ ? "Attention Span only shows pull requests and issues from the organizations and repositories above."
95
+ : "With none chosen, Attention Span shows everything on GitHub that involves you."}
96
+ </Text>
97
+ </View>
98
+ <View style={{ gap: 8 }}>
99
+ <NextUpSources value={nextUp} disabled={saving} onChange={persistNextUp} />
100
+ <Text style={[styles.muted, CAPTION]}>
101
+ {chosen
102
+ ? "Next up suggests unclaimed issues from these."
103
+ : orgs.length || repos.length
104
+ ? "None chosen: using the orgs and repos above."
105
+ : "None chosen: using your Paseo projects."}
89
106
  </Text>
107
+ </View>
108
+ <View style={{ gap: 4 }}>
109
+ {error ? <Text style={styles.danger}>{error}</Text> : null}
90
110
  {/* Until more moves here, point to the file for the rest. */}
91
111
  <Text style={styles.muted}>Settings are not complete yet. Until then, check out your ~/.config/paseo-attention-span/config.json for more options.</Text>
92
112
  </View>
@@ -94,8 +114,41 @@ function Coverage() {
94
114
  );
95
115
  }
96
116
 
117
+ // Where Next up looks [NXT-04]: my own repos, orgs I belong to, and single repos. Each is its own chip on Next up [NXT-09].
118
+ function NextUpSources({ value, disabled, onChange }: { value: ConfigStatus["nextUp"]; disabled: boolean; onChange: (next: ConfigStatus["nextUp"]) => Promise<void> }) {
119
+ const fetchOrgs = useRpc(rpc.myOrgs);
120
+ const myOrgs = useQuery({ queryKey: MY_ORGS_QUERY_KEY, queryFn: () => fetchOrgs({}) });
121
+ const choosable = (myOrgs.data?.orgs ?? []).filter((org) => !value.orgs.some((added) => added.toLowerCase() === org.toLowerCase()));
122
+ return (
123
+ <SettingsSection title="Next up">
124
+ <SettingsCard>
125
+ <SettingsSwitch label="My repos" value={value.mine} disabled={disabled} onValueChange={(mine) => void onChange({ ...value, mine })} />
126
+ {value.orgs.map((org) => (
127
+ <SettingsAction key={`org:${org}`} label={org} actionLabel="Remove" disabled={disabled} onPress={() => void onChange({ ...value, orgs: value.orgs.filter((other) => other !== org) })} />
128
+ ))}
129
+ {value.repos.map((repo) => (
130
+ <SettingsAction key={`repo:${repo}`} label={repo} actionLabel="Remove" disabled={disabled} onPress={() => void onChange({ ...value, repos: value.repos.filter((other) => other !== repo) })} />
131
+ ))}
132
+ {myOrgs.data && myOrgs.data.orgs.length === 0 ? (
133
+ <SettingsRow label="Add an organization" hint="You're not a member of any organizations" />
134
+ ) : (
135
+ <SettingsSelect
136
+ label="Add an organization"
137
+ error={myOrgs.error ? (myOrgs.error as Error).message : null}
138
+ value=""
139
+ options={[{ label: myOrgs.isLoading ? "Loading…" : "Choose…", value: "" }, ...choosable.map((org) => ({ label: org, value: org }))]}
140
+ disabled={disabled || choosable.length === 0}
141
+ onValueChange={(org) => void (org && onChange({ ...value, orgs: [...value.orgs, org] }))}
142
+ />
143
+ )}
144
+ <AddRow kind="repo" placeholder="owner/name" existing={value.repos} disabled={disabled} onAdd={(name) => onChange({ ...value, repos: [...value.repos, name] })} />
145
+ </SettingsCard>
146
+ </SettingsSection>
147
+ );
148
+ }
149
+
97
150
  // Each name is checked on GitHub before it's saved; GitHub's exact name is what's kept.
98
- function AddRow({ kind, existing, disabled, onAdd }: { kind: CoverageKind; existing: string[]; disabled: boolean; onAdd: (name: string) => Promise<void> }) {
151
+ function AddRow({ kind, placeholder, existing, disabled, onAdd }: { kind: CoverageKind; placeholder?: string; existing: string[]; disabled: boolean; onAdd: (name: string) => Promise<void> }) {
99
152
  const styles = useStyles();
100
153
  const check = useRpc(rpc.checkCoverage);
101
154
  const [text, setText] = useState("");
@@ -130,7 +183,7 @@ function AddRow({ kind, existing, disabled, onAdd }: { kind: CoverageKind; exist
130
183
  setText(value);
131
184
  setError(null);
132
185
  }}
133
- placeholder={kind === "org" ? "acme" : "acme/shop"}
186
+ placeholder={placeholder ?? (kind === "org" ? "acme" : "acme/shop")}
134
187
  placeholderTextColor={styles.c.foregroundMuted}
135
188
  autoCapitalize="none"
136
189
  autoCorrect={false}
package/client/icons.ts CHANGED
@@ -37,6 +37,7 @@ export const ICONS = {
37
37
  settings: { svg: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\"><path d=\"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 0 0-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 0 0-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 0 0-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 0 0-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 0 0 1.066-2.573c-.94-1.543.826-3.31 2.37-2.37c1 .608 2.296.07 2.572-1.065\"/><path d=\"M9 12a3 3 0 1 0 6 0a3 3 0 0 0-6 0\"/></g></svg>" },
38
38
  reload: { svg: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M19.933 13.041a8 8 0 1 1-9.925-8.788c3.899-1 7.935 1.007 9.425 4.747M20 4v5h-5\"/></svg>" },
39
39
  unclaim: { svg: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M8 7a4 4 0 1 0 8 0a4 4 0 0 0-8 0M6 21v-2a4 4 0 0 1 4-4h4c.348 0 .686.045 1.009.128M16 19h6\"/></svg>" },
40
+ filter: { svg: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M4 4h16v2.172a2 2 0 0 1-.586 1.414L15 12v7l-6 2v-8.5L4.52 7.572A2 2 0 0 1 4 6.227z\"/></svg>" },
40
41
  square: { svg: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M3 5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z\"/></svg>" },
41
42
  squareCheck: { svg: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M3 5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2zm6 7l2 2l4-4\"/></svg>" },
42
43
  // Tabler message-ai: marks actions that start or continue an agent session.