@triedotdev/mcp 1.0.52 → 1.0.54

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.
@@ -1,14 +1,16 @@
1
1
  import {
2
2
  Executor,
3
3
  Triager
4
- } from "./chunk-C3AS5OXW.js";
4
+ } from "./chunk-KLKY34RE.js";
5
5
  import {
6
6
  getSkillRegistry,
7
7
  updateContextAfterScan
8
- } from "./chunk-TOE75CFZ.js";
8
+ } from "./chunk-HUQQSQOD.js";
9
9
  import {
10
- ProgressReporter
11
- } from "./chunk-A43476GB.js";
10
+ ProgressReporter,
11
+ isInteractiveMode,
12
+ setInteractiveMode
13
+ } from "./chunk-6ODT4U4O.js";
12
14
  import {
13
15
  getWorkingDirectory
14
16
  } from "./chunk-ASGSTVVF.js";
@@ -2786,6 +2788,9 @@ var StreamingManager = class {
2786
2788
  }
2787
2789
  };
2788
2790
  function formatConsoleUpdate(update) {
2791
+ if (isInteractiveMode()) {
2792
+ return null;
2793
+ }
2789
2794
  switch (update.type) {
2790
2795
  case "agent_start":
2791
2796
  return `>> Starting ${update.data.agent}...`;
@@ -2806,13 +2811,6 @@ function formatConsoleUpdate(update) {
2806
2811
  return null;
2807
2812
  }
2808
2813
  }
2809
- function createProgressBar(current, total, width = 40) {
2810
- if (total === 0) return "\u2588".repeat(width);
2811
- const progress = current / total;
2812
- const filled = Math.round(width * progress);
2813
- const empty = width - filled;
2814
- return "\u2588".repeat(filled) + "\u2591".repeat(empty);
2815
- }
2816
2814
 
2817
2815
  // src/utils/issue-analyzer.ts
2818
2816
  var IssueAnalyzer = class {
@@ -3172,7 +3170,10 @@ var InteractiveDashboard = class {
3172
3170
  },
3173
3171
  view: "overview",
3174
3172
  selectedIssue: 0,
3175
- lastUpdate: Date.now()
3173
+ lastUpdate: Date.now(),
3174
+ scanComplete: false,
3175
+ startTime: Date.now(),
3176
+ activityLog: []
3176
3177
  };
3177
3178
  }
3178
3179
  /**
@@ -3180,6 +3181,8 @@ var InteractiveDashboard = class {
3180
3181
  */
3181
3182
  async start() {
3182
3183
  this.isActive = true;
3184
+ this.state.startTime = Date.now();
3185
+ this.addActivity("Guardian started");
3183
3186
  this.setupKeyboardHandlers();
3184
3187
  this.startUpdateLoop();
3185
3188
  this.render();
@@ -3193,6 +3196,17 @@ var InteractiveDashboard = class {
3193
3196
  clearInterval(this.updateInterval);
3194
3197
  }
3195
3198
  this.rl.close();
3199
+ process.stdout.write("\x1B[2J\x1B[H\x1B[?25h");
3200
+ }
3201
+ /**
3202
+ * Add activity log entry
3203
+ */
3204
+ addActivity(message) {
3205
+ const time = (/* @__PURE__ */ new Date()).toLocaleTimeString("en-US", { hour12: false, hour: "2-digit", minute: "2-digit", second: "2-digit" });
3206
+ this.state.activityLog.unshift({ time, message });
3207
+ if (this.state.activityLog.length > 50) {
3208
+ this.state.activityLog.pop();
3209
+ }
3196
3210
  }
