@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,15 +0,0 @@
1
- import { renderWelcome } from '../src/welcome.js';
2
-
3
- describe('welcome help menu', () => {
4
- it('lists the analytics command under Insights', () => {
5
- const output = renderWelcome({
6
- packageName: 'mint',
7
- version: '1.0.0',
8
- signedIn: true,
9
- });
10
-
11
- expect(output).toContain('Insights');
12
- expect(output).toContain('analytics');
13
- expect(output).toContain('View analytics for your site');
14
- });
15
- });
@@ -1,126 +0,0 @@
1
- import { createWorkflow, deleteWorkflow, listWorkflows } from '../../src/workflows/client.js';
2
- import type { WorkflowBody } from '../../src/workflows/types.js';
3
-
4
- vi.mock('../../src/keyring.js', () => ({
5
- getAccessToken: vi.fn().mockResolvedValue(null),
6
- getRefreshToken: vi.fn().mockResolvedValue(null),
7
- storeCredentials: vi.fn().mockResolvedValue(undefined),
8
- }));
9
-
10
- const mockFetch = vi.fn();
11
- global.fetch = mockFetch;
12
-
13
- beforeEach(() => {
14
- vi.stubEnv('MINTLIFY_SESSION_TOKEN', 'test-token');
15
- vi.stubEnv('MINTLIFY_API_URL', 'http://test-server:5000');
16
- mockFetch.mockReset();
17
- });
18
-
19
- afterEach(() => {
20
- vi.unstubAllEnvs();
21
- });
22
-
23
- function mockOk(data: unknown, status = 200) {
24
- mockFetch.mockResolvedValueOnce({
25
- ok: true,
26
- status,
27
- json: () => Promise.resolve(data),
28
- });
29
- }
30
-
31
- function mockError(status: number, body: string) {
32
- mockFetch.mockResolvedValueOnce({
33
- ok: false,
34
- status,
35
- statusText: 'Bad Request',
36
- text: () => Promise.resolve(body),
37
- });
38
- }
39
-
40
- function calledUrl(): string {
41
- const arg = mockFetch.mock.calls[0]![0];
42
- return typeof arg === 'string' ? arg : String(arg);
43
- }
44
-
45
- function calledInit(): RequestInit {
46
- return mockFetch.mock.calls[0]![1] as RequestInit;
47
- }
48
-
49
- const body: WorkflowBody = {
50
- name: 'My Workflow',
51
- on: { cron: '0 6 * * *' },
52
- prompt: 'Translate docs',
53
- };
54
-
55
- describe('workflow client auth', () => {
56
- it('throws when no session token is set', async () => {
57
- vi.stubEnv('MINTLIFY_SESSION_TOKEN', '');
58
- await expect(listWorkflows('docs')).rejects.toThrow('Not authenticated');
59
- });
60
-
61
- it('sends bearer token header', async () => {
62
- mockOk([]);
63
- await listWorkflows('docs');
64
- expect(mockFetch).toHaveBeenCalledWith(
65
- expect.any(String),
66
- expect.objectContaining({
67
- headers: expect.objectContaining({ Authorization: 'Bearer test-token' }),
68
- })
69
- );
70
- });
71
- });
72
-
73
- describe('createWorkflow', () => {
74
- it('POSTs the body to the subdomain-scoped URL', async () => {
75
- mockOk({ _id: 'wf123', name: 'My Workflow' }, 201);
76
- const result = await createWorkflow('docs', body);
77
-
78
- expect(new URL(calledUrl()).pathname).toBe('/api/cli/workflows/docs');
79
- const init = calledInit();
80
- expect(init.method).toBe('POST');
81
- expect(init.body).toBe(JSON.stringify(body));
82
- expect(init.headers).toMatchObject({ 'Content-Type': 'application/json' });
83
- expect(result).toMatchObject({ _id: 'wf123' });
84
- });
85
-
86
- it('encodes the subdomain', async () => {
87
- mockOk({ _id: 'wf123' }, 201);
88
- await createWorkflow('my docs/sub', body);
89
- expect(new URL(calledUrl()).pathname).toBe('/api/cli/workflows/my%20docs%2Fsub');
90
- });
91
-
92
- it('throws on API error', async () => {
93
- mockError(400, 'Invalid request body');
94
- await expect(createWorkflow('docs', body)).rejects.toThrow(
95
- 'API error (400): Invalid request body'
96
- );
97
- });
98
- });
99
-
100
- describe('listWorkflows', () => {
101
- it('GETs the subdomain-scoped URL', async () => {
102
- mockOk([{ _id: 'wf1' }, { _id: 'wf2' }]);
103
- const result = await listWorkflows('docs');
104
-
105
- expect(new URL(calledUrl()).pathname).toBe('/api/cli/workflows/docs');
106
- const init = calledInit();
107
- expect(init.method).toBeUndefined();
108
- expect(result).toHaveLength(2);
109
- });
110
- });
111
-
112
- describe('deleteWorkflow', () => {
113
- it('DELETEs by workflow id', async () => {
114
- mockOk({ success: true });
115
- await deleteWorkflow('docs', 'wf123');
116
-
117
- expect(new URL(calledUrl()).pathname).toBe('/api/cli/workflows/docs/wf123');
118
- expect(calledInit().method).toBe('DELETE');
119
- });
120
-
121
- it('encodes both segments', async () => {
122
- mockOk({ success: true });
123
- await deleteWorkflow('my docs', 'wf 123');
124
- expect(new URL(calledUrl()).pathname).toBe('/api/cli/workflows/my%20docs/wf%20123');
125
- });
126
- });
@@ -1,111 +0,0 @@
1
- import Color from 'color';
2
- export const WCAG_STANDARDS = {
3
- AA_NORMAL: 4.5,
4
- AA_LARGE: 3,
5
- AAA_NORMAL: 7,
6
- AAA_LARGE: 4.5,
7
- };
8
- export function checkColorContrast(foreground, background, minThreshold = WCAG_STANDARDS.AA_NORMAL) {
9
- try {
10
- const fg = Color(foreground);
11
- const bg = Color(background);
12
- const ratio = fg.contrast(bg);
13
- const level = fg.level(bg);
14
- const meetsAA = level === 'AA' || level === 'AAA';
15
- const meetsAAA = level === 'AAA';
16
- let recommendation;
17
- let message;
18
- if (minThreshold !== WCAG_STANDARDS.AA_NORMAL) {
19
- if (ratio >= minThreshold) {
20
- recommendation = 'pass';
21
- message = `Contrast ratio: ${ratio.toFixed(2)}:1 (meets minimum threshold of ${minThreshold}:1)`;
22
- }
23
- else {
24
- recommendation = 'fail';
25
- message = `Poor contrast ratio: ${ratio.toFixed(2)}:1 (fails minimum threshold, required: ${minThreshold}:1)`;
26
- }
27
- }
28
- else {
29
- if (meetsAAA) {
30
- recommendation = 'pass';
31
- message = `Excellent contrast ratio: ${ratio.toFixed(2)}:1 (meets WCAG AAA)`;
32
- }
33
- else if (meetsAA) {
34
- recommendation = 'warning';
35
- message = `Good contrast ratio: ${ratio.toFixed(2)}:1 (meets WCAG AA, consider AAA for better accessibility)`;
36
- }
37
- else {
38
- recommendation = 'fail';
39
- message = `Poor contrast ratio: ${ratio.toFixed(2)}:1 (fails WCAG AA, minimum required: ${WCAG_STANDARDS.AA_NORMAL}:1)`;
40
- }
41
- }
42
- return {
43
- ratio,
44
- meetsAA,
45
- meetsAAA,
46
- recommendation,
47
- message,
48
- };
49
- }
50
- catch (_a) {
51
- return null;
52
- }
53
- }
54
- export function checkDocsColors(colors, background, navigation) {
55
- var _a;
56
- const lightBackground = background.lightHex;
57
- const darkBackground = background.darkHex;
58
- const primaryContrast = colors.primary
59
- ? checkColorContrast(colors.primary, lightBackground)
60
- : null;
61
- const lightContrast = colors.light ? checkColorContrast(colors.light, darkBackground) : null;
62
- const darkContrast = colors.dark ? checkColorContrast(colors.dark, darkBackground, 3) : null;
63
- const darkOnLightContrast = colors.dark
64
- ? checkColorContrast(colors.dark, lightBackground, 3)
65
- : null;
66
- const anchorResults = [];
67
- if ((_a = navigation === null || navigation === void 0 ? void 0 : navigation.global) === null || _a === void 0 ? void 0 : _a.anchors) {
68
- for (const anchor of navigation.global.anchors) {
69
- if (anchor.color) {
70
- const lightContrast = anchor.color.light
71
- ? checkColorContrast(anchor.color.light, lightBackground)
72
- : null;
73
- const darkContrast = anchor.color.dark
74
- ? checkColorContrast(anchor.color.dark, darkBackground)
75
- : null;
76
- anchorResults.push({
77
- name: anchor.anchor,
78
- lightContrast,
79
- darkContrast,
80
- });
81
- }
82
- }
83
- }
84
- const results = [
85
- primaryContrast,
86
- lightContrast,
87
- darkContrast,
88
- darkOnLightContrast,
89
- ...anchorResults.flatMap((anchor) => [anchor.lightContrast, anchor.darkContrast]),
90
- ].filter(Boolean);
91
- const hasFailure = results.some((result) => result.recommendation === 'fail');
92
- const hasWarning = results.some((result) => result.recommendation === 'warning');
93
- let overallScore;
94
- if (hasFailure) {
95
- overallScore = 'fail';
96
- }
97
- else if (hasWarning) {
98
- overallScore = 'warning';
99
- }
100
- else {
101
- overallScore = 'pass';
102
- }
103
- return {
104
- primaryContrast,
105
- lightContrast,
106
- darkContrast,
107
- darkOnLightContrast,
108
- anchorResults,
109
- overallScore,
110
- };
111
- }
@@ -1,82 +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 { getBackgroundColors } from '@mintlify/common';
12
- import { getConfigObj, getConfigPath } from '@mintlify/prebuild';
13
- import { addLog, ErrorLog, WarningLog } from '@mintlify/previewing';
14
- import { Text } from 'ink';
15
- import { checkDocsColors } from './accessibility.js';
16
- import { CMD_EXEC_PATH, checkForDocsJson } from './helpers.js';
17
- export const accessibilityCheck = () => __awaiter(void 0, void 0, void 0, function* () {
18
- try {
19
- yield checkForDocsJson();
20
- const docsConfigPath = yield getConfigPath(CMD_EXEC_PATH, 'docs');
21
- const mintConfigPath = yield getConfigPath(CMD_EXEC_PATH, 'mint');
22
- if (!docsConfigPath && !mintConfigPath) {
23
- addLog(_jsx(ErrorLog, { message: "No configuration file found. Please run this command from a directory with a mint.json or docs.json file." }));
24
- return 1;
25
- }
26
- const configType = docsConfigPath ? 'docs' : 'mint';
27
- const config = (yield getConfigObj(CMD_EXEC_PATH, configType));
28
- if (!(config === null || config === void 0 ? void 0 : config.colors)) {
29
- addLog(_jsx(WarningLog, { message: "No colors section found in configuration file" }));
30
- return 0;
31
- }
32
- const { colors, navigation } = config;
33
- const { lightHex, darkHex } = getBackgroundColors(config);
34
- const results = checkDocsColors(colors, { lightHex, darkHex }, navigation);
35
- const displayContrastResult = (result, label, prefix = '') => {
36
- if (!result)
37
- return;
38
- const { recommendation, message } = result;
39
- const icon = recommendation === 'pass' ? 'PASS' : recommendation === 'warning' ? 'WARN' : 'FAIL';
40
- const color = recommendation === 'pass' ? 'green' : recommendation === 'warning' ? 'yellow' : 'red';
41
- addLog(_jsxs(Text, { children: [_jsxs(Text, { bold: prefix === '', children: [prefix, label, ":", ' '] }), _jsxs(Text, { color: color, children: [icon, " ", message] })] }));
42
- };
43
- addLog(_jsx(Text, { bold: true, color: "cyan", children: "Checking color accessibility..." }));
44
- addLog(_jsx(Text, {}));
45
- displayContrastResult(results.primaryContrast, `Primary Color (${colors.primary}) vs Light Background`);
46
- displayContrastResult(results.lightContrast, `Light Color (${colors.light}) vs Dark Background`);
47
- displayContrastResult(results.darkContrast, `Dark Color (${colors.dark}) vs Dark Background`);
48
- displayContrastResult(results.darkOnLightContrast, `Dark Color (${colors.dark}) vs Light Background`);
49
- const anchorsWithResults = results.anchorResults.filter((anchor) => anchor.lightContrast || anchor.darkContrast);
50
- if (anchorsWithResults.length > 0) {
51
- addLog(_jsx(Text, {}));
52
- addLog(_jsx(Text, { bold: true, color: "cyan", children: "Navigation Anchors:" }));
53
- for (const anchor of anchorsWithResults) {
54
- addLog(_jsxs(Text, { bold: true, children: [" ", anchor.name, ":"] }));
55
- displayContrastResult(anchor.lightContrast, 'Light variant vs Light Background', ' ');
56
- displayContrastResult(anchor.darkContrast, 'Dark variant vs Dark Background', ' ');
57
- }
58
- }
59
- addLog(_jsx(Text, {}));
60
- const overallIcon = results.overallScore === 'pass'
61
- ? 'PASS'
62
- : results.overallScore === 'warning'
63
- ? 'WARN'
64
- : 'FAIL';
65
- const overallColor = results.overallScore === 'pass'
66
- ? 'green'
67
- : results.overallScore === 'warning'
68
- ? 'yellow'
69
- : 'red';
70
- const overallMessage = results.overallScore === 'pass'
71
- ? 'All colors meet accessibility standards!'
72
- : results.overallScore === 'warning'
73
- ? 'Some colors could be improved for better accessibility'
74
- : 'Some colors fail accessibility standards and should be updated';
75
- addLog(_jsx(Text, { children: _jsxs(Text, { bold: true, color: overallColor, children: ["Overall Assessment: ", overallIcon, " ", overallMessage] }) }));
76
- return results.overallScore === 'fail' ? 1 : 0;
77
- }
78
- catch (error) {
79
- addLog(_jsx(ErrorLog, { message: `Accessibility check failed: ${error instanceof Error ? error.message : 'Unknown error'}` }));
80
- return 1;
81
- }
82
- });
package/bin/addDomain.js DELETED
@@ -1,130 +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 { getRelativeRecordName, normalizeBasePath, validateCustomDomainBasePath, } from '@mintlify/common';
12
- import { addLog, ErrorLog, removeLastLog, SpinnerLog, SuccessLog } from '@mintlify/previewing';
13
- import { Box, Text } from 'ink';
14
- import { authenticatedFetch } from './authenticatedFetch.js';
15
- import { getConfigValue } from './config.js';
16
- import { API_URL, CUSTOM_DOMAIN_CNAME_TARGET } from './constants.js';
17
- import { getAccessToken } from './keyring.js';
18
- import { getCliSubdomains } from './status.js';
19
- const DNS_POLL_INTERVAL_MS = 5000;
20
- const DNS_POLL_MAX_ATTEMPTS = 3;
21
- const DOMAIN_PATTERN = /^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+$/i;
22
- export function addDomain(domain, basePath) {
23
- return __awaiter(this, void 0, void 0, function* () {
24
- var _a, _b, _c, _d, _e, _f, _g;
25
- if (!DOMAIN_PATTERN.test(domain)) {
26
- addLog(_jsx(ErrorLog, { message: `invalid domain "${domain}". Expected a bare hostname, e.g. docs.example.com` }));
27
- return;
28
- }
29
- const normalizedBasePath = normalizeBasePath(basePath === null || basePath === void 0 ? void 0 : basePath.trim());
30
- if (normalizedBasePath) {
31
- const basePathError = validateCustomDomainBasePath(normalizedBasePath);
32
- if (basePathError) {
33
- addLog(_jsx(ErrorLog, { message: `invalid base path "${basePath}": ${basePathError}` }));
34
- return;
35
- }
36
- }
37
- const accessToken = yield getAccessToken();
38
- if (!accessToken) {
39
- addLog(_jsx(ErrorLog, { message: "not logged in. Run `mint login` to authenticate." }));
40
- return;
41
- }
42
- const subdomains = yield getCliSubdomains(accessToken);
43
- const configuredSubdomain = getConfigValue('subdomain');
44
- const subdomain = configuredSubdomain && subdomains.includes(configuredSubdomain)
45
- ? configuredSubdomain
46
- : subdomains[0];
47
- if (!subdomain) {
48
- addLog(_jsx(ErrorLog, { message: "no subdomain found. Run `mint status` to check your account." }));
49
- return;
50
- }
51
- try {
52
- const addRes = yield authenticatedFetch(`${API_URL}/api/cli/deployment/custom-domain/${subdomain}/${domain}`, {
53
- method: 'POST',
54
- headers: { 'Content-Type': 'application/json' },
55
- body: JSON.stringify({ basePath: normalizedBasePath ? '/docs' : '' }),
56
- });
57
- if (!addRes.ok) {
58
- const body = yield addRes.json().catch(() => ({}));
59
- addLog(_jsx(ErrorLog, { message: `could not add domain: ${(_a = body.error) !== null && _a !== void 0 ? _a : 'unknown error'}` }));
60
- return;
61
- }
62
- }
63
- catch (_h) {
64
- addLog(_jsx(ErrorLog, { message: "could not reach the server" }));
65
- return;
66
- }
67
- let basePathSaved = false;
68
- let basePathPending = false;
69
- if (normalizedBasePath) {
70
- addLog(_jsx(SpinnerLog, { message: `setting base path to ${normalizedBasePath}...` }));
71
- try {
72
- const basePathRes = yield authenticatedFetch(`${API_URL}/api/cli/deployment/base-path/${subdomain}`, {
73
- method: 'PUT',
74
- headers: { 'Content-Type': 'application/json' },
75
- body: JSON.stringify({ basePath: normalizedBasePath }),
76
- });
77
- removeLastLog();
78
- if (basePathRes.ok) {
79
- const body = (yield basePathRes.json().catch(() => ({})));
80
- basePathSaved = true;
81
- basePathPending = Boolean(body.pendingBasePathUpdate);
82
- }
83
- else {
84
- const body = (yield basePathRes.json().catch(() => ({})));
85
- const reason = (_e = (_d = (_c = (_b = body.issues) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.message) !== null && _d !== void 0 ? _d : body.error) !== null && _e !== void 0 ? _e : 'unknown error';
86
- addLog(_jsx(ErrorLog, { message: `domain added, but base path was not saved: ${reason}` }));
87
- }
88
- }
89
- catch (_j) {
90
- removeLastLog();
91
- addLog(_jsx(ErrorLog, { message: "domain added, but base path was not saved: could not reach the server" }));
92
- }
93
- }
94
- const maxWaitSeconds = ((DNS_POLL_MAX_ATTEMPTS - 1) * DNS_POLL_INTERVAL_MS) / 1000;
95
- addLog(_jsx(SpinnerLog, { message: `waiting for DNS records to generate (up to ${maxWaitSeconds}s)...` }));
96
- let dnsRecords = [];
97
- let recordsReady = false;
98
- try {
99
- for (let attempt = 0; attempt < DNS_POLL_MAX_ATTEMPTS; attempt++) {
100
- const checkRes = yield authenticatedFetch(`${API_URL}/api/cli/deployment/custom-domain/${subdomain}/${domain}`);
101
- if (checkRes.ok) {
102
- const body = (yield checkRes.json());
103
- dnsRecords = (_g = (_f = body.cloudflare) === null || _f === void 0 ? void 0 : _f.dnsRecords) !== null && _g !== void 0 ? _g : [];
104
- const stillGenerating = dnsRecords.some((record) => record.value === 'loading');
105
- if (dnsRecords.length > 0 && !stillGenerating) {
106
- recordsReady = true;
107
- break;
108
- }
109
- }
110
- if (attempt < DNS_POLL_MAX_ATTEMPTS - 1) {
111
- yield new Promise((resolve) => setTimeout(resolve, DNS_POLL_INTERVAL_MS));
112
- }
113
- }
114
- }
115
- catch (_k) {
116
- removeLastLog();
117
- addLog(_jsx(ErrorLog, { message: "domain added, but could not fetch DNS records" }));
118
- return;
119
- }
120
- removeLastLog();
121
- const readyTxtRecords = dnsRecords.filter((record) => record.type === 'TXT' && record.value !== 'loading');
122
- const successMessage = basePathPending
123
- ? `domain ${domain} added; base path ${normalizedBasePath} queued for the next deploy`
124
- : basePathSaved
125
- ? `domain ${domain} added (serving at ${normalizedBasePath})`
126
- : `domain ${domain} added`;
127
- addLog(_jsx(SuccessLog, { message: successMessage }));
128
- addLog(_jsxs(Box, { flexDirection: "column", gap: 1, paddingY: 1, children: [_jsx(Text, { bold: true, children: "Add these DNS records with your domain provider:" }), _jsxs(Box, { flexDirection: "column", paddingLeft: 3, children: [readyTxtRecords.map((record) => (_jsxs(Text, { children: ["TXT ", getRelativeRecordName(record.domain, domain), " \u2192 ", record.value] }, record.domain))), _jsxs(Text, { children: ["CNAME ", getRelativeRecordName(domain, domain), " \u2192 ", CUSTOM_DOMAIN_CNAME_TARGET] })] }), _jsx(Text, { dimColor: true, children: "Add the TXT records first; add the CNAME once they're validated." }), basePathPending && (_jsx(Text, { dimColor: true, children: "The base path takes effect when that deploy finishes; the current path stays up until then." })), basePathSaved && (_jsxs(Text, { dimColor: true, children: ["The CNAME sends all paths on ", domain, " to Mintlify. Only add it if this domain hosts nothing else. Otherwise, set up a reverse proxy for ", normalizedBasePath, ": https://www.mintlify.com/docs/deploy/docs-subpath"] })), !recordsReady && (_jsx(Text, { dimColor: true, children: "Some TXT records are still being generated. Check the dashboard in a moment for the rest." }))] }));
129
- });
130
- }
package/bin/agent-auth.js DELETED
@@ -1,104 +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 { z } from 'zod';
11
- import { agentRequest, agentResponse } from './agent-http.js';
12
- const resourceSchema = z.object({ authorization_servers: z.array(z.url()).min(1) });
13
- const discoverySchema = z.object({
14
- issuer: z.url(),
15
- token_endpoint: z.url(),
16
- agent_auth: z.object({
17
- identity_endpoint: z.url(),
18
- claim_endpoint: z.url(),
19
- identity_types_supported: z.array(z.string()),
20
- }),
21
- });
22
- export const agentIdentityAssertionSchema = z.object({ assertion: z.string().min(1) });
23
- const registrationSchema = z.object({
24
- id: z.string().min(1),
25
- identity: agentIdentityAssertionSchema,
26
- claim: z.object({ token: z.string().min(1) }),
27
- });
28
- const tokenSchema = z.object({
29
- access_token: z.string().min(1),
30
- expires_in: z.number().positive(),
31
- token_type: z.string().regex(/^bearer$/i),
32
- });
33
- const identitySchema = z.discriminatedUnion('identityType', [
34
- z.object({ registrationId: z.string(), identityType: z.literal('anonymous') }),
35
- z.object({
36
- registrationId: z.string(),
37
- identityType: z.literal('user_bound'),
38
- userId: z.string(),
39
- orgId: z.string(),
40
- }),
41
- ]);
42
- export function discoverAgentAuth(apiUrl) {
43
- return __awaiter(this, void 0, void 0, function* () {
44
- const resource = yield agentResponse(yield agentRequest(`${apiUrl}/api/agent/.well-known/oauth-protected-resource`), resourceSchema);
45
- const issuer = resource.authorization_servers[0];
46
- if (!issuer || new URL(issuer).protocol !== 'https:')
47
- throw new Error('Agent authentication requires an HTTPS issuer.');
48
- const discovery = yield agentResponse(yield agentRequest(`${issuer.replace(/\/$/, '')}/.well-known/oauth-authorization-server`), discoverySchema);
49
- const origin = new URL(issuer).origin;
50
- if ([
51
- discovery.issuer,
52
- discovery.token_endpoint,
53
- discovery.agent_auth.identity_endpoint,
54
- discovery.agent_auth.claim_endpoint,
55
- ].some((url) => new URL(url).origin !== origin)) {
56
- throw new Error('Agent authentication endpoints do not match the configured issuer.');
57
- }
58
- return discovery;
59
- });
60
- }
61
- export function registerAgent(discovery) {
62
- return __awaiter(this, void 0, void 0, function* () {
63
- if (!discovery.agent_auth.identity_types_supported.includes('anonymous')) {
64
- throw new Error('Anonymous registration is not enabled for this environment.');
65
- }
66
- const result = yield agentResponse(yield agentRequest(discovery.agent_auth.identity_endpoint, {
67
- method: 'POST',
68
- headers: { 'Content-Type': 'application/json' },
69
- body: JSON.stringify({ type: 'anonymous' }),
70
- }), registrationSchema);
71
- return {
72
- registrationId: result.id,
73
- issuer: discovery.issuer,
74
- assertion: result.identity.assertion,
75
- claimToken: result.claim.token,
76
- };
77
- });
78
- }
79
- export function exchangeAgentToken(discovery, credentials) {
80
- return __awaiter(this, void 0, void 0, function* () {
81
- var _a;
82
- if (new URL(credentials.issuer).origin !== new URL(discovery.issuer).origin) {
83
- throw new Error('Saved agent credentials belong to another issuer.');
84
- }
85
- if (credentials.accessToken && ((_a = credentials.accessTokenExpiresAt) !== null && _a !== void 0 ? _a : 0) > Date.now() + 30000) {
86
- return Object.assign(Object.assign({}, credentials), { accessToken: credentials.accessToken });
87
- }
88
- const token = yield agentResponse(yield agentRequest(discovery.token_endpoint, {
89
- method: 'POST',
90
- body: new URLSearchParams({
91
- grant_type: 'urn:ietf:params:oauth:grant-type:jwt-bearer',
92
- assertion: credentials.assertion,
93
- }),
94
- }), tokenSchema);
95
- return Object.assign(Object.assign({}, credentials), { accessToken: token.access_token, accessTokenExpiresAt: Date.now() + token.expires_in * 1000 });
96
- });
97
- }
98
- export function getAgentIdentity(apiUrl, accessToken) {
99
- return __awaiter(this, void 0, void 0, function* () {
100
- return agentResponse(yield agentRequest(`${apiUrl}/api/agent/identity`, {
101
- headers: { Authorization: `Bearer ${accessToken}` },
102
- }), identitySchema);
103
- });
104
- }
@@ -1,97 +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 { z } from 'zod';
11
- import { agentIdentityAssertionSchema, discoverAgentAuth, exchangeAgentToken, } from './agent-auth.js';
12
- import { loadAgentCredentials, saveAgentCredentials, } from './agent-credentials.js';
13
- import { AgentApiError, agentRequest, agentResponse } from './agent-http.js';
14
- import { DASHBOARD_URL } from './constants.js';
15
- import { trackEvent } from './telemetry/track.js';
16
- const claimAttemptSchema = z.object({ attempt: z.object({ verification_uri: z.url() }) });
17
- export function createAgentClaimLink(apiUrl, credentials, email) {
18
- return __awaiter(this, void 0, void 0, function* () {
19
- const loginHint = z.email().parse(email);
20
- const discovery = yield discoverAgentAuth(apiUrl);
21
- if (new URL(discovery.issuer).origin !== new URL(credentials.issuer).origin) {
22
- throw new Error('Saved agent credentials belong to another issuer.');
23
- }
24
- const claim = yield agentResponse(yield agentRequest(discovery.agent_auth.claim_endpoint, {
25
- method: 'POST',
26
- headers: { 'Content-Type': 'application/json' },
27
- body: JSON.stringify({
28
- type: 'service_auth',
29
- claim_token: credentials.claimToken,
30
- login_hint: loginHint,
31
- }),
32
- }), claimAttemptSchema).catch((error) => {
33
- if (error instanceof AgentApiError && error.code === 'too_many_attempts') {
34
- throw new Error('Too many claim links are still pending. Send the user the last claim link, or wait 5 minutes and retry.');
35
- }
36
- throw error;
37
- });
38
- const token = z
39
- .string()
40
- .min(1)
41
- .parse(new URL(claim.attempt.verification_uri).searchParams.get('token'));
42
- const claimUrl = new URL('/agent-claim', DASHBOARD_URL);
43
- claimUrl.searchParams.set('token', token);
44
- claimUrl.searchParams.set('registration', credentials.registrationId);
45
- void trackEvent('agent_signup.claim_started', { registration_id: credentials.registrationId });
46
- return claimUrl.toString();
47
- });
48
- }
49
- const completedClaimSchema = z.object({
50
- identity: agentIdentityAssertionSchema,
51
- });
52
- const signupSchema = z.object({ orgId: z.string().min(1), claimed: z.literal(true) });
53
- export function claimDeployment(options_1) {
54
- return __awaiter(this, arguments, void 0, function* (options, progress = () => { }) {
55
- var _a, _b;
56
- const { apiUrl, directory } = options;
57
- const code = (_a = options.code) === null || _a === void 0 ? void 0 : _a.trim();
58
- const email = (_b = options.email) === null || _b === void 0 ? void 0 : _b.trim();
59
- if ((!code && !email) || (code && email)) {
60
- throw new Error('Provide either --email <email> for a claim link or --code <code> to finish the claim.');
61
- }
62
- let credentials = yield loadAgentCredentials(apiUrl, directory);
63
- if (!credentials)
64
- throw new Error('No saved agent registration. Run from the directory used for mint deploy, or pass --directory.');
65
- if (email && !credentials.claimVerified) {
66
- progress('Creating the claim link...');
67
- const link = yield createAgentClaimLink(apiUrl, credentials, email);
68
- return `Claim link for the user: ${link}\nAsk the user to open it, sign in, and return the displayed code. Then run mint claim --code <code> from the same directory (or repeat --directory).`;
69
- }
70
- const discovery = yield discoverAgentAuth(apiUrl);
71
- if (new URL(discovery.issuer).origin !== new URL(credentials.issuer).origin) {
72
- throw new Error('Saved agent credentials belong to another issuer.');
73
- }
74
- const save = (value) => saveAgentCredentials(apiUrl, directory, value);
75
- if (!credentials.claimVerified) {
76
- progress('Completing the WorkOS claim...');
77
- const completed = yield agentResponse(yield agentRequest(`${discovery.agent_auth.claim_endpoint.replace(/\/$/, '')}/complete`, {
78
- method: 'POST',
79
- headers: { 'Content-Type': 'application/json' },
80
- body: JSON.stringify({ claim_token: credentials.claimToken, user_code: code }),
81
- }), completedClaimSchema);
82
- void trackEvent('agent_signup.claim_completed', {
83
- registration_id: credentials.registrationId,
84
- });
85
- credentials = Object.assign(Object.assign({}, credentials), { assertion: completed.identity.assertion, claimVerified: true, accessToken: undefined, accessTokenExpiresAt: undefined });
86
- yield save(credentials);
87
- }
88
- progress('Finishing the site claim...');
89
- const authenticated = yield exchangeAgentToken(discovery, credentials);
90
- yield agentResponse(yield agentRequest(`${apiUrl}/api/agent/signup`, {
91
- method: 'POST',
92
- headers: { Authorization: `Bearer ${authenticated.accessToken}` },
93
- }), signupSchema);
94
- yield save(authenticated);
95
- return 'Site claimed successfully. The user can now manage it in the Mintlify dashboard.';
96
- });
97
- }