vercel 51.2.0 → 51.3.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 (70) hide show
  1. package/dist/chunks/add-3MIOUOZC.js +180 -0
  2. package/dist/chunks/{chunk-K4IC7LFB.js → chunk-2JQVASXJ.js} +13 -8
  3. package/dist/chunks/{chunk-Q6BEDVOU.js → chunk-4PQA6H63.js} +1 -1
  4. package/dist/chunks/{chunk-IS2HEMF4.js → chunk-4RBF6ZDU.js} +4 -2
  5. package/dist/chunks/{chunk-V23RAVWV.js → chunk-4VP55L4V.js} +211 -504
  6. package/dist/chunks/{chunk-TBW2XDGN.js → chunk-4WRHMYCG.js} +6 -6
  7. package/dist/chunks/chunk-4ZWTYJSP.js +139 -0
  8. package/dist/chunks/{chunk-7IDNCLTM.js → chunk-APGVHLAW.js} +2 -2
  9. package/dist/chunks/{chunk-UZIEJEMY.js → chunk-BAUYQ7AR.js} +1 -1
  10. package/dist/chunks/{chunk-BUBUVE23.js → chunk-BJQTGP42.js} +4 -2
  11. package/dist/chunks/{chunk-WOFF2NEI.js → chunk-BU3JMDDH.js} +3 -3
  12. package/dist/chunks/chunk-CGTXAXZ4.js +484 -0
  13. package/dist/chunks/{chunk-BQUQ5F7R.js → chunk-CRZM5WM2.js} +4 -2
  14. package/dist/chunks/{chunk-RQTDTSAX.js → chunk-CZXW3DJH.js} +2 -2
  15. package/dist/chunks/chunk-DVQ4SIWF.js +183 -0
  16. package/dist/chunks/{chunk-TWZWQGBN.js → chunk-E3NE4SKN.js} +3 -0
  17. package/dist/chunks/{chunk-A4NVECX5.js → chunk-ECRBC4HL.js} +4 -581
  18. package/dist/chunks/{chunk-65IHMJX4.js → chunk-FNFZO3WQ.js} +7 -5
  19. package/dist/chunks/{chunk-L2BKVTHL.js → chunk-G6RXZLQ2.js} +2 -2
  20. package/dist/chunks/{chunk-4YZKA4FN.js → chunk-GE6G37P4.js} +1 -1
  21. package/dist/chunks/{chunk-NELCIT4M.js → chunk-GLDQ23LD.js} +1 -1
  22. package/dist/chunks/{chunk-D7SZ3DXR.js → chunk-GYBFQLYR.js} +6 -4
  23. package/dist/chunks/{chunk-ZL5SYUAG.js → chunk-JEON5XEH.js} +44 -13
  24. package/dist/chunks/{chunk-Y5YCSB6X.js → chunk-LDXYSGPZ.js} +2 -2
  25. package/dist/chunks/{chunk-U5J73OA3.js → chunk-N45K6NXC.js} +1 -1
  26. package/dist/chunks/{chunk-YKKQGGLZ.js → chunk-NCQBQGI6.js} +2 -2
  27. package/dist/chunks/chunk-NE34PEHL.js +167 -0
  28. package/dist/chunks/{chunk-A5XRYFVO.js → chunk-OFUQPP26.js} +10 -6
  29. package/dist/chunks/{chunk-NYO5XRBQ.js → chunk-R2BVH5SQ.js} +1 -1
  30. package/dist/chunks/chunk-RFMC2QXQ.js +602 -0
  31. package/dist/chunks/{chunk-XHMU7WUB.js → chunk-RHXEHBO3.js} +8 -6
  32. package/dist/chunks/{chunk-5CRSHCRD.js → chunk-RRYVGOVK.js} +1 -1
  33. package/dist/chunks/{chunk-3PEFANXY.js → chunk-T7CL42FK.js} +5 -5
  34. package/dist/chunks/{chunk-WXNT7WJO.js → chunk-TAOVG4PS.js} +49 -4
  35. package/dist/chunks/{chunk-6DIXPIXB.js → chunk-UB325PS7.js} +1 -1
  36. package/dist/chunks/{chunk-2IAZZEVQ.js → chunk-UWKTUK3W.js} +4 -2
  37. package/dist/chunks/{chunk-VE7MY76H.js → chunk-VGWGLBUC.js} +4 -2
  38. package/dist/chunks/{chunk-F2ROYUW2.js → chunk-VMTOBGCO.js} +425 -28
  39. package/dist/chunks/{chunk-XMVSCINT.js → chunk-ZS5VKEZL.js} +5 -3
  40. package/dist/chunks/{compile-vercel-config-6FEECIZK.js → compile-vercel-config-A2SLMCWK.js} +4 -2
  41. package/dist/chunks/{delete-J2N2QXMP.js → delete-SEQBCYWT.js} +8 -6
  42. package/dist/chunks/{disable-QGYXQKAM.js → disable-GRM5DJGU.js} +8 -6
  43. package/dist/chunks/{discard-ZDGJB5US.js → discard-IVQWWSPI.js} +8 -6
  44. package/dist/chunks/{edit-RJWDA5KJ.js → edit-YTMZBT4Y.js} +9 -7
  45. package/dist/chunks/{enable-L33HPTXB.js → enable-SSU3MG6J.js} +8 -6
  46. package/dist/chunks/{export-Z5C4BJ2U.js → export-INCDZTYW.js} +8 -6
  47. package/dist/chunks/inspect-QMY2ZE6J.js +353 -0
  48. package/dist/chunks/{list-HXN64DKX.js → list-FF4VGSZ2.js} +115 -85
  49. package/dist/chunks/{list-4P2TW77C.js → list-MMIBPSB3.js} +10 -7
  50. package/dist/chunks/ls-TYEDISJD.js +114 -0
  51. package/dist/chunks/{publish-TLVHQB2H.js → publish-OJQCVDL5.js} +8 -6
  52. package/dist/chunks/{query-SDKQTWN2.js → query-LACPOOBL.js} +15 -12
  53. package/dist/chunks/{reorder-UHMUFYIW.js → reorder-TBFWHFQZ.js} +8 -6
  54. package/dist/chunks/{restore-762GO6HU.js → restore-5LUZRUME.js} +8 -6
  55. package/dist/chunks/rm-LDXY2G45.js +164 -0
  56. package/dist/chunks/rule-inspect-THIN6POX.js +142 -0
  57. package/dist/chunks/rules-4ZH7VTGC.js +83 -0
  58. package/dist/chunks/{schema-WBOIQRP4.js → schema-OK4OOI2N.js} +9 -7
  59. package/dist/chunks/{types-A4EAQ6F6.js → types-QNN5CDCB.js} +6 -4
  60. package/dist/chunks/update-EXPUPEH6.js +196 -0
  61. package/dist/commands/build/index.js +28 -24
  62. package/dist/commands/deploy/index.js +172 -33
  63. package/dist/commands/dev/index.js +21 -17
  64. package/dist/commands/env/index.js +32 -27
  65. package/dist/commands/link/index.js +21 -17
  66. package/dist/commands/list/index.js +14 -11
  67. package/dist/commands-bulk.js +4566 -1816
  68. package/dist/index.js +38 -24
  69. package/dist/version.mjs +1 -1
  70. package/package.json +18 -18
