vercel 54.2.0 → 54.3.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 (67) hide show
  1. package/dist/chunks/{add-FAIIANHS.js → add-6BI52GC7.js} +8 -8
  2. package/dist/chunks/{chunk-2OASKDFC.js → chunk-3NTROBCB.js} +7 -4
  3. package/dist/chunks/{chunk-XVAEOG4L.js → chunk-3TDGMELF.js} +3 -5
  4. package/dist/chunks/{chunk-KSMF2UFR.js → chunk-4CIXZOP4.js} +15 -0
  5. package/dist/chunks/{chunk-O2NXGZCW.js → chunk-4KGRBMBC.js} +8 -8
  6. package/dist/chunks/{chunk-JFVGRFME.js → chunk-5EKBCYHA.js} +1 -1
  7. package/dist/chunks/{chunk-ISJJTUJZ.js → chunk-5TTQBT67.js} +1 -1
  8. package/dist/chunks/{chunk-IYP3534A.js → chunk-63MSANDD.js} +14 -10
  9. package/dist/chunks/{chunk-JQ7RG6JF.js → chunk-7UDM3VHD.js} +1 -1
  10. package/dist/chunks/{chunk-QH5Q2B4F.js → chunk-AKWLMA5B.js} +1 -1
  11. package/dist/chunks/{chunk-C5YP6KFI.js → chunk-AOJHEPS4.js} +6 -0
  12. package/dist/chunks/{chunk-QAA3JVFJ.js → chunk-B3RJGSB2.js} +2 -2
  13. package/dist/chunks/{chunk-ZAAKSLHC.js → chunk-C2V6DCWN.js} +4 -2
  14. package/dist/chunks/{chunk-4PSOOFYO.js → chunk-DJA3IN2X.js} +1 -1
  15. package/dist/chunks/{chunk-YNHUUJTK.js → chunk-EU5K7JFJ.js} +5 -5
  16. package/dist/chunks/{chunk-ZA4ZUW7G.js → chunk-GJI2IQHA.js} +2 -2
  17. package/dist/chunks/{chunk-4GQQJY5Y.js → chunk-H33IJ7OP.js} +9 -0
  18. package/dist/chunks/{chunk-23UWSHRQ.js → chunk-HFVP2JUO.js} +133 -63
  19. package/dist/chunks/{chunk-E3NE4SKN.js → chunk-L6Q2EQPI.js} +1 -0
  20. package/dist/chunks/{chunk-DKD6GTQT.js → chunk-OM5Z2KO5.js} +1 -1
  21. package/dist/chunks/{chunk-TWVG3QHM.js → chunk-PU4PEBGY.js} +1 -1
  22. package/dist/chunks/{chunk-VKQT3HCH.js → chunk-PXR6WCEU.js} +5 -5
  23. package/dist/chunks/{chunk-QEYYWOB4.js → chunk-R6QYB2GK.js} +13 -3
  24. package/dist/chunks/{chunk-FKUVFVT2.js → chunk-RNIZUKES.js} +120 -59
  25. package/dist/chunks/{chunk-E32QX22S.js → chunk-SJAFZ3UZ.js} +65 -5
  26. package/dist/chunks/{chunk-YE6OHHJA.js → chunk-SRLTKHXQ.js} +6 -6
  27. package/dist/chunks/{chunk-2DFWEDF7.js → chunk-SRVNEJVN.js} +2 -2
  28. package/dist/chunks/{chunk-DP5346AR.js → chunk-SXYVZF6H.js} +3 -3
  29. package/dist/chunks/{chunk-TZMIHH5D.js → chunk-TM2USC5N.js} +6 -11
  30. package/dist/chunks/{chunk-H7ZZXKJ2.js → chunk-TTOZFGDX.js} +3 -3
  31. package/dist/chunks/{chunk-J7RPHYNB.js → chunk-W64ECC2K.js} +1 -1
  32. package/dist/chunks/{chunk-IFATV36R.js → chunk-YAOSNCGO.js} +5 -8
  33. package/dist/chunks/{chunk-CQANJIEC.js → chunk-YP423QYK.js} +4 -6
  34. package/dist/chunks/{chunk-DIWRR5Y4.js → chunk-ZCMQ43RC.js} +1 -1
  35. package/dist/chunks/{chunk-ZFEECTPC.js → chunk-ZUK6C2UA.js} +1 -1
  36. package/dist/chunks/{compile-vercel-config-7TPMRTKM.js → compile-vercel-config-UTUECEB5.js} +3 -3
  37. package/dist/chunks/{delete-MVQKJDRS.js → delete-FML7PGMQ.js} +6 -6
  38. package/dist/chunks/{disable-YRONTYDS.js → disable-LJFGBJQD.js} +6 -6
  39. package/dist/chunks/{discard-UM7Y2PMF.js → discard-JKLUB56V.js} +6 -6
  40. package/dist/chunks/{edit-PHXJMLL2.js → edit-24LNAGLI.js} +8 -8
  41. package/dist/chunks/{enable-D26FR2VL.js → enable-XV6WCSRR.js} +6 -6
  42. package/dist/chunks/{export-YLMQTP7Y.js → export-IZAJQNHO.js} +6 -6
  43. package/dist/chunks/{inspect-SJTJNJVL.js → inspect-4OYBTMEZ.js} +10 -10
  44. package/dist/chunks/{list-XGSNQW5B.js → list-FOLL3X7L.js} +9 -9
  45. package/dist/chunks/{list-6OV7HAO4.js → list-PEXOOVJA.js} +5 -5
  46. package/dist/chunks/{ls-THDT5E4M.js → ls-3D5FA5CD.js} +8 -8
  47. package/dist/chunks/{publish-NPM5RPLV.js → publish-FV5R2JPI.js} +6 -6
  48. package/dist/chunks/{query-QP5JLBXI.js → query-JM422UQL.js} +6 -6
  49. package/dist/chunks/{reorder-573FHW5Z.js → reorder-H5VPRRYP.js} +6 -6
  50. package/dist/chunks/{restore-H65BVJFL.js → restore-JPFHV2E2.js} +6 -6
  51. package/dist/chunks/{rm-MOVL4G2Y.js → rm-AQFIGZB7.js} +8 -8
  52. package/dist/chunks/{routes-I74KWX7Q.js → routes-IBID4NSZ.js} +2 -2
  53. package/dist/chunks/{rule-inspect-33M2FHDU.js → rule-inspect-XV56NBAE.js} +8 -8
  54. package/dist/chunks/{rules-KVSJYT5T.js → rules-SUXFDKPS.js} +7 -7
  55. package/dist/chunks/{schema-MXM7Z52O.js → schema-3I4KYWU3.js} +7 -7
  56. package/dist/chunks/{types-QAT6PCGL.js → types-V6KTYGWP.js} +3 -3
  57. package/dist/chunks/{update-CSKHHR3E.js → update-3W7ETGXO.js} +8 -8
  58. package/dist/commands/build/index.js +80 -22
  59. package/dist/commands/deploy/index.js +32 -26
  60. package/dist/commands/dev/index.js +26 -13
  61. package/dist/commands/env/index.js +18 -22
  62. package/dist/commands/link/index.js +22 -29
  63. package/dist/commands/list/index.js +10 -10
  64. package/dist/commands-bulk.js +1356 -429
  65. package/dist/index.js +31 -21
  66. package/dist/version.mjs +1 -1
  67. package/package.json +16 -16
