vercel 56.4.1 → 57.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 (94) hide show
  1. package/dist/chunks/{add-L3Z6PL54.js → add-7M577U56.js} +7 -6
  2. package/dist/chunks/{add-RFEJCIBM.js → add-YRZTDNXX.js} +3 -3
  3. package/dist/chunks/{chunk-V5P25P7F.js → chunk-2473DUBR.js} +4 -11
  4. package/dist/chunks/{chunk-5EXIJBLL.js → chunk-2EDWKVNP.js} +8 -8
  5. package/dist/chunks/{chunk-YS6EDZHB.js → chunk-2MJROFVC.js} +5 -1
  6. package/dist/chunks/{chunk-OOD67FAL.js → chunk-3242RXCN.js} +1 -1
  7. package/dist/chunks/chunk-3PGXYIKC.js +147 -0
  8. package/dist/chunks/{chunk-CHZBEMLF.js → chunk-4PGF367U.js} +47 -210
  9. package/dist/chunks/{chunk-GKVAAY2A.js → chunk-555WJSO5.js} +1 -1
  10. package/dist/chunks/chunk-5AJPMLDV.js +28 -0
  11. package/dist/chunks/{chunk-IHQ7DPQI.js → chunk-A2TYQBX2.js} +117 -3
  12. package/dist/chunks/chunk-A3NYPUKZ.js +17 -0
  13. package/dist/chunks/{chunk-W346YNDN.js → chunk-DWMH5M4Q.js} +4 -1
  14. package/dist/chunks/chunk-E336ZXPP.js +43 -0
  15. package/dist/chunks/chunk-F5PQWDOC.js +245 -0
  16. package/dist/chunks/{chunk-Y7TVKRRJ.js → chunk-F7X55TOY.js} +15 -839
  17. package/dist/chunks/chunk-FGDKMNEN.js +21 -0
  18. package/dist/chunks/chunk-FHEMFAHB.js +320 -0
  19. package/dist/chunks/{chunk-NLRIKNPX.js → chunk-GP5VCTEU.js} +1 -1
  20. package/dist/chunks/chunk-GZLPFESR.js +48 -0
  21. package/dist/chunks/{chunk-HZKJMZEQ.js → chunk-HD7B425F.js} +2 -2
  22. package/dist/chunks/{chunk-J6KTUJHV.js → chunk-IOAZNR6Z.js} +1 -1
  23. package/dist/chunks/{chunk-STJJ3DFO.js → chunk-KCF6S3XF.js} +16 -1
  24. package/dist/chunks/chunk-LMHT3QR3.js +247 -0
  25. package/dist/chunks/{chunk-A4XB42AB.js → chunk-MAHINYBW.js} +4 -3
  26. package/dist/chunks/{chunk-DXFSBJTA.js → chunk-MIFDRYTN.js} +1 -1
  27. package/dist/chunks/{chunk-VLTQJKP6.js → chunk-NH43BFJ3.js} +1 -1
  28. package/dist/chunks/{chunk-Z7NPYIZ6.js → chunk-NM43FFV6.js} +0 -8
  29. package/dist/chunks/{chunk-MQRHJEBS.js → chunk-NRNMT43R.js} +3 -3
  30. package/dist/chunks/chunk-OF2GNB42.js +53 -0
  31. package/dist/chunks/chunk-PRWJUY5U.js +848 -0
  32. package/dist/chunks/{chunk-F5OMERHI.js → chunk-QZD5DKUR.js} +10 -23
  33. package/dist/chunks/{chunk-4M3ZQCYN.js → chunk-RAFH25WW.js} +8 -1
  34. package/dist/chunks/{chunk-43B3LNUF.js → chunk-RYO6FJFB.js} +1 -1
  35. package/dist/chunks/{chunk-XFGY3JAX.js → chunk-T4NODP6Y.js} +11 -18
  36. package/dist/chunks/{chunk-GLAHGVBS.js → chunk-TBR2Q37Y.js} +2038 -1786
  37. package/dist/chunks/chunk-V4RMJKQP.js +36 -0
  38. package/dist/chunks/chunk-WR7JTCGL.js +104 -0
  39. package/dist/chunks/{chunk-6RTK6BWX.js → chunk-YA3WQFLY.js} +1 -1
  40. package/dist/chunks/{chunk-UHGAPG7O.js → chunk-YOZCJHLZ.js} +4 -4
  41. package/dist/chunks/{compile-vercel-config-J2X5OV6K.js → compile-vercel-config-3OHO3TJA.js} +2 -2
  42. package/dist/chunks/config-validator.mjs +1 -0
  43. package/dist/chunks/delete-3DZOCWCC.js +150 -0
  44. package/dist/chunks/{delete-57A44RN7.js → delete-VOSJLNEA.js} +3 -3
  45. package/dist/chunks/{disable-DNZ52MEO.js → disable-LQDEVRQF.js} +3 -3
  46. package/dist/chunks/{discard-HACSIZ74.js → discard-RGV4JKXQ.js} +3 -3
  47. package/dist/chunks/{edit-HJ47TQU3.js → edit-SFIEOQ24.js} +4 -4
  48. package/dist/chunks/edit-UPZPI54L.js +153 -0
  49. package/dist/chunks/{enable-BVLRVRYM.js → enable-6UVH35WC.js} +3 -3
  50. package/dist/chunks/{export-7MJFGMG7.js → export-6CEG3CK7.js} +3 -3
  51. package/dist/chunks/{image-4UMD7UZP.js → image-CQRCD2OE.js} +3 -3
  52. package/dist/chunks/inspect-4ZAH3RFT.js +205 -0
  53. package/dist/chunks/inspect-EXQBIAFF.js +587 -0
  54. package/dist/chunks/{inspect-WBHUZC3R.js → inspect-K5ZMQG7X.js} +3 -3
  55. package/dist/chunks/{inspect-4JD2QN67.js → inspect-UM3LDRPV.js} +3 -3
  56. package/dist/chunks/{inspect-XX3OXSHC.js → inspect-ZFRY3X3H.js} +3 -3
  57. package/dist/chunks/{list-AM6K2JCW.js → list-4DRVM7Q4.js} +42 -55
  58. package/dist/chunks/{list-5H57NTM4.js → list-FJCBOCCA.js} +2 -2
  59. package/dist/chunks/list-KCUHD4OA.js +360 -0
  60. package/dist/chunks/{login-YO34E4V5.js → login-DFGYNU3K.js} +3 -3
  61. package/dist/chunks/{ls-44NPIO2N.js → ls-34NCZKBE.js} +3 -3
  62. package/dist/chunks/{ls-P7ZLBWW2.js → ls-4QHHVXXD.js} +3 -3
  63. package/dist/chunks/{ls-YDUYTLXW.js → ls-CG6A7UXF.js} +3 -3
  64. package/dist/chunks/ls-RHEQ6YQB.js +188 -0
  65. package/dist/chunks/open-E3XADEMX.js +106 -0
  66. package/dist/chunks/{publish-RXFUYSW3.js → publish-Z3AQRUCS.js} +3 -3
  67. package/dist/chunks/{query-ILJJL3BZ.js → query-3EV66DO3.js} +9 -9
  68. package/dist/chunks/{reorder-GBCOPZT4.js → reorder-VA5E5ZJT.js} +3 -3
  69. package/dist/chunks/reply-SNSCNKAW.js +167 -0
  70. package/dist/chunks/resolve-6ZX4RTXX.js +228 -0
  71. package/dist/chunks/{restore-YK5DGGRX.js → restore-NEHI5B5P.js} +3 -3
  72. package/dist/chunks/{rm-O474MI5C.js → rm-22B22E47.js} +3 -3
  73. package/dist/chunks/{rm-LK6P7XTA.js → rm-E5ZVLAKO.js} +3 -3
  74. package/dist/chunks/{rm-FRZMXB2W.js → rm-FR6KE744.js} +7 -6
  75. package/dist/chunks/rule-inspect-DMP2CKJQ.js +283 -0
  76. package/dist/chunks/{rules-MZ2MP6KJ.js → rules-EYGXEI2Z.js} +7 -7
  77. package/dist/chunks/{schema-FR6CCQIZ.js → schema-2IIWOBSQ.js} +7 -5
  78. package/dist/chunks/{tags-AKRTKFRV.js → tags-ZDVYRHAY.js} +2 -2
  79. package/dist/chunks/{update-W3CWQB2F.js → update-QH4DQMZV.js} +7 -6
  80. package/dist/commands/build/index.js +45 -13
  81. package/dist/commands/deploy/index.js +38 -27
  82. package/dist/commands/dev/index.js +13 -16
  83. package/dist/commands/env/index.js +13 -11
  84. package/dist/commands/link/index.js +10 -9
  85. package/dist/commands/list/index.js +5 -5
  86. package/dist/commands-bulk.js +2981 -2179
  87. package/dist/index.js +31 -21
  88. package/dist/vc.js +54 -18
  89. package/dist/version.mjs +1 -1
  90. package/package.json +35 -35
  91. package/dist/chunks/chunk-F32B76CK.js +0 -86
  92. package/dist/chunks/inspect-5YZP7IWI.js +0 -351
  93. package/dist/chunks/ls-MB74DIQV.js +0 -113
  94. package/dist/chunks/rule-inspect-YEZGYINZ.js +0 -141
