@mintlify/cli 4.0.1110 → 4.0.1111

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.1110",
3
+ "version": "4.0.1111",
4
4
  "description": "The Mintlify CLI",
5
5
  "engines": {
6
6
  "node": ">=18.0.0"
@@ -93,5 +93,5 @@
93
93
  "vitest": "2.1.9",
94
94
  "vitest-mock-process": "1.0.4"
95
95
  },
96
- "gitHead": "f976151a777e02bf8190efa6389757169e8b4ef1"
96
+ "gitHead": "38703fc288945eaeaea97ea561f5ff35b15fd6e4"
97
97
  }
@@ -3,15 +3,39 @@ import { getVersions } from '../helpers.js';
3
3
  import { trackCommand } from '../telemetry/track.js';
4
4
 
5
5
  const SCRAPE_SUBCOMMANDS = new Set(['page', 'site', 'openapi']);
6
+ const ANALYTICS_SUBCOMMANDS = new Set(['stats', 'search', 'feedback', 'conversation']);
7
+ const CONFIG_SUBCOMMANDS = new Set(['set', 'get', 'clear']);
8
+ const CONVERSATION_SUBCOMMANDS = new Set(['list', 'view', 'buckets']);
9
+ const BUCKETS_SUBCOMMANDS = new Set(['list', 'view']);
6
10
 
7
11
  export function getSanitizedCommandForTelemetry(_: (string | number)[]): string {
8
12
  const parts = _.filter((p): p is string => typeof p === 'string');
9
13
  if (parts.length === 0) return '';
10
14
  const first = parts[0]!;
11
15
  const second = parts[1];
16
+ const third = parts[2];
17
+
12
18
  if (first === 'scrape' && second !== undefined && SCRAPE_SUBCOMMANDS.has(second)) {
13
19
  return `scrape ${second}`;
14
20
  }
21
+
22
+ if (first === 'config' && second !== undefined && CONFIG_SUBCOMMANDS.has(second)) {
23
+ return `config ${second}`;
24
+ }
25
+
26
+ if (first === 'analytics' && second !== undefined && ANALYTICS_SUBCOMMANDS.has(second)) {
27
+ if (second === 'conversation' && third !== undefined) {
28
+ if (CONVERSATION_SUBCOMMANDS.has(third)) {
29
+ const fourth = parts[3];
30
+ if (third === 'buckets' && fourth !== undefined && BUCKETS_SUBCOMMANDS.has(fourth)) {
31
+ return `analytics conversation buckets ${fourth}`;
32
+ }
33
+ return `analytics conversation ${third}`;
34
+ }
35
+ }
36
+ return `analytics ${second}`;
37
+ }
38
+
15
39
  return first;
16
40
  }
17
41
 
@@ -3,6 +3,7 @@ import chalk from 'chalk';
3
3
  import { Text } from 'ink';
4
4
 
5
5
  import { terminate } from '../helpers.js';
6
+ import { trackEvent } from '../telemetry/track.js';
6
7
  import { getScore } from './client.js';
7
8
  import type { Check } from './types.js';
8
9
 
@@ -61,6 +62,11 @@ export const scoreHandler = async (argv: { url: string; format?: string }) => {
61
62
  try {
62
63
  if (format === 'table') addLog(<SpinnerLog message="Running agent readiness checks..." />);
63
64
  const data = await getScore(argv.url);
65
+ void trackEvent('cli.score.executed', {
66
+ url: argv.url,
67
+ score: data.overallScore,
68
+ format,
69
+ });
64
70
  if (format === 'table') removeLastLog();
65
71
 
66
72
  if (format === 'json') {
@@ -77,6 +77,25 @@ export async function trackLoginFailed(reason: string): Promise<void> {
77
77
  return trackLoginEvent('cli.login.failed', { reason });
78
78
  }
79
79
 
80
+ export async function trackEvent(
81
+ event: string,
82
+ properties?: Record<string, unknown>
83
+ ): Promise<void> {
84
+ if (!isTelemetryEnabled()) return;
85
+
86
+ try {
87
+ const { cli: cliVersion } = getVersions();
88
+ await captureWithTimeout(event, {
89
+ ...properties,
90
+ cli_version: cliVersion,
91
+ os: os.platform(),
92
+ arch: os.arch(),
93
+ node_version: process.version,
94
+ is_ai_agent: isAI(),
95
+ });
96
+ } catch {}
97
+ }
98
+
80
99
  export async function trackTelemetryPreferenceChange(options: { enabled: boolean }): Promise<void> {
81
100
  if (process.env.CLI_TEST_MODE === 'true') return;
82
101