vercel 56.4.0 → 56.5.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 (77) hide show
  1. package/dist/chunks/{add-XY2LNFK3.js → add-6GRH6G2M.js} +4 -4
  2. package/dist/chunks/{add-2HLAH42D.js → add-KNK5E2YT.js} +3 -3
  3. package/dist/chunks/{chunk-WM3UMX65.js → chunk-23U6FANO.js} +1 -1
  4. package/dist/chunks/chunk-2473DUBR.js +15 -0
  5. package/dist/chunks/{chunk-C4TEOOGB.js → chunk-26TEKOBZ.js} +63 -6
  6. package/dist/chunks/{chunk-S7HMSWGQ.js → chunk-3BHSS5E2.js} +2 -2
  7. package/dist/chunks/{chunk-PEC4ROHM.js → chunk-4MK452Y5.js} +5 -5
  8. package/dist/chunks/{chunk-ORMDX3GR.js → chunk-ARKHETJP.js} +1 -1
  9. package/dist/chunks/chunk-BM36UWE2.js +245 -0
  10. package/dist/chunks/{chunk-VZGX4CKB.js → chunk-CM3DLBDY.js} +1 -1
  11. package/dist/chunks/{chunk-SLCLT4P5.js → chunk-DI3HR3K6.js} +1 -1
  12. package/dist/chunks/{chunk-OSXJ6G4O.js → chunk-DOF6CJLL.js} +3 -3
  13. package/dist/chunks/chunk-E336ZXPP.js +43 -0
  14. package/dist/chunks/{chunk-K6YMSJMZ.js → chunk-EYICIM2K.js} +4 -4
  15. package/dist/chunks/chunk-FHEMFAHB.js +320 -0
  16. package/dist/chunks/{chunk-JGXABANG.js → chunk-G4MTGCZ5.js} +1 -1
  17. package/dist/chunks/{chunk-IN3RG4AU.js → chunk-GAOAGU5K.js} +1 -1
  18. package/dist/chunks/{chunk-UA3D44SL.js → chunk-GNV7547O.js} +1 -1
  19. package/dist/chunks/{chunk-2KNVJ7ET.js → chunk-IBP2XAUH.js} +103 -3
  20. package/dist/chunks/{chunk-JIK3GTU3.js → chunk-JQG5EDRD.js} +1 -1
  21. package/dist/chunks/{chunk-ENIJVO7C.js → chunk-PPEQUJ7T.js} +2 -2
  22. package/dist/chunks/{chunk-EJNFC5AV.js → chunk-PRYNIKBZ.js} +1 -1
  23. package/dist/chunks/{chunk-BRTMH4PL.js → chunk-SWEPOMSA.js} +1 -1
  24. package/dist/chunks/{chunk-QX4337BT.js → chunk-TMK6RSYW.js} +842 -842
  25. package/dist/chunks/chunk-WR7JTCGL.js +104 -0
  26. package/dist/chunks/{chunk-4QRRJEYO.js → chunk-X43U65TH.js} +2 -2
  27. package/dist/chunks/chunk-YTFJGKRG.js +247 -0
  28. package/dist/chunks/{compile-vercel-config-4Q4YZ44O.js → compile-vercel-config-IFET4E6H.js} +2 -2
  29. package/dist/chunks/config-validator.mjs +1 -0
  30. package/dist/chunks/{delete-AUDPLCMU.js → delete-PXB5WRH7.js} +3 -3
  31. package/dist/chunks/delete-X2MUMONI.js +150 -0
  32. package/dist/chunks/{disable-WFPXR7GZ.js → disable-GBL3SHJL.js} +3 -3
  33. package/dist/chunks/{discard-RVFKIZZG.js → discard-XVVSRGDR.js} +3 -3
  34. package/dist/chunks/{edit-KO5KX4WU.js → edit-EIHRP6XT.js} +4 -4
  35. package/dist/chunks/edit-K5Y2BDJO.js +153 -0
  36. package/dist/chunks/{enable-I5HE32DI.js → enable-W7AMJWKH.js} +3 -3
  37. package/dist/chunks/{export-4Y5L2TOT.js → export-N3AZ2KOO.js} +3 -3
  38. package/dist/chunks/{image-QC5MVWKN.js → image-DRTGVPVJ.js} +3 -3
  39. package/dist/chunks/{inspect-Q5BKZNVI.js → inspect-5YUAEI3L.js} +3 -3
  40. package/dist/chunks/{inspect-BULBAPNR.js → inspect-AAIVWSJI.js} +3 -3
  41. package/dist/chunks/{inspect-JUGFKEGR.js → inspect-DYXTX6P4.js} +3 -3
  42. package/dist/chunks/{inspect-PJDCPARM.js → inspect-IPSAYR2C.js} +3 -3
  43. package/dist/chunks/inspect-SLZLI6ZC.js +205 -0
  44. package/dist/chunks/{list-FJT44SB6.js → list-IF2YW73F.js} +2 -2
  45. package/dist/chunks/list-K2HLGUXV.js +360 -0
  46. package/dist/chunks/{list-N7OA4FBI.js → list-V7VTXVK4.js} +3 -3
  47. package/dist/chunks/{login-BPE774JW.js → login-7C6HQEOG.js} +3 -3
  48. package/dist/chunks/{ls-YV554CRJ.js → ls-2NU353QP.js} +3 -3
  49. package/dist/chunks/{ls-H52WO65Y.js → ls-NKECPPOR.js} +3 -3
  50. package/dist/chunks/{ls-E47M6P5O.js → ls-QQQHOJBE.js} +3 -3
  51. package/dist/chunks/{ls-26VFGQ6P.js → ls-RH6Y4XBS.js} +4 -4
  52. package/dist/chunks/open-2FAPZA6V.js +106 -0
  53. package/dist/chunks/{publish-DUTEBRX3.js → publish-G7PB64LJ.js} +3 -3
  54. package/dist/chunks/{query-QDOKUCHX.js → query-D4QBT4WR.js} +2 -2
  55. package/dist/chunks/{reorder-L2M3YGJ4.js → reorder-3Z7YIPAX.js} +3 -3
  56. package/dist/chunks/reply-7QQBXL5H.js +167 -0
  57. package/dist/chunks/resolve-UYKTDZEX.js +228 -0
  58. package/dist/chunks/{restore-BVDNAJVC.js → restore-Q2DR7SMW.js} +3 -3
  59. package/dist/chunks/{rm-VHWBHG3A.js → rm-O4M4GFSK.js} +3 -3
  60. package/dist/chunks/{rm-7KSHXSTB.js → rm-OCLUTM57.js} +4 -4
  61. package/dist/chunks/{rm-4OQ7G6UX.js → rm-PCWMEHQ2.js} +3 -3
  62. package/dist/chunks/{rule-inspect-AT6IEOUF.js → rule-inspect-XJ47UEG7.js} +4 -4
  63. package/dist/chunks/{rules-SQFCUKWS.js → rules-LIH5FLPJ.js} +6 -6
  64. package/dist/chunks/{schema-PWSCMD24.js → schema-OFALTXXM.js} +2 -2
  65. package/dist/chunks/{tags-BT7ZGJP2.js → tags-P4HIAI6D.js} +2 -2
  66. package/dist/chunks/{update-PTDGBKEH.js → update-E3ZQAFBS.js} +4 -4
  67. package/dist/commands/build/index.js +11 -11
  68. package/dist/commands/deploy/index.js +13 -12
  69. package/dist/commands/dev/index.js +10 -10
  70. package/dist/commands/env/index.js +9 -8
  71. package/dist/commands/link/index.js +8 -7
  72. package/dist/commands/list/index.js +5 -5
  73. package/dist/commands-bulk.js +2744 -1982
  74. package/dist/index.js +19 -8
  75. package/dist/vc.js +6 -1
  76. package/dist/version.mjs +1 -1
  77. package/package.json +92 -12
