passport-bridge 0.44.0 → 0.46.0

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 (73) 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/cliGuardHealth.js +2 -1
  9. package/dist/cliHook.js +5 -1
  10. package/dist/cliHookAfter.js +2 -2
  11. package/dist/cliHookNotices.d.ts +7 -0
  12. package/dist/cliHookNotices.js +14 -0
  13. package/dist/cliMain.js +33 -3
  14. package/dist/cliOutput.js +4 -6
  15. package/dist/cliRequest.d.ts +65 -0
  16. package/dist/cliRequest.js +135 -0
  17. package/dist/cliScan.js +1 -1
  18. package/dist/cliSession.d.ts +0 -1
  19. package/dist/cliSession.js +0 -2
  20. package/dist/cliStatus.d.ts +4 -2
  21. package/dist/cliStatus.js +21 -4
  22. package/dist/cliSupport.d.ts +0 -8
  23. package/dist/completion.js +1 -0
  24. package/dist/connectorKit/engine.generated.d.ts +2 -2
  25. package/dist/connectorKit/engine.generated.js +23 -3
  26. package/dist/connectorKit/manifest.generated.d.ts +1 -1
  27. package/dist/connectorKit/manifests/github.generated.js +26 -3
  28. package/dist/connectorKit/manifests/githubCapture.generated.js +41 -10
  29. package/dist/connectorKit/manifests/githubHooks.generated.js +21 -1
  30. package/dist/connectorKit/manifests/githubReads.generated.d.ts +2 -0
  31. package/dist/connectorKit/manifests/githubReads.generated.js +30 -5
  32. package/dist/connectorKit/manifests/railway.generated.js +3 -3
  33. package/dist/connectorKit/manifests/supabase.generated.js +1 -1
  34. package/dist/connectorKit/manifests/supabaseApi.generated.js +1 -1
  35. package/dist/connectorKit/manifests/supabaseCapture.generated.js +1 -1
  36. package/dist/connectorKit/manifests/supabaseCatalog.generated.d.ts +1 -1
  37. package/dist/connectorKit/manifests/supabaseCatalog.generated.js +4 -4
  38. package/dist/controlPlane.generated.d.ts +18 -17
  39. package/dist/controlPlane.generated.js +15 -21
  40. package/dist/controlPlaneBasic.generated.d.ts +5 -5
  41. package/dist/controlPlaneBasic.generated.js +5 -5
  42. package/dist/controlPlaneGithub.generated.d.ts +2 -2
  43. package/dist/controlPlaneGithub.generated.js +12 -2
  44. package/dist/controlPlaneGithubApi.generated.d.ts +2 -0
  45. package/dist/controlPlaneGithubApi.generated.js +56 -1
  46. package/dist/controlPlaneGithubCatalog.generated.d.ts +9 -3
  47. package/dist/controlPlaneGithubCatalog.generated.js +19 -13
  48. package/dist/controlPlaneGithubCli.generated.d.ts +2 -0
  49. package/dist/controlPlaneGithubCli.generated.js +65 -12
  50. package/dist/controlPlaneGuard.js +2 -0
  51. package/dist/controlPlanePeople.generated.d.ts +117 -0
  52. package/dist/controlPlanePeople.generated.js +6 -0
  53. package/dist/controlPlaneSupabase.js +3 -1
  54. package/dist/controlPlaneUnnamed.generated.d.ts +58 -0
  55. package/dist/controlPlaneUnnamed.generated.js +225 -0
  56. package/dist/cpCli.js +5 -1
  57. package/dist/initAppsStep.d.ts +1 -1
  58. package/dist/initAppsStep.js +7 -5
  59. package/dist/initOutro.js +13 -10
  60. package/dist/initState.d.ts +3 -2
  61. package/dist/initState.js +7 -18
  62. package/dist/localNotices.d.ts +22 -0
  63. package/dist/localNotices.js +100 -0
  64. package/dist/pluginPin.d.ts +1 -1
  65. package/dist/pluginPin.js +1 -1
  66. package/dist/version.d.ts +1 -1
  67. package/dist/version.js +1 -1
  68. package/dist/webLinks.d.ts +23 -6
  69. package/dist/webLinks.js +21 -22
  70. package/npm-shrinkwrap.json +8 -8
  71. package/package.json +1 -1
  72. package/dist/cliApprovalLink.d.ts +0 -5
  73. package/dist/cliApprovalLink.js +0 -21
@@ -1,13 +1,14 @@
1
1
  /**
2
- * The control plane's shared contract (docs/design/control-plane.md). Types
3
- * and a few pure helpers only, imported by the server, the web app and the
4
- * bridge. Every track builds against this file; change it only through the
5
- * spec's owner (the orchestrating session), never from a track. Account-scoped
6
- * ids, exact matching and Managed coverage (decided 2026-11-13) live beside it
7
- * in `controlPlaneModel.ts`.
2
+ * The control plane's shared contract (docs/design/control-plane.md). Types and a few pure helpers only, imported by
3
+ * the server, the web app and the bridge. Every track builds against this file; change it only through the spec's
4
+ * owner (the orchestrating session), never from a track. Account-scoped ids, exact matching and Managed coverage
5
+ * (decided 2026-11-13) live beside it in `controlPlaneModel.ts`; what an unnamed action hit in `controlPlaneUnnamed.ts`.
8
6
  */
