@mintlify/cli 4.0.1196 → 4.0.1198
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/bin/cli.js +33 -1
- package/bin/logo.js +28 -0
- package/bin/tsconfig.build.tsbuildinfo +1 -1
- package/bin/welcome.js +107 -0
- package/package.json +9 -8
- package/scripts/generate-logo.mjs +79 -0
- package/src/cli.tsx +36 -0
- package/src/logo.ts +31 -0
- package/src/welcome.ts +155 -0
package/bin/cli.js
CHANGED
|
@@ -21,7 +21,7 @@ import { comingSoon } from './comingSoon.js';
|
|
|
21
21
|
import { setTelemetryEnabled } from './config.js';
|
|
22
22
|
import { getConfigValue, setConfigValue, clearConfigValue } from './config.js';
|
|
23
23
|
import { API_URL } from './constants.js';
|
|
24
|
-
import { CMD_EXEC_PATH, checkPort, checkNodeVersion, autoUpgradeIfNeeded, getVersions, suppressConsoleWarnings, terminate, } from './helpers.js';
|
|
24
|
+
import { CMD_EXEC_PATH, checkPort, checkNodeVersion, autoUpgradeIfNeeded, getVersions, isAI, suppressConsoleWarnings, terminate, } from './helpers.js';
|
|
25
25
|
import { init } from './init.js';
|
|
26
26
|
import { getAccessToken } from './keyring.js';
|
|
27
27
|
import { login } from './login.js';
|
|
@@ -33,8 +33,40 @@ import { scoreHandler } from './score/index.js';
|
|
|
33
33
|
import { status, getCliSubdomains } from './status.js';
|
|
34
34
|
import { trackTelemetryPreferenceChange } from './telemetry/track.js';
|
|
35
35
|
import { update } from './update.js';
|
|
36
|
+
import { renderWelcome } from './welcome.js';
|
|
36
37
|
import { workflowsBuilder } from './workflows/index.js';
|
|
38
|
+
// The branded welcome screen replaces yargs' default help, but only for an
|
|
39
|
+
// interactive human at a TTY. Piped, scripted, AI, and test callers keep the
|
|
40
|
+
// plain yargs help so their output stays parseable and stable.
|
|
41
|
+
const shouldShowWelcome = (args) => {
|
|
42
|
+
const interactive = Boolean(process.stdout.isTTY) && !isAI() && process.env.CLI_TEST_MODE !== 'true';
|
|
43
|
+
if (!interactive)
|
|
44
|
+
return false;
|
|
45
|
+
if (args.length === 0)
|
|
46
|
+
return true;
|
|
47
|
+
const positionals = args.filter((arg) => !arg.startsWith('-'));
|
|
48
|
+
const command = positionals[0];
|
|
49
|
+
// `help` followed by a subcommand (e.g. `mint help dev`) is a subcommand
|
|
50
|
+
// lookup — let yargs handle it rather than intercepting with the welcome screen.
|
|
51
|
+
const isTopLevel = command === undefined || (command === 'help' && positionals.length === 1);
|
|
52
|
+
const helpRequested = command === 'help' || args.includes('--help') || args.includes('-h');
|
|
53
|
+
return isTopLevel && helpRequested;
|
|
54
|
+
};
|
|
55
|
+
const showWelcome = (packageName) => __awaiter(void 0, void 0, void 0, function* () {
|
|
56
|
+
const { cli: version } = getVersions(packageName);
|
|
57
|
+
const subdomain = getConfigValue('subdomain');
|
|
58
|
+
let signedIn = false;
|
|
59
|
+
try {
|
|
60
|
+
signedIn = Boolean(yield getAccessToken());
|
|
61
|
+
}
|
|
62
|
+
catch (_a) { }
|
|
63
|
+
process.stdout.write(renderWelcome({ packageName, version, signedIn, subdomain }));
|
|
64
|
+
yield terminate(0);
|
|
65
|
+
});
|
|
37
66
|
export const cli = ({ packageName = 'mint' }) => {
|
|
67
|
+
if (shouldShowWelcome(hideBin(process.argv))) {
|
|
68
|
+
return showWelcome(packageName);
|
|
69
|
+
}
|
|
38
70
|
const telemetryMiddleware = createTelemetryMiddleware();
|
|
39
71
|
render(_jsx(Logs, {}));
|
|
40
72
|
return (yargs(hideBin(process.argv))
|
package/bin/logo.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// AUTO-GENERATED by `scripts/generate-logo.mjs` from the Mintlify icon mark.
|
|
2
|
+
// Do not edit by hand — run `node scripts/generate-logo.mjs` to regenerate.
|
|
3
|
+
/** Mintlify brand greens. */
|
|
4
|
+
export const MINT_GREEN = '#18E299';
|
|
5
|
+
export const MINT_GREEN_DEEP = '#0C8C5E';
|
|
6
|
+
/**
|
|
7
|
+
* The Mintlify leaf, rendered as a solid `#` mark (chafa shape detection,
|
|
8
|
+
* normalized to a single glyph). Drawn in {@link MINT_GREEN} on the welcome
|
|
9
|
+
* screen.
|
|
10
|
+
*/
|
|
11
|
+
export const MINT_LOGO = [
|
|
12
|
+
' ##############',
|
|
13
|
+
' #################',
|
|
14
|
+
' ###################',
|
|
15
|
+
' #####################',
|
|
16
|
+
' #### ##############',
|
|
17
|
+
' ##### ###########',
|
|
18
|
+
' ####### #########',
|
|
19
|
+
'######## ########',
|
|
20
|
+
'######## ######',
|
|
21
|
+
'######## ####',
|
|
22
|
+
'###### ##############',
|
|
23
|
+
' ### ##############',
|
|
24
|
+
' ##############',
|
|
25
|
+
' ##########',
|
|
26
|
+
];
|
|
27
|
+
/** Width of the widest logo row, for laying out content beside it. */
|
|
28
|
+
export const MINT_LOGO_WIDTH = MINT_LOGO.reduce((max, line) => Math.max(max, line.length), 0);
|