vercel 56.5.0 → 58.0.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 (90) hide show
  1. package/dist/chunks/{add-KNK5E2YT.js → add-7PPD4ZUJ.js} +2 -2
  2. package/dist/chunks/{add-6GRH6G2M.js → add-E4KH6P4A.js} +6 -5
  3. package/dist/chunks/{chunk-YS6EDZHB.js → chunk-2MJROFVC.js} +5 -1
  4. package/dist/chunks/chunk-3PGXYIKC.js +147 -0
  5. package/dist/chunks/chunk-5AJPMLDV.js +28 -0
  6. package/dist/chunks/{chunk-V5P25P7F.js → chunk-A3NYPUKZ.js} +7 -12
  7. package/dist/chunks/{chunk-JQG5EDRD.js → chunk-AZTV7WPZ.js} +1 -1
  8. package/dist/chunks/{chunk-3BHSS5E2.js → chunk-B2MTCHPO.js} +65 -210
  9. package/dist/chunks/{chunk-GAOAGU5K.js → chunk-BYQQLGCT.js} +1 -1
  10. package/dist/chunks/{chunk-ARKHETJP.js → chunk-DGFASMSE.js} +1 -1
  11. package/dist/chunks/{chunk-W346YNDN.js → chunk-DWMH5M4Q.js} +4 -1
  12. package/dist/chunks/{chunk-PRYNIKBZ.js → chunk-EA22NMFU.js} +1 -1
  13. package/dist/chunks/{chunk-26TEKOBZ.js → chunk-FB4UFWEC.js} +8 -1
  14. package/dist/chunks/chunk-FGDKMNEN.js +21 -0
  15. package/dist/chunks/{chunk-23U6FANO.js → chunk-FYR7WEUJ.js} +11 -18
  16. package/dist/chunks/chunk-GZLPFESR.js +48 -0
  17. package/dist/chunks/{chunk-STJJ3DFO.js → chunk-KCF6S3XF.js} +16 -1
  18. package/dist/chunks/{chunk-PPEQUJ7T.js → chunk-KGVT2RSG.js} +3 -3
  19. package/dist/chunks/{chunk-4MK452Y5.js → chunk-L4WYMJB3.js} +8 -8
  20. package/dist/chunks/{chunk-BM36UWE2.js → chunk-MDQJLTGN.js} +1 -1
  21. package/dist/chunks/{chunk-Z7NPYIZ6.js → chunk-NM43FFV6.js} +0 -8
  22. package/dist/chunks/chunk-OF2GNB42.js +53 -0
  23. package/dist/chunks/{chunk-YTFJGKRG.js → chunk-OQGN4TEC.js} +1 -1
  24. package/dist/chunks/chunk-PRWJUY5U.js +848 -0
  25. package/dist/chunks/{chunk-F5OMERHI.js → chunk-QZD5DKUR.js} +10 -23
  26. package/dist/chunks/{chunk-SWEPOMSA.js → chunk-R54DAHCL.js} +4 -3
  27. package/dist/chunks/{chunk-DOF6CJLL.js → chunk-RSCSALZH.js} +15 -839
  28. package/dist/chunks/{chunk-G4MTGCZ5.js → chunk-TEWJ7TIW.js} +1 -1
  29. package/dist/chunks/{chunk-TMK6RSYW.js → chunk-TPX7RZBM.js} +1433 -979
  30. package/dist/chunks/chunk-V4RMJKQP.js +36 -0
  31. package/dist/chunks/{chunk-DI3HR3K6.js → chunk-VUESC3YO.js} +1 -1
  32. package/dist/chunks/{chunk-IBP2XAUH.js → chunk-WANVKOVB.js} +39 -5
  33. package/dist/chunks/{chunk-X43U65TH.js → chunk-WDE2EDYX.js} +2 -2
  34. package/dist/chunks/{chunk-6RTK6BWX.js → chunk-YA3WQFLY.js} +1 -1
  35. package/dist/chunks/{chunk-EYICIM2K.js → chunk-YZMZCQP3.js} +4 -4
  36. package/dist/chunks/{chunk-CM3DLBDY.js → chunk-ZMVFTCQF.js} +1 -1
  37. package/dist/chunks/{compile-vercel-config-IFET4E6H.js → compile-vercel-config-G2IVBXEI.js} +1 -1
  38. package/dist/chunks/config-validator.mjs +1 -1
  39. package/dist/chunks/{delete-PXB5WRH7.js → delete-2EIVGM6P.js} +2 -2
  40. package/dist/chunks/{delete-X2MUMONI.js → delete-E6ZQNE5X.js} +2 -2
  41. package/dist/chunks/{disable-GBL3SHJL.js → disable-M3Q6BBB7.js} +2 -2
  42. package/dist/chunks/{discard-XVVSRGDR.js → discard-3R6ETBPS.js} +2 -2
  43. package/dist/chunks/{edit-EIHRP6XT.js → edit-7JUDPVXD.js} +3 -3
  44. package/dist/chunks/{edit-K5Y2BDJO.js → edit-ICVMGRRU.js} +2 -2
  45. package/dist/chunks/{enable-W7AMJWKH.js → enable-HLTA35QL.js} +2 -2
  46. package/dist/chunks/{export-N3AZ2KOO.js → export-E6XZUFW3.js} +2 -2
  47. package/dist/chunks/{image-DRTGVPVJ.js → image-SIRPPQZT.js} +3 -3
  48. package/dist/chunks/{inspect-DYXTX6P4.js → inspect-4FYBOOM5.js} +2 -2
  49. package/dist/chunks/{inspect-AAIVWSJI.js → inspect-65YX7L3O.js} +2 -2
  50. package/dist/chunks/inspect-6TQWDIBG.js +587 -0
  51. package/dist/chunks/{inspect-IPSAYR2C.js → inspect-NFOURIGN.js} +2 -2
  52. package/dist/chunks/{inspect-SLZLI6ZC.js → inspect-OEWWGAHZ.js} +3 -3
  53. package/dist/chunks/{list-IF2YW73F.js → list-27DCGMBI.js} +1 -1
  54. package/dist/chunks/{list-V7VTXVK4.js → list-APFMKZJO.js} +41 -54
  55. package/dist/chunks/{list-K2HLGUXV.js → list-XQCZVLES.js} +3 -3
  56. package/dist/chunks/{login-7C6HQEOG.js → login-FMU4CQOV.js} +2 -2
  57. package/dist/chunks/{ls-2NU353QP.js → ls-24BRCAZR.js} +2 -2
  58. package/dist/chunks/ls-3L6EN4YU.js +188 -0
  59. package/dist/chunks/{ls-NKECPPOR.js → ls-BFACWH6C.js} +2 -2
  60. package/dist/chunks/{ls-QQQHOJBE.js → ls-T5RGDBCV.js} +2 -2
  61. package/dist/chunks/{open-2FAPZA6V.js → open-AG3VYJZM.js} +2 -2
  62. package/dist/chunks/{publish-G7PB64LJ.js → publish-5OVCPS4J.js} +2 -2
  63. package/dist/chunks/{query-D4QBT4WR.js → query-QS4VKBXJ.js} +8 -8
  64. package/dist/chunks/{reorder-3Z7YIPAX.js → reorder-B5V2P7YM.js} +2 -2
  65. package/dist/chunks/{reply-7QQBXL5H.js → reply-JBLWE6RS.js} +2 -2
  66. package/dist/chunks/{resolve-UYKTDZEX.js → resolve-2I6XH2G3.js} +2 -2
  67. package/dist/chunks/{restore-Q2DR7SMW.js → restore-O63FZXCL.js} +2 -2
  68. package/dist/chunks/{rm-OCLUTM57.js → rm-HUED5R3Q.js} +6 -5
  69. package/dist/chunks/{rm-O4M4GFSK.js → rm-N7W3QYWZ.js} +2 -2
  70. package/dist/chunks/{rm-PCWMEHQ2.js → rm-P3NJSCMY.js} +2 -2
  71. package/dist/chunks/rule-inspect-M3QUSPU2.js +283 -0
  72. package/dist/chunks/{rules-LIH5FLPJ.js → rules-NSSWPJ2B.js} +7 -7
  73. package/dist/chunks/{schema-OFALTXXM.js → schema-G2PAXPVA.js} +6 -4
  74. package/dist/chunks/{tags-P4HIAI6D.js → tags-JFMO63D4.js} +2 -2
  75. package/dist/chunks/{update-E3ZQAFBS.js → update-VJCKD6YG.js} +6 -5
  76. package/dist/commands/build/index.js +42 -10
  77. package/dist/commands/deploy/index.js +34 -24
  78. package/dist/commands/dev/index.js +23 -13
  79. package/dist/commands/env/index.js +8 -7
  80. package/dist/commands/link/index.js +8 -8
  81. package/dist/commands/list/index.js +2 -2
  82. package/dist/commands-bulk.js +1959 -1816
  83. package/dist/index.js +19 -20
  84. package/dist/vc.js +54 -18
  85. package/dist/version.mjs +1 -1
  86. package/package.json +35 -35
  87. package/dist/chunks/chunk-GNV7547O.js +0 -86
  88. package/dist/chunks/inspect-5YUAEI3L.js +0 -351
  89. package/dist/chunks/ls-RH6Y4XBS.js +0 -113
  90. package/dist/chunks/rule-inspect-XJ47UEG7.js +0 -141
