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
@@ -17,21 +17,23 @@ import {
17
17
  parseSubcommandArgs,
18
18
  resolveRoute,
19
19
  withGlobalFlags
20
- } from "./chunk-A5XRYFVO.js";
20
+ } from "./chunk-OFUQPP26.js";
21
21
  import {
22
22
  disableSubcommand
23
- } from "./chunk-BQUQ5F7R.js";
24
- import "./chunk-TWZWQGBN.js";
23
+ } from "./chunk-CRZM5WM2.js";
24
+ import "./chunk-E3NE4SKN.js";
25
+ import "./chunk-4VP55L4V.js";
26
+ import "./chunk-U3WLEFHU.js";
25
27
  import {
26
28
  outputAgentError
27
- } from "./chunk-V23RAVWV.js";
28
- import "./chunk-U3WLEFHU.js";
29
+ } from "./chunk-CGTXAXZ4.js";
29
30
  import {
30
31
  stamp_default
31
32
  } from "./chunk-CO5D46AG.js";
33
+ import "./chunk-RFMC2QXQ.js";
32
34
  import {
33
35
  getCommandName
34
- } from "./chunk-A4NVECX5.js";
36
+ } from "./chunk-ECRBC4HL.js";
35
37
  import {
36
38
  output_manager_default
37
39
  } from "./chunk-ZQKJVHXY.js";
@@ -17,21 +17,23 @@ import {
17
17
  parseSubcommandArgs,
18
18
  printDiffSummary,
19
19
  withGlobalFlags
20
- } from "./chunk-A5XRYFVO.js";
20
+ } from "./chunk-OFUQPP26.js";
21
21
  import {
22
22
  discardSubcommand
23
- } from "./chunk-BQUQ5F7R.js";
24
- import "./chunk-TWZWQGBN.js";
23
+ } from "./chunk-CRZM5WM2.js";
24
+ import "./chunk-E3NE4SKN.js";
25
+ import "./chunk-4VP55L4V.js";
26
+ import "./chunk-U3WLEFHU.js";
25
27
  import {
26
28
  outputAgentError
27
- } from "./chunk-V23RAVWV.js";
28
- import "./chunk-U3WLEFHU.js";
29
+ } from "./chunk-CGTXAXZ4.js";
29
30
  import {
30
31
  stamp_default
31
32
  } from "./chunk-CO5D46AG.js";
33
+ import "./chunk-RFMC2QXQ.js";
32
34
  import {
33
35
  getCommandName
34
- } from "./chunk-A4NVECX5.js";
36
+ } from "./chunk-ECRBC4HL.js";
35
37
  import {
36
38
  output_manager_default
37
39
  } from "./chunk-ZQKJVHXY.js";
@@ -19,7 +19,7 @@ import {
19
19
  printRouteConfig,
20
20
  routingRuleToCurrentRoute,
21
21
  runInteractiveEditLoop
22
- } from "./chunk-5CRSHCRD.js";
22
+ } from "./chunk-RRYVGOVK.js";
23
23
  import {
24
24
  getRouteVersions
25
25
  } from "./chunk-AHU7WNL2.js";
@@ -31,21 +31,23 @@ import {
31
31
  resolveRoute,
32
32
  shellQuoteRouteIdentifierForSuggestion,
33
33
  withGlobalFlags
34
- } from "./chunk-A5XRYFVO.js";
34
+ } from "./chunk-OFUQPP26.js";
35
35
  import {
36
36
  editSubcommand
37
- } from "./chunk-BQUQ5F7R.js";
38
- import "./chunk-TWZWQGBN.js";
37
+ } from "./chunk-CRZM5WM2.js";
38
+ import "./chunk-E3NE4SKN.js";
39
+ import "./chunk-4VP55L4V.js";
40
+ import "./chunk-U3WLEFHU.js";
39
41
  import {
40
42
  outputAgentError
41
- } from "./chunk-V23RAVWV.js";
42
- import "./chunk-U3WLEFHU.js";
43
+ } from "./chunk-CGTXAXZ4.js";
43
44
  import {
44
45
  stamp_default
45
46
  } from "./chunk-CO5D46AG.js";
47
+ import "./chunk-RFMC2QXQ.js";
46
48
  import {
47
49
  getCommandName
48
- } from "./chunk-A4NVECX5.js";
50
+ } from "./chunk-ECRBC4HL.js";
49
51
  import {
50
52
  output_manager_default
51
53
  } from "./chunk-ZQKJVHXY.js";
@@ -17,21 +17,23 @@ import {
17
17
  parseSubcommandArgs,
18
18
  resolveRoute,
19
19
  withGlobalFlags
20
- } from "./chunk-A5XRYFVO.js";
20
+ } from "./chunk-OFUQPP26.js";
21
21
  import {
22
22
  enableSubcommand
23
- } from "./chunk-BQUQ5F7R.js";
24
- import "./chunk-TWZWQGBN.js";
23
+ } from "./chunk-CRZM5WM2.js";
24
+ import "./chunk-E3NE4SKN.js";
25
+ import "./chunk-4VP55L4V.js";
26
+ import "./chunk-U3WLEFHU.js";
25
27
  import {
26
28
  outputAgentError
27
- } from "./chunk-V23RAVWV.js";
28
- import "./chunk-U3WLEFHU.js";
29
+ } from "./chunk-CGTXAXZ4.js";
29
30
  import {
30
31
  stamp_default
31
32
  } from "./chunk-CO5D46AG.js";
33
+ import "./chunk-RFMC2QXQ.js";
32
34
  import {
33
35
  getCommandName
34
- } from "./chunk-A4NVECX5.js";
36
+ } from "./chunk-ECRBC4HL.js";
35
37
  import {
36
38
  output_manager_default
37
39
  } from "./chunk-ZQKJVHXY.js";
@@ -9,19 +9,21 @@ import {
9
9
  getRoutes,
10
10
  parseSubcommandArgs,
11
11
  withGlobalFlags
12
- } from "./chunk-A5XRYFVO.js";
12
+ } from "./chunk-OFUQPP26.js";
13
13
  import {
14
14
  exportSubcommand
15
- } from "./chunk-BQUQ5F7R.js";
16
- import "./chunk-TWZWQGBN.js";
15
+ } from "./chunk-CRZM5WM2.js";
16
+ import "./chunk-E3NE4SKN.js";
17
+ import "./chunk-4VP55L4V.js";
18
+ import "./chunk-U3WLEFHU.js";
17
19
  import {
18
20
  outputAgentError
19
- } from "./chunk-V23RAVWV.js";
20
- import "./chunk-U3WLEFHU.js";
21
+ } from "./chunk-CGTXAXZ4.js";
21
22
  import "./chunk-CO5D46AG.js";
23
+ import "./chunk-RFMC2QXQ.js";
22
24
  import {
23
25
  getCommandName
24
- } from "./chunk-A4NVECX5.js";
26
+ } from "./chunk-ECRBC4HL.js";
25
27
  import {
26
28
  output_manager_default
27
29
  } from "./chunk-ZQKJVHXY.js";
@@ -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
+ };