passport-bridge 0.45.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 (68) 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/supabaseCatalog.generated.js +3 -3
  35. package/dist/controlPlane.generated.d.ts +16 -15
  36. package/dist/controlPlane.generated.js +12 -17
  37. package/dist/controlPlaneGithub.generated.d.ts +2 -2
  38. package/dist/controlPlaneGithub.generated.js +12 -2
  39. package/dist/controlPlaneGithubApi.generated.d.ts +2 -0
  40. package/dist/controlPlaneGithubApi.generated.js +56 -1
  41. package/dist/controlPlaneGithubCatalog.generated.d.ts +9 -3
  42. package/dist/controlPlaneGithubCatalog.generated.js +19 -13
  43. package/dist/controlPlaneGithubCli.generated.d.ts +2 -0
  44. package/dist/controlPlaneGithubCli.generated.js +65 -12
  45. package/dist/controlPlaneGuard.js +2 -0
  46. package/dist/controlPlanePeople.generated.d.ts +117 -0
  47. package/dist/controlPlanePeople.generated.js +6 -0
  48. package/dist/controlPlaneSupabase.js +3 -1
  49. package/dist/controlPlaneUnnamed.generated.d.ts +58 -0
  50. package/dist/controlPlaneUnnamed.generated.js +225 -0
  51. package/dist/cpCli.js +5 -1
  52. package/dist/initAppsStep.d.ts +1 -1
  53. package/dist/initAppsStep.js +7 -5
  54. package/dist/initOutro.js +13 -10
  55. package/dist/initState.d.ts +3 -2
  56. package/dist/initState.js +7 -18
  57. package/dist/localNotices.d.ts +22 -0
  58. package/dist/localNotices.js +100 -0
  59. package/dist/pluginPin.d.ts +1 -1
  60. package/dist/pluginPin.js +1 -1
  61. package/dist/version.d.ts +1 -1
  62. package/dist/version.js +1 -1
  63. package/dist/webLinks.d.ts +23 -6
  64. package/dist/webLinks.js +21 -22
  65. package/npm-shrinkwrap.json +8 -8
  66. package/package.json +1 -1
  67. package/dist/cliApprovalLink.d.ts +0 -5
  68. package/dist/cliApprovalLink.js +0 -21
