vercel 58.7.1 → 58.9.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-7RQIEXDK.js → add-EN4KBTT6.js} +4 -4
- package/dist/chunks/{add-CJZGLI73.js → add-HFK7NUGY.js} +2 -2
- package/dist/chunks/{add-JLCJCRV6.js → add-ZVQJE6BF.js} +6 -6
- package/dist/chunks/{build-BF4HIMTK.js → build-IDCBAC3R.js} +4 -4
- package/dist/chunks/{chunk-TNTJXJSE.js → chunk-2PPATWD6.js} +1 -1
- package/dist/chunks/{chunk-BIGFTNW6.js → chunk-766B6IIX.js} +1 -1
- package/dist/chunks/{chunk-UME4MVFU.js → chunk-7AB6QOKM.js} +1 -1
- package/dist/chunks/{chunk-LC5BYUUP.js → chunk-7N26744Z.js} +1 -1
- package/dist/chunks/{chunk-NZ6GDMPB.js → chunk-BX4IGDGM.js} +46 -14
- package/dist/chunks/{chunk-NI4DNP3D.js → chunk-CKIZU3CI.js} +1 -1
- package/dist/chunks/{chunk-UAVZOOOL.js → chunk-DDUZ2VME.js} +32 -9
- package/dist/chunks/{chunk-7SXWLTXT.js → chunk-DQXBNALU.js} +1 -1
- package/dist/chunks/{chunk-4XKF7JOF.js → chunk-E3DRV4WI.js} +1 -1
- package/dist/chunks/{chunk-AW5YINX6.js → chunk-ELA5VN3A.js} +36 -3
- package/dist/chunks/{chunk-YR6M7ZIU.js → chunk-F45WFNLZ.js} +1 -1
- package/dist/chunks/{chunk-CDYBV7YA.js → chunk-FBG4AMAX.js} +1 -1
- package/dist/chunks/{chunk-TE5MIANG.js → chunk-G2S2QKKF.js} +2 -2
- package/dist/chunks/{chunk-F2TNAAGW.js → chunk-KES53W3V.js} +4 -4
- package/dist/chunks/{chunk-7KUQ7BHI.js → chunk-N22RS64U.js} +4 -3
- package/dist/chunks/{chunk-ZZZEJXHD.js → chunk-NFZHW6HH.js} +54 -3
- package/dist/chunks/{chunk-74XVGG52.js → chunk-PNSWZSLC.js} +2 -2
- package/dist/chunks/{chunk-5SZ6VX2H.js → chunk-Q6OJHDZK.js} +1 -1
- package/dist/chunks/{chunk-NOMQUVGM.js → chunk-QRRCK6VX.js} +1 -1
- package/dist/chunks/{chunk-7KVYKSR2.js → chunk-TIBP3CPZ.js} +1 -1
- package/dist/chunks/{chunk-H3KETQAA.js → chunk-U6CTW37A.js} +1 -1
- package/dist/chunks/chunk-WWPV6Z24.js +2910 -0
- package/dist/chunks/{chunk-D6SC2UJH.js → chunk-YTIUSEWE.js} +1 -1
- package/dist/chunks/{chunk-MNZUPMZZ.js → chunk-YUISINFV.js} +2 -2
- package/dist/chunks/{clear-C2MXHYPE.js → clear-W4AEVUND.js} +2 -2
- package/dist/chunks/{compile-vercel-config-PM5ID4CV.js → compile-vercel-config-Q45PSZDQ.js} +1 -1
- package/dist/chunks/config-MZ3KLGOK.js +159 -0
- package/dist/chunks/{delete-GMVIUCQV.js → delete-7NADCRED.js} +2 -2
- package/dist/chunks/{delete-ZXMLT7EJ.js → delete-NAZTL2IK.js} +2 -2
- package/dist/chunks/{disable-JJZZQ4IZ.js → disable-SB224IIS.js} +2 -2
- package/dist/chunks/{discard-CGAS2MSK.js → discard-MME6PI7B.js} +2 -2
- package/dist/chunks/{edit-ALN5UQHF.js → edit-HKQEFIOY.js} +2 -2
- package/dist/chunks/{edit-RKUUUBQF.js → edit-NW4YBUR6.js} +3 -3
- package/dist/chunks/{enable-UXRVQO6C.js → enable-QEL5CXVD.js} +2 -2
- package/dist/chunks/{export-WQE3UU4V.js → export-XDOZTLG3.js} +2 -2
- package/dist/chunks/{image-CRMOA4YF.js → image-AJMRAAOW.js} +3 -3
- package/dist/chunks/{import-builders-IEVZ7KYP.js → import-builders-7UG32FQA.js} +2 -2
- package/dist/chunks/{inspect-TYSLBSPQ.js → inspect-4YTOMOOP.js} +3 -3
- package/dist/chunks/{inspect-OINSXSCL.js → inspect-DGBKWCS4.js} +2 -2
- package/dist/chunks/{inspect-6PCM4O6L.js → inspect-JPZFHGAF.js} +2 -2
- package/dist/chunks/{inspect-YRRS3ZXR.js → inspect-T6HYEMLA.js} +2 -2
- package/dist/chunks/{inspect-ML2INEZG.js → inspect-TW5DENBM.js} +4 -4
- package/dist/chunks/{list-Q2VZLAFY.js → list-ESW6P765.js} +2 -2
- package/dist/chunks/{list-PA2JTS75.js → list-T7LXP6VX.js} +3 -3
- package/dist/chunks/{list-JWZTSHHP.js → list-YQ4LADLW.js} +1 -1
- package/dist/chunks/{login-6R3KIPSN.js → login-VJESL6WK.js} +4 -4
- package/dist/chunks/{ls-MS3FACFC.js → ls-2DYO6E4E.js} +3 -3
- package/dist/chunks/{ls-FKFZKWHH.js → ls-4A6CGBPD.js} +2 -2
- package/dist/chunks/{ls-G5UH4KGX.js → ls-5AQBMBOG.js} +2 -2
- package/dist/chunks/{ls-WAI5XAUS.js → ls-5I2W7LZQ.js} +4 -4
- package/dist/chunks/{ls-642SJJPI.js → ls-Y46O3BCS.js} +2 -2
- package/dist/chunks/{open-KYVW2GTM.js → open-SZDSII6L.js} +2 -2
- package/dist/chunks/{permissions-YIOBV4Q7.js → permissions-HRR47E2L.js} +4 -4
- package/dist/chunks/{publish-4BKTL25X.js → publish-D2QWFUP4.js} +2 -2
- package/dist/chunks/{push-6DJOEYYK.js → push-75R5ZZIW.js} +4 -4
- package/dist/chunks/{query-EJTENIFF.js → query-LL2GMJWQ.js} +1 -1
- package/dist/chunks/{reorder-C44IJZNE.js → reorder-GNCRV6CV.js} +2 -2
- package/dist/chunks/{reply-LPVL3IAU.js → reply-S3UUI6C6.js} +2 -2
- package/dist/chunks/{resolve-ZKNB3CT5.js → resolve-PCBDK47N.js} +2 -2
- package/dist/chunks/{restore-ACDVNSTC.js → restore-SXI5SHGJ.js} +2 -2
- package/dist/chunks/{rm-W7LO4WXB.js → rm-574XTDSM.js} +2 -2
- package/dist/chunks/{rm-GO2WVRJQ.js → rm-BEIAUTSF.js} +4 -4
- package/dist/chunks/{rm-HSUWESWO.js → rm-YK2EGEPB.js} +2 -2
- package/dist/chunks/{rm-ZAXW6GEF.js → rm-ZFWVI6JE.js} +3 -3
- package/dist/chunks/{rule-inspect-HPZSCLO4.js → rule-inspect-QDQUU3EO.js} +3 -3
- package/dist/chunks/{rules-BKI7PJNK.js → rules-FNA3NXZZ.js} +6 -6
- package/dist/chunks/{schema-DF7XBQSH.js → schema-5CASPRP6.js} +1 -1
- package/dist/chunks/{tags-N7ZPPMWE.js → tags-SRHDQUF6.js} +2 -2
- package/dist/chunks/{update-4SJXDMTG.js → update-FSTNM3OX.js} +6 -6
- package/dist/commands/build/index.js +28 -2721
- package/dist/commands/deploy/index.js +19 -14
- package/dist/commands/dev/index.js +8 -8
- package/dist/commands/env/index.js +6 -6
- package/dist/commands/link/index.js +8 -8
- package/dist/commands/list/index.js +2 -2
- package/dist/commands-bulk.js +1825 -737
- package/dist/index.js +9 -9
- package/dist/version.mjs +1 -1
- package/package.json +44 -44
- package/dist/chunks/chunk-62SBYAED.js +0 -206
package/dist/commands-bulk.js
CHANGED
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
runInteractiveEditLoop,
|
|
38
38
|
stripQuotes,
|
|
39
39
|
validateActionFlags
|
|
40
|
-
} from "./chunks/chunk-
|
|
40
|
+
} from "./chunks/chunk-F45WFNLZ.js";
|
|
41
41
|
import {
|
|
42
42
|
getRouteVersions
|
|
43
43
|
} from "./chunks/chunk-AHU7WNL2.js";
|
|
@@ -57,7 +57,7 @@ import {
|
|
|
57
57
|
requireProjectContext,
|
|
58
58
|
validateRequiredArguments,
|
|
59
59
|
withGlobalFlags as withGlobalFlags2
|
|
60
|
-
} from "./chunks/chunk-
|
|
60
|
+
} from "./chunks/chunk-YTIUSEWE.js";
|
|
61
61
|
import {
|
|
62
62
|
canPrompt
|
|
63
63
|
} from "./chunks/chunk-2473DUBR.js";
|
|
@@ -90,12 +90,12 @@ import {
|
|
|
90
90
|
resolveOpenApiTagForTeamsCli,
|
|
91
91
|
setAutoUpdate,
|
|
92
92
|
tryOpenApiFallback
|
|
93
|
-
} from "./chunks/chunk-
|
|
93
|
+
} from "./chunks/chunk-KES53W3V.js";
|
|
94
94
|
import "./chunks/chunk-FGDKMNEN.js";
|
|
95
95
|
import {
|
|
96
96
|
getUpdateCommand,
|
|
97
97
|
isGlobal
|
|
98
|
-
} from "./chunks/chunk-
|
|
98
|
+
} from "./chunks/chunk-U6CTW37A.js";
|
|
99
99
|
import {
|
|
100
100
|
Now,
|
|
101
101
|
addDomain,
|
|
@@ -116,7 +116,7 @@ import {
|
|
|
116
116
|
require_cjs,
|
|
117
117
|
require_jsonlines,
|
|
118
118
|
setupDomain
|
|
119
|
-
} from "./chunks/chunk-
|
|
119
|
+
} from "./chunks/chunk-DDUZ2VME.js";
|
|
120
120
|
import {
|
|
121
121
|
require_format
|
|
122
122
|
} from "./chunks/chunk-PRWJUY5U.js";
|
|
@@ -127,7 +127,7 @@ import {
|
|
|
127
127
|
readLocalConfig,
|
|
128
128
|
sleep,
|
|
129
129
|
writeToConfigFile
|
|
130
|
-
} from "./chunks/chunk-
|
|
130
|
+
} from "./chunks/chunk-YUISINFV.js";
|
|
131
131
|
import "./chunks/chunk-V5P25P7F.js";
|
|
132
132
|
import {
|
|
133
133
|
CHECKBOX_INSTRUCTIONS,
|
|
@@ -155,7 +155,7 @@ import {
|
|
|
155
155
|
import {
|
|
156
156
|
formatEnvironment,
|
|
157
157
|
validateLsArgs
|
|
158
|
-
} from "./chunks/chunk-
|
|
158
|
+
} from "./chunks/chunk-CKIZU3CI.js";
|
|
159
159
|
import {
|
|
160
160
|
validateJsonOutput
|
|
161
161
|
} from "./chunks/chunk-KXDWXXJH.js";
|
|
@@ -465,17 +465,23 @@ import {
|
|
|
465
465
|
webAnalyticsSubcommand,
|
|
466
466
|
webhooksCommand,
|
|
467
467
|
whoamiCommand
|
|
468
|
-
} from "./chunks/chunk-
|
|
468
|
+
} from "./chunks/chunk-NFZHW6HH.js";
|
|
469
469
|
import {
|
|
470
470
|
addSubcommand as addSubcommand12,
|
|
471
471
|
buildSubcommand,
|
|
472
|
+
configSubcommand,
|
|
472
473
|
inspectSubcommand as inspectSubcommand10,
|
|
473
474
|
listSubcommand as listSubcommand21,
|
|
474
475
|
loginSubcommand,
|
|
475
476
|
pushSubcommand,
|
|
476
477
|
removeSubcommand as removeSubcommand15,
|
|
477
478
|
vcrCommand
|
|
478
|
-
} from "./chunks/chunk-
|
|
479
|
+
} from "./chunks/chunk-ELA5VN3A.js";
|
|
480
|
+
import {
|
|
481
|
+
tagsAggregateCommand,
|
|
482
|
+
tagsInspectSubcommand,
|
|
483
|
+
tagsLsSubcommand
|
|
484
|
+
} from "./chunks/chunk-B3JTF4CF.js";
|
|
479
485
|
import {
|
|
480
486
|
imageAggregateCommand,
|
|
481
487
|
imageInspectSubcommand,
|
|
@@ -490,11 +496,6 @@ import {
|
|
|
490
496
|
permissionsLsSubcommand,
|
|
491
497
|
permissionsRmSubcommand
|
|
492
498
|
} from "./chunks/chunk-J6LK45HT.js";
|
|
493
|
-
import {
|
|
494
|
-
tagsAggregateCommand,
|
|
495
|
-
tagsInspectSubcommand,
|
|
496
|
-
tagsLsSubcommand
|
|
497
|
-
} from "./chunks/chunk-B3JTF4CF.js";
|
|
498
499
|
import {
|
|
499
500
|
metricsCommand,
|
|
500
501
|
schemaSubcommand
|
|
@@ -547,10 +548,12 @@ import {
|
|
|
547
548
|
import "./chunks/chunk-7QVJTI5H.js";
|
|
548
549
|
import "./chunks/chunk-O5GNPPTU.js";
|
|
549
550
|
import {
|
|
551
|
+
dump,
|
|
552
|
+
load,
|
|
550
553
|
main
|
|
551
|
-
} from "./chunks/chunk-
|
|
554
|
+
} from "./chunks/chunk-WWPV6Z24.js";
|
|
552
555
|
import "./chunks/chunk-IB5L4LKZ.js";
|
|
553
|
-
import "./chunks/chunk-
|
|
556
|
+
import "./chunks/chunk-766B6IIX.js";
|
|
554
557
|
import {
|
|
555
558
|
require_execa
|
|
556
559
|
} from "./chunks/chunk-R6IGDGX3.js";
|
|
@@ -565,10 +568,10 @@ import {
|
|
|
565
568
|
} from "./chunks/chunk-VXYGCOKL.js";
|
|
566
569
|
import {
|
|
567
570
|
ensureLink
|
|
568
|
-
} from "./chunks/chunk-
|
|
569
|
-
import "./chunks/chunk-
|
|
570
|
-
import "./chunks/chunk-
|
|
571
|
-
import "./chunks/chunk-
|
|
571
|
+
} from "./chunks/chunk-N22RS64U.js";
|
|
572
|
+
import "./chunks/chunk-PNSWZSLC.js";
|
|
573
|
+
import "./chunks/chunk-7AB6QOKM.js";
|
|
574
|
+
import "./chunks/chunk-FBG4AMAX.js";
|
|
572
575
|
import {
|
|
573
576
|
help
|
|
574
577
|
} from "./chunks/chunk-ZX2FSPWV.js";
|
|
@@ -631,7 +634,7 @@ import {
|
|
|
631
634
|
selectOrg,
|
|
632
635
|
toHost,
|
|
633
636
|
ua_default
|
|
634
|
-
} from "./chunks/chunk-
|
|
637
|
+
} from "./chunks/chunk-BX4IGDGM.js";
|
|
635
638
|
import {
|
|
636
639
|
TelemetryClient
|
|
637
640
|
} from "./chunks/chunk-ECCWJHC6.js";
|
|
@@ -752,7 +755,7 @@ var require_tar_fs = __commonJS({
|
|
|
752
755
|
var tar2 = require_tar_stream();
|
|
753
756
|
var pump = require_pump();
|
|
754
757
|
var mkdirp = require_mkdirp();
|
|
755
|
-
var
|
|
758
|
+
var fs4 = __require("fs");
|
|
756
759
|
var path3 = __require("path");
|
|
757
760
|
var os = __require("os");
|
|
758
761
|
var win32 = os.platform() === "win32";
|
|
@@ -764,19 +767,19 @@ var require_tar_fs = __commonJS({
|
|
|
764
767
|
var normalize = !win32 ? echo : function(name) {
|
|
765
768
|
return name.replace(/\\/g, "/").replace(/[:?<>|]/g, "_");
|
|
766
769
|
};
|
|
767
|
-
var statAll = function(
|
|
770
|
+
var statAll = function(fs5, stat4, cwd, ignore, entries, sort) {
|
|
768
771
|
var queue = entries || ["."];
|
|
769
772
|
return function loop(callback) {
|
|
770
773
|
if (!queue.length)
|
|
771
774
|
return callback();
|
|
772
775
|
var next = queue.shift();
|
|
773
776
|
var nextAbs = path3.join(cwd, next);
|
|
774
|
-
|
|
777
|
+
stat4(nextAbs, function(err, stat5) {
|
|
775
778
|
if (err)
|
|
776
779
|
return callback(err);
|
|
777
|
-
if (!
|
|
778
|
-
return callback(null, next,
|
|
779
|
-
|
|
780
|
+
if (!stat5.isDirectory())
|
|
781
|
+
return callback(null, next, stat5);
|
|
782
|
+
fs5.readdir(nextAbs, function(err2, files) {
|
|
780
783
|
if (err2)
|
|
781
784
|
return callback(err2);
|
|
782
785
|
if (sort)
|
|
@@ -785,7 +788,7 @@ var require_tar_fs = __commonJS({
|
|
|
785
788
|
if (!ignore(path3.join(cwd, next, files[i])))
|
|
786
789
|
queue.push(path3.join(next, files[i]));
|
|
787
790
|
}
|
|
788
|
-
callback(null, next,
|
|
791
|
+
callback(null, next, stat5);
|
|
789
792
|
});
|
|
790
793
|
});
|
|
791
794
|
};
|
|
@@ -805,7 +808,7 @@ var require_tar_fs = __commonJS({
|
|
|
805
808
|
cwd = ".";
|
|
806
809
|
if (!opts)
|
|
807
810
|
opts = {};
|
|
808
|
-
var xfs = opts.fs ||
|
|
811
|
+
var xfs = opts.fs || fs4;
|
|
809
812
|
var ignore = opts.ignore || opts.filter || noop;
|
|
810
813
|
var map = opts.map || noop;
|
|
811
814
|
var mapStream = opts.mapStream || echo;
|
|
@@ -834,7 +837,7 @@ var require_tar_fs = __commonJS({
|
|
|
834
837
|
pack.entry(header, onnextentry);
|
|
835
838
|
});
|
|
836
839
|
};
|
|
837
|
-
var onstat = function(err, filename,
|
|
840
|
+
var onstat = function(err, filename, stat4) {
|
|
838
841
|
if (err)
|
|
839
842
|
return pack.destroy(err);
|
|
840
843
|
if (!filename) {
|
|
@@ -842,31 +845,31 @@ var require_tar_fs = __commonJS({
|
|
|
842
845
|
pack.finalize();
|
|
843
846
|
return finish(pack);
|
|
844
847
|
}
|
|
845
|
-
if (
|
|
848
|
+
if (stat4.isSocket())
|
|
846
849
|
return onnextentry();
|
|
847
850
|
var header = {
|
|
848
851
|
name: normalize(filename),
|
|
849
|
-
mode: (
|
|
850
|
-
mtime:
|
|
851
|
-
size:
|
|
852
|
+
mode: (stat4.mode | (stat4.isDirectory() ? dmode : fmode)) & umask,
|
|
853
|
+
mtime: stat4.mtime,
|
|
854
|
+
size: stat4.size,
|
|
852
855
|
type: "file",
|
|
853
|
-
uid:
|
|
854
|
-
gid:
|
|
856
|
+
uid: stat4.uid,
|
|
857
|
+
gid: stat4.gid
|
|
855
858
|
};
|
|
856
|
-
if (
|
|
859
|
+
if (stat4.isDirectory()) {
|
|
857
860
|
header.size = 0;
|
|
858
861
|
header.type = "directory";
|
|
859
862
|
header = map(header) || header;
|
|
860
863
|
return pack.entry(header, onnextentry);
|
|
861
864
|
}
|
|
862
|
-
if (
|
|
865
|
+
if (stat4.isSymbolicLink()) {
|
|
863
866
|
header.size = 0;
|
|
864
867
|
header.type = "symlink";
|
|
865
868
|
header = map(header) || header;
|
|
866
869
|
return onsymlink(filename, header);
|
|
867
870
|
}
|
|
868
871
|
header = map(header) || header;
|
|
869
|
-
if (!
|
|
872
|
+
if (!stat4.isFile()) {
|
|
870
873
|
if (strict)
|
|
871
874
|
return pack.destroy(new Error("unsupported type for " + filename));
|
|
872
875
|
return onnextentry();
|
|
@@ -902,7 +905,7 @@ var require_tar_fs = __commonJS({
|
|
|
902
905
|
cwd = ".";
|
|
903
906
|
if (!opts)
|
|
904
907
|
opts = {};
|
|
905
|
-
var xfs = opts.fs ||
|
|
908
|
+
var xfs = opts.fs || fs4;
|
|
906
909
|
var ignore = opts.ignore || opts.filter || noop;
|
|
907
910
|
var map = opts.map || noop;
|
|
908
911
|
var mapStream = opts.mapStream || echo;
|
|
@@ -946,13 +949,13 @@ var require_tar_fs = __commonJS({
|
|
|
946
949
|
});
|
|
947
950
|
};
|
|
948
951
|
var chperm = function(name, header, cb) {
|
|
949
|
-
var
|
|
950
|
-
var
|
|
951
|
-
var chown =
|
|
952
|
-
if (!
|
|
952
|
+
var link2 = header.type === "symlink";
|
|
953
|
+
var chmod3 = link2 ? xfs.lchmod : xfs.chmod;
|
|
954
|
+
var chown = link2 ? xfs.lchown : xfs.chown;
|
|
955
|
+
if (!chmod3)
|
|
953
956
|
return cb();
|
|
954
957
|
var mode = (header.mode | (header.type === "directory" ? dmode : fmode)) & umask;
|
|
955
|
-
|
|
958
|
+
chmod3(name, mode, function(err) {
|
|
956
959
|
if (err)
|
|
957
960
|
return cb(err);
|
|
958
961
|
if (!own)
|
|
@@ -970,7 +973,7 @@ var require_tar_fs = __commonJS({
|
|
|
970
973
|
stream.resume();
|
|
971
974
|
return next();
|
|
972
975
|
}
|
|
973
|
-
var
|
|
976
|
+
var stat4 = function(err) {
|
|
974
977
|
if (err)
|
|
975
978
|
return next(err);
|
|
976
979
|
utimes(name, header, function(err2) {
|
|
@@ -988,7 +991,7 @@ var require_tar_fs = __commonJS({
|
|
|
988
991
|
var dst = path3.resolve(path3.dirname(name), header.linkname);
|
|
989
992
|
if (!dst.startsWith(path3.resolve(cwd)))
|
|
990
993
|
return next(new Error(name + " is not a valid symlink"));
|
|
991
|
-
xfs.symlink(header.linkname, name,
|
|
994
|
+
xfs.symlink(header.linkname, name, stat4);
|
|
992
995
|
});
|
|
993
996
|
};
|
|
994
997
|
var onlink = function() {
|
|
@@ -1004,7 +1007,7 @@ var require_tar_fs = __commonJS({
|
|
|
1004
1007
|
stream = xfs.createReadStream(srcpath);
|
|
1005
1008
|
return onfile();
|
|
1006
1009
|
}
|
|
1007
|
-
|
|
1010
|
+
stat4(err2);
|
|
1008
1011
|
});
|
|
1009
1012
|
});
|
|
1010
1013
|
});
|
|
@@ -1018,7 +1021,7 @@ var require_tar_fs = __commonJS({
|
|
|
1018
1021
|
pump(rs, ws, function(err) {
|
|
1019
1022
|
if (err)
|
|
1020
1023
|
return next(err);
|
|
1021
|
-
ws.on("close",
|
|
1024
|
+
ws.on("close", stat4);
|
|
1022
1025
|
});
|
|
1023
1026
|
};
|
|
1024
1027
|
if (header.type === "directory") {
|
|
@@ -1028,7 +1031,7 @@ var require_tar_fs = __commonJS({
|
|
|
1028
1031
|
own,
|
|
1029
1032
|
uid: header.uid,
|
|
1030
1033
|
gid: header.gid
|
|
1031
|
-
},
|
|
1034
|
+
}, stat4);
|
|
1032
1035
|
}
|
|
1033
1036
|
var dir = path3.dirname(name);
|
|
1034
1037
|
validate(xfs, dir, path3.join(cwd, "."), function(err, valid) {
|
|
@@ -1063,14 +1066,14 @@ var require_tar_fs = __commonJS({
|
|
|
1063
1066
|
extract.on("finish", opts.finish);
|
|
1064
1067
|
return extract;
|
|
1065
1068
|
};
|
|
1066
|
-
function validate(
|
|
1069
|
+
function validate(fs5, name, root, cb) {
|
|
1067
1070
|
if (name === root)
|
|
1068
1071
|
return cb(null, true);
|
|
1069
|
-
|
|
1072
|
+
fs5.lstat(name, function(err, st) {
|
|
1070
1073
|
if (err && err.code !== "ENOENT")
|
|
1071
1074
|
return cb(err);
|
|
1072
1075
|
if (err || st.isDirectory())
|
|
1073
|
-
return validate(
|
|
1076
|
+
return validate(fs5, path3.join(name, ".."), root, cb);
|
|
1074
1077
|
cb(null, false);
|
|
1075
1078
|
});
|
|
1076
1079
|
}
|
|
@@ -2475,7 +2478,7 @@ async function activity(client) {
|
|
|
2475
2478
|
return 0;
|
|
2476
2479
|
}
|
|
2477
2480
|
telemetry2.trackCliSubcommandLs(subcommandOriginal);
|
|
2478
|
-
const listFn = (await import("./chunks/list-
|
|
2481
|
+
const listFn = (await import("./chunks/list-YQ4LADLW.js")).default;
|
|
2479
2482
|
return listFn(client, telemetry2);
|
|
2480
2483
|
}
|
|
2481
2484
|
}
|
|
@@ -4838,14 +4841,14 @@ async function rules(client) {
|
|
|
4838
4841
|
// src/commands/ai-gateway/coding-agents-setup.ts
|
|
4839
4842
|
var import_chalk22 = __toESM(require_source(), 1);
|
|
4840
4843
|
import { homedir } from "os";
|
|
4841
|
-
import { existsSync as
|
|
4842
|
-
import { dirname as
|
|
4844
|
+
import { existsSync as existsSync2 } from "fs";
|
|
4845
|
+
import { dirname as dirname4, resolve } from "path";
|
|
4843
4846
|
|
|
4844
4847
|
// src/util/ai-gateway/coding-agents/resolve.ts
|
|
4845
4848
|
var import_chalk17 = __toESM(require_source(), 1);
|
|
4846
4849
|
|
|
4847
4850
|
// src/util/ai-gateway/coding-agents/agents/claude-code.ts
|
|
4848
|
-
import { join as
|
|
4851
|
+
import { join as join3 } from "path";
|
|
4849
4852
|
|
|
4850
4853
|
// src/util/ai-gateway/coding-agents/config-files.ts
|
|
4851
4854
|
init_main();
|
|
@@ -4855,7 +4858,9 @@ import {
|
|
|
4855
4858
|
mkdir,
|
|
4856
4859
|
copyFile,
|
|
4857
4860
|
access,
|
|
4858
|
-
lstat
|
|
4861
|
+
lstat,
|
|
4862
|
+
link,
|
|
4863
|
+
unlink
|
|
4859
4864
|
} from "fs/promises";
|
|
4860
4865
|
import { isDeepStrictEqual } from "util";
|
|
4861
4866
|
import { dirname } from "path";
|
|
@@ -5136,6 +5141,20 @@ ${MANAGED_BLOCK_END}`;
|
|
|
5136
5141
|
return `${existing}${prefix}${block2}
|
|
5137
5142
|
`;
|
|
5138
5143
|
}
|
|
5144
|
+
async function publishNoClobber(temporary, destination) {
|
|
5145
|
+
try {
|
|
5146
|
+
await link(temporary, destination);
|
|
5147
|
+
return true;
|
|
5148
|
+
} catch (error) {
|
|
5149
|
+
if (error.code === "EEXIST") {
|
|
5150
|
+
return false;
|
|
5151
|
+
}
|
|
5152
|
+
throw error;
|
|
5153
|
+
} finally {
|
|
5154
|
+
await unlink(temporary).catch(() => {
|
|
5155
|
+
});
|
|
5156
|
+
}
|
|
5157
|
+
}
|
|
5139
5158
|
async function backupFile(path3) {
|
|
5140
5159
|
const backupPath = `${path3}.bak`;
|
|
5141
5160
|
await copyFile(path3, backupPath);
|
|
@@ -5147,9 +5166,11 @@ async function writeConfigFile(path3, content, mode) {
|
|
|
5147
5166
|
}
|
|
5148
5167
|
|
|
5149
5168
|
// src/util/ai-gateway/coding-agents/gateway.ts
|
|
5169
|
+
var GATEWAY_OPENAI_BASE_URL = "https://ai-gateway.vercel.sh/v1";
|
|
5150
5170
|
var GATEWAY_CODEX_BASE_URL = "https://ai-gateway.vercel.sh/codex/v1";
|
|
5151
5171
|
var GATEWAY_CLAUDE_CODE_BASE_URL = "https://ai-gateway.vercel.sh/claude-code";
|
|
5152
5172
|
var GATEWAY_API_KEY_ENV = "AI_GATEWAY_API_KEY";
|
|
5173
|
+
var GATEWAY_DEFAULT_MODEL = "anthropic/claude-fable-5";
|
|
5153
5174
|
var KEY_PLACEHOLDER = "__AI_GATEWAY_API_KEY__";
|
|
5154
5175
|
function resolveGatewayBaseUrl(override2, agentDefault) {
|
|
5155
5176
|
const trimmed = override2?.trim();
|
|
@@ -5165,19 +5186,181 @@ function maskSecret(secret) {
|
|
|
5165
5186
|
return `${secret.slice(0, 4)}\u2022\u2022\u2022\u2022${secret.slice(-4)}`;
|
|
5166
5187
|
}
|
|
5167
5188
|
|
|
5189
|
+
// src/util/ai-gateway/coding-agents/migrations/claude-desktop-sessions.ts
|
|
5190
|
+
import { randomUUID } from "crypto";
|
|
5191
|
+
import * as fs from "fs/promises";
|
|
5192
|
+
import { dirname as dirname2, join as join2 } from "path";
|
|
5193
|
+
var MAX_RECORD_BYTES = 1024 * 1024;
|
|
5194
|
+
function codeSpan(value) {
|
|
5195
|
+
return `\`${value.replace(/[`\r\n]/g, "")}\``;
|
|
5196
|
+
}
|
|
5197
|
+
var RECORD_PATTERN = /\.json$/;
|
|
5198
|
+
function claudeAppSupportRoot(home) {
|
|
5199
|
+
if (process.platform === "darwin") {
|
|
5200
|
+
return join2(home, "Library", "Application Support");
|
|
5201
|
+
}
|
|
5202
|
+
if (process.platform === "win32") {
|
|
5203
|
+
return process.env.APPDATA || join2(home, "AppData", "Roaming");
|
|
5204
|
+
}
|
|
5205
|
+
return join2(home, ".config");
|
|
5206
|
+
}
|
|
5207
|
+
function toGatewayModelId(model) {
|
|
5208
|
+
return model.includes("/") ? model : `anthropic/${model}`;
|
|
5209
|
+
}
|
|
5210
|
+
async function listSubdirectories(path3) {
|
|
5211
|
+
try {
|
|
5212
|
+
const entries = await fs.readdir(path3, { withFileTypes: true });
|
|
5213
|
+
return entries.filter((e2) => e2.isDirectory()).map((e2) => e2.name);
|
|
5214
|
+
} catch {
|
|
5215
|
+
return [];
|
|
5216
|
+
}
|
|
5217
|
+
}
|
|
5218
|
+
async function findDestinationIdentity(root) {
|
|
5219
|
+
let best = null;
|
|
5220
|
+
for (const account of await listSubdirectories(root)) {
|
|
5221
|
+
for (const org of await listSubdirectories(join2(root, account))) {
|
|
5222
|
+
const path3 = join2(root, account, org);
|
|
5223
|
+
try {
|
|
5224
|
+
const stat4 = await fs.stat(path3);
|
|
5225
|
+
if (!best || stat4.mtimeMs > best.mtime) {
|
|
5226
|
+
best = { path: path3, mtime: stat4.mtimeMs };
|
|
5227
|
+
}
|
|
5228
|
+
} catch {
|
|
5229
|
+
}
|
|
5230
|
+
}
|
|
5231
|
+
}
|
|
5232
|
+
return best?.path ?? null;
|
|
5233
|
+
}
|
|
5234
|
+
async function readRecord2(path3) {
|
|
5235
|
+
let stat4;
|
|
5236
|
+
try {
|
|
5237
|
+
stat4 = await fs.stat(path3);
|
|
5238
|
+
} catch {
|
|
5239
|
+
return null;
|
|
5240
|
+
}
|
|
5241
|
+
if (!stat4.isFile() || stat4.size > MAX_RECORD_BYTES)
|
|
5242
|
+
return null;
|
|
5243
|
+
try {
|
|
5244
|
+
const raw = await fs.readFile(path3, "utf8");
|
|
5245
|
+
const record = JSON.parse(raw);
|
|
5246
|
+
if (typeof record !== "object" || record === null || Array.isArray(record)) {
|
|
5247
|
+
return null;
|
|
5248
|
+
}
|
|
5249
|
+
return { record, bytes: stat4.size };
|
|
5250
|
+
} catch {
|
|
5251
|
+
return null;
|
|
5252
|
+
}
|
|
5253
|
+
}
|
|
5254
|
+
async function writeRecordNoClobber(destination, contents) {
|
|
5255
|
+
if (await pathExists(destination))
|
|
5256
|
+
return "skipped";
|
|
5257
|
+
await fs.mkdir(dirname2(destination), { recursive: true });
|
|
5258
|
+
const temp = join2(dirname2(destination), `.migrate-${randomUUID()}.tmp`);
|
|
5259
|
+
await fs.writeFile(temp, contents, { mode: 384 });
|
|
5260
|
+
return await publishNoClobber(temp, destination) ? "copied" : "skipped";
|
|
5261
|
+
}
|
|
5262
|
+
async function planClaudeDesktopSessionMigration(home, appSupportRoot = claudeAppSupportRoot(home)) {
|
|
5263
|
+
const subscriptionRoot = join2(
|
|
5264
|
+
appSupportRoot,
|
|
5265
|
+
"Claude",
|
|
5266
|
+
"claude-code-sessions"
|
|
5267
|
+
);
|
|
5268
|
+
const gatewayRoot = join2(appSupportRoot, "Claude-3p", "claude-code-sessions");
|
|
5269
|
+
const destinationDir = await findDestinationIdentity(gatewayRoot);
|
|
5270
|
+
if (!destinationDir)
|
|
5271
|
+
return null;
|
|
5272
|
+
const copies = [];
|
|
5273
|
+
let totalBytes = 0;
|
|
5274
|
+
for (const account of await listSubdirectories(subscriptionRoot)) {
|
|
5275
|
+
for (const org of await listSubdirectories(
|
|
5276
|
+
join2(subscriptionRoot, account)
|
|
5277
|
+
)) {
|
|
5278
|
+
const identityDir = join2(subscriptionRoot, account, org);
|
|
5279
|
+
let names;
|
|
5280
|
+
try {
|
|
5281
|
+
names = await fs.readdir(identityDir);
|
|
5282
|
+
} catch {
|
|
5283
|
+
continue;
|
|
5284
|
+
}
|
|
5285
|
+
for (const name of names) {
|
|
5286
|
+
if (!RECORD_PATTERN.test(name))
|
|
5287
|
+
continue;
|
|
5288
|
+
const source = join2(identityDir, name);
|
|
5289
|
+
const destination = join2(destinationDir, name);
|
|
5290
|
+
if (await pathExists(destination))
|
|
5291
|
+
continue;
|
|
5292
|
+
const read = await readRecord2(source);
|
|
5293
|
+
if (!read)
|
|
5294
|
+
continue;
|
|
5295
|
+
copies.push({ source, destination, bytes: read.bytes });
|
|
5296
|
+
totalBytes += read.bytes;
|
|
5297
|
+
}
|
|
5298
|
+
}
|
|
5299
|
+
}
|
|
5300
|
+
if (copies.length === 0)
|
|
5301
|
+
return null;
|
|
5302
|
+
return {
|
|
5303
|
+
label: "Claude Desktop sessions",
|
|
5304
|
+
itemCount: copies.length,
|
|
5305
|
+
totalBytes,
|
|
5306
|
+
sourceRoots: [subscriptionRoot],
|
|
5307
|
+
destinationRoots: [destinationDir],
|
|
5308
|
+
prompt: [
|
|
5309
|
+
`Copy the ${copies.length} Claude Desktop session record${copies.length === 1 ? "" : "s"} (per-session \`.json\` files) under ${codeSpan(subscriptionRoot)} into ${codeSpan(destinationDir)}, keeping each filename.`,
|
|
5310
|
+
"In each copy, rewrite the top-level `model` field to its AI Gateway id by prefixing `anthropic/` when the value has no provider prefix (e.g. `claude-opus-4-8` \u2192 `anthropic/claude-opus-4-8`); keep any suffix such as `[1m]` intact. Leave every other field unchanged.",
|
|
5311
|
+
"Use atomic, no-clobber writes with mode 0600; skip records whose destination already exists. Never move, edit, delete, or overwrite an original record."
|
|
5312
|
+
],
|
|
5313
|
+
async apply() {
|
|
5314
|
+
let copied = 0;
|
|
5315
|
+
let skipped = 0;
|
|
5316
|
+
const errors = [];
|
|
5317
|
+
for (const copy3 of copies) {
|
|
5318
|
+
try {
|
|
5319
|
+
const read = await readRecord2(copy3.source);
|
|
5320
|
+
if (!read) {
|
|
5321
|
+
skipped += 1;
|
|
5322
|
+
continue;
|
|
5323
|
+
}
|
|
5324
|
+
const record = { ...read.record };
|
|
5325
|
+
if (typeof record.model === "string") {
|
|
5326
|
+
record.model = toGatewayModelId(record.model);
|
|
5327
|
+
}
|
|
5328
|
+
const outcome = await writeRecordNoClobber(
|
|
5329
|
+
copy3.destination,
|
|
5330
|
+
`${JSON.stringify(record)}
|
|
5331
|
+
`
|
|
5332
|
+
);
|
|
5333
|
+
if (outcome === "copied")
|
|
5334
|
+
copied += 1;
|
|
5335
|
+
else
|
|
5336
|
+
skipped += 1;
|
|
5337
|
+
} catch (error) {
|
|
5338
|
+
errors.push(
|
|
5339
|
+
`${copy3.source}: ${error instanceof Error ? error.message : String(error)}`
|
|
5340
|
+
);
|
|
5341
|
+
}
|
|
5342
|
+
}
|
|
5343
|
+
return errors.length > 0 ? { copied, skipped, errors } : { copied, skipped };
|
|
5344
|
+
}
|
|
5345
|
+
};
|
|
5346
|
+
}
|
|
5347
|
+
|
|
5168
5348
|
// src/util/ai-gateway/coding-agents/agents/claude-code.ts
|
|
5169
5349
|
function claudeDir(home) {
|
|
5170
5350
|
const dir = process.env.CLAUDE_CONFIG_DIR;
|
|
5171
|
-
return dir && dir.trim() ? dir :
|
|
5351
|
+
return dir && dir.trim() ? dir : join3(home, ".claude");
|
|
5172
5352
|
}
|
|
5173
5353
|
var claudeCode = {
|
|
5174
5354
|
id: "claude-code",
|
|
5175
5355
|
displayName: "Claude Code",
|
|
5356
|
+
sessionMigration: {
|
|
5357
|
+
plan: ({ home }) => planClaudeDesktopSessionMigration(home)
|
|
5358
|
+
},
|
|
5176
5359
|
async detect(home) {
|
|
5177
5360
|
return pathExists(claudeDir(home));
|
|
5178
5361
|
},
|
|
5179
5362
|
configPath(ctx) {
|
|
5180
|
-
return ctx.overrides?.["claude-code"] ??
|
|
5363
|
+
return ctx.overrides?.["claude-code"] ?? join3(claudeDir(ctx.home), "settings.json");
|
|
5181
5364
|
},
|
|
5182
5365
|
buildPlan(ctx) {
|
|
5183
5366
|
const path3 = this.configPath(ctx);
|
|
@@ -5205,58 +5388,312 @@ var claudeCode = {
|
|
|
5205
5388
|
}
|
|
5206
5389
|
],
|
|
5207
5390
|
envExports,
|
|
5208
|
-
notes:
|
|
5209
|
-
|
|
5210
|
-
|
|
5211
|
-
|
|
5391
|
+
notes: [
|
|
5392
|
+
...ctx.useKeychain ? [
|
|
5393
|
+
"The Anthropic auth token is read from your shell environment (Keychain-backed).",
|
|
5394
|
+
"Open a new terminal so ANTHROPIC_AUTH_TOKEN is loaded, then restart Claude Code."
|
|
5395
|
+
] : ["Restart Claude Code to pick up the new settings."],
|
|
5396
|
+
"The Claude Desktop app switches providers in its own settings (Developer \u2192 Configure Third-Party Inference\u2026). After its first gateway launch, re-run this command to copy your existing desktop sessions over."
|
|
5397
|
+
]
|
|
5212
5398
|
};
|
|
5213
5399
|
}
|
|
5214
5400
|
};
|
|
5215
5401
|
|
|
5216
|
-
// src/util/ai-gateway/coding-agents/agents/
|
|
5402
|
+
// src/util/ai-gateway/coding-agents/agents/cline.ts
|
|
5217
5403
|
import { join as join4 } from "path";
|
|
5404
|
+
var cline = {
|
|
5405
|
+
id: "cline",
|
|
5406
|
+
displayName: "Cline",
|
|
5407
|
+
experimental: true,
|
|
5408
|
+
async detect(home) {
|
|
5409
|
+
return pathExists(join4(home, ".cline"));
|
|
5410
|
+
},
|
|
5411
|
+
configPath(ctx) {
|
|
5412
|
+
return ctx.overrides?.["cline"] ?? join4(ctx.home, ".cline", "data", "settings", "providers.json");
|
|
5413
|
+
},
|
|
5414
|
+
buildPlan(ctx) {
|
|
5415
|
+
const path3 = this.configPath(ctx);
|
|
5416
|
+
return {
|
|
5417
|
+
fileChanges: [
|
|
5418
|
+
{
|
|
5419
|
+
path: path3,
|
|
5420
|
+
label: "Cline providers",
|
|
5421
|
+
format: "json",
|
|
5422
|
+
mode: 384,
|
|
5423
|
+
transform: (current) => {
|
|
5424
|
+
const isNew = !current || !current.trim();
|
|
5425
|
+
return mergeJson(current, {
|
|
5426
|
+
...isNew ? { version: 1 } : {},
|
|
5427
|
+
lastUsedProvider: "vercel-ai-gateway",
|
|
5428
|
+
providers: {
|
|
5429
|
+
"vercel-ai-gateway": {
|
|
5430
|
+
settings: {
|
|
5431
|
+
provider: "vercel-ai-gateway",
|
|
5432
|
+
apiKey: ctx.apiKey,
|
|
5433
|
+
model: GATEWAY_DEFAULT_MODEL
|
|
5434
|
+
},
|
|
5435
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5436
|
+
tokenSource: "manual"
|
|
5437
|
+
}
|
|
5438
|
+
}
|
|
5439
|
+
});
|
|
5440
|
+
}
|
|
5441
|
+
}
|
|
5442
|
+
],
|
|
5443
|
+
envExports: [],
|
|
5444
|
+
notes: [
|
|
5445
|
+
`Cline will use its native Vercel AI Gateway provider with ${GATEWAY_DEFAULT_MODEL}; switch models in-session or with \`cline auth -p vercel-ai-gateway -m <gateway-model-id>\`.`,
|
|
5446
|
+
"In the VS Code extension, pick the Vercel AI Gateway provider under Settings \u2192 API Provider."
|
|
5447
|
+
]
|
|
5448
|
+
};
|
|
5449
|
+
}
|
|
5450
|
+
};
|
|
5218
5451
|
|
|
5219
|
-
// src/util/ai-gateway/coding-agents/
|
|
5220
|
-
import {
|
|
5221
|
-
|
|
5222
|
-
|
|
5223
|
-
|
|
5452
|
+
// src/util/ai-gateway/coding-agents/agents/codex.ts
|
|
5453
|
+
import { join as join6 } from "path";
|
|
5454
|
+
|
|
5455
|
+
// src/util/ai-gateway/coding-agents/migrations/codex-sessions.ts
|
|
5456
|
+
import { createHash, randomUUID as randomUUID2 } from "crypto";
|
|
5457
|
+
import { v5 as uuidv5, validate as uuidValidate } from "uuid";
|
|
5458
|
+
import { createReadStream, createWriteStream } from "fs";
|
|
5459
|
+
import * as fs2 from "fs/promises";
|
|
5460
|
+
import { basename, dirname as dirname3, join as join5 } from "path";
|
|
5461
|
+
import { pipeline } from "stream/promises";
|
|
5462
|
+
var ROLLOUT_PATTERN = /^rollout-.*\.jsonl(?:\.zst)?$/;
|
|
5463
|
+
var MAX_METADATA_BYTES = 1024 * 1024;
|
|
5464
|
+
function hasCode(error, code2) {
|
|
5465
|
+
return error.code === code2;
|
|
5466
|
+
}
|
|
5467
|
+
async function readMeta(path3, gateway = false) {
|
|
5468
|
+
const handle = await fs2.open(path3, "r");
|
|
5469
|
+
const buffer = new Uint8Array(MAX_METADATA_BYTES + 1);
|
|
5470
|
+
let length = 0;
|
|
5471
|
+
let newline = -1;
|
|
5472
|
+
try {
|
|
5473
|
+
while (length < buffer.length && newline < 0) {
|
|
5474
|
+
const start = length;
|
|
5475
|
+
const read = await handle.read(
|
|
5476
|
+
buffer,
|
|
5477
|
+
start,
|
|
5478
|
+
buffer.length - start,
|
|
5479
|
+
start
|
|
5480
|
+
);
|
|
5481
|
+
if (read.bytesRead === 0)
|
|
5482
|
+
break;
|
|
5483
|
+
length += read.bytesRead;
|
|
5484
|
+
newline = buffer.indexOf(10, start);
|
|
5485
|
+
}
|
|
5486
|
+
} finally {
|
|
5487
|
+
await handle.close();
|
|
5488
|
+
}
|
|
5489
|
+
if (newline < 0 && length > MAX_METADATA_BYTES)
|
|
5490
|
+
throw new Error(`${basename(path3)} metadata exceeds 1 MiB`);
|
|
5491
|
+
const lineEnd = newline < 0 ? length : newline;
|
|
5492
|
+
const carriageReturn = buffer[lineEnd - 1] === 13;
|
|
5493
|
+
let record;
|
|
5494
|
+
try {
|
|
5495
|
+
record = JSON.parse(
|
|
5496
|
+
new TextDecoder().decode(
|
|
5497
|
+
buffer.subarray(0, carriageReturn ? lineEnd - 1 : lineEnd)
|
|
5498
|
+
)
|
|
5499
|
+
);
|
|
5500
|
+
} catch {
|
|
5501
|
+
return null;
|
|
5502
|
+
}
|
|
5503
|
+
const payload = record.payload;
|
|
5504
|
+
const id = typeof payload?.id === "string" ? payload.id : typeof payload?.session_id === "string" ? payload.session_id : "";
|
|
5505
|
+
if (record.type !== "session_meta" || !payload || !uuidValidate(id) || typeof payload.session_id === "string" && payload.session_id !== id || payload.originator !== "Codex Desktop" && !(payload.originator == null && payload.source === "vscode") || (gateway ? payload.model_provider !== "vercel" : payload.model_provider === "vercel")) {
|
|
5506
|
+
return null;
|
|
5507
|
+
}
|
|
5508
|
+
return {
|
|
5509
|
+
record,
|
|
5510
|
+
payload,
|
|
5511
|
+
id,
|
|
5512
|
+
delimiter: newline < 0 ? "" : carriageReturn ? "\r\n" : "\n",
|
|
5513
|
+
restOffset: newline < 0 ? length : newline + 1
|
|
5514
|
+
};
|
|
5515
|
+
}
|
|
5516
|
+
function codeSpan2(value) {
|
|
5517
|
+
return `\`${value.replace(/[`\r\n]/g, "")}\``;
|
|
5518
|
+
}
|
|
5519
|
+
async function findRollouts(root) {
|
|
5520
|
+
const files = [];
|
|
5521
|
+
async function visit(directory) {
|
|
5522
|
+
let entries;
|
|
5523
|
+
try {
|
|
5524
|
+
entries = await fs2.readdir(directory, { withFileTypes: true });
|
|
5525
|
+
} catch (error) {
|
|
5526
|
+
if (hasCode(error, "ENOENT"))
|
|
5527
|
+
return;
|
|
5528
|
+
throw error;
|
|
5529
|
+
}
|
|
5530
|
+
for (const entry of entries) {
|
|
5531
|
+
const path3 = join5(directory, entry.name);
|
|
5532
|
+
if (entry.isDirectory())
|
|
5533
|
+
await visit(path3);
|
|
5534
|
+
else if (entry.isFile() && ROLLOUT_PATTERN.test(entry.name))
|
|
5535
|
+
files.push(path3);
|
|
5536
|
+
}
|
|
5537
|
+
}
|
|
5538
|
+
await visit(root);
|
|
5539
|
+
return files;
|
|
5540
|
+
}
|
|
5541
|
+
async function planCopy(path3, root) {
|
|
5542
|
+
const metadata = await readMeta(path3);
|
|
5543
|
+
const filename = basename(path3);
|
|
5544
|
+
if (!metadata || !filename.toLowerCase().includes(metadata.id.toLowerCase()))
|
|
5545
|
+
return null;
|
|
5546
|
+
const destinationId = uuidv5(
|
|
5547
|
+
`vercel-ai-gateway/codex/${metadata.id.toLowerCase()}/vercel`,
|
|
5548
|
+
uuidv5.URL
|
|
5549
|
+
);
|
|
5550
|
+
const destination = join5(
|
|
5551
|
+
dirname3(path3),
|
|
5552
|
+
filename.replace(new RegExp(metadata.id, "i"), destinationId)
|
|
5553
|
+
);
|
|
5554
|
+
const item = {
|
|
5555
|
+
source: path3,
|
|
5556
|
+
destination,
|
|
5557
|
+
sourceId: metadata.id,
|
|
5558
|
+
destinationId,
|
|
5559
|
+
bytes: (await fs2.stat(path3)).size,
|
|
5560
|
+
root
|
|
5561
|
+
};
|
|
5562
|
+
try {
|
|
5563
|
+
await fs2.stat(destination);
|
|
5564
|
+
await validateDestination(item);
|
|
5565
|
+
return null;
|
|
5566
|
+
} catch (error) {
|
|
5567
|
+
if (!hasCode(error, "ENOENT"))
|
|
5568
|
+
throw error;
|
|
5569
|
+
}
|
|
5570
|
+
return item;
|
|
5571
|
+
}
|
|
5572
|
+
async function bodyHash(path3, start) {
|
|
5573
|
+
const hash = createHash("sha256");
|
|
5574
|
+
await pipeline(createReadStream(path3, { start }), hash);
|
|
5575
|
+
return hash.digest("hex");
|
|
5576
|
+
}
|
|
5577
|
+
async function validateDestination(item) {
|
|
5578
|
+
const [source, destination] = await Promise.all([
|
|
5579
|
+
readMeta(item.source),
|
|
5580
|
+
readMeta(item.destination, true)
|
|
5581
|
+
]);
|
|
5582
|
+
const bodies = await Promise.all([
|
|
5583
|
+
bodyHash(item.source, source?.restOffset ?? 0),
|
|
5584
|
+
bodyHash(item.destination, destination?.restOffset ?? 0)
|
|
5585
|
+
]);
|
|
5586
|
+
const valid = source && destination?.id === item.destinationId && bodies[0] === bodies[1];
|
|
5587
|
+
if (!valid)
|
|
5588
|
+
throw new Error(
|
|
5589
|
+
`Existing destination ${basename(item.destination)} is invalid`
|
|
5590
|
+
);
|
|
5591
|
+
}
|
|
5592
|
+
async function copySession(item) {
|
|
5593
|
+
const metadata = await readMeta(item.source);
|
|
5594
|
+
if (!metadata)
|
|
5595
|
+
throw new Error("Codex session metadata is no longer valid");
|
|
5596
|
+
if (metadata.id !== item.sourceId)
|
|
5597
|
+
throw new Error("Codex session metadata changed after planning");
|
|
5598
|
+
const updated = {
|
|
5599
|
+
...metadata.record,
|
|
5600
|
+
payload: {
|
|
5601
|
+
...metadata.payload,
|
|
5602
|
+
id: item.destinationId,
|
|
5603
|
+
session_id: item.destinationId,
|
|
5604
|
+
model_provider: "vercel"
|
|
5605
|
+
}
|
|
5606
|
+
};
|
|
5607
|
+
const temporary = `${item.destination}.tmp-${process.pid}-${randomUUID2()}`;
|
|
5608
|
+
try {
|
|
5609
|
+
await fs2.writeFile(
|
|
5610
|
+
temporary,
|
|
5611
|
+
`${JSON.stringify(updated)}${metadata.delimiter}`,
|
|
5612
|
+
{ flag: "wx", mode: 384 }
|
|
5613
|
+
);
|
|
5614
|
+
await pipeline(
|
|
5615
|
+
createReadStream(item.source, { start: metadata.restOffset }),
|
|
5616
|
+
createWriteStream(temporary, { flags: "a", mode: 384 })
|
|
5617
|
+
);
|
|
5618
|
+
await fs2.chmod(temporary, 384);
|
|
5619
|
+
if (await publishNoClobber(temporary, item.destination)) {
|
|
5620
|
+
return true;
|
|
5621
|
+
}
|
|
5622
|
+
await validateDestination(item);
|
|
5224
5623
|
return false;
|
|
5624
|
+
} finally {
|
|
5625
|
+
await fs2.unlink(temporary).catch((error) => {
|
|
5626
|
+
if (!hasCode(error, "ENOENT"))
|
|
5627
|
+
throw error;
|
|
5628
|
+
});
|
|
5629
|
+
}
|
|
5630
|
+
}
|
|
5631
|
+
async function planCodexSessionMigration(home) {
|
|
5632
|
+
const codexHome = process.env.CODEX_HOME || join5(home, ".codex");
|
|
5633
|
+
const roots = ["sessions", "archived_sessions"].map(
|
|
5634
|
+
(root) => join5(codexHome, root)
|
|
5635
|
+
);
|
|
5636
|
+
const files = [];
|
|
5637
|
+
for (const root of roots) {
|
|
5638
|
+
files.push(...(await findRollouts(root)).map((path3) => ({ path: path3, root })));
|
|
5639
|
+
}
|
|
5640
|
+
if (files.some((file) => file.path.endsWith(".jsonl.zst"))) {
|
|
5641
|
+
throw new Error(
|
|
5642
|
+
"Found compressed Codex sessions; decompress them first, or pass --no-session-migration to leave them unchanged"
|
|
5643
|
+
);
|
|
5644
|
+
}
|
|
5645
|
+
const copies = [];
|
|
5646
|
+
for (const file of files) {
|
|
5647
|
+
const copy3 = await planCopy(file.path, file.root);
|
|
5648
|
+
if (copy3)
|
|
5649
|
+
copies.push(copy3);
|
|
5225
5650
|
}
|
|
5226
|
-
|
|
5651
|
+
if (copies.length === 0)
|
|
5652
|
+
return null;
|
|
5653
|
+
const sourceRoots = [...new Set(copies.map((copy3) => copy3.root))];
|
|
5654
|
+
return {
|
|
5655
|
+
label: "Codex Desktop sessions",
|
|
5656
|
+
itemCount: copies.length,
|
|
5657
|
+
totalBytes: copies.reduce((total, copy3) => total + copy3.bytes, 0),
|
|
5658
|
+
sourceRoots,
|
|
5659
|
+
destinationRoots: sourceRoots,
|
|
5660
|
+
prompt: [
|
|
5661
|
+
`Before changing the provider, copy the ${copies.length} top-level Codex Desktop rollout${copies.length === 1 ? "" : "s"} with a non-\`vercel\` provider under ${sourceRoots.map(codeSpan2).join(", ")}. Do not copy subagent rollouts whose \`session_id\` differs from \`id\`.`,
|
|
5662
|
+
"For each copy, derive a deterministic UUID v5 using the URL namespace `6ba7b811-9dad-11d1-80b4-00c04fd430c8` and name `vercel-ai-gateway/codex/<source-id>/vercel`. Replace the filename UUID and `session_meta.payload.id`/`session_id`, set `model_provider` to `vercel`, and preserve every later JSONL byte.",
|
|
5663
|
+
"Use atomic, no-clobber writes with mode 0600; skip an existing deterministic destination only after validating its metadata and body. Never move, edit, delete, or overwrite an original session file."
|
|
5664
|
+
],
|
|
5665
|
+
async apply() {
|
|
5666
|
+
let copied = 0;
|
|
5667
|
+
let skipped = 0;
|
|
5668
|
+
const errors = [];
|
|
5669
|
+
for (const item of copies) {
|
|
5670
|
+
try {
|
|
5671
|
+
await copySession(item) ? copied++ : skipped++;
|
|
5672
|
+
} catch (error) {
|
|
5673
|
+
errors.push(
|
|
5674
|
+
`${basename(item.source)}: ${error instanceof Error ? error.message : String(error)}`
|
|
5675
|
+
);
|
|
5676
|
+
}
|
|
5677
|
+
}
|
|
5678
|
+
return { copied, skipped, errors };
|
|
5679
|
+
}
|
|
5680
|
+
};
|
|
5227
5681
|
}
|
|
5228
5682
|
|
|
5229
5683
|
// src/util/ai-gateway/coding-agents/agents/codex.ts
|
|
5230
|
-
var CODEX_DESKTOP_APP = "Codex.app";
|
|
5231
5684
|
function codexDir(home) {
|
|
5232
5685
|
const dir = process.env.CODEX_HOME;
|
|
5233
|
-
return dir && dir.trim() ? dir :
|
|
5686
|
+
return dir && dir.trim() ? dir : join6(home, ".codex");
|
|
5234
5687
|
}
|
|
5235
5688
|
var codex = {
|
|
5236
5689
|
id: "codex",
|
|
5237
5690
|
displayName: "Codex",
|
|
5691
|
+
sessionMigration: { plan: ({ home }) => planCodexSessionMigration(home) },
|
|
5238
5692
|
async detect(home) {
|
|
5239
5693
|
return pathExists(codexDir(home));
|
|
5240
5694
|
},
|
|
5241
|
-
async warnings({ home, overrides }) {
|
|
5242
|
-
const warnings = [];
|
|
5243
|
-
if (isMacAppInstalled(CODEX_DESKTOP_APP, home)) {
|
|
5244
|
-
const configPath = this.configPath({ apiKey: "", home, overrides });
|
|
5245
|
-
warnings.push({
|
|
5246
|
-
code: "desktop_app_breaks",
|
|
5247
|
-
impact: "The Codex desktop app will stop working.",
|
|
5248
|
-
why: [
|
|
5249
|
-
'The desktop app is installed and cannot use custom model providers, and connecting sets model_provider = "vercel" in the config.toml the app shares with the CLI.',
|
|
5250
|
-
"The Codex CLI keeps working."
|
|
5251
|
-
],
|
|
5252
|
-
undo: `remove the model_provider line from ${configPath}`,
|
|
5253
|
-
confirm: "Configure Codex anyway?"
|
|
5254
|
-
});
|
|
5255
|
-
}
|
|
5256
|
-
return warnings;
|
|
5257
|
-
},
|
|
5258
5695
|
configPath(ctx) {
|
|
5259
|
-
return ctx.overrides?.["codex"] ??
|
|
5696
|
+
return ctx.overrides?.["codex"] ?? join6(codexDir(ctx.home), "config.toml");
|
|
5260
5697
|
},
|
|
5261
5698
|
buildPlan(ctx) {
|
|
5262
5699
|
const path3 = this.configPath(ctx);
|
|
@@ -5291,12 +5728,204 @@ var codex = {
|
|
|
5291
5728
|
}
|
|
5292
5729
|
};
|
|
5293
5730
|
|
|
5731
|
+
// src/util/ai-gateway/coding-agents/agents/cursor.ts
|
|
5732
|
+
import { join as join7 } from "path";
|
|
5733
|
+
var CURSOR_BASE_URL = "https://ai-gateway.vercel.sh/v1/cursor";
|
|
5734
|
+
var cursor = {
|
|
5735
|
+
id: "cursor",
|
|
5736
|
+
displayName: "Cursor",
|
|
5737
|
+
experimental: true,
|
|
5738
|
+
async detect(home) {
|
|
5739
|
+
return pathExists(join7(home, ".cursor"));
|
|
5740
|
+
},
|
|
5741
|
+
configPath(ctx) {
|
|
5742
|
+
return ctx.overrides?.["cursor"] ?? join7(ctx.home, ".cursor");
|
|
5743
|
+
},
|
|
5744
|
+
buildPlan(ctx) {
|
|
5745
|
+
return {
|
|
5746
|
+
fileChanges: [],
|
|
5747
|
+
envExports: [{ name: "AI_GATEWAY_API_KEY", value: ctx.apiKey }],
|
|
5748
|
+
notes: [
|
|
5749
|
+
"Cursor keeps its API-key settings in the app itself, so finish the setup there:",
|
|
5750
|
+
"1. Open Cursor \u2192 Settings (Cmd+Shift+J) \u2192 Models.",
|
|
5751
|
+
`2. Under OpenAI API Key: paste your gateway key, then enable "Override OpenAI Base URL" and set it to ${ctx.baseUrlOverride ?? CURSOR_BASE_URL}`,
|
|
5752
|
+
'3. Copy the key from a new terminal without echoing it: printf %s "$AI_GATEWAY_API_KEY" | pbcopy',
|
|
5753
|
+
'4. Use "Add model" to add gateway model ids you want in the picker (e.g. anthropic/claude-fable-5, openai/gpt-5.6-sol).',
|
|
5754
|
+
"While the override is on, Cursor's built-in non-OpenAI models stop working \u2014 use gateway model ids for everything, or toggle the override off to go back.",
|
|
5755
|
+
"Cursor chats are stored by its backend, so there are no local sessions to migrate.",
|
|
5756
|
+
"Cursor limitations: Tab completions never use custom keys, and Agent/Auto modes may bypass the override."
|
|
5757
|
+
]
|
|
5758
|
+
};
|
|
5759
|
+
}
|
|
5760
|
+
};
|
|
5761
|
+
|
|
5762
|
+
// src/util/ai-gateway/coding-agents/agents/hermes.ts
|
|
5763
|
+
import { join as join8 } from "path";
|
|
5764
|
+
var PROVIDER_KEY = "vercel-ai-gateway";
|
|
5765
|
+
function asObject(value) {
|
|
5766
|
+
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
5767
|
+
}
|
|
5768
|
+
var hermes = {
|
|
5769
|
+
id: "hermes",
|
|
5770
|
+
displayName: "Hermes",
|
|
5771
|
+
experimental: true,
|
|
5772
|
+
async detect(home) {
|
|
5773
|
+
return pathExists(join8(home, ".hermes"));
|
|
5774
|
+
},
|
|
5775
|
+
configPath(ctx) {
|
|
5776
|
+
return ctx.overrides?.["hermes"] ?? join8(ctx.home, ".hermes", "config.yaml");
|
|
5777
|
+
},
|
|
5778
|
+
buildPlan(ctx) {
|
|
5779
|
+
const path3 = this.configPath(ctx);
|
|
5780
|
+
const api2 = ctx.baseUrlOverride ?? GATEWAY_OPENAI_BASE_URL;
|
|
5781
|
+
return {
|
|
5782
|
+
fileChanges: [
|
|
5783
|
+
{
|
|
5784
|
+
path: path3,
|
|
5785
|
+
label: "Hermes config",
|
|
5786
|
+
format: "yaml",
|
|
5787
|
+
transform: (current) => {
|
|
5788
|
+
const config = asObject(load(current ?? "") ?? {});
|
|
5789
|
+
const providers2 = asObject(config.providers);
|
|
5790
|
+
providers2[PROVIDER_KEY] = {
|
|
5791
|
+
...asObject(providers2[PROVIDER_KEY]),
|
|
5792
|
+
api: api2,
|
|
5793
|
+
key_env: "AI_GATEWAY_API_KEY",
|
|
5794
|
+
transport: "chat_completions",
|
|
5795
|
+
discover_models: true
|
|
5796
|
+
};
|
|
5797
|
+
config.providers = providers2;
|
|
5798
|
+
config.model = {
|
|
5799
|
+
...asObject(config.model),
|
|
5800
|
+
provider: `custom:${PROVIDER_KEY}`,
|
|
5801
|
+
default: GATEWAY_DEFAULT_MODEL
|
|
5802
|
+
};
|
|
5803
|
+
return dump(config, { lineWidth: 120 });
|
|
5804
|
+
}
|
|
5805
|
+
}
|
|
5806
|
+
],
|
|
5807
|
+
envExports: [{ name: "AI_GATEWAY_API_KEY", value: ctx.apiKey }],
|
|
5808
|
+
notes: [
|
|
5809
|
+
`Hermes will use the gateway with ${GATEWAY_DEFAULT_MODEL}; switch models in-session with /model custom:${PROVIDER_KEY}:<gateway-model-id>.`,
|
|
5810
|
+
"Open a new terminal first so AI_GATEWAY_API_KEY is loaded."
|
|
5811
|
+
]
|
|
5812
|
+
};
|
|
5813
|
+
}
|
|
5814
|
+
};
|
|
5815
|
+
|
|
5816
|
+
// src/util/ai-gateway/coding-agents/agents/kilo.ts
|
|
5817
|
+
import { join as join9 } from "path";
|
|
5818
|
+
function kiloConfigDir(home) {
|
|
5819
|
+
const xdg = process.env.XDG_CONFIG_HOME;
|
|
5820
|
+
const base = xdg && xdg.startsWith("/") ? xdg : join9(home, ".config");
|
|
5821
|
+
return join9(base, "kilo");
|
|
5822
|
+
}
|
|
5823
|
+
var kilo = {
|
|
5824
|
+
id: "kilo",
|
|
5825
|
+
displayName: "Kilo Code",
|
|
5826
|
+
experimental: true,
|
|
5827
|
+
async detect(home) {
|
|
5828
|
+
return pathExists(kiloConfigDir(home));
|
|
5829
|
+
},
|
|
5830
|
+
configPath(ctx) {
|
|
5831
|
+
return ctx.overrides?.["kilo"] ?? join9(kiloConfigDir(ctx.home), "kilo.json");
|
|
5832
|
+
},
|
|
5833
|
+
buildPlan(ctx) {
|
|
5834
|
+
const path3 = this.configPath(ctx);
|
|
5835
|
+
const baseURL = ctx.baseUrlOverride ?? GATEWAY_OPENAI_BASE_URL;
|
|
5836
|
+
return {
|
|
5837
|
+
fileChanges: [
|
|
5838
|
+
{
|
|
5839
|
+
path: path3,
|
|
5840
|
+
label: "Kilo Code config",
|
|
5841
|
+
format: "json",
|
|
5842
|
+
transform: (current) => mergeJson(current, {
|
|
5843
|
+
provider: {
|
|
5844
|
+
"openai-compatible": {
|
|
5845
|
+
options: {
|
|
5846
|
+
apiKey: "{env:AI_GATEWAY_API_KEY}",
|
|
5847
|
+
baseURL
|
|
5848
|
+
}
|
|
5849
|
+
}
|
|
5850
|
+
}
|
|
5851
|
+
})
|
|
5852
|
+
}
|
|
5853
|
+
],
|
|
5854
|
+
envExports: [{ name: "AI_GATEWAY_API_KEY", value: ctx.apiKey }],
|
|
5855
|
+
notes: [
|
|
5856
|
+
"Kilo Code lists the gateway catalog automatically \u2014 pick a model with /models in a session (ids look like openai-compatible/anthropic/claude-fable-5).",
|
|
5857
|
+
"If you keep your Kilo config in kilo.jsonc instead of kilo.json, merge the new provider block into it manually."
|
|
5858
|
+
]
|
|
5859
|
+
};
|
|
5860
|
+
}
|
|
5861
|
+
};
|
|
5862
|
+
|
|
5863
|
+
// src/util/ai-gateway/coding-agents/agents/openclaw.ts
|
|
5864
|
+
import { join as join10 } from "path";
|
|
5865
|
+
var PROVIDER_KEY2 = "vercel-ai-gateway";
|
|
5866
|
+
var STARTER_MODELS = [
|
|
5867
|
+
{ id: "anthropic/claude-fable-5", name: "Claude Fable 5 (Gateway)" },
|
|
5868
|
+
{ id: "anthropic/claude-opus-4.8", name: "Claude Opus 4.8 (Gateway)" },
|
|
5869
|
+
{ id: "anthropic/claude-sonnet-4.6", name: "Claude Sonnet 4.6 (Gateway)" },
|
|
5870
|
+
{ id: "openai/gpt-5.6-sol", name: "GPT-5.6 Sol (Gateway)" },
|
|
5871
|
+
{ id: "google/gemini-3.6-flash", name: "Gemini 3.6 Flash (Gateway)" }
|
|
5872
|
+
];
|
|
5873
|
+
var openclaw = {
|
|
5874
|
+
id: "openclaw",
|
|
5875
|
+
displayName: "OpenClaw",
|
|
5876
|
+
experimental: true,
|
|
5877
|
+
async detect(home) {
|
|
5878
|
+
return pathExists(join10(home, ".openclaw"));
|
|
5879
|
+
},
|
|
5880
|
+
configPath(ctx) {
|
|
5881
|
+
return ctx.overrides?.["openclaw"] ?? join10(ctx.home, ".openclaw", "openclaw.json");
|
|
5882
|
+
},
|
|
5883
|
+
buildPlan(ctx) {
|
|
5884
|
+
const path3 = this.configPath(ctx);
|
|
5885
|
+
const baseUrl = ctx.baseUrlOverride ?? GATEWAY_OPENAI_BASE_URL;
|
|
5886
|
+
return {
|
|
5887
|
+
fileChanges: [
|
|
5888
|
+
{
|
|
5889
|
+
path: path3,
|
|
5890
|
+
label: "OpenClaw config",
|
|
5891
|
+
format: "json",
|
|
5892
|
+
transform: (current) => mergeJson(current, {
|
|
5893
|
+
models: {
|
|
5894
|
+
providers: {
|
|
5895
|
+
[PROVIDER_KEY2]: {
|
|
5896
|
+
baseUrl,
|
|
5897
|
+
// biome-ignore lint/suspicious/noTemplateCurlyInString: OpenClaw's own env-reference syntax, resolved by OpenClaw at load time
|
|
5898
|
+
apiKey: "${AI_GATEWAY_API_KEY}",
|
|
5899
|
+
api: "openai-completions",
|
|
5900
|
+
models: STARTER_MODELS
|
|
5901
|
+
}
|
|
5902
|
+
}
|
|
5903
|
+
},
|
|
5904
|
+
agents: {
|
|
5905
|
+
defaults: {
|
|
5906
|
+
model: {
|
|
5907
|
+
primary: `${PROVIDER_KEY2}/${GATEWAY_DEFAULT_MODEL}`
|
|
5908
|
+
}
|
|
5909
|
+
}
|
|
5910
|
+
}
|
|
5911
|
+
})
|
|
5912
|
+
}
|
|
5913
|
+
],
|
|
5914
|
+
envExports: [{ name: "AI_GATEWAY_API_KEY", value: ctx.apiKey }],
|
|
5915
|
+
notes: [
|
|
5916
|
+
`OpenClaw will default to ${PROVIDER_KEY2}/${GATEWAY_DEFAULT_MODEL}; the starter model list is in openclaw.json \u2014 add any gateway model id there.`,
|
|
5917
|
+
"Restart the OpenClaw gateway process so the new provider loads."
|
|
5918
|
+
]
|
|
5919
|
+
};
|
|
5920
|
+
}
|
|
5921
|
+
};
|
|
5922
|
+
|
|
5294
5923
|
// src/util/ai-gateway/coding-agents/agents/opencode.ts
|
|
5295
|
-
import { isAbsolute, join as
|
|
5924
|
+
import { isAbsolute, join as join11 } from "path";
|
|
5296
5925
|
function defaultConfigPath(home) {
|
|
5297
5926
|
const xdg = process.env.XDG_CONFIG_HOME;
|
|
5298
|
-
const base = xdg && isAbsolute(xdg) ? xdg :
|
|
5299
|
-
return
|
|
5927
|
+
const base = xdg && isAbsolute(xdg) ? xdg : join11(home, ".config");
|
|
5928
|
+
return join11(base, "opencode", "opencode.json");
|
|
5300
5929
|
}
|
|
5301
5930
|
var opencode = {
|
|
5302
5931
|
id: "opencode",
|
|
@@ -5334,20 +5963,20 @@ var opencode = {
|
|
|
5334
5963
|
};
|
|
5335
5964
|
|
|
5336
5965
|
// src/util/ai-gateway/coding-agents/agents/pi.ts
|
|
5337
|
-
import { join as
|
|
5966
|
+
import { join as join12 } from "path";
|
|
5338
5967
|
function piAgentDir(home) {
|
|
5339
5968
|
const dir = process.env.PI_CODING_AGENT_DIR;
|
|
5340
|
-
return dir && dir.trim() ? dir :
|
|
5969
|
+
return dir && dir.trim() ? dir : join12(home, ".pi", "agent");
|
|
5341
5970
|
}
|
|
5342
5971
|
var pi = {
|
|
5343
5972
|
id: "pi",
|
|
5344
5973
|
displayName: "Pi",
|
|
5345
5974
|
async detect(home) {
|
|
5346
5975
|
const dir = process.env.PI_CODING_AGENT_DIR;
|
|
5347
|
-
return pathExists(dir && dir.trim() ? dir :
|
|
5976
|
+
return pathExists(dir && dir.trim() ? dir : join12(home, ".pi"));
|
|
5348
5977
|
},
|
|
5349
5978
|
configPath(ctx) {
|
|
5350
|
-
return ctx.overrides?.["pi"] ??
|
|
5979
|
+
return ctx.overrides?.["pi"] ?? join12(piAgentDir(ctx.home), "auth.json");
|
|
5351
5980
|
},
|
|
5352
5981
|
buildPlan(ctx) {
|
|
5353
5982
|
const path3 = this.configPath(ctx);
|
|
@@ -5372,14 +6001,22 @@ var pi = {
|
|
|
5372
6001
|
};
|
|
5373
6002
|
|
|
5374
6003
|
// src/util/ai-gateway/coding-agents/agents/index.ts
|
|
5375
|
-
var CODING_AGENTS = [
|
|
6004
|
+
var CODING_AGENTS = [
|
|
6005
|
+
claudeCode,
|
|
6006
|
+
cline,
|
|
6007
|
+
codex,
|
|
6008
|
+
cursor,
|
|
6009
|
+
hermes,
|
|
6010
|
+
kilo,
|
|
6011
|
+
openclaw,
|
|
6012
|
+
opencode,
|
|
6013
|
+
pi
|
|
6014
|
+
];
|
|
5376
6015
|
var DEFAULT_AGENTS = CODING_AGENTS.filter((a) => !a.experimental);
|
|
5377
6016
|
function getAgentById(id) {
|
|
5378
6017
|
return CODING_AGENTS.find((a) => a.id === id);
|
|
5379
6018
|
}
|
|
5380
|
-
var UNSUPPORTED_AGENTS = {
|
|
5381
|
-
cursor: 'Cursor stores model settings in a SQLite database with no safely writable config, and its "Override OpenAI Base URL" GUI option is known to break other models. Set the base URL to https://ai-gateway.vercel.sh/v1 manually in Settings \u2192 Models if you want to try it.'
|
|
5382
|
-
};
|
|
6019
|
+
var UNSUPPORTED_AGENTS = {};
|
|
5383
6020
|
|
|
5384
6021
|
// src/util/ai-gateway/coding-agents/resolve.ts
|
|
5385
6022
|
async function resolveAgents(args) {
|
|
@@ -5596,16 +6233,16 @@ async function createKey(client, opts) {
|
|
|
5596
6233
|
}
|
|
5597
6234
|
|
|
5598
6235
|
// src/util/ai-gateway/coding-agents/apply.ts
|
|
5599
|
-
import { join as
|
|
6236
|
+
import { join as join13 } from "path";
|
|
5600
6237
|
|
|
5601
6238
|
// src/util/ai-gateway/coding-agents/keychain.ts
|
|
5602
|
-
import { existsSync
|
|
6239
|
+
import { existsSync } from "fs";
|
|
5603
6240
|
import { execFileSync } from "child_process";
|
|
5604
6241
|
var SECURITY_BIN = "/usr/bin/security";
|
|
5605
6242
|
var KEYCHAIN_SERVICE = "Vercel AI Gateway";
|
|
5606
6243
|
var KEYCHAIN_ACCOUNT = "vercel-ai-gateway";
|
|
5607
6244
|
function isKeychainAvailable() {
|
|
5608
|
-
return process.platform === "darwin" &&
|
|
6245
|
+
return process.platform === "darwin" && existsSync(SECURITY_BIN);
|
|
5609
6246
|
}
|
|
5610
6247
|
function storeKeyInKeychain(key) {
|
|
5611
6248
|
try {
|
|
@@ -5646,26 +6283,42 @@ function copyToClipboard(text2) {
|
|
|
5646
6283
|
}
|
|
5647
6284
|
|
|
5648
6285
|
// src/util/ai-gateway/coding-agents/apply.ts
|
|
6286
|
+
async function planSessionMigrations(agents, ctx) {
|
|
6287
|
+
const migrations = [];
|
|
6288
|
+
for (const agent2 of agents) {
|
|
6289
|
+
if (!agent2.sessionMigration)
|
|
6290
|
+
continue;
|
|
6291
|
+
const migration = await agent2.sessionMigration.plan(ctx);
|
|
6292
|
+
if (migration && migration.itemCount > 0) {
|
|
6293
|
+
migrations.push({
|
|
6294
|
+
...migration,
|
|
6295
|
+
agentId: agent2.id,
|
|
6296
|
+
agent: agent2.displayName
|
|
6297
|
+
});
|
|
6298
|
+
}
|
|
6299
|
+
}
|
|
6300
|
+
return migrations;
|
|
6301
|
+
}
|
|
5649
6302
|
function detectShellRc(home, override2) {
|
|
5650
6303
|
if (override2 && override2.trim())
|
|
5651
6304
|
return override2;
|
|
5652
6305
|
const shell = process.env.SHELL ?? "";
|
|
5653
6306
|
if (shell.includes("fish")) {
|
|
5654
6307
|
const xdg = process.env.XDG_CONFIG_HOME;
|
|
5655
|
-
const base = xdg && xdg.startsWith("/") ? xdg :
|
|
5656
|
-
return
|
|
6308
|
+
const base = xdg && xdg.startsWith("/") ? xdg : join13(home, ".config");
|
|
6309
|
+
return join13(base, "fish", "config.fish");
|
|
5657
6310
|
}
|
|
5658
6311
|
if (shell.includes("zsh")) {
|
|
5659
6312
|
const zdot = process.env.ZDOTDIR;
|
|
5660
|
-
return
|
|
6313
|
+
return join13(zdot && zdot.trim() ? zdot : home, ".zshrc");
|
|
5661
6314
|
}
|
|
5662
6315
|
if (shell.includes("bash")) {
|
|
5663
|
-
return
|
|
6316
|
+
return join13(
|
|
5664
6317
|
home,
|
|
5665
6318
|
process.platform === "darwin" ? ".bash_profile" : ".bashrc"
|
|
5666
6319
|
);
|
|
5667
6320
|
}
|
|
5668
|
-
return
|
|
6321
|
+
return join13(home, ".profile");
|
|
5669
6322
|
}
|
|
5670
6323
|
function shellQuote(value) {
|
|
5671
6324
|
return `'${value.split("'").join("'\\''")}'`;
|
|
@@ -5690,6 +6343,23 @@ function envBlockBody(exports, useKeychain, fish) {
|
|
|
5690
6343
|
}
|
|
5691
6344
|
return lines.join("\n");
|
|
5692
6345
|
}
|
|
6346
|
+
function preservedEnvLines(current, writtenNames) {
|
|
6347
|
+
if (!current)
|
|
6348
|
+
return [];
|
|
6349
|
+
const start = current.indexOf(MANAGED_BLOCK_START);
|
|
6350
|
+
const end = current.indexOf(MANAGED_BLOCK_END);
|
|
6351
|
+
if (start === -1 || end === -1 || end <= start)
|
|
6352
|
+
return [];
|
|
6353
|
+
const kept = [];
|
|
6354
|
+
for (const line2 of current.slice(start, end).split("\n")) {
|
|
6355
|
+
const match = /^(?:export|set -gx) ([A-Za-z_][A-Za-z0-9_]*)[ =]/.exec(
|
|
6356
|
+
line2.trim()
|
|
6357
|
+
);
|
|
6358
|
+
if (match && !writtenNames.has(match[1]))
|
|
6359
|
+
kept.push(line2.trim());
|
|
6360
|
+
}
|
|
6361
|
+
return kept;
|
|
6362
|
+
}
|
|
5693
6363
|
function matchesWithStoredKey(current, templated) {
|
|
5694
6364
|
const parts = templated.split(KEY_PLACEHOLDER);
|
|
5695
6365
|
if (parts.length < 2) {
|
|
@@ -5699,7 +6369,7 @@ function matchesWithStoredKey(current, templated) {
|
|
|
5699
6369
|
const pattern = `^${escaped[0]}([^\\s"'\\\\]+)${escaped.slice(1).join("\\1")}$`;
|
|
5700
6370
|
return new RegExp(pattern).test(current);
|
|
5701
6371
|
}
|
|
5702
|
-
async function buildSetupPlan(agents, ctx) {
|
|
6372
|
+
async function buildSetupPlan(agents, ctx, migrations = []) {
|
|
5703
6373
|
const pending = [];
|
|
5704
6374
|
const envExports = [];
|
|
5705
6375
|
const notes = [];
|
|
@@ -5737,12 +6407,20 @@ async function buildSetupPlan(agents, ctx) {
|
|
|
5737
6407
|
ctx.useKeychain,
|
|
5738
6408
|
shellRcPath.endsWith(".fish")
|
|
5739
6409
|
);
|
|
6410
|
+
const writtenNames = new Set(envExports.map((e2) => e2.name));
|
|
5740
6411
|
pending.push({
|
|
5741
6412
|
path: shellRcPath,
|
|
5742
6413
|
label: "Shell environment",
|
|
5743
6414
|
format: "shell",
|
|
5744
6415
|
owner: "Environment",
|
|
5745
|
-
transform: (current) =>
|
|
6416
|
+
transform: (current) => {
|
|
6417
|
+
const preserved = preservedEnvLines(current, writtenNames);
|
|
6418
|
+
return upsertManagedBlock(
|
|
6419
|
+
current,
|
|
6420
|
+
preserved.length > 0 ? `${body}
|
|
6421
|
+
${preserved.join("\n")}` : body
|
|
6422
|
+
);
|
|
6423
|
+
}
|
|
5746
6424
|
});
|
|
5747
6425
|
}
|
|
5748
6426
|
const byPath = /* @__PURE__ */ new Map();
|
|
@@ -5796,7 +6474,13 @@ async function buildSetupPlan(agents, ctx) {
|
|
|
5796
6474
|
symlink
|
|
5797
6475
|
});
|
|
5798
6476
|
}
|
|
5799
|
-
return {
|
|
6477
|
+
return {
|
|
6478
|
+
changes,
|
|
6479
|
+
notes,
|
|
6480
|
+
envExports,
|
|
6481
|
+
shellRcPath,
|
|
6482
|
+
migrations
|
|
6483
|
+
};
|
|
5800
6484
|
}
|
|
5801
6485
|
async function applyPlan(plan, options) {
|
|
5802
6486
|
const results = [];
|
|
@@ -5819,6 +6503,36 @@ async function applyPlan(plan, options) {
|
|
|
5819
6503
|
}
|
|
5820
6504
|
return results;
|
|
5821
6505
|
}
|
|
6506
|
+
async function applySessionMigrations(plan) {
|
|
6507
|
+
const results = [];
|
|
6508
|
+
const errors = [];
|
|
6509
|
+
for (const migration of plan.migrations) {
|
|
6510
|
+
try {
|
|
6511
|
+
const result = await migration.apply();
|
|
6512
|
+
const { errors: copyErrors = [], ...counts } = result;
|
|
6513
|
+
results.push({
|
|
6514
|
+
agentId: migration.agentId,
|
|
6515
|
+
agent: migration.agent,
|
|
6516
|
+
label: migration.label,
|
|
6517
|
+
...counts
|
|
6518
|
+
});
|
|
6519
|
+
errors.push(
|
|
6520
|
+
...copyErrors.map((message) => ({
|
|
6521
|
+
agentId: migration.agentId,
|
|
6522
|
+
agent: migration.agent,
|
|
6523
|
+
message
|
|
6524
|
+
}))
|
|
6525
|
+
);
|
|
6526
|
+
} catch (error) {
|
|
6527
|
+
errors.push({
|
|
6528
|
+
agentId: migration.agentId,
|
|
6529
|
+
agent: migration.agent,
|
|
6530
|
+
message: error instanceof Error ? error.message : String(error)
|
|
6531
|
+
});
|
|
6532
|
+
}
|
|
6533
|
+
}
|
|
6534
|
+
return { results, errors };
|
|
6535
|
+
}
|
|
5822
6536
|
|
|
5823
6537
|
// src/util/ai-gateway/coding-agents/render.ts
|
|
5824
6538
|
var import_chalk20 = __toESM(require_source(), 1);
|
|
@@ -5932,6 +6646,11 @@ function printResolvedState(args) {
|
|
|
5932
6646
|
const { selected, willCreate, name, budget, refreshPeriod, expiresAt } = args;
|
|
5933
6647
|
output_manager_default.print(import_chalk20.default.bold(" Summary\n"));
|
|
5934
6648
|
printAlignedLabel("Agents", selected.map((a) => a.displayName).join(", "));
|
|
6649
|
+
if (args.preserveKey) {
|
|
6650
|
+
printAlignedLabel("API key", "Existing configuration unchanged");
|
|
6651
|
+
output_manager_default.print("\n");
|
|
6652
|
+
return;
|
|
6653
|
+
}
|
|
5935
6654
|
if (!willCreate) {
|
|
5936
6655
|
printAlignedLabel("API key", "Using provided key");
|
|
5937
6656
|
output_manager_default.print("\n");
|
|
@@ -5990,7 +6709,7 @@ function printPlan(plan, previewKey, opts = {}) {
|
|
|
5990
6709
|
);
|
|
5991
6710
|
if (change2.symlink) {
|
|
5992
6711
|
output_manager_default.print(
|
|
5993
|
-
` ${import_chalk20.default.yellow("\u21B3 warning:")} this path is a symlink
|
|
6712
|
+
` ${import_chalk20.default.yellow("\u21B3 warning:")} this path is a symlink; the write will follow it to its target
|
|
5994
6713
|
`
|
|
5995
6714
|
);
|
|
5996
6715
|
}
|
|
@@ -6007,6 +6726,20 @@ function printPlan(plan, previewKey, opts = {}) {
|
|
|
6007
6726
|
`);
|
|
6008
6727
|
}
|
|
6009
6728
|
}
|
|
6729
|
+
for (const migration of plan.migrations) {
|
|
6730
|
+
output_manager_default.print(
|
|
6731
|
+
` ${import_chalk20.default.green("+")} ${import_chalk20.default.bold(migration.label)} (copy) ${import_chalk20.default.dim(
|
|
6732
|
+
`${migration.itemCount} ${migration.itemCount === 1 ? "session" : "sessions"}, ${formatBytes(migration.totalBytes)}`
|
|
6733
|
+
)}
|
|
6734
|
+
`
|
|
6735
|
+
);
|
|
6736
|
+
output_manager_default.print(
|
|
6737
|
+
import_chalk20.default.dim(
|
|
6738
|
+
` \u21B3 copy only from ${migration.sourceRoots.join(", ")} to ${migration.destinationRoots.join(", ")}; originals remain unchanged
|
|
6739
|
+
`
|
|
6740
|
+
)
|
|
6741
|
+
);
|
|
6742
|
+
}
|
|
6010
6743
|
output_manager_default.print("\n");
|
|
6011
6744
|
}
|
|
6012
6745
|
function printWarning(message) {
|
|
@@ -6045,12 +6778,29 @@ function printKey(key, opts = {}) {
|
|
|
6045
6778
|
printKeyRow(key, opts);
|
|
6046
6779
|
}
|
|
6047
6780
|
function buildAgentPrompt(plan, apiKey) {
|
|
6048
|
-
const
|
|
6781
|
+
const fileChanges = plan.changes.filter(
|
|
6782
|
+
(change2) => change2.status === "create" || change2.status === "update"
|
|
6783
|
+
);
|
|
6784
|
+
const sections = fileChanges.length > 0 ? [
|
|
6049
6785
|
"Set up the Vercel AI Gateway for my coding agents by applying the file changes below.",
|
|
6050
6786
|
"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).",
|
|
6051
6787
|
`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.`,
|
|
6052
6788
|
""
|
|
6053
|
-
];
|
|
6789
|
+
] : [];
|
|
6790
|
+
if (plan.migrations.length > 0) {
|
|
6791
|
+
sections.push(
|
|
6792
|
+
"# Existing Codex Desktop sessions",
|
|
6793
|
+
"Before editing the provider configuration, copy the sessions described below. Never move, delete, or overwrite the originals."
|
|
6794
|
+
);
|
|
6795
|
+
for (const migration of plan.migrations) {
|
|
6796
|
+
sections.push(
|
|
6797
|
+
"",
|
|
6798
|
+
`## ${migration.agent}: ${migration.label}`,
|
|
6799
|
+
...migration.prompt
|
|
6800
|
+
);
|
|
6801
|
+
}
|
|
6802
|
+
sections.push("");
|
|
6803
|
+
}
|
|
6054
6804
|
for (const change2 of plan.changes) {
|
|
6055
6805
|
if (change2.status !== "create" && change2.status !== "update") {
|
|
6056
6806
|
continue;
|
|
@@ -6069,6 +6819,13 @@ function buildAgentPrompt(plan, apiKey) {
|
|
|
6069
6819
|
return `${sections.join("\n").trimEnd()}
|
|
6070
6820
|
`;
|
|
6071
6821
|
}
|
|
6822
|
+
function formatBytes(bytes5) {
|
|
6823
|
+
if (bytes5 < 1024)
|
|
6824
|
+
return `${bytes5} B`;
|
|
6825
|
+
if (bytes5 < 1024 ** 2)
|
|
6826
|
+
return `${(bytes5 / 1024).toFixed(1)} KiB`;
|
|
6827
|
+
return `${(bytes5 / 1024 ** 2).toFixed(1)} MiB`;
|
|
6828
|
+
}
|
|
6072
6829
|
|
|
6073
6830
|
// src/util/ai-gateway/coding-agents/consent.ts
|
|
6074
6831
|
var import_chalk21 = __toESM(require_source(), 1);
|
|
@@ -6144,13 +6901,22 @@ async function runMachine(args) {
|
|
|
6144
6901
|
{
|
|
6145
6902
|
status: AGENT_STATUS.OK,
|
|
6146
6903
|
reason: "dry_run",
|
|
6147
|
-
message: "Previewing AI Gateway coding-agent setup. No
|
|
6904
|
+
message: "Previewing AI Gateway coding-agent setup. No changes applied.",
|
|
6148
6905
|
changes: previewPlan.changes.map((c) => ({
|
|
6149
6906
|
agent: c.owners.join(", "),
|
|
6150
6907
|
file: c.path,
|
|
6151
6908
|
action: c.status === "create" ? "would_create" : c.status === "update" ? "would_update" : c.status,
|
|
6152
6909
|
...c.symlink ? { symlink: true } : {}
|
|
6153
6910
|
})),
|
|
6911
|
+
migrations: previewPlan.migrations.map((m) => ({
|
|
6912
|
+
agent: m.agentId,
|
|
6913
|
+
label: m.label,
|
|
6914
|
+
action: "would_copy",
|
|
6915
|
+
sessions: m.itemCount,
|
|
6916
|
+
bytes: m.totalBytes,
|
|
6917
|
+
sourceRoots: m.sourceRoots,
|
|
6918
|
+
destinationRoots: m.destinationRoots
|
|
6919
|
+
})),
|
|
6154
6920
|
skipped,
|
|
6155
6921
|
warnings: args.warnings
|
|
6156
6922
|
},
|
|
@@ -6201,10 +6967,36 @@ async function runMachine(args) {
|
|
|
6201
6967
|
);
|
|
6202
6968
|
return 0;
|
|
6203
6969
|
}
|
|
6970
|
+
const sessionOnly = !args.keySource && !args.reconfigure && previewPlan.changes.every((c) => c.status === "unchanged") && previewPlan.migrations.length > 0;
|
|
6971
|
+
if (sessionOnly) {
|
|
6972
|
+
if (args.promptMode) {
|
|
6973
|
+
writeJson(client, {
|
|
6974
|
+
status: AGENT_STATUS.OK,
|
|
6975
|
+
reason: "agent_prompt",
|
|
6976
|
+
message: "Generated a Codex Desktop session migration prompt. No changes were applied.",
|
|
6977
|
+
prompt: buildAgentPrompt(previewPlan, ""),
|
|
6978
|
+
configured: [],
|
|
6979
|
+
skipped,
|
|
6980
|
+
warnings: args.warnings
|
|
6981
|
+
});
|
|
6982
|
+
return 0;
|
|
6983
|
+
}
|
|
6984
|
+
const migrated2 = await applySessionMigrations(previewPlan);
|
|
6985
|
+
writeJson(client, {
|
|
6986
|
+
status: migrated2.errors.length > 0 ? AGENT_STATUS.ERROR : AGENT_STATUS.OK,
|
|
6987
|
+
reason: migrated2.errors.length > 0 ? "session_migration_failed" : "sessions_migrated",
|
|
6988
|
+
message: migrated2.errors.length > 0 ? "One or more Codex Desktop session copies failed. Original sessions were left unchanged." : "Copied existing Codex Desktop sessions into the AI Gateway provider. Original sessions remain unchanged.",
|
|
6989
|
+
configured: [],
|
|
6990
|
+
migrated: migrated2.results,
|
|
6991
|
+
skipped: [...skipped, ...migrationSkips(migrated2.errors)],
|
|
6992
|
+
warnings: args.warnings
|
|
6993
|
+
});
|
|
6994
|
+
return migrated2.errors.length > 0 ? 1 : 0;
|
|
6995
|
+
}
|
|
6204
6996
|
const applicable = previewPlan.changes.filter(
|
|
6205
6997
|
(c) => (c.status === "create" || c.status === "update") && c.format !== "shell"
|
|
6206
6998
|
);
|
|
6207
|
-
if (applicable.length === 0 && errored.length > 0) {
|
|
6999
|
+
if (applicable.length === 0 && errored.length > 0 && (args.promptMode || previewPlan.migrations.length === 0)) {
|
|
6208
7000
|
client.stdout.write(
|
|
6209
7001
|
`${JSON.stringify(
|
|
6210
7002
|
{
|
|
@@ -6221,6 +7013,31 @@ async function runMachine(args) {
|
|
|
6221
7013
|
);
|
|
6222
7014
|
return 1;
|
|
6223
7015
|
}
|
|
7016
|
+
const migrated = args.promptMode ? { results: [], errors: [] } : await applySessionMigrations(previewPlan);
|
|
7017
|
+
if (migrated.errors.length > 0) {
|
|
7018
|
+
writeJson(client, {
|
|
7019
|
+
status: AGENT_STATUS.ERROR,
|
|
7020
|
+
reason: "session_migration_failed",
|
|
7021
|
+
message: "No agent configuration was changed because one or more Codex Desktop session copies failed. Original sessions were left unchanged.",
|
|
7022
|
+
configured: [],
|
|
7023
|
+
migrated: migrated.results,
|
|
7024
|
+
skipped: [...skipped, ...migrationSkips(migrated.errors)],
|
|
7025
|
+
warnings: args.warnings
|
|
7026
|
+
});
|
|
7027
|
+
return 1;
|
|
7028
|
+
}
|
|
7029
|
+
if (applicable.length === 0 && errored.length > 0) {
|
|
7030
|
+
writeJson(client, {
|
|
7031
|
+
status: AGENT_STATUS.ERROR,
|
|
7032
|
+
reason: "unparseable_config",
|
|
7033
|
+
message: "Copied the eligible sessions, but couldn't write any agent configurations.",
|
|
7034
|
+
configured: [],
|
|
7035
|
+
migrated: migrated.results,
|
|
7036
|
+
skipped,
|
|
7037
|
+
warnings: args.warnings
|
|
7038
|
+
});
|
|
7039
|
+
return 1;
|
|
7040
|
+
}
|
|
6224
7041
|
let key;
|
|
6225
7042
|
try {
|
|
6226
7043
|
key = args.keySource ? args.keySource.key : await args.createKey();
|
|
@@ -6229,20 +7046,25 @@ async function runMachine(args) {
|
|
|
6229
7046
|
outputAgentError(client, {
|
|
6230
7047
|
status: AGENT_STATUS.ERROR,
|
|
6231
7048
|
reason: err.status === 403 ? "forbidden" : AGENT_REASON.API_ERROR,
|
|
6232
|
-
message: err.message
|
|
7049
|
+
message: err.message,
|
|
7050
|
+
hint: `Session migrations: ${JSON.stringify(migrated.results)}`
|
|
6233
7051
|
});
|
|
6234
7052
|
}
|
|
6235
7053
|
throw err;
|
|
6236
7054
|
}
|
|
6237
7055
|
const useKeychain = args.useKeychain && storeKeyInKeychain(key);
|
|
6238
|
-
const finalPlan = await buildSetupPlan(
|
|
6239
|
-
|
|
6240
|
-
|
|
6241
|
-
|
|
6242
|
-
|
|
6243
|
-
|
|
6244
|
-
|
|
6245
|
-
|
|
7056
|
+
const finalPlan = await buildSetupPlan(
|
|
7057
|
+
selected,
|
|
7058
|
+
{
|
|
7059
|
+
apiKey: key,
|
|
7060
|
+
home,
|
|
7061
|
+
useKeychain,
|
|
7062
|
+
overrides: args.overrides,
|
|
7063
|
+
shellRcOverride: args.shellRcOverride,
|
|
7064
|
+
baseUrlOverride: args.baseUrlOverride
|
|
7065
|
+
},
|
|
7066
|
+
previewPlan.migrations
|
|
7067
|
+
);
|
|
6246
7068
|
if (args.promptMode) {
|
|
6247
7069
|
if (!useKeychain) {
|
|
6248
7070
|
client.stdout.write(
|
|
@@ -6296,6 +7118,7 @@ async function runMachine(args) {
|
|
|
6296
7118
|
action: r.action,
|
|
6297
7119
|
backup: r.backupPath
|
|
6298
7120
|
})),
|
|
7121
|
+
migrated: migrated.results,
|
|
6299
7122
|
skipped,
|
|
6300
7123
|
warnings: args.warnings,
|
|
6301
7124
|
notes: finalPlan.notes.flatMap(
|
|
@@ -6309,6 +7132,17 @@ async function runMachine(args) {
|
|
|
6309
7132
|
);
|
|
6310
7133
|
return 0;
|
|
6311
7134
|
}
|
|
7135
|
+
function migrationSkips(errors) {
|
|
7136
|
+
return errors.map((error) => ({
|
|
7137
|
+
target: error.agentId,
|
|
7138
|
+
reason: "session_migration_failed",
|
|
7139
|
+
message: error.message
|
|
7140
|
+
}));
|
|
7141
|
+
}
|
|
7142
|
+
function writeJson(client, value) {
|
|
7143
|
+
client.stdout.write(`${JSON.stringify(value, null, 2)}
|
|
7144
|
+
`);
|
|
7145
|
+
}
|
|
6312
7146
|
|
|
6313
7147
|
// src/util/telemetry/commands/ai-gateway/coding-agents-setup.ts
|
|
6314
7148
|
var AiGatewayCodingAgentsSetupTelemetryClient = class extends TelemetryClient {
|
|
@@ -6372,6 +7206,11 @@ var AiGatewayCodingAgentsSetupTelemetryClient = class extends TelemetryClient {
|
|
|
6372
7206
|
this.trackCliFlag("no-backup");
|
|
6373
7207
|
}
|
|
6374
7208
|
}
|
|
7209
|
+
trackCliFlagNoSessionMigration(noSessionMigration) {
|
|
7210
|
+
if (noSessionMigration) {
|
|
7211
|
+
this.trackCliFlag("no-session-migration");
|
|
7212
|
+
}
|
|
7213
|
+
}
|
|
6375
7214
|
trackCliFlagNoKeychain(noKeychain) {
|
|
6376
7215
|
if (noKeychain) {
|
|
6377
7216
|
this.trackCliFlag("no-keychain");
|
|
@@ -6432,6 +7271,7 @@ async function codingAgentsSetup(client, argv) {
|
|
|
6432
7271
|
const reconfigure = opts["--reconfigure"];
|
|
6433
7272
|
const dryRun = opts["--dry-run"];
|
|
6434
7273
|
const noBackup = opts["--no-backup"];
|
|
7274
|
+
const noSessionMigration = opts["--no-session-migration"];
|
|
6435
7275
|
const noKeychain = opts["--no-keychain"];
|
|
6436
7276
|
const agentConfig = opts["--agent-config"];
|
|
6437
7277
|
const shellRcOverride = opts["--shell-rc"];
|
|
@@ -6449,6 +7289,7 @@ async function codingAgentsSetup(client, argv) {
|
|
|
6449
7289
|
telemetry2.trackCliFlagReconfigure(reconfigure);
|
|
6450
7290
|
telemetry2.trackCliFlagDryRun(dryRun);
|
|
6451
7291
|
telemetry2.trackCliFlagNoBackup(noBackup);
|
|
7292
|
+
telemetry2.trackCliFlagNoSessionMigration(noSessionMigration);
|
|
6452
7293
|
telemetry2.trackCliFlagNoKeychain(noKeychain);
|
|
6453
7294
|
telemetry2.trackCliOptionAgentConfig(agentConfig);
|
|
6454
7295
|
telemetry2.trackCliOptionShellRc(shellRcOverride);
|
|
@@ -6491,14 +7332,6 @@ async function codingAgentsSetup(client, argv) {
|
|
|
6491
7332
|
`Invalid --apply "${applyMode}". Must be "edit" or "prompt".`
|
|
6492
7333
|
);
|
|
6493
7334
|
}
|
|
6494
|
-
if (applyMode === "prompt" && !wantKeychain) {
|
|
6495
|
-
return failValidation(
|
|
6496
|
-
client,
|
|
6497
|
-
machine,
|
|
6498
|
-
AGENT_REASON.INVALID_ARGUMENTS,
|
|
6499
|
-
"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`."
|
|
6500
|
-
);
|
|
6501
|
-
}
|
|
6502
7335
|
if (baseUrl !== void 0 && !isValidBaseUrl(baseUrl)) {
|
|
6503
7336
|
return failValidation(
|
|
6504
7337
|
client,
|
|
@@ -6533,7 +7366,7 @@ async function codingAgentsSetup(client, argv) {
|
|
|
6533
7366
|
}
|
|
6534
7367
|
if (dryRun && !machine) {
|
|
6535
7368
|
printStatus(
|
|
6536
|
-
`${import_chalk22.default.bold("Dry run")}
|
|
7369
|
+
`${import_chalk22.default.bold("Dry run")}: previewing changes only. No files will be written and no API key will be created.`
|
|
6537
7370
|
);
|
|
6538
7371
|
}
|
|
6539
7372
|
const selection = await resolveAgents({
|
|
@@ -6620,21 +7453,73 @@ async function codingAgentsSetup(client, argv) {
|
|
|
6620
7453
|
}
|
|
6621
7454
|
}
|
|
6622
7455
|
}
|
|
7456
|
+
let sessionMigrations = [];
|
|
7457
|
+
if (!noSessionMigration) {
|
|
7458
|
+
try {
|
|
7459
|
+
sessionMigrations = await planSessionMigrations(agents, { home });
|
|
7460
|
+
} catch (error) {
|
|
7461
|
+
return failValidation(
|
|
7462
|
+
client,
|
|
7463
|
+
machine,
|
|
7464
|
+
"session_migration_failed",
|
|
7465
|
+
`${error instanceof Error ? error.message : String(error)}. No configuration was changed. Pass --no-session-migration to leave existing sessions untouched and continue.`
|
|
7466
|
+
);
|
|
7467
|
+
}
|
|
7468
|
+
if (sessionMigrations.length > 0 && canPrompt2 && !yes && !dryRun) {
|
|
7469
|
+
const count2 = sessionMigrations.reduce(
|
|
7470
|
+
(total, migration) => total + migration.itemCount,
|
|
7471
|
+
0
|
|
7472
|
+
);
|
|
7473
|
+
const agentNames = [
|
|
7474
|
+
...new Set(sessionMigrations.map((migration) => migration.agent))
|
|
7475
|
+
].join(" and ");
|
|
7476
|
+
const migrate = await client.input.confirm(
|
|
7477
|
+
count2 === 1 ? `Copy your existing ${agentNames} Desktop session so it stays visible after switching to the AI Gateway? The original will be left unchanged.` : `Copy your ${count2} existing ${agentNames} Desktop sessions so they stay visible after switching to the AI Gateway? The originals will be left unchanged.`,
|
|
7478
|
+
true
|
|
7479
|
+
);
|
|
7480
|
+
if (!migrate) {
|
|
7481
|
+
sessionMigrations = [];
|
|
7482
|
+
printStatus(
|
|
7483
|
+
`Skipped ${agentNames} Desktop session migration. Your existing sessions were left unchanged.`
|
|
7484
|
+
);
|
|
7485
|
+
}
|
|
7486
|
+
}
|
|
7487
|
+
}
|
|
6623
7488
|
const willCreate = !providedKey;
|
|
6624
7489
|
let keyName = name;
|
|
6625
7490
|
let keyBudget = budget;
|
|
6626
7491
|
let keyRefresh = refreshPeriod;
|
|
6627
7492
|
let keyExpiresAt = flagExpiresAt;
|
|
6628
|
-
|
|
7493
|
+
const preflightPlan = await buildSetupPlan(
|
|
7494
|
+
agents,
|
|
7495
|
+
{
|
|
7496
|
+
apiKey: previewKey,
|
|
7497
|
+
home,
|
|
7498
|
+
useKeychain: wantKeychain,
|
|
7499
|
+
overrides,
|
|
7500
|
+
shellRcOverride,
|
|
7501
|
+
baseUrlOverride: baseUrl
|
|
7502
|
+
},
|
|
7503
|
+
sessionMigrations
|
|
7504
|
+
);
|
|
7505
|
+
const preflightSessionOnly = !providedKey && !reconfigure && preflightPlan.changes.every((change2) => change2.status === "unchanged") && preflightPlan.migrations.length > 0;
|
|
7506
|
+
if (applyMode === "prompt" && !wantKeychain && !preflightSessionOnly) {
|
|
7507
|
+
return failValidation(
|
|
7508
|
+
client,
|
|
7509
|
+
machine,
|
|
7510
|
+
AGENT_REASON.INVALID_ARGUMENTS,
|
|
7511
|
+
"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`."
|
|
7512
|
+
);
|
|
7513
|
+
}
|
|
7514
|
+
if (willCreate && !preflightSessionOnly && agents.length > 0 && (!dryRun || canPrompt2)) {
|
|
6629
7515
|
const promptCreate = canPrompt2 && !yes;
|
|
6630
7516
|
const teamError = await ensureTeam2(client, {
|
|
6631
7517
|
machine,
|
|
6632
7518
|
canPrompt: canPrompt2,
|
|
6633
7519
|
yes: Boolean(yes)
|
|
6634
7520
|
});
|
|
6635
|
-
if (teamError)
|
|
7521
|
+
if (teamError)
|
|
6636
7522
|
return teamError;
|
|
6637
|
-
}
|
|
6638
7523
|
if (promptCreate && keyName === void 0) {
|
|
6639
7524
|
keyName = await promptKeyName(client);
|
|
6640
7525
|
}
|
|
@@ -6650,12 +7535,12 @@ async function codingAgentsSetup(client, argv) {
|
|
|
6650
7535
|
}
|
|
6651
7536
|
}
|
|
6652
7537
|
let useKeychain = wantKeychain;
|
|
6653
|
-
if (wantKeychain && canPrompt2 && !yes) {
|
|
7538
|
+
if (!preflightSessionOnly && wantKeychain && canPrompt2 && !yes) {
|
|
6654
7539
|
useKeychain = await promptKeychain(client);
|
|
6655
7540
|
}
|
|
6656
7541
|
if (canPrompt2 && !yes) {
|
|
6657
7542
|
const missing = agents.filter(
|
|
6658
|
-
(a) => !overrides[a.id] && !
|
|
7543
|
+
(a) => !overrides[a.id] && !existsSync2(dirname4(a.configPath({ apiKey: "", home })))
|
|
6659
7544
|
);
|
|
6660
7545
|
if (missing.length > 0) {
|
|
6661
7546
|
const customize = await client.input.confirm(
|
|
@@ -6685,19 +7570,25 @@ async function codingAgentsSetup(client, argv) {
|
|
|
6685
7570
|
"--base-url has no effect for the selected agents; only Claude Code and Codex write a gateway base URL."
|
|
6686
7571
|
);
|
|
6687
7572
|
}
|
|
6688
|
-
const previewPlan = await buildSetupPlan(
|
|
6689
|
-
|
|
6690
|
-
|
|
6691
|
-
|
|
6692
|
-
|
|
6693
|
-
|
|
6694
|
-
|
|
6695
|
-
|
|
7573
|
+
const previewPlan = await buildSetupPlan(
|
|
7574
|
+
agents,
|
|
7575
|
+
{
|
|
7576
|
+
apiKey: previewKey,
|
|
7577
|
+
home,
|
|
7578
|
+
useKeychain,
|
|
7579
|
+
overrides,
|
|
7580
|
+
shellRcOverride,
|
|
7581
|
+
baseUrlOverride: baseUrl
|
|
7582
|
+
},
|
|
7583
|
+
sessionMigrations
|
|
7584
|
+
);
|
|
6696
7585
|
const changed = previewPlan.changes.filter(
|
|
6697
7586
|
(c) => c.status === "create" || c.status === "update"
|
|
6698
7587
|
);
|
|
6699
7588
|
const errored = previewPlan.changes.filter((c) => c.status === "error");
|
|
6700
|
-
const
|
|
7589
|
+
const noConfigChanges = changed.length === 0 && errored.length === 0;
|
|
7590
|
+
const alreadyConfigured = noConfigChanges && previewPlan.migrations.length === 0;
|
|
7591
|
+
const sessionOnly = !providedKey && !reconfigure && noConfigChanges && previewPlan.migrations.length > 0;
|
|
6701
7592
|
if (machine) {
|
|
6702
7593
|
return runMachine({
|
|
6703
7594
|
client,
|
|
@@ -6772,24 +7663,25 @@ async function codingAgentsSetup(client, argv) {
|
|
|
6772
7663
|
budget: keyBudget,
|
|
6773
7664
|
refreshPeriod: keyRefresh,
|
|
6774
7665
|
expiresAt: keyExpiresAt,
|
|
6775
|
-
keychain: wantKeychain ? useKeychain : void 0
|
|
7666
|
+
keychain: wantKeychain ? useKeychain : void 0,
|
|
7667
|
+
preserveKey: sessionOnly
|
|
6776
7668
|
});
|
|
6777
7669
|
printPlan(previewPlan, previewKey, { backup: !noBackup });
|
|
6778
7670
|
if (dryRun) {
|
|
6779
7671
|
printStatus(
|
|
6780
|
-
`Dry run
|
|
7672
|
+
`Dry run: no files written. Re-run without ${import_chalk22.default.bold("--dry-run")} to apply.`
|
|
6781
7673
|
);
|
|
6782
7674
|
return 0;
|
|
6783
7675
|
}
|
|
6784
7676
|
const agentConfigChanged = changed.filter((c) => c.format !== "shell");
|
|
6785
|
-
if (agentConfigChanged.length === 0 && errored.length > 0) {
|
|
7677
|
+
if (agentConfigChanged.length === 0 && errored.length > 0 && previewPlan.migrations.length === 0) {
|
|
6786
7678
|
output_manager_default.error(
|
|
6787
7679
|
"Couldn't write any agent configurations. Fix the files above, then re-run."
|
|
6788
7680
|
);
|
|
6789
7681
|
return 1;
|
|
6790
7682
|
}
|
|
6791
7683
|
let applyAction = applyMode === "prompt" ? "copy" : "apply";
|
|
6792
|
-
if (applyMode === void 0 && changed.length > 0 && canPrompt2 && !yes) {
|
|
7684
|
+
if (applyMode === void 0 && (changed.length > 0 || previewPlan.migrations.length > 0) && canPrompt2 && !yes) {
|
|
6793
7685
|
if (useKeychain) {
|
|
6794
7686
|
const choice = await client.input.select({
|
|
6795
7687
|
message: "Apply these changes?",
|
|
@@ -6816,6 +7708,41 @@ async function codingAgentsSetup(client, argv) {
|
|
|
6816
7708
|
}
|
|
6817
7709
|
}
|
|
6818
7710
|
}
|
|
7711
|
+
if (sessionOnly) {
|
|
7712
|
+
if (applyAction === "copy" && previewPlan.migrations.length > 0) {
|
|
7713
|
+
const promptText = buildAgentPrompt(previewPlan, KEY_PLACEHOLDER);
|
|
7714
|
+
emitAgentPrompt(client, promptText, applyMode === "prompt", "migration");
|
|
7715
|
+
return 0;
|
|
7716
|
+
}
|
|
7717
|
+
const migrated2 = await applySessionMigrations(previewPlan);
|
|
7718
|
+
printSessionMigrationReceipt(migrated2, true);
|
|
7719
|
+
return migrated2.errors.length > 0 ? 1 : 0;
|
|
7720
|
+
}
|
|
7721
|
+
if (applyAction === "copy" && !useKeychain) {
|
|
7722
|
+
return failValidation(
|
|
7723
|
+
client,
|
|
7724
|
+
machine,
|
|
7725
|
+
AGENT_REASON.INVALID_ARGUMENTS,
|
|
7726
|
+
"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`."
|
|
7727
|
+
);
|
|
7728
|
+
}
|
|
7729
|
+
const migrated = applyAction === "apply" ? await applySessionMigrations(previewPlan) : { results: [], errors: [] };
|
|
7730
|
+
if (migrated.errors.length > 0) {
|
|
7731
|
+
printSessionMigrationReceipt(migrated);
|
|
7732
|
+
output_manager_default.error(
|
|
7733
|
+
"Session migration did not complete, so no agent configuration was changed. Rerun the command to retry, or pass --no-session-migration to set up without copying sessions."
|
|
7734
|
+
);
|
|
7735
|
+
return 1;
|
|
7736
|
+
}
|
|
7737
|
+
if (migrated.results.length > 0) {
|
|
7738
|
+
printSessionMigrationReceipt(migrated, true);
|
|
7739
|
+
}
|
|
7740
|
+
if (applyAction === "apply" && agentConfigChanged.length === 0 && errored.length > 0) {
|
|
7741
|
+
output_manager_default.error(
|
|
7742
|
+
"Copied the eligible sessions, but couldn't write any agent configurations. Fix the files above, then re-run."
|
|
7743
|
+
);
|
|
7744
|
+
return 1;
|
|
7745
|
+
}
|
|
6819
7746
|
let keySource;
|
|
6820
7747
|
try {
|
|
6821
7748
|
keySource = providedKey ? { key: providedKey, created: false } : {
|
|
@@ -6848,33 +7775,21 @@ async function codingAgentsSetup(client, argv) {
|
|
|
6848
7775
|
);
|
|
6849
7776
|
useKeychain = false;
|
|
6850
7777
|
}
|
|
6851
|
-
const applyPlanResult = await buildSetupPlan(
|
|
6852
|
-
|
|
6853
|
-
|
|
6854
|
-
|
|
6855
|
-
|
|
6856
|
-
|
|
6857
|
-
|
|
6858
|
-
|
|
7778
|
+
const applyPlanResult = await buildSetupPlan(
|
|
7779
|
+
agents,
|
|
7780
|
+
{
|
|
7781
|
+
apiKey: keySource.key,
|
|
7782
|
+
home,
|
|
7783
|
+
useKeychain,
|
|
7784
|
+
overrides,
|
|
7785
|
+
shellRcOverride,
|
|
7786
|
+
baseUrlOverride: baseUrl
|
|
7787
|
+
},
|
|
7788
|
+
sessionMigrations
|
|
7789
|
+
);
|
|
6859
7790
|
if (applyAction === "copy") {
|
|
6860
7791
|
const promptText = buildAgentPrompt(applyPlanResult, keySource.key);
|
|
6861
|
-
|
|
6862
|
-
const copied = copyToClipboard(promptText);
|
|
6863
|
-
printStatus(
|
|
6864
|
-
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)."
|
|
6865
|
-
);
|
|
6866
|
-
client.stdout.write(`${promptText}
|
|
6867
|
-
`);
|
|
6868
|
-
} else if (copyToClipboard(promptText)) {
|
|
6869
|
-
printStatus(
|
|
6870
|
-
"Prompt copied to clipboard. Paste it into your coding agent to apply the changes."
|
|
6871
|
-
);
|
|
6872
|
-
} else {
|
|
6873
|
-
output_manager_default.debug("pbcopy failed or unavailable");
|
|
6874
|
-
printStatus("Could not access the clipboard \u2014 prompt printed below:");
|
|
6875
|
-
client.stdout.write(`${promptText}
|
|
6876
|
-
`);
|
|
6877
|
-
}
|
|
7792
|
+
emitAgentPrompt(client, promptText, applyMode === "prompt", "setup");
|
|
6878
7793
|
printKey(keySource.key, { keychain: true, created: keySource.created });
|
|
6879
7794
|
return 0;
|
|
6880
7795
|
}
|
|
@@ -6917,7 +7832,42 @@ async function codingAgentsSetup(client, argv) {
|
|
|
6917
7832
|
client.stdout.write(`${keySource.key}
|
|
6918
7833
|
`);
|
|
6919
7834
|
}
|
|
6920
|
-
return 0;
|
|
7835
|
+
return migrated.errors.length > 0 ? 1 : 0;
|
|
7836
|
+
}
|
|
7837
|
+
function printSessionMigrationReceipt(migration, gutter = false) {
|
|
7838
|
+
if (gutter)
|
|
7839
|
+
output_manager_default.print("\n");
|
|
7840
|
+
for (const result of migration.results) {
|
|
7841
|
+
printAlignedLabel(
|
|
7842
|
+
"Sessions",
|
|
7843
|
+
`Copied ${result.copied} ${result.copied === 1 ? "session" : "sessions"} for ${result.agent}; originals unchanged`,
|
|
7844
|
+
gutter ? { gutter: "\u2713" } : void 0
|
|
7845
|
+
);
|
|
7846
|
+
gutter = false;
|
|
7847
|
+
}
|
|
7848
|
+
for (const error of migration.errors) {
|
|
7849
|
+
printWarning(
|
|
7850
|
+
`Could not migrate ${error.agent} sessions: ${error.message}. Original sessions were left unchanged.`
|
|
7851
|
+
);
|
|
7852
|
+
}
|
|
7853
|
+
}
|
|
7854
|
+
function emitAgentPrompt(client, prompt, writeToStdout, subject) {
|
|
7855
|
+
const copied = copyToClipboard(prompt);
|
|
7856
|
+
if (writeToStdout) {
|
|
7857
|
+
printStatus(
|
|
7858
|
+
`Generated the ${subject} prompt${copied ? " (also copied to clipboard)" : ""}.`
|
|
7859
|
+
);
|
|
7860
|
+
client.stdout.write(`${prompt}
|
|
7861
|
+
`);
|
|
7862
|
+
} else if (copied) {
|
|
7863
|
+
printStatus(
|
|
7864
|
+
`Prompt copied. Paste it into your coding agent for the ${subject}.`
|
|
7865
|
+
);
|
|
7866
|
+
} else {
|
|
7867
|
+
printStatus("Could not access the clipboard. Prompt printed below:");
|
|
7868
|
+
client.stdout.write(`${prompt}
|
|
7869
|
+
`);
|
|
7870
|
+
}
|
|
6921
7871
|
}
|
|
6922
7872
|
function buildConsentCommand(argv, consentFlags) {
|
|
6923
7873
|
const args = stripSensitiveAuthArgs(argv.slice(2));
|
|
@@ -7332,7 +8282,7 @@ async function models(client) {
|
|
|
7332
8282
|
|
|
7333
8283
|
// src/commands/ai-gateway/leaderboard-shared.ts
|
|
7334
8284
|
var import_chalk25 = __toESM(require_source(), 1);
|
|
7335
|
-
import { writeFile as
|
|
8285
|
+
import { writeFile as writeFile5 } from "fs/promises";
|
|
7336
8286
|
|
|
7337
8287
|
// src/util/ai-gateway/leaderboard.ts
|
|
7338
8288
|
var DEFAULT_LEADERBOARD_BASE = "https://vercel.com";
|
|
@@ -7446,7 +8396,7 @@ async function fetchWithSpinner(fetch3, spinnerText) {
|
|
|
7446
8396
|
async function writeToFile(client, out, content, label) {
|
|
7447
8397
|
const writeStamp = stamp_default();
|
|
7448
8398
|
try {
|
|
7449
|
-
await
|
|
8399
|
+
await writeFile5(out, content);
|
|
7450
8400
|
} catch (err) {
|
|
7451
8401
|
output_manager_default.error(
|
|
7452
8402
|
`Failed to write ${out}: ${err instanceof Error ? err.message : String(err)}`
|
|
@@ -8375,17 +9325,17 @@ ${extra}` : helpOutput);
|
|
|
8375
9325
|
switch (subcommand) {
|
|
8376
9326
|
case "inspect": {
|
|
8377
9327
|
telemetry2.trackCliSubcommandInspect(subcommandOriginal);
|
|
8378
|
-
const inspectFn = (await import("./chunks/inspect-
|
|
9328
|
+
const inspectFn = (await import("./chunks/inspect-JPZFHGAF.js")).default;
|
|
8379
9329
|
return inspectFn(client, rawSubcommandArgs);
|
|
8380
9330
|
}
|
|
8381
9331
|
case "rules": {
|
|
8382
9332
|
telemetry2.trackCliSubcommandRules(args[0] ?? "ls");
|
|
8383
|
-
const rulesFn = (await import("./chunks/rules-
|
|
9333
|
+
const rulesFn = (await import("./chunks/rules-FNA3NXZZ.js")).default;
|
|
8384
9334
|
return rulesFn(client, rawSubcommandArgs);
|
|
8385
9335
|
}
|
|
8386
9336
|
default: {
|
|
8387
9337
|
telemetry2.trackCliSubcommandLs(subcommandOriginal);
|
|
8388
|
-
const listFn = (await import("./chunks/list-
|
|
9338
|
+
const listFn = (await import("./chunks/list-ESW6P765.js")).default;
|
|
8389
9339
|
return listFn(client, telemetry2);
|
|
8390
9340
|
}
|
|
8391
9341
|
}
|
|
@@ -9367,8 +10317,8 @@ var BisectTelemetryClient = class extends TelemetryClient {
|
|
|
9367
10317
|
});
|
|
9368
10318
|
}
|
|
9369
10319
|
}
|
|
9370
|
-
trackCliFlagOpen(
|
|
9371
|
-
if (
|
|
10320
|
+
trackCliFlagOpen(open16) {
|
|
10321
|
+
if (open16) {
|
|
9372
10322
|
this.trackCliFlag("open");
|
|
9373
10323
|
}
|
|
9374
10324
|
}
|
|
@@ -9661,11 +10611,11 @@ var BlobListTelemetryClient = class extends TelemetryClient {
|
|
|
9661
10611
|
});
|
|
9662
10612
|
}
|
|
9663
10613
|
}
|
|
9664
|
-
trackCliOptionCursor(
|
|
9665
|
-
if (
|
|
10614
|
+
trackCliOptionCursor(cursor2) {
|
|
10615
|
+
if (cursor2) {
|
|
9666
10616
|
this.trackCliOption({
|
|
9667
10617
|
option: "cursor",
|
|
9668
|
-
value:
|
|
10618
|
+
value: cursor2
|
|
9669
10619
|
});
|
|
9670
10620
|
}
|
|
9671
10621
|
}
|
|
@@ -9828,12 +10778,12 @@ async function list9(client, argv, auth) {
|
|
|
9828
10778
|
}
|
|
9829
10779
|
const {
|
|
9830
10780
|
"--limit": limit,
|
|
9831
|
-
"--cursor":
|
|
10781
|
+
"--cursor": cursor2,
|
|
9832
10782
|
"--prefix": prefix,
|
|
9833
10783
|
"--mode": modeFlag
|
|
9834
10784
|
} = flags;
|
|
9835
10785
|
telemetryClient.trackCliOptionLimit(limit);
|
|
9836
|
-
telemetryClient.trackCliOptionCursor(
|
|
10786
|
+
telemetryClient.trackCliOptionCursor(cursor2);
|
|
9837
10787
|
telemetryClient.trackCliOptionPrefix(prefix);
|
|
9838
10788
|
telemetryClient.trackCliOptionMode(modeFlag);
|
|
9839
10789
|
const mode = modeFlag ?? "expanded";
|
|
@@ -9850,7 +10800,7 @@ async function list9(client, argv, auth) {
|
|
|
9850
10800
|
list21 = await blob.list({
|
|
9851
10801
|
...blobOpts(auth),
|
|
9852
10802
|
limit: limit ?? 10,
|
|
9853
|
-
cursor,
|
|
10803
|
+
cursor: cursor2,
|
|
9854
10804
|
mode,
|
|
9855
10805
|
prefix
|
|
9856
10806
|
});
|
|
@@ -10159,8 +11109,8 @@ var BlobTelemetryClient = class extends TelemetryClient {
|
|
|
10159
11109
|
import * as blob2 from "@vercel/blob";
|
|
10160
11110
|
var import_error_utils = __toESM(require_dist(), 1);
|
|
10161
11111
|
import { statSync } from "fs";
|
|
10162
|
-
import { open as
|
|
10163
|
-
import { basename } from "path";
|
|
11112
|
+
import { open as open3 } from "fs/promises";
|
|
11113
|
+
import { basename as basename2 } from "path";
|
|
10164
11114
|
var import_chalk35 = __toESM(require_source(), 1);
|
|
10165
11115
|
|
|
10166
11116
|
// src/util/telemetry/commands/blob/put.ts
|
|
@@ -10327,9 +11277,9 @@ async function put2(client, argv, auth) {
|
|
|
10327
11277
|
const stats = statSync(filePath);
|
|
10328
11278
|
const isFile = stats.isFile();
|
|
10329
11279
|
if (isFile) {
|
|
10330
|
-
const file = await
|
|
11280
|
+
const file = await open3(filePath, "r");
|
|
10331
11281
|
putBody = file.createReadStream();
|
|
10332
|
-
pathname = pathnameFlag ??
|
|
11282
|
+
pathname = pathnameFlag ?? basename2(filePath);
|
|
10333
11283
|
} else {
|
|
10334
11284
|
output_manager_default.error("Path to upload is not a file");
|
|
10335
11285
|
return 1;
|
|
@@ -10418,9 +11368,9 @@ var BlobGetTelemetryClient = class extends TelemetryClient {
|
|
|
10418
11368
|
|
|
10419
11369
|
// src/commands/blob/get.ts
|
|
10420
11370
|
var import_bytes = __toESM(require_bytes(), 1);
|
|
10421
|
-
import { createWriteStream } from "fs";
|
|
11371
|
+
import { createWriteStream as createWriteStream2 } from "fs";
|
|
10422
11372
|
import { Readable } from "stream";
|
|
10423
|
-
import { pipeline } from "stream/promises";
|
|
11373
|
+
import { pipeline as pipeline2 } from "stream/promises";
|
|
10424
11374
|
async function get2(client, argv, auth) {
|
|
10425
11375
|
const telemetryClient = new BlobGetTelemetryClient({
|
|
10426
11376
|
opts: {
|
|
@@ -10477,14 +11427,14 @@ async function get2(client, argv, auth) {
|
|
|
10477
11427
|
}
|
|
10478
11428
|
const nodeStream = Readable.fromWeb(result.stream);
|
|
10479
11429
|
if (outputPath) {
|
|
10480
|
-
const writeStream =
|
|
10481
|
-
await
|
|
11430
|
+
const writeStream = createWriteStream2(outputPath);
|
|
11431
|
+
await pipeline2(nodeStream, writeStream);
|
|
10482
11432
|
output_manager_default.stopSpinner();
|
|
10483
11433
|
const sizeInfo = result.blob.size ? ` (${(0, import_bytes.default)(result.blob.size)})` : "";
|
|
10484
11434
|
const typeInfo = result.blob.contentType ? `, ${result.blob.contentType}` : "";
|
|
10485
11435
|
output_manager_default.success(`Saved to ${outputPath}${sizeInfo}${typeInfo}`);
|
|
10486
11436
|
} else {
|
|
10487
|
-
await
|
|
11437
|
+
await pipeline2(nodeStream, client.stdout, { end: false });
|
|
10488
11438
|
}
|
|
10489
11439
|
} catch (err) {
|
|
10490
11440
|
output_manager_default.stopSpinner();
|
|
@@ -10960,12 +11910,12 @@ async function addStore(client, argv) {
|
|
|
10960
11910
|
telemetryClient.trackCliArgumentName(name);
|
|
10961
11911
|
telemetryClient.trackCliOptionAccess(accessFlag);
|
|
10962
11912
|
telemetryClient.trackCliOptionRegion(flags["--region"]);
|
|
10963
|
-
const
|
|
10964
|
-
if (
|
|
11913
|
+
const link2 = await getLinkedProject(client);
|
|
11914
|
+
if (link2.status === "linked" && client.nonInteractive && !yes && !environmentFlags?.length) {
|
|
10965
11915
|
outputAgentError(client, {
|
|
10966
11916
|
status: "error",
|
|
10967
11917
|
reason: "confirmation_required",
|
|
10968
|
-
message: `Creating a blob store and linking it to ${
|
|
11918
|
+
message: `Creating a blob store and linking it to ${link2.project.name} requires confirmation. Re-run with --yes to create the store and link it to all environments, or pass --environment to choose which ones.`,
|
|
10969
11919
|
next: [
|
|
10970
11920
|
{
|
|
10971
11921
|
command: buildCommandWithYes(client.argv),
|
|
@@ -10986,7 +11936,7 @@ async function addStore(client, argv) {
|
|
|
10986
11936
|
method: "POST",
|
|
10987
11937
|
headers: { "Content-Type": "application/json" },
|
|
10988
11938
|
body: JSON.stringify({ name, region, access: access4 }),
|
|
10989
|
-
accountId:
|
|
11939
|
+
accountId: link2.status === "linked" ? link2.org.id : void 0
|
|
10990
11940
|
}
|
|
10991
11941
|
);
|
|
10992
11942
|
storeId = res.store.id;
|
|
@@ -11000,17 +11950,17 @@ async function addStore(client, argv) {
|
|
|
11000
11950
|
output_manager_default.success(`Blob store created: ${name} (${storeId})${regionInfo}`);
|
|
11001
11951
|
const docsUrl = access4 === "public" ? "https://vercel.com/docs/vercel-blob/public-storage" : "https://vercel.com/docs/vercel-blob/private-storage";
|
|
11002
11952
|
output_manager_default.log(`Access: ${access4}. Learn more: ${output_manager_default.link(docsUrl, docsUrl)}`);
|
|
11003
|
-
if (
|
|
11953
|
+
if (link2.status === "linked") {
|
|
11004
11954
|
let shouldLink = yes || Boolean(environmentFlags?.length);
|
|
11005
11955
|
if (!shouldLink && interactive) {
|
|
11006
11956
|
shouldLink = await client.input.confirm(
|
|
11007
|
-
`Would you like to link this blob store to ${
|
|
11957
|
+
`Would you like to link this blob store to ${link2.project.name}?`,
|
|
11008
11958
|
true
|
|
11009
11959
|
);
|
|
11010
11960
|
}
|
|
11011
11961
|
if (!shouldLink && !interactive) {
|
|
11012
11962
|
output_manager_default.log(
|
|
11013
|
-
`Not linked to ${import_chalk37.default.bold(
|
|
11963
|
+
`Not linked to ${import_chalk37.default.bold(link2.project.name)}. Pass --yes when creating to link the store to your project automatically.`
|
|
11014
11964
|
);
|
|
11015
11965
|
}
|
|
11016
11966
|
if (shouldLink) {
|
|
@@ -11030,27 +11980,27 @@ async function addStore(client, argv) {
|
|
|
11030
11980
|
environments = [...VALID_ENVIRONMENTS];
|
|
11031
11981
|
}
|
|
11032
11982
|
output_manager_default.spinner(
|
|
11033
|
-
`Connecting ${import_chalk37.default.bold(name)} to ${import_chalk37.default.bold(
|
|
11983
|
+
`Connecting ${import_chalk37.default.bold(name)} to ${import_chalk37.default.bold(link2.project.name)}...`
|
|
11034
11984
|
);
|
|
11035
11985
|
await connectResourceToProject(
|
|
11036
11986
|
client,
|
|
11037
|
-
|
|
11987
|
+
link2.project.id,
|
|
11038
11988
|
storeId,
|
|
11039
11989
|
environments,
|
|
11040
|
-
{ accountId:
|
|
11990
|
+
{ accountId: link2.org.id }
|
|
11041
11991
|
);
|
|
11042
11992
|
output_manager_default.success(
|
|
11043
11993
|
`Blob store ${import_chalk37.default.bold(name)} linked to ${import_chalk37.default.bold(
|
|
11044
|
-
|
|
11994
|
+
link2.project.name
|
|
11045
11995
|
)}`
|
|
11046
11996
|
);
|
|
11047
|
-
client.config.currentTeam =
|
|
11997
|
+
client.config.currentTeam = link2.org.type === "team" ? link2.org.id : void 0;
|
|
11048
11998
|
await envPullCommandLogic(
|
|
11049
11999
|
client,
|
|
11050
12000
|
".env.local",
|
|
11051
12001
|
true,
|
|
11052
12002
|
"development",
|
|
11053
|
-
|
|
12003
|
+
link2,
|
|
11054
12004
|
void 0,
|
|
11055
12005
|
client.cwd,
|
|
11056
12006
|
"vercel-cli:blob:store-add"
|
|
@@ -11128,8 +12078,8 @@ async function removeStore(client, argv, rwToken) {
|
|
|
11128
12078
|
return 1;
|
|
11129
12079
|
}
|
|
11130
12080
|
}
|
|
11131
|
-
const
|
|
11132
|
-
const accountId =
|
|
12081
|
+
const link2 = await getLinkedProject(client);
|
|
12082
|
+
const accountId = link2.status === "linked" ? link2.org.id : void 0;
|
|
11133
12083
|
try {
|
|
11134
12084
|
const [store, connectionsResponse] = await Promise.all([
|
|
11135
12085
|
client.fetch(
|
|
@@ -11194,14 +12144,14 @@ async function removeStore(client, argv, rwToken) {
|
|
|
11194
12144
|
}
|
|
11195
12145
|
output_manager_default.stopSpinner();
|
|
11196
12146
|
output_manager_default.success("Blob store deleted");
|
|
11197
|
-
if (
|
|
11198
|
-
client.config.currentTeam =
|
|
12147
|
+
if (link2.status === "linked") {
|
|
12148
|
+
client.config.currentTeam = link2.org.type === "team" ? link2.org.id : void 0;
|
|
11199
12149
|
await envPullCommandLogic(
|
|
11200
12150
|
client,
|
|
11201
12151
|
".env.local",
|
|
11202
12152
|
true,
|
|
11203
12153
|
"development",
|
|
11204
|
-
|
|
12154
|
+
link2,
|
|
11205
12155
|
void 0,
|
|
11206
12156
|
client.cwd,
|
|
11207
12157
|
"vercel-cli:blob:store-remove"
|
|
@@ -11249,8 +12199,8 @@ function formatStoreDetails(store, teamSlug) {
|
|
|
11249
12199
|
);
|
|
11250
12200
|
if (teamSlug) {
|
|
11251
12201
|
const dashboardUrl = `https://vercel.com/${teamSlug}/~/stores/blob/${store.id}`;
|
|
11252
|
-
const
|
|
11253
|
-
lines.push(`Dashboard: ${
|
|
12202
|
+
const link2 = output_manager_default.link(dashboardUrl, dashboardUrl);
|
|
12203
|
+
lines.push(`Dashboard: ${link2 || dashboardUrl}`);
|
|
11254
12204
|
}
|
|
11255
12205
|
lines.push(
|
|
11256
12206
|
`Created At: ${(0, import_format5.default)(new Date(store.createdAt), dateTimeFormat)}`
|
|
@@ -11318,10 +12268,10 @@ async function getStore(client, argv, rwToken) {
|
|
|
11318
12268
|
}
|
|
11319
12269
|
telemetryClient.trackCliArgumentStoreId(storeId);
|
|
11320
12270
|
try {
|
|
11321
|
-
const
|
|
12271
|
+
const link2 = await getLinkedProject(client);
|
|
11322
12272
|
output_manager_default.debug("Getting blob store");
|
|
11323
12273
|
output_manager_default.spinner("Getting blob store");
|
|
11324
|
-
const accountId =
|
|
12274
|
+
const accountId = link2.status === "linked" ? link2.org.id : void 0;
|
|
11325
12275
|
const store = await client.fetch(
|
|
11326
12276
|
`/v1/storage/stores/${storeId}`,
|
|
11327
12277
|
{
|
|
@@ -11329,7 +12279,7 @@ async function getStore(client, argv, rwToken) {
|
|
|
11329
12279
|
accountId
|
|
11330
12280
|
}
|
|
11331
12281
|
);
|
|
11332
|
-
let teamSlug =
|
|
12282
|
+
let teamSlug = link2.status === "linked" ? link2.org.slug : void 0;
|
|
11333
12283
|
if (!teamSlug) {
|
|
11334
12284
|
const { team } = await getScope(client);
|
|
11335
12285
|
teamSlug = team?.slug;
|
|
@@ -11612,8 +12562,8 @@ async function emptyStore(client, argv, auth) {
|
|
|
11612
12562
|
return 1;
|
|
11613
12563
|
}
|
|
11614
12564
|
try {
|
|
11615
|
-
const
|
|
11616
|
-
const accountId =
|
|
12565
|
+
const link2 = await getLinkedProject(client);
|
|
12566
|
+
const accountId = link2.status === "linked" ? link2.org.id : void 0;
|
|
11617
12567
|
const [storeResponse, connectionsResponse, initialList] = await Promise.all(
|
|
11618
12568
|
[
|
|
11619
12569
|
client.fetch(
|
|
@@ -12469,22 +13419,22 @@ async function purchaseCustomEnvironmentCapacity(client, {
|
|
|
12469
13419
|
commandName
|
|
12470
13420
|
}) {
|
|
12471
13421
|
const { cwd } = client;
|
|
12472
|
-
const
|
|
13422
|
+
const link2 = await ensureLink(commandName, client, cwd, {
|
|
12473
13423
|
autoConfirm: yes,
|
|
12474
13424
|
projectName,
|
|
12475
13425
|
failIfNotFound: Boolean(projectName)
|
|
12476
13426
|
});
|
|
12477
|
-
if (typeof
|
|
12478
|
-
return
|
|
13427
|
+
if (typeof link2 === "number") {
|
|
13428
|
+
return link2;
|
|
12479
13429
|
}
|
|
12480
|
-
const projectId =
|
|
12481
|
-
const projectNameResolved =
|
|
13430
|
+
const projectId = link2.project.id;
|
|
13431
|
+
const projectNameResolved = link2.project.name;
|
|
12482
13432
|
output_manager_default.spinner("Fetching custom environment settings");
|
|
12483
13433
|
let settings;
|
|
12484
13434
|
try {
|
|
12485
13435
|
settings = await client.fetch(
|
|
12486
13436
|
`/v1/projects/custom-environments/settings?projectId=${encodeURIComponent(projectId)}`,
|
|
12487
|
-
{ accountId:
|
|
13437
|
+
{ accountId: link2.org.id }
|
|
12488
13438
|
);
|
|
12489
13439
|
} catch (err) {
|
|
12490
13440
|
output_manager_default.stopSpinner();
|
|
@@ -12533,7 +13483,7 @@ async function purchaseCustomEnvironmentCapacity(client, {
|
|
|
12533
13483
|
{
|
|
12534
13484
|
method: "POST",
|
|
12535
13485
|
body: { purchasedAmount },
|
|
12536
|
-
accountId:
|
|
13486
|
+
accountId: link2.org.id
|
|
12537
13487
|
}
|
|
12538
13488
|
);
|
|
12539
13489
|
output_manager_default.stopSpinner();
|
|
@@ -13145,20 +14095,20 @@ async function purge(client, argv) {
|
|
|
13145
14095
|
}
|
|
13146
14096
|
const projectName = parsedArgs.flags["--project"];
|
|
13147
14097
|
telemetry2.trackCliOptionProject(projectName);
|
|
13148
|
-
const
|
|
14098
|
+
const link2 = await resolveProjectContext({
|
|
13149
14099
|
client,
|
|
13150
14100
|
projectNameOrId: projectName
|
|
13151
14101
|
});
|
|
13152
|
-
if (
|
|
14102
|
+
if (link2.status === "not_linked") {
|
|
13153
14103
|
output_manager_default.error(
|
|
13154
14104
|
"No project linked. Run `vercel link` to link a project to this directory."
|
|
13155
14105
|
);
|
|
13156
14106
|
return 1;
|
|
13157
14107
|
}
|
|
13158
|
-
if (
|
|
13159
|
-
return
|
|
14108
|
+
if (link2.status === "error") {
|
|
14109
|
+
return link2.exitCode;
|
|
13160
14110
|
}
|
|
13161
|
-
const { project, org } =
|
|
14111
|
+
const { project, org } = link2;
|
|
13162
14112
|
client.config.currentTeam = org.type === "team" ? org.id : void 0;
|
|
13163
14113
|
const yes = Boolean(parsedArgs.flags["--yes"]);
|
|
13164
14114
|
telemetry2.trackCliFlagYes(yes);
|
|
@@ -13268,20 +14218,20 @@ async function invalidate(client, argv) {
|
|
|
13268
14218
|
}
|
|
13269
14219
|
const projectName = parsedArgs.flags["--project"];
|
|
13270
14220
|
telemetry2.trackCliOptionProject(projectName);
|
|
13271
|
-
const
|
|
14221
|
+
const link2 = await resolveProjectContext({
|
|
13272
14222
|
client,
|
|
13273
14223
|
projectNameOrId: projectName
|
|
13274
14224
|
});
|
|
13275
|
-
if (
|
|
14225
|
+
if (link2.status === "not_linked") {
|
|
13276
14226
|
output_manager_default.error(
|
|
13277
14227
|
"No project linked. Run `vercel link` to link a project to this directory."
|
|
13278
14228
|
);
|
|
13279
14229
|
return 1;
|
|
13280
14230
|
}
|
|
13281
|
-
if (
|
|
13282
|
-
return
|
|
14231
|
+
if (link2.status === "error") {
|
|
14232
|
+
return link2.exitCode;
|
|
13283
14233
|
}
|
|
13284
|
-
const { project, org } =
|
|
14234
|
+
const { project, org } = link2;
|
|
13285
14235
|
client.config.currentTeam = org.type === "team" ? org.id : void 0;
|
|
13286
14236
|
const yes = Boolean(parsedArgs.flags["--yes"]);
|
|
13287
14237
|
const tag = parsedArgs.flags["--tag"];
|
|
@@ -13398,20 +14348,20 @@ async function dangerouslyDelete(client, argv) {
|
|
|
13398
14348
|
}
|
|
13399
14349
|
const projectName = parsedArgs.flags["--project"];
|
|
13400
14350
|
telemetry2.trackCliOptionProject(projectName);
|
|
13401
|
-
const
|
|
14351
|
+
const link2 = await resolveProjectContext({
|
|
13402
14352
|
client,
|
|
13403
14353
|
projectNameOrId: projectName
|
|
13404
14354
|
});
|
|
13405
|
-
if (
|
|
14355
|
+
if (link2.status === "not_linked") {
|
|
13406
14356
|
output_manager_default.error(
|
|
13407
14357
|
"No project linked. Run `vercel link` to link a project to this directory."
|
|
13408
14358
|
);
|
|
13409
14359
|
return 1;
|
|
13410
14360
|
}
|
|
13411
|
-
if (
|
|
13412
|
-
return
|
|
14361
|
+
if (link2.status === "error") {
|
|
14362
|
+
return link2.exitCode;
|
|
13413
14363
|
}
|
|
13414
|
-
const { project, org } =
|
|
14364
|
+
const { project, org } = link2;
|
|
13415
14365
|
client.config.currentTeam = org.type === "team" ? org.id : void 0;
|
|
13416
14366
|
const yes = Boolean(parsedArgs.flags["--yes"]);
|
|
13417
14367
|
const tag = parsedArgs.flags["--tag"];
|
|
@@ -13749,43 +14699,43 @@ async function comments(client) {
|
|
|
13749
14699
|
if (handleHelp(inspectSubcommand4))
|
|
13750
14700
|
return 0;
|
|
13751
14701
|
telemetry2.trackCliSubcommandInspect(subcommandOriginal);
|
|
13752
|
-
return (await import("./chunks/inspect-
|
|
14702
|
+
return (await import("./chunks/inspect-4YTOMOOP.js")).default(client, telemetry2);
|
|
13753
14703
|
}
|
|
13754
14704
|
case "open": {
|
|
13755
14705
|
if (handleHelp(openSubcommand))
|
|
13756
14706
|
return 0;
|
|
13757
14707
|
telemetry2.trackCliSubcommandOpen(subcommandOriginal);
|
|
13758
|
-
return (await import("./chunks/open-
|
|
14708
|
+
return (await import("./chunks/open-SZDSII6L.js")).default(client, telemetry2);
|
|
13759
14709
|
}
|
|
13760
14710
|
case "reply": {
|
|
13761
14711
|
if (handleHelp(replySubcommand))
|
|
13762
14712
|
return 0;
|
|
13763
14713
|
telemetry2.trackCliSubcommandReply(subcommandOriginal);
|
|
13764
|
-
return (await import("./chunks/reply-
|
|
14714
|
+
return (await import("./chunks/reply-S3UUI6C6.js")).default(client, telemetry2);
|
|
13765
14715
|
}
|
|
13766
14716
|
case "resolve": {
|
|
13767
14717
|
if (handleHelp(resolveSubcommand))
|
|
13768
14718
|
return 0;
|
|
13769
14719
|
telemetry2.trackCliSubcommandResolve(subcommandOriginal);
|
|
13770
|
-
return (await import("./chunks/resolve-
|
|
14720
|
+
return (await import("./chunks/resolve-PCBDK47N.js")).default(client, telemetry2, true);
|
|
13771
14721
|
}
|
|
13772
14722
|
case "reopen": {
|
|
13773
14723
|
if (handleHelp(reopenSubcommand))
|
|
13774
14724
|
return 0;
|
|
13775
14725
|
telemetry2.trackCliSubcommandReopen(subcommandOriginal);
|
|
13776
|
-
return (await import("./chunks/resolve-
|
|
14726
|
+
return (await import("./chunks/resolve-PCBDK47N.js")).default(client, telemetry2, false);
|
|
13777
14727
|
}
|
|
13778
14728
|
case "edit": {
|
|
13779
14729
|
if (handleHelp(editSubcommand))
|
|
13780
14730
|
return 0;
|
|
13781
14731
|
telemetry2.trackCliSubcommandEdit(subcommandOriginal);
|
|
13782
|
-
return (await import("./chunks/edit-
|
|
14732
|
+
return (await import("./chunks/edit-HKQEFIOY.js")).default(client, telemetry2);
|
|
13783
14733
|
}
|
|
13784
14734
|
case "delete": {
|
|
13785
14735
|
if (handleHelp(deleteSubcommand))
|
|
13786
14736
|
return 0;
|
|
13787
14737
|
telemetry2.trackCliSubcommandDelete(subcommandOriginal);
|
|
13788
|
-
return (await import("./chunks/delete-
|
|
14738
|
+
return (await import("./chunks/delete-NAZTL2IK.js")).default(client, telemetry2);
|
|
13789
14739
|
}
|
|
13790
14740
|
default: {
|
|
13791
14741
|
if (needHelp) {
|
|
@@ -13801,7 +14751,7 @@ async function comments(client) {
|
|
|
13801
14751
|
}
|
|
13802
14752
|
telemetry2.trackCliSubcommandList(subcommandOriginal);
|
|
13803
14753
|
const defaultInvocation = subcommandOriginal === "default";
|
|
13804
|
-
return (await import("./chunks/list-
|
|
14754
|
+
return (await import("./chunks/list-T7LXP6VX.js")).default(
|
|
13805
14755
|
client,
|
|
13806
14756
|
telemetry2,
|
|
13807
14757
|
defaultInvocation
|
|
@@ -14016,6 +14966,14 @@ var ConnexTelemetryClient = class extends TelemetryClient {
|
|
|
14016
14966
|
});
|
|
14017
14967
|
}
|
|
14018
14968
|
}
|
|
14969
|
+
trackCliOptionTriggerProject(v) {
|
|
14970
|
+
if (v) {
|
|
14971
|
+
this.trackCliOption({
|
|
14972
|
+
option: "trigger-project",
|
|
14973
|
+
value: this.redactedValue
|
|
14974
|
+
});
|
|
14975
|
+
}
|
|
14976
|
+
}
|
|
14019
14977
|
trackCliFlagMyTokens(v) {
|
|
14020
14978
|
if (v) {
|
|
14021
14979
|
this.trackCliFlag("my-tokens");
|
|
@@ -14118,7 +15076,7 @@ var ConnexTelemetryClient = class extends TelemetryClient {
|
|
|
14118
15076
|
|
|
14119
15077
|
// src/commands/connex/create.ts
|
|
14120
15078
|
var import_open3 = __toESM(require_open(), 1);
|
|
14121
|
-
import { readFile as
|
|
15079
|
+
import { readFile as readFile5 } from "fs/promises";
|
|
14122
15080
|
import { resolve as resolve5 } from "path";
|
|
14123
15081
|
import { text } from "stream/consumers";
|
|
14124
15082
|
|
|
@@ -14140,13 +15098,13 @@ async function selectConnexTeam(client, message) {
|
|
|
14140
15098
|
}
|
|
14141
15099
|
|
|
14142
15100
|
// src/util/connex/request-code.ts
|
|
14143
|
-
import { randomBytes, createHash } from "crypto";
|
|
15101
|
+
import { randomBytes, createHash as createHash2 } from "crypto";
|
|
14144
15102
|
var POLL_INTERVAL_MS = 2e3;
|
|
14145
15103
|
var MAX_POLL_DURATION_MS = 115 * 60 * 1e3;
|
|
14146
15104
|
var MAX_EARLY_404_COUNT = 3;
|
|
14147
15105
|
function generateRequestCode() {
|
|
14148
15106
|
const verifier = randomBytes(37).toString("base64url");
|
|
14149
|
-
const requestCode =
|
|
15107
|
+
const requestCode = createHash2("sha256").update(verifier).digest("base64url");
|
|
14150
15108
|
return { verifier, requestCode };
|
|
14151
15109
|
}
|
|
14152
15110
|
async function awaitConnexResult(client, verifier) {
|
|
@@ -14201,9 +15159,9 @@ async function awaitConnexResult(client, verifier) {
|
|
|
14201
15159
|
}
|
|
14202
15160
|
|
|
14203
15161
|
// src/util/connex/upload-icon.ts
|
|
14204
|
-
import { readFile as
|
|
15162
|
+
import { readFile as readFile4, stat as stat3 } from "fs/promises";
|
|
14205
15163
|
import { resolve as resolve4 } from "path";
|
|
14206
|
-
import { createHash as
|
|
15164
|
+
import { createHash as createHash3 } from "crypto";
|
|
14207
15165
|
var MAX_ICON_BYTES = 5 * 1024 * 1024;
|
|
14208
15166
|
var MIN_IMAGE_BYTES = 12;
|
|
14209
15167
|
var IMAGE_SIGNATURES = [
|
|
@@ -14231,7 +15189,7 @@ async function prepareConnexIcon(filePath, cwd) {
|
|
|
14231
15189
|
const absPath = resolve4(cwd, filePath);
|
|
14232
15190
|
let size;
|
|
14233
15191
|
try {
|
|
14234
|
-
size = (await
|
|
15192
|
+
size = (await stat3(absPath)).size;
|
|
14235
15193
|
} catch (err) {
|
|
14236
15194
|
throw new Error(
|
|
14237
15195
|
`Could not read icon file at "${filePath}": ${err.message}`
|
|
@@ -14244,7 +15202,7 @@ async function prepareConnexIcon(filePath, cwd) {
|
|
|
14244
15202
|
}
|
|
14245
15203
|
let buf;
|
|
14246
15204
|
try {
|
|
14247
|
-
buf = await
|
|
15205
|
+
buf = await readFile4(absPath);
|
|
14248
15206
|
} catch (err) {
|
|
14249
15207
|
throw new Error(
|
|
14250
15208
|
`Could not read icon file at "${filePath}": ${err.message}`
|
|
@@ -14253,7 +15211,7 @@ async function prepareConnexIcon(filePath, cwd) {
|
|
|
14253
15211
|
if (!isImageBuffer(buf)) {
|
|
14254
15212
|
throw new Error(`Icon file at "${filePath}" is not a PNG or JPEG.`);
|
|
14255
15213
|
}
|
|
14256
|
-
const sha =
|
|
15214
|
+
const sha = createHash3("sha1").update(new Uint8Array(buf)).digest("hex");
|
|
14257
15215
|
return { buf, sha };
|
|
14258
15216
|
}
|
|
14259
15217
|
async function uploadConnexIcon(client, prepared) {
|
|
@@ -14747,6 +15705,40 @@ async function create2(client, args, flags) {
|
|
|
14747
15705
|
output_manager_default.error("The --trigger-event flag requires --triggers.");
|
|
14748
15706
|
return 1;
|
|
14749
15707
|
}
|
|
15708
|
+
const triggerPath = flags["--trigger-path"];
|
|
15709
|
+
const triggerProject = flags["--trigger-project"];
|
|
15710
|
+
const triggerBranch = flags["--trigger-branch"];
|
|
15711
|
+
const triggerEnvironment = flags["--trigger-environment"];
|
|
15712
|
+
if (!flags["--triggers"] && (triggerPath !== void 0 || triggerProject !== void 0 || triggerBranch !== void 0 || triggerEnvironment !== void 0)) {
|
|
15713
|
+
output_manager_default.error(
|
|
15714
|
+
"The --trigger-project, --trigger-path, --trigger-branch, and --trigger-environment flags require --triggers."
|
|
15715
|
+
);
|
|
15716
|
+
return 1;
|
|
15717
|
+
}
|
|
15718
|
+
if (triggerBranch !== void 0 && triggerEnvironment !== void 0) {
|
|
15719
|
+
output_manager_default.error(
|
|
15720
|
+
"The --trigger-branch and --trigger-environment flags are mutually exclusive."
|
|
15721
|
+
);
|
|
15722
|
+
return 1;
|
|
15723
|
+
}
|
|
15724
|
+
if (triggerProject !== void 0 && triggerProject.trim() === "") {
|
|
15725
|
+
output_manager_default.error("The --trigger-project value must not be empty.");
|
|
15726
|
+
return 1;
|
|
15727
|
+
}
|
|
15728
|
+
if (triggerPath !== void 0 && (triggerPath.length === 0 || triggerPath.length > 2048)) {
|
|
15729
|
+
output_manager_default.error(
|
|
15730
|
+
"The --trigger-path value must be between 1 and 2048 characters."
|
|
15731
|
+
);
|
|
15732
|
+
return 1;
|
|
15733
|
+
}
|
|
15734
|
+
if (triggerBranch !== void 0 && triggerBranch.trim() === "") {
|
|
15735
|
+
output_manager_default.error("The --trigger-branch value must not be empty.");
|
|
15736
|
+
return 1;
|
|
15737
|
+
}
|
|
15738
|
+
if (triggerEnvironment !== void 0 && triggerEnvironment.trim() === "") {
|
|
15739
|
+
output_manager_default.error("The --trigger-environment value must not be empty.");
|
|
15740
|
+
return 1;
|
|
15741
|
+
}
|
|
14750
15742
|
const dataFlag = flags["--data"];
|
|
14751
15743
|
const connectorType = flags["--connector-type"];
|
|
14752
15744
|
const connectionMethodFlag = flags["--connection-method"];
|
|
@@ -14827,6 +15819,60 @@ async function create2(client, args, flags) {
|
|
|
14827
15819
|
client,
|
|
14828
15820
|
"Select the team where you want to create this connector"
|
|
14829
15821
|
);
|
|
15822
|
+
const link2 = await getProjectLink(client, client.cwd);
|
|
15823
|
+
let triggerProjectId;
|
|
15824
|
+
if (triggerProject !== void 0) {
|
|
15825
|
+
output_manager_default.spinner("Looking up trigger destination project\u2026");
|
|
15826
|
+
try {
|
|
15827
|
+
const resolvedProject = await getProjectByNameOrId(
|
|
15828
|
+
client,
|
|
15829
|
+
triggerProject,
|
|
15830
|
+
client.config.currentTeam
|
|
15831
|
+
);
|
|
15832
|
+
output_manager_default.stopSpinner();
|
|
15833
|
+
if (resolvedProject instanceof ProjectNotFound) {
|
|
15834
|
+
output_manager_default.error(
|
|
15835
|
+
`Trigger destination project ${triggerProject} was not found. Check the name/ID and try again.`
|
|
15836
|
+
);
|
|
15837
|
+
return 1;
|
|
15838
|
+
}
|
|
15839
|
+
triggerProjectId = resolvedProject.id;
|
|
15840
|
+
} catch (err) {
|
|
15841
|
+
output_manager_default.stopSpinner();
|
|
15842
|
+
printError(err);
|
|
15843
|
+
return 1;
|
|
15844
|
+
}
|
|
15845
|
+
}
|
|
15846
|
+
const destinationProjectId = triggerProjectId ?? link2?.projectId;
|
|
15847
|
+
if ((triggerPath !== void 0 || triggerProject !== void 0 || triggerBranch !== void 0 || triggerEnvironment !== void 0) && !destinationProjectId) {
|
|
15848
|
+
output_manager_default.error(
|
|
15849
|
+
"Trigger destination flags require a linked project. Run `vercel link` first."
|
|
15850
|
+
);
|
|
15851
|
+
return 1;
|
|
15852
|
+
}
|
|
15853
|
+
let customEnvironmentId;
|
|
15854
|
+
if (triggerEnvironment !== void 0 && destinationProjectId) {
|
|
15855
|
+
try {
|
|
15856
|
+
const customEnvironments = await getCustomEnvironments(
|
|
15857
|
+
client,
|
|
15858
|
+
destinationProjectId
|
|
15859
|
+
);
|
|
15860
|
+
const customEnvironment = pickCustomEnvironment(
|
|
15861
|
+
customEnvironments,
|
|
15862
|
+
triggerEnvironment
|
|
15863
|
+
);
|
|
15864
|
+
if (!customEnvironment) {
|
|
15865
|
+
output_manager_default.error(
|
|
15866
|
+
`Unknown trigger environment ${triggerEnvironment} for project ${destinationProjectId}. Use a custom environment slug or stable ID from that project.`
|
|
15867
|
+
);
|
|
15868
|
+
return 1;
|
|
15869
|
+
}
|
|
15870
|
+
customEnvironmentId = customEnvironment.id;
|
|
15871
|
+
} catch (err) {
|
|
15872
|
+
printError(err);
|
|
15873
|
+
return 1;
|
|
15874
|
+
}
|
|
15875
|
+
}
|
|
14830
15876
|
if (isDataFlagEmpty && isDataOnlyCreate) {
|
|
14831
15877
|
return await outputMissingDataError(client, service, connectorType);
|
|
14832
15878
|
}
|
|
@@ -14941,18 +15987,25 @@ async function create2(client, args, flags) {
|
|
|
14941
15987
|
}
|
|
14942
15988
|
output_manager_default.stopSpinner();
|
|
14943
15989
|
}
|
|
14944
|
-
const link = await getProjectLink(client, client.cwd);
|
|
14945
15990
|
const body = {
|
|
14946
15991
|
service,
|
|
14947
15992
|
name
|
|
14948
15993
|
};
|
|
14949
|
-
if (
|
|
14950
|
-
body.projectId =
|
|
15994
|
+
if (link2?.projectId) {
|
|
15995
|
+
body.projectId = link2.projectId;
|
|
14951
15996
|
}
|
|
14952
15997
|
body.triggers = { enabled: flags["--triggers"] === true };
|
|
14953
15998
|
if (flags["--trigger-event"] !== void 0) {
|
|
14954
15999
|
body.events = flags["--trigger-event"];
|
|
14955
16000
|
}
|
|
16001
|
+
if (triggerPath !== void 0 || triggerProject !== void 0 || triggerBranch !== void 0 || triggerEnvironment !== void 0) {
|
|
16002
|
+
body.triggerDestination = {
|
|
16003
|
+
...triggerProjectId !== void 0 ? { projectId: triggerProjectId } : {},
|
|
16004
|
+
...triggerPath !== void 0 ? { path: triggerPath } : {},
|
|
16005
|
+
...triggerBranch !== void 0 ? { branch: triggerBranch } : {},
|
|
16006
|
+
...customEnvironmentId !== void 0 ? { customEnvironmentId } : {}
|
|
16007
|
+
};
|
|
16008
|
+
}
|
|
14956
16009
|
if (iconSha) {
|
|
14957
16010
|
body.icon = iconSha;
|
|
14958
16011
|
}
|
|
@@ -15172,7 +16225,7 @@ async function resolveDataFlag(raw, client) {
|
|
|
15172
16225
|
);
|
|
15173
16226
|
}
|
|
15174
16227
|
try {
|
|
15175
|
-
return await
|
|
16228
|
+
return await readFile5(resolve5(client.cwd, source), "utf8");
|
|
15176
16229
|
} catch (err) {
|
|
15177
16230
|
throw new Error(
|
|
15178
16231
|
`Could not read --data file at "${source}": ${err.message}`
|
|
@@ -17000,6 +18053,19 @@ async function connex(client) {
|
|
|
17000
18053
|
telemetry2.trackCliOptionTarget(createParsedArgs.flags["--target"]);
|
|
17001
18054
|
telemetry2.trackCliOptionParam(createParsedArgs.flags["--param"]);
|
|
17002
18055
|
telemetry2.trackCliFlagYes(createParsedArgs.flags["--yes"]);
|
|
18056
|
+
telemetry2.trackCliFlagTriggers(createParsedArgs.flags["--triggers"]);
|
|
18057
|
+
telemetry2.trackCliOptionTriggerPath(
|
|
18058
|
+
createParsedArgs.flags["--trigger-path"]
|
|
18059
|
+
);
|
|
18060
|
+
telemetry2.trackCliOptionTriggerProject(
|
|
18061
|
+
createParsedArgs.flags["--trigger-project"]
|
|
18062
|
+
);
|
|
18063
|
+
telemetry2.trackCliOptionTriggerBranch(
|
|
18064
|
+
createParsedArgs.flags["--trigger-branch"]
|
|
18065
|
+
);
|
|
18066
|
+
telemetry2.trackCliOptionTriggerEnvironment(
|
|
18067
|
+
createParsedArgs.flags["--trigger-environment"]
|
|
18068
|
+
);
|
|
17003
18069
|
return await create2(
|
|
17004
18070
|
client,
|
|
17005
18071
|
createParsedArgs.args,
|
|
@@ -18232,7 +19298,7 @@ async function main6(client) {
|
|
|
18232
19298
|
// src/commands/crons/add.ts
|
|
18233
19299
|
var import_chalk62 = __toESM(require_source(), 1);
|
|
18234
19300
|
import { resolve as resolve7 } from "path";
|
|
18235
|
-
import { access as access2, readFile as
|
|
19301
|
+
import { access as access2, readFile as readFile6, writeFile as writeFile6 } from "fs/promises";
|
|
18236
19302
|
|
|
18237
19303
|
// src/util/telemetry/commands/crons/add.ts
|
|
18238
19304
|
var CronsAddTelemetryClient = class extends TelemetryClient {
|
|
@@ -18399,7 +19465,7 @@ async function add3(client, argv) {
|
|
|
18399
19465
|
const configPath = resolve7(client.cwd, "vercel.json");
|
|
18400
19466
|
let config;
|
|
18401
19467
|
try {
|
|
18402
|
-
const content = await
|
|
19468
|
+
const content = await readFile6(configPath, "utf-8");
|
|
18403
19469
|
config = JSON.parse(content);
|
|
18404
19470
|
} catch (err) {
|
|
18405
19471
|
if (err instanceof SyntaxError) {
|
|
@@ -18427,7 +19493,7 @@ async function add3(client, argv) {
|
|
|
18427
19493
|
existingCrons.push({ path: cronPath, schedule });
|
|
18428
19494
|
config.crons = existingCrons;
|
|
18429
19495
|
try {
|
|
18430
|
-
await
|
|
19496
|
+
await writeFile6(
|
|
18431
19497
|
configPath,
|
|
18432
19498
|
JSON.stringify(config, null, 2) + "\n",
|
|
18433
19499
|
"utf-8"
|
|
@@ -18501,20 +19567,20 @@ async function ls3(client, argv) {
|
|
|
18501
19567
|
return 1;
|
|
18502
19568
|
}
|
|
18503
19569
|
const asJson = formatResult.jsonOutput;
|
|
18504
|
-
const
|
|
19570
|
+
const link2 = await resolveProjectContext({
|
|
18505
19571
|
client,
|
|
18506
19572
|
projectNameOrId: projectName
|
|
18507
19573
|
});
|
|
18508
|
-
if (
|
|
18509
|
-
return
|
|
18510
|
-
} else if (
|
|
19574
|
+
if (link2.status === "error") {
|
|
19575
|
+
return link2.exitCode;
|
|
19576
|
+
} else if (link2.status === "not_linked") {
|
|
18511
19577
|
output_manager_default.error(
|
|
18512
19578
|
`Your codebase isn't linked to a project on Vercel. Pass --project <name>, or ${client.nonInteractive ? `run ${getCommandName("link --yes --team <team-id> --project <project-id>")} to link non-interactively.` : `run ${getCommandName("link")} to begin.`}`
|
|
18513
19579
|
);
|
|
18514
19580
|
return 1;
|
|
18515
19581
|
}
|
|
18516
|
-
client.config.currentTeam =
|
|
18517
|
-
const { project, org } =
|
|
19582
|
+
client.config.currentTeam = link2.org.type === "team" ? link2.org.id : void 0;
|
|
19583
|
+
const { project, org } = link2;
|
|
18518
19584
|
const lsStamp = stamp_default();
|
|
18519
19585
|
output_manager_default.spinner(
|
|
18520
19586
|
`Fetching cron jobs for ${import_chalk63.default.bold(`${org.slug}/${project.name}`)}`
|
|
@@ -18652,20 +19718,20 @@ async function run(client, argv) {
|
|
|
18652
19718
|
const projectName = opts["--project"];
|
|
18653
19719
|
telemetry2.trackCliOptionProject(projectName);
|
|
18654
19720
|
telemetry2.trackCliArgumentPath(cronPath);
|
|
18655
|
-
const
|
|
19721
|
+
const link2 = await resolveProjectContext({
|
|
18656
19722
|
client,
|
|
18657
19723
|
projectNameOrId: projectName
|
|
18658
19724
|
});
|
|
18659
|
-
if (
|
|
18660
|
-
return
|
|
18661
|
-
} else if (
|
|
19725
|
+
if (link2.status === "error") {
|
|
19726
|
+
return link2.exitCode;
|
|
19727
|
+
} else if (link2.status === "not_linked") {
|
|
18662
19728
|
output_manager_default.error(
|
|
18663
19729
|
`Your codebase isn't linked to a project on Vercel. Pass --project <name>, or ${client.nonInteractive ? `run ${getCommandName("link --yes --team <team-id> --project <project-id>")} to link non-interactively.` : `run ${getCommandName("link")} to begin.`}`
|
|
18664
19730
|
);
|
|
18665
19731
|
return 1;
|
|
18666
19732
|
}
|
|
18667
|
-
client.config.currentTeam =
|
|
18668
|
-
const { project, org } =
|
|
19733
|
+
client.config.currentTeam = link2.org.type === "team" ? link2.org.id : void 0;
|
|
19734
|
+
const { project, org } = link2;
|
|
18669
19735
|
const runStamp = stamp_default();
|
|
18670
19736
|
output_manager_default.spinner(
|
|
18671
19737
|
`Fetching cron jobs for ${import_chalk64.default.bold(`${org.slug}/${project.name}`)}`
|
|
@@ -18713,7 +19779,7 @@ async function run(client, argv) {
|
|
|
18713
19779
|
return 1;
|
|
18714
19780
|
}
|
|
18715
19781
|
output_manager_default.spinner(`Triggering cron job ${import_chalk64.default.bold(cronPath)}`);
|
|
18716
|
-
const teamId =
|
|
19782
|
+
const teamId = link2.org.type === "team" ? link2.org.id : void 0;
|
|
18717
19783
|
const qs = teamId ? `?teamId=${encodeURIComponent(teamId)}` : "";
|
|
18718
19784
|
let result;
|
|
18719
19785
|
try {
|
|
@@ -19344,13 +20410,13 @@ async function getFullUrlAndToken(client, fullUrl, protectionBypassFlag) {
|
|
|
19344
20410
|
link: null
|
|
19345
20411
|
};
|
|
19346
20412
|
}
|
|
19347
|
-
const
|
|
20413
|
+
const link2 = await resolveProjectFromUrl(client, fullUrl);
|
|
19348
20414
|
let deploymentProtectionToken = null;
|
|
19349
|
-
if (
|
|
20415
|
+
if (link2) {
|
|
19350
20416
|
try {
|
|
19351
20417
|
deploymentProtectionToken = await getOrCreateDeploymentProtectionToken(
|
|
19352
20418
|
client,
|
|
19353
|
-
|
|
20419
|
+
link2
|
|
19354
20420
|
);
|
|
19355
20421
|
} catch (err) {
|
|
19356
20422
|
output_manager_default.debug(`Failed to get deployment protection bypass token: ${err}`);
|
|
@@ -19359,7 +20425,7 @@ async function getFullUrlAndToken(client, fullUrl, protectionBypassFlag) {
|
|
|
19359
20425
|
return {
|
|
19360
20426
|
fullUrl,
|
|
19361
20427
|
deploymentProtectionToken,
|
|
19362
|
-
link
|
|
20428
|
+
link: link2
|
|
19363
20429
|
};
|
|
19364
20430
|
}
|
|
19365
20431
|
async function linkFromDeployment(client, deployment) {
|
|
@@ -19373,13 +20439,13 @@ async function linkFromDeployment(client, deployment) {
|
|
|
19373
20439
|
}
|
|
19374
20440
|
async function resolveTargetProject(client, deployment, deploymentFlag) {
|
|
19375
20441
|
try {
|
|
19376
|
-
const
|
|
19377
|
-
if (!
|
|
20442
|
+
const link2 = await linkFromDeployment(client, deployment);
|
|
20443
|
+
if (!link2) {
|
|
19378
20444
|
output_manager_default.warn(
|
|
19379
20445
|
`Deployment "${deploymentFlag}" is missing project metadata; proceeding without an automatic protection bypass token.`
|
|
19380
20446
|
);
|
|
19381
20447
|
}
|
|
19382
|
-
return
|
|
20448
|
+
return link2;
|
|
19383
20449
|
} catch (err) {
|
|
19384
20450
|
output_manager_default.debug(`Failed to resolve deployment project: ${err}`);
|
|
19385
20451
|
output_manager_default.warn(
|
|
@@ -19427,7 +20493,7 @@ async function getDeploymentUrlAndToken(client, commandName, path3, options) {
|
|
|
19427
20493
|
resolveProjectForTrace
|
|
19428
20494
|
} = options;
|
|
19429
20495
|
const suppliedProtectionBypass = deploymentFlag ? protectionBypassFlag ?? (process.env.VERCEL_AUTOMATION_BYPASS_SECRET || void 0) : protectionBypassFlag;
|
|
19430
|
-
let
|
|
20496
|
+
let link2 = null;
|
|
19431
20497
|
let createProtectionBypassIfMissing = !deploymentFlag;
|
|
19432
20498
|
let scope;
|
|
19433
20499
|
try {
|
|
@@ -19452,7 +20518,7 @@ async function getDeploymentUrlAndToken(client, commandName, path3, options) {
|
|
|
19452
20518
|
return 1;
|
|
19453
20519
|
}
|
|
19454
20520
|
if (resolveProjectForTrace) {
|
|
19455
|
-
|
|
20521
|
+
link2 = await tryLinkFromSelector(
|
|
19456
20522
|
client,
|
|
19457
20523
|
scope.contextName,
|
|
19458
20524
|
deploymentSelector
|
|
@@ -19474,10 +20540,10 @@ async function getDeploymentUrlAndToken(client, commandName, path3, options) {
|
|
|
19474
20540
|
`Could not resolve project information for deployment "${deploymentFlag}"; proceeding without an automatic protection bypass token.`
|
|
19475
20541
|
);
|
|
19476
20542
|
} else {
|
|
19477
|
-
|
|
19478
|
-
if (
|
|
20543
|
+
link2 = await resolveTargetProject(client, deployment, deploymentFlag);
|
|
20544
|
+
if (link2 && !hasAutomationBypassToken(link2.project)) {
|
|
19479
20545
|
const linked = await getLinkedProjectOrNull(client);
|
|
19480
|
-
createProtectionBypassIfMissing = linked?.project.id ===
|
|
20546
|
+
createProtectionBypassIfMissing = linked?.project.id === link2.project.id;
|
|
19481
20547
|
}
|
|
19482
20548
|
}
|
|
19483
20549
|
}
|
|
@@ -19507,7 +20573,7 @@ async function getDeploymentUrlAndToken(client, commandName, path3, options) {
|
|
|
19507
20573
|
output_manager_default.error("Failed to get project information");
|
|
19508
20574
|
return 1;
|
|
19509
20575
|
}
|
|
19510
|
-
|
|
20576
|
+
link2 = ensuredLink;
|
|
19511
20577
|
const preferredAlias = linkedProject.project.targets?.production?.alias?.[0];
|
|
19512
20578
|
const backupAlias = linkedProject.project.latestDeployments?.[0]?.url;
|
|
19513
20579
|
const target = preferredAlias || backupAlias;
|
|
@@ -19519,11 +20585,11 @@ async function getDeploymentUrlAndToken(client, commandName, path3, options) {
|
|
|
19519
20585
|
const fullUrl = `${baseUrl}${path3.startsWith("/") ? path3 : `/${path3}`}`;
|
|
19520
20586
|
output_manager_default.debug(`${import_chalk66.default.cyan("Target URL:")} ${import_chalk66.default.bold(fullUrl)}`);
|
|
19521
20587
|
let deploymentProtectionToken = suppliedProtectionBypass ?? null;
|
|
19522
|
-
if (suppliedProtectionBypass === void 0 &&
|
|
20588
|
+
if (suppliedProtectionBypass === void 0 && link2?.project.id) {
|
|
19523
20589
|
try {
|
|
19524
20590
|
deploymentProtectionToken = await getOrCreateDeploymentProtectionToken(
|
|
19525
20591
|
client,
|
|
19526
|
-
|
|
20592
|
+
link2,
|
|
19527
20593
|
{ createIfMissing: createProtectionBypassIfMissing }
|
|
19528
20594
|
);
|
|
19529
20595
|
} catch (err) {
|
|
@@ -19536,7 +20602,7 @@ async function getDeploymentUrlAndToken(client, commandName, path3, options) {
|
|
|
19536
20602
|
return {
|
|
19537
20603
|
fullUrl,
|
|
19538
20604
|
deploymentProtectionToken,
|
|
19539
|
-
link
|
|
20605
|
+
link: link2
|
|
19540
20606
|
};
|
|
19541
20607
|
}
|
|
19542
20608
|
|
|
@@ -19544,8 +20610,8 @@ async function getDeploymentUrlAndToken(client, commandName, path3, options) {
|
|
|
19544
20610
|
var import_error_utils8 = __toESM(require_dist(), 1);
|
|
19545
20611
|
import { spawn } from "child_process";
|
|
19546
20612
|
import { tmpdir } from "os";
|
|
19547
|
-
import { join as
|
|
19548
|
-
import { mkdtemp, readFile as
|
|
20613
|
+
import { join as join15 } from "path";
|
|
20614
|
+
import { mkdtemp, readFile as readFile8, rm as rm3 } from "fs/promises";
|
|
19549
20615
|
|
|
19550
20616
|
// src/commands/curl/confirm-production.ts
|
|
19551
20617
|
async function confirmProduction(client, { deploymentTarget, yes, isTTY }) {
|
|
@@ -19569,28 +20635,28 @@ async function confirmProduction(client, { deploymentTarget, yes, isTTY }) {
|
|
|
19569
20635
|
}
|
|
19570
20636
|
|
|
19571
20637
|
// src/commands/curl/trace-session-token-provider.ts
|
|
19572
|
-
import { createHash as
|
|
19573
|
-
import { chmod, mkdir as
|
|
19574
|
-
import { dirname as
|
|
20638
|
+
import { createHash as createHash4 } from "crypto";
|
|
20639
|
+
import { chmod as chmod2, mkdir as mkdir3, readFile as readFile7, unlink as unlink3, writeFile as writeFile7 } from "fs/promises";
|
|
20640
|
+
import { dirname as dirname5, join as join14 } from "path";
|
|
19575
20641
|
var FALLBACK_TTL_MS = 5 * 60 * 1e3;
|
|
19576
20642
|
var EXPIRY_BUFFER_MS = 30 * 1e3;
|
|
19577
20643
|
var CACHE_SCHEMA_VERSION = 1;
|
|
19578
20644
|
function resolveCacheDir(override2) {
|
|
19579
20645
|
if (override2)
|
|
19580
20646
|
return override2;
|
|
19581
|
-
return
|
|
20647
|
+
return join14(getGlobalPathConfig(), "cache", "traces");
|
|
19582
20648
|
}
|
|
19583
20649
|
function cacheFilename(teamId, host) {
|
|
19584
20650
|
const key = `${teamId ?? ""}:${host}`;
|
|
19585
|
-
return `${
|
|
20651
|
+
return `${createHash4("sha256").update(key).digest("hex")}.json`;
|
|
19586
20652
|
}
|
|
19587
20653
|
function cachePath(cacheDir, teamId, host) {
|
|
19588
|
-
return
|
|
20654
|
+
return join14(cacheDir, cacheFilename(teamId, host));
|
|
19589
20655
|
}
|
|
19590
20656
|
async function readCache(path3) {
|
|
19591
20657
|
let raw;
|
|
19592
20658
|
try {
|
|
19593
|
-
raw = await
|
|
20659
|
+
raw = await readFile7(path3, "utf8");
|
|
19594
20660
|
} catch {
|
|
19595
20661
|
return null;
|
|
19596
20662
|
}
|
|
@@ -19606,9 +20672,9 @@ async function readCache(path3) {
|
|
|
19606
20672
|
}
|
|
19607
20673
|
}
|
|
19608
20674
|
async function writeCache(path3, entry) {
|
|
19609
|
-
await
|
|
19610
|
-
await
|
|
19611
|
-
await
|
|
20675
|
+
await mkdir3(dirname5(path3), { recursive: true });
|
|
20676
|
+
await writeFile7(path3, JSON.stringify(entry), { mode: 384 });
|
|
20677
|
+
await chmod2(path3, 384);
|
|
19612
20678
|
}
|
|
19613
20679
|
async function issueToken(client, {
|
|
19614
20680
|
teamId,
|
|
@@ -19644,7 +20710,7 @@ async function getTraceSessionToken({
|
|
|
19644
20710
|
const path3 = cachePath(dir, teamId, hostname2);
|
|
19645
20711
|
const cached = await readCache(path3);
|
|
19646
20712
|
if (cached && evictedToken && cached.token === evictedToken) {
|
|
19647
|
-
await
|
|
20713
|
+
await unlink3(path3).catch(() => {
|
|
19648
20714
|
});
|
|
19649
20715
|
} else if (cached && Date.now() < cached.expiresAt - EXPIRY_BUFFER_MS) {
|
|
19650
20716
|
return {
|
|
@@ -19680,9 +20746,9 @@ async function lookupDeployment(client, fullUrl, accountId) {
|
|
|
19680
20746
|
accountId ? { accountId } : {}
|
|
19681
20747
|
);
|
|
19682
20748
|
}
|
|
19683
|
-
function resolveTeamId(
|
|
19684
|
-
if (
|
|
19685
|
-
return
|
|
20749
|
+
function resolveTeamId(link2, deployment) {
|
|
20750
|
+
if (link2?.org.type === "team") {
|
|
20751
|
+
return link2.org.id;
|
|
19686
20752
|
}
|
|
19687
20753
|
if (deployment.ownerId?.startsWith("team_")) {
|
|
19688
20754
|
return deployment.ownerId;
|
|
@@ -19718,8 +20784,8 @@ function extractFinalStatus(headerDump) {
|
|
|
19718
20784
|
return lastStatus;
|
|
19719
20785
|
}
|
|
19720
20786
|
async function runCurlAndCaptureHeaders(curlFlags, json) {
|
|
19721
|
-
const tmpDir = await mkdtemp(
|
|
19722
|
-
const headerFile =
|
|
20787
|
+
const tmpDir = await mkdtemp(join15(tmpdir(), "vc-curl-trace-"));
|
|
20788
|
+
const headerFile = join15(tmpDir, "headers");
|
|
19723
20789
|
const flags = ["--dump-header", headerFile, ...curlFlags];
|
|
19724
20790
|
try {
|
|
19725
20791
|
const { exitCode: exitCode2, capturedBody } = await new Promise((resolve10) => {
|
|
@@ -19748,7 +20814,7 @@ async function runCurlAndCaptureHeaders(curlFlags, json) {
|
|
|
19748
20814
|
});
|
|
19749
20815
|
let headerDump = "";
|
|
19750
20816
|
try {
|
|
19751
|
-
headerDump = await
|
|
20817
|
+
headerDump = await readFile8(headerFile, "utf8");
|
|
19752
20818
|
} catch (err) {
|
|
19753
20819
|
output_manager_default.debug(`Failed to read curl header dump: ${err}`);
|
|
19754
20820
|
}
|
|
@@ -19758,12 +20824,12 @@ async function runCurlAndCaptureHeaders(curlFlags, json) {
|
|
|
19758
20824
|
});
|
|
19759
20825
|
}
|
|
19760
20826
|
}
|
|
19761
|
-
async function trace2(client, { fullUrl, link, curlFlags, json, yes, telemetry: telemetry2 }) {
|
|
20827
|
+
async function trace2(client, { fullUrl, link: link2, curlFlags, json, yes, telemetry: telemetry2 }) {
|
|
19762
20828
|
telemetry2.trackCliFlagTrace(true);
|
|
19763
20829
|
if (json) {
|
|
19764
20830
|
telemetry2.trackCliFlagJson(true);
|
|
19765
20831
|
}
|
|
19766
|
-
const accountId =
|
|
20832
|
+
const accountId = link2?.org.id;
|
|
19767
20833
|
let deployment;
|
|
19768
20834
|
try {
|
|
19769
20835
|
deployment = await lookupDeployment(client, fullUrl, accountId);
|
|
@@ -19773,14 +20839,14 @@ async function trace2(client, { fullUrl, link, curlFlags, json, yes, telemetry:
|
|
|
19773
20839
|
);
|
|
19774
20840
|
return 1;
|
|
19775
20841
|
}
|
|
19776
|
-
const projectId =
|
|
20842
|
+
const projectId = link2?.project.id ?? deployment.projectId;
|
|
19777
20843
|
if (!projectId) {
|
|
19778
20844
|
output_manager_default.error(
|
|
19779
20845
|
"Could not resolve project for trace session. Run `vercel link` and retry."
|
|
19780
20846
|
);
|
|
19781
20847
|
return 1;
|
|
19782
20848
|
}
|
|
19783
|
-
const teamId = resolveTeamId(
|
|
20849
|
+
const teamId = resolveTeamId(link2, deployment);
|
|
19784
20850
|
let userId;
|
|
19785
20851
|
try {
|
|
19786
20852
|
userId = client.authConfig.userId ?? (await getUser(client)).id;
|
|
@@ -19979,11 +21045,11 @@ async function getProjectByCwdOrLink({
|
|
|
19979
21045
|
const effectiveNonInteractive = nonInteractive ?? client.nonInteractive ?? argvHasNonInteractive(client.argv);
|
|
19980
21046
|
if (forReadOnlyCommand && effectiveNonInteractive) {
|
|
19981
21047
|
const resolvedCwd = await resolveProjectCwd(cwd ?? client.cwd);
|
|
19982
|
-
const
|
|
19983
|
-
if (
|
|
19984
|
-
return
|
|
21048
|
+
const link2 = await getLinkedProject(client, { cwd: resolvedCwd });
|
|
21049
|
+
if (link2.status === "linked" && link2.project) {
|
|
21050
|
+
return link2.project;
|
|
19985
21051
|
}
|
|
19986
|
-
if (
|
|
21052
|
+
if (link2.status === "error") {
|
|
19987
21053
|
const err = new Error("Link project error");
|
|
19988
21054
|
err.code = "ERR_LINK_PROJECT";
|
|
19989
21055
|
throw err;
|
|
@@ -23856,8 +24922,8 @@ async function search(client, argv) {
|
|
|
23856
24922
|
output_manager_default.error(cursorResult.error);
|
|
23857
24923
|
return 1;
|
|
23858
24924
|
}
|
|
23859
|
-
const
|
|
23860
|
-
if (
|
|
24925
|
+
const cursor2 = cursorResult.cursor;
|
|
24926
|
+
if (cursor2 && (cursor2.query !== query || cursor2.fragment !== fragment || cursor2.order !== order || !areStringArraysEqual(cursor2.tlds, tlds) || cursor2.availableOnly !== availableOnly)) {
|
|
23861
24927
|
output_manager_default.error(
|
|
23862
24928
|
"The continuation cursor does not match the current query, order, or filters."
|
|
23863
24929
|
);
|
|
@@ -23866,7 +24932,7 @@ async function search(client, argv) {
|
|
|
23866
24932
|
try {
|
|
23867
24933
|
const supportedTlds = await getSupportedTlds(client, order);
|
|
23868
24934
|
const matchingTlds = filterTlds(supportedTlds, fragment, tlds, order);
|
|
23869
|
-
const offsetResult = getOffset(matchingTlds,
|
|
24935
|
+
const offsetResult = getOffset(matchingTlds, cursor2);
|
|
23870
24936
|
if (!offsetResult.valid) {
|
|
23871
24937
|
output_manager_default.error(offsetResult.error);
|
|
23872
24938
|
return 1;
|
|
@@ -23979,8 +25045,8 @@ function isSupportedTldsCacheEntryFresh(fetchedAt, now = Date.now()) {
|
|
|
23979
25045
|
const age = now - fetchedAt;
|
|
23980
25046
|
return age >= 0 && age <= SUPPORTED_TLDS_CACHE_TTL_MS;
|
|
23981
25047
|
}
|
|
23982
|
-
function encodeCursor(
|
|
23983
|
-
return Buffer.from(JSON.stringify(
|
|
25048
|
+
function encodeCursor(cursor2) {
|
|
25049
|
+
return Buffer.from(JSON.stringify(cursor2), "utf8").toString("base64url");
|
|
23984
25050
|
}
|
|
23985
25051
|
function decodeCursor(value) {
|
|
23986
25052
|
if (value === void 0) {
|
|
@@ -23990,13 +25056,13 @@ function decodeCursor(value) {
|
|
|
23990
25056
|
if (!value || !/^[A-Za-z0-9_-]+$/.test(value)) {
|
|
23991
25057
|
throw new Error("Invalid base64url value");
|
|
23992
25058
|
}
|
|
23993
|
-
const
|
|
25059
|
+
const cursor2 = JSON.parse(
|
|
23994
25060
|
Buffer.from(value, "base64url").toString("utf8")
|
|
23995
25061
|
);
|
|
23996
|
-
if (!isContinuationCursor(
|
|
25062
|
+
if (!isContinuationCursor(cursor2)) {
|
|
23997
25063
|
throw new Error("Invalid cursor shape");
|
|
23998
25064
|
}
|
|
23999
|
-
return { valid: true, cursor };
|
|
25065
|
+
return { valid: true, cursor: cursor2 };
|
|
24000
25066
|
} catch {
|
|
24001
25067
|
return {
|
|
24002
25068
|
valid: false,
|
|
@@ -24008,18 +25074,18 @@ function isContinuationCursor(value) {
|
|
|
24008
25074
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
24009
25075
|
return false;
|
|
24010
25076
|
}
|
|
24011
|
-
const
|
|
24012
|
-
const keys = Object.keys(
|
|
25077
|
+
const cursor2 = value;
|
|
25078
|
+
const keys = Object.keys(cursor2).sort();
|
|
24013
25079
|
if (keys.length !== 6 || keys.join(",") !== "availableOnly,fragment,lastTld,order,query,tlds") {
|
|
24014
25080
|
return false;
|
|
24015
25081
|
}
|
|
24016
|
-
return typeof
|
|
25082
|
+
return typeof cursor2.query === "string" && (typeof cursor2.fragment === "string" || cursor2.fragment === null) && typeof cursor2.order === "string" && ORDERS.includes(cursor2.order) && Array.isArray(cursor2.tlds) && cursor2.tlds.every((tld) => typeof tld === "string") && typeof cursor2.availableOnly === "boolean" && typeof cursor2.lastTld === "string" && cursor2.lastTld.length > 0;
|
|
24017
25083
|
}
|
|
24018
|
-
function getOffset(tlds,
|
|
24019
|
-
if (!
|
|
25084
|
+
function getOffset(tlds, cursor2) {
|
|
25085
|
+
if (!cursor2) {
|
|
24020
25086
|
return { valid: true, offset: 0 };
|
|
24021
25087
|
}
|
|
24022
|
-
const lastTldIndex = tlds.indexOf(
|
|
25088
|
+
const lastTldIndex = tlds.indexOf(cursor2.lastTld);
|
|
24023
25089
|
if (lastTldIndex === -1) {
|
|
24024
25090
|
return {
|
|
24025
25091
|
valid: false,
|
|
@@ -24092,7 +25158,7 @@ function getOrder(value) {
|
|
|
24092
25158
|
}
|
|
24093
25159
|
return { valid: true, order };
|
|
24094
25160
|
}
|
|
24095
|
-
function getContinuationCommand(query, order, tlds, availableOnly,
|
|
25161
|
+
function getContinuationCommand(query, order, tlds, availableOnly, cursor2) {
|
|
24096
25162
|
const flags = [];
|
|
24097
25163
|
if (order !== DEFAULT_ORDER) {
|
|
24098
25164
|
flags.push(`--order=${order}`);
|
|
@@ -24101,7 +25167,7 @@ function getContinuationCommand(query, order, tlds, availableOnly, cursor) {
|
|
|
24101
25167
|
if (availableOnly) {
|
|
24102
25168
|
flags.push("--available");
|
|
24103
25169
|
}
|
|
24104
|
-
flags.push(`--next ${
|
|
25170
|
+
flags.push(`--next ${cursor2}`);
|
|
24105
25171
|
return `domains search ${query} ${flags.join(" ")}`;
|
|
24106
25172
|
}
|
|
24107
25173
|
function normalizeTldFilters(values) {
|
|
@@ -24345,20 +25411,20 @@ async function resolveRequestedProject(client, domainName, idOrName) {
|
|
|
24345
25411
|
return { kind: "error", idOrName, error: result };
|
|
24346
25412
|
}
|
|
24347
25413
|
async function findLinkedProjectDomain(client, domainName) {
|
|
24348
|
-
const
|
|
24349
|
-
if (
|
|
25414
|
+
const link2 = await getLinkedProject(client);
|
|
25415
|
+
if (link2.status !== "linked") {
|
|
24350
25416
|
return null;
|
|
24351
25417
|
}
|
|
24352
|
-
const result = await getProjectDomain(client,
|
|
25418
|
+
const result = await getProjectDomain(client, link2.project.id, domainName, {
|
|
24353
25419
|
bailOn429: true
|
|
24354
25420
|
});
|
|
24355
25421
|
if (!isAPIError(result)) {
|
|
24356
|
-
return attachedProject(
|
|
25422
|
+
return attachedProject(link2.project.id, link2.project.name, result);
|
|
24357
25423
|
}
|
|
24358
25424
|
if (result.status === 403 || result.status === 404) {
|
|
24359
25425
|
return null;
|
|
24360
25426
|
}
|
|
24361
|
-
return { kind: "error", idOrName:
|
|
25427
|
+
return { kind: "error", idOrName: link2.project.id, error: result };
|
|
24362
25428
|
}
|
|
24363
25429
|
async function findProjectDomainByName(client, domainName) {
|
|
24364
25430
|
const result = await getProjectDomainByName(client, domainName, {
|
|
@@ -25787,14 +26853,14 @@ async function resolveFirewallScope(client, flags) {
|
|
|
25787
26853
|
}
|
|
25788
26854
|
return { type: "team", teamId: team.id, displayName: team.slug };
|
|
25789
26855
|
}
|
|
25790
|
-
const
|
|
26856
|
+
const link2 = await requireProjectContext(
|
|
25791
26857
|
client,
|
|
25792
26858
|
"firewall",
|
|
25793
26859
|
flags["--project"]
|
|
25794
26860
|
);
|
|
25795
|
-
if (typeof
|
|
25796
|
-
return
|
|
25797
|
-
const { project, org } =
|
|
26861
|
+
if (typeof link2 === "number")
|
|
26862
|
+
return link2;
|
|
26863
|
+
const { project, org } = link2;
|
|
25798
26864
|
return {
|
|
25799
26865
|
type: "project",
|
|
25800
26866
|
projectId: project.id,
|
|
@@ -26619,14 +27685,14 @@ async function overview(client, argv) {
|
|
|
26619
27685
|
const parsed = await parseSubcommandArgs2(argv, overviewSubcommand, client);
|
|
26620
27686
|
if (typeof parsed === "number")
|
|
26621
27687
|
return parsed;
|
|
26622
|
-
const
|
|
27688
|
+
const link2 = await requireProjectContext(
|
|
26623
27689
|
client,
|
|
26624
27690
|
"firewall",
|
|
26625
27691
|
parsed.flags["--project"]
|
|
26626
27692
|
);
|
|
26627
|
-
if (typeof
|
|
26628
|
-
return
|
|
26629
|
-
const { project, org } =
|
|
27693
|
+
if (typeof link2 === "number")
|
|
27694
|
+
return link2;
|
|
27695
|
+
const { project, org } = link2;
|
|
26630
27696
|
const teamId = org.type === "team" ? org.id : void 0;
|
|
26631
27697
|
output_manager_default.spinner(`Fetching firewall overview for ${import_chalk91.default.bold(project.name)}`);
|
|
26632
27698
|
try {
|
|
@@ -26882,14 +27948,14 @@ async function list12(client, argv) {
|
|
|
26882
27948
|
);
|
|
26883
27949
|
if (typeof parsed === "number")
|
|
26884
27950
|
return parsed;
|
|
26885
|
-
const
|
|
27951
|
+
const link2 = await requireProjectContext(
|
|
26886
27952
|
client,
|
|
26887
27953
|
"firewall",
|
|
26888
27954
|
parsed.flags["--project"]
|
|
26889
27955
|
);
|
|
26890
|
-
if (typeof
|
|
26891
|
-
return
|
|
26892
|
-
const { project, org } =
|
|
27956
|
+
if (typeof link2 === "number")
|
|
27957
|
+
return link2;
|
|
27958
|
+
const { project, org } = link2;
|
|
26893
27959
|
const teamId = org.type === "team" ? org.id : void 0;
|
|
26894
27960
|
output_manager_default.spinner(
|
|
26895
27961
|
`Fetching system bypass rules for ${import_chalk95.default.bold(project.name)}`
|
|
@@ -27086,14 +28152,14 @@ async function add6(client, argv) {
|
|
|
27086
28152
|
return 1;
|
|
27087
28153
|
}
|
|
27088
28154
|
}
|
|
27089
|
-
const
|
|
28155
|
+
const link2 = await requireProjectContext(
|
|
27090
28156
|
client,
|
|
27091
28157
|
"firewall",
|
|
27092
28158
|
parsed.flags["--project"]
|
|
27093
28159
|
);
|
|
27094
|
-
if (typeof
|
|
27095
|
-
return
|
|
27096
|
-
const { project, org } =
|
|
28160
|
+
if (typeof link2 === "number")
|
|
28161
|
+
return link2;
|
|
28162
|
+
const { project, org } = link2;
|
|
27097
28163
|
const teamId = org.type === "team" ? org.id : void 0;
|
|
27098
28164
|
const scopeLabel = domain2 || "all domains";
|
|
27099
28165
|
const confirmed = await confirmAction(
|
|
@@ -27193,14 +28259,14 @@ async function remove6(client, argv) {
|
|
|
27193
28259
|
return 1;
|
|
27194
28260
|
}
|
|
27195
28261
|
}
|
|
27196
|
-
const
|
|
28262
|
+
const link2 = await requireProjectContext(
|
|
27197
28263
|
client,
|
|
27198
28264
|
"firewall",
|
|
27199
28265
|
parsed.flags["--project"]
|
|
27200
28266
|
);
|
|
27201
|
-
if (typeof
|
|
27202
|
-
return
|
|
27203
|
-
const { project, org } =
|
|
28267
|
+
if (typeof link2 === "number")
|
|
28268
|
+
return link2;
|
|
28269
|
+
const { project, org } = link2;
|
|
27204
28270
|
const teamId = org.type === "team" ? org.id : void 0;
|
|
27205
28271
|
const scopeLabel = domain2 || "all domains";
|
|
27206
28272
|
const confirmed = await confirmAction(
|
|
@@ -27407,14 +28473,14 @@ async function enable(client, argv) {
|
|
|
27407
28473
|
);
|
|
27408
28474
|
return 1;
|
|
27409
28475
|
}
|
|
27410
|
-
const
|
|
28476
|
+
const link2 = await requireProjectContext(
|
|
27411
28477
|
client,
|
|
27412
28478
|
"firewall",
|
|
27413
28479
|
parsed.flags["--project"]
|
|
27414
28480
|
);
|
|
27415
|
-
if (typeof
|
|
27416
|
-
return
|
|
27417
|
-
const { project } =
|
|
28481
|
+
if (typeof link2 === "number")
|
|
28482
|
+
return link2;
|
|
28483
|
+
const { project } = link2;
|
|
27418
28484
|
const confirmed = await confirmAction(
|
|
27419
28485
|
client,
|
|
27420
28486
|
parsed.flags["--yes"],
|
|
@@ -27480,14 +28546,14 @@ async function disable(client, argv) {
|
|
|
27480
28546
|
);
|
|
27481
28547
|
return 1;
|
|
27482
28548
|
}
|
|
27483
|
-
const
|
|
28549
|
+
const link2 = await requireProjectContext(
|
|
27484
28550
|
client,
|
|
27485
28551
|
"firewall",
|
|
27486
28552
|
parsed.flags["--project"]
|
|
27487
28553
|
);
|
|
27488
|
-
if (typeof
|
|
27489
|
-
return
|
|
27490
|
-
const { project } =
|
|
28554
|
+
if (typeof link2 === "number")
|
|
28555
|
+
return link2;
|
|
28556
|
+
const { project } = link2;
|
|
27491
28557
|
const confirmed = await confirmAction(
|
|
27492
28558
|
client,
|
|
27493
28559
|
parsed.flags["--yes"],
|
|
@@ -27632,14 +28698,14 @@ async function pause(client, argv) {
|
|
|
27632
28698
|
);
|
|
27633
28699
|
return 1;
|
|
27634
28700
|
}
|
|
27635
|
-
const
|
|
28701
|
+
const link2 = await requireProjectContext(
|
|
27636
28702
|
client,
|
|
27637
28703
|
"firewall",
|
|
27638
28704
|
parsed.flags["--project"]
|
|
27639
28705
|
);
|
|
27640
|
-
if (typeof
|
|
27641
|
-
return
|
|
27642
|
-
const { project, org } =
|
|
28706
|
+
if (typeof link2 === "number")
|
|
28707
|
+
return link2;
|
|
28708
|
+
const { project, org } = link2;
|
|
27643
28709
|
const teamId = org.type === "team" ? org.id : void 0;
|
|
27644
28710
|
const confirmed = await confirmAction(
|
|
27645
28711
|
client,
|
|
@@ -27713,14 +28779,14 @@ async function resume(client, argv) {
|
|
|
27713
28779
|
);
|
|
27714
28780
|
return 1;
|
|
27715
28781
|
}
|
|
27716
|
-
const
|
|
28782
|
+
const link2 = await requireProjectContext(
|
|
27717
28783
|
client,
|
|
27718
28784
|
"firewall",
|
|
27719
28785
|
parsed.flags["--project"]
|
|
27720
28786
|
);
|
|
27721
|
-
if (typeof
|
|
27722
|
-
return
|
|
27723
|
-
const { project, org } =
|
|
28787
|
+
if (typeof link2 === "number")
|
|
28788
|
+
return link2;
|
|
28789
|
+
const { project, org } = link2;
|
|
27724
28790
|
const teamId = org.type === "team" ? org.id : void 0;
|
|
27725
28791
|
const confirmed = await confirmAction(
|
|
27726
28792
|
client,
|
|
@@ -33811,12 +34877,12 @@ var GlobalConfigTelemetryClient = class extends TelemetryClient {
|
|
|
33811
34877
|
|
|
33812
34878
|
// src/commands/global-config/apply-linked-project-team.ts
|
|
33813
34879
|
async function applyLinkedProjectTeam(client) {
|
|
33814
|
-
const
|
|
33815
|
-
if (
|
|
33816
|
-
return
|
|
34880
|
+
const link2 = await getLinkedProject(client);
|
|
34881
|
+
if (link2.status === "error") {
|
|
34882
|
+
return link2.exitCode;
|
|
33817
34883
|
}
|
|
33818
|
-
if (
|
|
33819
|
-
client.config.currentTeam =
|
|
34884
|
+
if (link2.status === "linked") {
|
|
34885
|
+
client.config.currentTeam = link2.org.type === "team" ? link2.org.id : void 0;
|
|
33820
34886
|
}
|
|
33821
34887
|
return void 0;
|
|
33822
34888
|
}
|
|
@@ -34107,7 +35173,7 @@ async function getFlags(client, projectId, options = {}) {
|
|
|
34107
35173
|
createdBy,
|
|
34108
35174
|
maintainerIds,
|
|
34109
35175
|
limit,
|
|
34110
|
-
cursor
|
|
35176
|
+
cursor: cursor2
|
|
34111
35177
|
} = options;
|
|
34112
35178
|
output_manager_default.debug(`Fetching feature flags for project ${projectId}`);
|
|
34113
35179
|
const basePath = `/v2/projects/${encodeURIComponent(projectId)}/feature-flags/flags`;
|
|
@@ -34129,13 +35195,13 @@ async function getFlags(client, projectId, options = {}) {
|
|
|
34129
35195
|
}
|
|
34130
35196
|
return query.toString();
|
|
34131
35197
|
};
|
|
34132
|
-
if (limit !== void 0 ||
|
|
35198
|
+
if (limit !== void 0 || cursor2 !== void 0) {
|
|
34133
35199
|
const pageLimit = Math.min(
|
|
34134
35200
|
limit ?? MAX_FLAGS_PAGE_LIMIT,
|
|
34135
35201
|
MAX_FLAGS_PAGE_LIMIT
|
|
34136
35202
|
);
|
|
34137
35203
|
const response = await client.fetch(
|
|
34138
|
-
`${basePath}?${buildQuery(pageLimit,
|
|
35204
|
+
`${basePath}?${buildQuery(pageLimit, cursor2)}`
|
|
34139
35205
|
);
|
|
34140
35206
|
return { flags: response.data, next: response.pagination?.next ?? null };
|
|
34141
35207
|
}
|
|
@@ -34303,17 +35369,17 @@ async function ls7(client, argv) {
|
|
|
34303
35369
|
);
|
|
34304
35370
|
return 1;
|
|
34305
35371
|
}
|
|
34306
|
-
const
|
|
34307
|
-
if (
|
|
34308
|
-
return
|
|
34309
|
-
} else if (
|
|
35372
|
+
const link2 = await getLinkedFlagsProject(client, projectName);
|
|
35373
|
+
if (link2.status === "error") {
|
|
35374
|
+
return link2.exitCode;
|
|
35375
|
+
} else if (link2.status === "not_linked") {
|
|
34310
35376
|
output_manager_default.error(
|
|
34311
35377
|
`Your codebase isn't linked to a project on Vercel. Pass --project <name>, or run ${getCommandName("link")} to link it.`
|
|
34312
35378
|
);
|
|
34313
35379
|
return 1;
|
|
34314
35380
|
}
|
|
34315
|
-
client.config.currentTeam =
|
|
34316
|
-
const { project, org } =
|
|
35381
|
+
client.config.currentTeam = link2.org.type === "team" ? link2.org.id : void 0;
|
|
35382
|
+
const { project, org } = link2;
|
|
34317
35383
|
const projectSlugLink = formatProject(org.slug, project.name);
|
|
34318
35384
|
const lsStamp = stamp_default();
|
|
34319
35385
|
output_manager_default.spinner(`Fetching ${state} feature flags for ${projectSlugLink}`);
|
|
@@ -34882,17 +35948,17 @@ async function inspect5(client, argv) {
|
|
|
34882
35948
|
}
|
|
34883
35949
|
telemetryClient.trackCliArgumentFlag(flagArg);
|
|
34884
35950
|
telemetryClient.trackCliOptionProject(projectName);
|
|
34885
|
-
const
|
|
34886
|
-
if (
|
|
34887
|
-
return
|
|
34888
|
-
} else if (
|
|
35951
|
+
const link2 = await getLinkedFlagsProject(client, projectName);
|
|
35952
|
+
if (link2.status === "error") {
|
|
35953
|
+
return link2.exitCode;
|
|
35954
|
+
} else if (link2.status === "not_linked") {
|
|
34889
35955
|
output_manager_default.error(
|
|
34890
35956
|
`Your codebase isn't linked to a project on Vercel. Pass --project <name>, or run ${getCommandName("link")} to link it.`
|
|
34891
35957
|
);
|
|
34892
35958
|
return 1;
|
|
34893
35959
|
}
|
|
34894
|
-
client.config.currentTeam =
|
|
34895
|
-
const { project, org } =
|
|
35960
|
+
client.config.currentTeam = link2.org.type === "team" ? link2.org.id : void 0;
|
|
35961
|
+
const { project, org } = link2;
|
|
34896
35962
|
const projectSlugLink = formatProject(org.slug, project.name);
|
|
34897
35963
|
try {
|
|
34898
35964
|
const [flag, settings] = await Promise.all([
|
|
@@ -34957,8 +36023,8 @@ var FlagsVersionsTelemetryClient = class extends TelemetryClient {
|
|
|
34957
36023
|
});
|
|
34958
36024
|
}
|
|
34959
36025
|
}
|
|
34960
|
-
trackCliOptionCursor(
|
|
34961
|
-
if (
|
|
36026
|
+
trackCliOptionCursor(cursor2) {
|
|
36027
|
+
if (cursor2) {
|
|
34962
36028
|
this.trackCliOption({
|
|
34963
36029
|
option: "cursor",
|
|
34964
36030
|
value: this.redactedValue
|
|
@@ -35733,7 +36799,7 @@ async function listVersions(client, argv, telemetryClient) {
|
|
|
35733
36799
|
const [flagArg] = args;
|
|
35734
36800
|
const environment = flags["--environment"];
|
|
35735
36801
|
const limit = flags["--limit"];
|
|
35736
|
-
const
|
|
36802
|
+
const cursor2 = flags["--cursor"];
|
|
35737
36803
|
const json = flags["--json"];
|
|
35738
36804
|
const projectName = getProjectNameFromFlags(flags);
|
|
35739
36805
|
if (!flagArg) {
|
|
@@ -35746,7 +36812,7 @@ async function listVersions(client, argv, telemetryClient) {
|
|
|
35746
36812
|
telemetryClient.trackCliOptionProject(projectName);
|
|
35747
36813
|
telemetryClient.trackCliOptionEnvironment(environment);
|
|
35748
36814
|
telemetryClient.trackCliOptionLimit(limit);
|
|
35749
|
-
telemetryClient.trackCliOptionCursor(
|
|
36815
|
+
telemetryClient.trackCliOptionCursor(cursor2);
|
|
35750
36816
|
telemetryClient.trackCliFlagJson(json);
|
|
35751
36817
|
if (limit !== void 0 && (!Number.isInteger(limit) || limit < 1 || limit > MAX_FLAG_VERSIONS_PAGE_LIMIT)) {
|
|
35752
36818
|
output_manager_default.error(
|
|
@@ -35754,10 +36820,10 @@ async function listVersions(client, argv, telemetryClient) {
|
|
|
35754
36820
|
);
|
|
35755
36821
|
return 1;
|
|
35756
36822
|
}
|
|
35757
|
-
const
|
|
35758
|
-
if (typeof
|
|
35759
|
-
return
|
|
35760
|
-
const { project, org } =
|
|
36823
|
+
const link2 = await resolveLinkedProject(client, projectName);
|
|
36824
|
+
if (typeof link2 === "number")
|
|
36825
|
+
return link2;
|
|
36826
|
+
const { project, org } = link2;
|
|
35761
36827
|
const projectSlugLink = formatProject(org.slug, project.name);
|
|
35762
36828
|
const versionsStamp = stamp_default();
|
|
35763
36829
|
const environmentLabel = environment ? ` in ${environment}` : "";
|
|
@@ -35772,7 +36838,7 @@ async function listVersions(client, argv, telemetryClient) {
|
|
|
35772
36838
|
{
|
|
35773
36839
|
environment,
|
|
35774
36840
|
limit,
|
|
35775
|
-
cursor
|
|
36841
|
+
cursor: cursor2
|
|
35776
36842
|
}
|
|
35777
36843
|
);
|
|
35778
36844
|
output_manager_default.stopSpinner();
|
|
@@ -35833,10 +36899,10 @@ async function diffVersions(client, argv, telemetryClient) {
|
|
|
35833
36899
|
output_manager_default.error("Revision 0 has no previous revision to compare.");
|
|
35834
36900
|
return 1;
|
|
35835
36901
|
}
|
|
35836
|
-
const
|
|
35837
|
-
if (typeof
|
|
35838
|
-
return
|
|
35839
|
-
const { project, org } =
|
|
36902
|
+
const link2 = await resolveLinkedProject(client, projectName);
|
|
36903
|
+
if (typeof link2 === "number")
|
|
36904
|
+
return link2;
|
|
36905
|
+
const { project, org } = link2;
|
|
35840
36906
|
const projectSlugLink = formatProject(org.slug, project.name);
|
|
35841
36907
|
const diffStamp = stamp_default();
|
|
35842
36908
|
output_manager_default.spinner(
|
|
@@ -35882,27 +36948,27 @@ async function diffVersions(client, argv, telemetryClient) {
|
|
|
35882
36948
|
return 0;
|
|
35883
36949
|
}
|
|
35884
36950
|
async function resolveLinkedProject(client, projectName) {
|
|
35885
|
-
const
|
|
35886
|
-
if (
|
|
35887
|
-
return
|
|
35888
|
-
} else if (
|
|
36951
|
+
const link2 = await getLinkedFlagsProject(client, projectName);
|
|
36952
|
+
if (link2.status === "error") {
|
|
36953
|
+
return link2.exitCode;
|
|
36954
|
+
} else if (link2.status === "not_linked") {
|
|
35889
36955
|
output_manager_default.error(
|
|
35890
36956
|
`Your codebase isn't linked to a project on Vercel. Pass --project <name>, or run ${getCommandName("link")} to link it.`
|
|
35891
36957
|
);
|
|
35892
36958
|
return 1;
|
|
35893
36959
|
}
|
|
35894
|
-
client.config.currentTeam =
|
|
35895
|
-
return
|
|
36960
|
+
client.config.currentTeam = link2.org.type === "team" ? link2.org.id : void 0;
|
|
36961
|
+
return link2;
|
|
35896
36962
|
}
|
|
35897
36963
|
async function getVersionPair(client, projectId, flagArg, revision) {
|
|
35898
|
-
let
|
|
36964
|
+
let cursor2;
|
|
35899
36965
|
let version;
|
|
35900
36966
|
let previousVersion;
|
|
35901
36967
|
const availableRevisions = /* @__PURE__ */ new Set();
|
|
35902
36968
|
do {
|
|
35903
36969
|
const result = await getFlagVersions(client, projectId, flagArg, {
|
|
35904
36970
|
limit: MAX_FLAG_VERSIONS_PAGE_LIMIT,
|
|
35905
|
-
cursor
|
|
36971
|
+
cursor: cursor2
|
|
35906
36972
|
});
|
|
35907
36973
|
for (const candidate of result.versions) {
|
|
35908
36974
|
availableRevisions.add(candidate.revision);
|
|
@@ -35916,8 +36982,8 @@ async function getVersionPair(client, projectId, flagArg, revision) {
|
|
|
35916
36982
|
if (version && previousVersion) {
|
|
35917
36983
|
break;
|
|
35918
36984
|
}
|
|
35919
|
-
|
|
35920
|
-
} while (
|
|
36985
|
+
cursor2 = result.next ?? void 0;
|
|
36986
|
+
} while (cursor2);
|
|
35921
36987
|
return {
|
|
35922
36988
|
version,
|
|
35923
36989
|
previousVersion,
|
|
@@ -36268,29 +37334,29 @@ async function evaluations(client, argv) {
|
|
|
36268
37334
|
if (!jsonOutput && resolvedGranularity.adjusted && resolvedGranularity.notice) {
|
|
36269
37335
|
output_manager_default.log(`Notice: ${resolvedGranularity.notice}`);
|
|
36270
37336
|
}
|
|
36271
|
-
let
|
|
37337
|
+
let link2;
|
|
36272
37338
|
try {
|
|
36273
|
-
|
|
37339
|
+
link2 = await getLinkedFlagsProject(client, projectName, {
|
|
36274
37340
|
projectNotFoundHandling: jsonOutput ? "return" : "report"
|
|
36275
37341
|
});
|
|
36276
37342
|
} catch (error) {
|
|
36277
37343
|
return handleCommandError(client, error, jsonOutput);
|
|
36278
37344
|
}
|
|
36279
|
-
if (
|
|
37345
|
+
if (link2.status === "error") {
|
|
36280
37346
|
return jsonOutput ? outputError(
|
|
36281
37347
|
client,
|
|
36282
37348
|
true,
|
|
36283
37349
|
"PROJECT_RESOLUTION_FAILED",
|
|
36284
37350
|
"Unable to resolve the requested Vercel project."
|
|
36285
|
-
) :
|
|
37351
|
+
) : link2.exitCode;
|
|
36286
37352
|
}
|
|
36287
|
-
if (
|
|
37353
|
+
if (link2.status === "not_linked") {
|
|
36288
37354
|
const code2 = projectName ? "PROJECT_NOT_FOUND" : "NOT_LINKED";
|
|
36289
37355
|
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.`;
|
|
36290
37356
|
return outputError(client, jsonOutput, code2, message);
|
|
36291
37357
|
}
|
|
36292
|
-
client.config.currentTeam =
|
|
36293
|
-
const { project, org } =
|
|
37358
|
+
client.config.currentTeam = link2.org.type === "team" ? link2.org.id : void 0;
|
|
37359
|
+
const { project, org } = link2;
|
|
36294
37360
|
let flag;
|
|
36295
37361
|
try {
|
|
36296
37362
|
flag = await getFlag(client, project.id, flagArgument);
|
|
@@ -36598,18 +37664,18 @@ async function create4(client, argv) {
|
|
|
36598
37664
|
);
|
|
36599
37665
|
return 1;
|
|
36600
37666
|
}
|
|
36601
|
-
const
|
|
36602
|
-
if (
|
|
36603
|
-
return
|
|
36604
|
-
} else if (
|
|
37667
|
+
const link2 = await getLinkedFlagsProject(client, projectName);
|
|
37668
|
+
if (link2.status === "error") {
|
|
37669
|
+
return link2.exitCode;
|
|
37670
|
+
} else if (link2.status === "not_linked") {
|
|
36605
37671
|
output_manager_default.error(
|
|
36606
37672
|
`Your codebase isn't linked to a project on Vercel. Pass --project <name>, or run ${getCommandName("link")} to link it.`
|
|
36607
37673
|
);
|
|
36608
37674
|
return 1;
|
|
36609
37675
|
}
|
|
36610
|
-
client.config.currentTeam =
|
|
36611
|
-
const { project } =
|
|
36612
|
-
const projectSlugLink = formatProject(
|
|
37676
|
+
client.config.currentTeam = link2.org.type === "team" ? link2.org.id : void 0;
|
|
37677
|
+
const { project } = link2;
|
|
37678
|
+
const projectSlugLink = formatProject(link2.org.slug, project.name);
|
|
36613
37679
|
let variants;
|
|
36614
37680
|
try {
|
|
36615
37681
|
variants = await getVariants(client, kind, variantInputs);
|
|
@@ -36646,7 +37712,7 @@ async function create4(client, argv) {
|
|
|
36646
37712
|
printFlagDetails({
|
|
36647
37713
|
flag,
|
|
36648
37714
|
projectSlugLink,
|
|
36649
|
-
orgSlug:
|
|
37715
|
+
orgSlug: link2.org.slug,
|
|
36650
37716
|
projectName: project.name,
|
|
36651
37717
|
showTimestamps: false
|
|
36652
37718
|
});
|
|
@@ -36792,17 +37858,17 @@ async function openFlag(client, argv) {
|
|
|
36792
37858
|
}
|
|
36793
37859
|
telemetryClient.trackCliArgumentFlag(flagArg);
|
|
36794
37860
|
telemetryClient.trackCliOptionProject(projectName);
|
|
36795
|
-
const
|
|
36796
|
-
if (
|
|
36797
|
-
return
|
|
36798
|
-
} else if (
|
|
37861
|
+
const link2 = await getLinkedFlagsProject(client, projectName);
|
|
37862
|
+
if (link2.status === "error") {
|
|
37863
|
+
return link2.exitCode;
|
|
37864
|
+
} else if (link2.status === "not_linked") {
|
|
36799
37865
|
output_manager_default.error(
|
|
36800
37866
|
`Your codebase isn't linked to a project on Vercel. Pass --project <name>, or run ${getCommandName("link")} to link it.`
|
|
36801
37867
|
);
|
|
36802
37868
|
return 1;
|
|
36803
37869
|
}
|
|
36804
|
-
client.config.currentTeam =
|
|
36805
|
-
const { project, org } =
|
|
37870
|
+
client.config.currentTeam = link2.org.type === "team" ? link2.org.id : void 0;
|
|
37871
|
+
const { project, org } = link2;
|
|
36806
37872
|
try {
|
|
36807
37873
|
let url = getFlagsDashboardUrl(org.slug, project.name);
|
|
36808
37874
|
let label = "feature flags dashboard";
|
|
@@ -37107,17 +38173,17 @@ async function update2(client, argv) {
|
|
|
37107
38173
|
);
|
|
37108
38174
|
return 1;
|
|
37109
38175
|
}
|
|
37110
|
-
const
|
|
37111
|
-
if (
|
|
37112
|
-
return
|
|
37113
|
-
} else if (
|
|
38176
|
+
const link2 = await getLinkedFlagsProject(client, projectName);
|
|
38177
|
+
if (link2.status === "error") {
|
|
38178
|
+
return link2.exitCode;
|
|
38179
|
+
} else if (link2.status === "not_linked") {
|
|
37114
38180
|
output_manager_default.error(
|
|
37115
38181
|
`Your codebase isn't linked to a project on Vercel. Pass --project <name>, or run ${getCommandName("link")} to link it.`
|
|
37116
38182
|
);
|
|
37117
38183
|
return 1;
|
|
37118
38184
|
}
|
|
37119
|
-
client.config.currentTeam =
|
|
37120
|
-
const { project } =
|
|
38185
|
+
client.config.currentTeam = link2.org.type === "team" ? link2.org.id : void 0;
|
|
38186
|
+
const { project } = link2;
|
|
37121
38187
|
try {
|
|
37122
38188
|
if (hasVariantMutations) {
|
|
37123
38189
|
return await updateFlagVariants(client, project.id, flagArg, {
|
|
@@ -37670,17 +38736,17 @@ async function set4(client, argv) {
|
|
|
37670
38736
|
telemetryClient.trackCliOptionEnvironment(environment);
|
|
37671
38737
|
telemetryClient.trackCliOptionVariant(variantSelector);
|
|
37672
38738
|
telemetryClient.trackCliOptionMessage(message);
|
|
37673
|
-
const
|
|
37674
|
-
if (
|
|
37675
|
-
return
|
|
37676
|
-
} else if (
|
|
38739
|
+
const link2 = await getLinkedFlagsProject(client, projectName);
|
|
38740
|
+
if (link2.status === "error") {
|
|
38741
|
+
return link2.exitCode;
|
|
38742
|
+
} else if (link2.status === "not_linked") {
|
|
37677
38743
|
output_manager_default.error(
|
|
37678
38744
|
`Your codebase isn't linked to a project on Vercel. Pass --project <name>, or run ${getCommandName("link")} to link it.`
|
|
37679
38745
|
);
|
|
37680
38746
|
return 1;
|
|
37681
38747
|
}
|
|
37682
|
-
client.config.currentTeam =
|
|
37683
|
-
const { project } =
|
|
38748
|
+
client.config.currentTeam = link2.org.type === "team" ? link2.org.id : void 0;
|
|
38749
|
+
const { project } = link2;
|
|
37684
38750
|
try {
|
|
37685
38751
|
output_manager_default.spinner("Fetching flag...");
|
|
37686
38752
|
const flag = await getFlag(client, project.id, flagArg);
|
|
@@ -38079,17 +39145,17 @@ async function split(client, argv) {
|
|
|
38079
39145
|
);
|
|
38080
39146
|
telemetryClient.trackCliOptionDefaultVariant(defaultVariantSelector);
|
|
38081
39147
|
telemetryClient.trackCliOptionMessage(message);
|
|
38082
|
-
const
|
|
38083
|
-
if (
|
|
38084
|
-
return
|
|
38085
|
-
} else if (
|
|
39148
|
+
const link2 = await getLinkedFlagsProject(client, projectName);
|
|
39149
|
+
if (link2.status === "error") {
|
|
39150
|
+
return link2.exitCode;
|
|
39151
|
+
} else if (link2.status === "not_linked") {
|
|
38086
39152
|
output_manager_default.error(
|
|
38087
39153
|
`Your codebase isn't linked to a project on Vercel. Pass --project <name>, or run ${getCommandName("link")} to link it.`
|
|
38088
39154
|
);
|
|
38089
39155
|
return 1;
|
|
38090
39156
|
}
|
|
38091
|
-
client.config.currentTeam =
|
|
38092
|
-
const { project } =
|
|
39157
|
+
client.config.currentTeam = link2.org.type === "team" ? link2.org.id : void 0;
|
|
39158
|
+
const { project } = link2;
|
|
38093
39159
|
try {
|
|
38094
39160
|
output_manager_default.spinner("Fetching flag...");
|
|
38095
39161
|
const [flag, settings] = await Promise.all([
|
|
@@ -38615,17 +39681,17 @@ async function rollout(client, argv) {
|
|
|
38615
39681
|
);
|
|
38616
39682
|
telemetryClient.trackCliOptionStart(start);
|
|
38617
39683
|
telemetryClient.trackCliOptionMessage(message);
|
|
38618
|
-
const
|
|
38619
|
-
if (
|
|
38620
|
-
return
|
|
38621
|
-
} else if (
|
|
39684
|
+
const link2 = await getLinkedFlagsProject(client, projectName);
|
|
39685
|
+
if (link2.status === "error") {
|
|
39686
|
+
return link2.exitCode;
|
|
39687
|
+
} else if (link2.status === "not_linked") {
|
|
38622
39688
|
output_manager_default.error(
|
|
38623
39689
|
`Your codebase isn't linked to a project on Vercel. Pass --project <name>, or run ${getCommandName("link")} to link it.`
|
|
38624
39690
|
);
|
|
38625
39691
|
return 1;
|
|
38626
39692
|
}
|
|
38627
|
-
client.config.currentTeam =
|
|
38628
|
-
const { project } =
|
|
39693
|
+
client.config.currentTeam = link2.org.type === "team" ? link2.org.id : void 0;
|
|
39694
|
+
const { project } = link2;
|
|
38629
39695
|
try {
|
|
38630
39696
|
output_manager_default.spinner("Fetching flag...");
|
|
38631
39697
|
const [flag, settings] = await Promise.all([
|
|
@@ -38774,17 +39840,17 @@ async function rm7(client, argv) {
|
|
|
38774
39840
|
telemetryClient.trackCliArgumentFlag(flagArg);
|
|
38775
39841
|
telemetryClient.trackCliOptionProject(projectName);
|
|
38776
39842
|
telemetryClient.trackCliFlagYes(skipConfirmation);
|
|
38777
|
-
const
|
|
38778
|
-
if (
|
|
38779
|
-
return
|
|
38780
|
-
} else if (
|
|
39843
|
+
const link2 = await getLinkedFlagsProject(client, projectName);
|
|
39844
|
+
if (link2.status === "error") {
|
|
39845
|
+
return link2.exitCode;
|
|
39846
|
+
} else if (link2.status === "not_linked") {
|
|
38781
39847
|
output_manager_default.error(
|
|
38782
39848
|
`Your codebase isn't linked to a project on Vercel. Pass --project <name>, or run ${getCommandName("link")} to link it.`
|
|
38783
39849
|
);
|
|
38784
39850
|
return 1;
|
|
38785
39851
|
}
|
|
38786
|
-
client.config.currentTeam =
|
|
38787
|
-
const { project } =
|
|
39852
|
+
client.config.currentTeam = link2.org.type === "team" ? link2.org.id : void 0;
|
|
39853
|
+
const { project } = link2;
|
|
38788
39854
|
try {
|
|
38789
39855
|
output_manager_default.spinner("Fetching flag...");
|
|
38790
39856
|
const flag = await getFlag(client, project.id, flagArg);
|
|
@@ -38870,17 +39936,17 @@ async function archive(client, argv) {
|
|
|
38870
39936
|
telemetryClient.trackCliArgumentFlag(flagArg);
|
|
38871
39937
|
telemetryClient.trackCliOptionProject(projectName);
|
|
38872
39938
|
telemetryClient.trackCliFlagYes(skipConfirmation);
|
|
38873
|
-
const
|
|
38874
|
-
if (
|
|
38875
|
-
return
|
|
38876
|
-
} else if (
|
|
39939
|
+
const link2 = await getLinkedFlagsProject(client, projectName);
|
|
39940
|
+
if (link2.status === "error") {
|
|
39941
|
+
return link2.exitCode;
|
|
39942
|
+
} else if (link2.status === "not_linked") {
|
|
38877
39943
|
output_manager_default.error(
|
|
38878
39944
|
`Your codebase isn't linked to a project on Vercel. Pass --project <name>, or run ${getCommandName("link")} to link it.`
|
|
38879
39945
|
);
|
|
38880
39946
|
return 1;
|
|
38881
39947
|
}
|
|
38882
|
-
client.config.currentTeam =
|
|
38883
|
-
const { project } =
|
|
39948
|
+
client.config.currentTeam = link2.org.type === "team" ? link2.org.id : void 0;
|
|
39949
|
+
const { project } = link2;
|
|
38884
39950
|
try {
|
|
38885
39951
|
output_manager_default.spinner("Fetching flag...");
|
|
38886
39952
|
const flag = await getFlag(client, project.id, flagArg);
|
|
@@ -38971,17 +40037,17 @@ async function unarchive(client, argv) {
|
|
|
38971
40037
|
telemetryClient.trackCliArgumentFlag(flagArg);
|
|
38972
40038
|
telemetryClient.trackCliOptionProject(projectName);
|
|
38973
40039
|
telemetryClient.trackCliFlagYes(skipConfirmation);
|
|
38974
|
-
const
|
|
38975
|
-
if (
|
|
38976
|
-
return
|
|
38977
|
-
} else if (
|
|
40040
|
+
const link2 = await getLinkedFlagsProject(client, projectName);
|
|
40041
|
+
if (link2.status === "error") {
|
|
40042
|
+
return link2.exitCode;
|
|
40043
|
+
} else if (link2.status === "not_linked") {
|
|
38978
40044
|
output_manager_default.error(
|
|
38979
40045
|
`Your codebase isn't linked to a project on Vercel. Pass --project <name>, or run ${getCommandName("link")} to link it.`
|
|
38980
40046
|
);
|
|
38981
40047
|
return 1;
|
|
38982
40048
|
}
|
|
38983
|
-
client.config.currentTeam =
|
|
38984
|
-
const { project } =
|
|
40049
|
+
client.config.currentTeam = link2.org.type === "team" ? link2.org.id : void 0;
|
|
40050
|
+
const { project } = link2;
|
|
38985
40051
|
try {
|
|
38986
40052
|
output_manager_default.spinner("Fetching flag...");
|
|
38987
40053
|
const flag = await getFlag(client, project.id, flagArg);
|
|
@@ -39165,10 +40231,10 @@ async function disable3(client, argv) {
|
|
|
39165
40231
|
telemetryClient.trackCliOptionEnvironment(environment);
|
|
39166
40232
|
telemetryClient.trackCliOptionVariant(variantId);
|
|
39167
40233
|
telemetryClient.trackCliOptionMessage(message);
|
|
39168
|
-
const
|
|
39169
|
-
if (
|
|
39170
|
-
return
|
|
39171
|
-
} else if (
|
|
40234
|
+
const link2 = await getLinkedFlagsProject(client, projectName);
|
|
40235
|
+
if (link2.status === "error") {
|
|
40236
|
+
return link2.exitCode;
|
|
40237
|
+
} else if (link2.status === "not_linked") {
|
|
39172
40238
|
if (client.nonInteractive) {
|
|
39173
40239
|
outputAgentError(
|
|
39174
40240
|
client,
|
|
@@ -39192,8 +40258,8 @@ async function disable3(client, argv) {
|
|
|
39192
40258
|
);
|
|
39193
40259
|
return 1;
|
|
39194
40260
|
}
|
|
39195
|
-
client.config.currentTeam =
|
|
39196
|
-
const { project } =
|
|
40261
|
+
client.config.currentTeam = link2.org.type === "team" ? link2.org.id : void 0;
|
|
40262
|
+
const { project } = link2;
|
|
39197
40263
|
try {
|
|
39198
40264
|
output_manager_default.spinner("Fetching flag...");
|
|
39199
40265
|
const flag = await getFlag(client, project.id, flagArg);
|
|
@@ -39209,7 +40275,7 @@ async function disable3(client, argv) {
|
|
|
39209
40275
|
attemptedSubcommand: "disable",
|
|
39210
40276
|
environment,
|
|
39211
40277
|
isInteractive: Boolean(client.stdin.isTTY),
|
|
39212
|
-
teamSlug:
|
|
40278
|
+
teamSlug: link2.org.slug,
|
|
39213
40279
|
projectName: project.name
|
|
39214
40280
|
});
|
|
39215
40281
|
return 0;
|
|
@@ -39378,17 +40444,17 @@ async function enable3(client, argv) {
|
|
|
39378
40444
|
telemetryClient.trackCliOptionProject(projectName);
|
|
39379
40445
|
telemetryClient.trackCliOptionEnvironment(environment);
|
|
39380
40446
|
telemetryClient.trackCliOptionMessage(message);
|
|
39381
|
-
const
|
|
39382
|
-
if (
|
|
39383
|
-
return
|
|
39384
|
-
} else if (
|
|
40447
|
+
const link2 = await getLinkedFlagsProject(client, projectName);
|
|
40448
|
+
if (link2.status === "error") {
|
|
40449
|
+
return link2.exitCode;
|
|
40450
|
+
} else if (link2.status === "not_linked") {
|
|
39385
40451
|
output_manager_default.error(
|
|
39386
40452
|
`Your codebase isn't linked to a project on Vercel. Pass --project <name>, or run ${getCommandName("link")} to link it.`
|
|
39387
40453
|
);
|
|
39388
40454
|
return 1;
|
|
39389
40455
|
}
|
|
39390
|
-
client.config.currentTeam =
|
|
39391
|
-
const { project } =
|
|
40456
|
+
client.config.currentTeam = link2.org.type === "team" ? link2.org.id : void 0;
|
|
40457
|
+
const { project } = link2;
|
|
39392
40458
|
try {
|
|
39393
40459
|
output_manager_default.spinner("Fetching flag...");
|
|
39394
40460
|
const flag = await getFlag(client, project.id, flagArg);
|
|
@@ -39404,7 +40470,7 @@ async function enable3(client, argv) {
|
|
|
39404
40470
|
attemptedSubcommand: "enable",
|
|
39405
40471
|
environment,
|
|
39406
40472
|
isInteractive: Boolean(client.stdin.isTTY),
|
|
39407
|
-
teamSlug:
|
|
40473
|
+
teamSlug: link2.org.slug,
|
|
39408
40474
|
projectName: project.name
|
|
39409
40475
|
});
|
|
39410
40476
|
return 0;
|
|
@@ -39617,17 +40683,17 @@ async function sdkKeysLs(client, argv) {
|
|
|
39617
40683
|
const projectName = getProjectNameFromFlags(flags);
|
|
39618
40684
|
telemetryClient.trackCliOptionProject(projectName);
|
|
39619
40685
|
telemetryClient.trackCliFlagJson(json);
|
|
39620
|
-
const
|
|
39621
|
-
if (
|
|
39622
|
-
return
|
|
39623
|
-
} else if (
|
|
40686
|
+
const link2 = await getLinkedFlagsProject(client, projectName);
|
|
40687
|
+
if (link2.status === "error") {
|
|
40688
|
+
return link2.exitCode;
|
|
40689
|
+
} else if (link2.status === "not_linked") {
|
|
39624
40690
|
output_manager_default.error(
|
|
39625
40691
|
`Your codebase isn't linked to a project on Vercel. Pass --project <name>, or run ${getCommandName("link")} to link it.`
|
|
39626
40692
|
);
|
|
39627
40693
|
return 1;
|
|
39628
40694
|
}
|
|
39629
|
-
client.config.currentTeam =
|
|
39630
|
-
const { project, org } =
|
|
40695
|
+
client.config.currentTeam = link2.org.type === "team" ? link2.org.id : void 0;
|
|
40696
|
+
const { project, org } = link2;
|
|
39631
40697
|
const projectSlugLink = formatProject(org.slug, project.name);
|
|
39632
40698
|
try {
|
|
39633
40699
|
output_manager_default.spinner("Fetching SDK keys...");
|
|
@@ -39739,10 +40805,10 @@ async function sdkKeysAdd(client, argv) {
|
|
|
39739
40805
|
telemetryClient.trackCliOptionType(sdkKeyType);
|
|
39740
40806
|
telemetryClient.trackCliOptionEnvironment(environment);
|
|
39741
40807
|
telemetryClient.trackCliOptionLabel(label);
|
|
39742
|
-
const
|
|
39743
|
-
if (
|
|
39744
|
-
return
|
|
39745
|
-
} else if (
|
|
40808
|
+
const link2 = await getLinkedFlagsProject(client, projectName);
|
|
40809
|
+
if (link2.status === "error") {
|
|
40810
|
+
return link2.exitCode;
|
|
40811
|
+
} else if (link2.status === "not_linked") {
|
|
39746
40812
|
if (client.nonInteractive) {
|
|
39747
40813
|
outputAgentError(
|
|
39748
40814
|
client,
|
|
@@ -39766,8 +40832,8 @@ async function sdkKeysAdd(client, argv) {
|
|
|
39766
40832
|
);
|
|
39767
40833
|
return 1;
|
|
39768
40834
|
}
|
|
39769
|
-
client.config.currentTeam =
|
|
39770
|
-
const { project } =
|
|
40835
|
+
client.config.currentTeam = link2.org.type === "team" ? link2.org.id : void 0;
|
|
40836
|
+
const { project } = link2;
|
|
39771
40837
|
if (!sdkKeyType) {
|
|
39772
40838
|
if (client.nonInteractive) {
|
|
39773
40839
|
const envPart = environment ? `--environment ${environment}` : "--environment <production|preview|development>";
|
|
@@ -39967,10 +41033,10 @@ async function sdkKeysRm(client, argv) {
|
|
|
39967
41033
|
telemetryClient.trackCliArgumentKey(hashKey);
|
|
39968
41034
|
telemetryClient.trackCliOptionProject(projectName);
|
|
39969
41035
|
telemetryClient.trackCliFlagYes(skipConfirmation);
|
|
39970
|
-
const
|
|
39971
|
-
if (
|
|
39972
|
-
return
|
|
39973
|
-
} else if (
|
|
41036
|
+
const link2 = await getLinkedFlagsProject(client, projectName);
|
|
41037
|
+
if (link2.status === "error") {
|
|
41038
|
+
return link2.exitCode;
|
|
41039
|
+
} else if (link2.status === "not_linked") {
|
|
39974
41040
|
if (client.nonInteractive) {
|
|
39975
41041
|
outputAgentError(
|
|
39976
41042
|
client,
|
|
@@ -39994,8 +41060,8 @@ async function sdkKeysRm(client, argv) {
|
|
|
39994
41060
|
);
|
|
39995
41061
|
return 1;
|
|
39996
41062
|
}
|
|
39997
|
-
client.config.currentTeam =
|
|
39998
|
-
const { project } =
|
|
41063
|
+
client.config.currentTeam = link2.org.type === "team" ? link2.org.id : void 0;
|
|
41064
|
+
const { project } = link2;
|
|
39999
41065
|
try {
|
|
40000
41066
|
if (!hashKey) {
|
|
40001
41067
|
if (client.nonInteractive) {
|
|
@@ -40438,17 +41504,17 @@ async function segmentsLs(client, argv) {
|
|
|
40438
41504
|
const projectName = getProjectNameFromFlags(flags);
|
|
40439
41505
|
telemetryClient.trackCliOptionProject(projectName);
|
|
40440
41506
|
telemetryClient.trackCliFlagJson(json);
|
|
40441
|
-
const
|
|
40442
|
-
if (
|
|
40443
|
-
return
|
|
40444
|
-
} else if (
|
|
41507
|
+
const link2 = await getLinkedFlagsProject(client, projectName);
|
|
41508
|
+
if (link2.status === "error") {
|
|
41509
|
+
return link2.exitCode;
|
|
41510
|
+
} else if (link2.status === "not_linked") {
|
|
40445
41511
|
output_manager_default.error(
|
|
40446
41512
|
`Your codebase isn't linked to a project on Vercel. Pass --project <name>, or run ${getCommandName("link")} to link it.`
|
|
40447
41513
|
);
|
|
40448
41514
|
return 1;
|
|
40449
41515
|
}
|
|
40450
|
-
client.config.currentTeam =
|
|
40451
|
-
const { project, org } =
|
|
41516
|
+
client.config.currentTeam = link2.org.type === "team" ? link2.org.id : void 0;
|
|
41517
|
+
const { project, org } = link2;
|
|
40452
41518
|
const projectSlugLink = formatProject(org.slug, project.name);
|
|
40453
41519
|
const lsStamp = stamp_default();
|
|
40454
41520
|
output_manager_default.spinner(`Fetching feature flag segments for ${projectSlugLink}`);
|
|
@@ -40690,17 +41756,17 @@ async function segmentsInspect(client, argv) {
|
|
|
40690
41756
|
telemetryClient.trackCliArgumentSegment(segmentArg);
|
|
40691
41757
|
telemetryClient.trackCliOptionProject(projectName);
|
|
40692
41758
|
telemetryClient.trackCliFlagJson(json);
|
|
40693
|
-
const
|
|
40694
|
-
if (
|
|
40695
|
-
return
|
|
40696
|
-
} else if (
|
|
41759
|
+
const link2 = await getLinkedFlagsProject(client, projectName);
|
|
41760
|
+
if (link2.status === "error") {
|
|
41761
|
+
return link2.exitCode;
|
|
41762
|
+
} else if (link2.status === "not_linked") {
|
|
40697
41763
|
output_manager_default.error(
|
|
40698
41764
|
`Your codebase isn't linked to a project on Vercel. Pass --project <name>, or run ${getCommandName("link")} to link it.`
|
|
40699
41765
|
);
|
|
40700
41766
|
return 1;
|
|
40701
41767
|
}
|
|
40702
|
-
client.config.currentTeam =
|
|
40703
|
-
const { project, org } =
|
|
41768
|
+
client.config.currentTeam = link2.org.type === "team" ? link2.org.id : void 0;
|
|
41769
|
+
const { project, org } = link2;
|
|
40704
41770
|
const projectSlugLink = formatProject(org.slug, project.name);
|
|
40705
41771
|
try {
|
|
40706
41772
|
output_manager_default.spinner("Fetching segment...");
|
|
@@ -41157,10 +42223,10 @@ async function segmentsCreate(client, argv) {
|
|
|
41157
42223
|
);
|
|
41158
42224
|
return 1;
|
|
41159
42225
|
}
|
|
41160
|
-
const
|
|
41161
|
-
if (
|
|
41162
|
-
return
|
|
41163
|
-
} else if (
|
|
42226
|
+
const link2 = await getLinkedFlagsProject(client, projectName);
|
|
42227
|
+
if (link2.status === "error") {
|
|
42228
|
+
return link2.exitCode;
|
|
42229
|
+
} else if (link2.status === "not_linked") {
|
|
41164
42230
|
if (client.nonInteractive) {
|
|
41165
42231
|
outputAgentError(
|
|
41166
42232
|
client,
|
|
@@ -41184,8 +42250,8 @@ async function segmentsCreate(client, argv) {
|
|
|
41184
42250
|
);
|
|
41185
42251
|
return 1;
|
|
41186
42252
|
}
|
|
41187
|
-
client.config.currentTeam =
|
|
41188
|
-
const { project, org } =
|
|
42253
|
+
client.config.currentTeam = link2.org.type === "team" ? link2.org.id : void 0;
|
|
42254
|
+
const { project, org } = link2;
|
|
41189
42255
|
const projectSlugLink = formatProject(org.slug, project.name);
|
|
41190
42256
|
label = await resolveSegmentLabel(client, label, slug);
|
|
41191
42257
|
hint = await resolveSegmentHint(client, hint, description, label);
|
|
@@ -41332,10 +42398,10 @@ async function segmentsUpdate(client, argv) {
|
|
|
41332
42398
|
telemetryClient.trackCliOptionAdd(addInputs);
|
|
41333
42399
|
telemetryClient.trackCliOptionRemove(removeInputs);
|
|
41334
42400
|
telemetryClient.trackCliFlagJson(json);
|
|
41335
|
-
const
|
|
41336
|
-
if (
|
|
41337
|
-
return
|
|
41338
|
-
} else if (
|
|
42401
|
+
const link2 = await getLinkedFlagsProject(client, projectName);
|
|
42402
|
+
if (link2.status === "error") {
|
|
42403
|
+
return link2.exitCode;
|
|
42404
|
+
} else if (link2.status === "not_linked") {
|
|
41339
42405
|
if (client.nonInteractive) {
|
|
41340
42406
|
outputAgentError(
|
|
41341
42407
|
client,
|
|
@@ -41359,8 +42425,8 @@ async function segmentsUpdate(client, argv) {
|
|
|
41359
42425
|
);
|
|
41360
42426
|
return 1;
|
|
41361
42427
|
}
|
|
41362
|
-
client.config.currentTeam =
|
|
41363
|
-
const { project, org } =
|
|
42428
|
+
client.config.currentTeam = link2.org.type === "team" ? link2.org.id : void 0;
|
|
42429
|
+
const { project, org } = link2;
|
|
41364
42430
|
const projectSlugLink = formatProject(org.slug, project.name);
|
|
41365
42431
|
try {
|
|
41366
42432
|
if (!segmentArg) {
|
|
@@ -41693,10 +42759,10 @@ async function segmentsRm(client, argv) {
|
|
|
41693
42759
|
telemetryClient.trackCliArgumentSegment(segmentArg);
|
|
41694
42760
|
telemetryClient.trackCliOptionProject(projectName);
|
|
41695
42761
|
telemetryClient.trackCliFlagYes(skipConfirmation);
|
|
41696
|
-
const
|
|
41697
|
-
if (
|
|
41698
|
-
return
|
|
41699
|
-
} else if (
|
|
42762
|
+
const link2 = await getLinkedFlagsProject(client, projectName);
|
|
42763
|
+
if (link2.status === "error") {
|
|
42764
|
+
return link2.exitCode;
|
|
42765
|
+
} else if (link2.status === "not_linked") {
|
|
41700
42766
|
if (client.nonInteractive) {
|
|
41701
42767
|
outputAgentError(
|
|
41702
42768
|
client,
|
|
@@ -41720,8 +42786,8 @@ async function segmentsRm(client, argv) {
|
|
|
41720
42786
|
);
|
|
41721
42787
|
return 1;
|
|
41722
42788
|
}
|
|
41723
|
-
client.config.currentTeam =
|
|
41724
|
-
const { project } =
|
|
42789
|
+
client.config.currentTeam = link2.org.type === "team" ? link2.org.id : void 0;
|
|
42790
|
+
const { project } = link2;
|
|
41725
42791
|
try {
|
|
41726
42792
|
if (!segmentArg) {
|
|
41727
42793
|
segmentArg = await resolveSegmentArg2(client, project.id);
|
|
@@ -42456,20 +43522,20 @@ function isRecord3(value) {
|
|
|
42456
43522
|
// src/commands/flags/rules-common.ts
|
|
42457
43523
|
var import_chalk154 = __toESM(require_source(), 1);
|
|
42458
43524
|
async function resolveRulesCommandContext(client, options) {
|
|
42459
|
-
const
|
|
43525
|
+
const link2 = await resolveProjectContext({
|
|
42460
43526
|
client,
|
|
42461
43527
|
projectNameOrId: options.projectName
|
|
42462
43528
|
});
|
|
42463
|
-
if (
|
|
42464
|
-
return { exitCode:
|
|
42465
|
-
} else if (
|
|
43529
|
+
if (link2.status === "error") {
|
|
43530
|
+
return { exitCode: link2.exitCode };
|
|
43531
|
+
} else if (link2.status === "not_linked") {
|
|
42466
43532
|
output_manager_default.error(
|
|
42467
43533
|
`Your codebase isn't linked to a project on Vercel. Run ${getCommandName("link")} to begin.`
|
|
42468
43534
|
);
|
|
42469
43535
|
return { exitCode: 1 };
|
|
42470
43536
|
}
|
|
42471
|
-
client.config.currentTeam =
|
|
42472
|
-
const { project } =
|
|
43537
|
+
client.config.currentTeam = link2.org.type === "team" ? link2.org.id : void 0;
|
|
43538
|
+
const { project } = link2;
|
|
42473
43539
|
output_manager_default.spinner("Fetching flag...");
|
|
42474
43540
|
const [flag, settings] = await Promise.all([
|
|
42475
43541
|
getFlag(client, project.id, options.flagArg),
|
|
@@ -43506,7 +44572,7 @@ async function main17(client) {
|
|
|
43506
44572
|
|
|
43507
44573
|
// src/commands/git/connect.ts
|
|
43508
44574
|
var import_chalk160 = __toESM(require_source(), 1);
|
|
43509
|
-
import { join as
|
|
44575
|
+
import { join as join16 } from "path";
|
|
43510
44576
|
|
|
43511
44577
|
// src/util/telemetry/commands/git/connect.ts
|
|
43512
44578
|
var GitConnectTelemetryClient = class extends TelemetryClient {
|
|
@@ -43577,7 +44643,7 @@ async function connect(client, argv) {
|
|
|
43577
44643
|
const { project, org } = linkedProject;
|
|
43578
44644
|
const gitProviderLink = project.link;
|
|
43579
44645
|
client.config.currentTeam = org.type === "team" ? org.id : void 0;
|
|
43580
|
-
const gitConfigPath =
|
|
44646
|
+
const gitConfigPath = join16(cwd, ".git/config");
|
|
43581
44647
|
const gitConfig = await parseGitConfig(gitConfigPath);
|
|
43582
44648
|
if (repoArg) {
|
|
43583
44649
|
const parsedUrlArg = parseRepoUrl(repoArg);
|
|
@@ -44140,7 +45206,7 @@ async function httpstat(client) {
|
|
|
44140
45206
|
// src/commands/init/init.ts
|
|
44141
45207
|
var import_tar_fs = __toESM(require_tar_fs(), 1);
|
|
44142
45208
|
var import_chalk163 = __toESM(require_source(), 1);
|
|
44143
|
-
import
|
|
45209
|
+
import fs3 from "fs";
|
|
44144
45210
|
import path2 from "path";
|
|
44145
45211
|
var EXAMPLE_API = "https://examples.vercel.sh";
|
|
44146
45212
|
async function init(client, opts, args, telemetry2) {
|
|
@@ -44242,15 +45308,15 @@ ${deployHint}`);
|
|
|
44242
45308
|
}
|
|
44243
45309
|
function prepareFolder(cwd, folder, force) {
|
|
44244
45310
|
const dest = path2.join(cwd, folder);
|
|
44245
|
-
if (
|
|
44246
|
-
if (!
|
|
45311
|
+
if (fs3.existsSync(dest)) {
|
|
45312
|
+
if (!fs3.lstatSync(dest).isDirectory()) {
|
|
44247
45313
|
throw new Error(
|
|
44248
45314
|
`Destination path "${import_chalk163.default.bold(
|
|
44249
45315
|
folder
|
|
44250
45316
|
)}" already exists and is not a directory.`
|
|
44251
45317
|
);
|
|
44252
45318
|
}
|
|
44253
|
-
if (!force &&
|
|
45319
|
+
if (!force && fs3.readdirSync(dest).length !== 0) {
|
|
44254
45320
|
throw new Error(
|
|
44255
45321
|
`Destination path "${import_chalk163.default.bold(
|
|
44256
45322
|
folder
|
|
@@ -44261,7 +45327,7 @@ function prepareFolder(cwd, folder, force) {
|
|
|
44261
45327
|
}
|
|
44262
45328
|
} else if (dest !== cwd) {
|
|
44263
45329
|
try {
|
|
44264
|
-
|
|
45330
|
+
fs3.mkdirSync(dest);
|
|
44265
45331
|
} catch (_e) {
|
|
44266
45332
|
throw new Error(`Could not create directory "${import_chalk163.default.bold(folder)}".`);
|
|
44267
45333
|
}
|
|
@@ -44898,7 +45964,7 @@ async function printDetails({
|
|
|
44898
45964
|
readyState,
|
|
44899
45965
|
alias: aliases
|
|
44900
45966
|
} = deployment;
|
|
44901
|
-
const { print, link } = output_manager_default;
|
|
45967
|
+
const { print, link: link2 } = output_manager_default;
|
|
44902
45968
|
const { builds } = deployment.version === 2 ? await client.fetch(`/v11/deployments/${id}/builds`) : { builds: [] };
|
|
44903
45969
|
print("\n");
|
|
44904
45970
|
print(import_chalk166.default.bold(" General\n\n"));
|
|
@@ -44910,7 +45976,7 @@ async function printDetails({
|
|
|
44910
45976
|
const target = customEnvironmentSlug ?? deployment.target ?? "preview";
|
|
44911
45977
|
print(` ${import_chalk166.default.cyan("target")} `);
|
|
44912
45978
|
print(
|
|
44913
|
-
deployment.customEnvironment && deployment.team?.slug ? `${
|
|
45979
|
+
deployment.customEnvironment && deployment.team?.slug ? `${link2(
|
|
44914
45980
|
`${target}`,
|
|
44915
45981
|
`https://vercel.com/${deployment.team.slug}/${name}/settings/environments/${deployment.customEnvironment.id}`,
|
|
44916
45982
|
{ fallback: () => target, color: false }
|
|
@@ -49583,28 +50649,28 @@ async function openIntegration(client, subArgs) {
|
|
|
49583
50649
|
);
|
|
49584
50650
|
return 1;
|
|
49585
50651
|
}
|
|
49586
|
-
const
|
|
50652
|
+
const link3 = buildSSOLink(
|
|
49587
50653
|
team,
|
|
49588
50654
|
configurationId,
|
|
49589
50655
|
resource.externalResourceId
|
|
49590
50656
|
);
|
|
49591
|
-
outputLink(client,
|
|
50657
|
+
outputLink(client, link3, asJson, resourceName, true);
|
|
49592
50658
|
return 0;
|
|
49593
50659
|
}
|
|
49594
|
-
const
|
|
49595
|
-
outputLink(client,
|
|
50660
|
+
const link2 = buildSSOLink(team, configurationId);
|
|
50661
|
+
outputLink(client, link2, asJson, integrationSlug, false);
|
|
49596
50662
|
return 0;
|
|
49597
50663
|
}
|
|
49598
|
-
function outputLink(client,
|
|
50664
|
+
function outputLink(client, link2, json, name, isResource) {
|
|
49599
50665
|
if (json) {
|
|
49600
|
-
client.stdout.write(`${JSON.stringify({ url:
|
|
50666
|
+
client.stdout.write(`${JSON.stringify({ url: link2 }, null, 2)}
|
|
49601
50667
|
`);
|
|
49602
50668
|
} else if (client.stdout.isTTY) {
|
|
49603
50669
|
const label = isResource ? `Opening the ${import_chalk183.default.bold(name)} resource dashboard...` : `Opening the ${import_chalk183.default.bold(name)} dashboard...`;
|
|
49604
50670
|
output_manager_default.print(label);
|
|
49605
|
-
(0, import_open13.default)(
|
|
50671
|
+
(0, import_open13.default)(link2);
|
|
49606
50672
|
} else {
|
|
49607
|
-
client.stdout.write(`${
|
|
50673
|
+
client.stdout.write(`${link2}
|
|
49608
50674
|
`);
|
|
49609
50675
|
}
|
|
49610
50676
|
}
|
|
@@ -50671,8 +51737,8 @@ function printGuide(client, product, guide2, snippets, resourceLinks) {
|
|
|
50671
51737
|
function appendResourceLinks(links, lines) {
|
|
50672
51738
|
lines.push("## Resources");
|
|
50673
51739
|
lines.push("");
|
|
50674
|
-
for (const
|
|
50675
|
-
lines.push(`- [${
|
|
51740
|
+
for (const link2 of links) {
|
|
51741
|
+
lines.push(`- [${link2.title}](${link2.href})`);
|
|
50676
51742
|
}
|
|
50677
51743
|
lines.push("");
|
|
50678
51744
|
}
|
|
@@ -51980,11 +53046,11 @@ async function resolveLogsTarget(client, { contextName, deploymentOption, projec
|
|
|
51980
53046
|
targetSource: "explicit-project"
|
|
51981
53047
|
};
|
|
51982
53048
|
}
|
|
51983
|
-
const
|
|
51984
|
-
if (
|
|
51985
|
-
return { exitCode:
|
|
53049
|
+
const link2 = await getLinkedProject(client);
|
|
53050
|
+
if (link2.status === "error") {
|
|
53051
|
+
return { exitCode: link2.exitCode };
|
|
51986
53052
|
}
|
|
51987
|
-
if (
|
|
53053
|
+
if (link2.status === "not_linked") {
|
|
51988
53054
|
output_manager_default.error(
|
|
51989
53055
|
`Your codebase isn't linked to a project on Vercel. Run ${getCommandName(
|
|
51990
53056
|
"link"
|
|
@@ -51992,12 +53058,12 @@ async function resolveLogsTarget(client, { contextName, deploymentOption, projec
|
|
|
51992
53058
|
);
|
|
51993
53059
|
return { exitCode: 1 };
|
|
51994
53060
|
}
|
|
51995
|
-
client.config.currentTeam =
|
|
53061
|
+
client.config.currentTeam = link2.org.type === "team" ? link2.org.id : void 0;
|
|
51996
53062
|
return {
|
|
51997
|
-
projectId:
|
|
51998
|
-
projectSlug:
|
|
51999
|
-
orgSlug:
|
|
52000
|
-
ownerId:
|
|
53063
|
+
projectId: link2.project.id,
|
|
53064
|
+
projectSlug: link2.project.name,
|
|
53065
|
+
orgSlug: link2.org.slug,
|
|
53066
|
+
ownerId: link2.org.id,
|
|
52001
53067
|
targetSource: "linked-project"
|
|
52002
53068
|
};
|
|
52003
53069
|
}
|
|
@@ -52606,17 +53672,17 @@ async function mcp(client, opts = {}) {
|
|
|
52606
53672
|
const cursorMcpPath = process.platform === "darwin" ? `${process.env.HOME}/.cursor/mcp.json` : process.platform === "win32" ? `${process.env.APPDATA}/Cursor/mcp.json` : `${process.env.HOME}/.cursor/mcp.json`;
|
|
52607
53673
|
let cursorAlreadyConfigured = false;
|
|
52608
53674
|
try {
|
|
52609
|
-
const
|
|
52610
|
-
if (
|
|
52611
|
-
const configContent =
|
|
53675
|
+
const fs4 = __require("fs");
|
|
53676
|
+
if (fs4.existsSync(cursorMcpPath)) {
|
|
53677
|
+
const configContent = fs4.readFileSync(cursorMcpPath, "utf8");
|
|
52612
53678
|
const config2 = JSON.parse(configContent);
|
|
52613
53679
|
const mcpServers = config2.mcpServers || {};
|
|
52614
53680
|
cursorAlreadyConfigured = Object.values(mcpServers).some(
|
|
52615
53681
|
(server) => server.url === mcpUrl || server.url === MCP_ENDPOINT
|
|
52616
53682
|
);
|
|
52617
53683
|
}
|
|
52618
|
-
if (!cursorAlreadyConfigured &&
|
|
52619
|
-
const configContent =
|
|
53684
|
+
if (!cursorAlreadyConfigured && fs4.existsSync(cursorConfigPath)) {
|
|
53685
|
+
const configContent = fs4.readFileSync(cursorConfigPath, "utf8");
|
|
52620
53686
|
const config2 = JSON.parse(configContent);
|
|
52621
53687
|
const mcpServers = config2["mcp.servers"] || {};
|
|
52622
53688
|
cursorAlreadyConfigured = Object.values(mcpServers).some(
|
|
@@ -52697,17 +53763,17 @@ async function mcp(client, opts = {}) {
|
|
|
52697
53763
|
const vscodeMcpPath = process.platform === "darwin" ? `${process.env.HOME}/Library/Application Support/Code/User/mcp.json` : process.platform === "win32" ? `${process.env.APPDATA}/Code/User/mcp.json` : `${process.env.HOME}/.config/Code/User/mcp.json`;
|
|
52698
53764
|
let vscodeAlreadyConfigured = false;
|
|
52699
53765
|
try {
|
|
52700
|
-
const
|
|
52701
|
-
if (
|
|
52702
|
-
const configContent =
|
|
53766
|
+
const fs4 = __require("fs");
|
|
53767
|
+
if (fs4.existsSync(vscodeMcpPath)) {
|
|
53768
|
+
const configContent = fs4.readFileSync(vscodeMcpPath, "utf8");
|
|
52703
53769
|
const config2 = JSON.parse(configContent);
|
|
52704
53770
|
const mcpServers = config2.servers || {};
|
|
52705
53771
|
vscodeAlreadyConfigured = Object.values(mcpServers).some(
|
|
52706
53772
|
(server) => server.url === mcpUrl || server.url === MCP_ENDPOINT
|
|
52707
53773
|
);
|
|
52708
53774
|
}
|
|
52709
|
-
if (!vscodeAlreadyConfigured &&
|
|
52710
|
-
const configContent =
|
|
53775
|
+
if (!vscodeAlreadyConfigured && fs4.existsSync(vscodeConfigPath)) {
|
|
53776
|
+
const configContent = fs4.readFileSync(vscodeConfigPath, "utf8");
|
|
52711
53777
|
const config2 = JSON.parse(configContent);
|
|
52712
53778
|
const mcpServers = config2["mcp.servers"] || {};
|
|
52713
53779
|
vscodeAlreadyConfigured = Object.values(mcpServers).some(
|
|
@@ -53096,7 +54162,7 @@ async function metrics(client) {
|
|
|
53096
54162
|
return 0;
|
|
53097
54163
|
}
|
|
53098
54164
|
telemetry2.trackCliSubcommandSchema(subcommandOriginal);
|
|
53099
|
-
const schemaFn = (await import("./chunks/schema-
|
|
54165
|
+
const schemaFn = (await import("./chunks/schema-5CASPRP6.js")).default;
|
|
53100
54166
|
return schemaFn(client, telemetry2);
|
|
53101
54167
|
}
|
|
53102
54168
|
default: {
|
|
@@ -53109,7 +54175,7 @@ async function metrics(client) {
|
|
|
53109
54175
|
output_manager_default.print(help(metricsCommand, { columns: client.stderr.columns }));
|
|
53110
54176
|
return 2;
|
|
53111
54177
|
}
|
|
53112
|
-
const queryFn = (await import("./chunks/query-
|
|
54178
|
+
const queryFn = (await import("./chunks/query-LL2GMJWQ.js")).default;
|
|
53113
54179
|
return queryFn(client, telemetry2);
|
|
53114
54180
|
}
|
|
53115
54181
|
}
|
|
@@ -53117,7 +54183,7 @@ async function metrics(client) {
|
|
|
53117
54183
|
|
|
53118
54184
|
// src/commands/microfrontends/pull.ts
|
|
53119
54185
|
var import_chalk192 = __toESM(require_source(), 1);
|
|
53120
|
-
import { join as
|
|
54186
|
+
import { join as join17 } from "path";
|
|
53121
54187
|
var import_fs_extra = __toESM(require_lib(), 1);
|
|
53122
54188
|
var VERCEL_DIR = ".vercel";
|
|
53123
54189
|
var VERCEL_DIR_MICROFRONTENDS = "microfrontends.json";
|
|
@@ -53131,16 +54197,16 @@ async function pull2(client) {
|
|
|
53131
54197
|
return 1;
|
|
53132
54198
|
}
|
|
53133
54199
|
const autoConfirm = !!parsedArgs.flags["--yes"];
|
|
53134
|
-
const
|
|
54200
|
+
const link2 = await ensureLink("microfrontends", client, client.cwd, {
|
|
53135
54201
|
autoConfirm
|
|
53136
54202
|
});
|
|
53137
|
-
if (typeof
|
|
53138
|
-
return
|
|
54203
|
+
if (typeof link2 === "number") {
|
|
54204
|
+
return link2;
|
|
53139
54205
|
}
|
|
53140
|
-
const { project, org, repoRoot } =
|
|
54206
|
+
const { project, org, repoRoot } = link2;
|
|
53141
54207
|
let currentDirectory;
|
|
53142
54208
|
if (repoRoot) {
|
|
53143
|
-
currentDirectory =
|
|
54209
|
+
currentDirectory = join17(repoRoot, project.rootDirectory || "");
|
|
53144
54210
|
} else {
|
|
53145
54211
|
currentDirectory = client.cwd;
|
|
53146
54212
|
}
|
|
@@ -53178,7 +54244,7 @@ async function pull2(client) {
|
|
|
53178
54244
|
)
|
|
53179
54245
|
};
|
|
53180
54246
|
output_manager_default.stopSpinner();
|
|
53181
|
-
const path3 =
|
|
54247
|
+
const path3 = join17(currentDirectory, VERCEL_DIR, VERCEL_DIR_MICROFRONTENDS);
|
|
53182
54248
|
await (0, import_fs_extra.outputJSON)(path3, sanitizedConfig, {
|
|
53183
54249
|
spaces: 2
|
|
53184
54250
|
});
|
|
@@ -53187,7 +54253,7 @@ async function pull2(client) {
|
|
|
53187
54253
|
`${prependEmoji(
|
|
53188
54254
|
`Downloaded microfrontends configuration to ${import_chalk192.default.bold(
|
|
53189
54255
|
humanizePath(
|
|
53190
|
-
|
|
54256
|
+
join17(currentDirectory, VERCEL_DIR, VERCEL_DIR_MICROFRONTENDS)
|
|
53191
54257
|
)
|
|
53192
54258
|
)} ${import_chalk192.default.gray(microfrontendsStamp())}`,
|
|
53193
54259
|
emoji("success")
|
|
@@ -53204,19 +54270,19 @@ async function pull2(client) {
|
|
|
53204
54270
|
|
|
53205
54271
|
// src/commands/microfrontends/create-group.ts
|
|
53206
54272
|
var import_chalk193 = __toESM(require_source(), 1);
|
|
53207
|
-
import { writeFile as
|
|
53208
|
-
import { existsSync as
|
|
53209
|
-
import { join as
|
|
54273
|
+
import { writeFile as writeFile8 } from "fs/promises";
|
|
54274
|
+
import { existsSync as existsSync3 } from "fs";
|
|
54275
|
+
import { join as join18 } from "path";
|
|
53210
54276
|
|
|
53211
54277
|
// src/commands/microfrontends/utils.ts
|
|
53212
54278
|
async function ensureMicrofrontendsContext(client, options) {
|
|
53213
|
-
const
|
|
54279
|
+
const link2 = await ensureLink("microfrontends", client, client.cwd, {
|
|
53214
54280
|
autoConfirm: options?.autoConfirm
|
|
53215
54281
|
});
|
|
53216
|
-
if (typeof
|
|
53217
|
-
return
|
|
54282
|
+
if (typeof link2 === "number") {
|
|
54283
|
+
return link2;
|
|
53218
54284
|
}
|
|
53219
|
-
const { project, org, repoRoot } =
|
|
54285
|
+
const { project, org, repoRoot } = link2;
|
|
53220
54286
|
if (org.type !== "team") {
|
|
53221
54287
|
output_manager_default.error("Microfrontends are only available for teams.");
|
|
53222
54288
|
return 1;
|
|
@@ -53626,13 +54692,13 @@ async function createGroup(client) {
|
|
|
53626
54692
|
output_manager_default.log(
|
|
53627
54693
|
`View microfrontends group: ${output_manager_default.link(settingsUrl, settingsUrl, { fallback: false })}`
|
|
53628
54694
|
);
|
|
53629
|
-
const
|
|
53630
|
-
const linkedProject =
|
|
54695
|
+
const link2 = await getLinkedProject(client, { cwd: client.cwd });
|
|
54696
|
+
const linkedProject = link2.status === "linked" ? link2.project : void 0;
|
|
53631
54697
|
if (linkedProject && linkedProject.id === defaultApp.id) {
|
|
53632
|
-
const repoRoot =
|
|
53633
|
-
const projectDir = repoRoot ?
|
|
53634
|
-
const configPath =
|
|
53635
|
-
if (!
|
|
54698
|
+
const repoRoot = link2.status === "linked" ? link2.repoRoot : void 0;
|
|
54699
|
+
const projectDir = repoRoot ? join18(repoRoot, linkedProject.rootDirectory || "") : client.cwd;
|
|
54700
|
+
const configPath = join18(projectDir, "microfrontends.json");
|
|
54701
|
+
if (!existsSync3(configPath)) {
|
|
53636
54702
|
output_manager_default.log("");
|
|
53637
54703
|
output_manager_default.log(
|
|
53638
54704
|
`No changes to production traffic will take effect until a ${import_chalk193.default.bold("microfrontends.json")} is added to the default app. This configuration file specifies the path routing for the microfrontends group.`
|
|
@@ -53668,7 +54734,7 @@ async function createGroup(client) {
|
|
|
53668
54734
|
routingPaths,
|
|
53669
54735
|
productionAlias
|
|
53670
54736
|
);
|
|
53671
|
-
await
|
|
54737
|
+
await writeFile8(configPath, config + "\n", "utf-8");
|
|
53672
54738
|
output_manager_default.success(`Created ${import_chalk193.default.bold("microfrontends.json")}`);
|
|
53673
54739
|
output_manager_default.log(
|
|
53674
54740
|
"Create a preview deployment to test microfrontends before deploying to production."
|
|
@@ -54176,8 +55242,8 @@ async function deleteGroup(client) {
|
|
|
54176
55242
|
}
|
|
54177
55243
|
selectedGroup = found;
|
|
54178
55244
|
} else {
|
|
54179
|
-
const
|
|
54180
|
-
const linkedProject =
|
|
55245
|
+
const link2 = await getLinkedProject(client, { cwd: client.cwd });
|
|
55246
|
+
const linkedProject = link2.status === "linked" ? link2.project : void 0;
|
|
54181
55247
|
const linkedGroup = linkedProject ? groups.find(
|
|
54182
55248
|
(g) => g.projects.some(
|
|
54183
55249
|
(p) => p.id === linkedProject.id && p.microfrontends?.isDefaultApp
|
|
@@ -54279,8 +55345,8 @@ async function deleteGroup(client) {
|
|
|
54279
55345
|
}
|
|
54280
55346
|
|
|
54281
55347
|
// src/commands/microfrontends/inspect-group.ts
|
|
54282
|
-
import { existsSync as
|
|
54283
|
-
import { join as
|
|
55348
|
+
import { existsSync as existsSync4 } from "fs";
|
|
55349
|
+
import { join as join19 } from "path";
|
|
54284
55350
|
var import_chalk197 = __toESM(require_source(), 1);
|
|
54285
55351
|
async function inspectGroup(client) {
|
|
54286
55352
|
let parsedArgs;
|
|
@@ -54509,8 +55575,8 @@ async function enrichGroupProject(client, teamId, group, groupProject, localRepo
|
|
|
54509
55575
|
}
|
|
54510
55576
|
async function getLocalRepoContext(client) {
|
|
54511
55577
|
try {
|
|
54512
|
-
const
|
|
54513
|
-
if (
|
|
55578
|
+
const link2 = await getLinkedProject(client, { cwd: client.cwd });
|
|
55579
|
+
if (link2.status !== "linked") {
|
|
54514
55580
|
return {
|
|
54515
55581
|
repoRoot: null,
|
|
54516
55582
|
linkedProjectId: null,
|
|
@@ -54519,10 +55585,10 @@ async function getLocalRepoContext(client) {
|
|
|
54519
55585
|
};
|
|
54520
55586
|
}
|
|
54521
55587
|
return {
|
|
54522
|
-
repoRoot:
|
|
54523
|
-
linkedProjectId:
|
|
54524
|
-
linkedRepoOrg:
|
|
54525
|
-
linkedRepoName:
|
|
55588
|
+
repoRoot: link2.repoRoot ?? null,
|
|
55589
|
+
linkedProjectId: link2.project.id,
|
|
55590
|
+
linkedRepoOrg: link2.project.link?.org ?? null,
|
|
55591
|
+
linkedRepoName: link2.project.link?.repo ?? null
|
|
54526
55592
|
};
|
|
54527
55593
|
} catch {
|
|
54528
55594
|
return {
|
|
@@ -54546,8 +55612,8 @@ async function resolvePackageNameFromLocalRepo(localRepoContext, gitOrg, gitRepo
|
|
|
54546
55612
|
if (!isProjectInLocalRepo(localRepoContext, gitOrg, gitRepo)) {
|
|
54547
55613
|
return null;
|
|
54548
55614
|
}
|
|
54549
|
-
const projectDir =
|
|
54550
|
-
const packageJsonPath =
|
|
55615
|
+
const projectDir = join19(localRepoContext.repoRoot, rootDirectory || "");
|
|
55616
|
+
const packageJsonPath = join19(projectDir, "package.json");
|
|
54551
55617
|
const pkg = await readJSONFile(packageJsonPath);
|
|
54552
55618
|
if (!pkg || pkg instanceof Error) {
|
|
54553
55619
|
return null;
|
|
@@ -54566,23 +55632,23 @@ function resolveLocalConfigFilePath(projects2, localRepoContext, configuredConfi
|
|
|
54566
55632
|
)) {
|
|
54567
55633
|
return null;
|
|
54568
55634
|
}
|
|
54569
|
-
const projectDir =
|
|
55635
|
+
const projectDir = join19(
|
|
54570
55636
|
localRepoContext.repoRoot,
|
|
54571
55637
|
defaultProject.git.rootDirectory || ""
|
|
54572
55638
|
);
|
|
54573
55639
|
const configuredName = configuredConfigFileName ?? null;
|
|
54574
55640
|
if (configuredName) {
|
|
54575
|
-
const configuredPath =
|
|
54576
|
-
if (
|
|
55641
|
+
const configuredPath = join19(projectDir, configuredName);
|
|
55642
|
+
if (existsSync4(configuredPath)) {
|
|
54577
55643
|
return configuredPath;
|
|
54578
55644
|
}
|
|
54579
55645
|
}
|
|
54580
|
-
const jsonPath =
|
|
54581
|
-
const jsoncPath =
|
|
54582
|
-
if (
|
|
55646
|
+
const jsonPath = join19(projectDir, "microfrontends.json");
|
|
55647
|
+
const jsoncPath = join19(projectDir, "microfrontends.jsonc");
|
|
55648
|
+
if (existsSync4(jsonPath)) {
|
|
54583
55649
|
return jsonPath;
|
|
54584
55650
|
}
|
|
54585
|
-
if (
|
|
55651
|
+
if (existsSync4(jsoncPath)) {
|
|
54586
55652
|
return jsoncPath;
|
|
54587
55653
|
}
|
|
54588
55654
|
return null;
|
|
@@ -54777,20 +55843,20 @@ async function openCommandHandler(client) {
|
|
|
54777
55843
|
return 0;
|
|
54778
55844
|
}
|
|
54779
55845
|
const autoConfirm = !!parsedArgs.flags["--yes"];
|
|
54780
|
-
const
|
|
55846
|
+
const link2 = await ensureLink("open", client, client.cwd, {
|
|
54781
55847
|
autoConfirm
|
|
54782
55848
|
});
|
|
54783
|
-
if (typeof
|
|
54784
|
-
return
|
|
55849
|
+
if (typeof link2 === "number") {
|
|
55850
|
+
return link2;
|
|
54785
55851
|
}
|
|
54786
|
-
if (
|
|
55852
|
+
if (link2.status !== "linked" || !link2.org || !link2.project) {
|
|
54787
55853
|
if (!client.nonInteractive) {
|
|
54788
55854
|
output_manager_default.error("This command requires a linked project. Please run:");
|
|
54789
55855
|
output_manager_default.print(" vercel link\n");
|
|
54790
55856
|
}
|
|
54791
55857
|
return 1;
|
|
54792
55858
|
}
|
|
54793
|
-
const { org, project } =
|
|
55859
|
+
const { org, project } = link2;
|
|
54794
55860
|
const projectUrl = `https://vercel.com/${org.slug}/${project.name}`;
|
|
54795
55861
|
output_manager_default.log(`Opening ${projectUrl} in your browser...`);
|
|
54796
55862
|
await (0, import_open15.default)(projectUrl);
|
|
@@ -58412,14 +59478,14 @@ async function list17(client, argv) {
|
|
|
58412
59478
|
const parsed = await parseSubcommandArgs3(argv, listSubcommand16);
|
|
58413
59479
|
if (typeof parsed === "number")
|
|
58414
59480
|
return parsed;
|
|
58415
|
-
const
|
|
59481
|
+
const link2 = await requireProjectContext(
|
|
58416
59482
|
client,
|
|
58417
59483
|
"redirects",
|
|
58418
59484
|
parsed.flags["--project"]
|
|
58419
59485
|
);
|
|
58420
|
-
if (typeof
|
|
58421
|
-
return
|
|
58422
|
-
const { project, org } =
|
|
59486
|
+
if (typeof link2 === "number")
|
|
59487
|
+
return link2;
|
|
59488
|
+
const { project, org } = link2;
|
|
58423
59489
|
const { flags } = parsed;
|
|
58424
59490
|
const teamId = org.type === "team" ? org.id : void 0;
|
|
58425
59491
|
const search2 = flags["--search"];
|
|
@@ -58583,14 +59649,14 @@ async function listVersions2(client, argv) {
|
|
|
58583
59649
|
const parsed = await parseSubcommandArgs3(argv, listVersionsSubcommand);
|
|
58584
59650
|
if (typeof parsed === "number")
|
|
58585
59651
|
return parsed;
|
|
58586
|
-
const
|
|
59652
|
+
const link2 = await requireProjectContext(
|
|
58587
59653
|
client,
|
|
58588
59654
|
"redirects",
|
|
58589
59655
|
parsed.flags["--project"]
|
|
58590
59656
|
);
|
|
58591
|
-
if (typeof
|
|
58592
|
-
return
|
|
58593
|
-
const { project, org } =
|
|
59657
|
+
if (typeof link2 === "number")
|
|
59658
|
+
return link2;
|
|
59659
|
+
const { project, org } = link2;
|
|
58594
59660
|
const teamId = org.type === "team" ? org.id : void 0;
|
|
58595
59661
|
const lsStamp = stamp_default();
|
|
58596
59662
|
output_manager_default.spinner(`Fetching redirect versions for ${import_chalk216.default.bold(project.name)}`);
|
|
@@ -58700,14 +59766,14 @@ async function add10(client, argv) {
|
|
|
58700
59766
|
const parsed = await parseSubcommandArgs3(argv, addSubcommand8);
|
|
58701
59767
|
if (typeof parsed === "number")
|
|
58702
59768
|
return parsed;
|
|
58703
|
-
const
|
|
59769
|
+
const link2 = await requireProjectContext(
|
|
58704
59770
|
client,
|
|
58705
59771
|
"redirects",
|
|
58706
59772
|
parsed.flags["--project"]
|
|
58707
59773
|
);
|
|
58708
|
-
if (typeof
|
|
58709
|
-
return
|
|
58710
|
-
const { project, org } =
|
|
59774
|
+
if (typeof link2 === "number")
|
|
59775
|
+
return link2;
|
|
59776
|
+
const { project, org } = link2;
|
|
58711
59777
|
const teamId = org.type === "team" ? org.id : void 0;
|
|
58712
59778
|
const { versions: versions2 } = await getRedirectVersions(client, project.id, teamId);
|
|
58713
59779
|
const existingStagingVersion = versions2.find((v) => v.isStaging);
|
|
@@ -58998,7 +60064,7 @@ async function add10(client, argv) {
|
|
|
58998
60064
|
// src/commands/redirects/upload.ts
|
|
58999
60065
|
var import_chalk218 = __toESM(require_source(), 1);
|
|
59000
60066
|
import { readFileSync as readFileSync4 } from "fs";
|
|
59001
|
-
import { basename as
|
|
60067
|
+
import { basename as basename3 } from "path";
|
|
59002
60068
|
|
|
59003
60069
|
// src/commands/redirects/validate-redirects.ts
|
|
59004
60070
|
import { statSync as statSync2 } from "fs";
|
|
@@ -59131,14 +60197,14 @@ async function upload(client, argv) {
|
|
|
59131
60197
|
const parsed = await parseSubcommandArgs3(argv, uploadSubcommand);
|
|
59132
60198
|
if (typeof parsed === "number")
|
|
59133
60199
|
return parsed;
|
|
59134
|
-
const
|
|
60200
|
+
const link2 = await requireProjectContext(
|
|
59135
60201
|
client,
|
|
59136
60202
|
"redirects",
|
|
59137
60203
|
parsed.flags["--project"]
|
|
59138
60204
|
);
|
|
59139
|
-
if (typeof
|
|
59140
|
-
return
|
|
59141
|
-
const { project, org } =
|
|
60205
|
+
if (typeof link2 === "number")
|
|
60206
|
+
return link2;
|
|
60207
|
+
const { project, org } = link2;
|
|
59142
60208
|
const teamId = org.type === "team" ? org.id : void 0;
|
|
59143
60209
|
const { args, flags } = parsed;
|
|
59144
60210
|
const skipPrompts = flags["--yes"] || false;
|
|
@@ -59196,7 +60262,7 @@ async function upload(client, argv) {
|
|
|
59196
60262
|
const { versions: versions2 } = await getRedirectVersions(client, project.id, teamId);
|
|
59197
60263
|
const existingStagingVersion = versions2.find((v) => v.isStaging);
|
|
59198
60264
|
if (!skipPrompts) {
|
|
59199
|
-
const fileName =
|
|
60265
|
+
const fileName = basename3(filePath);
|
|
59200
60266
|
const fileType = filePath.endsWith(".csv") ? "CSV" : "JSON";
|
|
59201
60267
|
const message = overwrite ? `Upload ${fileType} file "${fileName}" and replace all existing redirects?` : `Upload ${fileType} file "${fileName}"?`;
|
|
59202
60268
|
const confirmed = await client.input.confirm(message, true);
|
|
@@ -59235,7 +60301,7 @@ async function upload(client, argv) {
|
|
|
59235
60301
|
const url = "/v1/bulk-redirects";
|
|
59236
60302
|
if (filePath.endsWith(".csv")) {
|
|
59237
60303
|
const csvContent = readFileSync4(filePath);
|
|
59238
|
-
const fileName =
|
|
60304
|
+
const fileName = basename3(filePath);
|
|
59239
60305
|
const csvValidation = validateCSVStructure(csvContent.toString());
|
|
59240
60306
|
if (!csvValidation.valid) {
|
|
59241
60307
|
output_manager_default.error(`Invalid CSV: ${csvValidation.error}`);
|
|
@@ -59512,14 +60578,14 @@ async function remove10(client, argv) {
|
|
|
59512
60578
|
output_manager_default.error(error);
|
|
59513
60579
|
return 1;
|
|
59514
60580
|
}
|
|
59515
|
-
const
|
|
60581
|
+
const link2 = await requireProjectContext(
|
|
59516
60582
|
client,
|
|
59517
60583
|
"redirects",
|
|
59518
60584
|
parsed.flags["--project"]
|
|
59519
60585
|
);
|
|
59520
|
-
if (typeof
|
|
59521
|
-
return
|
|
59522
|
-
const { project, org } =
|
|
60586
|
+
if (typeof link2 === "number")
|
|
60587
|
+
return link2;
|
|
60588
|
+
const { project, org } = link2;
|
|
59523
60589
|
const teamId = org.type === "team" ? org.id : void 0;
|
|
59524
60590
|
const { versions: versions2 } = await getRedirectVersions(client, project.id, teamId);
|
|
59525
60591
|
const existingStagingVersion = versions2.find((v) => v.isStaging);
|
|
@@ -59719,14 +60785,14 @@ async function promote(client, argv) {
|
|
|
59719
60785
|
output_manager_default.error(error);
|
|
59720
60786
|
return 1;
|
|
59721
60787
|
}
|
|
59722
|
-
const
|
|
60788
|
+
const link2 = await requireProjectContext(
|
|
59723
60789
|
client,
|
|
59724
60790
|
"redirects",
|
|
59725
60791
|
parsed.flags["--project"]
|
|
59726
60792
|
);
|
|
59727
|
-
if (typeof
|
|
59728
|
-
return
|
|
59729
|
-
const { project, org } =
|
|
60793
|
+
if (typeof link2 === "number")
|
|
60794
|
+
return link2;
|
|
60795
|
+
const { project, org } = link2;
|
|
59730
60796
|
const teamId = org.type === "team" ? org.id : void 0;
|
|
59731
60797
|
const [versionIdentifier] = parsed.args;
|
|
59732
60798
|
output_manager_default.spinner(`Fetching redirect versions for ${import_chalk220.default.bold(project.name)}`);
|
|
@@ -59948,14 +61014,14 @@ async function restore(client, argv) {
|
|
|
59948
61014
|
output_manager_default.error(error);
|
|
59949
61015
|
return 1;
|
|
59950
61016
|
}
|
|
59951
|
-
const
|
|
61017
|
+
const link2 = await requireProjectContext(
|
|
59952
61018
|
client,
|
|
59953
61019
|
"redirects",
|
|
59954
61020
|
parsed.flags["--project"]
|
|
59955
61021
|
);
|
|
59956
|
-
if (typeof
|
|
59957
|
-
return
|
|
59958
|
-
const { project, org } =
|
|
61022
|
+
if (typeof link2 === "number")
|
|
61023
|
+
return link2;
|
|
61024
|
+
const { project, org } = link2;
|
|
59959
61025
|
const teamId = org.type === "team" ? org.id : void 0;
|
|
59960
61026
|
const [versionIdentifier] = parsed.args;
|
|
59961
61027
|
output_manager_default.spinner(`Fetching redirect versions for ${import_chalk221.default.bold(project.name)}`);
|
|
@@ -61532,14 +62598,14 @@ async function rollingRelease(client) {
|
|
|
61532
62598
|
projectName = subcommandFlags.flags["--project"];
|
|
61533
62599
|
telemetry2.trackCliOptionProject(projectName);
|
|
61534
62600
|
}
|
|
61535
|
-
const
|
|
62601
|
+
const link2 = await resolveProjectContext({
|
|
61536
62602
|
client,
|
|
61537
62603
|
projectNameOrId: projectName
|
|
61538
62604
|
});
|
|
61539
|
-
if (
|
|
61540
|
-
return
|
|
62605
|
+
if (link2.status === "error") {
|
|
62606
|
+
return link2.exitCode;
|
|
61541
62607
|
}
|
|
61542
|
-
if (
|
|
62608
|
+
if (link2.status === "not_linked") {
|
|
61543
62609
|
if (client.nonInteractive) {
|
|
61544
62610
|
outputAgentError(
|
|
61545
62611
|
client,
|
|
@@ -61557,7 +62623,7 @@ async function rollingRelease(client) {
|
|
|
61557
62623
|
);
|
|
61558
62624
|
return 1;
|
|
61559
62625
|
}
|
|
61560
|
-
const { project, org } =
|
|
62626
|
+
const { project, org } = link2;
|
|
61561
62627
|
client.config.currentTeam = org.type === "team" ? org.id : void 0;
|
|
61562
62628
|
if (!subcommandName || !subcommandFlags) {
|
|
61563
62629
|
output_manager_default.debug(`Invalid subcommand: ${subcommand}`);
|
|
@@ -61774,14 +62840,14 @@ async function list18(client, argv) {
|
|
|
61774
62840
|
const parsed = await parseSubcommandArgs(argv, listSubcommand17, client);
|
|
61775
62841
|
if (typeof parsed === "number")
|
|
61776
62842
|
return parsed;
|
|
61777
|
-
const
|
|
62843
|
+
const link2 = await requireProjectContext(
|
|
61778
62844
|
client,
|
|
61779
62845
|
"routes",
|
|
61780
62846
|
parsed.flags["--project"]
|
|
61781
62847
|
);
|
|
61782
|
-
if (typeof
|
|
61783
|
-
return
|
|
61784
|
-
const { project, org } =
|
|
62848
|
+
if (typeof link2 === "number")
|
|
62849
|
+
return link2;
|
|
62850
|
+
const { project, org } = link2;
|
|
61785
62851
|
const { flags } = parsed;
|
|
61786
62852
|
const teamId = org.type === "team" ? org.id : void 0;
|
|
61787
62853
|
const search2 = flags["--search"];
|
|
@@ -62123,14 +63189,14 @@ async function listVersions3(client, argv) {
|
|
|
62123
63189
|
);
|
|
62124
63190
|
if (typeof parsed === "number")
|
|
62125
63191
|
return parsed;
|
|
62126
|
-
const
|
|
63192
|
+
const link2 = await requireProjectContext(
|
|
62127
63193
|
client,
|
|
62128
63194
|
"routes",
|
|
62129
63195
|
parsed.flags["--project"]
|
|
62130
63196
|
);
|
|
62131
|
-
if (typeof
|
|
62132
|
-
return
|
|
62133
|
-
const { project, org } =
|
|
63197
|
+
if (typeof link2 === "number")
|
|
63198
|
+
return link2;
|
|
63199
|
+
const { project, org } = link2;
|
|
62134
63200
|
const { flags } = parsed;
|
|
62135
63201
|
const teamId = org.type === "team" ? org.id : void 0;
|
|
62136
63202
|
const count2 = flags["--count"];
|
|
@@ -62209,14 +63275,14 @@ async function inspect9(client, argv) {
|
|
|
62209
63275
|
const parsed = await parseSubcommandArgs(argv, inspectSubcommand9, client);
|
|
62210
63276
|
if (typeof parsed === "number")
|
|
62211
63277
|
return parsed;
|
|
62212
|
-
const
|
|
63278
|
+
const link2 = await requireProjectContext(
|
|
62213
63279
|
client,
|
|
62214
63280
|
"routes",
|
|
62215
63281
|
parsed.flags["--project"]
|
|
62216
63282
|
);
|
|
62217
|
-
if (typeof
|
|
62218
|
-
return
|
|
62219
|
-
const { project, org } =
|
|
63283
|
+
if (typeof link2 === "number")
|
|
63284
|
+
return link2;
|
|
63285
|
+
const { project, org } = link2;
|
|
62220
63286
|
const { flags, args } = parsed;
|
|
62221
63287
|
const teamId = org.type === "team" ? org.id : void 0;
|
|
62222
63288
|
const showDiff = flags["--diff"];
|
|
@@ -62752,14 +63818,14 @@ async function add11(client, argv) {
|
|
|
62752
63818
|
const parsed = await parseSubcommandArgs(argv, addSubcommand9, client);
|
|
62753
63819
|
if (typeof parsed === "number")
|
|
62754
63820
|
return parsed;
|
|
62755
|
-
const
|
|
63821
|
+
const link2 = await requireProjectContext(
|
|
62756
63822
|
client,
|
|
62757
63823
|
"routes",
|
|
62758
63824
|
parsed.flags["--project"]
|
|
62759
63825
|
);
|
|
62760
|
-
if (typeof
|
|
62761
|
-
return
|
|
62762
|
-
const { project, org } =
|
|
63826
|
+
if (typeof link2 === "number")
|
|
63827
|
+
return link2;
|
|
63828
|
+
const { project, org } = link2;
|
|
62763
63829
|
const teamId = org.type === "team" ? org.id : void 0;
|
|
62764
63830
|
const { args, flags } = parsed;
|
|
62765
63831
|
const isAgentMode = client.nonInteractive;
|
|
@@ -63810,7 +64876,7 @@ async function main26(client) {
|
|
|
63810
64876
|
return 2;
|
|
63811
64877
|
}
|
|
63812
64878
|
telemetry2.trackCliSubcommandEdit(subcommandOriginal);
|
|
63813
|
-
return (await import("./chunks/edit-
|
|
64879
|
+
return (await import("./chunks/edit-NW4YBUR6.js")).default(client, args);
|
|
63814
64880
|
case "delete":
|
|
63815
64881
|
if (needHelp) {
|
|
63816
64882
|
telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
|
|
@@ -63818,7 +64884,7 @@ async function main26(client) {
|
|
|
63818
64884
|
return 2;
|
|
63819
64885
|
}
|
|
63820
64886
|
telemetry2.trackCliSubcommandDelete(subcommandOriginal);
|
|
63821
|
-
return (await import("./chunks/delete-
|
|
64887
|
+
return (await import("./chunks/delete-7NADCRED.js")).default(client, args);
|
|
63822
64888
|
case "enable":
|
|
63823
64889
|
if (needHelp) {
|
|
63824
64890
|
telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
|
|
@@ -63826,7 +64892,7 @@ async function main26(client) {
|
|
|
63826
64892
|
return 2;
|
|
63827
64893
|
}
|
|
63828
64894
|
telemetry2.trackCliSubcommandEnable(subcommandOriginal);
|
|
63829
|
-
return (await import("./chunks/enable-
|
|
64895
|
+
return (await import("./chunks/enable-QEL5CXVD.js")).default(client, args);
|
|
63830
64896
|
case "disable":
|
|
63831
64897
|
if (needHelp) {
|
|
63832
64898
|
telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
|
|
@@ -63834,7 +64900,7 @@ async function main26(client) {
|
|
|
63834
64900
|
return 2;
|
|
63835
64901
|
}
|
|
63836
64902
|
telemetry2.trackCliSubcommandDisable(subcommandOriginal);
|
|
63837
|
-
return (await import("./chunks/disable-
|
|
64903
|
+
return (await import("./chunks/disable-SB224IIS.js")).default(client, args);
|
|
63838
64904
|
case "reorder":
|
|
63839
64905
|
if (needHelp) {
|
|
63840
64906
|
telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
|
|
@@ -63842,7 +64908,7 @@ async function main26(client) {
|
|
|
63842
64908
|
return 2;
|
|
63843
64909
|
}
|
|
63844
64910
|
telemetry2.trackCliSubcommandReorder(subcommandOriginal);
|
|
63845
|
-
return (await import("./chunks/reorder-
|
|
64911
|
+
return (await import("./chunks/reorder-GNCRV6CV.js")).default(client, args);
|
|
63846
64912
|
case "export":
|
|
63847
64913
|
if (needHelp) {
|
|
63848
64914
|
telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
|
|
@@ -63850,7 +64916,7 @@ async function main26(client) {
|
|
|
63850
64916
|
return 2;
|
|
63851
64917
|
}
|
|
63852
64918
|
telemetry2.trackCliSubcommandExport(subcommandOriginal);
|
|
63853
|
-
return (await import("./chunks/export-
|
|
64919
|
+
return (await import("./chunks/export-XDOZTLG3.js")).default(client, args);
|
|
63854
64920
|
case "publish":
|
|
63855
64921
|
if (needHelp) {
|
|
63856
64922
|
telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
|
|
@@ -63858,7 +64924,7 @@ async function main26(client) {
|
|
|
63858
64924
|
return 2;
|
|
63859
64925
|
}
|
|
63860
64926
|
telemetry2.trackCliSubcommandPublish(subcommandOriginal);
|
|
63861
|
-
return (await import("./chunks/publish-
|
|
64927
|
+
return (await import("./chunks/publish-D2QWFUP4.js")).default(client, args);
|
|
63862
64928
|
case "restore":
|
|
63863
64929
|
if (needHelp) {
|
|
63864
64930
|
telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
|
|
@@ -63866,7 +64932,7 @@ async function main26(client) {
|
|
|
63866
64932
|
return 2;
|
|
63867
64933
|
}
|
|
63868
64934
|
telemetry2.trackCliSubcommandRestore(subcommandOriginal);
|
|
63869
|
-
return (await import("./chunks/restore-
|
|
64935
|
+
return (await import("./chunks/restore-SXI5SHGJ.js")).default(client, args);
|
|
63870
64936
|
case "discard-staging":
|
|
63871
64937
|
if (needHelp) {
|
|
63872
64938
|
telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
|
|
@@ -63874,7 +64940,7 @@ async function main26(client) {
|
|
|
63874
64940
|
return 2;
|
|
63875
64941
|
}
|
|
63876
64942
|
telemetry2.trackCliSubcommandDiscardStaging(subcommandOriginal);
|
|
63877
|
-
return (await import("./chunks/discard-
|
|
64943
|
+
return (await import("./chunks/discard-MME6PI7B.js")).default(client, args);
|
|
63878
64944
|
default:
|
|
63879
64945
|
output_manager_default.error(getInvalidSubcommand(COMMAND_CONFIG45));
|
|
63880
64946
|
output_manager_default.print(help(routesCommand, { columns: client.stderr.columns }));
|
|
@@ -63948,8 +65014,8 @@ async function sandbox(client) {
|
|
|
63948
65014
|
var import_chalk229 = __toESM(require_source(), 1);
|
|
63949
65015
|
var import_frameworks3 = __toESM(require_frameworks(), 1);
|
|
63950
65016
|
var import_fs_detectors = __toESM(require_dist3(), 1);
|
|
63951
|
-
import { access as access3, readFile as
|
|
63952
|
-
import { join as
|
|
65017
|
+
import { access as access3, readFile as readFile9 } from "fs/promises";
|
|
65018
|
+
import { join as join20 } from "path";
|
|
63953
65019
|
import { homedir as homedir2 } from "os";
|
|
63954
65020
|
import { spawn as spawn4 } from "child_process";
|
|
63955
65021
|
|
|
@@ -64041,8 +65107,8 @@ async function searchSkills(query) {
|
|
|
64041
65107
|
}
|
|
64042
65108
|
async function detectProjectFramework(cwd) {
|
|
64043
65109
|
try {
|
|
64044
|
-
const
|
|
64045
|
-
const detected = await (0, import_fs_detectors.detectFrameworks)({ fs:
|
|
65110
|
+
const fs4 = new import_fs_detectors.LocalFileSystemDetector(cwd);
|
|
65111
|
+
const detected = await (0, import_fs_detectors.detectFrameworks)({ fs: fs4, frameworkList: import_frameworks3.frameworkList });
|
|
64046
65112
|
if (detected.length > 0) {
|
|
64047
65113
|
return { name: detected[0].name, slug: detected[0].slug || "" };
|
|
64048
65114
|
}
|
|
@@ -64052,7 +65118,7 @@ async function detectProjectFramework(cwd) {
|
|
|
64052
65118
|
}
|
|
64053
65119
|
async function readPackageDeps(cwd) {
|
|
64054
65120
|
try {
|
|
64055
|
-
const raw = await
|
|
65121
|
+
const raw = await readFile9(join20(cwd, "package.json"), "utf8");
|
|
64056
65122
|
const pkg = JSON.parse(raw);
|
|
64057
65123
|
const allDeps = {
|
|
64058
65124
|
...pkg.dependencies,
|
|
@@ -64072,8 +65138,8 @@ function cleanDepName(dep) {
|
|
|
64072
65138
|
async function isSkillInstalled(name, cwd) {
|
|
64073
65139
|
const sanitized = name.toLowerCase().replace(/\s+/g, "-");
|
|
64074
65140
|
const dirs = [
|
|
64075
|
-
|
|
64076
|
-
|
|
65141
|
+
join20(cwd, ".agents", "skills", sanitized),
|
|
65142
|
+
join20(homedir2(), ".agents", "skills", sanitized)
|
|
64077
65143
|
];
|
|
64078
65144
|
for (const dir of dirs) {
|
|
64079
65145
|
try {
|
|
@@ -64406,23 +65472,23 @@ async function list19(client, argv) {
|
|
|
64406
65472
|
const projectName = parsedArgs.flags["--project"];
|
|
64407
65473
|
telemetry2.trackCliOptionProject(projectName);
|
|
64408
65474
|
const autoConfirm = !!parsedArgs.flags["--yes"];
|
|
64409
|
-
const
|
|
65475
|
+
const link2 = await ensureLink(targetCommand.name, client, cwd, {
|
|
64410
65476
|
autoConfirm,
|
|
64411
65477
|
projectName,
|
|
64412
65478
|
failIfNotFound: Boolean(projectName)
|
|
64413
65479
|
});
|
|
64414
|
-
if (typeof
|
|
64415
|
-
return
|
|
65480
|
+
if (typeof link2 === "number") {
|
|
65481
|
+
return link2;
|
|
64416
65482
|
}
|
|
64417
65483
|
const start = Date.now();
|
|
64418
|
-
const projectSlugLink = formatProject(
|
|
65484
|
+
const projectSlugLink = formatProject(link2.org.slug, link2.project.name);
|
|
64419
65485
|
output_manager_default.spinner(`Fetching custom environments for ${projectSlugLink}`);
|
|
64420
65486
|
const url = `/projects/${encodeURIComponent(
|
|
64421
|
-
|
|
65487
|
+
link2.project.id
|
|
64422
65488
|
)}/custom-environments`;
|
|
64423
65489
|
let { environments: result } = await client.fetch(url, {
|
|
64424
65490
|
method: "GET",
|
|
64425
|
-
accountId:
|
|
65491
|
+
accountId: link2.org.id
|
|
64426
65492
|
});
|
|
64427
65493
|
output_manager_default.stopSpinner();
|
|
64428
65494
|
const elapsed2 = (0, import_ms35.default)(Date.now() - start);
|
|
@@ -64453,8 +65519,8 @@ async function list19(client, argv) {
|
|
|
64453
65519
|
...result.flatMap((target) => {
|
|
64454
65520
|
return [
|
|
64455
65521
|
[
|
|
64456
|
-
formatEnvironment(
|
|
64457
|
-
BRANCH_TRACKING_MAP[target.type](
|
|
65522
|
+
formatEnvironment(link2.org.slug, link2.project.name, target),
|
|
65523
|
+
BRANCH_TRACKING_MAP[target.type](link2.project, target),
|
|
64458
65524
|
TYPE_MAP[target.type],
|
|
64459
65525
|
import_chalk230.default.gray(
|
|
64460
65526
|
target.updatedAt > 0 ? (0, import_ms35.default)(Date.now() - target.updatedAt) : "-"
|
|
@@ -65397,15 +66463,15 @@ var updateCurrentTeam = (config, team) => {
|
|
|
65397
66463
|
writeToConfigFile(config);
|
|
65398
66464
|
};
|
|
65399
66465
|
async function warnIfStaleLinkExists(client, newOrgId) {
|
|
65400
|
-
let
|
|
66466
|
+
let link2 = null;
|
|
65401
66467
|
try {
|
|
65402
|
-
|
|
66468
|
+
link2 = await getLinkFromDir(
|
|
65403
66469
|
getVercelDirectory(client.cwd)
|
|
65404
66470
|
);
|
|
65405
66471
|
} catch (_error) {
|
|
65406
|
-
|
|
66472
|
+
link2 = null;
|
|
65407
66473
|
}
|
|
65408
|
-
if (!
|
|
66474
|
+
if (!link2 || link2.orgId === newOrgId) {
|
|
65409
66475
|
return;
|
|
65410
66476
|
}
|
|
65411
66477
|
output_manager_default.warn(
|
|
@@ -66766,8 +67832,8 @@ var TracesTelemetryClient = class extends TelemetryClient {
|
|
|
66766
67832
|
});
|
|
66767
67833
|
}
|
|
66768
67834
|
}
|
|
66769
|
-
trackCliFlagOpen(
|
|
66770
|
-
if (
|
|
67835
|
+
trackCliFlagOpen(open16) {
|
|
67836
|
+
if (open16) {
|
|
66771
67837
|
this.trackCliFlag("open");
|
|
66772
67838
|
}
|
|
66773
67839
|
}
|
|
@@ -68330,6 +69396,12 @@ var VcrTelemetryClient = class extends TelemetryClient {
|
|
|
68330
69396
|
value: actual
|
|
68331
69397
|
});
|
|
68332
69398
|
}
|
|
69399
|
+
trackCliSubcommandConfig(actual) {
|
|
69400
|
+
this.trackCliSubcommand({
|
|
69401
|
+
subcommand: "config",
|
|
69402
|
+
value: actual
|
|
69403
|
+
});
|
|
69404
|
+
}
|
|
68333
69405
|
trackCliSubcommandRm(actual) {
|
|
68334
69406
|
this.trackCliSubcommand({
|
|
68335
69407
|
subcommand: "rm",
|
|
@@ -68437,6 +69509,14 @@ var VcrTelemetryClient = class extends TelemetryClient {
|
|
|
68437
69509
|
});
|
|
68438
69510
|
}
|
|
68439
69511
|
}
|
|
69512
|
+
trackCliOptionPublic(value) {
|
|
69513
|
+
if (value === "true" || value === "false") {
|
|
69514
|
+
this.trackCliOption({
|
|
69515
|
+
option: "public",
|
|
69516
|
+
value
|
|
69517
|
+
});
|
|
69518
|
+
}
|
|
69519
|
+
}
|
|
68440
69520
|
trackCliFlagUntagged(value) {
|
|
68441
69521
|
if (value) {
|
|
68442
69522
|
this.trackCliFlag("untagged");
|
|
@@ -68459,6 +69539,7 @@ var COMMAND_CONFIG51 = {
|
|
|
68459
69539
|
ls: getCommandAliases(listSubcommand21),
|
|
68460
69540
|
inspect: getCommandAliases(inspectSubcommand10),
|
|
68461
69541
|
add: getCommandAliases(addSubcommand12),
|
|
69542
|
+
config: getCommandAliases(configSubcommand),
|
|
68462
69543
|
rm: getCommandAliases(removeSubcommand15),
|
|
68463
69544
|
login: getCommandAliases(loginSubcommand),
|
|
68464
69545
|
build: getCommandAliases(buildSubcommand),
|
|
@@ -68507,6 +69588,10 @@ async function vcr(client) {
|
|
|
68507
69588
|
telemetry2.trackCliFlagHelp("vcr", subcommandOriginal);
|
|
68508
69589
|
printHelp(addSubcommand12);
|
|
68509
69590
|
return 2;
|
|
69591
|
+
case "config":
|
|
69592
|
+
telemetry2.trackCliFlagHelp("vcr", subcommandOriginal);
|
|
69593
|
+
printHelp(configSubcommand);
|
|
69594
|
+
return 2;
|
|
68510
69595
|
case "rm":
|
|
68511
69596
|
telemetry2.trackCliFlagHelp("vcr", subcommandOriginal);
|
|
68512
69597
|
printHelp(removeSubcommand15);
|
|
@@ -68596,34 +69681,37 @@ async function vcr(client) {
|
|
|
68596
69681
|
switch (subcommand) {
|
|
68597
69682
|
case "ls":
|
|
68598
69683
|
telemetry2.trackCliSubcommandLs(subcommandOriginal);
|
|
68599
|
-
return (await import("./chunks/ls-
|
|
69684
|
+
return (await import("./chunks/ls-5I2W7LZQ.js")).default(client, args, telemetry2);
|
|
68600
69685
|
case "inspect":
|
|
68601
69686
|
telemetry2.trackCliSubcommandInspect(subcommandOriginal);
|
|
68602
|
-
return (await import("./chunks/inspect-
|
|
69687
|
+
return (await import("./chunks/inspect-TW5DENBM.js")).default(client, args, telemetry2);
|
|
68603
69688
|
case "add":
|
|
68604
69689
|
telemetry2.trackCliSubcommandAdd(subcommandOriginal);
|
|
68605
|
-
return (await import("./chunks/add-
|
|
69690
|
+
return (await import("./chunks/add-EN4KBTT6.js")).default(client, args, telemetry2);
|
|
69691
|
+
case "config":
|
|
69692
|
+
telemetry2.trackCliSubcommandConfig(subcommandOriginal);
|
|
69693
|
+
return (await import("./chunks/config-MZ3KLGOK.js")).default(client, args, telemetry2);
|
|
68606
69694
|
case "rm":
|
|
68607
69695
|
telemetry2.trackCliSubcommandRm(subcommandOriginal);
|
|
68608
|
-
return (await import("./chunks/rm-
|
|
69696
|
+
return (await import("./chunks/rm-BEIAUTSF.js")).default(client, args, telemetry2);
|
|
68609
69697
|
case "login":
|
|
68610
69698
|
telemetry2.trackCliSubcommandLogin(subcommandOriginal);
|
|
68611
|
-
return (await import("./chunks/login-
|
|
69699
|
+
return (await import("./chunks/login-VJESL6WK.js")).default(client, args, telemetry2);
|
|
68612
69700
|
case "build":
|
|
68613
69701
|
telemetry2.trackCliSubcommandBuild(subcommandOriginal);
|
|
68614
|
-
return (await import("./chunks/build-
|
|
69702
|
+
return (await import("./chunks/build-IDCBAC3R.js")).default(client, telemetry2);
|
|
68615
69703
|
case "push":
|
|
68616
69704
|
telemetry2.trackCliSubcommandPush(subcommandOriginal);
|
|
68617
|
-
return (await import("./chunks/push-
|
|
69705
|
+
return (await import("./chunks/push-75R5ZZIW.js")).default(client, telemetry2);
|
|
68618
69706
|
case "tag":
|
|
68619
69707
|
telemetry2.trackCliSubcommandTag(subcommandOriginal);
|
|
68620
|
-
return (await import("./chunks/tags-
|
|
69708
|
+
return (await import("./chunks/tags-SRHDQUF6.js")).default(client, args, telemetry2);
|
|
68621
69709
|
case "image":
|
|
68622
69710
|
telemetry2.trackCliSubcommandImage(subcommandOriginal);
|
|
68623
|
-
return (await import("./chunks/image-
|
|
69711
|
+
return (await import("./chunks/image-AJMRAAOW.js")).default(client, args, telemetry2);
|
|
68624
69712
|
case "permissions":
|
|
68625
69713
|
telemetry2.trackCliSubcommandPermissions(subcommandOriginal);
|
|
68626
|
-
return (await import("./chunks/permissions-
|
|
69714
|
+
return (await import("./chunks/permissions-HRR47E2L.js")).default(client, args, telemetry2);
|
|
68627
69715
|
default:
|
|
68628
69716
|
output_manager_default.error(getInvalidSubcommand(COMMAND_CONFIG51));
|
|
68629
69717
|
output_manager_default.print(help(vcrCommand, { columns: client.stderr.columns }));
|