securewithtrace 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +125 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3564,6 +3564,124 @@ function createAuthCommand() {
|
|
|
3564
3564
|
return auth;
|
|
3565
3565
|
}
|
|
3566
3566
|
|
|
3567
|
+
// src/banner.ts
|
|
3568
|
+
var ESC = "\x1B";
|
|
3569
|
+
var CURSOR_HIDE = `${ESC}[?25l`;
|
|
3570
|
+
var CURSOR_SHOW = `${ESC}[?25h`;
|
|
3571
|
+
function cursorUp(n) {
|
|
3572
|
+
return n > 0 ? `${ESC}[${n}A` : "";
|
|
3573
|
+
}
|
|
3574
|
+
var RESET = `${ESC}[0m`;
|
|
3575
|
+
function rgb(r, g, b) {
|
|
3576
|
+
return `${ESC}[38;2;${r};${g};${b}m`;
|
|
3577
|
+
}
|
|
3578
|
+
var LETTERS = {
|
|
3579
|
+
T: ["########", "########", " ## ", " ## ", " ## ", " ## ", " ## "],
|
|
3580
|
+
R: ["###### ", "## ## ", "## ## ", "###### ", "## ## ", "## ## ", "## ## "],
|
|
3581
|
+
A: [" #### ", " ## ## ", "## ##", "########", "## ##", "## ##", "## ##"],
|
|
3582
|
+
C: [" ###### ", "## ##", "## ", "## ", "## ", "## ##", " ###### "],
|
|
3583
|
+
E: ["########", "## ", "## ", "###### ", "## ", "## ", "########"]
|
|
3584
|
+
};
|
|
3585
|
+
var LETTER_ORDER = ["T", "R", "A", "C", "E"];
|
|
3586
|
+
var LETTER_GAP = " ";
|
|
3587
|
+
var ROWS = 7;
|
|
3588
|
+
function buildGrid() {
|
|
3589
|
+
const rows = [];
|
|
3590
|
+
for (let r = 0; r < ROWS; r++) {
|
|
3591
|
+
const parts = [];
|
|
3592
|
+
for (let i = 0; i < LETTER_ORDER.length; i++) {
|
|
3593
|
+
const letter = LETTER_ORDER[i];
|
|
3594
|
+
const def = LETTERS[letter];
|
|
3595
|
+
if (def) {
|
|
3596
|
+
parts.push(def[r] ?? "");
|
|
3597
|
+
}
|
|
3598
|
+
if (i < LETTER_ORDER.length - 1) {
|
|
3599
|
+
parts.push(LETTER_GAP);
|
|
3600
|
+
}
|
|
3601
|
+
}
|
|
3602
|
+
rows.push(parts.join(""));
|
|
3603
|
+
}
|
|
3604
|
+
return rows;
|
|
3605
|
+
}
|
|
3606
|
+
var SWEEP_CHARS = [" ", "\u2591", "\u2592", "\u2593", "\u2588"];
|
|
3607
|
+
var PALETTE = [
|
|
3608
|
+
{ r: 80, g: 200, b: 200 },
|
|
3609
|
+
// bright teal
|
|
3610
|
+
{ r: 90, g: 210, b: 210 },
|
|
3611
|
+
{ r: 70, g: 190, b: 195 },
|
|
3612
|
+
{ r: 100, g: 220, b: 215 },
|
|
3613
|
+
{ r: 85, g: 205, b: 205 },
|
|
3614
|
+
{ r: 75, g: 195, b: 200 },
|
|
3615
|
+
{ r: 95, g: 215, b: 210 }
|
|
3616
|
+
];
|
|
3617
|
+
function renderFrame(grid, revealCol, sweepPhase) {
|
|
3618
|
+
const lines = [];
|
|
3619
|
+
for (let r = 0; r < grid.length; r++) {
|
|
3620
|
+
const row = grid[r] ?? "";
|
|
3621
|
+
let line = "";
|
|
3622
|
+
const color = PALETTE[r % PALETTE.length] ?? { r: 80, g: 200, b: 200 };
|
|
3623
|
+
line += rgb(color.r, color.g, color.b);
|
|
3624
|
+
for (let c21 = 0; c21 < row.length; c21++) {
|
|
3625
|
+
const ch = row[c21];
|
|
3626
|
+
if (ch === " " || ch === void 0) {
|
|
3627
|
+
line += " ";
|
|
3628
|
+
continue;
|
|
3629
|
+
}
|
|
3630
|
+
if (c21 < revealCol) {
|
|
3631
|
+
line += "\u2588";
|
|
3632
|
+
} else if (c21 < revealCol + 4) {
|
|
3633
|
+
const distFromEdge = c21 - revealCol;
|
|
3634
|
+
const phaseIdx = Math.max(0, sweepPhase - distFromEdge);
|
|
3635
|
+
line += SWEEP_CHARS[Math.min(phaseIdx, SWEEP_CHARS.length - 1)] ?? " ";
|
|
3636
|
+
} else {
|
|
3637
|
+
line += " ";
|
|
3638
|
+
}
|
|
3639
|
+
}
|
|
3640
|
+
line += RESET;
|
|
3641
|
+
lines.push(line);
|
|
3642
|
+
}
|
|
3643
|
+
return lines.join("\n");
|
|
3644
|
+
}
|
|
3645
|
+
function sleep2(ms) {
|
|
3646
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
3647
|
+
}
|
|
3648
|
+
async function showBanner() {
|
|
3649
|
+
const grid = buildGrid();
|
|
3650
|
+
const totalCols = Math.max(...grid.map((r) => r.length));
|
|
3651
|
+
if (!process.stdout.isTTY) {
|
|
3652
|
+
printStaticBanner(grid);
|
|
3653
|
+
return;
|
|
3654
|
+
}
|
|
3655
|
+
process.stdout.write(CURSOR_HIDE);
|
|
3656
|
+
const emptyFrame = grid.map(() => "").join("\n");
|
|
3657
|
+
process.stdout.write(`${emptyFrame}
|
|
3658
|
+
`);
|
|
3659
|
+
const sweepWidth = 4;
|
|
3660
|
+
const totalSteps = totalCols + sweepWidth + SWEEP_CHARS.length;
|
|
3661
|
+
for (let step = 0; step <= totalSteps; step++) {
|
|
3662
|
+
const revealCol = Math.max(0, step - SWEEP_CHARS.length);
|
|
3663
|
+
const sweepPhase = Math.min(step, SWEEP_CHARS.length);
|
|
3664
|
+
const frame = renderFrame(grid, revealCol, sweepPhase);
|
|
3665
|
+
process.stdout.write(`${cursorUp(grid.length)}\r`);
|
|
3666
|
+
process.stdout.write(`${frame}
|
|
3667
|
+
`);
|
|
3668
|
+
await sleep2(12);
|
|
3669
|
+
}
|
|
3670
|
+
process.stdout.write(CURSOR_SHOW);
|
|
3671
|
+
}
|
|
3672
|
+
function printStaticBanner(grid) {
|
|
3673
|
+
for (let r = 0; r < grid.length; r++) {
|
|
3674
|
+
const row = grid[r] ?? "";
|
|
3675
|
+
const color = PALETTE[r % PALETTE.length] ?? { r: 80, g: 200, b: 200 };
|
|
3676
|
+
let line = rgb(color.r, color.g, color.b);
|
|
3677
|
+
for (const ch of row) {
|
|
3678
|
+
line += ch === "#" ? "\u2588" : " ";
|
|
3679
|
+
}
|
|
3680
|
+
line += RESET;
|
|
3681
|
+
console.log(line);
|
|
3682
|
+
}
|
|
3683
|
+
}
|
|
3684
|
+
|
|
3567
3685
|
// src/repo/commands.ts
|
|
3568
3686
|
import { chmodSync, mkdtempSync, rmSync as rmSync2, writeFileSync as writeFileSync2 } from "fs";
|
|
3569
3687
|
import { tmpdir } from "os";
|
|
@@ -23847,11 +23965,11 @@ async function resolveOrganizationIdSafe(client) {
|
|
|
23847
23965
|
|
|
23848
23966
|
// src/repo/commands.ts
|
|
23849
23967
|
function stripAnsi(str) {
|
|
23850
|
-
const
|
|
23968
|
+
const ESC2 = String.fromCharCode(27);
|
|
23851
23969
|
const CSI = String.fromCharCode(155);
|
|
23852
23970
|
const BEL = String.fromCharCode(7);
|
|
23853
|
-
const csi = `[${
|
|
23854
|
-
const osc = `${
|
|
23971
|
+
const csi = `[${ESC2}${CSI}][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]`;
|
|
23972
|
+
const osc = `${ESC2}\\].*?(?:${BEL}|${ESC2}\\\\)`;
|
|
23855
23973
|
const pattern = new RegExp(`${osc}|${csi}`, "g");
|
|
23856
23974
|
return str.replace(pattern, "");
|
|
23857
23975
|
}
|
|
@@ -24225,6 +24343,10 @@ function createVulnerabilitiesCommand() {
|
|
|
24225
24343
|
// src/index.ts
|
|
24226
24344
|
var program2 = new Command();
|
|
24227
24345
|
program2.name("tracecli").description("Trace CLI").version("0.0.1");
|
|
24346
|
+
program2.action(async () => {
|
|
24347
|
+
await showBanner();
|
|
24348
|
+
program2.outputHelp();
|
|
24349
|
+
});
|
|
24228
24350
|
program2.command("echo").description("Echo a message back to the terminal").argument("<message...>", "message to echo").action((messageParts) => {
|
|
24229
24351
|
console.log(messageParts.join(" "));
|
|
24230
24352
|
});
|