@vertaaux/cli 0.3.0 → 0.3.1
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/node_modules/@vertaaux/tui/dist/index.cjs +1157 -0
- package/node_modules/@vertaaux/tui/dist/index.cjs.map +1 -0
- package/node_modules/@vertaaux/tui/dist/index.d.cts +609 -0
- package/node_modules/@vertaaux/tui/dist/index.d.ts +609 -0
- package/node_modules/@vertaaux/tui/dist/index.js +1100 -0
- package/node_modules/@vertaaux/tui/dist/index.js.map +1 -0
- package/node_modules/@vertaaux/tui/package.json +64 -0
- package/package.json +4 -1
|
@@ -0,0 +1,609 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Raw ANSI escape sequences for terminal control.
|
|
3
|
+
*
|
|
4
|
+
* No dependencies — pure string constants and functions.
|
|
5
|
+
* Used by renderers and primitives for direct terminal manipulation.
|
|
6
|
+
*/
|
|
7
|
+
declare const cursor: {
|
|
8
|
+
/** Move cursor to row, col (1-indexed) */
|
|
9
|
+
readonly to: (row: number, col: number) => string;
|
|
10
|
+
/** Move cursor to top-left */
|
|
11
|
+
readonly home: "\u001B[H";
|
|
12
|
+
/** Move cursor up N lines */
|
|
13
|
+
readonly up: (n?: number) => string;
|
|
14
|
+
/** Move cursor down N lines */
|
|
15
|
+
readonly down: (n?: number) => string;
|
|
16
|
+
/** Move cursor to column N (1-indexed) */
|
|
17
|
+
readonly column: (n: number) => string;
|
|
18
|
+
/** Hide cursor */
|
|
19
|
+
readonly hide: "\u001B[?25l";
|
|
20
|
+
/** Show cursor */
|
|
21
|
+
readonly show: "\u001B[?25h";
|
|
22
|
+
/** Save cursor position */
|
|
23
|
+
readonly save: "\u001B7";
|
|
24
|
+
/** Restore cursor position */
|
|
25
|
+
readonly restore: "\u001B8";
|
|
26
|
+
};
|
|
27
|
+
declare const screen: {
|
|
28
|
+
/** Clear entire screen */
|
|
29
|
+
readonly clear: "\u001B[2J";
|
|
30
|
+
/** Clear from cursor to end of screen */
|
|
31
|
+
readonly clearDown: "\u001B[J";
|
|
32
|
+
/** Clear from cursor to end of line */
|
|
33
|
+
readonly clearLine: "\u001B[K";
|
|
34
|
+
/** Clear entire line */
|
|
35
|
+
readonly clearFullLine: "\u001B[2K";
|
|
36
|
+
/** Enter alternate screen buffer (preserves scrollback) */
|
|
37
|
+
readonly altEnter: "\u001B[?1049h";
|
|
38
|
+
/** Exit alternate screen buffer */
|
|
39
|
+
readonly altExit: "\u001B[?1049l";
|
|
40
|
+
};
|
|
41
|
+
declare const style: {
|
|
42
|
+
/** Reset all attributes */
|
|
43
|
+
readonly reset: "\u001B[0m";
|
|
44
|
+
};
|
|
45
|
+
declare const borders: {
|
|
46
|
+
readonly single: {
|
|
47
|
+
readonly topLeft: "┌";
|
|
48
|
+
readonly topRight: "┐";
|
|
49
|
+
readonly bottomLeft: "└";
|
|
50
|
+
readonly bottomRight: "┘";
|
|
51
|
+
readonly horizontal: "─";
|
|
52
|
+
readonly vertical: "│";
|
|
53
|
+
};
|
|
54
|
+
readonly double: {
|
|
55
|
+
readonly topLeft: "╔";
|
|
56
|
+
readonly topRight: "╗";
|
|
57
|
+
readonly bottomLeft: "╚";
|
|
58
|
+
readonly bottomRight: "╝";
|
|
59
|
+
readonly horizontal: "═";
|
|
60
|
+
readonly vertical: "║";
|
|
61
|
+
};
|
|
62
|
+
readonly rounded: {
|
|
63
|
+
readonly topLeft: "╭";
|
|
64
|
+
readonly topRight: "╮";
|
|
65
|
+
readonly bottomLeft: "╰";
|
|
66
|
+
readonly bottomRight: "╯";
|
|
67
|
+
readonly horizontal: "─";
|
|
68
|
+
readonly vertical: "│";
|
|
69
|
+
};
|
|
70
|
+
readonly heavy: {
|
|
71
|
+
readonly topLeft: "┏";
|
|
72
|
+
readonly topRight: "┓";
|
|
73
|
+
readonly bottomLeft: "┗";
|
|
74
|
+
readonly bottomRight: "┛";
|
|
75
|
+
readonly horizontal: "━";
|
|
76
|
+
readonly vertical: "┃";
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
type BorderStyle = keyof typeof borders;
|
|
80
|
+
/** Common type for any border character set */
|
|
81
|
+
interface BorderChars {
|
|
82
|
+
readonly topLeft: string;
|
|
83
|
+
readonly topRight: string;
|
|
84
|
+
readonly bottomLeft: string;
|
|
85
|
+
readonly bottomRight: string;
|
|
86
|
+
readonly horizontal: string;
|
|
87
|
+
readonly vertical: string;
|
|
88
|
+
}
|
|
89
|
+
/** Strip all ANSI escape sequences from a string */
|
|
90
|
+
declare function stripAnsi(str: string): string;
|
|
91
|
+
/** Get visible character width of a string (excluding ANSI codes) */
|
|
92
|
+
declare function visibleLength(str: string): number;
|
|
93
|
+
/** Pad string to visible width, accounting for ANSI codes */
|
|
94
|
+
declare function padEnd(str: string, width: number): string;
|
|
95
|
+
/** Pad string to visible width from left */
|
|
96
|
+
declare function padStart(str: string, width: number): string;
|
|
97
|
+
/** Center string within width, accounting for ANSI codes */
|
|
98
|
+
declare function center(str: string, width: number): string;
|
|
99
|
+
/** Truncate string to visible width, adding ellipsis */
|
|
100
|
+
declare function truncate(str: string, maxWidth: number): string;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* VertaaUX brand theme for terminal output.
|
|
104
|
+
*
|
|
105
|
+
* Defines the color palette, severity colors, score gradients,
|
|
106
|
+
* and semantic tokens used across all TUI primitives.
|
|
107
|
+
*/
|
|
108
|
+
declare const brand: {
|
|
109
|
+
readonly lime: "#78FFB4";
|
|
110
|
+
readonly tealLight: "#6BEEBD";
|
|
111
|
+
readonly teal: "#5EDDC6";
|
|
112
|
+
readonly cyan: "#51CCCE";
|
|
113
|
+
readonly dark: "#0A0F1A";
|
|
114
|
+
};
|
|
115
|
+
/** Gradient stops from lime → cyan (for banner, headers, accents) */
|
|
116
|
+
declare const gradient: readonly ["#78FFB4", "#6BEEBD", "#5EDDC6", "#51CCCE"];
|
|
117
|
+
declare const severity: {
|
|
118
|
+
readonly critical: "#FF6B6B";
|
|
119
|
+
readonly error: "#FF6B6B";
|
|
120
|
+
readonly serious: "#FFD93D";
|
|
121
|
+
readonly warning: "#FFD93D";
|
|
122
|
+
readonly moderate: "#6BCEFF";
|
|
123
|
+
readonly minor: "#6BCEFF";
|
|
124
|
+
readonly info: "#888888";
|
|
125
|
+
};
|
|
126
|
+
type SeverityLevel = keyof typeof severity;
|
|
127
|
+
/** Severity display labels */
|
|
128
|
+
declare const severityLabels: Record<string, string>;
|
|
129
|
+
/** Severity sort order (highest first) */
|
|
130
|
+
declare const severityOrder: Record<string, number>;
|
|
131
|
+
/**
|
|
132
|
+
* Get hex color for a score value (0-100).
|
|
133
|
+
*/
|
|
134
|
+
declare function scoreColor(score: number): string;
|
|
135
|
+
declare const tokens: {
|
|
136
|
+
readonly success: "#4ADE80";
|
|
137
|
+
readonly error: "#F87171";
|
|
138
|
+
readonly warning: "#FACC15";
|
|
139
|
+
readonly info: "#6BCEFF";
|
|
140
|
+
readonly muted: "#6B7280";
|
|
141
|
+
readonly accent: "#78FFB4";
|
|
142
|
+
};
|
|
143
|
+
/** Set whether color output is enabled (call early, based on detect.ts) */
|
|
144
|
+
declare function setColorEnabled(enabled: boolean): void;
|
|
145
|
+
/** Check if color is currently enabled */
|
|
146
|
+
declare function isColorEnabled(): boolean;
|
|
147
|
+
/** Apply hex color to text (respects color-enabled state) */
|
|
148
|
+
declare function colorize(text: string, hex: string): string;
|
|
149
|
+
/** Apply bold + hex color */
|
|
150
|
+
declare function boldColor(text: string, hex: string): string;
|
|
151
|
+
/** Apply dim styling */
|
|
152
|
+
declare function dim$1(text: string): string;
|
|
153
|
+
/** Apply bold styling */
|
|
154
|
+
declare function bold$1(text: string): string;
|
|
155
|
+
/** Apply gradient across text characters */
|
|
156
|
+
declare function applyGradient(text: string, colors?: readonly string[]): string;
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Environment detection for terminal capabilities.
|
|
160
|
+
*
|
|
161
|
+
* Standalone implementations (no CLI dependency) that detect
|
|
162
|
+
* TTY, CI, color support, and terminal dimensions.
|
|
163
|
+
*/
|
|
164
|
+
/** Check if running in a CI environment. */
|
|
165
|
+
declare function isCI(): boolean;
|
|
166
|
+
/** Check if stderr is a TTY (used for UI output). */
|
|
167
|
+
declare function isTTY(): boolean;
|
|
168
|
+
/** Check if stdout is a TTY (used for data output detection). */
|
|
169
|
+
declare function isStdoutTTY(): boolean;
|
|
170
|
+
/** Check if stdin is a TTY (used for keyboard input detection). */
|
|
171
|
+
declare function isStdinTTY(): boolean;
|
|
172
|
+
/**
|
|
173
|
+
* Determine if colors should be used.
|
|
174
|
+
*
|
|
175
|
+
* Priority: NO_COLOR > FORCE_COLOR > CI (off) > TTY detection
|
|
176
|
+
*/
|
|
177
|
+
declare function shouldUseColor(): boolean;
|
|
178
|
+
/** Get terminal width from stderr (where UI renders). Falls back to 80. */
|
|
179
|
+
declare function getTerminalWidth(): number;
|
|
180
|
+
/** Get terminal height from stderr. Falls back to 24. */
|
|
181
|
+
declare function getTerminalHeight(): number;
|
|
182
|
+
/** Check if terminal supports Unicode (not dumb terminal). */
|
|
183
|
+
declare function supportsUnicode(): boolean;
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Text styling primitives for terminal output.
|
|
187
|
+
*
|
|
188
|
+
* Semantic text functions for headings, labels, badges, and emphasis.
|
|
189
|
+
* All respect the color-enabled state from theme.ts.
|
|
190
|
+
*/
|
|
191
|
+
/** Render a section heading with brand accent */
|
|
192
|
+
declare function heading(text: string): string;
|
|
193
|
+
/** Render a sub-heading */
|
|
194
|
+
declare function subheading(text: string): string;
|
|
195
|
+
/** Render a label (key in key-value pairs) */
|
|
196
|
+
declare function label(text: string): string;
|
|
197
|
+
/** Render dimmed/muted text */
|
|
198
|
+
declare function dim(text: string): string;
|
|
199
|
+
/** Render bold text */
|
|
200
|
+
declare function bold(text: string): string;
|
|
201
|
+
/** Render a clickable-looking link (underlined cyan) */
|
|
202
|
+
declare function link(text: string): string;
|
|
203
|
+
/** Render severity badge: colored, bold, uppercase label */
|
|
204
|
+
declare function severityBadge(level: string): string;
|
|
205
|
+
/** Render score badge: color-coded number */
|
|
206
|
+
declare function scoreBadge(score: number): string;
|
|
207
|
+
/** Render success text */
|
|
208
|
+
declare function success(text: string): string;
|
|
209
|
+
/** Render error text */
|
|
210
|
+
declare function error(text: string): string;
|
|
211
|
+
/** Render warning text */
|
|
212
|
+
declare function warning(text: string): string;
|
|
213
|
+
/** Render info text */
|
|
214
|
+
declare function info(text: string): string;
|
|
215
|
+
/** Render a key: value pair with styled label */
|
|
216
|
+
declare function keyValue(key: string, value: string): string;
|
|
217
|
+
/** Render a horizontal rule that spans the terminal width */
|
|
218
|
+
declare function hr(width: number, char?: string): string;
|
|
219
|
+
/** Render a status indicator dot */
|
|
220
|
+
declare function statusDot(status: "pass" | "fail" | "warn" | "skip" | "active"): string;
|
|
221
|
+
|
|
222
|
+
declare const text_bold: typeof bold;
|
|
223
|
+
declare const text_dim: typeof dim;
|
|
224
|
+
declare const text_error: typeof error;
|
|
225
|
+
declare const text_heading: typeof heading;
|
|
226
|
+
declare const text_hr: typeof hr;
|
|
227
|
+
declare const text_info: typeof info;
|
|
228
|
+
declare const text_keyValue: typeof keyValue;
|
|
229
|
+
declare const text_label: typeof label;
|
|
230
|
+
declare const text_link: typeof link;
|
|
231
|
+
declare const text_scoreBadge: typeof scoreBadge;
|
|
232
|
+
declare const text_severityBadge: typeof severityBadge;
|
|
233
|
+
declare const text_statusDot: typeof statusDot;
|
|
234
|
+
declare const text_subheading: typeof subheading;
|
|
235
|
+
declare const text_success: typeof success;
|
|
236
|
+
declare const text_warning: typeof warning;
|
|
237
|
+
declare namespace text {
|
|
238
|
+
export { text_bold as bold, text_dim as dim, text_error as error, text_heading as heading, text_hr as hr, text_info as info, text_keyValue as keyValue, text_label as label, text_link as link, text_scoreBadge as scoreBadge, text_severityBadge as severityBadge, text_statusDot as statusDot, text_subheading as subheading, text_success as success, text_warning as warning };
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Box primitive for bordered terminal output.
|
|
243
|
+
*
|
|
244
|
+
* Renders content inside a Unicode box with optional title, subtitle,
|
|
245
|
+
* padding, and multiple border styles.
|
|
246
|
+
*/
|
|
247
|
+
|
|
248
|
+
interface BoxOptions {
|
|
249
|
+
/** Border style: single, double, rounded, heavy, none */
|
|
250
|
+
border?: BorderStyle | "none";
|
|
251
|
+
/** Inner padding (number of spaces on each side) */
|
|
252
|
+
padding?: number;
|
|
253
|
+
/** Vertical padding (blank lines above/below content) */
|
|
254
|
+
paddingY?: number;
|
|
255
|
+
/** Title displayed on the top border */
|
|
256
|
+
title?: string;
|
|
257
|
+
/** Subtitle displayed on the bottom border */
|
|
258
|
+
subtitle?: string;
|
|
259
|
+
/** Fixed width (defaults to terminal width - 2) */
|
|
260
|
+
width?: number;
|
|
261
|
+
/** Border color hex (defaults to brand.teal) */
|
|
262
|
+
borderColor?: string;
|
|
263
|
+
/** Title color hex (defaults to brand.lime) */
|
|
264
|
+
titleColor?: string;
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Render content inside a bordered box.
|
|
268
|
+
*
|
|
269
|
+
* @param content - Text content (can be multi-line)
|
|
270
|
+
* @param opts - Box options
|
|
271
|
+
* @returns Rendered box string
|
|
272
|
+
*/
|
|
273
|
+
declare function box(content: string, opts?: BoxOptions): string;
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Table primitive for terminal output.
|
|
277
|
+
*
|
|
278
|
+
* Renders aligned, color-coded tables with auto-width,
|
|
279
|
+
* group headers, and terminal-width-aware truncation.
|
|
280
|
+
* No external table library — pure string rendering.
|
|
281
|
+
*/
|
|
282
|
+
interface Column {
|
|
283
|
+
/** Data key to read from row objects */
|
|
284
|
+
key: string;
|
|
285
|
+
/** Column header label */
|
|
286
|
+
label: string;
|
|
287
|
+
/** Fixed width (characters). If omitted, auto-calculated. */
|
|
288
|
+
width?: number;
|
|
289
|
+
/** Text alignment */
|
|
290
|
+
align?: "left" | "right" | "center";
|
|
291
|
+
/** Custom color function for cell values */
|
|
292
|
+
color?: (value: string) => string;
|
|
293
|
+
}
|
|
294
|
+
interface TableOptions {
|
|
295
|
+
/** Maximum total width (defaults to terminal width) */
|
|
296
|
+
maxWidth?: number;
|
|
297
|
+
/** Show borders between rows */
|
|
298
|
+
rowBorders?: boolean;
|
|
299
|
+
/** Group header styling */
|
|
300
|
+
groupLabel?: string;
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Render a data table from rows and column definitions.
|
|
304
|
+
*/
|
|
305
|
+
declare function renderTable(rows: Record<string, string>[], columns: Column[], opts?: TableOptions): string;
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Spinner primitive for terminal progress indication.
|
|
309
|
+
*
|
|
310
|
+
* Renders an animated spinner with text to stderr.
|
|
311
|
+
* Writes ONLY to stderr — never pollutes stdout.
|
|
312
|
+
*/
|
|
313
|
+
interface SpinnerInstance {
|
|
314
|
+
/** Start the spinner animation */
|
|
315
|
+
start(): void;
|
|
316
|
+
/** Stop the spinner and clear the line */
|
|
317
|
+
stop(): void;
|
|
318
|
+
/** Update the display text */
|
|
319
|
+
setText(text: string): void;
|
|
320
|
+
/** Show phase label alongside text */
|
|
321
|
+
setPhase(phase: string): void;
|
|
322
|
+
/** Stop with success indicator */
|
|
323
|
+
succeed(text: string): void;
|
|
324
|
+
/** Stop with failure indicator */
|
|
325
|
+
fail(text: string): void;
|
|
326
|
+
/** Stop with warning indicator */
|
|
327
|
+
warn(text: string): void;
|
|
328
|
+
/** Stop with info indicator */
|
|
329
|
+
info(text: string): void;
|
|
330
|
+
/** Whether the spinner is currently running */
|
|
331
|
+
isRunning: boolean;
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* Create a new spinner instance.
|
|
335
|
+
*
|
|
336
|
+
* @param text - Initial text to display
|
|
337
|
+
* @param output - Writable stream (defaults to process.stderr)
|
|
338
|
+
*/
|
|
339
|
+
declare function createSpinner(text: string, output?: NodeJS.WritableStream): SpinnerInstance;
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* Progress bar primitive for terminal output.
|
|
343
|
+
*
|
|
344
|
+
* Single bars and multi-bar stacks with percentage, ETA,
|
|
345
|
+
* and brand-colored fill. Writes to stderr only.
|
|
346
|
+
*/
|
|
347
|
+
interface ProgressBarOptions {
|
|
348
|
+
/** Total number of steps */
|
|
349
|
+
total: number;
|
|
350
|
+
/** Label displayed before the bar */
|
|
351
|
+
label?: string;
|
|
352
|
+
/** Bar width in characters (defaults to auto) */
|
|
353
|
+
width?: number;
|
|
354
|
+
/** Color hex for the filled portion */
|
|
355
|
+
color?: string;
|
|
356
|
+
/** Writable stream (defaults to stderr) */
|
|
357
|
+
output?: NodeJS.WritableStream;
|
|
358
|
+
}
|
|
359
|
+
interface ProgressBar {
|
|
360
|
+
/** Update progress to a new value */
|
|
361
|
+
update(current: number): void;
|
|
362
|
+
/** Complete the bar at 100% */
|
|
363
|
+
complete(message?: string): void;
|
|
364
|
+
/** Fail the bar with error indicator */
|
|
365
|
+
fail(message?: string): void;
|
|
366
|
+
/** Get the current rendered bar string (for embedding in frames) */
|
|
367
|
+
render(current: number, barWidth?: number): string;
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* Create a progress bar.
|
|
371
|
+
*/
|
|
372
|
+
declare function createProgressBar(opts: ProgressBarOptions): ProgressBar;
|
|
373
|
+
interface MultiProgressOptions {
|
|
374
|
+
/** Writable stream (defaults to stderr) */
|
|
375
|
+
output?: NodeJS.WritableStream;
|
|
376
|
+
}
|
|
377
|
+
interface MultiProgress {
|
|
378
|
+
/** Add a named progress bar */
|
|
379
|
+
add(id: string, opts: Omit<ProgressBarOptions, "output">): void;
|
|
380
|
+
/** Update a specific bar */
|
|
381
|
+
update(id: string, current: number): void;
|
|
382
|
+
/** Mark a bar as complete */
|
|
383
|
+
complete(id: string): void;
|
|
384
|
+
/** Render all bars (returns multi-line string for dashboard embedding) */
|
|
385
|
+
renderAll(): string;
|
|
386
|
+
/** Write all bars to output (in-place update) */
|
|
387
|
+
draw(): void;
|
|
388
|
+
/** Clear all bar lines from terminal */
|
|
389
|
+
clear(): void;
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* Create a multi-progress bar stack.
|
|
393
|
+
*/
|
|
394
|
+
declare function createMultiProgress(opts?: MultiProgressOptions): MultiProgress;
|
|
395
|
+
|
|
396
|
+
/**
|
|
397
|
+
* List and tree primitive for terminal output.
|
|
398
|
+
*
|
|
399
|
+
* Renders ordered/unordered lists and tree structures
|
|
400
|
+
* with Unicode connectors and configurable indentation.
|
|
401
|
+
*/
|
|
402
|
+
interface ListOptions {
|
|
403
|
+
/** Ordered (numbered) or unordered (bullet) */
|
|
404
|
+
ordered?: boolean;
|
|
405
|
+
/** Indentation level (for nesting) */
|
|
406
|
+
indent?: number;
|
|
407
|
+
/** Bullet character for unordered lists */
|
|
408
|
+
bullet?: string;
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* Render a flat list of items.
|
|
412
|
+
*/
|
|
413
|
+
declare function renderList(items: string[], opts?: ListOptions): string;
|
|
414
|
+
interface TreeNode {
|
|
415
|
+
label: string;
|
|
416
|
+
children?: TreeNode[];
|
|
417
|
+
/** Whether this node's children should be collapsed (hidden) */
|
|
418
|
+
collapsed?: boolean;
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* Render a tree structure with Unicode box-drawing connectors.
|
|
422
|
+
*
|
|
423
|
+
* ```
|
|
424
|
+
* Root
|
|
425
|
+
* ├── Child 1
|
|
426
|
+
* │ ├── Grandchild A
|
|
427
|
+
* │ └── Grandchild B
|
|
428
|
+
* └── Child 2
|
|
429
|
+
* ```
|
|
430
|
+
*/
|
|
431
|
+
declare function renderTree(node: TreeNode, prefix?: string, isLast?: boolean, isRoot?: boolean): string;
|
|
432
|
+
/**
|
|
433
|
+
* Render a grouped list with section headers.
|
|
434
|
+
*
|
|
435
|
+
* ```
|
|
436
|
+
* ── Critical (3) ──────────
|
|
437
|
+
* • Issue 1
|
|
438
|
+
* • Issue 2
|
|
439
|
+
* • Issue 3
|
|
440
|
+
*
|
|
441
|
+
* ── Warning (5) ───────────
|
|
442
|
+
* • Issue 4
|
|
443
|
+
* ...
|
|
444
|
+
* ```
|
|
445
|
+
*/
|
|
446
|
+
declare function renderGroupedList(groups: Map<string, string[]> | Record<string, string[]>, opts?: ListOptions): string;
|
|
447
|
+
|
|
448
|
+
/**
|
|
449
|
+
* Diff rendering primitive for terminal output.
|
|
450
|
+
*
|
|
451
|
+
* Displays unified or side-by-side diffs with
|
|
452
|
+
* colored additions/deletions.
|
|
453
|
+
*/
|
|
454
|
+
type DiffMode = "unified" | "side-by-side";
|
|
455
|
+
interface DiffLine {
|
|
456
|
+
type: "add" | "remove" | "context" | "header";
|
|
457
|
+
content: string;
|
|
458
|
+
lineNum?: number;
|
|
459
|
+
}
|
|
460
|
+
interface DiffOptions {
|
|
461
|
+
mode?: DiffMode;
|
|
462
|
+
context?: number;
|
|
463
|
+
maxWidth?: number;
|
|
464
|
+
}
|
|
465
|
+
/**
|
|
466
|
+
* Render a unified diff from structured diff lines.
|
|
467
|
+
*/
|
|
468
|
+
declare function renderDiff(lines: DiffLine[], opts?: DiffOptions): string;
|
|
469
|
+
/**
|
|
470
|
+
* Parse a unified diff string into structured DiffLine array.
|
|
471
|
+
*/
|
|
472
|
+
declare function parseDiff(diffText: string): DiffLine[];
|
|
473
|
+
|
|
474
|
+
/**
|
|
475
|
+
* Renderer interface and factory for terminal output.
|
|
476
|
+
*
|
|
477
|
+
* Two rendering modes:
|
|
478
|
+
* - AlternateScreenRenderer: Full terminal takeover (TTY)
|
|
479
|
+
* - InlineRenderer: Timestamped log lines (CI/piped)
|
|
480
|
+
*/
|
|
481
|
+
interface DashboardState {
|
|
482
|
+
phase: string;
|
|
483
|
+
phaseIndex: number;
|
|
484
|
+
phaseTotal: number;
|
|
485
|
+
url: string;
|
|
486
|
+
mode: string;
|
|
487
|
+
progress: Record<string, number>;
|
|
488
|
+
totals: Record<string, number>;
|
|
489
|
+
issueCount: number;
|
|
490
|
+
scorePreview: number | null;
|
|
491
|
+
verbose: boolean;
|
|
492
|
+
elapsed: number;
|
|
493
|
+
}
|
|
494
|
+
interface SummaryResult {
|
|
495
|
+
url: string;
|
|
496
|
+
mode: string;
|
|
497
|
+
overallScore: number;
|
|
498
|
+
scores: Record<string, number>;
|
|
499
|
+
issueCount: number;
|
|
500
|
+
passed: boolean;
|
|
501
|
+
elapsed: number;
|
|
502
|
+
}
|
|
503
|
+
interface Renderer {
|
|
504
|
+
/** Update the display with new state */
|
|
505
|
+
update(state: DashboardState): void;
|
|
506
|
+
/** Show final summary and clean up */
|
|
507
|
+
finish(result: SummaryResult): void;
|
|
508
|
+
/** Clean up resources (keyboard, alternate screen, etc.) */
|
|
509
|
+
dispose(): void;
|
|
510
|
+
}
|
|
511
|
+
type RendererMode = "alternate" | "inline" | "auto";
|
|
512
|
+
/**
|
|
513
|
+
* Create a renderer based on mode or auto-detection.
|
|
514
|
+
*
|
|
515
|
+
* auto: alternate in interactive TTY, inline in CI/piped
|
|
516
|
+
*/
|
|
517
|
+
declare function createRenderer(mode?: RendererMode, output?: NodeJS.WritableStream): Renderer;
|
|
518
|
+
|
|
519
|
+
/**
|
|
520
|
+
* Alternate screen renderer for interactive TTY.
|
|
521
|
+
*
|
|
522
|
+
* Takes over the terminal with a full-screen dashboard.
|
|
523
|
+
* Uses the alternate screen buffer to preserve scrollback.
|
|
524
|
+
* On dispose, restores the original terminal.
|
|
525
|
+
*/
|
|
526
|
+
|
|
527
|
+
declare class AlternateScreenRenderer implements Renderer {
|
|
528
|
+
private output;
|
|
529
|
+
private entered;
|
|
530
|
+
constructor(output?: NodeJS.WritableStream);
|
|
531
|
+
update(state: DashboardState): void;
|
|
532
|
+
finish(result: SummaryResult): void;
|
|
533
|
+
dispose(): void;
|
|
534
|
+
private renderSummary;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
/**
|
|
538
|
+
* Inline renderer for CI/piped environments.
|
|
539
|
+
*
|
|
540
|
+
* Writes timestamped, non-interactive log lines to stderr.
|
|
541
|
+
* No cursor movement, no ANSI escape sequences beyond color.
|
|
542
|
+
* Compatible with log aggregation tools.
|
|
543
|
+
*/
|
|
544
|
+
|
|
545
|
+
declare class InlineRenderer implements Renderer {
|
|
546
|
+
private output;
|
|
547
|
+
private lastPhase;
|
|
548
|
+
constructor(output?: NodeJS.WritableStream);
|
|
549
|
+
update(state: DashboardState): void;
|
|
550
|
+
finish(result: SummaryResult): void;
|
|
551
|
+
dispose(): void;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
/**
|
|
555
|
+
* Dashboard frame renderer — pure function.
|
|
556
|
+
*
|
|
557
|
+
* Takes dashboard state + terminal dimensions, returns a string
|
|
558
|
+
* representing the full screen content. No side effects.
|
|
559
|
+
*/
|
|
560
|
+
|
|
561
|
+
/**
|
|
562
|
+
* Render a complete dashboard frame.
|
|
563
|
+
*
|
|
564
|
+
* Pure function — no I/O, no side effects, fully testable.
|
|
565
|
+
*/
|
|
566
|
+
declare function renderFrame(state: DashboardState, width: number, _height: number): string;
|
|
567
|
+
|
|
568
|
+
/**
|
|
569
|
+
* Dashboard state types and phase definitions.
|
|
570
|
+
*/
|
|
571
|
+
declare const AuditPhase: {
|
|
572
|
+
readonly Connecting: "Connecting";
|
|
573
|
+
readonly Crawling: "Crawling";
|
|
574
|
+
readonly Analyzing: "Analyzing";
|
|
575
|
+
readonly Scoring: "Scoring";
|
|
576
|
+
readonly Done: "Done";
|
|
577
|
+
readonly Failed: "Failed";
|
|
578
|
+
};
|
|
579
|
+
type AuditPhaseName = (typeof AuditPhase)[keyof typeof AuditPhase];
|
|
580
|
+
/** Ordered phases for progress indication */
|
|
581
|
+
declare const PHASE_ORDER: AuditPhaseName[];
|
|
582
|
+
/** Get the index of a phase in the ordered sequence */
|
|
583
|
+
declare function phaseIndex(phase: string): number;
|
|
584
|
+
/** Get the total number of actionable phases (excluding Done) */
|
|
585
|
+
declare function phaseTotal(): number;
|
|
586
|
+
|
|
587
|
+
/**
|
|
588
|
+
* Keyboard handler for dashboard interaction.
|
|
589
|
+
*
|
|
590
|
+
* Listens for keypresses in raw mode and emits semantic events.
|
|
591
|
+
* Only works in TTY — gracefully no-ops in non-TTY environments.
|
|
592
|
+
*/
|
|
593
|
+
type KeyboardEvent = "quit" | "verbose";
|
|
594
|
+
interface KeyboardHandler {
|
|
595
|
+
/** Start listening for keypresses */
|
|
596
|
+
start(): void;
|
|
597
|
+
/** Stop listening and restore terminal state */
|
|
598
|
+
dispose(): void;
|
|
599
|
+
/** Register an event handler */
|
|
600
|
+
on(event: KeyboardEvent, handler: () => void): void;
|
|
601
|
+
}
|
|
602
|
+
/**
|
|
603
|
+
* Create a keyboard handler.
|
|
604
|
+
*
|
|
605
|
+
* @param stdin - Input stream (defaults to process.stdin, injectable for testing)
|
|
606
|
+
*/
|
|
607
|
+
declare function createKeyboardHandler(stdin?: NodeJS.ReadStream): KeyboardHandler;
|
|
608
|
+
|
|
609
|
+
export { AlternateScreenRenderer, AuditPhase, type AuditPhaseName, type BorderChars, type BorderStyle, type BoxOptions, type Column, type DashboardState, type DiffLine, type DiffMode, type DiffOptions, InlineRenderer, type KeyboardEvent, type KeyboardHandler, type ListOptions, type MultiProgress, PHASE_ORDER, type ProgressBar, type ProgressBarOptions, type Renderer, type RendererMode, type SeverityLevel, type SpinnerInstance, type SummaryResult, type TableOptions, type TreeNode, applyGradient, bold$1 as bold, boldColor, borders, box, brand, center, colorize, createKeyboardHandler, createMultiProgress, createProgressBar, createRenderer, createSpinner, cursor, dim$1 as dim, getTerminalHeight, getTerminalWidth, gradient, isCI, isColorEnabled, isStdinTTY, isStdoutTTY, isTTY, padEnd, padStart, parseDiff, phaseIndex, phaseTotal, renderDiff, renderFrame, renderGroupedList, renderList, renderTable, renderTree, scoreColor, screen, setColorEnabled, severity, severityLabels, severityOrder, shouldUseColor, stripAnsi, style, supportsUnicode, text, tokens, truncate, visibleLength };
|