@@ -4,9 +4,20 @@ 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
+ getGroupStartedAt,
9
+ getGroupTitle,
10
+ getGroupType,
11
+ normalizeTimestamp,
12
+ renderAlertTable
13
+ } from "./chunk-3PGXYIKC.js";
7
14
  import {
8
15
  resolveAlertsScope
9
- } from "./chunk-XFGY3JAX.js";
16
+ } from "./chunk-T4NODP6Y.js";
17
+ import {
18
+ formatDate
19
+ } from "./chunk-GZLPFESR.js";
20
+ import "./chunk-A3NYPUKZ.js";
10
21
  import {
11
22
  handleValidationError,
12
23
  normalizeRepeatableStringFilters,
@@ -16,24 +27,27 @@ import {
16
27
  validateTimeBound,
17
28
  validateTimeOrder
18
29
  } from "./chunk-BUZRVER7.js";
30
+ import "./chunk-FGDKMNEN.js";
31
+ import "./chunk-PRWJUY5U.js";
32
+ import {
33
+ truncateEnd
34
+ } from "./chunk-OF2GNB42.js";
19
35
  import {
20
36
  validateJsonOutput
21
37
  } from "./chunk-XPKWKPWA.js";
22
38
  import {
23
39
  alertsCommand
24
- } from "./chunk-YS6EDZHB.js";
25
- import "./chunk-STJJ3DFO.js";
26
- import {
27
- table
28
- } from "./chunk-NZRWTCRM.js";
29
- import "./chunk-GLAHGVBS.js";
40
+ } from "./chunk-2MJROFVC.js";
41
+ import "./chunk-KCF6S3XF.js";
42
+ import "./chunk-NZRWTCRM.js";
43
+ import "./chunk-TBR2Q37Y.js";
44
+ import "./chunk-ECCWJHC6.js";
30
45
  import {
31
46
  AGENT_REASON,
32
47
  buildCommandWithGlobalFlags,
33
48
  outputAgentError,
34
49
  shouldEmitNonInteractiveCommandError
35
50
  } from "./chunk-UDWRZXIT.js";
