@triedotdev/mcp 1.0.80 → 1.0.81

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.
Files changed (35) hide show
  1. package/README.md +64 -18
  2. package/dist/{agent-smith-XGYNJUCJ.js → agent-smith-MCKGNWPL.js} +3 -3
  3. package/dist/{agent-smith-runner-QHYGVRNR.js → agent-smith-runner-GP5HLL7E.js} +3 -3
  4. package/dist/{chunk-KCAWTZ7P.js → chunk-2BXLPYHR.js} +600 -135
  5. package/dist/chunk-2BXLPYHR.js.map +1 -0
  6. package/dist/{chunk-45NUFTNV.js → chunk-7OVM6KEY.js} +29 -2
  7. package/dist/chunk-7OVM6KEY.js.map +1 -0
  8. package/dist/chunk-B7CLAOEK.js +532 -0
  9. package/dist/chunk-B7CLAOEK.js.map +1 -0
  10. package/dist/{chunk-Z7N7KDK3.js → chunk-DCJKNE2L.js} +2 -1
  11. package/dist/{chunk-D3F7VKCN.js → chunk-FW435YKY.js} +300 -440
  12. package/dist/chunk-FW435YKY.js.map +1 -0
  13. package/dist/{chunk-432E2RYB.js → chunk-MVWRFARH.js} +112 -543
  14. package/dist/chunk-MVWRFARH.js.map +1 -0
  15. package/dist/{chunk-EWQF6INU.js → chunk-TBRU735C.js} +2 -2
  16. package/dist/{chunk-LKXDJESG.js → chunk-YKG4KIY7.js} +3 -3
  17. package/dist/cli/main.js +184 -60
  18. package/dist/cli/main.js.map +1 -1
  19. package/dist/cli/yolo-daemon.js +8 -7
  20. package/dist/cli/yolo-daemon.js.map +1 -1
  21. package/dist/{guardian-agent-UPLAQWJK.js → guardian-agent-GWYDNLWC.js} +7 -3
  22. package/dist/index.js +83 -16
  23. package/dist/index.js.map +1 -1
  24. package/dist/workers/agent-worker.js +3 -3
  25. package/package.json +1 -1
  26. package/dist/chunk-432E2RYB.js.map +0 -1
  27. package/dist/chunk-45NUFTNV.js.map +0 -1
  28. package/dist/chunk-D3F7VKCN.js.map +0 -1
  29. package/dist/chunk-KCAWTZ7P.js.map +0 -1
  30. /package/dist/{agent-smith-XGYNJUCJ.js.map → agent-smith-MCKGNWPL.js.map} +0 -0
  31. /package/dist/{agent-smith-runner-QHYGVRNR.js.map → agent-smith-runner-GP5HLL7E.js.map} +0 -0
  32. /package/dist/{chunk-Z7N7KDK3.js.map → chunk-DCJKNE2L.js.map} +0 -0
  33. /package/dist/{chunk-EWQF6INU.js.map → chunk-TBRU735C.js.map} +0 -0
  34. /package/dist/{chunk-LKXDJESG.js.map → chunk-YKG4KIY7.js.map} +0 -0
  35. /package/dist/{guardian-agent-UPLAQWJK.js.map → guardian-agent-GWYDNLWC.js.map} +0 -0
@@ -1,12 +1,7 @@
1
- import {
2
- getVulnerabilityStats,
3
- getVulnerabilityTrie,
4
- scanForVulnerabilities
5
- } from "./chunk-FCMAQSV7.js";
6
1
  import {
7
2
  SlackIntegration,
8
3
  getGuardian
9
- } from "./chunk-45NUFTNV.js";
4
+ } from "./chunk-7OVM6KEY.js";
10
5
  import {
11
6
  Executor,
12
7
  Triager,
@@ -15,8 +10,14 @@ import {
15
10
  getSkillCategories,
16
11
  getSkillsByCategory,
17
12
  isGitRepo,
18
- isTrieInitialized
19
- } from "./chunk-KCAWTZ7P.js";
13
+ isTrieInitialized,
14
+ loadConfig
15
+ } from "./chunk-2BXLPYHR.js";
16
+ import {
17
+ getVulnerabilityStats,
18
+ getVulnerabilityTrie,
19
+ scanForVulnerabilities
20
+ } from "./chunk-FCMAQSV7.js";
20
21
  import {
21
22
  getGuardianState
22
23
  } from "./chunk-75J4HQTD.js";
@@ -30,7 +31,7 @@ import {
30
31
  removeGlobalSkill,
31
32
  runShellCommand,
32
33
  updateContextAfterScan
33
- } from "./chunk-LKXDJESG.js";
34
+ } from "./chunk-YKG4KIY7.js";
34
35
  import {
35
36
  findCrossProjectPatterns
36
37
  } from "./chunk-EWIEXQES.js";
@@ -39,10 +40,10 @@ import {
39
40
  } from "./chunk-6NLHFIYA.js";
