vercel 58.9.2 → 58.9.4

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 (85) hide show
  1. package/dist/chunks/{add-LVQP3SR2.js → add-GCIDCWH7.js} +2 -2
  2. package/dist/chunks/{add-DDUZR2RD.js → add-XFGCONHF.js} +6 -6
  3. package/dist/chunks/{add-XZ2HRB22.js → add-ZZTRLRJT.js} +2 -2
  4. package/dist/chunks/{build-L3WNBFT6.js → build-VVNU4BLE.js} +2 -2
  5. package/dist/chunks/{chunk-J23MTK5H.js → chunk-3GTCSDQR.js} +7 -11
  6. package/dist/chunks/{chunk-DBMBKXZO.js → chunk-3RVAJBTW.js} +1 -1
  7. package/dist/chunks/{chunk-CMS7PTFB.js → chunk-473IQJL4.js} +1 -1
  8. package/dist/chunks/{chunk-5LPWBMQG.js → chunk-4EN73Q5Q.js} +1 -1
  9. package/dist/chunks/{chunk-R7FRJJSO.js → chunk-4ZDDOMUT.js} +109 -31
  10. package/dist/chunks/{chunk-DSJHGENE.js → chunk-5KY7ORFF.js} +1 -1
  11. package/dist/chunks/{chunk-QCDSQERI.js → chunk-5OWYFCOQ.js} +3 -3
  12. package/dist/chunks/{chunk-S6CMPUF4.js → chunk-6RVEMCWL.js} +1 -1
  13. package/dist/chunks/{chunk-Z7LH63PK.js → chunk-6WHBYHIB.js} +1 -1
  14. package/dist/chunks/{chunk-YXFLKPDC.js → chunk-F2PRLQ37.js} +772 -12
  15. package/dist/chunks/{chunk-QXXH6L46.js → chunk-HDKQ66NL.js} +113 -8
  16. package/dist/chunks/{chunk-77FZZ73F.js → chunk-HXZFIIDG.js} +4 -4
  17. package/dist/chunks/{chunk-74ZES62J.js → chunk-IV3BQDT2.js} +1 -1
  18. package/dist/chunks/{chunk-Z7RSIWNT.js → chunk-K43NT7QG.js} +1 -1
  19. package/dist/chunks/{chunk-EPAVMBXG.js → chunk-NCPOQOZ2.js} +2 -2
  20. package/dist/chunks/{constants-T6BULVX6.js → chunk-O26N2UPI.js} +4 -2
  21. package/dist/chunks/{chunk-KIGRD7TV.js → chunk-PSYZGH6M.js} +1 -1
  22. package/dist/chunks/{chunk-DZAP2FIC.js → chunk-QLZKPGI4.js} +1 -1
  23. package/dist/chunks/{chunk-DGVJNQI3.js → chunk-R67YCGGV.js} +2 -2
  24. package/dist/chunks/{chunk-6YFPNNA5.js → chunk-TPNM2IBA.js} +1 -1
  25. package/dist/chunks/{chunk-3T3AIIEO.js → chunk-U2HFLQVO.js} +2 -2
  26. package/dist/chunks/{chunk-2Z66EK7E.js → chunk-UA6KSQA7.js} +1 -1
  27. package/dist/chunks/{chunk-BW7BH66H.js → chunk-VJCN2M7S.js} +1 -1
  28. package/dist/chunks/{chunk-446IAD7O.js → chunk-ZI4J4CQ4.js} +1 -1
  29. package/dist/chunks/{clear-QD7QNE2X.js → clear-FEV6EGAS.js} +2 -2
  30. package/dist/chunks/{compile-vercel-config-G46NO752.js → compile-vercel-config-QSZ7JDCG.js} +1 -1
  31. package/dist/chunks/{config-MRWCWMFM.js → config-3BEFAQQU.js} +2 -2
  32. package/dist/chunks/constants-WEQVJSYS.js +15 -0
  33. package/dist/chunks/{delete-THAK6PDA.js → delete-IYAGVXU6.js} +2 -2
  34. package/dist/chunks/{delete-IJDA6IJT.js → delete-QYUDDZD2.js} +2 -2
  35. package/dist/chunks/{disable-XJLSQWDP.js → disable-D4WNCZ4Z.js} +2 -2
  36. package/dist/chunks/{discard-MDTDXLPM.js → discard-YFBRDG2N.js} +2 -2
  37. package/dist/chunks/{edit-TBUQIBCG.js → edit-3IUCXLNZ.js} +2 -2
  38. package/dist/chunks/{edit-XWMGSV5O.js → edit-TWPSJUE4.js} +3 -3
  39. package/dist/chunks/{enable-D4ZEFA7B.js → enable-XJ7JMETR.js} +2 -2
  40. package/dist/chunks/{export-35THNYMQ.js → export-GJ6XQQFA.js} +2 -2
  41. package/dist/chunks/{image-ONVF2WQF.js → image-SXRSCUP3.js} +3 -3
  42. package/dist/chunks/{import-builders-4PL2UTKQ.js → import-builders-QITJL2IG.js} +2 -2
  43. package/dist/chunks/{inspect-P2MVWGGX.js → inspect-DXYEEYSF.js} +2 -2
  44. package/dist/chunks/{inspect-UKWD7EKB.js → inspect-FAJ7BQOB.js} +3 -3
  45. package/dist/chunks/{inspect-22HFUKUL.js → inspect-H2HA6RZQ.js} +2 -2
  46. package/dist/chunks/{inspect-K5URFDTI.js → inspect-SMDJWUBZ.js} +2 -2
  47. package/dist/chunks/{inspect-JPKI7TUF.js → inspect-U5SNE5AC.js} +2 -2
  48. package/dist/chunks/{list-QOKS7OXY.js → list-FONLZ3YO.js} +3 -3
  49. package/dist/chunks/{list-RTALDLVZ.js → list-MTOKP2AP.js} +1 -1
  50. package/dist/chunks/{list-2GKTKNSP.js → list-YR65RN5B.js} +2 -2
  51. package/dist/chunks/{login-VTT2OSLJ.js → login-DKKJWEM5.js} +2 -2
  52. package/dist/chunks/{ls-4VTPS4H3.js → ls-4CRKYKH7.js} +2 -2
  53. package/dist/chunks/{ls-DPQN66HC.js → ls-DI6AQCB4.js} +2 -2
  54. package/dist/chunks/{ls-6M25LDJ3.js → ls-LS475P45.js} +2 -2
  55. package/dist/chunks/{ls-5FYZ5VEP.js → ls-ORTO6EFA.js} +2 -2
  56. package/dist/chunks/{ls-3XZ54CAA.js → ls-XO2VXFTI.js} +3 -3
  57. package/dist/chunks/{open-LSQVBKRQ.js → open-2P4ZZTJD.js} +2 -2
  58. package/dist/chunks/{permissions-KHCRKKCJ.js → permissions-PTW7BRVE.js} +4 -4
  59. package/dist/chunks/{publish-OQZQOC3A.js → publish-IRGV2FST.js} +2 -2
  60. package/dist/chunks/{push-O22DZTSK.js → push-3OY5CP5F.js} +2 -2
  61. package/dist/chunks/{query-X2SX26DL.js → query-DLYCIOU6.js} +1 -1
  62. package/dist/chunks/{reorder-E53PSWXQ.js → reorder-J2TPPT62.js} +2 -2
  63. package/dist/chunks/{reply-NQD2F6SH.js → reply-QZWESDIB.js} +2 -2
  64. package/dist/chunks/{resolve-6ZPARPEF.js → resolve-HSW2EFLZ.js} +2 -2
  65. package/dist/chunks/{restore-UJYDYOZO.js → restore-DFLBJZFM.js} +2 -2
  66. package/dist/chunks/{rm-TCPTNK5O.js → rm-FAPEWTLO.js} +2 -2
  67. package/dist/chunks/{rm-A6S57TZX.js → rm-G5JC3V3B.js} +2 -2
  68. package/dist/chunks/{rm-BYF6J53M.js → rm-NIRLLUDU.js} +2 -2
  69. package/dist/chunks/{rm-5T3LQY2T.js → rm-QKGA6HFJ.js} +3 -3
  70. package/dist/chunks/{rule-inspect-Q7G2H534.js → rule-inspect-LKKYOQN7.js} +3 -3
  71. package/dist/chunks/{rules-5EI4AZ2N.js → rules-DNPBXPCT.js} +6 -6
  72. package/dist/chunks/{schema-CFEL4DGE.js → schema-E4EWRSGN.js} +1 -1
  73. package/dist/chunks/{tags-GWQZQY3Q.js → tags-IO73I6MR.js} +2 -2
  74. package/dist/chunks/{update-SHTZVWMD.js → update-CFCAOSLN.js} +6 -6
  75. package/dist/commands/build/index.js +13 -10
  76. package/dist/commands/deploy/index.js +9 -9
  77. package/dist/commands/dev/index.js +8 -8
  78. package/dist/commands/env/index.js +4 -4
  79. package/dist/commands/link/index.js +6 -6
  80. package/dist/commands/list/index.js +2 -2
  81. package/dist/commands-bulk.js +839 -773
  82. package/dist/index.js +26 -10
  83. package/dist/vc.js +7 -3
  84. package/dist/version.mjs +2 -1
  85. package/package.json +18 -18