@@ -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,12 +65,7 @@ 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
@@ -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 } : {}),
@@ -0,0 +1,117 @@
1
+ /**
2
+ * v21 People's part of the control-plane contract (docs/design/v21/people.md): coverage per person, setup links and
3
+ * leaving. Re-exported from `controlPlane.ts`; changed only through the orchestrating session.
4
+ */
5
+ /** A person's first coverage gap, which is also what a setup link asks for. */
6
+ export type CpCoverageGap = {
7
+ kind: "guard_off";
8
+ client: "claude-code" | "codex" | "cursor";
9
+ computer: string;
10
+ } | {
11
+ kind: "guard_missing";
12
+ computers: number;
13
+ of: number;
14
+ } | {
15
+ kind: "guard_outdated";
16
+ computer: string;
17
+ } | {
18
+ kind: "not_set_up";
19
+ } | {
20
+ kind: "own_sign_in";
21
+ platform: string;
22
+ };
23
+ /** A person's coverage (v21 People, docs/design/v21/people.md section 1). The UI words it; never an email. */
24
+ export type CpPersonCoverage = {
25
+ state: "covered" | "partly" | "not_set_up";
26
+ guard: "on" | "off" | "outdated" | "not_set_up" | "chat_only" | "none";
27
+ /** Computers with a guarded agent, and how many have every agent's guard on ("On 1 of 2"). */
28
+ computers: number;
29
+ computersOn: number;
30
+ gap?: CpCoverageGap;
31
+ /** Agent coverage over apps with an activity log, 7 days; null when they had no such actions. */
32
+ percent: number | null;
33
+ /** Outside Passport actions on those apps that map to them (their own sign-in), 7 days. */
34
+ ownSignIn7d: number;
35
+ /** Distinct agent clients on their live connections, for logos. */
36
+ clients: string[];
37
+ /** Apps they use: connected through Passport, plus apps with a log they acted on in 7 days. */
38
+ apps: number;
39
+ /** Their only connections are AI apps (Claude, ChatGPT): "Through Passport only". */
40
+ chatOnly: boolean;
41
+ };
42
+ /** The newest setup link sent to someone. */
43
+ export type CpSetupLinkState = {
44
+ id: string;
45
+ sentAt: number;
46
+ expiresAt: number;
47
+ remindedAt?: number;
48
+ status: "open" | "done" | "expired" | "canceled";
49
+ };
50
+ /** Someone who left (removed in the identity provider, or by an admin). */
51
+ export type CpLeftPerson = {
52
+ at: number;
53
+ via: "okta" | "admin";
54
+ /** Set once offboarded; "automatic" when the setting did it, else the admin's name. */
55
+ offboarded?: {
56
+ at: number;
57
+ by: string;
58
+ };
59
+ /** What still holds access until offboarded. `keysToRevokeInApps`: keys they made in the apps themselves. */
60
+ remaining: {
61
+ links: number;
62
+ credentials: number;
63
+ keysToRevokeInApps: number;
64
+ };
65
+ };
66
+ /** POST /api/cp/setup-links (admin). */
67
+ export type CpSetupLinkChannels = {
68
+ agent: boolean;
69
+ slack: boolean;
70
+ email: boolean;
71
+ };
72
+ export type CpSetupLinksRequest = {
73
+ memberIds: string[];
74
+ channels: CpSetupLinkChannels;
75
+ };
76
+ export type CpSetupLinksResponse = {
77
+ sent: {
78
+ memberId: string;
79
+ linkId: string;
80
+ expiresAt: number;
81
+ channels: {
82
+ agent: boolean;
83
+ slack: "sent" | "unavailable" | "off";
84
+ email: "sent" | "unavailable" | "off";
85
+ };
86
+ }[];
87
+ skipped: {
88
+ memberId: string;
89
+ reason: "covered" | "left" | "sent_recently" | "not_found";
90
+ }[];
91
+ };
92
+ /** POST /api/cp/people/:id/offboard (admin). */
93
+ export type CpOffboardResponse = {
94
+ offboarded: {
95
+ at: number;
96
+ };
97
+ done: {
98
+ apps: number;
99
+ agents: number;
100
+ links: number;
101
+ credentials: number;
102
+ };
103
+ };
104
+ /** v21 fields on `CpAgentRow`: its last action or check-in (epoch ms), and the Passport CLI version the guard last
105
+ * reported from its computer, else the connection's own. v22: `program` marks a program the app's log saw act (GitHub
106
+ * Actions on a repository): `name` is the program, `runsOn` the repository, no person, guard "na". */
107
+ export type CpAgentV21 = {
108
+ lastSeenTs?: number;
109
+ version?: string;
110
+ program?: true;
111
+ };
112
+ /** v21 fields on `CpPersonRow`: coverage, the newest setup link, and (only with `?left=1`) leaving. */
113
+ export type CpPersonV21 = {
114
+ coverage?: CpPersonCoverage;
115
+ setupLink?: CpSetupLinkState;
116
+ left?: CpLeftPerson;
117
+ };
@@ -0,0 +1,6 @@
1
+ // Generated by scripts/generate-control-plane-classifier.mjs. Do not edit.
2
+ /**
3
+ * v21 People's part of the control-plane contract (docs/design/v21/people.md): coverage per person, setup links and
4
+ * leaving. Re-exported from `controlPlane.ts`; changed only through the orchestrating session.
5
+ */
6
+ export {};
@@ -194,7 +194,9 @@ const action = (found) => ({
194
194
  actionKey: found.actionKey,
195
195
  summary: found.summary.slice(0, MAX_SUMMARY),
196
196
  ...(found.target ? { target: found.target } : {}),
197
- ...(found.nodes?.length ? { nodes: found.nodes } : {})
197
+ ...(found.nodes?.length ? { nodes: found.nodes } : {}),
198
+ // What an unnamed action hit, coarse; the server makes it coarse again (`sanitizeUnnamed`).
199
+ ...(found.unnamed ? { unnamed: found.unnamed } : {})
198
200
  });
