@triedotdev/mcp 1.0.19 → 1.0.21

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.
@@ -3,11 +3,6 @@ import {
3
3
  getVibeCodeTrie,
4
4
  scanForVibeCodeIssues
5
5
  } from "./chunk-3CS6Z2SL.js";
6
- import {
7
- AgentSmithAgent,
8
- BaseAgent,
9
- ProgressReporter
10
- } from "./chunk-WSBTQJMH.js";
11
6
  import {
12
7
  getVulnerabilityStats,
13
8
  getVulnerabilityTrie,
@@ -16,9 +11,13 @@ import {
16
11
  import {
17
12
  Trie
18
13
  } from "./chunk-6NLHFIYA.js";
14
+ import {
15
+ AgentSmithAgent,
16
+ BaseAgent,
17
+ ProgressReporter
18
+ } from "./chunk-3AUDJWEF.js";
19
19
 
20
20
  // src/agents/security.ts
21
- import { basename } from "path";
22
21
  var ALWAYS_SKIP_FILES = [
23
22
  /vulnerability-signatures\.[jt]s$/,
24
23
  /vibe-code-signatures\.[jt]s$/,
@@ -217,62 +216,87 @@ If no significant vulnerabilities are found, respond with:
217
216
  return prompt;
218
217
  }
219
218
  /**
220
- * Process AI request and also check for critical patterns
219
+ * Override AI enhancement system prompt for security-specific analysis
221
220
  */
222
- async processAIRequest(request) {
221
+ getAIEnhancementSystemPrompt() {
222
+ return `You are a senior security engineer performing a code audit.
223
+
224
+ Analyze the detected issues and code snippets for security vulnerabilities:
225
+
226
+ 1. VALIDATE: Confirm if pattern-detected issues are real vulnerabilities
227
+ 2. EXPAND: Find deeper issues - SQL injection, XSS, auth bypass, IDOR, secrets
228
+ 3. PRIORITIZE: Rate by exploitability (0-100, where 100 = trivially exploitable)
229
+ 4. FIX: Provide secure code fixes
230
+
231
+ Severity guide:
232
+ - CRITICAL: Directly exploitable, leads to RCE, data breach, or total auth bypass
233
+ - SERIOUS: Exploitable with conditions, significant impact
234
+ - MODERATE: Real issue but limited impact
235
+ - LOW: Best practice violation
236
+
237
+ Output STRICT JSON:
238
+ {
239
+ "validated": [{
240
+ "original_issue": "...",
241
+ "verdict": "TRUE_POSITIVE" | "FALSE_POSITIVE",
242
+ "confidence": 0-100,
243
+ "file": "path",
244
+ "line": 123,
245
+ "severity": "critical",
246
+ "vulnerability_type": "SQL Injection",
247
+ "attack_scenario": "How to exploit",
248
+ "fix": "Secure code example"
249
+ }],
250
+ "additional": [{
251
+ "issue": "Vulnerability description",
252
+ "file": "path",
253
+ "line": 123,
254
+ "severity": "serious",
255
+ "vulnerability_type": "XSS",
256
+ "attack_scenario": "How to exploit",
257
+ "fix": "Secure code"
258
+ }],
259
+ "summary": "Overall security assessment"
260
+ }`;
261
+ }
262
+ /**
263
+ * Pattern-based analysis for fast detection
264
+ * AI enhancement happens via base class if API key is available
265
+ */
266
+ async analyzeFiles(files, _context) {
223
267
  const issues = [];
224
- const fileName = basename(request.file);
225
- const content = request.code;
226
- const lines = content.split("\n");
227
- for (let i = 0; i < lines.length; i++) {
228
- const line = lines[i] || "";
229
- for (const { pattern, severity, issue, fix } of CRITICAL_PATTERNS) {
230
- if (pattern.test(line)) {
231
- this.progress?.found(severity, `${issue} at line ${i + 1}`);
232
- issues.push(this.createIssue(
233
- this.generateIssueId(),
234
- severity,
235
- issue,
236
- fix,
237
- request.file,
238
- i + 1,
239
- 0.98,
240
- void 0,
241
- true
242
- ));
268
+ for (const file of files) {
269
+ if (this.shouldAlwaysSkip(file)) continue;
270
+ try {
271
+ const content = await this.readFile(file);
272
+ const lines = content.split("\n");
273
+ for (let i = 0; i < lines.length; i++) {
274
+ const line = lines[i] || "";
275
+ for (const { pattern, severity, issue, fix } of CRITICAL_PATTERNS) {
276
+ if (pattern.test(line)) {
277
+ this.progress?.found(severity, `${issue} at line ${i + 1}`);
278
+ issues.push(this.createIssue(
279
+ this.generateIssueId(),
280
+ severity,
281
+ issue,
282
+ fix,
283
+ file,
284
+ i + 1,
285
+ 0.98,
286
+ void 0,
287
+ true
288
+ ));
289
+ }
290
+ }
243
291
  }
292
+ } catch {
244
293
  }
245
294
  }
246
- this.progress?.aiReview(`${fileName} - deep security analysis`);
247
- const aiIssue = {
248
- id: this.generateIssueId(),
249
- severity: "moderate",
250
- issue: `\u{1F9E0} AI Security Analysis: ${fileName}`,
251
- fix: "See AI analysis below",
252
- file: request.file,
253
- confidence: 1,
254
- autoFixable: false,
255
- agent: this.name,
256
- effort: "medium",
257
- aiPrompt: {
258
- system: request.systemPrompt,
259
- user: request.userPrompt
260
- }
261
- };
262
- issues.push(aiIssue);
263
295
  return issues;
264
296
  }
265
- /**
266
- * Legacy pattern-based analysis - kept minimal for backwards compatibility
267
- * Now only catches the most obvious issues as a fallback
268
- */
269
- async analyzeFiles(_files, _context) {
270
- return [];
271
- }
272
297
  };
273
298
 
274
299
  // src/agents/privacy.ts
275
- import { basename as basename2 } from "path";
276
300
  var PRIVACY_INDICATORS = {
277
301
  high: [
278
302
  { pattern: /email|phone|ssn|social.*security|passport|driver.*license/i, reason: "PII fields" },
@@ -366,7 +390,7 @@ var PrivacyAgent = class extends BaseAgent {
366
390
  };
367
391
  }
368
392
  /**
369
- * Get privacy-focused system prompt
393
+ * Get privacy-focused system prompt (legacy - kept for reference)
370
394
  */
371
395
  getSystemPrompt() {
372
396
  return `You are a data privacy officer and compliance expert.
@@ -398,7 +422,7 @@ SEVERITY GUIDELINES:
398
422
  - LOW: Minor concern, nice to have`;
399
423
  }
400
424
  /**
401
- * Build privacy-specific analysis prompt
425
+ * Build privacy-specific analysis prompt (legacy - kept for reference)
402
426
  */
403
427
  buildUserPrompt(filePath, content, relevance) {
404
428
  const isPersistenceFile = /(model|schema|entity|migration|prisma|mongoose|db|database)/i.test(filePath);
@@ -454,56 +478,115 @@ If no privacy issues found, respond with:
454
478
  return prompt;
455
479
  }
456
480
  /**
457
- * Process AI request and check for critical patterns
481
+ * Pattern-based privacy analysis
458
482
  */
459
- async processAIRequest(request) {
483
+ async analyzeFiles(files, _context) {
460
484
  const issues = [];
461
- const fileName = basename2(request.file);
462
- const content = request.code;
463
- const lines = content.split("\n");
464
- for (let i = 0; i < lines.length; i++) {
465
- const line = lines[i] || "";
466
- for (const { pattern, severity, issue, fix, regulation } of CRITICAL_PRIVACY_PATTERNS) {
467
- if (pattern.test(line)) {
468
- this.progress?.found(severity, `${issue} at line ${i + 1}`);
469
- issues.push(this.createIssue(
470
- this.generateIssueId(),
471
- severity,
472
- issue,
473
- fix,
474
- request.file,
475
- i + 1,
476
- 0.95,
477
- regulation,
478
- true
479
- ));
485
+ for (const file of files) {
486
+ try {
487
+ const content = await this.readFile(file);
488
+ const lines = content.split("\n");
489
+ for (let i = 0; i < lines.length; i++) {
490
+ const line = lines[i] || "";
491
+ for (const { pattern, severity, issue, fix, regulation } of CRITICAL_PRIVACY_PATTERNS) {
492
+ if (pattern.test(line)) {
493
+ this.progress?.found(severity, `${issue} at line ${i + 1}`);
494
+ issues.push(this.createIssue(
495
+ this.generateIssueId(),
496
+ severity,
497
+ issue,
498
+ fix,
499
+ file,
500
+ i + 1,
501
+ 0.95,
502
+ regulation,
503
+ true
504
+ ));
505
+ }
506
+ }
507
+ if (/localStorage\.setItem\s*\([^)]*(?:email|ssn|password|phone)/i.test(line)) {
508
+ issues.push(this.createIssue(
509
+ this.generateIssueId(),
510
+ "serious",
511
+ "PII stored in localStorage (unencrypted, persists)",
512
+ "Use encrypted storage or server-side sessions for PII",
513
+ file,
514
+ i + 1,
515
+ 0.9,
516
+ "GDPR Article 25",
517
+ false
518
+ ));
519
+ }
520
+ if (/gtag|ga\(|analytics|fbq\(|pixel/i.test(line) && !/consent|cookie.*accepted/i.test(content)) {
521
+ issues.push(this.createIssue(
522
+ this.generateIssueId(),
523
+ "moderate",
524
+ "Analytics/tracking loaded without checking consent",
525
+ "Only load analytics after user consents (GDPR, CCPA requirement)",
526
+ file,
527
+ i + 1,
528
+ 0.75,
529
+ "GDPR Article 7",
530
+ false
531
+ ));
532
+ }
533
+ if (/delete.*user|remove.*account/i.test(line) && !/backup|archive/i.test(line)) {
534
+ issues.push(this.createIssue(
535
+ this.generateIssueId(),
536
+ "low",
537
+ "User deletion - verify data is fully removed from all systems",
538
+ "Ensure GDPR right to erasure compliance - remove from backups, logs, third parties",
539
+ file,
540
+ i + 1,
541
+ 0.6,
542
+ "GDPR Article 17",
543
+ false
544
+ ));
545
+ }
480
546
  }
547
+ } catch {
481
548
  }
482
549
  }
483
- this.progress?.aiReview(`${fileName} - privacy compliance analysis`);
484
- const aiIssue = {
485
- id: this.generateIssueId(),
486
- severity: "moderate",
487
- issue: `\u{1F9E0} AI Privacy Analysis: ${fileName}`,
488
- fix: "See AI analysis below",
489
- file: request.file,
490
- confidence: 1,
491
- autoFixable: false,
492
- agent: this.name,
493
- effort: "medium",
494
- aiPrompt: {
495
- system: request.systemPrompt,
496
- user: request.userPrompt
497
- }
498
- };
499
- issues.push(aiIssue);
500
550
  return issues;
501
551
  }
502
552
  /**
503
- * Legacy pattern-based analysis - now minimal
553
+ * AI Enhancement for privacy compliance
504
554
  */
505
- async analyzeFiles(_files, _context) {
506
- return [];
555
+ getAIEnhancementSystemPrompt() {
556
+ return `You are a privacy compliance expert specializing in GDPR, CCPA, and PCI-DSS.
557
+
558
+ Analyze detected issues and code for:
559
+ 1. PII handling (encryption, minimization, access controls)
560
+ 2. Consent management (cookie banners, tracking consent)
561
+ 3. Data retention and right to erasure
562
+ 4. Cross-border data transfers
563
+ 5. Third-party data sharing
564
+ 6. Security measures for personal data
565
+
566
+ Output STRICT JSON:
567
+ {
568
+ "validated": [{
569
+ "original_issue": "...",
570
+ "verdict": "TRUE_POSITIVE" | "FALSE_POSITIVE",
571
+ "confidence": 0-100,
572
+ "file": "path",
573
+ "line": 123,
574
+ "severity": "critical",
575
+ "regulation": "GDPR Article X / CCPA / PCI-DSS",
576
+ "risk": "What could happen if not fixed",
577
+ "fix": "Compliant implementation"
578
+ }],
579
+ "additional": [{
580
+ "issue": "Privacy issue found",
581
+ "file": "path",
582
+ "line": 123,
583
+ "severity": "serious",
584
+ "regulation": "Regulation reference",
585
+ "risk": "Compliance risk",
586
+ "fix": "How to fix"
587
+ }],
588
+ "summary": "Overall privacy compliance assessment"
589
+ }`;
507
590
  }
508
591
  };
509
592
 
@@ -954,6 +1037,46 @@ var AccessibilityAgent = class extends BaseAgent {
954
1037
  }
955
1038
  return issues;
956
1039
  }
1040
+ /**
1041
+ * AI Enhancement for accessibility review
1042
+ */
1043
+ getAIEnhancementSystemPrompt() {
1044
+ return `You are a WCAG 2.1 accessibility expert. Review code for inclusive design.
1045
+
1046
+ Analyze detected issues and code for:
1047
+ 1. Screen reader compatibility (ARIA labels, roles, live regions)
1048
+ 2. Keyboard navigation (focus management, tab order, focus trapping)
1049
+ 3. Color contrast (4.5:1 for text, 3:1 for large text)
1050
+ 4. Form accessibility (labels, error messages, required fields)
1051
+ 5. Dynamic content (loading states, announcements, focus management)
1052
+ 6. Reduced motion support (prefers-reduced-motion)
1053
+ 7. Touch target sizes (44x44px minimum)
1054
+
1055
+ Output STRICT JSON:
1056
+ {
1057
+ "validated": [{
1058
+ "original_issue": "...",
1059
+ "verdict": "TRUE_POSITIVE" | "FALSE_POSITIVE",
1060
+ "confidence": 0-100,
1061
+ "file": "path",
1062
+ "line": 123,
1063
+ "severity": "serious",
1064
+ "wcag_criterion": "WCAG 2.1 - X.X.X Name",
1065
+ "impact": "How this affects users with disabilities",
1066
+ "fix": "Accessible code fix"
1067
+ }],
1068
+ "additional": [{
1069
+ "issue": "Accessibility issue found",
1070
+ "file": "path",
1071
+ "line": 123,
1072
+ "severity": "moderate",
1073
+ "wcag_criterion": "WCAG criterion",
1074
+ "impact": "User impact",
1075
+ "fix": "Accessible implementation"
1076
+ }],
1077
+ "summary": "Overall accessibility assessment"
1078
+ }`;
1079
+ }
957
1080
  };
958
1081
 
959
1082
  // src/agents/design-engineer.ts
@@ -1356,6 +1479,43 @@ var DesignEngineerAgent = class extends BaseAgent {
1356
1479
  }
1357
1480
  return issues;
1358
1481
  }
1482
+ /**
1483
+ * AI Enhancement for design review
1484
+ */
1485
+ getAIEnhancementSystemPrompt() {
1486
+ return `You are an award-winning design engineer from a top creative agency. You review code for Awwwards-level polish.
1487
+
1488
+ Analyze detected issues and code for:
1489
+ 1. Design system consistency (tokens, spacing scales, color systems)
1490
+ 2. Motion design quality (easing curves, choreography, performance)
1491
+ 3. Visual hierarchy and typography systems
1492
+ 4. Creative CSS techniques (gradients, masks, blend modes, clip-paths)
1493
+ 5. Modern CSS features (container queries, :has(), subgrid)
1494
+ 6. Responsive design patterns (fluid typography, aspect ratios)
1495
+
1496
+ Output STRICT JSON:
1497
+ {
1498
+ "validated": [{
1499
+ "original_issue": "...",
1500
+ "verdict": "TRUE_POSITIVE" | "FALSE_POSITIVE",
1501
+ "confidence": 0-100,
1502
+ "file": "path",
1503
+ "line": 123,
1504
+ "severity": "moderate",
1505
+ "design_impact": "Why this hurts the user experience",
1506
+ "fix": "Creative CSS fix with code example"
1507
+ }],
1508
+ "additional": [{
1509
+ "issue": "Design opportunity found",
1510
+ "file": "path",
1511
+ "line": 123,
1512
+ "severity": "low",
1513
+ "enhancement": "How to elevate this to award-winning quality",
1514
+ "fix": "Modern CSS/animation code"
1515
+ }],
1516
+ "summary": "Overall design craft assessment"
1517
+ }`;
1518
+ }
1359
1519
  };
1360
1520
 
1361
1521
  // src/agents/legal.ts
@@ -1499,7 +1659,7 @@ var LegalAgent = class extends BaseAgent {
1499
1659
  };
1500
1660
 
1501
1661
  // src/agents/test.ts
1502
- import { basename as basename3, dirname } from "path";
1662
+ import { basename, dirname } from "path";
1503
1663
  import { existsSync } from "fs";
1504
1664
  var TestAgent = class extends BaseAgent {
1505
1665
  name = "test";
@@ -1526,7 +1686,7 @@ var TestAgent = class extends BaseAgent {
1526
1686
  }
1527
1687
  checkTestCoverage(file, content, _context) {
1528
1688
  const issues = [];
1529
- const fileName = basename3(file);
1689
+ const fileName = basename(file);
1530
1690
  const fileDir = dirname(file);
1531
1691
  const testPatterns = [
1532
1692
  file.replace(/\.(ts|js|tsx|jsx)$/, ".test.$1"),
@@ -1806,6 +1966,46 @@ var SoftwareArchitectAgent = class extends BaseAgent {
1806
1966
  }
1807
1967
  return issues;
1808
1968
  }
1969
+ /**
1970
+ * AI Enhancement for architecture review
1971
+ */
1972
+ getAIEnhancementSystemPrompt() {
1973
+ return `You are a senior software architect reviewing code for scalability, maintainability, and best practices.
1974
+
1975
+ Analyze detected issues and code for:
1976
+ 1. SOLID principles violations
1977
+ 2. Separation of concerns (UI, API, data layers)
1978
+ 3. N+1 queries and database optimization
1979
+ 4. Dependency injection and testability
1980
+ 5. Error handling and resilience patterns
1981
+ 6. Caching and performance considerations
1982
+ 7. Circular dependencies and coupling
1983
+
1984
+ Output STRICT JSON:
1985
+ {
1986
+ "validated": [{
1987
+ "original_issue": "...",
1988
+ "verdict": "TRUE_POSITIVE" | "FALSE_POSITIVE",
1989
+ "confidence": 0-100,
1990
+ "file": "path",
1991
+ "line": 123,
1992
+ "severity": "serious",
1993
+ "principle": "SOLID / DRY / YAGNI / etc",
1994
+ "impact": "How this affects scalability/maintainability",
1995
+ "fix": "Architectural fix with code example"
1996
+ }],
1997
+ "additional": [{
1998
+ "issue": "Architecture issue found",
1999
+ "file": "path",
2000
+ "line": 123,
2001
+ "severity": "moderate",
2002
+ "principle": "Violated principle",
2003
+ "impact": "Technical debt impact",
2004
+ "fix": "Refactoring approach"
2005
+ }],
2006
+ "summary": "Overall architecture assessment"
2007
+ }`;
2008
+ }
1809
2009
  };
1810
2010
 
1811
2011
  // src/agents/devops.ts
@@ -1971,10 +2171,49 @@ var DevOpsAgent = class extends BaseAgent {
1971
2171
  }
1972
2172
  return issues;
1973
2173
  }
2174
+ /**
2175
+ * AI Enhancement for DevOps review
2176
+ */
2177
+ getAIEnhancementSystemPrompt() {
2178
+ return `You are a DevOps engineer reviewing code for production readiness.
2179
+
2180
+ Analyze detected issues and code for:
2181
+ 1. Environment configuration (dev/staging/prod)
2182
+ 2. Logging and observability (structured logs, metrics)
2183
+ 3. Error handling and graceful degradation
2184
+ 4. Resource management (connections, memory, timeouts)
2185
+ 5. Deployment patterns (health checks, graceful shutdown)
2186
+ 6. CI/CD concerns (test coverage, build optimization)
2187
+ 7. Secrets management
2188
+
2189
+ Output STRICT JSON:
2190
+ {
2191
+ "validated": [{
2192
+ "original_issue": "...",
2193
+ "verdict": "TRUE_POSITIVE" | "FALSE_POSITIVE",
2194
+ "confidence": 0-100,
2195
+ "file": "path",
2196
+ "line": 123,
2197
+ "severity": "serious",
2198
+ "category": "logging | config | deployment | etc",
2199
+ "production_risk": "What could go wrong in prod",
2200
+ "fix": "DevOps best practice fix"
2201
+ }],
2202
+ "additional": [{
2203
+ "issue": "DevOps issue found",
2204
+ "file": "path",
2205
+ "line": 123,
2206
+ "severity": "moderate",
2207
+ "category": "Issue category",
2208
+ "production_risk": "Risk description",
2209
+ "fix": "Implementation"
2210
+ }],
2211
+ "summary": "Production readiness assessment"
2212
+ }`;
2213
+ }
1974
2214
  };
1975
2215
 
1976
2216
  // src/agents/bug-finding.ts
1977
- import { basename as basename4 } from "path";
1978
2217
  var BUG_INDICATORS = {
1979
2218
  high: [
1980
2219
  { pattern: /async|await|promise/i, reason: "async code" },
@@ -2132,57 +2371,76 @@ If no significant bugs found, respond with:
2132
2371
  "No significant bugs found in this file."`;
2133
2372
  }
2134
2373
  /**
2135
- * Process AI request and check for critical patterns
2374
+ * Override AI enhancement system prompt for bug-finding
2375
+ */
2376
+ getAIEnhancementSystemPrompt() {
2377
+ return `You are a QA engineer trying to break code. Find bugs that will cause crashes or incorrect behavior.
2378
+
2379
+ Analyze detected issues and code for:
2380
+ 1. Null/undefined errors
2381
+ 2. Async/await bugs (missing await, async forEach)
2382
+ 3. Race conditions
2383
+ 4. Edge cases (empty arrays, zero values, boundaries)
2384
+ 5. Type coercion issues
2385
+ 6. Resource leaks
2386
+
2387
+ Output STRICT JSON:
2388
+ {
2389
+ "validated": [{
2390
+ "original_issue": "...",
2391
+ "verdict": "TRUE_POSITIVE" | "FALSE_POSITIVE",
2392
+ "confidence": 0-100,
2393
+ "file": "path",
2394
+ "line": 123,
2395
+ "severity": "critical",
2396
+ "trigger_condition": "When would this crash?",
2397
+ "fix": "Code fix"
2398
+ }],
2399
+ "additional": [{
2400
+ "issue": "Bug description",
2401
+ "file": "path",
2402
+ "line": 123,
2403
+ "severity": "serious",
2404
+ "trigger_condition": "When would this fail?",
2405
+ "fix": "Code fix"
2406
+ }],
2407
+ "summary": "Bug hunt assessment"
2408
+ }`;
2409
+ }
2410
+ /**
2411
+ * Pattern-based bug detection
2136
2412
  */
2137
- async processAIRequest(request) {
2413
+ async analyzeFiles(files, _context) {
2138
2414
  const issues = [];
2139
- const fileName = basename4(request.file);
2140
- const content = request.code;
2141
- const lines = content.split("\n");
2142
- for (let i = 0; i < lines.length; i++) {
2143
- const line = lines[i] || "";
2144
- for (const { pattern, severity, issue, fix } of CRITICAL_BUG_PATTERNS) {
2145
- if (pattern.test(line)) {
2146
- this.progress?.found(severity, `${issue} at line ${i + 1}`);
2147
- issues.push(this.createIssue(
2148
- this.generateIssueId(),
2149
- severity,
2150
- issue,
2151
- fix,
2152
- request.file,
2153
- i + 1,
2154
- 0.95,
2155
- void 0,
2156
- true
2157
- ));
2415
+ for (const file of files) {
2416
+ if (/node_modules|\.d\.ts$|\.min\.|dist\/|build\//.test(file)) continue;
2417
+ try {
2418
+ const content = await this.readFile(file);
2419
+ const lines = content.split("\n");
2420
+ for (let i = 0; i < lines.length; i++) {
2421
+ const line = lines[i] || "";
2422
+ for (const { pattern, severity, issue, fix } of CRITICAL_BUG_PATTERNS) {
2423
+ if (pattern.test(line)) {
2424
+ this.progress?.found(severity, `${issue} at line ${i + 1}`);
2425
+ issues.push(this.createIssue(
2426
+ this.generateIssueId(),
2427
+ severity,
2428
+ issue,
2429
+ fix,
2430
+ file,
2431
+ i + 1,
2432
+ 0.95,
2433
+ void 0,
2434
+ true
2435
+ ));
2436
+ }
2437
+ }
2158
2438
  }
2439
+ } catch {
2159
2440
  }
2160
2441
  }
2161
- this.progress?.aiReview(`${fileName} - deep bug analysis`);
2162
- const aiIssue = {
2163
- id: this.generateIssueId(),
2164
- severity: "moderate",
2165
- issue: `\u{1F9E0} AI Bug Analysis: ${fileName}`,
2166
- fix: "See AI analysis below",
2167
- file: request.file,
2168
- confidence: 1,
2169
- autoFixable: false,
2170
- agent: this.name,
2171
- effort: "medium",
2172
- aiPrompt: {
2173
- system: request.systemPrompt,
2174
- user: request.userPrompt
2175
- }
2176
- };
2177
- issues.push(aiIssue);
2178
2442
  return issues;
2179
2443
  }
2180
- /**
2181
- * Legacy pattern-based analysis - now minimal
2182
- */
2183
- async analyzeFiles(_files, _context) {
2184
- return [];
2185
- }
2186
2444
  };
2187
2445
 
2188
2446
  // src/agents/user-testing.ts
@@ -2913,6 +3171,44 @@ var SOC2Agent = class extends BaseAgent {
2913
3171
  };
2914
3172
  return fixes[category] || "Review and fix according to SOC 2 requirements.";
2915
3173
  }
3174
+ /**
3175
+ * AI Enhancement for SOC 2 compliance
3176
+ */
3177
+ getAIEnhancementSystemPrompt() {
3178
+ return `You are a SOC 2 compliance auditor reviewing code for Trust Services Criteria violations.
3179
+
3180
+ Analyze detected issues for SOC 2 compliance:
3181
+ 1. Security (CC6): Access controls, encryption, vulnerability management
3182
+ 2. Availability (CC7): System operations, incident response
3183
+ 3. Processing Integrity (CC8): Data accuracy, completeness
3184
+ 4. Confidentiality (CC9): Data classification, access restrictions
3185
+ 5. Privacy (P1-P8): GDPR-aligned privacy controls
3186
+
3187
+ Output STRICT JSON:
3188
+ {
3189
+ "validated": [{
3190
+ "original_issue": "...",
3191
+ "verdict": "TRUE_POSITIVE" | "FALSE_POSITIVE",
3192
+ "confidence": 0-100,
3193
+ "file": "path",
3194
+ "line": 123,
3195
+ "severity": "critical",
3196
+ "soc2_criteria": "CC6.1 / CC7.2 / etc",
3197
+ "audit_risk": "What an auditor would flag",
3198
+ "fix": "Compliant implementation"
3199
+ }],
3200
+ "additional": [{
3201
+ "issue": "Compliance gap found",
3202
+ "file": "path",
3203
+ "line": 123,
3204
+ "severity": "serious",
3205
+ "soc2_criteria": "SOC 2 criteria",
3206
+ "audit_risk": "Audit finding risk",
3207
+ "fix": "Remediation steps"
3208
+ }],
3209
+ "summary": "SOC 2 audit readiness assessment"
3210
+ }`;
3211
+ }
2916
3212
  };
2917
3213
 
2918
3214
  // src/agents/super-reviewer.ts
@@ -4595,14 +4891,14 @@ function getAgentRegistry() {
4595
4891
  // src/tools/scan.ts
4596
4892
  import { readFile as readFile7, readdir as readdir3 } from "fs/promises";
4597
4893
  import { existsSync as existsSync4 } from "fs";
4598
- import { basename as basename10, isAbsolute, resolve, join as join4, extname as extname4 } from "path";
4894
+ import { basename as basename7, isAbsolute, resolve, join as join4, extname as extname4 } from "path";
4599
4895
 
4600
4896
  // src/orchestrator/context-analyzer.ts
4601
4897
  import { readFile as readFile2 } from "fs/promises";
4602
4898
  import { parse } from "@babel/parser";
4603
4899
  import traverse from "@babel/traverse";
4604
4900
  import { existsSync as existsSync2 } from "fs";
4605
- import { extname as extname2, basename as basename5 } from "path";
4901
+ import { extname as extname2, basename as basename2 } from "path";
4606
4902
  var ContextAnalyzer = class {
4607
4903
  async analyze(files, userContext) {
4608
4904
  const context = {
@@ -4652,7 +4948,7 @@ var ContextAnalyzer = class {
4652
4948
  const lines = content.split("\n").length;
4653
4949
  totalLines += lines;
4654
4950
  if (!file) continue;
4655
- const fileName = basename5(file).toLowerCase();
4951
+ const fileName = basename2(file).toLowerCase();
4656
4952
  const filePath = file.toLowerCase();
4657
4953
  context.filePatterns.push(fileName);
4658
4954
  if (!context.language) {
@@ -5748,7 +6044,7 @@ var Executor = class {
5748
6044
 
5749
6045
  // src/analysis/cross-file.ts
5750
6046
  import { readFile as readFile3, readdir as readdir2 } from "fs/promises";
5751
- import { join as join2, extname as extname3, relative, dirname as dirname2, basename as basename6 } from "path";
6047
+ import { join as join2, extname as extname3, relative, dirname as dirname2, basename as basename3 } from "path";
5752
6048
  async function buildDependencyGraph(rootDir, maxFiles = 200) {
5753
6049
  const files = /* @__PURE__ */ new Map();
5754
6050
  const issues = [];
@@ -5891,7 +6187,7 @@ function detectCircularDependencies(files) {
5891
6187
  type: "circular-dep",
5892
6188
  severity: "serious",
5893
6189
  files: cycle,
5894
- description: `Circular dependency: ${cycle.map((f) => basename6(f)).join(" \u2192 ")}`,
6190
+ description: `Circular dependency: ${cycle.map((f) => basename3(f)).join(" \u2192 ")}`,
5895
6191
  suggestion: "Break the cycle by extracting shared code to a separate module"
5896
6192
  });
5897
6193
  }
@@ -5946,7 +6242,7 @@ function detectUnusedExports(files) {
5946
6242
  type: "unused-export",
5947
6243
  severity: "low",
5948
6244
  files: [path],
5949
- description: `Unused export '${exp.name}' in ${basename6(path)}`,
6245
+ description: `Unused export '${exp.name}' in ${basename3(path)}`,
5950
6246
  suggestion: `Remove the export or ensure it's imported somewhere`
5951
6247
  });
5952
6248
  }
@@ -5958,13 +6254,13 @@ function detectOrphanedFiles(files) {
5958
6254
  const issues = [];
5959
6255
  for (const [path, node] of files) {
5960
6256
  if (node.exports.length === 0 && node.dependents.length === 0) {
5961
- if (basename6(path).match(/^(index|main|app|server)\./i)) continue;
6257
+ if (basename3(path).match(/^(index|main|app|server)\./i)) continue;
5962
6258
  if (path.includes(".test.") || path.includes(".spec.") || path.includes("__tests__")) continue;
5963
6259
  issues.push({
5964
6260
  type: "orphaned-file",
5965
6261
  severity: "low",
5966
6262
  files: [path],
5967
- description: `Potentially orphaned file: ${basename6(path)}`,
6263
+ description: `Potentially orphaned file: ${basename3(path)}`,
5968
6264
  suggestion: "Verify this file is needed or remove it"
5969
6265
  });
5970
6266
  }
@@ -6081,7 +6377,7 @@ ${"\u2501".repeat(60)}
6081
6377
  output += `|------|---------|-------------|
6082
6378
  `;
6083
6379
  for (const node of sorted) {
6084
- output += `| ${basename6(node.relativePath)} | ${node.dependencies.length} | ${node.dependents.length} |
6380
+ output += `| ${basename3(node.relativePath)} | ${node.dependencies.length} | ${node.dependents.length} |
6085
6381
  `;
6086
6382
  }
6087
6383
  return output;
@@ -6089,7 +6385,7 @@ ${"\u2501".repeat(60)}
6089
6385
 
6090
6386
  // src/analysis/semantic-analyzer.ts
6091
6387
  import { readFile as readFile4 } from "fs/promises";
6092
- import { basename as basename7, relative as relative2 } from "path";
6388
+ import { basename as basename4, relative as relative2 } from "path";
6093
6389
  var SemanticAnalyzer = class {
6094
6390
  functions = [];
6095
6391
  routes = [];
@@ -6195,7 +6491,7 @@ var SemanticAnalyzer = class {
6195
6491
  const match = line.match(pattern);
6196
6492
  if (match) {
6197
6493
  const method = match[1].toUpperCase();
6198
- const path = match[2] || `/${basename7(file).replace(/\.[^.]+$/, "")}`;
6494
+ const path = match[2] || `/${basename4(file).replace(/\.[^.]+$/, "")}`;
6199
6495
  const contextLines = lines.slice(i, Math.min(i + 30, lines.length)).join("\n");
6200
6496
  const hasAuth = /auth|protect|authenticate|session|jwt|bearer/i.test(line + contextLines);
6201
6497
  const accessesBody = /req\.body|request\.json\(\)|formData/i.test(contextLines);
@@ -6409,7 +6705,7 @@ function formatSemanticIssues(issues) {
6409
6705
  const icon = { critical: "\u{1F534}", serious: "\u{1F7E0}", moderate: "\u{1F7E1}", low: "\u{1F535}" }[issue.severity];
6410
6706
  output += `${icon} **${issue.description}**
6411
6707
  `;
6412
- output += ` \u{1F4CD} \`${basename7(issue.source.file)}:${issue.source.line}\`
6708
+ output += ` \u{1F4CD} \`${basename4(issue.source.file)}:${issue.source.line}\`
6413
6709
  `;
6414
6710
  output += ` \u{1F527} ${issue.fix}
6415
6711
 
@@ -6425,7 +6721,7 @@ function formatSemanticIssues(issues) {
6425
6721
  }
6426
6722
 
6427
6723
  // src/analysis/smart-prioritizer.ts
6428
- import { basename as basename8 } from "path";
6724
+ import { basename as basename5 } from "path";
6429
6725
  function prioritizeIssues(issues) {
6430
6726
  const { filtered, noiseCount } = filterNoise(issues);
6431
6727
  const deduplicated = deduplicateIssues(filtered);
@@ -6615,7 +6911,7 @@ function generateSummary(critical, important, advisory, noiseCount) {
6615
6911
  for (const issue of critical.slice(0, 5)) {
6616
6912
  summary += `1. **${issue.issue}** - ${issue.reason}
6617
6913
  `;
6618
- summary += ` \u{1F4CD} \`${basename8(issue.file)}:${issue.line || "?"}\`
6914
+ summary += ` \u{1F4CD} \`${basename5(issue.file)}:${issue.line || "?"}\`
6619
6915
  `;
6620
6916
  summary += ` \u{1F527} ${issue.fix}
6621
6917
 
@@ -6663,7 +6959,7 @@ function formatPrioritizedResults(result) {
6663
6959
 
6664
6960
  // src/analysis/attack-surface.ts
6665
6961
  import { readFile as readFile5 } from "fs/promises";
6666
- import { basename as basename9, relative as relative3 } from "path";
6962
+ import { basename as basename6, relative as relative3 } from "path";
6667
6963
  var AttackSurfaceAnalyzer = class {
6668
6964
  endpoints = [];
6669
6965
  dataFlows = [];
@@ -6704,7 +7000,7 @@ var AttackSurfaceAnalyzer = class {
6704
7000
  const match = pattern.exec(line);
6705
7001
  if (match) {
6706
7002
  const method = match[1].toUpperCase();
6707
- const path = match[2] || `/${basename9(file).replace(/\.[^.]+$/, "")}`;
7003
+ const path = match[2] || `/${basename6(file).replace(/\.[^.]+$/, "")}`;
6708
7004
  const contextLines = lines.slice(i, Math.min(i + 50, lines.length)).join("\n");
6709
7005
  const authType = this.detectAuthType(line, contextLines);
6710
7006
  const endpoint = {
@@ -7797,7 +8093,7 @@ var TrieScanTool = class {
7797
8093
  this.progress.startPhase("init", "\u{1F53A} TRIE AGENT - AI-Powered Code Analysis");
7798
8094
  if (!files || !Array.isArray(files) || files.length === 0) {
7799
8095
  const scanDir2 = directory || process.cwd();
7800
- this.progress.startPhase("discovery", `Discovering files in ${basename10(scanDir2)}...`);
8096
+ this.progress.startPhase("discovery", `Discovering files in ${basename7(scanDir2)}...`);
7801
8097
  files = await this.discoverFiles(scanDir2);
7802
8098
  this.progress.completePhase(`Found ${files.length} files`);
7803
8099
  }
@@ -8135,7 +8431,7 @@ ${snippet}
8135
8431
 
8136
8432
  `;
8137
8433
  output += `\`\`\`
8138
- Fix the ${issue.issue.toLowerCase()} in ${basename10(issue.file)}${issue.line ? ` at line ${issue.line}` : ""}.
8434
+ Fix the ${issue.issue.toLowerCase()} in ${basename7(issue.file)}${issue.line ? ` at line ${issue.line}` : ""}.
8139
8435
 
8140
8436
  ${issue.fix}
8141
8437
  \`\`\`
@@ -8181,7 +8477,7 @@ ${snippet}
8181
8477
 
8182
8478
  `;
8183
8479
  output += `\`\`\`
8184
- Fix the ${issue.issue.toLowerCase()} in ${basename10(issue.file)}${issue.line ? ` at line ${issue.line}` : ""}.
8480
+ Fix the ${issue.issue.toLowerCase()} in ${basename7(issue.file)}${issue.line ? ` at line ${issue.line}` : ""}.
8185
8481
 
8186
8482
  ${issue.fix}
8187
8483
  \`\`\`
@@ -9585,4 +9881,4 @@ export {
9585
9881
  getSystemPrompt,
9586
9882
  TrieFixTool
9587
9883
  };
9588
- //# sourceMappingURL=chunk-TBCXJNH4.js.map
9884
+ //# sourceMappingURL=chunk-52RPXHT6.js.map