@@ -9,8 +9,8 @@ import {
9
9
  handleRulesApiError,
10
10
  parseRulesFlagsAndScope,
11
11
  rulesCollectionPath
12
- } from "./chunk-BRTMH4PL.js";
13
- import "./chunk-WM3UMX65.js";
12
+ } from "./chunk-SWEPOMSA.js";
13
+ import "./chunk-23U6FANO.js";
14
14
  import "./chunk-BUZRVER7.js";
15
15
  import {
16
16
  validateJsonOutput
@@ -18,12 +18,12 @@ import {
18
18
  import {
19
19
  rulesLsSubcommand
20
20
  } from "./chunk-STJJ3DFO.js";
21
- import "./chunk-QX4337BT.js";
21
+ import "./chunk-TMK6RSYW.js";
22
+ import "./chunk-ECCWJHC6.js";
22
23
  import {
23
24
  AGENT_REASON,
24
25
  outputAgentError
25
26
  } from "./chunk-UDWRZXIT.js";
26
- import "./chunk-ECCWJHC6.js";
27
27
  import {
28
28
  parseArguments,
29
29
  printError
@@ -0,0 +1,106 @@
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
+ parseThreadArg
9
+ } from "./chunk-E336ZXPP.js";
10
+ import {
11
+ getThread,
12
+ handleCommentsParseError,
13
+ resolveCommentsScope,
14
+ threadNotFoundMessage,
15
+ toApiErrorParts
16
+ } from "./chunk-YTFJGKRG.js";
17
+ import {
18
+ outputError
19
+ } from "./chunk-BUZRVER7.js";
20
+ import {
21
+ openSubcommand
22
+ } from "./chunk-FHEMFAHB.js";
23
+ import {
24
+ require_open
25
+ } from "./chunk-TMK6RSYW.js";
26
+ import "./chunk-ECCWJHC6.js";
27
+ import "./chunk-UDWRZXIT.js";
28
+ import {
29
+ parseArguments
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 {
43
+ __toESM
44
+ } from "./chunk-TZ2YI2VH.js";
45
+
46
+ // src/commands/comments/open.ts
47
+ var import_open = __toESM(require_open(), 1);
48
+ async function openThread(client, telemetry) {
49
+ let parsedArgs;
50
+ const flagsSpecification = getFlagsSpecification(openSubcommand.options);
51
+ try {
52
+ parsedArgs = parseArguments(client.argv.slice(2), flagsSpecification);
53
+ } catch (err) {
54
+ return handleCommentsParseError(err, "open");
55
+ }
56
+ const threadInput = parsedArgs.args[2];
57
+ telemetry.trackCliArgumentThread(threadInput);
58
+ if (!threadInput) {
59
+ output_manager_default.error("Pass a thread ID or URL: `vercel comments open <thread>`.");
60
+ return 1;
61
+ }
62
+ const threadRef = parseThreadArg(threadInput);
63
+ if (!threadRef) {
64
+ output_manager_default.error(
65
+ `Could not extract a thread ID from "${threadInput}". Pass the thread ID or its vercel.com URL.`
66
+ );
67
+ return 1;
68
+ }
69
+ const threadId = threadRef.id;
70
+ telemetry.trackCliOptionProject(parsedArgs.flags["--project"]);
71
+ const scope = await resolveCommentsScope(client, {
72
+ project: parsedArgs.flags["--project"],
73
+ requireProject: false,
74
+ jsonOutput: false,
75
+ urlTeamSlug: threadRef.teamSlug
76
+ });
77
+ if (typeof scope === "number") {
78
+ return scope;
79
+ }
80
+ let webUrl;
81
+ try {
82
+ const thread = await getThread(client, scope.teamId, threadId);
83
+ webUrl = thread.webUrl;
84
+ } catch (err) {
85
+ if (isAPIError(err)) {
86
+ const { code, message } = toApiErrorParts(err);
87
+ return outputError(
88
+ client,
89
+ false,
90
+ code,
91
+ err.status === 404 ? threadNotFoundMessage(threadId, scope) : message
92
+ );
93
+ }
94
+ throw err;
95
+ }
96
+ if (!webUrl) {
97
+ output_manager_default.error(`The API returned no web URL for ${threadId}.`);
98
+ return 1;
99
+ }
100
+ output_manager_default.log(`Opening ${webUrl}`);
101
+ await (0, import_open.default)(webUrl);
102
+ return 0;
103
+ }
104
+ export {
105
+ openThread as default
106
+ };
@@ -17,7 +17,7 @@ import {
17
17
  printDiffSummary,
18
18
  requireProjectContext,
19
19
  withGlobalFlags
20
- } from "./chunk-ORMDX3GR.js";
20
+ } from "./chunk-ARKHETJP.js";
21
21
  import {
22
22
  publishSubcommand
23
23
  } from "./chunk-VZSZBD4V.js";
@@ -25,11 +25,11 @@ import {
25
25
  stamp_default
26
26
  } from "./chunk-64IF634X.js";
27
27
  import "./chunk-VXYGCOKL.js";
28
- import "./chunk-QX4337BT.js";
28
+ import "./chunk-TMK6RSYW.js";
29
+ import "./chunk-ECCWJHC6.js";
29
30
  import {
30
31
  outputAgentError
31
32
  } from "./chunk-UDWRZXIT.js";
32
- import "./chunk-ECCWJHC6.js";
33
33
  import "./chunk-SZXT3PDQ.js";
34
34
  import "./chunk-KSSNLCL4.js";
35
35
  import "./chunk-P4QNYOFB.js";
@@ -34,9 +34,9 @@ import {
34
34
  getLinkedProject,
35
35
  getProjectByNameOrId,
36
36
  getScope
37
- } from "./chunk-QX4337BT.js";
38
- import "./chunk-UDWRZXIT.js";
37
+ } from "./chunk-TMK6RSYW.js";
39
38
  import "./chunk-ECCWJHC6.js";
39
+ import "./chunk-UDWRZXIT.js";
40
40
  import {
41
41
  parseArguments,
42
42
  printError
@@ -16,7 +16,7 @@ import {
16
16
  resolveRoute,
17
17
  shellQuoteRouteIdentifierForSuggestion,
18
18
  withGlobalFlags
19
- } from "./chunk-ORMDX3GR.js";
19
+ } from "./chunk-ARKHETJP.js";
20
20
  import {
21
21
  reorderSubcommand
22
22
  } from "./chunk-VZSZBD4V.js";
@@ -24,11 +24,11 @@ import {
24
24
  stamp_default
25
25
  } from "./chunk-64IF634X.js";
26
26
  import "./chunk-VXYGCOKL.js";
27
- import "./chunk-QX4337BT.js";
27
+ import "./chunk-TMK6RSYW.js";
28
+ import "./chunk-ECCWJHC6.js";
28
29
  import {
29
30
  outputAgentError
30
31
  } from "./chunk-UDWRZXIT.js";
31
- import "./chunk-ECCWJHC6.js";
32
32
  import "./chunk-SZXT3PDQ.js";
33
33
  import "./chunk-KSSNLCL4.js";
34
34
  import "./chunk-P4QNYOFB.js";
@@ -0,0 +1,167 @@
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
+ resolveMessageContent
9
+ } from "./chunk-WR7JTCGL.js";
10
+ import {
11
+ parseThreadArg
12
+ } from "./chunk-E336ZXPP.js";
13
+ import {
14
+ addMessage,
15
+ handleCommentsParseError,
16
+ resolveCommentsScope,
17
+ threadNotFoundMessage,
18
+ toApiErrorParts
19
+ } from "./chunk-YTFJGKRG.js";
20
+ import "./chunk-2473DUBR.js";
21
+ import {
22
+ outputError
23
+ } from "./chunk-BUZRVER7.js";
24
+ import {
25
+ validateJsonOutput
26
+ } from "./chunk-XPKWKPWA.js";
27
+ import {
28
+ replySubcommand
29
+ } from "./chunk-FHEMFAHB.js";
30
+ import "./chunk-TMK6RSYW.js";
31
+ import "./chunk-ECCWJHC6.js";
32
+ import "./chunk-UDWRZXIT.js";
33
+ import {
34
+ parseArguments
35
+ } from "./chunk-SZXT3PDQ.js";
36
+ import {
37
+ getFlagsSpecification,
38
+ isAPIError
39
+ } from "./chunk-KSSNLCL4.js";
40
+ import "./chunk-P4QNYOFB.js";
41
+ import "./chunk-52QYYTM5.js";
42
+ import {
43
+ output_manager_default
44
+ } from "./chunk-OX7KI3LF.js";
45
+ import "./chunk-GGP5R3FU.js";
46
+ import {
47
+ require_source
48
+ } from "./chunk-S7KYDPEM.js";
49
+ import {
50
+ __toESM
51
+ } from "./chunk-TZ2YI2VH.js";
52
+
53
+ // src/commands/comments/reply.ts
54
+ var import_chalk = __toESM(require_source(), 1);
55
+ function validateAttachments(attach) {
56
+ if (!attach || attach.length === 0) {
57
+ return void 0;
58
+ }
59
+ if (attach.length > 10) {
60
+ return "A message can have at most 10 attachments.";
61
+ }
62
+ for (const url of attach) {
63
+ if (!/^https:\/\//i.test(url)) {
64
+ return `Attachments must be https URLs (the API fetches them); got "${url}". Local file upload is not supported by the API.`;
65
+ }
66
+ }
67
+ return void 0;
68
+ }
69
+ async function reply(client, telemetry) {
70
+ let parsedArgs;
71
+ const flagsSpecification = getFlagsSpecification(replySubcommand.options);
72
+ try {
73
+ parsedArgs = parseArguments(client.argv.slice(2), flagsSpecification);
74
+ } catch (err) {
75
+ return handleCommentsParseError(err, "reply");
76
+ }
77
+ const formatResult = validateJsonOutput(parsedArgs.flags);
78
+ if (!formatResult.valid) {
79
+ output_manager_default.error(formatResult.error);
80
+ return 1;
81
+ }
82
+ const jsonOutput = formatResult.jsonOutput;
83
+ telemetry.trackCliOptionFormat(parsedArgs.flags["--format"]);
84
+ telemetry.trackCliOptionMessage(parsedArgs.flags["--message"]);
85
+ telemetry.trackCliOptionFile(parsedArgs.flags["--file"]);
86
+ telemetry.trackCliOptionAttach(parsedArgs.flags["--attach"]);
87
+ const threadInput = parsedArgs.args[2];
88
+ telemetry.trackCliArgumentThread(threadInput);
89
+ if (!threadInput) {
90
+ return outputError(
91
+ client,
92
+ jsonOutput,
93
+ "MISSING_THREAD",
94
+ "Pass a thread ID or URL: `vercel comments reply <thread> -m <text>`."
95
+ );
96
+ }
97
+ const threadRef = parseThreadArg(threadInput);
98
+ if (!threadRef) {
99
+ return outputError(
100
+ client,
101
+ jsonOutput,
102
+ "INVALID_THREAD",
103
+ `Could not extract a thread ID from "${threadInput}". Pass the thread ID or its vercel.com URL.`
104
+ );
105
+ }
106
+ const threadId = threadRef.id;
107
+ const attach = parsedArgs.flags["--attach"];
108
+ const attachError = validateAttachments(attach);
109
+ if (attachError) {
110
+ return outputError(client, jsonOutput, "INVALID_ATTACHMENT", attachError);
111
+ }
112
+ const content = await resolveMessageContent(
113
+ client,
114
+ {
115
+ message: parsedArgs.flags["--message"],
116
+ file: parsedArgs.flags["--file"],
117
+ hasAttachments: Boolean(attach && attach.length > 0)
118
+ },
119
+ jsonOutput
120
+ );
121
+ if (typeof content === "number") {
122
+ return content;
123
+ }
124
+ telemetry.trackCliOptionProject(parsedArgs.flags["--project"]);
125
+ const scope = await resolveCommentsScope(client, {
126
+ project: parsedArgs.flags["--project"],
127
+ requireProject: false,
128
+ jsonOutput,
129
+ urlTeamSlug: threadRef.teamSlug
130
+ });
131
+ if (typeof scope === "number") {
132
+ return scope;
133
+ }
134
+ if (!jsonOutput) {
135
+ output_manager_default.spinner("Posting reply\u2026");
136
+ }
137
+ try {
138
+ const message = await addMessage(client, scope.teamId, threadId, {
139
+ ...content !== void 0 && { markdown: content },
140
+ ...attach && attach.length > 0 && { attachments: attach.map((url) => ({ url })) }
141
+ });
142
+ if (jsonOutput) {
143
+ client.stdout.write(`${JSON.stringify(message, null, 2)}
144
+ `);
145
+ return 0;
146
+ }
147
+ output_manager_default.print(`${import_chalk.default.green("\u2713")} Replied to ${threadId}
148
+ `);
149
+ return 0;
150
+ } catch (err) {
151
+ if (isAPIError(err)) {
152
+ const { code, message } = toApiErrorParts(err);
153
+ return outputError(
154
+ client,
155
+ jsonOutput,
156
+ code,
157
+ err.status === 404 ? threadNotFoundMessage(threadId, scope) : message
158
+ );
159
+ }
160
+ throw err;
161
+ } finally {
162
+ output_manager_default.stopSpinner();
163
+ }
164
+ }
165
+ export {
166
+ reply as default
167
+ };
@@ -0,0 +1,228 @@
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
+ parseThreadArg
9
+ } from "./chunk-E336ZXPP.js";
10
+ import {
11
+ addMessage,
12
+ handleCommentsParseError,
13
+ resolveCommentsScope,
14
+ threadNotFoundMessage,
15
+ toApiErrorParts,
16
+ updateThread
17
+ } from "./chunk-YTFJGKRG.js";
18
+ import {
19
+ canPrompt
20
+ } from "./chunk-2473DUBR.js";
21
+ import {
22
+ outputError
23
+ } from "./chunk-BUZRVER7.js";
24
+ import {
25
+ validateJsonOutput
26
+ } from "./chunk-XPKWKPWA.js";
27
+ import {
28
+ reopenSubcommand,
29
+ resolveSubcommand
30
+ } from "./chunk-FHEMFAHB.js";
31
+ import "./chunk-TMK6RSYW.js";
32
+ import "./chunk-ECCWJHC6.js";
33
+ import "./chunk-UDWRZXIT.js";
34
+ import {
35
+ parseArguments
36
+ } from "./chunk-SZXT3PDQ.js";
37
+ import {
38
+ getFlagsSpecification,
39
+ isAPIError
40
+ } from "./chunk-KSSNLCL4.js";
41
+ import "./chunk-P4QNYOFB.js";
42
+ import "./chunk-52QYYTM5.js";
43
+ import {
44
+ output_manager_default
45
+ } from "./chunk-OX7KI3LF.js";
46
+ import "./chunk-GGP5R3FU.js";
47
+ import {
48
+ require_source
49
+ } from "./chunk-S7KYDPEM.js";
50
+ import {
51
+ __toESM
52
+ } from "./chunk-TZ2YI2VH.js";
53
+
54
+ // src/commands/comments/resolve.ts
55
+ var import_chalk = __toESM(require_source(), 1);
56
+ async function resolveThreads(client, telemetry, resolved) {
57
+ const subcommand = resolved ? resolveSubcommand : reopenSubcommand;
58
+ const verb = resolved ? "resolve" : "reopen";
59
+ const pastVerb = resolved ? "resolved" : "reopened";
60
+ let parsedArgs;
61
+ const flagsSpecification = getFlagsSpecification(subcommand.options);
62
+ try {
63
+ parsedArgs = parseArguments(client.argv.slice(2), flagsSpecification);
64
+ } catch (err) {
65
+ return handleCommentsParseError(err, subcommand.name);
66
+ }
67
+ const formatResult = validateJsonOutput(parsedArgs.flags);
68
+ if (!formatResult.valid) {
69
+ output_manager_default.error(formatResult.error);
70
+ return 1;
71
+ }
72
+ const jsonOutput = formatResult.jsonOutput;
73
+ const closingMessage = resolved ? parsedArgs.flags["--message"] : void 0;
74
+ const yes = Boolean(parsedArgs.flags["--yes"]);
75
+ telemetry.trackCliOptionFormat(parsedArgs.flags["--format"]);
76
+ telemetry.trackCliFlagYes(parsedArgs.flags["--yes"]);
77
+ if (resolved) {
78
+ telemetry.trackCliOptionMessage(closingMessage);
79
+ }
80
+ const threadInputs = parsedArgs.args.slice(2);
81
+ telemetry.trackCliArgumentThread(threadInputs[0]);
82
+ if (threadInputs.length === 0) {
83
+ return outputError(
84
+ client,
85
+ jsonOutput,
86
+ "MISSING_THREAD",
87
+ `Pass at least one thread ID or URL: \`vercel comments ${verb} <thread>\`.`
88
+ );
89
+ }
90
+ const threadIds = [];
91
+ let urlTeamSlug;
92
+ for (const input of threadInputs) {
93
+ const ref = parseThreadArg(input);
94
+ if (!ref) {
95
+ return outputError(
96
+ client,
97
+ jsonOutput,
98
+ "INVALID_THREAD",
99
+ `Could not extract a thread ID from "${input}".`
100
+ );
101
+ }
102
+ if (ref.teamSlug) {
103
+ if (urlTeamSlug && urlTeamSlug !== ref.teamSlug) {
104
+ return outputError(
105
+ client,
106
+ jsonOutput,
107
+ "MIXED_TEAMS",
108
+ `The URLs belong to different teams (${urlTeamSlug}, ${ref.teamSlug}). Run once per team.`
109
+ );
110
+ }
111
+ urlTeamSlug = ref.teamSlug;
112
+ }
113
+ threadIds.push(ref.id);
114
+ }
115
+ if (closingMessage !== void 0 && threadIds.length > 1) {
116
+ return outputError(
117
+ client,
118
+ jsonOutput,
119
+ "MESSAGE_WITH_MULTIPLE_THREADS",
120
+ "Cannot use -m with multiple threads. Resolve one thread with a closing message, or resolve multiple threads without -m."
121
+ );
122
+ }
123
+ const scope = await resolveCommentsScope(client, {
124
+ project: parsedArgs.flags["--project"],
125
+ requireProject: false,
126
+ jsonOutput,
127
+ urlTeamSlug
128
+ });
129
+ if (typeof scope === "number") {
130
+ return scope;
131
+ }
132
+ if (threadIds.length > 1 && !yes) {
133
+ if (!canPrompt(client) || jsonOutput) {
134
+ return outputError(
135
+ client,
136
+ jsonOutput,
137
+ "CONFIRMATION_REQUIRED",
138
+ `Pass --yes to ${verb} ${threadIds.length} comments non-interactively.`
139
+ );
140
+ }
141
+ const confirmed = await client.input.confirm(
142
+ `${import_chalk.default.bold(String(threadIds.length))} comments will be ${pastVerb} in team ${scope.teamSlug ?? scope.teamId}. Continue?`,
143
+ false
144
+ );
145
+ if (!confirmed) {
146
+ output_manager_default.log("Canceled.");
147
+ return 0;
148
+ }
149
+ }
150
+ telemetry.trackCliOptionProject(
151
+ parsedArgs.flags["--project"]
152
+ );
153
+ if (threadIds.length === 1) {
154
+ const threadId = threadIds[0];
155
+ let replied = false;
156
+ try {
157
+ if (closingMessage !== void 0) {
158
+ await addMessage(client, scope.teamId, threadId, {
159
+ markdown: closingMessage
160
+ });
161
+ replied = true;
162
+ }
163
+ const thread = await updateThread(
164
+ client,
165
+ scope.teamId,
166
+ threadId,
167
+ resolved
168
+ );
169
+ if (jsonOutput) {
170
+ client.stdout.write(
171
+ `${JSON.stringify({ thread, replied }, null, 2)}
172
+ `
173
+ );
174
+ return 0;
175
+ }
176
+ output_manager_default.print(
177
+ `${import_chalk.default.green("\u2713")} ${threadId} ${pastVerb}${replied ? " (with closing reply)" : ""}
178
+ `
179
+ );
180
+ return 0;
181
+ } catch (err) {
182
+ if (isAPIError(err)) {
183
+ const { code, message } = toApiErrorParts(err);
184
+ const friendly = err.status === 404 ? threadNotFoundMessage(threadId, scope) : message;
185
+ return outputError(
186
+ client,
187
+ jsonOutput,
188
+ code,
189
+ replied ? `Replied, but ${verb} failed: ${friendly} Run \`vercel comments resolve ${threadId}\` (without -m) to finish without duplicating the reply.` : friendly
190
+ );
191
+ }
192
+ throw err;
193
+ }
194
+ }
195
+ const results = [];
196
+ for (const threadId of threadIds) {
197
+ try {
198
+ await updateThread(client, scope.teamId, threadId, resolved);
199
+ results.push({ id: threadId, ok: true });
200
+ } catch (err) {
201
+ if (isAPIError(err)) {
202
+ const { message } = toApiErrorParts(err);
203
+ results.push({ id: threadId, ok: false, error: message });
204
+ } else {
205
+ throw err;
206
+ }
207
+ }
208
+ }
209
+ const failed = results.filter((result) => !result.ok);
210
+ if (jsonOutput) {
211
+ client.stdout.write(`${JSON.stringify({ results }, null, 2)}
212
+ `);
213
+ return failed.length > 0 ? 1 : 0;
214
+ }
215
+ for (const result of results) {
216
+ if (result.ok) {
217
+ output_manager_default.print(`${import_chalk.default.green("\u2713")} ${result.id} ${pastVerb}
218
+ `);
219
+ } else {
220
+ output_manager_default.print(`${import_chalk.default.yellow("!")} ${result.id} ${result.error}
221
+ `);
222
+ }
223
+ }
224
+ return failed.length > 0 ? 1 : 0;
225
+ }
226
+ export {
227
+ resolveThreads as default
228
+ };
@@ -19,7 +19,7 @@ import {
19
19
  requireProjectContext,
20
20
  validateRequiredArguments,
21
21
  withGlobalFlags
22
- } from "./chunk-ORMDX3GR.js";
22
+ } from "./chunk-ARKHETJP.js";
23
23
  import {
24
24
  restoreSubcommand
25
25
  } from "./chunk-VZSZBD4V.js";
