vercel 46.0.0 → 46.0.2-canary.a0bfa7a5

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 (2) hide show
  1. package/dist/index.js +565 -565
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -93,7 +93,7 @@ var require_dist2 = __commonJS2({
93
93
  var __toCommonJS4 = (mod) => __copyProps4(__defProp4({}, "__esModule", { value: true }), mod);
94
94
  var src_exports2 = {};
95
95
  __export4(src_exports2, {
96
- errorToString: () => errorToString15,
96
+ errorToString: () => errorToString14,
97
97
  isErrnoException: () => isErrnoException20,
98
98
  isError: () => isError14,
99
99
  isErrorLike: () => isErrorLike2,
@@ -111,7 +111,7 @@ var require_dist2 = __commonJS2({
111
111
  return isError14(error3) && "code" in error3;
112
112
  };
113
113
  var isErrorLike2 = (error3) => isObject2(error3) && "message" in error3;
114
- var errorToString15 = (error3, fallback) => {
114
+ var errorToString14 = (error3, fallback) => {
115
115
  if (isError14(error3) || isErrorLike2(error3))
116
116
  return error3.message;
117
117
  if (typeof error3 === "string")
@@ -121,7 +121,7 @@ var require_dist2 = __commonJS2({
121
121
  var normalizeError3 = (error3) => {
122
122
  if (isError14(error3))
123
123
  return error3;
124
- const errorMessage = errorToString15(error3);
124
+ const errorMessage = errorToString14(error3);
125
125
  return isErrorLike2(error3) ? Object.assign(new Error(errorMessage), error3) : new Error(errorMessage);
126
126
  };
127
127
  function isSpawnError2(v) {
@@ -33261,7 +33261,7 @@ var init_command20 = __esm({
33261
33261
  loginCommand = {
33262
33262
  name: "login",
33263
33263
  aliases: [],
33264
- description: "Authenticate using your email or team id.",
33264
+ description: "Sign in to your Vercel account.",
33265
33265
  arguments: [
33266
33266
  {
33267
33267
  name: "email or team id",
@@ -33274,41 +33274,29 @@ var init_command20 = __esm({
33274
33274
  description: "Log in with GitHub",
33275
33275
  shorthand: null,
33276
33276
  type: Boolean,
33277
- deprecated: false
33277
+ deprecated: true
33278
33278
  },
33279
33279
  {
33280
33280
  name: "oob",
33281
33281
  description: 'Log in with "out of band" authentication',
33282
33282
  shorthand: null,
33283
33283
  type: Boolean,
33284
- deprecated: false
33284
+ deprecated: true
33285
33285
  },
33286
- { name: "gitlab", shorthand: null, type: Boolean, deprecated: false },
33287
- { name: "bitbucket", shorthand: null, type: Boolean, deprecated: false },
33286
+ { name: "gitlab", shorthand: null, type: Boolean, deprecated: true },
33287
+ { name: "bitbucket", shorthand: null, type: Boolean, deprecated: true },
33288
33288
  {
33289
33289
  name: "future",
33290
33290
  description: "Sign in using OAuth Device Authorization",
33291
33291
  shorthand: null,
33292
33292
  type: Boolean,
33293
- deprecated: false
33293
+ deprecated: true
33294
33294
  }
33295
33295
  ],
33296
33296
  examples: [
33297
33297
  {
33298
- name: "Log into the Vercel platform",
33298
+ name: "Sign in to your Vercel account.",
33299
33299
  value: `${packageName} login`
33300
- },
33301
- {
33302
- name: "Log in using a specific email address",
33303
- value: `${packageName} login username@example.com`
33304
- },
33305
- {
33306
- name: 'Log in using a specific team "slug" for SAML Single Sign-On',
33307
- value: `${packageName} login acme`
33308
- },
33309
- {
33310
- name: 'Log in using GitHub in "out-of-band" mode',
33311
- value: `${packageName} login --github --oob`
33312
33300
  }
33313
33301
  ]
33314
33302
  };
@@ -33324,7 +33312,7 @@ var init_command21 = __esm({
33324
33312
  logoutCommand = {
33325
33313
  name: "logout",
33326
33314
  aliases: [],
33327
- description: "Logout the current authenticated user.",
33315
+ description: "Sign out the currently authenticated user.",
33328
33316
  arguments: [],
33329
33317
  options: [
33330
33318
  {
@@ -33332,12 +33320,12 @@ var init_command21 = __esm({
33332
33320
  description: "Sign out by calling the Vercel OAuth Revocation Endpoint.",
33333
33321
  shorthand: null,
33334
33322
  type: Boolean,
33335
- deprecated: false
33323
+ deprecated: true
33336
33324
  }
33337
33325
  ],
33338
33326
  examples: [
33339
33327
  {
33340
- name: "Logout from the CLI",
33328
+ name: "Sign out the currently authenticated user.",
33341
33329
  value: `${packageName} logout`
33342
33330
  }
33343
33331
  ]
@@ -41527,6 +41515,261 @@ var init_print_indications = __esm({
41527
41515
  }
41528
41516
  });
41529
41517
 
41518
+ // src/util/oauth.ts
41519
+ async function as() {
41520
+ if (!_as) {
41521
+ const discoveryResponse = await discoveryEndpointRequest(VERCEL_ISSUER);
41522
+ const [discoveryResponseError, as2] = await processDiscoveryEndpointResponse(discoveryResponse);
41523
+ if (discoveryResponseError) {
41524
+ throw discoveryResponseError;
41525
+ }
41526
+ _as = as2;
41527
+ }
41528
+ return _as;
41529
+ }
41530
+ async function discoveryEndpointRequest(issuer) {
41531
+ return await (0, import_node_fetch.default)(new URL(".well-known/openid-configuration", issuer), {
41532
+ headers: { "Content-Type": "application/json", "user-agent": userAgent }
41533
+ });
41534
+ }
41535
+ async function processDiscoveryEndpointResponse(response) {
41536
+ const json = await response.json();
41537
+ if (!response.ok) {
41538
+ return [new Error("Discovery endpoint request failed")];
41539
+ }
41540
+ if (typeof json !== "object" || json === null || !canParseURL(json.issuer) || !canParseURL(json.device_authorization_endpoint) || !canParseURL(json.token_endpoint) || !canParseURL(json.revocation_endpoint) || !canParseURL(json.jwks_uri) || !canParseURL(json.introspection_endpoint)) {
41541
+ return [new TypeError("Invalid discovery response")];
41542
+ }
41543
+ const issuer = new URL(json.issuer);
41544
+ if (issuer.href !== VERCEL_ISSUER.href) {
41545
+ return [new Error("Issuer mismatch")];
41546
+ }
41547
+ return [
41548
+ null,
41549
+ {
41550
+ issuer,
41551
+ device_authorization_endpoint: new URL(
41552
+ json.device_authorization_endpoint
41553
+ ),
41554
+ token_endpoint: new URL(json.token_endpoint),
41555
+ revocation_endpoint: new URL(json.revocation_endpoint),
41556
+ jwks_uri: new URL(json.jwks_uri),
41557
+ introspection_endpoint: new URL(json.introspection_endpoint)
41558
+ }
41559
+ ];
41560
+ }
41561
+ async function deviceAuthorizationRequest() {
41562
+ return await (0, import_node_fetch.default)((await as()).device_authorization_endpoint, {
41563
+ method: "POST",
41564
+ headers: {
41565
+ "Content-Type": "application/x-www-form-urlencoded",
41566
+ "user-agent": userAgent
41567
+ },
41568
+ body: new URLSearchParams({
41569
+ client_id: VERCEL_CLI_CLIENT_ID,
41570
+ scope: "openid offline_access"
41571
+ })
41572
+ });
41573
+ }
41574
+ async function processDeviceAuthorizationResponse(response) {
41575
+ const json = await response.json();
41576
+ if (!response.ok) {
41577
+ return [new OAuthError("Device authorization request failed", json)];
41578
+ }
41579
+ if (typeof json !== "object" || json === null)
41580
+ return [new TypeError("Expected response to be an object")];
41581
+ if (!("device_code" in json) || typeof json.device_code !== "string")
41582
+ return [new TypeError("Expected `device_code` to be a string")];
41583
+ if (!("user_code" in json) || typeof json.user_code !== "string")
41584
+ return [new TypeError("Expected `user_code` to be a string")];
41585
+ if (!("verification_uri" in json) || typeof json.verification_uri !== "string" || !canParseURL(json.verification_uri)) {
41586
+ return [new TypeError("Expected `verification_uri` to be a string")];
41587
+ }
41588
+ if (!("verification_uri_complete" in json) || typeof json.verification_uri_complete !== "string" || !canParseURL(json.verification_uri_complete)) {
41589
+ return [
41590
+ new TypeError("Expected `verification_uri_complete` to be a string")
41591
+ ];
41592
+ }
41593
+ if (!("expires_in" in json) || typeof json.expires_in !== "number")
41594
+ return [new TypeError("Expected `expires_in` to be a number")];
41595
+ if (!("interval" in json) || typeof json.interval !== "number")
41596
+ return [new TypeError("Expected `interval` to be a number")];
41597
+ return [
41598
+ null,
41599
+ {
41600
+ device_code: json.device_code,
41601
+ user_code: json.user_code,
41602
+ verification_uri: json.verification_uri,
41603
+ verification_uri_complete: json.verification_uri_complete,
41604
+ expiresAt: Date.now() + json.expires_in * 1e3,
41605
+ interval: json.interval
41606
+ }
41607
+ ];
41608
+ }
41609
+ async function deviceAccessTokenRequest(options) {
41610
+ try {
41611
+ return [
41612
+ null,
41613
+ await (0, import_node_fetch.default)((await as()).token_endpoint, {
41614
+ method: "POST",
41615
+ headers: {
41616
+ "Content-Type": "application/x-www-form-urlencoded",
41617
+ "user-agent": userAgent
41618
+ },
41619
+ body: new URLSearchParams({
41620
+ client_id: VERCEL_CLI_CLIENT_ID,
41621
+ grant_type: "urn:ietf:params:oauth:grant-type:device_code",
41622
+ ...options
41623
+ }),
41624
+ // TODO: Drop `node-fetch` and just use `signal`
41625
+ timeout: 10 * 1e3,
41626
+ // @ts-expect-error: Signal is part of `fetch` spec, should drop `node-fetch`
41627
+ signal: AbortSignal.timeout(10 * 1e3)
41628
+ })
41629
+ ];
41630
+ } catch (error3) {
41631
+ if (error3 instanceof Error)
41632
+ return [error3];
41633
+ return [
41634
+ new Error("An unknown error occurred. See the logs for details.", {
41635
+ cause: error3
41636
+ })
41637
+ ];
41638
+ }
41639
+ }
41640
+ async function processTokenResponse(response) {
41641
+ const json = await response.json();
41642
+ if (!response.ok) {
41643
+ return [new OAuthError("Device access token request failed", json)];
41644
+ }
41645
+ if (typeof json !== "object" || json === null)
41646
+ return [new TypeError("Expected response to be an object")];
41647
+ if (!("access_token" in json) || typeof json.access_token !== "string")
41648
+ return [new TypeError("Expected `access_token` to be a string")];
41649
+ if (!("token_type" in json) || json.token_type !== "Bearer")
41650
+ return [new TypeError('Expected `token_type` to be "Bearer"')];
41651
+ if (!("expires_in" in json) || typeof json.expires_in !== "number")
41652
+ return [new TypeError("Expected `expires_in` to be a number")];
41653
+ if ("refresh_token" in json && (typeof json.refresh_token !== "string" || !json.refresh_token))
41654
+ return [new TypeError("Expected `refresh_token` to be a string")];
41655
+ if ("scope" in json && typeof json.scope !== "string")
41656
+ return [new TypeError("Expected `scope` to be a string")];
41657
+ return [null, json];
41658
+ }
41659
+ async function revocationRequest(options) {
41660
+ return await (0, import_node_fetch.default)((await as()).revocation_endpoint, {
41661
+ method: "POST",
41662
+ headers: {
41663
+ "Content-Type": "application/x-www-form-urlencoded",
41664
+ "user-agent": userAgent
41665
+ },
41666
+ body: new URLSearchParams({ ...options, client_id: VERCEL_CLI_CLIENT_ID })
41667
+ });
41668
+ }
41669
+ async function processRevocationResponse(response) {
41670
+ if (response.ok)
41671
+ return [null, null];
41672
+ const json = await response.json();
41673
+ return [new OAuthError("Revocation request failed", json)];
41674
+ }
41675
+ async function refreshTokenRequest(options) {
41676
+ return await (0, import_node_fetch.default)((await as()).token_endpoint, {
41677
+ method: "POST",
41678
+ headers: {
41679
+ "Content-Type": "application/x-www-form-urlencoded",
41680
+ "user-agent": ua_default
41681
+ },
41682
+ body: new URLSearchParams({
41683
+ client_id: VERCEL_CLI_CLIENT_ID,
41684
+ grant_type: "refresh_token",
41685
+ ...options
41686
+ })
41687
+ });
41688
+ }
41689
+ function processOAuthErrorResponse(json) {
41690
+ if (typeof json !== "object" || json === null)
41691
+ return new TypeError("Expected response to be an object");
41692
+ if (!("error" in json) || typeof json.error !== "string")
41693
+ return new TypeError("Expected `error` to be a string");
41694
+ if ("error_description" in json && typeof json.error_description !== "string")
41695
+ return new TypeError("Expected `error_description` to be a string");
41696
+ if ("error_uri" in json && typeof json.error_uri !== "string")
41697
+ return new TypeError("Expected `error_uri` to be a string");
41698
+ return json;
41699
+ }
41700
+ function isOAuthError(error3) {
41701
+ return error3 instanceof OAuthError;
41702
+ }
41703
+ function canParseURL(url3) {
41704
+ try {
41705
+ return !!new URL(url3);
41706
+ } catch {
41707
+ return false;
41708
+ }
41709
+ }
41710
+ async function inspectTokenRequest(token) {
41711
+ return (0, import_node_fetch.default)((await as()).introspection_endpoint, {
41712
+ method: "POST",
41713
+ headers: {
41714
+ "Content-Type": "application/x-www-form-urlencoded",
41715
+ "user-agent": ua_default
41716
+ },
41717
+ body: new URLSearchParams({ token })
41718
+ });
41719
+ }
41720
+ async function processInspectTokenResponse(response) {
41721
+ try {
41722
+ const token = await response.json();
41723
+ if (!token || typeof token !== "object" || !("active" in token)) {
41724
+ throw new IntrospectionError("Invalid token introspection response");
41725
+ }
41726
+ return [null, token];
41727
+ } catch (cause) {
41728
+ return [new IntrospectionError("Could not introspect token.", { cause })];
41729
+ }
41730
+ }
41731
+ var import_node_fetch, import_os3, VERCEL_ISSUER, VERCEL_CLI_CLIENT_ID, userAgent, _as, OAuthError, IntrospectionError;
41732
+ var init_oauth = __esm({
41733
+ "src/util/oauth.ts"() {
41734
+ "use strict";
41735
+ import_node_fetch = __toESM3(require_lib7());
41736
+ init_ua();
41737
+ import_os3 = require("os");
41738
+ VERCEL_ISSUER = new URL("https://vercel.com");
41739
+ VERCEL_CLI_CLIENT_ID = "cl_HYyOPBNtFMfHhaUn9L4QPfTZz6TP47bp";
41740
+ userAgent = `${(0, import_os3.hostname)()} @ ${ua_default}`;
41741
+ OAuthError = class extends Error {
41742
+ constructor(message2, response) {
41743
+ var __super = (...args) => {
41744
+ super(...args);
41745
+ };
41746
+ const error3 = processOAuthErrorResponse(response);
41747
+ if (error3 instanceof TypeError) {
41748
+ const message3 = `Unexpected server response: ${JSON.stringify(response)}`;
41749
+ __super(message3);
41750
+ this.cause = new Error(message3, { cause: error3 });
41751
+ this.code = "server_error";
41752
+ return;
41753
+ }
41754
+ let cause = error3.error;
41755
+ if (error3.error_description)
41756
+ cause += `: ${error3.error_description}`;
41757
+ if (error3.error_uri)
41758
+ cause += ` (${error3.error_uri})`;
41759
+ __super(message2, { cause });
41760
+ this.cause = new Error(cause);
41761
+ this.code = error3.error;
41762
+ }
41763
+ };
41764
+ IntrospectionError = class extends Error {
41765
+ constructor() {
41766
+ super(...arguments);
41767
+ this.name = "IntrospectionError";
41768
+ }
41769
+ };
41770
+ }
41771
+ });
41772
+
41530
41773
  // ../../node_modules/.pnpm/is-docker@2.2.1/node_modules/is-docker/index.js
41531
41774
  var require_is_docker = __commonJS2({
41532
41775
  "../../node_modules/.pnpm/is-docker@2.2.1/node_modules/is-docker/index.js"(exports2, module2) {
@@ -42185,7 +42428,7 @@ function verify(client2, verificationToken, email2, provider, ssoUserId) {
42185
42428
  }
42186
42429
  if (!client2.authConfig.token) {
42187
42430
  const hyphens = new RegExp("-", "g");
42188
- const host = (0, import_os3.hostname)().replace(hyphens, " ").replace(".local", "");
42431
+ const host = (0, import_os4.hostname)().replace(hyphens, " ").replace(".local", "");
42189
42432
  const tokenName = `${getTitleName()} CLI on ${host} via ${provider}`;
42190
42433
  url3.searchParams.set("tokenName", tokenName);
42191
42434
  }
@@ -42194,12 +42437,12 @@ function verify(client2, verificationToken, email2, provider, ssoUserId) {
42194
42437
  }
42195
42438
  return client2.fetch(url3.href, { useCurrentTeam: false });
42196
42439
  }
42197
- var import_url2, import_os3;
42440
+ var import_url2, import_os4;
42198
42441
  var init_verify = __esm({
42199
42442
  "src/util/login/verify.ts"() {
42200
42443
  "use strict";
42201
42444
  import_url2 = require("url");
42202
- import_os3 = require("os");
42445
+ import_os4 = require("os");
42203
42446
  init_pkg_name();
42204
42447
  }
42205
42448
  });
@@ -42310,7 +42553,7 @@ var init_github = __esm({
42310
42553
  "src/util/login/github.ts"() {
42311
42554
  "use strict";
42312
42555
  import_url3 = require("url");
42313
- init_oauth();
42556
+ init_oauth2();
42314
42557
  }
42315
42558
  });
42316
42559
 
@@ -42324,7 +42567,7 @@ var init_google = __esm({
42324
42567
  "src/util/login/google.ts"() {
42325
42568
  "use strict";
42326
42569
  import_url4 = require("url");
42327
- init_oauth();
42570
+ init_oauth2();
42328
42571
  }
42329
42572
  });
42330
42573
 
@@ -42338,7 +42581,7 @@ var init_gitlab = __esm({
42338
42581
  "src/util/login/gitlab.ts"() {
42339
42582
  "use strict";
42340
42583
  import_url5 = require("url");
42341
- init_oauth();
42584
+ init_oauth2();
42342
42585
  }
42343
42586
  });
42344
42587
 
@@ -42357,7 +42600,7 @@ var init_bitbucket = __esm({
42357
42600
  "src/util/login/bitbucket.ts"() {
42358
42601
  "use strict";
42359
42602
  import_url6 = require("url");
42360
- init_oauth();
42603
+ init_oauth2();
42361
42604
  }
42362
42605
  });
42363
42606
 
@@ -42391,7 +42634,7 @@ async function prompt(client2, error3, outOfBand, ssoUserId) {
42391
42634
  const email2 = await readInput(client2, "Enter your email address:");
42392
42635
  result = await doEmailLogin(client2, email2, ssoUserId);
42393
42636
  } else if (choice === "saml") {
42394
- const slug = error3?.teamId || await readInput(client2, "Enter your Team slug:");
42637
+ const slug = error3?.scope || error3?.teamId || await readInput(client2, "Enter your Team slug:");
42395
42638
  result = await doSamlLogin(client2, slug, outOfBand, ssoUserId);
42396
42639
  }
42397
42640
  return result;
@@ -42558,7 +42801,7 @@ function isSSH() {
42558
42801
  return Boolean(process.env.SSH_CLIENT || process.env.SSH_TTY);
42559
42802
  }
42560
42803
  var import_http, import_open, import_url7, import_async_listen, import_is_docker;
42561
- var init_oauth = __esm({
42804
+ var init_oauth2 = __esm({
42562
42805
  "src/util/login/oauth.ts"() {
42563
42806
  "use strict";
42564
42807
  import_http = __toESM3(require("http"));
@@ -42576,17 +42819,53 @@ var init_oauth = __esm({
42576
42819
  });
42577
42820
 
42578
42821
  // src/util/login/saml.ts
42579
- function doSamlLogin(client2, teamIdOrSlug, outOfBand, ssoUserId) {
42822
+ async function doSamlLogin(client2, teamIdOrSlug, outOfBand, ssoUserId) {
42823
+ if (client2.authConfig.type === "oauth") {
42824
+ const { session_id, client_id } = await decodeToken(client2);
42825
+ const params2 = { session_id, client_id };
42826
+ const url4 = new import_url8.URL(
42827
+ `https://vercel.com/sso/${teamIdOrSlug}?${new URLSearchParams(params2).toString()}`
42828
+ );
42829
+ return doOauthLogin(
42830
+ client2,
42831
+ url4,
42832
+ "SAML Single Sign-On",
42833
+ outOfBand,
42834
+ ssoUserId
42835
+ );
42836
+ }
42580
42837
  const url3 = new import_url8.URL("/auth/sso", client2.apiUrl);
42581
42838
  url3.searchParams.set("teamId", teamIdOrSlug);
42582
42839
  return doOauthLogin(client2, url3, "SAML Single Sign-On", outOfBand, ssoUserId);
42583
42840
  }
42841
+ async function decodeToken(client2) {
42842
+ const { token } = client2.authConfig;
42843
+ if (!token) {
42844
+ throw new Error(
42845
+ `No existing credentials found. Please run \`vercel login\`.`
42846
+ );
42847
+ }
42848
+ const inspectResponse = await inspectTokenRequest(token);
42849
+ const [inspectError, inspectResult] = await processInspectTokenResponse(inspectResponse);
42850
+ if (inspectError)
42851
+ throw inspectError;
42852
+ if (!inspectResult.active || !inspectResult.session_id || !inspectResult.client_id) {
42853
+ throw new Error(
42854
+ `Invalid token type. Run \`vercel login\` to log-in and try again.`
42855
+ );
42856
+ }
42857
+ return {
42858
+ session_id: inspectResult.session_id,
42859
+ client_id: inspectResult.client_id
42860
+ };
42861
+ }
42584
42862
  var import_url8;
42585
42863
  var init_saml = __esm({
42586
42864
  "src/util/login/saml.ts"() {
42587
42865
  "use strict";
42588
42866
  import_url8 = require("url");
42589
42867
  init_oauth();
42868
+ init_oauth2();
42590
42869
  }
42591
42870
  });
42592
42871
 
@@ -42597,7 +42876,7 @@ async function reauthenticate(client2, error3) {
42597
42876
  `You must re-authenticate with SAML to use ${(0, import_chalk16.bold)(error3.scope)} scope.`
42598
42877
  );
42599
42878
  if (await client2.input.confirm(`Log in with SAML?`, true)) {
42600
- return doSamlLogin(client2, error3.teamId);
42879
+ return doSamlLogin(client2, error3.scope ?? error3.teamId);
42601
42880
  }
42602
42881
  } else {
42603
42882
  output_manager_default.log(`You must re-authenticate to use ${(0, import_chalk16.bold)(error3.scope)} scope.`);
@@ -60572,7 +60851,7 @@ var require_create_deployment = __commonJS2({
60572
60851
  var import_upload = require_upload();
60573
60852
  var import_utils4 = require_utils13();
60574
60853
  var import_errors4 = require_errors2();
60575
- var import_error_utils39 = require_dist2();
60854
+ var import_error_utils38 = require_dist2();
60576
60855
  var import_build_utils18 = require("@vercel/build-utils");
60577
60856
  var import_tar_fs2 = __toESM4(require_tar_fs());
60578
60857
  var import_zlib = require("zlib");
@@ -60654,7 +60933,7 @@ var require_create_deployment = __commonJS2({
60654
60933
  files = await (0, import_hashes.hashes)(fileList);
60655
60934
  }
60656
60935
  } catch (err) {
60657
- if (clientOptions.prebuilt && (0, import_error_utils39.isErrnoException)(err) && err.code === "ENOENT" && err.path) {
60936
+ if (clientOptions.prebuilt && (0, import_error_utils38.isErrnoException)(err) && err.code === "ENOENT" && err.path) {
60658
60937
  const errPath = (0, import_path41.relative)(workPath, err.path);
60659
60938
  err.message = `File does not exist: "${(0, import_path41.relative)(workPath, errPath)}"`;
60660
60939
  if (errPath.split(import_path41.sep).includes("node_modules")) {
@@ -60768,11 +61047,11 @@ var require_dist7 = __commonJS2({
60768
61047
  });
60769
61048
 
60770
61049
  // src/util/config/global-path.ts
60771
- var import_os4, import_fs, import_path3, import_xdg_app_paths2, isDirectory, getGlobalPathConfig, global_path_default;
61050
+ var import_os5, import_fs, import_path3, import_xdg_app_paths2, isDirectory, getGlobalPathConfig, global_path_default;
60772
61051
  var init_global_path = __esm({
60773
61052
  "src/util/config/global-path.ts"() {
60774
61053
  "use strict";
60775
- import_os4 = require("os");
61054
+ import_os5 = require("os");
60776
61055
  import_fs = __toESM3(require("fs"));
60777
61056
  import_path3 = __toESM3(require("path"));
60778
61057
  import_xdg_app_paths2 = __toESM3(require_xdg_app_paths());
@@ -60791,7 +61070,7 @@ var init_global_path = __esm({
60791
61070
  const possibleConfigPaths = [
60792
61071
  ...vercelDirectories,
60793
61072
  // latest vercel directory
60794
- import_path3.default.join((0, import_os4.homedir)(), ".now"),
61073
+ import_path3.default.join((0, import_os5.homedir)(), ".now"),
60795
61074
  // legacy config in user's home directory
60796
61075
  ...(0, import_xdg_app_paths2.default)("now").dataDirs()
60797
61076
  // legacy XDG directory
@@ -60982,233 +61261,6 @@ var init_promise = __esm({
60982
61261
  }
60983
61262
  });
60984
61263
 
60985
- // src/util/oauth.ts
60986
- async function as() {
60987
- if (!_as) {
60988
- const discoveryResponse = await discoveryEndpointRequest(VERCEL_ISSUER);
60989
- const [discoveryResponseError, as2] = await processDiscoveryEndpointResponse(discoveryResponse);
60990
- if (discoveryResponseError) {
60991
- throw discoveryResponseError;
60992
- }
60993
- _as = as2;
60994
- }
60995
- return _as;
60996
- }
60997
- async function discoveryEndpointRequest(issuer) {
60998
- return await (0, import_node_fetch.default)(new URL(".well-known/openid-configuration", issuer), {
60999
- headers: { "Content-Type": "application/json", "user-agent": userAgent }
61000
- });
61001
- }
61002
- async function processDiscoveryEndpointResponse(response) {
61003
- const json = await response.json();
61004
- if (!response.ok) {
61005
- return [new Error("Discovery endpoint request failed")];
61006
- }
61007
- if (typeof json !== "object" || json === null || !canParseURL(json.issuer) || !canParseURL(json.device_authorization_endpoint) || !canParseURL(json.token_endpoint) || !canParseURL(json.revocation_endpoint) || !canParseURL(json.jwks_uri)) {
61008
- return [new TypeError("Invalid discovery response")];
61009
- }
61010
- const issuer = new URL(json.issuer);
61011
- if (issuer.href !== VERCEL_ISSUER.href) {
61012
- return [new Error("Issuer mismatch")];
61013
- }
61014
- return [
61015
- null,
61016
- {
61017
- issuer,
61018
- device_authorization_endpoint: new URL(
61019
- json.device_authorization_endpoint
61020
- ),
61021
- token_endpoint: new URL(json.token_endpoint),
61022
- revocation_endpoint: new URL(json.revocation_endpoint),
61023
- jwks_uri: new URL(json.jwks_uri)
61024
- }
61025
- ];
61026
- }
61027
- async function deviceAuthorizationRequest() {
61028
- return await (0, import_node_fetch.default)((await as()).device_authorization_endpoint, {
61029
- method: "POST",
61030
- headers: {
61031
- "Content-Type": "application/x-www-form-urlencoded",
61032
- "user-agent": userAgent
61033
- },
61034
- body: new URLSearchParams({
61035
- client_id: VERCEL_CLI_CLIENT_ID,
61036
- scope: "openid offline_access"
61037
- })
61038
- });
61039
- }
61040
- async function processDeviceAuthorizationResponse(response) {
61041
- const json = await response.json();
61042
- if (!response.ok) {
61043
- return [new OAuthError("Device authorization request failed", json)];
61044
- }
61045
- if (typeof json !== "object" || json === null)
61046
- return [new TypeError("Expected response to be an object")];
61047
- if (!("device_code" in json) || typeof json.device_code !== "string")
61048
- return [new TypeError("Expected `device_code` to be a string")];
61049
- if (!("user_code" in json) || typeof json.user_code !== "string")
61050
- return [new TypeError("Expected `user_code` to be a string")];
61051
- if (!("verification_uri" in json) || typeof json.verification_uri !== "string" || !canParseURL(json.verification_uri)) {
61052
- return [new TypeError("Expected `verification_uri` to be a string")];
61053
- }
61054
- if (!("verification_uri_complete" in json) || typeof json.verification_uri_complete !== "string" || !canParseURL(json.verification_uri_complete)) {
61055
- return [
61056
- new TypeError("Expected `verification_uri_complete` to be a string")
61057
- ];
61058
- }
61059
- if (!("expires_in" in json) || typeof json.expires_in !== "number")
61060
- return [new TypeError("Expected `expires_in` to be a number")];
61061
- if (!("interval" in json) || typeof json.interval !== "number")
61062
- return [new TypeError("Expected `interval` to be a number")];
61063
- return [
61064
- null,
61065
- {
61066
- device_code: json.device_code,
61067
- user_code: json.user_code,
61068
- verification_uri: json.verification_uri,
61069
- verification_uri_complete: json.verification_uri_complete,
61070
- expiresAt: Date.now() + json.expires_in * 1e3,
61071
- interval: json.interval
61072
- }
61073
- ];
61074
- }
61075
- async function deviceAccessTokenRequest(options) {
61076
- try {
61077
- return [
61078
- null,
61079
- await (0, import_node_fetch.default)((await as()).token_endpoint, {
61080
- method: "POST",
61081
- headers: {
61082
- "Content-Type": "application/x-www-form-urlencoded",
61083
- "user-agent": userAgent
61084
- },
61085
- body: new URLSearchParams({
61086
- client_id: VERCEL_CLI_CLIENT_ID,
61087
- grant_type: "urn:ietf:params:oauth:grant-type:device_code",
61088
- ...options
61089
- }),
61090
- // TODO: Drop `node-fetch` and just use `signal`
61091
- timeout: 10 * 1e3,
61092
- // @ts-expect-error: Signal is part of `fetch` spec, should drop `node-fetch`
61093
- signal: AbortSignal.timeout(10 * 1e3)
61094
- })
61095
- ];
61096
- } catch (error3) {
61097
- if (error3 instanceof Error)
61098
- return [error3];
61099
- return [
61100
- new Error("An unknown error occurred. See the logs for details.", {
61101
- cause: error3
61102
- })
61103
- ];
61104
- }
61105
- }
61106
- async function processTokenResponse(response) {
61107
- const json = await response.json();
61108
- if (!response.ok) {
61109
- return [new OAuthError("Device access token request failed", json)];
61110
- }
61111
- if (typeof json !== "object" || json === null)
61112
- return [new TypeError("Expected response to be an object")];
61113
- if (!("access_token" in json) || typeof json.access_token !== "string")
61114
- return [new TypeError("Expected `access_token` to be a string")];
61115
- if (!("token_type" in json) || json.token_type !== "Bearer")
61116
- return [new TypeError('Expected `token_type` to be "Bearer"')];
61117
- if (!("expires_in" in json) || typeof json.expires_in !== "number")
61118
- return [new TypeError("Expected `expires_in` to be a number")];
61119
- if ("refresh_token" in json && (typeof json.refresh_token !== "string" || !json.refresh_token))
61120
- return [new TypeError("Expected `refresh_token` to be a string")];
61121
- if ("scope" in json && typeof json.scope !== "string")
61122
- return [new TypeError("Expected `scope` to be a string")];
61123
- return [null, json];
61124
- }
61125
- async function revocationRequest(options) {
61126
- return await (0, import_node_fetch.default)((await as()).revocation_endpoint, {
61127
- method: "POST",
61128
- headers: {
61129
- "Content-Type": "application/x-www-form-urlencoded",
61130
- "user-agent": userAgent
61131
- },
61132
- body: new URLSearchParams({ ...options, client_id: VERCEL_CLI_CLIENT_ID })
61133
- });
61134
- }
61135
- async function processRevocationResponse(response) {
61136
- if (response.ok)
61137
- return [null, null];
61138
- const json = await response.json();
61139
- return [new OAuthError("Revocation request failed", json)];
61140
- }
61141
- async function refreshTokenRequest(options) {
61142
- return await (0, import_node_fetch.default)((await as()).token_endpoint, {
61143
- method: "POST",
61144
- headers: {
61145
- "Content-Type": "application/x-www-form-urlencoded",
61146
- "user-agent": ua_default
61147
- },
61148
- body: new URLSearchParams({
61149
- client_id: VERCEL_CLI_CLIENT_ID,
61150
- grant_type: "refresh_token",
61151
- ...options
61152
- })
61153
- });
61154
- }
61155
- function processOAuthErrorResponse(json) {
61156
- if (typeof json !== "object" || json === null)
61157
- return new TypeError("Expected response to be an object");
61158
- if (!("error" in json) || typeof json.error !== "string")
61159
- return new TypeError("Expected `error` to be a string");
61160
- if ("error_description" in json && typeof json.error_description !== "string")
61161
- return new TypeError("Expected `error_description` to be a string");
61162
- if ("error_uri" in json && typeof json.error_uri !== "string")
61163
- return new TypeError("Expected `error_uri` to be a string");
61164
- return json;
61165
- }
61166
- function isOAuthError(error3) {
61167
- return error3 instanceof OAuthError;
61168
- }
61169
- function canParseURL(url3) {
61170
- try {
61171
- return !!new URL(url3);
61172
- } catch {
61173
- return false;
61174
- }
61175
- }
61176
- var import_node_fetch, import_os5, VERCEL_ISSUER, VERCEL_CLI_CLIENT_ID, userAgent, _as, OAuthError;
61177
- var init_oauth2 = __esm({
61178
- "src/util/oauth.ts"() {
61179
- "use strict";
61180
- import_node_fetch = __toESM3(require_lib7());
61181
- init_ua();
61182
- import_os5 = require("os");
61183
- VERCEL_ISSUER = new URL("https://vercel.com");
61184
- VERCEL_CLI_CLIENT_ID = "cl_HYyOPBNtFMfHhaUn9L4QPfTZz6TP47bp";
61185
- userAgent = `${(0, import_os5.hostname)()} @ ${ua_default}`;
61186
- OAuthError = class extends Error {
61187
- constructor(message2, response) {
61188
- var __super = (...args) => {
61189
- super(...args);
61190
- };
61191
- const error3 = processOAuthErrorResponse(response);
61192
- if (error3 instanceof TypeError) {
61193
- const message3 = `Unexpected server response: ${JSON.stringify(response)}`;
61194
- __super(message3);
61195
- this.cause = new Error(message3, { cause: error3 });
61196
- this.code = "server_error";
61197
- return;
61198
- }
61199
- let cause = error3.error;
61200
- if (error3.error_description)
61201
- cause += `: ${error3.error_description}`;
61202
- if (error3.error_uri)
61203
- cause += ` (${error3.error_uri})`;
61204
- __super(message2, { cause });
61205
- this.cause = new Error(cause);
61206
- this.code = error3.error;
61207
- }
61208
- };
61209
- }
61210
- });
61211
-
61212
61264
  // src/util/client.ts
61213
61265
  function isOAuthAuth(authConfig) {
61214
61266
  return authConfig.type === "oauth";
@@ -61243,7 +61295,7 @@ var init_client = __esm({
61243
61295
  import_error_utils6 = __toESM3(require_dist2());
61244
61296
  init_sleep();
61245
61297
  init_output_manager();
61246
- init_oauth2();
61298
+ init_oauth();
61247
61299
  isSAMLError = (v) => {
61248
61300
  return v && v.saml;
61249
61301
  };
@@ -61265,8 +61317,10 @@ var init_client = __esm({
61265
61317
  }
61266
61318
  throw error3;
61267
61319
  }
61268
- this.authConfig.token = result.token;
61269
- writeToAuthConfigFile(this.authConfig);
61320
+ if (this.authConfig.type !== "oauth") {
61321
+ this.authConfig.token = result.token;
61322
+ writeToAuthConfigFile(this.authConfig);
61323
+ }
61270
61324
  });
61271
61325
  this._onRetry = (error3) => {
61272
61326
  output_manager_default.debug(`Retrying: ${error3}
@@ -94353,6 +94407,15 @@ var init_telemetry = __esm({
94353
94407
  value: this.redactedValue
94354
94408
  });
94355
94409
  }
94410
+ trackLoginState(state) {
94411
+ if (state === "started")
94412
+ this.loginAttempt = (0, import_node_crypto.randomUUID)();
94413
+ if (this.loginAttempt) {
94414
+ this.track({ key: `login:attempt:${this.loginAttempt}`, value: state });
94415
+ }
94416
+ if (state !== "started")
94417
+ this.loginAttempt = void 0;
94418
+ }
94356
94419
  trackCliFlagHelp(command, subcommands) {
94357
94420
  let subcommand;
94358
94421
  if (subcommands) {
@@ -94363,9 +94426,6 @@ var init_telemetry = __esm({
94363
94426
  value: subcommand ? `${command}:${subcommand}` : command
94364
94427
  });
94365
94428
  }
94366
- trackCliFlagFuture(command) {
94367
- this.track({ key: "flag:future", value: command });
94368
- }
94369
94429
  };
94370
94430
  TelemetryEventStore = class {
94371
94431
  constructor(opts) {
@@ -114249,14 +114309,14 @@ var require_read_config_file = __commonJS2({
114249
114309
  var import_js_yaml = __toESM4(require_js_yaml2());
114250
114310
  var import_toml = __toESM4(require_toml());
114251
114311
  var import_fs9 = require("fs");
114252
- var import_error_utils39 = require_dist2();
114312
+ var import_error_utils38 = require_dist2();
114253
114313
  var { readFile: readFile6 } = import_fs9.promises;
114254
114314
  async function readFileOrNull(file) {
114255
114315
  try {
114256
114316
  const data = await readFile6(file);
114257
114317
  return data;
114258
114318
  } catch (error3) {
114259
- if (!(0, import_error_utils39.isErrnoException)(error3)) {
114319
+ if (!(0, import_error_utils38.isErrnoException)(error3)) {
114260
114320
  throw error3;
114261
114321
  }
114262
114322
  if (error3.code !== "ENOENT") {
@@ -116668,6 +116728,45 @@ var require_frameworks = __commonJS2({
116668
116728
  dependency: "express",
116669
116729
  getOutputDirName: async () => "public"
116670
116730
  },
116731
+ {
116732
+ name: "xmcp",
116733
+ slug: "xmcp",
116734
+ logo: "https://api-frameworks.vercel.sh/framework-logos/xmcp.svg",
116735
+ tagline: "The MCP framework for building AI-powered tools",
116736
+ description: "A framework for building Model Context Protocol servers with zero configuration.",
116737
+ website: "https://xmcp.dev",
116738
+ detectors: {
116739
+ some: [
116740
+ {
116741
+ path: "xmcp.config.ts"
116742
+ },
116743
+ {
116744
+ path: "xmcp.config.js"
116745
+ },
116746
+ {
116747
+ matchPackage: "xmcp"
116748
+ }
116749
+ ]
116750
+ },
116751
+ settings: {
116752
+ installCommand: {
116753
+ placeholder: "`yarn install`, `pnpm install`, `npm install`, or `bun install`"
116754
+ },
116755
+ buildCommand: {
116756
+ placeholder: "`npm run build` or `xmcp build`",
116757
+ value: "xmcp build --vercel"
116758
+ },
116759
+ devCommand: {
116760
+ value: "xmcp dev",
116761
+ placeholder: "xmcp dev"
116762
+ },
116763
+ outputDirectory: {
116764
+ value: "dist"
116765
+ }
116766
+ },
116767
+ dependency: "xmcp",
116768
+ getOutputDirName: async () => "dist"
116769
+ },
116671
116770
  {
116672
116771
  name: "Other",
116673
116772
  slug: null,
@@ -120051,7 +120150,7 @@ var require_local_file_system_detector = __commonJS2({
120051
120150
  var import_promises4 = __toESM4(require("fs/promises"));
120052
120151
  var import_path41 = require("path");
120053
120152
  var import_filesystem = require_filesystem();
120054
- var import_error_utils39 = require_dist2();
120153
+ var import_error_utils38 = require_dist2();
120055
120154
  var LocalFileSystemDetector5 = class _LocalFileSystemDetector extends import_filesystem.DetectorFilesystem {
120056
120155
  constructor(rootPath) {
120057
120156
  super();
@@ -120062,7 +120161,7 @@ var require_local_file_system_detector = __commonJS2({
120062
120161
  await import_promises4.default.stat(this.getFilePath(name));
120063
120162
  return true;
120064
120163
  } catch (err) {
120065
- if ((0, import_error_utils39.isErrnoException)(err) && err.code === "ENOENT") {
120164
+ if ((0, import_error_utils38.isErrnoException)(err) && err.code === "ENOENT") {
120066
120165
  return false;
120067
120166
  }
120068
120167
  throw err;
@@ -129843,15 +129942,15 @@ async function getStore2(client2, argv, rwToken) {
129843
129942
  method: "GET",
129844
129943
  accountId: link4.status === "linked" ? link4.org.id : void 0
129845
129944
  });
129846
- const dateTimeFormat3 = "MM/DD/YYYY HH:mm:ss.SS";
129945
+ const dateTimeFormat2 = "MM/DD/YYYY HH:mm:ss.SS";
129847
129946
  const regionInfo = store2.store.region ? `
129848
129947
  Region: ${store2.store.region}` : "";
129849
129948
  output_manager_default.print(
129850
129949
  `Blob Store: ${import_chalk40.default.bold(store2.store.name)} (${import_chalk40.default.dim(store2.store.id)})
129851
129950
  Billing State: ${store2.store.billingState === "active" ? import_chalk40.default.green("Active") : import_chalk40.default.red("Inactive")}
129852
129951
  Size: ${(0, import_bytes3.default)(store2.store.size)}${regionInfo}
129853
- Created At: ${(0, import_date_fns.format)(new Date(store2.store.createdAt), dateTimeFormat3)}
129854
- Updated At: ${(0, import_date_fns.format)(new Date(store2.store.updatedAt), dateTimeFormat3)}
129952
+ Created At: ${(0, import_date_fns.format)(new Date(store2.store.createdAt), dateTimeFormat2)}
129953
+ Updated At: ${(0, import_date_fns.format)(new Date(store2.store.updatedAt), dateTimeFormat2)}
129855
129954
  `
129856
129955
  );
129857
129956
  } catch (err) {
@@ -146777,7 +146876,7 @@ async function main4(client2) {
146777
146876
  if (!subcommand && needHelp) {
146778
146877
  telemetry2.trackCliFlagHelp(cacheCommand.name);
146779
146878
  output_manager_default.print(help2(cacheCommand, { columns: client2.stderr.columns }));
146780
- return 2;
146879
+ return 0;
146781
146880
  }
146782
146881
  function printHelp(command) {
146783
146882
  telemetry2.trackCliFlagHelp(command.name, subcommandOriginal);
@@ -178214,7 +178313,7 @@ async function link3(client2) {
178214
178313
  if (parsedArgs.flags["--help"]) {
178215
178314
  telemetry2.trackCliFlagHelp("link");
178216
178315
  output_manager_default.print(help2(linkCommand, { columns: client2.stderr.columns }));
178217
- return 2;
178316
+ return 0;
178218
178317
  }
178219
178318
  telemetry2.trackCliFlagRepo(parsedArgs.flags["--repo"]);
178220
178319
  telemetry2.trackCliFlagYes(parsedArgs.flags["--yes"]);
@@ -178394,7 +178493,7 @@ async function list5(client2) {
178394
178493
  if (parsedArgs.flags["--help"]) {
178395
178494
  telemetry2.trackCliFlagHelp("list");
178396
178495
  print(help2(listCommand, { columns: client2.stderr.columns }));
178397
- return 2;
178496
+ return 0;
178398
178497
  }
178399
178498
  if (parsedArgs.args.length > 2) {
178400
178499
  error3(`${getCommandName("ls [app]")} accepts at most one argument`);
@@ -178810,7 +178909,13 @@ async function logs(client2) {
178810
178909
  }
178811
178910
  return 1;
178812
178911
  }
178813
- printDisclaimer(deployment);
178912
+ output_manager_default.print(
178913
+ `Displaying runtime logs for deployment ${deployment.url} (${import_chalk106.default.dim(
178914
+ deployment.id
178915
+ )}) starting from ${import_chalk106.default.bold((0, import_format3.default)(Date.now(), DATE_TIME_FORMAT))}
178916
+
178917
+ `
178918
+ );
178814
178919
  const abortController = new AbortController();
178815
178920
  return await displayRuntimeLogs(
178816
178921
  client2,
@@ -178822,19 +178927,7 @@ async function logs(client2) {
178822
178927
  abortController
178823
178928
  );
178824
178929
  }
178825
- function printDisclaimer(deployment) {
178826
- output_manager_default.warn(
178827
- `This command now displays runtime logs. To access your build logs, run \`vercel inspect --logs ${deployment.url}\``
178828
- );
178829
- output_manager_default.print(
178830
- `Displaying runtime logs for deployment ${deployment.url} (${import_chalk106.default.dim(
178831
- deployment.id
178832
- )}) starting from ${import_chalk106.default.bold((0, import_format3.default)(Date.now(), dateTimeFormat2))}
178833
-
178834
- `
178835
- );
178836
- }
178837
- var import_error_utils30, import_chalk106, import_format3, deprecatedFlags, dateTimeFormat2;
178930
+ var import_error_utils30, import_chalk106, import_format3, deprecatedFlags, DATE_TIME_FORMAT;
178838
178931
  var init_logs3 = __esm({
178839
178932
  "src/commands/logs/index.ts"() {
178840
178933
  "use strict";
@@ -178864,7 +178957,7 @@ var init_logs3 = __esm({
178864
178957
  "--until",
178865
178958
  "--output"
178866
178959
  ];
178867
- dateTimeFormat2 = "MMM dd HH:mm:ss.SS";
178960
+ DATE_TIME_FORMAT = "MMM dd HH:mm:ss.SS";
178868
178961
  }
178869
178962
  });
178870
178963
 
@@ -179176,32 +179269,6 @@ var init_mcp2 = __esm({
179176
179269
  }
179177
179270
  });
179178
179271
 
179179
- // ../../node_modules/.pnpm/email-validator@1.1.1/node_modules/email-validator/index.js
179180
- var require_email_validator = __commonJS2({
179181
- "../../node_modules/.pnpm/email-validator@1.1.1/node_modules/email-validator/index.js"(exports2) {
179182
- "use strict";
179183
- var tester = /^[-!#$%&'*+\/0-9=?A-Z^_a-z{|}~](\.?[-!#$%&'*+\/0-9=?A-Z^_a-z`{|}~])*@[a-zA-Z0-9](-?\.?[a-zA-Z0-9])*\.[a-zA-Z](-?[a-zA-Z0-9])+$/;
179184
- exports2.validate = function(email2) {
179185
- if (!email2)
179186
- return false;
179187
- if (email2.length > 254)
179188
- return false;
179189
- var valid = tester.test(email2);
179190
- if (!valid)
179191
- return false;
179192
- var parts = email2.split("@");
179193
- if (parts[0].length > 64)
179194
- return false;
179195
- var domainParts = parts[1].split(".");
179196
- if (domainParts.some(function(part) {
179197
- return part.length > 63;
179198
- }))
179199
- return false;
179200
- return true;
179201
- };
179202
- }
179203
- });
179204
-
179205
179272
  // src/util/telemetry/commands/login/index.ts
179206
179273
  var LoginTelemetryClient;
179207
179274
  var init_login2 = __esm({
@@ -179209,12 +179276,72 @@ var init_login2 = __esm({
179209
179276
  "use strict";
179210
179277
  init_telemetry();
179211
179278
  LoginTelemetryClient = class extends TelemetryClient {
179279
+ /**
179280
+ * Tracks the state of the login process.
179281
+ * - `started` when the user initiates the login process.
179282
+ * - `canceled` when the user cancels the login process.
179283
+ * - `error` when the user encounters an error during the login process.
179284
+ * - `success` when the user successfully logs in.
179285
+ */
179286
+ trackState(...args2) {
179287
+ this.trackLoginState(...args2);
179288
+ }
179212
179289
  };
179213
179290
  }
179214
179291
  });
179215
179292
 
179216
- // src/commands/login/future.ts
179293
+ // src/commands/login/index.ts
179294
+ var login_exports = {};
179295
+ __export3(login_exports, {
179296
+ default: () => login2
179297
+ });
179217
179298
  async function login2(client2) {
179299
+ let parsedArgs = null;
179300
+ const flagsSpecification = getFlagsSpecification(loginCommand.options);
179301
+ const telemetry2 = new LoginTelemetryClient({
179302
+ opts: {
179303
+ store: client2.telemetryEventStore
179304
+ }
179305
+ });
179306
+ try {
179307
+ parsedArgs = parseArguments(client2.argv.slice(2), flagsSpecification);
179308
+ } catch (error4) {
179309
+ printError(error4);
179310
+ return 1;
179311
+ }
179312
+ if (parsedArgs.flags["--help"]) {
179313
+ telemetry2.trackCliFlagHelp("login");
179314
+ output_manager_default.print(help2(loginCommand, { columns: client2.stderr.columns }));
179315
+ return 0;
179316
+ }
179317
+ if (parsedArgs.flags["--token"]) {
179318
+ output_manager_default.error('`--token` may not be used with the "login" command');
179319
+ return 2;
179320
+ }
179321
+ const obsoleteFlags = Object.keys(parsedArgs.flags).filter((flag) => {
179322
+ const flagKey = flag.replace("--", "");
179323
+ const option = loginCommand.options.find((o) => o.name === flagKey);
179324
+ if (!option || typeof option === "number")
179325
+ return;
179326
+ return "deprecated" in option && option.deprecated;
179327
+ });
179328
+ if (obsoleteFlags.length) {
179329
+ const flags = obsoleteFlags.map((f) => import_chalk107.default.bold(f)).join(", ");
179330
+ output_manager_default.warn(`The following flags are deprecated: ${flags}`);
179331
+ }
179332
+ const obsoleteArguments = parsedArgs.args.slice(1);
179333
+ if (obsoleteArguments.length) {
179334
+ const args2 = obsoleteArguments.map((a) => import_chalk107.default.bold(a)).join(", ");
179335
+ output_manager_default.warn(`The following arguments are deprecated: ${args2}`);
179336
+ }
179337
+ if (obsoleteArguments.length || obsoleteFlags.length) {
179338
+ output_manager_default.print(
179339
+ // TODO: fix link
179340
+ `Read more in our ${output_manager_default.link("changelog", "https://vercel.com/changelog")}.
179341
+ `
179342
+ );
179343
+ }
179344
+ telemetry2.trackState("started");
179218
179345
  const deviceAuthorizationResponse = await deviceAuthorizationRequest();
179219
179346
  output_manager_default.debug(
179220
179347
  `'Device Authorization response:', ${await deviceAuthorizationResponse.clone().text()}`
@@ -179222,6 +179349,7 @@ async function login2(client2) {
179222
179349
  const [deviceAuthorizationError, deviceAuthorization] = await processDeviceAuthorizationResponse(deviceAuthorizationResponse);
179223
179350
  if (deviceAuthorizationError) {
179224
179351
  printError(deviceAuthorizationError);
179352
+ telemetry2.trackState("error");
179225
179353
  return 1;
179226
179354
  }
179227
179355
  const {
@@ -179232,6 +179360,7 @@ async function login2(client2) {
179232
179360
  expiresAt,
179233
179361
  interval
179234
179362
  } = deviceAuthorization;
179363
+ let rlClosed = false;
179235
179364
  const rl = import_node_readline.default.createInterface({
179236
179365
  input: process.stdin,
179237
179366
  output: process.stdout
@@ -179252,6 +179381,7 @@ async function login2(client2) {
179252
179381
  output_manager_default.print((0, import_ansi_escapes6.eraseLines)(2));
179253
179382
  output_manager_default.spinner("Waiting for authentication...");
179254
179383
  rl.close();
179384
+ rlClosed = true;
179255
179385
  }
179256
179386
  );
179257
179387
  output_manager_default.spinner("Waiting for authentication...");
@@ -179323,41 +179453,61 @@ async function login2(client2) {
179323
179453
  }
179324
179454
  error3 = await pollForToken();
179325
179455
  output_manager_default.stopSpinner();
179326
- rl.close();
179327
- if (!error3)
179456
+ if (!rlClosed) {
179457
+ rl.close();
179458
+ }
179459
+ if (!error3) {
179460
+ telemetry2.trackState("success");
179328
179461
  return 0;
179462
+ }
179463
+ telemetry2.trackState("error");
179329
179464
  printError(error3);
179330
179465
  return 1;
179331
179466
  }
179332
- var import_node_readline, import_chalk107, open6, import_ansi_escapes6;
179333
- var init_future = __esm({
179334
- "src/commands/login/future.ts"() {
179467
+ var import_chalk107, import_node_readline, open6, import_ansi_escapes6;
179468
+ var init_login3 = __esm({
179469
+ "src/commands/login/index.ts"() {
179335
179470
  "use strict";
179336
- import_node_readline = __toESM3(require("readline"));
179471
+ init_get_args();
179472
+ init_help();
179473
+ init_command20();
179474
+ init_get_flags_specification();
179475
+ init_error2();
179476
+ init_output_manager();
179477
+ init_login2();
179337
179478
  import_chalk107 = __toESM3(require_source());
179479
+ import_node_readline = __toESM3(require("readline"));
179338
179480
  open6 = __toESM3(require_open());
179339
179481
  import_ansi_escapes6 = __toESM3(require_ansi_escapes());
179340
- init_error2();
179341
179482
  init_update_current_team_after_login();
179342
179483
  init_global_path();
179343
179484
  init_pkg_name();
179344
179485
  init_emoji();
179345
179486
  init_humanize_path();
179346
- init_oauth2();
179347
- init_output_manager();
179487
+ init_oauth();
179348
179488
  }
179349
179489
  });
179350
179490
 
179351
- // src/commands/login/index.ts
179352
- var login_exports = {};
179353
- __export3(login_exports, {
179354
- default: () => login3
179491
+ // src/util/telemetry/commands/logout/index.ts
179492
+ var LogoutTelemetryClient;
179493
+ var init_logout = __esm({
179494
+ "src/util/telemetry/commands/logout/index.ts"() {
179495
+ "use strict";
179496
+ init_telemetry();
179497
+ LogoutTelemetryClient = class extends TelemetryClient {
179498
+ };
179499
+ }
179500
+ });
179501
+
179502
+ // src/commands/logout/index.ts
179503
+ var logout_exports = {};
179504
+ __export3(logout_exports, {
179505
+ default: () => logout
179355
179506
  });
179356
- async function login3(client2) {
179357
- const isInitialLogin = !client2.authConfig.token;
179507
+ async function logout(client2) {
179358
179508
  let parsedArgs = null;
179359
- const flagsSpecification = getFlagsSpecification(loginCommand.options);
179360
- const telemetry2 = new LoginTelemetryClient({
179509
+ const flagsSpecification = getFlagsSpecification(logoutCommand.options);
179510
+ const telemetry2 = new LogoutTelemetryClient({
179361
179511
  opts: {
179362
179512
  store: client2.telemetryEventStore
179363
179513
  }
@@ -179368,106 +179518,34 @@ async function login3(client2) {
179368
179518
  printError(error3);
179369
179519
  return 1;
179370
179520
  }
179371
- if (parsedArgs.flags["--future"]) {
179372
- telemetry2.trackCliFlagFuture("login");
179373
- return await login2(client2);
179374
- }
179375
179521
  if (parsedArgs.flags["--help"]) {
179376
- telemetry2.trackCliFlagHelp("login");
179377
- output_manager_default.print(help2(loginCommand, { columns: client2.stderr.columns }));
179378
- return 2;
179379
- }
179380
- if (parsedArgs.flags["--token"]) {
179381
- output_manager_default.error('`--token` may not be used with the "login" command');
179382
- return 2;
179383
- }
179384
- const input = parsedArgs.args[1];
179385
- let result = 1;
179386
- if (input) {
179387
- if ((0, import_email_validator.validate)(input)) {
179388
- result = await doEmailLogin(client2, input);
179389
- } else {
179390
- result = await doSamlLogin(client2, input, parsedArgs.flags["--oob"]);
179391
- }
179392
- } else if (parsedArgs.flags["--github"]) {
179393
- result = await doGithubLogin(client2, parsedArgs.flags["--oob"]);
179394
- } else if (parsedArgs.flags["--gitlab"]) {
179395
- result = await doGitlabLogin(client2, parsedArgs.flags["--oob"]);
179396
- } else if (parsedArgs.flags["--bitbucket"]) {
179397
- result = await doBitbucketLogin(client2, parsedArgs.flags["--oob"]);
179398
- } else {
179399
- result = await prompt(client2, void 0, parsedArgs.flags["--oob"]);
179400
- }
179401
- if (typeof result === "number") {
179402
- return result;
179522
+ telemetry2.trackCliFlagHelp("logout");
179523
+ output_manager_default.print(help2(logoutCommand, { columns: client2.stderr.columns }));
179524
+ return 0;
179403
179525
  }
179404
- client2.authConfig.token = result.token;
179405
- if (result.teamId) {
179406
- client2.config.currentTeam = result.teamId;
179407
- } else {
179408
- delete client2.config.currentTeam;
179526
+ const obsoleteFlags = Object.keys(parsedArgs.flags).filter((flag) => {
179527
+ const flagKey = flag.replace("--", "");
179528
+ const option = logoutCommand.options.find((o) => o.name === flagKey);
179529
+ if (!option || typeof option === "number")
179530
+ return;
179531
+ return "deprecated" in option && option.deprecated;
179532
+ });
179533
+ if (obsoleteFlags.length) {
179534
+ const flags = obsoleteFlags.map((f) => import_chalk108.default.bold(f)).join(", ");
179535
+ output_manager_default.warn(`The following flags are deprecated: ${flags}`);
179409
179536
  }
179410
- if (isInitialLogin) {
179411
- await updateCurrentTeamAfterLogin(client2, client2.config.currentTeam);
179537
+ const obsoleteArguments = parsedArgs.args.slice(1);
179538
+ if (obsoleteArguments.length) {
179539
+ const args2 = obsoleteArguments.map((a) => import_chalk108.default.bold(a)).join(", ");
179540
+ output_manager_default.warn(`The following arguments are deprecated: ${args2}`);
179412
179541
  }
179413
- writeToAuthConfigFile(client2.authConfig);
179414
- writeToConfigFile(client2.config);
179415
- output_manager_default.debug(`Saved credentials in "${humanizePath(global_path_default())}"`);
179416
- output_manager_default.print(
179417
- `${import_chalk108.default.cyan("Congratulations!")} You are now logged in. In order to deploy something, run ${getCommandName()}.
179418
- `
179419
- );
179420
- output_manager_default.print(
179421
- `${prependEmoji(
179422
- `Connect your Git Repositories to deploy every branch push automatically (https://vercel.link/git).`,
179423
- emoji("tip")
179424
- )}
179542
+ if (obsoleteArguments.length || obsoleteFlags.length) {
179543
+ output_manager_default.print(
179544
+ // TODO: fix link
179545
+ `Read more in our ${output_manager_default.link("changelog", "https://vercel.com/changelog")}.
179425
179546
  `
179426
- );
179427
- return 0;
179428
- }
179429
- var import_email_validator, import_chalk108;
179430
- var init_login3 = __esm({
179431
- "src/commands/login/index.ts"() {
179432
- "use strict";
179433
- import_email_validator = __toESM3(require_email_validator());
179434
- import_chalk108 = __toESM3(require_source());
179435
- init_humanize_path();
179436
- init_get_args();
179437
- init_prompt();
179438
- init_saml();
179439
- init_email();
179440
- init_github();
179441
- init_gitlab();
179442
- init_bitbucket();
179443
- init_emoji();
179444
- init_pkg_name();
179445
- init_global_path();
179446
- init_files();
179447
- init_help();
179448
- init_command20();
179449
- init_update_current_team_after_login();
179450
- init_get_flags_specification();
179451
- init_error2();
179452
- init_output_manager();
179453
- init_login2();
179454
- init_future();
179455
- }
179456
- });
179457
-
179458
- // src/util/telemetry/commands/logout/index.ts
179459
- var LogoutTelemetryClient;
179460
- var init_logout = __esm({
179461
- "src/util/telemetry/commands/logout/index.ts"() {
179462
- "use strict";
179463
- init_telemetry();
179464
- LogoutTelemetryClient = class extends TelemetryClient {
179465
- };
179547
+ );
179466
179548
  }
179467
- });
179468
-
179469
- // src/commands/logout/future.ts
179470
- async function logout(client2) {
179471
179549
  const { authConfig } = client2;
179472
179550
  if (!authConfig.token) {
179473
179551
  output_manager_default.note(
@@ -179479,7 +179557,9 @@ async function logout(client2) {
179479
179557
  const revocationResponse = await revocationRequest({
179480
179558
  token: authConfig.token
179481
179559
  });
179482
- output_manager_default.debug(`'Revocation response:', ${await revocationResponse.clone().text()}`);
179560
+ output_manager_default.debug(
179561
+ `'Revocation response:', ${await revocationResponse.clone().text()}`
179562
+ );
179483
179563
  const [revocationError] = await processRevocationResponse(revocationResponse);
179484
179564
  let logoutError = false;
179485
179565
  if (revocationError) {
@@ -179504,101 +179584,21 @@ async function logout(client2) {
179504
179584
  }
179505
179585
  return 1;
179506
179586
  }
179507
- var import_error_utils31;
179508
- var init_future2 = __esm({
179509
- "src/commands/logout/future.ts"() {
179510
- "use strict";
179511
- import_error_utils31 = __toESM3(require_dist2());
179512
- init_pkg_name();
179513
- init_oauth2();
179514
- init_output_manager();
179515
- }
179516
- });
179517
-
179518
- // src/commands/logout/index.ts
179519
- var logout_exports = {};
179520
- __export3(logout_exports, {
179521
- default: () => logout2
179522
- });
179523
- async function logout2(client2) {
179524
- const { authConfig, config: config2 } = client2;
179525
- let parsedArgs = null;
179526
- const flagsSpecification = getFlagsSpecification(logoutCommand.options);
179527
- const telemetry2 = new LogoutTelemetryClient({
179528
- opts: {
179529
- store: client2.telemetryEventStore
179530
- }
179531
- });
179532
- try {
179533
- parsedArgs = parseArguments(client2.argv.slice(2), flagsSpecification);
179534
- } catch (error3) {
179535
- printError(error3);
179536
- return 1;
179537
- }
179538
- if (parsedArgs.flags["--help"]) {
179539
- telemetry2.trackCliFlagHelp("logout");
179540
- output_manager_default.print(help2(logoutCommand, { columns: client2.stderr.columns }));
179541
- return 2;
179542
- }
179543
- if (authConfig.type === "oauth") {
179544
- return await logout(client2);
179545
- }
179546
- if (!authConfig.token) {
179547
- output_manager_default.note(
179548
- `Not currently logged in, so ${getCommandName("logout")} did nothing`
179549
- );
179550
- return 0;
179551
- }
179552
- output_manager_default.spinner("Logging out\u2026", 200);
179553
- let exitCode2 = 0;
179554
- try {
179555
- await client2.fetch("/v3/user/tokens/current", {
179556
- method: "DELETE",
179557
- useCurrentTeam: false
179558
- });
179559
- } catch (err) {
179560
- if (isAPIError(err)) {
179561
- if (err.status === 403) {
179562
- output_manager_default.debug("Token is invalid so it cannot be revoked");
179563
- } else if (err.status !== 200) {
179564
- output_manager_default.debug(err?.message ?? "");
179565
- exitCode2 = 1;
179566
- }
179567
- }
179568
- }
179569
- delete config2.currentTeam;
179570
- delete authConfig.token;
179571
- try {
179572
- writeToConfigFile(config2);
179573
- writeToAuthConfigFile(authConfig);
179574
- output_manager_default.debug("Configuration has been deleted");
179575
- } catch (err) {
179576
- output_manager_default.debug((0, import_error_utils32.errorToString)(err));
179577
- exitCode2 = 1;
179578
- }
179579
- if (exitCode2 === 0) {
179580
- output_manager_default.log("Logged out!");
179581
- } else {
179582
- output_manager_default.error("Failed during logout");
179583
- }
179584
- return exitCode2;
179585
- }
179586
- var import_error_utils32;
179587
+ var import_chalk108, import_error_utils31;
179587
179588
  var init_logout2 = __esm({
179588
179589
  "src/commands/logout/index.ts"() {
179589
179590
  "use strict";
179590
179591
  init_error2();
179591
- init_files();
179592
179592
  init_get_args();
179593
- init_pkg_name();
179594
- init_errors_ts();
179595
- import_error_utils32 = __toESM3(require_dist2());
179596
179593
  init_help();
179597
179594
  init_command21();
179598
179595
  init_get_flags_specification();
179599
179596
  init_output_manager();
179600
179597
  init_logout();
179601
- init_future2();
179598
+ import_chalk108 = __toESM3(require_source());
179599
+ import_error_utils31 = __toESM3(require_dist2());
179600
+ init_pkg_name();
179601
+ init_oauth();
179602
179602
  }
179603
179603
  });
179604
179604
 
@@ -180423,13 +180423,13 @@ async function main15(client2) {
180423
180423
  if (!subcommand && needHelp) {
180424
180424
  telemetry2.trackCliFlagHelp("project");
180425
180425
  output_manager_default.print(help2(projectCommand, { columns: client2.stderr.columns }));
180426
- return 2;
180426
+ return 0;
180427
180427
  }
180428
180428
  function printHelp(command) {
180429
180429
  output_manager_default.print(
180430
180430
  help2(command, { parent: projectCommand, columns: client2.stderr.columns })
180431
180431
  );
180432
- return 2;
180432
+ return 0;
180433
180433
  }
180434
180434
  if (!parsedArgs.args[1]) {
180435
180435
  subcommand = "list";
@@ -180933,7 +180933,7 @@ var promote_exports = {};
180933
180933
  __export3(promote_exports, {
180934
180934
  default: () => promote_default
180935
180935
  });
180936
- var import_ms27, import_error_utils33, promote_default;
180936
+ var import_ms27, import_error_utils32, promote_default;
180937
180937
  var init_promote2 = __esm({
180938
180938
  "src/commands/promote/index.ts"() {
180939
180939
  "use strict";
@@ -180941,7 +180941,7 @@ var init_promote2 = __esm({
180941
180941
  init_get_args();
180942
180942
  init_get_project_by_cwd_or_link();
180943
180943
  init_error2();
180944
- import_error_utils33 = __toESM3(require_dist2());
180944
+ import_error_utils32 = __toESM3(require_dist2());
180945
180945
  init_request_promote();
180946
180946
  init_status2();
180947
180947
  init_command26();
@@ -181011,7 +181011,7 @@ var init_promote2 = __esm({
181011
181011
  yes
181012
181012
  });
181013
181013
  } catch (err) {
181014
- if ((0, import_error_utils33.isErrnoException)(err)) {
181014
+ if ((0, import_error_utils32.isErrnoException)(err)) {
181015
181015
  if (err.code === "ERR_CANCELED") {
181016
181016
  return 0;
181017
181017
  }
@@ -181312,7 +181312,7 @@ async function redeploy(client2) {
181312
181312
  return printDeploymentStatus(deployment, deployStamp, noWait);
181313
181313
  } catch (err) {
181314
181314
  output_manager_default.prettyError(err);
181315
- if ((0, import_error_utils34.isErrnoException)(err) && err.code === "ERR_INVALID_TEAM") {
181315
+ if ((0, import_error_utils33.isErrnoException)(err) && err.code === "ERR_INVALID_TEAM") {
181316
181316
  output_manager_default.error(
181317
181317
  `Use ${import_chalk119.default.bold("vc switch")} to change your current team`
181318
181318
  );
@@ -181320,7 +181320,7 @@ async function redeploy(client2) {
181320
181320
  return 1;
181321
181321
  }
181322
181322
  }
181323
- var import_chalk119, import_client13, import_error_utils34;
181323
+ var import_chalk119, import_client13, import_error_utils33;
181324
181324
  var init_redeploy2 = __esm({
181325
181325
  "src/commands/redeploy/index.ts"() {
181326
181326
  "use strict";
@@ -181332,7 +181332,7 @@ var init_redeploy2 = __esm({
181332
181332
  init_get_deployment_by_id_or_url();
181333
181333
  init_get_scope();
181334
181334
  init_error2();
181335
- import_error_utils34 = __toESM3(require_dist2());
181335
+ import_error_utils33 = __toESM3(require_dist2());
181336
181336
  init_util();
181337
181337
  init_print_deployment_status();
181338
181338
  init_stamp();
@@ -181986,14 +181986,14 @@ var rollback_exports = {};
181986
181986
  __export3(rollback_exports, {
181987
181987
  default: () => rollback_default
181988
181988
  });
181989
- var import_error_utils35, import_ms31, rollback_default;
181989
+ var import_error_utils34, import_ms31, rollback_default;
181990
181990
  var init_rollback2 = __esm({
181991
181991
  "src/commands/rollback/index.ts"() {
181992
181992
  "use strict";
181993
181993
  init_get_args();
181994
181994
  init_get_project_by_cwd_or_link();
181995
181995
  init_error2();
181996
- import_error_utils35 = __toESM3(require_dist2());
181996
+ import_error_utils34 = __toESM3(require_dist2());
181997
181997
  import_ms31 = __toESM3(require_ms());
181998
181998
  init_request_rollback();
181999
181999
  init_status3();
@@ -182061,7 +182061,7 @@ var init_rollback2 = __esm({
182061
182061
  timeout
182062
182062
  });
182063
182063
  } catch (err) {
182064
- if ((0, import_error_utils35.isErrnoException)(err)) {
182064
+ if ((0, import_error_utils34.isErrnoException)(err)) {
182065
182065
  if (err.code === "ERR_CANCELED") {
182066
182066
  return 0;
182067
182067
  }
@@ -183069,10 +183069,10 @@ Please select a team scope using ${getCommandName(
183069
183069
  try {
183070
183070
  email2 = await client2.input.text({
183071
183071
  message: `- ${inviteUserPrefix}`,
183072
- validate: validateEmail2
183072
+ validate: validateEmail
183073
183073
  });
183074
183074
  } catch (err) {
183075
- if (!(0, import_error_utils36.isError)(err) || err.message !== "USER_ABORT") {
183075
+ if (!(0, import_error_utils35.isError)(err) || err.message !== "USER_ABORT") {
183076
183076
  throw err;
183077
183077
  }
183078
183078
  }
@@ -183102,7 +183102,7 @@ Please select a team scope using ${getCommandName(
183102
183102
  } catch (err) {
183103
183103
  output_manager_default.stopSpinner();
183104
183104
  process.stderr.write(eraseLines(emails.length + 2));
183105
- output_manager_default.error((0, import_error_utils36.errorToString)(err));
183105
+ output_manager_default.error((0, import_error_utils35.errorToString)(err));
183106
183106
  hasError = true;
183107
183107
  for (const email3 of emails) {
183108
183108
  output_manager_default.log(`${import_chalk125.default.cyan(chars_default.tick)} ${sentEmailPrefix}${email3}`);
@@ -183123,7 +183123,7 @@ Please select a team scope using ${getCommandName(
183123
183123
  }
183124
183124
  return 0;
183125
183125
  }
183126
- var import_chalk125, import_error_utils36, validateEmail2, domains;
183126
+ var import_chalk125, import_error_utils35, validateEmail, domains;
183127
183127
  var init_invite2 = __esm({
183128
183128
  "src/commands/teams/invite.ts"() {
183129
183129
  "use strict";
@@ -183139,14 +183139,14 @@ var init_invite2 = __esm({
183139
183139
  init_get_teams();
183140
183140
  init_invite_user_to_team();
183141
183141
  init_errors_ts();
183142
- import_error_utils36 = __toESM3(require_dist2());
183142
+ import_error_utils35 = __toESM3(require_dist2());
183143
183143
  init_invite();
183144
183144
  init_output_manager();
183145
183145
  init_get_args();
183146
183146
  init_get_flags_specification();
183147
183147
  init_error2();
183148
183148
  init_command33();
183149
- validateEmail2 = (data) => email.test(data.trim()) || data.length === 0;
183149
+ validateEmail = (data) => email.test(data.trim()) || data.length === 0;
183150
183150
  domains = Array.from(
183151
183151
  /* @__PURE__ */ new Set([
183152
183152
  "aol.com",
@@ -183215,7 +183215,7 @@ async function add7(client2) {
183215
183215
  default: slug
183216
183216
  });
183217
183217
  } catch (err) {
183218
- if ((0, import_error_utils37.isError)(err) && err.message === "USER_ABORT") {
183218
+ if ((0, import_error_utils36.isError)(err) && err.message === "USER_ABORT") {
183219
183219
  output_manager_default.log("Canceled");
183220
183220
  return 0;
183221
183221
  }
@@ -183228,7 +183228,7 @@ async function add7(client2) {
183228
183228
  } catch (err) {
183229
183229
  output_manager_default.stopSpinner();
183230
183230
  output_manager_default.print(eraseLines(2));
183231
- output_manager_default.error((0, import_error_utils37.errorToString)(err));
183231
+ output_manager_default.error((0, import_error_utils36.errorToString)(err));
183232
183232
  }
183233
183233
  } while (!team);
183234
183234
  output_manager_default.stopSpinner();
@@ -183244,7 +183244,7 @@ async function add7(client2) {
183244
183244
  validate: validateName
183245
183245
  });
183246
183246
  } catch (err) {
183247
- if ((0, import_error_utils37.isError)(err) && err.message === "USER_ABORT") {
183247
+ if ((0, import_error_utils36.isError)(err) && err.message === "USER_ABORT") {
183248
183248
  output_manager_default.log("No name specified");
183249
183249
  return 2;
183250
183250
  }
@@ -183271,7 +183271,7 @@ async function add7(client2) {
183271
183271
  });
183272
183272
  return 0;
183273
183273
  }
183274
- var import_chalk126, import_error_utils37, validateSlug, validateName, teamUrlPrefix, teamNamePrefix;
183274
+ var import_chalk126, import_error_utils36, validateSlug, validateName, teamUrlPrefix, teamNamePrefix;
183275
183275
  var init_add13 = __esm({
183276
183276
  "src/commands/teams/add.ts"() {
183277
183277
  "use strict";
@@ -183284,7 +183284,7 @@ var init_add13 = __esm({
183284
183284
  init_pkg_name();
183285
183285
  init_create_team();
183286
183286
  init_patch_team();
183287
- import_error_utils37 = __toESM3(require_dist2());
183287
+ import_error_utils36 = __toESM3(require_dist2());
183288
183288
  init_output_manager();
183289
183289
  validateSlug = (value) => /^[a-z]+[a-z0-9_-]*$/.test(value);
183290
183290
  validateName = (value) => /^[ a-zA-Z0-9_-]+$/.test(value);
@@ -183887,7 +183887,7 @@ async function whoami(client2) {
183887
183887
  if (parsedArgs.flags["--help"]) {
183888
183888
  telemetry2.trackCliFlagHelp("whoami");
183889
183889
  output_manager_default.print(help2(whoamiCommand, { columns: client2.stderr.columns }));
183890
- return 2;
183890
+ return 0;
183891
183891
  }
183892
183892
  const { contextName } = await getScope(client2, { getTeam: false });
183893
183893
  if (client2.stdout.isTTY) {
@@ -183913,7 +183913,7 @@ var init_whoami2 = __esm({
183913
183913
  });
183914
183914
 
183915
183915
  // src/index.ts
183916
- var import_error_utils38 = __toESM3(require_dist2());
183916
+ var import_error_utils37 = __toESM3(require_dist2());
183917
183917
  var import_path40 = require("path");
183918
183918
  var import_fs8 = require("fs");
183919
183919
  var import_fs_extra24 = __toESM3(require_lib());
@@ -184772,7 +184772,7 @@ var import_detect_agent = __toESM3(require_dist20());
184772
184772
  try {
184773
184773
  process.cwd();
184774
184774
  } catch (err) {
184775
- if ((0, import_error_utils38.isError)(err) && err.message.includes("uv_cwd")) {
184775
+ if ((0, import_error_utils37.isError)(err) && err.message.includes("uv_cwd")) {
184776
184776
  console.error("Error: The current working directory does not exist.");
184777
184777
  process.exit(1);
184778
184778
  }
@@ -184873,7 +184873,7 @@ var main17 = async () => {
184873
184873
  const bareHelpSubcommand = targetOrSubcommand === "help" && !subSubCommand;
184874
184874
  if (bareHelpOption || bareHelpSubcommand) {
184875
184875
  output_manager_default.print(help());
184876
- return 2;
184876
+ return 0;
184877
184877
  }
184878
184878
  try {
184879
184879
  await (0, import_fs_extra24.mkdirp)(VERCEL_DIR4);
@@ -184881,7 +184881,7 @@ var main17 = async () => {
184881
184881
  output_manager_default.error(
184882
184882
  `An unexpected error occurred while trying to create the global directory "${humanizePath(
184883
184883
  VERCEL_DIR4
184884
- )}" ${(0, import_error_utils38.errorToString)(err)}`
184884
+ )}" ${(0, import_error_utils37.errorToString)(err)}`
184885
184885
  );
184886
184886
  return 1;
184887
184887
  }
@@ -184889,7 +184889,7 @@ var main17 = async () => {
184889
184889
  try {
184890
184890
  config2 = readConfigFile();
184891
184891
  } catch (err) {
184892
- if ((0, import_error_utils38.isErrnoException)(err) && err.code === "ENOENT") {
184892
+ if ((0, import_error_utils37.isErrnoException)(err) && err.code === "ENOENT") {
184893
184893
  config2 = defaultGlobalConfig;
184894
184894
  try {
184895
184895
  writeToConfigFile(config2);
@@ -184897,7 +184897,7 @@ var main17 = async () => {
184897
184897
  output_manager_default.error(
184898
184898
  `An unexpected error occurred while trying to save the config to "${humanizePath(
184899
184899
  VERCEL_CONFIG_PATH
184900
- )}" ${(0, import_error_utils38.errorToString)(err2)}`
184900
+ )}" ${(0, import_error_utils37.errorToString)(err2)}`
184901
184901
  );
184902
184902
  return 1;
184903
184903
  }
@@ -184905,7 +184905,7 @@ var main17 = async () => {
184905
184905
  output_manager_default.error(
184906
184906
  `An unexpected error occurred while trying to read the config in "${humanizePath(
184907
184907
  VERCEL_CONFIG_PATH
184908
- )}" ${(0, import_error_utils38.errorToString)(err)}`
184908
+ )}" ${(0, import_error_utils37.errorToString)(err)}`
184909
184909
  );
184910
184910
  return 1;
184911
184911
  }
@@ -184914,7 +184914,7 @@ var main17 = async () => {
184914
184914
  try {
184915
184915
  authConfig = readAuthConfigFile();
184916
184916
  } catch (err) {
184917
- if ((0, import_error_utils38.isErrnoException)(err) && err.code === "ENOENT") {
184917
+ if ((0, import_error_utils37.isErrnoException)(err) && err.code === "ENOENT") {
184918
184918
  authConfig = defaultAuthConfig;
184919
184919
  try {
184920
184920
  writeToAuthConfigFile(authConfig);
@@ -184922,7 +184922,7 @@ var main17 = async () => {
184922
184922
  output_manager_default.error(
184923
184923
  `An unexpected error occurred while trying to write the auth config to "${humanizePath(
184924
184924
  VERCEL_AUTH_CONFIG_PATH
184925
- )}" ${(0, import_error_utils38.errorToString)(err2)}`
184925
+ )}" ${(0, import_error_utils37.errorToString)(err2)}`
184926
184926
  );
184927
184927
  return 1;
184928
184928
  }
@@ -184930,7 +184930,7 @@ var main17 = async () => {
184930
184930
  output_manager_default.error(
184931
184931
  `An unexpected error occurred while trying to read the auth config in "${humanizePath(
184932
184932
  VERCEL_AUTH_CONFIG_PATH
184933
- )}" ${(0, import_error_utils38.errorToString)(err)}`
184933
+ )}" ${(0, import_error_utils37.errorToString)(err)}`
184934
184934
  );
184935
184935
  return 1;
184936
184936
  }
@@ -185114,7 +185114,7 @@ var main17 = async () => {
185114
185114
  if (err instanceof Error) {
185115
185115
  output_manager_default.debug(err.stack || err.toString());
185116
185116
  }
185117
- if ((0, import_error_utils38.isErrnoException)(err) && err.code === "NOT_AUTHORIZED") {
185117
+ if ((0, import_error_utils37.isErrnoException)(err) && err.code === "NOT_AUTHORIZED") {
185118
185118
  output_manager_default.prettyError({
185119
185119
  message: `You do not have access to the specified account`,
185120
185120
  link: "https://err.sh/vercel/scope-not-accessible"
@@ -185122,7 +185122,7 @@ var main17 = async () => {
185122
185122
  return 1;
185123
185123
  }
185124
185124
  output_manager_default.error(
185125
- `Not able to load user because of unexpected error: ${(0, import_error_utils38.errorToString)(err)}`
185125
+ `Not able to load user because of unexpected error: ${(0, import_error_utils37.errorToString)(err)}`
185126
185126
  );
185127
185127
  return 1;
185128
185128
  }
@@ -185137,14 +185137,14 @@ var main17 = async () => {
185137
185137
  try {
185138
185138
  teams2 = await getTeams(client);
185139
185139
  } catch (err) {
185140
- if ((0, import_error_utils38.isErrnoException)(err) && err.code === "not_authorized") {
185140
+ if ((0, import_error_utils37.isErrnoException)(err) && err.code === "not_authorized") {
185141
185141
  output_manager_default.prettyError({
185142
185142
  message: `You do not have access to the specified team`,
185143
185143
  link: "https://err.sh/vercel/scope-not-accessible"
185144
185144
  });
185145
185145
  return 1;
185146
185146
  }
185147
- if ((0, import_error_utils38.isErrnoException)(err) && err.code === "rate_limited") {
185147
+ if ((0, import_error_utils37.isErrnoException)(err) && err.code === "rate_limited") {
185148
185148
  output_manager_default.prettyError({
185149
185149
  message: "Rate limited. Too many requests to the same endpoint: /teams"
185150
185150
  });
@@ -185177,7 +185177,7 @@ var main17 = async () => {
185177
185177
  );
185178
185178
  telemetry2.trackCliExtension();
185179
185179
  } catch (err) {
185180
- if ((0, import_error_utils38.isErrnoException)(err) && err.code === "ENOENT") {
185180
+ if ((0, import_error_utils37.isErrnoException)(err) && err.code === "ENOENT") {
185181
185181
  targetCommand2 = subcommand = "deploy";
185182
185182
  } else {
185183
185183
  throw err;
@@ -185353,7 +185353,7 @@ var main17 = async () => {
185353
185353
  exitCode2 = await func(client);
185354
185354
  }
185355
185355
  } catch (err) {
185356
- if ((0, import_error_utils38.isErrnoException)(err) && err.code === "ENOTFOUND") {
185356
+ if ((0, import_error_utils37.isErrnoException)(err) && err.code === "ENOTFOUND") {
185357
185357
  const matches = /getaddrinfo ENOTFOUND (.*)$/.exec(err.message || "");
185358
185358
  if (matches && matches[1]) {
185359
185359
  const hostname3 = matches[1];
@@ -185368,7 +185368,7 @@ var main17 = async () => {
185368
185368
  }
185369
185369
  return 1;
185370
185370
  }
185371
- if ((0, import_error_utils38.isErrnoException)(err) && err.code === "ECONNRESET") {
185371
+ if ((0, import_error_utils37.isErrnoException)(err) && err.code === "ECONNRESET") {
185372
185372
  const matches = /request to https:\/\/(.*?)\//.exec(err.message || "");
185373
185373
  const hostname3 = matches?.[1];
185374
185374
  if (hostname3) {
@@ -185380,7 +185380,7 @@ var main17 = async () => {
185380
185380
  }
185381
185381
  return 1;
185382
185382
  }
185383
- if ((0, import_error_utils38.isErrnoException)(err) && (err.code === "NOT_AUTHORIZED" || err.code === "TEAM_DELETED")) {
185383
+ if ((0, import_error_utils37.isErrnoException)(err) && (err.code === "NOT_AUTHORIZED" || err.code === "TEAM_DELETED")) {
185384
185384
  output_manager_default.prettyError(err);
185385
185385
  return 1;
185386
185386
  }
@@ -185389,7 +185389,7 @@ var main17 = async () => {
185389
185389
  output_manager_default.prettyError(err);
185390
185390
  return 1;
185391
185391
  }
185392
- if ((0, import_error_utils38.isErrnoException)(err)) {
185392
+ if ((0, import_error_utils37.isErrnoException)(err)) {
185393
185393
  if (typeof err.stack === "string") {
185394
185394
  output_manager_default.debug(err.stack);
185395
185395
  }