vercel 51.2.1 → 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 (69) hide show
  1. package/dist/chunks/add-3MIOUOZC.js +180 -0
  2. package/dist/chunks/{chunk-W6FW7CCT.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-7S7GE4BN.js → chunk-4VP55L4V.js} +208 -500
  6. package/dist/chunks/{chunk-5YQCJTZI.js → chunk-4WRHMYCG.js} +6 -6
  7. package/dist/chunks/chunk-4ZWTYJSP.js +139 -0
  8. package/dist/chunks/{chunk-3FMFPD7F.js → chunk-APGVHLAW.js} +2 -2
  9. package/dist/chunks/{chunk-5WHDQH2U.js → chunk-BAUYQ7AR.js} +1 -1
  10. package/dist/chunks/{chunk-BUBUVE23.js → chunk-BJQTGP42.js} +4 -2
  11. package/dist/chunks/{chunk-G6MVEB4W.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-XRR5HDB3.js → chunk-CZXW3DJH.js} +2 -2
  15. package/dist/chunks/chunk-DVQ4SIWF.js +183 -0
  16. package/dist/chunks/{chunk-A4NVECX5.js → chunk-ECRBC4HL.js} +4 -581
  17. package/dist/chunks/{chunk-RK4TKB3D.js → chunk-FNFZO3WQ.js} +7 -5
  18. package/dist/chunks/{chunk-L2BKVTHL.js → chunk-G6RXZLQ2.js} +2 -2
  19. package/dist/chunks/{chunk-4YZKA4FN.js → chunk-GE6G37P4.js} +1 -1
  20. package/dist/chunks/{chunk-NELCIT4M.js → chunk-GLDQ23LD.js} +1 -1
  21. package/dist/chunks/{chunk-5DLMAFQU.js → chunk-GYBFQLYR.js} +6 -4
  22. package/dist/chunks/{chunk-XAVGWINL.js → chunk-JEON5XEH.js} +44 -13
  23. package/dist/chunks/{chunk-Y5YCSB6X.js → chunk-LDXYSGPZ.js} +2 -2
  24. package/dist/chunks/{chunk-U5J73OA3.js → chunk-N45K6NXC.js} +1 -1
  25. package/dist/chunks/{chunk-SSOWPEZT.js → chunk-NCQBQGI6.js} +2 -2
  26. package/dist/chunks/chunk-NE34PEHL.js +167 -0
  27. package/dist/chunks/{chunk-QQTF2FEY.js → chunk-OFUQPP26.js} +9 -5
  28. package/dist/chunks/{chunk-FSOFFJDV.js → chunk-R2BVH5SQ.js} +1 -1
  29. package/dist/chunks/chunk-RFMC2QXQ.js +602 -0
  30. package/dist/chunks/{chunk-VTQNSCUG.js → chunk-RHXEHBO3.js} +8 -6
  31. package/dist/chunks/{chunk-K5XJCQQO.js → chunk-RRYVGOVK.js} +1 -1
  32. package/dist/chunks/{chunk-EHZKWVK2.js → chunk-T7CL42FK.js} +5 -5
  33. package/dist/chunks/{chunk-WXNT7WJO.js → chunk-TAOVG4PS.js} +49 -4
  34. package/dist/chunks/{chunk-57RLFBKC.js → chunk-UB325PS7.js} +1 -1
  35. package/dist/chunks/{chunk-2IAZZEVQ.js → chunk-UWKTUK3W.js} +4 -2
  36. package/dist/chunks/{chunk-VE7MY76H.js → chunk-VGWGLBUC.js} +4 -2
  37. package/dist/chunks/{chunk-4EGCWWSR.js → chunk-VMTOBGCO.js} +50 -16
  38. package/dist/chunks/{chunk-W5K4YCTI.js → chunk-ZS5VKEZL.js} +5 -3
  39. package/dist/chunks/{compile-vercel-config-2GV46IDP.js → compile-vercel-config-A2SLMCWK.js} +4 -2
  40. package/dist/chunks/{delete-PXMYSQGR.js → delete-SEQBCYWT.js} +7 -5
  41. package/dist/chunks/{disable-2ZQ4OG4A.js → disable-GRM5DJGU.js} +7 -5
  42. package/dist/chunks/{discard-FQZTZ5HK.js → discard-IVQWWSPI.js} +7 -5
  43. package/dist/chunks/{edit-F3J7Q5SZ.js → edit-YTMZBT4Y.js} +8 -6
  44. package/dist/chunks/{enable-ZW4W33H5.js → enable-SSU3MG6J.js} +7 -5
  45. package/dist/chunks/{export-ZZV6ESIW.js → export-INCDZTYW.js} +7 -5
  46. package/dist/chunks/inspect-QMY2ZE6J.js +353 -0
  47. package/dist/chunks/{list-VFPV4TUW.js → list-FF4VGSZ2.js} +115 -85
  48. package/dist/chunks/{list-SSIMVNNN.js → list-MMIBPSB3.js} +10 -7
  49. package/dist/chunks/ls-TYEDISJD.js +114 -0
  50. package/dist/chunks/{publish-3K76MNS3.js → publish-OJQCVDL5.js} +7 -5
  51. package/dist/chunks/{query-CY7JJSSX.js → query-LACPOOBL.js} +15 -12
  52. package/dist/chunks/{reorder-6L7MENN5.js → reorder-TBFWHFQZ.js} +7 -5
  53. package/dist/chunks/{restore-XUYXOJQ2.js → restore-5LUZRUME.js} +7 -5
  54. package/dist/chunks/rm-LDXY2G45.js +164 -0
  55. package/dist/chunks/rule-inspect-THIN6POX.js +142 -0
  56. package/dist/chunks/rules-4ZH7VTGC.js +83 -0
  57. package/dist/chunks/{schema-G5FSLZVA.js → schema-OK4OOI2N.js} +9 -7
  58. package/dist/chunks/{types-A4EAQ6F6.js → types-QNN5CDCB.js} +6 -4
  59. package/dist/chunks/update-EXPUPEH6.js +196 -0
  60. package/dist/commands/build/index.js +27 -23
  61. package/dist/commands/deploy/index.js +171 -32
  62. package/dist/commands/dev/index.js +21 -17
  63. package/dist/commands/env/index.js +32 -27
  64. package/dist/commands/link/index.js +21 -17
  65. package/dist/commands/list/index.js +14 -11
  66. package/dist/commands-bulk.js +322 -128
  67. package/dist/index.js +28 -24
  68. package/dist/version.mjs +1 -1
  69. package/package.json +19 -19