3197
3211
  /**
3198
3212
  * Process streaming updates
@@ -3201,16 +3215,34 @@ var InteractiveDashboard = class {
3201
3215
  this.state.lastUpdate = Date.now();
3202
3216
  switch (update.type) {
3203
3217
  case "progress":
3218
+ const oldProgress = this.state.progress;
3204
3219
  this.state.progress = update.data;
3220
+ if (update.data.currentFile && update.data.processedFiles % 10 === 0 && update.data.processedFiles !== oldProgress.processedFiles) {
3221
+ this.addActivity(`Scanned ${update.data.processedFiles}/${update.data.totalFiles} files`);
3222
+ }
3223
+ break;
3224
+ case "agent_start":
3225
+ this.addActivity(`[*] Agent started: ${update.data.agent}`);
3226
+ break;
3227
+ case "agent_complete":
3228
+ this.addActivity(`[+] Agent complete: ${update.data.agent} (${update.data.issueCount} issues)`);
3205
3229
  break;
3206
3230
  case "issue_found":
3207
3231
  this.state.issues.push(update.data);
3232
+ if (update.data.severity === "critical" || update.data.severity === "serious") {
3233
+ const icon = update.data.severity === "critical" ? "[!]" : "[x]";
3234
+ const fileName = update.data.file?.split("/").pop() || "unknown";
3235
+ this.addActivity(`${icon} ${update.data.severity.toUpperCase()}: ${update.data.message?.slice(0, 40) || fileName}`);
3236
+ }
3208
3237
  break;
3209
3238
  case "scan_complete":
3239
+ this.state.scanComplete = true;
3210
3240
  this.state.progress = {
3211
3241
  ...this.state.progress,
3212
3242
  processedFiles: this.state.progress.totalFiles
3213
3243
  };
3244
+ const elapsed = ((Date.now() - this.state.startTime) / 1e3).toFixed(1);
3245
+ this.addActivity(`=== Scan complete - ${this.state.progress.totalIssues} issues in ${elapsed}s ===`);
3214
3246
  break;
3215
3247
  }
3216
3248
  if (this.isActive) {
@@ -3285,150 +3317,274 @@ var InteractiveDashboard = class {
3285
3317
  }
3286
3318
  }, 100);
3287
3319
  }
3320
+ /**
3321
+ * Create a horizontal line
3322
+ */
3323
+ line(width = 78) {
3324
+ return "-".repeat(width);
3325
+ }
3326
+ /**
3327
+ * Create progress bar
3328
+ */
3329
+ progressBar(current, total, width = 50) {
3330
+ if (total === 0) return "[" + "#".repeat(width) + "]";
3331
+ const progress = Math.min(1, current / total);
3332
+ const filled = Math.round(width * progress);
3333
+ const empty = width - filled;
3334
+ return "[" + "#".repeat(filled) + ".".repeat(empty) + "]";
3335
+ }
3336
+ /**
3337
+ * Get severity icon
3338
+ */
3339
+ severityIcon(severity) {
3340
+ const icons = {
3341
+ critical: "[!]",
3342
+ serious: "[x]",
3343
+ moderate: "[~]",
3344
+ low: "[-]"
3345
+ };
3346
+ return icons[severity] || "[-]";
3347
+ }
3348
+ /**
3349
+ * Get agent status icon
3350
+ */
3351
+ agentIcon(status) {
3352
+ const icons = {
3353
+ running: "*",
3354
+ done: "+",
3355
+ waiting: "o"
3356
+ };
3357
+ return icons[status];
3358
+ }
3288
3359
  /**
3289
3360
  * Main render function
3290
3361
  */
