@mintlify/cli 4.0.1129 → 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 +26 -4
- package/bin/score/index.js +25 -2
- package/bin/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +7 -7
- package/src/cli.tsx +28 -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
|
@@ -271,6 +271,11 @@ export const cli = ({ packageName = 'mint' }: { packageName?: string }) => {
|
|
|
271
271
|
type: 'boolean',
|
|
272
272
|
default: false,
|
|
273
273
|
description: 'also check links inside <Snippet> components',
|
|
274
|
+
})
|
|
275
|
+
.option('check-redirects', {
|
|
276
|
+
type: 'boolean',
|
|
277
|
+
default: false,
|
|
278
|
+
description: 'also check that docs.json redirect destinations resolve to valid paths',
|
|
274
279
|
}),
|
|
275
280
|
async (argv) => {
|
|
276
281
|
await autoUpgradeIfNeeded();
|
|
@@ -314,6 +319,25 @@ export const cli = ({ packageName = 'mint' }: { packageName?: string }) => {
|
|
|
314
319
|
}
|
|
315
320
|
}
|
|
316
321
|
|
|
322
|
+
if (argv['check-redirects']) {
|
|
323
|
+
const brokenRedirects = graph.getBrokenRedirects();
|
|
324
|
+
if (brokenRedirects.length > 0) {
|
|
325
|
+
const configFilename = await fs
|
|
326
|
+
.access(path.join(CMD_EXEC_PATH, 'docs.json'))
|
|
327
|
+
.then(() => 'docs.json')
|
|
328
|
+
.catch(() => 'mint.json');
|
|
329
|
+
const labels = brokenRedirects.map(
|
|
330
|
+
({ source, destination }) => `${source} → ${destination}`
|
|
331
|
+
);
|
|
332
|
+
const existing = brokenLinksByFile[configFilename];
|
|
333
|
+
if (existing) {
|
|
334
|
+
existing.push(...labels);
|
|
335
|
+
} else {
|
|
336
|
+
brokenLinksByFile[configFilename] = labels;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
317
341
|
if (Object.keys(brokenLinksByFile).length === 0) {
|
|
318
342
|
clearLogs();
|
|
319
343
|
addLog(<SuccessLog message="no broken links found" />);
|
|
@@ -555,21 +579,21 @@ export const cli = ({ packageName = 'mint' }: { packageName?: string }) => {
|
|
|
555
579
|
)
|
|
556
580
|
.command('analytics', 'View analytics for your documentation', analyticsBuilder)
|
|
557
581
|
.command(
|
|
558
|
-
'score
|
|
582
|
+
'score [url]',
|
|
559
583
|
'Run agent readiness checks on a docs site',
|
|
560
584
|
(yargs: Argv) =>
|
|
561
585
|
yargs
|
|
562
586
|
.positional('url', {
|
|
563
587
|
type: 'string',
|
|
564
|
-
|
|
565
|
-
description: 'URL of the docs site to check',
|
|
588
|
+
description: 'URL of the docs site to check (defaults to your configured subdomain)',
|
|
566
589
|
})
|
|
567
590
|
.option('format', {
|
|
568
591
|
type: 'string',
|
|
569
592
|
choices: ['table', 'plain', 'json'] as const,
|
|
570
593
|
description: 'Output format',
|
|
571
594
|
})
|
|
572
|
-
.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'),
|
|
573
597
|
scoreHandler
|
|
574
598
|
)
|
|
575
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,
|