@@ -0,0 +1,353 @@
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
+ emitAlertsScopeError
9
+ } from "./chunk-NE34PEHL.js";
10
+ import {
11
+ handleValidationError,
12
+ outputError,
13
+ validateAllProjectMutualExclusivity
14
+ } from "./chunk-HTOH3MSD.js";
15
+ import {
16
+ getScope
17
+ } from "./chunk-APGVHLAW.js";
18
+ import {
19
+ validateJsonOutput
20
+ } from "./chunk-XPKWKPWA.js";
21
+ import {
22
+ inspectSubcommand
23
+ } from "./chunk-TAOVG4PS.js";
24
+ import "./chunk-DVQ4SIWF.js";
25
+ import {
26
+ AGENT_REASON
27
+ } from "./chunk-E3NE4SKN.js";
28
+ import {
29
+ getLinkedProject,
30
+ getProjectByNameOrId
31
+ } from "./chunk-4VP55L4V.js";
32
+ import "./chunk-U3WLEFHU.js";
33
+ import {
34
+ buildCommandWithGlobalFlags,
35
+ outputAgentError
36
+ } from "./chunk-CGTXAXZ4.js";
37
+ import "./chunk-CO5D46AG.js";
38
+ import {
39
+ getFlagsSpecification,
40
+ parseArguments,
41
+ printError
42
+ } from "./chunk-RFMC2QXQ.js";
43
+ import {
44
+ ProjectNotFound,
45
+ isAPIError,
46
+ packageName
47
+ } from "./chunk-ECRBC4HL.js";
48
+ import {
49
+ output_manager_default
50
+ } from "./chunk-ZQKJVHXY.js";
51
+ import {
52
+ require_source
53
+ } from "./chunk-S7KYDPEM.js";
54
+ import {
55
+ __toESM
56
+ } from "./chunk-TZ2YI2VH.js";
57
+
58
+ // src/commands/alerts/inspect.ts
59
+ var import_chalk = __toESM(require_source(), 1);
60
+ async function resolveInspectScope(client, flags, jsonOutput) {
61
+ const mutual = validateAllProjectMutualExclusivity(
62
+ flags["--all"],
63
+ flags["--project"]
64
+ );
65
+ if (!mutual.valid) {
66
+ outputAgentError(
67
+ client,
68
+ {
69
+ status: "error",
70
+ reason: AGENT_REASON.INVALID_ARGUMENTS,
71
+ message: mutual.message,
72
+ next: [
73
+ {
74
+ command: buildCommandWithGlobalFlags(
75
+ client.argv,
76
+ "alerts inspect <groupId> --help"
77
+ ),
78
+ when: "Use either `--project` or `--all`, not both"
79
+ }
80
+ ]
81
+ },
82
+ 1
83
+ );
84
+ return handleValidationError(mutual, jsonOutput, client);
85
+ }
86
+ if (flags["--all"]) {
87
+ const { team } = await getScope(client);
88
+ if (!team) {
89
+ const msg = "No team context found. Run `vercel switch` to select a team, or use `vercel link`.";
90
+ return emitAlertsScopeError(client, jsonOutput, "NO_TEAM", msg, {
91
+ reason: AGENT_REASON.MISSING_SCOPE,
92
+ next: [
93
+ {
94
+ command: buildCommandWithGlobalFlags(client.argv, "whoami"),
95
+ when: "See current user and team"
96
+ },
97
+ {
98
+ command: buildCommandWithGlobalFlags(client.argv, "teams switch"),
99
+ when: "Switch to a team that owns the project"
100
+ }
101
+ ]
102
+ });
103
+ }
104
+ return { teamId: team.id };
105
+ }
106
+ if (flags["--project"]) {
107
+ const { team } = await getScope(client);
108
+ if (!team) {
109
+ const msg = "No team context found. Run `vercel switch` to select a team.";
110
+ return emitAlertsScopeError(client, jsonOutput, "NO_TEAM", msg, {
111
+ reason: AGENT_REASON.MISSING_SCOPE,
112
+ next: [
113
+ {
114
+ command: buildCommandWithGlobalFlags(client.argv, "whoami"),
115
+ when: "See current user and team"
116
+ },
117
+ {
118
+ command: buildCommandWithGlobalFlags(client.argv, "teams switch"),
119
+ when: "Switch to a team that owns the project"
120
+ }
121
+ ]
122
+ });
123
+ }
124
+ try {
125
+ const p = await getProjectByNameOrId(client, flags["--project"], team.id);
126
+ if (p instanceof ProjectNotFound) {
127
+ const msg = `Project "${flags["--project"]}" was not found.`;
128
+ return emitAlertsScopeError(
129
+ client,
130
+ jsonOutput,
131
+ "PROJECT_NOT_FOUND",
132
+ msg,
133
+ {
134
+ reason: AGENT_REASON.NOT_FOUND,
135
+ next: [
136
+ {
137
+ command: buildCommandWithGlobalFlags(
138
+ client.argv,
139
+ "alerts inspect <groupId> --project <name_or_id>"
140
+ ),
141
+ when: "Retry with a valid project (replace placeholders)"
142
+ }
143
+ ]
144
+ }
145
+ );
146
+ }
147
+ return { teamId: team.id, projectId: p.id };
148
+ } catch (err) {
149
+ if (isAPIError(err)) {
150
+ const msg = err.serverMessage || (err.status === 403 ? `You do not have permission to access project "${flags["--project"]}" in team "${team.slug}".` : `API error (${err.status}).`);
151
+ const reason = err.status === 401 ? "not_authorized" : err.status === 403 ? "forbidden" : AGENT_REASON.API_ERROR;
152
+ return emitAlertsScopeError(
153
+ client,
154
+ jsonOutput,
155
+ err.code || "API_ERROR",
156
+ msg,
157
+ {
158
+ reason,
159
+ next: [
160
+ {
161
+ command: buildCommandWithGlobalFlags(
162
+ client.argv,
163
+ "alerts inspect <groupId> --project <name_or_id>"
164
+ ),
165
+ when: "Retry with a project you can access"
166
+ }
167
+ ]
168
+ }
169
+ );
170
+ }
171
+ throw err;
172
+ }
173
+ }
174
+ const linked = await getLinkedProject(client);
175
+ if (linked.status === "error") {
176
+ return linked.exitCode;
177
+ }
178
+ if (linked.status === "not_linked") {
179
+ const msg = "No linked project. Run `vercel link` or pass --project <name> or --all.";
180
+ return emitAlertsScopeError(client, jsonOutput, "NOT_LINKED", msg, {
181
+ reason: AGENT_REASON.NOT_LINKED,
182
+ next: [
183
+ {
184
+ command: buildCommandWithGlobalFlags(client.argv, "link"),
185
+ when: "Link this directory to a Vercel project"
186
+ },
187
+ {
188
+ command: buildCommandWithGlobalFlags(
189
+ client.argv,
190
+ "alerts inspect <groupId> --project <name_or_id>"
191
+ ),
192
+ when: "Inspect using an explicit project"
193
+ },
194
+ {
195
+ command: buildCommandWithGlobalFlags(
196
+ client.argv,
197
+ "alerts inspect <groupId> --all"
198
+ ),
199
+ when: "Inspect using team-wide scope"
200
+ }
201
+ ]
202
+ });
203
+ }
204
+ return {
205
+ teamId: linked.org.id,
206
+ projectId: linked.project.id
207
+ };
208
+ }
209
+ async function inspect(client, argv) {
210
+ let parsedArgs;
211
+ const spec = getFlagsSpecification(inspectSubcommand.options);
212
+ try {
213
+ parsedArgs = parseArguments(argv, spec);
214
+ } catch (e) {
215
+ const msg = e instanceof Error ? e.message : String(e);
216
+ const projectFlagMissingArg = msg.includes("--project") && msg.includes("requires argument");
217
+ outputAgentError(
218
+ client,
219
+ {
220
+ status: "error",
221
+ reason: AGENT_REASON.INVALID_ARGUMENTS,
222
+ message: projectFlagMissingArg ? "`--project` requires a project name or id (for example `--project my-app`)." : msg,
223
+ next: projectFlagMissingArg ? [
224
+ {
225
+ command: buildCommandWithGlobalFlags(
226
+ client.argv,
227
+ "alerts inspect <groupId> --project <name-or-id>"
228
+ ),
229
+ when: "Re-run with placeholders replaced"
230
+ }
231
+ ] : [
232
+ {
233
+ command: buildCommandWithGlobalFlags(
234
+ client.argv,
235
+ "alerts inspect --help"
236
+ ),
237
+ when: "See valid `alerts inspect` usage"
238
+ }
239
+ ]
240
+ },
241
+ 1
242
+ );
243
+ printError(e);
244
+ return 1;
245
+ }
246
+ const groupId = parsedArgs.args[0];
247
+ const fr = validateJsonOutput(parsedArgs.flags);
248
+ if (!fr.valid) {
249
+ outputAgentError(
250
+ client,
251
+ {
252
+ status: "error",
253
+ reason: AGENT_REASON.INVALID_ARGUMENTS,
254
+ message: fr.error
255
+ },
256
+ 1
257
+ );
258
+ output_manager_default.error(fr.error);
259
+ return 1;
260
+ }
261
+ if (!groupId) {
262
+ outputAgentError(
263
+ client,
264
+ {
265
+ status: "error",
266
+ reason: AGENT_REASON.MISSING_ARGUMENTS,
267
+ message: `Missing group id. Example: ${packageName} alerts inspect <groupId>`,
268
+ next: [
269
+ {
270
+ command: buildCommandWithGlobalFlags(
271
+ client.argv,
272
+ "alerts inspect <groupId>"
273
+ ),
274
+ when: "Replace <groupId> with a group id from `vercel alerts`"
275
+ }
276
+ ]
277
+ },
278
+ 1
279
+ );
280
+ return outputError(
281
+ client,
282
+ fr.jsonOutput,
283
+ "MISSING_ARGUMENTS",
284
+ "Usage: `vercel alerts inspect <groupId>`"
285
+ );
286
+ }
287
+ const scope = await resolveInspectScope(
288
+ client,
289
+ {
290
+ "--project": parsedArgs.flags["--project"],
291
+ "--all": parsedArgs.flags["--all"]
292
+ },
293
+ fr.jsonOutput
294
+ );
295
+ if (typeof scope === "number") {
296
+ return scope;
297
+ }
298
+ const query = new URLSearchParams({ teamId: scope.teamId });
299
+ if (scope.projectId) {
300
+ query.set("projectId", scope.projectId);
301
+ }
302
+ const path = `/alerts/v3/groups/${encodeURIComponent(groupId)}?${query.toString()}`;
303
+ output_manager_default.spinner("Fetching alert group...");
304
+ try {
305
+ const group = await client.fetch(path);
306
+ if (fr.jsonOutput) {
307
+ client.stdout.write(`${JSON.stringify({ group }, null, 2)}
308
+ `);
309
+ } else {
310
+ output_manager_default.log(`${import_chalk.default.bold("Alert group")} ${import_chalk.default.cyan(groupId)}`);
311
+ client.stdout.write(`${JSON.stringify(group, null, 2)}
312
+ `);
313
+ }
314
+ return 0;
315
+ } catch (err) {
316
+ if (isAPIError(err)) {
317
+ const msg = err.serverMessage || `API error (${err.status}).`;
318
+ const reason = err.status === 401 ? "not_authorized" : err.status === 403 ? "forbidden" : err.status === 404 ? AGENT_REASON.NOT_FOUND : err.status === 429 ? "rate_limited" : AGENT_REASON.API_ERROR;
319
+ outputAgentError(
320
+ client,
321
+ {
322
+ status: "error",
323
+ reason,
324
+ message: msg,
325
+ ...err.status === 401 || err.status === 403 ? {
326
+ hint: "Confirm team scope; use --scope <team-slug> if the group belongs to another team.",
327
+ next: [
328
+ {
329
+ command: buildCommandWithGlobalFlags(client.argv, "whoami"),
330
+ when: "See current user and team"
331
+ },
332
+ {
333
+ command: buildCommandWithGlobalFlags(
334
+ client.argv,
335
+ `alerts inspect ${groupId}`
336
+ ),
337
+ when: "Retry after fixing scope or permissions"
338
+ }
339
+ ]
340
+ } : {}
341
+ },
342
+ 1
343
+ );
344
+ return outputError(client, fr.jsonOutput, err.code || "API_ERROR", msg);
345
+ }
346
+ throw err;
347
+ } finally {
348
+ output_manager_default.stopSpinner();
349
+ }
350
+ }
351
+ export {
352
+ inspect as default
353
+ };
@@ -4,6 +4,9 @@ import { dirname as __dirname_ } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __dirname_(__filename);
7
+ import {
8
+ resolveAlertsScope
9
+ } from "./chunk-NE34PEHL.js";
7
10
  import {
8
11
  handleValidationError,
9
12
  normalizeRepeatableStringFilters,
@@ -13,33 +16,38 @@ import {
13
16
  validateTimeBound,
14
17
  validateTimeOrder
15
18
  } from "./chunk-HTOH3MSD.js";
16
- import {
17
- getScope
18
- } from "./chunk-3FMFPD7F.js";
19
+ import "./chunk-APGVHLAW.js";
19
20
  import {
20
21
  validateJsonOutput
21
22
  } from "./chunk-XPKWKPWA.js";
22
23
  import {
23
24
  alertsCommand
24
- } from "./chunk-WXNT7WJO.js";
25
+ } from "./chunk-TAOVG4PS.js";
26
+ import "./chunk-DVQ4SIWF.js";
25
27
  import {
26
- table
27
- } from "./chunk-4YZKA4FN.js";
28
+ AGENT_REASON
29
+ } from "./chunk-E3NE4SKN.js";
28
30
  import {
29
- getLinkedProject,
30
- getProjectByNameOrId
31
- } from "./chunk-7S7GE4BN.js";
31
+ table
32
+ } from "./chunk-GE6G37P4.js";
33
+ import "./chunk-4VP55L4V.js";
32
34
  import "./chunk-U3WLEFHU.js";
