@mintlify/cli 4.0.1337 → 4.0.1339

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.1337",
3
+ "version": "4.0.1339",
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.1041",
49
- "@mintlify/link-rot": "3.0.1233",
48
+ "@mintlify/common": "1.0.1042",
49
+ "@mintlify/link-rot": "3.0.1235",
50
50
  "@mintlify/models": "0.0.343",
51
- "@mintlify/prebuild": "1.0.1189",
52
- "@mintlify/previewing": "4.0.1258",
51
+ "@mintlify/prebuild": "1.0.1190",
52
+ "@mintlify/previewing": "4.0.1259",
53
53
  "@mintlify/validation": "0.1.798",
54
54
  "adm-zip": "0.5.16",
55
55
  "chalk": "5.2.0",
@@ -92,5 +92,5 @@
92
92
  "vitest": "2.1.9",
93
93
  "vitest-mock-process": "1.0.4"
94
94
  },
95
- "gitHead": "e6c3793e677c3aa79650fb9fbd31467ff1649d2e"
95
+ "gitHead": "3498acefd9c006ff788a60431cca85d03053d782"
96
96
  }
package/src/cli.tsx CHANGED
@@ -24,6 +24,7 @@ import { setTelemetryEnabled } from './config.js';
24
24
  import { getConfigValue, setConfigValue, clearConfigValue } from './config.js';
25
25
  import { API_URL } from './constants.js';
26
26
  import { deslopHandler } from './deslop/index.js';
27
+ import { resolveExplicitFiles } from './deslop/resolveFiles.js';
27
28
  import {
28
29
  CMD_EXEC_PATH,
29
30
  checkPort,
@@ -296,6 +297,11 @@ export const cli = ({ packageName = 'mint' }: { packageName?: string }) => {
296
297
  'Check for broken links',
297
298
  (yargs) =>
298
299
  yargs
300
+ .option('files', {
301
+ type: 'string',
302
+ array: true,
303
+ description: 'Files or globs to check (defaults to the whole site)',
304
+ })
299
305
  .option('check-anchors', {
300
306
  type: 'boolean',
301
307
  default: false,
@@ -315,19 +321,35 @@ export const cli = ({ packageName = 'mint' }: { packageName?: string }) => {
315
321
  type: 'boolean',
316
322
  default: false,
317
323
  description: 'also check that docs.json redirect destinations resolve to valid paths',
318
- }),
324
+ })
325
+ .example('mint broken-links --files introduction.mdx', 'Check a specific page')
326
+ .example('mint broken-links --files "guides/**/*.mdx"', 'Check pages matching a glob'),
319
327
  async (argv) => {
320
328
  await autoUpgradeIfNeeded();
321
329
  addLog(<SpinnerLog message="checking for broken links..." />);
322
330
  try {
331
+ const fileArgs = (argv.files ?? []).map(String).filter(Boolean);
332
+ const sourceFiles =
333
+ fileArgs.length > 0
334
+ ? new Set(
335
+ (await resolveExplicitFiles(CMD_EXEC_PATH, fileArgs)).map((file) =>
336
+ path.normalize(file)
337
+ )
338
+ )
339
+ : undefined;
323
340
  const graph = await buildGraph(undefined, {
324
341
  checkSnippets: argv['check-snippets'],
325
342
  });
326
343
  graph.precomputeFileResolutions();
327
344
 
328
- const brokenInternalLinks = graph.getBrokenInternalLinks({
329
- checkAnchors: argv['check-anchors'],
330
- });
345
+ const brokenInternalLinks = graph
346
+ .getBrokenInternalLinks({
347
+ checkAnchors: argv['check-anchors'],
348
+ })
349
+ .filter(
350
+ ({ relativeDir, filename }) =>
351
+ !sourceFiles || sourceFiles.has(path.join(relativeDir, filename))
352
+ );
331
353
 
332
354
  const brokenLinksByFile: Record<string, string[]> = {};
333
355
 
@@ -342,7 +364,10 @@ export const cli = ({ packageName = 'mint' }: { packageName?: string }) => {
342
364
  });
343
365
 
344
366
  if (argv['check-external']) {
345
- const brokenExternalLinks = await getBrokenExternalLinks(graph);
367
+ const brokenExternalLinks = await getBrokenExternalLinks(
368
+ graph,
369
+ sourceFiles ? { sourceFiles } : undefined
370
+ );
346
371
  for (const result of brokenExternalLinks) {
347
372
  for (const source of result.sources) {
348
373
  const label = result.status