@andrioid/paseo-attention-span 0.4.8 → 0.4.10

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.
Files changed (46) hide show
  1. package/OVERVIEW.md +11 -7
  2. package/client/attention-screen.tsx +50 -52
  3. package/client/card.tsx +34 -11
  4. package/client/coverage-settings.tsx +36 -1
  5. package/client/entity.tsx +118 -0
  6. package/client/feedback.tsx +2 -2
  7. package/client/icons.ts +5 -0
  8. package/client/next-up.tsx +145 -74
  9. package/client/sessions.ts +2 -2
  10. package/client/sheet.tsx +92 -11
  11. package/client/ui.tsx +167 -10
  12. package/docs/architecture.md +16 -9
  13. package/docs/screenshots/desktop-dark-doing-acknowledge.png +0 -0
  14. package/docs/screenshots/desktop-dark-doing-clear.png +0 -0
  15. package/docs/screenshots/desktop-dark-doing-issue-sheet.png +0 -0
  16. package/docs/screenshots/desktop-dark-doing-reviewers.png +0 -0
  17. package/docs/screenshots/desktop-dark-doing-sheet.png +0 -0
  18. package/docs/screenshots/desktop-dark-doing.png +0 -0
  19. package/docs/screenshots/desktop-dark-history-reviewed.png +0 -0
  20. package/docs/screenshots/desktop-dark-history.png +0 -0
  21. package/docs/screenshots/desktop-dark-next-up.png +0 -0
  22. package/docs/screenshots/desktop-dark-settings.png +0 -0
  23. package/docs/screenshots/desktop-dark-setup.png +0 -0
  24. package/docs/screenshots/desktop-dark-waiting-too-long.png +0 -0
  25. package/docs/screenshots/desktop-dark-waiting.png +0 -0
  26. package/docs/screenshots/phone-dark-doing.png +0 -0
  27. package/docs/screenshots/phone-light-next-up-filtered.png +0 -0
  28. package/index.server.ts +2 -0
  29. package/package.json +2 -2
  30. package/requirements.yaml +8 -5
  31. package/server/classify.ts +76 -29
  32. package/server/details.ts +3 -2
  33. package/server/fixture.ts +34 -10
  34. package/server/gh.ts +29 -12
  35. package/server/github-types.ts +19 -2
  36. package/server/projects.ts +47 -0
  37. package/server/queries.ts +41 -6
  38. package/server/rules.ts +10 -15
  39. package/server/service.ts +138 -22
  40. package/server/store.ts +15 -4
  41. package/server/view.ts +7 -2
  42. package/shared/attention.ts +72 -6
  43. package/shared/hint.ts +21 -0
  44. package/shared/opening.ts +31 -0
  45. package/shared/rpc.ts +5 -1
  46. package/docs/screenshots/desktop-dark-doing-too-long.png +0 -0
package/OVERVIEW.md CHANGED
@@ -6,7 +6,7 @@ There are four tabs. I think of them as a little story: what needs me now, what'
6
6
 
7
7
  ## Doing: what needs you now
8
8
 
9
- This is the one you'll live in. It's split by reason: someone's waiting for your reply, someone answered your question, a review's been requested, CI's failing, changes were requested, it's ready to merge, it needs upstream, it's waited too long, nobody's been asked to review it yet, or it's one of your drafts.
9
+ This is the one you'll live in. It's split by reason: someone's waiting for your reply, someone answered your question, a review's been requested, CI's failing, changes were requested, it's ready to merge, it needs upstream, nobody's been asked to review it yet, or it's one of your drafts. Only things you can act on, though. Nudging people lives in Waiting.
10
10
 
11
11
  ![Doing](docs/screenshots/desktop-dark-doing.png)
12
12
 
@@ -37,15 +37,17 @@ A PR you opened isn't waiting on anyone until you've asked someone to review it,
37
37
 
38
38
  ![Request review](docs/screenshots/desktop-dark-doing-reviewers.png)
39
39
 
40
- Anything that's sat in Waiting for more than three days shows up here too, under **Waiting too long**. Usually that means someone forgot, and sometimes the someone is me.
41
-
42
- ![Waiting too long](docs/screenshots/desktop-dark-doing-too-long.png)
43
-
44
40
  ## Waiting: out of your hands
45
41
 
46
42
  This is your work where someone else has the next move: the review you asked for, the reviewer looking again, CI running, or a question you asked that nobody's answered yet. Only questions count: a comment that just tells people something, even one that tags them, isn't waiting on anyone.
47
43
 
48
- It's grouped by who you're waiting on, whoever blocks the most first, and each item says why and for how long. Work with a session that's running or needs you leads its group. Who counts only when it's on record: the reviewers you asked, the reviewer who asked for changes, or the people you tagged in your question. Work that waits on nobody in particular, like CI or a repo rule, sits at the bottom rather than under a guess. Work that waited too long shows here as well as in Doing.
44
+ It's grouped by who you're waiting on, whoever blocks the most first, and each item says why and for how long. Work with a session that's running or needs you leads its group. Who counts only when it's on record: the reviewers you asked, the reviewer who asked for changes, or the people you tagged in your question. Work that waits on nobody in particular, like CI or a repo rule, sits at the bottom rather than under a guess.
45
+
46
+ Your PRs in Doing show up here too while someone you asked still hasn't reviewed them, even once they're approved. Merging is your call, but you might still want to nudge the person you asked.
47
+
48
+ After three days an item's age turns amber, with a little ⌛. Usually that means someone forgot, and sometimes the someone is me. It only does that when a nudge would be fair, so not while CI is failing or still running, or while there are conflicts, changes to make or a reply you owe. Point at it to see why.
49
+
50
+ ![Waited too long](docs/screenshots/desktop-dark-waiting-too-long.png)
49
51
 