9
- /** The kinds (2026-11-16). A read is decided only when a Block could cover it (server `readGate.ts`). */
10
- export declare const KINDS: readonly ["delete", "change", "create", "read"];
7
+ import type { CpAgentV21, CpPersonV21 } from "./controlPlanePeople.generated.js";
8
+ import type { UnnamedHit } from "./controlPlaneUnnamed.generated.js";
9
+ export type * from "./controlPlanePeople.generated.js";
10
+ /** The kinds (2026-11-16; Unclassified 2026-11-17). A read is decided only when a Block could cover it (`readGate.ts`). */
11
+ export declare const KINDS: readonly ["delete", "change", "create", "read", "unclassified"];
11
12
  export type Kind = (typeof KINDS)[number];
12
13
  export declare const KIND_LABEL: Readonly<Record<Kind, string>>;
13
14
  export declare const KIND_MEANING: Readonly<Record<Kind, string>>;
@@ -77,7 +78,7 @@ export type ActionDef = {
77
78
  exactTarget?: string;
78
79
  /** A lucide-react icon name matching the platform's own iconography ("Trash2"). */
79
80
  icon?: string;
80
- /** Can't be undone (`cli.local.*`): only action rules decide it (`resolveRule`), Observe refuses it. */
81
+ /** Can't be undone (`cli.local.*`): a label for the UI; rules decide it like any action (2026-11-16). */
81
82
  irreversible?: true;
82
83
  /** The platform sources that report it, and whether they name who did it (visibility levels). */
83
84
  seenBy?: ReadonlyArray<{
@@ -156,6 +157,7 @@ export type Classification = {
156
157
  nodes?: DiscoveredNode[];
157
158
  /** What it touched beneath the node, when that isn't a node of its own (section 6). */
158
159
  target?: ActionTarget;
160
+ unnamed?: UnnamedHit;
159
161
  };
160
162
  /** The one a bundle's event records when nothing in it is blocked: the most severe, first on ties. */
161
163
  export declare function mostSevere<T extends {
@@ -229,7 +231,7 @@ export type Resolution = {
229
231
  /**
230
232
  * The one resolution order, used by every enforcement point and every view: walk from the node up to its platform; at
231
233
  * each level an action rule beats a kind rule; the nearest level wins; then workspace action rule, workspace kind
232
- * rule, then the default (Allow). A kind Allow never decides an irreversible action; a kind Block does. Pure.
234
+ * rule, then the default (Allow). An irreversible action follows the same order ("truly allow all", 2026-11-16). Pure.
233
235
  */
234
236
  export declare function resolveRule(path: readonly string[], action: Pick<ActionDef, "key" | "kind" | "irreversible">, rules: readonly ControlRule[]): Resolution;
235
237
  /**
@@ -324,6 +326,7 @@ export type ActionEvent = {
324
326
  dbRole?: string;
325
327
  /** Unmanaged events: the credential that made it, worked out when read; never stored. */
326
328
  credentialRef?: CpCredentialRef;
329
+ unnamed?: UnnamedHit;
327
330
  };
328
331
  export declare const OUTSIDE_CREDENTIAL_KINDS: readonly ["personal_token", "deploy_key", "actions_secret", "railway_token", "service_role_key", "database_password"];
329
332
  export type OutsideCredentialKind = (typeof OUTSIDE_CREDENTIAL_KINDS)[number];
@@ -458,6 +461,7 @@ export type CpPlatformRow = {
458
461
  setUp: boolean;
459
462
  }>;
460
463
  gatewayCalls7d?: number;
464
+ blocked7d?: number;
461
465
  };
462
466
  export type CpNodeView = {
463
467
  node: ResourceNode;
@@ -528,8 +532,8 @@ export type CpTreeResponse = {
528
532
  export type CpRuleSetRow = {
529
533
  rule: ControlRule;
530
534
  path: CpPathEntry[];
531
- /** Observe mode, Block rules only: actions this rule would have blocked in the last 7 days. Absent once enforcing. */
532
535
  wouldBlock?: number;
536
+ hits7d?: number;
533
537
  };
534
538
  /** GET /api/cp/blocked: a pending block, its event and the event's node path (platform first). With
535
539
  * `?decided=today` (or `?decided=since&since=<ms>`): blocks decided since then, newest decision first, each with
@@ -555,8 +559,7 @@ export type CpAgentRow = {
555
559
  consequential7d: number;
556
560
  /** Of those, how many a rule blocked. */
557
561
  blocked7d: number;
558
- guard: "on" | "off" | "unknown";
559
- /** Set only on the one row counting outside identities. */
562
+ guard: "on" | "off" | "outdated" | "na" | "unknown";
560
563
  unknown?: true;
561
564
  /** Passport credentials issued to it that are still live (not revoked, not expired). Every server from v19 sets it. */
562
565
  liveCredentials?: number;
@@ -565,7 +568,7 @@ export type CpAgentRow = {
565
568
  by: string;
566
569
  at: number;
567
570
  };
568
- };
571
+ } & CpAgentV21;
569
572
  /** One member. Never carries an email. */
570
573
  export type CpPersonRow = {
571
574
  id: string;
@@ -575,11 +578,10 @@ export type CpPersonRow = {
575
578
  consequential7d: number;
576
579
  /** Outside events attributed to this person's login in the last 7 days. */
577
580
  outside7d: number;
578
- /** v19: their team when recorded; platforms acted on in 7 days; outside credentials of theirs seen in 30 days. */
579
581
  team?: string;
580
582
  platforms?: PlatformKey[];
581
583
  keys?: number;
582
- };
584
+ } & CpPersonV21;
583
585
  /** One line of fact on the Coverage tab, computed from real data. */
584
586
  export type CpCoverageFact = {
585
587
  /** The card it belongs to. */
@@ -596,4 +598,3 @@ export type CpCoverageView = {
596
598
  /** A fact Passport does not record is left out, never made up. */
597
599
  facts: CpCoverageFact[];
598
600
  };
599
- export {};
@@ -1,31 +1,31 @@
1
1
  // Generated by scripts/generate-control-plane-classifier.mjs. Do not edit.
2
2
  /**
3
- * The control plane's shared contract (docs/design/control-plane.md). Types
4
- * and a few pure helpers only, imported by the server, the web app and the
5
- * bridge. Every track builds against this file; change it only through the
6
- * spec's owner (the orchestrating session), never from a track. Account-scoped
7
- * ids, exact matching and Managed coverage (decided 2026-11-13) live beside it
8
- * in `controlPlaneModel.ts`.
3
+ * The control plane's shared contract (docs/design/control-plane.md). Types and a few pure helpers only, imported by
4
+ * the server, the web app and the bridge. Every track builds against this file; change it only through the spec's
5
+ * owner (the orchestrating session), never from a track. Account-scoped ids, exact matching and Managed coverage
6
+ * (decided 2026-11-13) live beside it in `controlPlaneModel.ts`; what an unnamed action hit in `controlPlaneUnnamed.ts`.
9
7
  */
10
8
  /* ------------------------------------------------------------------ */
11
9
  /* Kinds: what an action does, the same on every platform */
12
10
  /* ------------------------------------------------------------------ */
13
- /** The kinds (2026-11-16). A read is decided only when a Block could cover it (server `readGate.ts`). */
14
- export const KINDS = ["delete", "change", "create", "read"];
11
+ /** The kinds (2026-11-16; Unclassified 2026-11-17). A read is decided only when a Block could cover it (`readGate.ts`). */
12
+ export const KINDS = ["delete", "change", "create", "read", "unclassified"];
15
13
  export const KIND_LABEL = {
16
14
  delete: "Delete",
17
15
  change: "Change",
18
16
  create: "Create",
19
- read: "Read"
17
+ read: "Read",
18
+ unclassified: "Unclassified"
20
19
  };
21
20
  export const KIND_MEANING = {
22
21
  delete: "Removes or overwrites something, or turns off a protection",
23
22
  change: "Changes code, config, data or access",
24
23
  create: "Adds something new, such as a member, key or release",
25
- read: "Looks at something without changing it"
24
+ read: "Looks at something without changing it",
25
+ unclassified: "An action Passport can't name yet"
26
26
  };
27
27
  /** Most severe first: how a bundle of actions picks the one its event records (spec Part 2, section 4). */
28
- export const KIND_SEVERITY = ["delete", "change", "create", "read"];
28
+ export const KIND_SEVERITY = ["delete", "change", "create", "unclassified", "read"];
29
29
  /** A node id from its parts (see ResourceNode). */
30
30
  export function nodeId(platform, service, type, externalKey) {
31
31
  if (!service)
@@ -65,16 +65,11 @@ export function mostSevere(found, kindOf) {
65
65
  return [...found].sort((a, b) => rank(a) - rank(b))[0];
66
66
  }
67
67
  /** No rule, no block (2026-11-16): every kind is allowed until an admin adds a Block. */
68
- export const DEFAULT_KIND_DECISION = {
69
- delete: "allow",
70
- change: "allow",
71
- create: "allow",
72
- read: "allow"
73
- };
68
+ export const DEFAULT_KIND_DECISION = Object.fromEntries(KINDS.map((kind) => [kind, "allow"]));
74
69
  /**
75
70
  * The one resolution order, used by every enforcement point and every view: walk from the node up to its platform; at
76
71
  * each level an action rule beats a kind rule; the nearest level wins; then workspace action rule, workspace kind
77
- * rule, then the default (Allow). A kind Allow never decides an irreversible action; a kind Block does. Pure.
72
+ * rule, then the default (Allow). An irreversible action follows the same order ("truly allow all", 2026-11-16). Pure.
78
73
  */
79
74
  export function resolveRule(path /* node id first, platform last */, action, rules) {
80
75
  const at = (target, key) => rules.find((rule) => ("workspace" in rule.target
@@ -83,19 +78,18 @@ export function resolveRule(path /* node id first, platform last */, action, rul
83
78
  ("action" in rule.key
84
79
  ? "action" in key && rule.key.action === key.action
85
80
  : "kind" in key && rule.key.kind === key.kind));
86
- const kindCounts = (rule) => (action.irreversible && rule?.decision !== "block" ? undefined : rule);
87
81
  for (const id of path) {
88
82
  const byAction = at({ nodeId: id }, { action: action.key });
89
83
  if (byAction)
90
84
  return { decision: byAction.decision, ruleId: byAction.id, at: id, by: "action" };
91
- const byKind = kindCounts(at({ nodeId: id }, { kind: action.kind }));
85
+ const byKind = at({ nodeId: id }, { kind: action.kind });
92
86
  if (byKind)
93
87
  return { decision: byKind.decision, ruleId: byKind.id, at: id, by: "kind" };
94
88
  }
95
89
  const wsAction = at({ workspace: true }, { action: action.key });
96
90
  if (wsAction)
97
91
  return { decision: wsAction.decision, ruleId: wsAction.id, at: "workspace", by: "action" };
98
- const wsKind = kindCounts(at({ workspace: true }, { kind: action.kind }));
92
+ const wsKind = at({ workspace: true }, { kind: action.kind });
99
93
  if (wsKind)
100
94
  return { decision: wsKind.decision, ruleId: wsKind.id, at: "workspace", by: "kind" };
101
95
  return { decision: DEFAULT_KIND_DECISION[action.kind], ruleId: null, at: "default", by: "kind" };
@@ -13,12 +13,12 @@ import type { ActionDef, BasicPlatform } from "./controlPlane.generated.js";
13
13
  * Kinds come only from what Passport already reads about a tool (`server/src/riskClass.ts`): a read is not
14
14
  * consequential, a destructive tool is Delete, a write named for making something (`create_customer`,
15
15
  * `issues.create`, `domains add`) is Create, any other write is Change. Rules work as everywhere else
16
- * (`resolveRule`): a tool rule, then a kind rule on the platform, then the workspace, then the shipped default.
16
+ * (`resolveRule`): a tool rule, then a kind rule on the platform, then the workspace, then the default (Allow).
17
17
  *
18
- * This computer (`cli:local`) is the one exception: commands that can't be undone on the computer an agent runs on
19
- * (deleting the home folder, the disk, system files or the project folder; recursive permission changes there), one
20
- * action per class (`LOCAL_IRREVERSIBLE_VERBS`), kind Delete, `irreversible`: only an Allow on that action unlocks
21
- * one, kind rules never do, Observe mode refuses it too, and a block offers Always allow.
18
+ * This computer (`cli:local`): commands that can't be undone on the computer an agent runs on (deleting the home
19
+ * folder, the disk, system files or the project folder; recursive permission changes there), one action per class
20
+ * (`LOCAL_IRREVERSIBLE_VERBS`), kind Delete, labelled `irreversible`. Since 2026-11-16 ("truly allow all") they follow
21
+ * the same rules as every action: allowed with no rule, blocked by a Delete Block or an action Block.
22
22
  */
23
23
  export declare const BASIC_KINDS: readonly ["delete", "change", "create", "read"];
24
24
  export type BasicKind = (typeof BASIC_KINDS)[number];
@@ -12,12 +12,12 @@
12
12
  * Kinds come only from what Passport already reads about a tool (`server/src/riskClass.ts`): a read is not
13
13
  * consequential, a destructive tool is Delete, a write named for making something (`create_customer`,
14
14
  * `issues.create`, `domains add`) is Create, any other write is Change. Rules work as everywhere else
15
- * (`resolveRule`): a tool rule, then a kind rule on the platform, then the workspace, then the shipped default.
15
+ * (`resolveRule`): a tool rule, then a kind rule on the platform, then the workspace, then the default (Allow).
16
16
  *
17
- * This computer (`cli:local`) is the one exception: commands that can't be undone on the computer an agent runs on
18
- * (deleting the home folder, the disk, system files or the project folder; recursive permission changes there), one
19
- * action per class (`LOCAL_IRREVERSIBLE_VERBS`), kind Delete, `irreversible`: only an Allow on that action unlocks
20
- * one, kind rules never do, Observe mode refuses it too, and a block offers Always allow.
17
+ * This computer (`cli:local`): commands that can't be undone on the computer an agent runs on (deleting the home
18
+ * folder, the disk, system files or the project folder; recursive permission changes there), one action per class
19
+ * (`LOCAL_IRREVERSIBLE_VERBS`), kind Delete, labelled `irreversible`. Since 2026-11-16 ("truly allow all") they follow
20
+ * the same rules as every action: allowed with no rule, blocked by a Delete Block or an action Block.
21
21
  */
22
22
  export const BASIC_KINDS = ["delete", "change", "create", "read"];
23
23
  /** App keys and CLI vendors are slugs: letters, digits, "-" and "_" (never "." or ":"). */
@@ -39,7 +39,7 @@ export declare function classifyGithub(request: GithubRequest, context: GithubCo
39
39
  /** GitHub's own icons (Octicons) for every resource type and catalog action: the
40
40
  * names are Octicon names, and the web app maps each to its SVG. Platform and
41
41
  * service rows keep their own logos and icons. */
42
- export type GithubIcon = "repo" | "git-branch" | "git-merge" | "tag" | "archive" | "person-add" | "key" | "eye" | "arrow-switch" | "trash" | "repo-push" | "shield" | "person" | "shield-x" | "apps" | "people" | "organization" | "lock" | "server";
42
+ export type GithubIcon = "repo" | "git-branch" | "git-merge" | "tag" | "archive" | "person-add" | "key" | "eye" | "arrow-switch" | "trash" | "repo-push" | "shield" | "person" | "shield-x" | "apps" | "people" | "organization" | "lock" | "server" | "question" | "play" | "x-circle" | "sync" | "git-pull-request" | "git-pull-request-closed" | "comment" | "issue-opened" | "issue-closed";
43
43
  export declare const GITHUB_TYPE_ICON: Readonly<Record<string, GithubIcon>>;
44
- /** Every delete is the trash can; the rest name what the action does. */
44
+ /** Every delete is the trash can; the rest name what the action does (Unclassified: a question mark). */
45
45
  export declare const GITHUB_ACTION_ICON: Readonly<Record<string, GithubIcon>>;
@@ -65,7 +65,7 @@ export const GITHUB_TYPE_ICON = {
65
65
  secrets: "lock",
66
66
  runners: "server"
67
67
  };
68
- /** Every delete is the trash can; the rest name what the action does. */
68
+ /** Every delete is the trash can; the rest name what the action does (Unclassified: a question mark). */
69
69
  export const GITHUB_ACTION_ICON = {
70
70
  "github.repo.merge": "git-merge",
71
71
  "github.repo.release": "tag",
@@ -77,7 +77,17 @@ export const GITHUB_ACTION_ICON = {
77
77
  "github.repo.delete": "trash",
78
78
  "github.repo.workflow": "server",
79
79
  "github.repo.change": "repo",
80
- "github.unclassified": "trash",
80
+ "github.unclassified": "question",
81
+ "github.workflow.run": "play",
82
+ "github.run.cancel": "x-circle",
83
+ "github.run.rerun": "sync",
84
+ "github.pr.open": "git-pull-request",
85
+ "github.pr.edit": "git-pull-request",
86
+ "github.pr.state": "git-pull-request-closed",
87
+ "github.comment": "comment",
88
+ "github.issue.open": "issue-opened",
89
+ "github.issue.edit": "issue-closed",
90
+ "github.label.manage": "tag",
81
91
  "github.branch.push": "repo-push",
82
92
  "github.branch.force": "trash",
83
93
  "github.branch.delete": "trash",
@@ -11,5 +11,7 @@ export declare const OPAQUE_BODY: Bag;
11
11
  export declare function refUpdate(method: string, r: Repo, branch: string, body: Bag, context: GithubContext): GithubClassification | null;
12
12
  /** `repos/{o}/{r}/...`: `rest` is what follows the repository. */
13
13
  export declare function classifyRepoApi(method: string, r: Repo, rest: string[], body: Bag, context: GithubContext): GithubClassification | null;
14
+ /** The repository writes named since 2026-11-17: workflows and runs, pull requests, issues, comments, labels. */
15
+ export declare function repoWriteApi(method: string, r: Repo, rest: string[], body: Bag): GithubClassification | null;
14
16
  export declare function classifyOrgApi(method: string, org: string, rest: string[], body: Bag): GithubClassification | null;
15
17
  export declare function classifyApi(method: string, path: string, body: Bag | undefined, context: GithubContext): GithubClassification | null;
@@ -1,6 +1,6 @@
1
1
  // Generated by scripts/generate-control-plane-classifier.mjs. Do not edit.
2
2
  /** GitHub classifier: MCP tool calls and REST requests. Part of controlPlaneGithub.ts. */
3
- import { changeSecret, collaborator, deleteRepo, firstNumber, firstText, invite, isFalse, isTrue, lower, makePublic, merge, numberOf, onBranch, orgProtection, protection, release, text } from "./controlPlaneGithubCatalog.generated.js";
3
+ import { changeSecret, collaborator, deleteRepo, firstNumber, firstText, invite, isFalse, isTrue, lower, makePublic, merge, numberOf, onBranch, orgProtection, protection, release, repoWrite, text } from "./controlPlaneGithubCatalog.generated.js";
4
4
  /* ------------------------------------------------------------------ */
5
5
  /* MCP */
6
6
  /* ------------------------------------------------------------------ */
@@ -91,8 +91,63 @@ export function classifyRepoApi(method, r, rest, body, context) {
91
91
  if (first === "actions" && second === "secrets" && rest.length === 3 && method === "PUT") {
92
92
  return changeSecret(third, r.owner, r.repo);
93
93
  }
94
+ return repoWriteApi(method, r, rest, body);
95
+ }
96
+ const RERUN = new Set(["rerun", "rerun-failed-jobs"]);
97
+ /** The repository writes named since 2026-11-17: workflows and runs, pull requests, issues, comments, labels. */
98
+ export function repoWriteApi(method, r, rest, body) {
99
+ const [first] = rest;
100
+ if (method === "POST" && first === "actions")
101
+ return actionsWrite(r, rest);
102
+ if (first === "pulls")
103
+ return pullsWrite(method, r, rest, body);
104
+ if (first === "issues")
105
+ return issuesWrite(method, r, rest, body);
106
+ if (first === "labels" && method === "POST" && rest.length === 1) {
107
+ return repoWrite(r, "github.label.manage", "Create a label");
108
+ }
109
+ if (first === "labels" && method === "PATCH" && rest.length === 2) {
110
+ return repoWrite(r, "github.label.manage", "Edit a label");
111
+ }
112
+ return null;
113
+ }
114
+ /** `POST actions/…`: a workflow dispatched, a run cancelled or re-run. */
115
+ function actionsWrite(r, rest) {
116
+ const [, second, , fourth] = rest;
117
+ if (rest.length !== 4)
118
+ return null;
119
+ if (second === "workflows" && fourth === "dispatches")
120
+ return repoWrite(r, "github.workflow.run", "Run a workflow");
121
+ if (second === "runs" && (fourth === "cancel" || fourth === "force-cancel")) {
122
+ return repoWrite(r, "github.run.cancel", "Cancel a workflow run");
123
+ }
124
+ if ((second === "runs" || second === "jobs") && RERUN.has(fourth)) {
125
+ return repoWrite(r, "github.run.rerun", "Re-run a workflow");
126
+ }
94
127
  return null;
95
128
  }
129
+ /** A PATCH's `state`: closed or reopened, else an edit. */
130
+ const stateWord = (body) => (body.state === "closed" ? "Close" : body.state === "open" ? "Reopen" : null);
131
+ function pullsWrite(method, r, rest, body) {
132
+ if (method === "POST" && rest.length === 1)
133
+ return repoWrite(r, "github.pr.open", "Open a pull request");
134
+ if (method !== "PATCH" || rest.length !== 2)
135
+ return null;
136
+ const state = stateWord(body);
137
+ return state
138
+ ? repoWrite(r, "github.pr.state", `${state} a pull request`)
139
+ : repoWrite(r, "github.pr.edit", "Edit a pull request");
140
+ }
141
+ function issuesWrite(method, r, rest, body) {
142
+ const [, second, third] = rest;
143
+ if (method === "POST" && rest.length === 1)
144
+ return repoWrite(r, "github.issue.open", "Open an issue");
145
+ if (method === "POST" && rest.length === 3 && third === "comments")
146
+ return repoWrite(r, "github.comment", "Comment");
147
+ if (method !== "PATCH" || rest.length !== 2 || second === "comments")
148
+ return null;
149
+ return repoWrite(r, "github.issue.edit", `${stateWord(body) ?? "Edit"} an issue`);
150
+ }
96
151
  export function classifyOrgApi(method, org, rest, body) {
97
152
  const [first, second, third] = rest;
98
153
  if (first === "invitations" && rest.length === 1 && method === "POST") {
@@ -1,4 +1,5 @@
1
1
  /** The GitHub classifier's node ids, builders (the only places summaries are written) and small readers. Part of controlPlaneGithub.ts. */
2
+ import type { UnnamedHit } from "./controlPlaneUnnamed.generated.js";
2
3
  export declare const lower: (value: string) => string;
3
4
  export declare const githubNodeIds: {
4
5
  platform: string;
@@ -58,6 +59,8 @@ export type GithubClassification = {
58
59
  summary: string;
59
60
  /** The exact target beyond the node and action (stored only as a keyed hash); absent when the node is all of it. */
60
61
  target?: string;
62
+ /** On `github.unclassified`: the endpoint or command it hit, coarse (`controlPlaneUnnamed.ts`). */
63
+ unnamed?: UnnamedHit;
61
64
  };
62
65
  export type GithubRepo = {
63
66
  owner: string;
@@ -76,9 +79,12 @@ export declare function githubTarget(fields: TargetFields, primary: string): str
76
79
  export declare const withTarget: (found: GithubClassification, target: string | undefined) => GithubClassification;
77
80
  export declare function withoutTarget(found: GithubClassification): GithubClassification;
78
81
  export declare const onRepo: (r: Repo, actionKey: string, summary: string, target?: string) => GithubClassification;
79
- /** Fails closed: a `gh` command Passport can't name, a Delete on its repository (on Repositories when none is
80
- * known). No target narrower than the node. */
81
- export declare const unclassifiedGh: (r: Repo | null) => GithubClassification;
82
+ /** A `gh` command Passport can't name: the Unclassified action (its own kind, 2026-11-17) on its repository (on
83
+ * Repositories when none is known), with what it hit. No target narrower than the node. */
84
+ export declare const unclassifiedGh: (r: Repo | null, unnamed?: UnnamedHit) => GithubClassification;
85
+ /** The repository writes named since 2026-11-17 (workflows, runs, pull requests, issues, comments, labels): on the
86
+ * repository, no exact target. `what` is the summary's verb phrase ("Run a workflow"). */
87
+ export declare const repoWrite: (r: Repo, actionKey: string, what: string) => GithubClassification;
82
88
  /** The branch's own node, its most specific pattern node, or the repository when no node matches. */
83
89
  export declare function branchTarget(r: Repo, branch: string, context: BranchContext): string;
84
90
  export type BranchVerb = "push" | "force" | "delete";
@@ -129,19 +129,25 @@ export function withoutTarget(found) {
129
129
  return rest;
130
130
  }
131
131
  export const onRepo = (r, actionKey, summary, target) => withTarget({ nodeId: repoNode(r.owner, r.repo), actionKey, summary }, target);
132
- /** Fails closed: a `gh` command Passport can't name, a Delete on its repository (on Repositories when none is
133
- * known). No target narrower than the node. */
134
- export const unclassifiedGh = (r) => r
135
- ? {
136
- nodeId: repoNode(r.owner, r.repo),
137
- actionKey: "github.unclassified",
138
- summary: `Run a gh command Passport can't name in ${slug(r)}`
139
- }
140
- : {
141
- nodeId: githubNodeIds.repos,
142
- actionKey: "github.unclassified",
143
- summary: "Run a gh command Passport can't name"
144
- };
132
+ /** A `gh` command Passport can't name: the Unclassified action (its own kind, 2026-11-17) on its repository (on
133
+ * Repositories when none is known), with what it hit. No target narrower than the node. */
134
+ export const unclassifiedGh = (r, unnamed) => ({
135
+ ...(r
136
+ ? {
137
+ nodeId: repoNode(r.owner, r.repo),
138
+ actionKey: "github.unclassified",
139
+ summary: `Run a gh command Passport can't name in ${slug(r)}`
140
+ }
141
+ : {
142
+ nodeId: githubNodeIds.repos,
143
+ actionKey: "github.unclassified",
144
+ summary: "Run a gh command Passport can't name"
145
+ }),
146
+ ...(unnamed ? { unnamed } : {})
147
+ });
148
+ /** The repository writes named since 2026-11-17 (workflows, runs, pull requests, issues, comments, labels): on the
149
+ * repository, no exact target. `what` is the summary's verb phrase ("Run a workflow"). */
150
+ export const repoWrite = (r, actionKey, what) => onRepo(r, actionKey, `${what} in ${slug(r)}`);
145
151
  /** The branch's own node, its most specific pattern node, or the repository when no node matches. */
146
152
  export function branchTarget(r, branch, context) {
147
153
  const known = [...context.knownBranches(r.owner, r.repo)];
@@ -13,6 +13,8 @@ export declare const programOf: (argv0: string | undefined) => string;
13
13
  export declare const flagSet: (words: string) => Set<string>;
14
14
  export declare const GH_GLOBAL: Set<string>;
15
15
  export declare const GH_VALUES: Record<string, ReadonlySet<string>>;
16
+ /** `gh` repository writes named since 2026-11-17: the action and the summary's verb phrase. */
17
+ export declare const REPO_WRITES: Readonly<Record<string, readonly [string, string]>>;
16
18
  /** `-F` fields are typed (true, false, null, integers); `-f` fields are strings. */
17
19
  export declare function typedField(raw: string): unknown;
18
20
  /**
@@ -1,7 +1,8 @@
1
1
  // Generated by scripts/generate-control-plane-classifier.mjs. Do not edit.
2
2
  /** GitHub classifier: `gh` and `git push` command lines. Part of controlPlaneGithub.ts. */
3
- import { changeSecret, deleteRepo, eventBranch, githubTarget, makePublic, merge, numberOf, onBranch, onRepo, parseRepoRef, release, tag, unclassifiedGh, withoutTarget } from "./controlPlaneGithubCatalog.generated.js";
3
+ import { changeSecret, deleteRepo, eventBranch, githubTarget, makePublic, merge, numberOf, onBranch, onRepo, parseRepoRef, release, repoWrite, slug, tag, unclassifiedGh, withoutTarget } from "./controlPlaneGithubCatalog.generated.js";
4
4
  import { apiSegments, classifyApi, OPAQUE_BODY } from "./controlPlaneGithubApi.generated.js";
5
+ import { unnamedApi } from "./controlPlaneUnnamed.generated.js";
5
6
  /** Words and options of one command. `valueFlags` are the options that take the next word as their value. */
6
7
  export function parseArgs(args, valueFlags) {
7
8
  const parsed = { pos: [], opts: [] };
@@ -55,8 +56,44 @@ export const GH_VALUES = {
55
56
  "repo delete": GH_GLOBAL,
56
57
  "repo edit": flagSet("-R --repo --visibility -d --description -h --homepage --default-branch --add-topic --remove-topic"),
57
58
  "secret set": flagSet("-R --repo -a --app -b --body -e --env -f --env-file -o --org -r --repos -u --user"),
58
- api: flagSet("-R --repo -X --method -f --raw-field -F --field -H --header --input -q --jq -t --template --hostname --cache -p --preview")
59
+ api: flagSet("-R --repo -X --method -f --raw-field -F --field -H --header --input -q --jq -t --template --hostname --cache -p --preview"),
60
+ // The repository writes named since 2026-11-17 (`REPO_WRITES`).
61
+ "workflow run": flagSet("-R --repo -r --ref -f --raw-field -F --field"),
62
+ "run cancel": GH_GLOBAL,
63
+ "run rerun": flagSet("-R --repo -j --job"),
64
+ "pr create": flagSet("-R --repo -a --assignee -B --base -b --body -F --body-file -H --head -l --label -m --milestone -p --project --recover -r --reviewer -T --template -t --title"),
65
+ "pr edit": flagSet("-R --repo --add-assignee --add-label --add-project --add-reviewer -B --base -b --body -F --body-file -m --milestone --remove-assignee --remove-label --remove-project --remove-reviewer -t --title"),
66
+ "pr comment": flagSet("-R --repo -b --body -F --body-file"),
67
+ "pr close": flagSet("-R --repo -c --comment"),
68
+ "pr reopen": flagSet("-R --repo -c --comment"),
69
+ "issue create": flagSet("-R --repo -a --assignee -b --body -F --body-file -l --label -m --milestone -p --project --recover -T --template -t --title"),
70
+ "issue edit": flagSet("-R --repo --add-assignee --add-label --add-project -b --body -F --body-file -m --milestone --remove-assignee --remove-label --remove-project -t --title"),
71
+ "issue comment": flagSet("-R --repo -b --body -F --body-file"),
72
+ "issue close": flagSet("-R --repo -c --comment -r --reason"),
73
+ "issue reopen": flagSet("-R --repo -c --comment"),
74
+ "label create": flagSet("-R --repo -c --color -d --description"),
75
+ "label edit": flagSet("-R --repo -c --color -d --description -n --name")
59
76
  };
77
+ /** `gh` repository writes named since 2026-11-17: the action and the summary's verb phrase. */
78
+ export const REPO_WRITES = {
79
+ "workflow run": ["github.workflow.run", "Run a workflow"],
80
+ "run cancel": ["github.run.cancel", "Cancel a workflow run"],
81
+ "run rerun": ["github.run.rerun", "Re-run a workflow"],
82
+ "pr create": ["github.pr.open", "Open a pull request"],
83
+ "pr edit": ["github.pr.edit", "Edit a pull request"],
84
+ "pr comment": ["github.comment", "Comment"],
85
+ "pr close": ["github.pr.state", "Close a pull request"],
86
+ "pr reopen": ["github.pr.state", "Reopen a pull request"],
87
+ "issue create": ["github.issue.open", "Open an issue"],
88
+ "issue edit": ["github.issue.edit", "Edit an issue"],
89
+ "issue comment": ["github.comment", "Comment"],
90
+ "issue close": ["github.issue.edit", "Close an issue"],
91
+ "issue reopen": ["github.issue.edit", "Reopen an issue"],
92
+ "label create": ["github.label.manage", "Create a label"],
93
+ "label edit": ["github.label.manage", "Edit a label"]
94
+ };
95
+ /** A pull request's or issue's URL names its own repository. */
96
+ const ITEM_URL = /^https?:\/\/[^/]+\/([^/]+)\/([^/]+)\/(?:pull|issues)\/\d+/;
60
97
  /** `-F` fields are typed (true, false, null, integers); `-f` fields are strings. */
61
98
  export function typedField(raw) {
62
99
  if (raw === "true")
@@ -89,12 +126,14 @@ function apiRepo(path, parsed, args, context) {
89
126
  export function ghApi(parsed, args, context) {
90
127
  const raw = parsed.pos[1];
91
128
  const { method, read } = ghApiMethod(parsed);
92
- // Unparseable (no endpoint, or a placeholder gh fills in that Passport can't): fails closed.
129
+ // What it hit, coarse: the method and the path's template (never the query, fields or body).
130
+ const hit = unnamedApi("github", method, raw);
131
+ // Unparseable (no endpoint, or a placeholder gh fills in that Passport can't): unclassified.
93
132
  if (raw === undefined)
94
- return unclassifiedGh(apiRepo(undefined, parsed, args, context));
133
+ return unclassifiedGh(apiRepo(undefined, parsed, args, context), hit);
95
134
  const path = raw.replace(/\{(owner|repo|branch)\}/g, (placeholder, key) => (key === "branch" ? args.currentBranch : args.cwdRepo?.[key]) ?? placeholder);
96
135
  if (/\{(owner|repo|branch)\}/.test(path))
97
- return read ? null : unclassifiedGh(apiRepo(undefined, parsed, args, context));
136
+ return read ? null : unclassifiedGh(apiRepo(undefined, parsed, args, context), hit);
98
137
  const body = {};
99
138
  const fields = [
100
139
  ["-f", false],
@@ -120,7 +159,7 @@ export function ghApi(parsed, args, context) {
120
159
  const query = path.replace(/^\/+/, "") === "graphql" && !opaque && typeof body.query === "string" ? body.query : null;
121
160
  if (query !== null && !/^\s*mutation\b/i.test(query))
122
161
  return null;
123
- return read ? null : unclassifiedGh(apiRepo(path, parsed, args, context));
162
+ return read ? null : unclassifiedGh(apiRepo(path, parsed, args, context), hit);
124
163
  }
125
164
  export function classifyGh(args, context) {
126
165
  const words = parseArgs(args.argv.slice(1), GH_GLOBAL).pos;
@@ -155,17 +194,31 @@ export function classifyGh(args, context) {
155
194
  const r = argument === undefined ? repoFlag : parseRepoRef(argument, context.org);
156
195
  return r && lastValue(parsed, "--visibility") === "public" ? makePublic(r) : null;
157
196
  }
197
+ case "secret set":
198
+ return secretSet(parsed, argument, repoFlag);
158
199
  default: {
159
- const org = lastValue(parsed, "-o", "--org");
160
- if (hasFlag(parsed, "-u", "--user"))
200
+ const url = argument?.match(ITEM_URL);
201
+ const r = url ? { owner: url[1], repo: url[2] } : repoFlag;
202
+ if (!r)
161
203
  return null;
162
- if (org)
163
- return changeSecret(argument ?? null, org, null);
164
- const environment = lastValue(parsed, "-e", "--env") ?? null;
165
- return repoFlag ? changeSecret(argument ?? null, repoFlag.owner, repoFlag.repo, environment) : null;
204
+ // Closing with --delete-branch also deletes the head branch, not named on the line: the worse of the two.
205
+ if (command === "pr close" && hasFlag(parsed, "-d", "--delete-branch")) {
206
+ return onRepo(r, "github.branch.delete", `Close a pull request and delete its branch in ${slug(r)}`);
207
+ }
208
+ const [actionKey, what] = REPO_WRITES[command];
209
+ return repoWrite(r, actionKey, what);
166
210
  }
167
211
  }
168
212
  }
213
+ function secretSet(parsed, argument, repoFlag) {
214
+ const org = lastValue(parsed, "-o", "--org");
215
+ if (hasFlag(parsed, "-u", "--user"))
216
+ return null;
217
+ if (org)
218
+ return changeSecret(argument ?? null, org, null);
219
+ const environment = lastValue(parsed, "-e", "--env") ?? null;
220
+ return repoFlag ? changeSecret(argument ?? null, repoFlag.owner, repoFlag.repo, environment) : null;
221
+ }
169
222
  /* ------------------------------------------------------------------ */
170
223
  /* CLI: git push */
171
224
  /* ------------------------------------------------------------------ */
@@ -198,6 +198,8 @@ async function askOnce(api, classification, extra, signal, requestId) {
198
198
  summary: classification.summary.slice(0, MAX_SUMMARY),
199
199
  interface: "cli",
200
200
  ...(classification.target === undefined ? {} : { targetDigest: targetDigest(classification.target) }),
201
+ // What an unnamed action hit, coarse; the server makes it coarse again (`sanitizeUnnamed`).
202
+ ...(classification.unnamed ? { unnamed: classification.unnamed } : {}),
201
203
  // A push's after-SHA, read from git before it runs (`gitPush.ts` `withPushIds`): ids only.
202
204
  ...(platformIdsOf(classification).length ? { platformIds: platformIdsOf(classification) } : {}),
203
205
  ...(extra.credentialId ? { credentialId: extra.credentialId } : {}),