@vertaaux/cli 0.5.0 → 0.5.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/CHANGELOG.md +19 -0
- package/README.md +28 -1
- package/dist/app/interactive-app.d.ts +2 -0
- package/dist/app/interactive-app.d.ts.map +1 -1
- package/dist/app/interactive-app.js +26 -7
- package/dist/app/menu/categories.d.ts +2 -2
- package/dist/app/menu/categories.d.ts.map +1 -1
- package/dist/app/menu/categories.js +3 -18
- package/dist/app/views/command-runner.d.ts.map +1 -1
- package/dist/app/views/command-runner.js +52 -9
- package/dist/app/views/help-overlay.d.ts +1 -1
- package/dist/app/views/help-overlay.d.ts.map +1 -1
- package/dist/app/views/help-overlay.js +5 -4
- package/dist/commands/a11y.d.ts +4 -2
- package/dist/commands/a11y.d.ts.map +1 -1
- package/dist/commands/a11y.js +82 -9
- package/dist/commands/audit/index.d.ts.map +1 -1
- package/dist/commands/audit/index.js +33 -8
- package/dist/commands/audit/output.d.ts.map +1 -1
- package/dist/commands/audit/output.js +3 -4
- package/dist/commands/audit/policy.d.ts +10 -2
- package/dist/commands/audit/policy.d.ts.map +1 -1
- package/dist/commands/audit/policy.js +47 -2
- package/dist/commands/audit/types.d.ts +1 -0
- package/dist/commands/audit/types.d.ts.map +1 -1
- package/dist/commands/baseline.d.ts +1 -0
- package/dist/commands/baseline.d.ts.map +1 -1
- package/dist/commands/baseline.js +26 -12
- package/dist/commands/comment.d.ts.map +1 -1
- package/dist/commands/comment.js +8 -7
- package/dist/commands/compare.js +3 -3
- package/dist/commands/diff.d.ts +2 -0
- package/dist/commands/diff.d.ts.map +1 -1
- package/dist/commands/diff.js +23 -12
- package/dist/commands/doc.js +2 -2
- package/dist/commands/doctor.js +2 -2
- package/dist/commands/explain.js +3 -3
- package/dist/commands/fix-all.js +2 -2
- package/dist/commands/fix-plan.d.ts.map +1 -1
- package/dist/commands/fix-plan.js +4 -3
- package/dist/commands/fix.js +5 -5
- package/dist/commands/patch-review.js +2 -2
- package/dist/commands/policy.js +2 -2
- package/dist/commands/release-notes.js +3 -3
- package/dist/commands/suggest.d.ts.map +1 -1
- package/dist/commands/suggest.js +28 -2
- package/dist/commands/triage.js +3 -3
- package/dist/commands/verify.js +3 -3
- package/dist/config/schema.d.ts +4 -0
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/output/envelope.d.ts +8 -1
- package/dist/output/envelope.d.ts.map +1 -1
- package/dist/output/envelope.js +24 -6
- package/dist/policy/schema.d.ts +137 -0
- package/dist/policy/schema.d.ts.map +1 -1
- package/dist/policy/schema.js +107 -0
- package/dist/prompts/command-catalog.js +9 -9
- package/dist/utils/client.d.ts.map +1 -1
- package/dist/utils/client.js +30 -28
- package/dist/utils/root-args.d.ts +12 -0
- package/dist/utils/root-args.d.ts.map +1 -0
- package/dist/utils/root-args.js +44 -0
- package/dist/utils/stdin.d.ts +7 -0
- package/dist/utils/stdin.d.ts.map +1 -1
- package/dist/utils/stdin.js +32 -2
- package/node_modules/@vertaaux/tui/dist/index.cjs +505 -9
- package/node_modules/@vertaaux/tui/dist/index.cjs.map +1 -1
- package/node_modules/@vertaaux/tui/dist/index.js +502 -8
- package/node_modules/@vertaaux/tui/dist/index.js.map +1 -1
- package/node_modules/@vertaaux/tui/package.json +2 -3
- package/node_modules/chalk/license +9 -0
- package/node_modules/chalk/package.json +83 -0
- package/node_modules/chalk/readme.md +297 -0
- package/node_modules/chalk/source/index.d.ts +325 -0
- package/node_modules/chalk/source/index.js +225 -0
- package/node_modules/chalk/source/utilities.js +33 -0
- package/node_modules/chalk/source/vendor/ansi-styles/index.d.ts +236 -0
- package/node_modules/chalk/source/vendor/ansi-styles/index.js +223 -0
- package/node_modules/chalk/source/vendor/supports-color/browser.d.ts +1 -0
- package/node_modules/chalk/source/vendor/supports-color/browser.js +34 -0
- package/node_modules/chalk/source/vendor/supports-color/index.d.ts +55 -0
- package/node_modules/chalk/source/vendor/supports-color/index.js +190 -0
- package/package.json +9 -2
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import process from 'node:process';
|
|
2
|
+
import os from 'node:os';
|
|
3
|
+
import tty from 'node:tty';
|
|
4
|
+
|
|
5
|
+
// From: https://github.com/sindresorhus/has-flag/blob/main/index.js
|
|
6
|
+
/// function hasFlag(flag, argv = globalThis.Deno?.args ?? process.argv) {
|
|
7
|
+
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process.argv) {
|
|
8
|
+
const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
|
|
9
|
+
const position = argv.indexOf(prefix + flag);
|
|
10
|
+
const terminatorPosition = argv.indexOf('--');
|
|
11
|
+
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const {env} = process;
|
|
15
|
+
|
|
16
|
+
let flagForceColor;
|
|
17
|
+
if (
|
|
18
|
+
hasFlag('no-color')
|
|
19
|
+
|| hasFlag('no-colors')
|
|
20
|
+
|| hasFlag('color=false')
|
|
21
|
+
|| hasFlag('color=never')
|
|
22
|
+
) {
|
|
23
|
+
flagForceColor = 0;
|
|
24
|
+
} else if (
|
|
25
|
+
hasFlag('color')
|
|
26
|
+
|| hasFlag('colors')
|
|
27
|
+
|| hasFlag('color=true')
|
|
28
|
+
|| hasFlag('color=always')
|
|
29
|
+
) {
|
|
30
|
+
flagForceColor = 1;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function envForceColor() {
|
|
34
|
+
if ('FORCE_COLOR' in env) {
|
|
35
|
+
if (env.FORCE_COLOR === 'true') {
|
|
36
|
+
return 1;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (env.FORCE_COLOR === 'false') {
|
|
40
|
+
return 0;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function translateLevel(level) {
|
|
48
|
+
if (level === 0) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return {
|
|
53
|
+
level,
|
|
54
|
+
hasBasic: true,
|
|
55
|
+
has256: level >= 2,
|
|
56
|
+
has16m: level >= 3,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function _supportsColor(haveStream, {streamIsTTY, sniffFlags = true} = {}) {
|
|
61
|
+
const noFlagForceColor = envForceColor();
|
|
62
|
+
if (noFlagForceColor !== undefined) {
|
|
63
|
+
flagForceColor = noFlagForceColor;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
|
|
67
|
+
|
|
68
|
+
if (forceColor === 0) {
|
|
69
|
+
return 0;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (sniffFlags) {
|
|
73
|
+
if (hasFlag('color=16m')
|
|
74
|
+
|| hasFlag('color=full')
|
|
75
|
+
|| hasFlag('color=truecolor')) {
|
|
76
|
+
return 3;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (hasFlag('color=256')) {
|
|
80
|
+
return 2;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Check for Azure DevOps pipelines.
|
|
85
|
+
// Has to be above the `!streamIsTTY` check.
|
|
86
|
+
if ('TF_BUILD' in env && 'AGENT_NAME' in env) {
|
|
87
|
+
return 1;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (haveStream && !streamIsTTY && forceColor === undefined) {
|
|
91
|
+
return 0;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const min = forceColor || 0;
|
|
95
|
+
|
|
96
|
+
if (env.TERM === 'dumb') {
|
|
97
|
+
return min;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (process.platform === 'win32') {
|
|
101
|
+
// Windows 10 build 10586 is the first Windows release that supports 256 colors.
|
|
102
|
+
// Windows 10 build 14931 is the first release that supports 16m/TrueColor.
|
|
103
|
+
const osRelease = os.release().split('.');
|
|
104
|
+
if (
|
|
105
|
+
Number(osRelease[0]) >= 10
|
|
106
|
+
&& Number(osRelease[2]) >= 10_586
|
|
107
|
+
) {
|
|
108
|
+
return Number(osRelease[2]) >= 14_931 ? 3 : 2;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return 1;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if ('CI' in env) {
|
|
115
|
+
if (['GITHUB_ACTIONS', 'GITEA_ACTIONS', 'CIRCLECI'].some(key => key in env)) {
|
|
116
|
+
return 3;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (['TRAVIS', 'APPVEYOR', 'GITLAB_CI', 'BUILDKITE', 'DRONE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
|
|
120
|
+
return 1;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return min;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
if ('TEAMCITY_VERSION' in env) {
|
|
127
|
+
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (env.COLORTERM === 'truecolor') {
|
|
131
|
+
return 3;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if (env.TERM === 'xterm-kitty') {
|
|
135
|
+
return 3;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (env.TERM === 'xterm-ghostty') {
|
|
139
|
+
return 3;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (env.TERM === 'wezterm') {
|
|
143
|
+
return 3;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
if ('TERM_PROGRAM' in env) {
|
|
147
|
+
const version = Number.parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
|
|
148
|
+
|
|
149
|
+
switch (env.TERM_PROGRAM) {
|
|
150
|
+
case 'iTerm.app': {
|
|
151
|
+
return version >= 3 ? 3 : 2;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
case 'Apple_Terminal': {
|
|
155
|
+
return 2;
|
|
156
|
+
}
|
|
157
|
+
// No default
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if (/-256(color)?$/i.test(env.TERM)) {
|
|
162
|
+
return 2;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
|
166
|
+
return 1;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
if ('COLORTERM' in env) {
|
|
170
|
+
return 1;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
return min;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export function createSupportsColor(stream, options = {}) {
|
|
177
|
+
const level = _supportsColor(stream, {
|
|
178
|
+
streamIsTTY: stream && stream.isTTY,
|
|
179
|
+
...options,
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
return translateLevel(level);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
const supportsColor = {
|
|
186
|
+
stdout: createSupportsColor({isTTY: tty.isatty(1)}),
|
|
187
|
+
stderr: createSupportsColor({isTTY: tty.isatty(2)}),
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
export default supportsColor;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vertaaux/cli",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "Run automated UX audits, accessibility checks, and performance analysis from the terminal or CI pipelines. Supports policy gating, SARIF output, and multi-page crawling. See https://github.com/PetriLahdelma/vertaa/tree/main/cli#readme for full docs.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -41,21 +41,28 @@
|
|
|
41
41
|
"@vertaaux/tui"
|
|
42
42
|
],
|
|
43
43
|
"scripts": {
|
|
44
|
+
"prebuild": "node scripts/fix-node-pty-permissions.mjs 2>/dev/null || true",
|
|
44
45
|
"build": "tsc",
|
|
45
46
|
"dev": "tsc -w",
|
|
46
47
|
"start": "node dist/index.js",
|
|
47
48
|
"postinstall": "node scripts/fix-node-pty-permissions.mjs 2>/dev/null || true",
|
|
49
|
+
"pretest": "node scripts/fix-node-pty-permissions.mjs 2>/dev/null || true",
|
|
48
50
|
"prepublishOnly": "npm run build && node scripts/verify-package.mjs",
|
|
49
51
|
"test": "vitest run --config vitest.config.ts --exclude tests/e2e/**/*.test.ts",
|
|
52
|
+
"pretest:e2e": "node scripts/fix-node-pty-permissions.mjs 2>/dev/null || true",
|
|
50
53
|
"test:e2e": "vitest run --config vitest.config.ts tests/e2e/cli-contract.test.ts",
|
|
54
|
+
"pretest:e2e:package": "node scripts/fix-node-pty-permissions.mjs 2>/dev/null || true",
|
|
51
55
|
"test:e2e:package": "vitest run --config vitest.config.ts tests/e2e/package-install.test.ts",
|
|
56
|
+
"pretest:e2e:ui": "node scripts/fix-node-pty-permissions.mjs 2>/dev/null || true",
|
|
52
57
|
"test:e2e:ui": "vitest --ui --config vitest.config.ts tests/e2e/cli-contract.test.ts",
|
|
58
|
+
"pretest:pty": "node scripts/fix-node-pty-permissions.mjs 2>/dev/null || true",
|
|
53
59
|
"test:pty": "vitest run --config vitest.config.pty.ts",
|
|
60
|
+
"pretest:snapshot": "node scripts/fix-node-pty-permissions.mjs 2>/dev/null || true",
|
|
54
61
|
"test:snapshot": "vitest run --config vitest.config.snapshot.ts"
|
|
55
62
|
},
|
|
56
63
|
"dependencies": {
|
|
57
64
|
"@inquirer/prompts": "^8.2.0",
|
|
58
|
-
"@vertaaux/sdk": "
|
|
65
|
+
"@vertaaux/sdk": "^2.0.0",
|
|
59
66
|
"@vertaaux/tui": "file:../packages/tui",
|
|
60
67
|
"ajv": "^8.17.1",
|
|
61
68
|
"ajv-formats": "^3.0.1",
|