@mintlify/cli 4.0.1354 → 4.0.1355

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/signup.js CHANGED
@@ -13,6 +13,7 @@ import { addLog, addLogs, ErrorLog, SuccessLog } from '@mintlify/previewing';
13
13
  import { Box, Text } from 'ink';
14
14
  import { calculatePKCECodeChallenge, randomNonce, randomPKCECodeVerifier, randomState, } from 'openid-client';
15
15
  import { startCallbackServer } from './callbackServer.js';
16
+ import { clearConfigValue } from './config.js';
16
17
  import { API_URL, DASHBOARD_URL, STYTCH_CLIENT_ID, TOKEN_ENDPOINT } from './constants.js';
17
18
  import { isAI } from './helpers.js';
18
19
  import { storeCredentials } from './keyring.js';
@@ -83,6 +84,7 @@ export function signup() {
83
84
  }
84
85
  const token = body;
85
86
  yield storeCredentials(token.access_token, token.refresh_token);
87
+ yield clearConfigValue('subdomain').catch(() => undefined);
86
88
  addLog(_jsx(SuccessLog, { message: "account created and logged in successfully" }));
87
89
  addLog(_jsx(Text, { children: "Continue in the browser tab where you verified your email to connect GitHub." }));
88
90
  });
package/bin/status.js CHANGED
@@ -12,7 +12,7 @@ import { addLog, ErrorLog } from '@mintlify/previewing';
12
12
  import { Box, Text } from 'ink';
13
13
  import { z } from 'zod';
14
14
  import { authenticatedFetch } from './authenticatedFetch.js';
15
- import { getConfigValue } from './config.js';
15
+ import { getConfigValue, setConfigValue } from './config.js';
16
16
  import { API_URL } from './constants.js';
17
17
  import { getCliVersion } from './helpers.js';
18
18
  import { getAccessToken } from './keyring.js';
@@ -40,7 +40,7 @@ export function getCliSubdomains(accessToken) {
40
40
  }
41
41
  export function status() {
42
42
  return __awaiter(this, void 0, void 0, function* () {
43
- var _a, _b;
43
+ var _a;
44
44
  const accessToken = yield getAccessToken();
45
45
  if (!accessToken) {
46
46
  addLog(_jsx(ErrorLog, { message: "not logged in. Run `mint login` to authenticate." }));
@@ -60,7 +60,10 @@ export function status() {
60
60
  }
61
61
  const { user, org, subdomains } = parsed.data;
62
62
  const version = getCliVersion();
63
- const subdomain = (_b = (_a = getConfigValue('subdomain')) !== null && _a !== void 0 ? _a : subdomains[0]) !== null && _b !== void 0 ? _b : null;
63
+ const cached = getConfigValue('subdomain');
64
+ const subdomain = (_a = (cached && subdomains.includes(cached) ? cached : subdomains[0])) !== null && _a !== void 0 ? _a : null;
65
+ if (subdomain && subdomain !== cached)
66
+ yield setConfigValue('subdomain', subdomain).catch(() => undefined);
64
67
  addLog(_jsxs(Box, { flexDirection: "column", paddingY: 1, children: [version && (_jsxs(Box, { children: [_jsx(Box, { minWidth: 16, children: _jsx(Text, { dimColor: true, children: "Version" }) }), _jsx(Text, { children: version })] })), _jsxs(Box, { children: [_jsx(Box, { minWidth: 16, children: _jsx(Text, { dimColor: true, children: "Email" }) }), _jsx(Text, { children: user.email })] }), _jsxs(Box, { children: [_jsx(Box, { minWidth: 16, children: _jsx(Text, { dimColor: true, children: "Organization" }) }), _jsx(Text, { children: org.name })] }), subdomain && (_jsxs(Box, { children: [_jsx(Box, { minWidth: 16, children: _jsx(Text, { dimColor: true, children: "Subdomain" }) }), _jsx(Text, { children: subdomain })] }))] }));
65
68
  }
66
69
  catch (e) {