@vertaaux/cli 0.2.0
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/README.md +345 -0
- package/dist/auth/ci-token.d.ts +49 -0
- package/dist/auth/ci-token.d.ts.map +1 -0
- package/dist/auth/ci-token.js +83 -0
- package/dist/auth/device-flow.d.ts +66 -0
- package/dist/auth/device-flow.d.ts.map +1 -0
- package/dist/auth/device-flow.js +156 -0
- package/dist/auth/token-store.d.ts +53 -0
- package/dist/auth/token-store.d.ts.map +1 -0
- package/dist/auth/token-store.js +78 -0
- package/dist/baseline/diff.d.ts +57 -0
- package/dist/baseline/diff.d.ts.map +1 -0
- package/dist/baseline/diff.js +152 -0
- package/dist/baseline/hash.d.ts +54 -0
- package/dist/baseline/hash.d.ts.map +1 -0
- package/dist/baseline/hash.js +66 -0
- package/dist/baseline/manager.d.ts +89 -0
- package/dist/baseline/manager.d.ts.map +1 -0
- package/dist/baseline/manager.js +157 -0
- package/dist/cache/index.d.ts +8 -0
- package/dist/cache/index.d.ts.map +1 -0
- package/dist/cache/index.js +7 -0
- package/dist/cache/route-cache.d.ts +119 -0
- package/dist/cache/route-cache.d.ts.map +1 -0
- package/dist/cache/route-cache.js +213 -0
- package/dist/ci/changed-routes.d.ts +95 -0
- package/dist/ci/changed-routes.d.ts.map +1 -0
- package/dist/ci/changed-routes.js +304 -0
- package/dist/ci/github-api.d.ts +68 -0
- package/dist/ci/github-api.d.ts.map +1 -0
- package/dist/ci/github-api.js +138 -0
- package/dist/ci/gitlab-api.d.ts +75 -0
- package/dist/ci/gitlab-api.d.ts.map +1 -0
- package/dist/ci/gitlab-api.js +180 -0
- package/dist/ci/index.d.ts +6 -0
- package/dist/ci/index.d.ts.map +1 -0
- package/dist/ci/index.js +4 -0
- package/dist/commands/audit.d.ts +58 -0
- package/dist/commands/audit.d.ts.map +1 -0
- package/dist/commands/audit.js +862 -0
- package/dist/commands/baseline.d.ts +22 -0
- package/dist/commands/baseline.d.ts.map +1 -0
- package/dist/commands/baseline.js +210 -0
- package/dist/commands/comment.d.ts +14 -0
- package/dist/commands/comment.d.ts.map +1 -0
- package/dist/commands/comment.js +363 -0
- package/dist/commands/diff.d.ts +24 -0
- package/dist/commands/diff.d.ts.map +1 -0
- package/dist/commands/diff.js +196 -0
- package/dist/commands/doctor.d.ts +58 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +338 -0
- package/dist/commands/download.d.ts +12 -0
- package/dist/commands/download.d.ts.map +1 -0
- package/dist/commands/download.js +183 -0
- package/dist/commands/explain.d.ts +62 -0
- package/dist/commands/explain.d.ts.map +1 -0
- package/dist/commands/explain.js +302 -0
- package/dist/commands/init.d.ts +12 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +212 -0
- package/dist/commands/login.d.ts +14 -0
- package/dist/commands/login.d.ts.map +1 -0
- package/dist/commands/login.js +222 -0
- package/dist/commands/policy.d.ts +13 -0
- package/dist/commands/policy.d.ts.map +1 -0
- package/dist/commands/policy.js +347 -0
- package/dist/commands/upload.d.ts +12 -0
- package/dist/commands/upload.d.ts.map +1 -0
- package/dist/commands/upload.js +158 -0
- package/dist/config/defaults.d.ts +21 -0
- package/dist/config/defaults.d.ts.map +1 -0
- package/dist/config/defaults.js +49 -0
- package/dist/config/loader.d.ts +66 -0
- package/dist/config/loader.d.ts.map +1 -0
- package/dist/config/loader.js +167 -0
- package/dist/config/schema.d.ts +55 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/config/schema.js +6 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1090 -0
- package/dist/interactive/fix-wizard.d.ts +44 -0
- package/dist/interactive/fix-wizard.d.ts.map +1 -0
- package/dist/interactive/fix-wizard.js +286 -0
- package/dist/interactive/init-wizard.d.ts +32 -0
- package/dist/interactive/init-wizard.d.ts.map +1 -0
- package/dist/interactive/init-wizard.js +193 -0
- package/dist/interactive/prompts.d.ts +62 -0
- package/dist/interactive/prompts.d.ts.map +1 -0
- package/dist/interactive/prompts.js +78 -0
- package/dist/monorepo/detector.d.ts +70 -0
- package/dist/monorepo/detector.d.ts.map +1 -0
- package/dist/monorepo/detector.js +278 -0
- package/dist/monorepo/index.d.ts +9 -0
- package/dist/monorepo/index.d.ts.map +1 -0
- package/dist/monorepo/index.js +8 -0
- package/dist/monorepo/workspace.d.ts +142 -0
- package/dist/monorepo/workspace.d.ts.map +1 -0
- package/dist/monorepo/workspace.js +171 -0
- package/dist/output/envelope.d.ts +21 -0
- package/dist/output/envelope.d.ts.map +1 -0
- package/dist/output/envelope.js +27 -0
- package/dist/output/factory.d.ts +73 -0
- package/dist/output/factory.d.ts.map +1 -0
- package/dist/output/factory.js +60 -0
- package/dist/output/formats.d.ts +11 -0
- package/dist/output/formats.d.ts.map +1 -0
- package/dist/output/formats.js +41 -0
- package/dist/output/html.d.ts +45 -0
- package/dist/output/html.d.ts.map +1 -0
- package/dist/output/html.js +607 -0
- package/dist/output/human.d.ts +41 -0
- package/dist/output/human.d.ts.map +1 -0
- package/dist/output/human.js +274 -0
- package/dist/output/json.d.ts +42 -0
- package/dist/output/json.d.ts.map +1 -0
- package/dist/output/json.js +37 -0
- package/dist/output/junit.d.ts +56 -0
- package/dist/output/junit.d.ts.map +1 -0
- package/dist/output/junit.js +135 -0
- package/dist/output/markdown.d.ts +77 -0
- package/dist/output/markdown.d.ts.map +1 -0
- package/dist/output/markdown.js +411 -0
- package/dist/output/sarif.d.ts +160 -0
- package/dist/output/sarif.d.ts.map +1 -0
- package/dist/output/sarif.js +207 -0
- package/dist/policy/evaluator.d.ts +111 -0
- package/dist/policy/evaluator.d.ts.map +1 -0
- package/dist/policy/evaluator.js +362 -0
- package/dist/policy/index.d.ts +15 -0
- package/dist/policy/index.d.ts.map +1 -0
- package/dist/policy/index.js +11 -0
- package/dist/policy/loader.d.ts +97 -0
- package/dist/policy/loader.d.ts.map +1 -0
- package/dist/policy/loader.js +281 -0
- package/dist/policy/schema.d.ts +297 -0
- package/dist/policy/schema.d.ts.map +1 -0
- package/dist/policy/schema.js +230 -0
- package/dist/quality-gate/evaluator.d.ts +58 -0
- package/dist/quality-gate/evaluator.d.ts.map +1 -0
- package/dist/quality-gate/evaluator.js +274 -0
- package/dist/quality-gate/index.d.ts +10 -0
- package/dist/quality-gate/index.d.ts.map +1 -0
- package/dist/quality-gate/index.js +7 -0
- package/dist/quality-gate/types.d.ts +103 -0
- package/dist/quality-gate/types.d.ts.map +1 -0
- package/dist/quality-gate/types.js +23 -0
- package/dist/templates/azure-devops.d.ts +25 -0
- package/dist/templates/azure-devops.d.ts.map +1 -0
- package/dist/templates/azure-devops.js +109 -0
- package/dist/templates/circleci.d.ts +28 -0
- package/dist/templates/circleci.d.ts.map +1 -0
- package/dist/templates/circleci.js +86 -0
- package/dist/templates/github-actions.d.ts +81 -0
- package/dist/templates/github-actions.d.ts.map +1 -0
- package/dist/templates/github-actions.js +393 -0
- package/dist/templates/gitlab-ci.d.ts +26 -0
- package/dist/templates/gitlab-ci.d.ts.map +1 -0
- package/dist/templates/gitlab-ci.js +70 -0
- package/dist/templates/index.d.ts +72 -0
- package/dist/templates/index.d.ts.map +1 -0
- package/dist/templates/index.js +112 -0
- package/dist/templates/jenkins.d.ts +26 -0
- package/dist/templates/jenkins.d.ts.map +1 -0
- package/dist/templates/jenkins.js +110 -0
- package/dist/ui/banner.d.ts +31 -0
- package/dist/ui/banner.d.ts.map +1 -0
- package/dist/ui/banner.js +84 -0
- package/dist/ui/diagnostics.d.ts +39 -0
- package/dist/ui/diagnostics.d.ts.map +1 -0
- package/dist/ui/diagnostics.js +153 -0
- package/dist/ui/spinner.d.ts +61 -0
- package/dist/ui/spinner.d.ts.map +1 -0
- package/dist/ui/spinner.js +101 -0
- package/dist/ui/table.d.ts +63 -0
- package/dist/ui/table.d.ts.map +1 -0
- package/dist/ui/table.js +236 -0
- package/dist/utils/client.d.ts +82 -0
- package/dist/utils/client.d.ts.map +1 -0
- package/dist/utils/client.js +128 -0
- package/dist/utils/detect-env.d.ts +59 -0
- package/dist/utils/detect-env.d.ts.map +1 -0
- package/dist/utils/detect-env.js +115 -0
- package/dist/utils/exit-codes.d.ts +47 -0
- package/dist/utils/exit-codes.d.ts.map +1 -0
- package/dist/utils/exit-codes.js +61 -0
- package/dist/utils/logger.d.ts +87 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +185 -0
- package/dist/utils/sanitize.d.ts +36 -0
- package/dist/utils/sanitize.d.ts.map +1 -0
- package/dist/utils/sanitize.js +64 -0
- package/dist/utils/validators.d.ts +41 -0
- package/dist/utils/validators.d.ts.map +1 -0
- package/dist/utils/validators.js +123 -0
- package/package.json +63 -0
- package/schemas/vertaaux.config.schema.json +103 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Jenkins pipeline template generator for VertaaUX.
|
|
3
|
+
*
|
|
4
|
+
* Generates Jenkinsfile with Warnings NG plugin integration:
|
|
5
|
+
* - Checkstyle format output for Warnings NG parsing
|
|
6
|
+
* - recordIssues step for quality gate enforcement
|
|
7
|
+
*
|
|
8
|
+
* Requires Jenkins Warnings NG Plugin:
|
|
9
|
+
* @see https://plugins.jenkins.io/warnings-ng/
|
|
10
|
+
*/
|
|
11
|
+
export interface JenkinsOptions {
|
|
12
|
+
/** URL to audit (optional, can be set in config) */
|
|
13
|
+
auditUrl?: string;
|
|
14
|
+
/** Severity threshold for CI failure */
|
|
15
|
+
failOn?: "error" | "warning" | "info" | "none";
|
|
16
|
+
/** Minimum score threshold (0 = disabled) */
|
|
17
|
+
threshold?: number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Generate Jenkinsfile template for VertaaUX integration.
|
|
21
|
+
*
|
|
22
|
+
* @param options - Configuration options
|
|
23
|
+
* @returns Groovy Jenkinsfile content
|
|
24
|
+
*/
|
|
25
|
+
export declare function generateJenkinsTemplate(options?: JenkinsOptions): string;
|
|
26
|
+
//# sourceMappingURL=jenkins.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jenkins.d.ts","sourceRoot":"","sources":["../../src/templates/jenkins.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,MAAM,WAAW,cAAc;IAC7B,oDAAoD;IACpD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,wCAAwC;IACxC,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC;IAC/C,6CAA6C;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,GAAE,cAAmB,GAAG,MAAM,CAgG5E"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Jenkins pipeline template generator for VertaaUX.
|
|
3
|
+
*
|
|
4
|
+
* Generates Jenkinsfile with Warnings NG plugin integration:
|
|
5
|
+
* - Checkstyle format output for Warnings NG parsing
|
|
6
|
+
* - recordIssues step for quality gate enforcement
|
|
7
|
+
*
|
|
8
|
+
* Requires Jenkins Warnings NG Plugin:
|
|
9
|
+
* @see https://plugins.jenkins.io/warnings-ng/
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Generate Jenkinsfile template for VertaaUX integration.
|
|
13
|
+
*
|
|
14
|
+
* @param options - Configuration options
|
|
15
|
+
* @returns Groovy Jenkinsfile content
|
|
16
|
+
*/
|
|
17
|
+
export function generateJenkinsTemplate(options = {}) {
|
|
18
|
+
const { auditUrl, failOn = "error", threshold } = options;
|
|
19
|
+
// Build audit command with options
|
|
20
|
+
const auditArgs = [];
|
|
21
|
+
if (auditUrl) {
|
|
22
|
+
auditArgs.push(`--url "${auditUrl}"`);
|
|
23
|
+
}
|
|
24
|
+
if (failOn !== "none") {
|
|
25
|
+
auditArgs.push(`--fail-on ${failOn}`);
|
|
26
|
+
}
|
|
27
|
+
if (threshold && threshold > 0) {
|
|
28
|
+
auditArgs.push(`--threshold ${threshold}`);
|
|
29
|
+
}
|
|
30
|
+
const auditSuffix = auditArgs.length > 0 ? ` ${auditArgs.join(" ")}` : "";
|
|
31
|
+
return `// VertaaUX Accessibility & UX Audit
|
|
32
|
+
// https://vertaaux.ai
|
|
33
|
+
//
|
|
34
|
+
// Jenkinsfile with Warnings NG plugin integration.
|
|
35
|
+
// Requires:
|
|
36
|
+
// - NodeJS 20 tool configured in Jenkins Global Tool Configuration
|
|
37
|
+
// - Warnings NG plugin installed (https://plugins.jenkins.io/warnings-ng/)
|
|
38
|
+
// - VERTAAUX_API_KEY credential configured in Jenkins
|
|
39
|
+
|
|
40
|
+
pipeline {
|
|
41
|
+
agent any
|
|
42
|
+
|
|
43
|
+
tools {
|
|
44
|
+
nodejs 'NodeJS 20'
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
environment {
|
|
48
|
+
// Load API key from Jenkins credentials
|
|
49
|
+
VERTAAUX_API_KEY = credentials('vertaaux-api-key')
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
stages {
|
|
53
|
+
stage('Setup') {
|
|
54
|
+
steps {
|
|
55
|
+
sh 'npm install -g @vertaaux/cli'
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
stage('Audit') {
|
|
60
|
+
steps {
|
|
61
|
+
// Generate checkstyle format for Warnings NG plugin
|
|
62
|
+
sh '''
|
|
63
|
+
vertaa audit \\
|
|
64
|
+
--format checkstyle \\
|
|
65
|
+
--output vertaaux-results.xml${auditSuffix}
|
|
66
|
+
'''
|
|
67
|
+
|
|
68
|
+
// Generate HTML report for archive
|
|
69
|
+
sh '''
|
|
70
|
+
vertaa audit \\
|
|
71
|
+
--format html \\
|
|
72
|
+
--output vertaaux-report.html${auditSuffix}
|
|
73
|
+
'''
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
post {
|
|
79
|
+
always {
|
|
80
|
+
// Parse results with Warnings NG plugin
|
|
81
|
+
// Uses checkStyle parser which understands checkstyle XML format
|
|
82
|
+
recordIssues(
|
|
83
|
+
tools: [checkStyle(pattern: 'vertaaux-results.xml', id: 'vertaaux', name: 'VertaaUX')],
|
|
84
|
+
qualityGates: [
|
|
85
|
+
[threshold: 1, type: 'NEW', criticality: 'FAILURE']
|
|
86
|
+
],
|
|
87
|
+
// Fail build if new issues found
|
|
88
|
+
failOnError: true
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
// Archive HTML report
|
|
92
|
+
archiveArtifacts(
|
|
93
|
+
artifacts: 'vertaaux-report.html',
|
|
94
|
+
allowEmptyArchive: true
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
// Clean up generated files
|
|
98
|
+
cleanWs(
|
|
99
|
+
cleanWhenNotBuilt: false,
|
|
100
|
+
deleteDirs: true,
|
|
101
|
+
patterns: [
|
|
102
|
+
[pattern: 'vertaaux-results.xml', type: 'INCLUDE'],
|
|
103
|
+
[pattern: 'vertaaux-report.html', type: 'INCLUDE']
|
|
104
|
+
]
|
|
105
|
+
)
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
`;
|
|
110
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* V-mark ASCII banner for VertaaUX CLI.
|
|
3
|
+
*
|
|
4
|
+
* Displays a subtle gradient from lime to teal/cyan.
|
|
5
|
+
* Can be suppressed via --quiet, --no-banner, or non-TTY environments.
|
|
6
|
+
*/
|
|
7
|
+
export interface BannerOptions {
|
|
8
|
+
/** CLI version to display */
|
|
9
|
+
version: string;
|
|
10
|
+
/** Whether --quiet or -q was passed */
|
|
11
|
+
quiet?: boolean;
|
|
12
|
+
/** Whether --no-banner was passed */
|
|
13
|
+
noBanner?: boolean;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Show the V-mark banner with version and working directory.
|
|
17
|
+
*
|
|
18
|
+
* Banner is suppressed if:
|
|
19
|
+
* - --quiet or -q flag is set
|
|
20
|
+
* - --no-banner flag is set
|
|
21
|
+
* - Not running in a TTY (e.g., piped output)
|
|
22
|
+
*
|
|
23
|
+
* @param options - Banner display options
|
|
24
|
+
*/
|
|
25
|
+
export declare function showBanner(options: BannerOptions): void;
|
|
26
|
+
/**
|
|
27
|
+
* Get version from package.json.
|
|
28
|
+
* Falls back to "0.0.0" if unable to read.
|
|
29
|
+
*/
|
|
30
|
+
export declare function getVersion(): string;
|
|
31
|
+
//# sourceMappingURL=banner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"banner.d.ts","sourceRoot":"","sources":["../../src/ui/banner.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAwCH,MAAM,WAAW,aAAa;IAC5B,6BAA6B;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,uCAAuC;IACvC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,qCAAqC;IACrC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI,CA0BvD;AAED;;;GAGG;AACH,wBAAgB,UAAU,IAAI,MAAM,CAOnC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* V-mark ASCII banner for VertaaUX CLI.
|
|
3
|
+
*
|
|
4
|
+
* Displays a subtle gradient from lime to teal/cyan.
|
|
5
|
+
* Can be suppressed via --quiet, --no-banner, or non-TTY environments.
|
|
6
|
+
*/
|
|
7
|
+
import chalk from "chalk";
|
|
8
|
+
import { createRequire } from "module";
|
|
9
|
+
import { isTTY, shouldUseColor } from "../utils/detect-env.js";
|
|
10
|
+
// For JSON imports in ESM
|
|
11
|
+
const require = createRequire(import.meta.url);
|
|
12
|
+
// V-mark ASCII art (3 lines)
|
|
13
|
+
const V_MARK = [" \u2588\u2588\u2557 \u2588\u2588\u2557", " \u255a\u2588\u2588\u2557 \u2588\u2588\u2554\u255d", " \u255a\u2588\u2588\u2588\u2588\u2554\u255d"];
|
|
14
|
+
// Gradient colors: lime -> teal/cyan
|
|
15
|
+
const GRADIENT_COLORS = [
|
|
16
|
+
"#78FFB4", // Lime
|
|
17
|
+
"#6BEEBD", // Light teal
|
|
18
|
+
"#5EDDC6", // Teal
|
|
19
|
+
"#51CCCE", // Cyan-ish teal
|
|
20
|
+
];
|
|
21
|
+
/**
|
|
22
|
+
* Apply gradient to text by coloring each character.
|
|
23
|
+
*/
|
|
24
|
+
function applyGradient(text, colors) {
|
|
25
|
+
const colorCount = colors.length;
|
|
26
|
+
let result = "";
|
|
27
|
+
let colorIndex = 0;
|
|
28
|
+
for (const char of text) {
|
|
29
|
+
if (char !== " ") {
|
|
30
|
+
result += chalk.hex(colors[colorIndex % colorCount])(char);
|
|
31
|
+
colorIndex++;
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
result += char;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return result;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Show the V-mark banner with version and working directory.
|
|
41
|
+
*
|
|
42
|
+
* Banner is suppressed if:
|
|
43
|
+
* - --quiet or -q flag is set
|
|
44
|
+
* - --no-banner flag is set
|
|
45
|
+
* - Not running in a TTY (e.g., piped output)
|
|
46
|
+
*
|
|
47
|
+
* @param options - Banner display options
|
|
48
|
+
*/
|
|
49
|
+
export function showBanner(options) {
|
|
50
|
+
const { version, quiet = false, noBanner = false } = options;
|
|
51
|
+
// Skip banner in non-interactive or suppressed modes
|
|
52
|
+
if (quiet || noBanner || !isTTY()) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const useColor = shouldUseColor();
|
|
56
|
+
const cwd = process.cwd();
|
|
57
|
+
// Build banner lines
|
|
58
|
+
const lines = useColor
|
|
59
|
+
? [
|
|
60
|
+
`${applyGradient(V_MARK[0], GRADIENT_COLORS)} ${chalk.bold("VertaaUX")} v${version}`,
|
|
61
|
+
`${applyGradient(V_MARK[1], GRADIENT_COLORS)} ${chalk.dim(cwd)}`,
|
|
62
|
+
`${applyGradient(V_MARK[2], GRADIENT_COLORS)}`,
|
|
63
|
+
]
|
|
64
|
+
: [
|
|
65
|
+
`${V_MARK[0]} VertaaUX v${version}`,
|
|
66
|
+
`${V_MARK[1]} ${cwd}`,
|
|
67
|
+
`${V_MARK[2]}`,
|
|
68
|
+
];
|
|
69
|
+
// Write to stderr to avoid mixing with command output
|
|
70
|
+
process.stderr.write(lines.join("\n") + "\n\n");
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Get version from package.json.
|
|
74
|
+
* Falls back to "0.0.0" if unable to read.
|
|
75
|
+
*/
|
|
76
|
+
export function getVersion() {
|
|
77
|
+
try {
|
|
78
|
+
const pkg = require("../../package.json");
|
|
79
|
+
return pkg.version || "0.0.0";
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
return "0.0.0";
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Branded error formatting for VertaaUX CLI.
|
|
3
|
+
*
|
|
4
|
+
* Renders box-drawn error frames with brand colors in TTY mode,
|
|
5
|
+
* and structured plain text in non-TTY/CI/NO_COLOR environments.
|
|
6
|
+
*
|
|
7
|
+
* Integrates with Commander's configureOutput({ outputError }) hook
|
|
8
|
+
* to intercept and restyle all validation and argument errors.
|
|
9
|
+
*/
|
|
10
|
+
export interface ValidationErrorOptions {
|
|
11
|
+
flag: string;
|
|
12
|
+
value: string;
|
|
13
|
+
message: string;
|
|
14
|
+
hint?: string;
|
|
15
|
+
suggestion?: string;
|
|
16
|
+
validValues?: string[];
|
|
17
|
+
moreIssues?: number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Format a validation error with branded styling.
|
|
21
|
+
*
|
|
22
|
+
* Rich mode (TTY + color): Box-drawn frame with Unicode chars, brand colors.
|
|
23
|
+
* Plain mode (non-TTY/NO_COLOR/CI): Structured indented text, no decorations.
|
|
24
|
+
*/
|
|
25
|
+
export declare function formatValidationError(opts: ValidationErrorOptions): string;
|
|
26
|
+
/**
|
|
27
|
+
* Parse and reformat Commander error messages with branded styling.
|
|
28
|
+
*
|
|
29
|
+
* Commander passes raw error strings to configureOutput({ outputError }).
|
|
30
|
+
* This function parses them to extract flag/value information and applies
|
|
31
|
+
* branded formatting.
|
|
32
|
+
*
|
|
33
|
+
* InvalidArgumentError pattern:
|
|
34
|
+
* "error: option '--flag <arg>' argument 'value' is invalid. Detail"
|
|
35
|
+
*
|
|
36
|
+
* Other Commander errors (missing required, etc.) get branded prefix.
|
|
37
|
+
*/
|
|
38
|
+
export declare function formatCommanderError(rawMessage: string): string;
|
|
39
|
+
//# sourceMappingURL=diagnostics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diagnostics.d.ts","sourceRoot":"","sources":["../../src/ui/diagnostics.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAoCH,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,sBAAsB,GAAG,MAAM,CAK1E;AA8ED;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CA+C/D"}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Branded error formatting for VertaaUX CLI.
|
|
3
|
+
*
|
|
4
|
+
* Renders box-drawn error frames with brand colors in TTY mode,
|
|
5
|
+
* and structured plain text in non-TTY/CI/NO_COLOR environments.
|
|
6
|
+
*
|
|
7
|
+
* Integrates with Commander's configureOutput({ outputError }) hook
|
|
8
|
+
* to intercept and restyle all validation and argument errors.
|
|
9
|
+
*/
|
|
10
|
+
import chalk from "chalk";
|
|
11
|
+
import { shouldUseColor, isTTY, getTerminalWidth, } from "../utils/detect-env.js";
|
|
12
|
+
// ---------------------------------------------------------------------------
|
|
13
|
+
// Brand colors (matching banner.ts gradient)
|
|
14
|
+
// ---------------------------------------------------------------------------
|
|
15
|
+
const BRAND_ACCENT = "#78FFB4"; // Lime
|
|
16
|
+
const ERROR_COLOR = "#FF6B6B"; // Red
|
|
17
|
+
const HINT_COLOR = "#78FFB4"; // Brand lime for hints/suggestions
|
|
18
|
+
// ---------------------------------------------------------------------------
|
|
19
|
+
// Terminal capability detection
|
|
20
|
+
// ---------------------------------------------------------------------------
|
|
21
|
+
/**
|
|
22
|
+
* Determine if box-drawing characters and colors can be used.
|
|
23
|
+
* Returns false for dumb terminals, NO_COLOR, non-TTY, and CI.
|
|
24
|
+
*/
|
|
25
|
+
function canUseBoxDrawing() {
|
|
26
|
+
if (process.env.TERM === "dumb")
|
|
27
|
+
return false;
|
|
28
|
+
if (!shouldUseColor())
|
|
29
|
+
return false;
|
|
30
|
+
if (!isTTY())
|
|
31
|
+
return false;
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Format a validation error with branded styling.
|
|
36
|
+
*
|
|
37
|
+
* Rich mode (TTY + color): Box-drawn frame with Unicode chars, brand colors.
|
|
38
|
+
* Plain mode (non-TTY/NO_COLOR/CI): Structured indented text, no decorations.
|
|
39
|
+
*/
|
|
40
|
+
export function formatValidationError(opts) {
|
|
41
|
+
if (canUseBoxDrawing()) {
|
|
42
|
+
return boxDrawnError(opts);
|
|
43
|
+
}
|
|
44
|
+
return plainTextError(opts);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Rich box-drawn error frame for TTY terminals with color support.
|
|
48
|
+
*/
|
|
49
|
+
function boxDrawnError(opts) {
|
|
50
|
+
const width = Math.min(getTerminalWidth(), 72);
|
|
51
|
+
const prefix = chalk.hex(BRAND_ACCENT).bold("vertaa");
|
|
52
|
+
const border = chalk.dim(" " + "\u2500".repeat(width - 4));
|
|
53
|
+
const pipe = chalk.dim(" \u2502");
|
|
54
|
+
const lines = [
|
|
55
|
+
`${prefix} ${chalk.hex(ERROR_COLOR).bold("error")}: ${opts.message}`,
|
|
56
|
+
border,
|
|
57
|
+
`${pipe} ${chalk.dim("flag:")} --${opts.flag}`,
|
|
58
|
+
`${pipe} ${chalk.dim("value:")} ${chalk.yellow(opts.value)}`,
|
|
59
|
+
];
|
|
60
|
+
if (opts.suggestion) {
|
|
61
|
+
lines.push(pipe);
|
|
62
|
+
lines.push(`${pipe} ${chalk.hex(HINT_COLOR)("hint:")} Did you mean "${opts.suggestion}"?`);
|
|
63
|
+
}
|
|
64
|
+
if (opts.validValues && opts.validValues.length > 0) {
|
|
65
|
+
lines.push(`${pipe} ${chalk.dim("valid:")} ${chalk.dim(opts.validValues.join(", "))}`);
|
|
66
|
+
}
|
|
67
|
+
if (opts.hint) {
|
|
68
|
+
lines.push(pipe);
|
|
69
|
+
lines.push(`${pipe} ${chalk.dim(opts.hint)}`);
|
|
70
|
+
}
|
|
71
|
+
lines.push(border);
|
|
72
|
+
if (opts.moreIssues && opts.moreIssues > 0) {
|
|
73
|
+
lines.push(chalk.dim(` ...and ${opts.moreIssues} more issues`));
|
|
74
|
+
}
|
|
75
|
+
return lines.join("\n");
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Plain text error for non-TTY, NO_COLOR, CI, or TERM=dumb environments.
|
|
79
|
+
*/
|
|
80
|
+
function plainTextError(opts) {
|
|
81
|
+
const lines = [
|
|
82
|
+
`error: ${opts.message}`,
|
|
83
|
+
` flag: --${opts.flag}`,
|
|
84
|
+
` value: ${opts.value}`,
|
|
85
|
+
];
|
|
86
|
+
if (opts.suggestion) {
|
|
87
|
+
lines.push(` hint: Did you mean "${opts.suggestion}"?`);
|
|
88
|
+
}
|
|
89
|
+
if (opts.validValues && opts.validValues.length > 0) {
|
|
90
|
+
lines.push(` valid: ${opts.validValues.join(", ")}`);
|
|
91
|
+
}
|
|
92
|
+
if (opts.hint) {
|
|
93
|
+
lines.push(` ${opts.hint}`);
|
|
94
|
+
}
|
|
95
|
+
if (opts.moreIssues && opts.moreIssues > 0) {
|
|
96
|
+
lines.push(` ...and ${opts.moreIssues} more issues`);
|
|
97
|
+
}
|
|
98
|
+
return lines.join("\n");
|
|
99
|
+
}
|
|
100
|
+
// ---------------------------------------------------------------------------
|
|
101
|
+
// Commander error formatting
|
|
102
|
+
// ---------------------------------------------------------------------------
|
|
103
|
+
/**
|
|
104
|
+
* Parse and reformat Commander error messages with branded styling.
|
|
105
|
+
*
|
|
106
|
+
* Commander passes raw error strings to configureOutput({ outputError }).
|
|
107
|
+
* This function parses them to extract flag/value information and applies
|
|
108
|
+
* branded formatting.
|
|
109
|
+
*
|
|
110
|
+
* InvalidArgumentError pattern:
|
|
111
|
+
* "error: option '--flag <arg>' argument 'value' is invalid. Detail"
|
|
112
|
+
*
|
|
113
|
+
* Other Commander errors (missing required, etc.) get branded prefix.
|
|
114
|
+
*/
|
|
115
|
+
export function formatCommanderError(rawMessage) {
|
|
116
|
+
// Strip leading "error: " prefix that Commander adds
|
|
117
|
+
const msg = rawMessage.replace(/^error:\s*/i, "").trim();
|
|
118
|
+
// Pattern: option '--flag <arg>' argument 'value' is invalid. Detail
|
|
119
|
+
const invalidArgMatch = msg.match(/option\s+'(--[\w-]+)(?:\s+<[^>]+>)?'\s+argument\s+'([^']+)'\s+is invalid\.\s*(.*)/i);
|
|
120
|
+
if (invalidArgMatch) {
|
|
121
|
+
const [, flag, value, detail] = invalidArgMatch;
|
|
122
|
+
const flagName = flag.replace(/^--/, "");
|
|
123
|
+
// Try to extract suggestion from the detail (e.g., 'Did you mean "deep"?')
|
|
124
|
+
const suggestionMatch = detail.match(/Did you mean "([^"]+)"/);
|
|
125
|
+
const suggestion = suggestionMatch ? suggestionMatch[1] : undefined;
|
|
126
|
+
// Try to extract valid values from the detail
|
|
127
|
+
const validValuesMatch = detail.match(/Valid values?:\s*(.+)/i);
|
|
128
|
+
const validValues = validValuesMatch
|
|
129
|
+
? validValuesMatch[1].split(",").map((v) => v.trim())
|
|
130
|
+
: undefined;
|
|
131
|
+
return formatValidationError({
|
|
132
|
+
flag: flagName,
|
|
133
|
+
value,
|
|
134
|
+
message: detail || `invalid argument for --${flagName}`,
|
|
135
|
+
suggestion,
|
|
136
|
+
validValues,
|
|
137
|
+
hint: "Run vertaa <command> --help for all options",
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
// For other Commander errors: branded prefix with help hint
|
|
141
|
+
if (canUseBoxDrawing()) {
|
|
142
|
+
const prefix = chalk.hex(BRAND_ACCENT).bold("vertaa");
|
|
143
|
+
const errorLabel = chalk.hex(ERROR_COLOR).bold("error");
|
|
144
|
+
return [
|
|
145
|
+
`${prefix} ${errorLabel}: ${msg}`,
|
|
146
|
+
chalk.dim(" Run vertaa <command> --help for all options"),
|
|
147
|
+
].join("\n");
|
|
148
|
+
}
|
|
149
|
+
return [
|
|
150
|
+
`vertaa error: ${msg}`,
|
|
151
|
+
" Run vertaa <command> --help for all options",
|
|
152
|
+
].join("\n");
|
|
153
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Progress spinner wrapper for CLI.
|
|
3
|
+
*
|
|
4
|
+
* Provides a consistent interface for showing progress during long-running operations.
|
|
5
|
+
* Uses ora for elegant terminal spinners with TTY detection.
|
|
6
|
+
*/
|
|
7
|
+
import { type Ora } from "ora";
|
|
8
|
+
export interface SpinnerOptions {
|
|
9
|
+
/** Initial text to display */
|
|
10
|
+
text: string;
|
|
11
|
+
/** Color for the spinner (default: brand lime) */
|
|
12
|
+
color?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Create a new spinner instance.
|
|
16
|
+
*
|
|
17
|
+
* Spinner only displays in TTY mode. In non-TTY environments,
|
|
18
|
+
* returns a no-op spinner that still tracks state.
|
|
19
|
+
*
|
|
20
|
+
* @param text - Initial text to display next to spinner
|
|
21
|
+
* @returns An ora spinner instance
|
|
22
|
+
*/
|
|
23
|
+
export declare function createSpinner(text: string): Ora;
|
|
24
|
+
/**
|
|
25
|
+
* Update spinner text with optional progress indicator.
|
|
26
|
+
*
|
|
27
|
+
* @param spinner - The spinner instance to update
|
|
28
|
+
* @param text - New text to display
|
|
29
|
+
* @param current - Current progress count (optional)
|
|
30
|
+
* @param total - Total items count (optional)
|
|
31
|
+
*/
|
|
32
|
+
export declare function updateSpinner(spinner: Ora, text: string, current?: number, total?: number): void;
|
|
33
|
+
/**
|
|
34
|
+
* Complete spinner with success state.
|
|
35
|
+
*
|
|
36
|
+
* @param spinner - The spinner instance
|
|
37
|
+
* @param text - Success message to display
|
|
38
|
+
*/
|
|
39
|
+
export declare function succeedSpinner(spinner: Ora, text: string): void;
|
|
40
|
+
/**
|
|
41
|
+
* Complete spinner with failure state.
|
|
42
|
+
*
|
|
43
|
+
* @param spinner - The spinner instance
|
|
44
|
+
* @param text - Failure message to display
|
|
45
|
+
*/
|
|
46
|
+
export declare function failSpinner(spinner: Ora, text: string): void;
|
|
47
|
+
/**
|
|
48
|
+
* Complete spinner with warning state.
|
|
49
|
+
*
|
|
50
|
+
* @param spinner - The spinner instance
|
|
51
|
+
* @param text - Warning message to display
|
|
52
|
+
*/
|
|
53
|
+
export declare function warnSpinner(spinner: Ora, text: string): void;
|
|
54
|
+
/**
|
|
55
|
+
* Complete spinner with info state.
|
|
56
|
+
*
|
|
57
|
+
* @param spinner - The spinner instance
|
|
58
|
+
* @param text - Info message to display
|
|
59
|
+
*/
|
|
60
|
+
export declare function infoSpinner(spinner: Ora, text: string): void;
|
|
61
|
+
//# sourceMappingURL=spinner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spinner.d.ts","sourceRoot":"","sources":["../../src/ui/spinner.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAY,EAAE,KAAK,GAAG,EAAE,MAAM,KAAK,CAAC;AAapC,MAAM,WAAW,cAAc;IAC7B,8BAA8B;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,kDAAkD;IAClD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAiB/C;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,GAAG,EACZ,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,MAAM,EAChB,KAAK,CAAC,EAAE,MAAM,GACb,IAAI,CAcN;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAE/D;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAE5D;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAE5D;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAE5D"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Progress spinner wrapper for CLI.
|
|
3
|
+
*
|
|
4
|
+
* Provides a consistent interface for showing progress during long-running operations.
|
|
5
|
+
* Uses ora for elegant terminal spinners with TTY detection.
|
|
6
|
+
*/
|
|
7
|
+
import ora from "ora";
|
|
8
|
+
import chalk from "chalk";
|
|
9
|
+
import { isTTY, shouldUseColor } from "../utils/detect-env.js";
|
|
10
|
+
// Spinner style - classic dots for clean look
|
|
11
|
+
const SPINNER_STYLE = {
|
|
12
|
+
frames: ["\u2807", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"],
|
|
13
|
+
interval: 80,
|
|
14
|
+
};
|
|
15
|
+
// Brand color for spinner
|
|
16
|
+
const BRAND_COLOR = "#78FFB4";
|
|
17
|
+
/**
|
|
18
|
+
* Create a new spinner instance.
|
|
19
|
+
*
|
|
20
|
+
* Spinner only displays in TTY mode. In non-TTY environments,
|
|
21
|
+
* returns a no-op spinner that still tracks state.
|
|
22
|
+
*
|
|
23
|
+
* @param text - Initial text to display next to spinner
|
|
24
|
+
* @returns An ora spinner instance
|
|
25
|
+
*/
|
|
26
|
+
export function createSpinner(text) {
|
|
27
|
+
const useColor = shouldUseColor();
|
|
28
|
+
const spinner = ora({
|
|
29
|
+
text,
|
|
30
|
+
spinner: SPINNER_STYLE,
|
|
31
|
+
color: "cyan",
|
|
32
|
+
isEnabled: isTTY(),
|
|
33
|
+
stream: process.stderr, // Write to stderr to avoid mixing with command output
|
|
34
|
+
});
|
|
35
|
+
// Apply brand color if colors are enabled
|
|
36
|
+
if (useColor) {
|
|
37
|
+
spinner.color = "cyan";
|
|
38
|
+
}
|
|
39
|
+
return spinner;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Update spinner text with optional progress indicator.
|
|
43
|
+
*
|
|
44
|
+
* @param spinner - The spinner instance to update
|
|
45
|
+
* @param text - New text to display
|
|
46
|
+
* @param current - Current progress count (optional)
|
|
47
|
+
* @param total - Total items count (optional)
|
|
48
|
+
*/
|
|
49
|
+
export function updateSpinner(spinner, text, current, total) {
|
|
50
|
+
if (current !== undefined && total !== undefined) {
|
|
51
|
+
const progress = shouldUseColor()
|
|
52
|
+
? chalk.dim(`(${current}/${total})`)
|
|
53
|
+
: `(${current}/${total})`;
|
|
54
|
+
spinner.text = `${text} ${progress}`;
|
|
55
|
+
}
|
|
56
|
+
else if (current !== undefined) {
|
|
57
|
+
const progress = shouldUseColor()
|
|
58
|
+
? chalk.dim(`(${current})`)
|
|
59
|
+
: `(${current})`;
|
|
60
|
+
spinner.text = `${text} ${progress}`;
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
spinner.text = text;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Complete spinner with success state.
|
|
68
|
+
*
|
|
69
|
+
* @param spinner - The spinner instance
|
|
70
|
+
* @param text - Success message to display
|
|
71
|
+
*/
|
|
72
|
+
export function succeedSpinner(spinner, text) {
|
|
73
|
+
spinner.succeed(shouldUseColor() ? chalk.green(text) : text);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Complete spinner with failure state.
|
|
77
|
+
*
|
|
78
|
+
* @param spinner - The spinner instance
|
|
79
|
+
* @param text - Failure message to display
|
|
80
|
+
*/
|
|
81
|
+
export function failSpinner(spinner, text) {
|
|
82
|
+
spinner.fail(shouldUseColor() ? chalk.red(text) : text);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Complete spinner with warning state.
|
|
86
|
+
*
|
|
87
|
+
* @param spinner - The spinner instance
|
|
88
|
+
* @param text - Warning message to display
|
|
89
|
+
*/
|
|
90
|
+
export function warnSpinner(spinner, text) {
|
|
91
|
+
spinner.warn(shouldUseColor() ? chalk.yellow(text) : text);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Complete spinner with info state.
|
|
95
|
+
*
|
|
96
|
+
* @param spinner - The spinner instance
|
|
97
|
+
* @param text - Info message to display
|
|
98
|
+
*/
|
|
99
|
+
export function infoSpinner(spinner, text) {
|
|
100
|
+
spinner.info(shouldUseColor() ? chalk.cyan(text) : text);
|
|
101
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Table formatting utilities for CLI output.
|
|
3
|
+
*
|
|
4
|
+
* Uses cli-table3 for clean table rendering with severity-based coloring.
|
|
5
|
+
* Respects terminal width and provides truncation for long content.
|
|
6
|
+
*/
|
|
7
|
+
export interface Issue {
|
|
8
|
+
id?: string;
|
|
9
|
+
severity?: string;
|
|
10
|
+
category?: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
title?: string;
|
|
13
|
+
selector?: string;
|
|
14
|
+
wcag_reference?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface FormatTableOptions {
|
|
17
|
+
/** Maximum width for description column */
|
|
18
|
+
maxDescriptionWidth?: number;
|
|
19
|
+
/** Maximum width for selector column */
|
|
20
|
+
maxSelectorWidth?: number;
|
|
21
|
+
/** Whether to show the selector column */
|
|
22
|
+
showSelector?: boolean;
|
|
23
|
+
/** Whether to show the category column */
|
|
24
|
+
showCategory?: boolean;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Group issues by severity.
|
|
28
|
+
*/
|
|
29
|
+
export declare function groupBySeverity(issues: Issue[]): Map<string, Issue[]>;
|
|
30
|
+
/**
|
|
31
|
+
* Group issues by category.
|
|
32
|
+
*/
|
|
33
|
+
export declare function groupByCategory(issues: Issue[]): Map<string, Issue[]>;
|
|
34
|
+
/**
|
|
35
|
+
* Format issues into a table string.
|
|
36
|
+
*
|
|
37
|
+
* Columns: Severity | ID | Description | Selector (optional)
|
|
38
|
+
* Issues are sorted by severity (critical -> info).
|
|
39
|
+
*
|
|
40
|
+
* @param issues - Array of issues to format
|
|
41
|
+
* @param options - Formatting options
|
|
42
|
+
* @returns Formatted table string
|
|
43
|
+
*/
|
|
44
|
+
export declare function formatIssuesTable(issues: Issue[], options?: FormatTableOptions): string;
|
|
45
|
+
export interface Score {
|
|
46
|
+
category: string;
|
|
47
|
+
score: number;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Format scores into a table string.
|
|
51
|
+
*
|
|
52
|
+
* @param scores - Object mapping category names to scores
|
|
53
|
+
* @returns Formatted table string
|
|
54
|
+
*/
|
|
55
|
+
export declare function formatScoresTable(scores: Record<string, number | unknown>): string;
|
|
56
|
+
/**
|
|
57
|
+
* Format a summary line showing issue counts by severity.
|
|
58
|
+
*
|
|
59
|
+
* @param issues - Array of issues
|
|
60
|
+
* @returns Summary string like "3 critical, 5 serious, 12 minor issues"
|
|
61
|
+
*/
|
|
62
|
+
export declare function formatIssueSummary(issues: Issue[]): string;
|
|
63
|
+
//# sourceMappingURL=table.d.ts.map
|