@mintlify/cli 4.0.1766 → 4.0.1767
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/__test__/instructions.test.ts +53 -0
- package/bin/cli.js +27 -0
- package/bin/instructions.js +101 -0
- package/bin/tsconfig.build.tsbuildinfo +1 -1
- package/bin/welcome.js +1 -0
- package/package.json +2 -2
- package/src/cli.tsx +32 -0
- package/src/instructions.ts +99 -0
- package/src/welcome.ts +1 -0
package/bin/welcome.js
CHANGED
|
@@ -46,6 +46,7 @@ const GROUPS = [
|
|
|
46
46
|
commands: [
|
|
47
47
|
{ name: 'agent setup', description: 'Install Mintlify skills and configure Admin MCP' },
|
|
48
48
|
{ name: 'config', description: 'Manage CLI configuration' },
|
|
49
|
+
{ name: 'instructions', description: 'Print Mintlify workflow instructions' },
|
|
49
50
|
{ name: 'update', description: 'Update to the latest version' },
|
|
50
51
|
],
|
|
51
52
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mintlify/cli",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.1767",
|
|
4
4
|
"description": "The Mintlify CLI",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=18.0.0"
|
|
@@ -106,5 +106,5 @@
|
|
|
106
106
|
"vitest": "2.1.9",
|
|
107
107
|
"vitest-mock-process": "1.0.4"
|
|
108
108
|
},
|
|
109
|
-
"gitHead": "
|
|
109
|
+
"gitHead": "25990bd1c8ce8738dc0b9933a51c0e8b5a543aef"
|
|
110
110
|
}
|
package/src/cli.tsx
CHANGED
|
@@ -37,6 +37,7 @@ import {
|
|
|
37
37
|
terminate,
|
|
38
38
|
} from './helpers.js';
|
|
39
39
|
import { init } from './init.js';
|
|
40
|
+
import { fetchInstructions, formatTopics } from './instructions.js';
|
|
40
41
|
import { getAccessToken } from './keyring.js';
|
|
41
42
|
import { login } from './login.js';
|
|
42
43
|
import { logout } from './logout.js';
|
|
@@ -601,6 +602,37 @@ export const cli = ({ packageName = 'mint' }: { packageName?: string }) => {
|
|
|
601
602
|
.example('mint broken-links --files "guides/**/*.mdx"', 'Check pages matching a glob'),
|
|
602
603
|
(argv) => brokenLinksHandler(argv)
|
|
603
604
|
)
|
|
605
|
+
.command(
|
|
606
|
+
'instructions [topics..]',
|
|
607
|
+
'Print Mintlify workflow instructions for agents',
|
|
608
|
+
(yargs) =>
|
|
609
|
+
yargs
|
|
610
|
+
.positional('topics', {
|
|
611
|
+
type: 'string',
|
|
612
|
+
array: true,
|
|
613
|
+
default: [] as string[],
|
|
614
|
+
description: 'Topic and optional subtopic',
|
|
615
|
+
})
|
|
616
|
+
.example('mint instructions', 'List topics')
|
|
617
|
+
.example('mint instructions publish domain', 'Custom domain instructions'),
|
|
618
|
+
async ({ topics }) => {
|
|
619
|
+
if (topics.length === 0) {
|
|
620
|
+
process.stdout.write(formatTopics());
|
|
621
|
+
await terminate(0);
|
|
622
|
+
return;
|
|
623
|
+
}
|
|
624
|
+
let markdown;
|
|
625
|
+
try {
|
|
626
|
+
markdown = await fetchInstructions(topics);
|
|
627
|
+
} catch (error) {
|
|
628
|
+
addLog(<ErrorLog message={error instanceof Error ? error.message : String(error)} />);
|
|
629
|
+
await terminate(1);
|
|
630
|
+
return;
|
|
631
|
+
}
|
|
632
|
+
await new Promise<void>((resolve) => process.stdout.write(markdown, () => resolve()));
|
|
633
|
+
await terminate(0);
|
|
634
|
+
}
|
|
635
|
+
)
|
|
604
636
|
.command(
|
|
605
637
|
'status',
|
|
606
638
|
'View current authentication status',
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
export const INSTRUCTIONS_URL = 'https://www.mintlify.com/docs/mint-instructions';
|
|
2
|
+
|
|
3
|
+
export const TOPICS: { name: string; when: string }[] = [
|
|
4
|
+
{
|
|
5
|
+
name: 'overview',
|
|
6
|
+
when: 'Start here: how Mintlify works and facts agents most often get wrong',
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
name: 'new-site',
|
|
10
|
+
when: 'New docs site, first publish, no account, claim a site, login, no docs.json yet',
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
name: 'write',
|
|
14
|
+
when: 'Before creating a page or writing more than a sentence or two; changelogs',
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
name: 'write components',
|
|
18
|
+
when: 'Adding or changing components: callouts, cards, steps, tabs, accordions, fields',
|
|
19
|
+
},
|
|
20
|
+
{ name: 'configure', when: 'Changing docs.json: theme, colors, logo, favicon, required fields' },
|
|
21
|
+
{
|
|
22
|
+
name: 'configure navigation',
|
|
23
|
+
when: 'Changing navigation: groups, tabs, anchors, dropdowns, products, versions, languages',
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
name: 'configure settings',
|
|
27
|
+
when: 'navbar, footer, banner, SEO, search, integrations, contextual menu, redirects, 404',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
name: 'configure customization',
|
|
31
|
+
when: 'Themes, fonts, CSS, JavaScript, or React snippets',
|
|
32
|
+
},
|
|
33
|
+
{ name: 'api-docs', when: 'API documentation: OpenAPI, AsyncAPI, GraphQL, playground' },
|
|
34
|
+
{
|
|
35
|
+
name: 'api-docs sdk',
|
|
36
|
+
when: 'SDK reference pages, x-codeSamples, oneOf/anyOf, multiple responses, hiding endpoints',
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: 'publish',
|
|
40
|
+
when: 'Deploying, "is it live", previews, rollbacks, MCP, llms.txt, skill.md, Markdown export',
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: 'publish domain',
|
|
44
|
+
when: 'Custom domain (mint add-domain), /docs subpath, reverse proxy, CSP',
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: 'publish repo',
|
|
48
|
+
when: 'Monorepo, multi-repo, GitHub/GitLab/Bitbucket, offline export, self-host',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: 'publish analytics',
|
|
52
|
+
when: 'mint analytics, feedback, search data, analytics integrations',
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
name: 'publish assistant',
|
|
56
|
+
when: 'AI assistant, widget, Assistant.md, skills, narration, own model',
|
|
57
|
+
},
|
|
58
|
+
{ name: 'access', when: 'Private docs, reader login, user groups, personalization' },
|
|
59
|
+
{ name: 'access team', when: 'Team members, roles, SSO, SCIM, audit logs, session security' },
|
|
60
|
+
{
|
|
61
|
+
name: 'automate',
|
|
62
|
+
when: 'Keep docs in sync with code: agent, Autopilot, automations, Slack, CI',
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
name: 'migrate',
|
|
66
|
+
when: 'Moving docs from Docusaurus, GitBook, ReadMe, Fern, Document360, Confluence, Markdown',
|
|
67
|
+
},
|
|
68
|
+
{ name: 'troubleshoot', when: 'An error, a failed build or deploy, or the site looks wrong' },
|
|
69
|
+
];
|
|
70
|
+
|
|
71
|
+
export const formatTopics = (): string => {
|
|
72
|
+
const width = Math.max(...TOPICS.map(({ name }) => name.length)) + 2;
|
|
73
|
+
return [
|
|
74
|
+
'Usage: mint instructions <topic> [subtopic]',
|
|
75
|
+
'',
|
|
76
|
+
...TOPICS.map(({ name, when }) => ` ${name.padEnd(width)}${when}`),
|
|
77
|
+
'',
|
|
78
|
+
].join('\n');
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export const instructionsUrl = (topics: string[]): string =>
|
|
82
|
+
`${INSTRUCTIONS_URL}/${topics.map(encodeURIComponent).join('/')}.md`;
|
|
83
|
+
|
|
84
|
+
export const stripDocsPreamble = (markdown: string): string =>
|
|
85
|
+
markdown.replace(/^(?:>.*\n|\s*\n)*/, '');
|
|
86
|
+
|
|
87
|
+
export async function fetchInstructions(topics: string[]): Promise<string> {
|
|
88
|
+
const url = instructionsUrl(topics);
|
|
89
|
+
const response = await fetch(url);
|
|
90
|
+
if (response.status === 404) {
|
|
91
|
+
throw new Error(
|
|
92
|
+
`no instructions for "${topics.join(' ')}". Run \`mint instructions\` to list topics.`
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
if (!response.ok) {
|
|
96
|
+
throw new Error(`failed to fetch ${url}: ${response.status} ${response.statusText}`);
|
|
97
|
+
}
|
|
98
|
+
return stripDocsPreamble(await response.text());
|
|
99
|
+
}
|
package/src/welcome.ts
CHANGED
|
@@ -59,6 +59,7 @@ const GROUPS: CommandGroup[] = [
|
|
|
59
59
|
commands: [
|
|
60
60
|
{ name: 'agent setup', description: 'Install Mintlify skills and configure Admin MCP' },
|
|
61
61
|
{ name: 'config', description: 'Manage CLI configuration' },
|
|
62
|
+
{ name: 'instructions', description: 'Print Mintlify workflow instructions' },
|
|
62
63
|
{ name: 'update', description: 'Update to the latest version' },
|
|
63
64
|
],
|
|
64
65
|
},
|