@triedotdev/mcp 1.0.49 → 1.0.51
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/README.md +545 -406
- package/dist/agent-smith-BECRZH73.js +12 -0
- package/dist/{agent-smith-runner-ZTDCJJQG.js → agent-smith-runner-LZRXM2Q2.js} +7 -7
- package/dist/agent-smith-runner-LZRXM2Q2.js.map +1 -0
- package/dist/{chunk-KQOMSIVR.js → chunk-A43476GB.js} +13 -9
- package/dist/chunk-A43476GB.js.map +1 -0
- package/dist/{chunk-IMFD4SJC.js → chunk-ASGSTVVF.js} +1 -1
- package/dist/chunk-ASGSTVVF.js.map +1 -0
- package/dist/chunk-C3AS5OXW.js +1177 -0
- package/dist/chunk-C3AS5OXW.js.map +1 -0
- package/dist/chunk-IEFAQFDQ.js +2061 -0
- package/dist/chunk-IEFAQFDQ.js.map +1 -0
- package/dist/{chunk-GLC62PGD.js → chunk-KB5ZN6K2.js} +2 -2
- package/dist/{chunk-VZYCZXEQ.js → chunk-TOE75CFZ.js} +2034 -391
- package/dist/chunk-TOE75CFZ.js.map +1 -0
- package/dist/{chunk-JDICQHNT.js → chunk-YKUCIKTU.js} +171 -1245
- package/dist/chunk-YKUCIKTU.js.map +1 -0
- package/dist/cli/create-agent.js +2 -2
- package/dist/cli/main.js +428 -71
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/yolo-daemon.js +32 -20
- package/dist/cli/yolo-daemon.js.map +1 -1
- package/dist/comprehension-46F7ZNKL.js +821 -0
- package/dist/comprehension-46F7ZNKL.js.map +1 -0
- package/dist/index.js +478 -122
- package/dist/index.js.map +1 -1
- package/dist/workers/agent-worker.js +11 -11
- package/dist/workers/agent-worker.js.map +1 -1
- package/package.json +3 -1
- package/dist/agent-smith-5QOZXLMV.js +0 -11
- package/dist/agent-smith-runner-ZTDCJJQG.js.map +0 -1
- package/dist/chunk-6T7S77U7.js +0 -852
- package/dist/chunk-6T7S77U7.js.map +0 -1
- package/dist/chunk-IMFD4SJC.js.map +0 -1
- package/dist/chunk-JDICQHNT.js.map +0 -1
- package/dist/chunk-KQOMSIVR.js.map +0 -1
- package/dist/chunk-PZDQIFKO.js +0 -1598
- package/dist/chunk-PZDQIFKO.js.map +0 -1
- package/dist/chunk-VZYCZXEQ.js.map +0 -1
- /package/dist/{agent-smith-5QOZXLMV.js.map → agent-smith-BECRZH73.js.map} +0 -0
- /package/dist/{chunk-GLC62PGD.js.map → chunk-KB5ZN6K2.js.map} +0 -0
package/dist/cli/create-agent.js
CHANGED
package/dist/cli/main.js
CHANGED
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
|
+
ContextGraph,
|
|
4
|
+
IncidentIndex,
|
|
5
|
+
MissingAPIKeyError,
|
|
3
6
|
SKILL_CATEGORIES,
|
|
7
|
+
TrieFeedbackTool,
|
|
4
8
|
completeBootstrap,
|
|
9
|
+
exportToJson,
|
|
10
|
+
formatFriendlyError,
|
|
5
11
|
getSkillCategories,
|
|
6
12
|
getSkillsByCategory,
|
|
7
13
|
handleCheckpointCommand,
|
|
14
|
+
importFromJson,
|
|
8
15
|
initializeBootstrapFiles,
|
|
9
|
-
needsBootstrap
|
|
10
|
-
|
|
16
|
+
needsBootstrap,
|
|
17
|
+
perceiveCurrentChanges,
|
|
18
|
+
reasonAboutChangesHumanReadable
|
|
19
|
+
} from "../chunk-IEFAQFDQ.js";
|
|
20
|
+
import "../chunk-C3AS5OXW.js";
|
|
11
21
|
import {
|
|
12
22
|
findCrossProjectPatterns,
|
|
13
23
|
getDailyLogs,
|
|
@@ -27,10 +37,13 @@ import {
|
|
|
27
37
|
searchGlobalPatterns,
|
|
28
38
|
searchIssues,
|
|
29
39
|
updateGlobalMemoryMd
|
|
30
|
-
} from "../chunk-
|
|
40
|
+
} from "../chunk-TOE75CFZ.js";
|
|
41
|
+
import "../chunk-3CS6Z2SL.js";
|
|
42
|
+
import "../chunk-A43476GB.js";
|
|
31
43
|
import {
|
|
32
44
|
getWorkingDirectory
|
|
33
|
-
} from "../chunk-
|
|
45
|
+
} from "../chunk-ASGSTVVF.js";
|
|
46
|
+
import "../chunk-6NLHFIYA.js";
|
|
34
47
|
import {
|
|
35
48
|
__require
|
|
36
49
|
} from "../chunk-DGUM43GV.js";
|
|
@@ -228,32 +241,120 @@ Browse all skills: https://skills.sh
|
|
|
228
241
|
}
|
|
229
242
|
}
|
|
230
243
|
|
|
244
|
+
// src/hooks/install.ts
|
|
245
|
+
import fs from "fs";
|
|
246
|
+
import path from "path";
|
|
247
|
+
|
|
248
|
+
// src/hooks/templates.ts
|
|
249
|
+
var PATH_FIX = 'export PATH="/usr/local/bin:/opt/homebrew/bin:$PATH"\n';
|
|
250
|
+
function hookHeader() {
|
|
251
|
+
return "#!/bin/sh\n" + PATH_FIX + "\n";
|
|
252
|
+
}
|
|
253
|
+
function trieCommand(name) {
|
|
254
|
+
return `
|
|
255
|
+
TRIE_BIN="$(command -v trie || command -v trie-agent || true)"
|
|
256
|
+
if [ -n "$TRIE_BIN" ]; then
|
|
257
|
+
"$TRIE_BIN" ${name} || true
|
|
258
|
+
else
|
|
259
|
+
echo "Trie not available; skipping ${name} hook."
|
|
260
|
+
fi
|
|
261
|
+
`;
|
|
262
|
+
}
|
|
263
|
+
function preCommitTemplate() {
|
|
264
|
+
return (hookHeader() + "# Trie pre-commit hook\n" + trieCommand("pre-commit")).trim() + "\n";
|
|
265
|
+
}
|
|
266
|
+
function postCommitTemplate() {
|
|
267
|
+
return (hookHeader() + "# Trie post-commit hook\n" + trieCommand("post-commit")).trim() + "\n";
|
|
268
|
+
}
|
|
269
|
+
function prePushTemplate() {
|
|
270
|
+
return (hookHeader() + "# Trie pre-push hook\n" + trieCommand("check --quick")).trim() + "\n";
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
// src/hooks/install.ts
|
|
274
|
+
var HOOK_BUILDERS = {
|
|
275
|
+
"pre-commit": preCommitTemplate,
|
|
276
|
+
"post-commit": postCommitTemplate,
|
|
277
|
+
"pre-push": prePushTemplate
|
|
278
|
+
};
|
|
279
|
+
function hookPath(repoPath, name) {
|
|
280
|
+
return path.join(repoPath, ".git", "hooks", name);
|
|
281
|
+
}
|
|
282
|
+
function ensureHookDir(repoPath) {
|
|
283
|
+
const dir = path.join(repoPath, ".git", "hooks");
|
|
284
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
285
|
+
}
|
|
286
|
+
function appendHookFile(targetPath, content) {
|
|
287
|
+
if (fs.existsSync(targetPath)) {
|
|
288
|
+
const existing = fs.readFileSync(targetPath, "utf8");
|
|
289
|
+
if (existing.includes("# Trie pre-commit hook") || existing.includes("# Trie post-commit hook")) {
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
fs.appendFileSync(targetPath, `
|
|
293
|
+
# --- Added by Trie ---
|
|
294
|
+
${content}`);
|
|
295
|
+
} else {
|
|
296
|
+
fs.writeFileSync(targetPath, content, { mode: 493 });
|
|
297
|
+
}
|
|
298
|
+
fs.chmodSync(targetPath, 493);
|
|
299
|
+
}
|
|
300
|
+
function installGitHooks(projectPath) {
|
|
301
|
+
const gitDir = path.join(projectPath, ".git");
|
|
302
|
+
if (!fs.existsSync(gitDir)) {
|
|
303
|
+
return [];
|
|
304
|
+
}
|
|
305
|
+
ensureHookDir(projectPath);
|
|
306
|
+
const installed = [];
|
|
307
|
+
Object.keys(HOOK_BUILDERS).forEach((name) => {
|
|
308
|
+
const content = HOOK_BUILDERS[name]();
|
|
309
|
+
const target = hookPath(projectPath, name);
|
|
310
|
+
appendHookFile(target, content);
|
|
311
|
+
installed.push(name);
|
|
312
|
+
});
|
|
313
|
+
return installed;
|
|
314
|
+
}
|
|
315
|
+
|
|
231
316
|
// src/cli/init.ts
|
|
317
|
+
import fs2 from "fs";
|
|
318
|
+
import path2 from "path";
|
|
319
|
+
function ensureGitignore(workDir) {
|
|
320
|
+
const target = path2.join(workDir, ".gitignore");
|
|
321
|
+
const entries = [".trie/context.db", ".trie/context.json", ".trie/*.db", "trie-reports/"];
|
|
322
|
+
let content = "";
|
|
323
|
+
if (fs2.existsSync(target)) {
|
|
324
|
+
content = fs2.readFileSync(target, "utf8");
|
|
325
|
+
}
|
|
326
|
+
const missing = entries.filter((e) => !content.includes(e));
|
|
327
|
+
if (missing.length > 0) {
|
|
328
|
+
const updated = content.trimEnd() + "\n" + missing.join("\n") + "\n";
|
|
329
|
+
fs2.writeFileSync(target, updated);
|
|
330
|
+
}
|
|
331
|
+
}
|
|
232
332
|
async function handleInitCommand(args) {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
333
|
+
try {
|
|
334
|
+
const subcommand = args[0]?.toLowerCase();
|
|
335
|
+
const workDir = getWorkingDirectory(void 0, true);
|
|
336
|
+
if (subcommand === "complete") {
|
|
337
|
+
const result2 = await completeBootstrap(workDir);
|
|
338
|
+
if (result2) {
|
|
339
|
+
console.log("Bootstrap completed. BOOTSTRAP.md has been deleted.");
|
|
340
|
+
} else {
|
|
341
|
+
console.log("No BOOTSTRAP.md file found.");
|
|
342
|
+
}
|
|
343
|
+
return;
|
|
241
344
|
}
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
345
|
+
if (subcommand === "status") {
|
|
346
|
+
const needs = needsBootstrap(workDir);
|
|
347
|
+
if (needs) {
|
|
348
|
+
console.log("Bootstrap pending: .trie/BOOTSTRAP.md exists");
|
|
349
|
+
console.log('Run "trie init complete" after finishing setup.');
|
|
350
|
+
} else {
|
|
351
|
+
console.log("Bootstrap complete: No pending setup.");
|
|
352
|
+
}
|
|
353
|
+
return;
|
|
251
354
|
}
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
const skipBootstrap = args.includes("--skip-bootstrap");
|
|
256
|
-
console.log(`
|
|
355
|
+
const force = args.includes("--force") || args.includes("-f");
|
|
356
|
+
const skipBootstrap = args.includes("--skip-bootstrap");
|
|
357
|
+
console.log(`
|
|
257
358
|
\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557
|
|
258
359
|
\u2551 \u2551
|
|
259
360
|
\u2551 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2551
|
|
@@ -273,54 +374,73 @@ async function handleInitCommand(args) {
|
|
|
273
374
|
Follow me on X: https://x.com/louiskishfy
|
|
274
375
|
|
|
275
376
|
`);
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
377
|
+
const result = await initializeBootstrapFiles({
|
|
378
|
+
workDir,
|
|
379
|
+
force,
|
|
380
|
+
skipBootstrap
|
|
381
|
+
});
|
|
382
|
+
if (result.created.length > 0) {
|
|
383
|
+
console.log("Created files:");
|
|
384
|
+
for (const file of result.created) {
|
|
385
|
+
console.log(` + .trie/${file}`);
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
if (result.skipped.length > 0 && !force) {
|
|
389
|
+
console.log("\nSkipped (already exist):");
|
|
390
|
+
for (const file of result.skipped) {
|
|
391
|
+
console.log(` - .trie/${file}`);
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
console.log("\nDetected Stack:");
|
|
395
|
+
if (result.stack.framework) console.log(` Framework: ${result.stack.framework}`);
|
|
396
|
+
if (result.stack.language) console.log(` Language: ${result.stack.language}`);
|
|
397
|
+
if (result.stack.database) console.log(` Database: ${result.stack.database}`);
|
|
398
|
+
if (result.stack.auth) console.log(` Auth: ${result.stack.auth}`);
|
|
399
|
+
if (result.stack.packageManager) console.log(` Package Manager: ${result.stack.packageManager}`);
|
|
400
|
+
if (result.stack.suggestedSkills.length > 0) {
|
|
401
|
+
const topSkills = result.stack.suggestedSkills.slice(0, 5);
|
|
402
|
+
console.log("\nSuggested Skills (based on your stack):");
|
|
403
|
+
for (const skill of topSkills) {
|
|
404
|
+
console.log(` trie skills add ${skill}`);
|
|
405
|
+
}
|
|
406
|
+
if (result.stack.suggestedSkills.length > 5) {
|
|
407
|
+
console.log(` ... and ${result.stack.suggestedSkills.length - 5} more (run "trie init" again to see all)`);
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
const categories = getSkillCategories();
|
|
411
|
+
const topCategories = categories.slice(0, 5);
|
|
412
|
+
console.log("\nExplore skill categories:");
|
|
413
|
+
for (const cat of topCategories) {
|
|
414
|
+
console.log(` trie skills list ${cat.name.padEnd(15)} # ${cat.count} skills`);
|
|
415
|
+
}
|
|
416
|
+
console.log(` trie skills list categories # see all ${categories.length} categories`);
|
|
417
|
+
console.log("\nBrowse all skills: https://skills.sh");
|
|
418
|
+
console.log(`
|
|
318
419
|
Next Steps:
|
|
319
420
|
1. Edit .trie/PROJECT.md with your project description
|
|
320
421
|
2. Define coding standards in .trie/RULES.md
|
|
321
422
|
3. Run "trie scan" to analyze your codebase
|
|
322
423
|
4. Run "trie init complete" when setup is done
|
|
323
424
|
`);
|
|
425
|
+
const hooks = installGitHooks(workDir);
|
|
426
|
+
if (hooks.length > 0) {
|
|
427
|
+
console.log("\nGit hooks installed:");
|
|
428
|
+
for (const hook of hooks) {
|
|
429
|
+
console.log(` .git/hooks/${hook}`);
|
|
430
|
+
}
|
|
431
|
+
} else {
|
|
432
|
+
console.log("\nGit hooks not installed (no .git directory found).");
|
|
433
|
+
}
|
|
434
|
+
ensureGitignore(workDir);
|
|
435
|
+
if (!process.env.ANTHROPIC_API_KEY) {
|
|
436
|
+
const msg = new MissingAPIKeyError().userMessage;
|
|
437
|
+
console.log(`
|
|
438
|
+
Warning: ${msg}`);
|
|
439
|
+
}
|
|
440
|
+
} catch (error) {
|
|
441
|
+
const friendly = formatFriendlyError(error);
|
|
442
|
+
console.error(friendly.userMessage);
|
|
443
|
+
}
|
|
324
444
|
}
|
|
325
445
|
|
|
326
446
|
// src/cli/memory.ts
|
|
@@ -535,6 +655,203 @@ Examples:
|
|
|
535
655
|
`);
|
|
536
656
|
}
|
|
537
657
|
|
|
658
|
+
// src/cli/check.ts
|
|
659
|
+
function parseArgs(args) {
|
|
660
|
+
let mode = "full";
|
|
661
|
+
const filesFlag = args.find((a) => a.startsWith("--files="));
|
|
662
|
+
const parsedFiles = filesFlag ? filesFlag.replace("--files=", "").split(",").map((f) => f.trim()).filter(Boolean) : [];
|
|
663
|
+
if (args.includes("--quick") || args.includes("-q")) mode = "quick";
|
|
664
|
+
if (args.includes("--offline")) mode = "offline";
|
|
665
|
+
if (args.includes("--full")) mode = "full";
|
|
666
|
+
const result = { mode };
|
|
667
|
+
if (parsedFiles.length > 0) result.files = parsedFiles;
|
|
668
|
+
return result;
|
|
669
|
+
}
|
|
670
|
+
function printResult(result) {
|
|
671
|
+
console.log(`
|
|
672
|
+
Risk: ${result.original.riskLevel.toUpperCase()} (${result.original.shouldBlock ? "block" : "allow"})`);
|
|
673
|
+
console.log(`Explanation: ${result.original.explanation}`);
|
|
674
|
+
console.log(`Recommendation: ${result.original.recommendation}`);
|
|
675
|
+
if (result.original.files?.length) {
|
|
676
|
+
console.log("\nHigh-risk files:");
|
|
677
|
+
for (const file of result.original.files.filter((f) => ["high", "critical"].includes(f.level))) {
|
|
678
|
+
console.log(` - ${file.file}: ${file.reasons.join("; ")}`);
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
console.log("\nPlain-English summary:");
|
|
682
|
+
console.log(` Summary: ${result.summary}`);
|
|
683
|
+
console.log(` What I found: ${result.whatIFound}`);
|
|
684
|
+
console.log(` How bad: ${result.howBad}`);
|
|
685
|
+
console.log(` What to do: ${result.whatToDo}`);
|
|
686
|
+
}
|
|
687
|
+
async function handleCheckCommand(args) {
|
|
688
|
+
try {
|
|
689
|
+
const options = parseArgs(args);
|
|
690
|
+
const projectPath = getWorkingDirectory(void 0, true);
|
|
691
|
+
let files = options.files;
|
|
692
|
+
if (!files || files.length === 0) {
|
|
693
|
+
const perception = await perceiveCurrentChanges(projectPath);
|
|
694
|
+
files = perception.diffSummary.files.map((f) => f.filePath);
|
|
695
|
+
if (files.length === 0) {
|
|
696
|
+
console.log("No changes detected. Provide files with --files=path1,path2 or make a change first.");
|
|
697
|
+
return;
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
const runAgents = options.mode === "full";
|
|
701
|
+
const reasoning = await reasonAboutChangesHumanReadable(projectPath, files, {
|
|
702
|
+
runAgents,
|
|
703
|
+
scanContext: {
|
|
704
|
+
config: { timeoutMs: options.mode === "quick" ? 15e3 : 6e4 }
|
|
705
|
+
}
|
|
706
|
+
});
|
|
707
|
+
printResult(reasoning);
|
|
708
|
+
} catch (error) {
|
|
709
|
+
const friendly = formatFriendlyError(error);
|
|
710
|
+
console.error(friendly.userMessage);
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
// src/cli/tell.ts
|
|
715
|
+
import path3 from "path";
|
|
716
|
+
function escalateRisk(level) {
|
|
717
|
+
if (level === "low") return "medium";
|
|
718
|
+
if (level === "medium") return "high";
|
|
719
|
+
if (level === "high") return "critical";
|
|
720
|
+
return "critical";
|
|
721
|
+
}
|
|
722
|
+
function extractFilePathsFromDescription(description) {
|
|
723
|
+
const matches = description.match(/[\\w./_-]+\\.(ts|tsx|js|jsx|mjs|cjs)/gi);
|
|
724
|
+
if (!matches) return [];
|
|
725
|
+
const unique = /* @__PURE__ */ new Set();
|
|
726
|
+
matches.forEach((m) => unique.add(m.replace(/^\.\/+/, "")));
|
|
727
|
+
return Array.from(unique);
|
|
728
|
+
}
|
|
729
|
+
async function handleTellCommand(args) {
|
|
730
|
+
try {
|
|
731
|
+
const projectPath = getWorkingDirectory(void 0, true);
|
|
732
|
+
const description = args.join(" ").trim();
|
|
733
|
+
if (!description) {
|
|
734
|
+
console.log('Usage: trie tell "<incident description>"');
|
|
735
|
+
return;
|
|
736
|
+
}
|
|
737
|
+
const graph = new ContextGraph(projectPath);
|
|
738
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
739
|
+
const change = (await graph.getRecentChanges(1))[0];
|
|
740
|
+
const incident = await graph.addNode("incident", {
|
|
741
|
+
description,
|
|
742
|
+
severity: "major",
|
|
743
|
+
affectedUsers: null,
|
|
744
|
+
duration: null,
|
|
745
|
+
timestamp: now,
|
|
746
|
+
resolved: false,
|
|
747
|
+
resolution: null,
|
|
748
|
+
fixChangeId: change?.id ?? null,
|
|
749
|
+
reportedVia: "manual"
|
|
750
|
+
});
|
|
751
|
+
const linkedFiles = /* @__PURE__ */ new Set();
|
|
752
|
+
if (change) {
|
|
753
|
+
await graph.addEdge(change.id, incident.id, "leadTo");
|
|
754
|
+
await graph.addEdge(incident.id, change.id, "causedBy");
|
|
755
|
+
for (const filePath of change.data.files) {
|
|
756
|
+
linkedFiles.add(filePath);
|
|
757
|
+
const fileNode = await graph.getNode("file", path3.resolve(projectPath, filePath));
|
|
758
|
+
if (fileNode) {
|
|
759
|
+
const data = fileNode.data;
|
|
760
|
+
await graph.updateNode("file", fileNode.id, {
|
|
761
|
+
incidentCount: (data.incidentCount ?? 0) + 1,
|
|
762
|
+
riskLevel: escalateRisk(data.riskLevel)
|
|
763
|
+
});
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
const mentionedFiles = extractFilePathsFromDescription(description);
|
|
768
|
+
mentionedFiles.forEach((f) => linkedFiles.add(f));
|
|
769
|
+
const incidentIndex = new IncidentIndex(graph, projectPath);
|
|
770
|
+
incidentIndex.addIncidentToTrie(incident, Array.from(linkedFiles));
|
|
771
|
+
await exportToJson(graph);
|
|
772
|
+
console.log("Incident recorded.");
|
|
773
|
+
if (change) {
|
|
774
|
+
console.log(`Linked to change: ${change.id}`);
|
|
775
|
+
} else {
|
|
776
|
+
console.log("No recent change found; incident recorded without linkage.");
|
|
777
|
+
}
|
|
778
|
+
} catch (error) {
|
|
779
|
+
const friendly = formatFriendlyError(error);
|
|
780
|
+
console.error(friendly.userMessage);
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
// src/cli/reconcile.ts
|
|
785
|
+
import path4 from "path";
|
|
786
|
+
async function removeOrphanEdges(graph) {
|
|
787
|
+
const nodes = await graph.listNodes();
|
|
788
|
+
const nodeIds = new Set(nodes.map((n) => n.id));
|
|
789
|
+
const edges = await graph.listEdges();
|
|
790
|
+
let removed = 0;
|
|
791
|
+
for (const edge of edges) {
|
|
792
|
+
if (!nodeIds.has(edge.from_id) || !nodeIds.has(edge.to_id)) {
|
|
793
|
+
await graph.deleteEdge(edge.id);
|
|
794
|
+
removed++;
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
return removed;
|
|
798
|
+
}
|
|
799
|
+
async function handleReconcileCommand(args) {
|
|
800
|
+
try {
|
|
801
|
+
const projectPath = getWorkingDirectory(void 0, true);
|
|
802
|
+
const source = args.find((a) => a.startsWith("--from="))?.replace("--from=", "") ?? path4.join(projectPath, ".trie", "context.json");
|
|
803
|
+
const graph = new ContextGraph(projectPath);
|
|
804
|
+
await importFromJson(graph, "", source);
|
|
805
|
+
const removed = await removeOrphanEdges(graph);
|
|
806
|
+
console.log(`Reconciled context from ${source}. Removed ${removed} orphaned edges.`);
|
|
807
|
+
} catch (error) {
|
|
808
|
+
const friendly = formatFriendlyError(error);
|
|
809
|
+
console.error(friendly.userMessage);
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
// src/cli/ok.ts
|
|
814
|
+
async function handleOkCommand(args) {
|
|
815
|
+
const helpful = true;
|
|
816
|
+
const noteText = args.join(" ").trim();
|
|
817
|
+
const tool = new TrieFeedbackTool();
|
|
818
|
+
const input = noteText ? { helpful, note: noteText } : { helpful };
|
|
819
|
+
const result = await tool.execute(input);
|
|
820
|
+
if (result?.content?.[0]?.text) {
|
|
821
|
+
console.log(result.content[0].text);
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
// src/cli/bad.ts
|
|
826
|
+
async function handleBadCommand(args) {
|
|
827
|
+
const helpful = false;
|
|
828
|
+
const noteText = args.join(" ").trim();
|
|
829
|
+
const tool = new TrieFeedbackTool();
|
|
830
|
+
const input = noteText ? { helpful, note: noteText } : { helpful };
|
|
831
|
+
const result = await tool.execute(input);
|
|
832
|
+
if (result?.content?.[0]?.text) {
|
|
833
|
+
console.log(result.content[0].text);
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
// src/cli/quiet.ts
|
|
838
|
+
import fs3 from "fs";
|
|
839
|
+
import path5 from "path";
|
|
840
|
+
async function handleQuietCommand() {
|
|
841
|
+
const projectPath = getWorkingDirectory(void 0, true);
|
|
842
|
+
const quietPath = path5.join(projectPath, ".trie", "quiet.json");
|
|
843
|
+
const until = new Date(Date.now() + 60 * 60 * 1e3).toISOString();
|
|
844
|
+
const payload = { until };
|
|
845
|
+
try {
|
|
846
|
+
const dir = path5.dirname(quietPath);
|
|
847
|
+
fs3.mkdirSync(dir, { recursive: true });
|
|
848
|
+
fs3.writeFileSync(quietPath, JSON.stringify(payload, null, 2));
|
|
849
|
+
console.log("\u{1F515} Nudges snoozed for 1 hour.");
|
|
850
|
+
} catch (error) {
|
|
851
|
+
console.error("Failed to set quiet mode:", error);
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
|
|
538
855
|
// src/cli/main.ts
|
|
539
856
|
var __filename2 = fileURLToPath(import.meta.url);
|
|
540
857
|
var __dirname2 = dirname(__filename2);
|
|
@@ -574,6 +891,8 @@ COMMANDS:
|
|
|
574
891
|
skills Manage external skills from skills.sh
|
|
575
892
|
project View/manage project info (.trie/PROJECT.md)
|
|
576
893
|
memory Search and manage issue memory
|
|
894
|
+
agent-smith Run Agent Smith (35 vibe code hunters)
|
|
895
|
+
super-reviewer Run interactive PR review
|
|
577
896
|
version Show version information
|
|
578
897
|
|
|
579
898
|
EXAMPLES:
|
|
@@ -610,6 +929,12 @@ EXAMPLES:
|
|
|
610
929
|
# Search issue memory
|
|
611
930
|
trie-agent memory search "SQL injection"
|
|
612
931
|
|
|
932
|
+
# Run Agent Smith (vibe code hunter)
|
|
933
|
+
trie-agent agent-smith
|
|
934
|
+
|
|
935
|
+
# Run interactive PR review
|
|
936
|
+
trie-agent super-reviewer
|
|
937
|
+
|
|
613
938
|
MCP TOOLS (use via Cursor/Claude Desktop):
|
|
614
939
|
trie_scan Intelligent scan with agent selection
|
|
615
940
|
trie_fix Generate high-confidence fix prompts
|
|
@@ -628,14 +953,15 @@ MCP TOOLS (use via Cursor/Claude Desktop):
|
|
|
628
953
|
trie_types TypeScript type safety
|
|
629
954
|
trie_devops DevOps & deployment
|
|
630
955
|
trie_clean Clean up AI-generated code
|
|
956
|
+
|
|
957
|
+
Special Agents:
|
|
958
|
+
trie_agent_smith 35 vibe code hunters, cross-file detection
|
|
959
|
+
trie_super_reviewer Interactive PR review with cross-examination
|
|
631
960
|
|
|
632
961
|
Custom Skills:
|
|
633
962
|
trie_create_skill Create skill from PDF/TXT/MD document
|
|
634
963
|
trie_list_skills List all registered skills
|
|
635
964
|
|
|
636
|
-
NOTE: No API key required! Trie uses your AI tool's built-in Claude.
|
|
637
|
-
|
|
638
|
-
For more info: https://github.com/Trie-OS/Trie-Agent
|
|
639
965
|
`);
|
|
640
966
|
}
|
|
641
967
|
function showSetup() {
|
|
@@ -918,6 +1244,37 @@ function main() {
|
|
|
918
1244
|
case "watch":
|
|
919
1245
|
runWatch(restArgs);
|
|
920
1246
|
break;
|
|
1247
|
+
case "check":
|
|
1248
|
+
handleCheckCommand(restArgs);
|
|
1249
|
+
break;
|
|
1250
|
+
case "tell":
|
|
1251
|
+
handleTellCommand(restArgs);
|
|
1252
|
+
break;
|
|
1253
|
+
case "reconcile":
|
|
1254
|
+
handleReconcileCommand(restArgs);
|
|
1255
|
+
break;
|
|
1256
|
+
case "ok":
|
|
1257
|
+
case "thumbs-up":
|
|
1258
|
+
handleOkCommand(restArgs);
|
|
1259
|
+
break;
|
|
1260
|
+
case "bad":
|
|
1261
|
+
case "thumbs-down":
|
|
1262
|
+
handleBadCommand(restArgs);
|
|
1263
|
+
break;
|
|
1264
|
+
case "quiet":
|
|
1265
|
+
case "snooze":
|
|
1266
|
+
handleQuietCommand();
|
|
1267
|
+
break;
|
|
1268
|
+
case "agent-smith":
|
|
1269
|
+
case "smith":
|
|
1270
|
+
case "trie_agent_smith":
|
|
1271
|
+
runScan(["--agents", "agent-smith", ...restArgs]);
|
|
1272
|
+
break;
|
|
1273
|
+
case "super-reviewer":
|
|
1274
|
+
case "reviewer":
|
|
1275
|
+
case "trie_super_reviewer":
|
|
1276
|
+
runScan(["--agents", "super-reviewer", ...restArgs]);
|
|
1277
|
+
break;
|
|
921
1278
|
default:
|
|
922
1279
|
if (command.startsWith("-")) {
|
|
923
1280
|
const { spawn } = __require("child_process");
|