@@ -17,7 +17,7 @@ import {
17
17
  emitVcrArgParseError,
18
18
  resolveVcrScope,
19
19
  validateVcrJsonOutput
20
- } from "./chunk-CMS7PTFB.js";
20
+ } from "./chunk-473IQJL4.js";
21
21
  import "./chunk-G75NFPIT.js";
22
22
  import {
23
23
  outputError
@@ -27,7 +27,7 @@ import {
27
27
  permissionsAddSubcommand
28
28
  } from "./chunk-J6LK45HT.js";
29
29
  import "./chunk-R6IGDGX3.js";
30
- import "./chunk-J23MTK5H.js";
30
+ import "./chunk-3GTCSDQR.js";
31
31
  import "./chunk-ECCWJHC6.js";
32
32
  import {
33
33
  AGENT_REASON,
@@ -8,21 +8,21 @@ import {
8
8
  parseCustomAlertQueryBody,
9
9
  resolveCustomAlertProjectName,
10
10
  setMissingCustomAlertProjectScope
11
- } from "./chunk-EPAVMBXG.js";
11
+ } from "./chunk-NCPOQOZ2.js";
12
12
  import {
13
13
  emitRulesArgParseError,
14
14
  handleRulesApiError,
15
15
  parseRulesFlagsAndScope,
16
16
  rulesCollectionPath
17
- } from "./chunk-Z7LH63PK.js";
17
+ } from "./chunk-6WHBYHIB.js";
18
18
  import {
19
19
  isCustomAlertRule
20
20
  } from "./chunk-TEQKKTJQ.js";