3291
3362
  render() {
3292
- process.stdout.write("\x1B[2J\x1B[H");
3293
- this.renderHeader();
3294
- switch (this.state.view) {
3295
- case "overview":
3296
- this.renderOverview();
3297
- break;
3298
- case "issues":
3299
- this.renderIssuesList();
3300
- break;
3301
- case "agents":
3302
- this.renderAgentsView();
3303
- break;
3304
- case "files":
3305
- this.renderFilesView();
3306
- break;
3363
+ process.stdout.write("\x1B[2J\x1B[H\x1B[?25l");
3364
+ const width = Math.min(80, process.stdout.columns || 80);
3365
+ this.renderHeader(width);
3366
+ if (!this.state.scanComplete) {
3367
+ this.renderScanningView(width);
3368
+ } else {
3369
+ switch (this.state.view) {
3370
+ case "overview":
3371
+ this.renderOverview(width);
3372
+ break;
3373
+ case "issues":
3374
+ this.renderIssuesList(width);
3375
+ break;
3376
+ case "agents":
3377
+ this.renderAgentsView(width);
3378
+ break;
3379
+ case "files":
3380
+ this.renderFilesView(width);
3381
+ break;
3382
+ }
3383
+ }
3384
+ this.renderFooter(width);
3385
+ }
3386
+ /**
3387
+ * Render header with title and status
3388
+ */
3389
+ renderHeader(width) {
3390
+ const time = (/* @__PURE__ */ new Date()).toLocaleTimeString("en-US", { hour12: false, hour: "2-digit", minute: "2-digit", second: "2-digit" });
3391
+ let status = "SCANNING (...)";
3392
+ if (this.state.scanComplete) {
3393
+ status = "SCAN COMPLETE [OK]";
3394
+ }
3395
+ console.log("+" + this.line(width - 2) + "+");
3396
+ console.log("| TRIE GUARDIAN" + " ".repeat(width - 35 - status.length) + status + " " + time + " |");
3397
+ console.log("+" + this.line(width - 2) + "+");
3398
+ }
3399
+ /**
3400
+ * Render scanning in progress view
3401
+ */
3402
+ renderScanningView(width) {
3403
+ const { processedFiles, totalFiles, currentFile, activeAgents, completedAgents } = this.state.progress;
3404
+ const { issuesBySeverity } = this.state.progress;
3405
+ const percent = totalFiles > 0 ? Math.round(processedFiles / totalFiles * 100) : 0;
3406
+ const current = currentFile ? currentFile.split("/").pop() || "" : "";
3407
+ const progressBar = this.progressBar(processedFiles, totalFiles, 50);
3408
+ console.log("|" + " ".repeat(width - 2) + "|");
3409
+ console.log(`| Scanning: ${current.slice(0, 40).padEnd(40)}` + " ".repeat(width - 56) + "|");
3410
+ console.log(`| ${progressBar} ${percent}% (${processedFiles}/${totalFiles} files)`.padEnd(width - 1) + "|");
3411
+ console.log("|" + " ".repeat(width - 2) + "|");
3412
+ console.log("+" + this.line(width - 2) + "+");
3413
+ console.log("| AGENTS" + " ".repeat(width - 11) + "|");
3414
+ console.log("| " + this.line(width - 6) + " |");
3415
+ const allAgents = [.../* @__PURE__ */ new Set([...activeAgents, ...completedAgents])];
3416
+ const waitingAgents = ["security", "privacy", "typecheck", "accessibility", "legal", "test", "moneybags", "production-ready"].filter((a) => !activeAgents.includes(a) && !completedAgents.includes(a));
3417
+ const leftAgents = [];
3418
+ const rightAgents = [];
3419
+ allAgents.forEach((agent, i) => {
3420
+ const isActive = activeAgents.includes(agent);
3421
+ const isDone = completedAgents.includes(agent);
3422
+ const icon = isActive ? this.agentIcon("running") : isDone ? this.agentIcon("done") : this.agentIcon("waiting");
3423
+ const status = isActive ? "analyzing" : isDone ? `done (${this.getAgentIssueCount(agent)})` : "waiting";
3424
+ const entry = `${icon} ${agent.slice(0, 12).padEnd(12)} ... ${status.padEnd(15)}`;
3425
+ if (i % 2 === 0) {
3426
+ leftAgents.push(entry);
3427
+ } else {
3428
+ rightAgents.push(entry);
3429
+ }
3430
+ });
3431
+ waitingAgents.slice(0, 4).forEach((agent, i) => {
3432
+ const entry = `${this.agentIcon("waiting")} ${agent.slice(0, 12).padEnd(12)} ... waiting`.padEnd(35);
3433
+ if ((allAgents.length + i) % 2 === 0) {
3434
+ leftAgents.push(entry);
3435
+ } else {
3436
+ rightAgents.push(entry);
3437
+ }
3438
+ });
3439
+ const maxRows = Math.max(leftAgents.length, rightAgents.length, 4);
3440
+ for (let i = 0; i < maxRows && i < 4; i++) {
3441
+ const left = leftAgents[i] || " ".repeat(35);
3442
+ const right = rightAgents[i] || " ".repeat(35);
3443
+ console.log(`| ${left} ${right}`.slice(0, width - 1).padEnd(width - 1) + "|");
3444
+ }
3445
+ console.log("|" + " ".repeat(width - 2) + "|");
3446
+ console.log("+" + this.line(width - 2) + "+");
3447
+ console.log("| ISSUES FOUND" + " ".repeat(width - 17) + "|");
3448
+ console.log("| " + this.line(width - 6) + " |");
3449
+ console.log(`| [!] Critical ${issuesBySeverity.critical.toString().padStart(4)} [~] Moderate ${issuesBySeverity.moderate.toString().padStart(5)}`.padEnd(width - 1) + "|");
3450
+ console.log(`| [x] Serious ${issuesBySeverity.serious.toString().padStart(4)} [-] Low ${issuesBySeverity.low.toString().padStart(5)}`.padEnd(width - 1) + "|");
3451
+ console.log("|" + " ".repeat(width - 2) + "|");
3452
+ console.log("+" + this.line(width - 2) + "+");
3453
+ console.log("| ACTIVITY LOG" + " ".repeat(width - 17) + "|");
3454
+ console.log("| " + this.line(width - 6) + " |");
3455
+ const recentActivity = this.state.activityLog.slice(0, 6);
3456
+ for (const entry of recentActivity) {
3457
+ const line = `${entry.time} ${entry.message}`.slice(0, width - 6);
3458
+ console.log(`| ${line.padEnd(width - 4)}|`);
3459
+ }
3460
+ for (let i = recentActivity.length; i < 6; i++) {
3461
+ console.log("|" + " ".repeat(width - 2) + "|");
3307
3462
  }
3308
- this.renderFooter();
3309
3463
  }
3310
3464
  /**
3311
- * Render header with progress and title
3465
+ * Get issue count for an agent
3312
3466
  */
3313
- renderHeader() {
3314
- const title = "\u{1F50D} Trie Interactive Dashboard";
3315
- const timestamp = (/* @__PURE__ */ new Date()).toLocaleTimeString();
3316
- console.log("\u256D\u2500" + "\u2500".repeat(78) + "\u2500\u256E");
3317
- console.log(`\u2502 ${title.padEnd(40)} ${timestamp.padStart(38)} \u2502`);
3318
- console.log("\u251C\u2500" + "\u2500".repeat(78) + "\u2500\u2524");
3319
- const { processedFiles, totalFiles, activeAgents } = this.state.progress;
3320
- const progressPercent = totalFiles > 0 ? Math.round(processedFiles / totalFiles * 100) : 0;
3321
- const progressBar = createProgressBar(processedFiles, totalFiles, 30);
3322
- const activeText = activeAgents.length > 0 ? `Active: ${activeAgents.join(", ")}` : "Scanning...";
3323
- console.log(`\u2502 Progress: ${progressBar} ${progressPercent}%`.padEnd(79) + " \u2502");
3324
- console.log(`\u2502 ${activeText}`.padEnd(79) + " \u2502");
3325
- console.log("\u251C\u2500" + "\u2500".repeat(78) + "\u2500\u2524");
3467
+ getAgentIssueCount(agent) {
3468
+ return this.state.issues.filter((i) => i.agent === agent).length;
3326
3469
  }
3327
3470
  /**
3328
3471
  * Render overview with summary statistics
3329
3472
  */
3330
- renderOverview() {
3331
- const { issuesBySeverity, totalIssues } = this.state.progress;
3473
+ renderOverview(width) {
3474
+ const { issuesBySeverity, totalIssues, processedFiles } = this.state.progress;
3332
3475
  const { completedAgents } = this.state.progress;
3333
- console.log("\u2502 SCAN SUMMARY".padEnd(79) + " \u2502");
3334
- console.log("\u251C\u2500" + "\u2500".repeat(78) + "\u2500\u2524");
3335
- console.log(`\u2502 \u{1F534} Critical: ${issuesBySeverity.critical.toString().padStart(8)} \u{1F7E0} Serious: ${issuesBySeverity.serious.toString().padStart(8)}`.padEnd(79) + " \u2502");
3336
- console.log(`\u2502 \u{1F7E1} Moderate: ${issuesBySeverity.moderate.toString().padStart(8)} \u{1F535} Low: ${issuesBySeverity.low.toString().padStart(12)}`.padEnd(79) + " \u2502");
3337
- console.log(`\u2502 Total Issues: ${totalIssues.toString().padStart(8)}`.padEnd(79) + " \u2502");
3338
- console.log("\u251C\u2500" + "\u2500".repeat(78) + "\u2500\u2524");
3339
- console.log("\u2502 AGENT STATUS".padEnd(79) + " \u2502");
3340
- console.log("\u251C\u2500" + "\u2500".repeat(78) + "\u2500\u2524");
3341
- for (const agent of completedAgents.slice(0, 8)) {
3342
- const agentIssues = this.state.issues.filter((i) => i.agent === agent);
3343
- const statusIcon = agentIssues.length > 0 ? "\u26A0\uFE0F" : "\u2705";
3344
- console.log(`\u2502 ${statusIcon} ${agent.padEnd(20)} ${agentIssues.length.toString().padStart(4)} issues`.padEnd(79) + " \u2502");
3345
- }
3346
- const criticalIssues = this.state.issues.filter((i) => i.severity === "critical").slice(0, 5);
3476
+ const elapsed = ((Date.now() - this.state.startTime) / 1e3).toFixed(1);
3477
+ console.log("|" + " ".repeat(width - 2) + "|");
3478
+ console.log(`| ${processedFiles} files scanned in ${elapsed}s`.padEnd(width - 1) + "|");
3479
+ console.log(`| ${completedAgents.length} agents activated`.padEnd(width - 1) + "|");
3480
+ console.log("|" + " ".repeat(width - 2) + "|");
3481
+ console.log("+" + this.line(width - 2) + "+");
3482
+ console.log("| SUMMARY" + " ".repeat(width - 12) + "|");
3483
+ console.log("| " + this.line(width - 6) + " |");
3484
+ const criticalLabel = issuesBySeverity.critical > 0 ? "<- FIX NOW" : "";
3485
+ console.log(`| [!] ${issuesBySeverity.critical.toString().padStart(4)} Critical issues ${criticalLabel}`.padEnd(width - 1) + "|");
3486
+ console.log(`| [x] ${issuesBySeverity.serious.toString().padStart(4)} Serious issues`.padEnd(width - 1) + "|");
3487
+ console.log(`| [~] ${issuesBySeverity.moderate.toString().padStart(4)} Moderate issues`.padEnd(width - 1) + "|");
3488
+ console.log(`| [-] ${issuesBySeverity.low.toString().padStart(4)} Low issues`.padEnd(width - 1) + "|");
3489
+ console.log("|" + " ".repeat(width - 2) + "|");
3490
+ const criticalIssues = this.state.issues.filter((i) => i.severity === "critical").slice(0, 3);
3347
3491
  if (criticalIssues.length > 0) {
3348
- console.log("\u251C\u2500" + "\u2500".repeat(78) + "\u2500\u2524");
3349
- console.log("\u2502 \u{1F6A8} CRITICAL ISSUES".padEnd(79) + " \u2502");
3350
- console.log("\u251C\u2500" + "\u2500".repeat(78) + "\u2500\u2524");
3492
+ console.log("+" + this.line(width - 2) + "+");
3493
+ console.log("| TOP CRITICAL ISSUES" + " ".repeat(width - 24) + "|");
3494
+ console.log("| " + this.line(width - 6) + " |");
3351
3495
  for (const issue of criticalIssues) {
3352
3496
  const filename = issue.file.split("/").pop() || issue.file;
3353
3497
  const line = issue.line ? `:${issue.line}` : "";
3354
3498
  const location = `${filename}${line}`;
3355
- const description = issue.issue.slice(0, 45) + (issue.issue.length > 45 ? "..." : "");
3356
- console.log(`\u2502 ${location.padEnd(25)} ${description}`.slice(0, 79).padEnd(79) + " \u2502");
3499
+ const description = issue.issue.slice(0, 40) + (issue.issue.length > 40 ? "..." : "");
3500
+ console.log(`| > ${description}`.slice(0, width - 1).padEnd(width - 1) + "|");
3501
+ console.log(`| ${location}`.slice(0, width - 1).padEnd(width - 1) + "|");
3502
+ console.log("|" + " ".repeat(width - 2) + "|");
3357
3503
  }
3504
+ } else if (totalIssues === 0) {
3505
+ console.log("+" + this.line(width - 2) + "+");
3506
+ console.log("| [OK] No issues found - code looks good!".padEnd(width - 1) + "|");
3507
+ console.log("|" + " ".repeat(width - 2) + "|");
3508
+ }
3509
+ console.log("+" + this.line(width - 2) + "+");
3510
+ console.log("| ACTIVITY LOG" + " ".repeat(width - 17) + "|");
3511
+ console.log("| " + this.line(width - 6) + " |");
3512
+ const recentActivity = this.state.activityLog.slice(0, 8);
3513
+ for (const entry of recentActivity) {
3514
+ const line = `${entry.time} ${entry.message}`.slice(0, width - 6);
3515
+ console.log(`| ${line.padEnd(width - 4)}|`);
3516
+ }
3517
+ for (let i = recentActivity.length; i < 4; i++) {
3518
+ console.log("|" + " ".repeat(width - 2) + "|");
3358
3519
  }
3359
3520
  }
3360
3521
  /**
3361
3522
  * Render filtered issues list
3362
3523
  */
3363
- renderIssuesList() {
3524
+ renderIssuesList(width) {
3364
3525
  const filteredIssues = this.getFilteredIssues();
3365
3526
  const { selectedIssue } = this.state;
3366
- console.log("\u2502 ISSUES LIST".padEnd(79) + " \u2502");
3367
- console.log("\u251C\u2500" + "\u2500".repeat(78) + "\u2500\u2524");
3368
- const filterText = this.getFilterDescription();
3369
- console.log(`\u2502 Filter: ${filterText}`.padEnd(79) + " \u2502");
3370
- console.log("\u251C\u2500" + "\u2500".repeat(78) + "\u2500\u2524");
3371
- const pageSize = 15;
3527
+ console.log("| Filter: " + this.getFilterDescription().padEnd(width - 13) + "|");
3528
+ console.log("+" + this.line(width - 2) + "+");
3529
+ const pageSize = 10;
3372
3530
  const startIndex = Math.floor(selectedIssue / pageSize) * pageSize;
3373
3531
  const pageIssues = filteredIssues.slice(startIndex, startIndex + pageSize);
3374
3532
  for (let i = 0; i < pageIssues.length; i++) {
3375
3533
  const issue = pageIssues[i];
3376
3534
  const globalIndex = startIndex + i;
3377
3535
  const isSelected = globalIndex === selectedIssue;
3378
- const cursor = isSelected ? "\u25B6 " : " ";
3379
- const severityIcon = this.getSeverityIcon(issue.severity);
3536
+ const cursor = isSelected ? ">" : " ";
3537
+ const severityIcon = this.severityIcon(issue.severity);
3380
3538
  const filename = issue.file.split("/").pop() || issue.file;
3381
3539
  const location = `${filename}:${issue.line || "?"}`;
3382
- const description = issue.issue.slice(0, 40) + (issue.issue.length > 40 ? "..." : "");
3383
- const line = `${cursor}${severityIcon} ${location.padEnd(20)} ${description}`;
3384
- console.log(`\u2502 ${line}`.slice(0, 79).padEnd(79) + " \u2502");
3540
+ const description = issue.issue.slice(0, 35) + (issue.issue.length > 35 ? "..." : "");
3541
+ const line = `${severityIcon} ${cursor} ${description.padEnd(38)} ${location.padEnd(20)}`;
3542
+ console.log(`| ${line}`.slice(0, width - 1).padEnd(width - 1) + "|");
3543
+ }
3544
+ for (let i = pageIssues.length; i < pageSize; i++) {
3545
+ console.log("|" + " ".repeat(width - 2) + "|");
3385
3546
  }
3386
3547
  if (filteredIssues[selectedIssue]) {
3387
3548
  const selected = filteredIssues[selectedIssue];
3388
- console.log("\u251C\u2500" + "\u2500".repeat(78) + "\u2500\u2524");
3389
- console.log("\u2502 ISSUE DETAILS".padEnd(79) + " \u2502");
3390
- console.log("\u251C\u2500" + "\u2500".repeat(78) + "\u2500\u2524");
3391
- console.log(`\u2502 File: ${selected.file}`.slice(0, 79).padEnd(79) + " \u2502");
3392
- console.log(`\u2502 Line: ${selected.line || "Unknown"}`.padEnd(79) + " \u2502");
3393
- console.log(`\u2502 Agent: ${selected.agent}`.padEnd(79) + " \u2502");
3394
- const issueLines = this.wrapText(selected.issue, 75);
3395
- console.log(`\u2502 Issue:`.padEnd(79) + " \u2502");
3396
- for (const line of issueLines.slice(0, 3)) {
3397
- console.log(`\u2502 ${line}`.padEnd(79) + " \u2502");
3398
- }
3399
- const fixLines = this.wrapText(selected.fix, 75);
3400
- console.log(`\u2502 Fix:`.padEnd(79) + " \u2502");
3401
- for (const line of fixLines.slice(0, 3)) {
3402
- console.log(`\u2502 ${line}`.padEnd(79) + " \u2502");
3549
+ console.log("+" + this.line(width - 2) + "+");
3550
+ console.log("| SELECTED: " + selected.issue.slice(0, width - 15).padEnd(width - 15) + "|");
3551
+ console.log("| " + this.line(width - 6) + " |");
3552
+ console.log(`| File: ${selected.file}`.slice(0, width - 1).padEnd(width - 1) + "|");
3553
+ console.log(`| Line: ${selected.line || "Unknown"} Agent: ${selected.agent}`.padEnd(width - 1) + "|");
3554
+ console.log("|" + " ".repeat(width - 2) + "|");
3555
+ const fixLines = this.wrapText(selected.fix, width - 8);
3556
+ console.log("| Fix:".padEnd(width - 1) + "|");
3557
+ for (const line of fixLines.slice(0, 2)) {
3558
+ console.log(`| ${line}`.padEnd(width - 1) + "|");
3403
3559
  }
3404
3560
  }
3405
3561
  }
3406
3562
  /**
3407
3563
  * Render agents view
3408
3564
  */
3409
- renderAgentsView() {
3565
+ renderAgentsView(width) {
3410
3566
  const { completedAgents, activeAgents } = this.state.progress;
3411
- console.log("\u2502 AGENTS STATUS".padEnd(79) + " \u2502");
3412
- console.log("\u251C\u2500" + "\u2500".repeat(78) + "\u2500\u2524");
3567
+ console.log("| AGENTS STATUS" + " ".repeat(width - 18) + "|");
3568
+ console.log("+" + this.line(width - 2) + "+");
3413
3569
  if (activeAgents.length > 0) {
3414
- console.log("\u2502 \u{1F504} ACTIVE AGENTS".padEnd(79) + " \u2502");
3570
+ console.log("| * ACTIVE AGENTS" + " ".repeat(width - 20) + "|");
3415
3571
  for (const agent of activeAgents) {
3416
- console.log(`\u2502 \u2022 ${agent}`.padEnd(79) + " \u2502");
3572
+ console.log(`| - ${agent}`.padEnd(width - 1) + "|");
3417
3573
  }
3418
- console.log("\u251C\u2500" + "\u2500".repeat(78) + "\u2500\u2524");
3574
+ console.log("|" + " ".repeat(width - 2) + "|");
3419
3575
  }
3420
- console.log("\u2502 \u2705 COMPLETED AGENTS".padEnd(79) + " \u2502");
3576
+ console.log("| + COMPLETED AGENTS" + " ".repeat(width - 23) + "|");
3421
3577
  for (const agent of completedAgents) {
3422
3578
  const agentIssues = this.state.issues.filter((i) => i.agent === agent);
3423
3579
  const criticalCount = agentIssues.filter((i) => i.severity === "critical").length;
3424
3580
  const statusText = criticalCount > 0 ? `${criticalCount} critical` : `${agentIssues.length} issues`;
3425
- console.log(`\u2502 \u2022 ${agent.padEnd(25)} ${statusText}`.padEnd(79) + " \u2502");
3581
+ console.log(`| - ${agent.padEnd(25)} ${statusText}`.padEnd(width - 1) + "|");
3426
3582
  }
3427
3583
  }
3428
3584
  /**
3429
3585
  * Render files view
3430
3586
  */
3431
- renderFilesView() {
3587
+ renderFilesView(width) {
3432
3588
  const fileIssues = /* @__PURE__ */ new Map();
3433
3589
  for (const issue of this.state.issues) {
3434
3590
  if (!fileIssues.has(issue.file)) {
@@ -3436,29 +3592,31 @@ var InteractiveDashboard = class {
3436
3592
  }
3437
3593
  fileIssues.get(issue.file).push(issue);
3438
3594
  }
3439
- const sortedFiles = Array.from(fileIssues.entries()).sort((a, b) => b[1].length - a[1].length).slice(0, 20);
3440
- console.log("\u2502 FILES WITH ISSUES".padEnd(79) + " \u2502");
3441
- console.log("\u251C\u2500" + "\u2500".repeat(78) + "\u2500\u2524");
3595
+ const sortedFiles = Array.from(fileIssues.entries()).sort((a, b) => b[1].length - a[1].length).slice(0, 15);
3596
+ console.log("| FILES WITH ISSUES" + " ".repeat(width - 22) + "|");
3597
+ console.log("+" + this.line(width - 2) + "+");
3442
3598
  for (const [file, issues] of sortedFiles) {
3443
3599
  const filename = file.split("/").pop() || file;
3444
3600
  const criticalCount = issues.filter((i) => i.severity === "critical").length;
3445
3601
  const totalCount = issues.length;
3446
3602
  const criticalText = criticalCount > 0 ? ` (${criticalCount} critical)` : "";
3447
- console.log(`\u2502 ${filename.padEnd(35)} ${totalCount} issues${criticalText}`.slice(0, 79).padEnd(79) + " \u2502");
3603
+ console.log(`| ${filename.padEnd(35)} ${totalCount} issues${criticalText}`.slice(0, width - 1).padEnd(width - 1) + "|");
3448
3604
  }
3449
3605
  }
3450
3606
  /**
3451
3607
  * Render footer with controls
3452
3608
  */
3453
- renderFooter() {
3454
- console.log("\u251C\u2500" + "\u2500".repeat(78) + "\u2500\u2524");
3455
- console.log("\u2502 CONTROLS:".padEnd(79) + " \u2502");
3456
- console.log("\u2502 Tab: Switch view \u2191\u2193: Navigate Enter: Select 1-4: Filter severity \u2502");
3457
- console.log("\u2502 f: Search filter c: Clear filters h: Help q: Quit".padEnd(79) + " \u2502");
3458
- console.log("\u2570\u2500" + "\u2500".repeat(78) + "\u2500\u256F");
3609
+ renderFooter(width) {
3610
+ console.log("+" + this.line(width - 2) + "+");
3611
+ if (!this.state.scanComplete) {
3612
+ console.log(" [q] Quit [v] Verbose mode [Esc] Cancel scan");
3613
+ } else {
3614
+ console.log(" [Tab] Switch view [up/down] Navigate [1-4] Filter [q] Quit");
3615
+ }
3459
3616
  }
3460
3617
  // Helper methods
3461
3618
  switchView() {
3619
+ if (!this.state.scanComplete) return;
3462
3620
  const views = ["overview", "issues", "agents", "files"];
3463
3621
  const currentIndex = views.indexOf(this.state.view);
3464
3622
  const nextIndex = (currentIndex + 1) % views.length;
@@ -3515,10 +3673,7 @@ var InteractiveDashboard = class {
3515
3673
  if (this.state.filter.severity !== "all") parts.push(`Severity: ${this.state.filter.severity}`);
3516
3674
  if (this.state.filter.agent !== "all") parts.push(`Agent: ${this.state.filter.agent}`);
3517
3675
  if (this.state.filter.search) parts.push(`Search: "${this.state.filter.search}"`);
3518
- return parts.length > 0 ? parts.join(", ") : "None";
3519
- }
3520
- getSeverityIcon(severity) {
3521
- return { critical: "\u{1F534}", serious: "\u{1F7E0}", moderate: "\u{1F7E1}", low: "\u{1F535}" }[severity];
3676
+ return parts.length > 0 ? parts.join(", ") : "All issues";
3522
3677
  }
3523
3678
  wrapText(text, width) {
3524
3679
  const words = text.split(" ");
@@ -3551,21 +3706,23 @@ var InteractiveDashboard = class {
3551
3706
  showHelp() {
3552
3707
  this.isActive = false;
3553
3708
  process.stdout.write("\x1B[2J\x1B[H");
3554
- console.log("\u256D\u2500 Trie Interactive Dashboard Help \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E");
3555
- console.log("\u2502 Navigation \u2502");
3556
- console.log("\u2502 Tab Switch view (overview/issues/agents/files) \u2502");
3557
- console.log("\u2502 \u2191 / \u2193 Navigate issues list \u2502");
3558
- console.log("\u2502 Enter View issue details \u2502");
3559
- console.log("\u2502 Filters \u2502");
3560
- console.log("\u2502 1-4 Filter by severity (critical\u2192low) \u2502");
3561
- console.log("\u2502 0 Clear severity filter \u2502");
3562
- console.log("\u2502 f Search filter \u2502");
3563
- console.log("\u2502 c Clear all filters \u2502");
3564
- console.log("\u2502 Other \u2502");
3565
- console.log("\u2502 h or ? Show this help \u2502");
3566
- console.log("\u2502 q Quit \u2502");
3567
- console.log("\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F");
3568
- console.log("Press any key to return...");
3709
+ console.log("+" + this.line(66) + "+");
3710
+ console.log("| TRIE GUARDIAN - HELP" + " ".repeat(44) + "|");
3711
+ console.log("+" + this.line(66) + "+");
3712
+ console.log("| Navigation" + " ".repeat(54) + "|");
3713
+ console.log("| Tab Switch view (overview/issues/agents/files)" + " ".repeat(8) + "|");
3714
+ console.log("| up/down Navigate issues list" + " ".repeat(29) + "|");
3715
+ console.log("| Enter View issue details" + " ".repeat(31) + "|");
3716
+ console.log("| Filters" + " ".repeat(57) + "|");
3717
+ console.log("| 1-4 Filter by severity (critical->low)" + " ".repeat(16) + "|");
3718
+ console.log("| 0 Clear severity filter" + " ".repeat(28) + "|");
3719
+ console.log("| f Search filter" + " ".repeat(36) + "|");
3720
+ console.log("| c Clear all filters" + " ".repeat(32) + "|");
3721
+ console.log("| Other" + " ".repeat(59) + "|");
3722
+ console.log("| h or ? Show this help" + " ".repeat(35) + "|");
3723
+ console.log("| q Quit" + " ".repeat(45) + "|");
3724
+ console.log("+" + this.line(66) + "+");
3725
+ console.log(" Press any key to return...");
3569
3726
  const resume = () => {
3570
3727
  this.isActive = true;
3571
3728
  this.render();
@@ -3575,23 +3732,25 @@ var InteractiveDashboard = class {
3575
3732
  showIssueDetails(issue) {
3576
3733
  this.isActive = false;
3577
3734
  process.stdout.write("\x1B[2J\x1B[H");
3578
- console.log("\u256D\u2500 Issue Details \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E");
3579
- console.log(`\u2502 File: ${issue.file}`.slice(0, 63).padEnd(63) + "\u2502");
3580
- console.log(`\u2502 Line: ${issue.line || "Unknown"} Agent: ${issue.agent}`.slice(0, 63).padEnd(63) + "\u2502");
3581
- console.log("\u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524");
3582
- console.log("\u2502 Issue \u2502");
3583
- const issueLines = this.wrapText(issue.issue, 61);
3584
- for (const line of issueLines.slice(0, 6)) {
3585
- console.log(`\u2502 ${line}`.padEnd(63) + "\u2502");
3586
- }
3587
- console.log("\u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524");
3588
- console.log("\u2502 Fix \u2502");
3589
- const fixLines = this.wrapText(issue.fix, 61);
3590
- for (const line of fixLines.slice(0, 6)) {
3591
- console.log(`\u2502 ${line}`.padEnd(63) + "\u2502");
3592
- }
3593
- console.log("\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F");
3594
- console.log("Press any key to return...");
3735
+ console.log("+" + this.line(66) + "+");
3736
+ console.log("| ISSUE DETAILS" + " ".repeat(51) + "|");
3737
+ console.log("+" + this.line(66) + "+");
3738
+ console.log(`| File: ${issue.file}`.slice(0, 66).padEnd(66) + "|");
3739
+ console.log(`| Line: ${issue.line || "Unknown"} Agent: ${issue.agent}`.slice(0, 66).padEnd(66) + "|");
3740
+ console.log("+" + this.line(66) + "+");
3741
+ console.log("| Issue" + " ".repeat(59) + "|");
3742
+ const issueLines = this.wrapText(issue.issue, 62);
3743
+ for (const line of issueLines.slice(0, 4)) {
3744
+ console.log(`| ${line}`.padEnd(66) + "|");
3745
+ }
3746
+ console.log("+" + this.line(66) + "+");
3747
+ console.log("| Fix" + " ".repeat(61) + "|");
3748
+ const fixLines = this.wrapText(issue.fix, 62);
3749
+ for (const line of fixLines.slice(0, 4)) {
3750
+ console.log(`| ${line}`.padEnd(66) + "|");
3751
+ }
3752
+ console.log("+" + this.line(66) + "+");
3753
+ console.log(" Press any key to return...");
3595
3754
  const resume = () => {
3596
3755
  this.isActive = true;
3597
3756
  this.render();
@@ -4872,6 +5031,9 @@ var TrieScanTool = class {
4872
5031
  const useWorkerThreads = args?.workers ?? true;
4873
5032
  const streamingManager = streamingEnabled ? new StreamingManager() : void 0;
4874
5033
  const dashboard = interactiveEnabled ? new InteractiveDashboard() : void 0;
5034
+ if (interactiveEnabled) {
5035
+ setInteractiveMode(true);
5036
+ }
4875
5037
  if (dashboard && streamingManager) {
4876
5038
  streamingManager.subscribe((update) => dashboard.handleStreamUpdate(update));
4877
5039
  await dashboard.start();
@@ -4953,7 +5115,7 @@ var TrieScanTool = class {
4953
5115
  const before = selectedAgents.length;
4954
5116
  selectedAgents = selectedAgents.filter((a) => !excludeAgents.has(a.name));
4955
5117
  const removed = before - selectedAgents.length;
4956
- if (removed > 0) {
5118
+ if (removed > 0 && !isInteractiveMode()) {
4957
5119
  console.error(` Excluding ${removed} agent(s): ${Array.from(excludeAgents).join(", ")}`);
4958
5120
  }
4959
5121
  }
@@ -4965,7 +5127,9 @@ var TrieScanTool = class {
4965
5127
  const moneybags2 = selectedAgents.find((a) => a.name === "moneybags");
4966
5128
  if (moneybags2 && "configure" in moneybags2 && typeof moneybags2.configure === "function") {
4967
5129
  moneybags2.configure({ userCount });
4968
- console.error(` Cost estimates scaled for ${userCount.toLocaleString()} users`);
5130
+ if (!isInteractiveMode()) {
5131
+ console.error(` Cost estimates scaled for ${userCount.toLocaleString()} users`);
5132
+ }
4969
5133
  }
4970
5134
  }
4971
5135
  this.progress.startPhase("ai-review", "Running AI analysis...");
@@ -5185,6 +5349,7 @@ var TrieScanTool = class {
5185
5349
  }
5186
5350
  }
5187
5351
  logContextAnalysis(context) {
5352
+ if (isInteractiveMode()) return;
5188
5353
  console.error("\n Detected Context Signals:");
5189
5354
  const signals = [];
5190
5355
  if (context.touchesAuth) signals.push("* Authentication/Authorization");
@@ -5207,6 +5372,7 @@ var TrieScanTool = class {
5207
5372
  console.error("");
5208
5373
  }
5209
5374
  logRiskAssessment(context, riskLevel) {
5375
+ if (isInteractiveMode()) return;
5210
5376
  const riskLabel = {
5211
5377
  low: "[LOW]",
5212
5378
  medium: "[MEDIUM]",
@@ -5231,6 +5397,7 @@ var TrieScanTool = class {
5231
5397
  console.error("");
5232
5398
  }
5233
5399
  logTriaging(selectedNames, allAgentNames, context, riskLevel) {
5400
+ if (isInteractiveMode()) return;
5234
5401
  console.error(`
5235
5402
  Agents Selected: ${selectedNames.length} of ${allAgentNames.length} available`);
5236
5403
  console.error("");
@@ -5606,4 +5773,4 @@ export {
5606
5773
  loadConfig,
5607
5774
  TrieScanTool
5608
5775
  };
5609
- //# sourceMappingURL=chunk-YKUCIKTU.js.map
5776
+ //# sourceMappingURL=chunk-3NTILEEL.js.map