50
52
  When someone needs a nudge, **Copy list** next to their name copies their items oldest first, one line each like "Review 2h: [title](link)", ready to paste into a message. Otherwise there's nothing to do here. That's the point. It's tracked, so you can stop holding it in your head.
51
53
 
@@ -53,7 +55,9 @@ When someone needs a nudge, **Copy list** next to their name copies their items
53
55
 
54
56
  ## Next up: for when your plate is clear
55
57
 
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.
58
+ 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. Each fact sits in a small pill with an icon, so "Medium" never leaves you guessing whether it's priority or effort, and priority wears the color your org gave it.
59
+
60
+ If your issues live on GitHub project boards, Next up shows which board and column each one is in, and the filter lets you pick boards and their columns: only TODO's Todo, say, and leave Ideas out. That needs one more permission than `gh` asks for by default; Settings tells you the command (`gh auth refresh -s read:project`) and until then everything else works as before.
57
61
 
58
62
  ![Next up](docs/screenshots/desktop-dark-next-up.png)
59
63
 
@@ -1,12 +1,12 @@
1
1
  import type { RpcInput, RpcOutput } from "@getpaseo/plugin";
2
2
  import { openExternalUrl, type PluginScreenProps, usePaseo, useRpc } from "@getpaseo/plugin/client";
3
- import { Markdown, Modal, TextInput, useToast } from "@getpaseo/plugin/client/ui";
3
+ import { Markdown, TextInput, useToast } from "@getpaseo/plugin/client/ui";
4
4
  import { useQuery, useQueryClient } from "@tanstack/react-query";
5
5
  import { type ReactNode, useState } from "react";
6
6
  import { Pressable, ScrollView, Text, View } from "react-native";
7
7
  import { type ActionId, type AgentSummary, type AttentionView, type Chip, checkoutPr, type FailingChecks, type Item, itemSessions, liftActive, looseSessions, type NextUpIssue, ownStack, type PersonRole, type Reviewer, type Section, type SectionId, SECTIONS, type SubRow, TAB_FEED, type TabId, type Target, type WaitingGroup, type WaitingOn } from "../shared/attention";
8
8
  import { type AttentionConfig, nextUpSources, type SessionKind } from "../shared/config";
9
- import { ago, linkList, repoLabel } from "../shared/format";
9
+ import { ago, linkList } from "../shared/format";
10
10
  import { isClear } from "../shared/still";
11
11
  import { workEmoji } from "../shared/work";
12
12
  import { ACTION_SESSION, renderPrompt } from "../shared/prompts";
@@ -16,15 +16,16 @@ import { blocks } from "../shared/setup";
16
16
  import { useAttention } from "./data";
17
17
  import { CardList, CardRow, type CardProps } from "./card";
18
18
  import type { IconName } from "./icons";
19
+ import { NumberText, PlaceText } from "./entity";
19
20
  import { NextUpList } from "./next-up";
20
21
  import { Still } from "./still";
21
22
  import { agentSignal, sessionEntry, startAnotherEntry } from "./session-menu";
22
- import { ActionSheet, DetailLines, type SheetEntry } from "./sheet";
23
+ import { ActionSheet, cancelPendingOpen, DETAILS_STALE_MS, DetailLines, type DetailsQuery, detailsKey, Modal, type SheetEntry, useSheetOpener } from "./sheet";
23
24
  import { FeedbackAsk, FeedbackLine, type FeedbackScreen, FeedbackSheet } from "./feedback";
24
25
  import { branchWorkspaces, type FetchProviders, findCheckout, githubProjects, itemAgents, listProfiles, noProjectMessage, resolveAgentConfig, startSession } from "./sessions";
25
26
  import { SetupChecklist } from "./setup";
26
27
  import { UpdateNotice } from "./update";
27
- import { Avatar, Button, KeepStyles, Loading, Meta, SectionHeader, SpinningIcon, StylesProvider, TablerIcon, Toggle, useCopy, useHover, useStyles } from "./ui";
28
+ import { Avatar, Button, Hint, KeepStyles, Loading, Meta, SectionHeader, SpinningIcon, StylesProvider, TablerIcon, Toggle, useCopy, useHover, useStyles } from "./ui";
28
29
 
29
30
  // The agent icon marks every action that starts an agent session; the rest act on GitHub right away [ATT-13].