35
+ import {
36
+ buildCommandWithGlobalFlags,
37
+ outputAgentError,
38
+ shouldEmitNonInteractiveCommandError
39
+ } from "./chunk-CGTXAXZ4.js";
33
40
  import {
34
41
  require_ms
35
42
  } from "./chunk-CO5D46AG.js";
36
43
  import {
37
- ProjectNotFound,
38
44
  getFlagsSpecification,
39
- isAPIError,
40
45
  parseArguments,
41
46
  printError
42
- } from "./chunk-A4NVECX5.js";
47
+ } from "./chunk-RFMC2QXQ.js";
48
+ import {
49
+ isAPIError
50
+ } from "./chunk-ECRBC4HL.js";
43
51
  import {
44
52
  output_manager_default
45
53
  } from "./chunk-ZQKJVHXY.js";
@@ -55,6 +63,29 @@ var import_ms = __toESM(require_ms(), 1);
55
63
  var import_chalk = __toESM(require_source(), 1);
56
64
  function handleApiError(err, jsonOutput, client) {
57
65
  const message = err.status === 401 || err.status === 403 ? "You do not have access to alerts in this scope. Pass --token <TOKEN> and --scope <team-slug> with Alerts read access." : err.status >= 500 ? `The alerts endpoint failed on the server (${err.status}). Re-run with --debug and share the x-vercel-id from the failed request.` : err.serverMessage || `API error (${err.status}).`;
66
+ const reason = err.status === 401 ? "not_authorized" : err.status === 403 ? "forbidden" : err.status === 404 ? AGENT_REASON.NOT_FOUND : err.status === 429 ? "rate_limited" : AGENT_REASON.API_ERROR;
67
+ outputAgentError(
68
+ client,
69
+ {
70
+ status: "error",
71
+ reason,
72
+ message,
73
+ ...err.status === 401 || err.status === 403 ? {
74
+ hint: "Confirm team scope; use --scope <team-slug> if alerts belong to another team.",
75
+ next: [
76
+ {
77
+ command: buildCommandWithGlobalFlags(client.argv, "whoami"),
78
+ when: "See current user and team"
79
+ },
80
+ {
81
+ command: buildCommandWithGlobalFlags(client.argv, "alerts"),
82
+ when: "Retry listing alerts after fixing scope or permissions"
83
+ }
84
+ ]
85
+ } : {}
86
+ },
87
+ 1
88
+ );
58
89
  return outputError(client, jsonOutput, err.code || "API_ERROR", message);
59
90
  }
