@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mintlify/cli",
3
- "version": "4.0.1634",
3
+ "version": "4.0.1635",
4
4
  "description": "The Mintlify CLI",
5
5
  "engines": {
6
6
  "node": ">=18.0.0"
@@ -46,11 +46,11 @@
46
46
  "dependencies": {
47
47
  "@inquirer/prompts": "7.9.0",
48
48
  "@mintlify/common": "1.0.1238",
49
- "@mintlify/link-rot": "3.0.1453",
49
+ "@mintlify/link-rot": "3.0.1454",
50
50
  "@mintlify/models": "0.0.372",
51
51
  "@mintlify/og": "0.0.36",
52
52
  "@mintlify/prebuild": "1.0.1400",
53
- "@mintlify/previewing": "4.0.1474",
53
+ "@mintlify/previewing": "4.0.1475",
54
54
  "@mintlify/validation": "0.1.910",
55
55
  "adm-zip": "0.6.0",
56
56
  "chalk": "5.2.0",
@@ -105,5 +105,5 @@
105
105
  "vitest": "2.1.9",
106
106
  "vitest-mock-process": "1.0.4"
107
107
  },
108
- "gitHead": "f9509a110d307e51d75111b5bf5c0a5644ed22f2"
108
+ "gitHead": "f5423bcdc7906b51202bdbc5fd729c2a647f79ff"
109
109
  }
package/src/cli.tsx CHANGED
@@ -53,7 +53,7 @@ import {
53
53
  } from './openApiCheck.js';
54
54
  import { resolveExplicitFiles } from './resolveFiles.js';
55
55
  import { scoreHandler } from './score/index.js';
56
- import { signup } from './signup.js';
56
+ import { sendPublishPrompt, signup } from './signup.js';
57
57
  import { status, getCliSubdomains } from './status.js';
58
58
  import { trackTelemetryPreferenceChange } from './telemetry/track.js';
59
59
  import { update } from './update.js';
@@ -257,11 +257,14 @@ export const cli = ({ packageName = 'mint' }: { packageName?: string }) => {
257
257
  }
258
258
 
259
259
  const { cli: cliVersion } = getVersions(packageName);
260
- await validateBuild({
261
- ...argv,
262
- packageName,
263
- cliVersion,
264
- });
260
+ await validateBuild(
261
+ {
262
+ ...argv,
263
+ packageName,
264
+ cliVersion,
265
+ },
266
+ sendPublishPrompt
267
+ );
265
268
  }
266
269
  )
267
270
  .command(
package/src/config.ts CHANGED
@@ -8,6 +8,7 @@ interface MintlifyConfig {
8
8
  subdomain?: string;
9
9
  dateFrom?: string;
10
10
  dateTo?: string;
11
+ publishPromptShown?: string[];
11
12
  }
12
13
 
13
14
  function readConfig(): MintlifyConfig {
@@ -48,3 +49,11 @@ export async function setConfigValue(key: string, value: string): Promise<void>
48
49
  export async function clearConfigValue(key: string): Promise<void> {
49
50
  await writeConfig({ [key]: undefined });
50
51
  }
52
+
53
+ export function hasShownPublishPrompt(dir: string): boolean {
54
+ return readConfig().publishPromptShown?.includes(dir) ?? false;
55
+ }
56
+
57
+ export async function markPublishPromptShown(dir: string): Promise<void> {
58
+ await writeConfig({ publishPromptShown: [...(readConfig().publishPromptShown ?? []), dir] });
59
+ }
package/src/init.tsx CHANGED
@@ -23,6 +23,14 @@ const sendOnboardingMessage = (installDir: string) => {
23
23
  </Box>,
24
24
  <Text color="blue">mint dev</Text>
25
25
  );
26
+ if (isAI()) {
27
+ addLog(
28
+ <Text>
29
+ When the docs are ready, run `mint validate` in {installDir} to check the build and get
30
+ publish steps.
31
+ </Text>
32
+ );
33
+ }
26
34
  };
27
35
 
28
36
  const sendUsageMessageForAI = (
package/src/signup.tsx CHANGED
@@ -8,12 +8,13 @@ import {
8
8
  randomState,
9
9
  } from 'openid-client';
10
10
 
11
+ import { isCI } from './agent.js';
11
12
  import { startCallbackServer } from './callbackServer.js';
12
- import { clearConfigValue } from './config.js';
13
+ import { clearConfigValue, hasShownPublishPrompt, markPublishPromptShown } from './config.js';
13
14
  import { API_URL, TOKEN_ENDPOINT } from './constants.js';
14
- import { isAI } from './helpers.js';
15
+ import { CMD_EXEC_PATH, isAI } from './helpers.js';
15
16
  import { getEmailFromIdToken } from './idToken.js';
16
- import { storeCredentials } from './keyring.js';
17
+ import { getAccessToken, storeCredentials } from './keyring.js';
17
18
  import type { TokenResponse } from './login.js';
18
19
 
19
20
  export interface SignupOptions {
@@ -46,6 +47,39 @@ const sendAIUsageMessage = () => {
46
47
  );
47
48
  };
48
49
 
50
+ export const sendPublishPrompt = async () => {
51
+ if (
52
+ !isAI() ||
53
+ isCI() ||
54
+ process.env.MINTLIFY_SESSION_TOKEN ||
55
+ (await getAccessToken().catch(() => undefined))
56
+ ) {
57
+ return;
58
+ }
59
+ if (hasShownPublishPrompt(CMD_EXEC_PATH)) {
60
+ addLog(<Text>Not published yet. Run `mint signup` or `mint login` to publish.</Text>);
61
+ return;
62
+ }
63
+ addLogs(
64
+ <Text>{'<mint-cli-instructions>'}</Text>,
65
+ <Text>Ready to publish? The Starter plan is free, no credit card needed.</Text>,
66
+ <Text>
67
+ Offer to create the user's Mintlify account with `mint signup --firstName [firstName]
68
+ --lastName [lastName] --company [company] --email [email]`. Ask the user for their name,
69
+ company, and email in one message, and never invent them. Run it as a background task: it
70
+ blocks until the user clicks the verification link sent to their email.
71
+ </Text>,
72
+ <Text>Have an account: `mint login`.</Text>,
73
+ <Text>After the email is verified, connect GitHub in the browser tab to deploy.</Text>,
74
+ <Text>
75
+ Your site will then be live at https://[subdomain].mintlify.site (`mint status` shows the
76
+ exact URL).
77
+ </Text>,
78
+ <Text>{'</mint-cli-instructions>'}</Text>
79
+ );
80
+ await markPublishPromptShown(CMD_EXEC_PATH).catch(() => undefined);
81
+ };
82
+
49
83
  export async function signup(options: SignupOptions = {}): Promise<void> {
50
84
  if (isAI() && (!options.firstName || !options.lastName || !options.company || !options.email)) {
51
85
  sendAIUsageMessage();