@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
package/dist/cli/yolo-daemon.js
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
import {
|
|
3
3
|
TrieFixTool,
|
|
4
4
|
TrieScanTool
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-52RPXHT6.js";
|
|
6
6
|
import "../chunk-3CS6Z2SL.js";
|
|
7
7
|
import "../chunk-MR755QGT.js";
|
|
8
8
|
import "../chunk-6NLHFIYA.js";
|
|
9
|
-
import "../chunk-
|
|
9
|
+
import "../chunk-3AUDJWEF.js";
|
|
10
10
|
import "../chunk-DGUM43GV.js";
|
|
11
11
|
|
|
12
12
|
// src/cli/yolo-daemon.ts
|
package/dist/index.js
CHANGED
|
@@ -12,11 +12,11 @@ import {
|
|
|
12
12
|
getAgentRegistry,
|
|
13
13
|
getPrompt,
|
|
14
14
|
getSystemPrompt
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-52RPXHT6.js";
|
|
16
16
|
import "./chunk-3CS6Z2SL.js";
|
|
17
17
|
import "./chunk-MR755QGT.js";
|
|
18
18
|
import "./chunk-6NLHFIYA.js";
|
|
19
|
-
import "./chunk-
|
|
19
|
+
import "./chunk-3AUDJWEF.js";
|
|
20
20
|
import "./chunk-DGUM43GV.js";
|
|
21
21
|
|
|
22
22
|
// src/index.ts
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
ListResourcesRequestSchema,
|
|
29
29
|
ReadResourceRequestSchema
|
|
30
30
|
} from "@modelcontextprotocol/sdk/types.js";
|
|
31
|
-
import { readdir as readdir2, readFile as
|
|
31
|
+
import { readdir as readdir2, readFile as readFile6 } from "fs/promises";
|
|
32
32
|
import { join as join7 } from "path";
|
|
33
33
|
|
|
34
34
|
// src/tools/explain.ts
|
|
@@ -1514,252 +1514,9 @@ To get a full report, run \`trie_scan\` on your codebase.`
|
|
|
1514
1514
|
};
|
|
1515
1515
|
|
|
1516
1516
|
// src/tools/agent.ts
|
|
1517
|
-
import { readdir, readFile as
|
|
1517
|
+
import { readdir, readFile as readFile3 } from "fs/promises";
|
|
1518
1518
|
import { existsSync as existsSync4 } from "fs";
|
|
1519
|
-
import { join as join3, extname as
|
|
1520
|
-
|
|
1521
|
-
// src/ai/engine.ts
|
|
1522
|
-
import { readFile as readFile3 } from "fs/promises";
|
|
1523
|
-
import { extname as extname4, relative as relative3, basename as basename3 } from "path";
|
|
1524
|
-
function detectLanguage(filePath) {
|
|
1525
|
-
const ext = extname4(filePath).toLowerCase();
|
|
1526
|
-
const langMap = {
|
|
1527
|
-
".ts": "typescript",
|
|
1528
|
-
".tsx": "tsx",
|
|
1529
|
-
".js": "javascript",
|
|
1530
|
-
".jsx": "jsx",
|
|
1531
|
-
".py": "python",
|
|
1532
|
-
".go": "go",
|
|
1533
|
-
".rs": "rust",
|
|
1534
|
-
".java": "java",
|
|
1535
|
-
".rb": "ruby",
|
|
1536
|
-
".php": "php",
|
|
1537
|
-
".vue": "vue",
|
|
1538
|
-
".svelte": "svelte",
|
|
1539
|
-
".sql": "sql",
|
|
1540
|
-
".json": "json",
|
|
1541
|
-
".yaml": "yaml",
|
|
1542
|
-
".yml": "yaml",
|
|
1543
|
-
".md": "markdown",
|
|
1544
|
-
".html": "html",
|
|
1545
|
-
".css": "css",
|
|
1546
|
-
".scss": "scss"
|
|
1547
|
-
};
|
|
1548
|
-
return langMap[ext] || "plaintext";
|
|
1549
|
-
}
|
|
1550
|
-
function analyzeFileContext(content, _filePath) {
|
|
1551
|
-
const summary = {
|
|
1552
|
-
hasAuth: false,
|
|
1553
|
-
hasDatabase: false,
|
|
1554
|
-
hasUserInput: false,
|
|
1555
|
-
hasFileOps: false,
|
|
1556
|
-
hasCrypto: false,
|
|
1557
|
-
hasExternalAPIs: false,
|
|
1558
|
-
exports: [],
|
|
1559
|
-
imports: []
|
|
1560
|
-
};
|
|
1561
|
-
if (/auth|login|session|jwt|token|password|credential|oauth/i.test(content)) {
|
|
1562
|
-
summary.hasAuth = true;
|
|
1563
|
-
}
|
|
1564
|
-
if (/prisma|sequelize|knex|mongodb|sql|query|database|postgres|mysql|sqlite/i.test(content)) {
|
|
1565
|
-
summary.hasDatabase = true;
|
|
1566
|
-
}
|
|
1567
|
-
if (/req\.body|req\.params|req\.query|formData|input|textarea|userinput/i.test(content)) {
|
|
1568
|
-
summary.hasUserInput = true;
|
|
1569
|
-
}
|
|
1570
|
-
if (/readFile|writeFile|createReadStream|createWriteStream|fs\.|multer|upload/i.test(content)) {
|
|
1571
|
-
summary.hasFileOps = true;
|
|
1572
|
-
}
|
|
1573
|
-
if (/crypto|bcrypt|argon|scrypt|encrypt|decrypt|hash|sign|verify/i.test(content)) {
|
|
1574
|
-
summary.hasCrypto = true;
|
|
1575
|
-
}
|
|
1576
|
-
if (/fetch\(|axios|http\.|https\.|request\(|got\(|api\//i.test(content)) {
|
|
1577
|
-
summary.hasExternalAPIs = true;
|
|
1578
|
-
}
|
|
1579
|
-
if (/from\s+['"]react['"]|import\s+React/i.test(content)) {
|
|
1580
|
-
summary.framework = "React";
|
|
1581
|
-
} else if (/from\s+['"]next|NextRequest|getServerSideProps/i.test(content)) {
|
|
1582
|
-
summary.framework = "Next.js";
|
|
1583
|
-
} else if (/from\s+['"]express['"]|express\(\)/i.test(content)) {
|
|
1584
|
-
summary.framework = "Express";
|
|
1585
|
-
} else if (/from\s+['"]fastify['"]|fastify\(\)/i.test(content)) {
|
|
1586
|
-
summary.framework = "Fastify";
|
|
1587
|
-
} else if (/from\s+['"]vue['"]|defineComponent/i.test(content)) {
|
|
1588
|
-
summary.framework = "Vue";
|
|
1589
|
-
}
|
|
1590
|
-
const exportMatches = content.match(/export\s+(const|function|class|interface|type)\s+(\w+)/g) || [];
|
|
1591
|
-
summary.exports = exportMatches.map((m) => m.split(/\s+/).pop() || "").filter(Boolean).slice(0, 10);
|
|
1592
|
-
const importMatches = content.match(/import\s+.*from\s+['"]([^'"]+)['"]/g) || [];
|
|
1593
|
-
summary.imports = importMatches.map((m) => {
|
|
1594
|
-
const match = m.match(/from\s+['"]([^'"]+)['"]/);
|
|
1595
|
-
return match ? match[1] : "";
|
|
1596
|
-
}).filter((s) => Boolean(s)).slice(0, 10);
|
|
1597
|
-
return summary;
|
|
1598
|
-
}
|
|
1599
|
-
function buildPromptContext(contexts, agent) {
|
|
1600
|
-
let contextSummary = "";
|
|
1601
|
-
const hasAuth = contexts.some((c) => c.summary?.hasAuth);
|
|
1602
|
-
const hasDatabase = contexts.some((c) => c.summary?.hasDatabase);
|
|
1603
|
-
const hasUserInput = contexts.some((c) => c.summary?.hasUserInput);
|
|
1604
|
-
const hasFileOps = contexts.some((c) => c.summary?.hasFileOps);
|
|
1605
|
-
const hasCrypto = contexts.some((c) => c.summary?.hasCrypto);
|
|
1606
|
-
const hasExternalAPIs = contexts.some((c) => c.summary?.hasExternalAPIs);
|
|
1607
|
-
const frameworks = [...new Set(contexts.map((c) => c.summary?.framework).filter(Boolean))];
|
|
1608
|
-
contextSummary += "## Code Context Summary\n\n";
|
|
1609
|
-
contextSummary += `**Files analyzed:** ${contexts.length}
|
|
1610
|
-
`;
|
|
1611
|
-
contextSummary += `**Total lines:** ${contexts.reduce((sum, c) => sum + c.lineCount, 0)}
|
|
1612
|
-
`;
|
|
1613
|
-
if (frameworks.length > 0) {
|
|
1614
|
-
contextSummary += `**Frameworks detected:** ${frameworks.join(", ")}
|
|
1615
|
-
`;
|
|
1616
|
-
}
|
|
1617
|
-
const features = [];
|
|
1618
|
-
if (hasAuth) features.push("Authentication/Authorization");
|
|
1619
|
-
if (hasDatabase) features.push("Database operations");
|
|
1620
|
-
if (hasUserInput) features.push("User input handling");
|
|
1621
|
-
if (hasFileOps) features.push("File operations");
|
|
1622
|
-
if (hasCrypto) features.push("Cryptography");
|
|
1623
|
-
if (hasExternalAPIs) features.push("External API calls");
|
|
1624
|
-
if (features.length > 0) {
|
|
1625
|
-
contextSummary += `**Key features:** ${features.join(", ")}
|
|
1626
|
-
`;
|
|
1627
|
-
}
|
|
1628
|
-
contextSummary += "\n";
|
|
1629
|
-
if (agent === "security") {
|
|
1630
|
-
if (hasAuth) contextSummary += "\u26A0\uFE0F **Auth code detected** - Review authentication flows carefully\n";
|
|
1631
|
-
if (hasDatabase) contextSummary += "\u26A0\uFE0F **Database ops detected** - Check for injection vulnerabilities\n";
|
|
1632
|
-
if (hasUserInput) contextSummary += "\u26A0\uFE0F **User input detected** - Verify input validation\n";
|
|
1633
|
-
} else if (agent === "privacy") {
|
|
1634
|
-
if (hasAuth) contextSummary += "\u26A0\uFE0F **Auth code detected** - Review credential handling\n";
|
|
1635
|
-
if (hasDatabase) contextSummary += "\u26A0\uFE0F **Database ops detected** - Check PII storage\n";
|
|
1636
|
-
} else if (agent === "bugs") {
|
|
1637
|
-
if (hasExternalAPIs) contextSummary += "\u26A0\uFE0F **External APIs detected** - Check error handling\n";
|
|
1638
|
-
if (hasFileOps) contextSummary += "\u26A0\uFE0F **File ops detected** - Verify error handling and cleanup\n";
|
|
1639
|
-
}
|
|
1640
|
-
return contextSummary;
|
|
1641
|
-
}
|
|
1642
|
-
async function buildAnalysis(request) {
|
|
1643
|
-
const { agent, files, context = {}, depth = "standard" } = request;
|
|
1644
|
-
const codeContexts = [];
|
|
1645
|
-
console.error(`\u{1F52C} AI Engine: Preparing ${agent} analysis for ${files.length} files...`);
|
|
1646
|
-
for (const filePath of files) {
|
|
1647
|
-
try {
|
|
1648
|
-
const content = await readFile3(filePath, "utf-8");
|
|
1649
|
-
const language = detectLanguage(filePath);
|
|
1650
|
-
const summary = analyzeFileContext(content, filePath);
|
|
1651
|
-
console.error(` \u{1F4C4} ${basename3(filePath)} - ${content.split("\n").length} lines`);
|
|
1652
|
-
codeContexts.push({
|
|
1653
|
-
filePath,
|
|
1654
|
-
relativePath: relative3(process.cwd(), filePath),
|
|
1655
|
-
language,
|
|
1656
|
-
content: depth === "quick" && content.length > 5e3 ? content.substring(0, 5e3) + "\n\n... (truncated for quick analysis)" : content,
|
|
1657
|
-
lineCount: content.split("\n").length,
|
|
1658
|
-
summary
|
|
1659
|
-
});
|
|
1660
|
-
} catch (error) {
|
|
1661
|
-
console.error(` \u26A0\uFE0F Error reading ${filePath}:`, error);
|
|
1662
|
-
}
|
|
1663
|
-
}
|
|
1664
|
-
const codeBlocks = codeContexts.map(
|
|
1665
|
-
(ctx) => `### File: ${ctx.relativePath}
|
|
1666
|
-
\`\`\`${ctx.language}
|
|
1667
|
-
${ctx.content}
|
|
1668
|
-
\`\`\``
|
|
1669
|
-
).join("\n\n");
|
|
1670
|
-
const promptContext = buildPromptContext(codeContexts, agent);
|
|
1671
|
-
const variables = {
|
|
1672
|
-
...context,
|
|
1673
|
-
code: codeBlocks,
|
|
1674
|
-
language: codeContexts[0]?.language || "unknown",
|
|
1675
|
-
filePath: codeContexts.map((c) => c.relativePath).join(", ")
|
|
1676
|
-
};
|
|
1677
|
-
const analysisPrompt = getPrompt(agent, "analysis", variables);
|
|
1678
|
-
const systemPrompt = getSystemPrompt(agent);
|
|
1679
|
-
const suggestedFollowUps = [];
|
|
1680
|
-
if (codeContexts.some((c) => c.summary?.hasAuth)) {
|
|
1681
|
-
suggestedFollowUps.push("\u{1F510} Review authentication implementation");
|
|
1682
|
-
}
|
|
1683
|
-
if (codeContexts.some((c) => c.summary?.hasDatabase)) {
|
|
1684
|
-
suggestedFollowUps.push("\u{1F5C4}\uFE0F Check database query security");
|
|
1685
|
-
}
|
|
1686
|
-
if (codeContexts.some((c) => c.summary?.hasUserInput)) {
|
|
1687
|
-
suggestedFollowUps.push("\u{1F4DD} Verify input validation");
|
|
1688
|
-
}
|
|
1689
|
-
const filesSummary = codeContexts.map((c) => {
|
|
1690
|
-
const features = [];
|
|
1691
|
-
if (c.summary?.hasAuth) features.push("auth");
|
|
1692
|
-
if (c.summary?.hasDatabase) features.push("db");
|
|
1693
|
-
if (c.summary?.hasUserInput) features.push("input");
|
|
1694
|
-
if (c.summary?.framework) features.push(c.summary.framework);
|
|
1695
|
-
const featureStr = features.length > 0 ? ` [${features.join(", ")}]` : "";
|
|
1696
|
-
return `\`${c.relativePath}\` (${c.lineCount} lines)${featureStr}`;
|
|
1697
|
-
}).join("\n");
|
|
1698
|
-
console.error(`\u{1F9E0} AI Engine: Analysis prepared - ready for Claude`);
|
|
1699
|
-
return {
|
|
1700
|
-
agent,
|
|
1701
|
-
systemPrompt,
|
|
1702
|
-
prompt: promptContext + "\n" + analysisPrompt,
|
|
1703
|
-
codeContext: codeContexts,
|
|
1704
|
-
suggestedFollowUps,
|
|
1705
|
-
filesSummary
|
|
1706
|
-
};
|
|
1707
|
-
}
|
|
1708
|
-
function formatAnalysisResponse(result, options = {}) {
|
|
1709
|
-
const { agent, systemPrompt, prompt, codeContext, suggestedFollowUps, filesSummary } = result;
|
|
1710
|
-
const includePrompt = options.includePrompt ?? true;
|
|
1711
|
-
let output = "";
|
|
1712
|
-
output += `
|
|
1713
|
-
${"\u2501".repeat(60)}
|
|
1714
|
-
`;
|
|
1715
|
-
output += `\u{1F9E0} ${agent.toUpperCase()} AGENT - AI ANALYSIS
|
|
1716
|
-
`;
|
|
1717
|
-
output += `${"\u2501".repeat(60)}
|
|
1718
|
-
|
|
1719
|
-
`;
|
|
1720
|
-
output += `## \u{1F4C2} Files for Analysis
|
|
1721
|
-
|
|
1722
|
-
`;
|
|
1723
|
-
output += filesSummary + "\n\n";
|
|
1724
|
-
if (suggestedFollowUps.length > 0) {
|
|
1725
|
-
output += `## \u{1F3AF} Focus Areas
|
|
1726
|
-
|
|
1727
|
-
`;
|
|
1728
|
-
for (const followUp of suggestedFollowUps) {
|
|
1729
|
-
output += `- ${followUp}
|
|
1730
|
-
`;
|
|
1731
|
-
}
|
|
1732
|
-
output += "\n";
|
|
1733
|
-
}
|
|
1734
|
-
output += `${"\u2500".repeat(60)}
|
|
1735
|
-
`;
|
|
1736
|
-
output += `## \u{1F9E0} Analysis Request for Claude
|
|
1737
|
-
|
|
1738
|
-
`;
|
|
1739
|
-
if (includePrompt) {
|
|
1740
|
-
output += `**Role:** ${systemPrompt.split("\n")[0]}
|
|
1741
|
-
|
|
1742
|
-
`;
|
|
1743
|
-
output += `---
|
|
1744
|
-
|
|
1745
|
-
`;
|
|
1746
|
-
output += prompt;
|
|
1747
|
-
output += `
|
|
1748
|
-
|
|
1749
|
-
${"\u2500".repeat(60)}
|
|
1750
|
-
`;
|
|
1751
|
-
} else {
|
|
1752
|
-
output += `*Run with \`output: "full"\` to see the complete analysis prompt.*
|
|
1753
|
-
|
|
1754
|
-
`;
|
|
1755
|
-
output += `**Summary:** ${codeContext.length} files ready for ${agent} analysis
|
|
1756
|
-
`;
|
|
1757
|
-
}
|
|
1758
|
-
output += `
|
|
1759
|
-
**Claude:** Please analyze the code above according to the ${agent} analysis instructions and provide your findings.
|
|
1760
|
-
`;
|
|
1761
|
-
return output;
|
|
1762
|
-
}
|
|
1519
|
+
import { join as join3, extname as extname4, isAbsolute as isAbsolute3, resolve as resolve3, basename as basename3 } from "path";
|
|
1763
1520
|
|
|
1764
1521
|
// src/knowledge/index.ts
|
|
1765
1522
|
var SECURITY_SOURCES = [
|
|
@@ -2065,27 +1822,6 @@ var SKIP_DIRS2 = /* @__PURE__ */ new Set([
|
|
|
2065
1822
|
".turbo",
|
|
2066
1823
|
".cache"
|
|
2067
1824
|
]);
|
|
2068
|
-
var AGENT_TO_AI_TYPE = {
|
|
2069
|
-
"security": "security",
|
|
2070
|
-
"privacy": "privacy",
|
|
2071
|
-
"legal": "legal",
|
|
2072
|
-
"accessibility": "accessibility",
|
|
2073
|
-
"design-engineer": "design-engineer",
|
|
2074
|
-
"software-architect": "architecture",
|
|
2075
|
-
"bug-finding": "bugs",
|
|
2076
|
-
"user-testing": "ux",
|
|
2077
|
-
"typecheck": "types",
|
|
2078
|
-
"devops": "devops",
|
|
2079
|
-
"comprehension": "explain",
|
|
2080
|
-
"test": "test",
|
|
2081
|
-
"trie_clean": "vibe",
|
|
2082
|
-
"super-reviewer": "pr_review",
|
|
2083
|
-
"agent-smith": "agent-smith",
|
|
2084
|
-
"performance": "performance",
|
|
2085
|
-
"e2e": "e2e",
|
|
2086
|
-
"visual-qa": "visual_qa",
|
|
2087
|
-
"data-flow": "data_flow"
|
|
2088
|
-
};
|
|
2089
1825
|
var TrieAgentTool = class {
|
|
2090
1826
|
agentRegistry = getAgentRegistry();
|
|
2091
1827
|
customAgentsLoaded = false;
|
|
@@ -2142,68 +1878,21 @@ ${this.agentRegistry.getAgentNames().map((n) => `- ${n}`).join("\n")}`
|
|
|
2142
1878
|
};
|
|
2143
1879
|
}
|
|
2144
1880
|
const startTime = Date.now();
|
|
2145
|
-
|
|
2146
|
-
if (aiAgentType) {
|
|
2147
|
-
return this.runAIAnalysis(
|
|
2148
|
-
aiAgentType,
|
|
2149
|
-
validFiles,
|
|
2150
|
-
agentInstance.name,
|
|
2151
|
-
agentInstance.description,
|
|
2152
|
-
depth,
|
|
2153
|
-
output
|
|
2154
|
-
);
|
|
2155
|
-
} else {
|
|
2156
|
-
return this.runStaticAnalysis(agentInstance, validFiles, startTime);
|
|
2157
|
-
}
|
|
2158
|
-
}
|
|
2159
|
-
async runAIAnalysis(agentType, files, agentName, agentDescription, depth, outputMode) {
|
|
2160
|
-
const startTime = Date.now();
|
|
2161
|
-
console.error(`
|
|
2162
|
-
\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501`);
|
|
2163
|
-
console.error(`\u{1F9E0} Running AI-POWERED ${agentName.toUpperCase()} analysis`);
|
|
2164
|
-
console.error(`\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501
|
|
2165
|
-
`);
|
|
2166
|
-
console.error(`\u{1F4C4} ${agentDescription}`);
|
|
2167
|
-
console.error(`\u{1F4C2} Analyzing ${files.length} files (${depth} depth)...
|
|
2168
|
-
`);
|
|
2169
|
-
try {
|
|
2170
|
-
const analysis = await buildAnalysis({
|
|
2171
|
-
agent: agentType,
|
|
2172
|
-
files,
|
|
2173
|
-
depth
|
|
2174
|
-
});
|
|
2175
|
-
const executionTime = Date.now() - startTime;
|
|
2176
|
-
const includePrompt = outputMode === "full";
|
|
2177
|
-
let output = formatAnalysisResponse(analysis, { includePrompt });
|
|
2178
|
-
if (analysis.suggestedFollowUps.length > 0) {
|
|
2179
|
-
output += this.generateKnowledgeSuggestions(analysis.suggestedFollowUps, agentType);
|
|
2180
|
-
}
|
|
2181
|
-
output += `
|
|
2182
|
-
*Analysis completed in ${(executionTime / 1e3).toFixed(2)}s*
|
|
2183
|
-
`;
|
|
2184
|
-
return {
|
|
2185
|
-
content: [{
|
|
2186
|
-
type: "text",
|
|
2187
|
-
text: output
|
|
2188
|
-
}]
|
|
2189
|
-
};
|
|
2190
|
-
} catch (error) {
|
|
2191
|
-
return {
|
|
2192
|
-
content: [{
|
|
2193
|
-
type: "text",
|
|
2194
|
-
text: `\u274C Analysis error: ${error instanceof Error ? error.message : String(error)}`
|
|
2195
|
-
}]
|
|
2196
|
-
};
|
|
2197
|
-
}
|
|
1881
|
+
return this.runAgentScan(agentInstance, validFiles, startTime, output);
|
|
2198
1882
|
}
|
|
2199
|
-
|
|
1883
|
+
/**
|
|
1884
|
+
* Run agent scan using the new hybrid AI system
|
|
1885
|
+
* All agents now use scan() which has pattern detection + optional AI enhancement
|
|
1886
|
+
*/
|
|
1887
|
+
async runAgentScan(agentInstance, files, startTime, _outputMode) {
|
|
2200
1888
|
console.error(`
|
|
2201
1889
|
\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501`);
|
|
2202
|
-
console.error(`\u{1F50D} Running ${agentInstance.name.toUpperCase()}
|
|
1890
|
+
console.error(`\u{1F50D} Running ${agentInstance.name.toUpperCase()} analysis`);
|
|
2203
1891
|
console.error(`\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501
|
|
2204
1892
|
`);
|
|
2205
1893
|
console.error(`\u{1F4C4} ${agentInstance.description}`);
|
|
2206
|
-
console.error(`\u{1F4C2} Scanning ${files.length} files
|
|
1894
|
+
console.error(`\u{1F4C2} Scanning ${files.length} files...`);
|
|
1895
|
+
console.error(` (Pattern detection + AI enhancement if API key is set)
|
|
2207
1896
|
`);
|
|
2208
1897
|
try {
|
|
2209
1898
|
const result = await agentInstance.scan(files, { workingDir: process.cwd() });
|
|
@@ -2211,7 +1900,7 @@ ${this.agentRegistry.getAgentNames().map((n) => `- ${n}`).join("\n")}`
|
|
|
2211
1900
|
return {
|
|
2212
1901
|
content: [{
|
|
2213
1902
|
type: "text",
|
|
2214
|
-
text: await this.
|
|
1903
|
+
text: await this.formatAgentResult(agentInstance.name, result.issues, files, executionTime)
|
|
2215
1904
|
}]
|
|
2216
1905
|
};
|
|
2217
1906
|
} catch (error) {
|
|
@@ -2223,7 +1912,7 @@ ${this.agentRegistry.getAgentNames().map((n) => `- ${n}`).join("\n")}`
|
|
|
2223
1912
|
};
|
|
2224
1913
|
}
|
|
2225
1914
|
}
|
|
2226
|
-
generateKnowledgeSuggestions(followUps,
|
|
1915
|
+
generateKnowledgeSuggestions(followUps, agentName) {
|
|
2227
1916
|
if (followUps.length === 0) {
|
|
2228
1917
|
return "";
|
|
2229
1918
|
}
|
|
@@ -2235,7 +1924,7 @@ ${this.agentRegistry.getAgentNames().map((n) => `- ${n}`).join("\n")}`
|
|
|
2235
1924
|
output += `- ${followUp}
|
|
2236
1925
|
`;
|
|
2237
1926
|
}
|
|
2238
|
-
if (
|
|
1927
|
+
if (agentName === "security") {
|
|
2239
1928
|
output += `- **CVE Check**: Run \`trie_security lookup:"cve" query:"[library-name]"\` to check for vulnerabilities
|
|
2240
1929
|
`;
|
|
2241
1930
|
}
|
|
@@ -2258,8 +1947,7 @@ ${this.agentRegistry.getAgentNames().map((n) => `- ${n}`).join("\n")}`
|
|
|
2258
1947
|
const agents = this.agentRegistry.getAgentDescriptions();
|
|
2259
1948
|
const agentList = agents.map((a) => {
|
|
2260
1949
|
const command = this.getAgentCommand(a.name);
|
|
2261
|
-
|
|
2262
|
-
return `| \`${command}\` | ${aiPowered} ${a.name} | ${a.description} |`;
|
|
1950
|
+
return `| \`${command}\` | \u{1F50D}\u{1F916} ${a.name} | ${a.description} |`;
|
|
2263
1951
|
}).join("\n");
|
|
2264
1952
|
return {
|
|
2265
1953
|
content: [{
|
|
@@ -2270,7 +1958,7 @@ ${this.agentRegistry.getAgentNames().map((n) => `- ${n}`).join("\n")}`
|
|
|
2270
1958
|
|---------|-------|-------------|
|
|
2271
1959
|
${agentList}
|
|
2272
1960
|
|
|
2273
|
-
**Legend:** \u{
|
|
1961
|
+
**Legend:** \u{1F50D}\u{1F916} = Pattern detection + AI enhancement (if ANTHROPIC_API_KEY is set)
|
|
2274
1962
|
|
|
2275
1963
|
## Usage
|
|
2276
1964
|
|
|
@@ -2322,7 +2010,7 @@ trie_scan # Full scan with smart triaging
|
|
|
2322
2010
|
};
|
|
2323
2011
|
return commandMap[agentName] || `trie_scan --agent ${agentName}`;
|
|
2324
2012
|
}
|
|
2325
|
-
async
|
|
2013
|
+
async formatAgentResult(agentName, issues, files, executionTime) {
|
|
2326
2014
|
const critical = issues.filter((i) => i.severity === "critical").length;
|
|
2327
2015
|
const serious = issues.filter((i) => i.severity === "serious").length;
|
|
2328
2016
|
const moderate = issues.filter((i) => i.severity === "moderate").length;
|
|
@@ -2393,7 +2081,7 @@ ${snippet}
|
|
|
2393
2081
|
|
|
2394
2082
|
`;
|
|
2395
2083
|
output += `\`\`\`
|
|
2396
|
-
Fix the ${issue.issue.toLowerCase()} in ${
|
|
2084
|
+
Fix the ${issue.issue.toLowerCase()} in ${basename3(issue.file)}${issue.line ? ` at line ${issue.line}` : ""}.
|
|
2397
2085
|
|
|
2398
2086
|
${issue.fix}
|
|
2399
2087
|
\`\`\`
|
|
@@ -2415,7 +2103,7 @@ ${issue.fix}
|
|
|
2415
2103
|
async getCodeSnippet(filePath, line) {
|
|
2416
2104
|
if (!line || !existsSync4(filePath)) return null;
|
|
2417
2105
|
try {
|
|
2418
|
-
const content = await
|
|
2106
|
+
const content = await readFile3(filePath, "utf-8");
|
|
2419
2107
|
const lines = content.split("\n");
|
|
2420
2108
|
const start = Math.max(0, line - 3);
|
|
2421
2109
|
const end = Math.min(lines.length, line + 2);
|
|
@@ -2459,7 +2147,7 @@ ${issue.fix}
|
|
|
2459
2147
|
await walk(fullPath);
|
|
2460
2148
|
}
|
|
2461
2149
|
} else if (entry.isFile()) {
|
|
2462
|
-
const ext =
|
|
2150
|
+
const ext = extname4(entry.name).toLowerCase();
|
|
2463
2151
|
if (SCANNABLE_EXTENSIONS.has(ext)) {
|
|
2464
2152
|
files.push(fullPath);
|
|
2465
2153
|
}
|
|
@@ -2476,7 +2164,7 @@ ${issue.fix}
|
|
|
2476
2164
|
// src/tools/create-agent.ts
|
|
2477
2165
|
import { existsSync as existsSync5 } from "fs";
|
|
2478
2166
|
import { mkdir, writeFile } from "fs/promises";
|
|
2479
|
-
import { join as join4, basename as
|
|
2167
|
+
import { join as join4, basename as basename4, extname as extname5 } from "path";
|
|
2480
2168
|
var TrieCreateAgentTool = class {
|
|
2481
2169
|
async execute(args) {
|
|
2482
2170
|
const { filePath, documentContent, agentName, displayName, description, category } = args;
|
|
@@ -2505,7 +2193,7 @@ Supported types: .pdf, .txt, .md, .rtf`
|
|
|
2505
2193
|
}
|
|
2506
2194
|
const document = await parseDocument(filePath);
|
|
2507
2195
|
rawText = document.rawText;
|
|
2508
|
-
title = document.metadata.title ||
|
|
2196
|
+
title = document.metadata.title || basename4(filePath, extname5(filePath));
|
|
2509
2197
|
wordCount = document.metadata.wordCount;
|
|
2510
2198
|
} else {
|
|
2511
2199
|
rawText = documentContent;
|
|
@@ -3033,9 +2721,9 @@ var TrieListAgentsTool = class {
|
|
|
3033
2721
|
};
|
|
3034
2722
|
|
|
3035
2723
|
// src/tools/pr-review.ts
|
|
3036
|
-
import { readFile as
|
|
2724
|
+
import { readFile as readFile4 } from "fs/promises";
|
|
3037
2725
|
import { existsSync as existsSync6 } from "fs";
|
|
3038
|
-
import { join as join5, basename as
|
|
2726
|
+
import { join as join5, basename as basename5, resolve as resolve4, isAbsolute as isAbsolute4 } from "path";
|
|
3039
2727
|
import { execSync } from "child_process";
|
|
3040
2728
|
var TriePRReviewTool = class {
|
|
3041
2729
|
agent = new SuperReviewerAgent();
|
|
@@ -3114,7 +2802,7 @@ Usage:
|
|
|
3114
2802
|
success: true,
|
|
3115
2803
|
type: "worktree",
|
|
3116
2804
|
path: worktreePath,
|
|
3117
|
-
title: `Local changes in ${
|
|
2805
|
+
title: `Local changes in ${basename5(worktreePath)}`,
|
|
3118
2806
|
author: this.getGitUser(),
|
|
3119
2807
|
baseBranch: "HEAD~1",
|
|
3120
2808
|
headBranch: "HEAD"
|
|
@@ -3272,7 +2960,7 @@ Usage:
|
|
|
3272
2960
|
try {
|
|
3273
2961
|
const fullPath = isAbsolute4(filePath) ? filePath : join5(cwd, filePath);
|
|
3274
2962
|
if (existsSync6(fullPath)) {
|
|
3275
|
-
const content = await
|
|
2963
|
+
const content = await readFile4(fullPath, "utf-8");
|
|
3276
2964
|
contents.set(filePath, content);
|
|
3277
2965
|
}
|
|
3278
2966
|
} catch {
|
|
@@ -3729,7 +3417,7 @@ function detectAITool() {
|
|
|
3729
3417
|
}
|
|
3730
3418
|
|
|
3731
3419
|
// src/config/loader.ts
|
|
3732
|
-
import { readFile as
|
|
3420
|
+
import { readFile as readFile5 } from "fs/promises";
|
|
3733
3421
|
import { join as join6 } from "path";
|
|
3734
3422
|
|
|
3735
3423
|
// src/config/defaults.ts
|
|
@@ -3786,7 +3474,7 @@ var DEFAULT_CONFIG = {
|
|
|
3786
3474
|
async function loadConfig() {
|
|
3787
3475
|
try {
|
|
3788
3476
|
const configPath = join6(process.cwd(), ".trie", "config.json");
|
|
3789
|
-
const configFile = await
|
|
3477
|
+
const configFile = await readFile5(configPath, "utf-8");
|
|
3790
3478
|
const userConfig = JSON.parse(configFile);
|
|
3791
3479
|
return mergeConfig(DEFAULT_CONFIG, userConfig);
|
|
3792
3480
|
} catch (error) {
|
|
@@ -4485,7 +4173,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
4485
4173
|
case "smith": {
|
|
4486
4174
|
const smithArgs = args;
|
|
4487
4175
|
if (smithArgs.clear_memory) {
|
|
4488
|
-
const { AgentSmithAgent } = await import("./agent-smith-
|
|
4176
|
+
const { AgentSmithAgent } = await import("./agent-smith-QYMYTLFV.js");
|
|
4489
4177
|
const smith = new AgentSmithAgent();
|
|
4490
4178
|
const result = await smith.clearMemory();
|
|
4491
4179
|
return {
|
|
@@ -4493,7 +4181,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
4493
4181
|
};
|
|
4494
4182
|
}
|
|
4495
4183
|
if (smithArgs.show_stats) {
|
|
4496
|
-
const { AgentSmithAgent } = await import("./agent-smith-
|
|
4184
|
+
const { AgentSmithAgent } = await import("./agent-smith-QYMYTLFV.js");
|
|
4497
4185
|
const smith = new AgentSmithAgent();
|
|
4498
4186
|
const stats = await smith.getMemoryStats();
|
|
4499
4187
|
return {
|
|
@@ -4513,7 +4201,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
4513
4201
|
}]
|
|
4514
4202
|
};
|
|
4515
4203
|
}
|
|
4516
|
-
const { runAgentSmith } = await import("./agent-smith-runner-
|
|
4204
|
+
const { runAgentSmith } = await import("./agent-smith-runner-3MIO4CWT.js");
|
|
4517
4205
|
return await runAgentSmith(smithArgs);
|
|
4518
4206
|
}
|
|
4519
4207
|
default:
|
|
@@ -4636,7 +4324,7 @@ async function readResourceContent(uri) {
|
|
|
4636
4324
|
if (parsedUri === "cache/stats") {
|
|
4637
4325
|
try {
|
|
4638
4326
|
const cachePath = join7(process.cwd(), ".trie", ".trie-cache.json");
|
|
4639
|
-
const cacheContent = await
|
|
4327
|
+
const cacheContent = await readFile6(cachePath, "utf-8");
|
|
4640
4328
|
const cache = JSON.parse(cacheContent);
|
|
4641
4329
|
const fileCount = Object.keys(cache.files || {}).length;
|
|
4642
4330
|
const totalVulns = Object.values(cache.files || {}).reduce((acc, file) => {
|
|
@@ -4690,7 +4378,7 @@ async function readResourceContent(uri) {
|
|
|
4690
4378
|
const fileName = parsedUri.replace("reports/", "");
|
|
4691
4379
|
const reportPath = join7(process.cwd(), "trie-reports", fileName);
|
|
4692
4380
|
try {
|
|
4693
|
-
const content = await
|
|
4381
|
+
const content = await readFile6(reportPath, "utf-8");
|
|
4694
4382
|
return {
|
|
4695
4383
|
contents: [{
|
|
4696
4384
|
uri,
|