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.
- package/dist/chunks/{add-XY2LNFK3.js → add-6GRH6G2M.js} +4 -4
- package/dist/chunks/{add-2HLAH42D.js → add-KNK5E2YT.js} +3 -3
- package/dist/chunks/{chunk-WM3UMX65.js → chunk-23U6FANO.js} +1 -1
- package/dist/chunks/chunk-2473DUBR.js +15 -0
- package/dist/chunks/{chunk-C4TEOOGB.js → chunk-26TEKOBZ.js} +63 -6
- package/dist/chunks/{chunk-S7HMSWGQ.js → chunk-3BHSS5E2.js} +2 -2
- package/dist/chunks/{chunk-PEC4ROHM.js → chunk-4MK452Y5.js} +5 -5
- package/dist/chunks/{chunk-ORMDX3GR.js → chunk-ARKHETJP.js} +1 -1
- package/dist/chunks/chunk-BM36UWE2.js +245 -0
- package/dist/chunks/{chunk-VZGX4CKB.js → chunk-CM3DLBDY.js} +1 -1
- package/dist/chunks/{chunk-SLCLT4P5.js → chunk-DI3HR3K6.js} +1 -1
- package/dist/chunks/{chunk-OSXJ6G4O.js → chunk-DOF6CJLL.js} +3 -3
- package/dist/chunks/chunk-E336ZXPP.js +43 -0
- package/dist/chunks/{chunk-K6YMSJMZ.js → chunk-EYICIM2K.js} +4 -4
- package/dist/chunks/chunk-FHEMFAHB.js +320 -0
- package/dist/chunks/{chunk-JGXABANG.js → chunk-G4MTGCZ5.js} +1 -1
- package/dist/chunks/{chunk-IN3RG4AU.js → chunk-GAOAGU5K.js} +1 -1
- package/dist/chunks/{chunk-UA3D44SL.js → chunk-GNV7547O.js} +1 -1
- package/dist/chunks/{chunk-2KNVJ7ET.js → chunk-IBP2XAUH.js} +103 -3
- package/dist/chunks/{chunk-JIK3GTU3.js → chunk-JQG5EDRD.js} +1 -1
- package/dist/chunks/{chunk-ENIJVO7C.js → chunk-PPEQUJ7T.js} +2 -2
- package/dist/chunks/{chunk-EJNFC5AV.js → chunk-PRYNIKBZ.js} +1 -1
- package/dist/chunks/{chunk-BRTMH4PL.js → chunk-SWEPOMSA.js} +1 -1
- package/dist/chunks/{chunk-QX4337BT.js → chunk-TMK6RSYW.js} +842 -842
- package/dist/chunks/chunk-WR7JTCGL.js +104 -0
- package/dist/chunks/{chunk-4QRRJEYO.js → chunk-X43U65TH.js} +2 -2
- package/dist/chunks/chunk-YTFJGKRG.js +247 -0
- package/dist/chunks/{compile-vercel-config-4Q4YZ44O.js → compile-vercel-config-IFET4E6H.js} +2 -2
- package/dist/chunks/config-validator.mjs +1 -0
- package/dist/chunks/{delete-AUDPLCMU.js → delete-PXB5WRH7.js} +3 -3
- package/dist/chunks/delete-X2MUMONI.js +150 -0
- package/dist/chunks/{disable-WFPXR7GZ.js → disable-GBL3SHJL.js} +3 -3
- package/dist/chunks/{discard-RVFKIZZG.js → discard-XVVSRGDR.js} +3 -3
- package/dist/chunks/{edit-KO5KX4WU.js → edit-EIHRP6XT.js} +4 -4
- package/dist/chunks/edit-K5Y2BDJO.js +153 -0
- package/dist/chunks/{enable-I5HE32DI.js → enable-W7AMJWKH.js} +3 -3
- package/dist/chunks/{export-4Y5L2TOT.js → export-N3AZ2KOO.js} +3 -3
- package/dist/chunks/{image-QC5MVWKN.js → image-DRTGVPVJ.js} +3 -3
- package/dist/chunks/{inspect-Q5BKZNVI.js → inspect-5YUAEI3L.js} +3 -3
- package/dist/chunks/{inspect-BULBAPNR.js → inspect-AAIVWSJI.js} +3 -3
- package/dist/chunks/{inspect-JUGFKEGR.js → inspect-DYXTX6P4.js} +3 -3
- package/dist/chunks/{inspect-PJDCPARM.js → inspect-IPSAYR2C.js} +3 -3
- package/dist/chunks/inspect-SLZLI6ZC.js +205 -0
- package/dist/chunks/{list-FJT44SB6.js → list-IF2YW73F.js} +2 -2
- package/dist/chunks/list-K2HLGUXV.js +360 -0
- package/dist/chunks/{list-N7OA4FBI.js → list-V7VTXVK4.js} +3 -3
- package/dist/chunks/{login-BPE774JW.js → login-7C6HQEOG.js} +3 -3
- package/dist/chunks/{ls-YV554CRJ.js → ls-2NU353QP.js} +3 -3
- package/dist/chunks/{ls-H52WO65Y.js → ls-NKECPPOR.js} +3 -3
- package/dist/chunks/{ls-E47M6P5O.js → ls-QQQHOJBE.js} +3 -3
- package/dist/chunks/{ls-26VFGQ6P.js → ls-RH6Y4XBS.js} +4 -4
- package/dist/chunks/open-2FAPZA6V.js +106 -0
- package/dist/chunks/{publish-DUTEBRX3.js → publish-G7PB64LJ.js} +3 -3
- package/dist/chunks/{query-QDOKUCHX.js → query-D4QBT4WR.js} +2 -2
- package/dist/chunks/{reorder-L2M3YGJ4.js → reorder-3Z7YIPAX.js} +3 -3
- package/dist/chunks/reply-7QQBXL5H.js +167 -0
- package/dist/chunks/resolve-UYKTDZEX.js +228 -0
- package/dist/chunks/{restore-BVDNAJVC.js → restore-Q2DR7SMW.js} +3 -3
- package/dist/chunks/{rm-VHWBHG3A.js → rm-O4M4GFSK.js} +3 -3
- package/dist/chunks/{rm-7KSHXSTB.js → rm-OCLUTM57.js} +4 -4
- package/dist/chunks/{rm-4OQ7G6UX.js → rm-PCWMEHQ2.js} +3 -3
- package/dist/chunks/{rule-inspect-AT6IEOUF.js → rule-inspect-XJ47UEG7.js} +4 -4
- package/dist/chunks/{rules-SQFCUKWS.js → rules-LIH5FLPJ.js} +6 -6
- package/dist/chunks/{schema-PWSCMD24.js → schema-OFALTXXM.js} +2 -2
- package/dist/chunks/{tags-BT7ZGJP2.js → tags-P4HIAI6D.js} +2 -2
- package/dist/chunks/{update-PTDGBKEH.js → update-E3ZQAFBS.js} +4 -4
- package/dist/commands/build/index.js +11 -11
- package/dist/commands/deploy/index.js +13 -12
- package/dist/commands/dev/index.js +10 -10
- package/dist/commands/env/index.js +9 -8
- package/dist/commands/link/index.js +8 -7
- package/dist/commands/list/index.js +5 -5
- package/dist/commands-bulk.js +2744 -1982
- package/dist/index.js +19 -8
- package/dist/vc.js +6 -1
- package/dist/version.mjs +1 -1
- package/package.json +92 -12
|
@@ -0,0 +1,205 @@
|
|
|
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
|
+
actorLabel,
|
|
9
|
+
displayPath,
|
|
10
|
+
renderThreadDetail,
|
|
11
|
+
threadAge,
|
|
12
|
+
truncate
|
|
13
|
+
} from "./chunk-BM36UWE2.js";
|
|
14
|
+
import {
|
|
15
|
+
parseThreadArg
|
|
16
|
+
} from "./chunk-E336ZXPP.js";
|
|
17
|
+
import {
|
|
18
|
+
getThread,
|
|
19
|
+
handleCommentsParseError,
|
|
20
|
+
inferBranch,
|
|
21
|
+
listMessages,
|
|
22
|
+
listThreads,
|
|
23
|
+
resolveCommentsScope,
|
|
24
|
+
threadNotFoundMessage,
|
|
25
|
+
toApiErrorParts
|
|
26
|
+
} from "./chunk-YTFJGKRG.js";
|
|
27
|
+
import {
|
|
28
|
+
canPrompt
|
|
29
|
+
} from "./chunk-2473DUBR.js";
|
|
30
|
+
import {
|
|
31
|
+
outputError
|
|
32
|
+
} from "./chunk-BUZRVER7.js";
|
|
33
|
+
import {
|
|
34
|
+
validateJsonOutput
|
|
35
|
+
} from "./chunk-XPKWKPWA.js";
|
|
36
|
+
import {
|
|
37
|
+
inspectSubcommand
|
|
38
|
+
} from "./chunk-FHEMFAHB.js";
|
|
39
|
+
import "./chunk-TMK6RSYW.js";
|
|
40
|
+
import "./chunk-ECCWJHC6.js";
|
|
41
|
+
import "./chunk-UDWRZXIT.js";
|
|
42
|
+
import {
|
|
43
|
+
parseArguments
|
|
44
|
+
} from "./chunk-SZXT3PDQ.js";
|
|
45
|
+
import {
|
|
46
|
+
getFlagsSpecification,
|
|
47
|
+
isAPIError
|
|
48
|
+
} from "./chunk-KSSNLCL4.js";
|
|
49
|
+
import "./chunk-P4QNYOFB.js";
|
|
50
|
+
import "./chunk-52QYYTM5.js";
|
|
51
|
+
import {
|
|
52
|
+
output_manager_default
|
|
53
|
+
} from "./chunk-OX7KI3LF.js";
|
|
54
|
+
import "./chunk-GGP5R3FU.js";
|
|
55
|
+
import "./chunk-S7KYDPEM.js";
|
|
56
|
+
import "./chunk-TZ2YI2VH.js";
|
|
57
|
+
|
|
58
|
+
// src/commands/comments/inspect.ts
|
|
59
|
+
async function pickThread(client, jsonOutput) {
|
|
60
|
+
if (!canPrompt(client) || jsonOutput) {
|
|
61
|
+
return outputError(
|
|
62
|
+
client,
|
|
63
|
+
jsonOutput,
|
|
64
|
+
"MISSING_THREAD",
|
|
65
|
+
"Pass a thread ID or URL: `vercel comments inspect <thread>`."
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
const scope = await resolveCommentsScope(client, {
|
|
69
|
+
requireProject: true,
|
|
70
|
+
jsonOutput
|
|
71
|
+
});
|
|
72
|
+
if (typeof scope === "number") {
|
|
73
|
+
return scope;
|
|
74
|
+
}
|
|
75
|
+
const focus = scope.linked ? inferBranch(client.cwd) : void 0;
|
|
76
|
+
output_manager_default.spinner("Fetching comments\u2026");
|
|
77
|
+
let response;
|
|
78
|
+
try {
|
|
79
|
+
response = await listThreads(client, scope.teamId, {
|
|
80
|
+
projectId: scope.projectId,
|
|
81
|
+
status: "unresolved",
|
|
82
|
+
branch: focus ? [focus.value] : void 0,
|
|
83
|
+
limit: 20
|
|
84
|
+
});
|
|
85
|
+
} finally {
|
|
86
|
+
output_manager_default.stopSpinner();
|
|
87
|
+
}
|
|
88
|
+
if (response.threads.length === 0) {
|
|
89
|
+
return outputError(
|
|
90
|
+
client,
|
|
91
|
+
jsonOutput,
|
|
92
|
+
"NO_COMMENTS",
|
|
93
|
+
`No unresolved comments${focus ? ` on ${focus.value}` : ""} to pick from.`
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
return client.input.select({
|
|
97
|
+
message: "Select a comment",
|
|
98
|
+
choices: response.threads.map((thread) => ({
|
|
99
|
+
name: `${threadAge(thread)} ${actorLabel(thread.messages[0]?.author)} ${displayPath(thread)} \u201C${truncate(thread.messages[0]?.text ?? "", 48)}\u201D`,
|
|
100
|
+
value: thread.id
|
|
101
|
+
}))
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
async function fetchAllMessages(client, teamId, thread) {
|
|
105
|
+
if (thread.messageCount <= thread.messages.length) {
|
|
106
|
+
return thread.messages;
|
|
107
|
+
}
|
|
108
|
+
const all = [];
|
|
109
|
+
let cursor;
|
|
110
|
+
do {
|
|
111
|
+
const page = await listMessages(client, teamId, thread.id, {
|
|
112
|
+
limit: 100,
|
|
113
|
+
cursor
|
|
114
|
+
});
|
|
115
|
+
all.push(...page.messages);
|
|
116
|
+
cursor = page.pagination?.nextCursor;
|
|
117
|
+
} while (cursor && all.length < thread.messageCount);
|
|
118
|
+
return all;
|
|
119
|
+
}
|
|
120
|
+
async function inspect(client, telemetry) {
|
|
121
|
+
let parsedArgs;
|
|
122
|
+
const flagsSpecification = getFlagsSpecification(inspectSubcommand.options);
|
|
123
|
+
try {
|
|
124
|
+
parsedArgs = parseArguments(client.argv.slice(2), flagsSpecification);
|
|
125
|
+
} catch (err) {
|
|
126
|
+
return handleCommentsParseError(err, "inspect");
|
|
127
|
+
}
|
|
128
|
+
const formatResult = validateJsonOutput(parsedArgs.flags);
|
|
129
|
+
if (!formatResult.valid) {
|
|
130
|
+
output_manager_default.error(formatResult.error);
|
|
131
|
+
return 1;
|
|
132
|
+
}
|
|
133
|
+
const jsonOutput = formatResult.jsonOutput;
|
|
134
|
+
const showContext = Boolean(parsedArgs.flags["--context"]);
|
|
135
|
+
telemetry.trackCliOptionFormat(parsedArgs.flags["--format"]);
|
|
136
|
+
telemetry.trackCliFlagContext(parsedArgs.flags["--context"]);
|
|
137
|
+
telemetry.trackCliOptionProject(parsedArgs.flags["--project"]);
|
|
138
|
+
const threadInput = parsedArgs.args[2];
|
|
139
|
+
telemetry.trackCliArgumentThread(threadInput);
|
|
140
|
+
let threadId;
|
|
141
|
+
let urlTeamSlug;
|
|
142
|
+
if (threadInput) {
|
|
143
|
+
const parsed = parseThreadArg(threadInput);
|
|
144
|
+
if (!parsed) {
|
|
145
|
+
return outputError(
|
|
146
|
+
client,
|
|
147
|
+
jsonOutput,
|
|
148
|
+
"INVALID_THREAD",
|
|
149
|
+
`Could not extract a thread ID from "${threadInput}". Pass the thread ID or its vercel.com URL.`
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
threadId = parsed.id;
|
|
153
|
+
urlTeamSlug = parsed.teamSlug;
|
|
154
|
+
} else {
|
|
155
|
+
const picked = await pickThread(client, jsonOutput);
|
|
156
|
+
if (typeof picked === "number") {
|
|
157
|
+
return picked;
|
|
158
|
+
}
|
|
159
|
+
threadId = picked;
|
|
160
|
+
}
|
|
161
|
+
const scope = await resolveCommentsScope(client, {
|
|
162
|
+
project: parsedArgs.flags["--project"],
|
|
163
|
+
requireProject: false,
|
|
164
|
+
jsonOutput,
|
|
165
|
+
urlTeamSlug
|
|
166
|
+
});
|
|
167
|
+
if (typeof scope === "number") {
|
|
168
|
+
return scope;
|
|
169
|
+
}
|
|
170
|
+
if (!jsonOutput) {
|
|
171
|
+
output_manager_default.spinner("Fetching comment\u2026");
|
|
172
|
+
}
|
|
173
|
+
let thread;
|
|
174
|
+
let messages;
|
|
175
|
+
try {
|
|
176
|
+
thread = await getThread(client, scope.teamId, threadId);
|
|
177
|
+
messages = await fetchAllMessages(client, scope.teamId, thread);
|
|
178
|
+
} catch (err) {
|
|
179
|
+
if (isAPIError(err)) {
|
|
180
|
+
const { code, message } = toApiErrorParts(err);
|
|
181
|
+
return outputError(
|
|
182
|
+
client,
|
|
183
|
+
jsonOutput,
|
|
184
|
+
code,
|
|
185
|
+
err.status === 404 ? threadNotFoundMessage(threadId, scope) : message
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
throw err;
|
|
189
|
+
} finally {
|
|
190
|
+
output_manager_default.stopSpinner();
|
|
191
|
+
}
|
|
192
|
+
if (jsonOutput) {
|
|
193
|
+
client.stdout.write(
|
|
194
|
+
`${JSON.stringify({ ...thread, messages }, null, 2)}
|
|
195
|
+
`
|
|
196
|
+
);
|
|
197
|
+
return 0;
|
|
198
|
+
}
|
|
199
|
+
output_manager_default.print(`${renderThreadDetail(thread, messages, { showContext })}
|
|
200
|
+
`);
|
|
201
|
+
return 0;
|
|
202
|
+
}
|
|
203
|
+
export {
|
|
204
|
+
inspect as default
|
|
205
|
+
};
|
|
@@ -26,9 +26,9 @@ import {
|
|
|
26
26
|
getLinkedProject,
|
|
27
27
|
getProjectByNameOrId,
|
|
28
28
|
getScope
|
|
29
|
-
} from "./chunk-
|
|
30
|
-
import "./chunk-UDWRZXIT.js";
|
|
29
|
+
} from "./chunk-TMK6RSYW.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-BM36UWE2.js";
|
|
10
|
+
import {
|
|
11
|
+
handleCommentsParseError,
|
|
12
|
+
inferBranch,
|
|
13
|
+
listThreads,
|
|
14
|
+
resolveCommentsScope
|
|
15
|
+
} from "./chunk-YTFJGKRG.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-TMK6RSYW.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
|
+
};
|
|
@@ -6,7 +6,7 @@ const __filename = __fileURLToPath(import.meta.url);
|
|
|
6
6
|
const __dirname = __dirname_(__filename);
|
|
7
7
|
import {
|
|
8
8
|
resolveAlertsScope
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-23U6FANO.js";
|
|
10
10
|
import {
|
|
11
11
|
handleValidationError,
|
|
12
12
|
normalizeRepeatableStringFilters,
|
|
@@ -26,14 +26,14 @@ import "./chunk-STJJ3DFO.js";
|
|
|
26
26
|
import {
|
|
27
27
|
table
|
|
28
28
|
} from "./chunk-NZRWTCRM.js";
|
|
29
|
-
import "./chunk-
|
|
29
|
+
import "./chunk-TMK6RSYW.js";
|
|
30
|
+
import "./chunk-ECCWJHC6.js";
|
|
30
31
|
import {
|
|
31
32
|
AGENT_REASON,
|
|
32
33
|
buildCommandWithGlobalFlags,
|
|
33
34
|
outputAgentError,
|
|
34
35
|
shouldEmitNonInteractiveCommandError
|
|
35
36
|
} from "./chunk-UDWRZXIT.js";
|
|
36
|
-
import "./chunk-ECCWJHC6.js";
|
|
37
37
|
import {
|
|
38
38
|
parseArguments,
|
|
39
39
|
printError
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
resolveVcrScope,
|
|
14
14
|
validateVcrChoice,
|
|
15
15
|
validateVcrJsonOutput
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-DI3HR3K6.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-
|
|
32
|
+
import "./chunk-TMK6RSYW.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
|
resolveVcrScope,
|
|
20
20
|
validateVcrChoice,
|
|
21
21
|
validateVcrJsonOutput
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-DI3HR3K6.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-
|
|
36
|
+
import "./chunk-TMK6RSYW.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
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
handleVcrApiError,
|
|
16
16
|
resolveVcrScope,
|
|
17
17
|
validateVcrJsonOutput
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-DI3HR3K6.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-
|
|
32
|
+
import "./chunk-TMK6RSYW.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
|
requireVcrRepository,
|
|
20
20
|
resolveVcrScope,
|
|
21
21
|
validateVcrJsonOutput
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-DI3HR3K6.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-
|
|
34
|
+
import "./chunk-TMK6RSYW.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
|