@mintlify/cli 4.0.1097 → 4.0.1098
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/login.js +5 -5
- package/bin/logout.js +2 -3
- package/bin/status.js +13 -8
- package/bin/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +7 -7
- package/src/login.tsx +5 -5
- package/src/logout.tsx +2 -3
- package/src/status.tsx +41 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mintlify/cli",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.1098",
|
|
4
4
|
"description": "The Mintlify CLI",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=18.0.0"
|
|
@@ -45,11 +45,11 @@
|
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@inquirer/prompts": "7.9.0",
|
|
48
|
-
"@mintlify/common": "1.0.
|
|
49
|
-
"@mintlify/link-rot": "3.0.
|
|
50
|
-
"@mintlify/prebuild": "1.0.
|
|
51
|
-
"@mintlify/previewing": "4.0.
|
|
52
|
-
"@mintlify/validation": "0.1.
|
|
48
|
+
"@mintlify/common": "1.0.841",
|
|
49
|
+
"@mintlify/link-rot": "3.0.1016",
|
|
50
|
+
"@mintlify/prebuild": "1.0.983",
|
|
51
|
+
"@mintlify/previewing": "4.0.1044",
|
|
52
|
+
"@mintlify/validation": "0.1.657",
|
|
53
53
|
"adm-zip": "0.5.16",
|
|
54
54
|
"chalk": "5.2.0",
|
|
55
55
|
"color": "4.2.3",
|
|
@@ -93,5 +93,5 @@
|
|
|
93
93
|
"vitest": "2.1.9",
|
|
94
94
|
"vitest-mock-process": "1.0.4"
|
|
95
95
|
},
|
|
96
|
-
"gitHead": "
|
|
96
|
+
"gitHead": "edd192ddf9723fff5a7d818a9e6937e17b8806a1"
|
|
97
97
|
}
|
package/src/login.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { input } from '@inquirer/prompts';
|
|
2
|
-
import { addLog } from '@mintlify/previewing';
|
|
2
|
+
import { addLog, ErrorLog, SuccessLog } from '@mintlify/previewing';
|
|
3
3
|
import chalk from 'chalk';
|
|
4
4
|
import { Box, Text } from 'ink';
|
|
5
5
|
import open from 'open';
|
|
@@ -49,7 +49,7 @@ export async function login(): Promise<void> {
|
|
|
49
49
|
</Text>
|
|
50
50
|
<Box flexDirection="column" paddingLeft={3} gap={1}>
|
|
51
51
|
<Text dimColor>If your browser doesn't open automatically, copy this URL:</Text>
|
|
52
|
-
<Text
|
|
52
|
+
<Text dimColor>{url}</Text>
|
|
53
53
|
</Box>
|
|
54
54
|
</Box>
|
|
55
55
|
);
|
|
@@ -82,7 +82,7 @@ export async function login(): Promise<void> {
|
|
|
82
82
|
} catch {
|
|
83
83
|
closeServer();
|
|
84
84
|
inputPromise.cancel();
|
|
85
|
-
addLog(<
|
|
85
|
+
addLog(<ErrorLog message="login cancelled" />);
|
|
86
86
|
return;
|
|
87
87
|
}
|
|
88
88
|
|
|
@@ -106,12 +106,12 @@ export async function login(): Promise<void> {
|
|
|
106
106
|
if (!res.ok) {
|
|
107
107
|
const reason = body.error_message ?? body.error ?? 'unknown error';
|
|
108
108
|
void trackLoginFailed(reason);
|
|
109
|
-
addLog(<
|
|
109
|
+
addLog(<ErrorLog message={`login failed: ${reason}`} />);
|
|
110
110
|
return;
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
const token = body as TokenResponse;
|
|
114
114
|
await storeCredentials(token.access_token, token.refresh_token);
|
|
115
115
|
void trackLoginSuccess();
|
|
116
|
-
addLog(<
|
|
116
|
+
addLog(<SuccessLog message="logged in successfully" />);
|
|
117
117
|
}
|
package/src/logout.tsx
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { addLog } from '@mintlify/previewing';
|
|
2
|
-
import { Text } from 'ink';
|
|
1
|
+
import { addLog, SuccessLog } from '@mintlify/previewing';
|
|
3
2
|
|
|
4
3
|
import { clearCredentials } from './keyring.js';
|
|
5
4
|
|
|
6
5
|
export async function logout(): Promise<void> {
|
|
7
6
|
await clearCredentials();
|
|
8
|
-
addLog(<
|
|
7
|
+
addLog(<SuccessLog message="logged out successfully" />);
|
|
9
8
|
}
|
package/src/status.tsx
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { addLog } from '@mintlify/previewing';
|
|
2
|
-
import { Text } from 'ink';
|
|
1
|
+
import { addLog, ErrorLog } from '@mintlify/previewing';
|
|
2
|
+
import { Box, Text } from 'ink';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
|
+
import { getConfigValue } from './config.js';
|
|
5
6
|
import { API_URL } from './constants.js';
|
|
7
|
+
import { getCliVersion } from './helpers.js';
|
|
6
8
|
import { getAccessToken } from './keyring.js';
|
|
7
9
|
|
|
8
10
|
const StatusResponseSchema = z.object({
|
|
@@ -29,7 +31,7 @@ export async function status(): Promise<void> {
|
|
|
29
31
|
const accessToken = await getAccessToken();
|
|
30
32
|
|
|
31
33
|
if (!accessToken) {
|
|
32
|
-
addLog(<
|
|
34
|
+
addLog(<ErrorLog message="not logged in. Run `mint login` to authenticate." />);
|
|
33
35
|
return;
|
|
34
36
|
}
|
|
35
37
|
|
|
@@ -39,7 +41,7 @@ export async function status(): Promise<void> {
|
|
|
39
41
|
});
|
|
40
42
|
|
|
41
43
|
if (!res.ok) {
|
|
42
|
-
addLog(<
|
|
44
|
+
addLog(<ErrorLog message="not logged in. Run `mint login` to authenticate." />);
|
|
43
45
|
return;
|
|
44
46
|
}
|
|
45
47
|
|
|
@@ -47,18 +49,46 @@ export async function status(): Promise<void> {
|
|
|
47
49
|
const parsed = StatusResponseSchema.safeParse(json);
|
|
48
50
|
|
|
49
51
|
if (!parsed.success) {
|
|
50
|
-
addLog(<
|
|
52
|
+
addLog(<ErrorLog message="unexpected response from server. please try again." />);
|
|
51
53
|
return;
|
|
52
54
|
}
|
|
53
55
|
|
|
54
|
-
const { user, org } = parsed.data;
|
|
56
|
+
const { user, org, subdomain: apiSubdomain } = parsed.data;
|
|
57
|
+
const version = getCliVersion();
|
|
58
|
+
const subdomain = getConfigValue('subdomain') ?? apiSubdomain ?? null;
|
|
55
59
|
addLog(
|
|
56
|
-
<
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
+
<Box flexDirection="column" paddingY={1}>
|
|
61
|
+
{version && (
|
|
62
|
+
<Box>
|
|
63
|
+
<Box minWidth={16}>
|
|
64
|
+
<Text dimColor>Version</Text>
|
|
65
|
+
</Box>
|
|
66
|
+
<Text>{version}</Text>
|
|
67
|
+
</Box>
|
|
68
|
+
)}
|
|
69
|
+
<Box>
|
|
70
|
+
<Box minWidth={16}>
|
|
71
|
+
<Text dimColor>Email</Text>
|
|
72
|
+
</Box>
|
|
73
|
+
<Text>{user.email}</Text>
|
|
74
|
+
</Box>
|
|
75
|
+
<Box>
|
|
76
|
+
<Box minWidth={16}>
|
|
77
|
+
<Text dimColor>Organization</Text>
|
|
78
|
+
</Box>
|
|
79
|
+
<Text>{org.name}</Text>
|
|
80
|
+
</Box>
|
|
81
|
+
{subdomain && (
|
|
82
|
+
<Box>
|
|
83
|
+
<Box minWidth={16}>
|
|
84
|
+
<Text dimColor>Subdomain</Text>
|
|
85
|
+
</Box>
|
|
86
|
+
<Text>{subdomain}</Text>
|
|
87
|
+
</Box>
|
|
88
|
+
)}
|
|
89
|
+
</Box>
|
|
60
90
|
);
|
|
61
91
|
} catch (e) {
|
|
62
|
-
addLog(<
|
|
92
|
+
addLog(<ErrorLog message="unexpected response from server. please try again." />);
|
|
63
93
|
}
|
|
64
94
|
}
|