@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.
- package/dist/assets/export-scripts/README.classic.md +15 -0
- package/dist/assets/export-scripts/README.md +14 -0
- package/dist/assets/export-scripts/serve.js +114 -0
- package/dist/assets/export-scripts/start-docs.bat +10 -0
- package/dist/assets/export-scripts/start-docs.sh +9 -0
- package/dist/assets/og/Inter-Bold.ttf +0 -0
- package/dist/assets/og/Inter-Medium.ttf +0 -0
- package/dist/assets/og/Inter-Regular.ttf +0 -0
- package/dist/assets/og/Inter-SemiBold.ttf +0 -0
- package/dist/assets/og/PaperMono-Regular.ttf +0 -0
- package/dist/assets/og/index_bg.wasm +0 -0
- package/dist/assets/openChrome.applescript +94 -0
- package/dist/assets/socket.io/socket.io.esm.min.js +7 -0
- package/dist/assets/socket.io/socket.io.esm.min.js.map +1 -0
- package/dist/assets/socket.io/socket.io.js +4907 -0
- package/dist/assets/socket.io/socket.io.js.map +1 -0
- package/dist/assets/socket.io/socket.io.min.js +7 -0
- package/dist/assets/socket.io/socket.io.min.js.map +1 -0
- package/dist/assets/socket.io/socket.io.msgpack.min.js +7 -0
- package/dist/assets/socket.io/socket.io.msgpack.min.js.map +1 -0
- package/dist/assets/xdg-open +1066 -0
- package/dist/assets/yargs-locales/be.json +46 -0
- package/dist/assets/yargs-locales/cs.json +51 -0
- package/dist/assets/yargs-locales/de.json +46 -0
- package/dist/assets/yargs-locales/en.json +55 -0
- package/dist/assets/yargs-locales/es.json +46 -0
- package/dist/assets/yargs-locales/fi.json +49 -0
- package/dist/assets/yargs-locales/fr.json +53 -0
- package/dist/assets/yargs-locales/hi.json +49 -0
- package/dist/assets/yargs-locales/hu.json +46 -0
- package/dist/assets/yargs-locales/id.json +50 -0
- package/dist/assets/yargs-locales/it.json +46 -0
- package/dist/assets/yargs-locales/ja.json +51 -0
- package/dist/assets/yargs-locales/ko.json +49 -0
- package/dist/assets/yargs-locales/nb.json +44 -0
- package/dist/assets/yargs-locales/nl.json +49 -0
- package/dist/assets/yargs-locales/nn.json +44 -0
- package/dist/assets/yargs-locales/pirate.json +13 -0
- package/dist/assets/yargs-locales/pl.json +49 -0
- package/dist/assets/yargs-locales/pt.json +45 -0
- package/dist/assets/yargs-locales/pt_BR.json +48 -0
- package/dist/assets/yargs-locales/ru.json +51 -0
- package/dist/assets/yargs-locales/th.json +46 -0
- package/dist/assets/yargs-locales/tr.json +48 -0
- package/dist/assets/yargs-locales/uk_UA.json +51 -0
- package/dist/assets/yargs-locales/uz.json +52 -0
- package/dist/assets/yargs-locales/zh_CN.json +48 -0
- package/dist/assets/yargs-locales/zh_TW.json +51 -0
- package/dist/converter-d8O3xkdU.js +102 -0
- package/dist/devtools-CGNZQKFV.js +24 -0
- package/dist/index.js +8 -0
- package/dist/rolldown-runtime-CEAe2Uac.js +7 -0
- package/dist/schemas-CBsmCNpK.js +372 -0
- package/dist/start.js +2310 -0
- package/package.json +38 -31
- package/.oxlintrc.json +0 -5
- package/.prettierignore +0 -2
- package/.turbo/turbo-build.log +0 -1
- package/CONTRIBUTING.md +0 -45
- package/__test__/agent-auth.test.ts +0 -114
- package/__test__/agent-claim.test.ts +0 -164
- package/__test__/agent-credentials.test.ts +0 -149
- package/__test__/agent-deployment.test.ts +0 -106
- package/__test__/agent-setup-config.test.ts +0 -324
- package/__test__/agent-setup.test.ts +0 -207
- package/__test__/agent.test.ts +0 -64
- package/__test__/analytics/client.test.ts +0 -180
- package/__test__/analytics/dates.test.ts +0 -12
- package/__test__/analytics/filters.test.ts +0 -116
- package/__test__/analytics/format.test.ts +0 -137
- package/__test__/authenticatedFetch.test.ts +0 -182
- package/__test__/brokenLinks.test.ts +0 -283
- package/__test__/checkPort.test.ts +0 -92
- package/__test__/deploy-github-actions.test.ts +0 -202
- package/__test__/deploy-github-setup.test.ts +0 -240
- package/__test__/deploy-instructions.test.ts +0 -155
- package/__test__/deploy.test.ts +0 -202
- package/__test__/feedback.test.ts +0 -34
- package/__test__/foreignSyntax.test.ts +0 -73
- package/__test__/format.test.ts +0 -72
- package/__test__/helpers.test.ts +0 -52
- package/__test__/init.test.ts +0 -119
- package/__test__/instructions.test.ts +0 -53
- package/__test__/keyring.test.ts +0 -82
- package/__test__/mdxAccessibility.test.ts +0 -81
- package/__test__/migrate.test.ts +0 -186
- package/__test__/openApiCheck.test.ts +0 -185
- package/__test__/pathValidation.test.ts +0 -25
- package/__test__/resolveFiles.test.ts +0 -70
- package/__test__/sessionId.test.ts +0 -46
- package/__test__/signup.test.ts +0 -36
- package/__test__/update.test.ts +0 -117
- package/__test__/utils.ts +0 -25
- package/__test__/validateCommand.test.ts +0 -647
- package/__test__/validateEngine.test.ts +0 -245
- package/__test__/validateRules.test.ts +0 -1275
- package/__test__/welcome.test.ts +0 -15
- package/__test__/workflows/client.test.ts +0 -126
- package/bin/accessibility.js +0 -111
- package/bin/accessibilityCheck.js +0 -82
- package/bin/addDomain.js +0 -130
- package/bin/agent-auth.js +0 -104
- package/bin/agent-claim.js +0 -97
- package/bin/agent-credentials.js +0 -124
- package/bin/agent-deployment.js +0 -96
- package/bin/agent-http.js +0 -45
- package/bin/agent-setup-config.js +0 -141
- package/bin/agent-setup.js +0 -146
- package/bin/agent.js +0 -42
- package/bin/analytics/client.js +0 -60
- package/bin/analytics/dates.js +0 -6
- package/bin/analytics/filters.js +0 -27
- package/bin/analytics/format.js +0 -13
- package/bin/analytics/index.js +0 -496
- package/bin/analytics/output.js +0 -75
- package/bin/analytics/types.js +0 -1
- package/bin/authenticatedFetch.js +0 -46
- package/bin/brokenLinks.js +0 -122
- package/bin/callbackServer.js +0 -65
- package/bin/cli.js +0 -813
- package/bin/comingSoon.js +0 -26
- package/bin/config.js +0 -78
- package/bin/constants.js +0 -16
- package/bin/deploy-base.js +0 -20
- package/bin/deploy-github-actions.js +0 -102
- package/bin/deploy-github-setup.js +0 -165
- package/bin/deploy-instructions.js +0 -71
- package/bin/deploy.js +0 -123
- package/bin/feedback.js +0 -36
- package/bin/format.js +0 -121
- package/bin/helpers.js +0 -238
- package/bin/idToken.js +0 -14
- package/bin/index.js +0 -102
- package/bin/init.js +0 -182
- package/bin/instructions.js +0 -101
- package/bin/keyring.js +0 -78
- package/bin/login.js +0 -123
- package/bin/logout.js +0 -18
- package/bin/mdxAccessibility.js +0 -113
- package/bin/mdxLinter.js +0 -55
- package/bin/middlewares/subdomainMiddleware.js +0 -28
- package/bin/middlewares/telemetryMiddleware.js +0 -61
- package/bin/migrate.js +0 -54
- package/bin/og.js +0 -145
- package/bin/openApiCheck.js +0 -99
- package/bin/resolveFiles.js +0 -114
- package/bin/score/client.js +0 -40
- package/bin/score/index.js +0 -211
- package/bin/score/types.js +0 -1
- package/bin/signup.js +0 -118
- package/bin/start.js +0 -36
- package/bin/status.js +0 -106
- package/bin/telemetry/client.js +0 -53
- package/bin/telemetry/distinctId.js +0 -68
- package/bin/telemetry/sessionId.js +0 -36
- package/bin/telemetry/track.js +0 -149
- package/bin/templates.js +0 -127
- package/bin/tokenRefresh.js +0 -50
- package/bin/tsconfig.build.tsbuildinfo +0 -1
- package/bin/update.js +0 -65
- package/bin/validate/command.js +0 -127
- package/bin/validate/engine.js +0 -154
- package/bin/validate/files.js +0 -163
- package/bin/validate/mdx.js +0 -238
- package/bin/validate/output.js +0 -44
- package/bin/validate/report.js +0 -11
- package/bin/validate/rules/build.js +0 -102
- package/bin/validate/rules/content/duplicateH1.js +0 -57
- package/bin/validate/rules/content/foreignSyntax.js +0 -120
- package/bin/validate/rules/content/katex.js +0 -34
- package/bin/validate/rules/content/missingSnippet.js +0 -34
- package/bin/validate/rules/content/undefinedVariable.js +0 -13
- package/bin/validate/rules/content/unknownComponent.js +0 -121
- package/bin/validate/rules/content/voidTags.js +0 -38
- package/bin/validate/rules/index.js +0 -21
- package/bin/validate/rules/openapi.js +0 -50
- package/bin/validate/rules/parseError.js +0 -7
- package/bin/validate/site.js +0 -57
- package/bin/validate/types.js +0 -1
- package/bin/vendor/converter.js +0 -30882
- package/bin/welcome.js +0 -108
- package/bin/workflows/client.js +0 -34
- package/bin/workflows/index.js +0 -269
- package/bin/workflows/types.js +0 -11
- package/scripts/bundle-converter.mjs +0 -26
- package/scripts/generate-logo.mjs +0 -79
- package/src/accessibility.ts +0 -180
- package/src/accessibilityCheck.tsx +0 -150
- package/src/addDomain.tsx +0 -206
- package/src/agent-auth.ts +0 -119
- package/src/agent-claim.ts +0 -124
- package/src/agent-credentials.ts +0 -104
- package/src/agent-deployment.ts +0 -116
- package/src/agent-http.ts +0 -34
- package/src/agent-setup-config.ts +0 -144
- package/src/agent-setup.ts +0 -165
- package/src/agent.ts +0 -56
- package/src/analytics/client.ts +0 -153
- package/src/analytics/dates.ts +0 -6
- package/src/analytics/filters.ts +0 -50
- package/src/analytics/format.ts +0 -13
- package/src/analytics/index.tsx +0 -599
- package/src/analytics/output.ts +0 -99
- package/src/analytics/types.ts +0 -145
- package/src/authenticatedFetch.ts +0 -42
- package/src/brokenLinks.tsx +0 -152
- package/src/callbackServer.ts +0 -64
- package/src/cli.tsx +0 -1105
- package/src/comingSoon.tsx +0 -29
- package/src/config.ts +0 -75
- package/src/constants.ts +0 -28
- package/src/deploy-base.ts +0 -18
- package/src/deploy-github-actions.ts +0 -139
- package/src/deploy-github-setup.ts +0 -189
- package/src/deploy-instructions.ts +0 -76
- package/src/deploy.ts +0 -165
- package/src/feedback.tsx +0 -31
- package/src/format.tsx +0 -82
- package/src/helpers.tsx +0 -279
- package/src/idToken.ts +0 -17
- package/src/index.ts +0 -109
- package/src/init.tsx +0 -237
- package/src/instructions.ts +0 -99
- package/src/keyring.ts +0 -65
- package/src/login.tsx +0 -166
- package/src/logout.tsx +0 -8
- package/src/mdxAccessibility.ts +0 -134
- package/src/mdxLinter.tsx +0 -88
- package/src/middlewares/subdomainMiddleware.ts +0 -20
- package/src/middlewares/telemetryMiddleware.ts +0 -55
- package/src/migrate.ts +0 -76
- package/src/og.tsx +0 -185
- package/src/openApiCheck.tsx +0 -125
- package/src/resolveFiles.ts +0 -101
- package/src/score/client.ts +0 -36
- package/src/score/index.tsx +0 -205
- package/src/score/types.ts +0 -15
- package/src/signup.tsx +0 -172
- package/src/start.ts +0 -27
- package/src/status.tsx +0 -129
- package/src/telemetry/client.ts +0 -46
- package/src/telemetry/distinctId.ts +0 -70
- package/src/telemetry/sessionId.ts +0 -40
- package/src/telemetry/track.ts +0 -163
- package/src/templates.tsx +0 -143
- package/src/tokenRefresh.ts +0 -53
- package/src/update.tsx +0 -89
- package/src/validate/command.tsx +0 -135
- package/src/validate/engine.ts +0 -210
- package/src/validate/files.ts +0 -249
- package/src/validate/mdx.ts +0 -290
- package/src/validate/output.tsx +0 -76
- package/src/validate/report.ts +0 -40
- package/src/validate/rules/build.ts +0 -146
- package/src/validate/rules/content/duplicateH1.ts +0 -78
- package/src/validate/rules/content/foreignSyntax.ts +0 -144
- package/src/validate/rules/content/katex.ts +0 -33
- package/src/validate/rules/content/missingSnippet.ts +0 -36
- package/src/validate/rules/content/undefinedVariable.ts +0 -20
- package/src/validate/rules/content/unknownComponent.ts +0 -130
- package/src/validate/rules/content/voidTags.ts +0 -43
- package/src/validate/rules/index.ts +0 -23
- package/src/validate/rules/openapi.ts +0 -59
- package/src/validate/rules/parseError.ts +0 -9
- package/src/validate/site.ts +0 -53
- package/src/validate/types.ts +0 -102
- package/src/vendor/converter.ts +0 -1
- package/src/welcome.ts +0 -154
- package/src/workflows/client.ts +0 -39
- package/src/workflows/index.tsx +0 -287
- package/src/workflows/types.ts +0 -73
- package/tsconfig.build.json +0 -4
- package/tsconfig.json +0 -10
- package/vitest.config.ts +0 -9
package/bin/welcome.js
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
|
-
const MINT_GREEN = '#18E299';
|
|
3
|
-
const mint = chalk.hex(MINT_GREEN);
|
|
4
|
-
const GROUPS = [
|
|
5
|
-
{
|
|
6
|
-
title: 'Preview',
|
|
7
|
-
commands: [
|
|
8
|
-
{ name: 'dev', description: 'Start a local preview of your site' },
|
|
9
|
-
{ name: 'new', description: 'Scaffold a new documentation site' },
|
|
10
|
-
{
|
|
11
|
-
name: 'deploy',
|
|
12
|
-
description: 'Provision a docs site without login; get Git push instructions',
|
|
13
|
-
},
|
|
14
|
-
],
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
title: 'Quality',
|
|
18
|
-
commands: [
|
|
19
|
-
{ name: 'validate', description: 'Validate the site build (strict)' },
|
|
20
|
-
{
|
|
21
|
-
name: 'broken-links',
|
|
22
|
-
description: 'Find broken links before you ship',
|
|
23
|
-
},
|
|
24
|
-
{ name: 'a11y', description: 'Check site for accessibility issues' },
|
|
25
|
-
{ name: 'score', description: 'Run agent-readiness checks' },
|
|
26
|
-
],
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
title: 'Insights',
|
|
30
|
-
commands: [
|
|
31
|
-
{ name: 'analytics', description: 'View analytics for your site' },
|
|
32
|
-
{ name: 'automations', description: 'Create and manage automations' },
|
|
33
|
-
],
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
title: 'Account',
|
|
37
|
-
commands: [
|
|
38
|
-
{ name: 'login', description: 'Authenticate with Mintlify' },
|
|
39
|
-
{ name: 'claim', description: 'Claim a site created with mint deploy' },
|
|
40
|
-
{ name: 'logout', description: 'Sign out on this device' },
|
|
41
|
-
{ name: 'status', description: 'View authentication status' },
|
|
42
|
-
],
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
title: 'CLI',
|
|
46
|
-
commands: [
|
|
47
|
-
{ name: 'agent setup', description: 'Install Mintlify skills and configure Admin MCP' },
|
|
48
|
-
{ name: 'config', description: 'Manage CLI configuration' },
|
|
49
|
-
{ name: 'instructions', description: 'Print Mintlify workflow instructions' },
|
|
50
|
-
{ name: 'update', description: 'Update to the latest version' },
|
|
51
|
-
],
|
|
52
|
-
},
|
|
53
|
-
];
|
|
54
|
-
const EXAMPLES = [
|
|
55
|
-
{ name: 'dev', description: 'Start a local preview of your site' },
|
|
56
|
-
{ name: 'new docs', description: 'Scaffold a new site in ./docs' },
|
|
57
|
-
{
|
|
58
|
-
name: 'claim --email you@example.com',
|
|
59
|
-
description: 'Get a claim link; use the deployment directory',
|
|
60
|
-
},
|
|
61
|
-
{ name: 'claim --code <code>', description: 'Finish the claim in the same directory' },
|
|
62
|
-
{ name: 'validate', description: 'Validate your site before shipping' },
|
|
63
|
-
{ name: 'broken-links', description: 'Find broken links across your site' },
|
|
64
|
-
];
|
|
65
|
-
const COMMAND_NAME_WIDTH = GROUPS.flatMap((group) => group.commands).reduce((max, command) => Math.max(max, command.name.length), 0) + 2;
|
|
66
|
-
// `name description`, name padded to a shared column and colored mint. Padding
|
|
67
|
-
// is computed on the raw name so ANSI codes don't throw off the alignment.
|
|
68
|
-
const commandRow = (name, description, nameWidth, indent) => ' '.repeat(indent) + mint(name.padEnd(nameWidth)) + chalk.dim(description);
|
|
69
|
-
/**
|
|
70
|
-
* Builds the branded welcome / help screen as a ready-to-print string: the
|
|
71
|
-
* Mintlify leaf beside an identity block, then grouped examples and commands.
|
|
72
|
-
*/
|
|
73
|
-
export function renderWelcome({ packageName, version, signedIn, subdomain, }) {
|
|
74
|
-
const title = `${packageName.charAt(0).toUpperCase()}${packageName.slice(1)} CLI`;
|
|
75
|
-
// Only prefix "v" for real semver versions; the linked-dev build reports a
|
|
76
|
-
// descriptive string ("linked to local package").
|
|
77
|
-
const versionLabel = version ? (/^\d/.test(version) ? `v${version}` : version) : undefined;
|
|
78
|
-
const identity = [
|
|
79
|
-
chalk.bold(title) + (versionLabel ? chalk.dim(` ${versionLabel}`) : ''),
|
|
80
|
-
'',
|
|
81
|
-
signedIn
|
|
82
|
-
? chalk.dim('Signed in to Mintlify')
|
|
83
|
-
: chalk.dim('Run ') + mint(`${packageName} login`) + chalk.dim(' to sign in'),
|
|
84
|
-
...(subdomain ? [chalk.dim(`Project ${subdomain}`)] : []),
|
|
85
|
-
];
|
|
86
|
-
const lines = [''];
|
|
87
|
-
lines.push(...identity);
|
|
88
|
-
// Examples.
|
|
89
|
-
const exampleWidth = EXAMPLES.reduce((max, example) => Math.max(max, `${packageName} ${example.name}`.length), 0) +
|
|
90
|
-
2;
|
|
91
|
-
lines.push('', ' ' + chalk.bold('EXAMPLES'));
|
|
92
|
-
for (const example of EXAMPLES) {
|
|
93
|
-
lines.push(commandRow(`${packageName} ${example.name}`, example.description, exampleWidth, 3));
|
|
94
|
-
}
|
|
95
|
-
// Commands, grouped.
|
|
96
|
-
lines.push('', ' ' + chalk.bold('COMMANDS'));
|
|
97
|
-
for (const group of GROUPS) {
|
|
98
|
-
lines.push('', ' ' + chalk.bold(group.title));
|
|
99
|
-
for (const command of group.commands) {
|
|
100
|
-
lines.push(commandRow(command.name, command.description, COMMAND_NAME_WIDTH, 5));
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
lines.push('', ' ' +
|
|
104
|
-
chalk.dim('Run ') +
|
|
105
|
-
mint(`${packageName} <command> --help`) +
|
|
106
|
-
chalk.dim(' for details on any command.'), '');
|
|
107
|
-
return lines.join('\n') + '\n';
|
|
108
|
-
}
|
package/bin/workflows/client.js
DELETED
|
@@ -1,34 +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 { authenticatedFetch } from '../authenticatedFetch.js';
|
|
11
|
-
import { API_URL } from '../constants.js';
|
|
12
|
-
function request(path, init) {
|
|
13
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
14
|
-
const res = yield authenticatedFetch(`${API_URL}/api/cli/workflows${path}`, Object.assign(Object.assign({}, init), { headers: Object.assign({ Accept: 'application/json' }, init === null || init === void 0 ? void 0 : init.headers) }));
|
|
15
|
-
if (!res.ok) {
|
|
16
|
-
const body = yield res.text().catch(() => '');
|
|
17
|
-
throw new Error(`API error (${res.status}): ${body || res.statusText}`);
|
|
18
|
-
}
|
|
19
|
-
return res.json();
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
export function createWorkflow(subdomain, body) {
|
|
23
|
-
return request(`/${encodeURIComponent(subdomain)}`, {
|
|
24
|
-
method: 'POST',
|
|
25
|
-
headers: { 'Content-Type': 'application/json' },
|
|
26
|
-
body: JSON.stringify(body),
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
export function listWorkflows(subdomain) {
|
|
30
|
-
return request(`/${encodeURIComponent(subdomain)}`);
|
|
31
|
-
}
|
|
32
|
-
export function deleteWorkflow(subdomain, workflowSchemaId) {
|
|
33
|
-
return request(`/${encodeURIComponent(subdomain)}/${encodeURIComponent(workflowSchemaId)}`, { method: 'DELETE' });
|
|
34
|
-
}
|
package/bin/workflows/index.js
DELETED
|
@@ -1,269 +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, ErrorLog, SpinnerLog, SuccessLog, removeLastLog } from '@mintlify/previewing';
|
|
12
|
-
import chalk from 'chalk';
|
|
13
|
-
import { Text } from 'ink';
|
|
14
|
-
import yaml from 'js-yaml';
|
|
15
|
-
import fs from 'node:fs/promises';
|
|
16
|
-
import path from 'node:path';
|
|
17
|
-
import { CMD_EXEC_PATH, terminate } from '../helpers.js';
|
|
18
|
-
import { subdomainMiddleware } from '../middlewares/subdomainMiddleware.js';
|
|
19
|
-
import { trackEvent } from '../telemetry/track.js';
|
|
20
|
-
import { createWorkflow, deleteWorkflow, listWorkflows } from './client.js';
|
|
21
|
-
import { WORKFLOW_TYPES, } from './types.js';
|
|
22
|
-
function resolveFormat(argv) {
|
|
23
|
-
return argv.format === 'json' ? 'json' : 'table';
|
|
24
|
-
}
|
|
25
|
-
function output(format, text) {
|
|
26
|
-
if (format === 'table') {
|
|
27
|
-
addLog(_jsx(Text, { children: text }));
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
process.stdout.write(text + '\n');
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
function requireSubdomain(subdomain) {
|
|
34
|
-
if (!subdomain) {
|
|
35
|
-
throw new Error('No subdomain set. Pass --subdomain, or run `mint config set subdomain <name>`.');
|
|
36
|
-
}
|
|
37
|
-
return subdomain;
|
|
38
|
-
}
|
|
39
|
-
function readWorkflowFile(filePath) {
|
|
40
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
-
const resolved = path.isAbsolute(filePath) ? filePath : path.join(CMD_EXEC_PATH, filePath);
|
|
42
|
-
const contents = yield fs.readFile(resolved, 'utf-8');
|
|
43
|
-
if (/\.ya?ml$/i.test(resolved))
|
|
44
|
-
return yaml.load(contents);
|
|
45
|
-
return JSON.parse(contents);
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
function buildTriggerFromFlags(argv) {
|
|
49
|
-
var _a;
|
|
50
|
-
const repos = ((_a = argv.pushRepo) !== null && _a !== void 0 ? _a : []).map(String).filter(Boolean);
|
|
51
|
-
if (argv.cron && repos.length > 0) {
|
|
52
|
-
throw new Error('Specify either --cron or --push-repo, not both.');
|
|
53
|
-
}
|
|
54
|
-
if (argv.cron)
|
|
55
|
-
return { cron: argv.cron };
|
|
56
|
-
if (repos.length > 0)
|
|
57
|
-
return { push: repos.map((repo) => ({ repo })) };
|
|
58
|
-
throw new Error('A trigger is required. Pass --cron <expr> or --push-repo <owner/repo>.');
|
|
59
|
-
}
|
|
60
|
-
function buildBodyFromFlags(argv) {
|
|
61
|
-
var _a;
|
|
62
|
-
if (!argv.name) {
|
|
63
|
-
throw new Error('--name is required when --file is not provided.');
|
|
64
|
-
}
|
|
65
|
-
const type = argv.type;
|
|
66
|
-
if (type !== undefined && !WORKFLOW_TYPES.includes(type)) {
|
|
67
|
-
throw new Error(`Invalid --type "${type}". Valid types: ${WORKFLOW_TYPES.join(', ')}`);
|
|
68
|
-
}
|
|
69
|
-
const body = {
|
|
70
|
-
name: argv.name,
|
|
71
|
-
on: buildTriggerFromFlags(argv),
|
|
72
|
-
};
|
|
73
|
-
if (argv.prompt)
|
|
74
|
-
body.prompt = argv.prompt;
|
|
75
|
-
if (type)
|
|
76
|
-
body.type = type;
|
|
77
|
-
if (argv.automerge !== undefined)
|
|
78
|
-
body.automerge = argv.automerge;
|
|
79
|
-
const contextRepos = ((_a = argv.contextRepo) !== null && _a !== void 0 ? _a : []).map(String).filter(Boolean);
|
|
80
|
-
if (contextRepos.length > 0)
|
|
81
|
-
body.context = contextRepos.map((repo) => ({ repo }));
|
|
82
|
-
return body;
|
|
83
|
-
}
|
|
84
|
-
function describeTrigger(trigger) {
|
|
85
|
-
if ('webhook' in trigger)
|
|
86
|
-
return 'webhook';
|
|
87
|
-
if ('cron' in trigger)
|
|
88
|
-
return `cron(${trigger.cron})`;
|
|
89
|
-
if ('push' in trigger)
|
|
90
|
-
return `push(${trigger.push.map((p) => p.repo).join(', ')})`;
|
|
91
|
-
return `composio(${trigger.composio.toolkit}:${trigger.composio.triggerSlug})`;
|
|
92
|
-
}
|
|
93
|
-
function renderWorkflow(workflow) {
|
|
94
|
-
const lines = [];
|
|
95
|
-
lines.push(chalk.bold(`\nAutomation ${workflow.name}`));
|
|
96
|
-
lines.push(` ${chalk.dim('ID')} ${workflow._id}`);
|
|
97
|
-
lines.push(` ${chalk.dim('Status')} ${workflow.status}`);
|
|
98
|
-
if (workflow.type)
|
|
99
|
-
lines.push(` ${chalk.dim('Type')} ${workflow.type}`);
|
|
100
|
-
lines.push(` ${chalk.dim('Trigger')} ${describeTrigger(workflow.trigger)}`);
|
|
101
|
-
if (workflow.automerge !== undefined) {
|
|
102
|
-
lines.push(` ${chalk.dim('Automerge')} ${workflow.automerge}`);
|
|
103
|
-
}
|
|
104
|
-
return lines.join('\n');
|
|
105
|
-
}
|
|
106
|
-
function renderList(workflows) {
|
|
107
|
-
if (workflows.length === 0)
|
|
108
|
-
return 'No automations found.';
|
|
109
|
-
const rows = workflows.map((w) => {
|
|
110
|
-
var _a;
|
|
111
|
-
return [
|
|
112
|
-
w._id,
|
|
113
|
-
w.name,
|
|
114
|
-
(_a = w.type) !== null && _a !== void 0 ? _a : '—',
|
|
115
|
-
describeTrigger(w.trigger),
|
|
116
|
-
w.status,
|
|
117
|
-
];
|
|
118
|
-
});
|
|
119
|
-
const headers = ['ID', 'Name', 'Type', 'Trigger', 'Status'];
|
|
120
|
-
const widths = headers.map((h, i) => Math.max(h.length, ...rows.map((r) => String(r[i]).length)));
|
|
121
|
-
const fmt = (cells) => cells.map((c, i) => c.padEnd(widths[i])).join(' ');
|
|
122
|
-
return [chalk.bold(fmt(headers)), ...rows.map(fmt)].join('\n');
|
|
123
|
-
}
|
|
124
|
-
const withSubdomain = (yargs) => yargs.option('subdomain', {
|
|
125
|
-
type: 'string',
|
|
126
|
-
description: 'Documentation subdomain (default: mint config set subdomain)',
|
|
127
|
-
});
|
|
128
|
-
const withFormat = (yargs) => yargs.option('format', {
|
|
129
|
-
type: 'string',
|
|
130
|
-
choices: ['table', 'json'],
|
|
131
|
-
description: 'Output format (table=pretty, json=raw)',
|
|
132
|
-
});
|
|
133
|
-
export const workflowsBuilder = (yargs) => yargs
|
|
134
|
-
.middleware(subdomainMiddleware)
|
|
135
|
-
.command('create', 'Create a new automation', (yargs) => withFormat(withSubdomain(yargs)
|
|
136
|
-
.option('name', { type: 'string', description: 'Automation name' })
|
|
137
|
-
.option('prompt', { type: 'string', description: 'Automation prompt' })
|
|
138
|
-
.option('type', {
|
|
139
|
-
type: 'string',
|
|
140
|
-
choices: WORKFLOW_TYPES,
|
|
141
|
-
description: 'Automation type',
|
|
142
|
-
})
|
|
143
|
-
.option('cron', {
|
|
144
|
-
type: 'string',
|
|
145
|
-
description: 'Cron expression for a scheduled trigger',
|
|
146
|
-
})
|
|
147
|
-
.option('push-repo', {
|
|
148
|
-
type: 'string',
|
|
149
|
-
array: true,
|
|
150
|
-
description: 'Repository (owner/repo) for a push trigger (repeatable)',
|
|
151
|
-
})
|
|
152
|
-
.option('context-repo', {
|
|
153
|
-
type: 'string',
|
|
154
|
-
array: true,
|
|
155
|
-
description: 'Additional context repository (repeatable)',
|
|
156
|
-
})
|
|
157
|
-
.option('automerge', {
|
|
158
|
-
type: 'boolean',
|
|
159
|
-
description: 'Automatically merge PRs opened by this automation',
|
|
160
|
-
})
|
|
161
|
-
.option('file', {
|
|
162
|
-
type: 'string',
|
|
163
|
-
description: 'Path to a JSON or YAML file with the full automation body',
|
|
164
|
-
}))
|
|
165
|
-
.example('mint automations create --name Translations --cron "0 6 * * *" --type translations', '')
|
|
166
|
-
.example('mint automations create --file automation.yaml', ''), (argv) => __awaiter(void 0, void 0, void 0, function* () {
|
|
167
|
-
const format = resolveFormat(argv);
|
|
168
|
-
try {
|
|
169
|
-
const subdomain = requireSubdomain(argv.subdomain);
|
|
170
|
-
const body = argv.file
|
|
171
|
-
? (yield readWorkflowFile(argv.file))
|
|
172
|
-
: buildBodyFromFlags(argv);
|
|
173
|
-
if (format === 'table')
|
|
174
|
-
addLog(_jsx(SpinnerLog, { message: "Creating automation..." }));
|
|
175
|
-
const created = yield createWorkflow(subdomain, body);
|
|
176
|
-
if (format === 'table')
|
|
177
|
-
removeLastLog();
|
|
178
|
-
void trackEvent('cli.automation.created', {
|
|
179
|
-
subdomain,
|
|
180
|
-
type: created.type,
|
|
181
|
-
triggerKind: describeTrigger(created.trigger).split('(')[0],
|
|
182
|
-
});
|
|
183
|
-
if (format === 'json') {
|
|
184
|
-
output(format, JSON.stringify(created, null, 2));
|
|
185
|
-
}
|
|
186
|
-
else {
|
|
187
|
-
addLog(_jsx(SuccessLog, { message: `Created automation ${created._id}` }));
|
|
188
|
-
output(format, renderWorkflow(created));
|
|
189
|
-
}
|
|
190
|
-
yield terminate(0);
|
|
191
|
-
}
|
|
192
|
-
catch (err) {
|
|
193
|
-
if (format === 'table')
|
|
194
|
-
removeLastLog();
|
|
195
|
-
const message = err instanceof Error ? err.message : 'unknown error';
|
|
196
|
-
if (format === 'json') {
|
|
197
|
-
process.stderr.write(`Error: ${message}\n`);
|
|
198
|
-
}
|
|
199
|
-
else {
|
|
200
|
-
addLog(_jsx(ErrorLog, { message: message }));
|
|
201
|
-
}
|
|
202
|
-
yield terminate(1);
|
|
203
|
-
}
|
|
204
|
-
}))
|
|
205
|
-
.command('list', 'List automations for the current deployment', (yargs) => withFormat(withSubdomain(yargs)), (argv) => __awaiter(void 0, void 0, void 0, function* () {
|
|
206
|
-
const format = resolveFormat(argv);
|
|
207
|
-
try {
|
|
208
|
-
const subdomain = requireSubdomain(argv.subdomain);
|
|
209
|
-
if (format === 'table')
|
|
210
|
-
addLog(_jsx(SpinnerLog, { message: "Fetching automations..." }));
|
|
211
|
-
const workflows = yield listWorkflows(subdomain);
|
|
212
|
-
if (format === 'table')
|
|
213
|
-
removeLastLog();
|
|
214
|
-
if (format === 'json') {
|
|
215
|
-
output(format, JSON.stringify(workflows, null, 2));
|
|
216
|
-
}
|
|
217
|
-
else {
|
|
218
|
-
output(format, renderList(workflows));
|
|
219
|
-
}
|
|
220
|
-
yield terminate(0);
|
|
221
|
-
}
|
|
222
|
-
catch (err) {
|
|
223
|
-
if (format === 'table')
|
|
224
|
-
removeLastLog();
|
|
225
|
-
const message = err instanceof Error ? err.message : 'unknown error';
|
|
226
|
-
if (format === 'json') {
|
|
227
|
-
process.stderr.write(`Error: ${message}\n`);
|
|
228
|
-
}
|
|
229
|
-
else {
|
|
230
|
-
addLog(_jsx(ErrorLog, { message: message }));
|
|
231
|
-
}
|
|
232
|
-
yield terminate(1);
|
|
233
|
-
}
|
|
234
|
-
}))
|
|
235
|
-
.command('delete <id>', 'Delete an automation by ID', (yargs) => withFormat(withSubdomain(yargs)).positional('id', {
|
|
236
|
-
type: 'string',
|
|
237
|
-
demandOption: true,
|
|
238
|
-
description: 'Automation schema ID',
|
|
239
|
-
}), (argv) => __awaiter(void 0, void 0, void 0, function* () {
|
|
240
|
-
const format = resolveFormat(argv);
|
|
241
|
-
try {
|
|
242
|
-
const subdomain = requireSubdomain(argv.subdomain);
|
|
243
|
-
if (format === 'table')
|
|
244
|
-
addLog(_jsx(SpinnerLog, { message: "Deleting automation..." }));
|
|
245
|
-
yield deleteWorkflow(subdomain, argv.id);
|
|
246
|
-
if (format === 'table')
|
|
247
|
-
removeLastLog();
|
|
248
|
-
if (format === 'json') {
|
|
249
|
-
output(format, JSON.stringify({ success: true, id: argv.id }, null, 2));
|
|
250
|
-
}
|
|
251
|
-
else {
|
|
252
|
-
addLog(_jsx(SuccessLog, { message: `Deleted automation ${argv.id}` }));
|
|
253
|
-
}
|
|
254
|
-
yield terminate(0);
|
|
255
|
-
}
|
|
256
|
-
catch (err) {
|
|
257
|
-
if (format === 'table')
|
|
258
|
-
removeLastLog();
|
|
259
|
-
const message = err instanceof Error ? err.message : 'unknown error';
|
|
260
|
-
if (format === 'json') {
|
|
261
|
-
process.stderr.write(`Error: ${message}\n`);
|
|
262
|
-
}
|
|
263
|
-
else {
|
|
264
|
-
addLog(_jsx(ErrorLog, { message: message }));
|
|
265
|
-
}
|
|
266
|
-
yield terminate(1);
|
|
267
|
-
}
|
|
268
|
-
}))
|
|
269
|
-
.demandCommand(1, 'specify a subcommand: create, list, or delete');
|
package/bin/workflows/types.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { build } from 'esbuild';
|
|
2
|
-
import { createRequire } from 'node:module';
|
|
3
|
-
|
|
4
|
-
const require = createRequire(import.meta.url);
|
|
5
|
-
const entry = require.resolve('@mintlify/editor/converter');
|
|
6
|
-
|
|
7
|
-
await build({
|
|
8
|
-
entryPoints: [entry],
|
|
9
|
-
outfile: 'bin/vendor/converter.js',
|
|
10
|
-
bundle: true,
|
|
11
|
-
format: 'esm',
|
|
12
|
-
platform: 'node',
|
|
13
|
-
target: 'node18',
|
|
14
|
-
external: [
|
|
15
|
-
'@mintlify/common',
|
|
16
|
-
'@mintlify/validation',
|
|
17
|
-
'js-yaml',
|
|
18
|
-
'mdast-util-*',
|
|
19
|
-
'prosemirror-*',
|
|
20
|
-
'remark*',
|
|
21
|
-
'unified',
|
|
22
|
-
'unist-util-*',
|
|
23
|
-
'yaml',
|
|
24
|
-
'zod',
|
|
25
|
-
],
|
|
26
|
-
});
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
// Regenerates `src/logo.ts` — the ASCII Mintlify leaf shown on the welcome
|
|
2
|
-
// screen.
|
|
3
|
-
//
|
|
4
|
-
// Pipeline: flatten the icon's three vector paths into one solid-white
|
|
5
|
-
// silhouette (so brightness-based renderers don't drop the darker leaf
|
|
6
|
-
// segments), rasterize it with `sharp`, let `chafa` do the image -> ASCII shape
|
|
7
|
-
// detection, then normalize every glyph to a solid `#` for the clean
|
|
8
|
-
// single-color mark.
|
|
9
|
-
//
|
|
10
|
-
// Usage: node scripts/generate-logo.mjs
|
|
11
|
-
// Requires `sharp` (a monorepo dependency) and the `chafa` CLI on PATH.
|
|
12
|
-
|
|
13
|
-
import { execFileSync } from 'node:child_process';
|
|
14
|
-
import { mkdtempSync, writeFileSync } from 'node:fs';
|
|
15
|
-
import { tmpdir } from 'node:os';
|
|
16
|
-
import { dirname, join } from 'node:path';
|
|
17
|
-
import { fileURLToPath } from 'node:url';
|
|
18
|
-
import sharp from 'sharp';
|
|
19
|
-
|
|
20
|
-
const MINT_GREEN = '#18E299';
|
|
21
|
-
const MINT_GREEN_DEEP = '#0C8C5E';
|
|
22
|
-
|
|
23
|
-
// Paths from mintlify-icon.svg (viewBox 0 0 19 19), all filled solid white over
|
|
24
|
-
// a black background so chafa sees one uniform-brightness silhouette.
|
|
25
|
-
const PATHS = [
|
|
26
|
-
'M18.367 7.28888V1.59755C18.367 0.986819 17.8715 0.5 17.2699 0.5H11.5812C10.6877 0.5 9.80295 0.677018 8.98017 1.01336C8.15738 1.35856 7.40539 1.85424 6.77724 2.49152L6.733 2.53578C5.90137 3.37664 5.30862 4.42108 5.00781 5.57174C5.54749 5.43012 6.10483 5.35931 6.6622 5.35046C8.14852 5.33276 9.60831 5.81073 10.7938 6.7047C11.8643 7.50131 12.6783 8.59885 13.1206 9.86458C13.5807 11.148 13.6337 12.5465 13.2887 13.8653C14.43 13.5644 15.4828 12.9714 16.3233 12.1393L16.3675 12.0951C16.9957 11.4667 17.4999 10.7143 17.845 9.89114C18.19 9.06797 18.3581 8.18285 18.3581 7.28888H18.367Z',
|
|
27
|
-
'M4.83793 7.193C4.84674 5.44706 5.54303 3.77167 6.76814 2.51953L2.03511 7.25472C2.01749 7.27236 1.99985 7.28117 1.98222 7.29881C0.827615 8.44513 0.131342 9.97945 0.0167623 11.6019C-0.0890033 13.1186 0.307609 14.6176 1.15373 15.8698C1.23444 15.9892 1.45343 16.0285 1.57682 15.9139L4.47656 13.0216C5.38438 12.1134 5.66643 10.7642 5.23455 9.55618C4.96132 8.80666 4.82912 8.00424 4.83793 7.193Z',
|
|
28
|
-
'M16.341 12.0938C15.4332 12.9844 14.2962 13.6016 13.0623 13.875C11.8195 14.1483 10.5327 14.0689 9.33405 13.6457C9.33405 13.6457 9.32522 13.6457 9.31641 13.6457C8.10892 13.2136 6.76042 13.4958 5.8526 14.3952L2.95282 17.2875C2.82943 17.4109 2.84706 17.6137 2.99689 17.7107C4.24845 18.5484 5.74683 18.954 7.26281 18.8482C8.88455 18.7336 10.4093 18.037 11.5639 16.8818L11.608 16.8378L16.341 12.1026V12.0938Z',
|
|
29
|
-
];
|
|
30
|
-
|
|
31
|
-
const SIZE = '28x14'; // chafa output columns x rows
|
|
32
|
-
const RES = 480; // raster resolution fed to chafa
|
|
33
|
-
|
|
34
|
-
const silhouette = `<svg width="19" height="19" viewBox="0 0 19 19" xmlns="http://www.w3.org/2000/svg"><rect width="19" height="19" fill="#000"/>${PATHS.map(
|
|
35
|
-
(d) => `<path d="${d}" fill="#fff"/>`
|
|
36
|
-
).join('')}</svg>`;
|
|
37
|
-
|
|
38
|
-
const pngPath = join(mkdtempSync(join(tmpdir(), 'mint-logo-')), 'silhouette.png');
|
|
39
|
-
await sharp(Buffer.from(silhouette)).resize(RES, RES, { fit: 'fill' }).png().toFile(pngPath);
|
|
40
|
-
|
|
41
|
-
const ascii = execFileSync(
|
|
42
|
-
'chafa',
|
|
43
|
-
['--symbols', 'ascii', '-c', 'none', '--dither', 'none', '--size', SIZE, pngPath],
|
|
44
|
-
{ encoding: 'utf8' }
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
// chafa renders the shape with a brightness ramp of letters; collapse every
|
|
48
|
-
// glyph to `#` for the clean single-color mark, trim trailing space, and drop
|
|
49
|
-
// blank rows at the bottom.
|
|
50
|
-
const art = ascii
|
|
51
|
-
.split('\n')
|
|
52
|
-
.map((line) => line.replace(/\S/g, '#').replace(/\s+$/, ''))
|
|
53
|
-
.filter(
|
|
54
|
-
(line, index, lines) => line.length > 0 || lines.slice(index).some((rest) => rest.trim())
|
|
55
|
-
);
|
|
56
|
-
|
|
57
|
-
const file = `// AUTO-GENERATED by \`scripts/generate-logo.mjs\` from the Mintlify icon mark.
|
|
58
|
-
// Do not edit by hand — run \`node scripts/generate-logo.mjs\` to regenerate.
|
|
59
|
-
|
|
60
|
-
/** Mintlify brand greens. */
|
|
61
|
-
export const MINT_GREEN = '${MINT_GREEN}';
|
|
62
|
-
export const MINT_GREEN_DEEP = '${MINT_GREEN_DEEP}';
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* The Mintlify leaf, rendered as a solid \`#\` mark (chafa shape detection,
|
|
66
|
-
* normalized to a single glyph). Drawn in {@link MINT_GREEN} on the welcome
|
|
67
|
-
* screen.
|
|
68
|
-
*/
|
|
69
|
-
export const MINT_LOGO: string[] = [
|
|
70
|
-
${art.map((line) => ` '${line}',`).join('\n')}
|
|
71
|
-
];
|
|
72
|
-
|
|
73
|
-
/** Width of the widest logo row, for laying out content beside it. */
|
|
74
|
-
export const MINT_LOGO_WIDTH = MINT_LOGO.reduce((max, line) => Math.max(max, line.length), 0);
|
|
75
|
-
`;
|
|
76
|
-
|
|
77
|
-
const out = join(dirname(fileURLToPath(import.meta.url)), '..', 'src', 'logo.ts');
|
|
78
|
-
writeFileSync(out, file);
|
|
79
|
-
console.log(`Wrote ${out} (${art.length} rows, width ${Math.max(...art.map((r) => r.length))})`);
|