36
- import "./chunk-ECCWJHC6.js";
37
51
  import {
38
52
  parseArguments,
39
53
  printError
@@ -92,45 +106,17 @@ function getDefaultRange() {
92
106
  const from = new Date(to.getTime() - 24 * 60 * 60 * 1e3);
93
107
  return { from: from.toISOString(), to: to.toISOString() };
94
108
  }
95
- function getGroupTitle(group) {
96
- return group.ai?.title || "Alert group";
97
- }
98
- function parseDateInput(value) {
99
- if (value === void 0) {
100
- return void 0;
101
- }
102
- const epochMs = value < 1e12 ? value * 1e3 : value;
103
- const date = new Date(epochMs);
104
- return Number.isNaN(date.getTime()) ? void 0 : date;
105
- }
106
- function formatDateForDisplay(value) {
107
- const date = parseDateInput(value);
108
- if (!date) {
109
- return "-";
110
- }
111
- return date.toLocaleString("en-US", {
112
- year: "numeric",
113
- month: "short",
114
- day: "2-digit",
115
- hour: "2-digit",
116
- minute: "2-digit",
117
- second: "2-digit",
118
- hour12: false,
119
- timeZoneName: "short"
120
- });
121
- }
122
109
  function getStartedAt(group) {
123
- return formatDateForDisplay(getGroupStartedAt(group)?.getTime());
124
- }
125
- function getGroupStartedAt(group) {
126
- return parseDateInput(group.recordedStartedAt) || parseDateInput(group.alerts?.[0]?.startedAt);
110
+ return formatDate(getGroupStartedAt(group));
127
111
  }
128
112
  function getGroupResolvedAt(group) {
129
- const resolvedTimes = (group.alerts ?? []).map((alert) => parseDateInput(alert.resolvedAt)).filter((d) => Boolean(d)).map((d) => d.getTime());
113
+ const resolvedTimes = (group.alerts ?? []).map(
114
+ (alert) => normalizeTimestamp(alert.recordedResolvedAt ?? alert.resolvedAt)
115
+ ).filter((time) => time !== void 0);
130
116
  if (resolvedTimes.length > 0) {
131
- return new Date(Math.max(...resolvedTimes));
117
+ return Math.max(...resolvedTimes);
132
118
  }
133
- return getGroupStartedAt(group);
119
+ return void 0;
134
120
  }
135
121
  function getStatus(group) {
136
122
  const normalizedStatus = (group.status || "").toLowerCase();
@@ -140,8 +126,8 @@ function getStatus(group) {
140
126
  if (normalizedStatus === "resolved") {
141
127
  const startedAt = getGroupStartedAt(group);
142
128
  const resolvedAt = getGroupResolvedAt(group);
143
- if (startedAt && resolvedAt && resolvedAt.getTime() >= startedAt.getTime()) {
144
- return `resolved after ${(0, import_ms.default)(resolvedAt.getTime() - startedAt.getTime())}`;
129
+ if (startedAt && resolvedAt && resolvedAt >= startedAt) {
130
+ return `resolved after ${(0, import_ms.default)(resolvedAt - startedAt)}`;
145
131
  }
146
132
  return "resolved";
147
133
  }
@@ -152,7 +138,7 @@ function getResolvedAt(group) {
152
138
  if (normalizedStatus === "active") {
153
139
  return "active";
154
140
  }
155
- return formatDateForDisplay(getGroupResolvedAt(group)?.getTime());
141
+ return formatDate(getGroupResolvedAt(group));
156
142
  }
157
143
  function getAlertsCount(group) {
158
144
  return String(group.alerts?.length ?? 0);
@@ -192,18 +178,19 @@ function printGroups(groups) {
192
178
  ].map((h) => import_chalk.default.cyan(h));
193
179
  const rows = [
194
180
  headers,
195
- ...groups.map((group) => [
196
- import_chalk.default.bold(getGroupTitle(group)),
197
- import_chalk.default.dim(group.id || "-"),
198
- getStartedAt(group),
199
- group.type || "-",
200
- getStatus(group),
201
- getAlertsCount(group)
202
- ])
181
+ ...groups.map((group) => {
182
+ const row = [
183
+ import_chalk.default.bold(truncateEnd(getGroupTitle(group), 80)),
184
+ import_chalk.default.dim(group.id || "-"),
185
+ getStartedAt(group),
186
+ getGroupType(group)
187
+ ];
188
+ row.push(getStatus(group), getAlertsCount(group));
189
+ return row;
190
+ })
203
191
  ];
204
- const tableOutput = table(rows, { hsep: 3 }).split("\n").map((line) => line.trimEnd()).join("\n").replace(/^/gm, " ");
205
192
  output_manager_default.print(`
206
- ${tableOutput}
193
+ ${renderAlertTable(rows, 3)}
207
194
  `);
208
195
  }
209
196
  function printAiSections(groups) {
@@ -26,9 +26,9 @@ import {
26
26
  getLinkedProject,
27
27
  getProjectByNameOrId,
28
28
  getScope
29
- } from "./chunk-GLAHGVBS.js";
30
- import "./chunk-UDWRZXIT.js";
29
+ } from "./chunk-TBR2Q37Y.js";
31
30
  import "./chunk-ECCWJHC6.js";
31
+ import "./chunk-UDWRZXIT.js";
32
32
  import {
33
33
  parseArguments,
34
34
  printError
@@ -0,0 +1,360 @@
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
+ renderThreadRow
9
+ } from "./chunk-F5PQWDOC.js";
10
+ import {
11
+ handleCommentsParseError,
12
+ inferBranch,
13
+ listThreads,
14
+ resolveCommentsScope
15
+ } from "./chunk-LMHT3QR3.js";
16
+ import {
17
+ handleValidationError,
18
+ outputError,
19
+ validateIntegerRangeWithDefault
20
+ } from "./chunk-BUZRVER7.js";
21
+ import {
22
+ validateJsonOutput
23
+ } from "./chunk-XPKWKPWA.js";
24
+ import {
25
+ listSubcommand
26
+ } from "./chunk-FHEMFAHB.js";
27
+ import {
28
+ getScope
29
+ } from "./chunk-TBR2Q37Y.js";
30
+ import "./chunk-ECCWJHC6.js";
31
+ import "./chunk-UDWRZXIT.js";
32
+ import {
33
+ parseArguments
34
+ } from "./chunk-SZXT3PDQ.js";
35
+ import {
36
+ getCommandName,
37
+ getFlagsSpecification,
38
+ isAPIError,
39
+ stripSensitiveAuthArgs
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/list.ts
55
+ var import_chalk = __toESM(require_source(), 1);
56
+ function validateStatus(value) {
57
+ const status = value ?? "unresolved";
58
+ if (!["unresolved", "resolved", "all"].includes(status)) {
59
+ return void 0;
60
+ }
61
+ return status;
62
+ }
63
+ async function resolveAuthors(client, authors) {
64
+ if (!authors || authors.length === 0) {
65
+ return void 0;
66
+ }
67
+ if (!authors.includes("me")) {
68
+ return authors;
69
+ }
70
+ const { user } = await getScope(client);
71
+ return authors.map((author) => author === "me" ? user.id : author);
72
+ }
73
+ function statusWord(status) {
74
+ return status === "all" ? "" : ` ${status}`;
75
+ }
76
+ function printActiveFilters(flags) {
77
+ const parts = [];
78
+ if (flags["--author"]?.length) {
79
+ parts.push(
80
+ `--author ${flags["--author"].join(", ")} (takes a user ID or \`me\` \u2014 usernames match nothing)`
81
+ );
82
+ }
83
+ if (flags["--page"]?.length) {
84
+ parts.push(`--page ${flags["--page"].join(", ")}`);
85
+ }
86
+ if (flags["--search"]) {
87
+ parts.push(`--search ${flags["--search"]}`);
88
+ }
89
+ if (flags["--content-id"]?.length) {
90
+ parts.push(`--content-id ${flags["--content-id"].join(", ")}`);
91
+ }
92
+ if (parts.length > 0) {
93
+ output_manager_default.log(`Filters: ${parts.join(" \xB7 ")}`);
94
+ }
95
+ }
96
+ function countLine(count, status) {
97
+ return `${count}${statusWord(status)} comment${count === 1 ? "" : "s"}`;
98
+ }
99
+ var SCOPE_FLAG_NAMES = /* @__PURE__ */ new Set([
100
+ "--scope",
101
+ "-S",
102
+ "--project",
103
+ "-p",
104
+ "--team",
105
+ "-T"
106
+ ]);
107
+ function argvFlagTokens(client) {
108
+ return stripSensitiveAuthArgs(client.argv.slice(3));
109
+ }
110
+ function scopeFlagsSuffix(client) {
111
+ const tokens = argvFlagTokens(client);
112
+ const out = [];
113
+ for (let i = 0; i < tokens.length; i++) {
114
+ const token = tokens[i];
115
+ const name = token.split("=")[0];
116
+ if (!SCOPE_FLAG_NAMES.has(name)) {
117
+ continue;
118
+ }
119
+ out.push(token);
120
+ if (!token.includes("=") && i + 1 < tokens.length) {
121
+ out.push(tokens[++i]);
122
+ }
123
+ }
124
+ return out.length > 0 ? ` ${out.join(" ")}` : "";
125
+ }
126
+ function nextPageFlagsSuffix(client) {
127
+ const tokens = argvFlagTokens(client);
128
+ const out = [];
129
+ for (let i = 0; i < tokens.length; i++) {
130
+ const token = tokens[i];
131
+ if (!token.startsWith("-")) {
132
+ continue;
133
+ }
134
+ const name = token.split("=")[0];
135
+ if (name === "--next" || name === "-N") {
136
+ if (!token.includes("=") && i + 1 < tokens.length) {
137
+ i++;
138
+ }
139
+ continue;
140
+ }
141
+ out.push(token);
142
+ if (!token.includes("=") && i + 1 < tokens.length && !tokens[i + 1].startsWith("-")) {
143
+ out.push(tokens[++i]);
144
+ }
145
+ }
146
+ return out.length > 0 ? ` ${out.join(" ")}` : "";
147
+ }
148
+ function shellSafe(value) {
149
+ if (/^[A-Za-z0-9._/-]+$/.test(value)) {
150
+ return value;
151
+ }
152
+ return `'${value.replace(/'/g, "'\\''")}'`;
153
+ }
154
+ async function printEmptyState(client, scope, focus, params, status, flags) {
155
+ let probe;
156
+ try {
157
+ probe = await listThreads(client, scope.teamId, {
158
+ ...params,
159
+ branch: void 0,
160
+ cursor: void 0,
161
+ limit: 20
162
+ });
163
+ } catch {
164
+ output_manager_default.log(`No${statusWord(status)} comments on ${focus.value}.`);
165
+ return;
166
+ }
167
+ const branches = /* @__PURE__ */ new Map();
168
+ for (const thread of probe.threads) {
169
+ const branch = thread.branch ?? "(no branch)";
170
+ branches.set(branch, (branches.get(branch) ?? 0) + 1);
171
+ }
172
+ if (branches.size === 0) {
173
+ output_manager_default.log(
174
+ `No${statusWord(status)} comments in ${scope.projectName ?? "this project"} on any branch.`
175
+ );
176
+ printActiveFilters(flags);
177
+ return;
178
+ }
179
+ output_manager_default.log(`No${statusWord(status)} comments on ${focus.value}.`);
180
+ const suffix = probe.pagination.nextCursor ? "+" : "";
181
+ const scopeSuffix = scopeFlagsSuffix(client);
182
+ if (branches.size === 1) {
183
+ const [branch, count] = [...branches.entries()][0];
184
+ output_manager_default.log(
185
+ `${count}${suffix}${statusWord(status)} on ${import_chalk.default.bold(branch)} \u2014 run ${getCommandName(`comments --branch ${shellSafe(branch)}${scopeSuffix}`)}`
186
+ );
187
+ return;
188
+ }
189
+ const total = [...branches.values()].reduce((a, b) => a + b, 0);
190
+ output_manager_default.log(
191
+ `${total}${suffix}${statusWord(status)} on other branches \u2014 run ${getCommandName(`comments --all-branches${scopeSuffix}`)}`
192
+ );
193
+ }
194
+ async function list(client, telemetry, defaultInvocation) {
195
+ let parsedArgs;
196
+ const flagsSpecification = getFlagsSpecification(listSubcommand.options);
197
+ try {
198
+ parsedArgs = parseArguments(client.argv.slice(2), flagsSpecification);
199
+ } catch (err) {
200
+ return handleCommentsParseError(err, "list");
201
+ }
202
+ const flags = parsedArgs.flags;
203
+ const expectedPositionals = defaultInvocation ? 1 : 2;
204
+ if (parsedArgs.args.length > expectedPositionals) {
205
+ output_manager_default.error(
206
+ `Unknown ${defaultInvocation ? "subcommand" : "argument"} "${parsedArgs.args[expectedPositionals]}". Run \`vercel comments --help\` for usage.`
207
+ );
208
+ return 1;
209
+ }
210
+ const formatResult = validateJsonOutput(flags);
211
+ if (!formatResult.valid) {
212
+ output_manager_default.error(formatResult.error);
213
+ return 1;
214
+ }
215
+ const jsonOutput = formatResult.jsonOutput;
216
+ telemetry.trackCliOptionProject(flags["--project"]);
217
+ telemetry.trackCliOptionBranch(flags["--branch"]);
218
+ telemetry.trackCliFlagAllBranches(flags["--all-branches"]);
219
+ telemetry.trackCliOptionStatus(flags["--status"]);
220
+ telemetry.trackCliOptionPage(flags["--page"]);
221
+ telemetry.trackCliOptionAuthor(flags["--author"]);
222
+ telemetry.trackCliOptionContentId(flags["--content-id"]);
223
+ telemetry.trackCliOptionSearch(flags["--search"]);
224
+ telemetry.trackCliOptionLimit(flags["--limit"]);
225
+ telemetry.trackCliOptionNext(flags["--next"]);
226
+ telemetry.trackCliOptionFormat(flags["--format"]);
227
+ const status = validateStatus(flags["--status"]);
228
+ if (!status) {
229
+ return outputError(
230
+ client,
231
+ jsonOutput,
232
+ "INVALID_STATUS",
233
+ `Invalid --status "${flags["--status"]}". Valid values: unresolved, resolved, all.`
234
+ );
235
+ }
236
+ const limitResult = validateIntegerRangeWithDefault(flags["--limit"], {
237
+ flag: "--limit",
238
+ min: 1,
239
+ max: 100,
240
+ defaultValue: 20
241
+ });
242
+ if (!limitResult.valid) {
243
+ return handleValidationError(limitResult, jsonOutput, client);
244
+ }
245
+ if (flags["--branch"] && flags["--all-branches"]) {
246
+ return outputError(
247
+ client,
248
+ jsonOutput,
249
+ "MUTUAL_EXCLUSIVITY",
250
+ "Cannot specify both --branch and --all-branches."
251
+ );
252
+ }
253
+ const scope = await resolveCommentsScope(client, {
254
+ project: flags["--project"],
255
+ requireProject: true,
256
+ jsonOutput
257
+ });
258
+ if (typeof scope === "number") {
259
+ return scope;
260
+ }
261
+ let focus;
262
+ let branchFilter;
263
+ if (flags["--branch"] && flags["--branch"].length > 0) {
264
+ branchFilter = flags["--branch"];
265
+ focus = { value: branchFilter.join(", "), source: "flag" };
266
+ } else if (!flags["--all-branches"] && scope.linked) {
267
+ const inferred = inferBranch(client.cwd);
268
+ if (inferred) {
269
+ focus = inferred;
270
+ branchFilter = [inferred.value];
271
+ }
272
+ }
273
+ const authors = await resolveAuthors(client, flags["--author"]);
274
+ const params = {
275
+ projectId: scope.projectId,
276
+ branch: branchFilter,
277
+ status: status === "all" ? void 0 : status,
278
+ page: flags["--page"],
279
+ author: authors,
280
+ contentId: flags["--content-id"],
281
+ search: flags["--search"],
282
+ limit: limitResult.value,
283
+ cursor: flags["--next"]
284
+ };
285
+ if (!jsonOutput) {
286
+ output_manager_default.spinner("Fetching comments\u2026");
287
+ }
288
+ let response;
289
+ try {
290
+ response = await listThreads(client, scope.teamId, params);
291
+ } catch (err) {
292
+ if (isAPIError(err)) {
293
+ return outputError(
294
+ client,
295
+ jsonOutput,
296
+ err.code || "API_ERROR",
297
+ err.serverMessage || `API error (${err.status}).`
298
+ );
299
+ }
300
+ throw err;
301
+ } finally {
302
+ output_manager_default.stopSpinner();
303
+ }
304
+ const threads = response.threads ?? [];
305
+ const nextCursor = response.pagination?.nextCursor ?? null;
306
+ if (jsonOutput) {
307
+ const envelope = {
308
+ scope: {
309
+ teamId: scope.teamId,
310
+ ...scope.teamSlug && { teamSlug: scope.teamSlug },
311
+ ...scope.projectId && { projectId: scope.projectId },
312
+ ...scope.projectName && { projectName: scope.projectName },
313
+ ...focus && focus.source !== "flag" && { inferredBranch: focus.value }
314
+ },
315
+ filters: {
316
+ ...status !== "all" && { status },
317
+ ...focus && { branch: { value: focus.value, source: focus.source } }
318
+ },
319
+ pagination: { nextCursor },
320
+ threads
321
+ };
322
+ client.stdout.write(`${JSON.stringify(envelope, null, 2)}
323
+ `);
324
+ return 0;
325
+ }
326
+ const branchLabel = focus ? focus.value : "all branches";
327
+ output_manager_default.log(
328
+ `Comments in ${import_chalk.default.bold(scope.projectName ?? scope.projectId ?? "")} \xB7 ${branchLabel}`
329
+ );
330
+ if (threads.length === 0) {
331
+ if (focus) {
332
+ await printEmptyState(client, scope, focus, params, status, flags);
333
+ } else {
334
+ output_manager_default.log(
335
+ `No${statusWord(status)} comments in ${scope.projectName ?? "this project"}.`
336
+ );
337
+ printActiveFilters(flags);
338
+ }
339
+ return 0;
340
+ }
341
+ output_manager_default.print("\n");
342
+ for (const thread of threads) {
343
+ output_manager_default.print(`${renderThreadRow(thread, { showBranch: !focus })}
344
+
345
+ `);
346
+ }
347
+ output_manager_default.log(countLine(threads.length, status));
348
+ output_manager_default.log(
349
+ `To read a thread, run ${getCommandName(`comments inspect <id>${scopeFlagsSuffix(client)}`)}`
350
+ );
351
+ if (nextCursor) {
352
+ output_manager_default.log(
353
+ `To display the next page, run ${getCommandName(`comments${nextPageFlagsSuffix(client)} --next ${nextCursor}`)}`
354
+ );
355
+ }
356
+ return 0;
357
+ }
358
+ export {
359
+ list as default
360
+ };
@@ -13,7 +13,7 @@ import {
13
13
  resolveVcrScope,
14
14
  validateVcrChoice,
15
15
  validateVcrJsonOutput
16
- } from "./chunk-NLRIKNPX.js";
16
+ } from "./chunk-GP5VCTEU.js";
17
17
  import {
18
18
  require_lib
19
19
  } from "./chunk-G75NFPIT.js";
@@ -29,13 +29,13 @@ import "./chunk-FYQPTH5C.js";
29
29
  import {
30
30
  require_execa
31
31
  } from "./chunk-R6IGDGX3.js";
32
- import "./chunk-GLAHGVBS.js";
32
+ import "./chunk-TBR2Q37Y.js";
33
+ import "./chunk-ECCWJHC6.js";
33
34
  import {
34
35
  AGENT_REASON,
35
36
  buildCommandWithGlobalFlags,
36
37
  outputAgentError
37
38
  } from "./chunk-UDWRZXIT.js";
38
- import "./chunk-ECCWJHC6.js";
39
39
  import {
40
40
  parseArguments,
41
41
  printError
@@ -19,7 +19,7 @@ import {
19
19
  requireVcrRepository,
20
20
  resolveVcrScope,
21
21
  validateVcrJsonOutput
22
- } from "./chunk-NLRIKNPX.js";
22
+ } from "./chunk-GP5VCTEU.js";
23
23
  import {
24
24
  outputError,
25
25
  validateOptionalIntegerRange
@@ -31,12 +31,12 @@ import {
31
31
  import {
32
32
  table
33
33
  } from "./chunk-NZRWTCRM.js";
34
- import "./chunk-GLAHGVBS.js";
34
+ import "./chunk-TBR2Q37Y.js";
35
+ import "./chunk-ECCWJHC6.js";
35
36
  import {
36
37
  AGENT_REASON,
37
38
  outputAgentError
38
39
  } from "./chunk-UDWRZXIT.js";
39
- import "./chunk-ECCWJHC6.js";
40
40
  import {
41
41
  parseArguments,
42
42
  printError
@@ -15,7 +15,7 @@ import {
15
15
  handleVcrApiError,
16
16
  resolveVcrScope,
17
17
  validateVcrJsonOutput
18
- } from "./chunk-NLRIKNPX.js";
18
+ } from "./chunk-GP5VCTEU.js";
19
19
  import {
20
20
  outputError,
21
21
  validateOptionalIntegerRange
@@ -29,12 +29,12 @@ import "./chunk-FYQPTH5C.js";
29
29
  import {
30
30
  table
31
31
  } from "./chunk-NZRWTCRM.js";
32
- import "./chunk-GLAHGVBS.js";
32
+ import "./chunk-TBR2Q37Y.js";
33
+ import "./chunk-ECCWJHC6.js";
33
34
  import {
34
35
  AGENT_REASON,
35
36
  outputAgentError
36
37
  } from "./chunk-UDWRZXIT.js";
37
- import "./chunk-ECCWJHC6.js";
38
38
  import {
39
39
  parseArguments,
40
40
  printError
@@ -19,7 +19,7 @@ import {
19
19
  resolveVcrScope,
20
20
  validateVcrChoice,
21
21
  validateVcrJsonOutput
22
- } from "./chunk-NLRIKNPX.js";
22
+ } from "./chunk-GP5VCTEU.js";
23
23
  import {
24
24
  outputError,
25
25
  validateOptionalIntegerRange
@@ -33,12 +33,12 @@ import {
33
33
  import {
34
34
  table
35
35
  } from "./chunk-NZRWTCRM.js";
36
- import "./chunk-GLAHGVBS.js";
36
+ import "./chunk-TBR2Q37Y.js";
37
+ import "./chunk-ECCWJHC6.js";
37
38
  import {
38
39
  AGENT_REASON,
39
40
  outputAgentError
40
41
  } from "./chunk-UDWRZXIT.js";
41
- import "./chunk-ECCWJHC6.js";
42
42
  import {
43
43
  parseArguments,
44
44
  printError