@triedotdev/mcp 1.0.20 → 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.
- package/dist/{agent-smith-BKHHC4G6.js → agent-smith-QYMYTLFV.js} +2 -2
- package/dist/{agent-smith-runner-WZDDYQGK.js → agent-smith-runner-3MIO4CWT.js} +2 -2
- package/dist/{chunk-EEVALBHC.js → chunk-3AUDJWEF.js} +6 -6
- package/dist/chunk-3AUDJWEF.js.map +1 -0
- package/dist/{chunk-NZ67PJ6E.js → chunk-52RPXHT6.js} +320 -67
- package/dist/chunk-52RPXHT6.js.map +1 -0
- package/dist/cli/yolo-daemon.js +2 -2
- package/dist/index.js +36 -348
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-EEVALBHC.js.map +0 -1
- package/dist/chunk-NZ67PJ6E.js.map +0 -1
- /package/dist/{agent-smith-BKHHC4G6.js.map → agent-smith-QYMYTLFV.js.map} +0 -0
- /package/dist/{agent-smith-runner-WZDDYQGK.js.map → agent-smith-runner-3MIO4CWT.js.map} +0 -0
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
AgentSmithAgent,
|
|
16
16
|
BaseAgent,
|
|
17
17
|
ProgressReporter
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-3AUDJWEF.js";
|
|
19
19
|
|
|
20
20
|
// src/agents/security.ts
|
|
21
21
|
var ALWAYS_SKIP_FILES = [
|
|
@@ -297,7 +297,6 @@ Output STRICT JSON:
|
|
|
297
297
|
};
|
|
298
298
|
|
|
299
299
|
// src/agents/privacy.ts
|
|
300
|
-
import { basename } from "path";
|
|
301
300
|
var PRIVACY_INDICATORS = {
|
|
302
301
|
high: [
|
|
303
302
|
{ pattern: /email|phone|ssn|social.*security|passport|driver.*license/i, reason: "PII fields" },
|
|
@@ -391,7 +390,7 @@ var PrivacyAgent = class extends BaseAgent {
|
|
|
391
390
|
};
|
|
392
391
|
}
|
|
393
392
|
/**
|
|
394
|
-
* Get privacy-focused system prompt
|
|
393
|
+
* Get privacy-focused system prompt (legacy - kept for reference)
|
|
395
394
|
*/
|
|
396
395
|
getSystemPrompt() {
|
|
397
396
|
return `You are a data privacy officer and compliance expert.
|
|
@@ -423,7 +422,7 @@ SEVERITY GUIDELINES:
|
|
|
423
422
|
- LOW: Minor concern, nice to have`;
|
|
424
423
|
}
|
|
425
424
|
/**
|
|
426
|
-
* Build privacy-specific analysis prompt
|
|
425
|
+
* Build privacy-specific analysis prompt (legacy - kept for reference)
|
|
427
426
|
*/
|
|
428
427
|
buildUserPrompt(filePath, content, relevance) {
|
|
429
428
|
const isPersistenceFile = /(model|schema|entity|migration|prisma|mongoose|db|database)/i.test(filePath);
|
|
@@ -479,56 +478,115 @@ If no privacy issues found, respond with:
|
|
|
479
478
|
return prompt;
|
|
480
479
|
}
|
|
481
480
|
/**
|
|
482
|
-
*
|
|
481
|
+
* Pattern-based privacy analysis
|
|
483
482
|
*/
|
|
484
|
-
async
|
|
483
|
+
async analyzeFiles(files, _context) {
|
|
485
484
|
const issues = [];
|
|
486
|
-
const
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
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
|
+
}
|
|
505
546
|
}
|
|
547
|
+
} catch {
|
|
506
548
|
}
|
|
507
549
|
}
|
|
508
|
-
this.progress?.aiReview(`${fileName} - privacy compliance analysis`);
|
|
509
|
-
const aiIssue = {
|
|
510
|
-
id: this.generateIssueId(),
|
|
511
|
-
severity: "moderate",
|
|
512
|
-
issue: `\u{1F9E0} AI Privacy Analysis: ${fileName}`,
|
|
513
|
-
fix: "See AI analysis below",
|
|
514
|
-
file: request.file,
|
|
515
|
-
confidence: 1,
|
|
516
|
-
autoFixable: false,
|
|
517
|
-
agent: this.name,
|
|
518
|
-
effort: "medium",
|
|
519
|
-
aiPrompt: {
|
|
520
|
-
system: request.systemPrompt,
|
|
521
|
-
user: request.userPrompt
|
|
522
|
-
}
|
|
523
|
-
};
|
|
524
|
-
issues.push(aiIssue);
|
|
525
550
|
return issues;
|
|
526
551
|
}
|
|
527
552
|
/**
|
|
528
|
-
*
|
|
553
|
+
* AI Enhancement for privacy compliance
|
|
529
554
|
*/
|
|
530
|
-
|
|
531
|
-
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
|
+
}`;
|
|
532
590
|
}
|
|
533
591
|
};
|
|
534
592
|
|
|
@@ -979,6 +1037,46 @@ var AccessibilityAgent = class extends BaseAgent {
|
|
|
979
1037
|
}
|
|
980
1038
|
return issues;
|
|
981
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
|
+
}
|
|
982
1080
|
};
|
|
983
1081
|
|
|
984
1082
|
// src/agents/design-engineer.ts
|
|
@@ -1381,6 +1479,43 @@ var DesignEngineerAgent = class extends BaseAgent {
|
|
|
1381
1479
|
}
|
|
1382
1480
|
return issues;
|
|
1383
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
|
+
}
|
|
1384
1519
|
};
|
|
1385
1520
|
|
|
1386
1521
|
// src/agents/legal.ts
|
|
@@ -1524,7 +1659,7 @@ var LegalAgent = class extends BaseAgent {
|
|
|
1524
1659
|
};
|
|
1525
1660
|
|
|
1526
1661
|
// src/agents/test.ts
|
|
1527
|
-
import { basename
|
|
1662
|
+
import { basename, dirname } from "path";
|
|
1528
1663
|
import { existsSync } from "fs";
|
|
1529
1664
|
var TestAgent = class extends BaseAgent {
|
|
1530
1665
|
name = "test";
|
|
@@ -1551,7 +1686,7 @@ var TestAgent = class extends BaseAgent {
|
|
|
1551
1686
|
}
|
|
1552
1687
|
checkTestCoverage(file, content, _context) {
|
|
1553
1688
|
const issues = [];
|
|
1554
|
-
const fileName =
|
|
1689
|
+
const fileName = basename(file);
|
|
1555
1690
|
const fileDir = dirname(file);
|
|
1556
1691
|
const testPatterns = [
|
|
1557
1692
|
file.replace(/\.(ts|js|tsx|jsx)$/, ".test.$1"),
|
|
@@ -1831,6 +1966,46 @@ var SoftwareArchitectAgent = class extends BaseAgent {
|
|
|
1831
1966
|
}
|
|
1832
1967
|
return issues;
|
|
1833
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
|
+
}
|
|
1834
2009
|
};
|
|
1835
2010
|
|
|
1836
2011
|
// src/agents/devops.ts
|
|
@@ -1996,6 +2171,46 @@ var DevOpsAgent = class extends BaseAgent {
|
|
|
1996
2171
|
}
|
|
1997
2172
|
return issues;
|
|
1998
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
|
+
}
|
|
1999
2214
|
};
|
|
2000
2215
|
|
|
2001
2216
|
// src/agents/bug-finding.ts
|
|
@@ -2956,6 +3171,44 @@ var SOC2Agent = class extends BaseAgent {
|
|
|
2956
3171
|
};
|
|
2957
3172
|
return fixes[category] || "Review and fix according to SOC 2 requirements.";
|
|
2958
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
|
+
}
|
|
2959
3212
|
};
|
|
2960
3213
|
|
|
2961
3214
|
// src/agents/super-reviewer.ts
|
|
@@ -4638,14 +4891,14 @@ function getAgentRegistry() {
|
|
|
4638
4891
|
// src/tools/scan.ts
|
|
4639
4892
|
import { readFile as readFile7, readdir as readdir3 } from "fs/promises";
|
|
4640
4893
|
import { existsSync as existsSync4 } from "fs";
|
|
4641
|
-
import { basename as
|
|
4894
|
+
import { basename as basename7, isAbsolute, resolve, join as join4, extname as extname4 } from "path";
|
|
4642
4895
|
|
|
4643
4896
|
// src/orchestrator/context-analyzer.ts
|
|
4644
4897
|
import { readFile as readFile2 } from "fs/promises";
|
|
4645
4898
|
import { parse } from "@babel/parser";
|
|
4646
4899
|
import traverse from "@babel/traverse";
|
|
4647
4900
|
import { existsSync as existsSync2 } from "fs";
|
|
4648
|
-
import { extname as extname2, basename as
|
|
4901
|
+
import { extname as extname2, basename as basename2 } from "path";
|
|
4649
4902
|
var ContextAnalyzer = class {
|
|
4650
4903
|
async analyze(files, userContext) {
|
|
4651
4904
|
const context = {
|
|
@@ -4695,7 +4948,7 @@ var ContextAnalyzer = class {
|
|
|
4695
4948
|
const lines = content.split("\n").length;
|
|
4696
4949
|
totalLines += lines;
|
|
4697
4950
|
if (!file) continue;
|
|
4698
|
-
const fileName =
|
|
4951
|
+
const fileName = basename2(file).toLowerCase();
|
|
4699
4952
|
const filePath = file.toLowerCase();
|
|
4700
4953
|
context.filePatterns.push(fileName);
|
|
4701
4954
|
if (!context.language) {
|
|
@@ -5791,7 +6044,7 @@ var Executor = class {
|
|
|
5791
6044
|
|
|
5792
6045
|
// src/analysis/cross-file.ts
|
|
5793
6046
|
import { readFile as readFile3, readdir as readdir2 } from "fs/promises";
|
|
5794
|
-
import { join as join2, extname as extname3, relative, dirname as dirname2, basename as
|
|
6047
|
+
import { join as join2, extname as extname3, relative, dirname as dirname2, basename as basename3 } from "path";
|
|
5795
6048
|
async function buildDependencyGraph(rootDir, maxFiles = 200) {
|
|
5796
6049
|
const files = /* @__PURE__ */ new Map();
|
|
5797
6050
|
const issues = [];
|
|
@@ -5934,7 +6187,7 @@ function detectCircularDependencies(files) {
|
|
|
5934
6187
|
type: "circular-dep",
|
|
5935
6188
|
severity: "serious",
|
|
5936
6189
|
files: cycle,
|
|
5937
|
-
description: `Circular dependency: ${cycle.map((f) =>
|
|
6190
|
+
description: `Circular dependency: ${cycle.map((f) => basename3(f)).join(" \u2192 ")}`,
|
|
5938
6191
|
suggestion: "Break the cycle by extracting shared code to a separate module"
|
|
5939
6192
|
});
|
|
5940
6193
|
}
|
|
@@ -5989,7 +6242,7 @@ function detectUnusedExports(files) {
|
|
|
5989
6242
|
type: "unused-export",
|
|
5990
6243
|
severity: "low",
|
|
5991
6244
|
files: [path],
|
|
5992
|
-
description: `Unused export '${exp.name}' in ${
|
|
6245
|
+
description: `Unused export '${exp.name}' in ${basename3(path)}`,
|
|
5993
6246
|
suggestion: `Remove the export or ensure it's imported somewhere`
|
|
5994
6247
|
});
|
|
5995
6248
|
}
|
|
@@ -6001,13 +6254,13 @@ function detectOrphanedFiles(files) {
|
|
|
6001
6254
|
const issues = [];
|
|
6002
6255
|
for (const [path, node] of files) {
|
|
6003
6256
|
if (node.exports.length === 0 && node.dependents.length === 0) {
|
|
6004
|
-
if (
|
|
6257
|
+
if (basename3(path).match(/^(index|main|app|server)\./i)) continue;
|
|
6005
6258
|
if (path.includes(".test.") || path.includes(".spec.") || path.includes("__tests__")) continue;
|
|
6006
6259
|
issues.push({
|
|
6007
6260
|
type: "orphaned-file",
|
|
6008
6261
|
severity: "low",
|
|
6009
6262
|
files: [path],
|
|
6010
|
-
description: `Potentially orphaned file: ${
|
|
6263
|
+
description: `Potentially orphaned file: ${basename3(path)}`,
|
|
6011
6264
|
suggestion: "Verify this file is needed or remove it"
|
|
6012
6265
|
});
|
|
6013
6266
|
}
|
|
@@ -6124,7 +6377,7 @@ ${"\u2501".repeat(60)}
|
|
|
6124
6377
|
output += `|------|---------|-------------|
|
|
6125
6378
|
`;
|
|
6126
6379
|
for (const node of sorted) {
|
|
6127
|
-
output += `| ${
|
|
6380
|
+
output += `| ${basename3(node.relativePath)} | ${node.dependencies.length} | ${node.dependents.length} |
|
|
6128
6381
|
`;
|
|
6129
6382
|
}
|
|
6130
6383
|
return output;
|
|
@@ -6132,7 +6385,7 @@ ${"\u2501".repeat(60)}
|
|
|
6132
6385
|
|
|
6133
6386
|
// src/analysis/semantic-analyzer.ts
|
|
6134
6387
|
import { readFile as readFile4 } from "fs/promises";
|
|
6135
|
-
import { basename as
|
|
6388
|
+
import { basename as basename4, relative as relative2 } from "path";
|
|
6136
6389
|
var SemanticAnalyzer = class {
|
|
6137
6390
|
functions = [];
|
|
6138
6391
|
routes = [];
|
|
@@ -6238,7 +6491,7 @@ var SemanticAnalyzer = class {
|
|
|
6238
6491
|
const match = line.match(pattern);
|
|
6239
6492
|
if (match) {
|
|
6240
6493
|
const method = match[1].toUpperCase();
|
|
6241
|
-
const path = match[2] || `/${
|
|
6494
|
+
const path = match[2] || `/${basename4(file).replace(/\.[^.]+$/, "")}`;
|
|
6242
6495
|
const contextLines = lines.slice(i, Math.min(i + 30, lines.length)).join("\n");
|
|
6243
6496
|
const hasAuth = /auth|protect|authenticate|session|jwt|bearer/i.test(line + contextLines);
|
|
6244
6497
|
const accessesBody = /req\.body|request\.json\(\)|formData/i.test(contextLines);
|
|
@@ -6452,7 +6705,7 @@ function formatSemanticIssues(issues) {
|
|
|
6452
6705
|
const icon = { critical: "\u{1F534}", serious: "\u{1F7E0}", moderate: "\u{1F7E1}", low: "\u{1F535}" }[issue.severity];
|
|
6453
6706
|
output += `${icon} **${issue.description}**
|
|
6454
6707
|
`;
|
|
6455
|
-
output += ` \u{1F4CD} \`${
|
|
6708
|
+
output += ` \u{1F4CD} \`${basename4(issue.source.file)}:${issue.source.line}\`
|
|
6456
6709
|
`;
|
|
6457
6710
|
output += ` \u{1F527} ${issue.fix}
|
|
6458
6711
|
|
|
@@ -6468,7 +6721,7 @@ function formatSemanticIssues(issues) {
|
|
|
6468
6721
|
}
|
|
6469
6722
|
|
|
6470
6723
|
// src/analysis/smart-prioritizer.ts
|
|
6471
|
-
import { basename as
|
|
6724
|
+
import { basename as basename5 } from "path";
|
|
6472
6725
|
function prioritizeIssues(issues) {
|
|
6473
6726
|
const { filtered, noiseCount } = filterNoise(issues);
|
|
6474
6727
|
const deduplicated = deduplicateIssues(filtered);
|
|
@@ -6658,7 +6911,7 @@ function generateSummary(critical, important, advisory, noiseCount) {
|
|
|
6658
6911
|
for (const issue of critical.slice(0, 5)) {
|
|
6659
6912
|
summary += `1. **${issue.issue}** - ${issue.reason}
|
|
6660
6913
|
`;
|
|
6661
|
-
summary += ` \u{1F4CD} \`${
|
|
6914
|
+
summary += ` \u{1F4CD} \`${basename5(issue.file)}:${issue.line || "?"}\`
|
|
6662
6915
|
`;
|
|
6663
6916
|
summary += ` \u{1F527} ${issue.fix}
|
|
6664
6917
|
|
|
@@ -6706,7 +6959,7 @@ function formatPrioritizedResults(result) {
|
|
|
6706
6959
|
|
|
6707
6960
|
// src/analysis/attack-surface.ts
|
|
6708
6961
|
import { readFile as readFile5 } from "fs/promises";
|
|
6709
|
-
import { basename as
|
|
6962
|
+
import { basename as basename6, relative as relative3 } from "path";
|
|
6710
6963
|
var AttackSurfaceAnalyzer = class {
|
|
6711
6964
|
endpoints = [];
|
|
6712
6965
|
dataFlows = [];
|
|
@@ -6747,7 +7000,7 @@ var AttackSurfaceAnalyzer = class {
|
|
|
6747
7000
|
const match = pattern.exec(line);
|
|
6748
7001
|
if (match) {
|
|
6749
7002
|
const method = match[1].toUpperCase();
|
|
6750
|
-
const path = match[2] || `/${
|
|
7003
|
+
const path = match[2] || `/${basename6(file).replace(/\.[^.]+$/, "")}`;
|
|
6751
7004
|
const contextLines = lines.slice(i, Math.min(i + 50, lines.length)).join("\n");
|
|
6752
7005
|
const authType = this.detectAuthType(line, contextLines);
|
|
6753
7006
|
const endpoint = {
|
|
@@ -7840,7 +8093,7 @@ var TrieScanTool = class {
|
|
|
7840
8093
|
this.progress.startPhase("init", "\u{1F53A} TRIE AGENT - AI-Powered Code Analysis");
|
|
7841
8094
|
if (!files || !Array.isArray(files) || files.length === 0) {
|
|
7842
8095
|
const scanDir2 = directory || process.cwd();
|
|
7843
|
-
this.progress.startPhase("discovery", `Discovering files in ${
|
|
8096
|
+
this.progress.startPhase("discovery", `Discovering files in ${basename7(scanDir2)}...`);
|
|
7844
8097
|
files = await this.discoverFiles(scanDir2);
|
|
7845
8098
|
this.progress.completePhase(`Found ${files.length} files`);
|
|
7846
8099
|
}
|
|
@@ -8178,7 +8431,7 @@ ${snippet}
|
|
|
8178
8431
|
|
|
8179
8432
|
`;
|
|
8180
8433
|
output += `\`\`\`
|
|
8181
|
-
Fix the ${issue.issue.toLowerCase()} in ${
|
|
8434
|
+
Fix the ${issue.issue.toLowerCase()} in ${basename7(issue.file)}${issue.line ? ` at line ${issue.line}` : ""}.
|
|
8182
8435
|
|
|
8183
8436
|
${issue.fix}
|
|
8184
8437
|
\`\`\`
|
|
@@ -8224,7 +8477,7 @@ ${snippet}
|
|
|
8224
8477
|
|
|
8225
8478
|
`;
|
|
8226
8479
|
output += `\`\`\`
|
|
8227
|
-
Fix the ${issue.issue.toLowerCase()} in ${
|
|
8480
|
+
Fix the ${issue.issue.toLowerCase()} in ${basename7(issue.file)}${issue.line ? ` at line ${issue.line}` : ""}.
|
|
8228
8481
|
|
|
8229
8482
|
${issue.fix}
|
|
8230
8483
|
\`\`\`
|
|
@@ -9628,4 +9881,4 @@ export {
|
|
|
9628
9881
|
getSystemPrompt,
|
|
9629
9882
|
TrieFixTool
|
|
9630
9883
|
};
|
|
9631
|
-
//# sourceMappingURL=chunk-
|
|
9884
|
+
//# sourceMappingURL=chunk-52RPXHT6.js.map
|