@@ -1,351 +0,0 @@
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-23U6FANO.js";
10
- import {
11
- handleValidationError,
12
- outputError,
13
- validateAllProjectMutualExclusivity
14
- } from "./chunk-BUZRVER7.js";
15
- import {
16
- validateJsonOutput
17
- } from "./chunk-XPKWKPWA.js";
18
- import {
19
- inspectSubcommand
20
- } from "./chunk-YS6EDZHB.js";
21
- import "./chunk-STJJ3DFO.js";
22
- import {
23
- getLinkedProject,
24
- getProjectByNameOrId,
25
- getScope
26
- } from "./chunk-TMK6RSYW.js";
27
- import "./chunk-ECCWJHC6.js";
28
- import {
29
- AGENT_REASON,
30
- buildCommandWithGlobalFlags,
31
- outputAgentError
32
- } from "./chunk-UDWRZXIT.js";
33
- import {
34
- parseArguments,
35
- printError
36
- } from "./chunk-SZXT3PDQ.js";
37
- import {
38
- ProjectNotFound,
39
- getFlagsSpecification,
40
- isAPIError,
41
- packageName
42
- } from "./chunk-KSSNLCL4.js";
43
- import "./chunk-P4QNYOFB.js";
44
- import "./chunk-52QYYTM5.js";
45
- import {
46
- output_manager_default
47
- } from "./chunk-OX7KI3LF.js";
48
- import "./chunk-GGP5R3FU.js";
49
- import {
50
- require_source
51
- } from "./chunk-S7KYDPEM.js";
52
- import {
53
- __toESM
54
- } from "./chunk-TZ2YI2VH.js";
55
-
56
- // src/commands/alerts/inspect.ts
57
- var import_chalk = __toESM(require_source(), 1);
58
- async function resolveInspectScope(client, flags, jsonOutput) {
59
- const mutual = validateAllProjectMutualExclusivity(
60
- flags["--all"],
61
- flags["--project"]
62
- );
63
- if (!mutual.valid) {
64
- outputAgentError(
65
- client,
66
- {
67
- status: "error",
68
- reason: AGENT_REASON.INVALID_ARGUMENTS,
69
- message: mutual.message,
70
- next: [
71
- {
72
- command: buildCommandWithGlobalFlags(
73
- client.argv,
74
- "alerts inspect <groupId> --help"
75
- ),
76
- when: "Use either `--project` or `--all`, not both"
77
- }
78
- ]
79
- },
80
- 1
81
- );
82
- return handleValidationError(mutual, jsonOutput, client);
83
- }
84
- if (flags["--all"]) {
85
- const { team } = await getScope(client);
86
- if (!team) {
87
- const msg = "No team context found. Run `vercel switch` to select a team, or use `vercel link`.";
88
- return emitAlertsScopeError(client, jsonOutput, "NO_TEAM", msg, {
89
- reason: AGENT_REASON.MISSING_SCOPE,
90
- next: [
91
- {
92
- command: buildCommandWithGlobalFlags(client.argv, "whoami"),
93
- when: "See current user and team"
94
- },
95
- {
96
- command: buildCommandWithGlobalFlags(client.argv, "teams switch"),
97
- when: "Switch to a team that owns the project"
98
- }
99
- ]
100
- });
101
- }
102
- return { teamId: team.id };
103
- }
104
- if (flags["--project"]) {
105
- const { team } = await getScope(client);
106
- if (!team) {
107
- const msg = "No team context found. Run `vercel switch` to select a team.";
108
- return emitAlertsScopeError(client, jsonOutput, "NO_TEAM", msg, {
109
- reason: AGENT_REASON.MISSING_SCOPE,
110
- next: [
111
- {
112
- command: buildCommandWithGlobalFlags(client.argv, "whoami"),
113
- when: "See current user and team"
114
- },
115
- {
116
- command: buildCommandWithGlobalFlags(client.argv, "teams switch"),
117
- when: "Switch to a team that owns the project"
118
- }
119
- ]
120
- });
121
- }
122
- try {
123
- const p = await getProjectByNameOrId(client, flags["--project"], team.id);
124
- if (p instanceof ProjectNotFound) {
125
- const msg = `Project "${flags["--project"]}" was not found.`;
126
- return emitAlertsScopeError(
127
- client,
128
- jsonOutput,
129
- "PROJECT_NOT_FOUND",
130
- msg,
131
- {
132
- reason: AGENT_REASON.NOT_FOUND,
133
- next: [
134
- {
135
- command: buildCommandWithGlobalFlags(
136
- client.argv,
137
- "alerts inspect <groupId> --project <name_or_id>"
138
- ),
139
- when: "Retry with a valid project (replace placeholders)"
140
- }
141
- ]
142
- }
143
- );
144
- }
145
- return { teamId: team.id, projectId: p.id };
146
- } catch (err) {
147
- if (isAPIError(err)) {
148
- 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}).`);
149
- const reason = err.status === 401 ? "not_authorized" : err.status === 403 ? "forbidden" : AGENT_REASON.API_ERROR;
150
- return emitAlertsScopeError(
151
- client,
152
- jsonOutput,
153
- err.code || "API_ERROR",
154
- msg,
155
- {
156
- reason,
157
- next: [
158
- {
159
- command: buildCommandWithGlobalFlags(
160
- client.argv,
161
- "alerts inspect <groupId> --project <name_or_id>"
162
- ),
163
- when: "Retry with a project you can access"
164
- }
165
- ]
166
- }
167
- );
168
- }
169
- throw err;
170
- }
171
- }
172
- const linked = await getLinkedProject(client);
173
- if (linked.status === "error") {
174
- return linked.exitCode;
175
- }
176
- if (linked.status === "not_linked") {
177
- const msg = "No linked project. Run `vercel link` or pass --project <name> or --all.";
178
- return emitAlertsScopeError(client, jsonOutput, "NOT_LINKED", msg, {
179
- reason: AGENT_REASON.NOT_LINKED,
180
- next: [
181
- {
182
- command: buildCommandWithGlobalFlags(client.argv, "link"),
183
- when: "Link this directory to a Vercel project"
184
- },
185
- {
186
- command: buildCommandWithGlobalFlags(
187
- client.argv,
188
- "alerts inspect <groupId> --project <name_or_id>"
189
- ),
190
- when: "Inspect using an explicit project"
191
- },
192
- {
193
- command: buildCommandWithGlobalFlags(
194
- client.argv,
195
- "alerts inspect <groupId> --all"
196
- ),
197
- when: "Inspect using team-wide scope"
198
- }
199
- ]
200
- });
201
- }
202
- return {
203
- teamId: linked.org.id,
204
- projectId: linked.project.id
205
- };
206
- }
207
- async function inspect(client, argv) {
208
- let parsedArgs;
209
- const spec = getFlagsSpecification(inspectSubcommand.options);
210
- try {
211
- parsedArgs = parseArguments(argv, spec);
212
- } catch (e) {
213
- const msg = e instanceof Error ? e.message : String(e);
214
- const projectFlagMissingArg = msg.includes("--project") && msg.includes("requires argument");
215
- outputAgentError(
216
- client,
217
- {
218
- status: "error",
219
- reason: AGENT_REASON.INVALID_ARGUMENTS,
220
- message: projectFlagMissingArg ? "`--project` requires a project name or id (for example `--project my-app`)." : msg,
221
- next: projectFlagMissingArg ? [
222
- {
223
- command: buildCommandWithGlobalFlags(
224
- client.argv,
225
- "alerts inspect <groupId> --project <name-or-id>"
226
- ),
227
- when: "Re-run with placeholders replaced"
228
- }
229
- ] : [
230
- {
231
- command: buildCommandWithGlobalFlags(
232
- client.argv,
233
- "alerts inspect --help"
234
- ),
235
- when: "See valid `alerts inspect` usage"
236
- }
237
- ]
238
- },
239
- 1
240
- );
241
- printError(e);
242
- return 1;
243
- }
244
- const groupId = parsedArgs.args[0];
245
- const fr = validateJsonOutput(parsedArgs.flags);
246
- if (!fr.valid) {
247
- outputAgentError(
248
- client,
249
- {
250
- status: "error",
251
- reason: AGENT_REASON.INVALID_ARGUMENTS,
252
- message: fr.error
253
- },
254
- 1
255
- );
256
- output_manager_default.error(fr.error);
257
- return 1;
258
- }
259
- if (!groupId) {
260
- outputAgentError(
261
- client,
262
- {
263
- status: "error",
264
- reason: AGENT_REASON.MISSING_ARGUMENTS,
265
- message: `Missing group id. Example: ${packageName} alerts inspect <groupId>`,
266
- next: [
267
- {
268
- command: buildCommandWithGlobalFlags(
269
- client.argv,
270
- "alerts inspect <groupId>"
271
- ),
272
- when: "Replace <groupId> with a group id from `vercel alerts`"
273
- }
274
- ]
275
- },
276
- 1
277
- );
278
- return outputError(
279
- client,
280
- fr.jsonOutput,
281
- "MISSING_ARGUMENTS",
282
- "Usage: `vercel alerts inspect <groupId>`"
283
- );
284
- }
285
- const scope = await resolveInspectScope(
286
- client,
287
- {
288
- "--project": parsedArgs.flags["--project"],
289
- "--all": parsedArgs.flags["--all"]
290
- },
291
- fr.jsonOutput
292
- );
293
- if (typeof scope === "number") {
294
- return scope;
295
- }
296
- const query = new URLSearchParams({ teamId: scope.teamId });
297
- if (scope.projectId) {
298
- query.set("projectId", scope.projectId);
299
- }
300
- const path = `/alerts/v3/groups/${encodeURIComponent(groupId)}?${query.toString()}`;
301
- output_manager_default.spinner("Fetching alert group...");
302
- try {
303
- const group = await client.fetch(path);
304
- if (fr.jsonOutput) {
305
- client.stdout.write(`${JSON.stringify({ group }, null, 2)}
306
- `);
307
- } else {
308
- output_manager_default.log(`${import_chalk.default.bold("Alert group")} ${import_chalk.default.cyan(groupId)}`);
309
- client.stdout.write(`${JSON.stringify(group, null, 2)}
310
- `);
311
- }
312
- return 0;
313
- } catch (err) {
314
- if (isAPIError(err)) {
315
- const msg = err.serverMessage || `API error (${err.status}).`;
316
- 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;
317
- outputAgentError(
318
- client,
319
- {
320
- status: "error",
321
- reason,
322
- message: msg,
323
- ...err.status === 401 || err.status === 403 ? {
324
- hint: "Confirm team scope; use --scope <team-slug> if the group belongs to another team.",
325
- next: [
326
- {
327
- command: buildCommandWithGlobalFlags(client.argv, "whoami"),
328
- when: "See current user and team"
329
- },
330
- {
331
- command: buildCommandWithGlobalFlags(
332
- client.argv,
333
- `alerts inspect ${groupId}`
334
- ),
335
- when: "Retry after fixing scope or permissions"
336
- }
337
- ]
338
- } : {}
339
- },
340
- 1
341
- );
342
- return outputError(client, fr.jsonOutput, err.code || "API_ERROR", msg);
343
- }
344
- throw err;
345
- } finally {
346
- output_manager_default.stopSpinner();
347
- }
348
- }
349
- export {
350
- inspect as default
351
- };
@@ -1,113 +0,0 @@
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
- emitRulesArgParseError,
9
- handleRulesApiError,
10
- parseRulesFlagsAndScope,
11
- rulesCollectionPath
12
- } from "./chunk-SWEPOMSA.js";
13
- import "./chunk-23U6FANO.js";
14
- import "./chunk-BUZRVER7.js";
15
- import {
16
- validateJsonOutput
17
- } from "./chunk-XPKWKPWA.js";
18
- import {
19
- rulesLsSubcommand
20
- } from "./chunk-STJJ3DFO.js";
21
- import "./chunk-TMK6RSYW.js";
22
- import "./chunk-ECCWJHC6.js";
23
- import {
24
- AGENT_REASON,
25
- outputAgentError
26
- } from "./chunk-UDWRZXIT.js";
27
- import {
28
- parseArguments,
29
- printError
30
- } from "./chunk-SZXT3PDQ.js";
31
- import {
32
- getFlagsSpecification,
33
- isAPIError
34
- } from "./chunk-KSSNLCL4.js";
35
- import "./chunk-P4QNYOFB.js";
36
- import "./chunk-52QYYTM5.js";
37
- import {
38
- output_manager_default
39
- } from "./chunk-OX7KI3LF.js";
40
- import "./chunk-GGP5R3FU.js";
41
- import "./chunk-S7KYDPEM.js";
42
- import "./chunk-TZ2YI2VH.js";
43
-
44
- // src/commands/alerts/rules/ls.ts
45
- async function ls(client, argv) {
46
- let parsedArgs;
47
- try {
48
- parsedArgs = parseArguments(
49
- argv,
50
- getFlagsSpecification(rulesLsSubcommand.options)
51
- );
52
- } catch (e) {
53
- emitRulesArgParseError(client, e, "alerts rules ls --project <name-or-id>");
54
- printError(e);
55
- return 1;
56
- }
57
- const fr = validateJsonOutput(parsedArgs.flags);
58
- if (!fr.valid) {
59
- outputAgentError(
60
- client,
61
- {
62
- status: "error",
63
- reason: AGENT_REASON.INVALID_ARGUMENTS,
64
- message: fr.error
65
- },
66
- 1
67
- );
68
- output_manager_default.error(fr.error);
69
- return 1;
70
- }
71
- const scope = await parseRulesFlagsAndScope(
72
- client,
73
- {
74
- "--project": parsedArgs.flags["--project"],
75
- "--all": parsedArgs.flags["--all"]
76
- },
77
- fr.jsonOutput
78
- );
79
- if (typeof scope === "number") {
80
- return scope;
81
- }
82
- const path = rulesCollectionPath(scope);
83
- output_manager_default.spinner("Fetching alert rules...");
84
- try {
85
- const rules = await client.fetch(path);
86
- if (fr.jsonOutput) {
87
- client.stdout.write(`${JSON.stringify({ rules }, null, 2)}
88
- `);
89
- } else if (rules.length === 0) {
90
- output_manager_default.log("No alert rules found for this scope.");
91
- } else {
92
- for (const r of rules) {
93
- const id = typeof r.id === "string" ? r.id : "";
94
- const name = typeof r.name === "string" ? r.name : "";
95
- const pid = typeof r.projectId === "string" ? r.projectId : "";
96
- output_manager_default.log(
97
- `${id} ${name}${pid ? ` project: ${pid}` : " (team-wide)"}`
98
- );
99
- }
100
- }
101
- return 0;
102
- } catch (err) {
103
- if (isAPIError(err)) {
104
- return handleRulesApiError(client, err, fr.jsonOutput);
105
- }
106
- throw err;
107
- } finally {
108
- output_manager_default.stopSpinner();
109
- }
110
- }
111
- export {
112
- ls as default
113
- };
@@ -1,141 +0,0 @@
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
- emitRulesArgParseError,
9
- handleRulesApiError,
10
- parseRulesFlagsAndScope,
11
- rulesItemPath
12
- } from "./chunk-SWEPOMSA.js";
13
- import "./chunk-23U6FANO.js";
14
- import "./chunk-BUZRVER7.js";
15
- import {
16
- validateJsonOutput
17
- } from "./chunk-XPKWKPWA.js";
18
- import {
19
- rulesInspectSubcommand
20
- } from "./chunk-STJJ3DFO.js";
21
- import "./chunk-TMK6RSYW.js";
22
- import "./chunk-ECCWJHC6.js";
23
- import {
24
- AGENT_REASON,
25
- buildCommandWithGlobalFlags,
26
- outputAgentError
27
- } from "./chunk-UDWRZXIT.js";
28
- import {
29
- parseArguments,
30
- printError
31
- } from "./chunk-SZXT3PDQ.js";
32
- import {
33
- getFlagsSpecification,
34
- isAPIError,
35
- packageName
36
- } from "./chunk-KSSNLCL4.js";
37
- import "./chunk-P4QNYOFB.js";
38
- import "./chunk-52QYYTM5.js";
39
- import {
40
- output_manager_default
41
- } from "./chunk-OX7KI3LF.js";
42
- import "./chunk-GGP5R3FU.js";
43
- import "./chunk-S7KYDPEM.js";
44
- import "./chunk-TZ2YI2VH.js";
45
-
46
- // src/commands/alerts/rules/rule-inspect.ts
47
- async function ruleInspect(client, argv) {
48
- let parsedArgs;
49
- try {
50
- parsedArgs = parseArguments(
51
- argv,
52
- getFlagsSpecification(rulesInspectSubcommand.options)
53
- );
54
- } catch (e) {
55
- emitRulesArgParseError(
56
- client,
57
- e,
58
- "alerts rules inspect <ruleId> --project <name-or-id>"
59
- );
60
- printError(e);
61
- return 1;
62
- }
63
- const ruleId = parsedArgs.args[0];
64
- const fr = validateJsonOutput(parsedArgs.flags);
65
- if (!fr.valid) {
66
- outputAgentError(
67
- client,
68
- {
69
- status: "error",
70
- reason: AGENT_REASON.INVALID_ARGUMENTS,
71
- message: fr.error
72
- },
73
- 1
74
- );
75
- output_manager_default.error(fr.error);
76
- return 1;
77
- }
78
- if (!ruleId) {
79
- outputAgentError(
80
- client,
81
- {
82
- status: "error",
83
- reason: AGENT_REASON.MISSING_ARGUMENTS,
84
- message: `Missing rule id. Example: ${packageName} alerts rules inspect <ruleId>`,
85
- next: [
86
- {
87
- command: buildCommandWithGlobalFlags(
88
- client.argv,
89
- "alerts rules inspect <ruleId>"
90
- ),
91
- when: "Replace <ruleId> with an id from `alerts rules ls`"
92
- },
93
- {
94
- command: buildCommandWithGlobalFlags(
95
- client.argv,
96
- "alerts rules ls"
97
- ),
98
- when: "List rule ids in the current scope"
99
- }
100
- ]
101
- },
102
- 1
103
- );
104
- output_manager_default.error("Usage: `vercel alerts rules inspect <ruleId>`");
105
- return 1;
106
- }
107
- const scope = await parseRulesFlagsAndScope(
108
- client,
109
- {
110
- "--project": parsedArgs.flags["--project"],
111
- "--all": parsedArgs.flags["--all"]
112
- },
113
- fr.jsonOutput
114
- );
115
- if (typeof scope === "number") {
116
- return scope;
117
- }
118
- const path = rulesItemPath(scope, ruleId);
119
- output_manager_default.spinner("Fetching alert rule...");
120
- try {
121
- const rule = await client.fetch(path);
122
- if (fr.jsonOutput) {
123
- client.stdout.write(`${JSON.stringify({ rule }, null, 2)}
124
- `);
125
- } else {
126
- client.stdout.write(`${JSON.stringify(rule, null, 2)}
127
- `);
128
- }
129
- return 0;
130
- } catch (err) {
131
- if (isAPIError(err)) {
132
- return handleRulesApiError(client, err, fr.jsonOutput);
133
- }
134
- throw err;
135
- } finally {
136
- output_manager_default.stopSpinner();
137
- }
138
- }
139
- export {
140
- ruleInspect as default
141
- };