@@ -8,7 +8,7 @@ import {
8
8
  TelemetryClient,
9
9
  require_dist as require_dist2,
10
10
  require_graceful_fs
11
- } from "./chunk-KSMF2UFR.js";
11
+ } from "./chunk-4CIXZOP4.js";
12
12
  import {
13
13
  buildCommandWithYes,
14
14
  getPreservedArgsForEnvPull,
@@ -34,7 +34,7 @@ import {
34
34
  require_string_width,
35
35
  require_strip_ansi,
36
36
  yesOption
37
- } from "./chunk-4GQQJY5Y.js";
37
+ } from "./chunk-H33IJ7OP.js";
38
38
  import {
39
39
  APIError,
40
40
  CantParseJSONFile,
@@ -24051,7 +24051,7 @@ var require_auto_detect = __commonJS({
24051
24051
  var SERVICES_DIR = "services";
24052
24052
  var FRONTEND_LOCATIONS = [FRONTEND_DIR, APPS_WEB_DIR];
24053
24053
  async function autoDetectServices2(options) {
24054
- const { fs: fs5 } = options;
24054
+ const { fs: fs5, detectEntrypoint } = options;
24055
24055
  const rootFrameworks = await (0, import_detect_framework.detectFrameworks)({
24056
24056
  fs: fs5,
24057
24057
  frameworkList: import_frameworks2.frameworkList
@@ -24070,7 +24070,7 @@ var require_auto_detect = __commonJS({
24070
24070
  };
24071
24071
  }
24072
24072
  if (rootFrameworks.length === 1) {
24073
- return detectServicesAtRoot(fs5, rootFrameworks[0]);
24073
+ return detectServicesAtRoot(fs5, rootFrameworks[0], detectEntrypoint);
24074
24074
  }
24075
24075
  for (const frontendLocation of FRONTEND_LOCATIONS) {
24076
24076
  const hasFrontendDir = await fs5.hasPath(frontendLocation);
@@ -24099,7 +24099,8 @@ var require_auto_detect = __commonJS({
24099
24099
  return detectServicesFrontendSubdir(
24100
24100
  fs5,
24101
24101
  frontendFrameworks[0],
24102
- frontendLocation
24102
+ frontendLocation,
24103
+ detectEntrypoint
24103
24104
  );
24104
24105
  }
24105
24106
  }
@@ -24114,13 +24115,13 @@ var require_auto_detect = __commonJS({
24114
24115
  ]
24115
24116
  };
24116
24117
  }
24117
- async function detectServicesAtRoot(fs5, rootFramework) {
24118
+ async function detectServicesAtRoot(fs5, rootFramework, detectEntrypoint) {
24118
24119
  const services = {};
24119
24120
  services.frontend = {
24120
24121
  framework: rootFramework.slug ?? void 0,
24121
24122
  routePrefix: "/"
24122
24123
  };
24123
- const backendResult = await detectBackendServices(fs5);
24124
+ const backendResult = await detectBackendServices(fs5, detectEntrypoint);
24124
24125
  if (backendResult.error) {
24125
24126
  return {
24126
24127
  services: null,
@@ -24142,15 +24143,15 @@ var require_auto_detect = __commonJS({
24142
24143
  errors: []
24143
24144
  };
24144
24145
  }
24145
- async function detectServicesFrontendSubdir(fs5, frontendFramework, frontendLocation) {
24146
+ async function detectServicesFrontendSubdir(fs5, frontendFramework, frontendLocation, detectEntrypoint) {
24146
24147
  const services = {};
24147
24148
  const serviceName = frontendLocation.split("/").pop() || "frontend";
24148
24149
  services[serviceName] = {
24149
24150
  framework: frontendFramework.slug ?? void 0,
24150
- entrypoint: frontendLocation,
24151
+ root: frontendLocation,
24151
24152
  routePrefix: "/"
24152
24153
  };
24153
- const backendResult = await detectBackendServices(fs5);
24154
+ const backendResult = await detectBackendServices(fs5, detectEntrypoint);
24154
24155
  if (backendResult.error) {
24155
24156
  return {
24156
24157
  services: null,
@@ -24177,16 +24178,24 @@ var require_auto_detect = __commonJS({
24177
24178
  errors: []
24178
24179
  };
24179
24180
  }
24180
- async function detectBackendServices(fs5) {
24181
+ async function detectBackendServices(fs5, detectEntrypoint) {
24181
24182
  const services = {};
24182
- const backendResult = await detectServiceInDir(fs5, BACKEND_DIR, "backend");
24183
+ const backendResult = await detectServiceInDir(
24184
+ fs5,
24185
+ BACKEND_DIR,
24186
+ "backend",
24187
+ detectEntrypoint
24188
+ );
24183
24189
  if (backendResult.error) {
24184
24190
  return { services: {}, error: backendResult.error };
24185
24191
  }
24186
24192
  if (backendResult.service) {
24187
24193
  services.backend = backendResult.service;
24188
24194
  }
24189
- const multiServicesResult = await detectServicesDirectory(fs5);
24195
+ const multiServicesResult = await detectServicesDirectory(
24196
+ fs5,
24197
+ detectEntrypoint
24198
+ );
24190
24199
  if (multiServicesResult.error) {
24191
24200
  return { services: {}, error: multiServicesResult.error };
24192
24201
  }
@@ -24205,7 +24214,7 @@ var require_auto_detect = __commonJS({
24205
24214
  Object.assign(services, multiServicesResult.services);
24206
24215
  return { services };
24207
24216
  }
24208
- async function detectServicesDirectory(fs5) {
24217
+ async function detectServicesDirectory(fs5, detectEntrypoint) {
24209
24218
  const services = {};
24210
24219
  const hasServicesDir = await fs5.hasPath(SERVICES_DIR);
24211
24220
  if (!hasServicesDir) {
@@ -24219,7 +24228,12 @@ var require_auto_detect = __commonJS({
24219
24228
  }
24220
24229
  const serviceName = entry.name;
24221
24230
  const serviceDir = `${SERVICES_DIR}/${serviceName}`;
24222
- const result = await detectServiceInDir(fs5, serviceDir, serviceName);
24231
+ const result = await detectServiceInDir(
24232
+ fs5,
24233
+ serviceDir,
24234
+ serviceName,
24235
+ detectEntrypoint
24236
+ );
24223
24237
  if (result.error) {
24224
24238
  return { services: {}, error: result.error };
24225
24239
  }
@@ -24229,7 +24243,7 @@ var require_auto_detect = __commonJS({
24229
24243
  }
24230
24244
  return { services };
24231
24245
  }
24232
- async function detectServiceInDir(fs5, dirPath, serviceName) {
24246
+ async function detectServiceInDir(fs5, dirPath, serviceName, detectEntrypoint) {
24233
24247
  const hasDirPath = await fs5.hasPath(dirPath);
24234
24248
  if (!hasDirPath) {
24235
24249
  return {};
@@ -24250,17 +24264,21 @@ var require_auto_detect = __commonJS({
24250
24264
  }
24251
24265
  };
24252
24266
  }
24253
- if (frameworks.length === 1) {
24254
- const framework = frameworks[0];
24255
- return {
24256
- service: {
24257
- framework: framework.slug ?? void 0,
24258
- entrypoint: dirPath,
24259
- routePrefix: `/_/${serviceName}`
24260
- }
24261
- };
24267
+ if (frameworks.length !== 1) {
24268
+ return {};
24262
24269
  }
24263
- return {};
24270
+ const framework = frameworks[0];
24271
+ const slug = framework.slug ?? void 0;
24272
+ const routePrefix = `/_/${serviceName}`;
24273
+ const detected = detectEntrypoint && !(0, import_utils4.isFrontendFramework)(slug) ? await detectEntrypoint({ workPath: dirPath, framework: slug }) : null;
24274
+ return {
24275
+ service: {
24276
+ framework: slug,
24277
+ root: dirPath,
24278
+ ...detected ? { entrypoint: detected.entrypoint } : {},
24279
+ routePrefix
24280
+ }
24281
+ };
24264
24282
  }
24265
24283
  }
24266
24284
  });
@@ -24326,7 +24344,7 @@ var require_detect_railway = __commonJS({
24326
24344
  "CVS"
24327
24345
  ]);
24328
24346
  async function detectRailwayServices(options) {
24329
- const { fs: fs5 } = options;
24347
+ const { fs: fs5, detectEntrypoint } = options;
24330
24348
  const { configs, warnings } = await findRailwayConfigs(fs5);
24331
24349
  if (configs.length === 0) {
24332
24350
  return { services: null, errors: [], warnings };
@@ -24389,10 +24407,20 @@ var require_detect_railway = __commonJS({
24389
24407
  continue;
24390
24408
  }
24391
24409
  const framework = frameworks[0];
24410
+ const slug = framework.slug ?? void 0;
24392
24411
  let serviceConfig = {};
24393
- serviceConfig.framework = framework.slug ?? void 0;
24412
+ serviceConfig.framework = slug;
24394
24413
  if (cf.dirPath !== ".") {
24395
- serviceConfig.entrypoint = cf.dirPath;
24414
+ serviceConfig.root = cf.dirPath;
24415
+ if (detectEntrypoint && !(0, import_utils4.isFrontendFramework)(slug)) {
24416
+ const detected = await detectEntrypoint({
24417
+ workPath: cf.dirPath,
24418
+ framework: slug
24419
+ });
24420
+ if (detected) {
24421
+ serviceConfig.entrypoint = detected.entrypoint;
24422
+ }
24423
+ }
24396
24424
  }
24397
24425
  if (cf.config.build?.buildCommand) {
24398
24426
  serviceConfig.buildCommand = cf.config.build.buildCommand;
@@ -27913,6 +27941,9 @@ var require_detect_services = __commonJS({
27913
27941
  if (service.type) {
27914
27942
  serviceConfig.type = service.type;
27915
27943
  }
27944
+ if (typeof service.root === "string") {
27945
+ serviceConfig.root = service.root;
27946
+ }
27916
27947
  if (typeof service.entrypoint === "string") {
27917
27948
  serviceConfig.entrypoint = service.entrypoint;
27918
27949
  }
@@ -27933,7 +27964,7 @@ var require_detect_services = __commonJS({
27933
27964
  return inferredConfig;
27934
27965
  }
27935
27966
  async function detectServices3(options) {
27936
- const { fs: fs5, workPath } = options;
27967
+ const { fs: fs5, workPath, detectEntrypoint } = options;
27937
27968
  const scopedFs = workPath ? fs5.chdir(workPath) : fs5;
27938
27969
  const { config: vercelConfig, error: configError } = await (0, import_utils4.readVercelConfig)(scopedFs);
27939
27970
  if (configError) {
@@ -27957,7 +27988,7 @@ var require_detect_services = __commonJS({
27957
27988
  { detect: import_auto_detect.autoDetectServices, source: "layout" }
27958
27989
  ];
27959
27990
  for (const { detect, source } of detectors) {
27960
- const detectResult = await detect({ fs: scopedFs });
27991
+ const detectResult = await detect({ fs: scopedFs, detectEntrypoint });
27961
27992
  const match = await tryResolveInferred(detectResult, source, scopedFs);
27962
27993
  if (match)
27963
27994
  return match;
@@ -50082,6 +50113,27 @@ async function getTeamById(client, teamId) {
50082
50113
  return team;
50083
50114
  }
50084
50115
 
50116
+ // src/util/projects/get-org-by-id.ts
50117
+ async function getOrgById(client, orgId) {
50118
+ if (orgId.startsWith("team_")) {
50119
+ try {
50120
+ const team = await getTeamById(client, orgId);
50121
+ if (!team)
50122
+ return null;
50123
+ return { type: "team", id: team.id, slug: team.slug };
50124
+ } catch (err) {
50125
+ if (isAPIError(err) && (err.status === 404 || err.code === "not_found" || err.code === "mock_unimplemented")) {
50126
+ return null;
50127
+ }
50128
+ throw err;
50129
+ }
50130
+ }
50131
+ const user = await getUser(client);
50132
+ if (user.id !== orgId)
50133
+ return null;
50134
+ return { type: "user", id: orgId, slug: user.username };
50135
+ }
50136
+
50085
50137
  // src/util/fs.ts
50086
50138
  import fs from "fs";
50087
50139
  function isDirectory(targetPath) {
@@ -53358,7 +53410,7 @@ async function envPullCommandLogic(client, filename, skipConfirmation, environme
53358
53410
  let isGitIgnoreUpdated = false;
53359
53411
  if (filename === ".env.local") {
53360
53412
  const rootPath = link.repoRoot ?? cwd;
53361
- isGitIgnoreUpdated = await addToGitIgnore(rootPath, ".env*.local");
53413
+ isGitIgnoreUpdated = await addToGitIgnore(rootPath, ".env*");
53362
53414
  }
53363
53415
  output_manager_default.print(
53364
53416
  `${prependEmoji(
@@ -54286,14 +54338,24 @@ function getVercelDirectory(cwd) {
54286
54338
  }
54287
54339
  return existingDirs[0] || possibleDirs[0];
54288
54340
  }
54289
- async function getProjectLink(client, path, projectName) {
54341
+ async function getProjectLink(client, path, projectName, projectNameIsExplicit) {
54290
54342
  const dirLink = await getLinkFromDir(getVercelDirectory(path));
54291
54343
  if (dirLink) {
54292
- return dirLink;
54344
+ if (!projectNameIsExplicit || !projectName) {
54345
+ return dirLink;
54346
+ }
54347
+ if (dirLink.projectId === projectName || dirLink.projectName === projectName) {
54348
+ return dirLink;
54349
+ }
54293
54350
  }
54294
- return await getProjectLinkFromRepoLink(client, path, projectName);
54351
+ return await getProjectLinkFromRepoLink(
54352
+ client,
54353
+ path,
54354
+ projectName,
54355
+ projectNameIsExplicit
54356
+ );
54295
54357
  }
54296
- async function getProjectLinkFromRepoLink(client, path, projectName) {
54358
+ async function getProjectLinkFromRepoLink(client, path, projectName, projectNameIsExplicit) {
54297
54359
  const repoLink = await getRepoLink(client, path);
54298
54360
  if (!repoLink?.repoConfig) {
54299
54361
  return null;
@@ -54303,12 +54365,18 @@ async function getProjectLinkFromRepoLink(client, path, projectName) {
54303
54365
  relative(repoLink.rootPath, path)
54304
54366
  );
54305
54367
  let project;
54306
- if (projects.length === 1) {
54368
+ if (projectName && projectNameIsExplicit) {
54369
+ project = repoLink.repoConfig.projects.find(
54370
+ (p) => p.id === projectName || p.name === projectName
54371
+ );
54372
+ } else if (projects.length === 1) {
54307
54373
  project = projects[0];
54308
54374
  } else {
54309
54375
  const selectableProjects = projects.length > 0 ? projects : repoLink.repoConfig.projects;
54310
54376
  if (projectName) {
54311
- project = selectableProjects.find((p) => p.name === projectName);
54377
+ project = selectableProjects.find(
54378
+ (p) => p.id === projectName || p.name === projectName
54379
+ );
54312
54380
  }
54313
54381
  if (!project) {
54314
54382
  if (client.nonInteractive) {
@@ -54379,25 +54447,6 @@ async function getLinkFromDir(dir) {
54379
54447
  throw err;
54380
54448
  }
54381
54449
  }
54382
- async function getOrgById(client, orgId) {
54383
- if (orgId.startsWith("team_")) {
54384
- try {
54385
- const team = await getTeamById(client, orgId);
54386
- if (!team)
54387
- return null;
54388
- return { type: "team", id: team.id, slug: team.slug };
54389
- } catch (err) {
54390
- if (isAPIError(err) && (err.status === 404 || err.code === "not_found" || err.code === "mock_unimplemented")) {
54391
- return null;
54392
- }
54393
- throw err;
54394
- }
54395
- }
54396
- const user = await getUser(client);
54397
- if (user.id !== orgId)
54398
- return null;
54399
- return { type: "user", id: orgId, slug: user.username };
54400
- }
54401
54450
  async function hasProjectLink(client, projectLink, path) {
54402
54451
  const VERCEL_ORG_ID = getPlatformEnv("ORG_ID");
54403
54452
  const VERCEL_PROJECT_ID = getPlatformEnv("PROJECT_ID");
@@ -54427,7 +54476,7 @@ async function hasProjectLink(client, projectLink, path) {
54427
54476
  }
54428
54477
  return false;
54429
54478
  }
54430
- async function getLinkedProject(client, path = client.cwd, projectName) {
54479
+ async function getLinkedProject(client, path = client.cwd, projectName, apiFallback) {
54431
54480
  path = await resolveProjectCwd(path);
54432
54481
  const VERCEL_ORG_ID = getPlatformEnv("ORG_ID");
54433
54482
  const VERCEL_PROJECT_ID = getPlatformEnv("PROJECT_ID");
@@ -54439,7 +54488,19 @@ async function getLinkedProject(client, path = client.cwd, projectName) {
54439
54488
  );
54440
54489
  return { status: "error", exitCode: 1 };
54441
54490
  }
54442
- const link = VERCEL_ORG_ID && VERCEL_PROJECT_ID ? { orgId: VERCEL_ORG_ID, projectId: VERCEL_PROJECT_ID } : await getProjectLink(client, path, projectName);
54491
+ let link = VERCEL_ORG_ID && VERCEL_PROJECT_ID ? { orgId: VERCEL_ORG_ID, projectId: VERCEL_PROJECT_ID } : await getProjectLink(client, path, projectName, apiFallback);
54492
+ if (!link && projectName && apiFallback) {
54493
+ try {
54494
+ const apiProject = await getProjectByNameOrId(client, projectName);
54495
+ if (!(apiProject instanceof ProjectNotFound)) {
54496
+ link = {
54497
+ projectId: apiProject.id,
54498
+ orgId: apiProject.accountId
54499
+ };
54500
+ }
54501
+ } catch {
54502
+ }
54503
+ }
54443
54504
  if (!link) {
54444
54505
  return { status: "not_linked", org: null, project: null };
54445
54506
  }
@@ -4,9 +4,16 @@ import { dirname as __dirname_ } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __dirname_(__filename);
7
+ import {
8
+ AGENT_REASON,
9
+ AGENT_STATUS
10
+ } from "./chunk-L6Q2EQPI.js";
7
11
  import {
8
12
  getLocalPathConfig
9
- } from "./chunk-QAA3JVFJ.js";
13
+ } from "./chunk-B3RJGSB2.js";
14
+ import {
15
+ getScope
16
+ } from "./chunk-W64ECC2K.js";
10
17
  import {
11
18
  VERCEL_DIR_PROJECT,
12
19
  VERCEL_DIR_README,
@@ -39,13 +46,18 @@ import {
39
46
  selectAndParseRemoteUrl,
40
47
  selectOrg,
41
48
  writeServicesConfig
42
- } from "./chunk-FKUVFVT2.js";
49
+ } from "./chunk-RNIZUKES.js";
50
+ import {
51
+ buildCommandWithGlobalFlags,
52
+ outputAgentError,
53
+ shouldEmitNonInteractiveCommandError
54
+ } from "./chunk-ULXHXZCZ.js";
43
55
  import {
44
56
  table
45
- } from "./chunk-DKD6GTQT.js";
57
+ } from "./chunk-OM5Z2KO5.js";
46
58
  import {
47
59
  printError
48
- } from "./chunk-4GQQJY5Y.js";
60
+ } from "./chunk-H33IJ7OP.js";
49
61
  import {
50
62
  CantParseJSONFile,
51
63
  ProjectNotFound,
@@ -148,6 +160,53 @@ async function readConfig(dir) {
148
160
  return null;
149
161
  }
150
162
 
163
+ // src/util/projects/project-not-found-error.ts
164
+ async function printProjectNotFoundError(client, projectNameOrId, commandName) {
165
+ let contextName;
166
+ try {
167
+ const scope = await getScope(client);
168
+ contextName = scope.contextName;
169
+ } catch (err) {
170
+ output_manager_default.debug(`getScope failed during error reporting: ${err}`);
171
+ }
172
+ const scopeClause = contextName ? ` (${contextName})` : "";
173
+ const headline = `Project "${projectNameOrId}" was not found in the current scope${scopeClause}.`;
174
+ output_manager_default.error(
175
+ `${headline}
176
+
177
+ If it lives in a different team or account:
178
+ \u2022 Retry with \`--scope <team-slug|your-username>\`, or
179
+ \u2022 Run \`vercel switch <team-slug|your-username>\` to change scope.
180
+
181
+ List accessible teams with \`vercel teams ls\`.`
182
+ );
183
+ if (!shouldEmitNonInteractiveCommandError(client)) {
184
+ return;
185
+ }
186
+ const retryWithScope = buildCommandWithGlobalFlags(
187
+ client.argv,
188
+ `${commandName} --project ${projectNameOrId} --scope <team-slug>`
189
+ );
190
+ outputAgentError(
191
+ client,
192
+ {
193
+ status: AGENT_STATUS.ERROR,
194
+ reason: AGENT_REASON.PROJECT_NOT_FOUND,
195
+ message: `${headline} If it lives in a different team or account, retry with --scope <team-slug|your-username> or run \`vercel switch <team-slug|your-username>\` to change scope.`,
196
+ ...contextName ? { scope: contextName } : {},
197
+ next: [
198
+ { command: "vercel teams ls", when: "list accessible teams" },
199
+ { command: retryWithScope, when: "retry with a specific team" },
200
+ {
201
+ command: "vercel switch <team-slug>",
202
+ when: "change the default scope"
203
+ }
204
+ ]
205
+ },
206
+ 1
207
+ );
208
+ }
209
+
151
210
  // src/util/input/display-services.ts
152
211
  var import_frameworks = __toESM(require_frameworks(), 1);
153
212
  import {
@@ -1479,5 +1538,6 @@ export {
1479
1538
  validatePaths,
1480
1539
  readConfig,
1481
1540
  displayDetectedServices,
1482
- setupAndLink
1541
+ setupAndLink,
1542
+ printProjectNotFoundError
1483
1543
  };
@@ -7,23 +7,23 @@ const __dirname = __dirname_(__filename);
7
7
  import {
8
8
  getUpdateCommand,
9
9
  isGlobal
10
- } from "./chunk-ISJJTUJZ.js";
10
+ } from "./chunk-5TTQBT67.js";
11
11
  import {
12
12
  getGlobalPathConfig,
13
13
  login,
14
14
  writeToConfigFile
15
- } from "./chunk-VKQT3HCH.js";
15
+ } from "./chunk-PXR6WCEU.js";
16
16
  import {
17
17
  apiCommand,
18
18
  listSubcommand2 as listSubcommand,
19
19
  loginCommand
20
- } from "./chunk-23UWSHRQ.js";
20
+ } from "./chunk-HFVP2JUO.js";
21
21
  import {
22
22
  help
23
- } from "./chunk-H7ZZXKJ2.js";
23
+ } from "./chunk-TTOZFGDX.js";
24
24
  import {
25
25
  TelemetryClient
26
- } from "./chunk-KSMF2UFR.js";
26
+ } from "./chunk-4CIXZOP4.js";
27
27
  import {
28
28
  require_ms
29
29
  } from "./chunk-CO5D46AG.js";
@@ -32,7 +32,7 @@ import {
32
32
  parseArguments,
33
33
  printError,
34
34
  require_strip_ansi
35
- } from "./chunk-4GQQJY5Y.js";
35
+ } from "./chunk-H33IJ7OP.js";
36
36
  import {
37
37
  packageName
38
38
  } from "./chunk-UGXBNJMO.js";
@@ -6,10 +6,10 @@ const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __dirname_(__filename);
7
7
  import {
8
8
  table
9
- } from "./chunk-DKD6GTQT.js";
9
+ } from "./chunk-OM5Z2KO5.js";
10
10
  import {
11
11
  require_strip_ansi
12
- } from "./chunk-4GQQJY5Y.js";
12
+ } from "./chunk-H33IJ7OP.js";
13
13
  import {
14
14
  require_source
15
15
  } from "./chunk-S7KYDPEM.js";
@@ -7,10 +7,10 @@ const __dirname = __dirname_(__filename);
7
7
  import {
8
8
  AGENT_REASON,
9
9
  AGENT_STATUS
10
- } from "./chunk-E3NE4SKN.js";
10
+ } from "./chunk-L6Q2EQPI.js";
11
11
  import {
12
12
  getLinkedProject
13
- } from "./chunk-FKUVFVT2.js";
13
+ } from "./chunk-RNIZUKES.js";
14
14
  import {
15
15
  buildCommandWithYes,
16
16
  outputAgentError
@@ -20,7 +20,7 @@ import {
20
20
  getGlobalFlagsOnlyFromArgs,
21
21
  parseArguments,
22
22
  printError
23
- } from "./chunk-4GQQJY5Y.js";
23
+ } from "./chunk-H33IJ7OP.js";
24
24
  import {
25
25
  getCommandName,
26
26
  getCommandNamePlain
@@ -6,11 +6,12 @@ const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __dirname_(__filename);
7
7
  import {
8
8
  rulesAggregateCommand
9
- } from "./chunk-XVAEOG4L.js";
9
+ } from "./chunk-3TDGMELF.js";
10
10
  import {
11
11
  formatOption,
12
- limitOption
13
- } from "./chunk-4GQQJY5Y.js";
12
+ limitOption,
13
+ projectOption
14
+ } from "./chunk-H33IJ7OP.js";
14
15
  import {
15
16
  packageName
16
17
  } from "./chunk-UGXBNJMO.js";
@@ -39,11 +40,8 @@ var inspectSubcommand = {
39
40
  options: [
40
41
  formatOption,
41
42
  {
42
- name: "project",
43
+ ...projectOption,
43
44
  shorthand: "p",
44
- type: String,
45
- argument: "NAME_OR_ID",
46
- deprecated: false,
47
45
  description: "Filter by project (overrides auto-detected linked project)."
48
46
  },
49
47
  {
@@ -81,11 +79,8 @@ var alertsCommand = {
81
79
  description: "Filter by alert type. Repeatable and comma-separated (for example --type usage_anomaly,error_anomaly)."
82
80
  },
83
81
  {
84
- name: "project",
82
+ ...projectOption,
85
83
  shorthand: "p",
86
- type: String,
87
- argument: "NAME_OR_ID",
88
- deprecated: false,
89
84
  description: "Filter by project (overrides auto-detected linked project)."
90
85
  },
91
86
  {
@@ -6,14 +6,14 @@ const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __dirname_(__filename);
7
7
  import {
8
8
  require_dist
9
- } from "./chunk-KSMF2UFR.js";
9
+ } from "./chunk-4CIXZOP4.js";
10
10
  import {
11
11
  noBorderChars,
12
12
  require_cli_table3
13
- } from "./chunk-DKD6GTQT.js";
13
+ } from "./chunk-OM5Z2KO5.js";
14
14
  import {
15
15
  globalCommandOptions
16
- } from "./chunk-4GQQJY5Y.js";
16
+ } from "./chunk-H33IJ7OP.js";
17
17
  import {
18
18
  require_source
19
19
  } from "./chunk-S7KYDPEM.js";
@@ -11,7 +11,7 @@ import {
11
11
  getTeamById,
12
12
  getUser,
13
13
  getVercelDirectory
14
- } from "./chunk-FKUVFVT2.js";
14
+ } from "./chunk-RNIZUKES.js";
15
15
  import {
16
16
  TeamDeleted
17
17
  } from "./chunk-UGXBNJMO.js";
@@ -5,8 +5,9 @@ const require = __createRequire(import.meta.url);
5
5
  const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __dirname_(__filename);
7
7
  import {
8
- formatOption
9
- } from "./chunk-4GQQJY5Y.js";
8
+ formatOption,
9
+ projectOption
10
+ } from "./chunk-H33IJ7OP.js";
10
11
  import {
11
12
  packageName
12
13
  } from "./chunk-UGXBNJMO.js";
@@ -111,12 +112,8 @@ var metricsCommand = {
111
112
  argument: "SIZE"
112
113
  },
113
114
  {
114
- name: "project",
115
- shorthand: "p",
116
- type: String,
117
- deprecated: false,
118
- description: "Project name or ID (default: linked project)",
119
- argument: "NAME_OR_ID"
115
+ ...projectOption,
116
+ shorthand: "p"
120
117
  },
121
118
  {
122
119
  name: "all",
@@ -7,8 +7,9 @@ const __dirname = __dirname_(__filename);
7
7
  import {
8
8
  formatOption,
9
9
  limitOption,
10
- nextOption
11
- } from "./chunk-4GQQJY5Y.js";
10
+ nextOption,
11
+ projectOption
12
+ } from "./chunk-H33IJ7OP.js";
12
13
  import {
13
14
  packageName
14
15
  } from "./chunk-UGXBNJMO.js";
@@ -77,11 +78,8 @@ var activityCommand = {
77
78
  description: "Show events before this date (ISO 8601 or relative)."
78
79
  },
79
80
  {
80
- name: "project",
81
+ ...projectOption,
81
82
  shorthand: "p",
82
- type: String,
83
- argument: "NAME_OR_ID",
84
- deprecated: false,
85
83
  description: "Filter by project (overrides auto-detected linked project)."
86
84
  },
87
85
  {
@@ -6,7 +6,7 @@ const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __dirname_(__filename);
7
7
  import {
8
8
  TelemetryClient
9
- } from "./chunk-KSMF2UFR.js";
9
+ } from "./chunk-4CIXZOP4.js";
10
10
 
11
11
  // src/util/telemetry/commands/routes/index.ts
12
12
  var RoutesTelemetryClient = class extends TelemetryClient {
@@ -7,7 +7,7 @@ const __dirname = __dirname_(__filename);
7
7
  import {
8
8
  formatCondition,
9
9
  formatTransform
10
- } from "./chunk-DP5346AR.js";
10
+ } from "./chunk-SXYVZF6H.js";
11
11
  import {
12
12
  output_manager_default
13
13
  } from "./chunk-ZQKJVHXY.js";