21
- import "./chunk-6YFPNNA5.js";
21
+ import "./chunk-TPNM2IBA.js";
22
22
  import "./chunk-A3NYPUKZ.js";
23
23
  import "./chunk-P65EEFTR.js";
24
24
  import "./chunk-FGDKMNEN.js";
25
- import "./chunk-DGVJNQI3.js";
25
+ import "./chunk-R67YCGGV.js";
26
26
  import "./chunk-JKQWQA2T.js";
27
27
  import "./chunk-RQ7H43CJ.js";
28
28
  import {
@@ -31,9 +31,9 @@ import {
31
31
  import {
32
32
  rulesAddSubcommand
33
33
  } from "./chunk-UMA66MKW.js";
34
- import "./chunk-Z7RSIWNT.js";
34
+ import "./chunk-K43NT7QG.js";
35
35
  import "./chunk-KT4XXKJK.js";
36
- import "./chunk-J23MTK5H.js";
36
+ import "./chunk-3GTCSDQR.js";
37
37
  import "./chunk-ECCWJHC6.js";
38
38
  import {
39
39
  AGENT_REASON,
@@ -9,7 +9,7 @@ import {
9
9
  handleVcrApiError,
10
10
  resolveVcrScope,
11
11
  validateVcrJsonOutput
12
- } from "./chunk-CMS7PTFB.js";
12
+ } from "./chunk-473IQJL4.js";
13
13
  import "./chunk-G75NFPIT.js";
14
14
  import {
15
15
  outputError
@@ -22,7 +22,7 @@ import "./chunk-B3JTF4CF.js";
22
22
  import "./chunk-A5KP5HAI.js";
23
23
  import "./chunk-J6LK45HT.js";
24
24
  import "./chunk-R6IGDGX3.js";
25
- import "./chunk-J23MTK5H.js";
25
+ import "./chunk-3GTCSDQR.js";
26
26
  import "./chunk-ECCWJHC6.js";
27
27
  import {
28
28
  AGENT_REASON,
@@ -23,7 +23,7 @@ import {
23
23
  runEngine,
24
24
  splitPassthrough,
25
25
  validateVcrChoice
26
- } from "./chunk-CMS7PTFB.js";
26
+ } from "./chunk-473IQJL4.js";
27
27
  import "./chunk-G75NFPIT.js";
28
28
  import {
29
29
  outputError
@@ -36,7 +36,7 @@ import "./chunk-B3JTF4CF.js";
36
36
  import "./chunk-A5KP5HAI.js";
37
37
  import "./chunk-J6LK45HT.js";
38
38
  import "./chunk-R6IGDGX3.js";
39
- import "./chunk-J23MTK5H.js";
39
+ import "./chunk-3GTCSDQR.js";
40
40
  import "./chunk-ECCWJHC6.js";
41
41
  import {
42
42
  AGENT_REASON,
@@ -18167,16 +18167,10 @@ var require_frameworks = __commonJS({
18167
18167
  value: "N/A"
18168
18168
  }
18169
18169
  },
18170
- getOutputDirName: async () => "public",
18171
- defaultRoutes: [
18172
- {
18173
- handle: "filesystem"
18174
- },
18175
- {
18176
- src: "/(.*)",
18177
- dest: "/"
18178
- }
18179
- ]
18170
+ getOutputDirName: async () => "public"
18171
+ // No `defaultRoutes`: `@vercel/go` emits its own catch-all, which points at
18172
+ // the Lambda's real output path and carries the `request.path` transform
18173
+ // that makes rewrites visible to the server.
18180
18174
  },
18181
18175
  {
18182
18176
  name: "Services",
@@ -58952,7 +58946,7 @@ function createDetectEntrypoint(projectRoot) {
58952
58946
  };
58953
58947
  }
58954
58948
  async function loadBuilderDetectEntrypoint(name, projectRoot) {
58955
- const { importBuilders } = await import("./import-builders-4PL2UTKQ.js");
58949
+ const { importBuilders } = await import("./import-builders-QITJL2IG.js");
58956
58950
  const builders = await importBuilders(/* @__PURE__ */ new Set([name]), projectRoot);
58957
58951
  const loaded = builders.get(name);
58958
58952
  if (!loaded) {
@@ -60006,9 +60000,11 @@ export {
60006
60000
  isDirectory,
60007
60001
  require_pluralize,
60008
60002
  require_slugify,
60003
+ getGitConfigPath,
60009
60004
  createGitMeta,
60010
60005
  parseGitConfig,
60011
60006
  pluckRemoteUrls,
60007
+ getRemoteUrls,
60012
60008
  ALIGNED_LABEL_WIDTH,
60013
60009
  printAlignedLabel,
60014
60010
  selectOrg,
@@ -6,7 +6,7 @@ const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __dirname_(__filename);
7
7
  import {
8
8
  ALIGNED_LABEL_WIDTH
9
- } from "./chunk-J23MTK5H.js";
9
+ } from "./chunk-3GTCSDQR.js";
10
10
  import {
11
11
  require_ms
12
12
  } from "./chunk-GGP5R3FU.js";
@@ -20,7 +20,7 @@ import {
20
20
  getLinkedProject,
21
21
  getProjectByNameOrId,
22
22
  getScope
23
- } from "./chunk-J23MTK5H.js";
23
+ } from "./chunk-3GTCSDQR.js";
24
24
  import {
25
25
  AGENT_REASON,
26
26
  buildCommandWithGlobalFlags,
@@ -6,7 +6,7 @@ const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __dirname_(__filename);
7
7
  import {
8
8
  STANDARD_ENVIRONMENTS
9
- } from "./chunk-J23MTK5H.js";
9
+ } from "./chunk-3GTCSDQR.js";
10
10
  import {
11
11
  getCommandName,
12
12
  require_lib
@@ -8,7 +8,7 @@ import {
8
8
  getLocalPathConfig,
9
9
  isPromptBackError,
10
10
  isPromptCanceledError
11
- } from "./chunk-Z7RSIWNT.js";
11
+ } from "./chunk-K43NT7QG.js";
12
12
  import {
13
13
  table
14
14
  } from "./chunk-KT4XXKJK.js";
@@ -25,8 +25,10 @@ import {
25
25
  findProjectsFromPath,
26
26
  findRepoRoot,
27
27
  findSourceVercelConfigFile,
28
+ getGitConfigPath,
28
29
  getLinkedProject,
29
30
  getProjectByNameOrId,
31
+ getRemoteUrls,
30
32
  getServicesConfigWriteBlocker,
31
33
  getVercelDirectory,
32
34
  humanizePath,
@@ -34,6 +36,7 @@ import {
34
36
  linkFolderToProject,
35
37
  linkRepoProject,
36
38
  parseGitConfig,
39
+ parseRepoUrl,
37
40
  pluckRemoteUrls,
38
41
  printAlignedLabel,
39
42
  pull,
@@ -46,7 +49,7 @@ import {
46
49
  selectAndParseRemoteUrl,
47
50
  selectOrg,
48
51
  writeServicesConfig
49
- } from "./chunk-J23MTK5H.js";
52
+ } from "./chunk-3GTCSDQR.js";
50
53
  import {
51
54
  printError
52
55
  } from "./chunk-KBEX5MYS.js";
@@ -305,7 +308,7 @@ function displayServiceErrors(errors) {
305
308
  // src/util/link/setup-and-link.ts
306
309
  var import_fs_extra2 = __toESM(require_lib(), 1);
307
310
  var import_fs_detectors2 = __toESM(require_dist(), 1);
308
- import { join as join2, basename } from "path";
311
+ import { join as join3, basename } from "path";
309
312
  import { getPlatformEnv } from "@vercel/build-utils";
310
313
 
311
314
  // src/util/input/input-project.ts
@@ -315,6 +318,7 @@ var SEARCH_ALL_PROJECTS = "search-all-projects";
315
318
  var CREATE_NEW_PROJECT = "create-new-project";
316
319
  var BACK_TO_PROJECT_SELECTION = Symbol("back-to-project-selection");
317
320
  var BACK_TO_TEAM_SELECTION = Symbol("back-to-team-selection");
321
+ var SWITCH_GIT_REMOTE = Symbol("switch-git-remote");
318
322
  var NO_EXISTING_PROJECTS = Symbol("no-existing-projects");
319
323
  async function inputProjectDecision(client, defaultDecision) {
320
324
  const createChoice = {
@@ -439,8 +443,9 @@ async function searchExistingProjects(client, org, allowBack) {
439
443
  }
440
444
  });
441
445
  }
442
- async function inputProject(client, org, detectedProjectName, autoConfirm = false, skipAutoDetect = false, showProjectSuggestions = false, allowTeamSelectionBack = false, repoMatches = []) {
446
+ async function inputProject(client, org, detectedProjectName, autoConfirm = false, skipAutoDetect = false, showProjectSuggestions = false, allowTeamSelectionBack = false, repoMatches = [], gitRemoteOptions) {
443
447
  const slugifiedName = (0, import_slugify.default)(detectedProjectName);
448
+ const canSwitchGitRemote = (gitRemoteOptions?.remoteNames.length ?? 0) > 1;
444
449
  let detectedProject = null;
445
450
  if (!skipAutoDetect && repoMatches.length === 0) {
446
451
  output_manager_default.spinner("Searching for existing projects\u2026", 1e3);
@@ -514,6 +519,14 @@ async function inputProject(client, org, detectedProjectName, autoConfirm = fals
514
519
  description: `Create it under ${org.slug}`
515
520
  }
516
521
  );
522
+ if (canSwitchGitRemote) {
523
+ const current = gitRemoteOptions?.currentRemoteName;
524
+ choices.push({
525
+ name: "Switch Git remote",
526
+ value: SWITCH_GIT_REMOTE,
527
+ description: current ? `Suggestions are from ${current}` : "Search projects linked to a different remote"
528
+ });
529
+ }
517
530
  if (allowTeamSelectionBack) {
518
531
  choices.push({
519
532
  name: "Choose a different team",
@@ -528,6 +541,9 @@ async function inputProject(client, org, detectedProjectName, autoConfirm = fals
528
541
  if (selected === BACK_TO_TEAM_SELECTION) {
529
542
  return BACK_TO_TEAM_SELECTION;
530
543
  }
544
+ if (selected === SWITCH_GIT_REMOTE) {
545
+ return SWITCH_GIT_REMOTE;
546
+ }
531
547
  if (selected === CREATE_NEW_PROJECT) {
532
548
  const projectName = await promptForProjectNameWithBack(
533
549
  client,
@@ -908,33 +924,37 @@ async function promptForInferredServicesSetup({
908
924
 
909
925
  // src/util/projects/search-project-across-teams.ts
910
926
  var import_slugify2 = __toESM(require_slugify(), 1);
911
- import { relative as relative2 } from "path";
927
+ import { join as join2, relative as relative2 } from "path";
912
928
  async function searchProjectsByRepoRoot({
913
929
  client,
914
930
  cwd,
915
931
  gitProjectName,
916
932
  orgs,
917
- autoConfirm,
918
- nonInteractive
933
+ remoteName
919
934
  }) {
935
+ const empty = { matches: [], remoteNames: [] };
920
936
  const rootPath = await findRepoRoot(cwd);
921
937
  if (!rootPath) {
922
- return [];
938
+ return empty;
923
939
  }
940
+ const gitConfigPath = getGitConfigPath({ cwd: rootPath }) ?? join2(rootPath, ".git/config");
941
+ const remoteUrls = await getRemoteUrls(gitConfigPath);
942
+ const remoteNames = remoteUrls ? Object.keys(remoteUrls).sort() : [];
924
943
  let remote;
925
944
  try {
926
945
  remote = await resolveGitRemote(client, rootPath, {
927
- yes: autoConfirm || nonInteractive
946
+ yes: true,
947
+ existingRemoteName: remoteName
928
948
  });
929
949
  } catch (error) {
930
950
  if (isPromptCanceledError(error)) {
931
951
  throw error;
932
952
  }
933
953
  output_manager_default.debug(`Failed to resolve Git remote for project search: ${error}`);
934
- return [];
954
+ return { matches: [], remoteNames };
935
955
  }
936
956
  if (!remote) {
937
- return [];
957
+ return { matches: [], remoteNames };
938
958
  }
939
959
  const relativePath = relative2(rootPath, cwd);
940
960
  const results = await Promise.all(
@@ -983,7 +1003,11 @@ async function searchProjectsByRepoRoot({
983
1003
  }
984
1004
  })
985
1005
  );
986
- return results.flat();
1006
+ return {
1007
+ matches: results.flat(),
1008
+ remote,
1009
+ remoteNames
1010
+ };
987
1011
  }
988
1012
 
989
1013
  // src/util/link/setup-and-link.ts
@@ -1171,8 +1195,8 @@ async function setupAndLink(client, path2, {
1171
1195
  }
1172
1196
  if (forceDelete) {
1173
1197
  const vercelDir = getVercelDirectory(path2);
1174
- (0, import_fs_extra2.remove)(join2(vercelDir, VERCEL_DIR_README));
1175
- (0, import_fs_extra2.remove)(join2(vercelDir, VERCEL_DIR_PROJECT));
1198
+ (0, import_fs_extra2.remove)(join3(vercelDir, VERCEL_DIR_README));
1199
+ (0, import_fs_extra2.remove)(join3(vercelDir, VERCEL_DIR_PROJECT));
1176
1200
  }
1177
1201
  output_manager_default.print("\n");
1178
1202
  printAlignedLabel("Directory", humanizePath(path2));
@@ -1182,6 +1206,7 @@ async function setupAndLink(client, path2, {
1182
1206
  const showProjectSuggestions = interactive && !gitProjectName;
1183
1207
  let projectOrNewProjectName;
1184
1208
  let teamAutoSelected = false;
1209
+ let selectedGitRemoteName;
1185
1210
  for (; ; ) {
1186
1211
  if (!org) {
1187
1212
  const orgMeta = {};
@@ -1198,17 +1223,21 @@ async function setupAndLink(client, path2, {
1198
1223
  teamAutoSelected = orgMeta.choiceCount === 1;
1199
1224
  }
1200
1225
  let repoMatches = [];
1226
+ let gitRemoteNames = [];
1227
+ let currentGitRemoteName;
1201
1228
  if (showProjectSuggestions) {
1202
1229
  output_manager_default.spinner("Searching for existing projects\u2026", 1e3);
1203
1230
  try {
1204
- repoMatches = await searchProjectsByRepoRoot({
1231
+ const repoSearch = await searchProjectsByRepoRoot({
1205
1232
  client,
1206
1233
  cwd: path2,
1207
1234
  gitProjectName,
1208
1235
  orgs: [org],
1209
- autoConfirm,
1210
- nonInteractive
1236
+ remoteName: selectedGitRemoteName
1211
1237
  });
1238
+ repoMatches = repoSearch.matches;
1239
+ gitRemoteNames = repoSearch.remoteNames;
1240
+ currentGitRemoteName = repoSearch.remote?.remoteName;
1212
1241
  } catch (err) {
1213
1242
  if (isPromptCanceledError(err)) {
1214
1243
  throw err;
@@ -1227,7 +1256,11 @@ async function setupAndLink(client, path2, {
1227
1256
  false,
1228
1257
  showProjectSuggestions,
1229
1258
  searchableTeamPicker && !selectedOrg && !teamAutoSelected,
1230
- repoMatches
1259
+ repoMatches,
1260
+ {
1261
+ remoteNames: gitRemoteNames,
1262
+ currentRemoteName: currentGitRemoteName
1263
+ }
1231
1264
  );
1232
1265
  } catch (err) {
1233
1266
  if (err instanceof Error && err.code === "HEADLESS") {
@@ -1237,6 +1270,25 @@ async function setupAndLink(client, path2, {
1237
1270
  }
1238
1271
  if (projectOrNewProjectName === BACK_TO_TEAM_SELECTION) {
1239
1272
  org = void 0;
1273
+ selectedGitRemoteName = void 0;
1274
+ continue;
1275
+ }
1276
+ if (projectOrNewProjectName === SWITCH_GIT_REMOTE) {
1277
+ const rootPath = await findRepoRoot(path2);
1278
+ if (!rootPath) {
1279
+ continue;
1280
+ }
1281
+ try {
1282
+ const remote = await resolveGitRemote(client, rootPath, {
1283
+ yes: false
1284
+ });
1285
+ selectedGitRemoteName = remote?.remoteName;
1286
+ } catch (err) {
1287
+ if (isPromptCanceledError(err)) {
1288
+ throw err;
1289
+ }
1290
+ output_manager_default.debug(`Failed to switch Git remote: ${err}`);
1291
+ }
1240
1292
  continue;
1241
1293
  }
1242
1294
  break;
@@ -1270,6 +1322,11 @@ async function setupAndLink(client, path2, {
1270
1322
  return { status: "linked", org, project };
1271
1323
  }
1272
1324
  config.currentTeam = org.type === "team" ? org.id : void 0;
1325
+ const gitConnectIntent = await resolveGitConnectIntent(
1326
+ client,
1327
+ path2,
1328
+ autoConfirm
1329
+ );
1273
1330
  const rootServicesSetup = await getServicesSetupState(path2);
1274
1331
  const configFileName = await findSourceVercelConfigFile(path2) ?? "vercel.json";
1275
1332
  try {
@@ -1309,7 +1366,7 @@ async function setupAndLink(client, path2, {
1309
1366
  });
1310
1367
  if (shouldPromptRoot) {
1311
1368
  rootDirectory = await inputRootDirectory(client, path2, autoConfirm);
1312
- if (rootDirectory && !await validateRootDirectory(path2, join2(path2, rootDirectory))) {
1369
+ if (rootDirectory && !await validateRootDirectory(path2, join3(path2, rootDirectory))) {
1313
1370
  return {
1314
1371
  status: "error",
1315
1372
  exitCode: 1,
@@ -1318,7 +1375,7 @@ async function setupAndLink(client, path2, {
1318
1375
  }
1319
1376
  }
1320
1377
  }
1321
- pathWithRootDirectory = rootDirectory ? join2(path2, rootDirectory) : path2;
1378
+ pathWithRootDirectory = rootDirectory ? join3(path2, rootDirectory) : path2;
1322
1379
  const selectedRootServicesSetup = pathWithRootDirectory === path2 ? null : await getServicesSetupState(pathWithRootDirectory);
1323
1380
  let selectedRootInferredServicesChoice = null;
1324
1381
  if (!skipSelectedRootInferredServicesPrompt) {
@@ -1345,7 +1402,7 @@ async function setupAndLink(client, path2, {
1345
1402
  path2,
1346
1403
  selectedRootInferredServicesChoice.selectedPath
1347
1404
  );
1348
- pathWithRootDirectory = rootDirectory ? join2(path2, rootDirectory) : path2;
1405
+ pathWithRootDirectory = rootDirectory ? join3(path2, rootDirectory) : path2;
1349
1406
  }
1350
1407
  const localConfig = await readConfig(pathWithRootDirectory);
1351
1408
  if (localConfig instanceof CantParseJSONFile) {
@@ -1409,7 +1466,13 @@ async function setupAndLink(client, path2, {
1409
1466
  // don't prompt to pull env for newly created projects
1410
1467
  "Created"
1411
1468
  );
1412
- await connectGitRepository(client, path2, project, autoConfirm, org);
1469
+ await applyGitConnectIntent(
1470
+ client,
1471
+ gitConnectIntent,
1472
+ project,
1473
+ autoConfirm,
1474
+ org
1475
+ );
1413
1476
  return { status: "linked", org, project };
1414
1477
  } catch (err) {
1415
1478
  if (isPromptCanceledError(err)) {
@@ -1426,25 +1489,40 @@ async function setupAndLink(client, path2, {
1426
1489
  return { status: "error", exitCode: 1 };
1427
1490
  }
1428
1491
  }
1429
- async function connectGitRepository(client, path2, project, autoConfirm, org) {
1492
+ async function resolveGitConnectIntent(client, path2, autoConfirm) {
1430
1493
  try {
1431
- const gitConfig = await parseGitConfig(join2(path2, ".git/config"));
1494
+ const gitConfig = await parseGitConfig(join3(path2, ".git/config"));
1432
1495
  if (!gitConfig) {
1433
- return;
1496
+ return null;
1434
1497
  }
1435
1498
  const remoteUrls = pluckRemoteUrls(gitConfig);
1436
1499
  if (!remoteUrls || Object.keys(remoteUrls).length === 0) {
1437
- return;
1500
+ return null;
1438
1501
  }
1439
- output_manager_default.print("\n");
1440
- const shouldConnect = autoConfirm || await client.input.confirm(`Connect detected Git repository?`, true);
1502
+ const skipPrompts = autoConfirm || client.nonInteractive;
1503
+ const shouldConnect = skipPrompts || await client.input.confirm(`Connect detected Git repository?`, false);
1441
1504
  if (!shouldConnect) {
1442
- return;
1505
+ return null;
1443
1506
  }
1444
- const repoInfo = await selectAndParseRemoteUrl(client, remoteUrls);
1507
+ const repoInfo = skipPrompts ? parseRepoUrl(remoteUrls.origin ?? Object.values(remoteUrls)[0]) : await selectAndParseRemoteUrl(client, remoteUrls);
1445
1508
  if (!repoInfo) {
1446
- return;
1509
+ return null;
1510
+ }
1511
+ return { repoInfo };
1512
+ } catch (error) {
1513
+ if (isPromptCanceledError(error)) {
1514
+ throw error;
1447
1515
  }
1516
+ output_manager_default.debug(`Failed to detect git repository: ${error}`);
1517
+ return null;
1518
+ }
1519
+ }
1520
+ async function applyGitConnectIntent(client, intent, project, autoConfirm, org) {
1521
+ if (!intent) {
1522
+ return;
1523
+ }
1524
+ const { repoInfo } = intent;
1525
+ try {
1448
1526
  await checkExistsAndConnect({
1449
1527
  client,
1450
1528
  confirm: autoConfirm,
@@ -8,7 +8,7 @@ import {
8
8
  formatCondition,
9
9
  formatTransform,
10
10
  isTargetTransform
11
- } from "./chunk-74ZES62J.js";
11
+ } from "./chunk-IV3BQDT2.js";
12
12
  import {
13
13
  output_manager_default
14
14
  } from "./chunk-OX7KI3LF.js";
@@ -15,13 +15,13 @@ import {
15
15
  printIndications,
16
16
  require_dist as require_dist2,
17
17
  sleep
18
- } from "./chunk-DGVJNQI3.js";
18
+ } from "./chunk-R67YCGGV.js";
19
19
  import {
20
20
  suggestNextCommands
21
21
  } from "./chunk-XBN2O34P.js";
22
22
  import {
23
23
  CommandTimeout
24
- } from "./chunk-QXXH6L46.js";
24
+ } from "./chunk-HDKQ66NL.js";
25
25
  import {
26
26
  showPluginTipIfNeeded
27
27
  } from "./chunk-HT2XWSAJ.js";
@@ -38,7 +38,7 @@ import {
38
38
  require_dist as require_dist3,
39
39
  require_pluralize,
40
40
  ua_default
41
- } from "./chunk-J23MTK5H.js";
41
+ } from "./chunk-3GTCSDQR.js";
42
42
  import {
43
43
  require_ms
44
44
  } from "./chunk-GGP5R3FU.js";
@@ -8,7 +8,7 @@ import {
8
8
  VERCEL_DIR,
9
9
  VERCEL_DIR_PROJECT,
10
10
  require_lib
11
- } from "./chunk-J23MTK5H.js";
11
+ } from "./chunk-3GTCSDQR.js";
12
12
  import {
13
13
  require_dist
14
14
  } from "./chunk-OX7KI3LF.js";
@@ -6,7 +6,7 @@ const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __dirname_(__filename);
7
7
  import {
8
8
  resolveAlertsScope
9
- } from "./chunk-6YFPNNA5.js";
9
+ } from "./chunk-TPNM2IBA.js";
10
10
  import {
11
11
  handleValidationError,
12
12
  outputError,