passport-bridge 0.45.0 → 0.46.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/dist/cliArgs.d.ts +1 -1
  2. package/dist/cliArgs.js +3 -0
  3. package/dist/cliConnect.d.ts +3 -1
  4. package/dist/cliConnect.js +58 -6
  5. package/dist/cliConnections.d.ts +3 -3
  6. package/dist/cliConnections.js +13 -5
  7. package/dist/cliExec.js +1 -5
  8. package/dist/cliGitCredential.d.ts +2 -0
  9. package/dist/cliGitCredential.js +15 -7
  10. package/dist/cliGuardHealth.js +2 -1
  11. package/dist/cliHook.js +5 -1
  12. package/dist/cliHookAfter.js +2 -2
  13. package/dist/cliHookNotices.d.ts +7 -0
  14. package/dist/cliHookNotices.js +14 -0
  15. package/dist/cliMain.js +33 -3
  16. package/dist/cliOutput.js +4 -6
  17. package/dist/cliRequest.d.ts +65 -0
  18. package/dist/cliRequest.js +135 -0
  19. package/dist/cliScan.js +1 -1
  20. package/dist/cliSession.d.ts +0 -1
  21. package/dist/cliSession.js +0 -2
  22. package/dist/cliStatus.d.ts +4 -2
  23. package/dist/cliStatus.js +21 -4
  24. package/dist/cliSupport.d.ts +0 -8
  25. package/dist/completion.js +1 -0
  26. package/dist/connectorKit/engine.generated.d.ts +2 -2
  27. package/dist/connectorKit/engine.generated.js +23 -3
  28. package/dist/connectorKit/manifest.generated.d.ts +1 -1
  29. package/dist/connectorKit/manifests/github.generated.js +26 -3
  30. package/dist/connectorKit/manifests/githubCapture.generated.js +41 -10
  31. package/dist/connectorKit/manifests/githubHooks.generated.js +21 -1
  32. package/dist/connectorKit/manifests/githubReads.generated.d.ts +2 -0
  33. package/dist/connectorKit/manifests/githubReads.generated.js +30 -5
  34. package/dist/connectorKit/manifests/railway.generated.js +3 -3
  35. package/dist/connectorKit/manifests/supabase.generated.js +1 -1
  36. package/dist/connectorKit/manifests/supabaseCatalog.generated.js +3 -3
  37. package/dist/controlPlane.generated.d.ts +19 -18
  38. package/dist/controlPlane.generated.js +12 -17
  39. package/dist/controlPlaneGithub.generated.d.ts +2 -2
  40. package/dist/controlPlaneGithub.generated.js +12 -2
  41. package/dist/controlPlaneGithubApi.generated.d.ts +2 -0
  42. package/dist/controlPlaneGithubApi.generated.js +56 -1
  43. package/dist/controlPlaneGithubCatalog.generated.d.ts +9 -3
  44. package/dist/controlPlaneGithubCatalog.generated.js +19 -13
  45. package/dist/controlPlaneGithubCli.generated.d.ts +2 -0
  46. package/dist/controlPlaneGithubCli.generated.js +65 -12
  47. package/dist/controlPlaneGuard.js +2 -0
  48. package/dist/controlPlanePeople.generated.d.ts +117 -0
  49. package/dist/controlPlanePeople.generated.js +6 -0
  50. package/dist/controlPlaneRoutes.generated.d.ts +63 -0
  51. package/dist/controlPlaneRoutes.generated.js +111 -0
  52. package/dist/controlPlaneSupabase.js +3 -1
  53. package/dist/controlPlaneUnnamed.generated.d.ts +58 -0
  54. package/dist/controlPlaneUnnamed.generated.js +225 -0
  55. package/dist/cpCli.js +5 -1
  56. package/dist/gitCredentialRetire.d.ts +25 -0
  57. package/dist/gitCredentialRetire.js +143 -0
  58. package/dist/initAppsStep.d.ts +1 -1
  59. package/dist/initAppsStep.js +7 -5
  60. package/dist/initOutro.js +13 -10
  61. package/dist/initState.d.ts +3 -2
  62. package/dist/initState.js +7 -18
  63. package/dist/localNotices.d.ts +22 -0
  64. package/dist/localNotices.js +100 -0
  65. package/dist/pluginPin.d.ts +1 -1
  66. package/dist/pluginPin.js +1 -1
  67. package/dist/version.d.ts +1 -1
  68. package/dist/version.js +1 -1
  69. package/dist/webLinks.d.ts +23 -6
  70. package/dist/webLinks.js +21 -22
  71. package/npm-shrinkwrap.json +8 -8
  72. package/package.json +1 -1
  73. package/dist/cliApprovalLink.d.ts +0 -5
  74. package/dist/cliApprovalLink.js +0 -21
