vercel 56.3.1 → 56.4.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-ANWCBEDB.js → add-2HLAH42D.js} +2 -2
- package/dist/chunks/{add-FWXAFWCU.js → add-XY2LNFK3.js} +3 -3
- package/dist/chunks/{chunk-7ZECC3BE.js → chunk-2KNVJ7ET.js} +88 -2
- package/dist/chunks/{chunk-74TJ5D35.js → chunk-4QRRJEYO.js} +2 -2
- package/dist/chunks/{chunk-4Z5LC2CI.js → chunk-6RTK6BWX.js} +4 -96
- package/dist/chunks/{chunk-JEWA7HG3.js → chunk-BRTMH4PL.js} +1 -1
- package/dist/chunks/{chunk-F3B65VPT.js → chunk-C4TEOOGB.js} +1 -1
- package/dist/chunks/{chunk-M5LOXLMK.js → chunk-EJNFC5AV.js} +1 -1
- package/dist/chunks/{chunk-UOB64NBX.js → chunk-ENIJVO7C.js} +2 -2
- package/dist/chunks/{query-XC3Y3EBD.js → chunk-F5OMERHI.js} +65 -411
- package/dist/chunks/{chunk-26VWIAO5.js → chunk-IN3RG4AU.js} +1 -1
- package/dist/chunks/{chunk-2E3ZC3JA.js → chunk-JGXABANG.js} +1 -1
- package/dist/chunks/{chunk-AHSE4X6V.js → chunk-JIK3GTU3.js} +1 -1
- package/dist/chunks/{chunk-NMAHBCNK.js → chunk-K6YMSJMZ.js} +4 -4
- package/dist/chunks/{chunk-ETWY3HX7.js → chunk-ORMDX3GR.js} +1 -1
- package/dist/chunks/{chunk-JAY74MG2.js → chunk-OSXJ6G4O.js} +3 -3
- package/dist/chunks/{chunk-IAEXF3FY.js → chunk-PEC4ROHM.js} +4 -4
- package/dist/chunks/{chunk-RGOP4OYL.js → chunk-QX4337BT.js} +10 -7
- package/dist/chunks/{chunk-SAEAR237.js → chunk-S7HMSWGQ.js} +2 -2
- package/dist/chunks/{chunk-VO6PK3ZA.js → chunk-SLCLT4P5.js} +1 -1
- package/dist/chunks/{chunk-XOED7Y6Z.js → chunk-UA3D44SL.js} +1 -1
- package/dist/chunks/{chunk-5R5FS7WB.js → chunk-VZGX4CKB.js} +1 -1
- package/dist/chunks/{chunk-D7SLHLED.js → chunk-WM3UMX65.js} +1 -1
- package/dist/chunks/chunk-Z7NPYIZ6.js +116 -0
- package/dist/chunks/{compile-vercel-config-ELXMKFUY.js → compile-vercel-config-4Q4YZ44O.js} +1 -1
- package/dist/chunks/{delete-BO3RQ3F6.js → delete-AUDPLCMU.js} +2 -2
- package/dist/chunks/{disable-WRXXRGYR.js → disable-WFPXR7GZ.js} +2 -2
- package/dist/chunks/{discard-5XOTKSVP.js → discard-RVFKIZZG.js} +2 -2
- package/dist/chunks/{edit-ML2P3MKK.js → edit-KO5KX4WU.js} +3 -3
- package/dist/chunks/{enable-E5YCEICZ.js → enable-I5HE32DI.js} +2 -2
- package/dist/chunks/{export-EUFPKG5T.js → export-4Y5L2TOT.js} +2 -2
- package/dist/chunks/{image-5WOBJQFO.js → image-QC5MVWKN.js} +3 -3
- package/dist/chunks/{inspect-7PJE37AJ.js → inspect-BULBAPNR.js} +2 -2
- package/dist/chunks/{inspect-I3ZNL35B.js → inspect-JUGFKEGR.js} +2 -2
- package/dist/chunks/{inspect-W4SOI7QI.js → inspect-PJDCPARM.js} +2 -2
- package/dist/chunks/{inspect-BX26XAK2.js → inspect-Q5BKZNVI.js} +2 -2
- package/dist/chunks/{list-44G7AUFR.js → list-FJT44SB6.js} +1 -1
- package/dist/chunks/{list-VLFAOPR5.js → list-N7OA4FBI.js} +2 -2
- package/dist/chunks/{login-CL57KXDR.js → login-BPE774JW.js} +2 -2
- package/dist/chunks/{ls-VD2DNABR.js → ls-26VFGQ6P.js} +3 -3
- package/dist/chunks/{ls-KIAXSLDB.js → ls-E47M6P5O.js} +2 -2
- package/dist/chunks/{ls-42JFBIDV.js → ls-H52WO65Y.js} +2 -2
- package/dist/chunks/{ls-EZRL6SGP.js → ls-YV554CRJ.js} +2 -2
- package/dist/chunks/{publish-C3QAGQJ7.js → publish-DUTEBRX3.js} +2 -2
- package/dist/chunks/query-QDOKUCHX.js +391 -0
- package/dist/chunks/{reorder-L56M5KP3.js → reorder-L2M3YGJ4.js} +2 -2
- package/dist/chunks/{restore-E5LGXKS3.js → restore-BVDNAJVC.js} +2 -2
- package/dist/chunks/{rm-KGRSF2OY.js → rm-4OQ7G6UX.js} +2 -2
- package/dist/chunks/{rm-EF4HUVO2.js → rm-7KSHXSTB.js} +3 -3
- package/dist/chunks/{rm-AG3FDPTQ.js → rm-VHWBHG3A.js} +2 -2
- package/dist/chunks/{rule-inspect-FRDI2PJF.js → rule-inspect-AT6IEOUF.js} +3 -3
- package/dist/chunks/{rules-OEOYTZ6U.js → rules-SQFCUKWS.js} +6 -6
- package/dist/chunks/{schema-OEWP27BI.js → schema-PWSCMD24.js} +5 -5
- package/dist/chunks/{tags-RUHWH6XO.js → tags-BT7ZGJP2.js} +2 -2
- package/dist/chunks/{update-BEXGZY7H.js → update-PTDGBKEH.js} +3 -3
- package/dist/commands/build/index.js +9 -9
- package/dist/commands/deploy/index.js +9 -9
- package/dist/commands/dev/index.js +7 -7
- package/dist/commands/env/index.js +4 -4
- package/dist/commands/link/index.js +6 -6
- package/dist/commands/list/index.js +2 -2
- package/dist/commands-bulk.js +595 -71
- package/dist/index.js +7 -7
- package/dist/version.mjs +1 -1
- package/package.json +10 -10
- package/dist/chunks/chunk-A3NYPUKZ.js +0 -17
package/dist/commands-bulk.js
CHANGED
|
@@ -5,8 +5,15 @@ const require = __createRequire(import.meta.url);
|
|
|
5
5
|
const __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __dirname_(__filename);
|
|
7
7
|
import {
|
|
8
|
+
computeGranularity,
|
|
9
|
+
formatText,
|
|
10
|
+
toGranularityMsFromDuration
|
|
11
|
+
} from "./chunks/chunk-F5OMERHI.js";
|
|
12
|
+
import {
|
|
13
|
+
getRollupColumnName,
|
|
14
|
+
handleApiError,
|
|
8
15
|
indent_default
|
|
9
|
-
} from "./chunks/chunk-
|
|
16
|
+
} from "./chunks/chunk-Z7NPYIZ6.js";
|
|
10
17
|
import {
|
|
11
18
|
RoutesAddTelemetryClient,
|
|
12
19
|
RoutesTelemetryClient
|
|
@@ -31,7 +38,7 @@ import {
|
|
|
31
38
|
runInteractiveEditLoop,
|
|
32
39
|
stripQuotes,
|
|
33
40
|
validateActionFlags
|
|
34
|
-
} from "./chunks/chunk-
|
|
41
|
+
} from "./chunks/chunk-VZGX4CKB.js";
|
|
35
42
|
import {
|
|
36
43
|
getRouteVersions
|
|
37
44
|
} from "./chunks/chunk-AHU7WNL2.js";
|
|
@@ -51,10 +58,12 @@ import {
|
|
|
51
58
|
requireProjectContext,
|
|
52
59
|
validateRequiredArguments,
|
|
53
60
|
withGlobalFlags as withGlobalFlags2
|
|
54
|
-
} from "./chunks/chunk-
|
|
61
|
+
} from "./chunks/chunk-ORMDX3GR.js";
|
|
55
62
|
import {
|
|
56
63
|
normalizeRepeatableStringFilters,
|
|
57
|
-
|
|
64
|
+
outputError,
|
|
65
|
+
parseTimeFlag,
|
|
66
|
+
resolveTimeRange
|
|
58
67
|
} from "./chunks/chunk-BUZRVER7.js";
|
|
59
68
|
import {
|
|
60
69
|
OpenApiCache,
|
|
@@ -68,11 +77,11 @@ import {
|
|
|
68
77
|
resolveOpenApiTagForTeamsCli,
|
|
69
78
|
setAutoUpdate,
|
|
70
79
|
tryOpenApiFallback
|
|
71
|
-
} from "./chunks/chunk-
|
|
80
|
+
} from "./chunks/chunk-PEC4ROHM.js";
|
|
72
81
|
import {
|
|
73
82
|
getUpdateCommand,
|
|
74
83
|
isGlobal
|
|
75
|
-
} from "./chunks/chunk-
|
|
84
|
+
} from "./chunks/chunk-IN3RG4AU.js";
|
|
76
85
|
import {
|
|
77
86
|
Now,
|
|
78
87
|
addDomain,
|
|
@@ -94,14 +103,14 @@ import {
|
|
|
94
103
|
require_format,
|
|
95
104
|
require_jsonlines,
|
|
96
105
|
setupDomain
|
|
97
|
-
} from "./chunks/chunk-
|
|
106
|
+
} from "./chunks/chunk-OSXJ6G4O.js";
|
|
98
107
|
import {
|
|
99
108
|
getGlobalPathConfig,
|
|
100
109
|
persistAuthConfig,
|
|
101
110
|
readLocalConfig,
|
|
102
111
|
sleep,
|
|
103
112
|
writeToConfigFile
|
|
104
|
-
} from "./chunks/chunk-
|
|
113
|
+
} from "./chunks/chunk-S7HMSWGQ.js";
|
|
105
114
|
import "./chunks/chunk-V5P25P7F.js";
|
|
106
115
|
import {
|
|
107
116
|
CHECKBOX_INSTRUCTIONS,
|
|
@@ -128,7 +137,7 @@ import {
|
|
|
128
137
|
import {
|
|
129
138
|
formatEnvironment,
|
|
130
139
|
validateLsArgs
|
|
131
|
-
} from "./chunks/chunk-
|
|
140
|
+
} from "./chunks/chunk-JGXABANG.js";
|
|
132
141
|
import {
|
|
133
142
|
validateJsonOutput
|
|
134
143
|
} from "./chunks/chunk-XPKWKPWA.js";
|
|
@@ -140,6 +149,7 @@ import {
|
|
|
140
149
|
CREDIT_TYPE_LABELS,
|
|
141
150
|
FLAG_CONDITION_LIST_COMPARATORS,
|
|
142
151
|
FLAG_CONDITION_RHS_OPTIONAL_COMPARATORS,
|
|
152
|
+
FLAG_EVALUATIONS_GRANULARITIES,
|
|
143
153
|
SUPPORTED_ADDON_ALIASES,
|
|
144
154
|
SUPPORTED_CREDIT_TYPES,
|
|
145
155
|
abortSubcommand,
|
|
@@ -225,6 +235,7 @@ import {
|
|
|
225
235
|
enableSubcommand,
|
|
226
236
|
enableSubcommand2,
|
|
227
237
|
enableSubcommand3 as enableSubcommand4,
|
|
238
|
+
evaluationsSubcommand,
|
|
228
239
|
fetchSubcommand,
|
|
229
240
|
firewallCommand,
|
|
230
241
|
flagsCommand,
|
|
@@ -260,6 +271,7 @@ import {
|
|
|
260
271
|
ipBlocksListSubcommand,
|
|
261
272
|
ipBlocksSubcommand,
|
|
262
273
|
ipBlocksUnblockSubcommand,
|
|
274
|
+
isFlagEvaluationsGranularity,
|
|
263
275
|
issueSubcommand,
|
|
264
276
|
itemsSubcommand,
|
|
265
277
|
listStoresSubcommand,
|
|
@@ -415,7 +427,7 @@ import {
|
|
|
415
427
|
webAnalyticsSubcommand,
|
|
416
428
|
webhooksCommand,
|
|
417
429
|
whoamiCommand
|
|
418
|
-
} from "./chunks/chunk-
|
|
430
|
+
} from "./chunks/chunk-2KNVJ7ET.js";
|
|
419
431
|
import {
|
|
420
432
|
addSubcommand as addSubcommand12,
|
|
421
433
|
inspectSubcommand as inspectSubcommand8,
|
|
@@ -476,9 +488,9 @@ import "./chunks/chunk-OGG6UBXK.js";
|
|
|
476
488
|
import "./chunks/chunk-LHFNIZ2P.js";
|
|
477
489
|
import {
|
|
478
490
|
main
|
|
479
|
-
} from "./chunks/chunk-
|
|
491
|
+
} from "./chunks/chunk-K6YMSJMZ.js";
|
|
480
492
|
import "./chunks/chunk-IB5L4LKZ.js";
|
|
481
|
-
import "./chunks/chunk-
|
|
493
|
+
import "./chunks/chunk-JIK3GTU3.js";
|
|
482
494
|
import {
|
|
483
495
|
require_execa
|
|
484
496
|
} from "./chunks/chunk-R6IGDGX3.js";
|
|
@@ -493,10 +505,10 @@ import {
|
|
|
493
505
|
} from "./chunks/chunk-VXYGCOKL.js";
|
|
494
506
|
import {
|
|
495
507
|
ensureLink
|
|
496
|
-
} from "./chunks/chunk-
|
|
497
|
-
import "./chunks/chunk-
|
|
498
|
-
import "./chunks/chunk-
|
|
499
|
-
import "./chunks/chunk-
|
|
508
|
+
} from "./chunks/chunk-4QRRJEYO.js";
|
|
509
|
+
import "./chunks/chunk-ENIJVO7C.js";
|
|
510
|
+
import "./chunks/chunk-UA3D44SL.js";
|
|
511
|
+
import "./chunks/chunk-EJNFC5AV.js";
|
|
500
512
|
import {
|
|
501
513
|
help
|
|
502
514
|
} from "./chunks/chunk-DMSLNAVH.js";
|
|
@@ -561,7 +573,7 @@ import {
|
|
|
561
573
|
selectOrg,
|
|
562
574
|
toHost,
|
|
563
575
|
ua_default
|
|
564
|
-
} from "./chunks/chunk-
|
|
576
|
+
} from "./chunks/chunk-QX4337BT.js";
|
|
565
577
|
import {
|
|
566
578
|
AGENT_ACTION,
|
|
567
579
|
AGENT_REASON,
|
|
@@ -2396,7 +2408,7 @@ async function activity(client) {
|
|
|
2396
2408
|
return 0;
|
|
2397
2409
|
}
|
|
2398
2410
|
telemetry2.trackCliSubcommandLs(subcommandOriginal);
|
|
2399
|
-
const listFn = (await import("./chunks/list-
|
|
2411
|
+
const listFn = (await import("./chunks/list-FJT44SB6.js")).default;
|
|
2400
2412
|
return listFn(client, telemetry2);
|
|
2401
2413
|
}
|
|
2402
2414
|
}
|
|
@@ -3891,10 +3903,11 @@ async function resolveAgents(args) {
|
|
|
3891
3903
|
checked: detected[i]
|
|
3892
3904
|
}));
|
|
3893
3905
|
const picked = await client.input.checkbox({
|
|
3894
|
-
message: `Which coding agents should use the AI Gateway?
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
3906
|
+
message: `Which coding agents should use the AI Gateway?
|
|
3907
|
+
${import_chalk11.default.dim(
|
|
3908
|
+
" Detected agents are pre-selected \xB7"
|
|
3909
|
+
)}${CHECKBOX_INSTRUCTIONS}`,
|
|
3910
|
+
instructions: false,
|
|
3898
3911
|
choices
|
|
3899
3912
|
});
|
|
3900
3913
|
const selected = picked.map((id) => getAgentById(id)).filter((a) => Boolean(a));
|
|
@@ -3935,9 +3948,7 @@ function defaultKeyName() {
|
|
|
3935
3948
|
async function promptKeyName(client) {
|
|
3936
3949
|
const fallback = defaultKeyName();
|
|
3937
3950
|
const answer = await client.input.text({
|
|
3938
|
-
message:
|
|
3939
|
-
"A new AI Gateway API key will be created for your coding agents"
|
|
3940
|
-
)}`,
|
|
3951
|
+
message: "Key name?",
|
|
3941
3952
|
default: fallback
|
|
3942
3953
|
});
|
|
3943
3954
|
return answer.trim() || fallback;
|
|
@@ -4002,7 +4013,11 @@ async function ensureTeam2(client, opts) {
|
|
|
4002
4013
|
if (canPrompt2 && !yes && !hasExplicitScopeFlag(client.argv)) {
|
|
4003
4014
|
const org = await selectOrg(
|
|
4004
4015
|
client,
|
|
4005
|
-
|
|
4016
|
+
"Which team?",
|
|
4017
|
+
void 0,
|
|
4018
|
+
true,
|
|
4019
|
+
void 0,
|
|
4020
|
+
"The new AI Gateway API key will be created under this team:"
|
|
4006
4021
|
);
|
|
4007
4022
|
client.config.currentTeam = org.type === "team" ? org.id : void 0;
|
|
4008
4023
|
return void 0;
|
|
@@ -4083,6 +4098,18 @@ function keychainLookup(opts = {}) {
|
|
|
4083
4098
|
const cmd2 = `${SECURITY_BIN} find-generic-password -s '${KEYCHAIN_SERVICE}' -a '${KEYCHAIN_ACCOUNT}' -w 2>/dev/null`;
|
|
4084
4099
|
return opts.fish ? `(${cmd2})` : `$(${cmd2})`;
|
|
4085
4100
|
}
|
|
4101
|
+
var PBCOPY_BIN = "/usr/bin/pbcopy";
|
|
4102
|
+
function copyToClipboard(text2) {
|
|
4103
|
+
try {
|
|
4104
|
+
execFileSync(PBCOPY_BIN, {
|
|
4105
|
+
input: text2,
|
|
4106
|
+
stdio: ["pipe", "ignore", "ignore"]
|
|
4107
|
+
});
|
|
4108
|
+
return true;
|
|
4109
|
+
} catch {
|
|
4110
|
+
return false;
|
|
4111
|
+
}
|
|
4112
|
+
}
|
|
4086
4113
|
|
|
4087
4114
|
// src/util/ai-gateway/coding-agents/apply.ts
|
|
4088
4115
|
function detectShellRc(home, override2) {
|
|
@@ -4327,7 +4354,10 @@ function mask(text2, secrets) {
|
|
|
4327
4354
|
return redactSecretFields(maskKnownSecrets(text2, secrets));
|
|
4328
4355
|
}
|
|
4329
4356
|
function renderDiff(before, after, options = {}) {
|
|
4330
|
-
const { secrets = [], context = 2, indent: indent2 = " " } = options;
|
|
4357
|
+
const { secrets = [], context = 2, indent: indent2 = " ", color = true } = options;
|
|
4358
|
+
const dim = color ? import_chalk13.default.dim : (s) => s;
|
|
4359
|
+
const green = color ? import_chalk13.default.green : (s) => s;
|
|
4360
|
+
const red2 = color ? import_chalk13.default.red : (s) => s;
|
|
4331
4361
|
const lines = diffLines(before, after);
|
|
4332
4362
|
if (!lines.some((l) => l.type !== " ")) {
|
|
4333
4363
|
return "";
|
|
@@ -4345,7 +4375,7 @@ function renderDiff(before, after, options = {}) {
|
|
|
4345
4375
|
lines.forEach((line2, idx) => {
|
|
4346
4376
|
if (!keep[idx]) {
|
|
4347
4377
|
if (!collapsed) {
|
|
4348
|
-
rendered.push(
|
|
4378
|
+
rendered.push(dim(`${indent2} \u22EF`));
|
|
4349
4379
|
collapsed = true;
|
|
4350
4380
|
}
|
|
4351
4381
|
return;
|
|
@@ -4353,11 +4383,11 @@ function renderDiff(before, after, options = {}) {
|
|
|
4353
4383
|
collapsed = false;
|
|
4354
4384
|
const text2 = mask(line2.text, secrets);
|
|
4355
4385
|
if (line2.type === "+") {
|
|
4356
|
-
rendered.push(
|
|
4386
|
+
rendered.push(green(`${indent2}+ ${text2}`));
|
|
4357
4387
|
} else if (line2.type === "-") {
|
|
4358
|
-
rendered.push(
|
|
4388
|
+
rendered.push(red2(`${indent2}- ${text2}`));
|
|
4359
4389
|
} else {
|
|
4360
|
-
rendered.push(
|
|
4390
|
+
rendered.push(dim(`${indent2} ${text2}`));
|
|
4361
4391
|
}
|
|
4362
4392
|
});
|
|
4363
4393
|
return rendered.join("\n");
|
|
@@ -4461,7 +4491,7 @@ function printReceiptPath(label, path3) {
|
|
|
4461
4491
|
}
|
|
4462
4492
|
function printKeyRow(key, opts = {}) {
|
|
4463
4493
|
printAlignedLabel(
|
|
4464
|
-
"API Key",
|
|
4494
|
+
opts.created ? "New API Key" : "API Key",
|
|
4465
4495
|
`${maskSecret(key)} \xB7 ${opts.keychain ? "macOS Keychain" : "Config files"}`
|
|
4466
4496
|
);
|
|
4467
4497
|
}
|
|
@@ -4480,6 +4510,31 @@ function printKey(key, opts = {}) {
|
|
|
4480
4510
|
output_manager_default.print("\n");
|
|
4481
4511
|
printKeyRow(key, opts);
|
|
4482
4512
|
}
|
|
4513
|
+
function buildAgentPrompt(plan, apiKey) {
|
|
4514
|
+
const sections = [
|
|
4515
|
+
"Set up the Vercel AI Gateway for my coding agents by applying the file changes below.",
|
|
4516
|
+
"For each file, create it if missing or edit it to match the diff (lines starting with `+` are added, `-` are removed; `\u22EF` marks skipped unchanged lines).",
|
|
4517
|
+
`Any masked value (e.g. ${maskSecret(apiKey)}) is my AI Gateway API key, stored in my macOS Keychain; the config and shell already reference it with \`${"security find-generic-password"}\`, so leave those lookups as-is and do not ask me to paste the key.`,
|
|
4518
|
+
""
|
|
4519
|
+
];
|
|
4520
|
+
for (const change2 of plan.changes) {
|
|
4521
|
+
if (change2.status !== "create" && change2.status !== "update") {
|
|
4522
|
+
continue;
|
|
4523
|
+
}
|
|
4524
|
+
const diff2 = renderDiff(change2.current ?? "", change2.next ?? "", {
|
|
4525
|
+
secrets: [apiKey],
|
|
4526
|
+
indent: "",
|
|
4527
|
+
color: false
|
|
4528
|
+
});
|
|
4529
|
+
sections.push(`# ${change2.label} \u2014 ${change2.path}`);
|
|
4530
|
+
if (diff2) {
|
|
4531
|
+
sections.push(diff2);
|
|
4532
|
+
}
|
|
4533
|
+
sections.push("");
|
|
4534
|
+
}
|
|
4535
|
+
return `${sections.join("\n").trimEnd()}
|
|
4536
|
+
`;
|
|
4537
|
+
}
|
|
4483
4538
|
|
|
4484
4539
|
// src/util/ai-gateway/coding-agents/consent.ts
|
|
4485
4540
|
var import_chalk15 = __toESM(require_source(), 1);
|
|
@@ -4653,6 +4708,45 @@ async function runMachine(args) {
|
|
|
4653
4708
|
overrides: args.overrides,
|
|
4654
4709
|
shellRcOverride: args.shellRcOverride
|
|
4655
4710
|
});
|
|
4711
|
+
if (args.promptMode) {
|
|
4712
|
+
if (!useKeychain) {
|
|
4713
|
+
client.stdout.write(
|
|
4714
|
+
`${JSON.stringify(
|
|
4715
|
+
{
|
|
4716
|
+
status: AGENT_STATUS.ERROR,
|
|
4717
|
+
reason: "keychain_error",
|
|
4718
|
+
message: "The `--apply prompt` mode needs the key in the macOS Keychain, but storing it failed, so no prompt was produced.",
|
|
4719
|
+
skipped,
|
|
4720
|
+
warnings: args.warnings
|
|
4721
|
+
},
|
|
4722
|
+
null,
|
|
4723
|
+
2
|
|
4724
|
+
)}
|
|
4725
|
+
`
|
|
4726
|
+
);
|
|
4727
|
+
return 1;
|
|
4728
|
+
}
|
|
4729
|
+
client.stdout.write(
|
|
4730
|
+
`${JSON.stringify(
|
|
4731
|
+
{
|
|
4732
|
+
status: AGENT_STATUS.OK,
|
|
4733
|
+
reason: "agent_prompt",
|
|
4734
|
+
message: "Created the AI Gateway key and generated an agent prompt. No files were written.",
|
|
4735
|
+
prompt: buildAgentPrompt(finalPlan, key),
|
|
4736
|
+
configured: [],
|
|
4737
|
+
skipped,
|
|
4738
|
+
warnings: args.warnings,
|
|
4739
|
+
notes: finalPlan.notes.flatMap(
|
|
4740
|
+
(n) => n.notes.map((line2) => `${n.displayName}: ${line2}`)
|
|
4741
|
+
)
|
|
4742
|
+
},
|
|
4743
|
+
null,
|
|
4744
|
+
2
|
|
4745
|
+
)}
|
|
4746
|
+
`
|
|
4747
|
+
);
|
|
4748
|
+
return 0;
|
|
4749
|
+
}
|
|
4656
4750
|
const results = await applyPlan(finalPlan, { backup });
|
|
4657
4751
|
client.stdout.write(
|
|
4658
4752
|
`${JSON.stringify(
|
|
@@ -4761,6 +4855,11 @@ var AiGatewayCodingAgentsSetupTelemetryClient = class extends TelemetryClient {
|
|
|
4761
4855
|
this.trackCliOption({ option: "shell-rc", value: this.redactedValue });
|
|
4762
4856
|
}
|
|
4763
4857
|
}
|
|
4858
|
+
trackCliOptionApply(apply) {
|
|
4859
|
+
if (apply) {
|
|
4860
|
+
this.trackCliOption({ option: "apply", value: apply });
|
|
4861
|
+
}
|
|
4862
|
+
}
|
|
4764
4863
|
trackCliFlagYes(yes) {
|
|
4765
4864
|
if (yes) {
|
|
4766
4865
|
this.trackCliFlag("yes");
|
|
@@ -4796,6 +4895,7 @@ async function codingAgentsSetup(client, argv) {
|
|
|
4796
4895
|
const noKeychain = opts["--no-keychain"];
|
|
4797
4896
|
const agentConfig = opts["--agent-config"];
|
|
4798
4897
|
const shellRcOverride = opts["--shell-rc"];
|
|
4898
|
+
const applyMode = opts["--apply"];
|
|
4799
4899
|
const yes = opts["--yes"];
|
|
4800
4900
|
telemetry2.trackCliOptionAgent(agentFlags);
|
|
4801
4901
|
telemetry2.trackCliFlagAll(all);
|
|
@@ -4811,6 +4911,7 @@ async function codingAgentsSetup(client, argv) {
|
|
|
4811
4911
|
telemetry2.trackCliFlagNoKeychain(noKeychain);
|
|
4812
4912
|
telemetry2.trackCliOptionAgentConfig(agentConfig);
|
|
4813
4913
|
telemetry2.trackCliOptionShellRc(shellRcOverride);
|
|
4914
|
+
telemetry2.trackCliOptionApply(applyMode);
|
|
4814
4915
|
telemetry2.trackCliFlagYes(yes);
|
|
4815
4916
|
const machine = shouldEmitNonInteractiveCommandError(client);
|
|
4816
4917
|
const canPrompt2 = Boolean(client.stdin.isTTY) && !machine;
|
|
@@ -4840,6 +4941,22 @@ async function codingAgentsSetup(client, argv) {
|
|
|
4840
4941
|
`Invalid expiration "${expiration}". Must be one of: ${VALID_EXPIRY_VALUES.join(", ")}.`
|
|
4841
4942
|
);
|
|
4842
4943
|
}
|
|
4944
|
+
if (applyMode !== void 0 && applyMode !== "edit" && applyMode !== "prompt") {
|
|
4945
|
+
return failValidation(
|
|
4946
|
+
client,
|
|
4947
|
+
machine,
|
|
4948
|
+
AGENT_REASON.INVALID_ARGUMENTS,
|
|
4949
|
+
`Invalid --apply "${applyMode}". Must be "edit" or "prompt".`
|
|
4950
|
+
);
|
|
4951
|
+
}
|
|
4952
|
+
if (applyMode === "prompt" && !wantKeychain) {
|
|
4953
|
+
return failValidation(
|
|
4954
|
+
client,
|
|
4955
|
+
machine,
|
|
4956
|
+
AGENT_REASON.INVALID_ARGUMENTS,
|
|
4957
|
+
"The `--apply prompt` mode needs the macOS Keychain so the prompt never contains your plaintext key. Run on macOS without --no-keychain, or use `--apply edit`."
|
|
4958
|
+
);
|
|
4959
|
+
}
|
|
4843
4960
|
const flagExpiresAt = expiration && expiration !== "none" ? presetToExpiresAt(expiration) : void 0;
|
|
4844
4961
|
const overrides = {};
|
|
4845
4962
|
for (const pair of agentConfig ?? []) {
|
|
@@ -5049,7 +5166,8 @@ async function codingAgentsSetup(client, argv) {
|
|
|
5049
5166
|
home,
|
|
5050
5167
|
alreadyConfigured,
|
|
5051
5168
|
// With nothing consented there is nothing to rotate or reconfigure.
|
|
5052
|
-
reconfigure: Boolean(reconfigure) && agents.length > 0
|
|
5169
|
+
reconfigure: Boolean(reconfigure) && agents.length > 0,
|
|
5170
|
+
promptMode: applyMode === "prompt"
|
|
5053
5171
|
});
|
|
5054
5172
|
}
|
|
5055
5173
|
if (alreadyConfigured) {
|
|
@@ -5113,11 +5231,32 @@ async function codingAgentsSetup(client, argv) {
|
|
|
5113
5231
|
);
|
|
5114
5232
|
return 1;
|
|
5115
5233
|
}
|
|
5116
|
-
|
|
5117
|
-
|
|
5118
|
-
if (
|
|
5119
|
-
|
|
5120
|
-
|
|
5234
|
+
let applyAction = applyMode === "prompt" ? "copy" : "apply";
|
|
5235
|
+
if (applyMode === void 0 && changed.length > 0 && canPrompt2 && !yes) {
|
|
5236
|
+
if (useKeychain) {
|
|
5237
|
+
const choice = await client.input.select({
|
|
5238
|
+
message: "Apply these changes?",
|
|
5239
|
+
choices: [
|
|
5240
|
+
{ name: "Yes, write the files now", value: "apply" },
|
|
5241
|
+
{ name: "Copy a prompt for my agent", value: "copy" },
|
|
5242
|
+
{ name: "Cancel", value: "cancel" }
|
|
5243
|
+
],
|
|
5244
|
+
default: "apply"
|
|
5245
|
+
});
|
|
5246
|
+
if (choice === "cancel") {
|
|
5247
|
+
printStatus("Aborted. No files were changed.");
|
|
5248
|
+
return 0;
|
|
5249
|
+
}
|
|
5250
|
+
applyAction = choice;
|
|
5251
|
+
} else {
|
|
5252
|
+
const confirmed = await client.input.confirm(
|
|
5253
|
+
"Apply these changes?",
|
|
5254
|
+
true
|
|
5255
|
+
);
|
|
5256
|
+
if (!confirmed) {
|
|
5257
|
+
printStatus("Aborted. No files were changed.");
|
|
5258
|
+
return 0;
|
|
5259
|
+
}
|
|
5121
5260
|
}
|
|
5122
5261
|
}
|
|
5123
5262
|
let keySource;
|
|
@@ -5141,6 +5280,12 @@ async function codingAgentsSetup(client, argv) {
|
|
|
5141
5280
|
throw err;
|
|
5142
5281
|
}
|
|
5143
5282
|
if (useKeychain && !storeKeyInKeychain(keySource.key)) {
|
|
5283
|
+
if (applyAction === "copy") {
|
|
5284
|
+
output_manager_default.error(
|
|
5285
|
+
"Failed to store the key in the macOS Keychain, so a prompt would expose your plaintext key. Re-run and choose Apply, or pass --no-keychain to write the key to the config files."
|
|
5286
|
+
);
|
|
5287
|
+
return 1;
|
|
5288
|
+
}
|
|
5144
5289
|
printWarning(
|
|
5145
5290
|
"Failed to store the key in the macOS Keychain; writing it to the config files instead."
|
|
5146
5291
|
);
|
|
@@ -5153,11 +5298,36 @@ async function codingAgentsSetup(client, argv) {
|
|
|
5153
5298
|
overrides,
|
|
5154
5299
|
shellRcOverride
|
|
5155
5300
|
});
|
|
5301
|
+
if (applyAction === "copy") {
|
|
5302
|
+
const promptText = buildAgentPrompt(applyPlanResult, keySource.key);
|
|
5303
|
+
if (applyMode === "prompt") {
|
|
5304
|
+
const copied = copyToClipboard(promptText);
|
|
5305
|
+
printStatus(
|
|
5306
|
+
copied ? "Created the key and generated an agent prompt (copied to clipboard; also written to stdout)." : "Created the key and generated an agent prompt (written to stdout)."
|
|
5307
|
+
);
|
|
5308
|
+
client.stdout.write(`${promptText}
|
|
5309
|
+
`);
|
|
5310
|
+
} else if (copyToClipboard(promptText)) {
|
|
5311
|
+
printStatus(
|
|
5312
|
+
"Prompt copied to clipboard. Paste it into your coding agent to apply the changes."
|
|
5313
|
+
);
|
|
5314
|
+
} else {
|
|
5315
|
+
output_manager_default.debug("pbcopy failed or unavailable");
|
|
5316
|
+
printStatus("Could not access the clipboard \u2014 prompt printed below:");
|
|
5317
|
+
client.stdout.write(`${promptText}
|
|
5318
|
+
`);
|
|
5319
|
+
}
|
|
5320
|
+
printKey(keySource.key, { keychain: true, created: keySource.created });
|
|
5321
|
+
return 0;
|
|
5322
|
+
}
|
|
5156
5323
|
const results = await applyPlan(applyPlanResult, { backup: !noBackup });
|
|
5157
5324
|
if (results.length === 0 && keySource.created) {
|
|
5158
5325
|
output_manager_default.print("\n");
|
|
5159
|
-
printAlignedLabel("Rotated", "AI Gateway API key"
|
|
5160
|
-
printKeyRow(keySource.key, {
|
|
5326
|
+
printAlignedLabel("Rotated", "AI Gateway API key");
|
|
5327
|
+
printKeyRow(keySource.key, {
|
|
5328
|
+
keychain: useKeychain,
|
|
5329
|
+
created: keySource.created
|
|
5330
|
+
});
|
|
5161
5331
|
output_manager_default.print(import_chalk16.default.dim(" No config files changed.\n"));
|
|
5162
5332
|
}
|
|
5163
5333
|
if (results.length > 0) {
|
|
@@ -5171,7 +5341,10 @@ async function codingAgentsSetup(client, argv) {
|
|
|
5171
5341
|
result.path
|
|
5172
5342
|
);
|
|
5173
5343
|
}
|
|
5174
|
-
printKeyRow(keySource.key, {
|
|
5344
|
+
printKeyRow(keySource.key, {
|
|
5345
|
+
keychain: useKeychain,
|
|
5346
|
+
created: keySource.created
|
|
5347
|
+
});
|
|
5175
5348
|
if (results.some((r) => r.backupPath)) {
|
|
5176
5349
|
output_manager_default.print(import_chalk16.default.dim(" Previous files saved alongside as .bak\n"));
|
|
5177
5350
|
}
|
|
@@ -5888,12 +6061,12 @@ async function alerts(client) {
|
|
|
5888
6061
|
switch (subcommand) {
|
|
5889
6062
|
case "inspect": {
|
|
5890
6063
|
telemetry2.trackCliSubcommandInspect(subcommandOriginal);
|
|
5891
|
-
const inspectFn = (await import("./chunks/inspect-
|
|
6064
|
+
const inspectFn = (await import("./chunks/inspect-Q5BKZNVI.js")).default;
|
|
5892
6065
|
return inspectFn(client, args);
|
|
5893
6066
|
}
|
|
5894
6067
|
case "rules": {
|
|
5895
6068
|
telemetry2.trackCliSubcommandRules(args[0] ?? "ls");
|
|
5896
|
-
const rulesFn = (await import("./chunks/rules-
|
|
6069
|
+
const rulesFn = (await import("./chunks/rules-SQFCUKWS.js")).default;
|
|
5897
6070
|
const rulesArgs = [...args];
|
|
5898
6071
|
const project = parsedArgs.flags["--project"];
|
|
5899
6072
|
const format4 = parsedArgs.flags["--format"];
|
|
@@ -5907,7 +6080,7 @@ async function alerts(client) {
|
|
|
5907
6080
|
}
|
|
5908
6081
|
default: {
|
|
5909
6082
|
telemetry2.trackCliSubcommandLs(subcommandOriginal);
|
|
5910
|
-
const listFn = (await import("./chunks/list-
|
|
6083
|
+
const listFn = (await import("./chunks/list-N7OA4FBI.js")).default;
|
|
5911
6084
|
return listFn(client, telemetry2);
|
|
5912
6085
|
}
|
|
5913
6086
|
}
|
|
@@ -30014,6 +30187,12 @@ var FlagsTelemetryClient = class extends TelemetryClient {
|
|
|
30014
30187
|
value: actual
|
|
30015
30188
|
});
|
|
30016
30189
|
}
|
|
30190
|
+
trackCliSubcommandEvaluations(actual) {
|
|
30191
|
+
this.trackCliSubcommand({
|
|
30192
|
+
subcommand: "evaluations",
|
|
30193
|
+
value: actual
|
|
30194
|
+
});
|
|
30195
|
+
}
|
|
30017
30196
|
trackCliSubcommandOpen(actual) {
|
|
30018
30197
|
this.trackCliSubcommand({
|
|
30019
30198
|
subcommand: "open",
|
|
@@ -30271,10 +30450,11 @@ function quoteArg(value) {
|
|
|
30271
30450
|
function getProjectNameFromFlags(flags) {
|
|
30272
30451
|
return flags["--project"];
|
|
30273
30452
|
}
|
|
30274
|
-
function getLinkedFlagsProject(client, projectName) {
|
|
30453
|
+
function getLinkedFlagsProject(client, projectName, options) {
|
|
30275
30454
|
return resolveProjectContext({
|
|
30276
30455
|
client,
|
|
30277
|
-
projectNameOrId: projectName
|
|
30456
|
+
projectNameOrId: projectName,
|
|
30457
|
+
projectNotFoundHandling: options?.projectNotFoundHandling
|
|
30278
30458
|
});
|
|
30279
30459
|
}
|
|
30280
30460
|
|
|
@@ -30528,6 +30708,13 @@ function formatVariantForDisplay(variant) {
|
|
|
30528
30708
|
}
|
|
30529
30709
|
return parts.join(" ");
|
|
30530
30710
|
}
|
|
30711
|
+
function formatVariantListSummary(variant) {
|
|
30712
|
+
const value = formatVariantValue(variant.value);
|
|
30713
|
+
if (!variant.label) {
|
|
30714
|
+
return value;
|
|
30715
|
+
}
|
|
30716
|
+
return `${value}: ${import_chalk117.default.gray(variant.label)}`;
|
|
30717
|
+
}
|
|
30531
30718
|
function formatAvailableVariants(variants) {
|
|
30532
30719
|
return variants.map((v) => ` - ${formatAvailableVariant(v)}`).join("\n");
|
|
30533
30720
|
}
|
|
@@ -30861,13 +31048,6 @@ function getSortedEnvironmentEntries(flag, environments) {
|
|
|
30861
31048
|
function hasCustomConfigurationEnabled(envConfig) {
|
|
30862
31049
|
return Boolean(envConfig.targets && Object.keys(envConfig.targets).length > 0) || envConfig.rules.length > 0 || envConfig.fallthrough.type === "split" || envConfig.fallthrough.type === "rollout";
|
|
30863
31050
|
}
|
|
30864
|
-
function formatVariantListSummary(variant) {
|
|
30865
|
-
const value = formatVariantValue(variant.value);
|
|
30866
|
-
if (!variant.label) {
|
|
30867
|
-
return value;
|
|
30868
|
-
}
|
|
30869
|
-
return `${value}: ${import_chalk119.default.gray(variant.label)}`;
|
|
30870
|
-
}
|
|
30871
31051
|
|
|
30872
31052
|
// src/commands/flags/inspect.ts
|
|
30873
31053
|
async function inspect4(client, argv) {
|
|
@@ -32074,6 +32254,341 @@ function buildNextPageCommand2(flagArg, flags, nextCursor) {
|
|
|
32074
32254
|
return `flags versions ${quoteArg(flagArg)}${baseFlags}${environmentFlag} --cursor ${quoteArg(nextCursor)}`;
|
|
32075
32255
|
}
|
|
32076
32256
|
|
|
32257
|
+
// src/util/telemetry/commands/flags/evaluations.ts
|
|
32258
|
+
var FlagsEvaluationsTelemetryClient = class extends TelemetryClient {
|
|
32259
|
+
trackCliArgumentFlag(flag) {
|
|
32260
|
+
if (flag) {
|
|
32261
|
+
this.trackCliArgument({
|
|
32262
|
+
arg: "flag",
|
|
32263
|
+
value: this.redactedValue
|
|
32264
|
+
});
|
|
32265
|
+
}
|
|
32266
|
+
}
|
|
32267
|
+
trackCliOptionSince(since) {
|
|
32268
|
+
if (since) {
|
|
32269
|
+
this.trackCliOption({
|
|
32270
|
+
option: "since",
|
|
32271
|
+
value: this.redactedValue
|
|
32272
|
+
});
|
|
32273
|
+
}
|
|
32274
|
+
}
|
|
32275
|
+
trackCliOptionUntil(until) {
|
|
32276
|
+
if (until) {
|
|
32277
|
+
this.trackCliOption({
|
|
32278
|
+
option: "until",
|
|
32279
|
+
value: this.redactedValue
|
|
32280
|
+
});
|
|
32281
|
+
}
|
|
32282
|
+
}
|
|
32283
|
+
trackCliOptionGranularity(granularity) {
|
|
32284
|
+
if (granularity) {
|
|
32285
|
+
this.trackCliOption({
|
|
32286
|
+
option: "granularity",
|
|
32287
|
+
value: isFlagEvaluationsGranularity(granularity) ? granularity : this.redactedValue
|
|
32288
|
+
});
|
|
32289
|
+
}
|
|
32290
|
+
}
|
|
32291
|
+
trackCliFlagJson(json) {
|
|
32292
|
+
if (json) {
|
|
32293
|
+
this.trackCliFlag("json");
|
|
32294
|
+
}
|
|
32295
|
+
}
|
|
32296
|
+
};
|
|
32297
|
+
|
|
32298
|
+
// src/commands/flags/evaluations.ts
|
|
32299
|
+
var FLAG_EVALUATIONS_API_URL = "https://vercel.com/api/observability/metrics";
|
|
32300
|
+
var FLAG_EVALUATIONS_METRIC = "vercel.flag_evaluation.flag_evaluations";
|
|
32301
|
+
var FLAG_EVALUATIONS_AGGREGATION = "sum";
|
|
32302
|
+
var FLAG_EVALUATIONS_ROLLUP = getRollupColumnName(
|
|
32303
|
+
FLAG_EVALUATIONS_METRIC,
|
|
32304
|
+
FLAG_EVALUATIONS_AGGREGATION
|
|
32305
|
+
);
|
|
32306
|
+
var DISPLAY_GROUP_BY = "Variants";
|
|
32307
|
+
var QUERY_ENGINE_GROUP_BY = "flagVariant";
|
|
32308
|
+
var MAX_VARIANTS = 100;
|
|
32309
|
+
function getFlagEvaluationsApiUrl(ownerId) {
|
|
32310
|
+
const url = new URL(
|
|
32311
|
+
process.env.VERCEL_FLAG_EVALUATIONS_API_URL || FLAG_EVALUATIONS_API_URL
|
|
32312
|
+
);
|
|
32313
|
+
url.searchParams.set("ownerId", ownerId);
|
|
32314
|
+
return url.href;
|
|
32315
|
+
}
|
|
32316
|
+
function escapeODataString(value) {
|
|
32317
|
+
return value.replace(/'/g, "''");
|
|
32318
|
+
}
|
|
32319
|
+
function alignTimeRange(startTime, endTime, granularity) {
|
|
32320
|
+
const granularityMs = toGranularityMsFromDuration(granularity);
|
|
32321
|
+
return {
|
|
32322
|
+
startTime: new Date(
|
|
32323
|
+
Math.floor(startTime.getTime() / granularityMs) * granularityMs
|
|
32324
|
+
),
|
|
32325
|
+
endTime: new Date(
|
|
32326
|
+
Math.ceil(endTime.getTime() / granularityMs) * granularityMs
|
|
32327
|
+
)
|
|
32328
|
+
};
|
|
32329
|
+
}
|
|
32330
|
+
function getVariantDisplayName(flag, variantId2) {
|
|
32331
|
+
if (!variantId2 || variantId2 === "(not set)") {
|
|
32332
|
+
return "Default in Code";
|
|
32333
|
+
}
|
|
32334
|
+
const variant = flag.variants.find((item) => item.id === variantId2);
|
|
32335
|
+
return variant ? formatVariantListSummary(variant) : variantId2;
|
|
32336
|
+
}
|
|
32337
|
+
function handleCommandError(client, error, jsonOutput) {
|
|
32338
|
+
if (!jsonOutput) {
|
|
32339
|
+
printError(error);
|
|
32340
|
+
return 1;
|
|
32341
|
+
}
|
|
32342
|
+
if (isAPIError(error)) {
|
|
32343
|
+
return outputError(
|
|
32344
|
+
client,
|
|
32345
|
+
true,
|
|
32346
|
+
error.code || "API_ERROR",
|
|
32347
|
+
error.serverMessage || `API error (${error.status}).`
|
|
32348
|
+
);
|
|
32349
|
+
}
|
|
32350
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
32351
|
+
return outputError(client, true, "UNEXPECTED_ERROR", message);
|
|
32352
|
+
}
|
|
32353
|
+
function handleMetricsQueryError(client, error, jsonOutput) {
|
|
32354
|
+
return isAPIError(error) ? handleApiError(error, jsonOutput, client) : handleCommandError(client, error, jsonOutput);
|
|
32355
|
+
}
|
|
32356
|
+
function limitEvaluationVariants(response) {
|
|
32357
|
+
if (response.summary.length <= MAX_VARIANTS) {
|
|
32358
|
+
return { response, truncated: false };
|
|
32359
|
+
}
|
|
32360
|
+
const summary = response.summary.slice(0, MAX_VARIANTS);
|
|
32361
|
+
const visibleVariants = new Set(
|
|
32362
|
+
summary.map((row) => row[QUERY_ENGINE_GROUP_BY])
|
|
32363
|
+
);
|
|
32364
|
+
return {
|
|
32365
|
+
response: {
|
|
32366
|
+
...response,
|
|
32367
|
+
summary,
|
|
32368
|
+
data: response.data?.filter(
|
|
32369
|
+
(row) => visibleVariants.has(row[QUERY_ENGINE_GROUP_BY])
|
|
32370
|
+
)
|
|
32371
|
+
},
|
|
32372
|
+
truncated: true
|
|
32373
|
+
};
|
|
32374
|
+
}
|
|
32375
|
+
function formatEvaluationsJson(flag, response, startTime, endTime, granularity, truncated) {
|
|
32376
|
+
return `${JSON.stringify(
|
|
32377
|
+
{
|
|
32378
|
+
flag: flag.slug,
|
|
32379
|
+
variants: Object.fromEntries(
|
|
32380
|
+
flag.variants.map(({ id, value }) => [id, value])
|
|
32381
|
+
),
|
|
32382
|
+
startTime: startTime.toISOString(),
|
|
32383
|
+
endTime: endTime.toISOString(),
|
|
32384
|
+
granularity,
|
|
32385
|
+
truncated,
|
|
32386
|
+
buckets: (response.data ?? []).map((row) => ({
|
|
32387
|
+
timestamp: row.timestamp,
|
|
32388
|
+
variant: row[QUERY_ENGINE_GROUP_BY] ?? null,
|
|
32389
|
+
evaluations: row[FLAG_EVALUATIONS_ROLLUP] ?? null
|
|
32390
|
+
}))
|
|
32391
|
+
},
|
|
32392
|
+
null,
|
|
32393
|
+
2
|
|
32394
|
+
)}
|
|
32395
|
+
`;
|
|
32396
|
+
}
|
|
32397
|
+
async function evaluations(client, argv) {
|
|
32398
|
+
const telemetry2 = new FlagsEvaluationsTelemetryClient({
|
|
32399
|
+
opts: { store: client.telemetryEventStore }
|
|
32400
|
+
});
|
|
32401
|
+
let parsedArgs;
|
|
32402
|
+
const flagsSpecification = getFlagsSpecification(
|
|
32403
|
+
evaluationsSubcommand.options
|
|
32404
|
+
);
|
|
32405
|
+
try {
|
|
32406
|
+
parsedArgs = parseArguments(argv, flagsSpecification);
|
|
32407
|
+
} catch (error) {
|
|
32408
|
+
printError(error);
|
|
32409
|
+
return 1;
|
|
32410
|
+
}
|
|
32411
|
+
const { args, flags } = parsedArgs;
|
|
32412
|
+
const [flagArgument] = args;
|
|
32413
|
+
const projectName = getProjectNameFromFlags(flags);
|
|
32414
|
+
const since = flags["--since"];
|
|
32415
|
+
const until = flags["--until"];
|
|
32416
|
+
const granularity = flags["--granularity"];
|
|
32417
|
+
telemetry2.trackCliArgumentFlag(flagArgument);
|
|
32418
|
+
telemetry2.trackCliOptionProject(projectName);
|
|
32419
|
+
telemetry2.trackCliOptionSince(since);
|
|
32420
|
+
telemetry2.trackCliOptionUntil(until);
|
|
32421
|
+
telemetry2.trackCliOptionGranularity(granularity);
|
|
32422
|
+
telemetry2.trackCliFlagJson(flags["--json"]);
|
|
32423
|
+
const jsonOutput = flags["--json"] ?? false;
|
|
32424
|
+
if (!flagArgument) {
|
|
32425
|
+
return outputError(
|
|
32426
|
+
client,
|
|
32427
|
+
jsonOutput,
|
|
32428
|
+
"MISSING_FLAG",
|
|
32429
|
+
`Missing required argument: flag. Usage: ${getCommandName("flags evaluations <flag>")}`
|
|
32430
|
+
);
|
|
32431
|
+
}
|
|
32432
|
+
if (granularity && !isFlagEvaluationsGranularity(granularity)) {
|
|
32433
|
+
return outputError(
|
|
32434
|
+
client,
|
|
32435
|
+
jsonOutput,
|
|
32436
|
+
"INVALID_GRANULARITY",
|
|
32437
|
+
`Invalid granularity "${granularity}". Use one of: ${FLAG_EVALUATIONS_GRANULARITIES.join(", ")}.`
|
|
32438
|
+
);
|
|
32439
|
+
}
|
|
32440
|
+
let startTime;
|
|
32441
|
+
let endTime;
|
|
32442
|
+
let resolvedGranularity;
|
|
32443
|
+
try {
|
|
32444
|
+
({ startTime, endTime } = resolveTimeRange(since, until));
|
|
32445
|
+
if (startTime.getTime() >= endTime.getTime()) {
|
|
32446
|
+
throw new Error("The start time must be before the end time.");
|
|
32447
|
+
}
|
|
32448
|
+
resolvedGranularity = computeGranularity(
|
|
32449
|
+
endTime.getTime() - startTime.getTime(),
|
|
32450
|
+
granularity
|
|
32451
|
+
);
|
|
32452
|
+
({ startTime, endTime } = alignTimeRange(
|
|
32453
|
+
startTime,
|
|
32454
|
+
endTime,
|
|
32455
|
+
resolvedGranularity.duration
|
|
32456
|
+
));
|
|
32457
|
+
} catch (error) {
|
|
32458
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
32459
|
+
return outputError(client, jsonOutput, "INVALID_TIME", message);
|
|
32460
|
+
}
|
|
32461
|
+
if (!jsonOutput && resolvedGranularity.adjusted && resolvedGranularity.notice) {
|
|
32462
|
+
output_manager_default.log(`Notice: ${resolvedGranularity.notice}`);
|
|
32463
|
+
}
|
|
32464
|
+
let link;
|
|
32465
|
+
try {
|
|
32466
|
+
link = await getLinkedFlagsProject(client, projectName, {
|
|
32467
|
+
projectNotFoundHandling: jsonOutput ? "return" : "report"
|
|
32468
|
+
});
|
|
32469
|
+
} catch (error) {
|
|
32470
|
+
return handleCommandError(client, error, jsonOutput);
|
|
32471
|
+
}
|
|
32472
|
+
if (link.status === "error") {
|
|
32473
|
+
return jsonOutput ? outputError(
|
|
32474
|
+
client,
|
|
32475
|
+
true,
|
|
32476
|
+
"PROJECT_RESOLUTION_FAILED",
|
|
32477
|
+
"Unable to resolve the requested Vercel project."
|
|
32478
|
+
) : link.exitCode;
|
|
32479
|
+
}
|
|
32480
|
+
if (link.status === "not_linked") {
|
|
32481
|
+
const code2 = projectName ? "PROJECT_NOT_FOUND" : "NOT_LINKED";
|
|
32482
|
+
const message = projectName ? `Project "${projectName}" was not found in the current scope.` : `Your codebase isn't linked to a project on Vercel. Pass --project <name>, or run ${getCommandName("link")} to link it.`;
|
|
32483
|
+
return outputError(client, jsonOutput, code2, message);
|
|
32484
|
+
}
|
|
32485
|
+
client.config.currentTeam = link.org.type === "team" ? link.org.id : void 0;
|
|
32486
|
+
const { project, org } = link;
|
|
32487
|
+
let flag;
|
|
32488
|
+
try {
|
|
32489
|
+
flag = await getFlag(client, project.id, flagArgument);
|
|
32490
|
+
} catch (error) {
|
|
32491
|
+
return handleCommandError(client, error, jsonOutput);
|
|
32492
|
+
}
|
|
32493
|
+
if (!jsonOutput) {
|
|
32494
|
+
output_manager_default.spinner("Querying flag evaluations...");
|
|
32495
|
+
}
|
|
32496
|
+
const scope = {
|
|
32497
|
+
type: "project",
|
|
32498
|
+
ownerId: org.id,
|
|
32499
|
+
projectIds: [project.id]
|
|
32500
|
+
};
|
|
32501
|
+
let response;
|
|
32502
|
+
try {
|
|
32503
|
+
const body = {
|
|
32504
|
+
scope,
|
|
32505
|
+
reason: "flag_evaluation_chart",
|
|
32506
|
+
event: "flagEvaluation",
|
|
32507
|
+
rollups: {
|
|
32508
|
+
[FLAG_EVALUATIONS_ROLLUP]: {
|
|
32509
|
+
measure: "flagEvaluations",
|
|
32510
|
+
aggregation: "sum"
|
|
32511
|
+
}
|
|
32512
|
+
},
|
|
32513
|
+
orderBy: FLAG_EVALUATIONS_ROLLUP,
|
|
32514
|
+
orderDirection: "desc",
|
|
32515
|
+
groupBy: [QUERY_ENGINE_GROUP_BY],
|
|
32516
|
+
// Fetch one extra variant so output can disclose truncation reliably.
|
|
32517
|
+
limit: MAX_VARIANTS + 1,
|
|
32518
|
+
limitRanking: "single_pass",
|
|
32519
|
+
tailRollup: "truncate",
|
|
32520
|
+
summaryOnly: false,
|
|
32521
|
+
filter: `flagKey eq '${escapeODataString(flag.slug)}'`,
|
|
32522
|
+
granularity: resolvedGranularity.duration,
|
|
32523
|
+
startTime: startTime.toISOString(),
|
|
32524
|
+
endTime: endTime.toISOString()
|
|
32525
|
+
};
|
|
32526
|
+
response = await client.fetch(
|
|
32527
|
+
getFlagEvaluationsApiUrl(org.id),
|
|
32528
|
+
{
|
|
32529
|
+
method: "POST",
|
|
32530
|
+
body: JSON.stringify(body),
|
|
32531
|
+
headers: { "Content-Type": "application/json" },
|
|
32532
|
+
useCurrentTeam: false,
|
|
32533
|
+
bailOn429: true
|
|
32534
|
+
}
|
|
32535
|
+
);
|
|
32536
|
+
} catch (error) {
|
|
32537
|
+
return handleMetricsQueryError(client, error, jsonOutput);
|
|
32538
|
+
} finally {
|
|
32539
|
+
if (!jsonOutput) {
|
|
32540
|
+
output_manager_default.stopSpinner();
|
|
32541
|
+
}
|
|
32542
|
+
}
|
|
32543
|
+
const limited = limitEvaluationVariants(response);
|
|
32544
|
+
if (jsonOutput) {
|
|
32545
|
+
client.stdout.write(
|
|
32546
|
+
formatEvaluationsJson(
|
|
32547
|
+
flag,
|
|
32548
|
+
limited.response,
|
|
32549
|
+
startTime,
|
|
32550
|
+
endTime,
|
|
32551
|
+
resolvedGranularity.duration,
|
|
32552
|
+
limited.truncated
|
|
32553
|
+
)
|
|
32554
|
+
);
|
|
32555
|
+
} else {
|
|
32556
|
+
if (limited.truncated) {
|
|
32557
|
+
output_manager_default.warn(
|
|
32558
|
+
`Results are limited to the ${MAX_VARIANTS} most evaluated variants.`
|
|
32559
|
+
);
|
|
32560
|
+
}
|
|
32561
|
+
client.stdout.write(
|
|
32562
|
+
formatText(
|
|
32563
|
+
{
|
|
32564
|
+
...limited.response,
|
|
32565
|
+
data: limited.response.data?.map((row) => ({
|
|
32566
|
+
...row,
|
|
32567
|
+
[DISPLAY_GROUP_BY]: row[QUERY_ENGINE_GROUP_BY] ?? null
|
|
32568
|
+
}))
|
|
32569
|
+
},
|
|
32570
|
+
{
|
|
32571
|
+
metric: FLAG_EVALUATIONS_METRIC,
|
|
32572
|
+
metricUnit: "count",
|
|
32573
|
+
aggregation: FLAG_EVALUATIONS_AGGREGATION,
|
|
32574
|
+
groupBy: [DISPLAY_GROUP_BY],
|
|
32575
|
+
scope,
|
|
32576
|
+
projectName: project.name,
|
|
32577
|
+
teamName: org.slug,
|
|
32578
|
+
periodStart: startTime.toISOString(),
|
|
32579
|
+
periodEnd: endTime.toISOString(),
|
|
32580
|
+
granularity: resolvedGranularity.duration,
|
|
32581
|
+
presentation: {
|
|
32582
|
+
compact: true,
|
|
32583
|
+
formatGroupValue: (_field, value) => getVariantDisplayName(flag, value)
|
|
32584
|
+
}
|
|
32585
|
+
}
|
|
32586
|
+
)
|
|
32587
|
+
);
|
|
32588
|
+
}
|
|
32589
|
+
return 0;
|
|
32590
|
+
}
|
|
32591
|
+
|
|
32077
32592
|
// src/commands/flags/add.ts
|
|
32078
32593
|
var import_chalk122 = __toESM(require_source(), 1);
|
|
32079
32594
|
import { randomBytes as randomBytes2 } from "crypto";
|
|
@@ -38579,6 +39094,7 @@ var COMMAND_CONFIG30 = {
|
|
|
38579
39094
|
ls: getCommandAliases(listSubcommand11),
|
|
38580
39095
|
inspect: getCommandAliases(inspectSubcommand4),
|
|
38581
39096
|
versions: getCommandAliases(versionsSubcommand),
|
|
39097
|
+
evaluations: getCommandAliases(evaluationsSubcommand),
|
|
38582
39098
|
create: getCommandAliases(createSubcommand4),
|
|
38583
39099
|
open: getCommandAliases(openSubcommand2),
|
|
38584
39100
|
update: getCommandAliases(updateSubcommand3),
|
|
@@ -38647,6 +39163,14 @@ async function main17(client) {
|
|
|
38647
39163
|
case "versions":
|
|
38648
39164
|
telemetry2.trackCliSubcommandVersions(subcommandOriginal);
|
|
38649
39165
|
return versions(client, needHelp ? [...args, "--help"] : args);
|
|
39166
|
+
case "evaluations":
|
|
39167
|
+
if (needHelp) {
|
|
39168
|
+
telemetry2.trackCliFlagHelp("flags", subcommandOriginal);
|
|
39169
|
+
printHelp(evaluationsSubcommand);
|
|
39170
|
+
return 2;
|
|
39171
|
+
}
|
|
39172
|
+
telemetry2.trackCliSubcommandEvaluations(subcommandOriginal);
|
|
39173
|
+
return evaluations(client, args);
|
|
38650
39174
|
case "open":
|
|
38651
39175
|
if (needHelp) {
|
|
38652
39176
|
telemetry2.trackCliFlagHelp("flags", subcommandOriginal);
|
|
@@ -48278,7 +48802,7 @@ async function metrics(client) {
|
|
|
48278
48802
|
return 0;
|
|
48279
48803
|
}
|
|
48280
48804
|
telemetry2.trackCliSubcommandSchema(subcommandOriginal);
|
|
48281
|
-
const schemaFn = (await import("./chunks/schema-
|
|
48805
|
+
const schemaFn = (await import("./chunks/schema-PWSCMD24.js")).default;
|
|
48282
48806
|
return schemaFn(client, telemetry2);
|
|
48283
48807
|
}
|
|
48284
48808
|
default: {
|
|
@@ -48291,7 +48815,7 @@ async function metrics(client) {
|
|
|
48291
48815
|
output_manager_default.print(help(metricsCommand, { columns: client.stderr.columns }));
|
|
48292
48816
|
return 2;
|
|
48293
48817
|
}
|
|
48294
|
-
const queryFn = (await import("./chunks/query-
|
|
48818
|
+
const queryFn = (await import("./chunks/query-QDOKUCHX.js")).default;
|
|
48295
48819
|
return queryFn(client, telemetry2);
|
|
48296
48820
|
}
|
|
48297
48821
|
}
|
|
@@ -58871,7 +59395,7 @@ async function main26(client) {
|
|
|
58871
59395
|
return 2;
|
|
58872
59396
|
}
|
|
58873
59397
|
telemetry2.trackCliSubcommandEdit(subcommandOriginal);
|
|
58874
|
-
return (await import("./chunks/edit-
|
|
59398
|
+
return (await import("./chunks/edit-KO5KX4WU.js")).default(client, args);
|
|
58875
59399
|
case "delete":
|
|
58876
59400
|
if (needHelp) {
|
|
58877
59401
|
telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
|
|
@@ -58879,7 +59403,7 @@ async function main26(client) {
|
|
|
58879
59403
|
return 2;
|
|
58880
59404
|
}
|
|
58881
59405
|
telemetry2.trackCliSubcommandDelete(subcommandOriginal);
|
|
58882
|
-
return (await import("./chunks/delete-
|
|
59406
|
+
return (await import("./chunks/delete-AUDPLCMU.js")).default(client, args);
|
|
58883
59407
|
case "enable":
|
|
58884
59408
|
if (needHelp) {
|
|
58885
59409
|
telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
|
|
@@ -58887,7 +59411,7 @@ async function main26(client) {
|
|
|
58887
59411
|
return 2;
|
|
58888
59412
|
}
|
|
58889
59413
|
telemetry2.trackCliSubcommandEnable(subcommandOriginal);
|
|
58890
|
-
return (await import("./chunks/enable-
|
|
59414
|
+
return (await import("./chunks/enable-I5HE32DI.js")).default(client, args);
|
|
58891
59415
|
case "disable":
|
|
58892
59416
|
if (needHelp) {
|
|
58893
59417
|
telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
|
|
@@ -58895,7 +59419,7 @@ async function main26(client) {
|
|
|
58895
59419
|
return 2;
|
|
58896
59420
|
}
|
|
58897
59421
|
telemetry2.trackCliSubcommandDisable(subcommandOriginal);
|
|
58898
|
-
return (await import("./chunks/disable-
|
|
59422
|
+
return (await import("./chunks/disable-WFPXR7GZ.js")).default(client, args);
|
|
58899
59423
|
case "reorder":
|
|
58900
59424
|
if (needHelp) {
|
|
58901
59425
|
telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
|
|
@@ -58903,7 +59427,7 @@ async function main26(client) {
|
|
|
58903
59427
|
return 2;
|
|
58904
59428
|
}
|
|
58905
59429
|
telemetry2.trackCliSubcommandReorder(subcommandOriginal);
|
|
58906
|
-
return (await import("./chunks/reorder-
|
|
59430
|
+
return (await import("./chunks/reorder-L2M3YGJ4.js")).default(client, args);
|
|
58907
59431
|
case "export":
|
|
58908
59432
|
if (needHelp) {
|
|
58909
59433
|
telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
|
|
@@ -58911,7 +59435,7 @@ async function main26(client) {
|
|
|
58911
59435
|
return 2;
|
|
58912
59436
|
}
|
|
58913
59437
|
telemetry2.trackCliSubcommandExport(subcommandOriginal);
|
|
58914
|
-
return (await import("./chunks/export-
|
|
59438
|
+
return (await import("./chunks/export-4Y5L2TOT.js")).default(client, args);
|
|
58915
59439
|
case "publish":
|
|
58916
59440
|
if (needHelp) {
|
|
58917
59441
|
telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
|
|
@@ -58919,7 +59443,7 @@ async function main26(client) {
|
|
|
58919
59443
|
return 2;
|
|
58920
59444
|
}
|
|
58921
59445
|
telemetry2.trackCliSubcommandPublish(subcommandOriginal);
|
|
58922
|
-
return (await import("./chunks/publish-
|
|
59446
|
+
return (await import("./chunks/publish-DUTEBRX3.js")).default(client, args);
|
|
58923
59447
|
case "restore":
|
|
58924
59448
|
if (needHelp) {
|
|
58925
59449
|
telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
|
|
@@ -58927,7 +59451,7 @@ async function main26(client) {
|
|
|
58927
59451
|
return 2;
|
|
58928
59452
|
}
|
|
58929
59453
|
telemetry2.trackCliSubcommandRestore(subcommandOriginal);
|
|
58930
|
-
return (await import("./chunks/restore-
|
|
59454
|
+
return (await import("./chunks/restore-BVDNAJVC.js")).default(client, args);
|
|
58931
59455
|
case "discard-staging":
|
|
58932
59456
|
if (needHelp) {
|
|
58933
59457
|
telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
|
|
@@ -58935,7 +59459,7 @@ async function main26(client) {
|
|
|
58935
59459
|
return 2;
|
|
58936
59460
|
}
|
|
58937
59461
|
telemetry2.trackCliSubcommandDiscardStaging(subcommandOriginal);
|
|
58938
|
-
return (await import("./chunks/discard-
|
|
59462
|
+
return (await import("./chunks/discard-RVFKIZZG.js")).default(client, args);
|
|
58939
59463
|
default:
|
|
58940
59464
|
output_manager_default.error(getInvalidSubcommand(COMMAND_CONFIG41));
|
|
58941
59465
|
output_manager_default.print(help(routesCommand, { columns: client.stderr.columns }));
|
|
@@ -63546,25 +64070,25 @@ async function vcr(client) {
|
|
|
63546
64070
|
switch (subcommand) {
|
|
63547
64071
|
case "ls":
|
|
63548
64072
|
telemetry2.trackCliSubcommandLs(subcommandOriginal);
|
|
63549
|
-
return (await import("./chunks/ls-
|
|
64073
|
+
return (await import("./chunks/ls-H52WO65Y.js")).default(client, args, telemetry2);
|
|
63550
64074
|
case "inspect":
|
|
63551
64075
|
telemetry2.trackCliSubcommandInspect(subcommandOriginal);
|
|
63552
|
-
return (await import("./chunks/inspect-
|
|
64076
|
+
return (await import("./chunks/inspect-PJDCPARM.js")).default(client, args, telemetry2);
|
|
63553
64077
|
case "add":
|
|
63554
64078
|
telemetry2.trackCliSubcommandAdd(subcommandOriginal);
|
|
63555
|
-
return (await import("./chunks/add-
|
|
64079
|
+
return (await import("./chunks/add-2HLAH42D.js")).default(client, args, telemetry2);
|
|
63556
64080
|
case "rm":
|
|
63557
64081
|
telemetry2.trackCliSubcommandRm(subcommandOriginal);
|
|
63558
|
-
return (await import("./chunks/rm-
|
|
64082
|
+
return (await import("./chunks/rm-VHWBHG3A.js")).default(client, args, telemetry2);
|
|
63559
64083
|
case "login":
|
|
63560
64084
|
telemetry2.trackCliSubcommandLogin(subcommandOriginal);
|
|
63561
|
-
return (await import("./chunks/login-
|
|
64085
|
+
return (await import("./chunks/login-BPE774JW.js")).default(client, args, telemetry2);
|
|
63562
64086
|
case "tag":
|
|
63563
64087
|
telemetry2.trackCliSubcommandTag(subcommandOriginal);
|
|
63564
|
-
return (await import("./chunks/tags-
|
|
64088
|
+
return (await import("./chunks/tags-BT7ZGJP2.js")).default(client, args, telemetry2);
|
|
63565
64089
|
case "image":
|
|
63566
64090
|
telemetry2.trackCliSubcommandImage(subcommandOriginal);
|
|
63567
|
-
return (await import("./chunks/image-
|
|
64091
|
+
return (await import("./chunks/image-QC5MVWKN.js")).default(client, args, telemetry2);
|
|
63568
64092
|
default:
|
|
63569
64093
|
output_manager_default.error(getInvalidSubcommand(COMMAND_CONFIG47));
|
|
63570
64094
|
output_manager_default.print(help(vcrCommand, { columns: client.stderr.columns }));
|