@@ -27,11 +27,11 @@ import {
27
27
  stamp_default
28
28
  } from "./chunk-64IF634X.js";
29
29
  import "./chunk-VXYGCOKL.js";
30
- import "./chunk-QX4337BT.js";
30
+ import "./chunk-TMK6RSYW.js";
31
+ import "./chunk-ECCWJHC6.js";
31
32
  import {
32
33
  outputAgentError
33
34
  } from "./chunk-UDWRZXIT.js";
34
- import "./chunk-ECCWJHC6.js";
35
35
  import "./chunk-SZXT3PDQ.js";
36
36
  import "./chunk-KSSNLCL4.js";
37
37
  import "./chunk-P4QNYOFB.js";
@@ -13,7 +13,7 @@ import {
13
13
  requireVcrRepository,
14
14
  resolveVcrScope,
15
15
  validateVcrJsonOutput
16
- } from "./chunk-SLCLT4P5.js";
16
+ } from "./chunk-DI3HR3K6.js";
17
17
  import "./chunk-BUZRVER7.js";
18
18
  import "./chunk-XPKWKPWA.js";
19
19
  import {
@@ -21,13 +21,13 @@ import {
21
21
  } from "./chunk-3VS4DTAU.js";
22
22
  import "./chunk-GIL3VAUR.js";
23
23
  import "./chunk-FYQPTH5C.js";
24
- import "./chunk-QX4337BT.js";
24
+ import "./chunk-TMK6RSYW.js";
25
+ import "./chunk-ECCWJHC6.js";
25
26
  import {
26
27
  AGENT_REASON,
27
28
  buildCommandWithYes,
28
29
  outputAgentError
29
30
  } from "./chunk-UDWRZXIT.js";
30
- import "./chunk-ECCWJHC6.js";
31
31
  import {
32
32
  parseArguments,
33
33
  printError
@@ -9,8 +9,8 @@ import {
9
9
  handleRulesApiError,
10
10
  parseRulesFlagsAndScope,
11
11
  rulesItemPath
12
- } from "./chunk-BRTMH4PL.js";
13
- import "./chunk-WM3UMX65.js";
12
+ } from "./chunk-SWEPOMSA.js";
13
+ import "./chunk-23U6FANO.js";
14
14
  import "./chunk-BUZRVER7.js";
15
15
  import {
16
16
  validateJsonOutput
@@ -18,14 +18,14 @@ import {
18
18
  import {
19
19
  rulesRmSubcommand
20
20
  } from "./chunk-STJJ3DFO.js";
21
- import "./chunk-QX4337BT.js";
21
+ import "./chunk-TMK6RSYW.js";
22
+ import "./chunk-ECCWJHC6.js";
22
23
  import {
23
24
  AGENT_REASON,
24
25
  buildCommandWithGlobalFlags,
25
26
  buildCommandWithYes,
26
27
  outputAgentError
27
28
  } from "./chunk-UDWRZXIT.js";
28
- import "./chunk-ECCWJHC6.js";
29
29
  import {
30
30
  parseArguments,
31
31
  printError
@@ -13,19 +13,19 @@ import {
13
13
  requireVcrRepositoryAndImageId,
14
14
  resolveVcrScope,
15
15
  validateVcrJsonOutput
16
- } from "./chunk-SLCLT4P5.js";
16
+ } from "./chunk-DI3HR3K6.js";
17
17
  import "./chunk-BUZRVER7.js";
18
18
  import "./chunk-XPKWKPWA.js";
19
19
  import {
20
20
  imageRmSubcommand
21
21
  } from "./chunk-FYQPTH5C.js";
22
- import "./chunk-QX4337BT.js";
22
+ import "./chunk-TMK6RSYW.js";
23
+ import "./chunk-ECCWJHC6.js";
23
24
  import {
24
25
  AGENT_REASON,
25
26
  buildCommandWithYes,
26
27
  outputAgentError
27
28
  } from "./chunk-UDWRZXIT.js";
28
- import "./chunk-ECCWJHC6.js";
29
29
  import {
30
30
  parseArguments,
31
31
  printError