@mintlify/cli 4.0.1792 → 4.0.1794

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.1792",
3
+ "version": "4.0.1794",
4
4
  "description": "The Mintlify CLI",
5
5
  "engines": {
6
6
  "node": ">=18.0.0"
@@ -45,13 +45,13 @@
45
45
  },
46
46
  "dependencies": {
47
47
  "@inquirer/prompts": "7.9.0",
48
- "@mintlify/common": "1.0.1337",
49
- "@mintlify/link-rot": "3.0.1577",
48
+ "@mintlify/common": "1.0.1338",
49
+ "@mintlify/link-rot": "3.0.1578",
50
50
  "@mintlify/models": "0.0.385",
51
- "@mintlify/og": "0.0.136",
52
- "@mintlify/prebuild": "1.0.1510",
53
- "@mintlify/previewing": "4.0.1595",
54
- "@mintlify/validation": "0.1.957",
51
+ "@mintlify/og": "0.0.137",
52
+ "@mintlify/prebuild": "1.0.1511",
53
+ "@mintlify/previewing": "4.0.1596",
54
+ "@mintlify/validation": "0.1.958",
55
55
  "adm-zip": "0.6.0",
56
56
  "chalk": "5.2.0",
57
57
  "color": "4.2.3",
@@ -87,7 +87,7 @@
87
87
  "keytar": "7.9.0"
88
88
  },
89
89
  "devDependencies": {
90
- "@mintlify/editor": "0.0.614",
90
+ "@mintlify/editor": "0.0.615",
91
91
  "@mintlify/ts-config": "2.0.2",
92
92
  "@tsconfig/recommended": "1.0.2",
93
93
  "@types/detect-port": "1.3.2",
@@ -106,5 +106,5 @@
106
106
  "vitest": "2.1.9",
107
107
  "vitest-mock-process": "1.0.4"
108
108
  },
109
- "gitHead": "7a2db4b1b95b33d9aee9631696c6635427f7e440"
109
+ "gitHead": "bfddb32ecc50b5b165004784b730ee2e7c12b78b"
110
110
  }
package/src/cli.tsx CHANGED
@@ -26,6 +26,7 @@ import { deployFromGithubActions, isGithubActions } from './deploy-github-action
26
26
  import { formatGithubSetup, setupGithubDeployment } from './deploy-github-setup.js';
27
27
  import { DEPLOY_HELP, deploymentInstructions } from './deploy-instructions.js';
28
28
  import { formatDeployment, prepareAgentDeployment } from './deploy.js';
29
+ import { FEEDBACK_CATEGORIES, feedback } from './feedback.js';
29
30
  import { formatHandler } from './format.js';
30
31
  import {
31
32
  checkPort,
@@ -707,6 +708,42 @@ export const cli = ({ packageName = 'mint' }: { packageName?: string }) => {
707
708
  await terminate(0);
708
709
  }
709
710
  )
711
+ .command(
712
+ 'feedback <message>',
713
+ 'Send feedback to the Mintlify team',
714
+ (yargs: Argv) =>
715
+ yargs
716
+ .positional('message', {
717
+ type: 'string',
718
+ demandOption: true,
719
+ description: 'Feedback to send. Leave out API keys, tokens, and other secrets',
720
+ })
721
+ .option('client-id', {
722
+ type: 'string',
723
+ demandOption: true,
724
+ description: 'ID for this report, so the team can tell retries apart',
725
+ })
726
+ .option('category', {
727
+ choices: FEEDBACK_CATEGORIES,
728
+ demandOption: true,
729
+ description: 'Feedback category',
730
+ })
731
+ .example(
732
+ '$0 feedback "mint dev crashes on a missing image" --client-id 7f3a --category bug',
733
+ 'Report a bug'
734
+ )
735
+ .epilog(
736
+ 'Requires mint login. Never include API keys, tokens, passwords, or other secrets in the message.'
737
+ ),
738
+ async (argv) => {
739
+ const sent = await feedback({
740
+ message: argv.message,
741
+ clientId: argv.clientId,
742
+ category: argv.category,
743
+ });
744
+ await terminate(sent ? 0 : 1);
745
+ }
746
+ )
710
747
  .command('config', 'Manage CLI configuration', (yargs) =>
711
748
  yargs
712
749
  .command(
@@ -0,0 +1,36 @@
1
+ import { addLog, ErrorLog, SuccessLog } from '@mintlify/previewing';
2
+
3
+ import { authenticatedFetch } from './authenticatedFetch.js';
4
+ import { API_URL } from './constants.js';
5
+
6
+ export const FEEDBACK_CATEGORIES = ['bug', 'docs', 'idea'] as const;
7
+
8
+ export type FeedbackInput = {
9
+ message: string;
10
+ clientId: string;
11
+ category: (typeof FEEDBACK_CATEGORIES)[number];
12
+ };
13
+
14
+ const LOGIN_REQUIRED = 'not logged in. Run `mint login` first, then retry.';
15
+
16
+ export async function sendFeedback(input: FeedbackInput): Promise<string | undefined> {
17
+ let res: Response;
18
+ try {
19
+ res = await authenticatedFetch(`${API_URL}/api/cli/feedback`, {
20
+ method: 'POST',
21
+ headers: { 'Content-Type': 'application/json' },
22
+ body: JSON.stringify({ ...input, source: 'cli' }),
23
+ });
24
+ } catch (error) {
25
+ const notLoggedIn = error instanceof Error && /not authenticated/i.test(error.message);
26
+ return notLoggedIn ? LOGIN_REQUIRED : 'could not reach the server';
27
+ }
28
+ if (res.status === 401) return LOGIN_REQUIRED;
29
+ return res.ok ? undefined : `could not send feedback (HTTP ${res.status})`;
30
+ }
31
+
32
+ export async function feedback(input: FeedbackInput): Promise<boolean> {
33
+ const error = await sendFeedback(input);
34
+ addLog(error ? <ErrorLog message={error} /> : <SuccessLog message="feedback sent" />);
35
+ return !error;
36
+ }