@mintlify/cli 4.0.1813 → 4.1.1

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.
Files changed (274) hide show
  1. package/dist/assets/export-scripts/README.classic.md +15 -0
  2. package/dist/assets/export-scripts/README.md +14 -0
  3. package/dist/assets/export-scripts/serve.js +114 -0
  4. package/dist/assets/export-scripts/start-docs.bat +10 -0
  5. package/dist/assets/export-scripts/start-docs.sh +9 -0
  6. package/dist/assets/og/Inter-Bold.ttf +0 -0
  7. package/dist/assets/og/Inter-Medium.ttf +0 -0
  8. package/dist/assets/og/Inter-Regular.ttf +0 -0
  9. package/dist/assets/og/Inter-SemiBold.ttf +0 -0
  10. package/dist/assets/og/PaperMono-Regular.ttf +0 -0
  11. package/dist/assets/og/index_bg.wasm +0 -0
  12. package/dist/assets/openChrome.applescript +94 -0
  13. package/dist/assets/socket.io/socket.io.esm.min.js +7 -0
  14. package/dist/assets/socket.io/socket.io.esm.min.js.map +1 -0
  15. package/dist/assets/socket.io/socket.io.js +4907 -0
  16. package/dist/assets/socket.io/socket.io.js.map +1 -0
  17. package/dist/assets/socket.io/socket.io.min.js +7 -0
  18. package/dist/assets/socket.io/socket.io.min.js.map +1 -0
  19. package/dist/assets/socket.io/socket.io.msgpack.min.js +7 -0
  20. package/dist/assets/socket.io/socket.io.msgpack.min.js.map +1 -0
  21. package/dist/assets/xdg-open +1066 -0
  22. package/dist/assets/yargs-locales/be.json +46 -0
  23. package/dist/assets/yargs-locales/cs.json +51 -0
  24. package/dist/assets/yargs-locales/de.json +46 -0
  25. package/dist/assets/yargs-locales/en.json +55 -0
  26. package/dist/assets/yargs-locales/es.json +46 -0
  27. package/dist/assets/yargs-locales/fi.json +49 -0
  28. package/dist/assets/yargs-locales/fr.json +53 -0
  29. package/dist/assets/yargs-locales/hi.json +49 -0
  30. package/dist/assets/yargs-locales/hu.json +46 -0
  31. package/dist/assets/yargs-locales/id.json +50 -0
  32. package/dist/assets/yargs-locales/it.json +46 -0
  33. package/dist/assets/yargs-locales/ja.json +51 -0
  34. package/dist/assets/yargs-locales/ko.json +49 -0
  35. package/dist/assets/yargs-locales/nb.json +44 -0
  36. package/dist/assets/yargs-locales/nl.json +49 -0
  37. package/dist/assets/yargs-locales/nn.json +44 -0
  38. package/dist/assets/yargs-locales/pirate.json +13 -0
  39. package/dist/assets/yargs-locales/pl.json +49 -0
  40. package/dist/assets/yargs-locales/pt.json +45 -0
  41. package/dist/assets/yargs-locales/pt_BR.json +48 -0
  42. package/dist/assets/yargs-locales/ru.json +51 -0
  43. package/dist/assets/yargs-locales/th.json +46 -0
  44. package/dist/assets/yargs-locales/tr.json +48 -0
  45. package/dist/assets/yargs-locales/uk_UA.json +51 -0
  46. package/dist/assets/yargs-locales/uz.json +52 -0
  47. package/dist/assets/yargs-locales/zh_CN.json +48 -0
  48. package/dist/assets/yargs-locales/zh_TW.json +51 -0
  49. package/dist/converter-d8O3xkdU.js +102 -0
  50. package/dist/devtools-CGNZQKFV.js +24 -0
  51. package/dist/index.js +8 -0
  52. package/dist/rolldown-runtime-CEAe2Uac.js +7 -0
  53. package/dist/schemas-CBsmCNpK.js +372 -0
  54. package/dist/start.js +2310 -0
  55. package/package.json +38 -31
  56. package/.oxlintrc.json +0 -5
  57. package/.prettierignore +0 -2
  58. package/.turbo/turbo-build.log +0 -1
  59. package/CONTRIBUTING.md +0 -45
  60. package/__test__/agent-auth.test.ts +0 -114
  61. package/__test__/agent-claim.test.ts +0 -164
  62. package/__test__/agent-credentials.test.ts +0 -149
  63. package/__test__/agent-deployment.test.ts +0 -106
  64. package/__test__/agent-setup-config.test.ts +0 -324
  65. package/__test__/agent-setup.test.ts +0 -207
  66. package/__test__/agent.test.ts +0 -64
  67. package/__test__/analytics/client.test.ts +0 -180
  68. package/__test__/analytics/dates.test.ts +0 -12
  69. package/__test__/analytics/filters.test.ts +0 -116
  70. package/__test__/analytics/format.test.ts +0 -137
  71. package/__test__/authenticatedFetch.test.ts +0 -182
  72. package/__test__/brokenLinks.test.ts +0 -283
  73. package/__test__/checkPort.test.ts +0 -92
  74. package/__test__/deploy-github-actions.test.ts +0 -202
  75. package/__test__/deploy-github-setup.test.ts +0 -240
  76. package/__test__/deploy-instructions.test.ts +0 -155
  77. package/__test__/deploy.test.ts +0 -202
  78. package/__test__/feedback.test.ts +0 -34
  79. package/__test__/foreignSyntax.test.ts +0 -73
  80. package/__test__/format.test.ts +0 -72
  81. package/__test__/helpers.test.ts +0 -52
  82. package/__test__/init.test.ts +0 -119
  83. package/__test__/instructions.test.ts +0 -53
  84. package/__test__/keyring.test.ts +0 -82
  85. package/__test__/mdxAccessibility.test.ts +0 -81
  86. package/__test__/migrate.test.ts +0 -186
  87. package/__test__/openApiCheck.test.ts +0 -185
  88. package/__test__/pathValidation.test.ts +0 -25
  89. package/__test__/resolveFiles.test.ts +0 -70
  90. package/__test__/sessionId.test.ts +0 -46
  91. package/__test__/signup.test.ts +0 -36
  92. package/__test__/update.test.ts +0 -117
  93. package/__test__/utils.ts +0 -25
  94. package/__test__/validateCommand.test.ts +0 -647
  95. package/__test__/validateEngine.test.ts +0 -245
  96. package/__test__/validateRules.test.ts +0 -1275
  97. package/__test__/welcome.test.ts +0 -15
  98. package/__test__/workflows/client.test.ts +0 -126
  99. package/bin/accessibility.js +0 -111
  100. package/bin/accessibilityCheck.js +0 -82
  101. package/bin/addDomain.js +0 -130
  102. package/bin/agent-auth.js +0 -104
  103. package/bin/agent-claim.js +0 -97
  104. package/bin/agent-credentials.js +0 -124
  105. package/bin/agent-deployment.js +0 -96
  106. package/bin/agent-http.js +0 -45
  107. package/bin/agent-setup-config.js +0 -141
  108. package/bin/agent-setup.js +0 -146
  109. package/bin/agent.js +0 -42
  110. package/bin/analytics/client.js +0 -60
  111. package/bin/analytics/dates.js +0 -6
  112. package/bin/analytics/filters.js +0 -27
  113. package/bin/analytics/format.js +0 -13
  114. package/bin/analytics/index.js +0 -496
  115. package/bin/analytics/output.js +0 -75
  116. package/bin/analytics/types.js +0 -1
  117. package/bin/authenticatedFetch.js +0 -46
  118. package/bin/brokenLinks.js +0 -122
  119. package/bin/callbackServer.js +0 -65
  120. package/bin/cli.js +0 -813
  121. package/bin/comingSoon.js +0 -26
  122. package/bin/config.js +0 -78
  123. package/bin/constants.js +0 -16
  124. package/bin/deploy-base.js +0 -20
  125. package/bin/deploy-github-actions.js +0 -102
  126. package/bin/deploy-github-setup.js +0 -165
  127. package/bin/deploy-instructions.js +0 -71
  128. package/bin/deploy.js +0 -123
  129. package/bin/feedback.js +0 -36
  130. package/bin/format.js +0 -121
  131. package/bin/helpers.js +0 -238
  132. package/bin/idToken.js +0 -14
  133. package/bin/index.js +0 -102
  134. package/bin/init.js +0 -182
  135. package/bin/instructions.js +0 -101
  136. package/bin/keyring.js +0 -78
  137. package/bin/login.js +0 -123
  138. package/bin/logout.js +0 -18
  139. package/bin/mdxAccessibility.js +0 -113
  140. package/bin/mdxLinter.js +0 -55
  141. package/bin/middlewares/subdomainMiddleware.js +0 -28
  142. package/bin/middlewares/telemetryMiddleware.js +0 -61
  143. package/bin/migrate.js +0 -54
  144. package/bin/og.js +0 -145
  145. package/bin/openApiCheck.js +0 -99
  146. package/bin/resolveFiles.js +0 -114
  147. package/bin/score/client.js +0 -40
  148. package/bin/score/index.js +0 -211
  149. package/bin/score/types.js +0 -1
  150. package/bin/signup.js +0 -118
  151. package/bin/start.js +0 -36
  152. package/bin/status.js +0 -106
  153. package/bin/telemetry/client.js +0 -53
  154. package/bin/telemetry/distinctId.js +0 -68
  155. package/bin/telemetry/sessionId.js +0 -36
  156. package/bin/telemetry/track.js +0 -149
  157. package/bin/templates.js +0 -127
  158. package/bin/tokenRefresh.js +0 -50
  159. package/bin/tsconfig.build.tsbuildinfo +0 -1
  160. package/bin/update.js +0 -65
  161. package/bin/validate/command.js +0 -127
  162. package/bin/validate/engine.js +0 -154
  163. package/bin/validate/files.js +0 -163
  164. package/bin/validate/mdx.js +0 -238
  165. package/bin/validate/output.js +0 -44
  166. package/bin/validate/report.js +0 -11
  167. package/bin/validate/rules/build.js +0 -102
  168. package/bin/validate/rules/content/duplicateH1.js +0 -57
  169. package/bin/validate/rules/content/foreignSyntax.js +0 -120
  170. package/bin/validate/rules/content/katex.js +0 -34
  171. package/bin/validate/rules/content/missingSnippet.js +0 -34
  172. package/bin/validate/rules/content/undefinedVariable.js +0 -13
  173. package/bin/validate/rules/content/unknownComponent.js +0 -121
  174. package/bin/validate/rules/content/voidTags.js +0 -38
  175. package/bin/validate/rules/index.js +0 -21
  176. package/bin/validate/rules/openapi.js +0 -50
  177. package/bin/validate/rules/parseError.js +0 -7
  178. package/bin/validate/site.js +0 -57
  179. package/bin/validate/types.js +0 -1
  180. package/bin/vendor/converter.js +0 -30882
  181. package/bin/welcome.js +0 -108
  182. package/bin/workflows/client.js +0 -34
  183. package/bin/workflows/index.js +0 -269
  184. package/bin/workflows/types.js +0 -11
  185. package/scripts/bundle-converter.mjs +0 -26
  186. package/scripts/generate-logo.mjs +0 -79
  187. package/src/accessibility.ts +0 -180
  188. package/src/accessibilityCheck.tsx +0 -150
  189. package/src/addDomain.tsx +0 -206
  190. package/src/agent-auth.ts +0 -119
  191. package/src/agent-claim.ts +0 -124
  192. package/src/agent-credentials.ts +0 -104
  193. package/src/agent-deployment.ts +0 -116
  194. package/src/agent-http.ts +0 -34
  195. package/src/agent-setup-config.ts +0 -144
  196. package/src/agent-setup.ts +0 -165
  197. package/src/agent.ts +0 -56
  198. package/src/analytics/client.ts +0 -153
  199. package/src/analytics/dates.ts +0 -6
  200. package/src/analytics/filters.ts +0 -50
  201. package/src/analytics/format.ts +0 -13
  202. package/src/analytics/index.tsx +0 -599
  203. package/src/analytics/output.ts +0 -99
  204. package/src/analytics/types.ts +0 -145
  205. package/src/authenticatedFetch.ts +0 -42
  206. package/src/brokenLinks.tsx +0 -152
  207. package/src/callbackServer.ts +0 -64
  208. package/src/cli.tsx +0 -1105
  209. package/src/comingSoon.tsx +0 -29
  210. package/src/config.ts +0 -75
  211. package/src/constants.ts +0 -28
  212. package/src/deploy-base.ts +0 -18
  213. package/src/deploy-github-actions.ts +0 -139
  214. package/src/deploy-github-setup.ts +0 -189
  215. package/src/deploy-instructions.ts +0 -76
  216. package/src/deploy.ts +0 -165
  217. package/src/feedback.tsx +0 -31
  218. package/src/format.tsx +0 -82
  219. package/src/helpers.tsx +0 -279
  220. package/src/idToken.ts +0 -17
  221. package/src/index.ts +0 -109
  222. package/src/init.tsx +0 -237
  223. package/src/instructions.ts +0 -99
  224. package/src/keyring.ts +0 -65
  225. package/src/login.tsx +0 -166
  226. package/src/logout.tsx +0 -8
  227. package/src/mdxAccessibility.ts +0 -134
  228. package/src/mdxLinter.tsx +0 -88
  229. package/src/middlewares/subdomainMiddleware.ts +0 -20
  230. package/src/middlewares/telemetryMiddleware.ts +0 -55
  231. package/src/migrate.ts +0 -76
  232. package/src/og.tsx +0 -185
  233. package/src/openApiCheck.tsx +0 -125
  234. package/src/resolveFiles.ts +0 -101
  235. package/src/score/client.ts +0 -36
  236. package/src/score/index.tsx +0 -205
  237. package/src/score/types.ts +0 -15
  238. package/src/signup.tsx +0 -172
  239. package/src/start.ts +0 -27
  240. package/src/status.tsx +0 -129
  241. package/src/telemetry/client.ts +0 -46
  242. package/src/telemetry/distinctId.ts +0 -70
  243. package/src/telemetry/sessionId.ts +0 -40
  244. package/src/telemetry/track.ts +0 -163
  245. package/src/templates.tsx +0 -143
  246. package/src/tokenRefresh.ts +0 -53
  247. package/src/update.tsx +0 -89
  248. package/src/validate/command.tsx +0 -135
  249. package/src/validate/engine.ts +0 -210
  250. package/src/validate/files.ts +0 -249
  251. package/src/validate/mdx.ts +0 -290
  252. package/src/validate/output.tsx +0 -76
  253. package/src/validate/report.ts +0 -40
  254. package/src/validate/rules/build.ts +0 -146
  255. package/src/validate/rules/content/duplicateH1.ts +0 -78
  256. package/src/validate/rules/content/foreignSyntax.ts +0 -144
  257. package/src/validate/rules/content/katex.ts +0 -33
  258. package/src/validate/rules/content/missingSnippet.ts +0 -36
  259. package/src/validate/rules/content/undefinedVariable.ts +0 -20
  260. package/src/validate/rules/content/unknownComponent.ts +0 -130
  261. package/src/validate/rules/content/voidTags.ts +0 -43
  262. package/src/validate/rules/index.ts +0 -23
  263. package/src/validate/rules/openapi.ts +0 -59
  264. package/src/validate/rules/parseError.ts +0 -9
  265. package/src/validate/site.ts +0 -53
  266. package/src/validate/types.ts +0 -102
  267. package/src/vendor/converter.ts +0 -1
  268. package/src/welcome.ts +0 -154
  269. package/src/workflows/client.ts +0 -39
  270. package/src/workflows/index.tsx +0 -287
  271. package/src/workflows/types.ts +0 -73
  272. package/tsconfig.build.json +0 -4
  273. package/tsconfig.json +0 -10
  274. package/vitest.config.ts +0 -9
