passport-bridge 0.55.0 → 0.57.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 (100) hide show
  1. package/dist/cliHookDecide.d.ts +4 -2
  2. package/dist/cliHookDecide.js +27 -12
  3. package/dist/connectorKit/callEffects.generated.js +3 -1
  4. package/dist/connectorKit/containers.generated.d.ts +46 -0
  5. package/dist/connectorKit/containers.generated.js +202 -0
  6. package/dist/connectorKit/engine.generated.d.ts +6 -14
  7. package/dist/connectorKit/engine.generated.js +42 -103
  8. package/dist/connectorKit/githubDecide.generated.d.ts +6 -0
  9. package/dist/connectorKit/githubDecide.generated.js +26 -7
  10. package/dist/connectorKit/links.generated.d.ts +14 -0
  11. package/dist/connectorKit/links.generated.js +146 -0
  12. package/dist/connectorKit/manifest.generated.d.ts +3 -0
  13. package/dist/connectorKit/manifests/cloudflareApiOverlay.generated.d.ts +22 -0
  14. package/dist/connectorKit/manifests/cloudflareApiOverlay.generated.js +50 -0
  15. package/dist/connectorKit/manifests/cloudflareCli.generated.d.ts +3 -0
  16. package/dist/connectorKit/manifests/cloudflareCli.generated.js +27 -6
  17. package/dist/connectorKit/manifests/cloudflareCommands.generated.d.ts +17 -0
  18. package/dist/connectorKit/manifests/cloudflareCommands.generated.js +353 -0
  19. package/dist/connectorKit/manifests/githubCapture.generated.js +3 -2
  20. package/dist/connectorKit/manifests/githubHooks.generated.js +3 -1
  21. package/dist/connectorKit/manifests/githubReads.generated.d.ts +4 -0
  22. package/dist/connectorKit/manifests/githubReads.generated.js +36 -2
  23. package/dist/connectorKit/manifests/kubernetesCli.generated.d.ts +6 -0
  24. package/dist/connectorKit/manifests/kubernetesCli.generated.js +18 -4
  25. package/dist/connectorKit/manifests/railway.generated.js +3 -1
  26. package/dist/connectorKit/manifests/railwayCapture.generated.js +16 -1
  27. package/dist/connectorKit/manifests/railwayCommands.generated.js +9 -1
  28. package/dist/connectorKit/manifests/railwayGraphql.generated.d.ts +40 -0
  29. package/dist/connectorKit/manifests/railwayGraphql.generated.js +409 -0
  30. package/dist/connectorKit/manifests/railwayHooks.generated.d.ts +10 -1
  31. package/dist/connectorKit/manifests/railwayHooks.generated.js +105 -41
  32. package/dist/connectorKit/manifests/sentryCli.generated.js +3 -0
  33. package/dist/connectorKit/manifests/supabaseApi.generated.js +6 -0
  34. package/dist/connectorKit/manifests/supabaseCapture.generated.js +4 -0
  35. package/dist/connectorKit/manifests/terraform.generated.d.ts +16 -4
  36. package/dist/connectorKit/manifests/terraform.generated.js +85 -104
  37. package/dist/connectorKit/manifests/terraformCatalog.generated.d.ts +15 -0
  38. package/dist/connectorKit/manifests/terraformCatalog.generated.js +36 -0
  39. package/dist/connectorKit/manifests/terraformCommands.generated.d.ts +2 -0
  40. package/dist/connectorKit/manifests/terraformCommands.generated.js +109 -0
  41. package/dist/connectorKit/nodeChain.generated.d.ts +22 -0
  42. package/dist/connectorKit/nodeChain.generated.js +90 -0
  43. package/dist/connectorKit/scripts.generated.d.ts +72 -0
  44. package/dist/connectorKit/scripts.generated.js +282 -0
  45. package/dist/connectorKit/shell.generated.d.ts +29 -31
  46. package/dist/connectorKit/shell.generated.js +179 -184
  47. package/dist/connectorKit/shellFed.generated.d.ts +7 -1
  48. package/dist/connectorKit/shellFed.generated.js +111 -14
  49. package/dist/connectorKit/shellRuns.generated.d.ts +104 -0
  50. package/dist/connectorKit/shellRuns.generated.js +301 -0
  51. package/dist/connectorKit/sources/cloudflare/api-overlay.generated.d.ts +3793 -0
  52. package/dist/connectorKit/sources/cloudflare/api-overlay.generated.js +2 -0
  53. package/dist/connectorKit/sources/cloudflare/cli-tree.generated.d.ts +56 -0
  54. package/dist/connectorKit/sources/cloudflare/cli-tree.generated.js +2 -0
  55. package/dist/connectorKit/sources/railway/cli-tree.generated.d.ts +0 -17
  56. package/dist/connectorKit/sources/railway/cli-tree.generated.js +1 -1
  57. package/dist/connectorKit/sources/sentry/cli-commands.generated.d.ts +2 -0
  58. package/dist/connectorKit/sources/sentry/cli-commands.generated.js +1 -1
  59. package/dist/connectorKit/sources/supabase/api-operations.generated.js +1 -1
  60. package/dist/connectorKit/sources/terraform/cli-tree.generated.d.ts +32 -0
  61. package/dist/connectorKit/sources/terraform/cli-tree.generated.js +2 -0
  62. package/dist/connectorKit/spawns.generated.d.ts +3 -0
  63. package/dist/connectorKit/spawns.generated.js +66 -9
  64. package/dist/connectorKit/template.generated.d.ts +12 -0
  65. package/dist/connectorKit/template.generated.js +19 -0
  66. package/dist/connectorKit/unread.generated.d.ts +40 -0
  67. package/dist/connectorKit/unread.generated.js +92 -0
  68. package/dist/controlPlane.generated.d.ts +3 -2
  69. package/dist/controlPlaneCloudflare.d.ts +8 -3
  70. package/dist/controlPlaneCloudflare.js +22 -10
  71. package/dist/controlPlaneGuard.js +6 -8
  72. package/dist/controlPlaneNpmCommands.generated.d.ts +3 -0
  73. package/dist/controlPlaneNpmCommands.generated.js +17 -2
  74. package/dist/controlPlaneRailwayGuard.d.ts +42 -35
  75. package/dist/controlPlaneRailwayGuard.js +229 -117
  76. package/dist/controlPlaneRoutes.generated.d.ts +13 -0
  77. package/dist/controlPlaneRoutes.generated.js +9 -0
  78. package/dist/controlPlaneSentry.js +5 -3
  79. package/dist/controlPlaneSupabase.js +5 -3
  80. package/dist/controlPlaneTerraform.js +7 -4
  81. package/dist/controlPlaneUnnamed.generated.d.ts +17 -0
  82. package/dist/controlPlaneUnnamed.generated.js +20 -1
  83. package/dist/pluginPin.d.ts +1 -1
  84. package/dist/pluginPin.js +1 -1
  85. package/dist/scriptReader.d.ts +20 -0
  86. package/dist/scriptReader.js +52 -0
  87. package/dist/version.d.ts +1 -1
  88. package/dist/version.js +1 -1
  89. package/npm-shrinkwrap.json +2 -2
  90. package/package.json +1 -1
  91. package/dist/connectorKit/shadow.generated.d.ts +0 -52
  92. package/dist/connectorKit/shadow.generated.js +0 -148
  93. package/dist/controlPlaneRailway.generated.d.ts +0 -30
  94. package/dist/controlPlaneRailway.generated.js +0 -217
  95. package/dist/controlPlaneRailwayCli.generated.d.ts +0 -11
  96. package/dist/controlPlaneRailwayCli.generated.js +0 -455
  97. package/dist/kitShadow.d.ts +0 -81
  98. package/dist/kitShadow.js +0 -256
  99. package/dist/kitShadowBudget.d.ts +0 -10
  100. package/dist/kitShadowBudget.js +0 -15
