@mintlify/cli 4.0.1087 → 4.0.1088

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mintlify/cli",
3
- "version": "4.0.1087",
3
+ "version": "4.0.1088",
4
4
  "description": "The Mintlify CLI",
5
5
  "engines": {
6
6
  "node": ">=18.0.0"
@@ -46,9 +46,9 @@
46
46
  "dependencies": {
47
47
  "@inquirer/prompts": "7.9.0",
48
48
  "@mintlify/common": "1.0.835",
49
- "@mintlify/link-rot": "3.0.1008",
49
+ "@mintlify/link-rot": "3.0.1009",
50
50
  "@mintlify/prebuild": "1.0.977",
51
- "@mintlify/previewing": "4.0.1036",
51
+ "@mintlify/previewing": "4.0.1037",
52
52
  "@mintlify/validation": "0.1.653",
53
53
  "adm-zip": "0.5.16",
54
54
  "chalk": "5.2.0",
@@ -93,5 +93,5 @@
93
93
  "vitest": "2.1.9",
94
94
  "vitest-mock-process": "1.0.4"
95
95
  },
96
- "gitHead": "2098cd9c9868b0e8e7118290c5c768ecf90d54ff"
96
+ "gitHead": "8d3507469a2bba7c8ff8b0f5f7139ff3c8240041"
97
97
  }
package/src/cli.tsx CHANGED
@@ -22,6 +22,7 @@ import { accessibilityCheck } from './accessibilityCheck.js';
22
22
  import { analyticsBuilder } from './analytics/index.js';
23
23
  import { setTelemetryEnabled } from './config.js';
24
24
  import { getConfigValue, setConfigValue, clearConfigValue } from './config.js';
25
+ import { API_URL } from './constants.js';
25
26
  import {
26
27
  CMD_EXEC_PATH,
27
28
  checkPort,
@@ -32,11 +33,12 @@ import {
32
33
  terminate,
33
34
  } from './helpers.js';
34
35
  import { init } from './init.js';
36
+ import { getAccessToken } from './keyring.js';
35
37
  import { login } from './login.js';
36
38
  import { logout } from './logout.js';
37
39
  import { mdxLinter } from './mdxLinter.js';
38
40
  import { checkOpenApiFile, getOpenApiFilenamesFromDocsConfig } from './openApiCheck.js';
39
- import { status } from './status.js';
41
+ import { status, getCliSubdomain } from './status.js';
40
42
  import { createTelemetryMiddleware } from './telemetry/middleware.js';
41
43
  import { trackTelemetryPreferenceChange } from './telemetry/track.js';
42
44
  import { update } from './update.js';
@@ -109,12 +111,24 @@ export const cli = ({ packageName = 'mint' }: { packageName?: string }) => {
109
111
  await autoUpgradeIfNeeded();
110
112
  const port = await checkPort(argv);
111
113
  const { cli: cliVersion } = getVersions();
114
+ let accessToken: string | undefined;
115
+ let subdomain: string | undefined;
116
+ try {
117
+ accessToken = (await getAccessToken()) ?? undefined;
118
+ const configuredSubdomain = getConfigValue('subdomain');
119
+ subdomain =
120
+ configuredSubdomain ??
121
+ (accessToken ? (await getCliSubdomain(accessToken)) ?? undefined : undefined);
122
+ } catch {}
112
123
  if (port != undefined) {
113
124
  await dev({
114
125
  ...argv,
115
126
  port,
116
127
  packageName,
117
128
  cliVersion,
129
+ accessToken,
130
+ subdomain,
131
+ apiUrl: API_URL,
118
132
  });
119
133
  } else {
120
134
  addLog(<ErrorLog message="no available port found" />);
package/src/status.tsx CHANGED
@@ -8,8 +8,23 @@ import { getAccessToken } from './keyring.js';
8
8
  const StatusResponseSchema = z.object({
9
9
  user: z.object({ email: z.string() }),
10
10
  org: z.object({ name: z.string() }),
11
+ subdomain: z.string().nullable().optional(),
11
12
  });
12
13
 
14
+ export async function getCliSubdomain(accessToken: string): Promise<string | null> {
15
+ try {
16
+ const res = await fetch(`${API_URL}/api/cli/status`, {
17
+ headers: { Authorization: `Bearer ${accessToken}` },
18
+ });
19
+ if (!res.ok) return null;
20
+ const json = await res.json().catch(() => null);
21
+ const parsed = StatusResponseSchema.safeParse(json);
22
+ return parsed.success ? parsed.data.subdomain ?? null : null;
23
+ } catch {
24
+ return null;
25
+ }
26
+ }
27
+
13
28
  export async function status(): Promise<void> {
14
29
  const accessToken = await getAccessToken();
15
30