@mintlify/cli 4.0.1229 → 4.0.1230
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/__test__/telemetry.test.ts +0 -27
- package/bin/cli.js +0 -2
- package/bin/middlewares/telemetryMiddleware.js +0 -16
- package/bin/tsconfig.build.tsbuildinfo +1 -1
- package/bin/welcome.js +1 -4
- package/package.json +2 -2
- package/src/cli.tsx +0 -2
- package/src/middlewares/telemetryMiddleware.ts +0 -17
- package/src/welcome.ts +1 -4
- package/__test__/analytics/client.test.ts +0 -166
- package/__test__/analytics/format.test.ts +0 -137
- package/bin/analytics/client.js +0 -55
- package/bin/analytics/format.js +0 -13
- package/bin/analytics/index.js +0 -509
- package/bin/analytics/output.js +0 -75
- package/bin/analytics/types.js +0 -1
- package/src/analytics/client.ts +0 -146
- package/src/analytics/format.ts +0 -13
- package/src/analytics/index.tsx +0 -605
- package/src/analytics/output.ts +0 -99
- package/src/analytics/types.ts +0 -132
package/src/analytics/output.ts
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
|
-
|
|
3
|
-
import { isAI } from '../helpers.js';
|
|
4
|
-
|
|
5
|
-
export type OutputFormat = 'table' | 'plain' | 'json' | 'graph';
|
|
6
|
-
|
|
7
|
-
export function resolveFormat(argv: { format?: string }): OutputFormat {
|
|
8
|
-
if (
|
|
9
|
-
argv.format === 'table' ||
|
|
10
|
-
argv.format === 'plain' ||
|
|
11
|
-
argv.format === 'json' ||
|
|
12
|
-
argv.format === 'graph'
|
|
13
|
-
)
|
|
14
|
-
return argv.format;
|
|
15
|
-
if (isAI()) return 'json';
|
|
16
|
-
return 'plain';
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export function formatPlainTable(headers: string[], rows: string[][]): string {
|
|
20
|
-
if (rows.length === 0) return '';
|
|
21
|
-
|
|
22
|
-
const colWidths = headers.map((h, i) =>
|
|
23
|
-
Math.max(h.length, ...rows.map((r) => (r[i] ?? '').length))
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
const headerLine = headers.map((h, i) => h.toUpperCase().padEnd(colWidths[i]!)).join('\t');
|
|
27
|
-
const bodyLines = rows.map((row) => row.map((cell, i) => cell.padEnd(colWidths[i]!)).join('\t'));
|
|
28
|
-
|
|
29
|
-
return [headerLine, ...bodyLines].join('\n');
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export function formatPrettyTable(headers: string[], rows: string[][]): string {
|
|
33
|
-
if (rows.length === 0) return chalk.dim(' No data found.');
|
|
34
|
-
|
|
35
|
-
const colWidths = headers.map((h, i) =>
|
|
36
|
-
Math.max(h.length, ...rows.map((r) => (r[i] ?? '').length))
|
|
37
|
-
);
|
|
38
|
-
|
|
39
|
-
const headerLine = headers.map((h, i) => chalk.bold(h.padEnd(colWidths[i]!))).join(' ');
|
|
40
|
-
const separator = chalk.dim(colWidths.map((w) => '\u2500'.repeat(w)).join('\u2500\u2500'));
|
|
41
|
-
const bodyLines = rows.map((row) => row.map((cell, i) => cell.padEnd(colWidths[i]!)).join(' '));
|
|
42
|
-
|
|
43
|
-
return [headerLine, separator, ...bodyLines].join('\n');
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function gradientBar(len: number, rgb: [number, number, number]): string {
|
|
47
|
-
let result = '';
|
|
48
|
-
for (let i = 0; i < len; i++) {
|
|
49
|
-
const t = len === 1 ? 1 : i / (len - 1);
|
|
50
|
-
const dim = 0.3 + t * 0.7;
|
|
51
|
-
const r = Math.round(rgb[0] * dim);
|
|
52
|
-
const g = Math.round(rgb[1] * dim);
|
|
53
|
-
const b = Math.round(rgb[2] * dim);
|
|
54
|
-
result += chalk.rgb(r, g, b)('\u2588');
|
|
55
|
-
}
|
|
56
|
-
return result;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const COLOR_MAP: Record<string, [number, number, number]> = {
|
|
60
|
-
cyan: [0, 255, 255],
|
|
61
|
-
magenta: [255, 0, 255],
|
|
62
|
-
yellow: [255, 255, 0],
|
|
63
|
-
green: [0, 255, 100],
|
|
64
|
-
blue: [80, 140, 255],
|
|
65
|
-
red: [255, 80, 80],
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
export function formatBarChart(
|
|
69
|
-
items: { label: string; value: number; color?: string }[],
|
|
70
|
-
opts: { maxWidth?: number } = {}
|
|
71
|
-
): string {
|
|
72
|
-
if (items.length === 0) return chalk.dim(' No data found.');
|
|
73
|
-
|
|
74
|
-
const maxWidth = opts.maxWidth ?? 40;
|
|
75
|
-
const maxVal = Math.max(...items.map((i) => i.value), 1);
|
|
76
|
-
const maxLabel = Math.max(...items.map((i) => i.label.length));
|
|
77
|
-
const maxValStr = Math.max(...items.map((i) => i.value.toLocaleString('en-US').length));
|
|
78
|
-
|
|
79
|
-
return items
|
|
80
|
-
.map((item) => {
|
|
81
|
-
const barLen = Math.round((item.value / maxVal) * maxWidth);
|
|
82
|
-
const rgb = COLOR_MAP[item.color ?? 'cyan'] ?? COLOR_MAP.cyan!;
|
|
83
|
-
const bar = barLen > 0 ? gradientBar(barLen, rgb) : '';
|
|
84
|
-
const pad = ' '.repeat(maxWidth - barLen);
|
|
85
|
-
return ` ${item.label.padEnd(maxLabel)} ${bar}${pad} ${item.value.toLocaleString('en-US').padStart(maxValStr)}`;
|
|
86
|
-
})
|
|
87
|
-
.join('\n');
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export function formatOutput(
|
|
91
|
-
format: OutputFormat,
|
|
92
|
-
headers: string[],
|
|
93
|
-
rows: string[][],
|
|
94
|
-
jsonData: unknown
|
|
95
|
-
): string {
|
|
96
|
-
if (format === 'json') return JSON.stringify(jsonData, null, 2);
|
|
97
|
-
if (format === 'plain') return formatPlainTable(headers, rows);
|
|
98
|
-
return formatPrettyTable(headers, rows);
|
|
99
|
-
}
|
package/src/analytics/types.ts
DELETED
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
export interface KpiResponse {
|
|
2
|
-
humanVisitors: number;
|
|
3
|
-
humanViews: number;
|
|
4
|
-
humanAssistant: number;
|
|
5
|
-
humanSearches: number;
|
|
6
|
-
humanFeedback: number;
|
|
7
|
-
agentVisitors: number;
|
|
8
|
-
agentViews: number;
|
|
9
|
-
agentMcpSearches: number;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export interface BucketSummary {
|
|
13
|
-
id: string;
|
|
14
|
-
questionSummary: string;
|
|
15
|
-
size: number;
|
|
16
|
-
status: string;
|
|
17
|
-
lastAsked: string | null;
|
|
18
|
-
lastOccurredAt: string | null;
|
|
19
|
-
createdAt: string;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export interface BucketsResponse {
|
|
23
|
-
data: BucketSummary[];
|
|
24
|
-
pagination: { total: number };
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export interface BucketThread {
|
|
28
|
-
id: string;
|
|
29
|
-
firstUserMessage: string | null;
|
|
30
|
-
feedback: { up: number; down: number };
|
|
31
|
-
resolutionStatus: string | null;
|
|
32
|
-
length: number;
|
|
33
|
-
createdAt: string;
|
|
34
|
-
lastMessageAt: string | null;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export interface BucketThreadsResponse {
|
|
38
|
-
data: BucketThread[];
|
|
39
|
-
pagination: { total: number; hasMore: boolean; nextCursor: string | null };
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export interface FeedbackItem {
|
|
43
|
-
id: string;
|
|
44
|
-
path: string;
|
|
45
|
-
comment: string | null;
|
|
46
|
-
createdAt: string | null;
|
|
47
|
-
source: string;
|
|
48
|
-
status: string;
|
|
49
|
-
helpful?: boolean;
|
|
50
|
-
contact?: string;
|
|
51
|
-
code?: string;
|
|
52
|
-
filename?: string;
|
|
53
|
-
lang?: string;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export interface FeedbackResponse {
|
|
57
|
-
feedback: FeedbackItem[];
|
|
58
|
-
nextCursor: string | null;
|
|
59
|
-
hasMore: boolean;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export interface FeedbackByPageItem {
|
|
63
|
-
path: string;
|
|
64
|
-
thumbsUp: number;
|
|
65
|
-
thumbsDown: number;
|
|
66
|
-
code: number;
|
|
67
|
-
total: number;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export interface FeedbackByPageResponse {
|
|
71
|
-
feedback: FeedbackByPageItem[];
|
|
72
|
-
hasMore: boolean;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export interface ConversationSource {
|
|
76
|
-
title: string;
|
|
77
|
-
url: string;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export interface Conversation {
|
|
81
|
-
id: string;
|
|
82
|
-
timestamp: string;
|
|
83
|
-
query: string;
|
|
84
|
-
response: string;
|
|
85
|
-
sources: ConversationSource[];
|
|
86
|
-
queryCategory: string | null;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
export interface ConversationResponse {
|
|
90
|
-
conversations: Conversation[];
|
|
91
|
-
nextCursor: string | null;
|
|
92
|
-
hasMore: boolean;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
export interface SearchRow {
|
|
96
|
-
searchQuery: string;
|
|
97
|
-
hits: number;
|
|
98
|
-
ctr: number;
|
|
99
|
-
topClickedPage: string | null;
|
|
100
|
-
lastSearchedAt: string;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
export interface SearchResponse {
|
|
104
|
-
searches: SearchRow[];
|
|
105
|
-
totalSearches: number;
|
|
106
|
-
nextCursor: string | null;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
export interface TrafficTotals {
|
|
110
|
-
human: number;
|
|
111
|
-
ai: number;
|
|
112
|
-
total: number;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
export interface TrafficRow {
|
|
116
|
-
path: string;
|
|
117
|
-
human: number;
|
|
118
|
-
ai: number;
|
|
119
|
-
total: number;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
export interface ViewsResponse {
|
|
123
|
-
totals: TrafficTotals;
|
|
124
|
-
views: TrafficRow[];
|
|
125
|
-
hasMore: boolean;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
export interface VisitorsResponse {
|
|
129
|
-
totals: TrafficTotals;
|
|
130
|
-
visitors: TrafficRow[];
|
|
131
|
-
hasMore: boolean;
|
|
132
|
-
}
|