@@ -162,23 +162,42 @@ export function classifyGithub(request, context) {
162
162
  }
163
163
  const programOf = (word) => (word ?? "").replace(/^.*\//, "").replace(/\.exe$/i, "");
164
164
  const GIT_GLOBAL_VALUES = new Set(["-C", "-c", "--git-dir", "--work-tree", "--namespace"]);
165
- /** Whether a command line is `git push` (git's own options before it don't count). */
166
- export function isGitPush(argv) {
167
- if (programOf(argv[0]) !== "git")
168
- return false;
165
+ /** Where git's subcommand sits (git's own options before it don't count). */
166
+ function gitSubcommandAt(argv) {
169
167
  let index = 1;
170
168
  while ((argv[index] ?? "").startsWith("-"))
171
169
  index += GIT_GLOBAL_VALUES.has(argv[index]) ? 2 : 1;
172
- return argv[index] === "push";
170
+ return index;
171
+ }
172
+ /** Whether a command line is `git push` (git's own options before it don't count). */
173
+ export function isGitPush(argv) {
174
+ return programOf(argv[0]) === "git" && argv[gitSubcommandAt(argv)] === "push";
175
+ }
176
+ /**
177
+ * `git send-pack <url> <ref>…` (push's plumbing, same options and positions) as the push it is, so the push path
178
+ * names each ref it moves. With no ref, send-pack pushes every branch both sides have: read as `--all`, a superset.
179
+ * Any other line is returned as it is.
180
+ */
181
+ export function gitPushArgv(argv) {
182
+ if (programOf(argv[0]) !== "git")
183
+ return argv;
184
+ const at = gitSubcommandAt(argv);
185
+ if (argv[at] !== "send-pack")
186
+ return argv;
187
+ const rest = argv.slice(at + 1);
188
+ const refs = rest.filter((word) => !word.startsWith("-")).length > 1;
189
+ const every = rest.some((word) => word === "--all" || word === "--mirror" || word === "--stdin");
190
+ return [...argv.slice(0, at), "push", ...(refs || every ? [] : ["--all"]), ...rest];
173
191
  }
174
192
  /**
175
193
  * Every ref a `git push` moves, one classification each, worst first, with the worst case for what it can't name;
176
194
  * null when it isn't a push to GitHub (or is a dry run).
177
195
  */
178
196
  export function classifyGitPushRefs(args, context) {
179
- if (!isGitPush(args.argv))
197
+ const argv = [...gitPushArgv(args.argv)];
198
+ if (!isGitPush(argv))
180
199
  return null;
181
- const found = classifyGithubAll({ interface: "cli", ...args }, context);
200
+ const found = classifyGithubAll({ interface: "cli", ...args, argv }, context);
182
201
  return found.length ? found : null;
183
202
  }
184
203
  /** The worst a push to branches it doesn't name can do: force-push and delete, on the repository. */
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Folders and link files for the guard-side resolver (`shell.ts`): a path joined onto a folder, and a folder's link
3
+ * (the manifest's link file in the folder or the nearest parent), read through the guard's file reader.
4
+ */
5
+ import type { Manifest } from "./manifest.generated.js";
6
+ /** What reading a link needs from the guard. */
7
+ export type LinkReader = {
8
+ readFile?: (path: string) => string | undefined;
9
+ };
10
+ /** A path joined onto a folder, with "." and ".." resolved; posix. */
11
+ export declare function joinPath(folder: string, path: string): string;
12
+ /** A folder's link: the manifest's link file (the first of several it names) in the folder or the nearest parent
13
+ * that has one. */
14
+ export declare function folderLink(m: Manifest, folder: string, guard: LinkReader): Record<string, string> | undefined;
@@ -0,0 +1,146 @@
1
+ // Generated by scripts/generate-control-plane-classifier.mjs. Do not edit.
2
+ /**
3
+ * Folders and link files for the guard-side resolver (`shell.ts`): a path joined onto a folder, and a folder's link
4
+ * (the manifest's link file in the folder or the nearest parent), read through the guard's file reader.
5
+ */
6
+ /** A path joined onto a folder, with "." and ".." resolved; posix. */
7
+ export function joinPath(folder, path) {
8
+ const parts = [];
9
+ for (const part of `${path.startsWith("/") ? "" : folder}/${path}`.split("/")) {
10
+ if (part === "" || part === ".")
11
+ continue;
12
+ if (part === "..")
13
+ parts.pop();
14
+ else
15
+ parts.push(part);
16
+ }
17
+ return `/${parts.join("/")}`;
18
+ }
19
+ /** An INI file's "section.key" values the link names, as params: `[defaults]` then `org = acme`. */
20
+ function iniFields(text, fields) {
21
+ const out = {};
22
+ let section = "";
23
+ for (const raw of text.split(/\r?\n/)) {
24
+ const line = raw.trim();
25
+ if (!line || line.startsWith(";") || line.startsWith("#"))
26
+ continue;
27
+ const header = /^\[([^\]]+)\]$/.exec(line);
28
+ if (header) {
29
+ section = header[1].trim().toLowerCase();
30
+ continue;
31
+ }
32
+ const eq = line.indexOf("=");
33
+ if (eq <= 0)
34
+ continue;
35
+ const param = fields[`${section}.${line.slice(0, eq).trim().toLowerCase()}`];
36
+ const value = line.slice(eq + 1).trim();
37
+ if (param && value)
38
+ out[param] = value;
39
+ }
40
+ return Object.keys(out).length ? out : undefined;
41
+ }
42
+ /** A link file's text as params, or undefined when it can't be read. */
43
+ function linkParams(link, text) {
44
+ if (link.format === "text")
45
+ return text.trim() ? { [link.param]: text.trim() } : undefined;
46
+ if (link.format === "ini")
47
+ return iniFields(text, link.fields);
48
+ const parsed = link.format === "toml" ? tomlTop(text) : jsonTop(link.format === "jsonc" ? withoutComments(text) : text);
49
+ if (!parsed)
50
+ return undefined;
51
+ const out = {};
52
+ for (const [field, param] of Object.entries(link.fields))
53
+ if (typeof parsed[field] === "string")
54
+ out[param] = parsed[field];
55
+ return out;
56
+ }
57
+ function jsonTop(text) {
58
+ try {
59
+ const parsed = JSON.parse(text);
60
+ return parsed && typeof parsed === "object" && !Array.isArray(parsed)
61
+ ? parsed
62
+ : undefined;
63
+ }
64
+ catch {
65
+ return undefined;
66
+ }
67
+ }
68
+ /** JSONC as JSON: line and block comments outside strings, and trailing commas, removed. */
69
+ function withoutComments(text) {
70
+ let out = "";
71
+ for (let i = 0; i < text.length; i++) {
72
+ const ch = text[i];
73
+ if (ch === '"') {
74
+ const end = /"(?:[^"\\]|\\.)*"/y;
75
+ end.lastIndex = i;
76
+ const found = end.exec(text);
77
+ if (!found)
78
+ return out + text.slice(i);
79
+ out += found[0];
80
+ i += found[0].length - 1;
81
+ }
82
+ else if (ch === "/" && text[i + 1] === "/") {
83
+ while (i < text.length && text[i] !== "\n")
84
+ i++;
85
+ out += "\n";
86
+ }
87
+ else if (ch === "/" && text[i + 1] === "*") {
88
+ const close = text.indexOf("*/", i + 2);
89
+ i = close < 0 ? text.length : close + 1;
90
+ }
91
+ else
92
+ out += ch;
93
+ }
94
+ return out.replace(/,(\s*[}\]])/g, "$1");
95
+ }
96
+ /** A TOML file's top-level string keys (`name = "api"`), up to its first table header; nothing else is read. */
97
+ function tomlTop(text) {
98
+ const out = {};
99
+ for (const raw of text.split(/\r?\n/)) {
100
+ const line = raw.trim();
101
+ if (line.startsWith("["))
102
+ break;
103
+ const found = /^([A-Za-z0-9_-]+)\s*=\s*(?:"((?:[^"\\]|\\.)*)"|'([^']*)')\s*(?:#.*)?$/.exec(line);
104
+ if (found)
105
+ out[found[1]] = found[2] ?? found[3] ?? "";
106
+ }
107
+ return out;
108
+ }
109
+ /** A path that names a link file itself (Wrangler's `--config staging.toml`): read as the link spec of its format, never
110
+ * a parent's. Undefined when the path isn't one (a folder) or the file can't be read; null when nothing can name it. */
111
+ function readLinkFile(links, path, guard) {
112
+ const format = /\.toml$/i.test(path)
113
+ ? "toml"
114
+ : /\.jsonc$/i.test(path)
115
+ ? "jsonc"
116
+ : /\.json$/i.test(path)
117
+ ? "json"
118
+ : null;
119
+ if (!format)
120
+ return undefined;
121
+ const link = links.find((spec) => spec.format === format);
122
+ const text = link ? guard.readFile?.(path) : undefined;
123
+ return link && text !== undefined ? (linkParams(link, text) ?? null) : null;
124
+ }
125
+ /** A folder's link: the manifest's link file (the first of several it names) in the folder or the nearest parent
126
+ * that has one. */
127
+ export function folderLink(m, folder, guard) {
128
+ const spec = m.capture.cli.link;
129
+ if (!spec || !guard.readFile)
130
+ return undefined;
131
+ const links = Array.isArray(spec) ? spec : [spec];
132
+ const file = readLinkFile(links, folder, guard);
133
+ if (file !== undefined)
134
+ return file ?? undefined;
135
+ for (let dir = folder, guardDepth = 0; guardDepth < 64; guardDepth++) {
136
+ for (const link of links) {
137
+ const text = guard.readFile(joinPath(dir, link.file));
138
+ if (text !== undefined)
139
+ return linkParams(link, text);
140
+ }
141
+ if (dir === "/")
142
+ return undefined;
143
+ dir = joinPath(dir, "..");
144
+ }
145
+ return undefined;
146
+ }
@@ -213,6 +213,9 @@ export type CaptureSpec = {
213
213
  rules: readonly CaptureRule[];
214
214
  reads: Readonly<Record<string, ReadEvidence>>;
215
215
  unknown?: UnknownOp;
216
+ /** Paths outside the operation surface that only serve the vendor's own documentation (its OpenAPI document): a
217
+ * GET or HEAD of one reads no account data, so it is a read. Not operations, so not in the pinned sources. */
218
+ docs?: readonly string[];
216
219
  /** Query keys that name what a call acts on (Vercel's teamId); no other query key can set a node param. */
217
220
  query?: readonly string[];
218
221
  /** Query keys the vendor documents as repeatable (Sentry's bulk `?id=1&id=2`): their values are a list. Any
@@ -0,0 +1,22 @@
1
+ import type { CaptureRule, Manifest } from "../manifest.generated.js";
2
+ /**
3
+ * Cloudflare's whole API v4, named (docs/design/zero-unknowns.md, decision 3): every operation of the pinned schema
4
+ * the hand rules in `cloudflareApi.ts` don't name, from the generated overlay (`sources/cloudflare/api-overlay.json`,
5
+ * drafted and reviewed in `cloudflareApiDraft.ts`). A read is a read; anything else is Cloudflare's "Other change"
6
+ * with Cloudflare's own summary, placed on the node its path names, and the server's call-effects table
7
+ * (`cloudflareOverlayEffects.ts`) gives it its effects.
8
+ *
9
+ * Large (about 3,800 routes), so it is its own manifest: the guard loads it only for a line that calls Cloudflare's
10
+ * API, never for `wrangler`, and the web app never imports it.
11
+ */
12
+ /** `0` is a read; otherwise Cloudflare's summary and the reviewed effects (`effectSpec.ts`). */
13
+ export type ApiOverlayItem = 0 | readonly [summary: string, effects: string];
14
+ export declare const CLOUDFLARE_API_OVERLAY_ITEMS: Readonly<Record<string, ApiOverlayItem>>;
15
+ export declare function cloudflareApiPlace(path: string): string;
16
+ /** The overlay's capture rules and reads. */
17
+ export declare function cloudflareApiOverlayCapture(items?: Readonly<Record<string, ApiOverlayItem>>): {
18
+ rules: CaptureRule[];
19
+ reads: Record<string, string>;
20
+ };
21
+ /** Cloudflare's manifest with every API operation named: the hand rules first (they win), then the overlay. */
22
+ export declare const CLOUDFLARE_WITH_API: Manifest;
@@ -0,0 +1,50 @@
1
+ // Generated by scripts/generate-control-plane-classifier.mjs. Do not edit.
2
+ import OVERLAY from "../sources/cloudflare/api-overlay.generated.js";
3
+ import { CLOUDFLARE } from "./cloudflare.generated.js";
4
+ export const CLOUDFLARE_API_OVERLAY_ITEMS = OVERLAY.items;
5
+ const OTHER = "cloudflare.account.change";
6
+ const V = "/client/v4";
7
+ /** The node a route names, most specific first (each by the path param the manifest reads it from); else the
8
+ * platform. */
9
+ const PLACES = [
10
+ [/^\/client\/v4\/accounts\/\{account_id\}\/workers\/scripts\/\{script_name\}(\/|$)/, "worker"],
11
+ [/^\/client\/v4\/accounts\/\{account_id\}\/pages\/projects\/\{project_name\}(\/|$)/, "pages_project"],
12
+ [/^\/client\/v4\/accounts\/\{account_id\}\/r2\/buckets\/\{bucket_name\}(\/|$)/, "bucket"],
13
+ [/^\/client\/v4\/accounts\/\{account_id\}\/storage\/kv\/namespaces\/\{namespace_id\}(\/|$)/, "kv_namespace"],
14
+ [/^\/client\/v4\/accounts\/\{account_id\}\/d1\/database\/\{database_id\}(\/|$)/, "d1_database"],
15
+ [/^\/client\/v4\/accounts\/\{account_id\}\/queues\/\{queue_id\}(\/|$)/, "queue"],
16
+ [/^\/client\/v4\/zones\/\{zone_id\}(\/|$)/, "zone"],
17
+ [/^\/client\/v4\/accounts\/\{account_id\}(\/|$)/, "account"]
18
+ ];
19
+ export function cloudflareApiPlace(path) {
20
+ return PLACES.find(([pattern]) => pattern.test(path))?.[1] ?? "platform";
21
+ }
22
+ /** The overlay's capture rules and reads. */
23
+ export function cloudflareApiOverlayCapture(items = CLOUDFLARE_API_OVERLAY_ITEMS) {
24
+ const rules = [];
25
+ const reads = {};
26
+ for (const [op, item] of Object.entries(items)) {
27
+ if (item === 0) {
28
+ reads[op] = "A read in Cloudflare's API";
29
+ continue;
30
+ }
31
+ const path = op.slice(op.indexOf(" ") + 1);
32
+ rules.push({
33
+ match: op,
34
+ action: OTHER,
35
+ on: cloudflareApiPlace(path.startsWith(V) ? path : V + path),
36
+ summary: item[0]
37
+ });
38
+ }
39
+ return { rules, reads };
40
+ }
41
+ const overlay = cloudflareApiOverlayCapture();
42
+ const api = CLOUDFLARE.capture.api;
43
+ /** Cloudflare's manifest with every API operation named: the hand rules first (they win), then the overlay. */
44
+ export const CLOUDFLARE_WITH_API = {
45
+ ...CLOUDFLARE,
46
+ capture: {
47
+ ...CLOUDFLARE.capture,
48
+ api: { ...api, rules: [...api.rules, ...overlay.rules], reads: { ...overlay.reads, ...api.reads } }
49
+ }
50
+ };
@@ -1,2 +1,5 @@
1
1
  import type { CliSpec } from "../manifest.generated.js";
2
+ import { type CliTree } from "../cliTree.generated.js";
3
+ /** Wrangler 4.169.0's whole command tree (docs/design/zero-unknowns.md): flags, aliases and usage lines. */
4
+ export declare const CLOUDFLARE_TREE: CliTree;
2
5
  export declare const CLOUDFLARE_CLI: CliSpec;
@@ -1,5 +1,8 @@
1
1
  // Generated by scripts/generate-control-plane-classifier.mjs. Do not edit.
2
2
  import CLI from "../sources/cloudflare/cli-flags.generated.js";
3
+ import TREE from "../sources/cloudflare/cli-tree.generated.js";
4
+ import { mergeAliases, mergeFlags, treeGroups, treeTables } from "../cliTree.generated.js";
5
+ import { cloudflareOverlayCapture } from "./cloudflareCommands.generated.js";
3
6
  /**
4
7
  * Wrangler capture (2026-11-21), from Cloudflare's command reference (Wrangler 4.x, `sources/cloudflare/`).
5
8
  *
@@ -325,6 +328,13 @@ const pagesRules = [
325
328
  on: "pages_project",
326
329
  summary: "Create Pages project {project}"
327
330
  },
331
+ {
332
+ match: "pages deployment create",
333
+ args: ["directory"],
334
+ action: "cloudflare.pages.deploy",
335
+ on: "pages_project",
336
+ summary: "Deploy Pages project {project}"
337
+ },
328
338
  {
329
339
  match: "pages project delete",
330
340
  args: ["project"],
@@ -363,10 +373,17 @@ const pagesRules = [
363
373
  ];
364
374
  const R = "Lists or shows; changes nothing";
365
375
  const LOCAL = "Runs on this computer only";
376
+ /** Wrangler 4.169.0's whole command tree (docs/design/zero-unknowns.md): flags, aliases and usage lines. */
377
+ export const CLOUDFLARE_TREE = TREE;
378
+ const tables = treeTables(CLOUDFLARE_TREE);
379
+ const HAND_RULES = [...workerRules, ...storageRules, ...pagesRules];
380
+ /** Every pinned command no hand rule names: the overlay's reads, local commands and "Other change" rules. */
381
+ const OVERLAY = cloudflareOverlayCapture(CLOUDFLARE_TREE, OTHER, new Set(HAND_RULES.map((rule) => rule.match)));
382
+ const HAND_GLOBAL = CLI.global;
366
383
  export const CLOUDFLARE_CLI = {
367
384
  programs: ["wrangler"],
368
385
  framework: "cobra",
369
- aliases: CLI.aliases,
386
+ aliases: mergeAliases(tables.aliases ?? {}, CLI.aliases),
370
387
  contextFlags: ["config", "cwd"],
371
388
  // Documented by Cloudflare: the account a command acts on. Any other CLOUDFLARE_* or WRANGLER_* variable set on the
372
389
  // line fails closed; credentials are never read.
@@ -386,12 +403,18 @@ export const CLOUDFLARE_CLI = {
386
403
  { file: "wrangler.json", format: "json", fields: { name: "script", account_id: "account" } }
387
404
  ],
388
405
  infoFlags: ["help", "version"],
389
- usage: CLI.usage,
390
- flags: { global: CLI.global, commands: CLI.commands },
406
+ usage: { ...tables.usage, ...CLI.usage },
407
+ // The reviewed flags (`cli-flags.json`) win over the tree's where both name one.
408
+ flags: {
409
+ global: [...HAND_GLOBAL, ...tables.flags.global.filter((spec) => !HAND_GLOBAL.some((g) => g.long === spec.long))],
410
+ commands: mergeFlags(tables.flags.commands, CLI.commands)
411
+ },
391
412
  remoteFlags: ["remote"],
392
413
  localFlags: ["local", "dry-run"],
393
- rules: [...workerRules, ...storageRules, ...pagesRules],
414
+ rules: [...HAND_RULES, ...OVERLAY.rules],
394
415
  reads: {
416
+ ...Object.fromEntries(treeGroups(CLOUDFLARE_TREE).map((group) => [group, "Prints its subcommands"])),
417
+ ...OVERLAY.reads,
395
418
  "versions list": R,
396
419
  "versions view": R,
397
420
  "versions secret list": "Lists secret names; never their values",
@@ -406,8 +429,6 @@ export const CLOUDFLARE_CLI = {
406
429
  types: LOCAL,
407
430
  init: LOCAL,
408
431
  docs: "Opens the docs",
409
- "check startup": LOCAL,
410
- build: LOCAL,
411
432
  "kv namespace list": R,
412
433
  "kv key get": R,
413
434
  "kv key list": R,
@@ -0,0 +1,17 @@
1
+ import type { Effect } from "../../controlPlaneActions.generated.js";
2
+ import type { CaptureRule } from "../manifest.generated.js";
3
+ import type { CliTree, CommandEffect } from "../cliTree.generated.js";
4
+ /** The Worker's own commands, and the bucket or queue a command's group names: where an overlay rule
5
+ * lands (first prefix wins; anything else is the platform). */
6
+ export declare const CLOUDFLARE_CLI_PLACES: ReadonlyArray<readonly [prefix: string, place: Pick<CaptureRule, "on" | "args">]>;
7
+ export declare const CLOUDFLARE_COMMANDS: Readonly<Record<string, CommandEffect>>;
8
+ /** Where an overlay command lands, and the positional arguments its place reads. */
9
+ export declare function cloudflarePlace(command: string): Pick<CaptureRule, "on" | "args">;
10
+ /** The capture rules and reads the overlay adds for commands no hand rule names. A command whose tree flags include
11
+ * `--remote` runs against the local simulator until it is given (Wrangler 4's convention). */
12
+ export declare function cloudflareOverlayCapture(tree: CliTree, other: string, ruled: ReadonlySet<string>): {
13
+ rules: CaptureRule[];
14
+ reads: Record<string, string>;
15
+ };
16
+ /** The (action, summary, effects) rows the overlay gives the server's call-effects table. */
17
+ export declare function cloudflareCommandCallEffects(other: string): Array<[string, string, readonly Effect[]]>;