vercel 58.8.0 → 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.
Files changed (83) hide show
  1. package/dist/chunks/{add-RVZD257F.js → add-EN4KBTT6.js} +2 -2
  2. package/dist/chunks/{add-GEI53S56.js → add-HFK7NUGY.js} +2 -2
  3. package/dist/chunks/{add-OJLNBYCB.js → add-ZVQJE6BF.js} +6 -6
  4. package/dist/chunks/{build-KAOW7IJ6.js → build-IDCBAC3R.js} +2 -2
  5. package/dist/chunks/{chunk-4IVGF3OR.js → chunk-2PPATWD6.js} +1 -1
  6. package/dist/chunks/{chunk-55JM5YCD.js → chunk-766B6IIX.js} +1 -1
  7. package/dist/chunks/{chunk-N2A6HWBD.js → chunk-7AB6QOKM.js} +1 -1
  8. package/dist/chunks/{chunk-JFJGWMAL.js → chunk-7N26744Z.js} +1 -1
  9. package/dist/chunks/{chunk-IOBULT7M.js → chunk-BX4IGDGM.js} +6 -7
  10. package/dist/chunks/{chunk-LCZDGAXC.js → chunk-CKIZU3CI.js} +1 -1
  11. package/dist/chunks/{chunk-KPDA6YEP.js → chunk-DDUZ2VME.js} +3 -3
  12. package/dist/chunks/{chunk-SPQSJERL.js → chunk-DQXBNALU.js} +1 -1
  13. package/dist/chunks/{chunk-XTIQ7DV7.js → chunk-E3DRV4WI.js} +1 -1
  14. package/dist/chunks/{chunk-AX2PTUXP.js → chunk-F45WFNLZ.js} +1 -1
  15. package/dist/chunks/{chunk-AF7S35K3.js → chunk-FBG4AMAX.js} +1 -1
  16. package/dist/chunks/{chunk-7ZEPVL6J.js → chunk-G2S2QKKF.js} +2 -2
  17. package/dist/chunks/{chunk-YRYC7WDR.js → chunk-KES53W3V.js} +4 -4
  18. package/dist/chunks/{chunk-53LZ5BMD.js → chunk-N22RS64U.js} +2 -2
  19. package/dist/chunks/{chunk-IFNTK75I.js → chunk-NFZHW6HH.js} +9 -2
  20. package/dist/chunks/{chunk-ASSWFLX7.js → chunk-PNSWZSLC.js} +2 -2
  21. package/dist/chunks/{chunk-N7C5X53Q.js → chunk-Q6OJHDZK.js} +1 -1
  22. package/dist/chunks/{chunk-FWZGQKRP.js → chunk-QRRCK6VX.js} +1 -1
  23. package/dist/chunks/{chunk-V3FYICX7.js → chunk-TIBP3CPZ.js} +1 -1
  24. package/dist/chunks/{chunk-EMD7HCIW.js → chunk-U6CTW37A.js} +1 -1
  25. package/dist/chunks/chunk-WWPV6Z24.js +2910 -0
  26. package/dist/chunks/{chunk-4BQZVTJ2.js → chunk-YTIUSEWE.js} +1 -1
  27. package/dist/chunks/{chunk-HJEZQCMB.js → chunk-YUISINFV.js} +2 -2
  28. package/dist/chunks/{clear-DWPIGPO2.js → clear-W4AEVUND.js} +2 -2
  29. package/dist/chunks/{compile-vercel-config-FSU42P2X.js → compile-vercel-config-Q45PSZDQ.js} +1 -1
  30. package/dist/chunks/{config-V42N5SNP.js → config-MZ3KLGOK.js} +2 -2
  31. package/dist/chunks/{delete-EQ5NJWPR.js → delete-7NADCRED.js} +2 -2
  32. package/dist/chunks/{delete-5KRNKCYI.js → delete-NAZTL2IK.js} +2 -2
  33. package/dist/chunks/{disable-KO6WDHRC.js → disable-SB224IIS.js} +2 -2
  34. package/dist/chunks/{discard-E7PLPNUL.js → discard-MME6PI7B.js} +2 -2
  35. package/dist/chunks/{edit-OIXKTSXJ.js → edit-HKQEFIOY.js} +2 -2
  36. package/dist/chunks/{edit-55TQT6RK.js → edit-NW4YBUR6.js} +3 -3
  37. package/dist/chunks/{enable-UOEAVAUU.js → enable-QEL5CXVD.js} +2 -2
  38. package/dist/chunks/{export-X2XFUNPV.js → export-XDOZTLG3.js} +2 -2
  39. package/dist/chunks/{image-JAAMXTIA.js → image-AJMRAAOW.js} +3 -3
  40. package/dist/chunks/{import-builders-YDOLGBXS.js → import-builders-7UG32FQA.js} +2 -2
  41. package/dist/chunks/{inspect-EYUJ32YM.js → inspect-4YTOMOOP.js} +3 -3
  42. package/dist/chunks/{inspect-S52AEYAQ.js → inspect-DGBKWCS4.js} +2 -2
  43. package/dist/chunks/{inspect-SQXG4BFZ.js → inspect-JPZFHGAF.js} +2 -2
  44. package/dist/chunks/{inspect-IP6EMMGZ.js → inspect-T6HYEMLA.js} +2 -2
  45. package/dist/chunks/{inspect-W4AH3EKN.js → inspect-TW5DENBM.js} +2 -2
  46. package/dist/chunks/{list-ZFHW4YYW.js → list-ESW6P765.js} +2 -2
  47. package/dist/chunks/{list-W2HMCZT7.js → list-T7LXP6VX.js} +3 -3
  48. package/dist/chunks/{list-KODWTHC2.js → list-YQ4LADLW.js} +1 -1
  49. package/dist/chunks/{login-QA4765QP.js → login-VJESL6WK.js} +2 -2
  50. package/dist/chunks/{ls-GZ5K57Y6.js → ls-2DYO6E4E.js} +3 -3
  51. package/dist/chunks/{ls-GHFI6RDD.js → ls-4A6CGBPD.js} +2 -2
  52. package/dist/chunks/{ls-GLFSM2NL.js → ls-5AQBMBOG.js} +2 -2
  53. package/dist/chunks/{ls-ESCK2JMH.js → ls-5I2W7LZQ.js} +2 -2
  54. package/dist/chunks/{ls-A3RJWHNR.js → ls-Y46O3BCS.js} +2 -2
  55. package/dist/chunks/{open-EE7WS2UB.js → open-SZDSII6L.js} +2 -2
  56. package/dist/chunks/{permissions-L7NPGX2M.js → permissions-HRR47E2L.js} +4 -4
  57. package/dist/chunks/{publish-7BIMCBQ6.js → publish-D2QWFUP4.js} +2 -2
  58. package/dist/chunks/{push-IKPIV52M.js → push-75R5ZZIW.js} +2 -2
  59. package/dist/chunks/{query-DFRPIOZM.js → query-LL2GMJWQ.js} +1 -1
  60. package/dist/chunks/{reorder-GA5FVDKD.js → reorder-GNCRV6CV.js} +2 -2
  61. package/dist/chunks/{reply-C3375THE.js → reply-S3UUI6C6.js} +2 -2
  62. package/dist/chunks/{resolve-MBWHKHSW.js → resolve-PCBDK47N.js} +2 -2
  63. package/dist/chunks/{restore-WGSD5LXC.js → restore-SXI5SHGJ.js} +2 -2
  64. package/dist/chunks/{rm-UEFME3MH.js → rm-574XTDSM.js} +2 -2
  65. package/dist/chunks/{rm-PXBJERO4.js → rm-BEIAUTSF.js} +2 -2
  66. package/dist/chunks/{rm-KOUNSG5Y.js → rm-YK2EGEPB.js} +2 -2
  67. package/dist/chunks/{rm-XITL2VK4.js → rm-ZFWVI6JE.js} +3 -3
  68. package/dist/chunks/{rule-inspect-7MJ6F3H6.js → rule-inspect-QDQUU3EO.js} +3 -3
  69. package/dist/chunks/{rules-YBSW4TND.js → rules-FNA3NXZZ.js} +6 -6
  70. package/dist/chunks/{schema-JP4Z36AT.js → schema-5CASPRP6.js} +1 -1
  71. package/dist/chunks/{tags-XEZOWSS3.js → tags-SRHDQUF6.js} +2 -2
  72. package/dist/chunks/{update-236TLBCO.js → update-FSTNM3OX.js} +6 -6
  73. package/dist/commands/build/index.js +16 -2718
  74. package/dist/commands/deploy/index.js +9 -9
  75. package/dist/commands/dev/index.js +8 -8
  76. package/dist/commands/env/index.js +4 -4
  77. package/dist/commands/link/index.js +6 -6
  78. package/dist/commands/list/index.js +2 -2
  79. package/dist/commands-bulk.js +1682 -733
  80. package/dist/index.js +7 -7
  81. package/dist/version.mjs +1 -1
  82. package/package.json +43 -43
  83. package/dist/chunks/chunk-ZGXTMIJX.js +0 -206
@@ -37,7 +37,7 @@ import {
37
37
  runInteractiveEditLoop,
38
38
  stripQuotes,
39
39
  validateActionFlags
40
- } from "./chunks/chunk-AX2PTUXP.js";
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-4BQZVTJ2.js";
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-YRYC7WDR.js";
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-EMD7HCIW.js";
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-KPDA6YEP.js";
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-HJEZQCMB.js";
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-LCZDGAXC.js";
158
+ } from "./chunks/chunk-CKIZU3CI.js";
159
159
  import {
160
160
  validateJsonOutput
161
161
  } from "./chunks/chunk-KXDWXXJH.js";
@@ -465,7 +465,7 @@ import {
465
465
  webAnalyticsSubcommand,
466
466
  webhooksCommand,
467
467
  whoamiCommand
468
- } from "./chunks/chunk-IFNTK75I.js";
468
+ } from "./chunks/chunk-NFZHW6HH.js";
469
469
  import {
470
470
  addSubcommand as addSubcommand12,
471
471
  buildSubcommand,
@@ -548,10 +548,12 @@ import {
548
548
  import "./chunks/chunk-7QVJTI5H.js";
549
549
  import "./chunks/chunk-O5GNPPTU.js";
550
550
  import {
551
+ dump,
552
+ load,
551
553
  main
552
- } from "./chunks/chunk-ZGXTMIJX.js";
554
+ } from "./chunks/chunk-WWPV6Z24.js";
553
555
  import "./chunks/chunk-IB5L4LKZ.js";
554
- import "./chunks/chunk-55JM5YCD.js";
556
+ import "./chunks/chunk-766B6IIX.js";
555
557
  import {
556
558
  require_execa
557
559
  } from "./chunks/chunk-R6IGDGX3.js";
@@ -566,10 +568,10 @@ import {
566
568
  } from "./chunks/chunk-VXYGCOKL.js";
567
569
  import {
568
570
  ensureLink
569
- } from "./chunks/chunk-53LZ5BMD.js";
570
- import "./chunks/chunk-ASSWFLX7.js";
571
- import "./chunks/chunk-N2A6HWBD.js";
572
- import "./chunks/chunk-AF7S35K3.js";
571
+ } from "./chunks/chunk-N22RS64U.js";
572
+ import "./chunks/chunk-PNSWZSLC.js";
573
+ import "./chunks/chunk-7AB6QOKM.js";
574
+ import "./chunks/chunk-FBG4AMAX.js";
573
575
  import {
574
576
  help
575
577
  } from "./chunks/chunk-ZX2FSPWV.js";
@@ -632,7 +634,7 @@ import {
632
634
  selectOrg,
633
635
  toHost,
634
636
  ua_default
635
- } from "./chunks/chunk-IOBULT7M.js";
637
+ } from "./chunks/chunk-BX4IGDGM.js";
636
638
  import {
637
639
  TelemetryClient
638
640
  } from "./chunks/chunk-ECCWJHC6.js";
