@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
@@ -1,101 +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
- export const INSTRUCTIONS_URL = 'https://www.mintlify.com/docs/mint-instructions';
11
- export const TOPICS = [
12
- {
13
- name: 'overview',
14
- when: 'Start here: how Mintlify works and facts agents most often get wrong',
15
- },
16
- {
17
- name: 'new-site',
18
- when: 'New docs site, first publish, no account, claim a site, login, no docs.json yet',
19
- },
20
- {
21
- name: 'write',
22
- when: 'Before creating a page or writing more than a sentence or two; changelogs',
23
- },
24
- {
25
- name: 'write components',
26
- when: 'Adding or changing components: callouts, cards, steps, tabs, accordions, fields',
27
- },
28
- { name: 'configure', when: 'Changing docs.json: theme, colors, logo, favicon, required fields' },
29
- {
30
- name: 'configure navigation',
31
- when: 'Changing navigation: groups, tabs, anchors, dropdowns, products, versions, languages',
32
- },
33
- {
34
- name: 'configure settings',
35
- when: 'navbar, footer, banner, SEO, search, integrations, contextual menu, redirects, 404',
36
- },
37
- {
38
- name: 'configure customization',
39
- when: 'Themes, fonts, CSS, JavaScript, or React snippets',
40
- },
41
- { name: 'api-docs', when: 'API documentation: OpenAPI, AsyncAPI, GraphQL, playground' },
42
- {
43
- name: 'api-docs sdk',
44
- when: 'SDK reference pages, x-codeSamples, oneOf/anyOf, multiple responses, hiding endpoints',
45
- },
46
- {
47
- name: 'publish',
48
- when: 'Deploying, "is it live", previews, rollbacks, MCP, llms.txt, skill.md, Markdown export',
49
- },
50
- {
51
- name: 'publish domain',
52
- when: 'Custom domain (mint add-domain), /docs subpath, reverse proxy, CSP',
53
- },
54
- {
55
- name: 'publish repo',
56
- when: 'Monorepo, multi-repo, GitHub/GitLab/Bitbucket, offline export, self-host',
57
- },
58
- {
59
- name: 'publish analytics',
60
- when: 'mint analytics, feedback, search data, analytics integrations',
61
- },
62
- {
63
- name: 'publish assistant',
64
- when: 'AI assistant, widget, Assistant.md, skills, narration, own model',
65
- },
66
- { name: 'access', when: 'Private docs, reader login, user groups, personalization' },
67
- { name: 'access team', when: 'Team members, roles, SSO, SCIM, audit logs, session security' },
68
- {
69
- name: 'automate',
70
- when: 'Keep docs in sync with code: agent, Autopilot, automations, Slack, CI',
71
- },
72
- {
73
- name: 'migrate',
74
- when: 'Moving docs from Docusaurus, GitBook, ReadMe, Fern, Document360, Confluence, Markdown',
75
- },
76
- { name: 'troubleshoot', when: 'An error, a failed build or deploy, or the site looks wrong' },
77
- ];
78
- export const formatTopics = () => {
79
- const width = Math.max(...TOPICS.map(({ name }) => name.length)) + 2;
80
- return [
81
- 'Usage: mint instructions <topic> [subtopic]',
82
- '',
83
- ...TOPICS.map(({ name, when }) => ` ${name.padEnd(width)}${when}`),
84
- '',
85
- ].join('\n');
86
- };
87
- export const instructionsUrl = (topics) => `${INSTRUCTIONS_URL}/${topics.map(encodeURIComponent).join('/')}.md`;
88
- export const stripDocsPreamble = (markdown) => markdown.replace(/^(?:>.*\n|\s*\n)*/, '');
89
- export function fetchInstructions(topics) {
90
- return __awaiter(this, void 0, void 0, function* () {
91
- const url = instructionsUrl(topics);
92
- const response = yield fetch(url);
93
- if (response.status === 404) {
94
- throw new Error(`no instructions for "${topics.join(' ')}". Run \`mint instructions\` to list topics.`);
95
- }
96
- if (!response.ok) {
97
- throw new Error(`failed to fetch ${url}: ${response.status} ${response.statusText}`);
98
- }
99
- return stripDocsPreamble(yield response.text());
100
- });
101
- }
package/bin/keyring.js DELETED
@@ -1,78 +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
- const SERVICE = 'mintlify';
11
- const ACCESS_TOKEN_ACCOUNT = 'access_token';
12
- const REFRESH_TOKEN_ACCOUNT = 'refresh_token';
13
- const USER_EMAIL_ACCOUNT = 'user_email';
14
- export function getKeytar() {
15
- return __awaiter(this, void 0, void 0, function* () {
16
- var _a;
17
- try {
18
- const mod = yield import('keytar');
19
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- ESM wraps CJS in { default: ... } at runtime despite types
20
- return (_a = mod.default) !== null && _a !== void 0 ? _a : mod;
21
- }
22
- catch (_b) {
23
- throw new Error('keytar is required for credential storage but is not installed. Install it with: npm install keytar');
24
- }
25
- });
26
- }
27
- export function storeCredentials(accessToken, refreshToken, userEmail) {
28
- return __awaiter(this, void 0, void 0, function* () {
29
- const keytar = yield getKeytar();
30
- yield Promise.all([
31
- keytar.setPassword(SERVICE, ACCESS_TOKEN_ACCOUNT, accessToken),
32
- keytar.setPassword(SERVICE, REFRESH_TOKEN_ACCOUNT, refreshToken),
33
- ]);
34
- try {
35
- if (userEmail === null) {
36
- yield keytar.deletePassword(SERVICE, USER_EMAIL_ACCOUNT);
37
- }
38
- else if (userEmail !== undefined) {
39
- yield keytar.setPassword(SERVICE, USER_EMAIL_ACCOUNT, userEmail);
40
- }
41
- }
42
- catch (_a) { }
43
- });
44
- }
45
- export function getAccessToken() {
46
- return __awaiter(this, void 0, void 0, function* () {
47
- const keytar = yield getKeytar();
48
- return keytar.getPassword(SERVICE, ACCESS_TOKEN_ACCOUNT);
49
- });
50
- }
51
- export function getRefreshToken() {
52
- return __awaiter(this, void 0, void 0, function* () {
53
- const keytar = yield getKeytar();
54
- return keytar.getPassword(SERVICE, REFRESH_TOKEN_ACCOUNT);
55
- });
56
- }
57
- export function getUserEmail() {
58
- return __awaiter(this, void 0, void 0, function* () {
59
- const keytar = yield getKeytar();
60
- return keytar.getPassword(SERVICE, USER_EMAIL_ACCOUNT);
61
- });
62
- }
63
- export function storeUserEmail(userEmail) {
64
- return __awaiter(this, void 0, void 0, function* () {
65
- const keytar = yield getKeytar();
66
- yield keytar.setPassword(SERVICE, USER_EMAIL_ACCOUNT, userEmail);
67
- });
68
- }
69
- export function clearCredentials() {
70
- return __awaiter(this, void 0, void 0, function* () {
71
- const keytar = yield getKeytar();
72
- yield Promise.all([
73
- keytar.deletePassword(SERVICE, ACCESS_TOKEN_ACCOUNT),
74
- keytar.deletePassword(SERVICE, REFRESH_TOKEN_ACCOUNT),
75
- keytar.deletePassword(SERVICE, USER_EMAIL_ACCOUNT).catch(() => false),
76
- ]);
77
- });
78
- }
package/bin/login.js DELETED
@@ -1,123 +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 { input, search } from '@inquirer/prompts';
12
- import { addLog, ErrorLog, InfoLog, SuccessLog } from '@mintlify/previewing';
13
- import chalk from 'chalk';
14
- import { Box, Text } from 'ink';
15
- import open from 'open';
16
- import { calculatePKCECodeChallenge, randomNonce, randomPKCECodeVerifier, randomState, } from 'openid-client';
17
- import { startCallbackServer } from './callbackServer.js';
18
- import { setConfigValue } from './config.js';
19
- import { DASHBOARD_URL, TOKEN_ENDPOINT } from './constants.js';
20
- import { getEmailFromIdToken } from './idToken.js';
21
- import { storeCredentials } from './keyring.js';
22
- import { getCliSubdomains } from './status.js';
23
- import { trackLoginAttempt, trackLoginFailed, trackLoginSuccess } from './telemetry/track.js';
24
- export function login() {
25
- return __awaiter(this, void 0, void 0, function* () {
26
- var _a, _b, _c;
27
- const codeVerifier = randomPKCECodeVerifier();
28
- const codeChallenge = yield calculatePKCECodeChallenge(codeVerifier);
29
- const nonce = randomNonce();
30
- const clientState = randomState();
31
- const state = Buffer.from(JSON.stringify({ nonce, clientState })).toString('base64url');
32
- const authorizeUrl = new URL('/api/cli/oauth/authorize', DASHBOARD_URL);
33
- authorizeUrl.searchParams.set('state', state);
34
- authorizeUrl.searchParams.set('code_challenge', codeChallenge);
35
- const url = authorizeUrl.toString();
36
- void trackLoginAttempt();
37
- const { codePromise, close: closeServer } = yield startCallbackServer();
38
- addLog(_jsxs(Box, { flexDirection: "column", gap: 1, paddingY: 1, children: [_jsxs(Text, { bold: true, children: [_jsx(Text, { color: "green", children: "\u25C6 " }), "A browser window will open for Mintlify authentication"] }), _jsxs(Box, { flexDirection: "column", paddingLeft: 3, gap: 1, children: [_jsx(Text, { dimColor: true, children: "If your browser doesn't open automatically, copy this URL:" }), _jsx(Text, { dimColor: true, children: url })] })] }));
39
- open(url).catch(() => { });
40
- addLog(_jsxs(Box, { flexDirection: "column", paddingLeft: 1, marginTop: 1, children: [_jsx(Text, { dimColor: true, children: "\u256D\u2500 Paste the authorization code from your browser" }), _jsx(Text, { dimColor: true, children: "\u2502" })] }));
41
- // Let ink finish rendering before inquirer takes over stdout
42
- yield new Promise((resolve) => setTimeout(resolve, 50));
43
- const inputPromise = input({
44
- message: '█',
45
- theme: {
46
- prefix: chalk.dim(' │'),
47
- style: {
48
- answer: (text) => chalk.cyan(text),
49
- },
50
- },
51
- });
52
- let code;
53
- try {
54
- code = yield Promise.race([codePromise, inputPromise]);
55
- }
56
- catch (_d) {
57
- closeServer();
58
- inputPromise.cancel();
59
- addLog(_jsx(ErrorLog, { message: "login cancelled" }));
60
- return;
61
- }
62
- closeServer();
63
- inputPromise.cancel();
64
- const res = yield fetch(TOKEN_ENDPOINT, {
65
- method: 'POST',
66
- headers: { 'Content-Type': 'application/json' },
67
- body: JSON.stringify({
68
- grant_type: 'authorization_code',
69
- code,
70
- code_verifier: codeVerifier,
71
- }),
72
- });
73
- const body = yield res.json().catch(() => ({}));
74
- if (!res.ok) {
75
- const reason = (_b = (_a = body.error_message) !== null && _a !== void 0 ? _a : body.error) !== null && _b !== void 0 ? _b : 'unknown error';
76
- void trackLoginFailed(reason);
77
- addLog(_jsx(ErrorLog, { message: `login failed: ${reason}` }));
78
- return;
79
- }
80
- const token = body;
81
- yield storeCredentials(token.access_token, token.refresh_token, (_c = getEmailFromIdToken(token.id_token)) !== null && _c !== void 0 ? _c : null);
82
- void trackLoginSuccess();
83
- addLog(_jsx(SuccessLog, { message: "logged in successfully" }));
84
- yield promptSubdomainSelection(token.access_token);
85
- });
86
- }
87
- function isPromptCancellationError(error) {
88
- return error instanceof Error && error.name === 'ExitPromptError';
89
- }
90
- function promptSubdomainSelection(accessToken) {
91
- return __awaiter(this, void 0, void 0, function* () {
92
- const subdomains = yield getCliSubdomains(accessToken);
93
- if (subdomains.length === 0)
94
- return;
95
- if (subdomains.length === 1) {
96
- yield setConfigValue('subdomain', subdomains[0]);
97
- addLog(_jsx(InfoLog, { message: `default project set to ${subdomains[0]}` }));
98
- return;
99
- }
100
- yield new Promise((resolve) => setTimeout(resolve, 50));
101
- let chosen;
102
- try {
103
- chosen = yield search({
104
- message: 'Select a default project',
105
- source: (term) => {
106
- const results = term
107
- ? subdomains.filter((s) => s.toLowerCase().includes(term.toLowerCase()))
108
- : subdomains;
109
- return results.map((s) => ({ name: s, value: s }));
110
- },
111
- });
112
- }
113
- catch (error) {
114
- if (isPromptCancellationError(error)) {
115
- addLog(_jsx(InfoLog, { message: `No project set. To set a default project, run ${chalk.bold('mintlify config set subdomain <subdomain>')}` }));
116
- return;
117
- }
118
- throw error;
119
- }
120
- yield setConfigValue('subdomain', chosen);
121
- addLog(_jsx(InfoLog, { message: `default project set to ${chosen}` }));
122
- });
123
- }
package/bin/logout.js DELETED
@@ -1,18 +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 } from "react/jsx-runtime";
11
- import { addLog, SuccessLog } from '@mintlify/previewing';
12
- import { clearCredentials } from './keyring.js';
13
- export function logout() {
14
- return __awaiter(this, void 0, void 0, function* () {
15
- yield clearCredentials();
16
- addLog(_jsx(SuccessLog, { message: "logged out successfully" }));
17
- });
18
- }
@@ -1,113 +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 { coreRemark } from '@mintlify/common';
11
- import { categorizeFilePaths, getMintIgnore } from '@mintlify/prebuild';
12
- import fs from 'fs';
13
- import path from 'path';
14
- import { visit } from 'unist-util-visit';
15
- const checkAltAttributes = (filePath, content) => {
16
- const issues = [];
17
- const visitElements = () => {
18
- return (tree) => {
19
- visit(tree, (node) => {
20
- var _a, _b, _c, _d, _e, _f;
21
- if (node.type === 'image') {
22
- if (!node.alt || node.alt.trim() === '') {
23
- issues.push({
24
- filePath,
25
- line: (_a = node.position) === null || _a === void 0 ? void 0 : _a.start.line,
26
- column: (_b = node.position) === null || _b === void 0 ? void 0 : _b.start.column,
27
- element: 'img',
28
- tagName: 'image (markdown)',
29
- });
30
- }
31
- return;
32
- }
33
- const mdxJsxElement = node;
34
- if (mdxJsxElement.name === 'img' || mdxJsxElement.name === 'video') {
35
- const altAttrIndex = mdxJsxElement.attributes.findIndex((attr) => attr.type === 'mdxJsxAttribute' && attr.name === 'alt');
36
- const altAttribute = mdxJsxElement.attributes[altAttrIndex];
37
- const hasValidAlt = altAttribute &&
38
- typeof altAttribute.value === 'string' &&
39
- altAttribute.value.trim() !== '';
40
- if (!hasValidAlt) {
41
- issues.push({
42
- filePath,
43
- line: (_c = node.position) === null || _c === void 0 ? void 0 : _c.start.line,
44
- column: (_d = node.position) === null || _d === void 0 ? void 0 : _d.start.column,
45
- element: mdxJsxElement.name,
46
- tagName: mdxJsxElement.name,
47
- });
48
- }
49
- }
50
- else if (mdxJsxElement.name === 'a') {
51
- const hasTextContent = (children) => {
52
- return children.some((child) => {
53
- if (child.type === 'text') {
54
- const textNode = child;
55
- return textNode.value.trim() !== '';
56
- }
57
- if ('children' in child && Array.isArray(child.children)) {
58
- return hasTextContent(child.children);
59
- }
60
- return false;
61
- });
62
- };
63
- if (!hasTextContent(mdxJsxElement.children)) {
64
- issues.push({
65
- filePath,
66
- line: (_e = node.position) === null || _e === void 0 ? void 0 : _e.start.line,
67
- column: (_f = node.position) === null || _f === void 0 ? void 0 : _f.start.column,
68
- element: 'a',
69
- tagName: '<a>',
70
- });
71
- }
72
- }
73
- });
74
- return tree;
75
- };
76
- };
77
- try {
78
- const stripped = content.replace(/^( {0,3}#{1,6}\s+.+?)\s*\{#[^}]+\}\s*$/gm, '$1');
79
- coreRemark().use(visitElements).processSync(stripped);
80
- }
81
- catch (error) {
82
- console.warn(`Warning: Could not parse ${filePath}: ${error}`);
83
- }
84
- return issues;
85
- };
86
- export const checkMdxAccessibility = (...args_1) => __awaiter(void 0, [...args_1], void 0, function* (baseDir = process.cwd()) {
87
- const mintIgnore = yield getMintIgnore(baseDir);
88
- const { contentFilenames } = yield categorizeFilePaths(baseDir, mintIgnore);
89
- const mdxFiles = [];
90
- for (const file of contentFilenames) {
91
- mdxFiles.push(path.join(baseDir, file));
92
- }
93
- const allIssues = [];
94
- const filesWithIssues = new Set();
95
- for (const filePath of mdxFiles) {
96
- try {
97
- const content = fs.readFileSync(filePath, 'utf-8');
98
- const issues = checkAltAttributes(filePath, content);
99
- if (issues.length > 0) {
100
- allIssues.push(...issues);
101
- filesWithIssues.add(filePath);
102
- }
103
- }
104
- catch (error) {
105
- console.warn(`Warning: Could not read file ${filePath}: ${error}`);
106
- }
107
- }
108
- return {
109
- missingAltAttributes: allIssues,
110
- totalFiles: mdxFiles.length,
111
- filesWithIssues: filesWithIssues.size,
112
- };
113
- });
package/bin/mdxLinter.js DELETED
@@ -1,55 +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, ErrorLog, SuccessLog } from '@mintlify/previewing';
12
- import { Text } from 'ink';
13
- import path from 'path';
14
- import { checkMdxAccessibility } from './mdxAccessibility.js';
15
- export const mdxLinter = () => __awaiter(void 0, void 0, void 0, function* () {
16
- try {
17
- addLog(_jsx(Text, { bold: true, color: "cyan", children: "Checking mdx files for accessibility issues..." }));
18
- const results = yield checkMdxAccessibility();
19
- if (results.missingAltAttributes.length === 0) {
20
- addLog(_jsx(SuccessLog, { message: "no accessibility issues found" }));
21
- addLog(_jsxs(Text, { children: ["Checked ", results.totalFiles, " MDX files - all images and videos have alt attributes."] }));
22
- return 0;
23
- }
24
- const issuesByFile = {};
25
- results.missingAltAttributes.forEach((issue) => {
26
- var _a;
27
- if (!issuesByFile[issue.filePath]) {
28
- issuesByFile[issue.filePath] = [];
29
- }
30
- (_a = issuesByFile[issue.filePath]) === null || _a === void 0 ? void 0 : _a.push(issue);
31
- });
32
- addLog(_jsxs(Text, { bold: true, color: "red", children: ["Found ", results.missingAltAttributes.length, " accessibility issues in", ' ', results.filesWithIssues, " files:"] }));
33
- addLog(_jsx(Text, {}));
34
- for (const [filePath, issues] of Object.entries(issuesByFile)) {
35
- const relativePath = path.relative(process.cwd(), filePath);
36
- addLog(_jsxs(Text, { bold: true, children: [relativePath, ":"] }));
37
- for (const issue of issues) {
38
- const location = issue.line && issue.column ? ` (line ${issue.line}, col ${issue.column})` : '';
39
- if (issue.element === 'a') {
40
- addLog(_jsxs(Text, { children: [_jsx(Text, { color: "red", children: " \u2717" }), " Missing text attribute ", _jsx(Text, { bold: true, children: issue.tagName }), ' ', "element", location] }));
41
- }
42
- else {
43
- addLog(_jsxs(Text, { children: [_jsx(Text, { color: "red", children: " \u2717" }), " Missing alt attribute on ", _jsx(Text, { bold: true, children: issue.tagName }), ' ', "element", location] }));
44
- }
45
- }
46
- addLog(_jsx(Text, {}));
47
- }
48
- addLog(_jsxs(Text, { color: "yellow", children: [_jsx(Text, { bold: true, children: "Recommendation:" }), " Add alt attributes to all images and videos for better accessibility."] }));
49
- return 1;
50
- }
51
- catch (error) {
52
- addLog(_jsx(ErrorLog, { message: `MDX accessibility check failed: ${error instanceof Error ? error.message : 'Unknown error'}` }));
53
- return 1;
54
- }
55
- });
@@ -1,28 +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 { getConfigValue } from '../config.js';
11
- import { getAccessToken } from '../keyring.js';
12
- import { getCliSubdomains } from '../status.js';
13
- export function subdomainMiddleware(argv) {
14
- return __awaiter(this, void 0, void 0, function* () {
15
- if (typeof argv.subdomain === 'string' && argv.subdomain.length > 0)
16
- return;
17
- const fromConfig = getConfigValue('subdomain');
18
- if (fromConfig) {
19
- argv.subdomain = fromConfig;
20
- return;
21
- }
22
- const accessToken = yield getAccessToken();
23
- if (!accessToken)
24
- return;
25
- const subdomains = yield getCliSubdomains(accessToken);
26
- argv.subdomain = subdomains[0];
27
- });
28
- }
@@ -1,61 +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 { getConfigValue } from '../config.js';
11
- import { getVersions } from '../helpers.js';
12
- import { trackCommand } from '../telemetry/track.js';
13
- const SCRAPE_SUBCOMMANDS = new Set(['page', 'site', 'openapi']);
14
- const ANALYTICS_SUBCOMMANDS = new Set(['stats', 'search', 'feedback', 'conversation']);
15
- const CONFIG_SUBCOMMANDS = new Set(['set', 'get', 'clear']);
16
- const CONVERSATION_SUBCOMMANDS = new Set(['list', 'view', 'buckets']);
17
- const BUCKETS_SUBCOMMANDS = new Set(['list', 'view']);
18
- export function getSanitizedCommandForTelemetry(_) {
19
- const parts = _.filter((p) => typeof p === 'string');
20
- if (parts.length === 0)
21
- return '';
22
- const first = parts[0];
23
- const second = parts[1];
24
- const third = parts[2];
25
- if (first === 'scrape' && second !== undefined && SCRAPE_SUBCOMMANDS.has(second)) {
26
- return `scrape ${second}`;
27
- }
28
- if (first === 'config' && second !== undefined && CONFIG_SUBCOMMANDS.has(second)) {
29
- return `config ${second}`;
30
- }
31
- if (first === 'analytics' && second !== undefined && ANALYTICS_SUBCOMMANDS.has(second)) {
32
- if (second === 'conversation' && third !== undefined) {
33
- if (CONVERSATION_SUBCOMMANDS.has(third)) {
34
- const fourth = parts[3];
35
- if (third === 'buckets' && fourth !== undefined && BUCKETS_SUBCOMMANDS.has(fourth)) {
36
- return `analytics conversation buckets ${fourth}`;
37
- }
38
- return `analytics conversation ${third}`;
39
- }
40
- }
41
- return `analytics ${second}`;
42
- }
43
- return first;
44
- }
45
- export function createTelemetryMiddleware() {
46
- let tracked = false;
47
- return function telemetryMiddleware(argv) {
48
- return __awaiter(this, void 0, void 0, function* () {
49
- const command = argv._[0];
50
- if (typeof command === 'string') {
51
- if (tracked)
52
- return;
53
- tracked = true;
54
- const sanitizedCommand = getSanitizedCommandForTelemetry(argv._);
55
- const { cli: cliVersion } = getVersions();
56
- const subdomain = getConfigValue('subdomain');
57
- void trackCommand({ command: sanitizedCommand, cliVersion, subdomain });
58
- }
59
- });
60
- };
61
- }
package/bin/migrate.js DELETED
@@ -1,54 +0,0 @@
1
- import { spawn } from 'node:child_process';
2
- import { readdirSync, readFileSync } from 'node:fs';
3
- import path from 'node:path';
4
- import { fileURLToPath } from 'node:url';
5
- import { windowsCompatibleSpawnOptions } from './helpers.js';
6
- const root = fileURLToPath(new URL('../migrate', import.meta.url));
7
- const read = (...segments) => readFileSync(path.join(root, ...segments), 'utf8');
8
- export const listMigrationDocs = (section) => readdirSync(path.join(root, section))
9
- .filter((file) => file.endsWith('.md'))
10
- .map((file) => file.slice(0, -3))
11
- .sort();
12
- const overview = () => [
13
- read('index.md').trimEnd(),
14
- `Topics: ${listMigrationDocs('topics').join(', ')}. Run \`mint migrate --topic <name>\`.`,
15
- `Sources: ${listMigrationDocs('sources').join(', ')}. Run \`mint migrate --from <name>\`.`,
16
- ].join('\n\n');
17
- export const migrationInstructions = ({ from, topic }) => {
18
- if (topic)
19
- return read('topics', `${topic}.md`);
20
- if (from)
21
- return `${overview()}\n\n${read('sources', `${from}.md`)}`;
22
- return `${overview()}\n`;
23
- };
24
- const prompt = (from) => `Migrate a documentation site to Mintlify in the current directory. Run \`mint migrate${from ? ` --from ${from}` : ''}\` and follow the instructions it prints.`;
25
- export const agents = {
26
- claude: {
27
- bin: 'claude',
28
- args: (prompt) => [prompt],
29
- install: 'npm install -g @anthropic-ai/claude-code',
30
- },
31
- codex: {
32
- bin: 'codex',
33
- args: (prompt) => [prompt],
34
- install: 'npm install -g @openai/codex',
35
- },
36
- cursor: {
37
- bin: 'cursor-agent',
38
- args: (prompt) => [prompt],
39
- install: 'curl https://cursor.com/install -fsS | bash',
40
- },
41
- gemini: {
42
- bin: 'gemini',
43
- args: (prompt) => ['-i', prompt],
44
- install: 'npm install -g @google/gemini-cli',
45
- },
46
- };
47
- export const agentArgs = (name, from) => agents[name].args(prompt(from));
48
- export const migrateWithAgent = (name, from) => new Promise((resolve, reject) => {
49
- const { bin, install } = agents[name];
50
- const args = agentArgs(name, from).map((arg) => windowsCompatibleSpawnOptions.shell ? `"${arg}"` : arg);
51
- const child = spawn(bin, args, Object.assign({ stdio: 'inherit' }, windowsCompatibleSpawnOptions));
52
- child.on('error', (error) => reject(error.code === 'ENOENT' ? new Error(`${bin} not found. Install it with: ${install}`) : error));
53
- child.on('close', (code) => resolve(code !== null && code !== void 0 ? code : 1));
54
- });