@@ -0,0 +1,135 @@
1
+ /**
2
+ * `passport request`: ask for an app, see your requests, take one back (docs/design/v21/requests.md, section 4).
3
+ *
4
+ * passport request <app> --reason "<what it's for>" ask; an admin or the app's owner decides
5
+ * passport request your requests
6
+ * passport request <app> --cancel take back your request
7
+ *
8
+ * The answer arrives later as a one-time line in the next command's output (localNotices.ts), and by Slack and email.
9
+ * A person asks; an agent token can't.
10
+ */
11
+ import { bool, value } from "./cliArgs.js";
12
+ import { api, json } from "./cliMemberCall.js";
13
+ import { failure, readBoundedJson, safeApiError, sanitize } from "./cliSupport.js";
14
+ import { processTerminal } from "./initUi.js";
15
+ import { mark, termOf } from "./term.js";
16
+ const REASON_MIN = 10;
17
+ const REASON_MAX = 280;
18
+ const APP_NAME = /^[\p{L}\p{N}][\p{L}\p{N} ._-]{1,63}$/u;
19
+ const PATH = "/api/my/app-requests";
20
+ /** "Nov 16" in the person's own time zone. */
21
+ export function shortDate(at) {
22
+ return new Date(at).toLocaleDateString("en-US", { month: "short", day: "numeric" });
23
+ }
24
+ /** "You'll hear back here, in Slack and by email." without the ways that don't reach them. */
25
+ export function hearBackLine(reach) {
26
+ const ways = [...(reach.slack ? ["in Slack"] : []), ...(reach.email ? ["by email"] : [])];
27
+ if (!ways.length)
28
+ return "You'll hear back here.";
29
+ return `You'll hear back here, ${ways.join(" and ")}.`;
30
+ }
31
+ function cleanReason(raw) {
32
+ const reason = (raw ?? "").replace(/\s+/g, " ").trim();
33
+ return reason.length >= REASON_MIN && reason.length <= REASON_MAX ? reason : undefined;
34
+ }
35
+ async function askedReason(app, runtime, deps) {
36
+ const usage = `Say what it's for: passport request ${app} --reason "…"`;
37
+ let ask = deps.ask;
38
+ if (!ask && !deps.api) {
39
+ const terminal = processTerminal(runtime, process.platform, false);
40
+ if (terminal.interactive)
41
+ ask = (prompt) => terminal.question(prompt, runtime.signal);
42
+ }
43
+ if (!ask)
44
+ return failure(usage, 6, "usage");
45
+ const typed = cleanReason(await ask("What's it for? "));
46
+ return (typed ?? failure(`Give a reason of ${REASON_MIN}-${REASON_MAX} characters saying what you need it for.`, 6, "usage"));
47
+ }
48
+ function humanFiled(result, ok) {
49
+ if (!result.filed)
50
+ return `${ok} ${result.message}`;
51
+ if (result.status === "auto_approved") {
52
+ const link = result.connectUrl ? ` Connect: ${result.connectUrl}` : "";
53
+ return `${ok} ${result.app.name} is offered to your team.${link}`;
54
+ }
55
+ if (!result.created)
56
+ return `${ok} You already asked on ${shortDate(result.askedAt)}. Waiting for ${result.decidersLine}.`;
57
+ return `${ok} Sent to ${result.decidersLine}.\n ${hearBackLine(result.reach)}`;
58
+ }
59
+ async function file(args, runtime, deps, app) {
60
+ const given = value(args, "reason");
61
+ const reason = given === undefined ? await askedReason(app, runtime, deps) : cleanReason(given);
62
+ if (!reason) {
63
+ return failure(`Give a reason of ${REASON_MIN}-${REASON_MAX} characters saying what you need it for.`, 6, "usage");
64
+ }
65
+ const response = await api(args, runtime, deps).fetchApi(PATH, {
66
+ method: "POST",
67
+ headers: { "content-type": "application/json", accept: "application/json" },
68
+ body: JSON.stringify({ app, reason, via: "cli" }),
69
+ signal: runtime.signal
70
+ });
71
+ if (response.status === 400 || response.status === 429) {
72
+ return failure(await safeApiError(response, "Passport couldn't file that request."), response.status === 429 ? 1 : 6, "refused");
73
+ }
74
+ const result = await json(response, "Passport couldn't file that request.");
75
+ if (!result.filed && result.reason !== "connected")
76
+ return failure(sanitize(result.message), 1, result.reason);
77
+ const term = termOf(runtime.stdout, runtime.env);
78
+ return { json: result, human: humanFiled(result, mark(term, "done")) };
79
+ }
80
+ async function mine(args, runtime, deps) {
81
+ const response = await api(args, runtime, deps).fetchApi(PATH, {
82
+ method: "GET",
83
+ headers: { accept: "application/json" },
84
+ signal: runtime.signal
85
+ });
86
+ return (await json(response, "Passport couldn't list your requests.")).requests;
87
+ }
88
+ async function cancel(args, runtime, deps, app) {
89
+ const needle = app.trim().toLowerCase();
90
+ const open = (await mine(args, runtime, deps)).find((row) => row.status === "pending" && (row.app.key === needle || row.app.name.toLowerCase() === needle));
91
+ if (!open)
92
+ return failure(`You have no waiting request for ${app}.`, 1, "not_found", { hint: "Run: passport request" });
93
+ const response = await api(args, runtime, deps).fetchApi(`${PATH}/${encodeURIComponent(open.id)}`, {
94
+ method: "DELETE",
95
+ headers: { accept: "application/json" },
96
+ signal: runtime.signal
97
+ });
98
+ if (!response.ok)
99
+ return failure(await safeApiError(response, "Passport couldn't cancel it."), 1, "server");
100
+ await readBoundedJson(response).catch(() => undefined);
101
+ const term = termOf(runtime.stdout, runtime.env);
102
+ return {
103
+ json: { cancelled: open.id, app: open.app },
104
+ human: `${mark(term, "done")} Cancelled your request for ${open.app.name}.`
105
+ };
106
+ }
107
+ async function list(args, runtime, deps) {
108
+ const rows = await mine(args, runtime, deps);
109
+ if (!rows.length)
110
+ return { json: { requests: [] }, human: "No requests." };
111
+ const width = Math.max(...rows.map((row) => row.app.name.length)) + 3;
112
+ const human = rows
113
+ .map((row) => {
114
+ const when = row.status === "pending" ? ` · asked ${shortDate(row.askedAt)}` : "";
115
+ return `${row.app.name.padEnd(width)}${row.statusLine}${when}`;
116
+ })
117
+ .join("\n");
118
+ return { json: { requests: rows }, human };
119
+ }
120
+ export async function request(args, runtime, deps = {}) {
121
+ const [app, ...extra] = args.positionals;
122
+ if (extra.length)
123
+ return failure('Name one app: passport request <app> --reason "…"', 6, "usage");
124
+ if (app === undefined) {
125
+ if (bool(args, "cancel") || value(args, "reason") !== undefined) {
126
+ return failure('Name the app: passport request <app> --reason "…"', 6, "usage");
127
+ }
128
+ return list(args, runtime, deps);
129
+ }
130
+ if (!APP_NAME.test(app.trim()))
131
+ return failure("Name the app by its key, like github or linear.", 6, "usage");
132
+ if (bool(args, "cancel"))
133
+ return cancel(args, runtime, deps, app.trim());
134
+ return file(args, runtime, deps, app.trim());
135
+ }
package/dist/cliScan.js CHANGED
@@ -182,7 +182,7 @@ export function renderScan(result, options) {
182
182
  else
183
183
  lines.push(paint("dim", "Nothing left this computer."));
184
184
  if (count && options.initCommand) {
185
- lines.push("", `Give agents access without these keys: ${paint("bold", options.initCommand)}`);
185
+ lines.push("", `Put your agents under your company's rules: ${paint("bold", options.initCommand)}`);
186
186
  }
187
187
  else if (options.notSetUp && options.initCommand) {
188
188
  lines.push("", `Turn on the guard for your agents: ${paint("bold", options.initCommand)}`);
@@ -1,6 +1,5 @@
1
1
  import { type ParsedArgs } from "./cliArgs.js";
2
2
  import { CliFailure, type CommandResult, type Runtime } from "./cliSupport.js";
3
- export { linkApproval } from "./cliApprovalLink.js";
4
3
  export declare const CLI_SESSION_LINE_MAX_BYTES: number;
5
4
  export declare const CLI_SESSION_ARGV_MAX_ITEMS = 128;
6
5
  export type SessionRequest = {
@@ -2,8 +2,6 @@ import { once } from "node:events";
2
2
  import { bool, parseArgs, value } from "./cliArgs.js";
3
3
  import { asFailure, failurePayload } from "./cliOutput.js";
4
4
  import { callerFrom, CliFailure, failure, resolveCliAuth, timeoutMs } from "./cliSupport.js";
5
- // Failures leave through here and the CLI's catch; both name the approval they hit.
6
- export { linkApproval } from "./cliApprovalLink.js";
7
5
  export const CLI_SESSION_LINE_MAX_BYTES = 1024 * 1024;
8
6
  export const CLI_SESSION_ARGV_MAX_ITEMS = 128;
9
7
  /**
@@ -1,7 +1,8 @@
1
1
  /**
2
2
  * `passport status`: one screen, like `gh auth status`, in the web's words.
3
3
  *
4
- * You erin@acme.test in Acme
4
+ * You Erin Park in Acme
5
+ * My activity https://passportmcp.com/#p
5
6
  * Computer Ramish's Laptop
6
7
  * Guard ✓ Claude Code On
7
8
  * ! Codex Not trusted. Open Codex → /hooks and trust Passport's hooks.
@@ -55,7 +56,8 @@ export type StatusView = {
55
56
  };
56
57
  member: {
57
58
  id: string;
58
- email: string;
59
+ name?: string;
60
+ email?: string;
59
61
  };
60
62
  computer: string;
61
63
  mcps: Array<{
package/dist/cliStatus.js CHANGED
@@ -11,14 +11,15 @@ import { keyRows } from "./statusKeys.js";
11
11
  import { countOf } from "./plural.js";
12
12
  import { listOf } from "./initUi.js";
13
13
  import { VERSION } from "./version.js";
14
+ import { hashLink, MY_ACTIVITY_LINK } from "./webLinks.js";
14
15
  const CLI_POLICY_SYNC_MS = 5_000;
15
16
  const LABEL = 13;
16
17
  /** Plain words for a connection state in human output; --json keeps the code. */
17
18
  const CONNECTION_STATUS_LABELS = {
18
19
  connected: "connected",
19
- org_managed: "company-managed",
20
+ org_managed: "connected by your company",
20
21
  needs_your_signin: "needs your sign-in",
21
- needs_setup: "needs admin setup"
22
+ needs_setup: "not set up yet"
22
23
  };
23
24
  function connectionStatusLabel(status) {
24
25
  return CONNECTION_STATUS_LABELS[status] ?? status.replace(/_/g, " ");
@@ -143,13 +144,25 @@ function markedTable(term, rows) {
143
144
  ...(row.note ? wrap(row.note, width, indent) : [])
144
145
  ]);
145
146
  }
147
+ /** Who is signed in: the name cached at login, else the server's name, with the email only when an older server
148
+ * still sends one. */
149
+ function memberLabel(view) {
150
+ const name = view.signedInAs || view.member.name;
151
+ const email = view.member.email;
152
+ if (name && email && name !== email)
153
+ return `${name} (${email})`;
154
+ return name || email || "You";
155
+ }
146
156
  function youRows(view, term) {
147
157
  const host = hostOf(view.auth.endpoint);
148
158
  const who = view.auth.kind === "agent-key"
149
159
  ? `An agent token in ${view.workspace.name}`
150
- : `${view.signedInAs && view.signedInAs !== view.member.email ? `${view.signedInAs} (${view.member.email})` : view.member.email} in ${view.workspace.name}`;
160
+ : `${memberLabel(view)} in ${view.workspace.name}`;
161
+ // A person's own page in the web app; an agent token has none. The link is never wrapped.
162
+ const page = view.auth.kind === "agent-key" ? null : hashLink(view.auth.endpoint, MY_ACTIVITY_LINK);
151
163
  return [
152
164
  { label: "You", lines: wrap(`${who}${host ? ` (${host})` : ""}`, valueWidth(term)) },
165
+ ...(page ? [{ label: "My activity", lines: [page] }] : []),
153
166
  { label: "Computer", lines: wrap(view.computer, valueWidth(term)) }
154
167
  ];
155
168
  }
@@ -323,7 +336,11 @@ export async function status(args, runtime, withGateway, syncCliPolicy) {
323
336
  const local = localStatus(auth, runtime.env);
324
337
  const data = {
325
338
  workspace: { id: String(managed.workspace.id), name: String(managed.workspace.name) },
326
- member: { id: String(managed.member.id), email: String(managed.member.email) },
339
+ member: {
340
+ id: String(managed.member.id),
341
+ ...(typeof managed.member.name === "string" ? { name: managed.member.name } : {}),
342
+ ...(typeof managed.member.email === "string" ? { email: managed.member.email } : {})
343
+ },
327
344
  endpoint: auth.endpoint,
328
345
  auth: managed.auth,
329
346
  ...(auth.kind === "profile" ? { profile: auth.profile } : {}),
@@ -67,8 +67,6 @@ export declare class CliFailure extends Error {
67
67
  readonly cause: string;
68
68
  readonly details: {
69
69
  approvalId?: string;
70
- /** The approval in the web app, when the origin is known. */
71
- approvalUrl?: string;
72
70
  app?: string;
73
71
  connectUrl?: string;
74
72
  hint?: string;
@@ -77,13 +75,9 @@ export declare class CliFailure extends Error {
77
75
  remediation?: CliRemediation;
78
76
  retry?: CliRetry;
79
77
  requiredInput?: string[];
80
- /** The approval link is already on screen (the waiting line printed it). */
81
- linkShown?: boolean;
82
78
  };
83
79
  constructor(message: string, exitCode: number, cause: string, details?: {
84
80
  approvalId?: string;
85
- /** The approval in the web app, when the origin is known. */
86
- approvalUrl?: string;
87
81
  app?: string;
88
82
  connectUrl?: string;
89
83
  hint?: string;
@@ -92,8 +86,6 @@ export declare class CliFailure extends Error {
92
86
  remediation?: CliRemediation;
93
87
  retry?: CliRetry;
94
88
  requiredInput?: string[];
95
- /** The approval link is already on screen (the waiting line printed it). */
96
- linkShown?: boolean;
97
89
  });
98
90
  }
99
91
  export declare function failure(message: string, exitCode: number, cause: string, details?: CliFailure["details"]): never;
@@ -13,6 +13,7 @@ const DESCRIPTIONS = {
13
13
  run: "Run a governed tool",
14
14
  connect: "Connect member app accounts",
15
15
  connections: "Your connections, and your connections page",
16
+ request: "Ask for an app",
16
17
  resources: "List or read MCP resources",
17
18
  prompts: "List or get MCP prompts",
18
19
  scan: "Find the keys and MCP servers your agents can reach",
@@ -4,8 +4,8 @@
4
4
  * like every connector's `classify` (spec Part 2): no network, no platform
5
5
  * names. Summaries are templates filled with safe names only.
6
6
  *
7
- * Fails closed. These all become the manifest's Unclassified Action (kind
8
- * delete, so a Delete Block blocks it): a command, tool or route the manifest doesn't
7
+ * What it can't name is never guessed. These all become the manifest's Unclassified Action (its own kind,
8
+ * Unclassified, 2026-11-17; with what it hit, `unnamed`): a command, tool or route the manifest doesn't
9
9
  * name; a flag the vendor's spec doesn't list; a boolean the CLI framework
10
10
  * wouldn't accept; a value flag with no value; an argument no rule names; a
11
11
  * known operation whose conditions no rule matches; a SQL rule with no SQL; a
@@ -5,8 +5,8 @@
5
5
  * like every connector's `classify` (spec Part 2): no network, no platform
6
6
  * names. Summaries are templates filled with safe names only.
7
7
  *
8
- * Fails closed. These all become the manifest's Unclassified Action (kind
9
- * delete, so a Delete Block blocks it): a command, tool or route the manifest doesn't
8
+ * What it can't name is never guessed. These all become the manifest's Unclassified Action (its own kind,
9
+ * Unclassified, 2026-11-17; with what it hit, `unnamed`): a command, tool or route the manifest doesn't
10
10
  * name; a flag the vendor's spec doesn't list; a boolean the CLI framework
11
11
  * wouldn't accept; a value flag with no value; an argument no rule names; a
12
12
  * known operation whose conditions no rule matches; a SQL rule with no SQL; a
@@ -17,6 +17,7 @@
17
17
  * or SQL the parser shows only reads returns null.
18
18
  */
19
19
  import { nodeId } from "../controlPlane.generated.js";
20
+ import { unnamedApi, unnamedCli } from "../controlPlaneUnnamed.generated.js";
20
21
  import { knownOps, normalizeCli } from "./cli.generated.js";
21
22
  import { MANIFEST_SCHEMA } from "./manifest.generated.js";
22
23
  import { canonical, holds } from "./params.generated.js";
@@ -333,6 +334,23 @@ function build(m, part, params, context, hooks, each) {
333
334
  });
334
335
  return out;
335
336
  }
337
+ /** What an unnamed request hit, coarse (`controlPlaneUnnamed.ts`): an API call's method and path template, a command
338
+ * line's program and the words the CLI itself uses, up to the first it doesn't. Nothing for an MCP tool. */
339
+ function unnamedOf(m, n, ops) {
340
+ if (n.iface === "api") {
341
+ const [method, path] = n.op.split(" ");
342
+ return unnamedApi(m.platform, method, path ?? "");
343
+ }
344
+ if (n.iface !== "cli")
345
+ return undefined;
346
+ const words = [];
347
+ for (const [i, part] of n.op.split(" ").entries()) {
348
+ if (!ops.some((op) => op.split(" ")[i] === part))
349
+ break;
350
+ words.push(part);
351
+ }
352
+ return unnamedCli([m.capture.cli.programs[0] ?? m.platform, ...words]);
353
+ }
336
354
  /** What a request that fails closed becomes: the Unclassified Action, on the most specific node it names. */
337
355
  function unclassified(m, n, params, context, hooks, problem = n.problem) {
338
356
  const action = m.actions.find((a) => a.key === m.capture.unclassified);
@@ -349,13 +367,15 @@ function unclassified(m, n, params, context, hooks, problem = n.problem) {
349
367
  .join(" ")
350
368
  : (safeName(n.op) ?? "…");
351
369
  const at = nodeChain(m, action.appliesTo, params, context, hooks);
370
+ const unnamed = unnamedOf(m, n, ops);
352
371
  return {
353
372
  nodeId: at.unresolved
354
373
  ? nodeId(m.platform, m.types.find((t) => t.type === action.appliesTo)?.service ?? m.services[0].key)
355
374
  : at.nodeId,
356
375
  actionKey: m.capture.unclassified,
357
376
  summary: `${action.label}: ${what}${problem ? ` (${safeName(problem) ?? "invalid flags"})` : ""}`,
358
- nodes: at.unresolved ? [] : at.chain
377
+ nodes: at.unresolved ? [] : at.chain,
378
+ ...(unnamed ? { unnamed } : {})
359
379
  };
360
380
  }
361
381
  /* ------------------------------------------------------------------ */
@@ -199,7 +199,7 @@ export type CaptureSpec = {
199
199
  };
200
200
  /** SQL categories (sql.ts) → Action keys; a category not listed is a read. */
201
201
  sql: Readonly<Partial<Record<SqlCategory, string>>>;
202
- /** What anything unnamed becomes: an Action of kind delete, so the default rules block it. */
202
+ /** What anything unnamed becomes: an Action of kind Unclassified (2026-11-17), never assumed to be a Delete. */
203
203
  unclassified: string;
204
204
  };
205
205
  export type SqlCategory = "drop_database" | "drop_schema" | "drop_table" | "truncate" | "delete_all" | "rls_off" | "grant" | "ddl" | "write" | "export" | "opaque"
@@ -62,15 +62,38 @@ export const GITHUB_ACTIONS = [
62
62
  label: "Create or change a secret",
63
63
  icon: "Key"
64
64
  },
65
- // Anything the manifest can't name fails closed; in the server catalog since E3 (2026-11-16).
66
- { key: "github.unclassified", kind: "delete", appliesTo: "repo", label: "Unclassified action", icon: "CircleHelp" }
65
+ // The repository writes named since 2026-11-17 (docs/design/v22/unclassified.md).
66
+ { key: "github.workflow.run", kind: "change", appliesTo: "repo", label: "Run a workflow", icon: "Play" },
67
+ { key: "github.run.cancel", kind: "change", appliesTo: "repo", label: "Cancel a workflow run", icon: "CircleX" },
68
+ { key: "github.run.rerun", kind: "change", appliesTo: "repo", label: "Re-run a workflow", icon: "RefreshCw" },
69
+ { key: "github.pr.open", kind: "create", appliesTo: "repo", label: "Open a pull request", icon: "GitPullRequest" },
70
+ { key: "github.pr.edit", kind: "change", appliesTo: "repo", label: "Edit a pull request", icon: "GitPullRequest" },
71
+ {
72
+ key: "github.pr.state",
73
+ kind: "change",
74
+ appliesTo: "repo",
75
+ label: "Close or reopen a pull request",
76
+ icon: "GitPullRequestClosed"
77
+ },
78
+ { key: "github.comment", kind: "create", appliesTo: "repo", label: "Comment", icon: "MessageSquare" },
79
+ { key: "github.issue.open", kind: "create", appliesTo: "repo", label: "Open an issue", icon: "CircleDot" },
80
+ { key: "github.issue.edit", kind: "change", appliesTo: "repo", label: "Edit or close an issue", icon: "CircleCheck" },
81
+ { key: "github.label.manage", kind: "change", appliesTo: "repo", label: "Manage labels", icon: "Tag" },
82
+ // Anything the manifest can't name: its own kind, Unclassified (2026-11-17), never assumed to be a Delete.
83
+ {
84
+ key: "github.unclassified",
85
+ kind: "unclassified",
86
+ appliesTo: "repo",
87
+ label: "Unclassified action",
88
+ icon: "CircleHelp"
89
+ }
67
90
  ];
68
91
  export const GITHUB = {
69
92
  schema: MANIFEST_SCHEMA,
70
93
  platform: "github",
71
94
  label: "GitHub",
72
95
  // 1: the shadow run's first manifest (2026-11-14), node ids as today's classifier names them.
73
- version: 3,
96
+ version: 4,
74
97
  plans: ["free", "team", "enterprise"],
75
98
  identity: "member",
76
99
  services: [
@@ -1,4 +1,4 @@
1
- import { GH_COMMANDS, GH_READS, GITHUB_API_READS, GITHUB_MCP_READS } from "./githubReads.generated.js";
1
+ import { GH_COMMANDS, GH_READS, GH_REPO_WRITES, GITHUB_API_READS, GITHUB_MCP_READS } from "./githubReads.generated.js";
2
2
  /**
3
3
  * GitHub capture for the shadow run (2026-11-14): `gh` and `git push` command lines, GitHub's MCP tools and
4
4
  * REST calls, as today's classifier reads them. Where today's classifier names no action for a write that
@@ -122,6 +122,15 @@ const MCP_RULES = [
122
122
  /** Write methods on a route, each to the same rule. */
123
123
  const writes = (route, rule) => ["POST", "PUT", "PATCH", "DELETE"].map((method) => ({ match: `${method} ${route}`, ...rule }));
124
124
  const REPO = "/repos/{owner}/{repo}";
125
+ /** A repository write named since 2026-11-17: on the repository, no exact target. */
126
+ const repoApi = (match, action, what) => ({
127
+ match,
128
+ action,
129
+ on: "repo",
130
+ summary: `${what} in {owner}/{repo}`
131
+ });
132
+ const CLOSED = { body: ["state"], when: { state: "closed" } };
133
+ const OPENED = { body: ["state"], when: { state: "open" } };
125
134
  const API_RULES = [
126
135
  {
127
136
  match: `PUT ${REPO}/pulls/{number}/merge`,
@@ -232,16 +241,31 @@ const API_RULES = [
232
241
  },
233
242
  { match: `PATCH ${REPO}`, action: "read", because: NOT_GOVERNED },
234
243
  { match: "PATCH /orgs/{org}", action: "read", because: NOT_GOVERNED },
235
- // GraphQL: a mutation fails closed, a query reads (the hook reads the operation, never its values).
244
+ // GraphQL: a mutation is unclassified, a query reads (the hook reads the operation, never its values).
236
245
  { match: "POST /graphql", action: "github.unclassified", hook: "graphql" },
237
- ...[
238
- `POST ${REPO}/pulls`,
239
- `POST ${REPO}/issues`,
240
- `POST ${REPO}/issues/{number}/comments`,
241
- `POST ${REPO}/labels`,
242
- `POST ${REPO}/actions/runs/{run}/rerun`,
243
- `POST ${REPO}/releases/{release}/assets`
244
- ].map((match) => ({ match, action: "read", because: NOT_GOVERNED }))
246
+ // The repository writes named since 2026-11-17, on the repository with no exact target.
247
+ repoApi(`POST ${REPO}/actions/workflows/{workflow}/dispatches`, "github.workflow.run", "Run a workflow"),
248
+ repoApi(`POST ${REPO}/actions/runs/{run}/cancel`, "github.run.cancel", "Cancel a workflow run"),
249
+ repoApi(`POST ${REPO}/actions/runs/{run}/force-cancel`, "github.run.cancel", "Cancel a workflow run"),
250
+ repoApi(`POST ${REPO}/actions/runs/{run}/rerun`, "github.run.rerun", "Re-run a workflow"),
251
+ repoApi(`POST ${REPO}/actions/runs/{run}/rerun-failed-jobs`, "github.run.rerun", "Re-run a workflow"),
252
+ repoApi(`POST ${REPO}/actions/jobs/{job}/rerun`, "github.run.rerun", "Re-run a workflow"),
253
+ repoApi(`POST ${REPO}/pulls`, "github.pr.open", "Open a pull request"),
254
+ { ...repoApi(`PATCH ${REPO}/pulls/{number}`, "github.pr.state", "Close a pull request"), ...CLOSED },
255
+ { ...repoApi(`PATCH ${REPO}/pulls/{number}`, "github.pr.state", "Reopen a pull request"), ...OPENED },
256
+ repoApi(`PATCH ${REPO}/pulls/{number}`, "github.pr.edit", "Edit a pull request"),
257
+ repoApi(`POST ${REPO}/issues`, "github.issue.open", "Open an issue"),
258
+ repoApi(`POST ${REPO}/issues/{number}/comments`, "github.comment", "Comment"),
259
+ { ...repoApi(`PATCH ${REPO}/issues/{number}`, "github.issue.edit", "Close an issue"), ...CLOSED },
260
+ { ...repoApi(`PATCH ${REPO}/issues/{number}`, "github.issue.edit", "Reopen an issue"), ...OPENED },
261
+ repoApi(`PATCH ${REPO}/issues/{number}`, "github.issue.edit", "Edit an issue"),
262
+ repoApi(`POST ${REPO}/labels`, "github.label.manage", "Create a label"),
263
+ repoApi(`PATCH ${REPO}/labels/{name}`, "github.label.manage", "Edit a label"),
264
+ ...[`POST ${REPO}/releases/{release}/assets`].map((match) => ({
265
+ match,
266
+ action: "read",
267
+ because: NOT_GOVERNED
268
+ }))
245
269
  ];
246
270
  export const GITHUB_CAPTURE = {
247
271
  params: {
@@ -280,6 +304,13 @@ export const GITHUB_CAPTURE = {
280
304
  { match: "repo delete", action: "github.repo.delete", hook: "ghRepo" },
281
305
  { match: "repo edit", action: "github.repo.public", hook: "ghRepo" },
282
306
  { match: "secret set", action: "github.secret.change", hook: "ghRepo" },
307
+ // The repository writes named since 2026-11-17 (`GH_REPO_WRITES`).
308
+ ...Object.entries(GH_REPO_WRITES).map(([match, [action]]) => ({
309
+ match,
310
+ action,
311
+ hook: "ghRepo",
312
+ ...(match === "pr close" ? { also: [{ action: "github.branch.delete", on: "repo" }] } : {})
313
+ })),
283
314
  { match: "api", action: "github.unclassified", hook: "ghApi" },
284
315
  // Every ref a push moves (refspecs, force, delete, tags, the worst case for what it can't name).
285
316
  // `also` lists the other Actions the hook names (the engine never builds a hook rule's parts).
@@ -2,6 +2,7 @@
2
2
  import { nodeId } from "../../controlPlane.generated.js";
3
3
  import { matchBranch, MAX_BRANCH_MATCH_LENGTH } from "../../controlPlaneGithubCatalog.generated.js";
4
4
  import { classify, render } from "../engine.generated.js";
5
+ import { GH_REPO_WRITES } from "./githubReads.generated.js";
5
6
  const lower = (value) => value.toLowerCase();
6
7
  const text = (value) => (typeof value === "string" && value !== "" ? value : null);
7
8
  const words = (value) => value === undefined || typeof value === "boolean" ? [] : Array.isArray(value) ? value : [value];
@@ -31,6 +32,8 @@ const SUMMARY = {
31
32
  secret: "Change secret {name}",
32
33
  secrets: "Change secrets",
33
34
  tag: "Push tag {tag}",
35
+ repoWrite: "{what} in {repo}",
36
+ closeAndDelete: "Close a pull request and delete its branch in {repo}",
34
37
  allBranches: "Push to all branches ({why})",
35
38
  branchesDeleted: "Delete branches ({why})"
36
39
  };
@@ -193,9 +196,26 @@ function ghRepo(n, _p, context) {
193
196
  case "secret set":
194
197
  return secretSet(n, argument ?? null, repoFlag);
195
198
  default:
196
- return "unclassified";
199
+ return repoWrite(n, argument, repoFlag);
197
200
  }
198
201
  }
202
+ /** A pull request's or issue's URL names its own repository. */
203
+ const ITEM_URL = /^https?:\/\/[^/]+\/([^/]+)\/([^/]+)\/(?:pull|issues)\/\d+/;
204
+ function repoWrite(n, argument, repoFlag) {
205
+ const write = Object.prototype.hasOwnProperty.call(GH_REPO_WRITES, n.op) ? GH_REPO_WRITES[n.op] : undefined;
206
+ if (!write)
207
+ return "unclassified";
208
+ const url = argument?.match(ITEM_URL);
209
+ const r = url ? { owner: url[1], repo: url[2] } : repoFlag;
210
+ if (!r)
211
+ return "read";
212
+ const repo = slug(r.owner, r.repo);
213
+ // Closing with --delete-branch also deletes the head branch, not named on the line: the worse of the two.
214
+ if (n.op === "pr close" && present(n.params["delete-branch"])) {
215
+ return [onRepo(r.owner, r.repo, "github.branch.delete", render(SUMMARY.closeAndDelete, { repo }))];
216
+ }
217
+ return [onRepo(r.owner, r.repo, write[0], render(SUMMARY.repoWrite, { what: write[1], repo }))];
218
+ }
199
219
  function secretSet(n, name, repoFlag) {
200
220
  const org = text(n.params.org);
201
221
  if (present(n.params.user))
@@ -1,5 +1,7 @@
1
1
  import type { FlagSpec, ReadEvidence } from "../manifest.generated.js";
2
2
  export declare const GH_COMMANDS: Record<string, readonly FlagSpec[]>;
3
+ /** The repository writes named since 2026-11-17, as today's classifier names them (`REPO_WRITES`). */
4
+ export declare const GH_REPO_WRITES: Readonly<Record<string, readonly [string, string]>>;
3
5
  export declare const GH_READS: Readonly<Record<string, ReadEvidence>>;
4
6
  export declare const GITHUB_MCP_READS: Readonly<Record<string, ReadEvidence>>;
5
7
  /** GETs a request names (any other route fails closed through the API; `gh api` reads every GET). */
@@ -33,12 +33,41 @@ const GH = {
33
33
  "repo view": `${JSON_OUT}-b/branch= -w/web`,
34
34
  "release list": `${REPO}${JSON_OUT}exclude-drafts exclude-pre-releases -L/limit= -O/order=`,
35
35
  "release view": `${REPO}${JSON_OUT}-w/web`,
36
+ "workflow run": `${REPO}-F/field=+ -f/raw-field=+ json -r/ref=`,
37
+ "run cancel": `${REPO}`,
38
+ "pr edit": `${REPO}add-assignee=+ add-label=+ add-project=+ add-reviewer=+ -B/base= -b/body= -F/body-file= -m/milestone= remove-assignee=+ remove-label=+ remove-milestone remove-project=+ remove-reviewer=+ -t/title=`,
39
+ "pr comment": `${REPO}-b/body= -F/body-file= create-if-none delete-last edit-last -e/editor -w/web yes`,
40
+ "pr close": `${REPO}-c/comment= -d/delete-branch`,
41
+ "pr reopen": `${REPO}-c/comment=`,
42
+ "issue edit": `${REPO}add-assignee=+ add-label=+ add-project=+ -b/body= -F/body-file= -m/milestone= remove-assignee=+ remove-label=+ remove-milestone remove-project=+ -t/title=`,
43
+ "issue comment": `${REPO}-b/body= -F/body-file= create-if-none delete-last edit-last -e/editor -w/web yes`,
44
+ "issue close": `${REPO}-c/comment= duplicate-of= -r/reason=`,
45
+ "issue reopen": `${REPO}-c/comment=`,
46
+ "label edit": `${REPO}-c/color= -d/description= -n/name=`,
36
47
  "label create": `${REPO}-c/color= -d/description= -f/force`,
37
48
  "ruleset list": `${REPO}-L/limit= -o/org= -p/parents -w/web`,
38
49
  "workflow list": `${REPO}${JSON_OUT}-a/all -L/limit=`,
39
50
  "auth status": "-a/active -h/hostname= -t/show-token"
40
51
  };
41
52
  export const GH_COMMANDS = Object.fromEntries(Object.entries(GH).map(([command, spec]) => [command, parse(spec)]));
53
+ /** The repository writes named since 2026-11-17, as today's classifier names them (`REPO_WRITES`). */
54
+ export const GH_REPO_WRITES = {
55
+ "workflow run": ["github.workflow.run", "Run a workflow"],
56
+ "run cancel": ["github.run.cancel", "Cancel a workflow run"],
57
+ "run rerun": ["github.run.rerun", "Re-run a workflow"],
58
+ "pr create": ["github.pr.open", "Open a pull request"],
59
+ "pr edit": ["github.pr.edit", "Edit a pull request"],
60
+ "pr comment": ["github.comment", "Comment"],
61
+ "pr close": ["github.pr.state", "Close a pull request"],
62
+ "pr reopen": ["github.pr.state", "Reopen a pull request"],
63
+ "issue create": ["github.issue.open", "Open an issue"],
64
+ "issue edit": ["github.issue.edit", "Edit an issue"],
65
+ "issue comment": ["github.comment", "Comment"],
66
+ "issue close": ["github.issue.edit", "Close an issue"],
67
+ "issue reopen": ["github.issue.edit", "Reopen an issue"],
68
+ "label create": ["github.label.manage", "Create a label"],
69
+ "label edit": ["github.label.manage", "Edit a label"]
70
+ };
42
71
  const LOOKS = "Shows or lists; changes nothing on GitHub";
43
72
  export const GH_READS = {
44
73
  "pr view": LOOKS,
@@ -57,11 +86,7 @@ export const GH_READS = {
57
86
  "release view": LOOKS,
58
87
  "ruleset list": LOOKS,
59
88
  "workflow list": LOOKS,
60
- "auth status": "Shows the signed-in account on this computer",
61
- "pr create": NOT_GOVERNED,
62
- "issue create": NOT_GOVERNED,
63
- "run rerun": NOT_GOVERNED,
64
- "label create": NOT_GOVERNED
89
+ "auth status": "Shows the signed-in account on this computer"
65
90
  };
66
91
  /** GitHub's MCP server (github/github-mcp-server): its read-only tools, and the writes not governed in v1. */
67
92
  const MCP_HINT = [
@@ -70,8 +70,8 @@ const ACTIONS = [
70
70
  ["railway.volume.backups", "change", "volume", "Change backups", "Archive"],
71
71
  ["railway.bucket.delete", "change", "bucket", "Delete bucket", "Trash2"],
72
72
  ["railway.bucket.credentials", "change", "bucket", "Reset credentials", "Key"],
73
- // Anything the manifest can't name fails closed; in the server catalog since E3 (2026-11-16).
74
- ["railway.unclassified", "delete", "project", "Unclassified action", "CircleHelp"]
73
+ // Anything the manifest can't name: its own kind, Unclassified (2026-11-17), never assumed to be a Delete.
74
+ ["railway.unclassified", "unclassified", "project", "Unclassified action", "CircleHelp"]
75
75
  ];
76
76
  export const RAILWAY_ACTIONS = ACTIONS.map(([key, kind, appliesTo, label, icon]) => ({
77
77
  key,
@@ -85,7 +85,7 @@ export const RAILWAY = {
85
85
  platform: "railway",
86
86
  label: "Railway",
87
87
  // 1: the shadow run's first manifest (2026-11-14), node ids as today's classifier names them.
88
- version: 2,
88
+ version: 3,
89
89
  plans: ["hobby", "pro", "enterprise"],
90
90
  identity: "member",
91
91
  services: [
@@ -15,7 +15,7 @@ export const SUPABASE = {
15
15
  // 2: schema 2 (fail closed, Unclassified, reads with evidence). 3: SQL code, policy and drop-object
16
16
  // Actions after the round 2 review. 4: the 9 governed actions (2026-11-13); declared inputs. Node ids
17
17
  // unchanged.
18
- version: 5,
18
+ version: 6,
19
19
  plans: ["free", "pro", "team", "enterprise"],
20
20
  identity: "member",
21
21
  services: [