199
201
  /** The decide request for one bundle. */
200
202
  export function supabaseDecideBody(bundle, ask) {
@@ -0,0 +1,58 @@
1
+ /**
2
+ * What an action Passport can't name hit (`UnnamedHit`, decided 2026-11-17), made coarse: an API path becomes a
3
+ * template of the platform's own path words, a command line its program and known subcommand words. Pure; the
4
+ * server, the bridge and the kit share it. Never an owner, repository, number, id, sha, branch, query string, body,
5
+ * flag or argument: a segment or word that isn't the platform's own vocabulary is a placeholder or dropped.
6
+ */
7
+ /**
8
+ * What an action Passport can't name hit, so the next one to name is known (2026-11-17): an API call's method and
9
+ * path template (`repos/{owner}/{repo}/actions/runs/{id}/cancel`), or a command line's program and subcommand words
10
+ * (`gh run watch`). Never an owner, repository, number, id, branch, query string, body, flag or argument.
11
+ */
12
+ export type UnnamedHit = {
13
+ via: "api";
14
+ method?: string;
15
+ path?: string;
16
+ } | {
17
+ via: "cli";
18
+ command: string;
19
+ };
20
+ /** An app's action Passport can't name (`github.unclassified`). */
21
+ export declare const isUnclassifiedAction: (actionKey: string) => boolean;
22
+ /** The kind an event is shown as: Unclassified for an unnamed action whatever kind it was stored with (events
23
+ * from before 2026-11-17 recorded it as a Delete), else its own. */
24
+ export declare function displayKind<K extends string>(event: {
25
+ actionKey: string;
26
+ kind: K;
27
+ }): K | "unclassified";
28
+ export declare const UNNAMED_METHODS: readonly string[];
29
+ /** GitHub REST's literal path words (api.github.com), not exhaustive: any other segment becomes a placeholder. */
30
+ export declare const GITHUB_PATH_WORDS: ReadonlySet<string>;
31
+ /** Supabase's Management API path words (api.supabase.com/v1). */
32
+ export declare const SUPABASE_PATH_WORDS: ReadonlySet<string>;
33
+ /** Railway is GraphQL: its path is one word. */
34
+ export declare const RAILWAY_PATH_WORDS: ReadonlySet<string>;
35
+ export declare function pathWordsFor(platform: string): ReadonlySet<string>;
36
+ /**
37
+ * An API path as a template of the platform's own words: scheme, host, query and fragment dropped; the names after
38
+ * `repos`, `orgs`, `users` (as the first word) are `{owner}/{repo}`, `{org}`, `{user}`; any other segment stays only
39
+ * when it is one of `known`, else it is one placeholder named by the word before it (`{number}` after `pulls`,
40
+ * `{branch}` after `branches`, `{sha}` for a commit hash, else `{id}`), a run of them collapsed into one.
41
+ */
42
+ export declare function templatePath(raw: string, known: ReadonlySet<string>): string;
43
+ /**
44
+ * A command line as its program and at most two subcommand words: each a CLI word (`^[a-z][a-z-]{0,30}$`) and, for
45
+ * `gh` and `git`, one that CLI has, so a positional argument (a branch, a remote, a repository, a number) never
46
+ * passes as a subcommand. Flags end it. Null when the program itself isn't a plain name.
47
+ */
48
+ export declare function unnamedCommand(argv: readonly string[]): string | null;
49
+ /** An API call's hit: its method (one of the HTTP methods) and its path's template; either may be unknown. */
50
+ export declare function unnamedApi(platform: string, method: string | undefined, path?: string): UnnamedHit;
51
+ /** A command line's hit; undefined when nothing of it can be kept. */
52
+ export declare function unnamedCli(argv: readonly string[]): UnnamedHit | undefined;
53
+ /**
54
+ * What a caller sent (the bridge's classification) made coarse again, so nothing it adds survives: the method from
55
+ * the list, the path re-templated with the platform's words, the command re-read word by word. Anything else is
56
+ * dropped, never refused.
57
+ */
58
+ export declare function sanitizeUnnamed(platform: string, value: unknown): UnnamedHit | undefined;