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