@vertaaux/cli 0.4.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 +116 -0
- package/MIGRATION.md +239 -0
- package/README.md +62 -17
- package/dist/app/interactive-app.d.ts +103 -0
- package/dist/app/interactive-app.d.ts.map +1 -0
- package/dist/app/interactive-app.js +328 -0
- package/dist/app/layout/canvas.d.ts +23 -0
- package/dist/app/layout/canvas.d.ts.map +1 -0
- package/dist/app/layout/canvas.js +36 -0
- package/dist/app/layout/footer.d.ts +31 -0
- package/dist/app/layout/footer.d.ts.map +1 -0
- package/dist/app/layout/footer.js +41 -0
- package/dist/app/layout/header.d.ts +20 -0
- package/dist/app/layout/header.d.ts.map +1 -0
- package/dist/app/layout/header.js +27 -0
- package/dist/app/menu/categories.d.ts +20 -0
- package/dist/app/menu/categories.d.ts.map +1 -0
- package/dist/app/menu/categories.js +166 -0
- package/dist/app/menu/filter.d.ts +17 -0
- package/dist/app/menu/filter.d.ts.map +1 -0
- package/dist/app/menu/filter.js +33 -0
- package/dist/app/menu/menu-view.d.ts +35 -0
- package/dist/app/menu/menu-view.d.ts.map +1 -0
- package/dist/app/menu/menu-view.js +230 -0
- package/dist/app/menu/recent.d.ts +24 -0
- package/dist/app/menu/recent.d.ts.map +1 -0
- package/dist/app/menu/recent.js +49 -0
- package/dist/app/types.d.ts +43 -0
- package/dist/app/types.d.ts.map +1 -0
- package/dist/app/types.js +7 -0
- package/dist/app/views/command-runner.d.ts +36 -0
- package/dist/app/views/command-runner.d.ts.map +1 -0
- package/dist/app/views/command-runner.js +415 -0
- package/dist/app/views/help-overlay.d.ts +21 -0
- package/dist/app/views/help-overlay.d.ts.map +1 -0
- package/dist/app/views/help-overlay.js +46 -0
- package/dist/auth/ci-token.d.ts +8 -2
- package/dist/auth/ci-token.d.ts.map +1 -1
- package/dist/auth/ci-token.js +15 -30
- package/dist/auth/device-flow.d.ts +2 -1
- package/dist/auth/device-flow.d.ts.map +1 -1
- package/dist/auth/device-flow.js +13 -10
- package/dist/auth/token-store.d.ts.map +1 -1
- package/dist/auth/token-store.js +12 -2
- package/dist/baseline/diff.d.ts +2 -2
- package/dist/baseline/diff.d.ts.map +1 -1
- package/dist/baseline/diff.js +15 -34
- package/dist/commands/a11y.d.ts +11 -0
- package/dist/commands/a11y.d.ts.map +1 -0
- package/dist/commands/a11y.js +149 -0
- package/dist/commands/audit/artifacts.d.ts +27 -0
- package/dist/commands/audit/artifacts.d.ts.map +1 -0
- package/dist/commands/audit/artifacts.js +158 -0
- package/dist/commands/audit/ci-detection.d.ts +18 -0
- package/dist/commands/audit/ci-detection.d.ts.map +1 -0
- package/dist/commands/audit/ci-detection.js +71 -0
- package/dist/commands/audit/explain.d.ts +11 -0
- package/dist/commands/audit/explain.d.ts.map +1 -0
- package/dist/commands/audit/explain.js +45 -0
- package/dist/commands/audit/filters.d.ts +17 -0
- package/dist/commands/audit/filters.d.ts.map +1 -0
- package/dist/commands/audit/filters.js +40 -0
- package/dist/commands/audit/index.d.ts +18 -0
- package/dist/commands/audit/index.d.ts.map +1 -0
- package/dist/commands/audit/index.js +589 -0
- package/dist/commands/audit/output.d.ts +32 -0
- package/dist/commands/audit/output.d.ts.map +1 -0
- package/dist/commands/audit/output.js +129 -0
- package/dist/commands/audit/policy.d.ts +27 -0
- package/dist/commands/audit/policy.d.ts.map +1 -0
- package/dist/commands/audit/policy.js +147 -0
- package/dist/commands/audit/scoring.d.ts +23 -0
- package/dist/commands/audit/scoring.d.ts.map +1 -0
- package/dist/commands/audit/scoring.js +70 -0
- package/dist/commands/audit/types.d.ts +89 -0
- package/dist/commands/audit/types.d.ts.map +1 -0
- package/dist/commands/audit/types.js +8 -0
- package/dist/commands/audit.d.ts +2 -60
- package/dist/commands/audit.d.ts.map +1 -1
- package/dist/commands/audit.js +2 -1097
- package/dist/commands/baseline.d.ts +2 -0
- package/dist/commands/baseline.d.ts.map +1 -1
- package/dist/commands/baseline.js +221 -123
- package/dist/commands/comment.d.ts +22 -0
- package/dist/commands/comment.d.ts.map +1 -1
- package/dist/commands/comment.js +127 -62
- package/dist/commands/compare.d.ts +17 -0
- package/dist/commands/compare.d.ts.map +1 -1
- package/dist/commands/compare.js +288 -181
- package/dist/commands/diff.d.ts +7 -0
- package/dist/commands/diff.d.ts.map +1 -1
- package/dist/commands/diff.js +181 -143
- package/dist/commands/doc.d.ts +10 -0
- package/dist/commands/doc.d.ts.map +1 -1
- package/dist/commands/doc.js +135 -77
- package/dist/commands/doctor.d.ts +2 -0
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +166 -19
- package/dist/commands/download.d.ts +10 -0
- package/dist/commands/download.d.ts.map +1 -1
- package/dist/commands/download.js +169 -112
- package/dist/commands/explain.d.ts +5 -0
- package/dist/commands/explain.d.ts.map +1 -1
- package/dist/commands/explain.js +242 -156
- package/dist/commands/fix-all.d.ts +25 -0
- package/dist/commands/fix-all.d.ts.map +1 -0
- package/dist/commands/fix-all.js +206 -0
- package/dist/commands/fix-plan.d.ts +9 -0
- package/dist/commands/fix-plan.d.ts.map +1 -1
- package/dist/commands/fix-plan.js +154 -90
- package/dist/commands/fix.d.ts +17 -0
- package/dist/commands/fix.d.ts.map +1 -0
- package/dist/commands/fix.js +111 -0
- package/dist/commands/init.d.ts +11 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +94 -42
- package/dist/commands/login.d.ts +18 -0
- package/dist/commands/login.d.ts.map +1 -1
- package/dist/commands/login.js +263 -92
- package/dist/commands/patch-review.d.ts +11 -0
- package/dist/commands/patch-review.d.ts.map +1 -1
- package/dist/commands/patch-review.js +160 -98
- package/dist/commands/policy.d.ts +31 -0
- package/dist/commands/policy.d.ts.map +1 -1
- package/dist/commands/policy.js +270 -125
- package/dist/commands/release-notes.d.ts +10 -0
- package/dist/commands/release-notes.d.ts.map +1 -1
- package/dist/commands/release-notes.js +128 -74
- package/dist/commands/scan.d.ts +13 -0
- package/dist/commands/scan.d.ts.map +1 -0
- package/dist/commands/scan.js +133 -0
- package/dist/commands/status.d.ts +9 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +81 -0
- package/dist/commands/suggest.d.ts +10 -0
- package/dist/commands/suggest.d.ts.map +1 -1
- package/dist/commands/suggest.js +180 -83
- package/dist/commands/triage.d.ts +35 -0
- package/dist/commands/triage.d.ts.map +1 -1
- package/dist/commands/triage.js +207 -82
- package/dist/commands/upload.d.ts +9 -0
- package/dist/commands/upload.d.ts.map +1 -1
- package/dist/commands/upload.js +140 -101
- package/dist/commands/verify.d.ts +13 -0
- package/dist/commands/verify.d.ts.map +1 -0
- package/dist/commands/verify.js +118 -0
- package/dist/config/schema.d.ts +4 -0
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +127 -991
- package/dist/interactive/fix-wizard.d.ts +3 -0
- package/dist/interactive/fix-wizard.d.ts.map +1 -1
- package/dist/interactive/fix-wizard.js +130 -112
- package/dist/interactive/init-wizard.d.ts +3 -1
- package/dist/interactive/init-wizard.d.ts.map +1 -1
- package/dist/interactive/init-wizard.js +207 -138
- package/dist/interactive/prompts.d.ts +7 -3
- package/dist/interactive/prompts.d.ts.map +1 -1
- package/dist/interactive/prompts.js +44 -23
- package/dist/output/envelope.d.ts +9 -0
- package/dist/output/envelope.d.ts.map +1 -1
- package/dist/output/envelope.js +37 -3
- package/dist/output/factory.d.ts +2 -1
- package/dist/output/factory.d.ts.map +1 -1
- package/dist/output/html.d.ts +2 -1
- package/dist/output/html.d.ts.map +1 -1
- package/dist/output/html.js +3 -2
- package/dist/output/human.d.ts +2 -1
- package/dist/output/human.d.ts.map +1 -1
- package/dist/output/human.js +3 -2
- package/dist/output/json.d.ts +2 -1
- package/dist/output/json.d.ts.map +1 -1
- package/dist/output/junit.d.ts +2 -1
- package/dist/output/junit.d.ts.map +1 -1
- package/dist/output/sarif.d.ts +2 -1
- package/dist/output/sarif.d.ts.map +1 -1
- 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/types.d.ts +74 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/ui/banner.d.ts +34 -0
- package/dist/ui/banner.d.ts.map +1 -1
- package/dist/ui/banner.js +97 -5
- package/dist/ui/diagnostics.d.ts +9 -4
- package/dist/ui/diagnostics.d.ts.map +1 -1
- package/dist/ui/diagnostics.js +32 -82
- package/dist/ui/strings.d.ts +373 -0
- package/dist/ui/strings.d.ts.map +1 -0
- package/dist/ui/strings.js +499 -0
- package/dist/ui/table.d.ts +0 -2
- package/dist/ui/table.d.ts.map +1 -1
- package/dist/ui/table.js +3 -4
- package/dist/utils/api-client.d.ts +46 -0
- package/dist/utils/api-client.d.ts.map +1 -0
- package/dist/utils/api-client.js +170 -0
- package/dist/utils/client.d.ts +29 -18
- package/dist/utils/client.d.ts.map +1 -1
- package/dist/utils/client.js +104 -12
- package/dist/utils/formatters.d.ts +38 -0
- package/dist/utils/formatters.d.ts.map +1 -0
- package/dist/utils/formatters.js +277 -0
- 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/dist/utils/url-classify.d.ts.map +1 -1
- package/dist/utils/url-classify.js +24 -3
- package/node_modules/@vertaaux/tui/dist/index.cjs +1216 -27
- package/node_modules/@vertaaux/tui/dist/index.cjs.map +1 -1
- package/node_modules/@vertaaux/tui/dist/index.d.cts +361 -4
- package/node_modules/@vertaaux/tui/dist/index.d.ts +361 -4
- package/node_modules/@vertaaux/tui/dist/index.js +1189 -27
- 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 +20 -5
- package/dist/commands/client.d.ts +0 -14
- package/dist/commands/client.d.ts.map +0 -1
- package/dist/commands/client.js +0 -362
- package/dist/commands/drift.d.ts +0 -15
- package/dist/commands/drift.d.ts.map +0 -1
- package/dist/commands/drift.js +0 -309
- package/dist/commands/protect.d.ts +0 -16
- package/dist/commands/protect.d.ts.map +0 -1
- package/dist/commands/protect.js +0 -323
- package/dist/commands/report.d.ts +0 -15
- package/dist/commands/report.d.ts.map +0 -1
- package/dist/commands/report.js +0 -214
- package/dist/policy/sync.d.ts +0 -67
- package/dist/policy/sync.d.ts.map +0 -1
- package/dist/policy/sync.js +0 -147
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var process2 = require('process');
|
|
4
|
+
var os = require('os');
|
|
5
|
+
var tty = require('tty');
|
|
4
6
|
var events = require('events');
|
|
5
7
|
|
|
6
8
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
7
9
|
|
|
8
|
-
var
|
|
10
|
+
var process2__default = /*#__PURE__*/_interopDefault(process2);
|
|
11
|
+
var os__default = /*#__PURE__*/_interopDefault(os);
|
|
12
|
+
var tty__default = /*#__PURE__*/_interopDefault(tty);
|
|
9
13
|
|
|
10
14
|
var __defProp = Object.defineProperty;
|
|
11
15
|
var __export = (target, all) => {
|
|
@@ -142,6 +146,498 @@ function truncate(str, maxWidth) {
|
|
|
142
146
|
if (maxWidth <= 3) return stripped.slice(0, maxWidth);
|
|
143
147
|
return stripped.slice(0, maxWidth - 1) + "\u2026";
|
|
144
148
|
}
|
|
149
|
+
|
|
150
|
+
// node_modules/chalk/source/vendor/ansi-styles/index.js
|
|
151
|
+
var ANSI_BACKGROUND_OFFSET = 10;
|
|
152
|
+
var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
|
|
153
|
+
var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
|
|
154
|
+
var wrapAnsi16m = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
|
|
155
|
+
var styles = {
|
|
156
|
+
modifier: {
|
|
157
|
+
reset: [0, 0],
|
|
158
|
+
// 21 isn't widely supported and 22 does the same thing
|
|
159
|
+
bold: [1, 22],
|
|
160
|
+
dim: [2, 22],
|
|
161
|
+
italic: [3, 23],
|
|
162
|
+
underline: [4, 24],
|
|
163
|
+
overline: [53, 55],
|
|
164
|
+
inverse: [7, 27],
|
|
165
|
+
hidden: [8, 28],
|
|
166
|
+
strikethrough: [9, 29]
|
|
167
|
+
},
|
|
168
|
+
color: {
|
|
169
|
+
black: [30, 39],
|
|
170
|
+
red: [31, 39],
|
|
171
|
+
green: [32, 39],
|
|
172
|
+
yellow: [33, 39],
|
|
173
|
+
blue: [34, 39],
|
|
174
|
+
magenta: [35, 39],
|
|
175
|
+
cyan: [36, 39],
|
|
176
|
+
white: [37, 39],
|
|
177
|
+
// Bright color
|
|
178
|
+
blackBright: [90, 39],
|
|
179
|
+
gray: [90, 39],
|
|
180
|
+
// Alias of `blackBright`
|
|
181
|
+
grey: [90, 39],
|
|
182
|
+
// Alias of `blackBright`
|
|
183
|
+
redBright: [91, 39],
|
|
184
|
+
greenBright: [92, 39],
|
|
185
|
+
yellowBright: [93, 39],
|
|
186
|
+
blueBright: [94, 39],
|
|
187
|
+
magentaBright: [95, 39],
|
|
188
|
+
cyanBright: [96, 39],
|
|
189
|
+
whiteBright: [97, 39]
|
|
190
|
+
},
|
|
191
|
+
bgColor: {
|
|
192
|
+
bgBlack: [40, 49],
|
|
193
|
+
bgRed: [41, 49],
|
|
194
|
+
bgGreen: [42, 49],
|
|
195
|
+
bgYellow: [43, 49],
|
|
196
|
+
bgBlue: [44, 49],
|
|
197
|
+
bgMagenta: [45, 49],
|
|
198
|
+
bgCyan: [46, 49],
|
|
199
|
+
bgWhite: [47, 49],
|
|
200
|
+
// Bright color
|
|
201
|
+
bgBlackBright: [100, 49],
|
|
202
|
+
bgGray: [100, 49],
|
|
203
|
+
// Alias of `bgBlackBright`
|
|
204
|
+
bgGrey: [100, 49],
|
|
205
|
+
// Alias of `bgBlackBright`
|
|
206
|
+
bgRedBright: [101, 49],
|
|
207
|
+
bgGreenBright: [102, 49],
|
|
208
|
+
bgYellowBright: [103, 49],
|
|
209
|
+
bgBlueBright: [104, 49],
|
|
210
|
+
bgMagentaBright: [105, 49],
|
|
211
|
+
bgCyanBright: [106, 49],
|
|
212
|
+
bgWhiteBright: [107, 49]
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
Object.keys(styles.modifier);
|
|
216
|
+
var foregroundColorNames = Object.keys(styles.color);
|
|
217
|
+
var backgroundColorNames = Object.keys(styles.bgColor);
|
|
218
|
+
[...foregroundColorNames, ...backgroundColorNames];
|
|
219
|
+
function assembleStyles() {
|
|
220
|
+
const codes = /* @__PURE__ */ new Map();
|
|
221
|
+
for (const [groupName, group] of Object.entries(styles)) {
|
|
222
|
+
for (const [styleName, style2] of Object.entries(group)) {
|
|
223
|
+
styles[styleName] = {
|
|
224
|
+
open: `\x1B[${style2[0]}m`,
|
|
225
|
+
close: `\x1B[${style2[1]}m`
|
|
226
|
+
};
|
|
227
|
+
group[styleName] = styles[styleName];
|
|
228
|
+
codes.set(style2[0], style2[1]);
|
|
229
|
+
}
|
|
230
|
+
Object.defineProperty(styles, groupName, {
|
|
231
|
+
value: group,
|
|
232
|
+
enumerable: false
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
Object.defineProperty(styles, "codes", {
|
|
236
|
+
value: codes,
|
|
237
|
+
enumerable: false
|
|
238
|
+
});
|
|
239
|
+
styles.color.close = "\x1B[39m";
|
|
240
|
+
styles.bgColor.close = "\x1B[49m";
|
|
241
|
+
styles.color.ansi = wrapAnsi16();
|
|
242
|
+
styles.color.ansi256 = wrapAnsi256();
|
|
243
|
+
styles.color.ansi16m = wrapAnsi16m();
|
|
244
|
+
styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
|
|
245
|
+
styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
|
|
246
|
+
styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
|
|
247
|
+
Object.defineProperties(styles, {
|
|
248
|
+
rgbToAnsi256: {
|
|
249
|
+
value(red, green, blue) {
|
|
250
|
+
if (red === green && green === blue) {
|
|
251
|
+
if (red < 8) {
|
|
252
|
+
return 16;
|
|
253
|
+
}
|
|
254
|
+
if (red > 248) {
|
|
255
|
+
return 231;
|
|
256
|
+
}
|
|
257
|
+
return Math.round((red - 8) / 247 * 24) + 232;
|
|
258
|
+
}
|
|
259
|
+
return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
|
|
260
|
+
},
|
|
261
|
+
enumerable: false
|
|
262
|
+
},
|
|
263
|
+
hexToRgb: {
|
|
264
|
+
value(hex) {
|
|
265
|
+
const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
|
|
266
|
+
if (!matches) {
|
|
267
|
+
return [0, 0, 0];
|
|
268
|
+
}
|
|
269
|
+
let [colorString] = matches;
|
|
270
|
+
if (colorString.length === 3) {
|
|
271
|
+
colorString = [...colorString].map((character) => character + character).join("");
|
|
272
|
+
}
|
|
273
|
+
const integer = Number.parseInt(colorString, 16);
|
|
274
|
+
return [
|
|
275
|
+
/* eslint-disable no-bitwise */
|
|
276
|
+
integer >> 16 & 255,
|
|
277
|
+
integer >> 8 & 255,
|
|
278
|
+
integer & 255
|
|
279
|
+
/* eslint-enable no-bitwise */
|
|
280
|
+
];
|
|
281
|
+
},
|
|
282
|
+
enumerable: false
|
|
283
|
+
},
|
|
284
|
+
hexToAnsi256: {
|
|
285
|
+
value: (hex) => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
|
|
286
|
+
enumerable: false
|
|
287
|
+
},
|
|
288
|
+
ansi256ToAnsi: {
|
|
289
|
+
value(code) {
|
|
290
|
+
if (code < 8) {
|
|
291
|
+
return 30 + code;
|
|
292
|
+
}
|
|
293
|
+
if (code < 16) {
|
|
294
|
+
return 90 + (code - 8);
|
|
295
|
+
}
|
|
296
|
+
let red;
|
|
297
|
+
let green;
|
|
298
|
+
let blue;
|
|
299
|
+
if (code >= 232) {
|
|
300
|
+
red = ((code - 232) * 10 + 8) / 255;
|
|
301
|
+
green = red;
|
|
302
|
+
blue = red;
|
|
303
|
+
} else {
|
|
304
|
+
code -= 16;
|
|
305
|
+
const remainder = code % 36;
|
|
306
|
+
red = Math.floor(code / 36) / 5;
|
|
307
|
+
green = Math.floor(remainder / 6) / 5;
|
|
308
|
+
blue = remainder % 6 / 5;
|
|
309
|
+
}
|
|
310
|
+
const value = Math.max(red, green, blue) * 2;
|
|
311
|
+
if (value === 0) {
|
|
312
|
+
return 30;
|
|
313
|
+
}
|
|
314
|
+
let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
|
|
315
|
+
if (value === 2) {
|
|
316
|
+
result += 60;
|
|
317
|
+
}
|
|
318
|
+
return result;
|
|
319
|
+
},
|
|
320
|
+
enumerable: false
|
|
321
|
+
},
|
|
322
|
+
rgbToAnsi: {
|
|
323
|
+
value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
|
|
324
|
+
enumerable: false
|
|
325
|
+
},
|
|
326
|
+
hexToAnsi: {
|
|
327
|
+
value: (hex) => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),
|
|
328
|
+
enumerable: false
|
|
329
|
+
}
|
|
330
|
+
});
|
|
331
|
+
return styles;
|
|
332
|
+
}
|
|
333
|
+
var ansiStyles = assembleStyles();
|
|
334
|
+
var ansi_styles_default = ansiStyles;
|
|
335
|
+
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process2__default.default.argv) {
|
|
336
|
+
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
337
|
+
const position = argv.indexOf(prefix + flag);
|
|
338
|
+
const terminatorPosition = argv.indexOf("--");
|
|
339
|
+
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
340
|
+
}
|
|
341
|
+
var { env } = process2__default.default;
|
|
342
|
+
var flagForceColor;
|
|
343
|
+
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
|
|
344
|
+
flagForceColor = 0;
|
|
345
|
+
} else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
|
|
346
|
+
flagForceColor = 1;
|
|
347
|
+
}
|
|
348
|
+
function envForceColor() {
|
|
349
|
+
if ("FORCE_COLOR" in env) {
|
|
350
|
+
if (env.FORCE_COLOR === "true") {
|
|
351
|
+
return 1;
|
|
352
|
+
}
|
|
353
|
+
if (env.FORCE_COLOR === "false") {
|
|
354
|
+
return 0;
|
|
355
|
+
}
|
|
356
|
+
return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
function translateLevel(level) {
|
|
360
|
+
if (level === 0) {
|
|
361
|
+
return false;
|
|
362
|
+
}
|
|
363
|
+
return {
|
|
364
|
+
level,
|
|
365
|
+
hasBasic: true,
|
|
366
|
+
has256: level >= 2,
|
|
367
|
+
has16m: level >= 3
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
371
|
+
const noFlagForceColor = envForceColor();
|
|
372
|
+
if (noFlagForceColor !== void 0) {
|
|
373
|
+
flagForceColor = noFlagForceColor;
|
|
374
|
+
}
|
|
375
|
+
const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
|
|
376
|
+
if (forceColor === 0) {
|
|
377
|
+
return 0;
|
|
378
|
+
}
|
|
379
|
+
if (sniffFlags) {
|
|
380
|
+
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
|
|
381
|
+
return 3;
|
|
382
|
+
}
|
|
383
|
+
if (hasFlag("color=256")) {
|
|
384
|
+
return 2;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
if ("TF_BUILD" in env && "AGENT_NAME" in env) {
|
|
388
|
+
return 1;
|
|
389
|
+
}
|
|
390
|
+
if (haveStream && !streamIsTTY && forceColor === void 0) {
|
|
391
|
+
return 0;
|
|
392
|
+
}
|
|
393
|
+
const min = forceColor || 0;
|
|
394
|
+
if (env.TERM === "dumb") {
|
|
395
|
+
return min;
|
|
396
|
+
}
|
|
397
|
+
if (process2__default.default.platform === "win32") {
|
|
398
|
+
const osRelease = os__default.default.release().split(".");
|
|
399
|
+
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
400
|
+
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
401
|
+
}
|
|
402
|
+
return 1;
|
|
403
|
+
}
|
|
404
|
+
if ("CI" in env) {
|
|
405
|
+
if (["GITHUB_ACTIONS", "GITEA_ACTIONS", "CIRCLECI"].some((key) => key in env)) {
|
|
406
|
+
return 3;
|
|
407
|
+
}
|
|
408
|
+
if (["TRAVIS", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
|
|
409
|
+
return 1;
|
|
410
|
+
}
|
|
411
|
+
return min;
|
|
412
|
+
}
|
|
413
|
+
if ("TEAMCITY_VERSION" in env) {
|
|
414
|
+
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
415
|
+
}
|
|
416
|
+
if (env.COLORTERM === "truecolor") {
|
|
417
|
+
return 3;
|
|
418
|
+
}
|
|
419
|
+
if (env.TERM === "xterm-kitty") {
|
|
420
|
+
return 3;
|
|
421
|
+
}
|
|
422
|
+
if (env.TERM === "xterm-ghostty") {
|
|
423
|
+
return 3;
|
|
424
|
+
}
|
|
425
|
+
if (env.TERM === "wezterm") {
|
|
426
|
+
return 3;
|
|
427
|
+
}
|
|
428
|
+
if ("TERM_PROGRAM" in env) {
|
|
429
|
+
const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
430
|
+
switch (env.TERM_PROGRAM) {
|
|
431
|
+
case "iTerm.app": {
|
|
432
|
+
return version >= 3 ? 3 : 2;
|
|
433
|
+
}
|
|
434
|
+
case "Apple_Terminal": {
|
|
435
|
+
return 2;
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
if (/-256(color)?$/i.test(env.TERM)) {
|
|
440
|
+
return 2;
|
|
441
|
+
}
|
|
442
|
+
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
|
443
|
+
return 1;
|
|
444
|
+
}
|
|
445
|
+
if ("COLORTERM" in env) {
|
|
446
|
+
return 1;
|
|
447
|
+
}
|
|
448
|
+
return min;
|
|
449
|
+
}
|
|
450
|
+
function createSupportsColor(stream, options = {}) {
|
|
451
|
+
const level = _supportsColor(stream, {
|
|
452
|
+
streamIsTTY: stream && stream.isTTY,
|
|
453
|
+
...options
|
|
454
|
+
});
|
|
455
|
+
return translateLevel(level);
|
|
456
|
+
}
|
|
457
|
+
var supportsColor = {
|
|
458
|
+
stdout: createSupportsColor({ isTTY: tty__default.default.isatty(1) }),
|
|
459
|
+
stderr: createSupportsColor({ isTTY: tty__default.default.isatty(2) })
|
|
460
|
+
};
|
|
461
|
+
var supports_color_default = supportsColor;
|
|
462
|
+
|
|
463
|
+
// node_modules/chalk/source/utilities.js
|
|
464
|
+
function stringReplaceAll(string, substring, replacer) {
|
|
465
|
+
let index = string.indexOf(substring);
|
|
466
|
+
if (index === -1) {
|
|
467
|
+
return string;
|
|
468
|
+
}
|
|
469
|
+
const substringLength = substring.length;
|
|
470
|
+
let endIndex = 0;
|
|
471
|
+
let returnValue = "";
|
|
472
|
+
do {
|
|
473
|
+
returnValue += string.slice(endIndex, index) + substring + replacer;
|
|
474
|
+
endIndex = index + substringLength;
|
|
475
|
+
index = string.indexOf(substring, endIndex);
|
|
476
|
+
} while (index !== -1);
|
|
477
|
+
returnValue += string.slice(endIndex);
|
|
478
|
+
return returnValue;
|
|
479
|
+
}
|
|
480
|
+
function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
|
|
481
|
+
let endIndex = 0;
|
|
482
|
+
let returnValue = "";
|
|
483
|
+
do {
|
|
484
|
+
const gotCR = string[index - 1] === "\r";
|
|
485
|
+
returnValue += string.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
|
|
486
|
+
endIndex = index + 1;
|
|
487
|
+
index = string.indexOf("\n", endIndex);
|
|
488
|
+
} while (index !== -1);
|
|
489
|
+
returnValue += string.slice(endIndex);
|
|
490
|
+
return returnValue;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
// node_modules/chalk/source/index.js
|
|
494
|
+
var { stdout: stdoutColor, stderr: stderrColor } = supports_color_default;
|
|
495
|
+
var GENERATOR = /* @__PURE__ */ Symbol("GENERATOR");
|
|
496
|
+
var STYLER = /* @__PURE__ */ Symbol("STYLER");
|
|
497
|
+
var IS_EMPTY = /* @__PURE__ */ Symbol("IS_EMPTY");
|
|
498
|
+
var levelMapping = [
|
|
499
|
+
"ansi",
|
|
500
|
+
"ansi",
|
|
501
|
+
"ansi256",
|
|
502
|
+
"ansi16m"
|
|
503
|
+
];
|
|
504
|
+
var styles2 = /* @__PURE__ */ Object.create(null);
|
|
505
|
+
var applyOptions = (object, options = {}) => {
|
|
506
|
+
if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
|
|
507
|
+
throw new Error("The `level` option should be an integer from 0 to 3");
|
|
508
|
+
}
|
|
509
|
+
const colorLevel = stdoutColor ? stdoutColor.level : 0;
|
|
510
|
+
object.level = options.level === void 0 ? colorLevel : options.level;
|
|
511
|
+
};
|
|
512
|
+
var chalkFactory = (options) => {
|
|
513
|
+
const chalk2 = (...strings) => strings.join(" ");
|
|
514
|
+
applyOptions(chalk2, options);
|
|
515
|
+
Object.setPrototypeOf(chalk2, createChalk.prototype);
|
|
516
|
+
return chalk2;
|
|
517
|
+
};
|
|
518
|
+
function createChalk(options) {
|
|
519
|
+
return chalkFactory(options);
|
|
520
|
+
}
|
|
521
|
+
Object.setPrototypeOf(createChalk.prototype, Function.prototype);
|
|
522
|
+
for (const [styleName, style2] of Object.entries(ansi_styles_default)) {
|
|
523
|
+
styles2[styleName] = {
|
|
524
|
+
get() {
|
|
525
|
+
const builder = createBuilder(this, createStyler(style2.open, style2.close, this[STYLER]), this[IS_EMPTY]);
|
|
526
|
+
Object.defineProperty(this, styleName, { value: builder });
|
|
527
|
+
return builder;
|
|
528
|
+
}
|
|
529
|
+
};
|
|
530
|
+
}
|
|
531
|
+
styles2.visible = {
|
|
532
|
+
get() {
|
|
533
|
+
const builder = createBuilder(this, this[STYLER], true);
|
|
534
|
+
Object.defineProperty(this, "visible", { value: builder });
|
|
535
|
+
return builder;
|
|
536
|
+
}
|
|
537
|
+
};
|
|
538
|
+
var getModelAnsi = (model, level, type, ...arguments_) => {
|
|
539
|
+
if (model === "rgb") {
|
|
540
|
+
if (level === "ansi16m") {
|
|
541
|
+
return ansi_styles_default[type].ansi16m(...arguments_);
|
|
542
|
+
}
|
|
543
|
+
if (level === "ansi256") {
|
|
544
|
+
return ansi_styles_default[type].ansi256(ansi_styles_default.rgbToAnsi256(...arguments_));
|
|
545
|
+
}
|
|
546
|
+
return ansi_styles_default[type].ansi(ansi_styles_default.rgbToAnsi(...arguments_));
|
|
547
|
+
}
|
|
548
|
+
if (model === "hex") {
|
|
549
|
+
return getModelAnsi("rgb", level, type, ...ansi_styles_default.hexToRgb(...arguments_));
|
|
550
|
+
}
|
|
551
|
+
return ansi_styles_default[type][model](...arguments_);
|
|
552
|
+
};
|
|
553
|
+
var usedModels = ["rgb", "hex", "ansi256"];
|
|
554
|
+
for (const model of usedModels) {
|
|
555
|
+
styles2[model] = {
|
|
556
|
+
get() {
|
|
557
|
+
const { level } = this;
|
|
558
|
+
return function(...arguments_) {
|
|
559
|
+
const styler = createStyler(getModelAnsi(model, levelMapping[level], "color", ...arguments_), ansi_styles_default.color.close, this[STYLER]);
|
|
560
|
+
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
561
|
+
};
|
|
562
|
+
}
|
|
563
|
+
};
|
|
564
|
+
const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
|
|
565
|
+
styles2[bgModel] = {
|
|
566
|
+
get() {
|
|
567
|
+
const { level } = this;
|
|
568
|
+
return function(...arguments_) {
|
|
569
|
+
const styler = createStyler(getModelAnsi(model, levelMapping[level], "bgColor", ...arguments_), ansi_styles_default.bgColor.close, this[STYLER]);
|
|
570
|
+
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
571
|
+
};
|
|
572
|
+
}
|
|
573
|
+
};
|
|
574
|
+
}
|
|
575
|
+
var proto = Object.defineProperties(() => {
|
|
576
|
+
}, {
|
|
577
|
+
...styles2,
|
|
578
|
+
level: {
|
|
579
|
+
enumerable: true,
|
|
580
|
+
get() {
|
|
581
|
+
return this[GENERATOR].level;
|
|
582
|
+
},
|
|
583
|
+
set(level) {
|
|
584
|
+
this[GENERATOR].level = level;
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
});
|
|
588
|
+
var createStyler = (open, close, parent) => {
|
|
589
|
+
let openAll;
|
|
590
|
+
let closeAll;
|
|
591
|
+
if (parent === void 0) {
|
|
592
|
+
openAll = open;
|
|
593
|
+
closeAll = close;
|
|
594
|
+
} else {
|
|
595
|
+
openAll = parent.openAll + open;
|
|
596
|
+
closeAll = close + parent.closeAll;
|
|
597
|
+
}
|
|
598
|
+
return {
|
|
599
|
+
open,
|
|
600
|
+
close,
|
|
601
|
+
openAll,
|
|
602
|
+
closeAll,
|
|
603
|
+
parent
|
|
604
|
+
};
|
|
605
|
+
};
|
|
606
|
+
var createBuilder = (self, _styler, _isEmpty) => {
|
|
607
|
+
const builder = (...arguments_) => applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
|
|
608
|
+
Object.setPrototypeOf(builder, proto);
|
|
609
|
+
builder[GENERATOR] = self;
|
|
610
|
+
builder[STYLER] = _styler;
|
|
611
|
+
builder[IS_EMPTY] = _isEmpty;
|
|
612
|
+
return builder;
|
|
613
|
+
};
|
|
614
|
+
var applyStyle = (self, string) => {
|
|
615
|
+
if (self.level <= 0 || !string) {
|
|
616
|
+
return self[IS_EMPTY] ? "" : string;
|
|
617
|
+
}
|
|
618
|
+
let styler = self[STYLER];
|
|
619
|
+
if (styler === void 0) {
|
|
620
|
+
return string;
|
|
621
|
+
}
|
|
622
|
+
const { openAll, closeAll } = styler;
|
|
623
|
+
if (string.includes("\x1B")) {
|
|
624
|
+
while (styler !== void 0) {
|
|
625
|
+
string = stringReplaceAll(string, styler.close, styler.open);
|
|
626
|
+
styler = styler.parent;
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
const lfIndex = string.indexOf("\n");
|
|
630
|
+
if (lfIndex !== -1) {
|
|
631
|
+
string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
|
|
632
|
+
}
|
|
633
|
+
return openAll + string + closeAll;
|
|
634
|
+
};
|
|
635
|
+
Object.defineProperties(createChalk.prototype, styles2);
|
|
636
|
+
var chalk = createChalk();
|
|
637
|
+
createChalk({ level: stderrColor ? stderrColor.level : 0 });
|
|
638
|
+
var source_default = chalk;
|
|
639
|
+
|
|
640
|
+
// src/theme.ts
|
|
145
641
|
var brand = {
|
|
146
642
|
lime: "#78FFB4",
|
|
147
643
|
tealLight: "#6BEEBD",
|
|
@@ -202,25 +698,37 @@ var tokens = {
|
|
|
202
698
|
var _colorEnabled = true;
|
|
203
699
|
function setColorEnabled(enabled) {
|
|
204
700
|
_colorEnabled = enabled;
|
|
701
|
+
source_default.level = enabled ? 3 : 0;
|
|
205
702
|
}
|
|
206
703
|
function isColorEnabled() {
|
|
207
704
|
return _colorEnabled;
|
|
208
705
|
}
|
|
209
706
|
function colorize(text, hex) {
|
|
210
707
|
if (!_colorEnabled) return text;
|
|
211
|
-
return
|
|
708
|
+
return source_default.hex(hex)(text);
|
|
212
709
|
}
|
|
213
710
|
function boldColor(text, hex) {
|
|
214
711
|
if (!_colorEnabled) return text;
|
|
215
|
-
return
|
|
712
|
+
return source_default.hex(hex).bold(text);
|
|
216
713
|
}
|
|
217
714
|
function dim(text) {
|
|
218
715
|
if (!_colorEnabled) return text;
|
|
219
|
-
return
|
|
716
|
+
return source_default.dim(text);
|
|
220
717
|
}
|
|
221
718
|
function bold(text) {
|
|
222
719
|
if (!_colorEnabled) return text;
|
|
223
|
-
return
|
|
720
|
+
return source_default.bold(text);
|
|
721
|
+
}
|
|
722
|
+
function severityColor(level) {
|
|
723
|
+
const normalized = (level || "info").toLowerCase();
|
|
724
|
+
const hex = severity[normalized] ?? severity.info;
|
|
725
|
+
const isBold = ["critical", "error", "serious", "warning"].includes(normalized);
|
|
726
|
+
const label2 = normalized.toUpperCase();
|
|
727
|
+
return isBold ? boldColor(label2, hex) : colorize(label2, hex);
|
|
728
|
+
}
|
|
729
|
+
function bgColor(text, hex) {
|
|
730
|
+
if (!_colorEnabled) return text;
|
|
731
|
+
return source_default.bgHex(hex)(text);
|
|
224
732
|
}
|
|
225
733
|
function applyGradient(text, colors = gradient) {
|
|
226
734
|
if (!_colorEnabled) return text;
|
|
@@ -229,7 +737,7 @@ function applyGradient(text, colors = gradient) {
|
|
|
229
737
|
let idx = 0;
|
|
230
738
|
for (const char of text) {
|
|
231
739
|
if (char !== " " && char !== "\n") {
|
|
232
|
-
result +=
|
|
740
|
+
result += source_default.hex(colors[idx % colorCount])(char);
|
|
233
741
|
idx++;
|
|
234
742
|
} else {
|
|
235
743
|
result += char;
|
|
@@ -260,7 +768,7 @@ function shouldUseColor() {
|
|
|
260
768
|
return isTTY();
|
|
261
769
|
}
|
|
262
770
|
function getTerminalWidth() {
|
|
263
|
-
return process.stderr.columns || 80;
|
|
771
|
+
return parseInt(process.env.COLUMNS ?? "", 10) || process.stderr.columns || 80;
|
|
264
772
|
}
|
|
265
773
|
function getTerminalHeight() {
|
|
266
774
|
return process.stderr.rows || 24;
|
|
@@ -273,6 +781,96 @@ function supportsUnicode() {
|
|
|
273
781
|
return true;
|
|
274
782
|
}
|
|
275
783
|
|
|
784
|
+
// src/symbols.ts
|
|
785
|
+
var SYMBOL_MAP = {
|
|
786
|
+
nerd: {
|
|
787
|
+
// Nerd Font Material Design icons (private use area U+F0000+)
|
|
788
|
+
success: "\u{F012C}",
|
|
789
|
+
// nf-md-check_circle
|
|
790
|
+
fail: "\u{F0156}",
|
|
791
|
+
// nf-md-close_circle
|
|
792
|
+
warning: "\u{F01A6}",
|
|
793
|
+
// nf-md-alert
|
|
794
|
+
info: "\u{F02FD}",
|
|
795
|
+
// nf-md-information
|
|
796
|
+
pending: "\u25EF",
|
|
797
|
+
// ◯ large circle (no NF required)
|
|
798
|
+
running: "\u25C9"
|
|
799
|
+
// ◉ fisheye (no NF required)
|
|
800
|
+
},
|
|
801
|
+
unicode: {
|
|
802
|
+
success: "\u2713",
|
|
803
|
+
fail: "\u2717",
|
|
804
|
+
warning: "\u25B2",
|
|
805
|
+
info: "\u2139",
|
|
806
|
+
pending: "\u25CB",
|
|
807
|
+
running: "\u25C6"
|
|
808
|
+
},
|
|
809
|
+
ascii: {
|
|
810
|
+
success: "+",
|
|
811
|
+
fail: "x",
|
|
812
|
+
warning: "!",
|
|
813
|
+
info: "i",
|
|
814
|
+
pending: "-",
|
|
815
|
+
running: "*"
|
|
816
|
+
}
|
|
817
|
+
};
|
|
818
|
+
var _tier = "unicode";
|
|
819
|
+
function setSymbolTier(tier) {
|
|
820
|
+
_tier = tier;
|
|
821
|
+
}
|
|
822
|
+
function sym(role) {
|
|
823
|
+
return SYMBOL_MAP[_tier][role];
|
|
824
|
+
}
|
|
825
|
+
function detectSymbolTier(options = {}) {
|
|
826
|
+
if (options.plainMode) return "ascii";
|
|
827
|
+
const envIcons = process.env.VERTAA_ICONS;
|
|
828
|
+
if (envIcons === "nerd" || envIcons === "unicode" || envIcons === "ascii") {
|
|
829
|
+
return envIcons;
|
|
830
|
+
}
|
|
831
|
+
const termProgram = process.env.TERM_PROGRAM;
|
|
832
|
+
if (termProgram === "iTerm.app" || termProgram === "WezTerm") {
|
|
833
|
+
return "nerd";
|
|
834
|
+
}
|
|
835
|
+
if (supportsUnicode()) return "unicode";
|
|
836
|
+
return "ascii";
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
// src/plain.ts
|
|
840
|
+
var _plainMode = false;
|
|
841
|
+
function setPlainMode(enabled) {
|
|
842
|
+
_plainMode = enabled;
|
|
843
|
+
if (enabled) {
|
|
844
|
+
setColorEnabled(false);
|
|
845
|
+
setSymbolTier("ascii");
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
function isPlainMode() {
|
|
849
|
+
return _plainMode;
|
|
850
|
+
}
|
|
851
|
+
function toPlainBox(str) {
|
|
852
|
+
if (!_plainMode) return str;
|
|
853
|
+
return str.replace(/[─━═]/g, "-").replace(/[│┃║]/g, "|").replace(/[╭╮╰╯]/g, "+").replace(/[┌┍┎┏╔]/g, "+").replace(/[┐┑┒┓╗]/g, "+").replace(/[└┕┖┗╚]/g, "+").replace(/[┘┙┚┛╝]/g, "+").replace(/[├┤┬┴┼]/g, "+");
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
// src/easing.ts
|
|
857
|
+
function linear(t) {
|
|
858
|
+
return t;
|
|
859
|
+
}
|
|
860
|
+
function easeIn(t) {
|
|
861
|
+
return t * t;
|
|
862
|
+
}
|
|
863
|
+
function easeOut(t) {
|
|
864
|
+
return t * (2 - t);
|
|
865
|
+
}
|
|
866
|
+
function easeInOut(t) {
|
|
867
|
+
return t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t;
|
|
868
|
+
}
|
|
869
|
+
function lerp(from, to, t, ease = linear) {
|
|
870
|
+
const clamped = Math.max(0, Math.min(1, t));
|
|
871
|
+
return from + (to - from) * ease(clamped);
|
|
872
|
+
}
|
|
873
|
+
|
|
276
874
|
// src/primitives/text.ts
|
|
277
875
|
var text_exports = {};
|
|
278
876
|
__export(text_exports, {
|
|
@@ -391,7 +989,8 @@ function box(content, opts = {}) {
|
|
|
391
989
|
result.push(bc(chars.vertical) + " ".repeat(termWidth - 2) + bc(chars.vertical));
|
|
392
990
|
}
|
|
393
991
|
result.push(renderBottomBorder(chars, termWidth, subtitle, borderColor));
|
|
394
|
-
|
|
992
|
+
const output = result.join("\n");
|
|
993
|
+
return toPlainBox(output);
|
|
395
994
|
}
|
|
396
995
|
function renderNoBorder(content, padding) {
|
|
397
996
|
const pad = " ".repeat(padding);
|
|
@@ -536,6 +1135,9 @@ function alignCell(text, width, align) {
|
|
|
536
1135
|
// src/primitives/spinner.ts
|
|
537
1136
|
var BRAILLE_FRAMES = ["\u287F", "\u28DF", "\u28EF", "\u28F7", "\u28FE", "\u28FD", "\u28FB", "\u28BF"];
|
|
538
1137
|
var FRAME_INTERVAL = 80;
|
|
1138
|
+
function spinnerFrame(frameIndex) {
|
|
1139
|
+
return BRAILLE_FRAMES[frameIndex % BRAILLE_FRAMES.length];
|
|
1140
|
+
}
|
|
539
1141
|
function createSpinner(text, output = process.stderr) {
|
|
540
1142
|
let frameIndex = 0;
|
|
541
1143
|
let currentText = text;
|
|
@@ -545,6 +1147,11 @@ function createSpinner(text, output = process.stderr) {
|
|
|
545
1147
|
const enabled = isTTY();
|
|
546
1148
|
function render() {
|
|
547
1149
|
if (!enabled) return;
|
|
1150
|
+
if (isPlainMode()) {
|
|
1151
|
+
output.write(`[running] ${currentText}
|
|
1152
|
+
`);
|
|
1153
|
+
return;
|
|
1154
|
+
}
|
|
548
1155
|
const frame = isColorEnabled() ? colorize(BRAILLE_FRAMES[frameIndex], brand.lime) : BRAILLE_FRAMES[frameIndex];
|
|
549
1156
|
const phaseStr = currentPhase ? dim(` [${currentPhase}]`) : "";
|
|
550
1157
|
const line = `${frame} ${currentText}${phaseStr}`;
|
|
@@ -569,8 +1176,12 @@ function createSpinner(text, output = process.stderr) {
|
|
|
569
1176
|
running = true;
|
|
570
1177
|
frameIndex = 0;
|
|
571
1178
|
if (enabled) {
|
|
572
|
-
|
|
573
|
-
|
|
1179
|
+
if (isPlainMode()) {
|
|
1180
|
+
render();
|
|
1181
|
+
} else {
|
|
1182
|
+
render();
|
|
1183
|
+
timer = setInterval(render, FRAME_INTERVAL);
|
|
1184
|
+
}
|
|
574
1185
|
}
|
|
575
1186
|
},
|
|
576
1187
|
stop() {
|
|
@@ -589,23 +1200,23 @@ function createSpinner(text, output = process.stderr) {
|
|
|
589
1200
|
},
|
|
590
1201
|
succeed(text2) {
|
|
591
1202
|
instance.stop();
|
|
592
|
-
const
|
|
593
|
-
writeFinalLine(
|
|
1203
|
+
const icon = isColorEnabled() ? colorize(sym("success"), "#4ADE80") : sym("success");
|
|
1204
|
+
writeFinalLine(icon, text2);
|
|
594
1205
|
},
|
|
595
1206
|
fail(text2) {
|
|
596
1207
|
instance.stop();
|
|
597
|
-
const
|
|
598
|
-
writeFinalLine(
|
|
1208
|
+
const icon = isColorEnabled() ? colorize(sym("fail"), "#F87171") : sym("fail");
|
|
1209
|
+
writeFinalLine(icon, text2);
|
|
599
1210
|
},
|
|
600
1211
|
warn(text2) {
|
|
601
1212
|
instance.stop();
|
|
602
|
-
const
|
|
603
|
-
writeFinalLine(
|
|
1213
|
+
const icon = isColorEnabled() ? colorize(sym("warning"), "#FACC15") : sym("warning");
|
|
1214
|
+
writeFinalLine(icon, text2);
|
|
604
1215
|
},
|
|
605
1216
|
info(text2) {
|
|
606
1217
|
instance.stop();
|
|
607
|
-
const
|
|
608
|
-
writeFinalLine(
|
|
1218
|
+
const icon = isColorEnabled() ? colorize(sym("info"), "#6BCEFF") : sym("info");
|
|
1219
|
+
writeFinalLine(icon, text2);
|
|
609
1220
|
}
|
|
610
1221
|
};
|
|
611
1222
|
return instance;
|
|
@@ -623,7 +1234,7 @@ function createProgressBar(opts) {
|
|
|
623
1234
|
output = process.stderr
|
|
624
1235
|
} = opts;
|
|
625
1236
|
const enabled = isTTY();
|
|
626
|
-
|
|
1237
|
+
const startTime = Date.now();
|
|
627
1238
|
function renderBar(current, barWidth) {
|
|
628
1239
|
const pct = total > 0 ? Math.min(current / total, 1) : 0;
|
|
629
1240
|
const pctStr = `${Math.round(pct * 100)}%`;
|
|
@@ -645,8 +1256,8 @@ function createProgressBar(opts) {
|
|
|
645
1256
|
if (!enabled) return;
|
|
646
1257
|
output.write(screen.clearLine + "\r");
|
|
647
1258
|
if (message) {
|
|
648
|
-
const
|
|
649
|
-
output.write(`${
|
|
1259
|
+
const sym2 = isColorEnabled() ? colorize("\u2713", "#4ADE80") : "\u2713";
|
|
1260
|
+
output.write(`${sym2} ${message}
|
|
650
1261
|
`);
|
|
651
1262
|
}
|
|
652
1263
|
},
|
|
@@ -654,8 +1265,8 @@ function createProgressBar(opts) {
|
|
|
654
1265
|
if (!enabled) return;
|
|
655
1266
|
output.write(screen.clearLine + "\r");
|
|
656
1267
|
if (message) {
|
|
657
|
-
const
|
|
658
|
-
output.write(`${
|
|
1268
|
+
const sym2 = isColorEnabled() ? colorize("\u2717", "#F87171") : "\u2717";
|
|
1269
|
+
output.write(`${sym2} ${message}
|
|
659
1270
|
`);
|
|
660
1271
|
}
|
|
661
1272
|
},
|
|
@@ -862,6 +1473,200 @@ function parseDiff(diffText) {
|
|
|
862
1473
|
return lines;
|
|
863
1474
|
}
|
|
864
1475
|
|
|
1476
|
+
// src/primitives/error-box.ts
|
|
1477
|
+
function buildBoxWidth() {
|
|
1478
|
+
return Math.min(getTerminalWidth() - 4, 88);
|
|
1479
|
+
}
|
|
1480
|
+
function buildErrorContent(opts) {
|
|
1481
|
+
const parts = [];
|
|
1482
|
+
parts.push(
|
|
1483
|
+
`${sym("fail")} Error: ${bold(opts.message)}`
|
|
1484
|
+
);
|
|
1485
|
+
if (opts.context !== void 0 && opts.context !== "") {
|
|
1486
|
+
parts.push("");
|
|
1487
|
+
parts.push(dim(opts.context));
|
|
1488
|
+
}
|
|
1489
|
+
if (opts.suggestion !== void 0 && opts.suggestion !== "") {
|
|
1490
|
+
parts.push("");
|
|
1491
|
+
parts.push(colorize(`Try: ${opts.suggestion}`, brand.lime));
|
|
1492
|
+
}
|
|
1493
|
+
if (opts.exitCode !== void 0) {
|
|
1494
|
+
parts.push("");
|
|
1495
|
+
parts.push(dim(`Exit code: ${opts.exitCode}`));
|
|
1496
|
+
}
|
|
1497
|
+
return parts.join("\n");
|
|
1498
|
+
}
|
|
1499
|
+
function buildWarningContent(opts) {
|
|
1500
|
+
const parts = [];
|
|
1501
|
+
parts.push(
|
|
1502
|
+
`${sym("warning")} Warning: ${bold(opts.message)}`
|
|
1503
|
+
);
|
|
1504
|
+
if (opts.context !== void 0 && opts.context !== "") {
|
|
1505
|
+
parts.push("");
|
|
1506
|
+
parts.push(dim(opts.context));
|
|
1507
|
+
}
|
|
1508
|
+
if (opts.suggestion !== void 0 && opts.suggestion !== "") {
|
|
1509
|
+
parts.push("");
|
|
1510
|
+
parts.push(colorize(`Try: ${opts.suggestion}`, brand.lime));
|
|
1511
|
+
}
|
|
1512
|
+
return parts.join("\n");
|
|
1513
|
+
}
|
|
1514
|
+
function renderError(opts) {
|
|
1515
|
+
const content = buildErrorContent(opts);
|
|
1516
|
+
return box(content, {
|
|
1517
|
+
border: "rounded",
|
|
1518
|
+
borderColor: tokens.error,
|
|
1519
|
+
padding: 1,
|
|
1520
|
+
width: buildBoxWidth()
|
|
1521
|
+
});
|
|
1522
|
+
}
|
|
1523
|
+
function renderWarning(opts) {
|
|
1524
|
+
const content = buildWarningContent(opts);
|
|
1525
|
+
return box(content, {
|
|
1526
|
+
border: "rounded",
|
|
1527
|
+
borderColor: tokens.warning,
|
|
1528
|
+
padding: 1,
|
|
1529
|
+
width: buildBoxWidth()
|
|
1530
|
+
});
|
|
1531
|
+
}
|
|
1532
|
+
|
|
1533
|
+
// src/layout/step-list.ts
|
|
1534
|
+
function stepGlyph(state, frameIndex) {
|
|
1535
|
+
switch (state.status) {
|
|
1536
|
+
case "running":
|
|
1537
|
+
return colorize(spinnerFrame(frameIndex), tokens.success);
|
|
1538
|
+
case "done":
|
|
1539
|
+
return colorize(sym("success"), tokens.success);
|
|
1540
|
+
case "failed":
|
|
1541
|
+
return colorize(sym("fail"), tokens.error);
|
|
1542
|
+
case "warning":
|
|
1543
|
+
return colorize(sym("warning"), tokens.warning);
|
|
1544
|
+
case "skipped":
|
|
1545
|
+
return dim("\u2014");
|
|
1546
|
+
default:
|
|
1547
|
+
return dim(sym("pending"));
|
|
1548
|
+
}
|
|
1549
|
+
}
|
|
1550
|
+
function stepText(state) {
|
|
1551
|
+
switch (state.status) {
|
|
1552
|
+
case "done":
|
|
1553
|
+
return state.summaryText;
|
|
1554
|
+
case "failed":
|
|
1555
|
+
return state.failReason ? `${state.actionText} \u2014 ${state.failReason}` : state.actionText;
|
|
1556
|
+
case "skipped":
|
|
1557
|
+
return dim(state.actionText);
|
|
1558
|
+
default:
|
|
1559
|
+
return state.actionText;
|
|
1560
|
+
}
|
|
1561
|
+
}
|
|
1562
|
+
function stepDuration(state) {
|
|
1563
|
+
if (state.durationMs === void 0) return "";
|
|
1564
|
+
const secs = state.durationMs / 1e3;
|
|
1565
|
+
return `${secs.toFixed(1)}s`;
|
|
1566
|
+
}
|
|
1567
|
+
function renderStep(state, frameIndex, indent, termWidth) {
|
|
1568
|
+
if (isPlainMode()) {
|
|
1569
|
+
return renderStepPlain(state, indent);
|
|
1570
|
+
}
|
|
1571
|
+
const glyph = stepGlyph(state, frameIndex);
|
|
1572
|
+
const text = stepText(state);
|
|
1573
|
+
const duration = stepDuration(state);
|
|
1574
|
+
const glyphVisible = visibleLength(glyph);
|
|
1575
|
+
const textVisible = visibleLength(text);
|
|
1576
|
+
const durationVisible = visibleLength(duration);
|
|
1577
|
+
const indentLen = indent.length;
|
|
1578
|
+
const usedWidth = indentLen + glyphVisible + 1 + textVisible + durationVisible;
|
|
1579
|
+
const gap = Math.max(1, termWidth - usedWidth);
|
|
1580
|
+
let line;
|
|
1581
|
+
if (duration) {
|
|
1582
|
+
line = `${indent}${glyph} ${text}${" ".repeat(gap)}${dim(duration)}`;
|
|
1583
|
+
} else {
|
|
1584
|
+
line = `${indent}${glyph} ${text}`;
|
|
1585
|
+
}
|
|
1586
|
+
const lines = [line];
|
|
1587
|
+
if (state.subSteps && state.subSteps.length > 0) {
|
|
1588
|
+
const subIndent = indent + " | ";
|
|
1589
|
+
for (const sub of state.subSteps) {
|
|
1590
|
+
lines.push(renderStep(sub, frameIndex, subIndent, termWidth));
|
|
1591
|
+
}
|
|
1592
|
+
}
|
|
1593
|
+
return lines.join("\n");
|
|
1594
|
+
}
|
|
1595
|
+
function renderStepPlain(state, indent) {
|
|
1596
|
+
const text = stepText(state);
|
|
1597
|
+
const duration = stepDuration(state);
|
|
1598
|
+
const durationStr = duration ? ` (${duration})` : "";
|
|
1599
|
+
const line = `${indent}[${state.status}] ${text}${durationStr}`;
|
|
1600
|
+
const lines = [line];
|
|
1601
|
+
if (state.subSteps && state.subSteps.length > 0) {
|
|
1602
|
+
for (const sub of state.subSteps) {
|
|
1603
|
+
lines.push(renderStepPlain(sub, indent + " | "));
|
|
1604
|
+
}
|
|
1605
|
+
}
|
|
1606
|
+
return lines.join("\n");
|
|
1607
|
+
}
|
|
1608
|
+
function renderStepList(steps, frameIndex, termWidth = 80) {
|
|
1609
|
+
const lines = steps.map((step) => renderStep(step, frameIndex, "", termWidth));
|
|
1610
|
+
return lines.join("\n");
|
|
1611
|
+
}
|
|
1612
|
+
|
|
1613
|
+
// src/layout/run-steps.ts
|
|
1614
|
+
function defToState(def) {
|
|
1615
|
+
return {
|
|
1616
|
+
id: def.id,
|
|
1617
|
+
actionText: def.actionText,
|
|
1618
|
+
summaryText: def.summaryText,
|
|
1619
|
+
status: "pending",
|
|
1620
|
+
startedAt: void 0,
|
|
1621
|
+
finishedAt: void 0,
|
|
1622
|
+
durationMs: void 0,
|
|
1623
|
+
failReason: void 0,
|
|
1624
|
+
subSteps: def.subSteps ? def.subSteps.map(defToState) : void 0
|
|
1625
|
+
};
|
|
1626
|
+
}
|
|
1627
|
+
async function runSteps(defs, opts = {}) {
|
|
1628
|
+
const failFast = opts.failFast ?? (isCI() || !isTTY());
|
|
1629
|
+
const { onStateChange } = opts;
|
|
1630
|
+
const states = defs.map(defToState);
|
|
1631
|
+
let anyFailed = false;
|
|
1632
|
+
const notify = () => {
|
|
1633
|
+
onStateChange?.(states);
|
|
1634
|
+
};
|
|
1635
|
+
for (let i = 0; i < defs.length; i++) {
|
|
1636
|
+
const def = defs[i];
|
|
1637
|
+
const state = states[i];
|
|
1638
|
+
state.status = "running";
|
|
1639
|
+
state.startedAt = Date.now();
|
|
1640
|
+
notify();
|
|
1641
|
+
try {
|
|
1642
|
+
await def.run();
|
|
1643
|
+
state.finishedAt = Date.now();
|
|
1644
|
+
state.durationMs = state.finishedAt - (state.startedAt ?? state.finishedAt);
|
|
1645
|
+
state.status = "done";
|
|
1646
|
+
notify();
|
|
1647
|
+
} catch (err) {
|
|
1648
|
+
const reason = err instanceof Error ? err.message : String(err);
|
|
1649
|
+
state.finishedAt = Date.now();
|
|
1650
|
+
state.durationMs = state.finishedAt - (state.startedAt ?? state.finishedAt);
|
|
1651
|
+
state.failReason = reason;
|
|
1652
|
+
anyFailed = true;
|
|
1653
|
+
if (failFast) {
|
|
1654
|
+
state.status = "failed";
|
|
1655
|
+
notify();
|
|
1656
|
+
for (let j = i + 1; j < states.length; j++) {
|
|
1657
|
+
states[j].status = "skipped";
|
|
1658
|
+
}
|
|
1659
|
+
notify();
|
|
1660
|
+
return { success: false, states };
|
|
1661
|
+
} else {
|
|
1662
|
+
state.status = "warning";
|
|
1663
|
+
notify();
|
|
1664
|
+
}
|
|
1665
|
+
}
|
|
1666
|
+
}
|
|
1667
|
+
return { success: !anyFailed, states };
|
|
1668
|
+
}
|
|
1669
|
+
|
|
865
1670
|
// src/dashboard/state.ts
|
|
866
1671
|
var AuditPhase = {
|
|
867
1672
|
Connecting: "Connecting",
|
|
@@ -983,6 +1788,10 @@ var AlternateScreenRenderer = class {
|
|
|
983
1788
|
this.entered = false;
|
|
984
1789
|
}
|
|
985
1790
|
}
|
|
1791
|
+
suspend() {
|
|
1792
|
+
}
|
|
1793
|
+
resume() {
|
|
1794
|
+
}
|
|
986
1795
|
renderSummary(result) {
|
|
987
1796
|
const status = result.passed ? colorize("PASSED", "#4ADE80") : colorize("FAILED", "#F87171");
|
|
988
1797
|
const scoreStr = colorize(String(result.overallScore), result.overallScore >= 70 ? "#4ADE80" : "#F87171");
|
|
@@ -1004,6 +1813,132 @@ function formatElapsed2(ms) {
|
|
|
1004
1813
|
return `${Math.floor(secs / 60)}m ${secs % 60}s`;
|
|
1005
1814
|
}
|
|
1006
1815
|
|
|
1816
|
+
// src/layout/composed.ts
|
|
1817
|
+
var ComposedRenderer = class {
|
|
1818
|
+
output;
|
|
1819
|
+
tickTimer = null;
|
|
1820
|
+
frameIndex = 0;
|
|
1821
|
+
suspended = false;
|
|
1822
|
+
resizeTimer = null;
|
|
1823
|
+
lastState = null;
|
|
1824
|
+
entered = false;
|
|
1825
|
+
constructor(output = process.stderr) {
|
|
1826
|
+
this.output = output;
|
|
1827
|
+
process.stderr.on("resize", this.onResize);
|
|
1828
|
+
}
|
|
1829
|
+
update(state) {
|
|
1830
|
+
if (!this.entered) {
|
|
1831
|
+
this.output.write(screen.altEnter + cursor.hide);
|
|
1832
|
+
this.entered = true;
|
|
1833
|
+
}
|
|
1834
|
+
this.lastState = state;
|
|
1835
|
+
const content = this.buildContent(state, this.frameIndex);
|
|
1836
|
+
const capped = this.capContent(content);
|
|
1837
|
+
this.output.write(cursor.home + screen.clear + capped);
|
|
1838
|
+
if (!this.tickTimer && !this.suspended) {
|
|
1839
|
+
this.startTick();
|
|
1840
|
+
}
|
|
1841
|
+
}
|
|
1842
|
+
finish(result) {
|
|
1843
|
+
this.stopTick();
|
|
1844
|
+
const content = this.buildFinishContent(result);
|
|
1845
|
+
if (this.entered) {
|
|
1846
|
+
this.output.write(cursor.home + screen.clear + content);
|
|
1847
|
+
}
|
|
1848
|
+
if (this.entered) {
|
|
1849
|
+
this.output.write(cursor.show + screen.altExit);
|
|
1850
|
+
this.entered = false;
|
|
1851
|
+
}
|
|
1852
|
+
this.lastState = null;
|
|
1853
|
+
}
|
|
1854
|
+
dispose() {
|
|
1855
|
+
this.stopTick();
|
|
1856
|
+
if (this.resizeTimer !== null) {
|
|
1857
|
+
clearTimeout(this.resizeTimer);
|
|
1858
|
+
this.resizeTimer = null;
|
|
1859
|
+
}
|
|
1860
|
+
process.stderr.removeListener("resize", this.onResize);
|
|
1861
|
+
if (this.entered) {
|
|
1862
|
+
this.output.write(cursor.show + screen.altExit);
|
|
1863
|
+
this.entered = false;
|
|
1864
|
+
}
|
|
1865
|
+
}
|
|
1866
|
+
suspend() {
|
|
1867
|
+
this.suspended = true;
|
|
1868
|
+
this.stopTick();
|
|
1869
|
+
if (this.entered) {
|
|
1870
|
+
this.output.write(cursor.show + screen.altExit);
|
|
1871
|
+
this.entered = false;
|
|
1872
|
+
}
|
|
1873
|
+
}
|
|
1874
|
+
resume() {
|
|
1875
|
+
this.suspended = false;
|
|
1876
|
+
if (this.lastState) {
|
|
1877
|
+
this.output.write(screen.altEnter + cursor.hide);
|
|
1878
|
+
this.entered = true;
|
|
1879
|
+
this.startTick();
|
|
1880
|
+
}
|
|
1881
|
+
}
|
|
1882
|
+
// ── Private helpers ──────────────────────────────────────────────
|
|
1883
|
+
startTick() {
|
|
1884
|
+
this.tickTimer = setInterval(() => {
|
|
1885
|
+
this.frameIndex++;
|
|
1886
|
+
if (this.lastState && this.entered) {
|
|
1887
|
+
const content = this.buildContent(this.lastState, this.frameIndex);
|
|
1888
|
+
const capped = this.capContent(content);
|
|
1889
|
+
this.output.write(cursor.home + screen.clear + capped);
|
|
1890
|
+
}
|
|
1891
|
+
}, FRAME_INTERVAL);
|
|
1892
|
+
}
|
|
1893
|
+
stopTick() {
|
|
1894
|
+
if (this.tickTimer !== null) {
|
|
1895
|
+
clearInterval(this.tickTimer);
|
|
1896
|
+
this.tickTimer = null;
|
|
1897
|
+
}
|
|
1898
|
+
}
|
|
1899
|
+
onResize = () => {
|
|
1900
|
+
if (this.resizeTimer !== null) {
|
|
1901
|
+
clearTimeout(this.resizeTimer);
|
|
1902
|
+
}
|
|
1903
|
+
this.resizeTimer = setTimeout(() => {
|
|
1904
|
+
this.resizeTimer = null;
|
|
1905
|
+
if (this.lastState && this.entered) {
|
|
1906
|
+
const content = this.buildContent(this.lastState, this.frameIndex);
|
|
1907
|
+
const capped = this.capContent(content);
|
|
1908
|
+
this.output.write(cursor.home + screen.clear + capped);
|
|
1909
|
+
}
|
|
1910
|
+
}, 100);
|
|
1911
|
+
};
|
|
1912
|
+
capContent(content) {
|
|
1913
|
+
const maxLines = Math.max(1, getTerminalHeight() - 2);
|
|
1914
|
+
const lines = content.split("\n");
|
|
1915
|
+
if (lines.length <= maxLines) return content;
|
|
1916
|
+
const overflow = lines.length - (maxLines - 1);
|
|
1917
|
+
const truncated = lines.slice(0, maxLines - 1);
|
|
1918
|
+
truncated.push(dim(`... ${overflow} more lines`));
|
|
1919
|
+
return truncated.join("\n");
|
|
1920
|
+
}
|
|
1921
|
+
buildContent(state, frame) {
|
|
1922
|
+
if (state.stepStates && state.stepStates.length > 0) {
|
|
1923
|
+
return renderStepList(state.stepStates, frame, getTerminalWidth());
|
|
1924
|
+
}
|
|
1925
|
+
const spinner = spinnerFrame(frame);
|
|
1926
|
+
const progress = state.phaseTotal > 0 ? ` (${state.phaseIndex}/${state.phaseTotal})` : "";
|
|
1927
|
+
return `${spinner} ${state.phase}${dim(progress)}`;
|
|
1928
|
+
}
|
|
1929
|
+
buildFinishContent(result) {
|
|
1930
|
+
if (result.passed) {
|
|
1931
|
+
return `${sym("success")} ${bold("Complete")}${dim(" " + formatElapsed3(result.elapsed))}`;
|
|
1932
|
+
}
|
|
1933
|
+
return `${sym("fail")} ${bold("Failed")}${dim(" " + formatElapsed3(result.elapsed))}`;
|
|
1934
|
+
}
|
|
1935
|
+
};
|
|
1936
|
+
function formatElapsed3(ms) {
|
|
1937
|
+
const secs = Math.round(ms / 1e3);
|
|
1938
|
+
if (secs < 60) return `(${secs}s)`;
|
|
1939
|
+
return `(${Math.floor(secs / 60)}m ${secs % 60}s)`;
|
|
1940
|
+
}
|
|
1941
|
+
|
|
1007
1942
|
// src/layout/inline.ts
|
|
1008
1943
|
var InlineRenderer = class {
|
|
1009
1944
|
output;
|
|
@@ -1025,7 +1960,7 @@ var InlineRenderer = class {
|
|
|
1025
1960
|
finish(result) {
|
|
1026
1961
|
const ts = timestamp();
|
|
1027
1962
|
const status = result.passed ? isColorEnabled() ? colorize("PASSED", "#4ADE80") : "PASSED" : isColorEnabled() ? colorize("FAILED", "#F87171") : "FAILED";
|
|
1028
|
-
const elapsed =
|
|
1963
|
+
const elapsed = formatElapsed4(result.elapsed);
|
|
1029
1964
|
this.output.write(
|
|
1030
1965
|
`${dim(ts)} ${bold("Audit Complete")} ${status} score=${result.overallScore} issues=${result.issueCount} ${dim(elapsed)}
|
|
1031
1966
|
`
|
|
@@ -1033,6 +1968,10 @@ var InlineRenderer = class {
|
|
|
1033
1968
|
}
|
|
1034
1969
|
dispose() {
|
|
1035
1970
|
}
|
|
1971
|
+
suspend() {
|
|
1972
|
+
}
|
|
1973
|
+
resume() {
|
|
1974
|
+
}
|
|
1036
1975
|
};
|
|
1037
1976
|
function timestamp() {
|
|
1038
1977
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -1041,23 +1980,248 @@ function timestamp() {
|
|
|
1041
1980
|
function pad2(n) {
|
|
1042
1981
|
return n < 10 ? `0${n}` : String(n);
|
|
1043
1982
|
}
|
|
1044
|
-
function
|
|
1983
|
+
function formatElapsed4(ms) {
|
|
1045
1984
|
const secs = Math.round(ms / 1e3);
|
|
1046
1985
|
if (secs < 60) return `(${secs}s)`;
|
|
1047
1986
|
return `(${Math.floor(secs / 60)}m ${secs % 60}s)`;
|
|
1048
1987
|
}
|
|
1049
1988
|
|
|
1050
1989
|
// src/layout/renderer.ts
|
|
1990
|
+
var _rendererOverride = null;
|
|
1991
|
+
function setRendererOverride(renderer) {
|
|
1992
|
+
_rendererOverride = renderer;
|
|
1993
|
+
}
|
|
1051
1994
|
function createRenderer(mode = "auto", output = process.stderr) {
|
|
1995
|
+
if (_rendererOverride) return _rendererOverride;
|
|
1052
1996
|
if (mode === "auto") {
|
|
1053
|
-
mode = isTTY() && !isCI() ? "
|
|
1997
|
+
mode = isTTY() && !isCI() ? "composed" : "inline";
|
|
1054
1998
|
}
|
|
1055
1999
|
if (mode === "alternate") {
|
|
1056
2000
|
return new AlternateScreenRenderer(output);
|
|
1057
2001
|
}
|
|
2002
|
+
if (mode === "composed") {
|
|
2003
|
+
if (!isTTY()) return new InlineRenderer(output);
|
|
2004
|
+
return new ComposedRenderer(output);
|
|
2005
|
+
}
|
|
1058
2006
|
return new InlineRenderer(output);
|
|
1059
2007
|
}
|
|
2008
|
+
|
|
2009
|
+
// src/layout/physicalRows.ts
|
|
2010
|
+
function physicalRows(content, terminalWidth) {
|
|
2011
|
+
if (terminalWidth <= 0) return 0;
|
|
2012
|
+
const lines = content.split("\n");
|
|
2013
|
+
return lines.reduce((total, line) => {
|
|
2014
|
+
const len = visibleLength(line);
|
|
2015
|
+
return total + Math.max(1, Math.ceil(len / terminalWidth));
|
|
2016
|
+
}, 0);
|
|
2017
|
+
}
|
|
2018
|
+
|
|
2019
|
+
// src/layout/viewport.ts
|
|
2020
|
+
var KEY_CTRL_C = "";
|
|
2021
|
+
var KEY_UP = "\x1B[A";
|
|
2022
|
+
var KEY_DOWN = "\x1B[B";
|
|
2023
|
+
var KEY_PAGE_UP = "\x1B[5~";
|
|
2024
|
+
var KEY_PAGE_DOWN = "\x1B[6~";
|
|
2025
|
+
var KEY_ENTER_CR = "\r";
|
|
2026
|
+
var KEY_ENTER_LF = "\n";
|
|
2027
|
+
var KEY_ESC = "\x1B";
|
|
2028
|
+
var KEY_J = "j";
|
|
2029
|
+
var KEY_K = "k";
|
|
2030
|
+
function parseKey(data) {
|
|
2031
|
+
const str = data.toString("binary");
|
|
2032
|
+
if (str === KEY_CTRL_C) return "quit";
|
|
2033
|
+
if (str === KEY_UP) return "up";
|
|
2034
|
+
if (str === KEY_DOWN) return "down";
|
|
2035
|
+
if (str === KEY_PAGE_UP) return "pageup";
|
|
2036
|
+
if (str === KEY_PAGE_DOWN) return "pagedown";
|
|
2037
|
+
if (str === KEY_ENTER_CR || str === KEY_ENTER_LF) return "enter";
|
|
2038
|
+
if (str === KEY_ESC) return "escape";
|
|
2039
|
+
if (str === KEY_J) return "down";
|
|
2040
|
+
if (str === KEY_K) return "up";
|
|
2041
|
+
return null;
|
|
2042
|
+
}
|
|
2043
|
+
var ScrollingViewport = class {
|
|
2044
|
+
items;
|
|
2045
|
+
maxRows;
|
|
2046
|
+
output;
|
|
2047
|
+
stdin;
|
|
2048
|
+
/** Index of the currently highlighted item (0-indexed) */
|
|
2049
|
+
cursorIdx = 0;
|
|
2050
|
+
/** Index of first visible item */
|
|
2051
|
+
scrollOffset = 0;
|
|
2052
|
+
/** Index of expanded item (-1 = none) */
|
|
2053
|
+
expandedIdx = -1;
|
|
2054
|
+
/** Calculated visible rows (updated on resize) */
|
|
2055
|
+
visibleRows;
|
|
2056
|
+
lastRows = 0;
|
|
2057
|
+
resizeTimer = null;
|
|
2058
|
+
constructor(options) {
|
|
2059
|
+
this.items = options.items;
|
|
2060
|
+
this.maxRows = options.maxRows ?? 10;
|
|
2061
|
+
this.output = options.output ?? process.stderr;
|
|
2062
|
+
this.stdin = options.stdin ?? process.stdin;
|
|
2063
|
+
this.visibleRows = this.calcVisibleRows();
|
|
2064
|
+
}
|
|
2065
|
+
// ── Public entry point ──────────────────────────────────────────────────────
|
|
2066
|
+
/**
|
|
2067
|
+
* Run the viewport interactively.
|
|
2068
|
+
*
|
|
2069
|
+
* Guard: if stdin is not a TTY or setRawMode is unavailable, returns
|
|
2070
|
+
* immediately (non-interactive fallback).
|
|
2071
|
+
*
|
|
2072
|
+
* Resolves when the user presses Ctrl+C.
|
|
2073
|
+
*/
|
|
2074
|
+
async run() {
|
|
2075
|
+
if (!this.stdin.isTTY || typeof this.stdin.setRawMode !== "function") {
|
|
2076
|
+
return;
|
|
2077
|
+
}
|
|
2078
|
+
return new Promise((resolve) => {
|
|
2079
|
+
this.stdin.setRawMode(true);
|
|
2080
|
+
this.stdin.resume();
|
|
2081
|
+
this.output.write(cursor.hide);
|
|
2082
|
+
this.redraw(this.buildFrame());
|
|
2083
|
+
const onResize = () => {
|
|
2084
|
+
if (this.resizeTimer !== null) clearTimeout(this.resizeTimer);
|
|
2085
|
+
this.resizeTimer = setTimeout(() => {
|
|
2086
|
+
this.resizeTimer = null;
|
|
2087
|
+
this.visibleRows = this.calcVisibleRows();
|
|
2088
|
+
this.clampScrollOffset();
|
|
2089
|
+
this.lastRows = 0;
|
|
2090
|
+
this.redraw(this.buildFrame());
|
|
2091
|
+
}, 100);
|
|
2092
|
+
};
|
|
2093
|
+
const onData = (data) => {
|
|
2094
|
+
const action = parseKey(data);
|
|
2095
|
+
if (action === "quit") {
|
|
2096
|
+
cleanup();
|
|
2097
|
+
resolve();
|
|
2098
|
+
return;
|
|
2099
|
+
}
|
|
2100
|
+
this.handleAction(action);
|
|
2101
|
+
this.redraw(this.buildFrame());
|
|
2102
|
+
};
|
|
2103
|
+
const cleanup = () => {
|
|
2104
|
+
this.stdin.removeListener("data", onData);
|
|
2105
|
+
process.stderr.removeListener("resize", onResize);
|
|
2106
|
+
if (this.resizeTimer !== null) {
|
|
2107
|
+
clearTimeout(this.resizeTimer);
|
|
2108
|
+
this.resizeTimer = null;
|
|
2109
|
+
}
|
|
2110
|
+
try {
|
|
2111
|
+
this.stdin.setRawMode(false);
|
|
2112
|
+
} catch {
|
|
2113
|
+
}
|
|
2114
|
+
this.stdin.pause();
|
|
2115
|
+
this.output.write(cursor.show);
|
|
2116
|
+
};
|
|
2117
|
+
this.stdin.on("data", onData);
|
|
2118
|
+
process.stderr.on("resize", onResize);
|
|
2119
|
+
});
|
|
2120
|
+
}
|
|
2121
|
+
// ── Private helpers ─────────────────────────────────────────────────────────
|
|
2122
|
+
calcVisibleRows() {
|
|
2123
|
+
return Math.min(this.maxRows, getTerminalHeight() - 4);
|
|
2124
|
+
}
|
|
2125
|
+
clampScrollOffset() {
|
|
2126
|
+
const maxOffset = Math.max(0, this.items.length - this.visibleRows);
|
|
2127
|
+
this.scrollOffset = Math.max(0, Math.min(this.scrollOffset, maxOffset));
|
|
2128
|
+
}
|
|
2129
|
+
handleAction(action) {
|
|
2130
|
+
const last = this.items.length - 1;
|
|
2131
|
+
switch (action) {
|
|
2132
|
+
case "up":
|
|
2133
|
+
this.cursorIdx = Math.max(0, this.cursorIdx - 1);
|
|
2134
|
+
break;
|
|
2135
|
+
case "down":
|
|
2136
|
+
this.cursorIdx = Math.min(last, this.cursorIdx + 1);
|
|
2137
|
+
break;
|
|
2138
|
+
case "pageup":
|
|
2139
|
+
this.cursorIdx = Math.max(0, this.cursorIdx - this.visibleRows);
|
|
2140
|
+
break;
|
|
2141
|
+
case "pagedown":
|
|
2142
|
+
this.cursorIdx = Math.min(last, this.cursorIdx + this.visibleRows);
|
|
2143
|
+
break;
|
|
2144
|
+
case "enter":
|
|
2145
|
+
this.expandedIdx = this.expandedIdx === this.cursorIdx ? -1 : this.cursorIdx;
|
|
2146
|
+
break;
|
|
2147
|
+
case "escape":
|
|
2148
|
+
this.expandedIdx = -1;
|
|
2149
|
+
break;
|
|
2150
|
+
}
|
|
2151
|
+
if (this.cursorIdx < this.scrollOffset) {
|
|
2152
|
+
this.scrollOffset = this.cursorIdx;
|
|
2153
|
+
}
|
|
2154
|
+
if (this.cursorIdx >= this.scrollOffset + this.visibleRows) {
|
|
2155
|
+
this.scrollOffset = this.cursorIdx - this.visibleRows + 1;
|
|
2156
|
+
}
|
|
2157
|
+
this.clampScrollOffset();
|
|
2158
|
+
}
|
|
2159
|
+
buildFrame() {
|
|
2160
|
+
const width = getTerminalWidth();
|
|
2161
|
+
const lines = [];
|
|
2162
|
+
const plain = isPlainMode();
|
|
2163
|
+
const colored = isColorEnabled();
|
|
2164
|
+
if (this.scrollOffset > 0) {
|
|
2165
|
+
const count = this.scrollOffset;
|
|
2166
|
+
const arrow = plain ? "^" : "\u25B2";
|
|
2167
|
+
lines.push(dim(` ${arrow} ${count} more`));
|
|
2168
|
+
}
|
|
2169
|
+
const end = Math.min(this.scrollOffset + this.visibleRows, this.items.length);
|
|
2170
|
+
for (let i = this.scrollOffset; i < end; i++) {
|
|
2171
|
+
const item = this.items[i];
|
|
2172
|
+
const isHighlighted = i === this.cursorIdx;
|
|
2173
|
+
const isExpanded = i === this.expandedIdx;
|
|
2174
|
+
const badge = severityColor(item.severity);
|
|
2175
|
+
const badgeVisibleWidth = item.severity.toUpperCase().length;
|
|
2176
|
+
const titleMaxWidth = Math.max(10, width - badgeVisibleWidth - 18);
|
|
2177
|
+
const title = truncate(item.title, titleMaxWidth);
|
|
2178
|
+
const effortTag = dim(`[${item.effort}]`);
|
|
2179
|
+
let row = ` ${badge} ${title} ${effortTag}`;
|
|
2180
|
+
if (isHighlighted) {
|
|
2181
|
+
if (colored && !plain) {
|
|
2182
|
+
row = bgColor(row, brand.teal);
|
|
2183
|
+
} else {
|
|
2184
|
+
row = `\x1B[7m${row}\x1B[0m`;
|
|
2185
|
+
}
|
|
2186
|
+
}
|
|
2187
|
+
lines.push(row);
|
|
2188
|
+
if (isExpanded && item.detail) {
|
|
2189
|
+
const detailLines = item.detail.split("\n");
|
|
2190
|
+
for (const dl of detailLines) {
|
|
2191
|
+
lines.push(` ${dim(truncate(dl, width - 6))}`);
|
|
2192
|
+
}
|
|
2193
|
+
}
|
|
2194
|
+
}
|
|
2195
|
+
if (this.scrollOffset + this.visibleRows < this.items.length) {
|
|
2196
|
+
const count = this.items.length - (this.scrollOffset + this.visibleRows);
|
|
2197
|
+
const arrow = plain ? "v" : "\u25BC";
|
|
2198
|
+
lines.push(dim(` ${arrow} ${count} more`));
|
|
2199
|
+
}
|
|
2200
|
+
return lines.join("\n");
|
|
2201
|
+
}
|
|
2202
|
+
redraw(content) {
|
|
2203
|
+
const rows = this.lastRows;
|
|
2204
|
+
let seq = rows > 0 ? cursor.up(rows) + screen.clearDown : "";
|
|
2205
|
+
seq += content;
|
|
2206
|
+
this.output.write(seq);
|
|
2207
|
+
this.lastRows = physicalRows(content, getTerminalWidth());
|
|
2208
|
+
}
|
|
2209
|
+
};
|
|
2210
|
+
var _isOverrideActive = false;
|
|
2211
|
+
function setKeyboardOverrideActive(active) {
|
|
2212
|
+
_isOverrideActive = active;
|
|
2213
|
+
}
|
|
1060
2214
|
function createKeyboardHandler(stdin = process.stdin) {
|
|
2215
|
+
if (_isOverrideActive) {
|
|
2216
|
+
return {
|
|
2217
|
+
start() {
|
|
2218
|
+
},
|
|
2219
|
+
dispose() {
|
|
2220
|
+
},
|
|
2221
|
+
on() {
|
|
2222
|
+
}
|
|
2223
|
+
};
|
|
2224
|
+
}
|
|
1061
2225
|
const emitter = new events.EventEmitter();
|
|
1062
2226
|
let started = false;
|
|
1063
2227
|
let wasRawMode = false;
|
|
@@ -1103,9 +2267,14 @@ function createKeyboardHandler(stdin = process.stdin) {
|
|
|
1103
2267
|
|
|
1104
2268
|
exports.AlternateScreenRenderer = AlternateScreenRenderer;
|
|
1105
2269
|
exports.AuditPhase = AuditPhase;
|
|
2270
|
+
exports.BRAILLE_FRAMES = BRAILLE_FRAMES;
|
|
2271
|
+
exports.ComposedRenderer = ComposedRenderer;
|
|
2272
|
+
exports.FRAME_INTERVAL = FRAME_INTERVAL;
|
|
1106
2273
|
exports.InlineRenderer = InlineRenderer;
|
|
1107
2274
|
exports.PHASE_ORDER = PHASE_ORDER;
|
|
2275
|
+
exports.ScrollingViewport = ScrollingViewport;
|
|
1108
2276
|
exports.applyGradient = applyGradient;
|
|
2277
|
+
exports.bgColor = bgColor;
|
|
1109
2278
|
exports.bold = bold;
|
|
1110
2279
|
exports.boldColor = boldColor;
|
|
1111
2280
|
exports.borders = borders;
|
|
@@ -1119,37 +2288,57 @@ exports.createProgressBar = createProgressBar;
|
|
|
1119
2288
|
exports.createRenderer = createRenderer;
|
|
1120
2289
|
exports.createSpinner = createSpinner;
|
|
1121
2290
|
exports.cursor = cursor;
|
|
2291
|
+
exports.detectSymbolTier = detectSymbolTier;
|
|
1122
2292
|
exports.dim = dim;
|
|
2293
|
+
exports.easeIn = easeIn;
|
|
2294
|
+
exports.easeInOut = easeInOut;
|
|
2295
|
+
exports.easeOut = easeOut;
|
|
1123
2296
|
exports.getTerminalHeight = getTerminalHeight;
|
|
1124
2297
|
exports.getTerminalWidth = getTerminalWidth;
|
|
1125
2298
|
exports.gradient = gradient;
|
|
1126
2299
|
exports.isCI = isCI;
|
|
1127
2300
|
exports.isColorEnabled = isColorEnabled;
|
|
2301
|
+
exports.isPlainMode = isPlainMode;
|
|
1128
2302
|
exports.isStdinTTY = isStdinTTY;
|
|
1129
2303
|
exports.isStdoutTTY = isStdoutTTY;
|
|
1130
2304
|
exports.isTTY = isTTY;
|
|
2305
|
+
exports.lerp = lerp;
|
|
2306
|
+
exports.linear = linear;
|
|
1131
2307
|
exports.padEnd = padEnd;
|
|
1132
2308
|
exports.padStart = padStart;
|
|
1133
2309
|
exports.parseDiff = parseDiff;
|
|
1134
2310
|
exports.phaseIndex = phaseIndex;
|
|
1135
2311
|
exports.phaseTotal = phaseTotal;
|
|
2312
|
+
exports.physicalRows = physicalRows;
|
|
1136
2313
|
exports.renderDiff = renderDiff;
|
|
2314
|
+
exports.renderError = renderError;
|
|
1137
2315
|
exports.renderFrame = renderFrame;
|
|
1138
2316
|
exports.renderGroupedList = renderGroupedList;
|
|
1139
2317
|
exports.renderList = renderList;
|
|
2318
|
+
exports.renderStepList = renderStepList;
|
|
1140
2319
|
exports.renderTable = renderTable;
|
|
1141
2320
|
exports.renderTree = renderTree;
|
|
2321
|
+
exports.renderWarning = renderWarning;
|
|
2322
|
+
exports.runSteps = runSteps;
|
|
1142
2323
|
exports.scoreColor = scoreColor;
|
|
1143
2324
|
exports.screen = screen;
|
|
1144
2325
|
exports.setColorEnabled = setColorEnabled;
|
|
2326
|
+
exports.setKeyboardOverrideActive = setKeyboardOverrideActive;
|
|
2327
|
+
exports.setPlainMode = setPlainMode;
|
|
2328
|
+
exports.setRendererOverride = setRendererOverride;
|
|
2329
|
+
exports.setSymbolTier = setSymbolTier;
|
|
1145
2330
|
exports.severity = severity;
|
|
2331
|
+
exports.severityColor = severityColor;
|
|
1146
2332
|
exports.severityLabels = severityLabels;
|
|
1147
2333
|
exports.severityOrder = severityOrder;
|
|
1148
2334
|
exports.shouldUseColor = shouldUseColor;
|
|
2335
|
+
exports.spinnerFrame = spinnerFrame;
|
|
1149
2336
|
exports.stripAnsi = stripAnsi;
|
|
1150
2337
|
exports.style = style;
|
|
1151
2338
|
exports.supportsUnicode = supportsUnicode;
|
|
2339
|
+
exports.sym = sym;
|
|
1152
2340
|
exports.text = text_exports;
|
|
2341
|
+
exports.toPlainBox = toPlainBox;
|
|
1153
2342
|
exports.tokens = tokens;
|
|
1154
2343
|
exports.truncate = truncate;
|
|
1155
2344
|
exports.visibleLength = visibleLength;
|