@@ -0,0 +1,484 @@
1
+ import { createRequire as __createRequire } from 'node:module';
2
+ import { fileURLToPath as __fileURLToPath } from 'node:url';
3
+ import { dirname as __dirname_ } from 'node:path';
4
+ const require = __createRequire(import.meta.url);
5
+ const __filename = __fileURLToPath(import.meta.url);
6
+ const __dirname = __dirname_(__filename);
7
+ import {
8
+ LinkRequiredError,
9
+ ProjectNotFound,
10
+ isAPIError,
11
+ packageName
12
+ } from "./chunk-ECRBC4HL.js";
13
+ import {
14
+ require_dist
15
+ } from "./chunk-ZQKJVHXY.js";
16
+ import {
17
+ __toESM
18
+ } from "./chunk-TZ2YI2VH.js";
19
+
20
+ // src/util/agent-output.ts
21
+ var import_error_utils = __toESM(require_dist(), 1);
22
+ function buildCommandWithYes(argv, pkgName = packageName) {
23
+ const args = argv.slice(2);
24
+ const hasYes = args.some((a) => a === "--yes" || a === "-y");
25
+ const out = hasYes ? [...args] : [...args, "--yes"];
26
+ return `${pkgName} ${out.join(" ")}`;
27
+ }
28
+ var GLOBAL_FLAG_NAMES = /* @__PURE__ */ new Set([
29
+ "--cwd",
30
+ "--config",
31
+ "--yes",
32
+ "-y",
33
+ "--non-interactive",
34
+ "--scope",
35
+ "--team",
36
+ "-S",
37
+ "-T",
38
+ "--token"
39
+ ]);
40
+ var BOOLEAN_GLOBAL_FLAG_NAMES = /* @__PURE__ */ new Set(["--yes", "-y", "--non-interactive"]);
41
+ function getGlobalFlagsFromArgv(argv) {
42
+ const args = argv.slice(2);
43
+ const out = [];
44
+ for (let i = 0; i < args.length; i++) {
45
+ const arg = args[i];
46
+ const name = arg.startsWith("--") ? arg.split("=")[0] : arg;
47
+ if (GLOBAL_FLAG_NAMES.has(name)) {
48
+ out.push(arg);
49
+ const takesSeparateValue = !BOOLEAN_GLOBAL_FLAG_NAMES.has(name) && !arg.includes("=") && i + 1 < args.length && !args[i + 1].startsWith("-");
50
+ if (takesSeparateValue) {
51
+ out.push(args[i + 1]);
52
+ i++;
53
+ }
54
+ }
55
+ }
56
+ return out;
57
+ }
58
+ function omitGlobalFlagsFromArgs(args) {
59
+ const out = [];
60
+ for (let i = 0; i < args.length; i++) {
61
+ const arg = args[i];
62
+ const name = arg.startsWith("--") ? arg.split("=")[0] : arg;
63
+ if (GLOBAL_FLAG_NAMES.has(name)) {
64
+ const skipSeparateValue = !BOOLEAN_GLOBAL_FLAG_NAMES.has(name) && !arg.includes("=") && i + 1 < args.length && !args[i + 1].startsWith("-");
65
+ if (skipSeparateValue) {
66
+ i++;
67
+ }
68
+ continue;
69
+ }
70
+ out.push(arg);
71
+ }
72
+ return out;
73
+ }
74
+ function buildIntegrationCommandTailFromArgv(argv) {
75
+ const args = argv.slice(2);
76
+ const idx = args.indexOf("integration");
77
+ if (idx === -1) {
78
+ return "integration";
79
+ }
80
+ return omitGlobalFlagsFromArgs(args.slice(idx)).join(" ");
81
+ }
82
+ function buildCommandWithGlobalFlags(argv, commandTemplate, pkgName = packageName, options) {
83
+ let preserved = getGlobalFlagsFromArgv(argv);
84
+ if (options?.excludeFlags?.length) {
85
+ const exclude = new Set(options.excludeFlags);
86
+ const out = [];
87
+ for (let i = 0; i < preserved.length; i++) {
88
+ const arg = preserved[i];
89
+ const name = arg.startsWith("--") ? arg.split("=")[0] : arg;
90
+ if (exclude.has(name)) {
91
+ if (!arg.includes("=") && i + 1 < preserved.length && !preserved[i + 1].startsWith("-")) {
92
+ i++;
93
+ }
94
+ continue;
95
+ }
96
+ out.push(arg);
97
+ }
98
+ preserved = out;
99
+ }
100
+ const base = `${pkgName} ${commandTemplate}`;
101
+ if (preserved.length === 0) {
102
+ return base;
103
+ }
104
+ if (options?.prependGlobalFlags) {
105
+ return `${pkgName} ${preserved.join(" ")} ${commandTemplate}`;
106
+ }
107
+ return `${base} ${preserved.join(" ")}`;
108
+ }
109
+ function getPreservedArgsForEnvAdd(argv) {
110
+ const args = argv.slice(2);
111
+ const addIdx = args.indexOf("add");
112
+ if (addIdx === -1 || args[addIdx - 1] !== "env")
113
+ return args;
114
+ let i = addIdx + 1;
115
+ let positionals = 0;
116
+ while (i < args.length && positionals < 3 && !args[i].startsWith("-")) {
117
+ positionals++;
118
+ i++;
119
+ }
120
+ return args.slice(i);
121
+ }
122
+ function buildEnvAddCommandWithPreservedArgs(argv, commandTemplate, pkgName = packageName) {
123
+ let preserved = getPreservedArgsForEnvAdd(argv);
124
+ if (commandTemplate.includes("--yes")) {
125
+ preserved = preserved.filter((a) => a !== "--yes" && a !== "-y");
126
+ }
127
+ if (commandTemplate.includes("--value")) {
128
+ const out = [];
129
+ for (let j = 0; j < preserved.length; j++) {
130
+ if (preserved[j] === "--value" && j + 1 < preserved.length) {
131
+ j++;
132
+ continue;
133
+ }
134
+ if (preserved[j].startsWith("--value="))
135
+ continue;
136
+ out.push(preserved[j]);
137
+ }
138
+ preserved = out;
139
+ }
140
+ const base = `${pkgName} ${commandTemplate}`;
141
+ if (preserved.length === 0)
142
+ return base;
143
+ return `${base} ${preserved.join(" ")}`;
144
+ }
145
+ function getPreservedArgsForEnvPull(argv) {
146
+ const args = argv.slice(2);
147
+ const pullIdx = args.indexOf("pull");
148
+ if (pullIdx === -1 || args[pullIdx - 1] !== "env")
149
+ return args;
150
+ let i = pullIdx + 1;
151
+ if (i < args.length && !args[i].startsWith("-"))
152
+ i++;
153
+ return args.slice(i);
154
+ }
155
+ function getPreservedArgsForEnvRm(argv) {
156
+ const args = argv.slice(2);
157
+ const rmIdx = args.indexOf("rm");
158
+ if (rmIdx === -1 || args[rmIdx - 1] !== "env")
159
+ return args;
160
+ let i = rmIdx + 1;
161
+ let positionals = 0;
162
+ while (i < args.length && positionals < 3 && !args[i].startsWith("-")) {
163
+ positionals++;
164
+ i++;
165
+ }
166
+ return args.slice(i);
167
+ }
168
+ function buildEnvRmCommandWithPreservedArgs(argv, commandTemplate, pkgName = packageName) {
169
+ let preserved = getPreservedArgsForEnvRm(argv);
170
+ if (commandTemplate.includes("--yes")) {
171
+ preserved = preserved.filter((a) => a !== "--yes" && a !== "-y");
172
+ }
173
+ const base = `${pkgName} ${commandTemplate}`;
174
+ if (preserved.length === 0)
175
+ return base;
176
+ return `${base} ${preserved.join(" ")}`;
177
+ }
178
+ function getPreservedArgsForEnvUpdate(argv) {
179
+ const args = argv.slice(2);
180
+ const updateIdx = args.indexOf("update");
181
+ if (updateIdx === -1 || args[updateIdx - 1] !== "env")
182
+ return args;
183
+ let i = updateIdx + 1;
184
+ let positionals = 0;
185
+ while (i < args.length && positionals < 3 && !args[i].startsWith("-")) {
186
+ positionals++;
187
+ i++;
188
+ }
189
+ return args.slice(i);
190
+ }
191
+ function buildEnvUpdateCommandWithPreservedArgs(argv, commandTemplate, pkgName = packageName) {
192
+ let preserved = getPreservedArgsForEnvUpdate(argv);
193
+ if (commandTemplate.includes("--yes")) {
194
+ preserved = preserved.filter((a) => a !== "--yes" && a !== "-y");
195
+ }
196
+ if (commandTemplate.includes("--value")) {
197
+ const out = [];
198
+ for (let i = 0; i < preserved.length; i++) {
199
+ if (preserved[i] === "--value" && i + 1 < preserved.length) {
200
+ i++;
201
+ continue;
202
+ }
203
+ if (preserved[i].startsWith("--value="))
204
+ continue;
205
+ out.push(preserved[i]);
206
+ }
207
+ preserved = out;
208
+ }
209
+ const base = `${pkgName} ${commandTemplate}`;
210
+ if (preserved.length === 0)
211
+ return base;
212
+ return `${base} ${preserved.join(" ")}`;
213
+ }
214
+ function buildCommandWithScope(argv, scopeSlug, pkgName = packageName) {
215
+ const args = argv.slice(2);
216
+ const out = [];
217
+ for (let i = 0; i < args.length; i++) {
218
+ if (args[i] === "--scope" || args[i] === "--team" || args[i] === "-S" || args[i] === "-T") {
219
+ i++;
220
+ continue;
221
+ }
222
+ if (args[i].startsWith("--scope=") || args[i].startsWith("--team=")) {
223
+ continue;
224
+ }
225
+ out.push(args[i]);
226
+ }
227
+ out.push("--scope", scopeSlug);
228
+ return `${pkgName} ${out.join(" ")}`;
229
+ }
230
+ function enrichActionRequiredWithInvokingCommand(payload, argv) {
231
+ if (!payload.choices?.length) {
232
+ return payload;
233
+ }
234
+ const next = [];
235
+ const linkArgv = [...argv.slice(0, 2), "link", ...argv.slice(3)];
236
+ for (const choice of payload.choices) {
237
+ const slug = choice.name;
238
+ next.push({
239
+ command: buildCommandWithScope(linkArgv, slug),
240
+ when: "Link first (then run any command without --scope)"
241
+ });
242
+ next.push({
243
+ command: buildCommandWithScope(argv, slug),
244
+ when: "Run this command with scope (no link)"
245
+ });
246
+ }
247
+ return { ...payload, next };
248
+ }
249
+ function outputActionRequired(client, payload, exitCode = 1) {
250
+ if (!shouldEmitNonInteractiveCommandError(client)) {
251
+ return;
252
+ }
253
+ const enriched = enrichActionRequiredWithInvokingCommand(
254
+ payload,
255
+ client.argv
256
+ );
257
+ if (!enriched.hint && enriched.next?.length) {
258
+ enriched.hint = "Run one of the commands in next[] to complete without prompting.";
259
+ }
260
+ client.stdout.write(`${JSON.stringify(enriched, null, 2)}
261
+ `);
262
+ process.exit(exitCode);
263
+ }
264
+ function argvHasNonInteractive(argv) {
265
+ if (!argv?.length) {
266
+ return false;
267
+ }
268
+ for (let i = 0; i < argv.length; i++) {
269
+ const a = argv[i];
270
+ if (a === "--non-interactive") {
271
+ return argv[i + 1] !== "false";
272
+ }
273
+ if (a.startsWith("--non-interactive=")) {
274
+ return a.slice("--non-interactive=".length) !== "false";
275
+ }
276
+ }
277
+ return false;
278
+ }
279
+ function shouldEmitNonInteractiveCommandError(client) {
280
+ return client.nonInteractive || argvHasNonInteractive(client.argv ?? []);
281
+ }
282
+ function outputAgentError(client, payload, exitCode = 1) {
283
+ if (!shouldEmitNonInteractiveCommandError(client)) {
284
+ return;
285
+ }
286
+ client.stdout.write(`${JSON.stringify(payload, null, 2)}
287
+ `);
288
+ process.exit(exitCode);
289
+ }
290
+ function buildNextStepsForEdgeConfig(client) {
291
+ return [
292
+ {
293
+ command: buildCommandWithGlobalFlags(client.argv, "edge-config list"),
294
+ when: "List Edge Config stores in the current team scope"
295
+ },
296
+ {
297
+ command: buildCommandWithGlobalFlags(client.argv, "teams switch"),
298
+ when: "Switch to the team that owns the Edge Config"
299
+ },
300
+ {
301
+ command: buildCommandWithGlobalFlags(client.argv, "whoami"),
302
+ when: "Verify the current team or user scope"
303
+ }
304
+ ];
305
+ }
306
+ var EDGE_CONFIG_NON_INTERACTIVE_HINT = "Edge Config commands use your current team scope. Pass --scope or run `vercel teams switch` if the store is missing.";
307
+ function buildNextStepsForProjectSubcommands(client, variant) {
308
+ const byName = variant === "access-groups" ? {
309
+ template: "project access-groups <name>",
310
+ when: "List access groups by project name (replace <name>)"
311
+ } : variant === "access-summary" ? {
312
+ template: "project access-summary <name>",
313
+ when: "Show role counts by project name (replace <name>)"
314
+ } : variant === "protection" ? {
315
+ template: "project protection <name>",
316
+ when: "Show deployment protection by project name (replace <name>)"
317
+ } : variant === "speed-insights" ? {
318
+ template: "project speed-insights <name>",
319
+ when: "Enable Speed Insights by project name (replace <name>)"
320
+ } : variant === "web-analytics" ? {
321
+ template: "project web-analytics <name>",
322
+ when: "Enable Web Analytics by project name (replace <name>)"
323
+ } : variant === "checks" ? {
324
+ template: "project checks add <name>",
325
+ when: "Create a deployment check by project name (replace <name>)"
326
+ } : {
327
+ template: "project members <name>",
328
+ when: "List members by project name (replace <name>)"
329
+ };
330
+ return [
331
+ {
332
+ command: buildCommandWithGlobalFlags(client.argv, "link"),
333
+ when: "Re-link this directory to the correct Vercel project"
334
+ },
335
+ {
336
+ command: buildCommandWithGlobalFlags(client.argv, byName.template),
337
+ when: byName.when
338
+ },
339
+ {
340
+ command: buildCommandWithGlobalFlags(client.argv, "project ls"),
341
+ when: "List projects in the current team to pick a name"
342
+ }
343
+ ];
344
+ }
345
+ var PROJECT_SUBCOMMAND_ERROR_HINT = "If you use --cwd, ensure that folder is linked to the right project, or pass an explicit project name. Use --scope when the project belongs to another team.";
346
+ function resolveNonInteractiveDefaults(client, variant) {
347
+ if (variant === "edge-config") {
348
+ return {
349
+ next: buildNextStepsForEdgeConfig(client),
350
+ hint: EDGE_CONFIG_NON_INTERACTIVE_HINT
351
+ };
352
+ }
353
+ return {
354
+ next: buildNextStepsForProjectSubcommands(client, variant),
355
+ hint: PROJECT_SUBCOMMAND_ERROR_HINT
356
+ };
357
+ }
358
+ function writeAgentErrorPayloadAndExit(client, payload, exitCode, variant) {
359
+ const defaults = resolveNonInteractiveDefaults(client, variant);
360
+ const out = {
361
+ ...payload,
362
+ next: payload.next ?? defaults.next,
363
+ hint: payload.hint ?? defaults.hint
364
+ };
365
+ client.stdout.write(`${JSON.stringify(out, null, 2)}
366
+ `);
367
+ process.exit(exitCode);
368
+ }
369
+ function isProjectNotFoundLike(err) {
370
+ if (err instanceof ProjectNotFound) {
371
+ return true;
372
+ }
373
+ if ((0, import_error_utils.isError)(err) && "code" in err && err.code === "PROJECT_NOT_FOUND") {
374
+ return true;
375
+ }
376
+ return false;
377
+ }
378
+ function isLinkRequiredLike(err) {
379
+ return err instanceof LinkRequiredError;
380
+ }
381
+ function normalizeApiErrorText(message) {
382
+ return message.replace(/\s*\(\d{3}\)\s*$/, "").trim();
383
+ }
384
+ function exitWithNonInteractiveError(client, err, exitCode = 1, options = {
385
+ variant: "members"
386
+ }) {
387
+ if (!shouldEmitNonInteractiveCommandError(client)) {
388
+ return;
389
+ }
390
+ const { variant } = options;
391
+ if (isLinkRequiredLike(err)) {
392
+ if (variant === "edge-config") {
393
+ writeAgentErrorPayloadAndExit(
394
+ client,
395
+ {
396
+ status: "error",
397
+ reason: "link_required",
398
+ message: err instanceof Error ? err.message : String(err),
399
+ next: buildNextStepsForEdgeConfig(client),
400
+ hint: EDGE_CONFIG_NON_INTERACTIVE_HINT
401
+ },
402
+ exitCode,
403
+ "edge-config"
404
+ );
405
+ return;
406
+ }
407
+ writeAgentErrorPayloadAndExit(
408
+ client,
409
+ {
410
+ status: "error",
411
+ reason: "link_required",
412
+ message: err instanceof Error ? err.message : String(err)
413
+ },
414
+ exitCode,
415
+ variant
416
+ );
417
+ return;
418
+ }
419
+ if (isProjectNotFoundLike(err)) {
420
+ writeAgentErrorPayloadAndExit(
421
+ client,
422
+ {
423
+ status: "error",
424
+ reason: "project_not_found",
425
+ message: err instanceof Error ? err.message : String(err)
426
+ },
427
+ exitCode,
428
+ variant
429
+ );
430
+ return;
431
+ }
432
+ if (isAPIError(err)) {
433
+ const rawMessage = err.serverMessage || err.message;
434
+ const message = normalizeApiErrorText(rawMessage);
435
+ const reason = err.status === 403 ? "forbidden" : err.status === 401 ? "not_authorized" : err.status === 404 ? variant === "edge-config" ? "not_found" : "project_not_found" : err.status === 429 ? "rate_limited" : "api_error";
436
+ writeAgentErrorPayloadAndExit(
437
+ client,
438
+ {
439
+ status: "error",
440
+ reason,
441
+ message
442
+ },
443
+ exitCode,
444
+ variant
445
+ );
446
+ }
447
+ writeAgentErrorPayloadAndExit(
448
+ client,
449
+ {
450
+ status: "error",
451
+ reason: "unexpected_error",
452
+ message: err instanceof Error ? err.message : String(err)
453
+ },
454
+ exitCode,
455
+ variant
456
+ );
457
+ }
458
+ function openUrlInBrowserCommand(url) {
459
+ if (process.platform === "win32")
460
+ return `start ${url}`;
461
+ if (process.platform === "darwin")
462
+ return `open '${url}'`;
463
+ return `xdg-open '${url}'`;
464
+ }
465
+
466
+ export {
467
+ buildCommandWithYes,
468
+ getGlobalFlagsFromArgv,
469
+ buildIntegrationCommandTailFromArgv,
470
+ buildCommandWithGlobalFlags,
471
+ getPreservedArgsForEnvAdd,
472
+ buildEnvAddCommandWithPreservedArgs,
473
+ getPreservedArgsForEnvPull,
474
+ getPreservedArgsForEnvRm,
475
+ buildEnvRmCommandWithPreservedArgs,
476
+ getPreservedArgsForEnvUpdate,
477
+ buildEnvUpdateCommandWithPreservedArgs,
478
+ outputActionRequired,
479
+ argvHasNonInteractive,
480
+ shouldEmitNonInteractiveCommandError,
481
+ outputAgentError,
482
+ exitWithNonInteractiveError,
483
+ openUrlInBrowserCommand
484
+ };
@@ -5,9 +5,11 @@ const require = __createRequire(import.meta.url);
5
5
  const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __dirname_(__filename);