40
41
  import {
41
42
  getOutputManager
42
- } from "./chunk-EWQF6INU.js";
43
+ } from "./chunk-TBRU735C.js";
43
44
  import {
44
45
  isAIAvailable
45
- } from "./chunk-Z7N7KDK3.js";
46
+ } from "./chunk-DCJKNE2L.js";
46
47
  import {
47
48
  atomicWriteJSON,
48
49
  getMemoryStats,
@@ -57,9 +58,6 @@ import {
57
58
  isInteractiveMode,
58
59
  setInteractiveMode
59
60
  } from "./chunk-MIL54SAF.js";
60
- import {
61
- __require
62
- } from "./chunk-DGUM43GV.js";
63
61
 
64
62
  // src/utils/streaming.ts
65
63
  var shouldSuppressConsole = () => isInteractiveMode();
@@ -3688,11 +3686,11 @@ var InteractiveDashboard = class {
3688
3686
  pLine(colors.highlight("Install this skill? ") + colors.dim("(y/n)"));
3689
3687
  pLine("");
3690
3688
  console.log(colors.border(box.bottomLeft + this.line(w - 2) + box.bottomRight));
3691
- const answer = await new Promise((resolve3) => {
3689
+ const answer = await new Promise((resolve2) => {
3692
3690
  const handler = (_chunk, key) => {
3693
3691
  if (key.name === "y" || key.name === "n" || key.name === "escape" || key.name === "q") {
3694
3692
  input.removeListener("keypress", handler);
3695
- resolve3(key.name);
3693
+ resolve2(key.name);
3696
3694
  }
3697
3695
  };
3698
3696
  input.on("keypress", handler);
@@ -3756,10 +3754,10 @@ var InteractiveDashboard = class {
3756
3754
  this.addActivity(`Skill install error: ${errMsg}`);
3757
3755
  }
3758
3756
  this.state.skillsBrowser.installing = false;
3759
- await new Promise((resolve3) => {
3757
+ await new Promise((resolve2) => {
3760
3758
  const handler = () => {
3761
3759
  input.removeListener("keypress", handler);
3762
- resolve3();
3760
+ resolve2();
3763
3761
  };
3764
3762
  input.once("keypress", handler);
3765
3763
  });
@@ -3794,11 +3792,11 @@ var InteractiveDashboard = class {
3794
3792
  pLine(colors.highlight("Remove this skill? ") + colors.dim("(y/n)"));
3795
3793
  pLine("");
3796
3794
  console.log(colors.border(box.bottomLeft + this.line(w - 2) + box.bottomRight));
3797
- const answer = await new Promise((resolve3) => {
3795
+ const answer = await new Promise((resolve2) => {
3798
3796
  const handler = (_chunk, key) => {
3799
3797
  if (key.name === "y" || key.name === "n" || key.name === "escape" || key.name === "q") {
3800
3798
  input.removeListener("keypress", handler);
3801
- resolve3(key.name);
3799
+ resolve2(key.name);
3802
3800
  }
3803
3801
  };
3804
3802
  input.on("keypress", handler);
@@ -3860,7 +3858,7 @@ var InteractiveDashboard = class {
3860
3858
  pLine(colors.dim("Falling back to manual entry..."));
3861
3859
  pLine("");
3862
3860
  console.log(colors.border(box.bottomLeft + this.line(w - 2) + box.bottomRight));
3863
- await new Promise((resolve3) => setTimeout(resolve3, 1500));
3861
+ await new Promise((resolve2) => setTimeout(resolve2, 1500));
3864
3862
  } else {
3865
3863
  filePath = result2.path;
3866
3864
  }
@@ -3888,10 +3886,10 @@ var InteractiveDashboard = class {
3888
3886
  input.setRawMode(false);
3889
3887
  }
3890
3888
  const rl = readline.createInterface({ input, output });
3891
- filePath = await new Promise((resolve3) => {
3889
+ filePath = await new Promise((resolve2) => {
3892
3890
  rl.question("", (answer) => {
3893
3891
  rl.close();
3894
- resolve3(answer.trim());
3892
+ resolve2(answer.trim());
3895
3893
  });
3896
3894
  });
3897
3895
  if (input.isTTY) {
@@ -3921,8 +3919,8 @@ var InteractiveDashboard = class {
3921
3919
  console.log(colors.border(box.leftT + this.line(w - 2) + box.rightT));
3922
3920
  pLine(colors.dim("Press any key to continue..."));
3923
3921
  console.log(colors.border(box.bottomLeft + this.line(w - 2) + box.bottomRight));
3924
- await new Promise((resolve3) => {
3925
- input.once("keypress", () => resolve3());
3922
+ await new Promise((resolve2) => {
3923
+ input.once("keypress", () => resolve2());
3926
3924
  });
3927
3925
  this.isActive = true;
3928
3926
  this.render();
@@ -3974,8 +3972,8 @@ var InteractiveDashboard = class {
3974
3972
  pLine(colors.dim("Press any key to continue..."));
3975
3973
  console.log(colors.border(box.bottomLeft + this.line(w - 2) + box.bottomRight));
3976
3974
  }
3977
- await new Promise((resolve3) => {
3978
- input.once("keypress", () => resolve3());
3975
+ await new Promise((resolve2) => {
3976
+ input.once("keypress", () => resolve2());
3979
3977
  });
3980
3978
  this.isActive = true;
3981
3979
  this.render();
@@ -4285,7 +4283,7 @@ var InteractiveDashboard = class {
4285
4283
  stdio: "inherit",
4286
4284
  cwd: process.cwd()
4287
4285
  });
4288
- await new Promise((resolve3) => {
4286
+ await new Promise((resolve2) => {
4289
4287
  child.on("close", (code) => {
4290
4288
  console.log("");
4291
4289
  console.log(colors.dim(" \u2500".repeat(40)));
@@ -4296,20 +4294,20 @@ var InteractiveDashboard = class {
4296
4294
  }
4297
4295
  console.log("");
4298
4296
  console.log(colors.dim(" Press any key to return to dashboard..."));
4299
- resolve3();
4297
+ resolve2();
4300
4298
  });
4301
4299
  child.on("error", (err) => {
4302
4300
  console.log("");
4303
4301
  console.log(colors.critical(` \u2717 Failed to run command: ${err.message}`));
4304
4302
  console.log("");
4305
4303
  console.log(colors.dim(" Press any key to return to dashboard..."));
4306
- resolve3();
4304
+ resolve2();
4307
4305
  });
4308
4306
  });
4309
- await new Promise((resolve3) => {
4307
+ await new Promise((resolve2) => {
4310
4308
  const onKeypress = () => {
4311
4309
  process.stdin.removeListener("keypress", onKeypress);
4312
- resolve3();
4310
+ resolve2();
4313
4311
  };
4314
4312
  process.stdin.once("keypress", onKeypress);
4315
4313
  });
@@ -4631,13 +4629,13 @@ var InteractiveDashboard = class {
4631
4629
  pLine(" " + colors.highlight(" 5") + " - Auto-escalation settings");
4632
4630
  pLine(" " + colors.highlight(" Esc") + " - Cancel");
4633
4631
  console.log(colors.border(box.bottomLeft + this.line(w - 2) + box.bottomRight));
4634
- return new Promise((resolve3) => {
4632
+ return new Promise((resolve2) => {
4635
4633
  const handler = (_ch, key) => {
4636
4634
  if (key.name === "escape") {
4637
4635
  input.removeListener("keypress", handler);
4638
4636
  this.isActive = true;
4639
4637
  this.render();
4640
- resolve3();
4638
+ resolve2();
4641
4639
  return;
4642
4640
  }
4643
4641
  if (key.name === "1" || _ch === "1") {
@@ -4645,7 +4643,7 @@ var InteractiveDashboard = class {
4645
4643
  this.showMoneybagsConfig().then(() => {
4646
4644
  this.isActive = true;
4647
4645
  this.render();
4648
- resolve3();
4646
+ resolve2();
4649
4647
  });
4650
4648
  return;
4651
4649
  }
@@ -4654,7 +4652,7 @@ var InteractiveDashboard = class {
4654
4652
  this.showAgentSmithConfig().then(() => {
4655
4653
  this.isActive = true;
4656
4654
  this.render();
4657
- resolve3();
4655
+ resolve2();
4658
4656
  });
4659
4657
  return;
4660
4658
  }
@@ -4663,7 +4661,7 @@ var InteractiveDashboard = class {
4663
4661
  this.showPerformanceConfig().then(() => {
4664
4662
  this.isActive = true;
4665
4663
  this.render();
4666
- resolve3();
4664
+ resolve2();
4667
4665
  });
4668
4666
  return;
4669
4667
  }
@@ -4672,7 +4670,7 @@ var InteractiveDashboard = class {
4672
4670
  this.showRiskThresholdsConfig().then(() => {
4673
4671
  this.isActive = true;
4674
4672
  this.render();
4675
- resolve3();
4673
+ resolve2();
4676
4674
  });
4677
4675
  return;
4678
4676
  }
@@ -4681,7 +4679,7 @@ var InteractiveDashboard = class {
4681
4679
  this.showEscalationConfig().then(() => {
4682
4680
  this.isActive = true;
4683
4681
  this.render();
4684
- resolve3();
4682
+ resolve2();
4685
4683
  });
4686
4684
  return;
4687
4685
  }
@@ -4693,7 +4691,7 @@ var InteractiveDashboard = class {
4693
4691
  * Show Moneybags configuration submenu
4694
4692
  */
4695
4693
  async showMoneybagsConfig() {
4696
- return new Promise((resolve3) => {
4694
+ return new Promise((resolve2) => {
4697
4695
  process.stdout.write("\x1B[2J\x1B[H");
4698
4696
  const v = colors.border(box.vertical);
4699
4697
  const w = Math.max(60, Math.min(80, (process.stdout.columns || 80) - 4));
@@ -4739,32 +4737,32 @@ var InteractiveDashboard = class {
4739
4737
  const handler = (_ch, key) => {
4740
4738
  if (key.name === "escape") {
4741
4739
  input.removeListener("keypress", handler);
4742
- resolve3();
4740
+ resolve2();
4743
4741
  return;
4744
4742
  }
4745
4743
  if (key.name === "1" || _ch === "1") {
4746
4744
  input.removeListener("keypress", handler);
4747
- this.promptUserCount().then(resolve3);
4745
+ this.promptUserCount().then(resolve2);
4748
4746
  return;
4749
4747
  }
4750
4748
  if (key.name === "2" || _ch === "2") {
4751
4749
  input.removeListener("keypress", handler);
4752
- this.promptPayingUsers().then(resolve3);
4750
+ this.promptPayingUsers().then(resolve2);
4753
4751
  return;
4754
4752
  }
4755
4753
  if (key.name === "3" || _ch === "3") {
4756
4754
  input.removeListener("keypress", handler);
4757
- this.promptRevenuePerUser().then(resolve3);
4755
+ this.promptRevenuePerUser().then(resolve2);
4758
4756
  return;
4759
4757
  }
4760
4758
  if (key.name === "4" || _ch === "4") {
4761
4759
  input.removeListener("keypress", handler);
4762
- this.promptDeveloperRate().then(resolve3);
4760
+ this.promptDeveloperRate().then(resolve2);
4763
4761
  return;
4764
4762
  }
4765
4763
  if (key.name === "5" || _ch === "5") {
4766
4764
  input.removeListener("keypress", handler);
4767
- this.promptIndustry().then(resolve3);
4765
+ this.promptIndustry().then(resolve2);
4768
4766
  return;
4769
4767
  }
4770
4768
  };
@@ -4775,7 +4773,7 @@ var InteractiveDashboard = class {
4775
4773
  * Show Agent Smith configuration submenu
4776
4774
  */
4777
4775
  async showAgentSmithConfig() {
4778
- return new Promise((resolve3) => {
4776
+ return new Promise((resolve2) => {
4779
4777
  process.stdout.write("\x1B[2J\x1B[H");
4780
4778
  const v = colors.border(box.vertical);
4781
4779
  const w = Math.max(60, Math.min(80, (process.stdout.columns || 80) - 4));
@@ -4811,7 +4809,7 @@ var InteractiveDashboard = class {
4811
4809
  const handler = (_ch, key) => {
4812
4810
  if (key.name === "escape") {
4813
4811
  input.removeListener("keypress", handler);
4814
- resolve3();
4812
+ resolve2();
4815
4813
  return;
4816
4814
  }
4817
4815
  if (key.name === "1" || _ch === "1") {
@@ -4819,22 +4817,22 @@ var InteractiveDashboard = class {
4819
4817
  this.state.guardianConfig.agentSmith.aiEnhancement = !this.state.guardianConfig.agentSmith.aiEnhancement;
4820
4818
  const status = this.state.guardianConfig.agentSmith.aiEnhancement ? "enabled" : "disabled";
4821
4819
  this.addActivity(`Agent Smith: AI Enhancement ${status}`);
4822
- this.showAgentSmithConfig().then(resolve3);
4820
+ this.showAgentSmithConfig().then(resolve2);
4823
4821
  return;
4824
4822
  }
4825
4823
  if (key.name === "2" || _ch === "2") {
4826
4824
  input.removeListener("keypress", handler);
4827
- this.promptSmithMinSeverity().then(resolve3);
4825
+ this.promptSmithMinSeverity().then(resolve2);
4828
4826
  return;
4829
4827
  }
4830
4828
  if (key.name === "3" || _ch === "3") {
4831
4829
  input.removeListener("keypress", handler);
4832
- this.promptSmithCategories().then(resolve3);
4830
+ this.promptSmithCategories().then(resolve2);
4833
4831
  return;
4834
4832
  }
4835
4833
  if (key.name === "4" || _ch === "4") {
4836
4834
  input.removeListener("keypress", handler);
4837
- this.promptSmithMemoryRetention().then(resolve3);
4835
+ this.promptSmithMemoryRetention().then(resolve2);
4838
4836
  return;
4839
4837
  }
4840
4838
  };
@@ -4845,7 +4843,7 @@ var InteractiveDashboard = class {
4845
4843
  * Prompt for Agent Smith min severity
4846
4844
  */
4847
4845
  async promptSmithMinSeverity() {
4848
- return new Promise((resolve3) => {
4846
+ return new Promise((resolve2) => {
4849
4847
  process.stdout.write("\x1B[2J\x1B[H");
4850
4848
  console.log(colors.header("Set Minimum Severity"));
4851
4849
  console.log(colors.dim(`Current: ${this.state.guardianConfig.agentSmith.minSeverity}`));
@@ -4868,7 +4866,7 @@ var InteractiveDashboard = class {
4868
4866
  this.state.guardianConfig.agentSmith.minSeverity = severities[idx];
4869
4867
  this.addActivity(`Agent Smith: Min severity set to ${severities[idx]}`);
4870
4868
  }
4871
- this.showAgentSmithConfig().then(resolve3);
4869
+ this.showAgentSmithConfig().then(resolve2);
4872
4870
  });
4873
4871
  });
4874
4872
  }
@@ -4876,7 +4874,7 @@ var InteractiveDashboard = class {
4876
4874
  * Prompt for Agent Smith pattern categories
4877
4875
  */
4878
4876
  async promptSmithCategories() {
4879
- return new Promise((resolve3) => {
4877
+ return new Promise((resolve2) => {
4880
4878
  process.stdout.write("\x1B[2J\x1B[H");
4881
4879
  const cfg = this.state.guardianConfig.agentSmith.enabledCategories;
4882
4880
  console.log(colors.header("Toggle Pattern Categories"));
@@ -4898,7 +4896,7 @@ var InteractiveDashboard = class {
4898
4896
  const enabledCount = Object.values(this.state.guardianConfig.agentSmith.enabledCategories).filter((v) => v).length;
4899
4897
  this.addActivity(`Agent Smith: ${enabledCount}/6 categories enabled`);
4900
4898
  void this.persistGuardianConfig();
4901
- this.showAgentSmithConfig().then(resolve3);
4899
+ this.showAgentSmithConfig().then(resolve2);
4902
4900
  return;
4903
4901
  }
4904
4902
  const cats = this.state.guardianConfig.agentSmith.enabledCategories;
@@ -4915,7 +4913,7 @@ var InteractiveDashboard = class {
4915
4913
  cats.security = cats.codeSmells = cats.asyncBugs = cats.reactPatterns = cats.uxPatterns = cats.backendPatterns = false;
4916
4914
  }
4917
4915
  input.removeListener("keypress", handler);
4918
- this.promptSmithCategories().then(resolve3);
4916
+ this.promptSmithCategories().then(resolve2);
4919
4917
  };
4920
4918
  input.on("keypress", handler);
4921
4919
  });
@@ -4924,7 +4922,7 @@ var InteractiveDashboard = class {
4924
4922
  * Prompt for Agent Smith memory retention days
4925
4923
  */
4926
4924
  async promptSmithMemoryRetention() {
4927
- return new Promise((resolve3) => {
4925
+ return new Promise((resolve2) => {
4928
4926
  process.stdout.write("\x1B[2J\x1B[H");
4929
4927
  console.log(colors.header("Set Memory Retention"));
4930
4928
  console.log(colors.dim(`Current: ${this.state.guardianConfig.agentSmith.memoryRetentionDays} days`));
@@ -4946,7 +4944,7 @@ var InteractiveDashboard = class {
4946
4944
  this.addActivity(`Agent Smith: Memory retention set to ${days} days`);
4947
4945
  }
4948
4946
  }
4949
- this.showAgentSmithConfig().then(resolve3);
4947
+ this.showAgentSmithConfig().then(resolve2);
4950
4948
  });
4951
4949
  });
4952
4950
  }
@@ -4954,7 +4952,7 @@ var InteractiveDashboard = class {
4954
4952
  * Show Performance configuration submenu
4955
4953
  */
4956
4954
  async showPerformanceConfig() {
4957
- return new Promise((resolve3) => {
4955
+ return new Promise((resolve2) => {
4958
4956
  process.stdout.write("\x1B[2J\x1B[H");
4959
4957
  const v = colors.border(box.vertical);
4960
4958
  const w = Math.max(60, Math.min(80, (process.stdout.columns || 80) - 4));
@@ -4986,7 +4984,7 @@ var InteractiveDashboard = class {
4986
4984
  const handler = (_ch, key) => {
4987
4985
  if (key.name === "escape") {
4988
4986
  input.removeListener("keypress", handler);
4989
- resolve3();
4987
+ resolve2();
4990
4988
  return;
4991
4989
  }
4992
4990
  if (key.name === "1" || _ch === "1") {
@@ -4994,7 +4992,7 @@ var InteractiveDashboard = class {
4994
4992
  this.addActivity(`Performance: Parallel execution ${this.state.guardianConfig.performance.parallel ? "enabled" : "disabled"}`);
4995
4993
  void this.persistGuardianConfig();
4996
4994
  input.removeListener("keypress", handler);
4997
- resolve3();
4995
+ resolve2();
4998
4996
  return;
4999
4997
  }
5000
4998
  if (key.name === "2" || _ch === "2") {
@@ -5002,17 +5000,17 @@ var InteractiveDashboard = class {
5002
5000
  this.addActivity(`Performance: Caching ${this.state.guardianConfig.performance.cache ? "enabled" : "disabled"}`);
5003
5001
  void this.persistGuardianConfig();
5004
5002
  input.removeListener("keypress", handler);
5005
- resolve3();
5003
+ resolve2();
5006
5004
  return;
5007
5005
  }
5008
5006
  if (key.name === "3" || _ch === "3") {
5009
5007
  input.removeListener("keypress", handler);
5010
- this.promptMaxConcurrency().then(resolve3);
5008
+ this.promptMaxConcurrency().then(resolve2);
5011
5009
  return;
5012
5010
  }
5013
5011
  if (key.name === "4" || _ch === "4") {
5014
5012
  input.removeListener("keypress", handler);
5015
- this.promptTimeout().then(resolve3);
5013
+ this.promptTimeout().then(resolve2);
5016
5014
  return;
5017
5015
  }
5018
5016
  if (key.name === "5" || _ch === "5") {
@@ -5020,7 +5018,7 @@ var InteractiveDashboard = class {
5020
5018
  this.addActivity(`Performance: Worker threads ${this.state.guardianConfig.performance.workers ? "enabled" : "disabled"}`);
5021
5019
  void this.persistGuardianConfig();
5022
5020
  input.removeListener("keypress", handler);
5023
- resolve3();
5021
+ resolve2();
5024
5022
  return;
5025
5023
  }
5026
5024
  if (key.name === "6" || _ch === "6") {
@@ -5028,7 +5026,7 @@ var InteractiveDashboard = class {
5028
5026
  this.addActivity(`Performance: Streaming ${this.state.guardianConfig.performance.streaming ? "enabled" : "disabled"}`);
5029
5027
  void this.persistGuardianConfig();
5030
5028
  input.removeListener("keypress", handler);
5031
- resolve3();
5029
+ resolve2();
5032
5030
  return;
5033
5031
  }
5034
5032
  };
@@ -5039,7 +5037,7 @@ var InteractiveDashboard = class {
5039
5037
  * Show Risk Thresholds configuration submenu
5040
5038
  */
5041
5039
  async showRiskThresholdsConfig() {
5042
- return new Promise((resolve3) => {
5040
+ return new Promise((resolve2) => {
5043
5041
  process.stdout.write("\x1B[2J\x1B[H");
5044
5042
  const v = colors.border(box.vertical);
5045
5043
  const w = Math.max(60, Math.min(80, (process.stdout.columns || 80) - 4));
@@ -5065,22 +5063,22 @@ var InteractiveDashboard = class {
5065
5063
  const handler = (_ch, key) => {
5066
5064
  if (key.name === "escape") {
5067
5065
  input.removeListener("keypress", handler);
5068
- resolve3();
5066
+ resolve2();
5069
5067
  return;
5070
5068
  }
5071
5069
  if (key.name === "1" || _ch === "1") {
5072
5070
  input.removeListener("keypress", handler);
5073
- this.promptRiskThreshold("critical").then(resolve3);
5071
+ this.promptRiskThreshold("critical").then(resolve2);
5074
5072
  return;
5075
5073
  }
5076
5074
  if (key.name === "2" || _ch === "2") {
5077
5075
  input.removeListener("keypress", handler);
5078
- this.promptRiskThreshold("high").then(resolve3);
5076
+ this.promptRiskThreshold("high").then(resolve2);
5079
5077
  return;
5080
5078
  }
5081
5079
  if (key.name === "3" || _ch === "3") {
5082
5080
  input.removeListener("keypress", handler);
5083
- this.promptRiskThreshold("medium").then(resolve3);
5081
+ this.promptRiskThreshold("medium").then(resolve2);
5084
5082
  return;
5085
5083
  }
5086
5084
  };
@@ -5091,7 +5089,7 @@ var InteractiveDashboard = class {
5091
5089
  * Prompt for user count
5092
5090
  */
5093
5091
  async promptUserCount() {
5094
- return new Promise((resolve3) => {
5092
+ return new Promise((resolve2) => {
5095
5093
  process.stdout.write("\x1B[2J\x1B[H\x1B[?25h");
5096
5094
  console.log(colors.header("\u{1F4B0} Set User Count"));
5097
5095
  console.log(colors.dim(`Current: ${this.state.guardianConfig.moneybags.userCount.toLocaleString()} users`));
@@ -5117,7 +5115,7 @@ var InteractiveDashboard = class {
5117
5115
  if (changed) {
5118
5116
  this.triggerMoneybagsRecalc();
5119
5117
  }
5120
- resolve3();
5118
+ resolve2();
5121
5119
  });
5122
5120
  });
5123
5121
  }
@@ -5125,7 +5123,7 @@ var InteractiveDashboard = class {
5125
5123
  * Prompt for paying users
5126
5124
  */
5127
5125
  async promptPayingUsers() {
5128
- return new Promise((resolve3) => {
5126
+ return new Promise((resolve2) => {
5129
5127
  process.stdout.write("\x1B[2J\x1B[H\x1B[?25h");
5130
5128
  console.log(colors.header("\u{1F4B0} Set Paying Users"));
5131
5129
  const current = this.state.guardianConfig.moneybags.payingUsers;
@@ -5156,7 +5154,7 @@ var InteractiveDashboard = class {
5156
5154
  if (changed) {
5157
5155
  this.triggerMoneybagsRecalc();
5158
5156
  }
5159
- resolve3();
5157
+ resolve2();
5160
5158
  });
5161
5159
  });
5162
5160
  }
@@ -5164,7 +5162,7 @@ var InteractiveDashboard = class {
5164
5162
  * Prompt for revenue per user
5165
5163
  */
5166
5164
  async promptRevenuePerUser() {
5167
- return new Promise((resolve3) => {
5165
+ return new Promise((resolve2) => {
5168
5166
  process.stdout.write("\x1B[2J\x1B[H\x1B[?25h");
5169
5167
  console.log(colors.header("\u{1F4B0} Set Revenue Per User"));
5170
5168
  const current = this.state.guardianConfig.moneybags.revenuePerUser;
@@ -5195,7 +5193,7 @@ var InteractiveDashboard = class {
5195
5193
  if (changed) {
5196
5194
  this.triggerMoneybagsRecalc();
5197
5195
  }
5198
- resolve3();
5196
+ resolve2();
5199
5197
  });
5200
5198
  });
5201
5199
  }
@@ -5203,7 +5201,7 @@ var InteractiveDashboard = class {
5203
5201
  * Prompt for developer rate
5204
5202
  */
5205
5203
  async promptDeveloperRate() {
5206
- return new Promise((resolve3) => {
5204
+ return new Promise((resolve2) => {
5207
5205
  process.stdout.write("\x1B[2J\x1B[H\x1B[?25h");
5208
5206
  console.log(colors.header("\u{1F4B0} Set Developer Rate"));
5209
5207
  console.log(colors.dim(`Current: $${this.state.guardianConfig.moneybags.developerRate}/hr`));
@@ -5229,7 +5227,7 @@ var InteractiveDashboard = class {
5229
5227
  if (changed) {
5230
5228
  this.triggerMoneybagsRecalc();
5231
5229
  }
5232
- resolve3();
5230
+ resolve2();
5233
5231
  });
5234
5232
  });
5235
5233
  }
@@ -5237,7 +5235,7 @@ var InteractiveDashboard = class {
5237
5235
  * Show Escalation configuration submenu
5238
5236
  */
5239
5237
  async showEscalationConfig() {
5240
- return new Promise((resolve3) => {
5238
+ return new Promise((resolve2) => {
5241
5239
  process.stdout.write("\x1B[2J\x1B[H");
5242
5240
  const v = colors.border(box.vertical);
5243
5241
  const w = Math.max(60, Math.min(80, (process.stdout.columns || 80) - 4));
@@ -5299,7 +5297,7 @@ var InteractiveDashboard = class {
5299
5297
  const handler = (_ch, key) => {
5300
5298
  if (key.name === "escape") {
5301
5299
  input.removeListener("keypress", handler);
5302
- resolve3();
5300
+ resolve2();
5303
5301
  }
5304
5302
  };
5305
5303
  input.on("keypress", handler);
@@ -5309,7 +5307,7 @@ var InteractiveDashboard = class {
5309
5307
  * Prompt for industry
5310
5308
  */
5311
5309
  async promptIndustry() {
5312
- return new Promise((resolve3) => {
5310
+ return new Promise((resolve2) => {
5313
5311
  process.stdout.write("\x1B[2J\x1B[H\x1B[?25h");
5314
5312
  console.log(colors.header("\u{1F4B0} Set Industry"));
5315
5313
  const current = this.state.guardianConfig.moneybags.industry || "(not set)";
@@ -5343,7 +5341,7 @@ var InteractiveDashboard = class {
5343
5341
  console.error("Warning: Failed to restore raw mode:", error);
5344
5342
  }
5345
5343
  }
5346
- this.handleIndustryInput(answer, resolve3);
5344
+ this.handleIndustryInput(answer, resolve2);
5347
5345
  } catch (error) {
5348
5346
  console.error("Error handling industry input:", error);
5349
5347
  if (input.isTTY) {
@@ -5352,7 +5350,7 @@ var InteractiveDashboard = class {
5352
5350
  } catch {
5353
5351
  }
5354
5352
  }
5355
- resolve3();
5353
+ resolve2();
5356
5354
  }
5357
5355
  });
5358
5356
  });
@@ -5360,13 +5358,13 @@ var InteractiveDashboard = class {
5360
5358
  /**
5361
5359
  * Handle industry input after prompt
5362
5360
  */
5363
- handleIndustryInput(answer, resolve3) {
5361
+ handleIndustryInput(answer, resolve2) {
5364
5362
  try {
5365
5363
  const sanitized = answer.replace(/[^\d\w\s]/g, "").trim();
5366
5364
  const industries = ["solopreneur", "startup", "fintech", "healthcare", "enterprise", "saas", "ecommerce"];
5367
5365
  let changed = false;
5368
5366
  if (sanitized === "") {
5369
- resolve3();
5367
+ resolve2();
5370
5368
  return;
5371
5369
  } else if (sanitized === "8") {
5372
5370
  delete this.state.guardianConfig.moneybags.industry;
@@ -5385,24 +5383,24 @@ var InteractiveDashboard = class {
5385
5383
  console.log(colors.critical(`Invalid selection: "${sanitized}"`));
5386
5384
  console.log(colors.dim("Please enter a number between 1-8, or press Enter to cancel."));
5387
5385
  setTimeout(() => {
5388
- resolve3();
5386
+ resolve2();
5389
5387
  }, 1500);
5390
5388
  return;
5391
5389
  }
5392
5390
  if (changed) {
5393
5391
  this.triggerMoneybagsRecalc();
5394
5392
  }
5395
- resolve3();
5393
+ resolve2();
5396
5394
  } catch (error) {
5397
5395
  console.error("Error in handleIndustryInput:", error);
5398
- resolve3();
5396
+ resolve2();
5399
5397
  }
5400
5398
  }
5401
5399
  /**
5402
5400
  * Prompt for max concurrency
5403
5401
  */
5404
5402
  async promptMaxConcurrency() {
5405
- return new Promise((resolve3) => {
5403
+ return new Promise((resolve2) => {
5406
5404
  process.stdout.write("\x1B[2J\x1B[H\x1B[?25h");
5407
5405
  console.log(colors.header("Set Max Concurrency"));
5408
5406
  console.log(colors.dim(`Current: ${this.state.guardianConfig.performance.maxConcurrency}`));
@@ -5423,7 +5421,7 @@ var InteractiveDashboard = class {
5423
5421
  this.addActivity(`Performance: Max concurrency set to ${val}`);
5424
5422
  }
5425
5423
  }
5426
- resolve3();
5424
+ resolve2();
5427
5425
  });
5428
5426
  });
5429
5427
  }
@@ -5431,7 +5429,7 @@ var InteractiveDashboard = class {
5431
5429
  * Prompt for timeout
5432
5430
  */
5433
5431
  async promptTimeout() {
5434
- return new Promise((resolve3) => {
5432
+ return new Promise((resolve2) => {
5435
5433
  process.stdout.write("\x1B[2J\x1B[H\x1B[?25h");
5436
5434
  console.log(colors.header("Set Timeout"));
5437
5435
  console.log(colors.dim(`Current: ${this.state.guardianConfig.performance.timeoutMs / 1e3}s`));
@@ -5452,7 +5450,7 @@ var InteractiveDashboard = class {
5452
5450
  this.addActivity(`Performance: Timeout set to ${this.state.guardianConfig.performance.timeoutMs / 1e3}s`);
5453
5451
  }
5454
5452
  }
5455
- resolve3();
5453
+ resolve2();
5456
5454
  });
5457
5455
  });
5458
5456
  }
@@ -5460,7 +5458,7 @@ var InteractiveDashboard = class {
5460
5458
  * Prompt for risk threshold
5461
5459
  */
5462
5460
  async promptRiskThreshold(level) {
5463
- return new Promise((resolve3) => {
5461
+ return new Promise((resolve2) => {
5464
5462
  process.stdout.write("\x1B[2J\x1B[H\x1B[?25h");
5465
5463
  console.log(colors.header(`Set ${level.toUpperCase()} Risk Threshold`));
5466
5464
  console.log(colors.dim(`Current: ${this.state.guardianConfig.riskThresholds[level]}`));
@@ -5481,7 +5479,7 @@ var InteractiveDashboard = class {
5481
5479
  this.addActivity(`Risk: ${level} threshold set to ${val}`);
5482
5480
  }
5483
5481
  }
5484
- resolve3();
5482
+ resolve2();
5485
5483
  });
5486
5484
  });
5487
5485
  }
@@ -5606,9 +5604,9 @@ var InteractiveDashboard = class {
5606
5604
  };
5607
5605
 
5608
5606
  // src/tools/scan.ts
5609
- import { readFile as readFile8, readdir as readdir2, writeFile as writeFile2, mkdir as mkdir3 } from "fs/promises";
5610
- import { existsSync as existsSync6 } from "fs";
5611
- import { basename as basename7, isAbsolute, resolve as resolve2, join as join6, extname as extname3, dirname as dirname2 } from "path";
5607
+ import { readFile as readFile7, readdir as readdir2, writeFile as writeFile2, mkdir as mkdir3 } from "fs/promises";
5608
+ import { existsSync as existsSync4 } from "fs";
5609
+ import { basename as basename7, isAbsolute, resolve, join as join4, extname as extname3, dirname as dirname2 } from "path";
5612
5610
 
5613
5611
  // src/orchestrator/context-analyzer.ts
5614
5612
  import { readFile as readFile2 } from "fs/promises";
@@ -8699,434 +8697,6 @@ var IssueAnalyzer = class {
8699
8697
  }
8700
8698
  };
8701
8699
 
8702
- // src/config/loader.ts
8703
- import { readFile as readFile7 } from "fs/promises";
8704
- import { existsSync as existsSync5 } from "fs";
8705
- import { join as join5 } from "path";
8706
-
8707
- // src/config/validation.ts
8708
- import { z } from "zod";
8709
- import { existsSync as existsSync4, readFileSync } from "fs";
8710
- import { resolve, join as join4 } from "path";
8711
- var API_KEY_PATTERNS = {
8712
- anthropic: /^sk-ant-api\d{2}-[\w-]{95}$/,
8713
- openai: /^sk-[\w]{48}$/,
8714
- github: /^ghp_[\w]{36}$/,
8715
- vercel: /^[\w]{24}$/
8716
- };
8717
- var ApiKeysSchema = z.object({
8718
- anthropic: z.string().regex(API_KEY_PATTERNS.anthropic, "Invalid Anthropic API key format").optional(),
8719
- openai: z.string().regex(API_KEY_PATTERNS.openai, "Invalid OpenAI API key format").optional(),
8720
- github: z.string().regex(API_KEY_PATTERNS.github, "Invalid GitHub token format").optional(),
8721
- vercel: z.string().regex(API_KEY_PATTERNS.vercel, "Invalid Vercel token format").optional()
8722
- });
8723
- var AgentConfigSchema = z.object({
8724
- enabled: z.array(z.string()).optional().default([]),
8725
- disabled: z.array(z.string()).optional().default([]),
8726
- parallel: z.boolean().optional().default(true),
8727
- maxConcurrency: z.number().int().min(1).max(20).optional().default(4),
8728
- timeout: z.number().int().min(1e3).max(3e5).optional().default(12e4),
8729
- // 2 minutes
8730
- cache: z.boolean().optional().default(true)
8731
- });
8732
- var ComplianceSchema = z.object({
8733
- standards: z.array(z.enum(["SOC2", "GDPR", "HIPAA", "CCPA", "PCI-DSS"])).optional().default(["SOC2"]),
8734
- enforceCompliance: z.boolean().optional().default(false),
8735
- reportFormat: z.enum(["json", "sarif", "csv", "html"]).optional().default("json")
8736
- });
8737
- var OutputSchema = z.object({
8738
- format: z.enum(["console", "json", "sarif", "junit"]).optional().default("console"),
8739
- level: z.enum(["critical", "serious", "moderate", "low", "all"]).optional().default("all"),
8740
- interactive: z.boolean().optional().default(false),
8741
- streaming: z.boolean().optional().default(true),
8742
- colors: z.boolean().optional().default(true)
8743
- });
8744
- var PathsSchema = z.object({
8745
- include: z.array(z.string()).optional().default([]),
8746
- exclude: z.array(z.string()).optional().default(["node_modules", "dist", "build", ".git"]),
8747
- configDir: z.string().optional().default(".trie"),
8748
- outputDir: z.string().optional().default("trie-reports")
8749
- });
8750
- var IntegrationsSchema = z.object({
8751
- github: z.object({
8752
- enabled: z.boolean().optional().default(false),
8753
- token: z.string().optional(),
8754
- webhook: z.string().url().optional()
8755
- }).optional(),
8756
- slack: z.object({
8757
- enabled: z.boolean().optional().default(false),
8758
- webhook: z.string().url().optional(),
8759
- channel: z.string().optional()
8760
- }).optional(),
8761
- jira: z.object({
8762
- enabled: z.boolean().optional().default(false),
8763
- url: z.string().url().optional(),
8764
- token: z.string().optional(),
8765
- project: z.string().optional()
8766
- }).optional()
8767
- });
8768
- var UserSchema = z.object({
8769
- name: z.string().min(1).optional(),
8770
- email: z.string().email().optional(),
8771
- role: z.enum([
8772
- "developer",
8773
- "designer",
8774
- "qa",
8775
- "devops",
8776
- "security",
8777
- "architect",
8778
- "manager",
8779
- "contributor"
8780
- ]).optional().default("developer"),
8781
- github: z.string().optional(),
8782
- // GitHub username
8783
- url: z.string().url().optional()
8784
- // Personal/portfolio URL
8785
- });
8786
- var TrieConfigSchema = z.object({
8787
- version: z.string().optional().default("1.0.0"),
8788
- apiKeys: ApiKeysSchema.optional(),
8789
- agents: AgentConfigSchema.optional(),
8790
- compliance: ComplianceSchema.optional(),
8791
- output: OutputSchema.optional(),
8792
- paths: PathsSchema.optional(),
8793
- integrations: IntegrationsSchema.optional(),
8794
- user: UserSchema.optional()
8795
- // User identity for attribution
8796
- });
8797
- var ConfigValidator = class {
8798
- /**
8799
- * Validate configuration object
8800
- */
8801
- validateConfig(config) {
8802
- try {
8803
- const validated = TrieConfigSchema.parse(config);
8804
- const businessErrors = this.validateBusinessLogic(validated);
8805
- if (businessErrors.length > 0) {
8806
- return { success: false, errors: businessErrors };
8807
- }
8808
- return { success: true, data: validated };
8809
- } catch (error) {
8810
- if (error instanceof z.ZodError) {
8811
- const errors = error.errors.map(
8812
- (err) => `${err.path.join(".")}: ${err.message}`
8813
- );
8814
- return { success: false, errors };
8815
- }
8816
- return {
8817
- success: false,
8818
- errors: [`Configuration validation failed: ${error instanceof Error ? error.message : "Unknown error"}`]
8819
- };
8820
- }
8821
- }
8822
- /**
8823
- * Validate environment variables for API keys
8824
- */
8825
- validateEnvironment() {
8826
- const warnings = [];
8827
- const errors = [];
8828
- const exposedPatterns = [
8829
- "NEXT_PUBLIC_ANTHROPIC",
8830
- "REACT_APP_ANTHROPIC",
8831
- "VITE_ANTHROPIC",
8832
- "PUBLIC_ANTHROPIC"
8833
- ];
8834
- for (const pattern of exposedPatterns) {
8835
- const envVars = Object.keys(process.env).filter((key) => key.includes(pattern));
8836
- for (const envVar of envVars) {
8837
- errors.push(`[!] Security risk: API key in client-side environment variable: ${envVar}`);
8838
- }
8839
- }
8840
- let anthropicKey = process.env.ANTHROPIC_API_KEY;
8841
- if (!anthropicKey) {
8842
- try {
8843
- const configPath = join4(getWorkingDirectory(void 0, true), ".trie", "config.json");
8844
- if (existsSync4(configPath)) {
8845
- const config = JSON.parse(readFileSync(configPath, "utf-8"));
8846
- anthropicKey = config.apiKeys?.anthropic;
8847
- }
8848
- } catch {
8849
- }
8850
- }
8851
- if (anthropicKey && !API_KEY_PATTERNS.anthropic.test(anthropicKey)) {
8852
- errors.push("ANTHROPIC_API_KEY does not match expected format");
8853
- }
8854
- if (!anthropicKey) {
8855
- warnings.push("ANTHROPIC_API_KEY not set - AI features will be disabled. Set in environment, .trie/config.json, or .env file");
8856
- }
8857
- if (!process.env.GITHUB_TOKEN && process.env.CI) {
8858
- warnings.push("GITHUB_TOKEN not set - GitHub integration disabled");
8859
- }
8860
- return {
8861
- valid: errors.length === 0,
8862
- warnings,
8863
- errors
8864
- };
8865
- }
8866
- /**
8867
- * Validate file paths in configuration
8868
- */
8869
- validatePaths(paths) {
8870
- const errors = [];
8871
- if (paths?.include) {
8872
- for (const path of paths.include) {
8873
- const resolvedPath = resolve(path);
8874
- if (!existsSync4(resolvedPath)) {
8875
- errors.push(`Include path does not exist: ${path}`);
8876
- }
8877
- }
8878
- }
8879
- if (paths?.configDir) {
8880
- const configPath = resolve(paths.configDir);
8881
- if (!existsSync4(configPath)) {
8882
- try {
8883
- __require("fs").mkdirSync(configPath, { recursive: true });
8884
- } catch {
8885
- errors.push(`Cannot create config directory: ${paths.configDir}`);
8886
- }
8887
- }
8888
- }
8889
- return {
8890
- valid: errors.length === 0,
8891
- errors
8892
- };
8893
- }
8894
- /**
8895
- * Validate integration configurations
8896
- */
8897
- validateIntegrations(integrations) {
8898
- const errors = [];
8899
- if (integrations?.github?.enabled) {
8900
- if (!integrations.github.token) {
8901
- errors.push("GitHub integration enabled but no token provided");
8902
- }
8903
- }
8904
- if (integrations?.slack?.enabled) {
8905
- if (!integrations.slack.webhook) {
8906
- errors.push("Slack integration enabled but no webhook URL provided");
8907
- }
8908
- }
8909
- if (integrations?.jira?.enabled) {
8910
- if (!integrations.jira.url || !integrations.jira.token || !integrations.jira.project) {
8911
- errors.push("JIRA integration enabled but missing required fields (url, token, project)");
8912
- }
8913
- }
8914
- return {
8915
- valid: errors.length === 0,
8916
- errors
8917
- };
8918
- }
8919
- /**
8920
- * Business logic validation
8921
- */
8922
- validateBusinessLogic(config) {
8923
- const errors = [];
8924
- if (config.agents?.enabled && config.agents?.disabled) {
8925
- const overlap = config.agents.enabled.filter(
8926
- (agent) => config.agents?.disabled?.includes(agent)
8927
- );
8928
- if (overlap.length > 0) {
8929
- errors.push(`Agents cannot be both enabled and disabled: ${overlap.join(", ")}`);
8930
- }
8931
- }
8932
- if (config.agents?.maxConcurrency && config.agents.maxConcurrency > 10) {
8933
- errors.push("maxConcurrency should not exceed 10 for optimal performance");
8934
- }
8935
- if (config.compliance?.standards) {
8936
- const invalidStandards = config.compliance.standards.filter(
8937
- (standard) => !["SOC2", "GDPR", "HIPAA", "CCPA", "PCI-DSS"].includes(standard)
8938
- );
8939
- if (invalidStandards.length > 0) {
8940
- errors.push(`Invalid compliance standards: ${invalidStandards.join(", ")}`);
8941
- }
8942
- }
8943
- if (config.paths) {
8944
- const pathValidation = this.validatePaths(config.paths);
8945
- errors.push(...pathValidation.errors);
8946
- }
8947
- if (config.integrations) {
8948
- const integrationValidation = this.validateIntegrations(config.integrations);
8949
- errors.push(...integrationValidation.errors);
8950
- }
8951
- return errors;
8952
- }
8953
- /**
8954
- * Generate configuration template
8955
- */
8956
- generateTemplate() {
8957
- return {
8958
- version: "1.0.0",
8959
- agents: {
8960
- enabled: ["security", "bugs", "types"],
8961
- disabled: [],
8962
- parallel: true,
8963
- maxConcurrency: 4,
8964
- timeout: 12e4,
8965
- cache: true
8966
- },
8967
- compliance: {
8968
- standards: ["SOC2"],
8969
- enforceCompliance: false,
8970
- reportFormat: "json"
8971
- },
8972
- output: {
8973
- format: "console",
8974
- level: "all",
8975
- interactive: false,
8976
- streaming: true,
8977
- colors: true
8978
- },
8979
- paths: {
8980
- include: [],
8981
- exclude: ["node_modules", "dist", "build", ".git"],
8982
- configDir: ".trie",
8983
- outputDir: "trie-reports"
8984
- }
8985
- };
8986
- }
8987
- /**
8988
- * Validate and provide suggestions for improvement
8989
- */
8990
- analyze(config) {
8991
- const suggestions = [];
8992
- const securityIssues = [];
8993
- const optimizations = [];
8994
- let score = 100;
8995
- let hasApiKey = Boolean(config.apiKeys?.anthropic || process.env.ANTHROPIC_API_KEY);
8996
- if (!hasApiKey) {
8997
- try {
8998
- const workDir = getWorkingDirectory(void 0, true);
8999
- const envFiles = [".env", ".env.local", ".env.production"];
9000
- for (const envFile of envFiles) {
9001
- const envPath = join4(workDir, envFile);
9002
- if (existsSync4(envPath)) {
9003
- const envContent = readFileSync(envPath, "utf-8");
9004
- if (envContent.includes("ANTHROPIC_API_KEY=")) {
9005
- hasApiKey = true;
9006
- break;
9007
- }
9008
- }
9009
- }
9010
- } catch {
9011
- }
9012
- }
9013
- if (!hasApiKey) {
9014
- suggestions.push("Add ANTHROPIC_API_KEY to enable AI-powered analysis for better issue detection. Set in environment, .trie/config.json, or .env file");
9015
- score -= 10;
9016
- }
9017
- if (config.agents?.parallel === false) {
9018
- optimizations.push("Enable parallel agent execution for 3-5x faster scans");
9019
- score -= 15;
9020
- }
9021
- if (config.agents?.cache === false) {
9022
- optimizations.push("Enable result caching to speed up repeated scans");
9023
- score -= 10;
9024
- }
9025
- if (!config.compliance?.standards || config.compliance.standards.length === 0) {
9026
- suggestions.push("Configure compliance standards (SOC2, GDPR, etc.) for regulatory requirements");
9027
- score -= 5;
9028
- }
9029
- const hasIntegrations = config.integrations && (config.integrations.github?.enabled || config.integrations.slack?.enabled || config.integrations.jira?.enabled);
9030
- if (!hasIntegrations) {
9031
- suggestions.push("Consider enabling GitHub/Slack/JIRA integrations for better team collaboration");
9032
- score -= 5;
9033
- }
9034
- if (config.apiKeys) {
9035
- securityIssues.push("API keys in config file - consider using environment variables instead");
9036
- score -= 20;
9037
- }
9038
- return {
9039
- score: Math.max(0, score),
9040
- suggestions,
9041
- securityIssues,
9042
- optimizations
9043
- };
9044
- }
9045
- };
9046
- var DEFAULT_CONFIG = {
9047
- version: "1.0.0",
9048
- agents: {
9049
- enabled: [],
9050
- disabled: [],
9051
- parallel: true,
9052
- maxConcurrency: 4,
9053
- timeout: 12e4,
9054
- cache: true
9055
- },
9056
- compliance: {
9057
- standards: ["SOC2"],
9058
- enforceCompliance: false,
9059
- reportFormat: "json"
9060
- },
9061
- output: {
9062
- format: "console",
9063
- level: "all",
9064
- interactive: false,
9065
- streaming: true,
9066
- colors: true
9067
- },
9068
- paths: {
9069
- include: [],
9070
- exclude: ["node_modules", "dist", "build", ".git", ".next", ".nuxt", "coverage"],
9071
- configDir: ".trie",
9072
- outputDir: "trie-reports"
9073
- }
9074
- };
9075
-
9076
- // src/config/loader.ts
9077
- async function loadConfig() {
9078
- const validator = new ConfigValidator();
9079
- const configPath = join5(getWorkingDirectory(void 0, true), ".trie", "config.json");
9080
- try {
9081
- if (!existsSync5(configPath)) {
9082
- return DEFAULT_CONFIG;
9083
- }
9084
- const configFile = await readFile7(configPath, "utf-8");
9085
- const userConfig = JSON.parse(configFile);
9086
- const merged = mergeConfig(DEFAULT_CONFIG, userConfig);
9087
- const result = validator.validateConfig(merged);
9088
- if (!result.success) {
9089
- if (!isInteractiveMode()) {
9090
- console.error("Configuration validation failed:");
9091
- for (const error of result.errors) {
9092
- console.error(` - ${error}`);
9093
- }
9094
- }
9095
- return DEFAULT_CONFIG;
9096
- }
9097
- if (!isInteractiveMode()) {
9098
- const envValidation = validator.validateEnvironment();
9099
- for (const warning of envValidation.warnings) {
9100
- console.warn(warning);
9101
- }
9102
- for (const error of envValidation.errors) {
9103
- console.error(error);
9104
- }
9105
- }
9106
- return result.data;
9107
- } catch (error) {
9108
- if (!isInteractiveMode()) {
9109
- console.error("Failed to load config, using defaults:", error);
9110
- }
9111
- return DEFAULT_CONFIG;
9112
- }
9113
- }
9114
- function mergeConfig(defaults, user) {
9115
- if (typeof user !== "object" || user === null || Array.isArray(user)) {
9116
- return { ...defaults };
9117
- }
9118
- const result = { ...defaults };
9119
- for (const [key, value] of Object.entries(user)) {
9120
- const defaultValue = defaults[key];
9121
- if (typeof value === "object" && value !== null && !Array.isArray(value) && typeof defaultValue === "object" && defaultValue !== null) {
9122
- result[key] = mergeConfig(defaultValue, value);
9123
- } else {
9124
- result[key] = value;
9125
- }
9126
- }
9127
- return result;
9128
- }
9129
-
9130
8700
  // src/integrations/team-collaboration.ts
9131
8701
  var TeamCollaborationManager = class {
9132
8702
  teamMembers = /* @__PURE__ */ new Map();
@@ -9487,10 +9057,10 @@ var TeamCollaborationManager = class {
9487
9057
 
9488
9058
  // src/tools/scan.ts
9489
9059
  async function updateAgentLedger(workDir, agentResults, registry, userConfig) {
9490
- const ledgerPath = join6(workDir, ".trie", "ledger.json");
9060
+ const ledgerPath = join4(workDir, ".trie", "ledger.json");
9491
9061
  try {
9492
9062
  const trieDir = dirname2(ledgerPath);
9493
- if (!existsSync6(trieDir)) {
9063
+ if (!existsSync4(trieDir)) {
9494
9064
  await mkdir3(trieDir, { recursive: true });
9495
9065
  }
9496
9066
  const now = (/* @__PURE__ */ new Date()).toISOString();
@@ -9505,9 +9075,9 @@ async function updateAgentLedger(workDir, agentResults, registry, userConfig) {
9505
9075
  meta,
9506
9076
  agents: {}
9507
9077
  };
9508
- if (existsSync6(ledgerPath)) {
9078
+ if (existsSync4(ledgerPath)) {
9509
9079
  try {
9510
- const content = await readFile8(ledgerPath, "utf-8");
9080
+ const content = await readFile7(ledgerPath, "utf-8");
9511
9081
  const existing = JSON.parse(content);
9512
9082
  if (existing.meta) {
9513
9083
  ledger = existing;
@@ -9662,10 +9232,10 @@ var TrieScanTool = class {
9662
9232
  if (isAbsolute(f)) {
9663
9233
  return f;
9664
9234
  }
9665
- return resolve2(workDir, f);
9235
+ return resolve(workDir, f);
9666
9236
  });
9667
9237
  const validFiles = resolvedFiles.filter((f) => {
9668
- if (!existsSync6(f)) {
9238
+ if (!existsSync4(f)) {
9669
9239
  this.progress.warn("File not found", f);
9670
9240
  return false;
9671
9241
  }
@@ -10052,8 +9622,8 @@ var TrieScanTool = class {
10052
9622
  const enriched = [];
10053
9623
  for (const issue of issues) {
10054
9624
  try {
10055
- if (issue.line && existsSync6(issue.file)) {
10056
- const content = await readFile8(issue.file, "utf-8");
9625
+ if (issue.line && existsSync4(issue.file)) {
9626
+ const content = await readFile7(issue.file, "utf-8");
10057
9627
  const lines = content.split("\n");
10058
9628
  const startLine = Math.max(0, issue.line - 3);
10059
9629
  const endLine = Math.min(lines.length, issue.line + 2);
@@ -10335,9 +9905,9 @@ ${issue.fix}
10335
9905
  * Get a code snippet around a specific line
10336
9906
  */
10337
9907
  async getCodeSnippet(filePath, line) {
10338
- if (!line || !existsSync6(filePath)) return null;
9908
+ if (!line || !existsSync4(filePath)) return null;
10339
9909
  try {
10340
- const content = await readFile8(filePath, "utf-8");
9910
+ const content = await readFile7(filePath, "utf-8");
10341
9911
  const lines = content.split("\n");
10342
9912
  const start = Math.max(0, line - 3);
10343
9913
  const end = Math.min(lines.length, line + 2);
@@ -10361,7 +9931,7 @@ ${issue.fix}
10361
9931
  const entries = await readdir2(currentDir, { withFileTypes: true });
10362
9932
  for (const entry of entries) {
10363
9933
  if (files.length >= maxFiles) break;
10364
- const fullPath = join6(currentDir, entry.name);
9934
+ const fullPath = join4(currentDir, entry.name);
10365
9935
  if (entry.isDirectory()) {
10366
9936
  if (!SKIP_DIRS.has(entry.name) && !entry.name.startsWith(".")) {
10367
9937
  await walk(fullPath);
@@ -10386,12 +9956,12 @@ ${issue.fix}
10386
9956
  return files;
10387
9957
  }
10388
9958
  async loadTeamMembers(workDir) {
10389
- const teamConfigPath = join6(workDir, ".trie", "team.json");
10390
- if (!existsSync6(teamConfigPath)) {
9959
+ const teamConfigPath = join4(workDir, ".trie", "team.json");
9960
+ if (!existsSync4(teamConfigPath)) {
10391
9961
  return [];
10392
9962
  }
10393
9963
  try {
10394
- const content = await readFile8(teamConfigPath, "utf-8");
9964
+ const content = await readFile7(teamConfigPath, "utf-8");
10395
9965
  const data = JSON.parse(content);
10396
9966
  return Array.isArray(data.members) ? data.members : [];
10397
9967
  } catch {
@@ -10409,9 +9979,8 @@ ${issue.fix}
10409
9979
  };
10410
9980
 
10411
9981
  export {
10412
- loadConfig,
10413
9982
  StreamingManager,
10414
9983
  InteractiveDashboard,
10415
9984
  TrieScanTool
10416
9985
  };
10417
- //# sourceMappingURL=chunk-432E2RYB.js.map
9986
+ //# sourceMappingURL=chunk-MVWRFARH.js.map