@@ -753,7 +755,7 @@ var require_tar_fs = __commonJS({
753
755
  var tar2 = require_tar_stream();
754
756
  var pump = require_pump();
755
757
  var mkdirp = require_mkdirp();
756
- var fs2 = __require("fs");
758
+ var fs4 = __require("fs");
757
759
  var path3 = __require("path");
758
760
  var os = __require("os");
759
761
  var win32 = os.platform() === "win32";
@@ -765,19 +767,19 @@ var require_tar_fs = __commonJS({
765
767
  var normalize = !win32 ? echo : function(name) {
766
768
  return name.replace(/\\/g, "/").replace(/[:?<>|]/g, "_");
767
769
  };
768
- var statAll = function(fs3, stat2, cwd, ignore, entries, sort) {
770
+ var statAll = function(fs5, stat4, cwd, ignore, entries, sort) {
769
771
  var queue = entries || ["."];
770
772
  return function loop(callback) {
771
773
  if (!queue.length)
772
774
  return callback();
773
775
  var next = queue.shift();
774
776
  var nextAbs = path3.join(cwd, next);
775
- stat2(nextAbs, function(err, stat3) {
777
+ stat4(nextAbs, function(err, stat5) {
776
778
  if (err)
777
779
  return callback(err);
778
- if (!stat3.isDirectory())
779
- return callback(null, next, stat3);
780
- fs3.readdir(nextAbs, function(err2, files) {
780
+ if (!stat5.isDirectory())
781
+ return callback(null, next, stat5);
782
+ fs5.readdir(nextAbs, function(err2, files) {
781
783
  if (err2)
782
784
  return callback(err2);
783
785
  if (sort)
@@ -786,7 +788,7 @@ var require_tar_fs = __commonJS({
786
788
  if (!ignore(path3.join(cwd, next, files[i])))
787
789
  queue.push(path3.join(next, files[i]));
788
790
  }
789
- callback(null, next, stat3);
791
+ callback(null, next, stat5);
790
792
  });
791
793
  });
792
794
  };
@@ -806,7 +808,7 @@ var require_tar_fs = __commonJS({
806
808
  cwd = ".";
807
809
  if (!opts)
808
810
  opts = {};
809
- var xfs = opts.fs || fs2;
811
+ var xfs = opts.fs || fs4;
810
812
  var ignore = opts.ignore || opts.filter || noop;
811
813
  var map = opts.map || noop;
812
814
  var mapStream = opts.mapStream || echo;
@@ -835,7 +837,7 @@ var require_tar_fs = __commonJS({
835
837
  pack.entry(header, onnextentry);
836
838
  });
837
839
  };
838
- var onstat = function(err, filename, stat2) {
840
+ var onstat = function(err, filename, stat4) {
839
841
  if (err)
840
842
  return pack.destroy(err);
841
843
  if (!filename) {
@@ -843,31 +845,31 @@ var require_tar_fs = __commonJS({
843
845
  pack.finalize();
844
846
  return finish(pack);
845
847
  }
846
- if (stat2.isSocket())
848
+ if (stat4.isSocket())
847
849
  return onnextentry();
848
850
  var header = {
849
851
  name: normalize(filename),
850
- mode: (stat2.mode | (stat2.isDirectory() ? dmode : fmode)) & umask,
851
- mtime: stat2.mtime,
852
- size: stat2.size,
852
+ mode: (stat4.mode | (stat4.isDirectory() ? dmode : fmode)) & umask,
853
+ mtime: stat4.mtime,
854
+ size: stat4.size,
853
855
  type: "file",
854
- uid: stat2.uid,
855
- gid: stat2.gid
856
+ uid: stat4.uid,
857
+ gid: stat4.gid
856
858
  };
857
- if (stat2.isDirectory()) {
859
+ if (stat4.isDirectory()) {
858
860
  header.size = 0;
859
861
  header.type = "directory";
860
862
  header = map(header) || header;
861
863
  return pack.entry(header, onnextentry);
862
864
  }
863
- if (stat2.isSymbolicLink()) {
865
+ if (stat4.isSymbolicLink()) {
864
866
  header.size = 0;
865
867
  header.type = "symlink";
866
868
  header = map(header) || header;
867
869
  return onsymlink(filename, header);
868
870
  }
869
871
  header = map(header) || header;
870
- if (!stat2.isFile()) {
872
+ if (!stat4.isFile()) {
871
873
  if (strict)
872
874
  return pack.destroy(new Error("unsupported type for " + filename));
873
875
  return onnextentry();
@@ -903,7 +905,7 @@ var require_tar_fs = __commonJS({
903
905
  cwd = ".";
904
906
  if (!opts)
905
907
  opts = {};
906
- var xfs = opts.fs || fs2;
908
+ var xfs = opts.fs || fs4;
907
909
  var ignore = opts.ignore || opts.filter || noop;
908
910
  var map = opts.map || noop;
909
911
  var mapStream = opts.mapStream || echo;
@@ -947,13 +949,13 @@ var require_tar_fs = __commonJS({
947
949
  });
948
950
  };
949
951
  var chperm = function(name, header, cb) {
950
- var link = header.type === "symlink";
951
- var chmod2 = link ? xfs.lchmod : xfs.chmod;
952
- var chown = link ? xfs.lchown : xfs.chown;
953
- if (!chmod2)
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)
954
956
  return cb();
955
957
  var mode = (header.mode | (header.type === "directory" ? dmode : fmode)) & umask;
956
- chmod2(name, mode, function(err) {
958
+ chmod3(name, mode, function(err) {
957
959
  if (err)
958
960
  return cb(err);
959
961
  if (!own)
@@ -971,7 +973,7 @@ var require_tar_fs = __commonJS({
971
973
  stream.resume();
972
974
  return next();
973
975
  }
974
- var stat2 = function(err) {
976
+ var stat4 = function(err) {
975
977
  if (err)
976
978
  return next(err);
977
979
  utimes(name, header, function(err2) {
@@ -989,7 +991,7 @@ var require_tar_fs = __commonJS({
989
991
  var dst = path3.resolve(path3.dirname(name), header.linkname);
990
992
  if (!dst.startsWith(path3.resolve(cwd)))
991
993
  return next(new Error(name + " is not a valid symlink"));
992
- xfs.symlink(header.linkname, name, stat2);
994
+ xfs.symlink(header.linkname, name, stat4);
993
995
  });
994
996
  };
995
997
  var onlink = function() {
@@ -1005,7 +1007,7 @@ var require_tar_fs = __commonJS({
1005
1007
  stream = xfs.createReadStream(srcpath);
1006
1008
  return onfile();
1007
1009
  }
1008
- stat2(err2);
1010
+ stat4(err2);
1009
1011
  });
1010
1012
  });
1011
1013
  });
@@ -1019,7 +1021,7 @@ var require_tar_fs = __commonJS({
1019
1021
  pump(rs, ws, function(err) {
1020
1022
  if (err)
1021
1023
  return next(err);
1022
- ws.on("close", stat2);
1024
+ ws.on("close", stat4);
1023
1025
  });
1024
1026
  };
1025
1027
  if (header.type === "directory") {
@@ -1029,7 +1031,7 @@ var require_tar_fs = __commonJS({
1029
1031
  own,
1030
1032
  uid: header.uid,
1031
1033
  gid: header.gid
1032
- }, stat2);
1034
+ }, stat4);
1033
1035
  }
1034
1036
  var dir = path3.dirname(name);
1035
1037
  validate(xfs, dir, path3.join(cwd, "."), function(err, valid) {
@@ -1064,14 +1066,14 @@ var require_tar_fs = __commonJS({
1064
1066
  extract.on("finish", opts.finish);
1065
1067
  return extract;
1066
1068
  };
1067
- function validate(fs3, name, root, cb) {
1069
+ function validate(fs5, name, root, cb) {
1068
1070
  if (name === root)
1069
1071
  return cb(null, true);
1070
- fs3.lstat(name, function(err, st) {
1072
+ fs5.lstat(name, function(err, st) {
1071
1073
  if (err && err.code !== "ENOENT")
1072
1074
  return cb(err);
1073
1075
  if (err || st.isDirectory())
1074
- return validate(fs3, path3.join(name, ".."), root, cb);
1076
+ return validate(fs5, path3.join(name, ".."), root, cb);
1075
1077
  cb(null, false);
1076
1078
  });
1077
1079
  }
@@ -2476,7 +2478,7 @@ async function activity(client) {
2476
2478
  return 0;
2477
2479
  }
2478
2480
  telemetry2.trackCliSubcommandLs(subcommandOriginal);
2479
- const listFn = (await import("./chunks/list-KODWTHC2.js")).default;
2481
+ const listFn = (await import("./chunks/list-YQ4LADLW.js")).default;
2480
2482
  return listFn(client, telemetry2);
2481
2483
  }
2482
2484
  }
@@ -4839,14 +4841,14 @@ async function rules(client) {
4839
4841
  // src/commands/ai-gateway/coding-agents-setup.ts
4840
4842
  var import_chalk22 = __toESM(require_source(), 1);
4841
4843
  import { homedir } from "os";
4842
- import { existsSync as existsSync3 } from "fs";
4843
- import { dirname as dirname2, resolve } from "path";
4844
+ import { existsSync as existsSync2 } from "fs";
4845
+ import { dirname as dirname4, resolve } from "path";
4844
4846
 
4845
4847
  // src/util/ai-gateway/coding-agents/resolve.ts
4846
4848
  var import_chalk17 = __toESM(require_source(), 1);
4847
4849
 
4848
4850
  // src/util/ai-gateway/coding-agents/agents/claude-code.ts
4849
- import { join as join2 } from "path";
4851
+ import { join as join3 } from "path";
4850
4852
 
4851
4853
  // src/util/ai-gateway/coding-agents/config-files.ts
4852
4854
  init_main();
@@ -4856,7 +4858,9 @@ import {
4856
4858
  mkdir,
4857
4859
  copyFile,
4858
4860
  access,
4859
- lstat
4861
+ lstat,
4862
+ link,
4863
+ unlink
4860
4864
  } from "fs/promises";
4861
4865
  import { isDeepStrictEqual } from "util";
4862
4866
  import { dirname } from "path";
@@ -5137,6 +5141,20 @@ ${MANAGED_BLOCK_END}`;
5137
5141
  return `${existing}${prefix}${block2}
5138
5142
  `;
5139
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
+ }
5140
5158
  async function backupFile(path3) {
5141
5159
  const backupPath = `${path3}.bak`;
5142
5160
  await copyFile(path3, backupPath);
@@ -5148,9 +5166,11 @@ async function writeConfigFile(path3, content, mode) {
5148
5166
  }
5149
5167
 
5150
5168
  // src/util/ai-gateway/coding-agents/gateway.ts
5169
+ var GATEWAY_OPENAI_BASE_URL = "https://ai-gateway.vercel.sh/v1";
5151
5170
  var GATEWAY_CODEX_BASE_URL = "https://ai-gateway.vercel.sh/codex/v1";
5152
5171
  var GATEWAY_CLAUDE_CODE_BASE_URL = "https://ai-gateway.vercel.sh/claude-code";
5153
5172
  var GATEWAY_API_KEY_ENV = "AI_GATEWAY_API_KEY";
5173
+ var GATEWAY_DEFAULT_MODEL = "anthropic/claude-fable-5";
5154
5174
  var KEY_PLACEHOLDER = "__AI_GATEWAY_API_KEY__";
5155
5175
  function resolveGatewayBaseUrl(override2, agentDefault) {
5156
5176
  const trimmed = override2?.trim();
@@ -5166,19 +5186,181 @@ function maskSecret(secret) {
5166
5186
  return `${secret.slice(0, 4)}\u2022\u2022\u2022\u2022${secret.slice(-4)}`;
5167
5187
  }
5168
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
+
5169
5348
  // src/util/ai-gateway/coding-agents/agents/claude-code.ts
5170
5349
  function claudeDir(home) {
5171
5350
  const dir = process.env.CLAUDE_CONFIG_DIR;
5172
- return dir && dir.trim() ? dir : join2(home, ".claude");
5351
+ return dir && dir.trim() ? dir : join3(home, ".claude");
5173
5352
  }
5174
5353
  var claudeCode = {
5175
5354
  id: "claude-code",
5176
5355
  displayName: "Claude Code",
5356
+ sessionMigration: {
5357
+ plan: ({ home }) => planClaudeDesktopSessionMigration(home)
5358
+ },
5177
5359
  async detect(home) {
5178
5360
  return pathExists(claudeDir(home));
5179
5361
  },
5180
5362
  configPath(ctx) {
5181
- return ctx.overrides?.["claude-code"] ?? join2(claudeDir(ctx.home), "settings.json");
5363
+ return ctx.overrides?.["claude-code"] ?? join3(claudeDir(ctx.home), "settings.json");
5182
5364
  },
5183
5365
  buildPlan(ctx) {
5184
5366
  const path3 = this.configPath(ctx);
@@ -5206,58 +5388,312 @@ var claudeCode = {
5206
5388
  }
5207
5389
  ],
5208
5390
  envExports,
5209
- notes: ctx.useKeychain ? [
5210
- "The Anthropic auth token is read from your shell environment (Keychain-backed).",
5211
- "Open a new terminal so ANTHROPIC_AUTH_TOKEN is loaded, then restart Claude Code."
5212
- ] : ["Restart Claude Code to pick up the new settings."]
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
+ ]
5213
5398
  };
5214
5399
  }
5215
5400
  };
5216
5401
 
5217
- // src/util/ai-gateway/coding-agents/agents/codex.ts
5402
+ // src/util/ai-gateway/coding-agents/agents/cline.ts
5218
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
+ };
5219
5451
 
5220
- // src/util/ai-gateway/coding-agents/desktop-apps.ts
5221
- import { existsSync } from "fs";
5222
- import { join as join3 } from "path";
5223
- function isMacAppInstalled(bundleName, home) {
5224
- if (process.platform !== "darwin") {
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);
5225
5623
  return false;
5624
+ } finally {
5625
+ await fs2.unlink(temporary).catch((error) => {
5626
+ if (!hasCode(error, "ENOENT"))
5627
+ throw error;
5628
+ });
5226
5629
  }
5227
- return existsSync(join3("/Applications", bundleName)) || existsSync(join3(home, "Applications", bundleName));
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);
5650
+ }
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
+ };
5228
5681
  }
5229
5682
 
5230
5683
  // src/util/ai-gateway/coding-agents/agents/codex.ts
5231
- var CODEX_DESKTOP_APP = "Codex.app";
5232
5684
  function codexDir(home) {
5233
5685
  const dir = process.env.CODEX_HOME;
5234
- return dir && dir.trim() ? dir : join4(home, ".codex");
5686
+ return dir && dir.trim() ? dir : join6(home, ".codex");
5235
5687
  }
5236
5688
  var codex = {
5237
5689
  id: "codex",
5238
5690
  displayName: "Codex",
5691
+ sessionMigration: { plan: ({ home }) => planCodexSessionMigration(home) },
5239
5692
  async detect(home) {
5240
5693
  return pathExists(codexDir(home));
5241
5694
  },
5242
- async warnings({ home, overrides }) {
5243
- const warnings = [];
5244
- if (isMacAppInstalled(CODEX_DESKTOP_APP, home)) {
5245
- const configPath = this.configPath({ apiKey: "", home, overrides });
5246
- warnings.push({
5247
- code: "desktop_app_breaks",
5248
- impact: "The Codex desktop app will stop working.",
5249
- why: [
5250
- '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.',
5251
- "The Codex CLI keeps working."
5252
- ],
5253
- undo: `remove the model_provider line from ${configPath}`,
5254
- confirm: "Configure Codex anyway?"
5255
- });
5256
- }
5257
- return warnings;
5258
- },
5259
5695
  configPath(ctx) {
5260
- return ctx.overrides?.["codex"] ?? join4(codexDir(ctx.home), "config.toml");
5696
+ return ctx.overrides?.["codex"] ?? join6(codexDir(ctx.home), "config.toml");
5261
5697
  },
5262
5698
  buildPlan(ctx) {
5263
5699
  const path3 = this.configPath(ctx);
@@ -5292,12 +5728,204 @@ var codex = {
5292
5728
  }
5293
5729
  };
5294
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
+
5295
5923
  // src/util/ai-gateway/coding-agents/agents/opencode.ts
5296
- import { isAbsolute, join as join5 } from "path";
5924
+ import { isAbsolute, join as join11 } from "path";
5297
5925
  function defaultConfigPath(home) {
5298
5926
  const xdg = process.env.XDG_CONFIG_HOME;
5299
- const base = xdg && isAbsolute(xdg) ? xdg : join5(home, ".config");
5300
- return join5(base, "opencode", "opencode.json");
5927
+ const base = xdg && isAbsolute(xdg) ? xdg : join11(home, ".config");
5928
+ return join11(base, "opencode", "opencode.json");
5301
5929
  }
5302
5930
  var opencode = {
5303
5931
  id: "opencode",
@@ -5335,20 +5963,20 @@ var opencode = {
5335
5963
  };
5336
5964
 
5337
5965
  // src/util/ai-gateway/coding-agents/agents/pi.ts
5338
- import { join as join6 } from "path";
5966
+ import { join as join12 } from "path";
5339
5967
  function piAgentDir(home) {
5340
5968
  const dir = process.env.PI_CODING_AGENT_DIR;
5341
- return dir && dir.trim() ? dir : join6(home, ".pi", "agent");
5969
+ return dir && dir.trim() ? dir : join12(home, ".pi", "agent");
5342
5970
  }
5343
5971
  var pi = {
5344
5972
  id: "pi",
5345
5973
  displayName: "Pi",
5346
5974
  async detect(home) {
5347
5975
  const dir = process.env.PI_CODING_AGENT_DIR;
5348
- return pathExists(dir && dir.trim() ? dir : join6(home, ".pi"));
5976
+ return pathExists(dir && dir.trim() ? dir : join12(home, ".pi"));
5349
5977
  },
5350
5978
  configPath(ctx) {
5351
- return ctx.overrides?.["pi"] ?? join6(piAgentDir(ctx.home), "auth.json");
5979
+ return ctx.overrides?.["pi"] ?? join12(piAgentDir(ctx.home), "auth.json");
5352
5980
  },
5353
5981
  buildPlan(ctx) {
5354
5982
  const path3 = this.configPath(ctx);
@@ -5373,14 +6001,22 @@ var pi = {
5373
6001
  };
5374
6002
 
5375
6003
  // src/util/ai-gateway/coding-agents/agents/index.ts
5376
- var CODING_AGENTS = [claudeCode, codex, opencode, pi];
6004
+ var CODING_AGENTS = [
6005
+ claudeCode,
6006
+ cline,
6007
+ codex,
6008
+ cursor,
6009
+ hermes,
6010
+ kilo,
6011
+ openclaw,
6012
+ opencode,
6013
+ pi
6014
+ ];
5377
6015
  var DEFAULT_AGENTS = CODING_AGENTS.filter((a) => !a.experimental);
5378
6016
  function getAgentById(id) {
5379
6017
  return CODING_AGENTS.find((a) => a.id === id);
5380
6018
  }
5381
- var UNSUPPORTED_AGENTS = {
5382
- 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.'
5383
- };
6019
+ var UNSUPPORTED_AGENTS = {};
5384
6020
 
5385
6021
  // src/util/ai-gateway/coding-agents/resolve.ts
5386
6022
  async function resolveAgents(args) {
@@ -5597,16 +6233,16 @@ async function createKey(client, opts) {
5597
6233
  }
5598
6234
 
5599
6235
  // src/util/ai-gateway/coding-agents/apply.ts
5600
- import { join as join7 } from "path";
6236
+ import { join as join13 } from "path";
5601
6237
 
5602
6238
  // src/util/ai-gateway/coding-agents/keychain.ts
5603
- import { existsSync as existsSync2 } from "fs";
6239
+ import { existsSync } from "fs";
5604
6240
  import { execFileSync } from "child_process";
5605
6241
  var SECURITY_BIN = "/usr/bin/security";
5606
6242
  var KEYCHAIN_SERVICE = "Vercel AI Gateway";
5607
6243
  var KEYCHAIN_ACCOUNT = "vercel-ai-gateway";
5608
6244
  function isKeychainAvailable() {
5609
- return process.platform === "darwin" && existsSync2(SECURITY_BIN);
6245
+ return process.platform === "darwin" && existsSync(SECURITY_BIN);
5610
6246
  }
5611
6247
  function storeKeyInKeychain(key) {
5612
6248
  try {
@@ -5647,26 +6283,42 @@ function copyToClipboard(text2) {
5647
6283
  }
5648
6284
 
5649
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
+ }
5650
6302
  function detectShellRc(home, override2) {
5651
6303
  if (override2 && override2.trim())
5652
6304
  return override2;
5653
6305
  const shell = process.env.SHELL ?? "";
5654
6306
  if (shell.includes("fish")) {
5655
6307
  const xdg = process.env.XDG_CONFIG_HOME;
5656
- const base = xdg && xdg.startsWith("/") ? xdg : join7(home, ".config");
5657
- return join7(base, "fish", "config.fish");
6308
+ const base = xdg && xdg.startsWith("/") ? xdg : join13(home, ".config");
6309
+ return join13(base, "fish", "config.fish");
5658
6310
  }
5659
6311
  if (shell.includes("zsh")) {
5660
6312
  const zdot = process.env.ZDOTDIR;
5661
- return join7(zdot && zdot.trim() ? zdot : home, ".zshrc");
6313
+ return join13(zdot && zdot.trim() ? zdot : home, ".zshrc");
5662
6314
  }
5663
6315
  if (shell.includes("bash")) {
5664
- return join7(
6316
+ return join13(
5665
6317
  home,
5666
6318
  process.platform === "darwin" ? ".bash_profile" : ".bashrc"
5667
6319
  );
5668
6320
  }
5669
- return join7(home, ".profile");
6321
+ return join13(home, ".profile");
5670
6322
  }
5671
6323
  function shellQuote(value) {
5672
6324
  return `'${value.split("'").join("'\\''")}'`;
@@ -5691,6 +6343,23 @@ function envBlockBody(exports, useKeychain, fish) {
5691
6343
  }
5692
6344
  return lines.join("\n");
5693
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
+ }
5694
6363
  function matchesWithStoredKey(current, templated) {
5695
6364
  const parts = templated.split(KEY_PLACEHOLDER);
5696
6365
  if (parts.length < 2) {
@@ -5700,7 +6369,7 @@ function matchesWithStoredKey(current, templated) {
5700
6369
  const pattern = `^${escaped[0]}([^\\s"'\\\\]+)${escaped.slice(1).join("\\1")}$`;
5701
6370
  return new RegExp(pattern).test(current);
5702
6371
  }
5703
- async function buildSetupPlan(agents, ctx) {
6372
+ async function buildSetupPlan(agents, ctx, migrations = []) {
5704
6373
  const pending = [];
5705
6374
  const envExports = [];
5706
6375
  const notes = [];
@@ -5738,12 +6407,20 @@ async function buildSetupPlan(agents, ctx) {
5738
6407
  ctx.useKeychain,
5739
6408
  shellRcPath.endsWith(".fish")
5740
6409
  );
6410
+ const writtenNames = new Set(envExports.map((e2) => e2.name));
5741
6411
  pending.push({
5742
6412
  path: shellRcPath,
5743
6413
  label: "Shell environment",
5744
6414
  format: "shell",
5745
6415
  owner: "Environment",
5746
- transform: (current) => upsertManagedBlock(current, body)
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
+ }
5747
6424
  });
5748
6425
  }
5749
6426
  const byPath = /* @__PURE__ */ new Map();
@@ -5797,7 +6474,13 @@ async function buildSetupPlan(agents, ctx) {
5797
6474
  symlink
5798
6475
  });
5799
6476
  }
5800
- return { changes, notes, envExports, shellRcPath };
6477
+ return {
6478
+ changes,
6479
+ notes,
6480
+ envExports,
6481
+ shellRcPath,
6482
+ migrations
6483
+ };
5801
6484
  }
5802
6485
  async function applyPlan(plan, options) {
5803
6486
  const results = [];
@@ -5820,6 +6503,36 @@ async function applyPlan(plan, options) {
5820
6503
  }
5821
6504
  return results;
5822
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
+ }
5823
6536
 
5824
6537
  // src/util/ai-gateway/coding-agents/render.ts
5825
6538
  var import_chalk20 = __toESM(require_source(), 1);
@@ -5933,6 +6646,11 @@ function printResolvedState(args) {
5933
6646
  const { selected, willCreate, name, budget, refreshPeriod, expiresAt } = args;
5934
6647
  output_manager_default.print(import_chalk20.default.bold(" Summary\n"));
5935
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
+ }
5936
6654
  if (!willCreate) {
5937
6655
  printAlignedLabel("API key", "Using provided key");
5938
6656
  output_manager_default.print("\n");
@@ -5991,7 +6709,7 @@ function printPlan(plan, previewKey, opts = {}) {
5991
6709
  );
5992
6710
  if (change2.symlink) {
5993
6711
  output_manager_default.print(
5994
- ` ${import_chalk20.default.yellow("\u21B3 warning:")} this path is a symlink \u2014 the write will follow it to its target
6712
+ ` ${import_chalk20.default.yellow("\u21B3 warning:")} this path is a symlink; the write will follow it to its target
5995
6713
  `
5996
6714
  );
5997
6715
  }
@@ -6008,6 +6726,20 @@ function printPlan(plan, previewKey, opts = {}) {
6008
6726
  `);
6009
6727
  }
6010
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
+ }
6011
6743
  output_manager_default.print("\n");
6012
6744
  }
6013
6745
  function printWarning(message) {
@@ -6046,12 +6778,29 @@ function printKey(key, opts = {}) {
6046
6778
  printKeyRow(key, opts);
6047
6779
  }
6048
6780
  function buildAgentPrompt(plan, apiKey) {
6049
- const sections = [
6781
+ const fileChanges = plan.changes.filter(
6782
+ (change2) => change2.status === "create" || change2.status === "update"
6783
+ );
6784
+ const sections = fileChanges.length > 0 ? [
6050
6785
  "Set up the Vercel AI Gateway for my coding agents by applying the file changes below.",
6051
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).",
6052
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.`,
6053
6788
  ""
6054
- ];
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
+ }
6055
6804
  for (const change2 of plan.changes) {
6056
6805
  if (change2.status !== "create" && change2.status !== "update") {
6057
6806
  continue;
@@ -6070,6 +6819,13 @@ function buildAgentPrompt(plan, apiKey) {
6070
6819
  return `${sections.join("\n").trimEnd()}
6071
6820
  `;
6072
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
+ }
6073
6829
 
6074
6830
  // src/util/ai-gateway/coding-agents/consent.ts
6075
6831
  var import_chalk21 = __toESM(require_source(), 1);
@@ -6145,13 +6901,22 @@ async function runMachine(args) {
6145
6901
  {
6146
6902
  status: AGENT_STATUS.OK,
6147
6903
  reason: "dry_run",
6148
- message: "Previewing AI Gateway coding-agent setup. No files written.",
6904
+ message: "Previewing AI Gateway coding-agent setup. No changes applied.",
6149
6905
  changes: previewPlan.changes.map((c) => ({
6150
6906
  agent: c.owners.join(", "),
6151
6907
  file: c.path,
6152
6908
  action: c.status === "create" ? "would_create" : c.status === "update" ? "would_update" : c.status,
6153
6909
  ...c.symlink ? { symlink: true } : {}
6154
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
+ })),
6155
6920
  skipped,
6156
6921
  warnings: args.warnings
6157
6922
  },
@@ -6202,10 +6967,36 @@ async function runMachine(args) {
6202
6967
  );
6203
6968
  return 0;
6204
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
+ }
6205
6996
  const applicable = previewPlan.changes.filter(
6206
6997
  (c) => (c.status === "create" || c.status === "update") && c.format !== "shell"
6207
6998
  );
6208
- if (applicable.length === 0 && errored.length > 0) {
6999
+ if (applicable.length === 0 && errored.length > 0 && (args.promptMode || previewPlan.migrations.length === 0)) {
6209
7000
  client.stdout.write(
6210
7001
  `${JSON.stringify(
6211
7002
  {
@@ -6222,6 +7013,31 @@ async function runMachine(args) {
6222
7013
  );
6223
7014
  return 1;
6224
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
+ }
6225
7041
  let key;
6226
7042
  try {
6227
7043
  key = args.keySource ? args.keySource.key : await args.createKey();
@@ -6230,20 +7046,25 @@ async function runMachine(args) {
6230
7046
  outputAgentError(client, {
6231
7047
  status: AGENT_STATUS.ERROR,
6232
7048
  reason: err.status === 403 ? "forbidden" : AGENT_REASON.API_ERROR,
6233
- message: err.message
7049
+ message: err.message,
7050
+ hint: `Session migrations: ${JSON.stringify(migrated.results)}`
6234
7051
  });
6235
7052
  }
6236
7053
  throw err;
6237
7054
  }
6238
7055
  const useKeychain = args.useKeychain && storeKeyInKeychain(key);
6239
- const finalPlan = await buildSetupPlan(selected, {
6240
- apiKey: key,
6241
- home,
6242
- useKeychain,
6243
- overrides: args.overrides,
6244
- shellRcOverride: args.shellRcOverride,
6245
- baseUrlOverride: args.baseUrlOverride
6246
- });
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
+ );
6247
7068
  if (args.promptMode) {
6248
7069
  if (!useKeychain) {
6249
7070
  client.stdout.write(
@@ -6297,6 +7118,7 @@ async function runMachine(args) {
6297
7118
  action: r.action,
6298
7119
  backup: r.backupPath
6299
7120
  })),
7121
+ migrated: migrated.results,
6300
7122
  skipped,
6301
7123
  warnings: args.warnings,
6302
7124
  notes: finalPlan.notes.flatMap(
@@ -6310,6 +7132,17 @@ async function runMachine(args) {
6310
7132
  );
6311
7133
  return 0;
6312
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
+ }
6313
7146
 
6314
7147
  // src/util/telemetry/commands/ai-gateway/coding-agents-setup.ts
6315
7148
  var AiGatewayCodingAgentsSetupTelemetryClient = class extends TelemetryClient {
@@ -6373,6 +7206,11 @@ var AiGatewayCodingAgentsSetupTelemetryClient = class extends TelemetryClient {
6373
7206
  this.trackCliFlag("no-backup");
6374
7207
  }
6375
7208
  }
7209
+ trackCliFlagNoSessionMigration(noSessionMigration) {
7210
+ if (noSessionMigration) {
7211
+ this.trackCliFlag("no-session-migration");
7212
+ }
7213
+ }
6376
7214
  trackCliFlagNoKeychain(noKeychain) {
6377
7215
  if (noKeychain) {
6378
7216
  this.trackCliFlag("no-keychain");
@@ -6433,6 +7271,7 @@ async function codingAgentsSetup(client, argv) {
6433
7271
  const reconfigure = opts["--reconfigure"];
6434
7272
  const dryRun = opts["--dry-run"];
6435
7273
  const noBackup = opts["--no-backup"];
7274
+ const noSessionMigration = opts["--no-session-migration"];
6436
7275
  const noKeychain = opts["--no-keychain"];
6437
7276
  const agentConfig = opts["--agent-config"];
6438
7277
  const shellRcOverride = opts["--shell-rc"];
@@ -6450,6 +7289,7 @@ async function codingAgentsSetup(client, argv) {
6450
7289
  telemetry2.trackCliFlagReconfigure(reconfigure);
6451
7290
  telemetry2.trackCliFlagDryRun(dryRun);
6452
7291
  telemetry2.trackCliFlagNoBackup(noBackup);
7292
+ telemetry2.trackCliFlagNoSessionMigration(noSessionMigration);
6453
7293
  telemetry2.trackCliFlagNoKeychain(noKeychain);
6454
7294
  telemetry2.trackCliOptionAgentConfig(agentConfig);
6455
7295
  telemetry2.trackCliOptionShellRc(shellRcOverride);
@@ -6492,14 +7332,6 @@ async function codingAgentsSetup(client, argv) {
6492
7332
  `Invalid --apply "${applyMode}". Must be "edit" or "prompt".`
6493
7333
  );
6494
7334
  }
6495
- if (applyMode === "prompt" && !wantKeychain) {
6496
- return failValidation(
6497
- client,
6498
- machine,
6499
- AGENT_REASON.INVALID_ARGUMENTS,
6500
- "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`."
6501
- );
6502
- }
6503
7335
  if (baseUrl !== void 0 && !isValidBaseUrl(baseUrl)) {
6504
7336
  return failValidation(
6505
7337
  client,
@@ -6534,7 +7366,7 @@ async function codingAgentsSetup(client, argv) {
6534
7366
  }
6535
7367
  if (dryRun && !machine) {
6536
7368
  printStatus(
6537
- `${import_chalk22.default.bold("Dry run")} \u2014 previewing changes only. No files will be written and no API key will be created.`
7369
+ `${import_chalk22.default.bold("Dry run")}: previewing changes only. No files will be written and no API key will be created.`
6538
7370
  );
6539
7371
  }
6540
7372
  const selection = await resolveAgents({
@@ -6621,21 +7453,73 @@ async function codingAgentsSetup(client, argv) {
6621
7453
  }
6622
7454
  }
6623
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
+ }
6624
7488
  const willCreate = !providedKey;
6625
7489
  let keyName = name;
6626
7490
  let keyBudget = budget;
6627
7491
  let keyRefresh = refreshPeriod;
6628
7492
  let keyExpiresAt = flagExpiresAt;
6629
- if (willCreate && agents.length > 0 && (!dryRun || canPrompt2)) {
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)) {
6630
7515
  const promptCreate = canPrompt2 && !yes;
6631
7516
  const teamError = await ensureTeam2(client, {
6632
7517
  machine,
6633
7518
  canPrompt: canPrompt2,
6634
7519
  yes: Boolean(yes)
6635
7520
  });
6636
- if (teamError) {
7521
+ if (teamError)
6637
7522
  return teamError;
6638
- }
6639
7523
  if (promptCreate && keyName === void 0) {
6640
7524
  keyName = await promptKeyName(client);
6641
7525
  }
@@ -6651,12 +7535,12 @@ async function codingAgentsSetup(client, argv) {
6651
7535
  }
6652
7536
  }
6653
7537
  let useKeychain = wantKeychain;
6654
- if (wantKeychain && canPrompt2 && !yes) {
7538
+ if (!preflightSessionOnly && wantKeychain && canPrompt2 && !yes) {
6655
7539
  useKeychain = await promptKeychain(client);
6656
7540
  }
6657
7541
  if (canPrompt2 && !yes) {
6658
7542
  const missing = agents.filter(
6659
- (a) => !overrides[a.id] && !existsSync3(dirname2(a.configPath({ apiKey: "", home })))
7543
+ (a) => !overrides[a.id] && !existsSync2(dirname4(a.configPath({ apiKey: "", home })))
6660
7544
  );
6661
7545
  if (missing.length > 0) {
6662
7546
  const customize = await client.input.confirm(
@@ -6686,19 +7570,25 @@ async function codingAgentsSetup(client, argv) {
6686
7570
  "--base-url has no effect for the selected agents; only Claude Code and Codex write a gateway base URL."
6687
7571
  );
6688
7572
  }
6689
- const previewPlan = await buildSetupPlan(agents, {
6690
- apiKey: previewKey,
6691
- home,
6692
- useKeychain,
6693
- overrides,
6694
- shellRcOverride,
6695
- baseUrlOverride: baseUrl
6696
- });
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
+ );
6697
7585
  const changed = previewPlan.changes.filter(
6698
7586
  (c) => c.status === "create" || c.status === "update"
6699
7587
  );
6700
7588
  const errored = previewPlan.changes.filter((c) => c.status === "error");
6701
- const alreadyConfigured = changed.length === 0 && errored.length === 0;
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;
6702
7592
  if (machine) {
6703
7593
  return runMachine({
6704
7594
  client,
@@ -6773,24 +7663,25 @@ async function codingAgentsSetup(client, argv) {
6773
7663
  budget: keyBudget,
6774
7664
  refreshPeriod: keyRefresh,
6775
7665
  expiresAt: keyExpiresAt,
6776
- keychain: wantKeychain ? useKeychain : void 0
7666
+ keychain: wantKeychain ? useKeychain : void 0,
7667
+ preserveKey: sessionOnly
6777
7668
  });
6778
7669
  printPlan(previewPlan, previewKey, { backup: !noBackup });
6779
7670
  if (dryRun) {
6780
7671
  printStatus(
6781
- `Dry run \u2014 no files written. Re-run without ${import_chalk22.default.bold("--dry-run")} to apply.`
7672
+ `Dry run: no files written. Re-run without ${import_chalk22.default.bold("--dry-run")} to apply.`
6782
7673
  );
6783
7674
  return 0;
6784
7675
  }
6785
7676
  const agentConfigChanged = changed.filter((c) => c.format !== "shell");
6786
- if (agentConfigChanged.length === 0 && errored.length > 0) {
7677
+ if (agentConfigChanged.length === 0 && errored.length > 0 && previewPlan.migrations.length === 0) {
6787
7678
  output_manager_default.error(
6788
7679
  "Couldn't write any agent configurations. Fix the files above, then re-run."
6789
7680
  );
6790
7681
  return 1;
6791
7682
  }
6792
7683
  let applyAction = applyMode === "prompt" ? "copy" : "apply";
6793
- if (applyMode === void 0 && changed.length > 0 && canPrompt2 && !yes) {
7684
+ if (applyMode === void 0 && (changed.length > 0 || previewPlan.migrations.length > 0) && canPrompt2 && !yes) {
6794
7685
  if (useKeychain) {
6795
7686
  const choice = await client.input.select({
6796
7687
  message: "Apply these changes?",
@@ -6817,6 +7708,41 @@ async function codingAgentsSetup(client, argv) {
6817
7708
  }
6818
7709
  }
6819
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
+ }
6820
7746
  let keySource;
6821
7747
  try {
6822
7748
  keySource = providedKey ? { key: providedKey, created: false } : {
@@ -6849,33 +7775,21 @@ async function codingAgentsSetup(client, argv) {
6849
7775
  );
6850
7776
  useKeychain = false;
6851
7777
  }
6852
- const applyPlanResult = await buildSetupPlan(agents, {
6853
- apiKey: keySource.key,
6854
- home,
6855
- useKeychain,
6856
- overrides,
6857
- shellRcOverride,
6858
- baseUrlOverride: baseUrl
6859
- });
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
+ );
6860
7790
  if (applyAction === "copy") {
6861
7791
  const promptText = buildAgentPrompt(applyPlanResult, keySource.key);
6862
- if (applyMode === "prompt") {
6863
- const copied = copyToClipboard(promptText);
6864
- printStatus(
6865
- 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)."
6866
- );
6867
- client.stdout.write(`${promptText}
6868
- `);
6869
- } else if (copyToClipboard(promptText)) {
6870
- printStatus(
6871
- "Prompt copied to clipboard. Paste it into your coding agent to apply the changes."
6872
- );
6873
- } else {
6874
- output_manager_default.debug("pbcopy failed or unavailable");
6875
- printStatus("Could not access the clipboard \u2014 prompt printed below:");
6876
- client.stdout.write(`${promptText}
6877
- `);
6878
- }
7792
+ emitAgentPrompt(client, promptText, applyMode === "prompt", "setup");
6879
7793
  printKey(keySource.key, { keychain: true, created: keySource.created });
6880
7794
  return 0;
6881
7795
  }
@@ -6918,7 +7832,42 @@ async function codingAgentsSetup(client, argv) {
6918
7832
  client.stdout.write(`${keySource.key}
6919
7833
  `);
6920
7834
  }
6921
- 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
+ }
6922
7871
  }
6923
7872
  function buildConsentCommand(argv, consentFlags) {
6924
7873
  const args = stripSensitiveAuthArgs(argv.slice(2));
@@ -7333,7 +8282,7 @@ async function models(client) {
7333
8282
 
7334
8283
  // src/commands/ai-gateway/leaderboard-shared.ts
7335
8284
  var import_chalk25 = __toESM(require_source(), 1);
7336
- import { writeFile as writeFile3 } from "fs/promises";
8285
+ import { writeFile as writeFile5 } from "fs/promises";
7337
8286
 
7338
8287
  // src/util/ai-gateway/leaderboard.ts
7339
8288
  var DEFAULT_LEADERBOARD_BASE = "https://vercel.com";
@@ -7447,7 +8396,7 @@ async function fetchWithSpinner(fetch3, spinnerText) {
7447
8396
  async function writeToFile(client, out, content, label) {
7448
8397
  const writeStamp = stamp_default();
7449
8398
  try {
7450
- await writeFile3(out, content);
8399
+ await writeFile5(out, content);
7451
8400
  } catch (err) {
7452
8401
  output_manager_default.error(
7453
8402
  `Failed to write ${out}: ${err instanceof Error ? err.message : String(err)}`
@@ -8376,17 +9325,17 @@ ${extra}` : helpOutput);
8376
9325
  switch (subcommand) {
8377
9326
  case "inspect": {
8378
9327
  telemetry2.trackCliSubcommandInspect(subcommandOriginal);
8379
- const inspectFn = (await import("./chunks/inspect-SQXG4BFZ.js")).default;
9328
+ const inspectFn = (await import("./chunks/inspect-JPZFHGAF.js")).default;
8380
9329
  return inspectFn(client, rawSubcommandArgs);
8381
9330
  }
8382
9331
  case "rules": {
8383
9332
  telemetry2.trackCliSubcommandRules(args[0] ?? "ls");
8384
- const rulesFn = (await import("./chunks/rules-YBSW4TND.js")).default;
9333
+ const rulesFn = (await import("./chunks/rules-FNA3NXZZ.js")).default;
8385
9334
  return rulesFn(client, rawSubcommandArgs);
8386
9335
  }
8387
9336
  default: {
8388
9337
  telemetry2.trackCliSubcommandLs(subcommandOriginal);
8389
- const listFn = (await import("./chunks/list-ZFHW4YYW.js")).default;
9338
+ const listFn = (await import("./chunks/list-ESW6P765.js")).default;
8390
9339
  return listFn(client, telemetry2);
8391
9340
  }
8392
9341
  }
@@ -9368,8 +10317,8 @@ var BisectTelemetryClient = class extends TelemetryClient {
9368
10317
  });
9369
10318
  }
9370
10319
  }
9371
- trackCliFlagOpen(open15) {
9372
- if (open15) {
10320
+ trackCliFlagOpen(open16) {
10321
+ if (open16) {
9373
10322
  this.trackCliFlag("open");
9374
10323
  }
9375
10324
  }
@@ -9662,11 +10611,11 @@ var BlobListTelemetryClient = class extends TelemetryClient {
9662
10611
  });
9663
10612
  }
9664
10613
  }
9665
- trackCliOptionCursor(cursor) {
9666
- if (cursor) {
10614
+ trackCliOptionCursor(cursor2) {
10615
+ if (cursor2) {
9667
10616
  this.trackCliOption({
9668
10617
  option: "cursor",
9669
- value: cursor
10618
+ value: cursor2
9670
10619
  });
9671
10620
  }
9672
10621
  }
@@ -9829,12 +10778,12 @@ async function list9(client, argv, auth) {
9829
10778
  }
9830
10779
  const {
9831
10780
  "--limit": limit,
9832
- "--cursor": cursor,
10781
+ "--cursor": cursor2,
9833
10782
  "--prefix": prefix,
9834
10783
  "--mode": modeFlag
9835
10784
  } = flags;
9836
10785
  telemetryClient.trackCliOptionLimit(limit);
9837
- telemetryClient.trackCliOptionCursor(cursor);
10786
+ telemetryClient.trackCliOptionCursor(cursor2);
9838
10787
  telemetryClient.trackCliOptionPrefix(prefix);
9839
10788
  telemetryClient.trackCliOptionMode(modeFlag);
9840
10789
  const mode = modeFlag ?? "expanded";
@@ -9851,7 +10800,7 @@ async function list9(client, argv, auth) {
9851
10800
  list21 = await blob.list({
9852
10801
  ...blobOpts(auth),
9853
10802
  limit: limit ?? 10,
9854
- cursor,
10803
+ cursor: cursor2,
9855
10804
  mode,
9856
10805
  prefix
9857
10806
  });
@@ -10160,8 +11109,8 @@ var BlobTelemetryClient = class extends TelemetryClient {
10160
11109
  import * as blob2 from "@vercel/blob";
10161
11110
  var import_error_utils = __toESM(require_dist(), 1);
10162
11111
  import { statSync } from "fs";
10163
- import { open as open2 } from "fs/promises";
10164
- import { basename } from "path";
11112
+ import { open as open3 } from "fs/promises";
11113
+ import { basename as basename2 } from "path";
10165
11114
  var import_chalk35 = __toESM(require_source(), 1);
10166
11115
 
10167
11116
  // src/util/telemetry/commands/blob/put.ts
@@ -10328,9 +11277,9 @@ async function put2(client, argv, auth) {
10328
11277
  const stats = statSync(filePath);
10329
11278
  const isFile = stats.isFile();
10330
11279
  if (isFile) {
10331
- const file = await open2(filePath, "r");
11280
+ const file = await open3(filePath, "r");
10332
11281
  putBody = file.createReadStream();
10333
- pathname = pathnameFlag ?? basename(filePath);
11282
+ pathname = pathnameFlag ?? basename2(filePath);
10334
11283
  } else {
10335
11284
  output_manager_default.error("Path to upload is not a file");
10336
11285
  return 1;
@@ -10419,9 +11368,9 @@ var BlobGetTelemetryClient = class extends TelemetryClient {
10419
11368
 
10420
11369
  // src/commands/blob/get.ts
10421
11370
  var import_bytes = __toESM(require_bytes(), 1);
10422
- import { createWriteStream } from "fs";
11371
+ import { createWriteStream as createWriteStream2 } from "fs";
10423
11372
  import { Readable } from "stream";
10424
- import { pipeline } from "stream/promises";
11373
+ import { pipeline as pipeline2 } from "stream/promises";
10425
11374
  async function get2(client, argv, auth) {
10426
11375
  const telemetryClient = new BlobGetTelemetryClient({
10427
11376
  opts: {
@@ -10478,14 +11427,14 @@ async function get2(client, argv, auth) {
10478
11427
  }
10479
11428
  const nodeStream = Readable.fromWeb(result.stream);
10480
11429
  if (outputPath) {
10481
- const writeStream = createWriteStream(outputPath);
10482
- await pipeline(nodeStream, writeStream);
11430
+ const writeStream = createWriteStream2(outputPath);
11431
+ await pipeline2(nodeStream, writeStream);
10483
11432
  output_manager_default.stopSpinner();
10484
11433
  const sizeInfo = result.blob.size ? ` (${(0, import_bytes.default)(result.blob.size)})` : "";
10485
11434
  const typeInfo = result.blob.contentType ? `, ${result.blob.contentType}` : "";
10486
11435
  output_manager_default.success(`Saved to ${outputPath}${sizeInfo}${typeInfo}`);
10487
11436
  } else {
10488
- await pipeline(nodeStream, client.stdout, { end: false });
11437
+ await pipeline2(nodeStream, client.stdout, { end: false });
10489
11438
  }
10490
11439
  } catch (err) {
10491
11440
  output_manager_default.stopSpinner();
@@ -10961,12 +11910,12 @@ async function addStore(client, argv) {
10961
11910
  telemetryClient.trackCliArgumentName(name);
10962
11911
  telemetryClient.trackCliOptionAccess(accessFlag);
10963
11912
  telemetryClient.trackCliOptionRegion(flags["--region"]);
10964
- const link = await getLinkedProject(client);
10965
- if (link.status === "linked" && client.nonInteractive && !yes && !environmentFlags?.length) {
11913
+ const link2 = await getLinkedProject(client);
11914
+ if (link2.status === "linked" && client.nonInteractive && !yes && !environmentFlags?.length) {
10966
11915
  outputAgentError(client, {
10967
11916
  status: "error",
10968
11917
  reason: "confirmation_required",
10969
- message: `Creating a blob store and linking it to ${link.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.`,
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.`,
10970
11919
  next: [
10971
11920
  {
10972
11921
  command: buildCommandWithYes(client.argv),
@@ -10987,7 +11936,7 @@ async function addStore(client, argv) {
10987
11936
  method: "POST",
10988
11937
  headers: { "Content-Type": "application/json" },
10989
11938
  body: JSON.stringify({ name, region, access: access4 }),
10990
- accountId: link.status === "linked" ? link.org.id : void 0
11939
+ accountId: link2.status === "linked" ? link2.org.id : void 0
10991
11940
  }
10992
11941
  );
10993
11942
  storeId = res.store.id;
@@ -11001,17 +11950,17 @@ async function addStore(client, argv) {
11001
11950
  output_manager_default.success(`Blob store created: ${name} (${storeId})${regionInfo}`);
11002
11951
  const docsUrl = access4 === "public" ? "https://vercel.com/docs/vercel-blob/public-storage" : "https://vercel.com/docs/vercel-blob/private-storage";
11003
11952
  output_manager_default.log(`Access: ${access4}. Learn more: ${output_manager_default.link(docsUrl, docsUrl)}`);
11004
- if (link.status === "linked") {
11953
+ if (link2.status === "linked") {
11005
11954
  let shouldLink = yes || Boolean(environmentFlags?.length);
11006
11955
  if (!shouldLink && interactive) {
11007
11956
  shouldLink = await client.input.confirm(
11008
- `Would you like to link this blob store to ${link.project.name}?`,
11957
+ `Would you like to link this blob store to ${link2.project.name}?`,
11009
11958
  true
11010
11959
  );
11011
11960
  }
11012
11961
  if (!shouldLink && !interactive) {
11013
11962
  output_manager_default.log(
11014
- `Not linked to ${import_chalk37.default.bold(link.project.name)}. Pass --yes when creating to link the store to your project automatically.`
11963
+ `Not linked to ${import_chalk37.default.bold(link2.project.name)}. Pass --yes when creating to link the store to your project automatically.`
11015
11964
  );
11016
11965
  }
11017
11966
  if (shouldLink) {
@@ -11031,27 +11980,27 @@ async function addStore(client, argv) {
11031
11980
  environments = [...VALID_ENVIRONMENTS];
11032
11981
  }
11033
11982
  output_manager_default.spinner(
11034
- `Connecting ${import_chalk37.default.bold(name)} to ${import_chalk37.default.bold(link.project.name)}...`
11983
+ `Connecting ${import_chalk37.default.bold(name)} to ${import_chalk37.default.bold(link2.project.name)}...`
11035
11984
  );
11036
11985
  await connectResourceToProject(
11037
11986
  client,
11038
- link.project.id,
11987
+ link2.project.id,
11039
11988
  storeId,
11040
11989
  environments,
11041
- { accountId: link.org.id }
11990
+ { accountId: link2.org.id }
11042
11991
  );
11043
11992
  output_manager_default.success(
11044
11993
  `Blob store ${import_chalk37.default.bold(name)} linked to ${import_chalk37.default.bold(
11045
- link.project.name
11994
+ link2.project.name
11046
11995
  )}`
11047
11996
  );
11048
- client.config.currentTeam = link.org.type === "team" ? link.org.id : void 0;
11997
+ client.config.currentTeam = link2.org.type === "team" ? link2.org.id : void 0;
11049
11998
  await envPullCommandLogic(
11050
11999
  client,
11051
12000
  ".env.local",
11052
12001
  true,
11053
12002
  "development",
11054
- link,
12003
+ link2,
11055
12004
  void 0,
11056
12005
  client.cwd,
11057
12006
  "vercel-cli:blob:store-add"
@@ -11129,8 +12078,8 @@ async function removeStore(client, argv, rwToken) {
11129
12078
  return 1;
11130
12079
  }
11131
12080
  }
11132
- const link = await getLinkedProject(client);
11133
- const accountId = link.status === "linked" ? link.org.id : void 0;
12081
+ const link2 = await getLinkedProject(client);
12082
+ const accountId = link2.status === "linked" ? link2.org.id : void 0;
11134
12083
  try {
11135
12084
  const [store, connectionsResponse] = await Promise.all([
11136
12085
  client.fetch(
@@ -11195,14 +12144,14 @@ async function removeStore(client, argv, rwToken) {
11195
12144
  }
11196
12145
  output_manager_default.stopSpinner();
11197
12146
  output_manager_default.success("Blob store deleted");
11198
- if (link.status === "linked") {
11199
- client.config.currentTeam = link.org.type === "team" ? link.org.id : void 0;
12147
+ if (link2.status === "linked") {
12148
+ client.config.currentTeam = link2.org.type === "team" ? link2.org.id : void 0;
11200
12149
  await envPullCommandLogic(
11201
12150
  client,
11202
12151
  ".env.local",
11203
12152
  true,
11204
12153
  "development",
11205
- link,
12154
+ link2,
11206
12155
  void 0,
11207
12156
  client.cwd,
11208
12157
  "vercel-cli:blob:store-remove"
@@ -11250,8 +12199,8 @@ function formatStoreDetails(store, teamSlug) {
11250
12199
  );
11251
12200
  if (teamSlug) {
11252
12201
  const dashboardUrl = `https://vercel.com/${teamSlug}/~/stores/blob/${store.id}`;
11253
- const link = output_manager_default.link(dashboardUrl, dashboardUrl);
11254
- lines.push(`Dashboard: ${link || dashboardUrl}`);
12202
+ const link2 = output_manager_default.link(dashboardUrl, dashboardUrl);
12203
+ lines.push(`Dashboard: ${link2 || dashboardUrl}`);
11255
12204
  }
11256
12205
  lines.push(
11257
12206
  `Created At: ${(0, import_format5.default)(new Date(store.createdAt), dateTimeFormat)}`
@@ -11319,10 +12268,10 @@ async function getStore(client, argv, rwToken) {
11319
12268
  }
11320
12269
  telemetryClient.trackCliArgumentStoreId(storeId);
11321
12270
  try {
11322
- const link = await getLinkedProject(client);
12271
+ const link2 = await getLinkedProject(client);
11323
12272
  output_manager_default.debug("Getting blob store");
11324
12273
  output_manager_default.spinner("Getting blob store");
11325
- const accountId = link.status === "linked" ? link.org.id : void 0;
12274
+ const accountId = link2.status === "linked" ? link2.org.id : void 0;
11326
12275
  const store = await client.fetch(
11327
12276
  `/v1/storage/stores/${storeId}`,
11328
12277
  {
@@ -11330,7 +12279,7 @@ async function getStore(client, argv, rwToken) {
11330
12279
  accountId
11331
12280
  }
11332
12281
  );
11333
- let teamSlug = link.status === "linked" ? link.org.slug : void 0;
12282
+ let teamSlug = link2.status === "linked" ? link2.org.slug : void 0;
11334
12283
  if (!teamSlug) {
11335
12284
  const { team } = await getScope(client);
11336
12285
  teamSlug = team?.slug;
@@ -11613,8 +12562,8 @@ async function emptyStore(client, argv, auth) {
11613
12562
  return 1;
11614
12563
  }
11615
12564
  try {
11616
- const link = await getLinkedProject(client);
11617
- const accountId = link.status === "linked" ? link.org.id : void 0;
12565
+ const link2 = await getLinkedProject(client);
12566
+ const accountId = link2.status === "linked" ? link2.org.id : void 0;
11618
12567
  const [storeResponse, connectionsResponse, initialList] = await Promise.all(
11619
12568
  [
11620
12569
  client.fetch(
@@ -12470,22 +13419,22 @@ async function purchaseCustomEnvironmentCapacity(client, {
12470
13419
  commandName
12471
13420
  }) {
12472
13421
  const { cwd } = client;
12473
- const link = await ensureLink(commandName, client, cwd, {
13422
+ const link2 = await ensureLink(commandName, client, cwd, {
12474
13423
  autoConfirm: yes,
12475
13424
  projectName,
12476
13425
  failIfNotFound: Boolean(projectName)
12477
13426
  });
12478
- if (typeof link === "number") {
12479
- return link;
13427
+ if (typeof link2 === "number") {
13428
+ return link2;
12480
13429
  }
12481
- const projectId = link.project.id;
12482
- const projectNameResolved = link.project.name;
13430
+ const projectId = link2.project.id;
13431
+ const projectNameResolved = link2.project.name;
12483
13432
  output_manager_default.spinner("Fetching custom environment settings");
12484
13433
  let settings;
12485
13434
  try {
12486
13435
  settings = await client.fetch(
12487
13436
  `/v1/projects/custom-environments/settings?projectId=${encodeURIComponent(projectId)}`,
12488
- { accountId: link.org.id }
13437
+ { accountId: link2.org.id }
12489
13438
  );
12490
13439
  } catch (err) {
12491
13440
  output_manager_default.stopSpinner();
@@ -12534,7 +13483,7 @@ async function purchaseCustomEnvironmentCapacity(client, {
12534
13483
  {
12535
13484
  method: "POST",
12536
13485
  body: { purchasedAmount },
12537
- accountId: link.org.id
13486
+ accountId: link2.org.id
12538
13487
  }
12539
13488
  );
12540
13489
  output_manager_default.stopSpinner();
@@ -13146,20 +14095,20 @@ async function purge(client, argv) {
13146
14095
  }
13147
14096
  const projectName = parsedArgs.flags["--project"];
13148
14097
  telemetry2.trackCliOptionProject(projectName);
13149
- const link = await resolveProjectContext({
14098
+ const link2 = await resolveProjectContext({
13150
14099
  client,
13151
14100
  projectNameOrId: projectName
13152
14101
  });
13153
- if (link.status === "not_linked") {
14102
+ if (link2.status === "not_linked") {
13154
14103
  output_manager_default.error(
13155
14104
  "No project linked. Run `vercel link` to link a project to this directory."
13156
14105
  );
13157
14106
  return 1;
13158
14107
  }
13159
- if (link.status === "error") {
13160
- return link.exitCode;
14108
+ if (link2.status === "error") {
14109
+ return link2.exitCode;
13161
14110
  }
13162
- const { project, org } = link;
14111
+ const { project, org } = link2;
13163
14112
  client.config.currentTeam = org.type === "team" ? org.id : void 0;
13164
14113
  const yes = Boolean(parsedArgs.flags["--yes"]);
13165
14114
  telemetry2.trackCliFlagYes(yes);
@@ -13269,20 +14218,20 @@ async function invalidate(client, argv) {
13269
14218
  }
13270
14219
  const projectName = parsedArgs.flags["--project"];
13271
14220
  telemetry2.trackCliOptionProject(projectName);
13272
- const link = await resolveProjectContext({
14221
+ const link2 = await resolveProjectContext({
13273
14222
  client,
13274
14223
  projectNameOrId: projectName
13275
14224
  });
13276
- if (link.status === "not_linked") {
14225
+ if (link2.status === "not_linked") {
13277
14226
  output_manager_default.error(
13278
14227
  "No project linked. Run `vercel link` to link a project to this directory."
13279
14228
  );
13280
14229
  return 1;
13281
14230
  }
13282
- if (link.status === "error") {
13283
- return link.exitCode;
14231
+ if (link2.status === "error") {
14232
+ return link2.exitCode;
13284
14233
  }
13285
- const { project, org } = link;
14234
+ const { project, org } = link2;
13286
14235
  client.config.currentTeam = org.type === "team" ? org.id : void 0;
13287
14236
  const yes = Boolean(parsedArgs.flags["--yes"]);
13288
14237
  const tag = parsedArgs.flags["--tag"];
@@ -13399,20 +14348,20 @@ async function dangerouslyDelete(client, argv) {
13399
14348
  }
13400
14349
  const projectName = parsedArgs.flags["--project"];
13401
14350
  telemetry2.trackCliOptionProject(projectName);
13402
- const link = await resolveProjectContext({
14351
+ const link2 = await resolveProjectContext({
13403
14352
  client,
13404
14353
  projectNameOrId: projectName
13405
14354
  });
13406
- if (link.status === "not_linked") {
14355
+ if (link2.status === "not_linked") {
13407
14356
  output_manager_default.error(
13408
14357
  "No project linked. Run `vercel link` to link a project to this directory."
13409
14358
  );
13410
14359
  return 1;
13411
14360
  }
13412
- if (link.status === "error") {
13413
- return link.exitCode;
14361
+ if (link2.status === "error") {
14362
+ return link2.exitCode;
13414
14363
  }
13415
- const { project, org } = link;
14364
+ const { project, org } = link2;
13416
14365
  client.config.currentTeam = org.type === "team" ? org.id : void 0;
13417
14366
  const yes = Boolean(parsedArgs.flags["--yes"]);
13418
14367
  const tag = parsedArgs.flags["--tag"];
@@ -13750,43 +14699,43 @@ async function comments(client) {
13750
14699
  if (handleHelp(inspectSubcommand4))
13751
14700
  return 0;
13752
14701
  telemetry2.trackCliSubcommandInspect(subcommandOriginal);
13753
- return (await import("./chunks/inspect-EYUJ32YM.js")).default(client, telemetry2);
14702
+ return (await import("./chunks/inspect-4YTOMOOP.js")).default(client, telemetry2);
13754
14703
  }
13755
14704
  case "open": {
13756
14705
  if (handleHelp(openSubcommand))
13757
14706
  return 0;
13758
14707
  telemetry2.trackCliSubcommandOpen(subcommandOriginal);
13759
- return (await import("./chunks/open-EE7WS2UB.js")).default(client, telemetry2);
14708
+ return (await import("./chunks/open-SZDSII6L.js")).default(client, telemetry2);
13760
14709
  }
13761
14710
  case "reply": {
13762
14711
  if (handleHelp(replySubcommand))
13763
14712
  return 0;
13764
14713
  telemetry2.trackCliSubcommandReply(subcommandOriginal);
13765
- return (await import("./chunks/reply-C3375THE.js")).default(client, telemetry2);
14714
+ return (await import("./chunks/reply-S3UUI6C6.js")).default(client, telemetry2);
13766
14715
  }
13767
14716
  case "resolve": {
13768
14717
  if (handleHelp(resolveSubcommand))
13769
14718
  return 0;
13770
14719
  telemetry2.trackCliSubcommandResolve(subcommandOriginal);
13771
- return (await import("./chunks/resolve-MBWHKHSW.js")).default(client, telemetry2, true);
14720
+ return (await import("./chunks/resolve-PCBDK47N.js")).default(client, telemetry2, true);
13772
14721
  }
13773
14722
  case "reopen": {
13774
14723
  if (handleHelp(reopenSubcommand))
13775
14724
  return 0;
13776
14725
  telemetry2.trackCliSubcommandReopen(subcommandOriginal);
13777
- return (await import("./chunks/resolve-MBWHKHSW.js")).default(client, telemetry2, false);
14726
+ return (await import("./chunks/resolve-PCBDK47N.js")).default(client, telemetry2, false);
13778
14727
  }
13779
14728
  case "edit": {
13780
14729
  if (handleHelp(editSubcommand))
13781
14730
  return 0;
13782
14731
  telemetry2.trackCliSubcommandEdit(subcommandOriginal);
13783
- return (await import("./chunks/edit-OIXKTSXJ.js")).default(client, telemetry2);
14732
+ return (await import("./chunks/edit-HKQEFIOY.js")).default(client, telemetry2);
13784
14733
  }
13785
14734
  case "delete": {
13786
14735
  if (handleHelp(deleteSubcommand))
13787
14736
  return 0;
13788
14737
  telemetry2.trackCliSubcommandDelete(subcommandOriginal);
13789
- return (await import("./chunks/delete-5KRNKCYI.js")).default(client, telemetry2);
14738
+ return (await import("./chunks/delete-NAZTL2IK.js")).default(client, telemetry2);
13790
14739
  }
13791
14740
  default: {
13792
14741
  if (needHelp) {
@@ -13802,7 +14751,7 @@ async function comments(client) {
13802
14751
  }
13803
14752
  telemetry2.trackCliSubcommandList(subcommandOriginal);
13804
14753
  const defaultInvocation = subcommandOriginal === "default";
13805
- return (await import("./chunks/list-W2HMCZT7.js")).default(
14754
+ return (await import("./chunks/list-T7LXP6VX.js")).default(
13806
14755
  client,
13807
14756
  telemetry2,
13808
14757
  defaultInvocation
@@ -14127,7 +15076,7 @@ var ConnexTelemetryClient = class extends TelemetryClient {
14127
15076
 
14128
15077
  // src/commands/connex/create.ts
14129
15078
  var import_open3 = __toESM(require_open(), 1);
14130
- import { readFile as readFile4 } from "fs/promises";
15079
+ import { readFile as readFile5 } from "fs/promises";
14131
15080
  import { resolve as resolve5 } from "path";
14132
15081
  import { text } from "stream/consumers";
14133
15082
 
@@ -14149,13 +15098,13 @@ async function selectConnexTeam(client, message) {
14149
15098
  }
14150
15099
 
14151
15100
  // src/util/connex/request-code.ts
14152
- import { randomBytes, createHash } from "crypto";
15101
+ import { randomBytes, createHash as createHash2 } from "crypto";
14153
15102
  var POLL_INTERVAL_MS = 2e3;
14154
15103
  var MAX_POLL_DURATION_MS = 115 * 60 * 1e3;
14155
15104
  var MAX_EARLY_404_COUNT = 3;
14156
15105
  function generateRequestCode() {
14157
15106
  const verifier = randomBytes(37).toString("base64url");
14158
- const requestCode = createHash("sha256").update(verifier).digest("base64url");
15107
+ const requestCode = createHash2("sha256").update(verifier).digest("base64url");
14159
15108
  return { verifier, requestCode };
14160
15109
  }
14161
15110
  async function awaitConnexResult(client, verifier) {
@@ -14210,9 +15159,9 @@ async function awaitConnexResult(client, verifier) {
14210
15159
  }
14211
15160
 
14212
15161
  // src/util/connex/upload-icon.ts
14213
- import { readFile as readFile3, stat } from "fs/promises";
15162
+ import { readFile as readFile4, stat as stat3 } from "fs/promises";
14214
15163
  import { resolve as resolve4 } from "path";
14215
- import { createHash as createHash2 } from "crypto";
15164
+ import { createHash as createHash3 } from "crypto";
14216
15165
  var MAX_ICON_BYTES = 5 * 1024 * 1024;
14217
15166
  var MIN_IMAGE_BYTES = 12;
14218
15167
  var IMAGE_SIGNATURES = [
@@ -14240,7 +15189,7 @@ async function prepareConnexIcon(filePath, cwd) {
14240
15189
  const absPath = resolve4(cwd, filePath);
14241
15190
  let size;
14242
15191
  try {
14243
- size = (await stat(absPath)).size;
15192
+ size = (await stat3(absPath)).size;
14244
15193
  } catch (err) {
14245
15194
  throw new Error(
14246
15195
  `Could not read icon file at "${filePath}": ${err.message}`
@@ -14253,7 +15202,7 @@ async function prepareConnexIcon(filePath, cwd) {
14253
15202
  }
14254
15203
  let buf;
14255
15204
  try {
14256
- buf = await readFile3(absPath);
15205
+ buf = await readFile4(absPath);
14257
15206
  } catch (err) {
14258
15207
  throw new Error(
14259
15208
  `Could not read icon file at "${filePath}": ${err.message}`
@@ -14262,7 +15211,7 @@ async function prepareConnexIcon(filePath, cwd) {
14262
15211
  if (!isImageBuffer(buf)) {
14263
15212
  throw new Error(`Icon file at "${filePath}" is not a PNG or JPEG.`);
14264
15213
  }
14265
- const sha = createHash2("sha1").update(new Uint8Array(buf)).digest("hex");
15214
+ const sha = createHash3("sha1").update(new Uint8Array(buf)).digest("hex");
14266
15215
  return { buf, sha };
14267
15216
  }
14268
15217
  async function uploadConnexIcon(client, prepared) {
@@ -14870,7 +15819,7 @@ async function create2(client, args, flags) {
14870
15819
  client,
14871
15820
  "Select the team where you want to create this connector"
14872
15821
  );
14873
- const link = await getProjectLink(client, client.cwd);
15822
+ const link2 = await getProjectLink(client, client.cwd);
14874
15823
  let triggerProjectId;
14875
15824
  if (triggerProject !== void 0) {
14876
15825
  output_manager_default.spinner("Looking up trigger destination project\u2026");
@@ -14894,7 +15843,7 @@ async function create2(client, args, flags) {
14894
15843
  return 1;
14895
15844
  }
14896
15845
  }
14897
- const destinationProjectId = triggerProjectId ?? link?.projectId;
15846
+ const destinationProjectId = triggerProjectId ?? link2?.projectId;
14898
15847
  if ((triggerPath !== void 0 || triggerProject !== void 0 || triggerBranch !== void 0 || triggerEnvironment !== void 0) && !destinationProjectId) {
14899
15848
  output_manager_default.error(
14900
15849
  "Trigger destination flags require a linked project. Run `vercel link` first."
@@ -15042,8 +15991,8 @@ async function create2(client, args, flags) {
15042
15991
  service,
15043
15992
  name
15044
15993
  };
15045
- if (link?.projectId) {
15046
- body.projectId = link.projectId;
15994
+ if (link2?.projectId) {
15995
+ body.projectId = link2.projectId;
15047
15996
  }
15048
15997
  body.triggers = { enabled: flags["--triggers"] === true };
15049
15998
  if (flags["--trigger-event"] !== void 0) {
@@ -15276,7 +16225,7 @@ async function resolveDataFlag(raw, client) {
15276
16225
  );
15277
16226
  }
15278
16227
  try {
15279
- return await readFile4(resolve5(client.cwd, source), "utf8");
16228
+ return await readFile5(resolve5(client.cwd, source), "utf8");
15280
16229
  } catch (err) {
15281
16230
  throw new Error(
15282
16231
  `Could not read --data file at "${source}": ${err.message}`
@@ -18349,7 +19298,7 @@ async function main6(client) {
18349
19298
  // src/commands/crons/add.ts
18350
19299
  var import_chalk62 = __toESM(require_source(), 1);
18351
19300
  import { resolve as resolve7 } from "path";
18352
- import { access as access2, readFile as readFile5, writeFile as writeFile4 } from "fs/promises";
19301
+ import { access as access2, readFile as readFile6, writeFile as writeFile6 } from "fs/promises";
18353
19302
 
18354
19303
  // src/util/telemetry/commands/crons/add.ts
18355
19304
  var CronsAddTelemetryClient = class extends TelemetryClient {
@@ -18516,7 +19465,7 @@ async function add3(client, argv) {
18516
19465
  const configPath = resolve7(client.cwd, "vercel.json");
18517
19466
  let config;
18518
19467
  try {
18519
- const content = await readFile5(configPath, "utf-8");
19468
+ const content = await readFile6(configPath, "utf-8");
18520
19469
  config = JSON.parse(content);
18521
19470
  } catch (err) {
18522
19471
  if (err instanceof SyntaxError) {
@@ -18544,7 +19493,7 @@ async function add3(client, argv) {
18544
19493
  existingCrons.push({ path: cronPath, schedule });
18545
19494
  config.crons = existingCrons;
18546
19495
  try {
18547
- await writeFile4(
19496
+ await writeFile6(
18548
19497
  configPath,
18549
19498
  JSON.stringify(config, null, 2) + "\n",
18550
19499
  "utf-8"
@@ -18618,20 +19567,20 @@ async function ls3(client, argv) {
18618
19567
  return 1;
18619
19568
  }
18620
19569
  const asJson = formatResult.jsonOutput;
18621
- const link = await resolveProjectContext({
19570
+ const link2 = await resolveProjectContext({
18622
19571
  client,
18623
19572
  projectNameOrId: projectName
18624
19573
  });
18625
- if (link.status === "error") {
18626
- return link.exitCode;
18627
- } else if (link.status === "not_linked") {
19574
+ if (link2.status === "error") {
19575
+ return link2.exitCode;
19576
+ } else if (link2.status === "not_linked") {
18628
19577
  output_manager_default.error(
18629
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.`}`
18630
19579
  );
18631
19580
  return 1;
18632
19581
  }
18633
- client.config.currentTeam = link.org.type === "team" ? link.org.id : void 0;
18634
- const { project, org } = link;
19582
+ client.config.currentTeam = link2.org.type === "team" ? link2.org.id : void 0;
19583
+ const { project, org } = link2;
18635
19584
  const lsStamp = stamp_default();
18636
19585
  output_manager_default.spinner(
18637
19586
  `Fetching cron jobs for ${import_chalk63.default.bold(`${org.slug}/${project.name}`)}`
@@ -18769,20 +19718,20 @@ async function run(client, argv) {
18769
19718
  const projectName = opts["--project"];
18770
19719
  telemetry2.trackCliOptionProject(projectName);
18771
19720
  telemetry2.trackCliArgumentPath(cronPath);
18772
- const link = await resolveProjectContext({
19721
+ const link2 = await resolveProjectContext({
18773
19722
  client,
18774
19723
  projectNameOrId: projectName
18775
19724
  });
18776
- if (link.status === "error") {
18777
- return link.exitCode;
18778
- } else if (link.status === "not_linked") {
19725
+ if (link2.status === "error") {
19726
+ return link2.exitCode;
19727
+ } else if (link2.status === "not_linked") {
18779
19728
  output_manager_default.error(
18780
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.`}`
18781
19730
  );
18782
19731
  return 1;
18783
19732
  }
18784
- client.config.currentTeam = link.org.type === "team" ? link.org.id : void 0;
18785
- const { project, org } = link;
19733
+ client.config.currentTeam = link2.org.type === "team" ? link2.org.id : void 0;
19734
+ const { project, org } = link2;
18786
19735
  const runStamp = stamp_default();
18787
19736
  output_manager_default.spinner(
18788
19737
  `Fetching cron jobs for ${import_chalk64.default.bold(`${org.slug}/${project.name}`)}`
@@ -18830,7 +19779,7 @@ async function run(client, argv) {
18830
19779
  return 1;
18831
19780
  }
18832
19781
  output_manager_default.spinner(`Triggering cron job ${import_chalk64.default.bold(cronPath)}`);
18833
- const teamId = link.org.type === "team" ? link.org.id : void 0;
19782
+ const teamId = link2.org.type === "team" ? link2.org.id : void 0;
18834
19783
  const qs = teamId ? `?teamId=${encodeURIComponent(teamId)}` : "";
18835
19784
  let result;
18836
19785
  try {
@@ -19461,13 +20410,13 @@ async function getFullUrlAndToken(client, fullUrl, protectionBypassFlag) {
19461
20410
  link: null
19462
20411
  };
19463
20412
  }
19464
- const link = await resolveProjectFromUrl(client, fullUrl);
20413
+ const link2 = await resolveProjectFromUrl(client, fullUrl);
19465
20414
  let deploymentProtectionToken = null;
19466
- if (link) {
20415
+ if (link2) {
19467
20416
  try {
19468
20417
  deploymentProtectionToken = await getOrCreateDeploymentProtectionToken(
19469
20418
  client,
19470
- link
20419
+ link2
19471
20420
  );
19472
20421
  } catch (err) {
19473
20422
  output_manager_default.debug(`Failed to get deployment protection bypass token: ${err}`);
@@ -19476,7 +20425,7 @@ async function getFullUrlAndToken(client, fullUrl, protectionBypassFlag) {
19476
20425
  return {
19477
20426
  fullUrl,
19478
20427
  deploymentProtectionToken,
19479
- link
20428
+ link: link2
19480
20429
  };
19481
20430
  }
19482
20431
  async function linkFromDeployment(client, deployment) {
@@ -19490,13 +20439,13 @@ async function linkFromDeployment(client, deployment) {
19490
20439
  }
19491
20440
  async function resolveTargetProject(client, deployment, deploymentFlag) {
19492
20441
  try {
19493
- const link = await linkFromDeployment(client, deployment);
19494
- if (!link) {
20442
+ const link2 = await linkFromDeployment(client, deployment);
20443
+ if (!link2) {
19495
20444
  output_manager_default.warn(
19496
20445
  `Deployment "${deploymentFlag}" is missing project metadata; proceeding without an automatic protection bypass token.`
19497
20446
  );
19498
20447
  }
19499
- return link;
20448
+ return link2;
19500
20449
  } catch (err) {
19501
20450
  output_manager_default.debug(`Failed to resolve deployment project: ${err}`);
19502
20451
  output_manager_default.warn(
@@ -19544,7 +20493,7 @@ async function getDeploymentUrlAndToken(client, commandName, path3, options) {
19544
20493
  resolveProjectForTrace
19545
20494
  } = options;
19546
20495
  const suppliedProtectionBypass = deploymentFlag ? protectionBypassFlag ?? (process.env.VERCEL_AUTOMATION_BYPASS_SECRET || void 0) : protectionBypassFlag;
19547
- let link = null;
20496
+ let link2 = null;
19548
20497
  let createProtectionBypassIfMissing = !deploymentFlag;
19549
20498
  let scope;
19550
20499
  try {
@@ -19569,7 +20518,7 @@ async function getDeploymentUrlAndToken(client, commandName, path3, options) {
19569
20518
  return 1;
19570
20519
  }
19571
20520
  if (resolveProjectForTrace) {
19572
- link = await tryLinkFromSelector(
20521
+ link2 = await tryLinkFromSelector(
19573
20522
  client,
19574
20523
  scope.contextName,
19575
20524
  deploymentSelector
@@ -19591,10 +20540,10 @@ async function getDeploymentUrlAndToken(client, commandName, path3, options) {
19591
20540
  `Could not resolve project information for deployment "${deploymentFlag}"; proceeding without an automatic protection bypass token.`
19592
20541
  );
19593
20542
  } else {
19594
- link = await resolveTargetProject(client, deployment, deploymentFlag);
19595
- if (link && !hasAutomationBypassToken(link.project)) {
20543
+ link2 = await resolveTargetProject(client, deployment, deploymentFlag);
20544
+ if (link2 && !hasAutomationBypassToken(link2.project)) {
19596
20545
  const linked = await getLinkedProjectOrNull(client);
19597
- createProtectionBypassIfMissing = linked?.project.id === link.project.id;
20546
+ createProtectionBypassIfMissing = linked?.project.id === link2.project.id;
19598
20547
  }
19599
20548
  }
19600
20549
  }
@@ -19624,7 +20573,7 @@ async function getDeploymentUrlAndToken(client, commandName, path3, options) {
19624
20573
  output_manager_default.error("Failed to get project information");
19625
20574
  return 1;
19626
20575
  }
19627
- link = ensuredLink;
20576
+ link2 = ensuredLink;
19628
20577
  const preferredAlias = linkedProject.project.targets?.production?.alias?.[0];
19629
20578
  const backupAlias = linkedProject.project.latestDeployments?.[0]?.url;
19630
20579
  const target = preferredAlias || backupAlias;
@@ -19636,11 +20585,11 @@ async function getDeploymentUrlAndToken(client, commandName, path3, options) {
19636
20585
  const fullUrl = `${baseUrl}${path3.startsWith("/") ? path3 : `/${path3}`}`;
19637
20586
  output_manager_default.debug(`${import_chalk66.default.cyan("Target URL:")} ${import_chalk66.default.bold(fullUrl)}`);
19638
20587
  let deploymentProtectionToken = suppliedProtectionBypass ?? null;
19639
- if (suppliedProtectionBypass === void 0 && link?.project.id) {
20588
+ if (suppliedProtectionBypass === void 0 && link2?.project.id) {
19640
20589
  try {
19641
20590
  deploymentProtectionToken = await getOrCreateDeploymentProtectionToken(
19642
20591
  client,
19643
- link,
20592
+ link2,
19644
20593
  { createIfMissing: createProtectionBypassIfMissing }
19645
20594
  );
19646
20595
  } catch (err) {
@@ -19653,7 +20602,7 @@ async function getDeploymentUrlAndToken(client, commandName, path3, options) {
19653
20602
  return {
19654
20603
  fullUrl,
19655
20604
  deploymentProtectionToken,
19656
- link
20605
+ link: link2
19657
20606
  };
19658
20607
  }
19659
20608
 
@@ -19661,8 +20610,8 @@ async function getDeploymentUrlAndToken(client, commandName, path3, options) {
19661
20610
  var import_error_utils8 = __toESM(require_dist(), 1);
19662
20611
  import { spawn } from "child_process";
19663
20612
  import { tmpdir } from "os";
19664
- import { join as join9 } from "path";
19665
- import { mkdtemp, readFile as readFile7, rm as rm3 } from "fs/promises";
20613
+ import { join as join15 } from "path";
20614
+ import { mkdtemp, readFile as readFile8, rm as rm3 } from "fs/promises";
19666
20615
 
19667
20616
  // src/commands/curl/confirm-production.ts
19668
20617
  async function confirmProduction(client, { deploymentTarget, yes, isTTY }) {
@@ -19686,28 +20635,28 @@ async function confirmProduction(client, { deploymentTarget, yes, isTTY }) {
19686
20635
  }
19687
20636
 
19688
20637
  // src/commands/curl/trace-session-token-provider.ts
19689
- import { createHash as createHash3 } from "crypto";
19690
- import { chmod, mkdir as mkdir2, readFile as readFile6, unlink, writeFile as writeFile5 } from "fs/promises";
19691
- import { dirname as dirname3, join as join8 } from "path";
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";
19692
20641
  var FALLBACK_TTL_MS = 5 * 60 * 1e3;
19693
20642
  var EXPIRY_BUFFER_MS = 30 * 1e3;
19694
20643
  var CACHE_SCHEMA_VERSION = 1;
19695
20644
  function resolveCacheDir(override2) {
19696
20645
  if (override2)
19697
20646
  return override2;
19698
- return join8(getGlobalPathConfig(), "cache", "traces");
20647
+ return join14(getGlobalPathConfig(), "cache", "traces");
19699
20648
  }
19700
20649
  function cacheFilename(teamId, host) {
19701
20650
  const key = `${teamId ?? ""}:${host}`;
19702
- return `${createHash3("sha256").update(key).digest("hex")}.json`;
20651
+ return `${createHash4("sha256").update(key).digest("hex")}.json`;
19703
20652
  }
19704
20653
  function cachePath(cacheDir, teamId, host) {
19705
- return join8(cacheDir, cacheFilename(teamId, host));
20654
+ return join14(cacheDir, cacheFilename(teamId, host));
19706
20655
  }
19707
20656
  async function readCache(path3) {
19708
20657
  let raw;
19709
20658
  try {
19710
- raw = await readFile6(path3, "utf8");
20659
+ raw = await readFile7(path3, "utf8");
19711
20660
  } catch {
19712
20661
  return null;
19713
20662
  }
@@ -19723,9 +20672,9 @@ async function readCache(path3) {
19723
20672
  }
19724
20673
  }
19725
20674
  async function writeCache(path3, entry) {
19726
- await mkdir2(dirname3(path3), { recursive: true });
19727
- await writeFile5(path3, JSON.stringify(entry), { mode: 384 });
19728
- await chmod(path3, 384);
20675
+ await mkdir3(dirname5(path3), { recursive: true });
20676
+ await writeFile7(path3, JSON.stringify(entry), { mode: 384 });
20677
+ await chmod2(path3, 384);
19729
20678
  }
19730
20679
  async function issueToken(client, {
19731
20680
  teamId,
@@ -19761,7 +20710,7 @@ async function getTraceSessionToken({
19761
20710
  const path3 = cachePath(dir, teamId, hostname2);
19762
20711
  const cached = await readCache(path3);
19763
20712
  if (cached && evictedToken && cached.token === evictedToken) {
19764
- await unlink(path3).catch(() => {
20713
+ await unlink3(path3).catch(() => {
19765
20714
  });
19766
20715
  } else if (cached && Date.now() < cached.expiresAt - EXPIRY_BUFFER_MS) {
19767
20716
  return {
@@ -19797,9 +20746,9 @@ async function lookupDeployment(client, fullUrl, accountId) {
19797
20746
  accountId ? { accountId } : {}
19798
20747
  );
19799
20748
  }
19800
- function resolveTeamId(link, deployment) {
19801
- if (link?.org.type === "team") {
19802
- return link.org.id;
20749
+ function resolveTeamId(link2, deployment) {
20750
+ if (link2?.org.type === "team") {
20751
+ return link2.org.id;
19803
20752
  }
19804
20753
  if (deployment.ownerId?.startsWith("team_")) {
19805
20754
  return deployment.ownerId;
@@ -19835,8 +20784,8 @@ function extractFinalStatus(headerDump) {
19835
20784
  return lastStatus;
19836
20785
  }
19837
20786
  async function runCurlAndCaptureHeaders(curlFlags, json) {
19838
- const tmpDir = await mkdtemp(join9(tmpdir(), "vc-curl-trace-"));
19839
- const headerFile = join9(tmpDir, "headers");
20787
+ const tmpDir = await mkdtemp(join15(tmpdir(), "vc-curl-trace-"));
20788
+ const headerFile = join15(tmpDir, "headers");
19840
20789
  const flags = ["--dump-header", headerFile, ...curlFlags];
19841
20790
  try {
19842
20791
  const { exitCode: exitCode2, capturedBody } = await new Promise((resolve10) => {
@@ -19865,7 +20814,7 @@ async function runCurlAndCaptureHeaders(curlFlags, json) {
19865
20814
  });
19866
20815
  let headerDump = "";
19867
20816
  try {
19868
- headerDump = await readFile7(headerFile, "utf8");
20817
+ headerDump = await readFile8(headerFile, "utf8");
19869
20818
  } catch (err) {
19870
20819
  output_manager_default.debug(`Failed to read curl header dump: ${err}`);
19871
20820
  }
@@ -19875,12 +20824,12 @@ async function runCurlAndCaptureHeaders(curlFlags, json) {
19875
20824
  });
19876
20825
  }
19877
20826
  }
19878
- async function trace2(client, { fullUrl, link, curlFlags, json, yes, telemetry: telemetry2 }) {
20827
+ async function trace2(client, { fullUrl, link: link2, curlFlags, json, yes, telemetry: telemetry2 }) {
19879
20828
  telemetry2.trackCliFlagTrace(true);
19880
20829
  if (json) {
19881
20830
  telemetry2.trackCliFlagJson(true);
19882
20831
  }
19883
- const accountId = link?.org.id;
20832
+ const accountId = link2?.org.id;
19884
20833
  let deployment;
19885
20834
  try {
19886
20835
  deployment = await lookupDeployment(client, fullUrl, accountId);
@@ -19890,14 +20839,14 @@ async function trace2(client, { fullUrl, link, curlFlags, json, yes, telemetry:
19890
20839
  );
19891
20840
  return 1;
19892
20841
  }
19893
- const projectId = link?.project.id ?? deployment.projectId;
20842
+ const projectId = link2?.project.id ?? deployment.projectId;
19894
20843
  if (!projectId) {
19895
20844
  output_manager_default.error(
19896
20845
  "Could not resolve project for trace session. Run `vercel link` and retry."
19897
20846
  );
19898
20847
  return 1;
19899
20848
  }
19900
- const teamId = resolveTeamId(link, deployment);
20849
+ const teamId = resolveTeamId(link2, deployment);
19901
20850
  let userId;
19902
20851
  try {
19903
20852
  userId = client.authConfig.userId ?? (await getUser(client)).id;
@@ -20096,11 +21045,11 @@ async function getProjectByCwdOrLink({
20096
21045
  const effectiveNonInteractive = nonInteractive ?? client.nonInteractive ?? argvHasNonInteractive(client.argv);
20097
21046
  if (forReadOnlyCommand && effectiveNonInteractive) {
20098
21047
  const resolvedCwd = await resolveProjectCwd(cwd ?? client.cwd);
20099
- const link = await getLinkedProject(client, { cwd: resolvedCwd });
20100
- if (link.status === "linked" && link.project) {
20101
- return link.project;
21048
+ const link2 = await getLinkedProject(client, { cwd: resolvedCwd });
21049
+ if (link2.status === "linked" && link2.project) {
21050
+ return link2.project;
20102
21051
  }
20103
- if (link.status === "error") {
21052
+ if (link2.status === "error") {
20104
21053
  const err = new Error("Link project error");
20105
21054
  err.code = "ERR_LINK_PROJECT";
20106
21055
  throw err;
@@ -23973,8 +24922,8 @@ async function search(client, argv) {
23973
24922
  output_manager_default.error(cursorResult.error);
23974
24923
  return 1;
23975
24924
  }
23976
- const cursor = cursorResult.cursor;
23977
- if (cursor && (cursor.query !== query || cursor.fragment !== fragment || cursor.order !== order || !areStringArraysEqual(cursor.tlds, tlds) || cursor.availableOnly !== availableOnly)) {
24925
+ const cursor2 = cursorResult.cursor;
24926
+ if (cursor2 && (cursor2.query !== query || cursor2.fragment !== fragment || cursor2.order !== order || !areStringArraysEqual(cursor2.tlds, tlds) || cursor2.availableOnly !== availableOnly)) {
23978
24927
  output_manager_default.error(
23979
24928
  "The continuation cursor does not match the current query, order, or filters."
23980
24929
  );
@@ -23983,7 +24932,7 @@ async function search(client, argv) {
23983
24932
  try {
23984
24933
  const supportedTlds = await getSupportedTlds(client, order);
23985
24934
  const matchingTlds = filterTlds(supportedTlds, fragment, tlds, order);
23986
- const offsetResult = getOffset(matchingTlds, cursor);
24935
+ const offsetResult = getOffset(matchingTlds, cursor2);
23987
24936
  if (!offsetResult.valid) {
23988
24937
  output_manager_default.error(offsetResult.error);
23989
24938
  return 1;
@@ -24096,8 +25045,8 @@ function isSupportedTldsCacheEntryFresh(fetchedAt, now = Date.now()) {
24096
25045
  const age = now - fetchedAt;
24097
25046
  return age >= 0 && age <= SUPPORTED_TLDS_CACHE_TTL_MS;
24098
25047
  }
24099
- function encodeCursor(cursor) {
24100
- return Buffer.from(JSON.stringify(cursor), "utf8").toString("base64url");
25048
+ function encodeCursor(cursor2) {
25049
+ return Buffer.from(JSON.stringify(cursor2), "utf8").toString("base64url");
24101
25050
  }
24102
25051
  function decodeCursor(value) {
24103
25052
  if (value === void 0) {
@@ -24107,13 +25056,13 @@ function decodeCursor(value) {
24107
25056
  if (!value || !/^[A-Za-z0-9_-]+$/.test(value)) {
24108
25057
  throw new Error("Invalid base64url value");
24109
25058
  }
24110
- const cursor = JSON.parse(
25059
+ const cursor2 = JSON.parse(
24111
25060
  Buffer.from(value, "base64url").toString("utf8")
24112
25061
  );
24113
- if (!isContinuationCursor(cursor)) {
25062
+ if (!isContinuationCursor(cursor2)) {
24114
25063
  throw new Error("Invalid cursor shape");
24115
25064
  }
24116
- return { valid: true, cursor };
25065
+ return { valid: true, cursor: cursor2 };
24117
25066
  } catch {
24118
25067
  return {
24119
25068
  valid: false,
@@ -24125,18 +25074,18 @@ function isContinuationCursor(value) {
24125
25074
  if (!value || typeof value !== "object" || Array.isArray(value)) {
24126
25075
  return false;
24127
25076
  }
24128
- const cursor = value;
24129
- const keys = Object.keys(cursor).sort();
25077
+ const cursor2 = value;
25078
+ const keys = Object.keys(cursor2).sort();
24130
25079
  if (keys.length !== 6 || keys.join(",") !== "availableOnly,fragment,lastTld,order,query,tlds") {
24131
25080
  return false;
24132
25081
  }
24133
- return typeof cursor.query === "string" && (typeof cursor.fragment === "string" || cursor.fragment === null) && typeof cursor.order === "string" && ORDERS.includes(cursor.order) && Array.isArray(cursor.tlds) && cursor.tlds.every((tld) => typeof tld === "string") && typeof cursor.availableOnly === "boolean" && typeof cursor.lastTld === "string" && cursor.lastTld.length > 0;
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;
24134
25083
  }
24135
- function getOffset(tlds, cursor) {
24136
- if (!cursor) {
25084
+ function getOffset(tlds, cursor2) {
25085
+ if (!cursor2) {
24137
25086
  return { valid: true, offset: 0 };
24138
25087
  }
24139
- const lastTldIndex = tlds.indexOf(cursor.lastTld);
25088
+ const lastTldIndex = tlds.indexOf(cursor2.lastTld);
24140
25089
  if (lastTldIndex === -1) {
24141
25090
  return {
24142
25091
  valid: false,
@@ -24209,7 +25158,7 @@ function getOrder(value) {
24209
25158
  }
24210
25159
  return { valid: true, order };
24211
25160
  }
24212
- function getContinuationCommand(query, order, tlds, availableOnly, cursor) {
25161
+ function getContinuationCommand(query, order, tlds, availableOnly, cursor2) {
24213
25162
  const flags = [];
24214
25163
  if (order !== DEFAULT_ORDER) {
24215
25164
  flags.push(`--order=${order}`);
@@ -24218,7 +25167,7 @@ function getContinuationCommand(query, order, tlds, availableOnly, cursor) {
24218
25167
  if (availableOnly) {
24219
25168
  flags.push("--available");
24220
25169
  }
24221
- flags.push(`--next ${cursor}`);
25170
+ flags.push(`--next ${cursor2}`);
24222
25171
  return `domains search ${query} ${flags.join(" ")}`;
24223
25172
  }
24224
25173
  function normalizeTldFilters(values) {
@@ -24462,20 +25411,20 @@ async function resolveRequestedProject(client, domainName, idOrName) {
24462
25411
  return { kind: "error", idOrName, error: result };
24463
25412
  }
24464
25413
  async function findLinkedProjectDomain(client, domainName) {
24465
- const link = await getLinkedProject(client);
24466
- if (link.status !== "linked") {
25414
+ const link2 = await getLinkedProject(client);
25415
+ if (link2.status !== "linked") {
24467
25416
  return null;
24468
25417
  }
24469
- const result = await getProjectDomain(client, link.project.id, domainName, {
25418
+ const result = await getProjectDomain(client, link2.project.id, domainName, {
24470
25419
  bailOn429: true
24471
25420
  });
24472
25421
  if (!isAPIError(result)) {
24473
- return attachedProject(link.project.id, link.project.name, result);
25422
+ return attachedProject(link2.project.id, link2.project.name, result);
24474
25423
  }
24475
25424
  if (result.status === 403 || result.status === 404) {
24476
25425
  return null;
24477
25426
  }
24478
- return { kind: "error", idOrName: link.project.id, error: result };
25427
+ return { kind: "error", idOrName: link2.project.id, error: result };
24479
25428
  }
24480
25429
  async function findProjectDomainByName(client, domainName) {
24481
25430
  const result = await getProjectDomainByName(client, domainName, {
@@ -25904,14 +26853,14 @@ async function resolveFirewallScope(client, flags) {
25904
26853
  }
25905
26854
  return { type: "team", teamId: team.id, displayName: team.slug };
25906
26855
  }
25907
- const link = await requireProjectContext(
26856
+ const link2 = await requireProjectContext(
25908
26857
  client,
25909
26858
  "firewall",
25910
26859
  flags["--project"]
25911
26860
  );
25912
- if (typeof link === "number")
25913
- return link;
25914
- const { project, org } = link;
26861
+ if (typeof link2 === "number")
26862
+ return link2;
26863
+ const { project, org } = link2;
25915
26864
  return {
25916
26865
  type: "project",
25917
26866
  projectId: project.id,
@@ -26736,14 +27685,14 @@ async function overview(client, argv) {
26736
27685
  const parsed = await parseSubcommandArgs2(argv, overviewSubcommand, client);
26737
27686
  if (typeof parsed === "number")
26738
27687
  return parsed;
26739
- const link = await requireProjectContext(
27688
+ const link2 = await requireProjectContext(
26740
27689
  client,
26741
27690
  "firewall",
26742
27691
  parsed.flags["--project"]
26743
27692
  );
26744
- if (typeof link === "number")
26745
- return link;
26746
- const { project, org } = link;
27693
+ if (typeof link2 === "number")
27694
+ return link2;
27695
+ const { project, org } = link2;
26747
27696
  const teamId = org.type === "team" ? org.id : void 0;
26748
27697
  output_manager_default.spinner(`Fetching firewall overview for ${import_chalk91.default.bold(project.name)}`);
26749
27698
  try {
@@ -26999,14 +27948,14 @@ async function list12(client, argv) {
26999
27948
  );
27000
27949
  if (typeof parsed === "number")
27001
27950
  return parsed;
27002
- const link = await requireProjectContext(
27951
+ const link2 = await requireProjectContext(
27003
27952
  client,
27004
27953
  "firewall",
27005
27954
  parsed.flags["--project"]
27006
27955
  );
27007
- if (typeof link === "number")
27008
- return link;
27009
- const { project, org } = link;
27956
+ if (typeof link2 === "number")
27957
+ return link2;
27958
+ const { project, org } = link2;
27010
27959
  const teamId = org.type === "team" ? org.id : void 0;
27011
27960
  output_manager_default.spinner(
27012
27961
  `Fetching system bypass rules for ${import_chalk95.default.bold(project.name)}`
@@ -27203,14 +28152,14 @@ async function add6(client, argv) {
27203
28152
  return 1;
27204
28153
  }
27205
28154
  }
27206
- const link = await requireProjectContext(
28155
+ const link2 = await requireProjectContext(
27207
28156
  client,
27208
28157
  "firewall",
27209
28158
  parsed.flags["--project"]
27210
28159
  );
27211
- if (typeof link === "number")
27212
- return link;
27213
- const { project, org } = link;
28160
+ if (typeof link2 === "number")
28161
+ return link2;
28162
+ const { project, org } = link2;
27214
28163
  const teamId = org.type === "team" ? org.id : void 0;
27215
28164
  const scopeLabel = domain2 || "all domains";
27216
28165
  const confirmed = await confirmAction(
@@ -27310,14 +28259,14 @@ async function remove6(client, argv) {
27310
28259
  return 1;
27311
28260
  }
27312
28261
  }
27313
- const link = await requireProjectContext(
28262
+ const link2 = await requireProjectContext(
27314
28263
  client,
27315
28264
  "firewall",
27316
28265
  parsed.flags["--project"]
27317
28266
  );
27318
- if (typeof link === "number")
27319
- return link;
27320
- const { project, org } = link;
28267
+ if (typeof link2 === "number")
28268
+ return link2;
28269
+ const { project, org } = link2;
27321
28270
  const teamId = org.type === "team" ? org.id : void 0;
27322
28271
  const scopeLabel = domain2 || "all domains";
27323
28272
  const confirmed = await confirmAction(
@@ -27524,14 +28473,14 @@ async function enable(client, argv) {
27524
28473
  );
27525
28474
  return 1;
27526
28475
  }
27527
- const link = await requireProjectContext(
28476
+ const link2 = await requireProjectContext(
27528
28477
  client,
27529
28478
  "firewall",
27530
28479
  parsed.flags["--project"]
27531
28480
  );
27532
- if (typeof link === "number")
27533
- return link;
27534
- const { project } = link;
28481
+ if (typeof link2 === "number")
28482
+ return link2;
28483
+ const { project } = link2;
27535
28484
  const confirmed = await confirmAction(
27536
28485
  client,
27537
28486
  parsed.flags["--yes"],
@@ -27597,14 +28546,14 @@ async function disable(client, argv) {
27597
28546
  );
27598
28547
  return 1;
27599
28548
  }
27600
- const link = await requireProjectContext(
28549
+ const link2 = await requireProjectContext(
27601
28550
  client,
27602
28551
  "firewall",
27603
28552
  parsed.flags["--project"]
27604
28553
  );
27605
- if (typeof link === "number")
27606
- return link;
27607
- const { project } = link;
28554
+ if (typeof link2 === "number")
28555
+ return link2;
28556
+ const { project } = link2;
27608
28557
  const confirmed = await confirmAction(
27609
28558
  client,
27610
28559
  parsed.flags["--yes"],
@@ -27749,14 +28698,14 @@ async function pause(client, argv) {
27749
28698
  );
27750
28699
  return 1;
27751
28700
  }
27752
- const link = await requireProjectContext(
28701
+ const link2 = await requireProjectContext(
27753
28702
  client,
27754
28703
  "firewall",
27755
28704
  parsed.flags["--project"]
27756
28705
  );
27757
- if (typeof link === "number")
27758
- return link;
27759
- const { project, org } = link;
28706
+ if (typeof link2 === "number")
28707
+ return link2;
28708
+ const { project, org } = link2;
27760
28709
  const teamId = org.type === "team" ? org.id : void 0;
27761
28710
  const confirmed = await confirmAction(
27762
28711
  client,
@@ -27830,14 +28779,14 @@ async function resume(client, argv) {
27830
28779
  );
27831
28780
  return 1;
27832
28781
  }
27833
- const link = await requireProjectContext(
28782
+ const link2 = await requireProjectContext(
27834
28783
  client,
27835
28784
  "firewall",
27836
28785
  parsed.flags["--project"]
27837
28786
  );
27838
- if (typeof link === "number")
27839
- return link;
27840
- const { project, org } = link;
28787
+ if (typeof link2 === "number")
28788
+ return link2;
28789
+ const { project, org } = link2;
27841
28790
  const teamId = org.type === "team" ? org.id : void 0;
27842
28791
  const confirmed = await confirmAction(
27843
28792
  client,
@@ -33928,12 +34877,12 @@ var GlobalConfigTelemetryClient = class extends TelemetryClient {
33928
34877
 
33929
34878
  // src/commands/global-config/apply-linked-project-team.ts
33930
34879
  async function applyLinkedProjectTeam(client) {
33931
- const link = await getLinkedProject(client);
33932
- if (link.status === "error") {
33933
- return link.exitCode;
34880
+ const link2 = await getLinkedProject(client);
34881
+ if (link2.status === "error") {
34882
+ return link2.exitCode;
33934
34883
  }
33935
- if (link.status === "linked") {
33936
- client.config.currentTeam = link.org.type === "team" ? link.org.id : void 0;
34884
+ if (link2.status === "linked") {
34885
+ client.config.currentTeam = link2.org.type === "team" ? link2.org.id : void 0;
33937
34886
  }
33938
34887
  return void 0;
33939
34888
  }
@@ -34224,7 +35173,7 @@ async function getFlags(client, projectId, options = {}) {
34224
35173
  createdBy,
34225
35174
  maintainerIds,
34226
35175
  limit,
34227
- cursor
35176
+ cursor: cursor2
34228
35177
  } = options;
34229
35178
  output_manager_default.debug(`Fetching feature flags for project ${projectId}`);
34230
35179
  const basePath = `/v2/projects/${encodeURIComponent(projectId)}/feature-flags/flags`;
@@ -34246,13 +35195,13 @@ async function getFlags(client, projectId, options = {}) {
34246
35195
  }
34247
35196
  return query.toString();
34248
35197
  };
34249
- if (limit !== void 0 || cursor !== void 0) {
35198
+ if (limit !== void 0 || cursor2 !== void 0) {
34250
35199
  const pageLimit = Math.min(
34251
35200
  limit ?? MAX_FLAGS_PAGE_LIMIT,
34252
35201
  MAX_FLAGS_PAGE_LIMIT
34253
35202
  );
34254
35203
  const response = await client.fetch(
34255
- `${basePath}?${buildQuery(pageLimit, cursor)}`
35204
+ `${basePath}?${buildQuery(pageLimit, cursor2)}`
34256
35205
  );
34257
35206
  return { flags: response.data, next: response.pagination?.next ?? null };
34258
35207
  }
@@ -34420,17 +35369,17 @@ async function ls7(client, argv) {
34420
35369
  );
34421
35370
  return 1;
34422
35371
  }
34423
- const link = await getLinkedFlagsProject(client, projectName);
34424
- if (link.status === "error") {
34425
- return link.exitCode;
34426
- } else if (link.status === "not_linked") {
35372
+ const link2 = await getLinkedFlagsProject(client, projectName);
35373
+ if (link2.status === "error") {
35374
+ return link2.exitCode;
35375
+ } else if (link2.status === "not_linked") {
34427
35376
  output_manager_default.error(
34428
35377
  `Your codebase isn't linked to a project on Vercel. Pass --project <name>, or run ${getCommandName("link")} to link it.`
34429
35378
  );
34430
35379
  return 1;
34431
35380
  }
34432
- client.config.currentTeam = link.org.type === "team" ? link.org.id : void 0;
34433
- const { project, org } = link;
35381
+ client.config.currentTeam = link2.org.type === "team" ? link2.org.id : void 0;
35382
+ const { project, org } = link2;
34434
35383
  const projectSlugLink = formatProject(org.slug, project.name);
34435
35384
  const lsStamp = stamp_default();
34436
35385
  output_manager_default.spinner(`Fetching ${state} feature flags for ${projectSlugLink}`);
@@ -34999,17 +35948,17 @@ async function inspect5(client, argv) {
34999
35948
  }
35000
35949
  telemetryClient.trackCliArgumentFlag(flagArg);
35001
35950
  telemetryClient.trackCliOptionProject(projectName);
35002
- const link = await getLinkedFlagsProject(client, projectName);
35003
- if (link.status === "error") {
35004
- return link.exitCode;
35005
- } else if (link.status === "not_linked") {
35951
+ const link2 = await getLinkedFlagsProject(client, projectName);
35952
+ if (link2.status === "error") {
35953
+ return link2.exitCode;
35954
+ } else if (link2.status === "not_linked") {
35006
35955
  output_manager_default.error(
35007
35956
  `Your codebase isn't linked to a project on Vercel. Pass --project <name>, or run ${getCommandName("link")} to link it.`
35008
35957
  );
35009
35958
  return 1;
35010
35959
  }
35011
- client.config.currentTeam = link.org.type === "team" ? link.org.id : void 0;
35012
- const { project, org } = link;
35960
+ client.config.currentTeam = link2.org.type === "team" ? link2.org.id : void 0;
35961
+ const { project, org } = link2;
35013
35962
  const projectSlugLink = formatProject(org.slug, project.name);
35014
35963
  try {
35015
35964
  const [flag, settings] = await Promise.all([
@@ -35074,8 +36023,8 @@ var FlagsVersionsTelemetryClient = class extends TelemetryClient {
35074
36023
  });
35075
36024
  }
35076
36025
  }
35077
- trackCliOptionCursor(cursor) {
35078
- if (cursor) {
36026
+ trackCliOptionCursor(cursor2) {
36027
+ if (cursor2) {
35079
36028
  this.trackCliOption({
35080
36029
  option: "cursor",
35081
36030
  value: this.redactedValue
@@ -35850,7 +36799,7 @@ async function listVersions(client, argv, telemetryClient) {
35850
36799
  const [flagArg] = args;
35851
36800
  const environment = flags["--environment"];
35852
36801
  const limit = flags["--limit"];
35853
- const cursor = flags["--cursor"];
36802
+ const cursor2 = flags["--cursor"];
35854
36803
  const json = flags["--json"];
35855
36804
  const projectName = getProjectNameFromFlags(flags);
35856
36805
  if (!flagArg) {
@@ -35863,7 +36812,7 @@ async function listVersions(client, argv, telemetryClient) {
35863
36812
  telemetryClient.trackCliOptionProject(projectName);
35864
36813
  telemetryClient.trackCliOptionEnvironment(environment);
35865
36814
  telemetryClient.trackCliOptionLimit(limit);
35866
- telemetryClient.trackCliOptionCursor(cursor);
36815
+ telemetryClient.trackCliOptionCursor(cursor2);
35867
36816
  telemetryClient.trackCliFlagJson(json);
35868
36817
  if (limit !== void 0 && (!Number.isInteger(limit) || limit < 1 || limit > MAX_FLAG_VERSIONS_PAGE_LIMIT)) {
35869
36818
  output_manager_default.error(
@@ -35871,10 +36820,10 @@ async function listVersions(client, argv, telemetryClient) {
35871
36820
  );
35872
36821
  return 1;
35873
36822
  }
35874
- const link = await resolveLinkedProject(client, projectName);
35875
- if (typeof link === "number")
35876
- return link;
35877
- const { project, org } = link;
36823
+ const link2 = await resolveLinkedProject(client, projectName);
36824
+ if (typeof link2 === "number")
36825
+ return link2;
36826
+ const { project, org } = link2;
35878
36827
  const projectSlugLink = formatProject(org.slug, project.name);
35879
36828
  const versionsStamp = stamp_default();
35880
36829
  const environmentLabel = environment ? ` in ${environment}` : "";
@@ -35889,7 +36838,7 @@ async function listVersions(client, argv, telemetryClient) {
35889
36838
  {
35890
36839
  environment,
35891
36840
  limit,
35892
- cursor
36841
+ cursor: cursor2
35893
36842
  }
35894
36843
  );
35895
36844
  output_manager_default.stopSpinner();
@@ -35950,10 +36899,10 @@ async function diffVersions(client, argv, telemetryClient) {
35950
36899
  output_manager_default.error("Revision 0 has no previous revision to compare.");
35951
36900
  return 1;
35952
36901
  }
35953
- const link = await resolveLinkedProject(client, projectName);
35954
- if (typeof link === "number")
35955
- return link;
35956
- const { project, org } = link;
36902
+ const link2 = await resolveLinkedProject(client, projectName);
36903
+ if (typeof link2 === "number")
36904
+ return link2;
36905
+ const { project, org } = link2;
35957
36906
  const projectSlugLink = formatProject(org.slug, project.name);
35958
36907
  const diffStamp = stamp_default();
35959
36908
  output_manager_default.spinner(
@@ -35999,27 +36948,27 @@ async function diffVersions(client, argv, telemetryClient) {
35999
36948
  return 0;
36000
36949
  }
36001
36950
  async function resolveLinkedProject(client, projectName) {
36002
- const link = await getLinkedFlagsProject(client, projectName);
36003
- if (link.status === "error") {
36004
- return link.exitCode;
36005
- } else if (link.status === "not_linked") {
36951
+ const link2 = await getLinkedFlagsProject(client, projectName);
36952
+ if (link2.status === "error") {
36953
+ return link2.exitCode;
36954
+ } else if (link2.status === "not_linked") {
36006
36955
  output_manager_default.error(
36007
36956
  `Your codebase isn't linked to a project on Vercel. Pass --project <name>, or run ${getCommandName("link")} to link it.`
36008
36957
  );
36009
36958
  return 1;
36010
36959
  }
36011
- client.config.currentTeam = link.org.type === "team" ? link.org.id : void 0;
36012
- return link;
36960
+ client.config.currentTeam = link2.org.type === "team" ? link2.org.id : void 0;
36961
+ return link2;
36013
36962
  }
36014
36963
  async function getVersionPair(client, projectId, flagArg, revision) {
36015
- let cursor;
36964
+ let cursor2;
36016
36965
  let version;
36017
36966
  let previousVersion;
36018
36967
  const availableRevisions = /* @__PURE__ */ new Set();
36019
36968
  do {
36020
36969
  const result = await getFlagVersions(client, projectId, flagArg, {
36021
36970
  limit: MAX_FLAG_VERSIONS_PAGE_LIMIT,
36022
- cursor
36971
+ cursor: cursor2
36023
36972
  });
36024
36973
  for (const candidate of result.versions) {
36025
36974
  availableRevisions.add(candidate.revision);
@@ -36033,8 +36982,8 @@ async function getVersionPair(client, projectId, flagArg, revision) {
36033
36982
  if (version && previousVersion) {
36034
36983
  break;
36035
36984
  }
36036
- cursor = result.next ?? void 0;
36037
- } while (cursor);
36985
+ cursor2 = result.next ?? void 0;
36986
+ } while (cursor2);
36038
36987
  return {
36039
36988
  version,
36040
36989
  previousVersion,
@@ -36385,29 +37334,29 @@ async function evaluations(client, argv) {
36385
37334
  if (!jsonOutput && resolvedGranularity.adjusted && resolvedGranularity.notice) {
36386
37335
  output_manager_default.log(`Notice: ${resolvedGranularity.notice}`);
36387
37336
  }
36388
- let link;
37337
+ let link2;
36389
37338
  try {
36390
- link = await getLinkedFlagsProject(client, projectName, {
37339
+ link2 = await getLinkedFlagsProject(client, projectName, {
36391
37340
  projectNotFoundHandling: jsonOutput ? "return" : "report"
36392
37341
  });
36393
37342
  } catch (error) {
36394
37343
  return handleCommandError(client, error, jsonOutput);
36395
37344
  }
36396
- if (link.status === "error") {
37345
+ if (link2.status === "error") {
36397
37346
  return jsonOutput ? outputError(
36398
37347
  client,
36399
37348
  true,
36400
37349
  "PROJECT_RESOLUTION_FAILED",
36401
37350
  "Unable to resolve the requested Vercel project."
36402
- ) : link.exitCode;
37351
+ ) : link2.exitCode;
36403
37352
  }
36404
- if (link.status === "not_linked") {
37353
+ if (link2.status === "not_linked") {
36405
37354
  const code2 = projectName ? "PROJECT_NOT_FOUND" : "NOT_LINKED";
36406
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.`;
36407
37356
  return outputError(client, jsonOutput, code2, message);
36408
37357
  }
36409
- client.config.currentTeam = link.org.type === "team" ? link.org.id : void 0;
36410
- const { project, org } = link;
37358
+ client.config.currentTeam = link2.org.type === "team" ? link2.org.id : void 0;
37359
+ const { project, org } = link2;
36411
37360
  let flag;
36412
37361
  try {
36413
37362
  flag = await getFlag(client, project.id, flagArgument);
@@ -36715,18 +37664,18 @@ async function create4(client, argv) {
36715
37664
  );
36716
37665
  return 1;
36717
37666
  }
36718
- const link = await getLinkedFlagsProject(client, projectName);
36719
- if (link.status === "error") {
36720
- return link.exitCode;
36721
- } else if (link.status === "not_linked") {
37667
+ const link2 = await getLinkedFlagsProject(client, projectName);
37668
+ if (link2.status === "error") {
37669
+ return link2.exitCode;
37670
+ } else if (link2.status === "not_linked") {
36722
37671
  output_manager_default.error(
36723
37672
  `Your codebase isn't linked to a project on Vercel. Pass --project <name>, or run ${getCommandName("link")} to link it.`
36724
37673
  );
36725
37674
  return 1;
36726
37675
  }
36727
- client.config.currentTeam = link.org.type === "team" ? link.org.id : void 0;
36728
- const { project } = link;
36729
- const projectSlugLink = formatProject(link.org.slug, project.name);
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);
36730
37679
  let variants;
36731
37680
  try {
36732
37681
  variants = await getVariants(client, kind, variantInputs);
@@ -36763,7 +37712,7 @@ async function create4(client, argv) {
36763
37712
  printFlagDetails({
36764
37713
  flag,
36765
37714
  projectSlugLink,
36766
- orgSlug: link.org.slug,
37715
+ orgSlug: link2.org.slug,
36767
37716
  projectName: project.name,
36768
37717
  showTimestamps: false
36769
37718
  });
@@ -36909,17 +37858,17 @@ async function openFlag(client, argv) {
36909
37858
  }
36910
37859
  telemetryClient.trackCliArgumentFlag(flagArg);
36911
37860
  telemetryClient.trackCliOptionProject(projectName);
36912
- const link = await getLinkedFlagsProject(client, projectName);
36913
- if (link.status === "error") {
36914
- return link.exitCode;
36915
- } else if (link.status === "not_linked") {
37861
+ const link2 = await getLinkedFlagsProject(client, projectName);
37862
+ if (link2.status === "error") {
37863
+ return link2.exitCode;
37864
+ } else if (link2.status === "not_linked") {
36916
37865
  output_manager_default.error(
36917
37866
  `Your codebase isn't linked to a project on Vercel. Pass --project <name>, or run ${getCommandName("link")} to link it.`
36918
37867
  );
36919
37868
  return 1;
36920
37869
  }
36921
- client.config.currentTeam = link.org.type === "team" ? link.org.id : void 0;
36922
- const { project, org } = link;
37870
+ client.config.currentTeam = link2.org.type === "team" ? link2.org.id : void 0;
37871
+ const { project, org } = link2;
36923
37872
  try {
36924
37873
  let url = getFlagsDashboardUrl(org.slug, project.name);
36925
37874
  let label = "feature flags dashboard";
@@ -37224,17 +38173,17 @@ async function update2(client, argv) {
37224
38173
  );
37225
38174
  return 1;
37226
38175
  }
37227
- const link = await getLinkedFlagsProject(client, projectName);
37228
- if (link.status === "error") {
37229
- return link.exitCode;
37230
- } else if (link.status === "not_linked") {
38176
+ const link2 = await getLinkedFlagsProject(client, projectName);
38177
+ if (link2.status === "error") {
38178
+ return link2.exitCode;
38179
+ } else if (link2.status === "not_linked") {
37231
38180
  output_manager_default.error(
37232
38181
  `Your codebase isn't linked to a project on Vercel. Pass --project <name>, or run ${getCommandName("link")} to link it.`
37233
38182
  );
37234
38183
  return 1;
37235
38184
  }
37236
- client.config.currentTeam = link.org.type === "team" ? link.org.id : void 0;
37237
- const { project } = link;
38185
+ client.config.currentTeam = link2.org.type === "team" ? link2.org.id : void 0;
38186
+ const { project } = link2;
37238
38187
  try {
37239
38188
  if (hasVariantMutations) {
37240
38189
  return await updateFlagVariants(client, project.id, flagArg, {
@@ -37787,17 +38736,17 @@ async function set4(client, argv) {
37787
38736
  telemetryClient.trackCliOptionEnvironment(environment);
37788
38737
  telemetryClient.trackCliOptionVariant(variantSelector);
37789
38738
  telemetryClient.trackCliOptionMessage(message);
37790
- const link = await getLinkedFlagsProject(client, projectName);
37791
- if (link.status === "error") {
37792
- return link.exitCode;
37793
- } else if (link.status === "not_linked") {
38739
+ const link2 = await getLinkedFlagsProject(client, projectName);
38740
+ if (link2.status === "error") {
38741
+ return link2.exitCode;
38742
+ } else if (link2.status === "not_linked") {
37794
38743
  output_manager_default.error(
37795
38744
  `Your codebase isn't linked to a project on Vercel. Pass --project <name>, or run ${getCommandName("link")} to link it.`
37796
38745
  );
37797
38746
  return 1;
37798
38747
  }
37799
- client.config.currentTeam = link.org.type === "team" ? link.org.id : void 0;
37800
- const { project } = link;
38748
+ client.config.currentTeam = link2.org.type === "team" ? link2.org.id : void 0;
38749
+ const { project } = link2;
37801
38750
  try {
37802
38751
  output_manager_default.spinner("Fetching flag...");
37803
38752
  const flag = await getFlag(client, project.id, flagArg);
@@ -38196,17 +39145,17 @@ async function split(client, argv) {
38196
39145
  );
38197
39146
  telemetryClient.trackCliOptionDefaultVariant(defaultVariantSelector);
38198
39147
  telemetryClient.trackCliOptionMessage(message);
38199
- const link = await getLinkedFlagsProject(client, projectName);
38200
- if (link.status === "error") {
38201
- return link.exitCode;
38202
- } else if (link.status === "not_linked") {
39148
+ const link2 = await getLinkedFlagsProject(client, projectName);
39149
+ if (link2.status === "error") {
39150
+ return link2.exitCode;
39151
+ } else if (link2.status === "not_linked") {
38203
39152
  output_manager_default.error(
38204
39153
  `Your codebase isn't linked to a project on Vercel. Pass --project <name>, or run ${getCommandName("link")} to link it.`
38205
39154
  );
38206
39155
  return 1;
38207
39156
  }
38208
- client.config.currentTeam = link.org.type === "team" ? link.org.id : void 0;
38209
- const { project } = link;
39157
+ client.config.currentTeam = link2.org.type === "team" ? link2.org.id : void 0;
39158
+ const { project } = link2;
38210
39159
  try {
38211
39160
  output_manager_default.spinner("Fetching flag...");
38212
39161
  const [flag, settings] = await Promise.all([
@@ -38732,17 +39681,17 @@ async function rollout(client, argv) {
38732
39681
  );
38733
39682
  telemetryClient.trackCliOptionStart(start);
38734
39683
  telemetryClient.trackCliOptionMessage(message);
38735
- const link = await getLinkedFlagsProject(client, projectName);
38736
- if (link.status === "error") {
38737
- return link.exitCode;
38738
- } else if (link.status === "not_linked") {
39684
+ const link2 = await getLinkedFlagsProject(client, projectName);
39685
+ if (link2.status === "error") {
39686
+ return link2.exitCode;
39687
+ } else if (link2.status === "not_linked") {
38739
39688
  output_manager_default.error(
38740
39689
  `Your codebase isn't linked to a project on Vercel. Pass --project <name>, or run ${getCommandName("link")} to link it.`
38741
39690
  );
38742
39691
  return 1;
38743
39692
  }
38744
- client.config.currentTeam = link.org.type === "team" ? link.org.id : void 0;
38745
- const { project } = link;
39693
+ client.config.currentTeam = link2.org.type === "team" ? link2.org.id : void 0;
39694
+ const { project } = link2;
38746
39695
  try {
38747
39696
  output_manager_default.spinner("Fetching flag...");
38748
39697
  const [flag, settings] = await Promise.all([
@@ -38891,17 +39840,17 @@ async function rm7(client, argv) {
38891
39840
  telemetryClient.trackCliArgumentFlag(flagArg);
38892
39841
  telemetryClient.trackCliOptionProject(projectName);
38893
39842
  telemetryClient.trackCliFlagYes(skipConfirmation);
38894
- const link = await getLinkedFlagsProject(client, projectName);
38895
- if (link.status === "error") {
38896
- return link.exitCode;
38897
- } else if (link.status === "not_linked") {
39843
+ const link2 = await getLinkedFlagsProject(client, projectName);
39844
+ if (link2.status === "error") {
39845
+ return link2.exitCode;
39846
+ } else if (link2.status === "not_linked") {
38898
39847
  output_manager_default.error(
38899
39848
  `Your codebase isn't linked to a project on Vercel. Pass --project <name>, or run ${getCommandName("link")} to link it.`
38900
39849
  );
38901
39850
  return 1;
38902
39851
  }
38903
- client.config.currentTeam = link.org.type === "team" ? link.org.id : void 0;
38904
- const { project } = link;
39852
+ client.config.currentTeam = link2.org.type === "team" ? link2.org.id : void 0;
39853
+ const { project } = link2;
38905
39854
  try {
38906
39855
  output_manager_default.spinner("Fetching flag...");
38907
39856
  const flag = await getFlag(client, project.id, flagArg);
@@ -38987,17 +39936,17 @@ async function archive(client, argv) {
38987
39936
  telemetryClient.trackCliArgumentFlag(flagArg);
38988
39937
  telemetryClient.trackCliOptionProject(projectName);
38989
39938
  telemetryClient.trackCliFlagYes(skipConfirmation);
38990
- const link = await getLinkedFlagsProject(client, projectName);
38991
- if (link.status === "error") {
38992
- return link.exitCode;
38993
- } else if (link.status === "not_linked") {
39939
+ const link2 = await getLinkedFlagsProject(client, projectName);
39940
+ if (link2.status === "error") {
39941
+ return link2.exitCode;
39942
+ } else if (link2.status === "not_linked") {
38994
39943
  output_manager_default.error(
38995
39944
  `Your codebase isn't linked to a project on Vercel. Pass --project <name>, or run ${getCommandName("link")} to link it.`
38996
39945
  );
38997
39946
  return 1;
38998
39947
  }
38999
- client.config.currentTeam = link.org.type === "team" ? link.org.id : void 0;
39000
- const { project } = link;
39948
+ client.config.currentTeam = link2.org.type === "team" ? link2.org.id : void 0;
39949
+ const { project } = link2;
39001
39950
  try {
39002
39951
  output_manager_default.spinner("Fetching flag...");
39003
39952
  const flag = await getFlag(client, project.id, flagArg);
@@ -39088,17 +40037,17 @@ async function unarchive(client, argv) {
39088
40037
  telemetryClient.trackCliArgumentFlag(flagArg);
39089
40038
  telemetryClient.trackCliOptionProject(projectName);
39090
40039
  telemetryClient.trackCliFlagYes(skipConfirmation);
39091
- const link = await getLinkedFlagsProject(client, projectName);
39092
- if (link.status === "error") {
39093
- return link.exitCode;
39094
- } else if (link.status === "not_linked") {
40040
+ const link2 = await getLinkedFlagsProject(client, projectName);
40041
+ if (link2.status === "error") {
40042
+ return link2.exitCode;
40043
+ } else if (link2.status === "not_linked") {
39095
40044
  output_manager_default.error(
39096
40045
  `Your codebase isn't linked to a project on Vercel. Pass --project <name>, or run ${getCommandName("link")} to link it.`
39097
40046
  );
39098
40047
  return 1;
39099
40048
  }
39100
- client.config.currentTeam = link.org.type === "team" ? link.org.id : void 0;
39101
- const { project } = link;
40049
+ client.config.currentTeam = link2.org.type === "team" ? link2.org.id : void 0;
40050
+ const { project } = link2;
39102
40051
  try {
39103
40052
  output_manager_default.spinner("Fetching flag...");
39104
40053
  const flag = await getFlag(client, project.id, flagArg);
@@ -39282,10 +40231,10 @@ async function disable3(client, argv) {
39282
40231
  telemetryClient.trackCliOptionEnvironment(environment);
39283
40232
  telemetryClient.trackCliOptionVariant(variantId);
39284
40233
  telemetryClient.trackCliOptionMessage(message);
39285
- const link = await getLinkedFlagsProject(client, projectName);
39286
- if (link.status === "error") {
39287
- return link.exitCode;
39288
- } else if (link.status === "not_linked") {
40234
+ const link2 = await getLinkedFlagsProject(client, projectName);
40235
+ if (link2.status === "error") {
40236
+ return link2.exitCode;
40237
+ } else if (link2.status === "not_linked") {
39289
40238
  if (client.nonInteractive) {
39290
40239
  outputAgentError(
39291
40240
  client,
@@ -39309,8 +40258,8 @@ async function disable3(client, argv) {
39309
40258
  );
39310
40259
  return 1;
39311
40260
  }
39312
- client.config.currentTeam = link.org.type === "team" ? link.org.id : void 0;
39313
- const { project } = link;
40261
+ client.config.currentTeam = link2.org.type === "team" ? link2.org.id : void 0;
40262
+ const { project } = link2;
39314
40263
  try {
39315
40264
  output_manager_default.spinner("Fetching flag...");
39316
40265
  const flag = await getFlag(client, project.id, flagArg);
@@ -39326,7 +40275,7 @@ async function disable3(client, argv) {
39326
40275
  attemptedSubcommand: "disable",
39327
40276
  environment,
39328
40277
  isInteractive: Boolean(client.stdin.isTTY),
39329
- teamSlug: link.org.slug,
40278
+ teamSlug: link2.org.slug,
39330
40279
  projectName: project.name
39331
40280
  });
39332
40281
  return 0;
@@ -39495,17 +40444,17 @@ async function enable3(client, argv) {
39495
40444
  telemetryClient.trackCliOptionProject(projectName);
39496
40445
  telemetryClient.trackCliOptionEnvironment(environment);
39497
40446
  telemetryClient.trackCliOptionMessage(message);
39498
- const link = await getLinkedFlagsProject(client, projectName);
39499
- if (link.status === "error") {
39500
- return link.exitCode;
39501
- } else if (link.status === "not_linked") {
40447
+ const link2 = await getLinkedFlagsProject(client, projectName);
40448
+ if (link2.status === "error") {
40449
+ return link2.exitCode;
40450
+ } else if (link2.status === "not_linked") {
39502
40451
  output_manager_default.error(
39503
40452
  `Your codebase isn't linked to a project on Vercel. Pass --project <name>, or run ${getCommandName("link")} to link it.`
39504
40453
  );
39505
40454
  return 1;
39506
40455
  }
39507
- client.config.currentTeam = link.org.type === "team" ? link.org.id : void 0;
39508
- const { project } = link;
40456
+ client.config.currentTeam = link2.org.type === "team" ? link2.org.id : void 0;
40457
+ const { project } = link2;
39509
40458
  try {
39510
40459
  output_manager_default.spinner("Fetching flag...");
39511
40460
  const flag = await getFlag(client, project.id, flagArg);
@@ -39521,7 +40470,7 @@ async function enable3(client, argv) {
39521
40470
  attemptedSubcommand: "enable",
39522
40471
  environment,
39523
40472
  isInteractive: Boolean(client.stdin.isTTY),
39524
- teamSlug: link.org.slug,
40473
+ teamSlug: link2.org.slug,
39525
40474
  projectName: project.name
39526
40475
  });
39527
40476
  return 0;
@@ -39734,17 +40683,17 @@ async function sdkKeysLs(client, argv) {
39734
40683
  const projectName = getProjectNameFromFlags(flags);
39735
40684
  telemetryClient.trackCliOptionProject(projectName);
39736
40685
  telemetryClient.trackCliFlagJson(json);
39737
- const link = await getLinkedFlagsProject(client, projectName);
39738
- if (link.status === "error") {
39739
- return link.exitCode;
39740
- } else if (link.status === "not_linked") {
40686
+ const link2 = await getLinkedFlagsProject(client, projectName);
40687
+ if (link2.status === "error") {
40688
+ return link2.exitCode;
40689
+ } else if (link2.status === "not_linked") {
39741
40690
  output_manager_default.error(
39742
40691
  `Your codebase isn't linked to a project on Vercel. Pass --project <name>, or run ${getCommandName("link")} to link it.`
39743
40692
  );
39744
40693
  return 1;
39745
40694
  }
39746
- client.config.currentTeam = link.org.type === "team" ? link.org.id : void 0;
39747
- const { project, org } = link;
40695
+ client.config.currentTeam = link2.org.type === "team" ? link2.org.id : void 0;
40696
+ const { project, org } = link2;
39748
40697
  const projectSlugLink = formatProject(org.slug, project.name);
39749
40698
  try {
39750
40699
  output_manager_default.spinner("Fetching SDK keys...");
@@ -39856,10 +40805,10 @@ async function sdkKeysAdd(client, argv) {
39856
40805
  telemetryClient.trackCliOptionType(sdkKeyType);
39857
40806
  telemetryClient.trackCliOptionEnvironment(environment);
39858
40807
  telemetryClient.trackCliOptionLabel(label);
39859
- const link = await getLinkedFlagsProject(client, projectName);
39860
- if (link.status === "error") {
39861
- return link.exitCode;
39862
- } else if (link.status === "not_linked") {
40808
+ const link2 = await getLinkedFlagsProject(client, projectName);
40809
+ if (link2.status === "error") {
40810
+ return link2.exitCode;
40811
+ } else if (link2.status === "not_linked") {
39863
40812
  if (client.nonInteractive) {
39864
40813
  outputAgentError(
39865
40814
  client,
@@ -39883,8 +40832,8 @@ async function sdkKeysAdd(client, argv) {
39883
40832
  );
39884
40833
  return 1;
39885
40834
  }
39886
- client.config.currentTeam = link.org.type === "team" ? link.org.id : void 0;
39887
- const { project } = link;
40835
+ client.config.currentTeam = link2.org.type === "team" ? link2.org.id : void 0;
40836
+ const { project } = link2;
39888
40837
  if (!sdkKeyType) {
39889
40838
  if (client.nonInteractive) {
39890
40839
  const envPart = environment ? `--environment ${environment}` : "--environment <production|preview|development>";
@@ -40084,10 +41033,10 @@ async function sdkKeysRm(client, argv) {
40084
41033
  telemetryClient.trackCliArgumentKey(hashKey);
40085
41034
  telemetryClient.trackCliOptionProject(projectName);
40086
41035
  telemetryClient.trackCliFlagYes(skipConfirmation);
40087
- const link = await getLinkedFlagsProject(client, projectName);
40088
- if (link.status === "error") {
40089
- return link.exitCode;
40090
- } else if (link.status === "not_linked") {
41036
+ const link2 = await getLinkedFlagsProject(client, projectName);
41037
+ if (link2.status === "error") {
41038
+ return link2.exitCode;
41039
+ } else if (link2.status === "not_linked") {
40091
41040
  if (client.nonInteractive) {
40092
41041
  outputAgentError(
40093
41042
  client,
@@ -40111,8 +41060,8 @@ async function sdkKeysRm(client, argv) {
40111
41060
  );
40112
41061
  return 1;
40113
41062
  }
40114
- client.config.currentTeam = link.org.type === "team" ? link.org.id : void 0;
40115
- const { project } = link;
41063
+ client.config.currentTeam = link2.org.type === "team" ? link2.org.id : void 0;
41064
+ const { project } = link2;
40116
41065
  try {
40117
41066
  if (!hashKey) {
40118
41067
  if (client.nonInteractive) {
@@ -40555,17 +41504,17 @@ async function segmentsLs(client, argv) {
40555
41504
  const projectName = getProjectNameFromFlags(flags);
40556
41505
  telemetryClient.trackCliOptionProject(projectName);
40557
41506
  telemetryClient.trackCliFlagJson(json);
40558
- const link = await getLinkedFlagsProject(client, projectName);
40559
- if (link.status === "error") {
40560
- return link.exitCode;
40561
- } else if (link.status === "not_linked") {
41507
+ const link2 = await getLinkedFlagsProject(client, projectName);
41508
+ if (link2.status === "error") {
41509
+ return link2.exitCode;
41510
+ } else if (link2.status === "not_linked") {
40562
41511
  output_manager_default.error(
40563
41512
  `Your codebase isn't linked to a project on Vercel. Pass --project <name>, or run ${getCommandName("link")} to link it.`
40564
41513
  );
40565
41514
  return 1;
40566
41515
  }
40567
- client.config.currentTeam = link.org.type === "team" ? link.org.id : void 0;
40568
- const { project, org } = link;
41516
+ client.config.currentTeam = link2.org.type === "team" ? link2.org.id : void 0;
41517
+ const { project, org } = link2;
40569
41518
  const projectSlugLink = formatProject(org.slug, project.name);
40570
41519
  const lsStamp = stamp_default();
40571
41520
  output_manager_default.spinner(`Fetching feature flag segments for ${projectSlugLink}`);
@@ -40807,17 +41756,17 @@ async function segmentsInspect(client, argv) {
40807
41756
  telemetryClient.trackCliArgumentSegment(segmentArg);
40808
41757
  telemetryClient.trackCliOptionProject(projectName);
40809
41758
  telemetryClient.trackCliFlagJson(json);
40810
- const link = await getLinkedFlagsProject(client, projectName);
40811
- if (link.status === "error") {
40812
- return link.exitCode;
40813
- } else if (link.status === "not_linked") {
41759
+ const link2 = await getLinkedFlagsProject(client, projectName);
41760
+ if (link2.status === "error") {
41761
+ return link2.exitCode;
41762
+ } else if (link2.status === "not_linked") {
40814
41763
  output_manager_default.error(
40815
41764
  `Your codebase isn't linked to a project on Vercel. Pass --project <name>, or run ${getCommandName("link")} to link it.`
40816
41765
  );
40817
41766
  return 1;
40818
41767
  }
40819
- client.config.currentTeam = link.org.type === "team" ? link.org.id : void 0;
40820
- const { project, org } = link;
41768
+ client.config.currentTeam = link2.org.type === "team" ? link2.org.id : void 0;
41769
+ const { project, org } = link2;
40821
41770
  const projectSlugLink = formatProject(org.slug, project.name);
40822
41771
  try {
40823
41772
  output_manager_default.spinner("Fetching segment...");
@@ -41274,10 +42223,10 @@ async function segmentsCreate(client, argv) {
41274
42223
  );
41275
42224
  return 1;
41276
42225
  }
41277
- const link = await getLinkedFlagsProject(client, projectName);
41278
- if (link.status === "error") {
41279
- return link.exitCode;
41280
- } else if (link.status === "not_linked") {
42226
+ const link2 = await getLinkedFlagsProject(client, projectName);
42227
+ if (link2.status === "error") {
42228
+ return link2.exitCode;
42229
+ } else if (link2.status === "not_linked") {
41281
42230
  if (client.nonInteractive) {
41282
42231
  outputAgentError(
41283
42232
  client,
@@ -41301,8 +42250,8 @@ async function segmentsCreate(client, argv) {
41301
42250
  );
41302
42251
  return 1;
41303
42252
  }
41304
- client.config.currentTeam = link.org.type === "team" ? link.org.id : void 0;
41305
- const { project, org } = link;
42253
+ client.config.currentTeam = link2.org.type === "team" ? link2.org.id : void 0;
42254
+ const { project, org } = link2;
41306
42255
  const projectSlugLink = formatProject(org.slug, project.name);
41307
42256
  label = await resolveSegmentLabel(client, label, slug);
41308
42257
  hint = await resolveSegmentHint(client, hint, description, label);
@@ -41449,10 +42398,10 @@ async function segmentsUpdate(client, argv) {
41449
42398
  telemetryClient.trackCliOptionAdd(addInputs);
41450
42399
  telemetryClient.trackCliOptionRemove(removeInputs);
41451
42400
  telemetryClient.trackCliFlagJson(json);
41452
- const link = await getLinkedFlagsProject(client, projectName);
41453
- if (link.status === "error") {
41454
- return link.exitCode;
41455
- } else if (link.status === "not_linked") {
42401
+ const link2 = await getLinkedFlagsProject(client, projectName);
42402
+ if (link2.status === "error") {
42403
+ return link2.exitCode;
42404
+ } else if (link2.status === "not_linked") {
41456
42405
  if (client.nonInteractive) {
41457
42406
  outputAgentError(
41458
42407
  client,
@@ -41476,8 +42425,8 @@ async function segmentsUpdate(client, argv) {
41476
42425
  );
41477
42426
  return 1;
41478
42427
  }
41479
- client.config.currentTeam = link.org.type === "team" ? link.org.id : void 0;
41480
- const { project, org } = link;
42428
+ client.config.currentTeam = link2.org.type === "team" ? link2.org.id : void 0;
42429
+ const { project, org } = link2;
41481
42430
  const projectSlugLink = formatProject(org.slug, project.name);
41482
42431
  try {
41483
42432
  if (!segmentArg) {
@@ -41810,10 +42759,10 @@ async function segmentsRm(client, argv) {
41810
42759
  telemetryClient.trackCliArgumentSegment(segmentArg);
41811
42760
  telemetryClient.trackCliOptionProject(projectName);
41812
42761
  telemetryClient.trackCliFlagYes(skipConfirmation);
41813
- const link = await getLinkedFlagsProject(client, projectName);
41814
- if (link.status === "error") {
41815
- return link.exitCode;
41816
- } else if (link.status === "not_linked") {
42762
+ const link2 = await getLinkedFlagsProject(client, projectName);
42763
+ if (link2.status === "error") {
42764
+ return link2.exitCode;
42765
+ } else if (link2.status === "not_linked") {
41817
42766
  if (client.nonInteractive) {
41818
42767
  outputAgentError(
41819
42768
  client,
@@ -41837,8 +42786,8 @@ async function segmentsRm(client, argv) {
41837
42786
  );
41838
42787
  return 1;
41839
42788
  }
41840
- client.config.currentTeam = link.org.type === "team" ? link.org.id : void 0;
41841
- const { project } = link;
42789
+ client.config.currentTeam = link2.org.type === "team" ? link2.org.id : void 0;
42790
+ const { project } = link2;
41842
42791
  try {
41843
42792
  if (!segmentArg) {
41844
42793
  segmentArg = await resolveSegmentArg2(client, project.id);
@@ -42573,20 +43522,20 @@ function isRecord3(value) {
42573
43522
  // src/commands/flags/rules-common.ts
42574
43523
  var import_chalk154 = __toESM(require_source(), 1);
42575
43524
  async function resolveRulesCommandContext(client, options) {
42576
- const link = await resolveProjectContext({
43525
+ const link2 = await resolveProjectContext({
42577
43526
  client,
42578
43527
  projectNameOrId: options.projectName
42579
43528
  });
42580
- if (link.status === "error") {
42581
- return { exitCode: link.exitCode };
42582
- } else if (link.status === "not_linked") {
43529
+ if (link2.status === "error") {
43530
+ return { exitCode: link2.exitCode };
43531
+ } else if (link2.status === "not_linked") {
42583
43532
  output_manager_default.error(
42584
43533
  `Your codebase isn't linked to a project on Vercel. Run ${getCommandName("link")} to begin.`
42585
43534
  );
42586
43535
  return { exitCode: 1 };
42587
43536
  }
42588
- client.config.currentTeam = link.org.type === "team" ? link.org.id : void 0;
42589
- const { project } = link;
43537
+ client.config.currentTeam = link2.org.type === "team" ? link2.org.id : void 0;
43538
+ const { project } = link2;
42590
43539
  output_manager_default.spinner("Fetching flag...");
42591
43540
  const [flag, settings] = await Promise.all([
42592
43541
  getFlag(client, project.id, options.flagArg),
@@ -43623,7 +44572,7 @@ async function main17(client) {
43623
44572
 
43624
44573
  // src/commands/git/connect.ts
43625
44574
  var import_chalk160 = __toESM(require_source(), 1);
43626
- import { join as join10 } from "path";
44575
+ import { join as join16 } from "path";
43627
44576
 
43628
44577
  // src/util/telemetry/commands/git/connect.ts
43629
44578
  var GitConnectTelemetryClient = class extends TelemetryClient {
@@ -43694,7 +44643,7 @@ async function connect(client, argv) {
43694
44643
  const { project, org } = linkedProject;
43695
44644
  const gitProviderLink = project.link;
43696
44645
  client.config.currentTeam = org.type === "team" ? org.id : void 0;
43697
- const gitConfigPath = join10(cwd, ".git/config");
44646
+ const gitConfigPath = join16(cwd, ".git/config");
43698
44647
  const gitConfig = await parseGitConfig(gitConfigPath);
43699
44648
  if (repoArg) {
43700
44649
  const parsedUrlArg = parseRepoUrl(repoArg);
@@ -44257,7 +45206,7 @@ async function httpstat(client) {
44257
45206
  // src/commands/init/init.ts
44258
45207
  var import_tar_fs = __toESM(require_tar_fs(), 1);
44259
45208
  var import_chalk163 = __toESM(require_source(), 1);
44260
- import fs from "fs";
45209
+ import fs3 from "fs";
44261
45210
  import path2 from "path";
44262
45211
  var EXAMPLE_API = "https://examples.vercel.sh";
44263
45212
  async function init(client, opts, args, telemetry2) {
@@ -44359,15 +45308,15 @@ ${deployHint}`);
44359
45308
  }
44360
45309
  function prepareFolder(cwd, folder, force) {
44361
45310
  const dest = path2.join(cwd, folder);
44362
- if (fs.existsSync(dest)) {
44363
- if (!fs.lstatSync(dest).isDirectory()) {
45311
+ if (fs3.existsSync(dest)) {
45312
+ if (!fs3.lstatSync(dest).isDirectory()) {
44364
45313
  throw new Error(
44365
45314
  `Destination path "${import_chalk163.default.bold(
44366
45315
  folder
44367
45316
  )}" already exists and is not a directory.`
44368
45317
  );
44369
45318
  }
44370
- if (!force && fs.readdirSync(dest).length !== 0) {
45319
+ if (!force && fs3.readdirSync(dest).length !== 0) {
44371
45320
  throw new Error(
44372
45321
  `Destination path "${import_chalk163.default.bold(
44373
45322
  folder
@@ -44378,7 +45327,7 @@ function prepareFolder(cwd, folder, force) {
44378
45327
  }
44379
45328
  } else if (dest !== cwd) {
44380
45329
  try {
44381
- fs.mkdirSync(dest);
45330
+ fs3.mkdirSync(dest);
44382
45331
  } catch (_e) {
44383
45332
  throw new Error(`Could not create directory "${import_chalk163.default.bold(folder)}".`);
44384
45333
  }
@@ -45015,7 +45964,7 @@ async function printDetails({
45015
45964
  readyState,
45016
45965
  alias: aliases
45017
45966
  } = deployment;
45018
- const { print, link } = output_manager_default;
45967
+ const { print, link: link2 } = output_manager_default;
45019
45968
  const { builds } = deployment.version === 2 ? await client.fetch(`/v11/deployments/${id}/builds`) : { builds: [] };
45020
45969
  print("\n");
45021
45970
  print(import_chalk166.default.bold(" General\n\n"));
@@ -45027,7 +45976,7 @@ async function printDetails({
45027
45976
  const target = customEnvironmentSlug ?? deployment.target ?? "preview";
45028
45977
  print(` ${import_chalk166.default.cyan("target")} `);
45029
45978
  print(
45030
- deployment.customEnvironment && deployment.team?.slug ? `${link(
45979
+ deployment.customEnvironment && deployment.team?.slug ? `${link2(
45031
45980
  `${target}`,
45032
45981
  `https://vercel.com/${deployment.team.slug}/${name}/settings/environments/${deployment.customEnvironment.id}`,
45033
45982
  { fallback: () => target, color: false }
@@ -49700,28 +50649,28 @@ async function openIntegration(client, subArgs) {
49700
50649
  );
49701
50650
  return 1;
49702
50651
  }
49703
- const link2 = buildSSOLink(
50652
+ const link3 = buildSSOLink(
49704
50653
  team,
49705
50654
  configurationId,
49706
50655
  resource.externalResourceId
49707
50656
  );
49708
- outputLink(client, link2, asJson, resourceName, true);
50657
+ outputLink(client, link3, asJson, resourceName, true);
49709
50658
  return 0;
49710
50659
  }
49711
- const link = buildSSOLink(team, configurationId);
49712
- outputLink(client, link, asJson, integrationSlug, false);
50660
+ const link2 = buildSSOLink(team, configurationId);
50661
+ outputLink(client, link2, asJson, integrationSlug, false);
49713
50662
  return 0;
49714
50663
  }
49715
- function outputLink(client, link, json, name, isResource) {
50664
+ function outputLink(client, link2, json, name, isResource) {
49716
50665
  if (json) {
49717
- client.stdout.write(`${JSON.stringify({ url: link }, null, 2)}
50666
+ client.stdout.write(`${JSON.stringify({ url: link2 }, null, 2)}
49718
50667
  `);
49719
50668
  } else if (client.stdout.isTTY) {
49720
50669
  const label = isResource ? `Opening the ${import_chalk183.default.bold(name)} resource dashboard...` : `Opening the ${import_chalk183.default.bold(name)} dashboard...`;
49721
50670
  output_manager_default.print(label);
49722
- (0, import_open13.default)(link);
50671
+ (0, import_open13.default)(link2);
49723
50672
  } else {
49724
- client.stdout.write(`${link}
50673
+ client.stdout.write(`${link2}
49725
50674
  `);
49726
50675
  }
49727
50676
  }
@@ -50788,8 +51737,8 @@ function printGuide(client, product, guide2, snippets, resourceLinks) {
50788
51737
  function appendResourceLinks(links, lines) {
50789
51738
  lines.push("## Resources");
50790
51739
  lines.push("");
50791
- for (const link of links) {
50792
- lines.push(`- [${link.title}](${link.href})`);
51740
+ for (const link2 of links) {
51741
+ lines.push(`- [${link2.title}](${link2.href})`);
50793
51742
  }
50794
51743
  lines.push("");
50795
51744
  }
@@ -52097,11 +53046,11 @@ async function resolveLogsTarget(client, { contextName, deploymentOption, projec
52097
53046
  targetSource: "explicit-project"
52098
53047
  };
52099
53048
  }
52100
- const link = await getLinkedProject(client);
52101
- if (link.status === "error") {
52102
- return { exitCode: link.exitCode };
53049
+ const link2 = await getLinkedProject(client);
53050
+ if (link2.status === "error") {
53051
+ return { exitCode: link2.exitCode };
52103
53052
  }
52104
- if (link.status === "not_linked") {
53053
+ if (link2.status === "not_linked") {
52105
53054
  output_manager_default.error(
52106
53055
  `Your codebase isn't linked to a project on Vercel. Run ${getCommandName(
52107
53056
  "link"
@@ -52109,12 +53058,12 @@ async function resolveLogsTarget(client, { contextName, deploymentOption, projec
52109
53058
  );
52110
53059
  return { exitCode: 1 };
52111
53060
  }
52112
- client.config.currentTeam = link.org.type === "team" ? link.org.id : void 0;
53061
+ client.config.currentTeam = link2.org.type === "team" ? link2.org.id : void 0;
52113
53062
  return {
52114
- projectId: link.project.id,
52115
- projectSlug: link.project.name,
52116
- orgSlug: link.org.slug,
52117
- ownerId: link.org.id,
53063
+ projectId: link2.project.id,
53064
+ projectSlug: link2.project.name,
53065
+ orgSlug: link2.org.slug,
53066
+ ownerId: link2.org.id,
52118
53067
  targetSource: "linked-project"
52119
53068
  };
52120
53069
  }
@@ -52723,17 +53672,17 @@ async function mcp(client, opts = {}) {
52723
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`;
52724
53673
  let cursorAlreadyConfigured = false;
52725
53674
  try {
52726
- const fs2 = __require("fs");
52727
- if (fs2.existsSync(cursorMcpPath)) {
52728
- const configContent = fs2.readFileSync(cursorMcpPath, "utf8");
53675
+ const fs4 = __require("fs");
53676
+ if (fs4.existsSync(cursorMcpPath)) {
53677
+ const configContent = fs4.readFileSync(cursorMcpPath, "utf8");
52729
53678
  const config2 = JSON.parse(configContent);
52730
53679
  const mcpServers = config2.mcpServers || {};
52731
53680
  cursorAlreadyConfigured = Object.values(mcpServers).some(
52732
53681
  (server) => server.url === mcpUrl || server.url === MCP_ENDPOINT
52733
53682
  );
52734
53683
  }
52735
- if (!cursorAlreadyConfigured && fs2.existsSync(cursorConfigPath)) {
52736
- const configContent = fs2.readFileSync(cursorConfigPath, "utf8");
53684
+ if (!cursorAlreadyConfigured && fs4.existsSync(cursorConfigPath)) {
53685
+ const configContent = fs4.readFileSync(cursorConfigPath, "utf8");
52737
53686
  const config2 = JSON.parse(configContent);
52738
53687
  const mcpServers = config2["mcp.servers"] || {};
52739
53688
  cursorAlreadyConfigured = Object.values(mcpServers).some(
@@ -52814,17 +53763,17 @@ async function mcp(client, opts = {}) {
52814
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`;
52815
53764
  let vscodeAlreadyConfigured = false;
52816
53765
  try {
52817
- const fs2 = __require("fs");
52818
- if (fs2.existsSync(vscodeMcpPath)) {
52819
- const configContent = fs2.readFileSync(vscodeMcpPath, "utf8");
53766
+ const fs4 = __require("fs");
53767
+ if (fs4.existsSync(vscodeMcpPath)) {
53768
+ const configContent = fs4.readFileSync(vscodeMcpPath, "utf8");
52820
53769
  const config2 = JSON.parse(configContent);
52821
53770
  const mcpServers = config2.servers || {};
52822
53771
  vscodeAlreadyConfigured = Object.values(mcpServers).some(
52823
53772
  (server) => server.url === mcpUrl || server.url === MCP_ENDPOINT
52824
53773
  );
52825
53774
  }
52826
- if (!vscodeAlreadyConfigured && fs2.existsSync(vscodeConfigPath)) {
52827
- const configContent = fs2.readFileSync(vscodeConfigPath, "utf8");
53775
+ if (!vscodeAlreadyConfigured && fs4.existsSync(vscodeConfigPath)) {
53776
+ const configContent = fs4.readFileSync(vscodeConfigPath, "utf8");
52828
53777
  const config2 = JSON.parse(configContent);
52829
53778
  const mcpServers = config2["mcp.servers"] || {};
52830
53779
  vscodeAlreadyConfigured = Object.values(mcpServers).some(
@@ -53213,7 +54162,7 @@ async function metrics(client) {
53213
54162
  return 0;
53214
54163
  }
53215
54164
  telemetry2.trackCliSubcommandSchema(subcommandOriginal);
53216
- const schemaFn = (await import("./chunks/schema-JP4Z36AT.js")).default;
54165
+ const schemaFn = (await import("./chunks/schema-5CASPRP6.js")).default;
53217
54166
  return schemaFn(client, telemetry2);
53218
54167
  }
53219
54168
  default: {
@@ -53226,7 +54175,7 @@ async function metrics(client) {
53226
54175
  output_manager_default.print(help(metricsCommand, { columns: client.stderr.columns }));
53227
54176
  return 2;
53228
54177
  }
53229
- const queryFn = (await import("./chunks/query-DFRPIOZM.js")).default;
54178
+ const queryFn = (await import("./chunks/query-LL2GMJWQ.js")).default;
53230
54179
  return queryFn(client, telemetry2);
53231
54180
  }
53232
54181
  }
@@ -53234,7 +54183,7 @@ async function metrics(client) {
53234
54183
 
53235
54184
  // src/commands/microfrontends/pull.ts
53236
54185
  var import_chalk192 = __toESM(require_source(), 1);
53237
- import { join as join11 } from "path";
54186
+ import { join as join17 } from "path";
53238
54187
  var import_fs_extra = __toESM(require_lib(), 1);
53239
54188
  var VERCEL_DIR = ".vercel";
53240
54189
  var VERCEL_DIR_MICROFRONTENDS = "microfrontends.json";
@@ -53248,16 +54197,16 @@ async function pull2(client) {
53248
54197
  return 1;
53249
54198
  }
53250
54199
  const autoConfirm = !!parsedArgs.flags["--yes"];
53251
- const link = await ensureLink("microfrontends", client, client.cwd, {
54200
+ const link2 = await ensureLink("microfrontends", client, client.cwd, {
53252
54201
  autoConfirm
53253
54202
  });
53254
- if (typeof link === "number") {
53255
- return link;
54203
+ if (typeof link2 === "number") {
54204
+ return link2;
53256
54205
  }
53257
- const { project, org, repoRoot } = link;
54206
+ const { project, org, repoRoot } = link2;
53258
54207
  let currentDirectory;
53259
54208
  if (repoRoot) {
53260
- currentDirectory = join11(repoRoot, project.rootDirectory || "");
54209
+ currentDirectory = join17(repoRoot, project.rootDirectory || "");
53261
54210
  } else {
53262
54211
  currentDirectory = client.cwd;
53263
54212
  }
@@ -53295,7 +54244,7 @@ async function pull2(client) {
53295
54244
  )
53296
54245
  };
53297
54246
  output_manager_default.stopSpinner();
53298
- const path3 = join11(currentDirectory, VERCEL_DIR, VERCEL_DIR_MICROFRONTENDS);
54247
+ const path3 = join17(currentDirectory, VERCEL_DIR, VERCEL_DIR_MICROFRONTENDS);
53299
54248
  await (0, import_fs_extra.outputJSON)(path3, sanitizedConfig, {
53300
54249
  spaces: 2
53301
54250
  });
@@ -53304,7 +54253,7 @@ async function pull2(client) {
53304
54253
  `${prependEmoji(
53305
54254
  `Downloaded microfrontends configuration to ${import_chalk192.default.bold(
53306
54255
  humanizePath(
53307
- join11(currentDirectory, VERCEL_DIR, VERCEL_DIR_MICROFRONTENDS)
54256
+ join17(currentDirectory, VERCEL_DIR, VERCEL_DIR_MICROFRONTENDS)
53308
54257
  )
53309
54258
  )} ${import_chalk192.default.gray(microfrontendsStamp())}`,
53310
54259
  emoji("success")
@@ -53321,19 +54270,19 @@ async function pull2(client) {
53321
54270
 
53322
54271
  // src/commands/microfrontends/create-group.ts
53323
54272
  var import_chalk193 = __toESM(require_source(), 1);
53324
- import { writeFile as writeFile6 } from "fs/promises";
53325
- import { existsSync as existsSync4 } from "fs";
53326
- import { join as join12 } from "path";
54273
+ import { writeFile as writeFile8 } from "fs/promises";
54274
+ import { existsSync as existsSync3 } from "fs";
54275
+ import { join as join18 } from "path";
53327
54276
 
53328
54277
  // src/commands/microfrontends/utils.ts
53329
54278
  async function ensureMicrofrontendsContext(client, options) {
53330
- const link = await ensureLink("microfrontends", client, client.cwd, {
54279
+ const link2 = await ensureLink("microfrontends", client, client.cwd, {
53331
54280
  autoConfirm: options?.autoConfirm
53332
54281
  });
53333
- if (typeof link === "number") {
53334
- return link;
54282
+ if (typeof link2 === "number") {
54283
+ return link2;
53335
54284
  }
53336
- const { project, org, repoRoot } = link;
54285
+ const { project, org, repoRoot } = link2;
53337
54286
  if (org.type !== "team") {
53338
54287
  output_manager_default.error("Microfrontends are only available for teams.");
53339
54288
  return 1;
@@ -53743,13 +54692,13 @@ async function createGroup(client) {
53743
54692
  output_manager_default.log(
53744
54693
  `View microfrontends group: ${output_manager_default.link(settingsUrl, settingsUrl, { fallback: false })}`
53745
54694
  );
53746
- const link = await getLinkedProject(client, { cwd: client.cwd });
53747
- const linkedProject = link.status === "linked" ? link.project : void 0;
54695
+ const link2 = await getLinkedProject(client, { cwd: client.cwd });
54696
+ const linkedProject = link2.status === "linked" ? link2.project : void 0;
53748
54697
  if (linkedProject && linkedProject.id === defaultApp.id) {
53749
- const repoRoot = link.status === "linked" ? link.repoRoot : void 0;
53750
- const projectDir = repoRoot ? join12(repoRoot, linkedProject.rootDirectory || "") : client.cwd;
53751
- const configPath = join12(projectDir, "microfrontends.json");
53752
- if (!existsSync4(configPath)) {
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)) {
53753
54702
  output_manager_default.log("");
53754
54703
  output_manager_default.log(
53755
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.`
@@ -53785,7 +54734,7 @@ async function createGroup(client) {
53785
54734
  routingPaths,
53786
54735
  productionAlias
53787
54736
  );
53788
- await writeFile6(configPath, config + "\n", "utf-8");
54737
+ await writeFile8(configPath, config + "\n", "utf-8");
53789
54738
  output_manager_default.success(`Created ${import_chalk193.default.bold("microfrontends.json")}`);
53790
54739
  output_manager_default.log(
53791
54740
  "Create a preview deployment to test microfrontends before deploying to production."
@@ -54293,8 +55242,8 @@ async function deleteGroup(client) {
54293
55242
  }
54294
55243
  selectedGroup = found;
54295
55244
  } else {
54296
- const link = await getLinkedProject(client, { cwd: client.cwd });
54297
- const linkedProject = link.status === "linked" ? link.project : void 0;
55245
+ const link2 = await getLinkedProject(client, { cwd: client.cwd });
55246
+ const linkedProject = link2.status === "linked" ? link2.project : void 0;
54298
55247
  const linkedGroup = linkedProject ? groups.find(
54299
55248
  (g) => g.projects.some(
54300
55249
  (p) => p.id === linkedProject.id && p.microfrontends?.isDefaultApp
@@ -54396,8 +55345,8 @@ async function deleteGroup(client) {
54396
55345
  }
54397
55346
 
54398
55347
  // src/commands/microfrontends/inspect-group.ts
54399
- import { existsSync as existsSync5 } from "fs";
54400
- import { join as join13 } from "path";
55348
+ import { existsSync as existsSync4 } from "fs";
55349
+ import { join as join19 } from "path";
54401
55350
  var import_chalk197 = __toESM(require_source(), 1);
54402
55351
  async function inspectGroup(client) {
54403
55352
  let parsedArgs;
@@ -54626,8 +55575,8 @@ async function enrichGroupProject(client, teamId, group, groupProject, localRepo
54626
55575
  }
54627
55576
  async function getLocalRepoContext(client) {
54628
55577
  try {
54629
- const link = await getLinkedProject(client, { cwd: client.cwd });
54630
- if (link.status !== "linked") {
55578
+ const link2 = await getLinkedProject(client, { cwd: client.cwd });
55579
+ if (link2.status !== "linked") {
54631
55580
  return {
54632
55581
  repoRoot: null,
54633
55582
  linkedProjectId: null,
@@ -54636,10 +55585,10 @@ async function getLocalRepoContext(client) {
54636
55585
  };
54637
55586
  }
54638
55587
  return {
54639
- repoRoot: link.repoRoot ?? null,
54640
- linkedProjectId: link.project.id,
54641
- linkedRepoOrg: link.project.link?.org ?? null,
54642
- linkedRepoName: link.project.link?.repo ?? null
55588
+ repoRoot: link2.repoRoot ?? null,
55589
+ linkedProjectId: link2.project.id,
55590
+ linkedRepoOrg: link2.project.link?.org ?? null,
55591
+ linkedRepoName: link2.project.link?.repo ?? null
54643
55592
  };
54644
55593
  } catch {
54645
55594
  return {
@@ -54663,8 +55612,8 @@ async function resolvePackageNameFromLocalRepo(localRepoContext, gitOrg, gitRepo
54663
55612
  if (!isProjectInLocalRepo(localRepoContext, gitOrg, gitRepo)) {
54664
55613
  return null;
54665
55614
  }
54666
- const projectDir = join13(localRepoContext.repoRoot, rootDirectory || "");
54667
- const packageJsonPath = join13(projectDir, "package.json");
55615
+ const projectDir = join19(localRepoContext.repoRoot, rootDirectory || "");
55616
+ const packageJsonPath = join19(projectDir, "package.json");
54668
55617
  const pkg = await readJSONFile(packageJsonPath);
54669
55618
  if (!pkg || pkg instanceof Error) {
54670
55619
  return null;
@@ -54683,23 +55632,23 @@ function resolveLocalConfigFilePath(projects2, localRepoContext, configuredConfi
54683
55632
  )) {
54684
55633
  return null;
54685
55634
  }
54686
- const projectDir = join13(
55635
+ const projectDir = join19(
54687
55636
  localRepoContext.repoRoot,
54688
55637
  defaultProject.git.rootDirectory || ""
54689
55638
  );
54690
55639
  const configuredName = configuredConfigFileName ?? null;
54691
55640
  if (configuredName) {
54692
- const configuredPath = join13(projectDir, configuredName);
54693
- if (existsSync5(configuredPath)) {
55641
+ const configuredPath = join19(projectDir, configuredName);
55642
+ if (existsSync4(configuredPath)) {
54694
55643
  return configuredPath;
54695
55644
  }
54696
55645
  }
54697
- const jsonPath = join13(projectDir, "microfrontends.json");
54698
- const jsoncPath = join13(projectDir, "microfrontends.jsonc");
54699
- if (existsSync5(jsonPath)) {
55646
+ const jsonPath = join19(projectDir, "microfrontends.json");
55647
+ const jsoncPath = join19(projectDir, "microfrontends.jsonc");
55648
+ if (existsSync4(jsonPath)) {
54700
55649
  return jsonPath;
54701
55650
  }
54702
- if (existsSync5(jsoncPath)) {
55651
+ if (existsSync4(jsoncPath)) {
54703
55652
  return jsoncPath;
54704
55653
  }
54705
55654
  return null;
@@ -54894,20 +55843,20 @@ async function openCommandHandler(client) {
54894
55843
  return 0;
54895
55844
  }
54896
55845
  const autoConfirm = !!parsedArgs.flags["--yes"];
54897
- const link = await ensureLink("open", client, client.cwd, {
55846
+ const link2 = await ensureLink("open", client, client.cwd, {
54898
55847
  autoConfirm
54899
55848
  });
54900
- if (typeof link === "number") {
54901
- return link;
55849
+ if (typeof link2 === "number") {
55850
+ return link2;
54902
55851
  }
54903
- if (link.status !== "linked" || !link.org || !link.project) {
55852
+ if (link2.status !== "linked" || !link2.org || !link2.project) {
54904
55853
  if (!client.nonInteractive) {
54905
55854
  output_manager_default.error("This command requires a linked project. Please run:");
54906
55855
  output_manager_default.print(" vercel link\n");
54907
55856
  }
54908
55857
  return 1;
54909
55858
  }
54910
- const { org, project } = link;
55859
+ const { org, project } = link2;
54911
55860
  const projectUrl = `https://vercel.com/${org.slug}/${project.name}`;
54912
55861
  output_manager_default.log(`Opening ${projectUrl} in your browser...`);
54913
55862
  await (0, import_open15.default)(projectUrl);
@@ -58529,14 +59478,14 @@ async function list17(client, argv) {
58529
59478
  const parsed = await parseSubcommandArgs3(argv, listSubcommand16);
58530
59479
  if (typeof parsed === "number")
58531
59480
  return parsed;
58532
- const link = await requireProjectContext(
59481
+ const link2 = await requireProjectContext(
58533
59482
  client,
58534
59483
  "redirects",
58535
59484
  parsed.flags["--project"]
58536
59485
  );
58537
- if (typeof link === "number")
58538
- return link;
58539
- const { project, org } = link;
59486
+ if (typeof link2 === "number")
59487
+ return link2;
59488
+ const { project, org } = link2;
58540
59489
  const { flags } = parsed;
58541
59490
  const teamId = org.type === "team" ? org.id : void 0;
58542
59491
  const search2 = flags["--search"];
@@ -58700,14 +59649,14 @@ async function listVersions2(client, argv) {
58700
59649
  const parsed = await parseSubcommandArgs3(argv, listVersionsSubcommand);
58701
59650
  if (typeof parsed === "number")
58702
59651
  return parsed;
58703
- const link = await requireProjectContext(
59652
+ const link2 = await requireProjectContext(
58704
59653
  client,
58705
59654
  "redirects",
58706
59655
  parsed.flags["--project"]
58707
59656
  );
58708
- if (typeof link === "number")
58709
- return link;
58710
- const { project, org } = link;
59657
+ if (typeof link2 === "number")
59658
+ return link2;
59659
+ const { project, org } = link2;
58711
59660
  const teamId = org.type === "team" ? org.id : void 0;
58712
59661
  const lsStamp = stamp_default();
58713
59662
  output_manager_default.spinner(`Fetching redirect versions for ${import_chalk216.default.bold(project.name)}`);
@@ -58817,14 +59766,14 @@ async function add10(client, argv) {
58817
59766
  const parsed = await parseSubcommandArgs3(argv, addSubcommand8);
58818
59767
  if (typeof parsed === "number")
58819
59768
  return parsed;
58820
- const link = await requireProjectContext(
59769
+ const link2 = await requireProjectContext(
58821
59770
  client,
58822
59771
  "redirects",
58823
59772
  parsed.flags["--project"]
58824
59773
  );
58825
- if (typeof link === "number")
58826
- return link;
58827
- const { project, org } = link;
59774
+ if (typeof link2 === "number")
59775
+ return link2;
59776
+ const { project, org } = link2;
58828
59777
  const teamId = org.type === "team" ? org.id : void 0;
58829
59778
  const { versions: versions2 } = await getRedirectVersions(client, project.id, teamId);
58830
59779
  const existingStagingVersion = versions2.find((v) => v.isStaging);
@@ -59115,7 +60064,7 @@ async function add10(client, argv) {
59115
60064
  // src/commands/redirects/upload.ts
59116
60065
  var import_chalk218 = __toESM(require_source(), 1);
59117
60066
  import { readFileSync as readFileSync4 } from "fs";
59118
- import { basename as basename2 } from "path";
60067
+ import { basename as basename3 } from "path";
59119
60068
 
59120
60069
  // src/commands/redirects/validate-redirects.ts
59121
60070
  import { statSync as statSync2 } from "fs";
@@ -59248,14 +60197,14 @@ async function upload(client, argv) {
59248
60197
  const parsed = await parseSubcommandArgs3(argv, uploadSubcommand);
59249
60198
  if (typeof parsed === "number")
59250
60199
  return parsed;
59251
- const link = await requireProjectContext(
60200
+ const link2 = await requireProjectContext(
59252
60201
  client,
59253
60202
  "redirects",
59254
60203
  parsed.flags["--project"]
59255
60204
  );
59256
- if (typeof link === "number")
59257
- return link;
59258
- const { project, org } = link;
60205
+ if (typeof link2 === "number")
60206
+ return link2;
60207
+ const { project, org } = link2;
59259
60208
  const teamId = org.type === "team" ? org.id : void 0;
59260
60209
  const { args, flags } = parsed;
59261
60210
  const skipPrompts = flags["--yes"] || false;
@@ -59313,7 +60262,7 @@ async function upload(client, argv) {
59313
60262
  const { versions: versions2 } = await getRedirectVersions(client, project.id, teamId);
59314
60263
  const existingStagingVersion = versions2.find((v) => v.isStaging);
59315
60264
  if (!skipPrompts) {
59316
- const fileName = basename2(filePath);
60265
+ const fileName = basename3(filePath);
59317
60266
  const fileType = filePath.endsWith(".csv") ? "CSV" : "JSON";
59318
60267
  const message = overwrite ? `Upload ${fileType} file "${fileName}" and replace all existing redirects?` : `Upload ${fileType} file "${fileName}"?`;
59319
60268
  const confirmed = await client.input.confirm(message, true);
@@ -59352,7 +60301,7 @@ async function upload(client, argv) {
59352
60301
  const url = "/v1/bulk-redirects";
59353
60302
  if (filePath.endsWith(".csv")) {
59354
60303
  const csvContent = readFileSync4(filePath);
59355
- const fileName = basename2(filePath);
60304
+ const fileName = basename3(filePath);
59356
60305
  const csvValidation = validateCSVStructure(csvContent.toString());
59357
60306
  if (!csvValidation.valid) {
59358
60307
  output_manager_default.error(`Invalid CSV: ${csvValidation.error}`);
@@ -59629,14 +60578,14 @@ async function remove10(client, argv) {
59629
60578
  output_manager_default.error(error);
59630
60579
  return 1;
59631
60580
  }
59632
- const link = await requireProjectContext(
60581
+ const link2 = await requireProjectContext(
59633
60582
  client,
59634
60583
  "redirects",
59635
60584
  parsed.flags["--project"]
59636
60585
  );
59637
- if (typeof link === "number")
59638
- return link;
59639
- const { project, org } = link;
60586
+ if (typeof link2 === "number")
60587
+ return link2;
60588
+ const { project, org } = link2;
59640
60589
  const teamId = org.type === "team" ? org.id : void 0;
59641
60590
  const { versions: versions2 } = await getRedirectVersions(client, project.id, teamId);
59642
60591
  const existingStagingVersion = versions2.find((v) => v.isStaging);
@@ -59836,14 +60785,14 @@ async function promote(client, argv) {
59836
60785
  output_manager_default.error(error);
59837
60786
  return 1;
59838
60787
  }
59839
- const link = await requireProjectContext(
60788
+ const link2 = await requireProjectContext(
59840
60789
  client,
59841
60790
  "redirects",
59842
60791
  parsed.flags["--project"]
59843
60792
  );
59844
- if (typeof link === "number")
59845
- return link;
59846
- const { project, org } = link;
60793
+ if (typeof link2 === "number")
60794
+ return link2;
60795
+ const { project, org } = link2;
59847
60796
  const teamId = org.type === "team" ? org.id : void 0;
59848
60797
  const [versionIdentifier] = parsed.args;
59849
60798
  output_manager_default.spinner(`Fetching redirect versions for ${import_chalk220.default.bold(project.name)}`);
@@ -60065,14 +61014,14 @@ async function restore(client, argv) {
60065
61014
  output_manager_default.error(error);
60066
61015
  return 1;
60067
61016
  }
60068
- const link = await requireProjectContext(
61017
+ const link2 = await requireProjectContext(
60069
61018
  client,
60070
61019
  "redirects",
60071
61020
  parsed.flags["--project"]
60072
61021
  );
60073
- if (typeof link === "number")
60074
- return link;
60075
- const { project, org } = link;
61022
+ if (typeof link2 === "number")
61023
+ return link2;
61024
+ const { project, org } = link2;
60076
61025
  const teamId = org.type === "team" ? org.id : void 0;
60077
61026
  const [versionIdentifier] = parsed.args;
60078
61027
  output_manager_default.spinner(`Fetching redirect versions for ${import_chalk221.default.bold(project.name)}`);
@@ -61649,14 +62598,14 @@ async function rollingRelease(client) {
61649
62598
  projectName = subcommandFlags.flags["--project"];
61650
62599
  telemetry2.trackCliOptionProject(projectName);
61651
62600
  }
61652
- const link = await resolveProjectContext({
62601
+ const link2 = await resolveProjectContext({
61653
62602
  client,
61654
62603
  projectNameOrId: projectName
61655
62604
  });
61656
- if (link.status === "error") {
61657
- return link.exitCode;
62605
+ if (link2.status === "error") {
62606
+ return link2.exitCode;
61658
62607
  }
61659
- if (link.status === "not_linked") {
62608
+ if (link2.status === "not_linked") {
61660
62609
  if (client.nonInteractive) {
61661
62610
  outputAgentError(
61662
62611
  client,
@@ -61674,7 +62623,7 @@ async function rollingRelease(client) {
61674
62623
  );
61675
62624
  return 1;
61676
62625
  }
61677
- const { project, org } = link;
62626
+ const { project, org } = link2;
61678
62627
  client.config.currentTeam = org.type === "team" ? org.id : void 0;
61679
62628
  if (!subcommandName || !subcommandFlags) {
61680
62629
  output_manager_default.debug(`Invalid subcommand: ${subcommand}`);
@@ -61891,14 +62840,14 @@ async function list18(client, argv) {
61891
62840
  const parsed = await parseSubcommandArgs(argv, listSubcommand17, client);
61892
62841
  if (typeof parsed === "number")
61893
62842
  return parsed;
61894
- const link = await requireProjectContext(
62843
+ const link2 = await requireProjectContext(
61895
62844
  client,
61896
62845
  "routes",
61897
62846
  parsed.flags["--project"]
61898
62847
  );
61899
- if (typeof link === "number")
61900
- return link;
61901
- const { project, org } = link;
62848
+ if (typeof link2 === "number")
62849
+ return link2;
62850
+ const { project, org } = link2;
61902
62851
  const { flags } = parsed;
61903
62852
  const teamId = org.type === "team" ? org.id : void 0;
61904
62853
  const search2 = flags["--search"];
@@ -62240,14 +63189,14 @@ async function listVersions3(client, argv) {
62240
63189
  );
62241
63190
  if (typeof parsed === "number")
62242
63191
  return parsed;
62243
- const link = await requireProjectContext(
63192
+ const link2 = await requireProjectContext(
62244
63193
  client,
62245
63194
  "routes",
62246
63195
  parsed.flags["--project"]
62247
63196
  );
62248
- if (typeof link === "number")
62249
- return link;
62250
- const { project, org } = link;
63197
+ if (typeof link2 === "number")
63198
+ return link2;
63199
+ const { project, org } = link2;
62251
63200
  const { flags } = parsed;
62252
63201
  const teamId = org.type === "team" ? org.id : void 0;
62253
63202
  const count2 = flags["--count"];
@@ -62326,14 +63275,14 @@ async function inspect9(client, argv) {
62326
63275
  const parsed = await parseSubcommandArgs(argv, inspectSubcommand9, client);
62327
63276
  if (typeof parsed === "number")
62328
63277
  return parsed;
62329
- const link = await requireProjectContext(
63278
+ const link2 = await requireProjectContext(
62330
63279
  client,
62331
63280
  "routes",
62332
63281
  parsed.flags["--project"]
62333
63282
  );
62334
- if (typeof link === "number")
62335
- return link;
62336
- const { project, org } = link;
63283
+ if (typeof link2 === "number")
63284
+ return link2;
63285
+ const { project, org } = link2;
62337
63286
  const { flags, args } = parsed;
62338
63287
  const teamId = org.type === "team" ? org.id : void 0;
62339
63288
  const showDiff = flags["--diff"];
@@ -62869,14 +63818,14 @@ async function add11(client, argv) {
62869
63818
  const parsed = await parseSubcommandArgs(argv, addSubcommand9, client);
62870
63819
  if (typeof parsed === "number")
62871
63820
  return parsed;
62872
- const link = await requireProjectContext(
63821
+ const link2 = await requireProjectContext(
62873
63822
  client,
62874
63823
  "routes",
62875
63824
  parsed.flags["--project"]
62876
63825
  );
62877
- if (typeof link === "number")
62878
- return link;
62879
- const { project, org } = link;
63826
+ if (typeof link2 === "number")
63827
+ return link2;
63828
+ const { project, org } = link2;
62880
63829
  const teamId = org.type === "team" ? org.id : void 0;
62881
63830
  const { args, flags } = parsed;
62882
63831
  const isAgentMode = client.nonInteractive;
@@ -63927,7 +64876,7 @@ async function main26(client) {
63927
64876
  return 2;
63928
64877
  }
63929
64878
  telemetry2.trackCliSubcommandEdit(subcommandOriginal);
63930
- return (await import("./chunks/edit-55TQT6RK.js")).default(client, args);
64879
+ return (await import("./chunks/edit-NW4YBUR6.js")).default(client, args);
63931
64880
  case "delete":
63932
64881
  if (needHelp) {
63933
64882
  telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
@@ -63935,7 +64884,7 @@ async function main26(client) {
63935
64884
  return 2;
63936
64885
  }
63937
64886
  telemetry2.trackCliSubcommandDelete(subcommandOriginal);
63938
- return (await import("./chunks/delete-EQ5NJWPR.js")).default(client, args);
64887
+ return (await import("./chunks/delete-7NADCRED.js")).default(client, args);
63939
64888
  case "enable":
63940
64889
  if (needHelp) {
63941
64890
  telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
@@ -63943,7 +64892,7 @@ async function main26(client) {
63943
64892
  return 2;
63944
64893
  }
63945
64894
  telemetry2.trackCliSubcommandEnable(subcommandOriginal);
63946
- return (await import("./chunks/enable-UOEAVAUU.js")).default(client, args);
64895
+ return (await import("./chunks/enable-QEL5CXVD.js")).default(client, args);
63947
64896
  case "disable":
63948
64897
  if (needHelp) {
63949
64898
  telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
@@ -63951,7 +64900,7 @@ async function main26(client) {
63951
64900
  return 2;
63952
64901
  }
63953
64902
  telemetry2.trackCliSubcommandDisable(subcommandOriginal);
63954
- return (await import("./chunks/disable-KO6WDHRC.js")).default(client, args);
64903
+ return (await import("./chunks/disable-SB224IIS.js")).default(client, args);
63955
64904
  case "reorder":
63956
64905
  if (needHelp) {
63957
64906
  telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
@@ -63959,7 +64908,7 @@ async function main26(client) {
63959
64908
  return 2;
63960
64909
  }
63961
64910
  telemetry2.trackCliSubcommandReorder(subcommandOriginal);
63962
- return (await import("./chunks/reorder-GA5FVDKD.js")).default(client, args);
64911
+ return (await import("./chunks/reorder-GNCRV6CV.js")).default(client, args);
63963
64912
  case "export":
63964
64913
  if (needHelp) {
63965
64914
  telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
@@ -63967,7 +64916,7 @@ async function main26(client) {
63967
64916
  return 2;
63968
64917
  }
63969
64918
  telemetry2.trackCliSubcommandExport(subcommandOriginal);
63970
- return (await import("./chunks/export-X2XFUNPV.js")).default(client, args);
64919
+ return (await import("./chunks/export-XDOZTLG3.js")).default(client, args);
63971
64920
  case "publish":
63972
64921
  if (needHelp) {
63973
64922
  telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
@@ -63975,7 +64924,7 @@ async function main26(client) {
63975
64924
  return 2;
63976
64925
  }
63977
64926
  telemetry2.trackCliSubcommandPublish(subcommandOriginal);
63978
- return (await import("./chunks/publish-7BIMCBQ6.js")).default(client, args);
64927
+ return (await import("./chunks/publish-D2QWFUP4.js")).default(client, args);
63979
64928
  case "restore":
63980
64929
  if (needHelp) {
63981
64930
  telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
@@ -63983,7 +64932,7 @@ async function main26(client) {
63983
64932
  return 2;
63984
64933
  }
63985
64934
  telemetry2.trackCliSubcommandRestore(subcommandOriginal);
63986
- return (await import("./chunks/restore-WGSD5LXC.js")).default(client, args);
64935
+ return (await import("./chunks/restore-SXI5SHGJ.js")).default(client, args);
63987
64936
  case "discard-staging":
63988
64937
  if (needHelp) {
63989
64938
  telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
@@ -63991,7 +64940,7 @@ async function main26(client) {
63991
64940
  return 2;
63992
64941
  }
63993
64942
  telemetry2.trackCliSubcommandDiscardStaging(subcommandOriginal);
63994
- return (await import("./chunks/discard-E7PLPNUL.js")).default(client, args);
64943
+ return (await import("./chunks/discard-MME6PI7B.js")).default(client, args);
63995
64944
  default:
63996
64945
  output_manager_default.error(getInvalidSubcommand(COMMAND_CONFIG45));
63997
64946
  output_manager_default.print(help(routesCommand, { columns: client.stderr.columns }));
@@ -64065,8 +65014,8 @@ async function sandbox(client) {
64065
65014
  var import_chalk229 = __toESM(require_source(), 1);
64066
65015
  var import_frameworks3 = __toESM(require_frameworks(), 1);
64067
65016
  var import_fs_detectors = __toESM(require_dist3(), 1);
64068
- import { access as access3, readFile as readFile8 } from "fs/promises";
64069
- import { join as join14 } from "path";
65017
+ import { access as access3, readFile as readFile9 } from "fs/promises";
65018
+ import { join as join20 } from "path";
64070
65019
  import { homedir as homedir2 } from "os";
64071
65020
  import { spawn as spawn4 } from "child_process";
64072
65021
 
@@ -64158,8 +65107,8 @@ async function searchSkills(query) {
64158
65107
  }
64159
65108
  async function detectProjectFramework(cwd) {
64160
65109
  try {
64161
- const fs2 = new import_fs_detectors.LocalFileSystemDetector(cwd);
64162
- const detected = await (0, import_fs_detectors.detectFrameworks)({ fs: fs2, frameworkList: import_frameworks3.frameworkList });
65110
+ const fs4 = new import_fs_detectors.LocalFileSystemDetector(cwd);
65111
+ const detected = await (0, import_fs_detectors.detectFrameworks)({ fs: fs4, frameworkList: import_frameworks3.frameworkList });
64163
65112
  if (detected.length > 0) {
64164
65113
  return { name: detected[0].name, slug: detected[0].slug || "" };
64165
65114
  }
@@ -64169,7 +65118,7 @@ async function detectProjectFramework(cwd) {
64169
65118
  }
64170
65119
  async function readPackageDeps(cwd) {
64171
65120
  try {
64172
- const raw = await readFile8(join14(cwd, "package.json"), "utf8");
65121
+ const raw = await readFile9(join20(cwd, "package.json"), "utf8");
64173
65122
  const pkg = JSON.parse(raw);
64174
65123
  const allDeps = {
64175
65124
  ...pkg.dependencies,
@@ -64189,8 +65138,8 @@ function cleanDepName(dep) {
64189
65138
  async function isSkillInstalled(name, cwd) {
64190
65139
  const sanitized = name.toLowerCase().replace(/\s+/g, "-");
64191
65140
  const dirs = [
64192
- join14(cwd, ".agents", "skills", sanitized),
64193
- join14(homedir2(), ".agents", "skills", sanitized)
65141
+ join20(cwd, ".agents", "skills", sanitized),
65142
+ join20(homedir2(), ".agents", "skills", sanitized)
64194
65143
  ];
64195
65144
  for (const dir of dirs) {
64196
65145
  try {
@@ -64523,23 +65472,23 @@ async function list19(client, argv) {
64523
65472
  const projectName = parsedArgs.flags["--project"];
64524
65473
  telemetry2.trackCliOptionProject(projectName);
64525
65474
  const autoConfirm = !!parsedArgs.flags["--yes"];
64526
- const link = await ensureLink(targetCommand.name, client, cwd, {
65475
+ const link2 = await ensureLink(targetCommand.name, client, cwd, {
64527
65476
  autoConfirm,
64528
65477
  projectName,
64529
65478
  failIfNotFound: Boolean(projectName)
64530
65479
  });
64531
- if (typeof link === "number") {
64532
- return link;
65480
+ if (typeof link2 === "number") {
65481
+ return link2;
64533
65482
  }
64534
65483
  const start = Date.now();
64535
- const projectSlugLink = formatProject(link.org.slug, link.project.name);
65484
+ const projectSlugLink = formatProject(link2.org.slug, link2.project.name);
64536
65485
  output_manager_default.spinner(`Fetching custom environments for ${projectSlugLink}`);
64537
65486
  const url = `/projects/${encodeURIComponent(
64538
- link.project.id
65487
+ link2.project.id
64539
65488
  )}/custom-environments`;
64540
65489
  let { environments: result } = await client.fetch(url, {
64541
65490
  method: "GET",
64542
- accountId: link.org.id
65491
+ accountId: link2.org.id
64543
65492
  });
64544
65493
  output_manager_default.stopSpinner();
64545
65494
  const elapsed2 = (0, import_ms35.default)(Date.now() - start);
@@ -64570,8 +65519,8 @@ async function list19(client, argv) {
64570
65519
  ...result.flatMap((target) => {
64571
65520
  return [
64572
65521
  [
64573
- formatEnvironment(link.org.slug, link.project.name, target),
64574
- BRANCH_TRACKING_MAP[target.type](link.project, target),
65522
+ formatEnvironment(link2.org.slug, link2.project.name, target),
65523
+ BRANCH_TRACKING_MAP[target.type](link2.project, target),
64575
65524
  TYPE_MAP[target.type],
64576
65525
  import_chalk230.default.gray(
64577
65526
  target.updatedAt > 0 ? (0, import_ms35.default)(Date.now() - target.updatedAt) : "-"
@@ -65514,15 +66463,15 @@ var updateCurrentTeam = (config, team) => {
65514
66463
  writeToConfigFile(config);
65515
66464
  };
65516
66465
  async function warnIfStaleLinkExists(client, newOrgId) {
65517
- let link = null;
66466
+ let link2 = null;
65518
66467
  try {
65519
- link = await getLinkFromDir(
66468
+ link2 = await getLinkFromDir(
65520
66469
  getVercelDirectory(client.cwd)
65521
66470
  );
65522
66471
  } catch (_error) {
65523
- link = null;
66472
+ link2 = null;
65524
66473
  }
65525
- if (!link || link.orgId === newOrgId) {
66474
+ if (!link2 || link2.orgId === newOrgId) {
65526
66475
  return;
65527
66476
  }
65528
66477
  output_manager_default.warn(
@@ -66883,8 +67832,8 @@ var TracesTelemetryClient = class extends TelemetryClient {
66883
67832
  });
66884
67833
  }
66885
67834
  }
66886
- trackCliFlagOpen(open15) {
66887
- if (open15) {
67835
+ trackCliFlagOpen(open16) {
67836
+ if (open16) {
66888
67837
  this.trackCliFlag("open");
66889
67838
  }
66890
67839
  }
@@ -68732,37 +69681,37 @@ async function vcr(client) {
68732
69681
  switch (subcommand) {
68733
69682
  case "ls":
68734
69683
  telemetry2.trackCliSubcommandLs(subcommandOriginal);
68735
- return (await import("./chunks/ls-ESCK2JMH.js")).default(client, args, telemetry2);
69684
+ return (await import("./chunks/ls-5I2W7LZQ.js")).default(client, args, telemetry2);
68736
69685
  case "inspect":
68737
69686
  telemetry2.trackCliSubcommandInspect(subcommandOriginal);
68738
- return (await import("./chunks/inspect-W4AH3EKN.js")).default(client, args, telemetry2);
69687
+ return (await import("./chunks/inspect-TW5DENBM.js")).default(client, args, telemetry2);
68739
69688
  case "add":
68740
69689
  telemetry2.trackCliSubcommandAdd(subcommandOriginal);
68741
- return (await import("./chunks/add-RVZD257F.js")).default(client, args, telemetry2);
69690
+ return (await import("./chunks/add-EN4KBTT6.js")).default(client, args, telemetry2);
68742
69691
  case "config":
68743
69692
  telemetry2.trackCliSubcommandConfig(subcommandOriginal);
68744
- return (await import("./chunks/config-V42N5SNP.js")).default(client, args, telemetry2);
69693
+ return (await import("./chunks/config-MZ3KLGOK.js")).default(client, args, telemetry2);
68745
69694
  case "rm":
68746
69695
  telemetry2.trackCliSubcommandRm(subcommandOriginal);
68747
- return (await import("./chunks/rm-PXBJERO4.js")).default(client, args, telemetry2);
69696
+ return (await import("./chunks/rm-BEIAUTSF.js")).default(client, args, telemetry2);
68748
69697
  case "login":
68749
69698
  telemetry2.trackCliSubcommandLogin(subcommandOriginal);
68750
- return (await import("./chunks/login-QA4765QP.js")).default(client, args, telemetry2);
69699
+ return (await import("./chunks/login-VJESL6WK.js")).default(client, args, telemetry2);
68751
69700
  case "build":
68752
69701
  telemetry2.trackCliSubcommandBuild(subcommandOriginal);
68753
- return (await import("./chunks/build-KAOW7IJ6.js")).default(client, telemetry2);
69702
+ return (await import("./chunks/build-IDCBAC3R.js")).default(client, telemetry2);
68754
69703
  case "push":
68755
69704
  telemetry2.trackCliSubcommandPush(subcommandOriginal);
68756
- return (await import("./chunks/push-IKPIV52M.js")).default(client, telemetry2);
69705
+ return (await import("./chunks/push-75R5ZZIW.js")).default(client, telemetry2);
68757
69706
  case "tag":
68758
69707
  telemetry2.trackCliSubcommandTag(subcommandOriginal);
68759
- return (await import("./chunks/tags-XEZOWSS3.js")).default(client, args, telemetry2);
69708
+ return (await import("./chunks/tags-SRHDQUF6.js")).default(client, args, telemetry2);
68760
69709
  case "image":
68761
69710
  telemetry2.trackCliSubcommandImage(subcommandOriginal);
68762
- return (await import("./chunks/image-JAAMXTIA.js")).default(client, args, telemetry2);
69711
+ return (await import("./chunks/image-AJMRAAOW.js")).default(client, args, telemetry2);
68763
69712
  case "permissions":
68764
69713
  telemetry2.trackCliSubcommandPermissions(subcommandOriginal);
68765
- return (await import("./chunks/permissions-L7NPGX2M.js")).default(client, args, telemetry2);
69714
+ return (await import("./chunks/permissions-HRR47E2L.js")).default(client, args, telemetry2);
68766
69715
  default:
68767
69716
  output_manager_default.error(getInvalidSubcommand(COMMAND_CONFIG51));
68768
69717
  output_manager_default.print(help(vcrCommand, { columns: client.stderr.columns }));