7
7
  import {
8
- packageName,
9
8
  yesOption
10
- } from "./chunk-A4NVECX5.js";
9
+ } from "./chunk-RFMC2QXQ.js";
10
+ import {
11
+ packageName
12
+ } from "./chunk-ECRBC4HL.js";
11
13
 
12
14
  // src/commands/routes/command.ts
13
15
  var listSubcommand = {
@@ -6,11 +6,11 @@ const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __dirname_(__filename);
7
7
  import {
8
8
  STANDARD_ENVIRONMENTS
9
- } from "./chunk-V23RAVWV.js";
9
+ } from "./chunk-4VP55L4V.js";
10
10
  import {
11
11
  getCommandName,
12
12
  require_lib
13
- } from "./chunk-A4NVECX5.js";
13
+ } from "./chunk-ECRBC4HL.js";
14
14
  import {
15
15
  output_manager_default
16
16
  } from "./chunk-ZQKJVHXY.js";
@@ -0,0 +1,183 @@
1
+ import { createRequire as __createRequire } from 'node:module';
2
+ import { fileURLToPath as __fileURLToPath } from 'node:url';
3
+ import { dirname as __dirname_ } from 'node:path';
4
+ const require = __createRequire(import.meta.url);
5
+ const __filename = __fileURLToPath(import.meta.url);
6
+ const __dirname = __dirname_(__filename);
7
+ import {
8
+ formatOption,
9
+ yesOption
10
+ } from "./chunk-RFMC2QXQ.js";
11
+ import {
12
+ packageName
13
+ } from "./chunk-ECRBC4HL.js";
14
+
15
+ // src/commands/alerts/rules/command.ts
16
+ var scopeOptions = [
17
+ {
18
+ name: "project",
19
+ shorthand: "p",
20
+ type: String,
21
+ argument: "NAME_OR_ID",
22
+ deprecated: false,
23
+ description: "Project scope (overrides linked project). Requires team context."
24
+ },
25
+ {
26
+ name: "all",
27
+ shorthand: "a",
28
+ type: Boolean,
29
+ deprecated: false,
30
+ description: "Team-wide rules only (omit project filter; ignore linked project)."
31
+ }
32
+ ];
33
+ var rulesLsSubcommand = {
34
+ name: "ls",
35
+ aliases: ["list"],
36
+ description: "List alert rules for the current scope",
37
+ arguments: [],
38
+ options: [...scopeOptions, formatOption],
39
+ examples: [
40
+ {
41
+ name: "List rules for the linked project",
42
+ value: `${packageName} alerts rules ls`
43
+ },
44
+ {
45
+ name: "List team-wide rules",
46
+ value: `${packageName} alerts rules ls --all`
47
+ },
48
+ {
49
+ name: "JSON output",
50
+ value: `${packageName} alerts rules ls --format json`
51
+ }
52
+ ]
53
+ };
54
+ var rulesAddSubcommand = {
55
+ name: "add",
56
+ aliases: ["create"],
57
+ description: "Create an alert rule from a JSON body file",
58
+ arguments: [],
59
+ options: [
60
+ ...scopeOptions,
61
+ formatOption,
62
+ {
63
+ name: "body",
64
+ shorthand: null,
65
+ type: String,
66
+ argument: "PATH",
67
+ deprecated: false,
68
+ description: "Path to JSON for the new rule. Do not include id or teamId; the API assigns them."
69
+ }
70
+ ],
71
+ examples: [
72
+ {
73
+ name: "Create from file",
74
+ value: `${packageName} alerts rules add --body ./rule.json`
75
+ }
76
+ ]
77
+ };
78
+ var rulesInspectSubcommand = {
79
+ name: "inspect",
80
+ aliases: ["get"],
81
+ description: "Show one alert rule by id",
82
+ arguments: [
83
+ {
84
+ name: "ruleId",
85
+ required: true
86
+ }
87
+ ],
88
+ options: [...scopeOptions, formatOption],
89
+ examples: [
90
+ {
91
+ name: "Inspect a rule",
92
+ value: `${packageName} alerts rules inspect ar_abc123`
93
+ },
94
+ {
95
+ name: "JSON output",
96
+ value: `${packageName} alerts rules inspect ar_abc123 --format json`
97
+ }
98
+ ]
99
+ };
100
+ var rulesRmSubcommand = {
101
+ name: "rm",
102
+ aliases: ["remove", "delete"],
103
+ description: "Delete an alert rule",
104
+ arguments: [
105
+ {
106
+ name: "ruleId",
107
+ required: true
108
+ }
109
+ ],
110
+ options: [...scopeOptions, formatOption, yesOption],
111
+ examples: [
112
+ {
113
+ name: "Delete with confirmation",
114
+ value: `${packageName} alerts rules rm ar_abc123`
115
+ },
116
+ {
117
+ name: "Delete without prompt",
118
+ value: `${packageName} alerts rules rm ar_abc123 --yes`
119
+ }
120
+ ]
121
+ };
122
+ var rulesUpdateSubcommand = {
123
+ name: "update",
124
+ aliases: ["patch"],
125
+ description: "Patch an alert rule from a JSON body file",
126
+ arguments: [
127
+ {
128
+ name: "ruleId",
129
+ required: true
130
+ }
131
+ ],
132
+ options: [
133
+ ...scopeOptions,
134
+ formatOption,
135
+ {
136
+ name: "body",
137
+ shorthand: null,
138
+ type: String,
139
+ argument: "PATH",
140
+ deprecated: false,
141
+ description: "Path to JSON with fields to update (partial document)."
142
+ }
143
+ ],
144
+ examples: [
145
+ {
146
+ name: "Update from file",
147
+ value: `${packageName} alerts rules update ar_abc123 --body ./patch.json`
148
+ }
149
+ ]
150
+ };
151
+ var rulesAggregateCommand = {
152
+ name: "rules",
153
+ aliases: [],
154
+ description: "Create, list, update, or delete alert notification rules (dashboard parity).",
155
+ arguments: [],
156
+ subcommands: [
157
+ rulesLsSubcommand,
158
+ rulesAddSubcommand,
159
+ rulesInspectSubcommand,
160
+ rulesRmSubcommand,
161
+ rulesUpdateSubcommand
162
+ ],
163
+ options: [],
164
+ examples: [
165
+ {
166
+ name: "List rules",
167
+ value: `${packageName} alerts rules ls`
168
+ },
169
+ {
170
+ name: "Add a rule",
171
+ value: `${packageName} alerts rules add --body ./rule.json`
172
+ }
173
+ ]
174
+ };
175
+
176
+ export {
177
+ rulesLsSubcommand,
178
+ rulesAddSubcommand,
179
+ rulesInspectSubcommand,
180
+ rulesRmSubcommand,
181
+ rulesUpdateSubcommand,
182
+ rulesAggregateCommand
183
+ };
@@ -58,6 +58,9 @@ var AGENT_REASON = {
58
58
  MISSING_EVENTS: "missing_events",
59
59
  INVALID_URL: "invalid_url",
60
60
  INVALID_EVENT: "invalid_event",
61
+ // AI Gateway
62
+ INVALID_BUDGET: "invalid_budget",
63
+ INVALID_REFRESH_PERIOD: "invalid_refresh_period",
61
64
  // Redirects
62
65
  REDIRECT_NOT_FOUND: "redirect_not_found",
63
66
  VERSION_NOT_FOUND: "version_not_found",