30
31
  const ACTION_ICONS: Record<ActionId, IconName> = {
@@ -118,7 +119,6 @@ const SECTION_ICONS: Record<SectionId, IconName> = {
118
119
  changes: "changes",
119
120
  ready: "merge",
120
121
  upstream: "branch",
121
- too_long: "hourglass",
122
122
  needs_reviewer: "claim",
123
123
  drafts: "pencil",
124
124
  wait_review: "review",
@@ -195,6 +195,7 @@ function AttentionList({
195
195
  const restore = useRpc(rpc.restoreDismissed);
196
196
  const saveScopes = useRpc(rpc.setScopes);
197
197
  const saveSources = useRpc(rpc.setSources);
198
+ const saveProjects = useRpc(rpc.setProjectFilter);
198
199
  const closeIssue = useRpc(rpc.closeIssue);
199
200
  const reopenIssue = useRpc(rpc.reopenIssue);
200
201
  const update = useRpc(rpc.updateBranch);
@@ -400,7 +401,7 @@ function AttentionList({
400
401
  <Text style={styles.muted}>{feed.fetchedAt ? `${ago(feed.fetchedAt)} ago` : "never"}</Text>
401
402
  </Pressable>
402
403
  {openSettings ? (
403
- <Pressable accessibilityRole="button" accessibilityLabel="Attention Span settings" onPress={openSettings} hitSlop={8}>
404
+ <Pressable accessibilityRole="button" accessibilityLabel="Attention Span settings" onPress={() => (cancelPendingOpen(), openSettings())} hitSlop={8}>
404
405
  <TablerIcon name="settings" size={16} />
405
406
  </Pressable>
406
407
  ) : null}
@@ -450,12 +451,15 @@ function AttentionList({
450
451
  selected={view.scopes}
451
452
  sources={nextUpSources(view.config)}
452
453
  selectedSources={view.sources}
453
- // One setView for both, so clearing scopes and sources together can't put either back.
454
+ projects={view.projects}
455
+ selectedProjects={view.projectFilter}
456
+ // One setView for all, so clearing them together can't put any back.
454
457
  onFilter={(change) => {
455
458
  attention.setView({ ...view, ...change });
456
459
  const failed = (error: Error) => toast.error(`Saving the filter failed: ${error.message}`);
457
460
  if (change.scopes) saveScopes({ scopes: change.scopes }).catch(failed);
458
461
  if (change.sources) saveSources({ sources: change.sources }).catch(failed);
462
+ if (change.projectFilter) saveProjects({ projects: change.projectFilter }).catch(failed);
459
463
  }}
460
464
  agents={actions.agents}
461
465
  login={view.login}
@@ -569,17 +573,17 @@ type Sheet = "item" | "acknowledge" | "reviewers" | "reviewers-after-ready" | nu
569
573
  // A session on an item that has no session action of its own starts with this prompt; it's editable first.
570
574
  const fallbackKind = (item: Item): SessionKind => (item.target.kind === "issue" ? "start" : "review");
571
575
 
572
- // How long it has waited, and why: in Waiting with a flag once it's too long, in Doing's Waiting too long as its own warning [WAI-01, ATT-11].
573
- function waitChips(item: Item, inWaiting: boolean): Chip[] {
576
+ // Why it waits and how long, in Waiting only; Doing says what's mine to do. Once it has waited too long, where nudging is
577
+ // fair, the age itself turns amber with ⌛ and says so in words [WAI-01, ATT-11].
578
+ function waitChips(item: Item, inWaiting: boolean, tooLongDays: number): Chip[] {
574
579
  const { wait } = item;
575
- if (!wait) return [];
580
+ if (!wait || !inWaiting) return [];
576
581
  const age = ago(wait.since);
577
- if (!inWaiting) return wait.overdue ? [{ text: `${wait.overdue} · ${age}`, tone: "warn" }] : [];
578
- return [
579
- ...(wait.overdue ? [{ text: "waited too long", tone: "warn" as const }] : []),
580
- ...(wait.reason ? [{ text: wait.reason, tone: "neutral" as const }] : []),
581
- { text: age, tone: "neutral" },
582
- ];
582
+ const reason: Chip[] = wait.reason ? [{ text: wait.reason, tone: "neutral" }] : [];
583
+ if (!wait.tooLong) return [...reason, { text: age, tone: "neutral" }];
584
+ const since = wait.reason === "question" ? "you asked" : "your last push or reply";
585
+ const limit = `${tooLongDays} day${tooLongDays === 1 ? "" : "s"}`;
586
+ return [...reason, { text: age, tone: "warn", icon: "hourglass", hint: `Waited too long: ${age} since ${since}, more than ${limit}` }];
583
587
  }
584
588
 
585
589
  // "Review 2h", "Question 3d": why and how long, to lead a line in a nudge [WAI-03].
@@ -596,7 +600,7 @@ function ItemRow({ item, first, actions, group }: { item: Item; first: boolean;
596
600
  const styles = useStyles();
597
601
  // An open session leads; without one, the item's own action does [SES-03].
598
602
  const sessions = itemSessions(actions.agents, item);
599
- const own = [...waitChips(item, !!group), ...item.chips];
603
+ const own = [...waitChips(item, !!group, actions.config.waitingTooLongDays), ...item.chips];
600
604
  const chips = sessions[0] ? [...own, agentSignal(sessions[0])] : own;
601
605
  // The group names one; the card names the rest [WAI-01].
602
606
  const others = group?.who ? (item.waitingOn ?? []).filter((who) => !samePerson(who, group.who!)) : [];
@@ -607,11 +611,15 @@ function ItemRow({ item, first, actions, group }: { item: Item; first: boolean;
607
611
  const main = item.actions[0];
608
612
  // The full stack is in the sheet; the card shows the PRs that need attention [ATT-04].
609
613
  const children = item.children.filter((child) => child.attention || isRed(child.chips));
610
- const open = () => setSheet("item");
614
+ // The sheet opens once its details are in; meanwhile › spins [ATT-06].
615
+ const opener = useSheetOpener(itemDetailsQuery(item, actions.fetchDetails), () => setSheet("item"));
616
+ const open = opener.open;
611
617
  const copy = useCopy();
612
618
  const history = SECTIONS[item.section].tab === "history";
613
619
 
614
620
  function perform(action: ActionId) {
621
+ // An action opening its own sheet wins over a details sheet still waiting to open [ATT-06].
622
+ cancelPendingOpen();
615
623
  setSheet(null);
616
624
  if (action === "merge" || action === "close") setConfirm(action);
617
625
  else if (action === "acknowledge") setSheet("acknowledge");
@@ -632,7 +640,7 @@ function ItemRow({ item, first, actions, group }: { item: Item; first: boolean;
632
640
  mark={stateMark(item)}
633
641
  title={item.title}
634
642
  meta={{
635
- place: `${repoLabel(item.repo, actions.login)} #${item.number}`,
643
+ place: { repo: item.repo, number: item.number, login: actions.login },
636
644
  when: item.closedAt ? `${item.kind === "pr" ? "merged" : "closed"} ${ago(item.closedAt)} ago` : undefined,
637
645
  signals: chips,
638
646
  }}
@@ -647,6 +655,8 @@ function ItemRow({ item, first, actions, group }: { item: Item; first: boolean;
647
655
  ) : null
648
656
  }
649
657
  onOpen={open}
658
+ opening={opener.opening}
659
+ hover={opener.hover}
650
660
  busy={actions.busy.has(item.key)}
651
661
  primary={
652
662
  sessions[0]
@@ -701,14 +711,17 @@ interface SheetHandlers {
701
711
  }
702
712
 
703
713
  // What the card already knows on top, then every action, then what's fetched when it opens, so nothing jumps as it loads [ATT-06, GH-01].
704
- function ItemSheet({ item, chips, sessions, actions, ...handlers }: { item: Item; chips: Chip[]; sessions: AgentSummary[]; actions: Actions } & SheetHandlers) {
714
+ // What an item's sheet fetches when it opens; its card fetches the same ahead, so the sheet opens complete [ATT-06].
715
+ // `checks` asks for failing checks too, for Rerun.
716
+ function itemDetailsQuery(item: Item, fetchDetails: FetchDetails): DetailsQuery {
705
717
  const checks = item.actions.includes("rerun");
706
- const details = useQuery({
707
- queryKey: ["attention-span", "details", item.key, checks],
708
- queryFn: () => actions.fetchDetails({ subject: { kind: item.kind, repo: item.repo, number: item.number }, target: item.target, checks }),
709
- staleTime: 60_000,
710
- });
711
- const meta = [`${item.repo}#${item.number}`, ...(item.target.number !== item.number ? [`actions apply to PR #${item.target.number}`] : [])];
718
+ const subject = { kind: item.kind, repo: item.repo, number: item.number };
719
+ return { queryKey: detailsKey(subject, item.target, checks), queryFn: () => fetchDetails({ subject, target: item.target, checks }) };
720
+ }
721
+
722
+ function ItemSheet({ item, chips, sessions, actions, ...handlers }: { item: Item; chips: Chip[]; sessions: AgentSummary[]; actions: Actions } & SheetHandlers) {
723
+ const details = useQuery({ ...itemDetailsQuery(item, actions.fetchDetails), staleTime: DETAILS_STALE_MS });
724
+ const meta = item.target.number !== item.number ? [`actions apply to PR #${item.target.number}`] : [];
712
725
  // PRs already in the stack line link from there; list only the rest, like someone else's PR closing the same issue.
713
726
  const shown = new Set(item.children.map((child) => child.url));
714
727
  const extra = details.data && { ...details.data, linked: details.data.linked.filter((link) => !shown.has(link.url)) };
@@ -718,14 +731,16 @@ function ItemSheet({ item, chips, sessions, actions, ...handlers }: { item: Item
718
731
  onClose={handlers.onClose}
719
732
  top={
720
733
  <>
721
- <Meta facts={meta} chips={chips} />
734
+ {/* Number first, as on the card; the sheet always names the owner, even of my own repos [ATT-20]. */}
735
+ <Meta lead={<PlaceText place={{ repo: item.repo, number: item.number, login: null }} />} facts={meta} chips={chips} />
722
736
  {item.person ? <PersonQuote person={item.person} expanded /> : null}
723
737
  {item.waitingOn ? <WaitingOnLine people={item.waitingOn} asked={item.wait?.reason === "question"} expanded /> : null}
724
738
  {item.children.length > 0 ? <StackLine rows={item.children} merged={!!item.closedAt} links /> : null}
725
739
  </>
726
740
  }
727
741
  entries={sheetEntries(item, sessions, actions, handlers, details)}
728
- bottom={<DetailLines details={extra} loading={details.isLoading} error={details.error} linkedLabel={item.kind === "issue" ? "PR" : "Closes"} />}
742
+ // The PR its actions apply to has a size line; an issue's PRs are in its stack line already, so few more come [ATT-06].
743
+ bottom={<DetailLines details={extra} loading={details.isLoading} error={details.error} linkedLabel={item.kind === "issue" ? "PR" : "Closes"} expected={item.target.kind === "pr" ? 1 : 0} />}
729
744
  />
730
745
  );
731
746
  }
@@ -929,23 +944,6 @@ function ReviewerSheet({
929
944
  // reads like Waiting, and whose comments are left like Changes requested [ATT-19].
930
945
  const ROLE_ICON: Record<PersonRole | "waiting", IconName> = { waiting: "hourglass", author: "pencil", changes: "changes" };
931
946
 
932
- // A line that says what it means in words on hover, and to screen readers; phones rely on the icon [ATT-19]. The words sit
933
- // beside the line in its flow, not floating over it, so a card's clipping can't cut them off: they wrap where space runs out.
934
- function Explained({ text, children }: { text: string; children: ReactNode }) {
935
- const styles = useStyles();
936
- const [hovered, setHovered] = useState(false);
937
- return (
938
- <View accessibilityLabel={text} onPointerEnter={() => setHovered(true)} onPointerLeave={() => setHovered(false)} style={{ alignSelf: "flex-start", flexDirection: "row", alignItems: "center", gap: 8 }}>
939
- <View style={{ flexShrink: 0 }}>{children}</View>
940
- {hovered ? (
941
- <View style={{ flexShrink: 1, backgroundColor: styles.c.surface2, borderColor: styles.c.border, borderWidth: 1, borderRadius: 6, paddingVertical: 2, paddingHorizontal: 8 }}>
942
- <Text style={{ color: styles.c.foreground, fontSize: 12 }}>{text}</Text>
943
- </View>
944
- ) : null}
945
- </View>
946
- );
947
- }
948
-
949
947
  // The icon sits tight against the faces it explains, apart from the name and time, so they read as one.
950
948
  function Badged({ role, children }: { role: keyof typeof ROLE_ICON; children: ReactNode }) {
951
949
  const styles = useStyles();
@@ -965,7 +963,7 @@ function PersonQuote({ person, expanded }: { person: NonNullable<Item["person"]>
965
963
  if (!person.snippet && person.role) {
966
964
  const text = person.role === "author" ? `Opened by ${person.login}` : `${person.login}'s comments are left to address, since your last push ${ago(person.since)} ago`;
967
965
  return (
968
- <Explained text={text}>
966
+ <Hint text={text}>
969
967
  <View style={styles.row}>
970
968
  <Badged role={person.role}>
971
969
  <Avatar url={person.avatarUrl} bot={person.bot} />
@@ -973,7 +971,7 @@ function PersonQuote({ person, expanded }: { person: NonNullable<Item["person"]>
973
971
  {name}
974
972
  {person.role === "author" ? null : <Text style={styles.muted}>· {ago(person.since)}</Text>}
975
973
  </View>
976
- </Explained>
974
+ </Hint>
977
975
  );
978
976
  }
979
977
  const line = (
@@ -1013,7 +1011,7 @@ function WaitingOnLine({ people, asked, expanded }: { people: WaitingOn[]; asked
1013
1011
  return (
1014
1012
  <View style={{ gap: 6 }}>
1015
1013
  {people.map((who) => (
1016
- <Explained key={who.login} text={explain([who.login], who.since)}>
1014
+ <Hint key={who.login} text={explain([who.login], who.since)}>
1017
1015
  <View style={styles.row}>
1018
1016
  <Badged role="waiting">
1019
1017
  <Avatar url={who.avatarUrl} team={who.team} />
@@ -1021,14 +1019,14 @@ function WaitingOnLine({ people, asked, expanded }: { people: WaitingOn[]; asked
1021
1019
  {name(who.login)}
1022
1020
  {since(who.since)}
1023
1021
  </View>
1024
- </Explained>
1022
+ </Hint>
1025
1023
  ))}
1026
1024
  </View>
1027
1025
  );
1028
1026
  }
1029
1027
  const earliest = people.map((who) => who.since).sort()[0];
1030
1028
  return (
1031
- <Explained text={explain(people.map((who) => who.login), earliest)}>
1029
+ <Hint text={explain(people.map((who) => who.login), earliest)}>
1032
1030
  <View style={styles.row}>
1033
1031
  <Badged role="waiting">
1034
1032
  <View style={{ flexDirection: "row", alignItems: "center", gap: 4 }}>
@@ -1043,7 +1041,7 @@ function WaitingOnLine({ people, asked, expanded }: { people: WaitingOn[]; asked
1043
1041
  {hovered ? name(hovered) : null}
1044
1042
  {since(earliest)}
1045
1043
  </View>
1046
- </Explained>
1044
+ </Hint>
1047
1045
  );
1048
1046
  }
1049
1047
 
@@ -1185,7 +1183,7 @@ function StackLine({ rows, merged, links = false }: { rows: SubRow[]; merged: bo
1185
1183
  <Text style={{ color: styles.c.foreground, fontSize: 13 }} numberOfLines={1}>
1186
1184
  {row.title}
1187
1185
  </Text>
1188
- <Meta facts={[`#${row.number}`]} chips={row.chips} />
1186
+ <Meta lead={<NumberText number={row.number} />} facts={[]} chips={row.chips} />
1189
1187
  </View>
1190
1188
  {links ? (
1191
1189
  <View style={{ justifyContent: "center", paddingHorizontal: 4 }}>
package/client/card.tsx CHANGED
@@ -3,12 +3,14 @@ import { type ReactNode, useState } from "react";
3
3
  import { ActivityIndicator, Pressable, Text, View } from "react-native";
4
4
  import type { Chip } from "../shared/attention";
5
5
  import type { IconName } from "./icons";
6
- import { Button, Meta, TablerIcon, toneColor, useStyles } from "./ui";
6
+ import { type Place, PlaceText } from "./entity";
7
+ import { cancelPendingOpen } from "./sheet";
8
+ import { Button, HintArea, Meta, TablerIcon, toneColor, useStyles } from "./ui";
7
9
 
8
10
  // Every card in every list has this anatomy; tabs fill it in with data and slots, not layout [ATT-05].
9
11
  //
10
12
  // [mark] title (2 lines at most) [actions] ← desktop
11
- // place · when · signals
13
+ // #number · repo · when · signals
12
14
  // extra (slot)
13
15
  // [actions] ← phone, labelled
14
16
  // confirm bar
@@ -36,12 +38,16 @@ export interface ConfirmSpec {
36
38
  export interface CardProps {
37
39
  mark: { icon: IconName; tone: Tone };
38
40
  title: string;
39
- // "repo #number", then when it happened, then signals [ATT-05].
40
- meta: { place: string; when?: string; signals: Chip[] };
41
+ // "#number · repo", then when it happened, then signals [ATT-05, ATT-20].
42
+ meta: { place: Place; when?: string; signals: Chip[] };
41
43
  // Defaults to "<title>, more".
42
44
  accessibilityLabel?: string;
43
45
  // Tapping the card opens its sheet [ATT-06].
44
46
  onOpen: () => void;
47
+ // While its sheet waits for its details, a spinner takes the place of › [ATT-06].
48
+ opening?: boolean;
49
+ // Resting the pointer on the card, to fetch its sheet's details ahead.
50
+ hover?: { onHoverIn: () => void; onHoverOut: () => void };
45
51
  // The labelled main action; secondary ones are icon-only (›, copy).
46
52
  primary?: CardAction;
47
53
  secondary: CardAction[];
@@ -59,38 +65,55 @@ export function CardList({ children }: { children: ReactNode }) {
59
65
  return <View style={styles.card}>{children}</View>;
60
66
  }
61
67
 
62
- export function CardRow({ first, mark, title, meta, accessibilityLabel, onOpen, primary, secondary, busy, extra, confirm, overlay }: CardProps & { first: boolean }) {
68
+ export function CardRow({ first, mark, title, meta, accessibilityLabel, onOpen, opening, hover, primary, secondary, busy, extra, confirm, overlay }: CardProps & { first: boolean }) {
63
69
  const styles = useStyles();
70
+ const chevron = secondary.some((action) => action.icon === "chevronRight");
64
71
  const actions = (
65
72
  <View style={styles.wrap}>
66
73
  {primary ? (
67
- <Button label={primary.label} accessibilityLabel={primary.accessibilityLabel} icon={primary.icon} variant="calm" busy={busy} onPress={primary.onPress} />
74
+ <Button
75
+ label={primary.label}
76
+ accessibilityLabel={primary.accessibilityLabel}
77
+ icon={primary.icon}
78
+ variant="calm"
79
+ busy={busy}
80
+ // A card's action wins over its sheet still waiting to open [ATT-06].
81
+ onPress={() => (cancelPendingOpen(), primary.onPress())}
82
+ />
68
83
  ) : busy ? (
69
84
  <ActivityIndicator size="small" color={styles.c.foregroundMuted} />
70
85
  ) : null}
71
86
  {/* On phones › and copy sit at the far edge, apart from the labelled action. */}
72
87
  {styles.compact && secondary.length ? <View style={{ flex: 1 }} /> : null}
73
88
  {secondary.map((action) => (
74
- <Button key={action.accessibilityLabel ?? action.label} icon={action.icon} variant="ghost" accessibilityLabel={action.accessibilityLabel ?? action.label} onPress={action.onPress} />
89
+ <Button
90
+ key={action.accessibilityLabel ?? action.label}
91
+ icon={action.icon}
92
+ variant="ghost"
93
+ accessibilityLabel={action.accessibilityLabel ?? action.label}
94
+ busy={opening && action.icon === "chevronRight"}
95
+ onPress={action.onPress}
96
+ />
75
97
  ))}
98
+ {opening && !chevron ? <ActivityIndicator size="small" color={styles.c.foregroundMuted} accessibilityLabel="Opening" /> : null}
76
99
  </View>
77
100
  );
78
101
  return (
79
102
  <View style={first ? null : styles.divider}>
80
103
  <View style={styles.item}>
81
104
  <Mark {...mark} />
82
- <View style={styles.body}>
83
- <Pressable accessibilityRole="button" accessibilityLabel={accessibilityLabel ?? `${title}, more`} onPress={onOpen} style={{ gap: 6 }}>
105
+ <HintArea style={styles.body}>
106
+ <Pressable accessibilityRole="button" accessibilityLabel={accessibilityLabel ?? `${title}, more`} onPress={onOpen} {...hover} style={{ gap: 6 }}>
84
107
  <Text style={styles.title} numberOfLines={2}>
85
108
  {title}
86
109
  </Text>
87
- <Meta facts={meta.when ? [meta.place, meta.when] : [meta.place]} chips={meta.signals} />
110
+ <Meta lead={<PlaceText place={meta.place} />} facts={meta.when ? [meta.when] : []} chips={meta.signals} />
88
111
  {extra}
89
112
  </Pressable>
90
113
  {/* On phones the actions sit under the text, labelled, so mixed actions stay readable. */}
91
114
  {styles.compact ? actions : null}
92
115
  {confirm ? <ConfirmBar {...confirm} /> : null}
93
- </View>
116
+ </HintArea>
94
117
  {styles.compact ? null : actions}
95
118
  </View>
96
119
  {overlay}
@@ -7,11 +7,12 @@ import * as rpc from "../shared/rpc";
7
7
  import { DEFAULT_FIELD, FIELD_ROLES, type FieldRole, sameField } from "../shared/config";
8
8
  import type { ConfigStatus, CoverageKind, IssueField } from "../shared/setup";
9
9
  import { VIEW_QUERY_KEY } from "./data";
10
- import { Button, StylesProvider, useStyles } from "./ui";
10
+ import { Button, StylesProvider, useCopy, useStyles } from "./ui";
11
11
 
12
12
  const COVERAGE_QUERY_KEY = ["attention-span", "coverage"] as const;
13
13
  const MY_ORGS_QUERY_KEY = ["attention-span", "my-orgs"] as const;
14
14
  const FIELDS_QUERY_KEY = ["attention-span", "issue-fields"] as const;
15
+ const PROJECTS_QUERY_KEY = ["attention-span", "projects-access"] as const;
15
16
  // A caption belongs to the card above it, so it sits closer to that card than to the next heading.
16
17
  const CAPTION = { marginTop: -24, marginBottom: 16 };
17
18
 
@@ -216,6 +217,7 @@ function NextUpFields({ value, disabled, onChange }: { value: ConfigStatus["fiel
216
217
  />
217
218
  );
218
219
  })}
220
+ <ProjectsRow />
219
221
  </SettingsCard>
220
222
  </SettingsSection>
221
223
  <Text style={[styles.muted, CAPTION]}>
@@ -227,6 +229,39 @@ function NextUpFields({ value, disabled, onChange }: { value: ConfigStatus["fiel
227
229
  );
228
230
  }
229
231
 
232
+ // Projects need the read:project scope, which gh doesn't ask for by default. Asked again each time Settings opens, so the
233
+ // row turns On once it's fixed. How to fix it depends on where gh's token comes from: its own login takes one command; a
234
+ // token in GH_TOKEN or GITHUB_TOKEN, which gh reads first, needs that permission on GitHub; anything else, like an org's
235
+ // SSO, gets GitHub's own words [NXT-12].
236
+ const SCOPE_COMMAND = "gh auth refresh -s read:project";
237
+
238
+ function ProjectsRow() {
239
+ const styles = useStyles();
240
+ const copy = useCopy();
241
+ const check = useRpc(rpc.projectsAccess);
242
+ const access = useQuery({ queryKey: PROJECTS_QUERY_KEY, queryFn: () => check({}), staleTime: 0 });
243
+ const status = access.data;
244
+ if (status?.state === "missing" && status.token === "gh")
245
+ return <SettingsAction label="Projects" hint={`Needs the read:project scope. Run ${SCOPE_COMMAND} on this host`} actionLabel="Copy command" onPress={() => copy(SCOPE_COMMAND, "Copied the command")} />;
246
+ const hint =
247
+ status?.state === "missing"
248
+ ? `Your token comes from ${status.token}. Give it read:project (classic) or Projects: read (fine-grained), then restart the daemon`
249
+ : status?.state === "failed"
250
+ ? `Couldn't read projects: ${status.error}`
251
+ : status?.state === "unknown"
252
+ ? "Couldn't tell whether projects can be read"
253
+ : // On, but some went wrong last time, like boards an org's SSO hides: in GitHub's words, so it can be fixed.
254
+ status?.warning || status?.error
255
+ ? `On, but GitHub said: ${status.warning ?? status.error}`
256
+ : "Shows each issue's project and Status on its card, and adds them to the filter";
257
+ const on = status?.state === "on";
258
+ return (
259
+ <SettingsRow label="Projects" hint={hint} error={access.error ? (access.error as Error).message : null}>
260
+ <Text style={[styles.text, { color: on ? styles.action : styles.c.foregroundMuted }]}>{on ? "On" : access.isLoading ? "Checking…" : "Off"}</Text>
261
+ </SettingsRow>
262
+ );
263
+ }
264
+
230
265
  // Each name is checked on GitHub before it's saved; GitHub's exact name is what's kept.
231
266
  function AddRow({ kind, placeholder, existing, disabled, onAdd }: { kind: CoverageKind; placeholder?: string; existing: string[]; disabled: boolean; onAdd: (name: string) => Promise<void> }) {
232
267
  const styles = useStyles();
@@ -0,0 +1,118 @@
1
+ import { Text, View } from "react-native";
2
+ import type { GithubColor, IssueProject, NextUpIssue } from "../shared/attention";
3
+ import type { FieldRole } from "../shared/config";
4
+ import { repoLabel, shortValue } from "../shared/format";
5
+ import type { IconName } from "./icons";
6
+ import { Pill, type Styles, useStrongText, useStyles } from "./ui";
7
+
8
+ // How an issue or PR is presented wherever it shows, on a card or in its sheet: which one it is, and the facts that help
9
+ // pick it up. Tabs and sheets compose these rather than format their own.
10
+
11
+ // ---- Which item [ATT-20] ----
12
+
13
+ // An item's number and repo. My own repos go without their owner where `login` is given; a sheet passes none, so it always
14
+ // names the owner.
15
+ export interface Place {
16
+ repo: string;
17
+ number: number;
18
+ login: string | null;
19
+ }
20
+
21
+ // "#160", standing out a little from the quiet text it leads, like a stack's rows in a sheet.
22
+ export function NumberText({ number }: { number: number }) {
23
+ return <Text style={useStrongText()}>#{number}</Text>;
24
+ }
25
+
26
+ // "#160 · acme/shop", to lead a Meta line: the number on its own first, then the repo with its name standing out from its
27
+ // owner, so cards from several repos scan.
28
+ export function PlaceText({ place }: { place: Place }) {
29
+ const strong = useStrongText();
30
+ const label = repoLabel(place.repo, place.login);
31
+ const cut = label.lastIndexOf("/") + 1;
32
+ return (
33
+ <>
34
+ <NumberText number={place.number} />
35
+ {" · "}
36
+ {label.slice(0, cut)}
37
+ <Text style={strong}>{label.slice(cut)}</Text>
38
+ </>
39
+ );
40
+ }
41
+
42
+ // ---- GitHub's option colors [NXT-10] ----
43
+
44
+ // The colors GitHub offers for issue field and project options, as GitHub draws them on dark and on light.
45
+ const GITHUB_COLORS: Record<GithubColor, { dark: string; light: string }> = {
46
+ GRAY: { dark: "#8b949e", light: "#6e7781" },
47
+ BLUE: { dark: "#4493f8", light: "#0969da" },
48
+ GREEN: { dark: "#3fb950", light: "#1a7f37" },
49
+ YELLOW: { dark: "#d29922", light: "#9a6700" },
50
+ ORANGE: { dark: "#db6d28", light: "#bc4c00" },
51
+ RED: { dark: "#f85149", light: "#cf222e" },
52
+ PINK: { dark: "#db61a2", light: "#bf3989" },
53
+ PURPLE: { dark: "#ab7df8", light: "#8250df" },
54
+ };
55
+
56
+ // An option's color for this theme. GRAY is what an option looks like when nobody chose a color, so it tints nothing.
57
+ export function githubColor(styles: Styles, color: GithubColor | undefined): string | undefined {
58
+ return color && color !== "GRAY" ? GITHUB_COLORS[color]?.[styles.dark ? "dark" : "light"] : undefined;
59
+ }
60
+
61
+ // ---- An issue to pick up [NXT-10, NXT-12] ----
62
+
63
+ // Each field's pill: its icon says which field the value is.
64
+ const FIELDS = [
65
+ { role: "priority", label: "Priority", icon: "flag" },
66
+ { role: "effort", label: "Effort", icon: "weight" },
67
+ { role: "scope", label: "Scope", icon: "layers" },
68
+ ] as const satisfies { role: FieldRole; label: string; icon: IconName }[];
69
+
70
+ // Priority in the color the org gave it; where it colored none, the top priority is warm, the next accent, the rest quiet.
71
+ function priorityColor(styles: Styles, issue: NextUpIssue): string | undefined {
72
+ if (issue.priorityColor) return githubColor(styles, issue.priorityColor);
73
+ return issue.priorityRank === 0 ? styles.c.statusWarning : issue.priorityRank === 1 ? styles.action : undefined;
74
+ }
75
+
76
+ // A board it's on, and its column there in the board's color.
77
+ export function ProjectPill({ project }: { project: IssueProject }) {
78
+ const styles = useStyles();
79
+ return (
80
+ <Pill
81
+ icon="kanban"
82
+ label={project.title}
83
+ value={project.status}
84
+ color={githubColor(styles, project.color)}
85
+ hint={`Project ${project.title}: ${project.status ?? "no status"}`}
86
+ />
87
+ );
88
+ }
89
+
90
+ // One of its fields. `full` (the sheet) names the field and keeps the value whole, as phones can't show a pill's hint;
91
+ // the card trims the value's emoji and notes in brackets.
92
+ export function FieldPill({ issue, role, full = false }: { issue: NextUpIssue; role: FieldRole; full?: boolean }) {
93
+ const styles = useStyles();
94
+ const field = FIELDS.find((f) => f.role === role)!;
95
+ const raw = issue[role];
96
+ if (!raw) return null;
97
+ const value = full ? raw : shortValue(raw);
98
+ const color = role === "priority" ? priorityColor(styles, issue) : undefined;
99
+ return <Pill icon={field.icon} label={full ? field.label : undefined} value={value} color={color} hint={`${field.label}: ${value}`} />;
100
+ }
101
+
102
+ // What helps decide whether to pick it up: the boards it's on, then priority, effort and scope. Nothing when it has none.
103
+ export function IssuePills({ issue, full = false }: { issue: NextUpIssue; full?: boolean }) {
104
+ const styles = useStyles();
105
+ const projects = issue.projects ?? [];
106
+ const fields = FIELDS.filter(({ role }) => issue[role]);
107
+ if (projects.length === 0 && fields.length === 0) return null;
108
+ return (
109
+ <View style={[styles.wrap, { gap: 4, marginTop: 2 }]}>
110
+ {projects.map((project) => (
111
+ <ProjectPill key={project.id} project={project} />
112
+ ))}
113
+ {fields.map(({ role }) => (
114
+ <FieldPill key={role} issue={issue} role={role} full={full} />
115
+ ))}
116
+ </View>
117
+ );
118
+ }
@@ -1,12 +1,12 @@
1
1
  import { openExternalUrl, type PluginClientContext, usePaseo, useRpc } from "@getpaseo/plugin/client";
2
- import { Modal, TextInput, useToast } from "@getpaseo/plugin/client/ui";
2
+ import { TextInput, useToast } from "@getpaseo/plugin/client/ui";
3
3
  import { useState } from "react";
4
4
  import { Pressable, Text, View } from "react-native";
5
5
  import type { AgentSummary } from "../shared/attention";
6
6
  import type { AttentionConfig } from "../shared/config";
7
7
  import { FEEDBACK_REPO, type FeedbackContext, type FeedbackKind, feedbackItemKey, feedbackPrompt } from "../shared/feedback";
8
8
  import * as rpc from "../shared/rpc";
9
- import { ActionSheet, type SheetEntry } from "./sheet";
9
+ import { ActionSheet, Modal, type SheetEntry } from "./sheet";
10
10
  import { sessionEntry } from "./session-menu";
11
11
  import { ITEM_LABEL, KIND_LABEL, LABEL, resolveAgentConfig } from "./sessions";
12
12
  import { Button, KeepStyles, TablerIcon, useStyles } from "./ui";
package/client/icons.ts CHANGED
@@ -41,6 +41,11 @@ export const ICONS = {
41
41
  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>" },
42
42
  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>" },
43
43
  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>" },
44
+ squareMinus: { 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=\"M9 12h6M3 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>" },
45
+ flag: { 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=\"M5 5a5 5 0 0 1 7 0a5 5 0 0 0 7 0v9a5 5 0 0 1-7 0a5 5 0 0 0-7 0zm0 16v-7\"/></svg>" },
46
+ weight: { 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=\"M9 6a3 3 0 1 0 6 0a3 3 0 1 0-6 0\"/><path d=\"M6.835 9h10.33a1 1 0 0 1 .984.821l1.637 9A1 1 0 0 1 18.802 20H5.198a1 1 0 0 1-.984-1.179l1.637-9A1 1 0 0 1 6.835 9\"/></g></svg>" },
47
+ layers: { 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=\"M12 4L4 8l8 4l8-4zm-8 8l8 4l8-4M4 16l8 4l8-4\"/></svg>" },
48
+ kanban: { 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 4h6m4 0h6M4 10a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2zm10 0a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2a2 2 0 0 1-2 2h-2a2 2 0 0 1-2-2z\"/></svg>" },
44
49
  chevronRight: { 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=\"m9 6l6 6l-6 6\"/></svg>" },
45
50
  plus: { 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=\"M12 5v14m-7-7h14\"/></svg>" },
46
51
  check: { 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=\"m5 12l5 5L20 7\"/></svg>" },