paseo-follow-up 1.4.0-beta.0 → 1.4.0-beta.2
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 +6 -2
- package/README.md +24 -2
- package/client/about.tsx +132 -0
- package/client/home.tsx +4 -0
- package/client/needs-you.tsx +2 -0
- package/client/panel.tsx +6 -3
- package/client/pill.tsx +2 -0
- package/client/pr-controls.tsx +18 -5
- package/client/reviewers.tsx +172 -0
- package/client/settings.tsx +4 -0
- package/docs/screenshots/reviewers-picker-phone.png +0 -0
- package/docs/screenshots/reviewers-picker.png +0 -0
- package/docs/screenshots/reviewers-sheet.png +0 -0
- package/index.server.ts +166 -54
- package/package.json +3 -2
- package/server/about.ts +386 -0
- package/server/agent-actions.ts +29 -10
- package/server/agent-hook.mjs +50 -9
- package/server/agent-mcp.ts +1 -104
- package/server/ai-jobs.ts +155 -0
- package/server/github.ts +5 -2
- package/server/governor.ts +7 -2
- package/server/hook-source.ts +1 -1
- package/server/inbox.ts +3 -3
- package/server/mcp-registrations.ts +113 -0
- package/server/mcp-source.ts +1 -1
- package/server/mcp.d.mts +14 -0
- package/server/mcp.mjs +14 -3
- package/server/native-tools.ts +68 -0
- package/server/pr-actions.ts +13 -8
- package/server/reviewer-config.ts +131 -0
- package/server/session-mcp.ts +2 -2
- package/server/transcript.ts +66 -0
- package/shared/about.ts +223 -0
- package/shared/attention.ts +2 -2
- package/shared/brief.ts +6 -5
- package/shared/chat.ts +5 -2
- package/shared/contracts.ts +13 -1
- package/shared/home.ts +2 -2
- package/shared/resources.ts +4 -0
- package/shared/reviewers.ts +75 -2
package/OVERVIEW.md
CHANGED
|
@@ -6,6 +6,7 @@ Follow-up watches every pull request a Paseo workspace opens until the work is a
|
|
|
6
6
|
|
|
7
7
|
- Home: every workspace grouped by what it needs from you (Needs you, Follow-up is fixing, Running, Waiting on others, Quiet), with the selected one beside the list so you can allow a permission, answer, merge, reply or sign off in place, and a brief with what Follow-up did while you were away. Above the list: the status counts, provider limits from Smart Session when it's installed, a search over names, branches, PRs, agents and asks, and a sort menu (Priority, Recent, Oldest waiting, Name, By project).
|
|
8
8
|
- The Overseer (1.4 beta), pinned on Home: one agent you talk to about all your workspaces. It forwards your asks to the agent that owns them, asks you when it isn't sure, and starts a new workspace only when you say so.
|
|
9
|
+
- What's this about?, a collapsible section at the top of Home's detail pane and the workspace panel: a one-line gist, a short AI overview of what the workspace is for and where it stands, and its linked Linear issues, PRs, Slack threads and docs.
|
|
9
10
|
- A workspace panel for the open workspace only, with a Home button: PRs merged, what needs you, what needs fixing, a bar with one segment per PR, and what the agent is doing now. "Open full" on Home docks it beside the agent's chat.
|
|
10
11
|
- A Needs you card with one button per decision: Send repairs, Merge, Resume, Retry, or Answer.
|
|
11
12
|
- Questions from the main agent, each with a permanent ref (Q1, Q2…), lettered options, the agent's recommendation and what it does while it waits. Pick an option, add a note and Send it to the agent, or Copy it instead. Answered questions stay listed under their ref, and the question mode setting (Stop, Work around, Keep building) tells agents what to do until you answer.
|
|
@@ -26,14 +27,17 @@ Auto-send ("Send repairs automatically") is on by default for every followed wor
|
|
|
26
27
|
|
|
27
28
|
### What agents can do for you
|
|
28
29
|
|
|
29
|
-
Every root agent Paseo launches (tracked or not) gets Follow-up's action tools: `list_prs`, `add_reviewers`, `merge`, `enable_merge_when_ready`, `disable_merge_when_ready`, `send_repairs`, `set_auto_send`, `clear_hold`, `retry_batch`, `track`, `inbox_list`, `sign_off`, `snooze`, `set_finish_flags` and `
|
|
30
|
+
Every root agent Paseo launches (tracked or not) gets Follow-up's action tools: `list_prs`, `add_reviewers`, `merge`, `enable_merge_when_ready`, `disable_merge_when_ready`, `send_repairs`, `set_auto_send`, `clear_hold`, `retry_batch`, `track`, `inbox_list`, `sign_off`, `snooze`, `set_finish_flags`, `set_priorities` and the read-only `workspace_about` (a workspace's overview and linked items) (external priorities for Home's Priority sort, kept in `plugin-data/follow-through/priorities.json`). Each runs the server path its button runs, with the same guards (tracked workspace, hold, PR eligibility, merge blockers), across every tracked workspace, so an orchestrating agent can act "on all" when you ask it to. Tools that act on a list, and merge, return a dry run and run only with `confirm: true` and that plan's id; merge is marked destructive and the list tools read-only. Inbox tools act on other agents only: an agent can't sign itself off. Recovery agents, contributors and subagents never get them, and the daemon re-checks the caller on each call. Each agent action is kept in the inbox's delivery ledger as `by: "agent:<id>"`; it never counts as you writing to an agent. A sign-off is still a sign-off made on your behalf, so it clears the flag. There is no tool to untrack or archive a workspace, or to put one on hold, because Follow-up has no button for those either.
|
|
30
31
|
|
|
31
32
|
## Data and access
|
|
32
33
|
|
|
33
|
-
This is a trusted, unsandboxed plugin. It reads workspace metadata, saved agent history and configuration, GitHub status and existing CLI authentication, and keeps its state in `plugin-data/follow-through` on the daemon host. It
|
|
34
|
+
This is a trusted, unsandboxed plugin. It reads workspace metadata, saved agent history and configuration, GitHub status and existing CLI authentication, and keeps its state in `plugin-data/follow-through` on the daemon host. It attaches scoped agent tools per session (served by Paseo's own MCP as `follow_*` on Paseo 0.15+, a per-launch stdio bridge otherwise; never a global MCP registration, and it removes the user-scope `follow-through` entry older versions wrote, keeping a `.follow-through-unregister.bak` of each file) and reversible provider hooks for tracked sessions and, while the Needs-you inbox is on, the `needs_you` tool and its Stop-hook nudge for root agents (see below). To find the spec link it reads completed Claude Artifact publish results in the workspace's root sessions, never page content, chat links or the repository; a link you set wins over the agent's, which wins over detection. Repair prompts go to your configured agent and provider. For the provider meters it calls the Smart Session plugin's `smart-session.subscriptions` and `smart-session.budget` RPCs at most once a minute, or reads the newest rows of its `plugin-data/smart-session/accounts-YYYY-MM.jsonl`; it never asks ZeroSub to refresh or switch. It has no Slack identity and no background channel scanning; replies to stakeholders need your authorization and a sent-message receipt from the agent.
|
|
35
|
+
|
|
36
|
+
Reviewer lists live in `plugin-data/follow-through/reviewers.json` (owner-only), apart from `state.json`. Each list is per repository, plus a default for repositories without one, and each user keeps their own. Collaborator and team suggestions are read with `gh api` only when you open Add reviewer. They are cached for ten minutes, and never polled.
|
|
34
37
|
|
|
35
38
|
The Needs-you inbox (beta) keeps one flag per root agent in `plugin-data/follow-through/inbox.json`. When a turn starts it reads the newest user message from the agent's recent timeline to tell your messages from automation, and it reads, never writes, Defer's `plugin-data/defer/queue.json`, Smart Session's `plugin-data/smart-session/compactions.json`, Session Guard's `plugin-data/session-guard/state.json` and Paseo's schedule records. An unknown or unreadable format counts as your message, which clears a flag rather than adding one. Signing off also clears Paseo's own unread dot for that agent. The first-run import and the restart check read only Paseo's agent list: an agent's last activity is its unread time or your last message to it, never Paseo's `updatedAt` (which the daemon rewrites in bulk), and they don't fetch timelines, which would load every agent. Closed and archived agents are never imported. Turning the inbox off stops all of this.
|
|
36
39
|
|
|
37
40
|
The brief (beta) is stored on the agent's inbox entry and appended to its timeline as a Follow-up row; re-appending replaces that row, and the restart check ignores the `updatedAt` change the append causes because it never reads `updatedAt`. To build a brief Follow-up reads only what it already has: the agent's `needs_you` call, the permission request's title, the failed turn's error message, Session Guard's note and reset time for a paused agent, and its own PR state. It does not read or quote the agent's reply. While the inbox is on, every root Paseo agent on Claude Code or Codex gets Follow-up's MCP bridge with the `needs_you` tool only (tracked main agents keep their full set), and `plugin-data/follow-through/brief.json` records whether the inbox and the nudge are on and which agents have a permission prompt showing. Clicking an option or Retry sends one message as you; it is logged in the delivery ledger as yours, so it clears the flag. The Stop hook, part of the same reversible provider hooks Follow-up already installs, now also runs for those root Claude Code sessions: if the turn ended without `needs_you`, it blocks the stop once with a one-line request to call it, records that it did in `hook-state`, and never blocks the same turn again. It reads `brief.json`, its own per-turn marker and the time of the agent's last `needs_you` call, and nothing else. Turn it off with *Ask agents to state what they need*; turning the inbox off stops it too.
|
|
38
41
|
|
|
39
42
|
The Overseer (beta) is one Claude agent in a Follow-up workspace under `plugin-data/follow-through/overseer-home`, labelled `follow-up.overseer=1` and created only when you click Start. Its id is kept in `plugin-data/follow-through/overseer.json`. Discovery, tracking, auto-send and Needs you skip its workspace. At the start of each of its turns, the provider hook adds a digest from `plugin-data/follow-through/overseer-digest.json` and records what it showed in `hook-state/overseer-seen-<agent>.json`. The worker builds that file from Paseo's workspace list (metadata only, at most once a minute) and Follow-up's own state. It rewrites the file only when the content changes, and skips it while the resource governor pauses background work. Its tools are `workstreams`, `agent_digest`, `route_candidates`, `send_to_agent` and `start_workspace`. For an agent that isn't loaded, `agent_digest` reads the provider's transcript on disk, read-only (Claude Code's `projects/<cwd>/<session>.jsonl`, Codex's `sessions/**/rollout-*-<thread>.jsonl`; only the last 512 KB, and never the credentials in Paseo's agent record). Without a transcript it uses Follow-up's goal and PR titles. It never reads that agent's timeline. `send_to_agent` writes your words to the delivery ledger first: as yours only when they answer that agent's open ask, otherwise as Follow-up's. It wakes a resting agent only because you asked for it. `start_workspace` runs only after your approval, through a dry run and confirm. The Overseer can't merge, archive or post anywhere.
|
|
43
|
+
"What's this about?" keeps its overviews in `plugin-data/follow-through/about.json` (gist, overview, linked rows, when and from what; never raw history) and logs each model call's duration and cost to `ai-jobs.jsonl`. To write one it reads the root agent's latest steps from its live timeline only when Paseo already has the agent loaded; otherwise it reads the first and last part of the agent's provider transcript on disk (Claude Code's `~/.claude/projects`, Codex's `~/.codex/sessions`), read-only, and never wakes the agent. It reads subagent titles from Paseo's agent list, PR titles and bodies with `gh pr view`, and only the Linear issues and Slack threads the workspace itself links, through `mcpproxy call tool-read` (`linear:get_issue`, `slack-user:slack_read_thread`); there are no searches. The model is a headless `claude -p` (Haiku) with no tools, no MCP servers, no settings and no saved session, one turn, a 90-second timeout, one call at a time. Overviews are written ahead of time only for non-dormant workspaces in Needs you, at most 60 a day, and not while a Claude account is above 85% of a limit or the resource governor has paused background work; above its higher threshold, opening the section shows the cached overview and writes none.
|
package/README.md
CHANGED
|
@@ -56,6 +56,18 @@ Tap a PR, or its segment in the bar, for a sheet with its checks, reviewers and
|
|
|
56
56
|
|
|
57
57
|

|
|
58
58
|
|
|
59
|
+
### Reviewers
|
|
60
|
+
|
|
61
|
+
**Add reviewers** asks the people you've set for that repository. Set them in **Settings → Follow-up → Reviewers**:
|
|
62
|
+
|
|
63
|
+
- Each repository Follow-up has seen a PR in gets its own list. **Default for all repos** covers every repository without one.
|
|
64
|
+
- **Add reviewer** suggests the repository's collaborators and teams from GitHub. You can also type a login (`octocat`) or a team as `org/team`.
|
|
65
|
+
- Remove a reviewer with its ×. The arrow moves a reviewer earlier in the list.
|
|
66
|
+
|
|
67
|
+
The PR sheet says who will be asked. **Edit…** opens a picker where you check or uncheck people for that PR only. **Remember for owner/repo** saves the choice as that repository's list. With nobody set, **Add reviewers** opens the picker straight away. The PR author is never asked.
|
|
68
|
+
|
|
69
|
+
The lists are yours, not your team's. Each person who installs Follow-up sets their own. If you upgrade from a version that hardcoded reviewers, each repository keeps the reviewers you last requested there. A fresh install starts empty.
|
|
70
|
+
|
|
59
71
|
The expand icon next to the gear (or **Follow-up: open the larger view** in ⌘K) opens the workspace as a full screen, in two columns when there is room: what needs you on the left, the stacks and activity on the right. Esc or the collapse icon takes you back.
|
|
60
72
|
|
|
61
73
|

|
|
@@ -109,6 +121,16 @@ The Follow-up sidebar row (and ⌘K → **Follow-up: Home**) opens **Home**: eve
|
|
|
109
121
|
- **Provider limits** under it, from the [Smart Session](https://www.npmjs.com/package/paseo-smart-session) plugin: one line per provider, such as "Claude 5h 62% · 7d 41% · resets 14:10". Amber from 80%, red at the limit; tap a line to see each ZeroSub account. The age shows when the reading is older than 15 minutes. Without Smart Session the line isn't there.
|
|
110
122
|
- **Search** ("Search workspaces, branches, PRs"; `/` or ⌘K → **Follow-up: Search** focuses it) matches workspace names, branches, PR numbers ("#1402" or "1402") and titles, agent and subagent titles, the project, Linear keys such as HER-1312, and the current ask. Words can come in any order, prefixes count and one typo is forgiven. Results are one ranked list (name above branch and PR above the ask, then recency) with the matched words marked and each row's group as a chip; archived workspaces come last. ↑/↓ move, Enter opens the result on the right, Esc clears.
|
|
111
123
|
- **Sort** (the menu beside search, remembered on this device): **Priority** (default), **Recent**, **Oldest waiting**, **Name** and **By project**. It orders rows inside each group; groups stay in place and search ignores it. Priority means urgency: blocking asks, then decisions only you make, then finished turns; inside those, a big open question first, then the nearest task deadline, then the oldest ask. When an agent has ranked workspaces with `set_priorities` in the last 6 hours, Priority uses those scores inside Needs you (blocking asks still first), each row shows the ranker's one-line reason and source, and the menu says "Ranked 12m ago"; otherwise it says "By urgency". Follow-up never writes a reason itself.
|
|
124
|
+
#### What's this about?
|
|
125
|
+
|
|
126
|
+
When a workspace's name doesn't remind you what it's for, open **What's this about?** at the top of Home's detail pane or the workspace panel (under Home). It's collapsed by default and remembers open or closed on this device. Collapsed, it shows a one-line gist once one is written ("Fix slow vendor-activity query; PR #1352 merged, waiting on Hadar"). Open, it shows:
|
|
127
|
+
|
|
128
|
+
- **An overview**: two to four plain sentences on what the workspace is for, where it stands and what it's waiting on, written by a small model from the root agent's first messages and latest steps, its subagents' titles, its PRs and the linked issues. While it's being written you see "Summarizing…" with the first message.
|
|
129
|
+
- **Linked**: Linear issues (key, title, state, priority, due), PRs (number, title, state), Slack threads (channel, who, a one-line excerpt) and claude.ai or doc links the agent shared, each with a source chip. Links are only ever found in the workspace's own text, never written by the model; with none it says "No linked issues or threads found".
|
|
130
|
+
- **A footer** with when and from what it was summarized ("Summarized 2h ago from the saved transcript, 2 PRs, HER-1312"), any source that couldn't be read, and **Refresh**.
|
|
131
|
+
|
|
132
|
+
An overview is written when you open the section and none exists, or when the inputs changed and it's over an hour old, or on Refresh. Workspaces in Needs you get one ahead of time (at most 60 a day). Agents can read it with the read-only `workspace_about` tool.
|
|
133
|
+
|
|
112
134
|

|
|
113
135
|
|
|
114
136
|
- ⌘K: **Follow-up: Home**, **Follow-up: Search**, **Follow-up: Sign off & next**, **Follow-up: Later (tomorrow 09:00)**, **Follow-up: Next needs-you**, **Follow-up: Done while you were away**.
|
|
@@ -131,7 +153,7 @@ Turn it off under Settings → **Overseer (beta)**.
|
|
|
131
153
|
Install the beta:
|
|
132
154
|
|
|
133
155
|
```sh
|
|
134
|
-
paseo plugin update follow-through --version 1.4.0-beta.
|
|
156
|
+
paseo plugin update follow-through --version 1.4.0-beta.2
|
|
135
157
|
# or, for a fresh install:
|
|
136
158
|
paseo plugin install npm:paseo-follow-up@beta
|
|
137
159
|
```
|
|
@@ -159,7 +181,7 @@ Tell an agent "the PRs look good, assign reviewers on all" and it can do it. Eve
|
|
|
159
181
|
| Tool | Does what this button does |
|
|
160
182
|
| --- | --- |
|
|
161
183
|
| `list_prs` | Reads tracked PRs across all workspaces (draft, checks, threads, reviewers, merge blockers). Filters: `needs_reviewers`, `ready_to_merge`, `workspace`. |
|
|
162
|
-
| `add_reviewers` | **Add reviewers**, on one PR or many.
|
|
184
|
+
| `add_reviewers` | **Add reviewers**, on one PR or many. Uses your saved reviewers for the repository, or the logins (or `org/team` slugs) you name. `list_prs` shows each PR's saved reviewers as `configuredReviewers`. |
|
|
163
185
|
| `merge`, `enable_merge_when_ready`, `disable_merge_when_ready` | **Merge** and the PR sheet's merge-when-ready switch, with the same plan and blockers. |
|
|
164
186
|
| `send_repairs`, `set_auto_send`, `clear_hold`, `retry_batch`, `track` | **Send**, the **Auto-send** switch, **Resume**, **Retry**, following a workspace again after an opt-out. |
|
|
165
187
|
| `set_priorities` | Stores external priorities for Home's Priority sort: per workspace a score 0–100, a one-line reason and sources (Linear, Slack, planning, GitHub, Paseo). Plans first; `confirm: true` with the plan id stores them. Used for 6 hours. |
|
package/client/about.tsx
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import { Pressable, Text, View } from "react-native";
|
|
3
|
+
import { openExternalUrl, useRpc } from "@getpaseo/plugin/client";
|
|
4
|
+
import { Icon } from "@getpaseo/plugin/client/ui";
|
|
5
|
+
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
|
6
|
+
import { workspaceAboutRpc } from "../shared/contracts";
|
|
7
|
+
import { aboutDisplay, linkLine, SOURCE_LABEL, type AboutLink, type AboutView } from "../shared/about";
|
|
8
|
+
import { errorText } from "../shared/errors";
|
|
9
|
+
import { Button, text, type Theme } from "./kit";
|
|
10
|
+
import { Spinner } from "./motion";
|
|
11
|
+
import { useTick } from "./home-data";
|
|
12
|
+
import type { Colors } from "./theme";
|
|
13
|
+
|
|
14
|
+
const OPEN_KEY = "follow-up.about.open";
|
|
15
|
+
/** Open/closed is per device (web and desktop storage). Native or blocked storage: this session only. */
|
|
16
|
+
let memoryOpen: boolean | null = null;
|
|
17
|
+
const readOpen = (): boolean => {
|
|
18
|
+
try { const v = (globalThis as { localStorage?: Storage }).localStorage?.getItem(OPEN_KEY); if (v === "1" || v === "0") return v === "1"; } catch { /* memory only */ }
|
|
19
|
+
return memoryOpen ?? false;
|
|
20
|
+
};
|
|
21
|
+
const writeOpen = (open: boolean) => {
|
|
22
|
+
memoryOpen = open;
|
|
23
|
+
try { (globalThis as { localStorage?: Storage }).localStorage?.setItem(OPEN_KEY, open ? "1" : "0"); } catch { /* memory only */ }
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const aboutKey = (workspaceId: string) => ["follow-through", "about", workspaceId] as const;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* "What's this about?" at the top of Home's detail pane and the workspace panel. Collapsed: the label and, when one
|
|
30
|
+
* is cached, the one-line gist. Open: the overview, what's linked, and when it was written with a Refresh.
|
|
31
|
+
*/
|
|
32
|
+
export function AboutSection({ workspaceId, theme, compact, flush = false }: { workspaceId: string; theme: Theme; compact: boolean; flush?: boolean }) {
|
|
33
|
+
const c = theme.colors; const t = text(c);
|
|
34
|
+
const [open, setOpenState] = useState(readOpen);
|
|
35
|
+
const [refreshing, setRefreshing] = useState(false);
|
|
36
|
+
const read = useRpc(workspaceAboutRpc);
|
|
37
|
+
const client = useQueryClient();
|
|
38
|
+
const query = useQuery({
|
|
39
|
+
queryKey: [...aboutKey(workspaceId), open],
|
|
40
|
+
queryFn: () => read({ workspaceId, open }),
|
|
41
|
+
// Polls only while an overview is being written; otherwise one read per open (and per Refresh).
|
|
42
|
+
refetchInterval: q => (q.state.data as AboutView | undefined)?.status === "pending" ? 3000 : false,
|
|
43
|
+
staleTime: 60_000,
|
|
44
|
+
});
|
|
45
|
+
useTick(60_000);
|
|
46
|
+
const view = query.data ?? null;
|
|
47
|
+
const d = aboutDisplay(view, Date.now());
|
|
48
|
+
const toggle = () => { const next = !open; writeOpen(next); setOpenState(next); };
|
|
49
|
+
const refresh = async () => {
|
|
50
|
+
if (refreshing) return;
|
|
51
|
+
setRefreshing(true);
|
|
52
|
+
try { const next = await read({ workspaceId, open: true, refresh: true }); client.setQueryData([...aboutKey(workspaceId), true], next); }
|
|
53
|
+
catch { /* the query's error shows */ } finally { setRefreshing(false); }
|
|
54
|
+
};
|
|
55
|
+
const busy = refreshing || view?.status === "pending";
|
|
56
|
+
|
|
57
|
+
const failedKinds = new Set(view?.record?.failed ?? []);
|
|
58
|
+
|
|
59
|
+
// Collapsed it's a plain disclosure row; open, a hairline frame with no fill so the ask stays the raised block.
|
|
60
|
+
return <View style={{ borderRadius: 10, borderWidth: open ? 1 : 0, borderColor: c.border, marginHorizontal: flush ? 0 : compact ? 16 : 12, marginTop: flush ? 0 : 8 }}>
|
|
61
|
+
<Pressable accessibilityRole="button" aria-expanded={open} accessibilityState={{ expanded: open }} accessibilityLabel={`${open ? "Hide" : "Show"} what this workspace is about`}
|
|
62
|
+
accessibilityHint={d.gist && !open ? d.gist : undefined} onPress={toggle}
|
|
63
|
+
style={state => ({ flexDirection: "row", alignItems: "center", gap: 8, paddingHorizontal: open ? 12 : 8, marginHorizontal: open ? 0 : -8, minHeight: compact ? 44 : 32, paddingVertical: 6, borderRadius: 8,
|
|
64
|
+
backgroundColor: state.pressed ? c.surface2 : (state as { hovered?: boolean }).hovered ? c.surface1 : "transparent" })}>
|
|
65
|
+
<Icon name={open ? "ChevronDown" : "ChevronRight"} size={14} color={c.foregroundMuted} />
|
|
66
|
+
<Text style={[t.label, { flexShrink: 0 }]}>What's this about?</Text>
|
|
67
|
+
{!open && d.gist ? <Text numberOfLines={1} style={[t.meta, { flex: 1, minWidth: 0 }]}>{d.gist}</Text> : <View style={{ flex: 1 }} />}
|
|
68
|
+
{!open && view?.status === "pending" && !d.gist && <Spinner color={c.foregroundMuted} size={11} label="Summarizing" />}
|
|
69
|
+
</Pressable>
|
|
70
|
+
{open && <View style={{ paddingHorizontal: 12, paddingBottom: 10, gap: 12 }}>
|
|
71
|
+
<Overview d={d} view={view} c={c} compact={compact} loading={query.isPending} error={query.error ? errorText(query.error) : null} />
|
|
72
|
+
{/* Nothing is claimed about links until an overview exists: "none found" only after a finished write. */}
|
|
73
|
+
{d.body === "overview" && <View style={{ gap: 4 }}>
|
|
74
|
+
<Text accessibilityRole="header" style={[t.small, { fontWeight: "600", letterSpacing: 0.5, textTransform: "uppercase" }]}>Linked</Text>
|
|
75
|
+
{d.links.length ? d.links.map(l => <LinkRow key={l.key} l={l} c={c} compact={compact} failed={failedKinds.has(SOURCE_LABEL[l.kind])} />)
|
|
76
|
+
: <Text style={t.meta}>{d.empty}</Text>}
|
|
77
|
+
</View>}
|
|
78
|
+
{view?.record && <View style={{ flexDirection: "row", alignItems: "center", gap: 8 }}>
|
|
79
|
+
<Text style={[t.small, { flex: 1, minWidth: 0 }]}>{d.footer}</Text>
|
|
80
|
+
<Button theme={theme} compact={compact} kind="ghost" icon="RefreshCw" title={busy ? "Summarizing…" : "Refresh"} accessibilityLabel="Summarize again" disabled={busy} onPress={() => void refresh()} />
|
|
81
|
+
</View>}
|
|
82
|
+
{!view?.record && view?.status === "failed" && <View style={{ flexDirection: "row" }}>
|
|
83
|
+
<Button theme={theme} compact={compact} kind="ghost" icon="RefreshCw" title={busy ? "Summarizing…" : "Try again"} disabled={busy} onPress={() => void refresh()} />
|
|
84
|
+
</View>}
|
|
85
|
+
</View>}
|
|
86
|
+
</View>;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function Overview({ d, view, c, compact, loading, error }: { d: ReturnType<typeof aboutDisplay>; view: AboutView | null; c: Colors; compact: boolean; loading: boolean; error: string | null }) {
|
|
90
|
+
const t = text(c);
|
|
91
|
+
const [more, setMore] = useState(false);
|
|
92
|
+
// onTextLayout doesn't fire on web; about 200 characters fill four lines at phone width.
|
|
93
|
+
const long = compact && (d.overview?.length ?? 0) > 200;
|
|
94
|
+
// Context, not the ask: body size, a step quieter than the ask's text. On a phone, four lines with More.
|
|
95
|
+
if (d.body === "overview") return <View style={{ gap: 4 }}>
|
|
96
|
+
<Text selectable numberOfLines={compact && !more ? 4 : undefined}
|
|
97
|
+
style={[t.body, { lineHeight: 19, color: c.foreground, opacity: 0.88 }]}>{d.overview}</Text>
|
|
98
|
+
{long && <Pressable accessibilityRole="button" onPress={() => setMore(m => !m)} hitSlop={12}><Text style={[t.small, { color: c.foreground }]}>{more ? "Less" : "More"}</Text></Pressable>}
|
|
99
|
+
{d.refreshing && <View style={{ flexDirection: "row", alignItems: "center", gap: 6 }}><Spinner color={c.foregroundMuted} size={10} label="Summarizing" /><Text style={t.small}>Updating…</Text></View>}
|
|
100
|
+
</View>;
|
|
101
|
+
if (d.body === "summarizing" || loading) return <View style={{ gap: 6 }}>
|
|
102
|
+
<View style={{ flexDirection: "row", alignItems: "center", gap: 8 }}>
|
|
103
|
+
<Spinner color={c.foregroundMuted} size={12} label="Summarizing" />
|
|
104
|
+
<Text style={t.meta}>Summarizing…</Text>
|
|
105
|
+
</View>
|
|
106
|
+
{d.excerpt && <Text numberOfLines={3} style={[t.meta, { fontStyle: "italic" }]}>“{d.excerpt}”</Text>}
|
|
107
|
+
</View>;
|
|
108
|
+
if (error) return <Text accessibilityRole="alert" style={[t.meta, { color: c.statusDanger }]}>Couldn't load the overview: {error}</Text>;
|
|
109
|
+
if (d.body === "failed") return <Text accessibilityRole="alert" style={t.meta}>Couldn't write an overview{view?.error ? `: ${view.error}` : "."}</Text>;
|
|
110
|
+
return <Text style={t.meta}>No overview yet.</Text>;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function LinkRow({ l, c, compact, failed }: { l: AboutLink; c: Colors; compact: boolean; failed: boolean }) {
|
|
114
|
+
const t = text(c);
|
|
115
|
+
const line = linkLine(l);
|
|
116
|
+
const bare = !l.title && !l.excerpt;
|
|
117
|
+
// A source that couldn't be read says so on its own row, muted: it doesn't need the developer.
|
|
118
|
+
const meta = bare && failed ? [...line.meta, `${SOURCE_LABEL[l.kind]} couldn't be read`] : line.meta;
|
|
119
|
+
return <Pressable accessibilityRole="link" accessibilityLabel={[SOURCE_LABEL[l.kind], line.lead, line.title, ...meta].filter(Boolean).join(", ")} disabled={!l.url}
|
|
120
|
+
onPress={() => { if (l.url) void openExternalUrl(l.url).catch(() => undefined); }}
|
|
121
|
+
style={state => ({ flexDirection: "row", alignItems: "flex-start", gap: 10, minHeight: compact ? 44 : undefined, paddingVertical: compact ? 8 : 4, paddingHorizontal: 6, marginHorizontal: -6, borderRadius: 6, backgroundColor: (state as { hovered?: boolean }).hovered ? c.surface1 : "transparent" })}>
|
|
122
|
+
<Text numberOfLines={1} style={[t.small, { width: 46, paddingTop: 2 }]}>{SOURCE_LABEL[l.kind]}</Text>
|
|
123
|
+
<View style={{ flex: 1, minWidth: 0, gap: 1 }}>
|
|
124
|
+
<Text numberOfLines={2} style={t.body}>
|
|
125
|
+
<Text style={{ fontWeight: "500", fontVariant: ["tabular-nums"], color: bare ? c.foregroundMuted : c.foreground }}>{line.lead}</Text>
|
|
126
|
+
{line.title ? <Text>{` ${line.title}`}</Text> : bare && l.url && l.kind !== "slack" ? <Text style={{ color: c.foregroundMuted }}>{" link"}</Text> : null}
|
|
127
|
+
</Text>
|
|
128
|
+
{!!meta.length && <Text numberOfLines={1} style={t.small}>{meta.join(" · ")}</Text>}
|
|
129
|
+
</View>
|
|
130
|
+
{!!l.url && <View style={{ paddingTop: 3 }}><Icon name="ArrowUpRight" size={12} color={c.foregroundMuted} /></View>}
|
|
131
|
+
</Pressable>;
|
|
132
|
+
}
|
package/client/home.tsx
CHANGED
|
@@ -10,6 +10,7 @@ import { age, snoozeUntil, type InboxRow } from "../shared/inbox";
|
|
|
10
10
|
import { errorText } from "../shared/errors";
|
|
11
11
|
import { isLoaded, type LoadSignals } from "../shared/agent-load";
|
|
12
12
|
import { BriefCard, type BriefDeps } from "./brief";
|
|
13
|
+
import { AboutSection } from "./about";
|
|
13
14
|
import { Button, IconButton, text, type Theme } from "./kit";
|
|
14
15
|
import { NeedsYouList } from "./needs-you";
|
|
15
16
|
import { PrSheet } from "./pr-sheet";
|
|
@@ -237,6 +238,7 @@ function DetailPane({ s, model, theme, compact, deps, openFull, signOffNext, onB
|
|
|
237
238
|
return <View style={{ flex: 1, backgroundColor: c.surface0 }}>
|
|
238
239
|
{header}
|
|
239
240
|
<ScrollView style={{ flex: 1 }} contentContainerStyle={{ padding: compact ? 16 : 20, gap: 16, paddingBottom: 24 }} keyboardShouldPersistTaps="handled">
|
|
241
|
+
{!compact && s.workspaceId && w && <AboutSection key={s.workspaceId} workspaceId={s.workspaceId} theme={theme} compact={compact} flush />}
|
|
240
242
|
{agent.permissions.map(p => <PermissionBlock key={p.id} p={p} theme={theme} compact={compact} busy={busy === `perm:${p.id}`} primary={plan.primary === "allow"} onRespond={r => void respond(p, r)} />)}
|
|
241
243
|
{b && s.agentId && !(b.kind === "permission" && agent.permissions.length) ? <BriefCard {...({ embedded: true, item: { data: b }, theme, layout: { compact }, agentId: s.agentId, deps: deps.briefDeps } as unknown as Parameters<typeof BriefCard>[0])} />
|
|
242
244
|
: row?.needs && !agent.permissions.length && !b ? <Text style={[t.body, { fontSize: 15, lineHeight: 21, fontWeight: "600" }]}>{s.line || s.word || "Needs you"}</Text>
|
|
@@ -244,6 +246,8 @@ function DetailPane({ s, model, theme, compact, deps, openFull, signOffNext, onB
|
|
|
244
246
|
{w && <NeedsYouList workspace={w} theme={theme} compact={compact} flush skip={b?.decisions.length ? ["question"] : []}
|
|
245
247
|
actions={{ openPr: (key, intent) => setSheet({ key, intent }), openQuestion: setQuestion, openAgent: () => openFull(s) }} />}
|
|
246
248
|
{actionBar}
|
|
249
|
+
{/* On a phone the ask and its moves come first; the reminder sits under them. */}
|
|
250
|
+
{compact && s.workspaceId && w && <AboutSection key={s.workspaceId} workspaceId={s.workspaceId} theme={theme} compact={compact} flush />}
|
|
247
251
|
{s.agentId && <View style={{ gap: 8 }}>
|
|
248
252
|
<Text style={[t.small, { fontWeight: "600", letterSpacing: 0.5, textTransform: "uppercase" }]}>{tail.asleep && tail.seenAt ? `Last seen · ${age(new Date(tail.seenAt).toISOString(), Date.now()) === "now" ? "just now" : `${age(new Date(tail.seenAt).toISOString(), Date.now())} ago`}` : tail.steps?.length ? `Recent · last ${tail.steps.length} steps` : "Recent steps"}</Text>
|
|
249
253
|
{!!tail.error && <Text style={t.meta}>{`Couldn't load the agent's steps: ${tail.error}`}</Text>}
|
package/client/needs-you.tsx
CHANGED
|
@@ -8,6 +8,7 @@ import type { Workspace } from "../shared/model";
|
|
|
8
8
|
import { Button, Card, CardRow, errorText, text, type Theme } from "./kit";
|
|
9
9
|
import type { Colors } from "./theme";
|
|
10
10
|
import { meanwhile } from "./questions";
|
|
11
|
+
import { useReviewerSettings } from "./reviewers";
|
|
11
12
|
|
|
12
13
|
import { overviewKey, workspaceKey } from "./keys";
|
|
13
14
|
export { overviewKey, workspaceKey };
|
|
@@ -36,6 +37,7 @@ export type NeedActions = {
|
|
|
36
37
|
/** The developer's queue: one row per decision, each with its single action inline. */
|
|
37
38
|
export function NeedsYouList({ workspace: w, theme, compact, actions, now = Date.now(), flush = false, skip = [] }: { workspace: Workspace; theme: Theme; compact: boolean; actions: NeedActions; now?: number; flush?: boolean; skip?: NeedItem["kind"][] }) {
|
|
38
39
|
const c = theme.colors; const t = text(c);
|
|
40
|
+
useReviewerSettings();
|
|
39
41
|
const toast = useToast();
|
|
40
42
|
const cache = useQueryClient();
|
|
41
43
|
const control = useRpc(controlRpc); const send = useRpc(sendRpc); const check = useRpc(checkPrActionRpc);
|
package/client/panel.tsx
CHANGED
|
@@ -22,6 +22,7 @@ import { PrSheet } from "./pr-sheet";
|
|
|
22
22
|
import { ActivityCard, QuestionSheet } from "./questions";
|
|
23
23
|
import { SpecRow, SpecSheet } from "./spec";
|
|
24
24
|
import { tint } from "./theme";
|
|
25
|
+
import { AboutSection } from "./about";
|
|
25
26
|
|
|
26
27
|
export { overviewKey, workspaceKey };
|
|
27
28
|
|
|
@@ -111,8 +112,9 @@ function PanelWorkspace(props: PanelProps & { workspace: Workspace; loadError?:
|
|
|
111
112
|
const { openLarge } = props;
|
|
112
113
|
const compact = props.layout.compact;
|
|
113
114
|
const top = <PanelTop theme={props.theme} compact={compact} openOverview={props.openOverview} />;
|
|
115
|
+
const about = <AboutSection key={props.workspaceId} workspaceId={props.workspaceId} theme={props.theme} compact={compact} />;
|
|
114
116
|
const ask = props.inbox && props.briefDeps ? <MainAsk w={props.workspace} theme={props.theme} compact={compact} inbox={props.inbox} briefDeps={props.briefDeps} /> : null;
|
|
115
|
-
return <WorkspaceView {...props} top={top} ask={ask} folds={{ isOpen, toggle }} resize={openLarge ? { icon: "Maximize2", label: "Open the larger view", onPress: () => openLarge(props.workspaceId) } : null} />;
|
|
117
|
+
return <WorkspaceView {...props} top={top} about={about} ask={ask} folds={{ isOpen, toggle }} resize={openLarge ? { icon: "Maximize2", label: "Open the larger view", onPress: () => openLarge(props.workspaceId) } : null} />;
|
|
116
118
|
}
|
|
117
119
|
|
|
118
120
|
|
|
@@ -234,8 +236,8 @@ const folds = z.object({ open: z.array(z.string()) });
|
|
|
234
236
|
/** Two columns from this content width: actions on the left, the stacks on the right. */
|
|
235
237
|
export const WIDE_MIN = 820;
|
|
236
238
|
|
|
237
|
-
export function WorkspaceView({ theme, layout, workspace: w, navigation, loadError, openSettings, openOverview, folds: { isOpen, toggle }, resize, large = false, top, ask }: PluginHostProps & {
|
|
238
|
-
navigation?: PluginWorkspacePanelProps["navigation"]; workspace: Workspace; loadError?: string | null; openSettings: () => void; openOverview: () => void; top?: ReactNode; ask?: ReactNode;
|
|
239
|
+
export function WorkspaceView({ theme, layout, workspace: w, navigation, loadError, openSettings, openOverview, folds: { isOpen, toggle }, resize, large = false, top, about, ask }: PluginHostProps & {
|
|
240
|
+
navigation?: PluginWorkspacePanelProps["navigation"]; workspace: Workspace; loadError?: string | null; openSettings: () => void; openOverview: () => void; top?: ReactNode; about?: ReactNode; ask?: ReactNode;
|
|
239
241
|
folds: Folds; resize: { icon: "Maximize2" | "Minimize2"; label: string; onPress: () => void } | null; large?: boolean;
|
|
240
242
|
}) {
|
|
241
243
|
const control = useRpc(controlRpc); const refresh = useRpc(refreshRpc); const browserRead = useRpc(browserStatusRpc);
|
|
@@ -273,6 +275,7 @@ export function WorkspaceView({ theme, layout, workspace: w, navigation, loadErr
|
|
|
273
275
|
{top}
|
|
274
276
|
<ScrollView style={{ flex: 1 }} contentContainerStyle={{ paddingBottom: 20, ...(large ? { maxWidth: 1240, width: "100%", alignSelf: "center", paddingHorizontal: 12 } : null) }}>
|
|
275
277
|
{header}
|
|
278
|
+
{about}
|
|
276
279
|
{ask}
|
|
277
280
|
{wide ? <View style={{ flexDirection: "row", alignItems: "flex-start" }}>
|
|
278
281
|
<View style={{ flex: 5, minWidth: 0 }}>{shipped}{needs}{agent}{history}{tasks}</View>
|
package/client/pill.tsx
CHANGED
|
@@ -17,6 +17,7 @@ import type { LiveStore } from "./live";
|
|
|
17
17
|
import { NeedsYouList, workspaceKey } from "./needs-you";
|
|
18
18
|
import { PrSheet } from "./pr-sheet";
|
|
19
19
|
import { QuestionSheet, QuestionStepper } from "./questions";
|
|
20
|
+
import { useReviewerSettings } from "./reviewers";
|
|
20
21
|
|
|
21
22
|
export const PILL_ID = "follow-up";
|
|
22
23
|
|
|
@@ -42,6 +43,7 @@ const stateFor = (t: Target | undefined, recent: { agentIds: string[]; at: numbe
|
|
|
42
43
|
t ? pillState({ row: t.row, items: t.items, recent, now }) : null;
|
|
43
44
|
|
|
44
45
|
function useTarget(deps: Deps, agentId: string, workspaceId: string) {
|
|
46
|
+
useReviewerSettings();
|
|
45
47
|
useSyncExternalStore(deps.live.subscribe, deps.live.version, deps.live.version);
|
|
46
48
|
useInbox(deps.inbox, () => deps.inbox.version());
|
|
47
49
|
const now = Date.now();
|
package/client/pr-controls.tsx
CHANGED
|
@@ -8,7 +8,8 @@ import { mergeBlockers, prActionBlocks, type ActionPlan, type PrActionKind } fro
|
|
|
8
8
|
import { mergeQueued, mergeReady } from "../shared/attention";
|
|
9
9
|
import type { Pr, Workspace } from "../shared/model";
|
|
10
10
|
import { Button, Switch, errorText, text, type Theme } from "./kit";
|
|
11
|
-
import {
|
|
11
|
+
import { noReviewers, resolveReviewers, withoutAuthor, type ReviewerEntry } from "../shared/reviewers";
|
|
12
|
+
import { ReviewerPicker, reviewerSettingsKey, useReviewerSettings, willAsk } from "./reviewers";
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* Merge, merge-when-ready and reviewer requests for one PR. Every write needs a click; Merge always
|
|
@@ -23,7 +24,11 @@ export function PrControls({ pr, workspace, theme, compact, browserReady, intent
|
|
|
23
24
|
const statusKey = ["follow-through", "pr-controls", workspace.id, pr.key, pr.snapshot?.head];
|
|
24
25
|
const status = useQuery({ queryKey: statusKey, queryFn: () => read({ workspaceId: workspace.id, prKey: pr.key }), refetchInterval: 5000, enabled: browserReady });
|
|
25
26
|
const invalidate = () => { void cache.invalidateQueries({ queryKey: ["follow-through", "workspace", workspace.id] }); void cache.invalidateQueries({ queryKey: ["follow-through", "pr-controls", workspace.id] }); void cache.invalidateQueries({ queryKey: ["follow-through", "overview"] }); };
|
|
26
|
-
const
|
|
27
|
+
const [picking, setPicking] = useState(false);
|
|
28
|
+
const reviewerSettings = useReviewerSettings();
|
|
29
|
+
// `picked`: this PR only, from the picker; `remember` also saves them for the repository.
|
|
30
|
+
const reviewRequest = useMutation({ mutationFn: (input?: { picked: ReviewerEntry[]; remember: boolean }) => requestReviewers({ workspaceId: workspace.id, prKey: pr.key, ...(input ? { reviewers: input.picked, remember: input.remember } : {}) }),
|
|
31
|
+
onSuccess: (reply, input) => { setPicking(false); setNotice(reply.result); if (reply.state === "submitted") toast.show(reply.result, { variant: "success" }); if (input?.remember) void cache.invalidateQueries({ queryKey: reviewerSettingsKey }); invalidate(); }, onError: invalidate });
|
|
27
32
|
const submit = useMutation({ mutationFn: (input: { planId: string; scope: "target" | "downstack" }) => confirm(input), onSuccess: reply => { setPlan(null); setNotice(reply.result); if (reply.state === "submitted") toast.show(reply.result, { variant: "success" }); invalidate(); }, onError: invalidate });
|
|
28
33
|
const checking = useMutation({ mutationFn: (kind: PrActionKind) => prepare({ workspaceId: workspace.id, prKey: pr.key, kind }), onSuccess: result => {
|
|
29
34
|
if (result.kind !== "merge" && result.prs.length === 1 && !result.blockers.length && !result.prs[0].blockers.length) submit.mutate({ planId: result.id, scope: "target" });
|
|
@@ -39,7 +44,7 @@ export function PrControls({ pr, workspace, theme, compact, browserReady, intent
|
|
|
39
44
|
const canMerge = mergeReady(pr, workspace) && !actual?.merging;
|
|
40
45
|
const disabled = busy || reviewRequest.isPending || pendingAction || workspace.archived;
|
|
41
46
|
const missingReviewers = noReviewers(pr);
|
|
42
|
-
const reviewers =
|
|
47
|
+
const reviewers = reviewerSettings.data ? withoutAuthor(resolveReviewers(reviewerSettings.data.config, pr.repo).reviewers, pr.snapshot?.reviewers?.author) : [];
|
|
43
48
|
const begin = (kind: PrActionKind) => { setPlan(null); setNotice(null); submit.reset(); checking.reset(); checking.mutate(kind); };
|
|
44
49
|
const failure = checking.error ?? submit.error ?? reviewRequest.error;
|
|
45
50
|
const error = failure ? errorText(failure) : (browserReady ? status.data?.error : null) ?? null;
|
|
@@ -48,14 +53,22 @@ export function PrControls({ pr, workspace, theme, compact, browserReady, intent
|
|
|
48
53
|
// Opening the sheet from "Merge…" starts the read-only check; the merge itself still needs the confirm click.
|
|
49
54
|
const started = useRef(false);
|
|
50
55
|
useEffect(() => { if (intent === "merge" && canMerge && !disabled && !started.current) { started.current = true; begin("merge"); } }, [intent, canMerge]);
|
|
56
|
+
// Opening from "Add reviewers" with nobody set goes straight to the picker instead of an error.
|
|
57
|
+
const loaded = !!reviewerSettings.data;
|
|
58
|
+
useEffect(() => { if (intent === "reviewers" && loaded && missingReviewers && !pr.snapshot?.draft && !reviewers.length) setPicking(true); }, [intent, loaded]);
|
|
51
59
|
if (pr.snapshot?.state !== "OPEN") return null;
|
|
52
60
|
const waitingFor = mergeBlockers(pr).filter(b => !b.startsWith("Graphite "));
|
|
53
61
|
return <View style={{ gap: 10 }}>
|
|
54
62
|
{missingReviewers && <View style={{ flexDirection: "row", alignItems: "center", flexWrap: "wrap", gap: 8 }}>
|
|
55
63
|
<Icon name="UserX" size={14} color={c.statusWarning} />
|
|
56
|
-
<Text style={[t.meta, { flex: 1, minWidth: 120, color: c.statusWarning }]}>No reviewers yet</Text>
|
|
57
|
-
{!pr.snapshot?.draft &&
|
|
64
|
+
<Text style={[t.meta, { flex: 1, minWidth: 120, color: c.statusWarning }]}>{!pr.snapshot?.draft && !picking && reviewers.length ? <>No reviewers yet<Text style={{ color: c.foregroundMuted }}>{` · will ask ${willAsk(reviewers)}`}</Text></> : "No reviewers yet"}</Text>
|
|
65
|
+
{!pr.snapshot?.draft && !picking && reviewerSettings.data && <>
|
|
66
|
+
{reviewers.length > 0 && <Button title={reviewRequest.isPending ? "Requesting…" : "Add reviewers"} accessibilityLabel={`Add reviewers: ${willAsk(reviewers)} for ${pr.repo} pull request ${pr.number}`} icon="UserPlus" theme={theme} compact={compact} disabled={disabled} loading={reviewRequest.isPending} onPress={() => { setNotice(null); reviewRequest.mutate(undefined); }} />}
|
|
67
|
+
<Button title={reviewers.length ? "Choose others…" : "Add reviewers…"} kind={reviewers.length ? "ghost" : "secondary"} icon={reviewers.length ? undefined : "UserPlus"} accessibilityLabel={reviewers.length ? "Pick different reviewers for this PR" : `Pick reviewers for ${pr.repo} pull request ${pr.number}`} theme={theme} compact={compact} disabled={disabled} onPress={() => { setNotice(null); setPicking(true); }} />
|
|
68
|
+
</>}
|
|
58
69
|
</View>}
|
|
70
|
+
{missingReviewers && !pr.snapshot?.draft && picking && <ReviewerPicker repo={pr.repo} author={pr.snapshot?.reviewers?.author ?? null} theme={theme} compact={compact} busy={reviewRequest.isPending}
|
|
71
|
+
onCancel={() => setPicking(false)} onRequest={(picked, remember) => reviewRequest.mutate({ picked, remember })} />}
|
|
59
72
|
{!plan && <View style={{ flexDirection: "row", alignItems: "center", flexWrap: "wrap", gap: 12 }}>
|
|
60
73
|
{(canMerge || queued || recentlySubmitted || busy) ? <Button title={busy ? checking.isPending ? "Checking…" : "Submitting…" : queued ? "Queued to merge" : recentlySubmitted ? "Submitted" : `Merge #${pr.number}`} icon={queued ? "Clock" : "GitMerge"} theme={theme} compact={compact} kind={canMerge ? "primary" : "secondary"} loading={busy} disabled={disabled || !canMerge} onPress={() => begin("merge")} />
|
|
61
74
|
: <Text style={[t.meta, { flex: 1 }]}>{waitingFor.length ? `Merge opens when it clears: ${waitingFor.join(", ").toLowerCase()}.` : "Waiting for Graphite to report it ready to merge."}</Text>}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { useEffect, useMemo, useState } from "react";
|
|
2
|
+
import { Pressable, Text, TextInput, View } from "react-native";
|
|
3
|
+
import { useRpc } from "@getpaseo/plugin/client";
|
|
4
|
+
import { Icon, useToast } from "@getpaseo/plugin/client/ui";
|
|
5
|
+
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
6
|
+
import { reviewerSettingsRpc, reviewerSuggestionsRpc, saveReviewersRpc } from "../shared/contracts";
|
|
7
|
+
import { MAX_REVIEWERS, TEAM_SLUG, USER_LOGIN, isTeam, resolveReviewers, reviewerConfig, reviewerLabel, sameLogin, setReviewerConfig, type ReviewerEntry } from "../shared/reviewers";
|
|
8
|
+
import { Button, Switch, errorText, text, type Theme } from "./kit";
|
|
9
|
+
|
|
10
|
+
export const reviewerSettingsKey = ["follow-through", "reviewer-settings"];
|
|
11
|
+
|
|
12
|
+
/** The saved reviewer lists. Loading them also updates what Needs you and the briefs read. */
|
|
13
|
+
export function useReviewerSettings() {
|
|
14
|
+
const read = useRpc(reviewerSettingsRpc);
|
|
15
|
+
const cache = useQueryClient();
|
|
16
|
+
const query = useQuery({ queryKey: reviewerSettingsKey, queryFn: () => read({}), staleTime: 60_000 });
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
// Every mounted user shares one query; only a real change re-renders what read the old lists.
|
|
19
|
+
if (!query.data || JSON.stringify(query.data.config) === JSON.stringify(reviewerConfig())) return;
|
|
20
|
+
setReviewerConfig(query.data.config);
|
|
21
|
+
// Needs-you rows and counts were computed with the previous lists.
|
|
22
|
+
void cache.invalidateQueries({ queryKey: ["follow-through", "workspace"] }); void cache.invalidateQueries({ queryKey: ["follow-through", "overview"] });
|
|
23
|
+
}, [query.data]);
|
|
24
|
+
return query;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const valid = (login: string) => USER_LOGIN.test(login) || TEAM_SLUG.test(login);
|
|
28
|
+
|
|
29
|
+
function ReviewerChip({ r, theme, compact, onRemove }: { r: ReviewerEntry; theme: Theme; compact: boolean; onRemove?: () => void }) {
|
|
30
|
+
const c = theme.colors;
|
|
31
|
+
const label = reviewerLabel(r);
|
|
32
|
+
return <View style={{ flexDirection: "row", alignItems: "center", gap: 5, paddingLeft: 8, paddingRight: onRemove ? 2 : 8, minHeight: compact ? 44 : 28, borderRadius: 6, backgroundColor: c.surface2 }}>
|
|
33
|
+
<Icon name={isTeam(r.login) ? "Users" : "User"} size={12} color={c.foregroundMuted} />
|
|
34
|
+
<Text numberOfLines={1} style={{ color: c.foreground, fontSize: 12, lineHeight: 16, fontWeight: "500", maxWidth: 200 }}>{label}</Text>
|
|
35
|
+
{label !== r.login && <Text numberOfLines={1} style={{ color: c.foregroundMuted, fontSize: 11, lineHeight: 16, maxWidth: 160 }}>{r.login}</Text>}
|
|
36
|
+
{onRemove && <Pressable accessibilityRole="button" accessibilityLabel={`Remove ${label}`} onPress={onRemove} hitSlop={compact ? 0 : 5}
|
|
37
|
+
style={({ pressed }) => ({ width: compact ? 44 : 24, height: compact ? 44 : 24, borderRadius: 4, alignItems: "center", justifyContent: "center", backgroundColor: pressed ? c.surface1 : "transparent" })}>
|
|
38
|
+
<Icon name="X" size={12} color={c.foregroundMuted} />
|
|
39
|
+
</Pressable>}
|
|
40
|
+
</View>;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* "Add reviewer": free text (a login or org/team), with the repository's collaborators and teams as suggestions.
|
|
45
|
+
* Suggestions load when the field is focused, once per repository (cached on the server too).
|
|
46
|
+
*/
|
|
47
|
+
function AddReviewer({ repo, theme, compact, taken, onAdd }: { repo: string | null; theme: Theme; compact: boolean; taken: string[]; onAdd: (r: ReviewerEntry) => void }) {
|
|
48
|
+
const c = theme.colors; const t = text(c);
|
|
49
|
+
const suggestRead = useRpc(reviewerSuggestionsRpc);
|
|
50
|
+
const [value, setValue] = useState("");
|
|
51
|
+
const [focused, setFocused] = useState(false);
|
|
52
|
+
// The list shows while the field has focus; blur closes it a beat later so a tap on a suggestion still lands.
|
|
53
|
+
const [open, setOpen] = useState(false);
|
|
54
|
+
const suggestions = useQuery({ queryKey: ["follow-through", "reviewer-suggestions", repo], queryFn: () => suggestRead({ repo: repo! }), enabled: !!repo && focused, staleTime: 600_000, retry: false });
|
|
55
|
+
const q = value.trim().replace(/^@/, "");
|
|
56
|
+
const matches = (suggestions.data?.suggestions ?? []).filter(s => !taken.some(l => sameLogin(l, s.login)) && (!q || s.login.toLowerCase().includes(q.toLowerCase()) || (s.name ?? "").toLowerCase().includes(q.toLowerCase()))).slice(0, 6);
|
|
57
|
+
const add = (r: ReviewerEntry) => { onAdd(r); setValue(""); setOpen(false); };
|
|
58
|
+
const typed = !!q && valid(q) && !taken.some(l => sameLogin(l, q));
|
|
59
|
+
return <View style={{ gap: 6 }}>
|
|
60
|
+
<View style={{ flexDirection: "row", alignItems: "center", gap: 8 }}>
|
|
61
|
+
<TextInput accessibilityLabel={repo ? `Add a reviewer for ${repo}` : "Add a default reviewer"} value={value} placeholder="Login or org/team" placeholderTextColor={c.foregroundMuted}
|
|
62
|
+
autoCapitalize="none" autoCorrect={false} onFocus={() => { setFocused(true); setOpen(true); }} onBlur={() => setTimeout(() => setOpen(false), 150)}
|
|
63
|
+
onKeyPress={e => { if (e.nativeEvent.key === "Escape") setOpen(false); }} onChangeText={v => { setValue(v); setOpen(true); }} onSubmitEditing={() => { if (typed) add({ login: q, name: null }); }}
|
|
64
|
+
style={{ flex: 1, minWidth: 0, minHeight: compact ? 44 : 32, paddingHorizontal: 10, borderRadius: 6, borderWidth: 1, borderColor: c.border, color: c.foreground, fontSize: 13, backgroundColor: c.surface0 }} />
|
|
65
|
+
<Button theme={theme} compact={compact} icon="Plus" title="Add" disabled={!typed} accessibilityLabel={typed ? `Add ${q}` : "Add reviewer"} onPress={() => add({ login: q, name: null })} />
|
|
66
|
+
</View>
|
|
67
|
+
{!!q && !valid(q) && <Text style={[t.small, { color: c.statusWarning }]}>Use a GitHub login like octocat, or a team as org/team.</Text>}
|
|
68
|
+
{open && suggestions.isFetching && !suggestions.data && <Text style={t.small}>Loading collaborators…</Text>}
|
|
69
|
+
{open && suggestions.data?.error && <Text style={t.small}>{suggestions.data.error}</Text>}
|
|
70
|
+
{open && matches.length > 0 && <View style={{ borderRadius: 6, borderWidth: 1, borderColor: c.border, overflow: "hidden" }}>
|
|
71
|
+
{matches.map((s, i) => <Pressable key={s.login} accessibilityRole="button" accessibilityLabel={`Add ${s.name ?? s.login}`} onPress={() => add({ login: s.login, name: s.kind === "team" ? s.name : null })}
|
|
72
|
+
style={({ pressed, hovered }: { pressed: boolean; hovered?: boolean }) => ({ flexDirection: "row", alignItems: "center", gap: 8, minHeight: compact ? 44 : 30, paddingHorizontal: 10, borderTopWidth: i ? 1 : 0, borderTopColor: c.border, backgroundColor: pressed ? c.surface2 : hovered ? c.surface1 : "transparent" })}>
|
|
73
|
+
<Icon name={s.kind === "team" ? "Users" : "User"} size={12} color={c.foregroundMuted} />
|
|
74
|
+
<Text numberOfLines={1} style={[t.body, { flexShrink: 1 }]}>{s.login}</Text>
|
|
75
|
+
{s.name && <Text numberOfLines={1} style={[t.small, { flexShrink: 1 }]}>{s.name}</Text>}
|
|
76
|
+
</Pressable>)}
|
|
77
|
+
</View>}
|
|
78
|
+
</View>;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** One list (a repository, or the default for all repos) with its chips and Add reviewer. Saves on every change. */
|
|
82
|
+
function ReviewerList({ repo, list, theme, compact, fallback, first }: { repo: string | null; list: ReviewerEntry[]; theme: Theme; compact: boolean; fallback?: string | null; first?: boolean }) {
|
|
83
|
+
const c = theme.colors; const t = text(c);
|
|
84
|
+
const save = useRpc(saveReviewersRpc); const cache = useQueryClient(); const toast = useToast();
|
|
85
|
+
const [adding, setAdding] = useState(false);
|
|
86
|
+
const change = useMutation({ mutationFn: (next: ReviewerEntry[]) => save({ repo, reviewers: next }), onSuccess: data => { cache.setQueryData(reviewerSettingsKey, data); setReviewerConfig(data.config); }, onError: error => toast.error(errorText(error)) });
|
|
87
|
+
return <View style={{ gap: 8, paddingHorizontal: 14, paddingVertical: 12, borderTopWidth: first ? 0 : 1, borderTopColor: c.border }}>
|
|
88
|
+
<View style={{ flexDirection: "row", alignItems: "center", gap: 8 }}>
|
|
89
|
+
<Icon name={repo ? "GitPullRequest" : "Globe"} size={13} color={c.foregroundMuted} />
|
|
90
|
+
<Text numberOfLines={1} style={[t.label, { flex: 1, minWidth: 0 }]}>{repo ?? "Default for all repos"}</Text>
|
|
91
|
+
{adding ? <Button theme={theme} compact={compact} kind="ghost" icon="Check" title="Done" accessibilityLabel={`Done adding to ${repo ?? "the default list"}`} onPress={() => setAdding(false)} />
|
|
92
|
+
: list.length < MAX_REVIEWERS && <Button theme={theme} compact={compact} kind="ghost" icon="UserPlus" title="Add reviewer" accessibilityLabel={`Add reviewer to ${repo ?? "the default list"}`} onPress={() => setAdding(true)} />}
|
|
93
|
+
</View>
|
|
94
|
+
{list.length > 0 ? <View style={{ flexDirection: "row", flexWrap: "wrap", gap: 6 }}>
|
|
95
|
+
{list.map((r, i) => <ReviewerChip key={r.login} r={r} theme={theme} compact={compact} onRemove={change.isPending ? undefined : () => change.mutate(list.filter((_, j) => j !== i))} />)}
|
|
96
|
+
</View> : <Text style={t.meta}>{fallback ?? "Nobody yet. Add reviewers opens a picker."}</Text>}
|
|
97
|
+
{adding && <AddReviewer repo={repo} theme={theme} compact={compact} taken={list.map(r => r.login)} onAdd={r => change.mutate([...list, r])} />}
|
|
98
|
+
</View>;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/** Settings → Reviewers: who "Add reviewers" asks, per repository, with a default for the rest. */
|
|
102
|
+
export function ReviewerSettings({ theme, compact = false }: { theme: Theme; compact?: boolean }) {
|
|
103
|
+
const c = theme.colors; const t = text(c);
|
|
104
|
+
const query = useReviewerSettings();
|
|
105
|
+
const data = query.data;
|
|
106
|
+
return <View style={{ gap: 8 }}>
|
|
107
|
+
{query.isPending && <Text style={t.meta}>Loading reviewers…</Text>}
|
|
108
|
+
{query.error && <Text accessibilityRole="alert" style={[t.meta, { color: c.statusDanger }]}>{errorText(query.error)}</Text>}
|
|
109
|
+
{data && <View style={{ borderRadius: 10, borderWidth: 1, borderColor: c.border, backgroundColor: c.surface1, overflow: "hidden" }}>
|
|
110
|
+
<ReviewerList first repo={null} list={data.config.defaults} theme={theme} compact={compact} fallback="Nobody. Repositories without their own list open the picker." />
|
|
111
|
+
{data.repos.map(repo => <ReviewerList key={repo} repo={repo} list={data.config.repos[repo] ?? []} theme={theme} compact={compact}
|
|
112
|
+
fallback={data.config.defaults.length ? `Uses the default: ${data.config.defaults.map(reviewerLabel).join(", ")}` : null} />)}
|
|
113
|
+
</View>}
|
|
114
|
+
{data && !data.repos.length && <Text style={t.meta}>Repositories show here once Follow-up has seen a PR in them.</Text>}
|
|
115
|
+
</View>;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* The picker in the PR sheet: check who to ask on this PR only; "Remember for <repo>" also saves them as its list.
|
|
120
|
+
* The author is listed but can't be picked.
|
|
121
|
+
*/
|
|
122
|
+
export function ReviewerPicker({ repo, author, theme, compact, busy, onCancel, onRequest }: {
|
|
123
|
+
repo: string; author: string | null; theme: Theme; compact: boolean; busy: boolean;
|
|
124
|
+
onCancel: () => void; onRequest: (reviewers: ReviewerEntry[], remember: boolean) => void;
|
|
125
|
+
}) {
|
|
126
|
+
const c = theme.colors; const t = text(c);
|
|
127
|
+
const settings = useReviewerSettings();
|
|
128
|
+
const config = settings.data?.config;
|
|
129
|
+
const saved = useMemo(() => config ? resolveReviewers(config, repo).reviewers : [], [config, repo]);
|
|
130
|
+
const [options, setOptions] = useState<ReviewerEntry[]>([]);
|
|
131
|
+
const [checked, setChecked] = useState<string[]>([]);
|
|
132
|
+
const [remember, setRemember] = useState(false);
|
|
133
|
+
const [init, setInit] = useState(false);
|
|
134
|
+
useEffect(() => { if (config && !init) { setOptions(saved); setChecked(saved.filter(r => !isAuthor(r)).map(r => r.login.toLowerCase())); setRemember(!saved.length); setInit(true); } }, [config]);
|
|
135
|
+
const isAuthor = (r: ReviewerEntry) => !!author && !isTeam(r.login) && sameLogin(r.login, author);
|
|
136
|
+
const picked = options.filter(r => checked.includes(r.login.toLowerCase()) && !isAuthor(r));
|
|
137
|
+
const toggle = (r: ReviewerEntry) => setChecked(v => v.includes(r.login.toLowerCase()) ? v.filter(x => x !== r.login.toLowerCase()) : [...v, r.login.toLowerCase()]);
|
|
138
|
+
const sameAsSaved = picked.length === saved.length && picked.every((r, i) => sameLogin(r.login, saved[i].login));
|
|
139
|
+
return <View accessibilityRole="summary" accessibilityLabel="Pick reviewers for this PR" style={{ gap: 8 }}>
|
|
140
|
+
{!options.length && <Text style={t.meta}>{`No reviewers set for ${repo}. Add who to ask on this PR.`}</Text>}
|
|
141
|
+
{options.map(r => {
|
|
142
|
+
const on = checked.includes(r.login.toLowerCase()) && !isAuthor(r);
|
|
143
|
+
return <Pressable key={r.login} accessibilityRole="checkbox" accessibilityState={{ checked: on, disabled: isAuthor(r) }} aria-checked={on} disabled={isAuthor(r)}
|
|
144
|
+
accessibilityLabel={`${reviewerLabel(r)}${isAuthor(r) ? ", the PR author" : ""}`} onPress={() => toggle(r)}
|
|
145
|
+
style={({ pressed }) => ({ flexDirection: "row", alignItems: "center", gap: 10, minHeight: compact ? 44 : 30, paddingHorizontal: 4, borderRadius: 6, backgroundColor: pressed ? c.surface2 : "transparent", opacity: isAuthor(r) ? 0.5 : 1 })}>
|
|
146
|
+
<View style={{ width: 16, height: 16, borderRadius: 4, borderWidth: 1, borderColor: on ? c.accent : c.border, backgroundColor: on ? c.accent : "transparent", alignItems: "center", justifyContent: "center" }}>
|
|
147
|
+
{on && <Icon name="Check" size={11} color={c.accentForeground} />}
|
|
148
|
+
</View>
|
|
149
|
+
<Icon name={isTeam(r.login) ? "Users" : "User"} size={12} color={c.foregroundMuted} />
|
|
150
|
+
<Text numberOfLines={1} style={[t.body, { flexShrink: 1 }]}>{reviewerLabel(r)}</Text>
|
|
151
|
+
{reviewerLabel(r) !== r.login && <Text numberOfLines={1} style={[t.small, { flexShrink: 1 }]}>{r.login}</Text>}
|
|
152
|
+
{isAuthor(r) && <Text style={t.small}>author</Text>}
|
|
153
|
+
</Pressable>;
|
|
154
|
+
})}
|
|
155
|
+
{options.length < MAX_REVIEWERS && <AddReviewer repo={repo} theme={theme} compact={compact} taken={[...options.map(r => r.login), ...(author ? [author] : [])]}
|
|
156
|
+
onAdd={r => { setOptions(v => [...v, r]); setChecked(v => [...v, r.login.toLowerCase()]); }} />}
|
|
157
|
+
{picked.length > 0 && !sameAsSaved && <Switch theme={theme} compact={compact} label={saved.length ? `Remember for ${repo}` : `Remember for ${repo} (no list yet)`} value={remember} onChange={setRemember}
|
|
158
|
+
hint="Saves the checked reviewers as this repository's list." />}
|
|
159
|
+
<View style={{ flexDirection: "row", flexWrap: "wrap", gap: 8 }}>
|
|
160
|
+
<Button theme={theme} compact={compact} kind="primary" icon="UserPlus" loading={busy} disabled={!picked.length || busy}
|
|
161
|
+
title={picked.length ? `Request ${picked.length === 1 ? reviewerLabel(picked[0]) : `${picked.length} reviewers`}` : "Request reviewers"}
|
|
162
|
+
accessibilityLabel={`Request ${picked.map(reviewerLabel).join(", ") || "nobody"}`} onPress={() => onRequest(picked, remember && !sameAsSaved)} />
|
|
163
|
+
<Button theme={theme} compact={compact} kind="ghost" title="Cancel" disabled={busy} onPress={onCancel} />
|
|
164
|
+
</View>
|
|
165
|
+
</View>;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/** "Will ask Uri and Yuval": the configured reviewers for a PR, minus its author. */
|
|
169
|
+
export function willAsk(list: ReviewerEntry[]): string {
|
|
170
|
+
const names = list.map(reviewerLabel);
|
|
171
|
+
return names.length > 1 ? `${names.slice(0, -1).join(", ")} and ${names.at(-1)}` : names[0] ?? "";
|
|
172
|
+
}
|
package/client/settings.tsx
CHANGED
|
@@ -8,6 +8,7 @@ import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
|
8
8
|
import { followSettingsRpc, projectSettingsRpc, setFollowSettingsRpc, setProjectTrackingRpc } from "../shared/contracts";
|
|
9
9
|
import { errorText, text } from "./kit";
|
|
10
10
|
import { DisplaySections } from "./display";
|
|
11
|
+
import { ReviewerSettings } from "./reviewers";
|
|
11
12
|
|
|
12
13
|
const settingsKey = ["follow-through", "project-settings"];
|
|
13
14
|
|
|
@@ -115,6 +116,9 @@ export function FollowSettings({ theme, layout }: PluginSurfaceProps) {
|
|
|
115
116
|
onValueChange={value => change.mutate({ projectId: project.id, enable_default_tracking: value })} />)}
|
|
116
117
|
</SettingsCard>}
|
|
117
118
|
</SettingsSection>
|
|
119
|
+
<SettingsSection title="Reviewers" info="Who Add reviewers asks on a PR. Set a list per repository, or a default for every repository without one. A login is a GitHub user (octocat) or a team (org/team). Teammates each keep their own lists.">
|
|
120
|
+
<ReviewerSettings theme={theme} compact={layout.compact} />
|
|
121
|
+
</SettingsSection>
|
|
118
122
|
<QuestionSettings theme={theme} />
|
|
119
123
|
<DisplaySections theme={theme} />
|
|
120
124
|
</ScrollView>;
|
|
Binary file
|
|
Binary file
|
|
Binary file
|