package/bin/cli.js DELETED
@@ -1,813 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
- import { addLog, dev, exportSite, ErrorLog, SuccessLog, Logs, WarningLog, } from '@mintlify/previewing';
12
- import { thumbnailOverrideSchema } from '@mintlify/validation';
13
- import { render, Text } from 'ink';
14
- import yargs from 'yargs';
15
- import { hideBin } from 'yargs/helpers';
16
- import { accessibilityCheck } from './accessibilityCheck.js';
17
- import { addDomain } from './addDomain.js';
18
- import { claimDeployment, createAgentClaimLink } from './agent-claim.js';
19
- import { SETUP_AGENTS, setupAgent } from './agent-setup.js';
20
- import { analyticsBuilder } from './analytics/index.js';
21
- import { brokenLinksHandler } from './brokenLinks.js';
22
- import { comingSoon } from './comingSoon.js';
23
- import { setTelemetryEnabled } from './config.js';
24
- import { getConfigValue, setConfigValue, clearConfigValue } from './config.js';
25
- import { API_URL } from './constants.js';
26
- import { pushBaseCheckout } from './deploy-base.js';
27
- import { deployFromGithubActions, isGithubActions } from './deploy-github-actions.js';
28
- import { formatGithubSetup, setupGithubDeployment } from './deploy-github-setup.js';
29
- import { DEPLOY_HELP, deploymentInstructions } from './deploy-instructions.js';
30
- import { agentEditorUrl, formatDeployment, prepareAgentDeployment } from './deploy.js';
31
- import { FEEDBACK_CATEGORIES, feedback } from './feedback.js';
32
- import { formatHandler } from './format.js';
33
- import { checkPort, checkNodeVersion, autoUpgradeIfNeeded, getVersions, isAI, suppressConsoleWarnings, terminate, } from './helpers.js';
34
- import { init } from './init.js';
35
- import { fetchInstructions, formatTopics } from './instructions.js';
36
- import { getAccessToken } from './keyring.js';
37
- import { login } from './login.js';
38
- import { logout } from './logout.js';
39
- import { mdxLinter } from './mdxLinter.js';
40
- import { createTelemetryMiddleware } from './middlewares/telemetryMiddleware.js';
41
- import { agents, listMigrationDocs, migrateWithAgent, migrationInstructions, } from './migrate.js';
42
- import { ogCommand } from './og.js';
43
- import { buildOverlayRegistryForCheck, checkOpenApiFile } from './openApiCheck.js';
44
- import { scoreHandler } from './score/index.js';
45
- import { signup } from './signup.js';
46
- import { status, getCliSubdomains } from './status.js';
47
- import { trackEvent, trackTelemetryPreferenceChange } from './telemetry/track.js';
48
- import { update } from './update.js';
49
- import { splitList, validateHandler } from './validate/command.js';
50
- import { RULES } from './validate/rules/index.js';
51
- import { PARSE_ERROR } from './validate/rules/parseError.js';
52
- import { GROUPS } from './validate/types.js';
53
- import { renderWelcome } from './welcome.js';
54
- import { workflowsBuilder } from './workflows/index.js';
55
- // The branded welcome screen replaces yargs' default help, but only for an
56
- // interactive human at a TTY. Piped, scripted, AI, and test callers keep the
57
- // plain yargs help so their output stays parseable and stable.
58
- const shouldShowWelcome = (args) => {
59
- const interactive = Boolean(process.stdout.isTTY) && !isAI() && process.env.CLI_TEST_MODE !== 'true';
60
- if (!interactive)
61
- return false;
62
- if (args.length === 0)
63
- return true;
64
- const positionals = args.filter((arg) => !arg.startsWith('-'));
65
- const command = positionals[0];
66
- // `help` followed by a subcommand (e.g. `mint help dev`) is a subcommand
67
- // lookup — let yargs handle it rather than intercepting with the welcome screen.
68
- const isTopLevel = command === undefined || (command === 'help' && positionals.length === 1);
69
- const helpRequested = command === 'help' || args.includes('--help') || args.includes('-h');
70
- return isTopLevel && helpRequested;
71
- };
72
- const showWelcome = (packageName) => __awaiter(void 0, void 0, void 0, function* () {
73
- const { cli: version } = getVersions(packageName);
74
- const subdomain = getConfigValue('subdomain');
75
- let signedIn = false;
76
- try {
77
- signedIn = Boolean(yield getAccessToken());
78
- }
79
- catch (_a) { }
80
- process.stdout.write(renderWelcome({ packageName, version, signedIn, subdomain }));
81
- yield terminate(0);
82
- });
83
- export const cli = ({ packageName = 'mint' }) => {
84
- const commandArguments = hideBin(process.argv);
85
- if (shouldShowWelcome(commandArguments)) {
86
- return showWelcome(packageName);
87
- }
88
- const telemetryMiddleware = createTelemetryMiddleware();
89
- render(_jsx(Logs, {}));
90
- return (yargs(commandArguments)
91
- .scriptName(packageName)
92
- .option('telemetry', {
93
- type: 'boolean',
94
- alias: 't',
95
- description: 'Enable or disable usage telemetry',
96
- })
97
- .middleware((argv) => __awaiter(void 0, void 0, void 0, function* () {
98
- if (argv.telemetry !== undefined && argv._.length === 0) {
99
- yield setTelemetryEnabled(argv.telemetry);
100
- yield trackTelemetryPreferenceChange({ enabled: argv.telemetry });
101
- addLog(_jsx(SuccessLog, { message: `telemetry ${argv.telemetry ? 'enabled' : 'disabled'}` }));
102
- yield terminate(0);
103
- }
104
- }), true)
105
- .middleware(checkNodeVersion)
106
- .middleware(suppressConsoleWarnings)
107
- .middleware(telemetryMiddleware)
108
- .command('agent', 'Set up AI coding agents for Mintlify', (yargs) => yargs
109
- .command('setup', 'Install Mintlify skills and configure Admin MCP', (yargs) => yargs
110
- .exitProcess(false)
111
- .option('agent', {
112
- alias: 'a',
113
- type: 'string',
114
- array: true,
115
- choices: SETUP_AGENTS,
116
- description: 'Agents to configure (defaults to interactive selection)',
117
- })
118
- .option('global', {
119
- alias: 'g',
120
- type: 'boolean',
121
- default: false,
122
- description: 'Set up agents for your user account instead of this project',
123
- })
124
- .example('$0 agent setup', 'Choose agents and set up the current project')
125
- .example('$0 agent setup --agent codex --global', 'Set up Codex for your user account')
126
- .epilog('Requires Node.js 22.20 or later and npm. Admin MCP requires a separate OAuth sign-in in each agent.'), (argv) => __awaiter(void 0, void 0, void 0, function* () {
127
- try {
128
- yield setupAgent({ agents: argv.agent, global: argv.global });
129
- yield terminate(0);
130
- }
131
- catch (error) {
132
- process.stderr.write(`${error instanceof Error ? error.message : 'Agent setup failed.'}\n`);
133
- yield terminate(1);
134
- }
135
- }))
136
- .demandCommand(1, 'Run mint agent setup to configure your coding agents.'))
137
- .command('claim', 'Claim a site created with mint deploy', (yargs) => yargs
138
- .option('email', { type: 'string', description: 'User email for a claim link' })
139
- .option('code', {
140
- type: 'string',
141
- description: 'Code returned by the user from the claim page',
142
- })
143
- .option('directory', {
144
- type: 'string',
145
- default: '.',
146
- description: 'Original documentation directory used for mint deploy',
147
- })
148
- .conflicts('code', 'email')
149
- .example('$0 claim --email you@example.com', 'Get a claim link for the current site')
150
- .example('$0 claim --code ABCDEFGH', 'Finish the claim with the code from the user')
151
- .epilog('Run from the same directory as mint deploy, or pass --directory. Ask the user to open the claim link and return the code. The CLI reads saved credentials internally; do not read or print keychain secrets. Retry the same command if Mintlify signup fails.'), (argv) => __awaiter(void 0, void 0, void 0, function* () {
152
- try {
153
- const message = yield claimDeployment({ apiUrl: API_URL, directory: argv.directory, code: argv.code, email: argv.email }, (message) => process.stderr.write(`${message}\n`));
154
- process.stdout.write(`${message}\n`);
155
- yield terminate(0);
156
- }
157
- catch (error) {
158
- process.stderr.write(`${error instanceof Error ? error.message : 'Claim failed.'}\n`);
159
- yield terminate(1);
160
- }
161
- }))
162
- .command('deploy', 'Provision an anonymous docs site and get Git push instructions', (yargs) => yargs
163
- .option('subdomain', {
164
- type: 'string',
165
- description: 'Requested site name; required for the first deployment or --new',
166
- })
167
- .option('org-name', { type: 'string', description: 'Organization display name' })
168
- .option('directory', {
169
- type: 'string',
170
- default: '.',
171
- description: 'Documentation directory associated with this site',
172
- })
173
- .option('new', {
174
- type: 'boolean',
175
- default: false,
176
- description: 'Create a new registration and site',
177
- })
178
- .option('email', {
179
- type: 'string',
180
- description: 'User email for an optional claim link',
181
- })
182
- .option('github', {
183
- type: 'boolean',
184
- description: 'Trust this GitHub repository to deploy the site and write a GitHub Actions workflow',
185
- })
186
- .option('force', {
187
- type: 'boolean',
188
- default: false,
189
- description: 'With --github, overwrite an existing .github/workflows/mintlify.yml',
190
- })
191
- .option('base', {
192
- type: 'boolean',
193
- description: 'Provision a base, edited in the Mintlify editor, instead of a docs site',
194
- })
195
- .option('push', {
196
- type: 'string',
197
- description: 'With --base, rebase this clone onto main and push it to the base',
198
- })
199
- .implies('push', 'base')
200
- .conflicts('push', 'email')
201
- .conflicts('github', 'email')
202
- .conflicts('base', 'github')
203
- .example('$0 deploy --subdomain my-docs', 'Provision a site without signing in')
204
- .example('$0 deploy --email you@example.com', 'Get repository access and a claim link for the current site')
205
- .example('$0 deploy --new --subdomain another-site', 'Create another anonymous site')
206
- .example('$0 deploy --base --subdomain my-base', 'Provision a base and get its editor link')
207
- .example('$0 deploy --github --subdomain my-docs', 'Deploy the site from GitHub Actions on every push to the default branch')
208
- .example('$0 deploy --subdomain my-docs', 'In GitHub Actions with id-token: write, push the current commit to a trusted site')
209
- .epilog(DEPLOY_HELP), (argv) => __awaiter(void 0, void 0, void 0, function* () {
210
- try {
211
- if (isGithubActions()) {
212
- const siteUrl = yield deployFromGithubActions({ apiUrl: API_URL, directory: argv.directory, subdomain: argv.subdomain }, (message) => process.stderr.write(`${message}\n`));
213
- process.stdout.write(`Pushed to ${argv.subdomain}; the build starts now.\nSite: ${siteUrl}\n`);
214
- yield terminate(0);
215
- return;
216
- }
217
- if (argv.github) {
218
- const setup = yield setupGithubDeployment({
219
- apiUrl: API_URL,
220
- directory: argv.directory,
221
- subdomain: argv.subdomain,
222
- orgName: argv.orgName,
223
- newSite: argv.new,
224
- force: argv.force,
225
- }, (message) => process.stderr.write(`Warning: ${message}\n`), (message) => process.stderr.write(`${message}\n`));
226
- process.stdout.write(`${formatGithubSetup(setup)}\n`);
227
- yield terminate(0);
228
- return;
229
- }
230
- const result = yield prepareAgentDeployment({
231
- apiUrl: API_URL,
232
- directory: argv.directory,
233
- subdomain: argv.subdomain,
234
- orgName: argv.orgName,
235
- newSite: argv.new,
236
- base: argv.base,
237
- }, (message) => {
238
- process.stderr.write(`Warning: ${message}\n`);
239
- }, (message) => process.stderr.write(`${message}\n`));
240
- if (argv.push && result.status === 'ready') {
241
- yield pushBaseCheckout(argv.push, result.write);
242
- process.stdout.write(`Pushed ${argv.push} to the base.\nEditor: ${agentEditorUrl(result.site)}\n`);
243
- yield terminate(0);
244
- return;
245
- }
246
- process.stdout.write(`${formatDeployment(result, API_URL)}\n`);
247
- let claimUrl;
248
- if (argv.email && result.status === 'ready') {
249
- try {
250
- process.stderr.write('Creating the claim link...\n');
251
- claimUrl = yield createAgentClaimLink(API_URL, result.credentials, argv.email);
252
- }
253
- catch (error) {
254
- const reason = error instanceof Error ? ` ${error.message}` : '';
255
- process.stderr.write(`Warning: Could not create the claim link.${reason} Your site is provisioned; retry with --email later.\n`);
256
- }
257
- }
258
- process.stdout.write(`${deploymentInstructions(result, claimUrl)}\n`);
259
- yield terminate(0);
260
- }
261
- catch (error) {
262
- process.stderr.write(`${error instanceof Error ? error.message : 'Deployment failed.'}\n`);
263
- yield terminate(1);
264
- }
265
- }))
266
- .command('dev', 'Initialize a local preview environment', (yargs) => yargs
267
- .option('open', {
268
- type: 'boolean',
269
- default: true,
270
- description: 'open a local preview in the browser',
271
- })
272
- .option('local-schema', {
273
- type: 'boolean',
274
- default: false,
275
- hidden: true,
276
- description: 'use a locally hosted schema file (note: only https protocol is supported in production)',
277
- })
278
- .option('client-version', {
279
- type: 'string',
280
- hidden: true,
281
- description: 'the version of the client to use for cli testing',
282
- })
283
- .option('local-client-version', {
284
- type: 'string',
285
- hidden: true,
286
- description: 'path to local client repo to symlink for development',
287
- })
288
- .option('groups', {
289
- type: 'array',
290
- description: 'Mock user groups for local development and testing',
291
- example: '--groups admin user',
292
- })
293
- .option('signed-in', {
294
- type: 'boolean',
295
- default: false,
296
- description: 'Mock a signed-in user with no groups for local development and testing',
297
- })
298
- .option('disable-openapi', {
299
- type: 'boolean',
300
- default: false,
301
- description: 'Disable OpenAPI file generation',
302
- })
303
- .option('disable-prefetch', {
304
- type: 'boolean',
305
- default: false,
306
- description: 'Disable navigation prefetching in the local preview',
307
- })
308
- .option('host', {
309
- type: 'boolean',
310
- default: false,
311
- description: 'Expose the local preview on your network',
312
- })
313
- .option('classic', {
314
- type: 'boolean',
315
- default: false,
316
- description: 'Preview with the classic client',
317
- })
318
- .usage('usage: mintlify dev [options]')
319
- .example('mintlify dev', 'run with default settings (opens in browser)')
320
- .example('mintlify dev --no-open', 'run without opening in browser'), (argv) => __awaiter(void 0, void 0, void 0, function* () {
321
- var _a, _b;
322
- yield autoUpgradeIfNeeded();
323
- const port = yield checkPort(argv);
324
- const { cli: cliVersion } = getVersions(packageName);
325
- let accessToken;
326
- let subdomain;
327
- try {
328
- accessToken = (_a = (yield getAccessToken())) !== null && _a !== void 0 ? _a : undefined;
329
- const configuredSubdomain = getConfigValue('subdomain');
330
- subdomain =
331
- configuredSubdomain !== null && configuredSubdomain !== void 0 ? configuredSubdomain : (accessToken ? (yield getCliSubdomains(accessToken))[0] : undefined);
332
- }
333
- catch (_c) { }
334
- if (port != undefined) {
335
- yield dev(Object.assign(Object.assign({}, argv), { groups: (_b = argv.groups) !== null && _b !== void 0 ? _b : (argv.signedIn ? [] : undefined), port,
336
- packageName,
337
- cliVersion,
338
- accessToken,
339
- subdomain, apiUrl: API_URL }));
340
- }
341
- else {
342
- addLog(_jsx(ErrorLog, { message: "no available port found" }));
343
- yield terminate(1);
344
- }
345
- }))
346
- .command('validate', 'Check the docs: content, OpenAPI specs, then a strict build. Exits 0 with no errors, 1 with errors, 2 when validate itself could not run', (yargs) => yargs
347
- .option('local-schema', {
348
- type: 'boolean',
349
- default: false,
350
- hidden: true,
351
- description: 'use a locally hosted schema file',
352
- })
353
- .option('client-version', {
354
- type: 'string',
355
- hidden: true,
356
- description: 'the version of the client to use for cli testing',
357
- })
358
- .option('groups', {
359
- type: 'array',
360
- description: 'Mock user groups for validation',
361
- })
362
- .option('files', {
363
- type: 'string',
364
- array: true,
365
- description: 'Limit page checks to these files or globs; site-wide checks and the build still cover the whole site',
366
- })
367
- .option('build', {
368
- type: 'boolean',
369
- default: true,
370
- description: 'Run the strict build after the other checks pass; --no-build skips it, so no client download is needed. Remote OpenAPI specs are still fetched unless openapi rules are disabled',
371
- })
372
- .option('enable', {
373
- type: 'string',
374
- array: true,
375
- coerce: splitList,
376
- description: 'Turn on rules or groups (comma-separated), for example after --disable all',
377
- })
378
- .option('disable', {
379
- type: 'string',
380
- array: true,
381
- coerce: splitList,
382
- description: 'Turn off rules or groups (comma-separated), or all; parse errors are still reported',
383
- })
384
- .option('fix', {
385
- type: 'boolean',
386
- default: false,
387
- description: 'Apply the fixes and check again',
388
- })
389
- .option('format', {
390
- type: 'string',
391
- choices: ['text', 'json'],
392
- default: 'text',
393
- description: 'Output format; json prints one report ({ passed, summary, diagnostics, build }) and nothing else on stdout, and errors to stderr',
394
- })
395
- .usage('usage: mint validate [options]')
396
- .epilogue([
397
- `Groups: ${GROUPS.join(', ')}. Rules:`,
398
- ...RULES.map(({ id, description }) => ` ${id} — ${description}`),
399
- ` parse-error — ${PARSE_ERROR.description} (always runs)`,
400
- ].join('\n'))
401
- .example('mint validate', 'run every check and the build')
402
- .example('mint validate --no-build --format json', 'fast offline check for scripts and agents')
403
- .example('mint validate --files "guides/**/*.mdx" --fix', 'check some pages and apply fixes')
404
- .example('mint validate --disable all --enable content', 'run the content rules only; missing-file and import-error still run the build')
405
- .strict(), (argv) => validateHandler(argv, packageName))
406
- .command('export', 'Export a static site for air-gapped deployment', (yargs) => yargs
407
- .option('output', {
408
- type: 'string',
409
- default: 'export.zip',
410
- description: 'output zip file path',
411
- })
412
- .option('client-version', {
413
- type: 'string',
414
- hidden: true,
415
- })
416
- .option('local-client-version', {
417
- type: 'string',
418
- hidden: true,
419
- description: 'path to local client repo to symlink for development',
420
- })
421
- .option('groups', {
422
- type: 'array',
423
- description: 'Mock user groups for export',
424
- })
425
- .option('base-path', {
426
- type: 'string',
427
- description: 'path prefix the export will be served under, e.g. /docs',
428
- })
429
- .option('disable-openapi', {
430
- type: 'boolean',
431
- default: false,
432
- description: 'Disable OpenAPI file generation',
433
- })
434
- .option('classic', {
435
- type: 'boolean',
436
- default: false,
437
- description: 'Export with the classic client',
438
- })
439
- .usage('usage: mintlify export [options]')
440
- .example('mintlify export', 'export as export.zip')
441
- .example('mintlify export --output docs.zip', 'export to custom filename')
442
- .example('mintlify export --base-path /docs', 'export for hosting under /docs'), (argv) => __awaiter(void 0, void 0, void 0, function* () {
443
- const { cli: cliVersion } = getVersions(packageName);
444
- yield exportSite(Object.assign(Object.assign({}, argv), { packageName,
445
- cliVersion }));
446
- yield terminate(0);
447
- }))
448
- .command('openapi-check <filename>', false, (yargs) => yargs
449
- .positional('filename', {
450
- describe: 'the filename of the OpenAPI spec (e.g. ./openapi.yaml) or the URL to the OpenAPI spec (e.g. https://petstore3.swagger.io/api/v3/openapi.json)',
451
- type: 'string',
452
- demandOption: true,
453
- })
454
- .option('local-schema', {
455
- type: 'boolean',
456
- default: false,
457
- description: 'use a locally hosted schema file (note: only https protocol is supported in production)',
458
- }), (_a) => __awaiter(void 0, [_a], void 0, function* ({ filename, 'local-schema': localSchema }) {
459
- addLog(_jsx(WarningLog, { message: "openapi-check is deprecated, use `mintlify validate` instead" }));
460
- let overlayRegistry;
461
- try {
462
- overlayRegistry = yield buildOverlayRegistryForCheck(localSchema);
463
- }
464
- catch (error) {
465
- addLog(_jsx(ErrorLog, { message: error instanceof Error ? error.message : String(error) }));
466
- yield terminate(1);
467
- return;
468
- }
469
- const valid = yield checkOpenApiFile(filename, localSchema, overlayRegistry);
470
- yield terminate(valid ? 0 : 1);
471
- }))
472
- .command('broken-links', 'Check for broken links', (yargs) => yargs
473
- .option('files', {
474
- type: 'string',
475
- array: true,
476
- description: 'Files or globs to check (defaults to the whole site)',
477
- })
478
- .option('check-anchors', {
479
- type: 'boolean',
480
- default: false,
481
- description: 'also validate anchor links (e.g. #section) against heading slugs',
482
- })
483
- .option('check-external', {
484
- type: 'boolean',
485
- default: false,
486
- description: 'also check external links for broken URLs',
487
- })
488
- .option('check-snippets', {
489
- type: 'boolean',
490
- default: false,
491
- description: 'also check links inside <Snippet> components',
492
- })
493
- .option('check-redirects', {
494
- type: 'boolean',
495
- default: false,
496
- description: 'also check that docs.json redirect destinations resolve to valid paths',
497
- })
498
- .example('mint broken-links --files introduction.mdx', 'Check a specific page')
499
- .example('mint broken-links --files "guides/**/*.mdx"', 'Check pages matching a glob'), (argv) => brokenLinksHandler(argv))
500
- .command('instructions [topics..]', 'Print Mintlify workflow instructions for agents', (yargs) => yargs
501
- .positional('topics', {
502
- type: 'string',
503
- array: true,
504
- default: [],
505
- description: 'Topic and optional subtopic',
506
- })
507
- .example('mint instructions', 'List topics')
508
- .example('mint instructions publish domain', 'Custom domain instructions'), (_a) => __awaiter(void 0, [_a], void 0, function* ({ topics }) {
509
- if (topics.length === 0) {
510
- process.stdout.write(formatTopics());
511
- yield terminate(0);
512
- return;
513
- }
514
- let markdown;
515
- try {
516
- markdown = yield fetchInstructions(topics);
517
- }
518
- catch (error) {
519
- addLog(_jsx(ErrorLog, { message: error instanceof Error ? error.message : String(error) }));
520
- yield terminate(1);
521
- return;
522
- }
523
- yield new Promise((resolve) => process.stdout.write(markdown, () => resolve()));
524
- yield terminate(0);
525
- }))
526
- .command('status', 'View current authentication status', () => undefined, () => __awaiter(void 0, void 0, void 0, function* () {
527
- yield status();
528
- yield terminate(0);
529
- }))
530
- .command('logout', 'Logout of your Mintlify account', () => undefined, () => __awaiter(void 0, void 0, void 0, function* () {
531
- yield logout();
532
- yield terminate(0);
533
- }))
534
- .command('login', 'Authenticate your account to Mintlify', () => undefined, () => __awaiter(void 0, void 0, void 0, function* () {
535
- yield login();
536
- yield terminate(0);
537
- }))
538
- .command('signup', 'Create a new Mintlify account', (yargs) => yargs
539
- .option('firstName', { type: 'string', description: 'First name' })
540
- .option('lastName', { type: 'string', description: 'Last name' })
541
- .option('company', { type: 'string', description: 'Company name' })
542
- .option('email', { type: 'string', description: 'Email address' })
543
- .epilogue('Note: this command does not return until the user clicks the verification link ' +
544
- 'sent to their email, which can take several minutes. Non-interactive or scripted ' +
545
- 'callers should run it as a background process rather than waiting on it synchronously.'), (argv) => __awaiter(void 0, void 0, void 0, function* () {
546
- yield signup({
547
- firstName: argv.firstName,
548
- lastName: argv.lastName,
549
- company: argv.company,
550
- email: argv.email,
551
- });
552
- yield terminate(0);
553
- }))
554
- .command('add-domain <domain>', 'Add a custom domain to your deployment', (yargs) => yargs
555
- .positional('domain', {
556
- type: 'string',
557
- demandOption: true,
558
- description: 'The custom domain to add (e.g. docs.example.com)',
559
- })
560
- .option('basePath', {
561
- type: 'string',
562
- description: 'Serve the docs under a base path (e.g. /docs)',
563
- }), (argv) => __awaiter(void 0, void 0, void 0, function* () {
564
- yield addDomain(argv.domain, argv.basePath);
565
- yield terminate(0);
566
- }))
567
- .command('feedback <message>', 'Send feedback to the Mintlify team', (yargs) => yargs
568
- .positional('message', {
569
- type: 'string',
570
- demandOption: true,
571
- description: 'Feedback to send. Leave out API keys, tokens, and other secrets',
572
- })
573
- .option('client-id', {
574
- type: 'string',
575
- demandOption: true,
576
- description: 'ID for this report, so the team can tell retries apart',
577
- })
578
- .option('category', {
579
- choices: FEEDBACK_CATEGORIES,
580
- demandOption: true,
581
- description: 'Feedback category',
582
- })
583
- .example('$0 feedback "mint dev crashes on a missing image" --client-id 7f3a --category bug', 'Report a bug')
584
- .epilog('Never include API keys, tokens, passwords, or other secrets in the message.'), (argv) => __awaiter(void 0, void 0, void 0, function* () {
585
- const sent = yield feedback({
586
- message: argv.message,
587
- clientId: argv.clientId,
588
- category: argv.category,
589
- });
590
- yield terminate(sent ? 0 : 1);
591
- }))
592
- .command('config', 'Manage CLI configuration', (yargs) => yargs
593
- .command('set <key> <value>', 'Set a configuration value', (yargs) => yargs
594
- .positional('key', {
595
- type: 'string',
596
- demandOption: true,
597
- description: 'Config key (e.g. subdomain)',
598
- })
599
- .positional('value', {
600
- type: 'string',
601
- demandOption: true,
602
- description: 'Config value',
603
- }), (argv) => __awaiter(void 0, void 0, void 0, function* () {
604
- const validKeys = ['subdomain', 'dateFrom', 'dateTo'];
605
- if (!validKeys.includes(argv.key)) {
606
- addLog(_jsx(ErrorLog, { message: `Unknown config key: "${argv.key}". Valid keys: ${validKeys.join(', ')}` }));
607
- yield terminate(1);
608
- return;
609
- }
610
- yield setConfigValue(argv.key, argv.value);
611
- addLog(_jsx(SuccessLog, { message: `${argv.key} = "${argv.value}"` }));
612
- yield terminate(0);
613
- }))
614
- .command('get <key>', 'Get a configuration value', (yargs) => yargs.positional('key', {
615
- type: 'string',
616
- demandOption: true,
617
- description: 'Config key (e.g. subdomain, dateFrom, dateTo)',
618
- }), (argv) => __awaiter(void 0, void 0, void 0, function* () {
619
- const validKeys = ['subdomain', 'dateFrom', 'dateTo'];
620
- if (!validKeys.includes(argv.key)) {
621
- addLog(_jsx(ErrorLog, { message: `Unknown config key: "${argv.key}". Valid keys: ${validKeys.join(', ')}` }));
622
- yield terminate(1);
623
- return;
624
- }
625
- const val = getConfigValue(argv.key);
626
- addLog(_jsx(Text, { children: val !== null && val !== void 0 ? val : 'not set' }));
627
- yield terminate(0);
628
- }))
629
- .command('clear <key>', 'Remove a configuration value', (yargs) => yargs.positional('key', {
630
- type: 'string',
631
- demandOption: true,
632
- description: 'Config key (e.g. subdomain, dateFrom, dateTo)',
633
- }), (argv) => __awaiter(void 0, void 0, void 0, function* () {
634
- const validKeys = ['subdomain', 'dateFrom', 'dateTo'];
635
- if (!validKeys.includes(argv.key)) {
636
- addLog(_jsx(ErrorLog, { message: `Unknown config key: "${argv.key}". Valid keys: ${validKeys.join(', ')}` }));
637
- yield terminate(1);
638
- return;
639
- }
640
- yield clearConfigValue(argv.key);
641
- addLog(_jsx(SuccessLog, { message: `${argv.key} cleared` }));
642
- yield terminate(0);
643
- }))
644
- .demandCommand(1, 'specify a subcommand: set, get, or clear'))
645
- .command('update', 'Update the CLI to the latest version', () => undefined, () => __awaiter(void 0, void 0, void 0, function* () {
646
- yield update({ packageName });
647
- yield terminate(0);
648
- }))
649
- .command(['a11y', 'accessibility-check', 'a11y-check', 'accessibility'], 'Check for accessibility issues in documentation', (yargs) => yargs
650
- .option('skip-contrast', {
651
- type: 'boolean',
652
- default: false,
653
- description: 'Skip color contrast checks',
654
- })
655
- .option('skip-alt-text', {
656
- type: 'boolean',
657
- default: false,
658
- description: 'Skip alt text checks on images and videos',
659
- })
660
- .check((argv) => {
661
- if (argv.skipContrast && argv.skipAltText) {
662
- throw new Error('Cannot skip both contrast and alt-text checks');
663
- }
664
- return true;
665
- })
666
- .example('mint a11y', 'Run all accessibility checks')
667
- .example('mint a11y --skip-contrast', 'Only check for missing alt text')
668
- .example('mint a11y --skip-alt-text', 'Only check color contrast'), (argv) => __awaiter(void 0, void 0, void 0, function* () {
669
- let accessibilityCheckTerminateCode = 0;
670
- let mdxLinterTerminateCode = 0;
671
- if (!argv.skipContrast) {
672
- accessibilityCheckTerminateCode = yield accessibilityCheck();
673
- }
674
- if (!argv.skipAltText) {
675
- mdxLinterTerminateCode = yield mdxLinter();
676
- }
677
- yield terminate(accessibilityCheckTerminateCode || mdxLinterTerminateCode);
678
- }))
679
- .command('og [page]', 'Render the social preview (OG) image for a page', (yargs) => yargs
680
- .positional('page', {
681
- type: 'string',
682
- description: 'Page path, such as guides/webhooks. Defaults to index',
683
- })
684
- .option('preset', {
685
- choices: thumbnailOverrideSchema.shape.preset.unwrap().options,
686
- description: 'Try a preset without editing docs.json',
687
- })
688
- .option('surface', {
689
- choices: thumbnailOverrideSchema.shape.surface.unwrap().options,
690
- description: 'Try a surface without editing docs.json',
691
- })
692
- .option('appearance', {
693
- choices: thumbnailOverrideSchema.shape.appearance.unwrap().options,
694
- description: 'Try an appearance without editing docs.json',
695
- })
696
- .option('output', {
697
- type: 'string',
698
- description: 'Where to write the PNG. Defaults to a temporary file',
699
- })
700
- .option('open', {
701
- type: 'boolean',
702
- default: true,
703
- description: 'Open the image after rendering. Use --no-open in CI',
704
- })
705
- .example('mint og guides/webhooks', 'Render one page and open it')
706
- .example('mint og --preset headline --surface brand', 'Try settings on the home page')
707
- .example('mint og --output og.png --no-open', 'Render to a file in CI'), (argv) => __awaiter(void 0, void 0, void 0, function* () {
708
- yield terminate(yield ogCommand(argv));
709
- }))
710
- .command(['version', 'v'], 'Display the current version of the CLI and client', () => undefined, () => __awaiter(void 0, void 0, void 0, function* () {
711
- const { cli, client } = getVersions(packageName);
712
- addLog(_jsxs(Text, { children: [_jsx(Text, { bold: true, color: "green", children: "cli version" }), ' ', cli] }));
713
- addLog(_jsxs(Text, { children: [_jsx(Text, { bold: true, color: "green", children: "client version" }), ' ', client] }));
714
- }))
715
- .command('new [directory]', 'Create a new Mintlify documentation site', (yargs) => yargs
716
- .positional('directory', {
717
- describe: 'The directory to initialize your documentation',
718
- type: 'string',
719
- default: '.',
720
- })
721
- .option('theme', {
722
- type: 'string',
723
- description: 'Theme for the documentation site',
724
- })
725
- .option('name', {
726
- type: 'string',
727
- description: 'Name of the documentation project',
728
- })
729
- .option('template', {
730
- type: 'string',
731
- description: 'Use a template as a starting point',
732
- })
733
- .option('force', {
734
- type: 'boolean',
735
- default: false,
736
- description: 'Create the documentation in a subdirectory',
737
- }), (_a) => __awaiter(void 0, [_a], void 0, function* ({ directory, theme, name, force, template }) {
738
- try {
739
- yield init(directory, force, theme, name, template);
740
- yield terminate(0);
741
- }
742
- catch (error) {
743
- addLog(_jsx(ErrorLog, { message: error instanceof Error ? error.message : 'error occurred' }));
744
- yield terminate(1);
745
- }
746
- }))
747
- .command('analytics', 'View analytics for your documentation', analyticsBuilder)
748
- .command(['automations', 'workflow', 'workflows'], 'Create and manage automations', workflowsBuilder)
749
- .command('score [url]', 'Run agent readiness checks on a docs site', (yargs) => yargs
750
- .positional('url', {
751
- type: 'string',
752
- description: 'URL of the docs site to check (defaults to your configured subdomain)',
753
- })
754
- .option('format', {
755
- type: 'string',
756
- choices: ['table', 'plain', 'json'],
757
- description: 'Output format',
758
- })
759
- .example('mint score', 'Run agent readiness checks on your default subdomain')
760
- .example('mint score docs.example.com', 'Run agent readiness checks on a URL'), scoreHandler)
761
- .command('format', 'Format MDX files in the current directory', (yargs) => yargs
762
- .usage('usage: mint format')
763
- .example('mint format', 'format all MDX files in the current directory'), formatHandler)
764
- .command('migrate', 'Print instructions for migrating a docs site to Mintlify', (yargs) => yargs
765
- .option('from', {
766
- type: 'string',
767
- choices: listMigrationDocs('sources'),
768
- description: 'Include instructions for a source platform',
769
- })
770
- .option('topic', {
771
- type: 'string',
772
- choices: listMigrationDocs('topics'),
773
- description: 'Print a single topic',
774
- })
775
- .option('agent', {
776
- type: 'string',
777
- choices: Object.keys(agents),
778
- description: 'Run the migration with a coding agent',
779
- })
780
- .option('claude', {
781
- type: 'boolean',
782
- description: 'Alias for --agent claude',
783
- }), (argv) => __awaiter(void 0, void 0, void 0, function* () {
784
- var _a;
785
- const agent = (_a = argv.agent) !== null && _a !== void 0 ? _a : (argv.claude ? 'claude' : undefined);
786
- void trackEvent('cli.migrate.executed', {
787
- from: argv.from,
788
- topic: argv.topic,
789
- agent,
790
- });
791
- if (agent) {
792
- try {
793
- return yield terminate(yield migrateWithAgent(agent, argv.from));
794
- }
795
- catch (error) {
796
- addLog(_jsx(ErrorLog, { message: error instanceof Error ? error.message : String(error) }));
797
- return yield terminate(1);
798
- }
799
- }
800
- yield new Promise((resolve) => process.stdout.write(migrationInstructions(argv), () => resolve()));
801
- yield terminate(0);
802
- }))
803
- // Coming soon commands — visible in help, tracked via telemetry to gauge interest.
804
- .command('ai', '[Coming soon] AI-powered documentation (run mint ai to vote)', () => undefined, comingSoon('ai', packageName))
805
- .command('mcp', '[Coming soon] MCP server for documentation (run mint mcp to vote)', () => undefined, comingSoon('mcp', packageName))
806
- // Print the help menu when the user enters an invalid command.
807
- .strictCommands()
808
- .demandCommand(1, 'unknown command. see above for the list of supported commands.')
809
- // Alias option flags --help = -h, default --version = -v
810
- .alias('h', 'help')
811
- .alias('v', 'version')
812
- .parseAsync());
813
- };