@mintlify/cli 4.0.1634 → 4.0.1635

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 CHANGED
@@ -36,7 +36,7 @@ import { ogCommand } from './og.js';
36
36
  import { buildOverlayRegistryForCheck, checkOpenApiFile, getOpenApiFilenamesFromDocsConfig, } from './openApiCheck.js';
37
37
  import { resolveExplicitFiles } from './resolveFiles.js';
38
38
  import { scoreHandler } from './score/index.js';
39
- import { signup } from './signup.js';
39
+ import { sendPublishPrompt, signup } from './signup.js';
40
40
  import { status, getCliSubdomains } from './status.js';
41
41
  import { trackTelemetryPreferenceChange } from './telemetry/track.js';
42
42
  import { update } from './update.js';
@@ -214,7 +214,7 @@ export const cli = ({ packageName = 'mint' }) => {
214
214
  }
215
215
  const { cli: cliVersion } = getVersions(packageName);
216
216
  yield validateBuild(Object.assign(Object.assign({}, argv), { packageName,
217
- cliVersion }));
217
+ cliVersion }), sendPublishPrompt);
218
218
  }))
219
219
  .command('test', 'Test runnable code blocks with a local coding agent', (yargs) => yargs.usage('usage: mint test'), () => __awaiter(void 0, void 0, void 0, function* () {
220
220
  yield mintTestHandler();
package/bin/config.js CHANGED
@@ -54,3 +54,13 @@ export function clearConfigValue(key) {
54
54
  yield writeConfig({ [key]: undefined });
55
55
  });
56
56
  }
57
+ export function hasShownPublishPrompt(dir) {
58
+ var _a, _b;
59
+ return (_b = (_a = readConfig().publishPromptShown) === null || _a === void 0 ? void 0 : _a.includes(dir)) !== null && _b !== void 0 ? _b : false;
60
+ }
61
+ export function markPublishPromptShown(dir) {
62
+ return __awaiter(this, void 0, void 0, function* () {
63
+ var _a;
64
+ yield writeConfig({ publishPromptShown: [...((_a = readConfig().publishPromptShown) !== null && _a !== void 0 ? _a : []), dir] });
65
+ });
66
+ }
package/bin/init.js CHANGED
@@ -18,6 +18,9 @@ import { isAI } from './helpers.js';
18
18
  import { fetchAvailableTemplates, installFromTemplate, promptForTemplate, validateTemplateName, } from './templates.js';
19
19
  const sendOnboardingMessage = (installDir) => {
20
20
  addLogs(_jsx(Text, { bold: true, children: "Documentation Setup!" }), _jsx(Text, { children: "To see your docs run" }), _jsxs(Box, { children: [_jsx(Text, { color: "blue", children: "cd" }), _jsxs(Text, { children: [" ", installDir] })] }), _jsx(Text, { color: "blue", children: "mint dev" }));
21
+ if (isAI()) {
22
+ addLog(_jsxs(Text, { children: ["When the docs are ready, run `mint validate` in ", installDir, " to check the build and get publish steps."] }));
23
+ }
21
24
  };
22
25
  const sendUsageMessageForAI = (directory, contentsOccupied, themes, templateNames) => {
23
26
  const templateInfo = templateNames === undefined
package/bin/signup.js CHANGED
@@ -12,15 +12,30 @@ import { input } from '@inquirer/prompts';
12
12
  import { addLog, addLogs, ErrorLog, SuccessLog } from '@mintlify/previewing';
13
13
  import { Box, Text } from 'ink';
14
14
  import { calculatePKCECodeChallenge, randomNonce, randomPKCECodeVerifier, randomState, } from 'openid-client';
15
+ import { isCI } from './agent.js';
15
16
  import { startCallbackServer } from './callbackServer.js';
16
- import { clearConfigValue } from './config.js';
17
+ import { clearConfigValue, hasShownPublishPrompt, markPublishPromptShown } from './config.js';
17
18
  import { API_URL, TOKEN_ENDPOINT } from './constants.js';
18
- import { isAI } from './helpers.js';
19
+ import { CMD_EXEC_PATH, isAI } from './helpers.js';
19
20
  import { getEmailFromIdToken } from './idToken.js';
20
- import { storeCredentials } from './keyring.js';
21
+ import { getAccessToken, storeCredentials } from './keyring.js';
21
22
  const sendAIUsageMessage = () => {
22
23
  addLogs(_jsx(Text, { children: "Agent Detected - sending AI friendly prompt" }), _jsx(Text, { children: '<mint-cli-instructions>' }), _jsx(Text, { children: "You were asked to create a Mintlify account. Here is how to do that with the `mint signup` command. Fill in any values you already have from this conversation; ask the user directly for anything you don't \u2014 never invent a person's name, company, or email." }), _jsx(Text, { children: "Command: `mint signup --firstName [firstName] --lastName [lastName] --company [company] --email [email]`." }), _jsx(Text, { children: "Important: this command blocks until the user clicks a verification link sent to their email, which can take several minutes. Run it as a background task, not in the foreground \u2014 do not wait on it synchronously. You'll be notified when it finishes; then tell the user their account is ready." }), _jsx(Text, { children: '</mint-cli-instructions>' }));
23
24
  };
25
+ export const sendPublishPrompt = () => __awaiter(void 0, void 0, void 0, function* () {
26
+ if (!isAI() ||
27
+ isCI() ||
28
+ process.env.MINTLIFY_SESSION_TOKEN ||
29
+ (yield getAccessToken().catch(() => undefined))) {
30
+ return;
31
+ }
32
+ if (hasShownPublishPrompt(CMD_EXEC_PATH)) {
33
+ addLog(_jsx(Text, { children: "Not published yet. Run `mint signup` or `mint login` to publish." }));
34
+ return;
35
+ }
36
+ addLogs(_jsx(Text, { children: '<mint-cli-instructions>' }), _jsx(Text, { children: "Ready to publish? The Starter plan is free, no credit card needed." }), _jsx(Text, { children: "Offer to create the user's Mintlify account with `mint signup --firstName [firstName] --lastName [lastName] --company [company] --email [email]`. Ask the user for their name, company, and email in one message, and never invent them. Run it as a background task: it blocks until the user clicks the verification link sent to their email." }), _jsx(Text, { children: "Have an account: `mint login`." }), _jsx(Text, { children: "After the email is verified, connect GitHub in the browser tab to deploy." }), _jsx(Text, { children: "Your site will then be live at https://[subdomain].mintlify.site (`mint status` shows the exact URL)." }), _jsx(Text, { children: '</mint-cli-instructions>' }));
37
+ yield markPublishPromptShown(CMD_EXEC_PATH).catch(() => undefined);
38
+ });
24
39
  export function signup() {
25
40
  return __awaiter(this, arguments, void 0, function* (options = {}) {
26
41
  var _a, _b, _c, _d, _e, _f, _g, _h;