paseo-follow-up 2.6.0-beta.7 → 2.6.0-beta.9
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/CHANGELOG.md +14 -0
- package/index.server.ts +12 -13
- package/package.json +5 -1
- package/server/daemon.ts +27 -4
- package/server/mcp-source.ts +16 -1
- package/server/mcp.mjs +2 -1
- package/shared/daemon-url.d.mts +2 -0
- package/shared/daemon-url.mjs +12 -0
- package/shared/dispatch.ts +19 -3
- package/shared/issue-workspace.ts +25 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
What changed in each version of Follow-up, newest first. Follow-up shows "What's new" after an update that brings new release notes: the curated part of each stable release since you last looked (betas install quietly; Settings → General can turn it off), and every version's notes from Home's version line.
|
|
4
4
|
|
|
5
|
+
## 2.5.1 (2026-11-28)
|
|
6
|
+
|
|
7
|
+
One fix for 2.5.0.
|
|
8
|
+
|
|
9
|
+
- **Follow-up keeps working with Tailscale on.** With Tailscale on, Paseo listens on more than one address and Follow-up's tools failed to connect. Follow-up now uses Paseo's main address.
|
|
10
|
+
|
|
11
|
+
<details><summary>Full changelog since 2.5.0</summary>
|
|
12
|
+
|
|
13
|
+
### Fixes
|
|
14
|
+
|
|
15
|
+
- Fixed Follow-up’s tools failing after turning on Tailscale in Paseo. Follow-up now connects to the main address when the host listens on several addresses.
|
|
16
|
+
|
|
17
|
+
</details>
|
|
18
|
+
|
|
5
19
|
## 2.5.0 (2026-11-26)
|
|
6
20
|
|
|
7
21
|
Send a task at the time you pick, and read every release in one scroll.
|
package/index.server.ts
CHANGED
|
@@ -92,7 +92,7 @@ import { scopeWriter, workflowSummary } from "./server/scopes";
|
|
|
92
92
|
import { maintainTasks, type NudgeReceipt } from "./shared/task-due";
|
|
93
93
|
import { PrWorkflowStore } from "./server/pr-workflow";
|
|
94
94
|
import { commandName, handsMergeBack, noReviewRepoList, noReviewRepos } from "./shared/pr-workflow";
|
|
95
|
-
import {
|
|
95
|
+
import { gitProjectRepo } from "./server/daemon";
|
|
96
96
|
import { batchArchive, pruneUnsent } from "./server/batch-archive";
|
|
97
97
|
import { statusCheck } from "./server/status-check";
|
|
98
98
|
import { NO_USAGE, usageKey } from "./shared/usage";
|
|
@@ -107,7 +107,7 @@ import { DispatchService, DispatchStore, type ActionChange, type DispatchPaseo,
|
|
|
107
107
|
import { LinearIssues } from "./server/linear-issues";
|
|
108
108
|
import { LinearQueue, LinearQueueStore } from "./server/linear-queue";
|
|
109
109
|
import { teamOf } from "./shared/linked";
|
|
110
|
-
import {
|
|
110
|
+
import { issueWorkspaces, sourceHolder } from "./shared/issue-workspace";
|
|
111
111
|
import { currentSummary } from "./shared/about";
|
|
112
112
|
import { RpcTiming } from "./server/rpc-timing";
|
|
113
113
|
import { hostAtLeast, hostFeature, ROW_BADGES_SINCE, type ServerInfo } from "./server/host-features";
|
|
@@ -247,7 +247,7 @@ export default function contribute(server: PluginServerContext) {
|
|
|
247
247
|
const paths = new Map<string, string[]>();
|
|
248
248
|
const add = (repo: string, path: string) => { const key = repoKey(repo); paths.set(key, [...(paths.get(key) ?? []), path]); };
|
|
249
249
|
const state = await store.snapshot();
|
|
250
|
-
for (const p of await gateway.projects(state)) { const repo =
|
|
250
|
+
for (const p of await gateway.projects(state)) { const repo = await gitProjectRepo(p); if (repo && p.path) add(repo, p.path); }
|
|
251
251
|
// Fallback: where tracked workspaces' agents work on that repository's PRs.
|
|
252
252
|
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);
|
|
253
253
|
return paths;
|
|
@@ -1132,7 +1132,7 @@ export default function contribute(server: PluginServerContext) {
|
|
|
1132
1132
|
};
|
|
1133
1133
|
const prWorkflowRepos = async () => {
|
|
1134
1134
|
const repos = new Set((await reviewerSettings()).repos);
|
|
1135
|
-
for (const p of await gateway.projects(await store.snapshot()).catch(() => [])) { const repo =
|
|
1135
|
+
for (const p of await gateway.projects(await store.snapshot()).catch(() => [])) { const repo = await gitProjectRepo(p); if (repo) repos.add(repoKey(repo)); }
|
|
1136
1136
|
for (const repo of Object.keys(prWorkflow.current().repos)) repos.add(repo);
|
|
1137
1137
|
return repos;
|
|
1138
1138
|
};
|
|
@@ -1513,7 +1513,8 @@ export default function contribute(server: PluginServerContext) {
|
|
|
1513
1513
|
const baseCache = new Map<string, { at: number; value: Promise<string | null> }>();
|
|
1514
1514
|
const dispatchProjects = async (): Promise<DispatchProject[]> => {
|
|
1515
1515
|
const rows = await gateway.directory.projects(60_000);
|
|
1516
|
-
|
|
1516
|
+
// a-source-names-its-own-repo-and-holder: the repository is the project's remote key, else its checkout's origin.
|
|
1517
|
+
return Promise.all(rows.map(async p => ({ id: p.projectId, name: p.projectCustomName || p.projectDisplayName, repo: await gitProjectRepo({ kind: p.projectKind, key: p.projectKey, path: p.projectRootPath }), worktree: p.projectKind === "git", path: p.projectRootPath })));
|
|
1517
1518
|
};
|
|
1518
1519
|
const linkedOf = async () => Object.entries((await linkedStore.read()).workspaces);
|
|
1519
1520
|
// a-taken-issue-is-not-a-suggestion: the one "which live workspace has this issue" map (shared/issue-workspace.ts):
|
|
@@ -1523,7 +1524,8 @@ export default function contribute(server: PluginServerContext) {
|
|
|
1523
1524
|
const latest = (w: (typeof state.workspaces)[number]) => [w.mainWorkAt ?? "", ...w.batches.map(b => b.activityAt ?? b.sentAt ?? b.createdAt)].reduce((a, b) => b > a ? b : a, "");
|
|
1524
1525
|
return issueWorkspaces({
|
|
1525
1526
|
workspaces: state.workspaces.map(w => ({ id: w.id, title: w.title, archived: w.archived, enable_tracking: w.enable_tracking, activityAt: latest(w), prs: w.prs })),
|
|
1526
|
-
|
|
1527
|
+
// Every linked item's key (a-source-names-its-own-repo-and-holder): a GitHub issue or a link is held like a Linear key.
|
|
1528
|
+
links: linked.map(([id, l]) => [id, l.items.flatMap(i => i.key ? [i.key] : [])] as const),
|
|
1527
1529
|
});
|
|
1528
1530
|
};
|
|
1529
1531
|
// New's view of it: each holder with the project it's in (Paseo's directory, cached), for resolveWhere.
|
|
@@ -1564,13 +1566,10 @@ export default function contribute(server: PluginServerContext) {
|
|
|
1564
1566
|
const live = (id: string) => state.workspaces.find(w => w.id === id && !w.archived) ?? null;
|
|
1565
1567
|
// The project it's in (Paseo's directory, cached): a source already being worked on goes there (resolveWhere).
|
|
1566
1568
|
const projectOf = async (id: string) => (await gateway.directory.read().catch(() => null))?.workspaces.find(w => w.id === id)?.projectId ?? null;
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
}
|
|
1572
|
-
if (source.kind !== "linear" || !source.key) return null;
|
|
1573
|
-
return holderOf(await takenIssues(), source.key);
|
|
1569
|
+
const owner = source.kind === "pr" && source.repo && source.number ? prOwner(state, source.repo, source.number) : null;
|
|
1570
|
+
const w = owner ? live(owner.workspaceId) : null;
|
|
1571
|
+
const tracked = w ? { workspaceId: w.id, title: w.title, state: "tracked" as const, via: "pr" as const, projectId: await projectOf(w.id) } : null;
|
|
1572
|
+
return sourceHolder(source, await takenIssues(), () => tracked);
|
|
1574
1573
|
},
|
|
1575
1574
|
taken: takenIssues,
|
|
1576
1575
|
// The repository's default branch (origin/HEAD), read from the checkout once an hour.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "paseo-follow-up",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "2.6.0-beta.
|
|
4
|
+
"version": "2.6.0-beta.9",
|
|
5
5
|
"description": "Every agent, one inbox. Follow-up brings what all your coding agents need from you into one ranked list, and follows their work through merge, deploy and after.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|
|
@@ -65,6 +65,10 @@
|
|
|
65
65
|
"typescript": "^5.9.3",
|
|
66
66
|
"zod": "^4.4.3"
|
|
67
67
|
},
|
|
68
|
+
"allowScripts": {
|
|
69
|
+
"esbuild": false,
|
|
70
|
+
"fsevents": false
|
|
71
|
+
},
|
|
68
72
|
"license": "MIT",
|
|
69
73
|
"author": "Tom Gringauz",
|
|
70
74
|
"repository": {
|
package/server/daemon.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import { daemonUrl } from "../shared/daemon-url.mjs";
|
|
1
2
|
import { imageSupport, imagesLeftOff } from "./image-support";
|
|
2
3
|
import { taskAgentStates } from "../shared/task-status";
|
|
3
4
|
import { settleWithin, type Deadline } from "./teardown";
|
|
4
5
|
import { isRecovery, RECOVERY_LABEL, RECOVERY_BATCH_LABEL, RECOVERY_TITLE, MCP_SERVER, MCP_SERVERS } from "../shared/legacy";
|
|
5
6
|
import { isOverseerAgent } from "../shared/overseer";
|
|
6
7
|
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
8
|
+
import { execFile } from "node:child_process";
|
|
9
|
+
import { githubRepoOf } from "../shared/dispatch";
|
|
7
10
|
import { homedir } from "node:os";
|
|
8
11
|
import { join } from "node:path";
|
|
9
12
|
import { readSharedJson } from "./shared-file";
|
|
@@ -118,7 +121,7 @@ export async function daemonOptions(): Promise<Record<string, unknown>> {
|
|
|
118
121
|
let url = process.env.PASEO_DAEMON_URL;
|
|
119
122
|
if (!url) {
|
|
120
123
|
const config = JSON.parse(await readFile(join(paseoHome, "config.json"), "utf8"));
|
|
121
|
-
url =
|
|
124
|
+
url = daemonUrl(config);
|
|
122
125
|
}
|
|
123
126
|
return { url, clientId: "follow-up-worker", clientType: "cli", reconnect: { enabled: false }, connectTimeoutMs: 10_000, suppressSendErrors: true, ...(password ? { password } : {}) };
|
|
124
127
|
}
|
|
@@ -298,8 +301,27 @@ async function readSince(client: Daemon, agentId: string, since: Cursor): Promis
|
|
|
298
301
|
return null;
|
|
299
302
|
}
|
|
300
303
|
|
|
301
|
-
/** A Paseo project's GitHub repository (owner/name), from its remote key; null for local or non-GitHub projects. */
|
|
302
|
-
|
|
304
|
+
/** A Paseo project's GitHub repository (owner/name), from its remote key; null for local or non-GitHub projects. Read it through `gitProjectRepo`. */
|
|
305
|
+
const projectRepo = (key: string) => /^remote:github\.com\/([\w.-]+\/[\w.-]+?)(?:\.git)?$/.exec(key)?.[1] ?? null;
|
|
306
|
+
const originCache = new Map<string, { at: number; value: Promise<string | null> }>();
|
|
307
|
+
/**
|
|
308
|
+
* A checkout's GitHub repository (lower-case owner/name) from its `origin` remote, read once an hour per path. Paseo
|
|
309
|
+
* derives a project's key from the remote only when the project is added and keeps it, so a project added before its
|
|
310
|
+
* checkout had an origin keeps a path key; the checkout itself still says which repository it is.
|
|
311
|
+
*/
|
|
312
|
+
export function checkoutRepo(path: string | null | undefined, ttlMs = 3_600_000): Promise<string | null> {
|
|
313
|
+
if (!path) return Promise.resolve(null);
|
|
314
|
+
const hit = originCache.get(path);
|
|
315
|
+
if (hit && Date.now() - hit.at < ttlMs) return hit.value;
|
|
316
|
+
const value = new Promise<string | null>(resolve => execFile("git", ["-C", path, "remote", "get-url", "origin"], { timeout: 5_000 }, (error, stdout) => resolve(error ? null : githubRepoOf(String(stdout)))));
|
|
317
|
+
originCache.set(path, { at: Date.now(), value });
|
|
318
|
+
return value;
|
|
319
|
+
}
|
|
320
|
+
/** A git project's GitHub repository: its remote key, else its checkout's origin (`checkoutRepo`); null otherwise. */
|
|
321
|
+
export async function gitProjectRepo(p: { kind?: string; key: string; path?: string | null }): Promise<string | null> {
|
|
322
|
+
if (p.kind && p.kind !== "git") return null;
|
|
323
|
+
return projectRepo(p.key)?.toLowerCase() ?? await checkoutRepo(p.path);
|
|
324
|
+
}
|
|
303
325
|
/** The agent whose session is opening, from the session_open request: Paseo doesn't list it until its first session is open. */
|
|
304
326
|
export type OpeningAgent = { id: string; workspaceId: string; provider: string; cwd: string; title?: string | null; labels: Record<string, string> };
|
|
305
327
|
const openingAgent = (a: OpeningAgent): Agent => ({ id: a.id, workspaceId: a.workspaceId, provider: a.provider, cwd: a.cwd, title: a.title ?? null, labels: a.labels, status: "initializing", activeTurn: null, archivedAt: null, lastUserMessageAt: null, pendingPermissions: [] } as unknown as Agent);
|
|
@@ -395,7 +417,8 @@ export class PaseoGateway implements Gateway {
|
|
|
395
417
|
// Preserve the designated owner even when it is no longer indexed. Other root
|
|
396
418
|
// sessions can still contribute their PRs without acquiring completion authority.
|
|
397
419
|
const project = projects.find(p => p.projectId === workspace.projectId);
|
|
398
|
-
|
|
420
|
+
// a-source-names-its-own-repo-and-holder: the one project-repository reader (remote key, else the checkout's origin).
|
|
421
|
+
const repo = project ? await gitProjectRepo({ kind: project.projectKind, key: project.projectKey, path: project.projectRootPath }) : null;
|
|
399
422
|
row.repo = repo;
|
|
400
423
|
if (repo) this.workspaceRepos.set(workspace.id, repo); else this.workspaceRepos.delete(workspace.id);
|
|
401
424
|
this.workspaceCwds.set(workspace.id, [...new Set(roots.map(a => a.cwd).filter(Boolean))]);
|
package/server/mcp-source.ts
CHANGED
|
@@ -9,6 +9,21 @@ export const mcpSource: string = [
|
|
|
9
9
|
"import { join, delimiter } from \"node:path\";",
|
|
10
10
|
"import { homedir } from \"node:os\";",
|
|
11
11
|
"// Follow-up's words live in one place; scripts/build.mjs inlines them into mcp-source.ts (the bridge runs as one file).",
|
|
12
|
+
"// ---- inlined from shared/daemon-url.mjs by scripts/build.mjs ----",
|
|
13
|
+
"/**",
|
|
14
|
+
" * One config-to-URL rule for the worker and standalone bridge (inlined by scripts/build.mjs).",
|
|
15
|
+
" * Match Paseo's getMainListenAddress: socket/pipe paths are literal; TCP lists use the trimmed first entry.",
|
|
16
|
+
" */",
|
|
17
|
+
"export function daemonUrl(config, override) {",
|
|
18
|
+
" if (override) return override;",
|
|
19
|
+
" const listen = config.daemon?.listen ?? \"127.0.0.1:6767\";",
|
|
20
|
+
" if (listen.startsWith(\"pipe://\") || listen.startsWith(\"unix://\")) return `ws+unix://${listen.slice(7)}:/ws`;",
|
|
21
|
+
" if (listen.startsWith(\"\\\\\\\\.\\\\pipe\\\\\") || listen.startsWith(\"/\") || listen.startsWith(\"~\")) return `ws+unix://${listen}:/ws`;",
|
|
22
|
+
" const main = listen.split(\",\", 1)[0].trim();",
|
|
23
|
+
" return `ws://${/^\\d+$/.test(main) ? `127.0.0.1:${main}` : main}/ws`;",
|
|
24
|
+
"}",
|
|
25
|
+
"",
|
|
26
|
+
"// ---- end of shared/daemon-url.mjs ----",
|
|
12
27
|
"// ---- inlined from shared/agent-text.mjs by scripts/build.mjs ----",
|
|
13
28
|
"/**",
|
|
14
29
|
" * Everything Follow-up says to an agent, in one place (one-place-for-agent-text): the workspace instructions, the role",
|
|
@@ -567,7 +582,7 @@ export const mcpSource: string = [
|
|
|
567
582
|
" let password = process.env.PASEO_PASSWORD;",
|
|
568
583
|
" if (!password && process.env.PASEO_PASSWORD_FILE) password = (await readFile(process.env.PASEO_PASSWORD_FILE, \"utf8\")).trim();",
|
|
569
584
|
" if (!password && home === join(homedir(), \".paseo\")) password = await readFile(join(homedir(), \"paseo-hub/secrets/daemon-password\"), \"utf8\").then(s => s.trim()).catch(() => undefined);",
|
|
570
|
-
" const client = new DaemonClient({ url: process.env.PASEO_DAEMON_URL
|
|
585
|
+
" const client = new DaemonClient({ url: daemonUrl(config, process.env.PASEO_DAEMON_URL), clientId: \"follow-up-mcp\", clientType: \"cli\", reconnect: { enabled: false }, connectTimeoutMs: 10000, suppressSendErrors: true, ...(password ? { password } : {}) });",
|
|
571
586
|
" try {",
|
|
572
587
|
" await client.connect();",
|
|
573
588
|
" let last;",
|
package/server/mcp.mjs
CHANGED
|
@@ -7,6 +7,7 @@ import { existsSync, realpathSync } from "node:fs";
|
|
|
7
7
|
import { join, delimiter } from "node:path";
|
|
8
8
|
import { homedir } from "node:os";
|
|
9
9
|
// Follow-up's words live in one place; scripts/build.mjs inlines them into mcp-source.ts (the bridge runs as one file).
|
|
10
|
+
import { daemonUrl } from "../shared/daemon-url.mjs";
|
|
10
11
|
import { bridgeInstructions } from "../shared/agent-text.mjs";
|
|
11
12
|
|
|
12
13
|
/** Set by the worker's prelude (shared/legacy.ts withRuntimePrelude); absent when a test imports this file. */
|
|
@@ -430,7 +431,7 @@ async function call(method, input) {
|
|
|
430
431
|
let password = process.env.PASEO_PASSWORD;
|
|
431
432
|
if (!password && process.env.PASEO_PASSWORD_FILE) password = (await readFile(process.env.PASEO_PASSWORD_FILE, "utf8")).trim();
|
|
432
433
|
if (!password && home === join(homedir(), ".paseo")) password = await readFile(join(homedir(), "paseo-hub/secrets/daemon-password"), "utf8").then(s => s.trim()).catch(() => undefined);
|
|
433
|
-
const client = new DaemonClient({ url: process.env.PASEO_DAEMON_URL
|
|
434
|
+
const client = new DaemonClient({ url: daemonUrl(config, process.env.PASEO_DAEMON_URL), clientId: "follow-up-mcp", clientType: "cli", reconnect: { enabled: false }, connectTimeoutMs: 10000, suppressSendErrors: true, ...(password ? { password } : {}) });
|
|
434
435
|
try {
|
|
435
436
|
await client.connect();
|
|
436
437
|
let last;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One config-to-URL rule for the worker and standalone bridge (inlined by scripts/build.mjs).
|
|
3
|
+
* Match Paseo's getMainListenAddress: socket/pipe paths are literal; TCP lists use the trimmed first entry.
|
|
4
|
+
*/
|
|
5
|
+
export function daemonUrl(config, override) {
|
|
6
|
+
if (override) return override;
|
|
7
|
+
const listen = config.daemon?.listen ?? "127.0.0.1:6767";
|
|
8
|
+
if (listen.startsWith("pipe://") || listen.startsWith("unix://")) return `ws+unix://${listen.slice(7)}:/ws`;
|
|
9
|
+
if (listen.startsWith("\\\\.\\pipe\\") || listen.startsWith("/") || listen.startsWith("~")) return `ws+unix://${listen}:/ws`;
|
|
10
|
+
const main = listen.split(",", 1)[0].trim();
|
|
11
|
+
return `ws://${/^\d+$/.test(main) ? `127.0.0.1:${main}` : main}/ws`;
|
|
12
|
+
}
|
package/shared/dispatch.ts
CHANGED
|
@@ -295,10 +295,23 @@ export function parseSource(raw: string): DispatchSource {
|
|
|
295
295
|
const m = /^([\w.-]+\/[\w.-]+)#(\d+)$/.exec(c.key);
|
|
296
296
|
return { ...base, kind: c.kind, key: c.key, title: c.key, url: c.url, repo: m?.[1].toLowerCase() ?? null, number: m ? Number(m[2]) : null };
|
|
297
297
|
}
|
|
298
|
-
|
|
299
|
-
|
|
298
|
+
// Any other link keeps the key `follow_link_item` gives it (so `existing` finds a workspace that linked it), and a
|
|
299
|
+
// github.com link names its repository like an issue does.
|
|
300
|
+
const link = c ?? (/^https?:\/\/\S+$/i.test(text) ? classifyLink(text, true) ?? { kind: "link" as const, key: text, url: text } : null);
|
|
301
|
+
if (link) return { ...base, kind: "link", key: link.key, title: link.url ?? link.key, url: link.url, repo: githubRepoOf(link.url ?? "") };
|
|
300
302
|
return { ...base, kind: "text", key: null, title: firstSentence(text) || "New work", body: text, read: true };
|
|
301
303
|
}
|
|
304
|
+
/** GitHub paths under github.com that aren't a repository. */
|
|
305
|
+
const NOT_A_REPO = new Set(["orgs", "settings", "notifications", "pulls", "issues", "marketplace", "explore", "topics", "search", "sponsors", "login", "new", "users", "apps", "features", "enterprise"]);
|
|
306
|
+
/**
|
|
307
|
+
* The GitHub repository (lower-case owner/name) a URL or a git remote names: `https://github.com/acme/web/…`,
|
|
308
|
+
* `git@github.com:acme/web.git`, `ssh://git@github.com/acme/web.git`. Null for anything else.
|
|
309
|
+
*/
|
|
310
|
+
export function githubRepoOf(url: string): string | null {
|
|
311
|
+
const m = /^(?:(?:https?|ssh|git):\/\/(?:[^@/]+@)?(?:www\.)?github\.com(?::\d+)?\/|[^@/\s]+@github\.com:)([\w.-]+)\/([\w.-]+?)(?:\.git)?(?:[/?#].*)?$/i.exec(url.trim());
|
|
312
|
+
if (!m || NOT_A_REPO.has(m[1].toLowerCase())) return null;
|
|
313
|
+
return `${m[1]}/${m[2]}`.toLowerCase();
|
|
314
|
+
}
|
|
302
315
|
/** A Linear issue read as a source. */
|
|
303
316
|
export function linearSource(issue: LinearIssue): DispatchSource {
|
|
304
317
|
return { kind: "linear", key: issue.key, title: issue.title, url: issue.url, body: issue.description ?? "", team: issue.team, repo: null, number: null, branchHint: issue.branchName, state: issue.state, read: true };
|
|
@@ -377,7 +390,7 @@ export type WhereInput = {
|
|
|
377
390
|
|
|
378
391
|
/**
|
|
379
392
|
* The project a source goes to, and why, in this order: the developer's pick; the repository a GitHub link names; the
|
|
380
|
-
* project its live workspace is in; the team's rule; what the team's past workspaces learned (LEARN_MIN and LEARN_SHARE); for a source with no team, the
|
|
393
|
+
* project its live workspace is in; for a source that names a repository no project has, ambiguous; the team's rule; what the team's past workspaces learned (LEARN_MIN and LEARN_SHARE); for a source with no team, the
|
|
381
394
|
* last used project as a guess; the only project; otherwise ambiguous, with the candidates. A rule or pick naming a
|
|
382
395
|
* project that is gone makes it ambiguous and says so; nothing ever switches silently.
|
|
383
396
|
*/
|
|
@@ -402,6 +415,9 @@ export function resolveWhere(input: WhereInput): Where {
|
|
|
402
415
|
const p = byId.get(input.workspaceProjectId);
|
|
403
416
|
if (p) return at(p, "workspace", "Where its workspace is");
|
|
404
417
|
}
|
|
418
|
+
// a-source-names-its-own-repo-and-holder: a source that names its repository goes only to a project whose checkout's
|
|
419
|
+
// origin is that repository. No such project asks (pick one, or clone it first); never the last used or the only one.
|
|
420
|
+
if (source.repo) return ambiguous(`No Paseo project has ${source.repo} as its origin. Pick a project, or clone ${source.repo} and add it to Paseo first.`);
|
|
405
421
|
const team = source.team;
|
|
406
422
|
if (team) {
|
|
407
423
|
const rule = input.rules[team];
|
|
@@ -20,9 +20,9 @@ export type IssueWorkspaceInput = {
|
|
|
20
20
|
id: string; title: string; archived: boolean; enable_tracking?: boolean;
|
|
21
21
|
/** When it last did something (newest wins a tie between holders of the same kind). */
|
|
22
22
|
activityAt?: string | null;
|
|
23
|
-
prs: readonly { snapshot?: { title?: string; headBranch?: string } | null }[];
|
|
23
|
+
prs: readonly { repo?: string; snapshot?: { title?: string; headBranch?: string } | null }[];
|
|
24
24
|
}[];
|
|
25
|
-
/** Workspace id → the Linear keys
|
|
25
|
+
/** Workspace id → the keys of every item it links (`follow_link_item`): Linear keys, `owner/name#12` GitHub issues, URLs. */
|
|
26
26
|
links: Iterable<readonly [string, readonly string[]]>;
|
|
27
27
|
};
|
|
28
28
|
|
|
@@ -53,7 +53,10 @@ export function issueWorkspaces(input: IssueWorkspaceInput): Map<string, IssueHo
|
|
|
53
53
|
if (was && (was.holder.via === "pr" && via === "link" || was.holder.via === via && was.at >= at)) return;
|
|
54
54
|
best.set(key, { holder: { workspaceId: w.id, title: w.title, state: w.enable_tracking ? "tracked" : "untracked", via }, at });
|
|
55
55
|
};
|
|
56
|
-
for (const w of live.values()) for (const pr of w.prs)
|
|
56
|
+
for (const w of live.values()) for (const pr of w.prs) {
|
|
57
|
+
const keys = [...keysIn(pr.snapshot?.headBranch), ...keysIn(pr.snapshot?.title), ...githubIssueKeysIn(pr.repo, pr.snapshot?.headBranch)];
|
|
58
|
+
for (const key of new Set(keys)) offer(key, w, "pr");
|
|
59
|
+
}
|
|
57
60
|
for (const [id, keys] of input.links) {
|
|
58
61
|
const w = live.get(id);
|
|
59
62
|
if (w) for (const key of keys) offer(issueKey(key), w, "link");
|
|
@@ -63,3 +66,22 @@ export function issueWorkspaces(input: IssueWorkspaceInput): Map<string, IssueHo
|
|
|
63
66
|
|
|
64
67
|
/** The holder of one key, from a map `issueWorkspaces` built. */
|
|
65
68
|
export const holderOf = <T>(map: ReadonlyMap<string, T>, key: string | null | undefined): T | null => key ? map.get(issueKey(key)) ?? null : null;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* The GitHub issue a tracked PR's branch names, as `owner/name#12`: Dispatch names a GitHub issue's branch
|
|
72
|
+
* `issue-12-…` (`branchFor`), so the PR it opens holds that issue. Only in the PR's own repository.
|
|
73
|
+
*/
|
|
74
|
+
export function githubIssueKeysIn(repo: string | null | undefined, branch: string | null | undefined): string[] {
|
|
75
|
+
const m = repo && branch ? /(?:^|\/)issue-(\d+)(?![0-9])/.exec(branch) : null;
|
|
76
|
+
return m ? [issueKey(`${repo}#${Number(m[1])}`)] : [];
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* One source's live workspace (a-source-names-its-own-repo-and-holder): the PR's tracking workspace for a pull request,
|
|
81
|
+
* else whoever holds the source's own key in the map `issueWorkspaces` built, for every kind with a key (a Linear
|
|
82
|
+
* issue, a GitHub issue, a link). The same keys `follow_link_item` and tracked PRs use; a typed sentence has none.
|
|
83
|
+
*/
|
|
84
|
+
export function sourceHolder<T>(source: { kind: string; key: string | null }, holders: ReadonlyMap<string, T>, prHolder?: () => T | null): T | null {
|
|
85
|
+
if (source.kind === "pr") { const own = prHolder?.() ?? null; if (own) return own; }
|
|
86
|
+
return source.kind === "text" ? null : holderOf(holders, source.key);
|
|
87
|
+
}
|