60
91
  function getDefaultRange() {
@@ -62,70 +93,6 @@ function getDefaultRange() {
62
93
  const from = new Date(to.getTime() - 24 * 60 * 60 * 1e3);
63
94
  return { from: from.toISOString(), to: to.toISOString() };
64
95
  }
65
- async function resolveScope(client, opts) {
66
- if (opts.all || opts.project) {
67
- const { team } = await getScope(client);
68
- if (!team) {
69
- return outputError(
70
- client,
71
- opts.jsonOutput,
72
- "NO_TEAM",
73
- "No team context found. Run `vercel switch` to select a team, or use `vercel link` in a project directory."
74
- );
75
- }
76
- if (opts.all) {
77
- return {
78
- teamId: team.id
79
- };
80
- }
81
- let projectResult;
82
- try {
83
- projectResult = await getProjectByNameOrId(
84
- client,
85
- opts.project,
86
- team.id
87
- );
88
- } catch (err) {
89
- if (isAPIError(err)) {
90
- return outputError(
91
- client,
92
- opts.jsonOutput,
93
- err.code || "API_ERROR",
94
- err.serverMessage || (err.status === 403 ? `You do not have permission to access project "${opts.project}" in team "${team.slug}".` : `API error (${err.status}).`)
95
- );
96
- }
97
- throw err;
98
- }
99
- if (projectResult instanceof ProjectNotFound) {
100
- return outputError(
101
- client,
102
- opts.jsonOutput,
103
- "PROJECT_NOT_FOUND",
104
- `Project "${opts.project}" was not found in team "${team.slug}".`
105
- );
106
- }
107
- return {
108
- teamId: team.id,
109
- projectId: projectResult.id
110
- };
111
- }
112
- const linkedProject = await getLinkedProject(client);
113
- if (linkedProject.status === "error") {
114
- return linkedProject.exitCode;
115
- }
116
- if (linkedProject.status === "not_linked") {
117
- return outputError(
118
- client,
119
- opts.jsonOutput,
120
- "NOT_LINKED",
121
- "No linked project found. Run `vercel link` to link a project, or use --project <name> or --all."
122
- );
123
- }
124
- return {
125
- teamId: linkedProject.org.id,
126
- projectId: linkedProject.project.id
127
- };
128
- }
129
96
  function getGroupTitle(group) {
130
97
  return group.ai?.title || "Alert group";
131
98
  }
@@ -191,18 +158,44 @@ function getResolvedAt(group) {
191
158
  function getAlertsCount(group) {
192
159
  return String(group.alerts?.length ?? 0);
193
160
  }
161
+ function validationFailureForAgents(client, result, jsonOutput) {
162
+ if (shouldEmitNonInteractiveCommandError(client)) {
163
+ outputAgentError(
164
+ client,
165
+ {
166
+ status: "error",
167
+ reason: AGENT_REASON.INVALID_ARGUMENTS,
168
+ message: result.message,
169
+ next: [
170
+ {
171
+ command: buildCommandWithGlobalFlags(client.argv, "alerts --help"),
172
+ when: "See valid `alerts` list flags and examples"
173
+ }
174
+ ]
175
+ },
176
+ 1
177
+ );
178
+ }
179
+ return handleValidationError(result, jsonOutput, client);
180
+ }
194
181
  function printGroups(groups) {
195
182
  if (groups.length === 0) {
196
183
  output_manager_default.log("No alerts found.");
197
184
  return;
198
185
  }
199
- const headers = ["Title", "Started At", "Type", "Status", "Alerts"].map(
200
- (h) => import_chalk.default.cyan(h)
201
- );
186
+ const headers = [
187
+ "Title",
188
+ "Group id",
189
+ "Started At",
190
+ "Type",
191
+ "Status",
192
+ "Alerts"
193
+ ].map((h) => import_chalk.default.cyan(h));
202
194
  const rows = [
203
195
  headers,
204
196
  ...groups.map((group) => [
205
197
  import_chalk.default.bold(getGroupTitle(group)),
198
+ import_chalk.default.dim(group.id || "-"),
206
199
  getStartedAt(group),
207
200
  group.type || "-",
208
201
  getStatus(group),
@@ -252,6 +245,43 @@ function parseFlags(client) {
252
245
  const parsedArgs = parseArguments(client.argv.slice(2), flagsSpecification);
253
246
  return parsedArgs.flags;
254
247
  } catch (err) {
248
+ const msg = err instanceof Error ? err.message : String(err);
249
+ const projectFlagMissingArg = msg.includes("--project") && msg.includes("requires argument");
250
+ if (shouldEmitNonInteractiveCommandError(client)) {
251
+ outputAgentError(
252
+ client,
253
+ {
254
+ status: "error",
255
+ reason: AGENT_REASON.INVALID_ARGUMENTS,
256
+ message: projectFlagMissingArg ? "`--project` requires a project name or id (for example `--project my-app`)." : msg,
257
+ next: projectFlagMissingArg ? [
258
+ {
259
+ command: buildCommandWithGlobalFlags(
260
+ client.argv,
261
+ "alerts --project <name-or-id>"
262
+ ),
263
+ when: "Re-run with a project name or id (replace placeholder)"
264
+ },
265
+ {
266
+ command: buildCommandWithGlobalFlags(
267
+ client.argv,
268
+ "alerts --help"
269
+ ),
270
+ when: "See all `alerts` flags and examples"
271
+ }
272
+ ] : [
273
+ {
274
+ command: buildCommandWithGlobalFlags(
275
+ client.argv,
276
+ "alerts --help"
277
+ ),
278
+ when: "See valid flags and examples"
279
+ }
280
+ ]
281
+ },
282
+ 1
283
+ );
284
+ }
255
285
  printError(err);
256
286
  return 1;
257
287
  }
@@ -264,29 +294,29 @@ function resolveValidatedInputs(flags, client, jsonOutput) {
264
294
  max: 100
265
295
  });
266
296
  if (!limitResult.valid) {
267
- return handleValidationError(limitResult, jsonOutput, client);
297
+ return validationFailureForAgents(client, limitResult, jsonOutput);
268
298
  }
269
299
  const mutualResult = validateAllProjectMutualExclusivity(
270
300
  flags["--all"],
271
301
  flags["--project"]
272
302
  );
273
303
  if (!mutualResult.valid) {
274
- return handleValidationError(mutualResult, jsonOutput, client);
304
+ return validationFailureForAgents(client, mutualResult, jsonOutput);
275
305
  }
276
306
  const sinceResult = validateTimeBound(flags["--since"]);
277
307
  if (!sinceResult.valid) {
278
- return handleValidationError(sinceResult, jsonOutput, client);
308
+ return validationFailureForAgents(client, sinceResult, jsonOutput);
279
309
  }
280
310
  const untilResult = validateTimeBound(flags["--until"]);
281
311
  if (!untilResult.valid) {
282
- return handleValidationError(untilResult, jsonOutput, client);
312
+ return validationFailureForAgents(client, untilResult, jsonOutput);
283
313
  }
284
314
  const timeOrderResult = validateTimeOrder(
285
315
  sinceResult.value,
286
316
  untilResult.value
287
317
  );
288
318
  if (!timeOrderResult.valid) {
289
- return handleValidationError(timeOrderResult, jsonOutput, client);
319
+ return validationFailureForAgents(client, timeOrderResult, jsonOutput);
290
320
  }
291
321
  return {
292
322
  limit: limitResult.value,
@@ -338,7 +368,7 @@ async function list(client, telemetry) {
338
368
  if (typeof validatedInputs === "number") {
339
369
  return validatedInputs;
340
370
  }
341
- const scope = await resolveScope(client, {
371
+ const scope = await resolveAlertsScope(client, {
342
372
  project: flags["--project"],
343
373
  all: flags["--all"],
344
374
  jsonOutput
@@ -18,27 +18,30 @@ import {
18
18
  } from "./chunk-EOZFDJSY.js";
19
19
  import {
20
20
  getScope
21
- } from "./chunk-3FMFPD7F.js";
21
+ } from "./chunk-APGVHLAW.js";
22
22
  import {
23
23
  validateJsonOutput
24
24
  } from "./chunk-XPKWKPWA.js";
25
25
  import {
26
26
  activityCommand
27
- } from "./chunk-2IAZZEVQ.js";
27
+ } from "./chunk-UWKTUK3W.js";
28
28
  import {
29
29
  getLinkedProject,
30
30
  getProjectByNameOrId
31
- } from "./chunk-7S7GE4BN.js";
31
+ } from "./chunk-4VP55L4V.js";
32
32
  import "./chunk-U3WLEFHU.js";
33
+ import "./chunk-CGTXAXZ4.js";
33
34
  import "./chunk-CO5D46AG.js";
34
35
  import {
35
- ProjectNotFound,
36
- getCommandName,
37
36
  getFlagsSpecification,
38
- isAPIError,
39
37
  parseArguments,
40
38
  printError
41
- } from "./chunk-A4NVECX5.js";
39
+ } from "./chunk-RFMC2QXQ.js";
40
+ import {
41
+ ProjectNotFound,
42
+ getCommandName,
43
+ isAPIError
44
+ } from "./chunk-ECRBC4HL.js";
42
45
  import {
43
46
  output_manager_default
44
47
  } from "./chunk-ZQKJVHXY.js";