paseo-follow-up 1.4.0-beta.18 → 1.4.0-beta.19
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 +1 -1
- package/README.md +2 -2
- package/client/onboarding.tsx +4 -0
- package/client/settings.tsx +2 -0
- package/client/shipping.tsx +183 -0
- package/index.server.ts +17 -3
- package/package.json +1 -1
- package/server/daemon.ts +3 -0
- package/server/pr-workflow.ts +13 -6
- package/shared/onboarding.ts +2 -1
- package/shared/pr-workflow.ts +40 -6
package/OVERVIEW.md
CHANGED
|
@@ -36,7 +36,7 @@ This is a trusted, unsandboxed plugin. It reads workspace metadata, saved agent
|
|
|
36
36
|
|
|
37
37
|
Follow-up reads Paseo's agent, workspace and project lists into one in-memory directory shared by discovery, runtime checks, the Needs-you inbox, the Overseer and every client RPC. It reads the lists once at start, then patches the directory from lifecycle events: turn started or ended, permission requested or resolved, agent created, closed or archived, workspace created or archived. A change marks it dirty, and a dirty directory re-reads at most once a minute; a clean one re-reads every ten minutes. Before anything that would load an agent (a timeline or provider-subagent read), Follow-up re-reads that one agent, because the cached copy may predate Paseo unloading it. Provider subagents are asked about only when a send is due or waiting for acknowledgment, or completion is being checked. The Done label is sent only when it changes. In the app, the panel, the larger view and the pill draw from the client's shared workspace poll, which runs every 15 s plus a refresh shortly after Paseo reports an agent change. The inbox runs the same way and passes the tag of the list it holds, so an unchanged list comes back empty. Display preferences re-read once a minute. None of these poll while the app is hidden.
|
|
38
38
|
|
|
39
|
-
The PR workflow setting lives in `plugin-data/follow-through/pr-workflow.json` (owner-only): the default, per-repository overrides, merge methods and the review-fix instruction. Auto-detection reads only files: PATH for a `gt` executable, `~/.config/graphite/auth` for a sign-in token's presence (never sent anywhere by detection), and `<git dir>/.graphite_repo_config` in the checkout of the repository's Paseo project. It never runs `gt` and caches for ten minutes. Repositories that resolve to GitHub get no Graphite API calls; their readiness, merge method and auto-merge come from the same `gh api graphql` query that already reads each PR, so there is no extra polling. The first start with this setting seeds the review-fix instruction to `/fix-pr` when `~/.claude/commands/fix-pr.md` or `~/.claude/skills/fix-pr/SKILL.md` exists, once.
|
|
39
|
+
The PR workflow setting lives in `plugin-data/follow-through/pr-workflow.json` (owner-only): the default, per-repository overrides, merge methods and the review-fix instruction. Auto-detection reads only files: PATH for a `gt` executable, `~/.config/graphite/auth` for a sign-in token's presence (never sent anywhere by detection), and `<git dir>/.graphite_repo_config` in the checkout of the repository's Paseo project, then in the working directories of tracked workspaces with PRs in that repository (from the agent list Follow-up already has). It never runs `gt` and caches for ten minutes. Repositories that resolve to GitHub get no Graphite API calls; their readiness, merge method and auto-merge come from the same `gh api graphql` query that already reads each PR, so there is no extra polling. The first start with this setting seeds the review-fix instruction to `/fix-pr` when `~/.claude/commands/fix-pr.md` or `~/.claude/skills/fix-pr/SKILL.md` exists, once.
|
|
40
40
|
|
|
41
41
|
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.
|
|
42
42
|
|
package/README.md
CHANGED
|
@@ -56,7 +56,7 @@ Follow-up works with plain GitHub out of the box: readiness comes from GitHub it
|
|
|
56
56
|
|
|
57
57
|
If you use [Graphite](https://graphite.dev), Follow-up picks it up per repository: **Auto** chooses Graphite where the `gt` CLI is on the daemon's PATH, signed in, and the repository was set up with `gt init`; everywhere else it's GitHub. Detection only looks at files (it never runs `gt`) and is cached for ten minutes. In Graphite repositories, Merge goes through Graphite with your saved CLI sign-in, and Merge when ready works through the Send to Paseo companion (below).
|
|
58
58
|
|
|
59
|
-
Auto is the default for every repository.
|
|
59
|
+
Auto is the default for every repository, and setup's **How do you ship PRs?** step shows what it picked. To change it later, open Follow-up's settings (the gear on Home or in a workspace's panel) → **Following** → **Shipping PRs**: a default for every repository (Auto, Graphite or GitHub), an override per repository showing what Auto picked and why, the merge method, and how agents should address review comments: Follow-up's built-in steps (read the unresolved threads with `gh`, fix, push, reply and resolve) or a skill or command of your own, such as `/fix-pr`. Agents get instructions for the workflow their workspace uses, so a GitHub workspace never hears about Graphite. An install that already had a `/fix-pr` command or skill in `~/.claude` keeps using it.
|
|
60
60
|
|
|
61
61
|

|
|
62
62
|
|
|
@@ -205,7 +205,7 @@ The choices live in `agents.json` in Follow-up's data folder. Anything missing o
|
|
|
205
205
|
Install the beta:
|
|
206
206
|
|
|
207
207
|
```sh
|
|
208
|
-
paseo plugin update follow-through --version 1.4.0-beta.
|
|
208
|
+
paseo plugin update follow-through --version 1.4.0-beta.19
|
|
209
209
|
# or, for a fresh install:
|
|
210
210
|
paseo plugin install npm:paseo-follow-up@beta
|
|
211
211
|
```
|
package/client/onboarding.tsx
CHANGED
|
@@ -8,6 +8,7 @@ import { displayPreferences } from "../shared/display";
|
|
|
8
8
|
import { ONBOARDING_STEPS, autoSendWrites, checksSummary, type Check, type OnboardingStep, type OnboardingView } from "../shared/onboarding";
|
|
9
9
|
import { Button, IconButton, errorText, text, type Theme } from "./kit";
|
|
10
10
|
import { ReviewerSettings } from "./reviewers";
|
|
11
|
+
import { ShippingStep } from "./shipping";
|
|
11
12
|
import { Spinner, useReducedMotion } from "./motion";
|
|
12
13
|
import { raised, runningColor, tint, withAlpha, type Colors } from "./theme";
|
|
13
14
|
|
|
@@ -37,6 +38,7 @@ const TITLES: Record<OnboardingStep, string> = {
|
|
|
37
38
|
intro: "Follow-up keeps your agents' PRs moving",
|
|
38
39
|
checks: "Check your setup",
|
|
39
40
|
defaults: "What Follow-up does without asking",
|
|
41
|
+
shipping: "How do you ship PRs?",
|
|
40
42
|
reviewers: "Who should review your PRs?",
|
|
41
43
|
helpers: "Helpers, and where things are",
|
|
42
44
|
};
|
|
@@ -75,12 +77,14 @@ export function Setup({ theme, compact, view, deps }: { theme: Theme; compact: b
|
|
|
75
77
|
const body = step === "intro" ? <IntroStep theme={theme} compact={compact} follow={follow.data ?? null} />
|
|
76
78
|
: step === "checks" ? <ChecksStep theme={theme} compact={compact} checks={checks} deps={deps} />
|
|
77
79
|
: step === "defaults" ? <DefaultsStep theme={theme} compact={compact} held={view.holdsAutoSends} />
|
|
80
|
+
: step === "shipping" ? <ShippingStep theme={theme} compact={compact} />
|
|
78
81
|
: step === "reviewers" ? <ReviewerSettings theme={theme} compact={compact} />
|
|
79
82
|
: <HelpersStep theme={theme} compact={compact} deps={deps} checks={checks.data?.checks ?? null} />;
|
|
80
83
|
const lead: Record<OnboardingStep, string> = {
|
|
81
84
|
intro: "It follows your agents' pull requests until the work is done, sends fixes back to them, and asks you only for decisions.",
|
|
82
85
|
checks: "Follow-up reads PRs with the GitHub CLI, and its helper agents run on Claude or Codex. Checking is free.",
|
|
83
86
|
defaults: "These are on now. Change anything here; it saves as you go, and Settings has the same switches.",
|
|
87
|
+
shipping: "Follow-up merges and tracks PRs the way each repository already works. It picked these; change one if it's wrong.",
|
|
84
88
|
reviewers: "When you press Add reviewers on a PR, Follow-up asks these people. Set a default for all repositories, or a list for one. Until then, PRs without reviewers show in Needs you.",
|
|
85
89
|
helpers: "Two optional agents. They read, summarise and rank. They never change code or message anyone.",
|
|
86
90
|
};
|
package/client/settings.tsx
CHANGED
|
@@ -10,6 +10,7 @@ import { Switch, errorText, text, type Theme } from "./kit";
|
|
|
10
10
|
import { DisplaySections, PermissionsSection, PreferenceSwitch } from "./display";
|
|
11
11
|
import { ReviewerSettings, reviewerSettingsKey } from "./reviewers";
|
|
12
12
|
import { AgentSettings, agentSettingsKey } from "./agents";
|
|
13
|
+
import { ShippingSettings } from "./shipping";
|
|
13
14
|
import { BackHeader, CategoryList, CategoryTabs, Disclosure } from "./settings-shell";
|
|
14
15
|
import {
|
|
15
16
|
categoryTitle, followingSummary, hasSavedCategory, projectsOpenByDefault, projectsSummary, readCategory, reviewersSummary, workspaceRows, workspaceState, workspacesOpenByDefault, workspacesSummary,
|
|
@@ -75,6 +76,7 @@ function FollowingCategory({ theme, compact, openSetup }: { theme: Theme; compac
|
|
|
75
76
|
onValueChange={value => change.mutate({ activeWindowDays: Number(value) })} />
|
|
76
77
|
</SettingsCard>}
|
|
77
78
|
</SettingsSection>
|
|
79
|
+
<ShippingSettings theme={theme} compact={compact} />
|
|
78
80
|
<PermissionsSection theme={theme} />
|
|
79
81
|
<ProjectsFold theme={theme} compact={compact} />
|
|
80
82
|
{data && (data.workspaces.length
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import { ActivityIndicator, Text, TextInput, View } from "react-native";
|
|
3
|
+
import { useRpc } from "@getpaseo/plugin/client";
|
|
4
|
+
import { SettingsAction, SettingsCard, SettingsSection, SettingsSelect, useToast } from "@getpaseo/plugin/client/ui";
|
|
5
|
+
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
6
|
+
import type { z } from "zod";
|
|
7
|
+
import { prWorkflowRpc, setPrWorkflowRpc } from "../shared/contracts";
|
|
8
|
+
import {
|
|
9
|
+
MERGE_METHOD_LABELS, MERGE_METHOD_SHORT, PR_WORKFLOWS, setupValue, setupWrite, type setPrWorkflowInputSchema, PR_WORKFLOW_LABELS, commandName, repoShippingSummary, reposShippingSummary, reviewFixLabel, shippingSummary, workflowName,
|
|
10
|
+
type MergeMethod, type PrWorkflowSetting, type PrWorkflowView, type RepoWorkflowView, type ReviewFix,
|
|
11
|
+
} from "../shared/pr-workflow";
|
|
12
|
+
import { Button, errorText, text, type Theme } from "./kit";
|
|
13
|
+
import { Disclosure } from "./settings-shell";
|
|
14
|
+
|
|
15
|
+
export const shippingKey = ["follow-through", "pr-workflow"];
|
|
16
|
+
type Write = z.input<typeof setPrWorkflowInputSchema>;
|
|
17
|
+
|
|
18
|
+
/** The section's info tip. Graphite is explained only on a machine where it's in play. */
|
|
19
|
+
export function shippingInfo(view: PrWorkflowView | undefined): string {
|
|
20
|
+
const base = "How Follow-up checks and merges each repository's PRs, and what it tells agents about review comments. Auto picks per repository from what's set up on this machine.";
|
|
21
|
+
const graphite = !!view && (view.gt.installed || view.repos.some(r => r.effective === "graphite" || r.detected === "graphite"));
|
|
22
|
+
return graphite ? `${base} It picks Graphite where the gt CLI is signed in and the repository is initialised, and only reads files to decide.` : base;
|
|
23
|
+
}
|
|
24
|
+
const BUILTIN_HINT = "Agents read the unresolved threads with gh, fix and push, then reply to each thread and resolve it.";
|
|
25
|
+
|
|
26
|
+
/** Where a nested fold's title starts (Disclosure: 36 in, 14 chevron, 8 gap) less a settings row's own 16 padding. */
|
|
27
|
+
const REPO_INSET = 36 + 14 + 8 - 16;
|
|
28
|
+
const ago = (at: number, now = Date.now()) => { const m = Math.round((now - at) / 60_000); return m < 1 ? "just now" : m < 60 ? `${m}m ago` : `${Math.round(m / 60)}h ago`; };
|
|
29
|
+
|
|
30
|
+
/** Settings → Following → Shipping PRs: the default, review comments, then one fold per repository. */
|
|
31
|
+
export function ShippingSettings({ theme, compact }: { theme: Theme; compact: boolean }) {
|
|
32
|
+
const c = theme.colors; const t = text(c);
|
|
33
|
+
const read = useRpc(prWorkflowRpc); const write = useRpc(setPrWorkflowRpc); const cache = useQueryClient(); const toast = useToast();
|
|
34
|
+
const query = useQuery({ queryKey: shippingKey, queryFn: () => read({}), staleTime: 60_000 });
|
|
35
|
+
const recheck = useMutation({ mutationFn: () => read({ refresh: true }), onSuccess: v => { cache.setQueryData(shippingKey, v); toast.show("Checked again", { variant: "success" }); }, onError: e => toast.error(errorText(e)) });
|
|
36
|
+
const change = useMutation({
|
|
37
|
+
mutationFn: (input: Write & { toast?: string }) => { const { toast: _, ...rest } = input; return write(rest); },
|
|
38
|
+
onSuccess: (v, input) => { cache.setQueryData(shippingKey, v); if (input.toast) toast.show(input.toast, { variant: "success" }); void cache.invalidateQueries({ queryKey: ["follow-through", "workspace"] }); },
|
|
39
|
+
onError: e => toast.error(errorText(e)),
|
|
40
|
+
});
|
|
41
|
+
const data = query.data;
|
|
42
|
+
const checked = query.dataUpdatedAt ? ago(query.dataUpdatedAt) : null;
|
|
43
|
+
return <SettingsSection title="Shipping PRs" info={shippingInfo(data)}>
|
|
44
|
+
{query.isPending && <ActivityIndicator accessibilityLabel="Loading how PRs ship" color={c.foregroundMuted} style={{ alignSelf: "flex-start", marginVertical: 8 }} />}
|
|
45
|
+
{query.error && <SettingsCard><SettingsAction label="Couldn't load how PRs ship" hint={errorText(query.error)} actionLabel="Retry" onPress={() => void query.refetch()} /></SettingsCard>}
|
|
46
|
+
{data && <>
|
|
47
|
+
<SettingsCard>
|
|
48
|
+
<SettingsSelect<PrWorkflowSetting> label="Ship PRs with" hint={defaultHint(data)} value={data.default} disabled={change.isPending}
|
|
49
|
+
options={PR_WORKFLOWS.map(w => ({ value: w, label: PR_WORKFLOW_LABELS[w].label }))}
|
|
50
|
+
onValueChange={value => change.mutate({ default: value, toast: `Default: ship with ${PR_WORKFLOW_LABELS[value].label}` })} />
|
|
51
|
+
<ReviewFixSelect label="Review comments" value={data.reviewFix} theme={theme} compact={compact} busy={change.isPending}
|
|
52
|
+
onSave={fix => { if (fix) change.mutate({ reviewFix: fix, toast: `Default: review comments → ${reviewFixLabel(fix)}` }); }} />
|
|
53
|
+
</SettingsCard>
|
|
54
|
+
{signInWarning(data) && <Text accessibilityRole="alert" style={[t.meta, { color: c.statusWarning }]}>{signInWarning(data)}</Text>}
|
|
55
|
+
{data.repos.length ? <Disclosure id="shipping.repos" title="Repositories" summary={reposShippingSummary(data.repos)}
|
|
56
|
+
defaultOpen={data.repos.length <= 6} theme={theme} compact={compact}>
|
|
57
|
+
{data.repos.map((row, i) => <View key={row.repo} style={{ borderTopWidth: i ? 1 : 0, borderTopColor: c.border }}>
|
|
58
|
+
<Disclosure framed={false} id={`shipping.repo.${row.repo}`} title={row.repo} summary={repoShippingSummary(row)} defaultOpen={false} theme={theme} compact={compact}>
|
|
59
|
+
<RepoShipping row={row} view={data} theme={theme} compact={compact} busy={change.isPending} set={(input, label) => change.mutate({ repo: row.repo, ...input, toast: `${row.repo}: ${label}` })} />
|
|
60
|
+
</Disclosure>
|
|
61
|
+
</View>)}
|
|
62
|
+
<View style={{ flexDirection: "row", alignItems: "center", gap: 12, borderTopWidth: 1, borderTopColor: c.border, paddingHorizontal: compact ? 16 : 14, paddingVertical: 8 }}>
|
|
63
|
+
<Text style={[t.meta, { flex: 1 }]}>{`${checked ? `Checked ${checked}` : "Not checked yet"} · looks at what's installed and how each repository is set up.`}</Text>
|
|
64
|
+
<Button theme={theme} compact={compact} title={recheck.isPending ? "Checking…" : "Check again"} disabled={recheck.isPending} loading={recheck.isPending} onPress={() => recheck.mutate()} />
|
|
65
|
+
</View>
|
|
66
|
+
</Disclosure> : <Text style={t.meta}>Repositories show here once Follow-up sees a PR in them or a project with a GitHub remote.</Text>}
|
|
67
|
+
</>}
|
|
68
|
+
</SettingsSection>;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function defaultHint(view: PrWorkflowView): string {
|
|
72
|
+
const now = shippingSummary(view).split(" · ").slice(1).join(" · ");
|
|
73
|
+
return view.default === "auto" ? (now ? `Right now: ${now}.` : PR_WORKFLOW_LABELS.auto.hint) : PR_WORKFLOW_LABELS[view.default].hint;
|
|
74
|
+
}
|
|
75
|
+
/** Only when a repository is on Graphite and the CLI can't merge for it; a missing gt is normal otherwise. */
|
|
76
|
+
function signInWarning(view: PrWorkflowView): string | null {
|
|
77
|
+
if (!view.repos.some(r => r.effective === "graphite") || view.gt.installed && view.gt.signedIn) return null;
|
|
78
|
+
return view.gt.installed ? "The Graphite CLI isn't signed in on this machine. Run gt auth, or merges in Graphite repositories will fail." : "A repository is set to Graphite, but the gt CLI isn't installed on this machine.";
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function RepoShipping({ row, view, theme, compact, busy, set }: { row: RepoWorkflowView; view: PrWorkflowView; theme: Theme; compact: boolean; busy: boolean; set: (input: Omit<Write, "repo">, label: string) => void }) {
|
|
82
|
+
const c = theme.colors; const t = text(c);
|
|
83
|
+
const fallback = view.default === "auto" ? `Default · Auto → ${workflowName(row.detected)}` : `Default · ${PR_WORKFLOW_LABELS[view.default].label}`;
|
|
84
|
+
const methods = row.github?.methods ?? [];
|
|
85
|
+
const preferred = row.github?.preferred ?? methods[0] ?? null;
|
|
86
|
+
// A hairline that starts on the text column, without shifting the row under it.
|
|
87
|
+
const rule = <View style={{ height: 1, backgroundColor: c.border, marginLeft: 16 }} />;
|
|
88
|
+
const autoMerge = row.effective !== "github" || !row.github ? undefined : row.github.autoMerge ? "Auto-merge is available for PRs here." : "Auto-merge is off in this repository's GitHub settings, so its PRs have no Auto-merge switch.";
|
|
89
|
+
const pinned = !row.inherits && row.setting !== "auto";
|
|
90
|
+
const reason = pinned ? `Set here.${row.detected !== row.effective ? ` Auto would use ${workflowName(row.detected)}.` : ""}` : row.reason;
|
|
91
|
+
// Flat rows inside the fold: no inner card. Text and hairlines start on the repository name's column.
|
|
92
|
+
return <View style={{ paddingLeft: REPO_INSET, paddingBottom: 4 }}>
|
|
93
|
+
<Text style={[t.meta, { paddingHorizontal: 16, paddingBottom: 4 }]}>{reason}</Text>
|
|
94
|
+
<SettingsSelect<"inherit" | PrWorkflowSetting> label="Ship with" hint={autoMerge} value={row.inherits ? "inherit" : row.setting} disabled={busy}
|
|
95
|
+
options={[{ value: "inherit", label: fallback }, ...(view.default !== "auto" ? [{ value: "auto" as const, label: `Auto (picks ${workflowName(row.detected)} here)` }] : []), ...PR_WORKFLOWS.filter(w => w !== "auto").map(w => ({ value: w, label: PR_WORKFLOW_LABELS[w].label }))]}
|
|
96
|
+
onValueChange={value => set({ setting: value === "inherit" ? null : value }, value === "inherit" ? "back to the default" : PR_WORKFLOW_LABELS[value].label)} />
|
|
97
|
+
{row.effective === "github" && <View>{rule}{row.github?.mergeQueue
|
|
98
|
+
? <SettingsAction label="Merge method" hint="This repository merges through a merge queue, which picks the method." actionLabel="GitHub" disabled onPress={() => undefined} />
|
|
99
|
+
: <SettingsSelect<"default" | MergeMethod> label="Merge method" disabled={busy || !row.github}
|
|
100
|
+
hint={!row.github ? "Shows after Follow-up reads a PR here." : `This repository allows ${listMethods(methods)}.`}
|
|
101
|
+
value={row.mergeMethod && methods.includes(row.mergeMethod) ? row.mergeMethod : "default"}
|
|
102
|
+
options={[{ value: "default", label: preferred ? `Default · ${MERGE_METHOD_SHORT[preferred]}` : "Repository default" }, ...methods.map(m => ({ value: m, label: MERGE_METHOD_LABELS[m] }))]}
|
|
103
|
+
onValueChange={value => set({ mergeMethod: value === "default" ? null : value }, value === "default" ? "GitHub's default merge method" : MERGE_METHOD_LABELS[value])} />}</View>}
|
|
104
|
+
<View>{rule}<ReviewFixSelect label="Review comments" value={row.reviewFix} inherited={view.reviewFix} theme={theme} compact={compact} busy={busy}
|
|
105
|
+
onSave={fix => set({ reviewFix: fix }, fix ? `review comments: ${reviewFixLabel(fix)}` : "review comments back to the default")} /></View>
|
|
106
|
+
</View>;
|
|
107
|
+
}
|
|
108
|
+
/** "squash", "squash and rebase", "squash, merge commits and rebase". */
|
|
109
|
+
function listMethods(methods: MergeMethod[]): string {
|
|
110
|
+
const words = methods.map(m => ({ squash: "squash", merge: "merge commits", rebase: "rebase" })[m]);
|
|
111
|
+
return words.length < 2 ? words.join("") : `${words.slice(0, -1).join(", ")} and ${words.at(-1)}`;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Built-in steps or a skill/command name. Choosing "A skill or command" opens a one-line field with Save; an
|
|
116
|
+
* inherited row (`inherited` set) adds "Same as default".
|
|
117
|
+
*/
|
|
118
|
+
function ReviewFixSelect({ label, value, inherited, theme, compact, busy, onSave }: { label: string; value: ReviewFix | null; inherited?: ReviewFix; theme: Theme; compact: boolean; busy: boolean; onSave: (fix: ReviewFix | null) => void }) {
|
|
119
|
+
const c = theme.colors; const t = text(c);
|
|
120
|
+
const current = value ? value.kind : inherited ? "inherit" : "builtin";
|
|
121
|
+
const [editing, setEditing] = useState(false);
|
|
122
|
+
const [draft, setDraft] = useState(value && commandName(value) || "");
|
|
123
|
+
const valid = /^\/?[\w:.-]{1,80}$/.test(draft.trim());
|
|
124
|
+
const shown = editing ? "command" : current;
|
|
125
|
+
const hint = shown === "inherit" ? `Uses the default: ${reviewFixLabel(inherited!)}.` : shown === "builtin" ? BUILTIN_HINT : value?.kind === "command" && !editing ? `Agents run ${commandName(value)} for review comments.` : "The skill or slash command agents run for review comments, such as /fix-pr.";
|
|
126
|
+
return <View>
|
|
127
|
+
<SettingsSelect<"inherit" | "builtin" | "command"> label={label} hint={hint} value={shown} disabled={busy}
|
|
128
|
+
options={[...(inherited ? [{ value: "inherit" as const, label: `Default · ${reviewFixLabel(inherited)}` }] : []), { value: "builtin" as const, label: "Built-in steps" }, { value: "command" as const, label: value?.kind === "command" ? commandName(value)! : "A skill or command…" }]}
|
|
129
|
+
onValueChange={next => { if (next === "command") { setEditing(true); return; } setEditing(false); onSave(next === "inherit" ? null : { kind: "builtin" }); }} />
|
|
130
|
+
{editing && <View style={{ flexDirection: "row", alignItems: "center", gap: 8, paddingHorizontal: 14, paddingBottom: 12 }}>
|
|
131
|
+
<TextInput accessibilityLabel="Skill or command for review comments" value={draft} onChangeText={setDraft} placeholder="/fix-pr" placeholderTextColor={c.foregroundMuted} autoCapitalize="none" autoCorrect={false} autoFocus
|
|
132
|
+
onSubmitEditing={() => { if (valid) { onSave({ kind: "command", command: draft.trim() }); setEditing(false); } }}
|
|
133
|
+
style={{ flex: 1, minWidth: 0, minHeight: compact ? 44 : 32, paddingHorizontal: 10, borderRadius: 6, borderWidth: 1, borderColor: draft && !valid ? c.statusDanger : c.border, color: c.foreground, fontSize: 13, backgroundColor: c.surface0, fontFamily: "monospace" }} />
|
|
134
|
+
<Button theme={theme} compact={compact} kind="primary" title="Save" disabled={!valid || busy} onPress={() => { onSave({ kind: "command", command: draft.trim() }); setEditing(false); }} />
|
|
135
|
+
<Button theme={theme} compact={compact} kind="ghost" title="Cancel" onPress={() => setEditing(false)} />
|
|
136
|
+
</View>}
|
|
137
|
+
{editing && draft !== "" && !valid && <Text style={[t.meta, { color: c.statusDanger, paddingHorizontal: 14, paddingBottom: 10 }]}>Use a name like /fix-pr: letters, digits, dashes, dots or colons.</Text>}
|
|
138
|
+
</View>;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Setup's "How do you ship PRs?" step: one row per repository with what Auto picked and why, and a select that writes
|
|
143
|
+
* the same setting as Settings. Graphite is named only as an option, or on a repository that already ships with it.
|
|
144
|
+
*/
|
|
145
|
+
export function ShippingStep({ theme, compact }: { theme: Theme; compact: boolean }) {
|
|
146
|
+
const c = theme.colors; const t = text(c);
|
|
147
|
+
const read = useRpc(prWorkflowRpc); const write = useRpc(setPrWorkflowRpc); const cache = useQueryClient(); const toast = useToast();
|
|
148
|
+
const query = useQuery({ queryKey: shippingKey, queryFn: () => read({}), staleTime: 60_000 });
|
|
149
|
+
const change = useMutation({
|
|
150
|
+
mutationFn: (input: Write) => write(input),
|
|
151
|
+
onSuccess: v => cache.setQueryData(shippingKey, v),
|
|
152
|
+
onError: e => toast.error(errorText(e)),
|
|
153
|
+
});
|
|
154
|
+
const later = <Text style={t.meta}>Change this later in Settings → Following → Shipping PRs.</Text>;
|
|
155
|
+
if (query.isPending) return <ActivityIndicator accessibilityLabel="Checking how your repositories ship PRs" color={c.foregroundMuted} style={{ alignSelf: "flex-start" }} />;
|
|
156
|
+
if (query.error) return <Text accessibilityRole="alert" style={[t.meta, { color: c.statusDanger }]}>{errorText(query.error)}</Text>;
|
|
157
|
+
const data = query.data!;
|
|
158
|
+
if (!data.repos.length) return <View style={{ gap: 10 }}><Text style={t.body}>Follow-up works this out per repository when it sees the first PR.</Text>{later}</View>;
|
|
159
|
+
const warning = signInWarning(data);
|
|
160
|
+
// Graphite repositories first: they're the ones worth a look.
|
|
161
|
+
const rows = [...data.repos].sort((a, b) => Number(b.effective === "graphite") - Number(a.effective === "graphite"));
|
|
162
|
+
const uniform = rows.every(r => r.effective === "github" && r.inherits);
|
|
163
|
+
const row = (r: RepoWorkflowView) => <SettingsSelect<PrWorkflowSetting> key={r.repo} label={r.repo} hint={r.reason} value={setupValue(data, r)} disabled={change.isPending}
|
|
164
|
+
options={PR_WORKFLOWS.map(w => ({ value: w, label: w === "auto" ? `Auto (${workflowName(r.detected)})` : PR_WORKFLOW_LABELS[w].label }))}
|
|
165
|
+
onValueChange={choice => change.mutate(setupWrite(data, r.repo, choice))} />;
|
|
166
|
+
// Nothing to decide (every repository on GitHub by Auto): one row for the default, the repositories folded.
|
|
167
|
+
if (uniform) return <View style={{ gap: 10 }}>
|
|
168
|
+
<SettingsCard>
|
|
169
|
+
<SettingsSelect<PrWorkflowSetting> label={`All ${rows.length} repositor${rows.length === 1 ? "y ships" : "ies ship"} with GitHub`} hint={rows[0].reason} value={data.default} disabled={change.isPending}
|
|
170
|
+
options={PR_WORKFLOWS.map(w => ({ value: w, label: PR_WORKFLOW_LABELS[w].label }))}
|
|
171
|
+
onValueChange={value => change.mutate({ default: value })} />
|
|
172
|
+
</SettingsCard>
|
|
173
|
+
<Disclosure id="setup.shipping.repos" title="Show repositories" summary={`${rows.length} on GitHub`} defaultOpen={false} theme={theme} compact={compact}>
|
|
174
|
+
{rows.map((r, i) => <View key={r.repo} style={{ borderTopWidth: i ? 1 : 0, borderTopColor: c.border }}>{row(r)}</View>)}
|
|
175
|
+
</Disclosure>
|
|
176
|
+
{later}
|
|
177
|
+
</View>;
|
|
178
|
+
return <View style={{ gap: 10 }}>
|
|
179
|
+
<SettingsCard>{rows.map(row)}</SettingsCard>
|
|
180
|
+
{warning && <Text accessibilityRole="alert" style={[t.meta, { color: c.statusWarning }]}>{warning}</Text>}
|
|
181
|
+
{later}
|
|
182
|
+
</View>;
|
|
183
|
+
}
|
package/index.server.ts
CHANGED
|
@@ -119,8 +119,12 @@ export default function contribute(server: PluginServerContext) {
|
|
|
119
119
|
github.workflow = repo => prWorkflow.workflow(repo);
|
|
120
120
|
workspaceRepos = gateway.workspaceRepos;
|
|
121
121
|
prWorkflow.paths = async () => {
|
|
122
|
-
const paths = new Map<string, string>();
|
|
123
|
-
|
|
122
|
+
const paths = new Map<string, string[]>();
|
|
123
|
+
const add = (repo: string, path: string) => { const key = repoKey(repo); paths.set(key, [...(paths.get(key) ?? []), path]); };
|
|
124
|
+
const state = await store.snapshot();
|
|
125
|
+
for (const p of await gateway.projects(state)) { const repo = projectRepo(p.key); if (repo && p.path) add(repo, p.path); }
|
|
126
|
+
// Fallback: where tracked workspaces' agents work on that repository's PRs.
|
|
127
|
+
for (const w of state.workspaces) for (const repo of new Set([...w.prs.map(p => p.repo), ...(workspaceRepos.get(w.id) ? [workspaceRepos.get(w.id)!] : [])])) for (const cwd of gateway.workspaceCwds.get(w.id) ?? []) add(repo, cwd);
|
|
124
128
|
return paths;
|
|
125
129
|
};
|
|
126
130
|
prWorkflow.onChanged = () => { void store.snapshot().then(state => store.onChanged(state)).catch(() => undefined); };
|
|
@@ -592,7 +596,17 @@ export default function contribute(server: PluginServerContext) {
|
|
|
592
596
|
for (const repo of Object.keys(prWorkflow.current().repos)) repos.add(repo);
|
|
593
597
|
return repos;
|
|
594
598
|
};
|
|
595
|
-
|
|
599
|
+
// Each repository's merge settings as GitHub reported them with its newest observed PR (no extra request).
|
|
600
|
+
const repoMerges = async () => {
|
|
601
|
+
const newest = new Map<string, { at: string; value: NonNullable<NonNullable<Workspace["prs"][number]["snapshot"]>["repoMerge"]> }>();
|
|
602
|
+
for (const w of (await store.snapshot()).workspaces) for (const p of w.prs) {
|
|
603
|
+
const s = p.snapshot; if (!s?.repoMerge) continue;
|
|
604
|
+
const key = repoKey(p.repo); const seen = newest.get(key);
|
|
605
|
+
if (!seen || s.observedAt > seen.at) newest.set(key, { at: s.observedAt, value: s.repoMerge });
|
|
606
|
+
}
|
|
607
|
+
return newest;
|
|
608
|
+
};
|
|
609
|
+
const prWorkflowView = async (fresh = false) => { const merges = await repoMerges(); return prWorkflow.view(await prWorkflowRepos(), fresh, repo => merges.get(repo)?.value ?? null); };
|
|
596
610
|
handle(rpc.prWorkflowRpc, async ({ refresh }) => {
|
|
597
611
|
await requireReady();
|
|
598
612
|
const view = await prWorkflowView(!!refresh);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "paseo-follow-up",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.4.0-beta.
|
|
4
|
+
"version": "1.4.0-beta.19",
|
|
5
5
|
"description": "Follow every workspace PR stack in Paseo, answer agent questions, batch repairs for the main agent, and see what needs you.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|
package/server/daemon.ts
CHANGED
|
@@ -159,6 +159,8 @@ export const projectRepo = (key: string) => /^remote:github\.com\/([\w.-]+\/[\w.
|
|
|
159
159
|
export class PaseoGateway implements Gateway {
|
|
160
160
|
/** Each discovered workspace's project repository, for its PR workflow before it has PRs. */
|
|
161
161
|
readonly workspaceRepos = new Map<string, string>();
|
|
162
|
+
/** Workspace → its root agents' working directories, from the agent list already in hand (no extra reads). */
|
|
163
|
+
readonly workspaceCwds = new Map<string, string[]>();
|
|
162
164
|
/** Settings → Agents' "recovery" role; unset or "Same as main agent" copies the main agent. */
|
|
163
165
|
recoveryRole: (() => Promise<RecoveryRole>) | null = null;
|
|
164
166
|
constructor(private connect: typeof withDaemon = withDaemon, private guard = new SessionGuard(join(paseoHome, "plugin-data/session-guard")), private compacting = compactionPending, private histories = new HistoryCache(null), private now = Date.now, readonly directory = new DaemonDirectory(connect, now)) {}
|
|
@@ -222,6 +224,7 @@ export class PaseoGateway implements Gateway {
|
|
|
222
224
|
const project = projects.find(p => p.projectId === workspace.projectId);
|
|
223
225
|
const repo = project?.projectKind === "git" ? /^remote:github\.com\/([\w.-]+\/[\w.-]+?)(?:\.git)?$/.exec(project.projectKey)?.[1] ?? null : null;
|
|
224
226
|
if (repo) this.workspaceRepos.set(workspace.id, repo); else this.workspaceRepos.delete(workspace.id);
|
|
227
|
+
this.workspaceCwds.set(workspace.id, [...new Set(roots.map(a => a.cwd).filter(Boolean))]);
|
|
225
228
|
// Active scope: a dormant workspace stays listed but is never scanned. Within an active one only
|
|
226
229
|
// loaded agents are read, because a timeline read loads the agent (see isLoaded).
|
|
227
230
|
row.active = workspaceActive(roots, existing, windowMs, now);
|
package/server/pr-workflow.ts
CHANGED
|
@@ -60,8 +60,11 @@ export class PrWorkflowStore {
|
|
|
60
60
|
private cached: PrWorkflowConfig | null = null;
|
|
61
61
|
private machine: { at: number; gtInstalled: boolean; signedIn: boolean } | null = null;
|
|
62
62
|
private detected = new Map<string, Detected>();
|
|
63
|
-
/**
|
|
64
|
-
|
|
63
|
+
/**
|
|
64
|
+
* Repository (owner/name, lowercase) → local checkouts to look at, best first: the Paseo project's root, then the
|
|
65
|
+
* working directories of tracked workspaces with PRs there (a repository often has no project registered). Set by the server.
|
|
66
|
+
*/
|
|
67
|
+
paths: () => Promise<Map<string, string[]>> = async () => new Map();
|
|
65
68
|
/** Called after every save, so derived files (scopes.json) can be rewritten. */
|
|
66
69
|
onChanged: () => void = () => undefined;
|
|
67
70
|
constructor(readonly directory: string, private probe: Probe = fsProbe(), private now = Date.now, private ttl = 600_000) {}
|
|
@@ -124,9 +127,13 @@ export class PrWorkflowStore {
|
|
|
124
127
|
const hit = this.detected.get(key);
|
|
125
128
|
if (!fresh && hit && this.now() - hit.at < this.ttl) return hit;
|
|
126
129
|
const machine = await this.machineState(freshMachine);
|
|
127
|
-
const
|
|
130
|
+
const candidates = [...new Set((await this.paths()).get(key) ?? [])];
|
|
131
|
+
let path = candidates[0] ?? null;
|
|
128
132
|
const detection: Detection = { gtInstalled: machine.gtInstalled, signedIn: machine.signedIn, path, initialised: false };
|
|
129
|
-
|
|
133
|
+
// File reads only, stopping at the first checkout set up for Graphite.
|
|
134
|
+
if (machine.gtInstalled && machine.signedIn) for (const candidate of candidates) {
|
|
135
|
+
if (await this.probe.initialised(candidate).catch(() => false)) { detection.initialised = true; path = candidate; break; }
|
|
136
|
+
}
|
|
130
137
|
const value = { at: this.now(), path, ...detect(detection) };
|
|
131
138
|
this.detected.set(key, value);
|
|
132
139
|
return value;
|
|
@@ -155,7 +162,7 @@ export class PrWorkflowStore {
|
|
|
155
162
|
}
|
|
156
163
|
reviewFix(repo: string | null): ReviewFix { return reviewFixFor(this.current(), repo); }
|
|
157
164
|
|
|
158
|
-
async view(repos: Iterable<string>, fresh = false): Promise<PrWorkflowView> {
|
|
165
|
+
async view(repos: Iterable<string>, fresh = false, github: (repo: string) => RepoWorkflowView["github"] = () => null): Promise<PrWorkflowView> {
|
|
159
166
|
const config = await this.read();
|
|
160
167
|
const machine = await this.machineState(fresh);
|
|
161
168
|
const rows: RepoWorkflowView[] = [];
|
|
@@ -163,7 +170,7 @@ export class PrWorkflowStore {
|
|
|
163
170
|
const d = await this.detect(repo, fresh, false);
|
|
164
171
|
const { setting, inherits } = repoSetting(config, repo);
|
|
165
172
|
const own = config.repos[repo];
|
|
166
|
-
rows.push({ repo, setting, inherits, detected: d.workflow, effective: resolveWorkflow(setting, d.workflow), reason: d.reason, path: d.path, mergeMethod: own?.mergeMethod ?? null, reviewFix: own?.reviewFix ?? null });
|
|
173
|
+
rows.push({ repo, setting, inherits, detected: d.workflow, effective: resolveWorkflow(setting, d.workflow), reason: d.reason, path: d.path, mergeMethod: own?.mergeMethod ?? null, reviewFix: own?.reviewFix ?? null, github: github(repo) });
|
|
167
174
|
}
|
|
168
175
|
return { gt: { installed: machine.gtInstalled, signedIn: machine.signedIn }, default: config.default, reviewFix: config.reviewFix, repos: rows };
|
|
169
176
|
}
|
package/shared/onboarding.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { z } from "zod";
|
|
|
8
8
|
* (see `CHOICE_WRITES`); the flow keeps only its own progress in `plugin-data/follow-through/onboarding.json`.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
export const ONBOARDING_STEPS = ["intro", "checks", "defaults", "reviewers", "helpers"] as const;
|
|
11
|
+
export const ONBOARDING_STEPS = ["intro", "checks", "defaults", "shipping", "reviewers", "helpers"] as const;
|
|
12
12
|
export type OnboardingStep = typeof ONBOARDING_STEPS[number];
|
|
13
13
|
export const isStep = (v: unknown): v is OnboardingStep => typeof v === "string" && (ONBOARDING_STEPS as readonly string[]).includes(v);
|
|
14
14
|
|
|
@@ -219,6 +219,7 @@ export const CHOICE_WRITES = {
|
|
|
219
219
|
autoSendDefault: { rpc: "follow.set-follow-settings", field: "enable_auto_sends_default" },
|
|
220
220
|
autoSendWorkspace: { rpc: "follow.set-follow-settings", field: "workspace.enable_auto_sends" },
|
|
221
221
|
reviewers: { rpc: "follow.save-reviewers", field: "reviewers" },
|
|
222
|
+
shipping: { rpc: "follow.set-pr-workflow", field: "setting" },
|
|
222
223
|
overseer: { settings: "display", field: "enable_overseer" },
|
|
223
224
|
ranker: { settings: "display", field: "enable_ranker" },
|
|
224
225
|
trustBypass: { settings: "display", field: "enable_trust_bypass" },
|
package/shared/pr-workflow.ts
CHANGED
|
@@ -15,14 +15,15 @@ export const prWorkflowSchema = z.enum(["graphite", "github"]);
|
|
|
15
15
|
/** The same plain words Settings and onboarding show. The github hint never mentions Graphite. */
|
|
16
16
|
export const PR_WORKFLOW_LABELS: Record<PrWorkflowSetting, { label: string; hint: string }> = {
|
|
17
17
|
auto: { label: "Auto", hint: "Works it out per repository from what's installed and how the repository is set up." },
|
|
18
|
-
graphite: { label: "Graphite
|
|
18
|
+
graphite: { label: "Graphite", hint: "Merge, merge when ready and stack readiness through Graphite. Needs the gt CLI signed in on this machine." },
|
|
19
19
|
github: { label: "GitHub", hint: "Readiness, merge and auto-merge straight from GitHub. Stacks follow each PR's base branch." },
|
|
20
20
|
};
|
|
21
|
-
export const workflowName = (w: PrWorkflow) => w === "graphite" ? "Graphite
|
|
21
|
+
export const workflowName = (w: PrWorkflow) => w === "graphite" ? "Graphite" : "GitHub";
|
|
22
22
|
|
|
23
23
|
export const MERGE_METHODS = ["squash", "merge", "rebase"] as const;
|
|
24
24
|
export type MergeMethod = typeof MERGE_METHODS[number];
|
|
25
25
|
export const mergeMethodSchema = z.enum(MERGE_METHODS);
|
|
26
|
+
export const MERGE_METHOD_SHORT: Record<MergeMethod, string> = { squash: "Squash", merge: "Merge commit", rebase: "Rebase" };
|
|
26
27
|
export const MERGE_METHOD_LABELS: Record<MergeMethod, string> = { squash: "Squash and merge", merge: "Merge commit", rebase: "Rebase and merge" };
|
|
27
28
|
|
|
28
29
|
/**
|
|
@@ -58,11 +59,11 @@ export const emptyPrWorkflowConfig = (): PrWorkflowConfig => prWorkflowConfigSch
|
|
|
58
59
|
/** What the machine and the repository say, gathered without running gt. */
|
|
59
60
|
export type Detection = { gtInstalled: boolean; signedIn: boolean; path: string | null; initialised: boolean };
|
|
60
61
|
export function detect(d: Detection): { workflow: PrWorkflow; reason: string } {
|
|
61
|
-
if (!d.gtInstalled) return { workflow: "github", reason: "
|
|
62
|
-
if (!d.signedIn) return { workflow: "github", reason: "
|
|
62
|
+
if (!d.gtInstalled) return { workflow: "github", reason: "Using GitHub. Graphite isn’t set up on this machine." };
|
|
63
|
+
if (!d.signedIn) return { workflow: "github", reason: "Using GitHub. Graphite isn’t set up on this machine." };
|
|
63
64
|
if (!d.path) return { workflow: "github", reason: "No local checkout to check; using GitHub" };
|
|
64
|
-
if (!d.initialised) return { workflow: "github", reason: "This repository
|
|
65
|
-
return { workflow: "graphite", reason: "Graphite CLI
|
|
65
|
+
if (!d.initialised) return { workflow: "github", reason: "Using GitHub. This repository isn’t set up for Graphite." };
|
|
66
|
+
return { workflow: "graphite", reason: "Using Graphite. The gt CLI is signed in and this repository is initialised." };
|
|
66
67
|
}
|
|
67
68
|
|
|
68
69
|
export function repoSetting(config: PrWorkflowConfig, repo: string): { setting: PrWorkflowSetting; inherits: boolean } {
|
|
@@ -78,6 +79,8 @@ export const repoWorkflowViewSchema = z.object({
|
|
|
78
79
|
repo: z.string(), setting: prWorkflowSettingSchema, detected: prWorkflowSchema, effective: prWorkflowSchema, reason: z.string(),
|
|
79
80
|
path: z.string().nullable(), inherits: z.boolean(),
|
|
80
81
|
mergeMethod: mergeMethodSchema.nullable(), reviewFix: reviewFixSchema.nullable(),
|
|
82
|
+
/** What GitHub allows here, from the newest PR Follow-up read in this repository; null until it has read one. */
|
|
83
|
+
github: z.object({ methods: z.array(mergeMethodSchema), preferred: mergeMethodSchema.nullable(), autoMerge: z.boolean(), mergeQueue: z.boolean() }).nullable().default(null),
|
|
81
84
|
});
|
|
82
85
|
export type RepoWorkflowView = z.infer<typeof repoWorkflowViewSchema>;
|
|
83
86
|
export const prWorkflowViewSchema = z.object({
|
|
@@ -95,5 +98,36 @@ export const setPrWorkflowInputSchema = z.strictObject({
|
|
|
95
98
|
reviewFix: reviewFixSchema.nullable().optional(),
|
|
96
99
|
});
|
|
97
100
|
|
|
101
|
+
/** Settings' line for the default: "Auto · GitHub in 5 repositories, Graphite in 3". */
|
|
102
|
+
export function shippingSummary(view: Pick<PrWorkflowView, "default" | "repos">): string {
|
|
103
|
+
const counts = (["github", "graphite"] as const).map(w => [w, view.repos.filter(r => r.effective === w).length] as const).filter(([, n]) => n > 0);
|
|
104
|
+
const lead = PR_WORKFLOW_LABELS[view.default].label;
|
|
105
|
+
if (!counts.length) return lead;
|
|
106
|
+
if (counts.length === 1) return `${lead} · ${workflowName(counts[0][0])} everywhere`;
|
|
107
|
+
return `${lead} · ${counts.map(([w, n]) => `${workflowName(w)} in ${n}`).join(", ")}`;
|
|
108
|
+
}
|
|
109
|
+
/** One repository's folded line: "GitHub · Auto", "Graphite · set here", plus a merge method chosen here. */
|
|
110
|
+
export function repoShippingSummary(row: RepoWorkflowView): string {
|
|
111
|
+
// What was set here comes before "Auto", so a phone's truncation cuts the least useful part.
|
|
112
|
+
const method = row.mergeMethod && row.effective === "github" ? MERGE_METHOD_SHORT[row.mergeMethod] : "";
|
|
113
|
+
return [workflowName(row.effective), method, row.inherits ? (row.setting === "auto" ? "Auto" : "default") : "set here"].filter(Boolean).join(" · ");
|
|
114
|
+
}
|
|
115
|
+
/** "3 GitHub · 2 Graphite · 1 set here". */
|
|
116
|
+
export function reposShippingSummary(rows: readonly RepoWorkflowView[]): string {
|
|
117
|
+
const gh = rows.filter(r => r.effective === "github").length, gt = rows.length - gh, own = rows.filter(r => !r.inherits || r.mergeMethod || r.reviewFix).length;
|
|
118
|
+
return [gh ? `${gh} GitHub` : "", gt ? `${gt} Graphite` : "", own ? `${own} set here` : ""].filter(Boolean).join(" · ") || "None yet";
|
|
119
|
+
}
|
|
120
|
+
export const reviewFixLabel = (fix: ReviewFix) => fix.kind === "builtin" ? "Built-in steps" : commandName(fix)!;
|
|
121
|
+
|
|
98
122
|
/** What an agent's instructions depend on: the workspace's workflow and its review-fix command (null: built-in). */
|
|
99
123
|
export type AgentWorkflow = { mode: PrWorkflow; reviewFix: string | null };
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* What setup's per-repository select writes. "Auto" while the default is Auto means inherit (null), as Settings'
|
|
127
|
+
* "Default" does, so going Graphite → Auto doesn't leave the repository pinned.
|
|
128
|
+
*/
|
|
129
|
+
export function setupWrite(view: Pick<PrWorkflowView, "default">, repo: string, choice: PrWorkflowSetting): { repo: string; setting: PrWorkflowSetting | null } {
|
|
130
|
+
return { repo, setting: choice === "auto" && view.default === "auto" ? null : choice };
|
|
131
|
+
}
|
|
132
|
+
/** Setup's select value: an inheriting repository under an Auto default shows Auto. */
|
|
133
|
+
export const setupValue = (view: Pick<PrWorkflowView, "default">, row: Pick<RepoWorkflowView, "inherits" | "setting">): PrWorkflowSetting => row.inherits ? view.default : row.setting;
|