@mintlify/cli 4.0.1130 → 4.0.1131
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/cli.js +4 -4
- package/bin/score/index.js +25 -2
- package/bin/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +7 -7
- package/src/cli.tsx +4 -4
- package/src/score/index.tsx +25 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mintlify/cli",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.1131",
|
|
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.862",
|
|
49
|
+
"@mintlify/link-rot": "3.0.1040",
|
|
50
|
+
"@mintlify/prebuild": "1.0.1005",
|
|
51
|
+
"@mintlify/previewing": "4.0.1066",
|
|
52
|
+
"@mintlify/validation": "0.1.673",
|
|
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": "ce2406d3df08c0001f4991ab8559de6a09e13838"
|
|
97
97
|
}
|
package/src/cli.tsx
CHANGED
|
@@ -579,21 +579,21 @@ export const cli = ({ packageName = 'mint' }: { packageName?: string }) => {
|
|
|
579
579
|
)
|
|
580
580
|
.command('analytics', 'View analytics for your documentation', analyticsBuilder)
|
|
581
581
|
.command(
|
|
582
|
-
'score
|
|
582
|
+
'score [url]',
|
|
583
583
|
'Run agent readiness checks on a docs site',
|
|
584
584
|
(yargs: Argv) =>
|
|
585
585
|
yargs
|
|
586
586
|
.positional('url', {
|
|
587
587
|
type: 'string',
|
|
588
|
-
|
|
589
|
-
description: 'URL of the docs site to check',
|
|
588
|
+
description: 'URL of the docs site to check (defaults to your configured subdomain)',
|
|
590
589
|
})
|
|
591
590
|
.option('format', {
|
|
592
591
|
type: 'string',
|
|
593
592
|
choices: ['table', 'plain', 'json'] as const,
|
|
594
593
|
description: 'Output format',
|
|
595
594
|
})
|
|
596
|
-
.example('mint score
|
|
595
|
+
.example('mint score', 'Run agent readiness checks on your default subdomain')
|
|
596
|
+
.example('mint score docs.example.com', 'Run agent readiness checks on a URL'),
|
|
597
597
|
scoreHandler
|
|
598
598
|
)
|
|
599
599
|
// Coming soon commands — visible in help, tracked via telemetry to gauge interest.
|
package/src/score/index.tsx
CHANGED
|
@@ -2,7 +2,10 @@ import { addLog, ErrorLog, SpinnerLog, removeLastLog } from '@mintlify/previewin
|
|
|
2
2
|
import chalk from 'chalk';
|
|
3
3
|
import { Text } from 'ink';
|
|
4
4
|
|
|
5
|
+
import { getConfigValue } from '../config.js';
|
|
5
6
|
import { terminate } from '../helpers.js';
|
|
7
|
+
import { getAccessToken } from '../keyring.js';
|
|
8
|
+
import { getCliSubdomains } from '../status.js';
|
|
6
9
|
import { trackEvent } from '../telemetry/track.js';
|
|
7
10
|
import { fetchScoreBySlug, resolveScoreForUrl } from './client.js';
|
|
8
11
|
import type { Check, ScoreResponse } from './types.js';
|
|
@@ -96,11 +99,30 @@ async function pollForScore(
|
|
|
96
99
|
throw new Error(`Score did not complete within ${POLL_TIMEOUT_MS / 1000}s`);
|
|
97
100
|
}
|
|
98
101
|
|
|
99
|
-
|
|
102
|
+
async function resolveDefaultSubdomain(): Promise<string | undefined> {
|
|
103
|
+
const fromConfig = getConfigValue('subdomain');
|
|
104
|
+
if (fromConfig) return fromConfig;
|
|
105
|
+
const accessToken = await getAccessToken();
|
|
106
|
+
if (!accessToken) return undefined;
|
|
107
|
+
const subdomains = await getCliSubdomains(accessToken);
|
|
108
|
+
return subdomains[0];
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export const scoreHandler = async (argv: { url?: string; format?: string }) => {
|
|
100
112
|
const format = resolveFormat(argv);
|
|
101
113
|
try {
|
|
114
|
+
let url = argv.url;
|
|
115
|
+
if (!url) {
|
|
116
|
+
const subdomain = await resolveDefaultSubdomain();
|
|
117
|
+
if (!subdomain) {
|
|
118
|
+
throw new Error(
|
|
119
|
+
'No URL provided and no default subdomain set. Run `mint login` to set one, or pass a URL: `mint score <url>`.'
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
url = `${subdomain}.mintlify.app`;
|
|
123
|
+
}
|
|
102
124
|
if (format === 'table') addLog(<SpinnerLog message="Checking agent readiness..." />);
|
|
103
|
-
const resolved = await resolveScoreForUrl(
|
|
125
|
+
const resolved = await resolveScoreForUrl(url);
|
|
104
126
|
|
|
105
127
|
let final: ScoreResponse;
|
|
106
128
|
|
|
@@ -134,7 +156,7 @@ export const scoreHandler = async (argv: { url: string; format?: string }) => {
|
|
|
134
156
|
}
|
|
135
157
|
|
|
136
158
|
void trackEvent('cli.score.executed', {
|
|
137
|
-
url
|
|
159
|
+
url,
|
|
138
160
|
score: final.overallScore,
|
|
139
161
|
format,
|
|
140
162
|
status: resolved.status,
|