@triedotdev/mcp 1.0.93 → 1.0.97
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 +145 -137
- package/dist/chunk-APMV77PU.js +313 -0
- package/dist/chunk-APMV77PU.js.map +1 -0
- package/dist/{chunk-MZI46HQT.js → chunk-B3MNN3XB.js} +13 -18
- package/dist/{chunk-MZI46HQT.js.map → chunk-B3MNN3XB.js.map} +1 -1
- package/dist/{chunk-5Z7O66DE.js → chunk-F4NJ4CBP.js} +2 -2
- package/dist/{chunk-YTJXD664.js → chunk-FNCCZ3XB.js} +1222 -75
- package/dist/chunk-FNCCZ3XB.js.map +1 -0
- package/dist/chunk-G76DYVGX.js +136 -0
- package/dist/chunk-G76DYVGX.js.map +1 -0
- package/dist/chunk-HSNE46VE.js +956 -0
- package/dist/chunk-HSNE46VE.js.map +1 -0
- package/dist/{chunk-LVVG2DMW.js → chunk-IXO4G4D3.js} +2 -2
- package/dist/{chunk-LP4MVJDW.js → chunk-JDHR5BDR.js} +2 -3
- package/dist/chunk-NIASHOAB.js +1304 -0
- package/dist/chunk-NIASHOAB.js.map +1 -0
- package/dist/{chunk-NMGINYYX.js → chunk-OVRG5RP3.js} +6 -7
- package/dist/chunk-OVRG5RP3.js.map +1 -0
- package/dist/{chunk-T5UOH56R.js → chunk-R3I2GCZC.js} +3 -3
- package/dist/{chunk-RDOJCRKJ.js → chunk-R4AAPFXC.js} +2 -2
- package/dist/{chunk-R6AUYN3R.js → chunk-SLL2MDJD.js} +786 -4668
- package/dist/chunk-SLL2MDJD.js.map +1 -0
- package/dist/cli/create-agent.js +931 -7
- package/dist/cli/create-agent.js.map +1 -1
- package/dist/cli/main.js +151 -383
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/yolo-daemon.js +13 -20
- package/dist/cli/yolo-daemon.js.map +1 -1
- package/dist/{goal-manager-ESJCJXFS.js → goal-manager-LAOT4QQX.js} +6 -6
- package/dist/guardian-agent-M352CBE5.js +19 -0
- package/dist/index.js +1025 -1550
- package/dist/index.js.map +1 -1
- package/dist/{issue-store-JZ2LCQEG.js → issue-store-W2X33X2X.js} +4 -4
- package/dist/{progress-PH6NNWZM.js → progress-PQVEM7BR.js} +2 -2
- package/dist/{vibe-code-signatures-K4UIWKJZ.js → vibe-code-signatures-ELEWJFGZ.js} +3 -3
- package/dist/{vulnerability-signatures-ZKVLMBRG.js → vulnerability-signatures-EIJQX2TS.js} +3 -3
- package/dist/workers/agent-worker.js +2 -11
- package/dist/workers/agent-worker.js.map +1 -1
- package/package.json +2 -2
- package/dist/agent-smith-QYDXPFPJ.js +0 -14
- package/dist/agent-smith-runner-GXGDJTSR.js +0 -573
- package/dist/agent-smith-runner-GXGDJTSR.js.map +0 -1
- package/dist/cache-manager-7SKX3IGO.js +0 -10
- package/dist/chunk-74NPKTZV.js +0 -141
- package/dist/chunk-74NPKTZV.js.map +0 -1
- package/dist/chunk-BG2BHWCC.js +0 -10879
- package/dist/chunk-BG2BHWCC.js.map +0 -1
- package/dist/chunk-CUXXRM3T.js +0 -2124
- package/dist/chunk-CUXXRM3T.js.map +0 -1
- package/dist/chunk-D25EIBPO.js +0 -183
- package/dist/chunk-D25EIBPO.js.map +0 -1
- package/dist/chunk-F55XBLIA.js +0 -536
- package/dist/chunk-F55XBLIA.js.map +0 -1
- package/dist/chunk-HFQ5ORON.js +0 -279
- package/dist/chunk-HFQ5ORON.js.map +0 -1
- package/dist/chunk-IOUOVBJZ.js +0 -175
- package/dist/chunk-IOUOVBJZ.js.map +0 -1
- package/dist/chunk-KWDNYWOR.js +0 -2270
- package/dist/chunk-KWDNYWOR.js.map +0 -1
- package/dist/chunk-LT7MKIXU.js +0 -266
- package/dist/chunk-LT7MKIXU.js.map +0 -1
- package/dist/chunk-MURGTWG4.js +0 -279
- package/dist/chunk-MURGTWG4.js.map +0 -1
- package/dist/chunk-NMGINYYX.js.map +0 -1
- package/dist/chunk-R6AUYN3R.js.map +0 -1
- package/dist/chunk-SJFJ6GLR.js +0 -955
- package/dist/chunk-SJFJ6GLR.js.map +0 -1
- package/dist/chunk-YTJXD664.js.map +0 -1
- package/dist/git-PZV3BBYI.js +0 -29
- package/dist/guardian-agent-ZHJXLBOU.js +0 -21
- package/dist/progress-PH6NNWZM.js.map +0 -1
- package/dist/vibe-code-signatures-K4UIWKJZ.js.map +0 -1
- package/dist/vulnerability-signatures-ZKVLMBRG.js.map +0 -1
- /package/dist/{chunk-5Z7O66DE.js.map → chunk-F4NJ4CBP.js.map} +0 -0
- /package/dist/{chunk-LVVG2DMW.js.map → chunk-IXO4G4D3.js.map} +0 -0
- /package/dist/{chunk-LP4MVJDW.js.map → chunk-JDHR5BDR.js.map} +0 -0
- /package/dist/{chunk-T5UOH56R.js.map → chunk-R3I2GCZC.js.map} +0 -0
- /package/dist/{chunk-RDOJCRKJ.js.map → chunk-R4AAPFXC.js.map} +0 -0
- /package/dist/{agent-smith-QYDXPFPJ.js.map → goal-manager-LAOT4QQX.js.map} +0 -0
- /package/dist/{cache-manager-7SKX3IGO.js.map → guardian-agent-M352CBE5.js.map} +0 -0
- /package/dist/{git-PZV3BBYI.js.map → issue-store-W2X33X2X.js.map} +0 -0
- /package/dist/{goal-manager-ESJCJXFS.js.map → progress-PQVEM7BR.js.map} +0 -0
- /package/dist/{guardian-agent-ZHJXLBOU.js.map → vibe-code-signatures-ELEWJFGZ.js.map} +0 -0
- /package/dist/{issue-store-JZ2LCQEG.js.map → vulnerability-signatures-EIJQX2TS.js.map} +0 -0
package/dist/cli/main.js
CHANGED
|
@@ -7,66 +7,48 @@ import {
|
|
|
7
7
|
exportToJson,
|
|
8
8
|
formatFriendlyError,
|
|
9
9
|
getAutonomyConfig,
|
|
10
|
+
getStagedChanges,
|
|
11
|
+
getUncommittedChanges,
|
|
10
12
|
handleCheckpointCommand,
|
|
11
13
|
importFromJson,
|
|
12
14
|
initializeBootstrapFiles,
|
|
15
|
+
loadConfig,
|
|
13
16
|
needsBootstrap,
|
|
14
17
|
perceiveCurrentChanges,
|
|
15
18
|
reasonAboutChangesHumanReadable,
|
|
16
19
|
recordBypass,
|
|
20
|
+
saveConfig,
|
|
17
21
|
shouldAutoFix,
|
|
18
22
|
shouldBlockPush,
|
|
19
23
|
trackIssueOccurrence
|
|
20
|
-
} from "../chunk-
|
|
24
|
+
} from "../chunk-FNCCZ3XB.js";
|
|
21
25
|
import {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
26
|
+
formatAuditLog,
|
|
27
|
+
getAuditStatistics,
|
|
28
|
+
getRecentAuditLogs,
|
|
29
|
+
getSkillAuditLogs,
|
|
25
30
|
getSkillCategories,
|
|
26
|
-
getSkillsByCategory,
|
|
27
|
-
isTrieInitialized,
|
|
28
|
-
loadConfig,
|
|
29
|
-
loadSavedPatterns,
|
|
30
|
-
saveConfig,
|
|
31
|
-
savePatternToProject,
|
|
32
|
-
savePatternsToProject
|
|
33
|
-
} from "../chunk-CUXXRM3T.js";
|
|
34
|
-
import "../chunk-HFQ5ORON.js";
|
|
35
|
-
import {
|
|
36
|
-
getStagedChanges,
|
|
37
|
-
getUncommittedChanges
|
|
38
|
-
} from "../chunk-IOUOVBJZ.js";
|
|
39
|
-
import {
|
|
40
|
-
ContextGraph,
|
|
41
|
-
GotchaPredictor
|
|
42
|
-
} from "../chunk-F55XBLIA.js";
|
|
43
|
-
import "../chunk-5Z7O66DE.js";
|
|
44
|
-
import {
|
|
45
|
-
getGuardianState
|
|
46
|
-
} from "../chunk-T5UOH56R.js";
|
|
47
|
-
import {
|
|
48
31
|
initProjectInfo,
|
|
49
|
-
|
|
50
|
-
listInstalledSkills,
|
|
32
|
+
isTrieInitialized,
|
|
51
33
|
loadContextState,
|
|
52
34
|
loadProjectInfo,
|
|
53
|
-
projectInfoExists
|
|
54
|
-
|
|
55
|
-
removeSkill
|
|
56
|
-
} from "../chunk-BG2BHWCC.js";
|
|
57
|
-
import {
|
|
58
|
-
formatAuditLog,
|
|
59
|
-
getAuditStatistics,
|
|
60
|
-
getRecentAuditLogs,
|
|
61
|
-
getSkillAuditLogs
|
|
62
|
-
} from "../chunk-MURGTWG4.js";
|
|
35
|
+
projectInfoExists
|
|
36
|
+
} from "../chunk-HSNE46VE.js";
|
|
63
37
|
import {
|
|
38
|
+
ContextGraph,
|
|
39
|
+
GotchaPredictor,
|
|
64
40
|
findCrossProjectPatterns,
|
|
65
41
|
getGlobalMemoryStats,
|
|
66
42
|
listTrackedProjects,
|
|
67
43
|
searchGlobalPatterns,
|
|
68
44
|
updateGlobalMemoryMd
|
|
69
|
-
} from "../chunk-
|
|
45
|
+
} from "../chunk-NIASHOAB.js";
|
|
46
|
+
import "../chunk-F4NJ4CBP.js";
|
|
47
|
+
import "../chunk-IXO4G4D3.js";
|
|
48
|
+
import "../chunk-6NLHFIYA.js";
|
|
49
|
+
import {
|
|
50
|
+
getGuardianState
|
|
51
|
+
} from "../chunk-R3I2GCZC.js";
|
|
70
52
|
import {
|
|
71
53
|
getDailyLogs,
|
|
72
54
|
getMemoryStats,
|
|
@@ -74,242 +56,21 @@ import {
|
|
|
74
56
|
markIssueResolved,
|
|
75
57
|
purgeIssues,
|
|
76
58
|
searchIssues
|
|
77
|
-
} from "../chunk-
|
|
78
|
-
import "../chunk-LVVG2DMW.js";
|
|
79
|
-
import "../chunk-6NLHFIYA.js";
|
|
80
|
-
import "../chunk-KWDNYWOR.js";
|
|
81
|
-
import "../chunk-74NPKTZV.js";
|
|
59
|
+
} from "../chunk-JDHR5BDR.js";
|
|
82
60
|
import {
|
|
83
61
|
getTrieDirectory,
|
|
84
62
|
getWorkingDirectory
|
|
85
|
-
} from "../chunk-
|
|
86
|
-
import "../chunk-
|
|
63
|
+
} from "../chunk-R4AAPFXC.js";
|
|
64
|
+
import "../chunk-APMV77PU.js";
|
|
87
65
|
import {
|
|
88
66
|
__require
|
|
89
67
|
} from "../chunk-DGUM43GV.js";
|
|
90
68
|
|
|
91
69
|
// src/cli/main.ts
|
|
92
|
-
import { resolve, join as
|
|
93
|
-
import {
|
|
70
|
+
import { resolve, join as join3, dirname } from "path";
|
|
71
|
+
import { readFileSync } from "fs";
|
|
94
72
|
import { fileURLToPath } from "url";
|
|
95
73
|
|
|
96
|
-
// src/cli/skills.ts
|
|
97
|
-
async function handleSkillsCommand(args) {
|
|
98
|
-
const [cmd, ...rest] = args;
|
|
99
|
-
switch (cmd) {
|
|
100
|
-
case "add":
|
|
101
|
-
case "install": {
|
|
102
|
-
if (!rest[0]) {
|
|
103
|
-
console.log("Usage: trie skills add <owner/repo> [skill-name]");
|
|
104
|
-
console.log("");
|
|
105
|
-
console.log("Examples:");
|
|
106
|
-
console.log(" trie skills add vercel-labs/agent-skills react-best-practices");
|
|
107
|
-
console.log(" trie skills add anthropics/skills claude-code-review");
|
|
108
|
-
console.log(" trie skills add myorg/internal-standards");
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
console.log(`Installing skill from ${rest[0]}...`);
|
|
112
|
-
const result = await installSkill(rest[0], rest[1]);
|
|
113
|
-
if (result.success) {
|
|
114
|
-
await recordSkillInstalled({ name: result.name, source: rest[0] });
|
|
115
|
-
console.log(`Installed: ${result.name}`);
|
|
116
|
-
console.log(`Path: ${result.path}`);
|
|
117
|
-
console.log("");
|
|
118
|
-
console.log("This skill is now a capability the skill-review agent can apply.");
|
|
119
|
-
console.log('Run "trie scan" to apply skills to your codebase.');
|
|
120
|
-
} else {
|
|
121
|
-
console.error(`Failed to install: ${result.error}`);
|
|
122
|
-
process.exit(1);
|
|
123
|
-
}
|
|
124
|
-
break;
|
|
125
|
-
}
|
|
126
|
-
case "list":
|
|
127
|
-
case "ls": {
|
|
128
|
-
const categoryArg = rest[0]?.toLowerCase();
|
|
129
|
-
if (categoryArg) {
|
|
130
|
-
if (categoryArg === "categories" || categoryArg === "all") {
|
|
131
|
-
const categories = getSkillCategories();
|
|
132
|
-
console.log("");
|
|
133
|
-
console.log("Available Skill Categories:");
|
|
134
|
-
console.log("");
|
|
135
|
-
for (const cat of categories) {
|
|
136
|
-
console.log(` ${cat.name.padEnd(15)} ${cat.count} skills`);
|
|
137
|
-
}
|
|
138
|
-
console.log("");
|
|
139
|
-
console.log("View skills in a category:");
|
|
140
|
-
console.log(" trie skills list <category>");
|
|
141
|
-
console.log("");
|
|
142
|
-
console.log("Browse all skills: https://skills.sh");
|
|
143
|
-
return;
|
|
144
|
-
}
|
|
145
|
-
const categorySkills = getSkillsByCategory(categoryArg);
|
|
146
|
-
if (categorySkills.length === 0) {
|
|
147
|
-
const categories = getSkillCategories();
|
|
148
|
-
console.log(`Unknown category: ${categoryArg}`);
|
|
149
|
-
console.log("");
|
|
150
|
-
console.log("Available categories:");
|
|
151
|
-
for (const cat of categories) {
|
|
152
|
-
console.log(` ${cat.name}`);
|
|
153
|
-
}
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
console.log("");
|
|
157
|
-
console.log(`${categoryArg.charAt(0).toUpperCase() + categoryArg.slice(1)} Skills (${categorySkills.length}):`);
|
|
158
|
-
console.log("");
|
|
159
|
-
for (const skill of categorySkills) {
|
|
160
|
-
console.log(` trie skills add ${skill}`);
|
|
161
|
-
}
|
|
162
|
-
console.log("");
|
|
163
|
-
console.log("Install any skill with: trie skills add <source> <name>");
|
|
164
|
-
console.log("Browse all skills: https://skills.sh");
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
167
|
-
const skills = await listInstalledSkills();
|
|
168
|
-
const state = await loadContextState();
|
|
169
|
-
if (skills.length === 0) {
|
|
170
|
-
console.log("");
|
|
171
|
-
console.log("No skills installed.");
|
|
172
|
-
console.log("");
|
|
173
|
-
console.log("Install a skill:");
|
|
174
|
-
console.log(" trie skills add vercel-labs/agent-skills react-best-practices");
|
|
175
|
-
console.log("");
|
|
176
|
-
console.log("Explore skill categories:");
|
|
177
|
-
const categories = getSkillCategories();
|
|
178
|
-
for (const cat of categories.slice(0, 5)) {
|
|
179
|
-
console.log(` trie skills list ${cat.name.padEnd(15)} # ${cat.count} skills`);
|
|
180
|
-
}
|
|
181
|
-
console.log(" trie skills list categories # see all");
|
|
182
|
-
console.log("");
|
|
183
|
-
console.log("Browse all skills: https://skills.sh");
|
|
184
|
-
return;
|
|
185
|
-
}
|
|
186
|
-
console.log("");
|
|
187
|
-
console.log(`Installed Skills (${skills.length}):`);
|
|
188
|
-
console.log("");
|
|
189
|
-
for (const skill of skills) {
|
|
190
|
-
const record = state.skills?.[skill.name];
|
|
191
|
-
const usage = record ? `applied ${record.timesApplied}x` : "not yet applied";
|
|
192
|
-
console.log(` ${skill.name} (${usage})`);
|
|
193
|
-
console.log(` ${skill.description}`);
|
|
194
|
-
console.log(` Source: ${skill.installedFrom}`);
|
|
195
|
-
console.log("");
|
|
196
|
-
}
|
|
197
|
-
console.log("These skills are applied by the skill-review agent during scans.");
|
|
198
|
-
console.log("");
|
|
199
|
-
console.log("Explore more: trie skills list categories");
|
|
200
|
-
break;
|
|
201
|
-
}
|
|
202
|
-
case "remove":
|
|
203
|
-
case "rm":
|
|
204
|
-
case "uninstall": {
|
|
205
|
-
if (!rest[0]) {
|
|
206
|
-
console.log("Usage: trie skills remove <skill-name>");
|
|
207
|
-
return;
|
|
208
|
-
}
|
|
209
|
-
const removed = await removeSkill(rest[0]);
|
|
210
|
-
if (removed) {
|
|
211
|
-
console.log(`Removed: ${rest[0]}`);
|
|
212
|
-
} else {
|
|
213
|
-
console.error(`Skill not found: ${rest[0]}`);
|
|
214
|
-
process.exit(1);
|
|
215
|
-
}
|
|
216
|
-
break;
|
|
217
|
-
}
|
|
218
|
-
case "suggest":
|
|
219
|
-
case "recommended": {
|
|
220
|
-
const workDir = getWorkingDirectory(void 0, true);
|
|
221
|
-
const stack = await detectStack(workDir);
|
|
222
|
-
if (stack.suggestedSkills.length === 0) {
|
|
223
|
-
console.log("");
|
|
224
|
-
console.log("No specific skill recommendations for your stack.");
|
|
225
|
-
console.log("");
|
|
226
|
-
console.log("Browse all skills:");
|
|
227
|
-
console.log(" trie skills list categories");
|
|
228
|
-
console.log(" https://skills.sh");
|
|
229
|
-
return;
|
|
230
|
-
}
|
|
231
|
-
console.log("");
|
|
232
|
-
console.log("Suggested Skills (based on your stack):");
|
|
233
|
-
console.log("");
|
|
234
|
-
if (stack.framework) console.log(` Detected: ${stack.framework}`);
|
|
235
|
-
if (stack.language) console.log(` Language: ${stack.language}`);
|
|
236
|
-
if (stack.database) console.log(` Database: ${stack.database}`);
|
|
237
|
-
console.log("");
|
|
238
|
-
for (const skill of stack.suggestedSkills) {
|
|
239
|
-
console.log(` trie skills add ${skill}`);
|
|
240
|
-
}
|
|
241
|
-
console.log("");
|
|
242
|
-
console.log("Install any skill with: trie skills add <source> <name>");
|
|
243
|
-
console.log("Browse all skills: https://skills.sh");
|
|
244
|
-
break;
|
|
245
|
-
}
|
|
246
|
-
case "info": {
|
|
247
|
-
if (!rest[0]) {
|
|
248
|
-
console.log("Usage: trie skills info <skill-name>");
|
|
249
|
-
return;
|
|
250
|
-
}
|
|
251
|
-
const skills = await listInstalledSkills();
|
|
252
|
-
const skill = skills.find((s) => s.name === rest[0]);
|
|
253
|
-
if (!skill) {
|
|
254
|
-
console.error(`Skill not found: ${rest[0]}`);
|
|
255
|
-
process.exit(1);
|
|
256
|
-
return;
|
|
257
|
-
}
|
|
258
|
-
const state = await loadContextState();
|
|
259
|
-
const record = state.skills?.[skill.name];
|
|
260
|
-
console.log("");
|
|
261
|
-
console.log(`Skill: ${skill.name}`);
|
|
262
|
-
console.log(`Description: ${skill.description}`);
|
|
263
|
-
console.log(`Path: ${skill.path}`);
|
|
264
|
-
console.log(`Source: ${skill.installedFrom}`);
|
|
265
|
-
console.log(`Installed: ${new Date(skill.installedAt).toLocaleString()}`);
|
|
266
|
-
if (record) {
|
|
267
|
-
console.log(`Times Applied: ${record.timesApplied}`);
|
|
268
|
-
console.log(`Applied By: ${record.appliedBy.join(", ") || "none"}`);
|
|
269
|
-
if (record.lastApplied) {
|
|
270
|
-
console.log(`Last Applied: ${new Date(record.lastApplied).toLocaleString()}`);
|
|
271
|
-
}
|
|
272
|
-
} else {
|
|
273
|
-
console.log("Times Applied: 0");
|
|
274
|
-
}
|
|
275
|
-
break;
|
|
276
|
-
}
|
|
277
|
-
default: {
|
|
278
|
-
const categories = getSkillCategories();
|
|
279
|
-
console.log(`
|
|
280
|
-
Skills - Reusable capabilities from skills.sh
|
|
281
|
-
|
|
282
|
-
Skills are NOT agents - they are knowledge/instructions that the
|
|
283
|
-
skill-review agent applies during code review.
|
|
284
|
-
|
|
285
|
-
Commands:
|
|
286
|
-
trie skills suggest Show skills for your stack
|
|
287
|
-
trie skills add <source> [name] Install a skill
|
|
288
|
-
trie skills list List installed skills
|
|
289
|
-
trie skills list <category> Browse skills by category
|
|
290
|
-
trie skills list categories Show all categories
|
|
291
|
-
trie skills info <name> Show skill details
|
|
292
|
-
trie skills remove <name> Uninstall a skill
|
|
293
|
-
|
|
294
|
-
Examples:
|
|
295
|
-
trie skills add vercel-labs/agent-skills react-best-practices
|
|
296
|
-
trie skills add anthropics/skills frontend-design
|
|
297
|
-
trie skills add expo/skills upgrading-expo
|
|
298
|
-
|
|
299
|
-
Categories (${categories.length} total, ${Object.values(SKILL_CATEGORIES).flat().length}+ skills):
|
|
300
|
-
${categories.map((c) => `${c.name} (${c.count})`).join(", ")}
|
|
301
|
-
|
|
302
|
-
How it works:
|
|
303
|
-
1. You install skills (capabilities)
|
|
304
|
-
2. The skill-review agent applies them during 'trie scan'
|
|
305
|
-
3. Usage is tracked in your project context
|
|
306
|
-
|
|
307
|
-
Browse all skills: https://skills.sh
|
|
308
|
-
`);
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
|
|
313
74
|
// src/hooks/install.ts
|
|
314
75
|
import fs from "fs";
|
|
315
76
|
import path from "path";
|
|
@@ -2260,10 +2021,123 @@ async function handleLearnCommand(args) {
|
|
|
2260
2021
|
}
|
|
2261
2022
|
|
|
2262
2023
|
// src/cli/patterns.ts
|
|
2024
|
+
import { readFile as readFile3, writeFile as writeFile3 } from "fs/promises";
|
|
2025
|
+
import { existsSync as existsSync4 } from "fs";
|
|
2026
|
+
import { basename as basename2 } from "path";
|
|
2027
|
+
import picocolors3 from "picocolors";
|
|
2028
|
+
|
|
2029
|
+
// src/patterns/saved-patterns.ts
|
|
2030
|
+
import { createHash } from "crypto";
|
|
2263
2031
|
import { readFile as readFile2, writeFile as writeFile2 } from "fs/promises";
|
|
2264
2032
|
import { existsSync as existsSync3 } from "fs";
|
|
2265
|
-
import { basename } from "path";
|
|
2266
|
-
|
|
2033
|
+
import { join as join2, basename } from "path";
|
|
2034
|
+
async function loadSavedPatterns(workDir) {
|
|
2035
|
+
const patternsPath = join2(getTrieDirectory(workDir), "saved-patterns.json");
|
|
2036
|
+
try {
|
|
2037
|
+
if (existsSync3(patternsPath)) {
|
|
2038
|
+
const content = await readFile2(patternsPath, "utf-8");
|
|
2039
|
+
return JSON.parse(content);
|
|
2040
|
+
}
|
|
2041
|
+
} catch {
|
|
2042
|
+
}
|
|
2043
|
+
return [];
|
|
2044
|
+
}
|
|
2045
|
+
async function savePatternsToProject(patterns, workDir) {
|
|
2046
|
+
const { mkdir } = await import("fs/promises");
|
|
2047
|
+
const patternsPath = join2(getTrieDirectory(workDir), "saved-patterns.json");
|
|
2048
|
+
await mkdir(getTrieDirectory(workDir), { recursive: true });
|
|
2049
|
+
await writeFile2(patternsPath, JSON.stringify(patterns, null, 2));
|
|
2050
|
+
}
|
|
2051
|
+
async function savePatternToProject(pattern, workDir) {
|
|
2052
|
+
const patterns = await loadSavedPatterns(workDir);
|
|
2053
|
+
const existing = patterns.findIndex((p) => p.id === pattern.id);
|
|
2054
|
+
if (existing >= 0) {
|
|
2055
|
+
patterns[existing] = {
|
|
2056
|
+
...patterns[existing],
|
|
2057
|
+
...pattern,
|
|
2058
|
+
occurrences: patterns[existing].occurrences + 1
|
|
2059
|
+
};
|
|
2060
|
+
} else {
|
|
2061
|
+
patterns.push(pattern);
|
|
2062
|
+
}
|
|
2063
|
+
await savePatternsToProject(patterns, workDir);
|
|
2064
|
+
}
|
|
2065
|
+
function detectPatternType(target, workDir) {
|
|
2066
|
+
const scoutNames = [
|
|
2067
|
+
"security",
|
|
2068
|
+
"legal",
|
|
2069
|
+
"accessibility",
|
|
2070
|
+
"bug-finding",
|
|
2071
|
+
"architecture",
|
|
2072
|
+
"types",
|
|
2073
|
+
"clean",
|
|
2074
|
+
"devops",
|
|
2075
|
+
"performance",
|
|
2076
|
+
"ux",
|
|
2077
|
+
"design",
|
|
2078
|
+
"production-ready",
|
|
2079
|
+
"agent-smith"
|
|
2080
|
+
];
|
|
2081
|
+
if (scoutNames.includes(target.toLowerCase())) {
|
|
2082
|
+
return "detection-rule";
|
|
2083
|
+
}
|
|
2084
|
+
const fullPath = join2(workDir, target);
|
|
2085
|
+
if (existsSync3(fullPath) || target.includes("/") || target.includes("*") || target.endsWith(".ts") || target.endsWith(".js")) {
|
|
2086
|
+
return "file-structure";
|
|
2087
|
+
}
|
|
2088
|
+
return "code-pattern";
|
|
2089
|
+
}
|
|
2090
|
+
function generatePatternId(target, type) {
|
|
2091
|
+
const hash = createHash("sha256").update(`${type}:${target}`).digest("hex").slice(0, 12);
|
|
2092
|
+
return `${type}-${hash}`;
|
|
2093
|
+
}
|
|
2094
|
+
async function createSavedPattern(target, note, workDir) {
|
|
2095
|
+
const projectName = basename(workDir);
|
|
2096
|
+
const patternType = detectPatternType(target, workDir);
|
|
2097
|
+
const savedPattern = {
|
|
2098
|
+
id: generatePatternId(target, patternType),
|
|
2099
|
+
type: patternType,
|
|
2100
|
+
name: target,
|
|
2101
|
+
description: note || `Pattern saved from ${projectName}`,
|
|
2102
|
+
validated: false,
|
|
2103
|
+
projects: [projectName],
|
|
2104
|
+
occurrences: 1,
|
|
2105
|
+
savedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2106
|
+
savedBy: projectName
|
|
2107
|
+
};
|
|
2108
|
+
if (patternType === "file-structure") {
|
|
2109
|
+
savedPattern.filePatterns = [target];
|
|
2110
|
+
savedPattern.architecture = {
|
|
2111
|
+
structure: `Files matching ${target}`,
|
|
2112
|
+
rationale: note || "File structure pattern that worked well"
|
|
2113
|
+
};
|
|
2114
|
+
} else if (patternType === "code-pattern") {
|
|
2115
|
+
const issues = await searchIssues(target, { limit: 5 });
|
|
2116
|
+
if (issues.length > 0) {
|
|
2117
|
+
const latestIssue = issues[0];
|
|
2118
|
+
savedPattern.codePattern = {
|
|
2119
|
+
pattern: latestIssue?.issue.issue || target,
|
|
2120
|
+
fix: latestIssue?.issue.fix || "Review and apply similar fix",
|
|
2121
|
+
context: note || "Code pattern that worked well"
|
|
2122
|
+
};
|
|
2123
|
+
} else {
|
|
2124
|
+
savedPattern.codePattern = {
|
|
2125
|
+
pattern: target,
|
|
2126
|
+
fix: "Review and apply similar fix",
|
|
2127
|
+
context: note || "Code pattern that worked well"
|
|
2128
|
+
};
|
|
2129
|
+
}
|
|
2130
|
+
} else if (patternType === "detection-rule") {
|
|
2131
|
+
savedPattern.detectionRule = {
|
|
2132
|
+
agent: target,
|
|
2133
|
+
rule: `Detection rules from ${target} scout`,
|
|
2134
|
+
severity: "moderate"
|
|
2135
|
+
};
|
|
2136
|
+
}
|
|
2137
|
+
return savedPattern;
|
|
2138
|
+
}
|
|
2139
|
+
|
|
2140
|
+
// src/cli/patterns.ts
|
|
2267
2141
|
async function handlePatternsCommand(args) {
|
|
2268
2142
|
const subcommand = args[0]?.toLowerCase();
|
|
2269
2143
|
const workDir = getWorkingDirectory(void 0, true);
|
|
@@ -2363,10 +2237,10 @@ async function handleExportPatterns(args, workDir) {
|
|
|
2363
2237
|
const exportData = {
|
|
2364
2238
|
version: "1.0",
|
|
2365
2239
|
exportedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2366
|
-
exportedFrom:
|
|
2240
|
+
exportedFrom: basename2(workDir),
|
|
2367
2241
|
patterns
|
|
2368
2242
|
};
|
|
2369
|
-
await
|
|
2243
|
+
await writeFile3(outputPath, JSON.stringify(exportData, null, 2));
|
|
2370
2244
|
console.log(picocolors3.green(`\u2713 Exported ${patterns.length} patterns to ${outputPath}`));
|
|
2371
2245
|
console.log(picocolors3.dim(` Import to another project with: trie patterns import ${outputPath}`));
|
|
2372
2246
|
}
|
|
@@ -2376,18 +2250,18 @@ async function handleImportPatterns(args, workDir) {
|
|
|
2376
2250
|
console.error(picocolors3.red("Usage: trie patterns import <path-to-patterns.json>"));
|
|
2377
2251
|
process.exit(1);
|
|
2378
2252
|
}
|
|
2379
|
-
if (!
|
|
2253
|
+
if (!existsSync4(inputPath)) {
|
|
2380
2254
|
console.error(picocolors3.red(`File not found: ${inputPath}`));
|
|
2381
2255
|
process.exit(1);
|
|
2382
2256
|
}
|
|
2383
|
-
const content = await
|
|
2257
|
+
const content = await readFile3(inputPath, "utf-8");
|
|
2384
2258
|
const importData = JSON.parse(content);
|
|
2385
2259
|
if (!importData.patterns || !Array.isArray(importData.patterns)) {
|
|
2386
2260
|
console.error(picocolors3.red("Invalid pattern file format."));
|
|
2387
2261
|
process.exit(1);
|
|
2388
2262
|
}
|
|
2389
2263
|
const existingPatterns = await loadSavedPatterns(workDir);
|
|
2390
|
-
const projectName =
|
|
2264
|
+
const projectName = basename2(workDir);
|
|
2391
2265
|
let imported = 0;
|
|
2392
2266
|
let skipped = 0;
|
|
2393
2267
|
for (const pattern of importData.patterns) {
|
|
@@ -2494,7 +2368,7 @@ function showBanner() {
|
|
|
2494
2368
|
\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557
|
|
2495
2369
|
\u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D
|
|
2496
2370
|
|
|
2497
|
-
Your
|
|
2371
|
+
Your decision ledger that travels
|
|
2498
2372
|
|
|
2499
2373
|
by Louis Kishfy
|
|
2500
2374
|
|
|
@@ -2527,18 +2401,13 @@ COMMANDS:
|
|
|
2527
2401
|
gotcha Predict problems with current changes (alias: predict)
|
|
2528
2402
|
reconcile Reconcile context graph from JSON backup
|
|
2529
2403
|
|
|
2530
|
-
skills Manage external skills from skills.sh
|
|
2531
2404
|
audit View security audit logs
|
|
2532
2405
|
memory Search and manage issue memory
|
|
2533
2406
|
patterns Save, validate, and share patterns across projects
|
|
2534
2407
|
status Quick health check (project health + memory stats)
|
|
2535
2408
|
project View/manage project info (.trie/PROJECT.md)
|
|
2536
|
-
scouts List all available scouts
|
|
2537
2409
|
setup Configure API key and environment
|
|
2538
2410
|
|
|
2539
|
-
agent-smith Run Agent Smith (35 vibe code hunters)
|
|
2540
|
-
super-reviewer Run interactive PR review
|
|
2541
|
-
|
|
2542
2411
|
ci Generate GitHub Actions workflow with memory caching
|
|
2543
2412
|
|
|
2544
2413
|
help Show this help message
|
|
@@ -2549,7 +2418,6 @@ EXAMPLES:
|
|
|
2549
2418
|
trie watch # Start the guardian (watches + nudges)
|
|
2550
2419
|
trie watch # Run in background: screen -S trie-watch
|
|
2551
2420
|
trie scan # Scan your codebase now
|
|
2552
|
-
trie scan --scouts security,privacy # Scan with specific scouts
|
|
2553
2421
|
|
|
2554
2422
|
trie tell "users couldn't log in" # Report an incident
|
|
2555
2423
|
trie ok # Mark current pattern as good
|
|
@@ -2561,42 +2429,18 @@ EXAMPLES:
|
|
|
2561
2429
|
trie gotcha # Predict for current changes
|
|
2562
2430
|
|
|
2563
2431
|
trie check # Risk check before pushing
|
|
2564
|
-
|
|
2565
|
-
trie skills add vercel-labs/agent-skills react-best-practices
|
|
2432
|
+
|
|
2566
2433
|
trie memory search "SQL injection"
|
|
2567
2434
|
trie memory stats # View memory statistics
|
|
2568
2435
|
trie status # Quick health check (project + memory)
|
|
2569
|
-
trie agent-smith # 35 vibe code hunters
|
|
2570
|
-
trie super-reviewer # Interactive PR review
|
|
2571
2436
|
trie ci # Generate CI workflow with memory caching
|
|
2572
2437
|
|
|
2573
2438
|
MCP TOOLS (use via Cursor/Claude Desktop):
|
|
2574
2439
|
trie_linear_sync Sync active tickets from Linear
|
|
2575
|
-
trie_scan
|
|
2440
|
+
trie_scan Scan with decision ledger
|
|
2576
2441
|
trie_fix Generate high-confidence fix prompts
|
|
2577
2442
|
trie_explain Explain code, issues, or changes
|
|
2578
2443
|
trie_watch Watch mode for autonomous reporting
|
|
2579
|
-
|
|
2580
|
-
Individual Scouts:
|
|
2581
|
-
trie_security Security vulnerabilities
|
|
2582
|
-
trie_privacy Privacy & GDPR compliance
|
|
2583
|
-
trie_soc2 SOC 2 Type II compliance
|
|
2584
|
-
trie_legal Legal compliance
|
|
2585
|
-
trie_accessibility WCAG 2.1 accessibility
|
|
2586
|
-
trie_architecture Code organization & SOLID
|
|
2587
|
-
trie_bugs Bug finding & null safety
|
|
2588
|
-
trie_ux UX testing (happy path, edge cases)
|
|
2589
|
-
trie_types TypeScript type safety
|
|
2590
|
-
trie_devops DevOps & deployment
|
|
2591
|
-
trie_clean Clean up AI-generated code
|
|
2592
|
-
|
|
2593
|
-
Special Scouts:
|
|
2594
|
-
trie_agent_smith 35 vibe code hunters, cross-file detection
|
|
2595
|
-
trie_super_reviewer Interactive PR review with cross-examination
|
|
2596
|
-
|
|
2597
|
-
Custom Skills:
|
|
2598
|
-
trie_create_skill Create skill from PDF/TXT/MD document
|
|
2599
|
-
trie_list_skills List all registered skills
|
|
2600
2444
|
|
|
2601
2445
|
`);
|
|
2602
2446
|
}
|
|
@@ -2645,60 +2489,6 @@ STEP 3: Start scanning!
|
|
|
2645
2489
|
Ask your AI assistant: "Scan this with Trie" or "Use trie_scan"
|
|
2646
2490
|
`);
|
|
2647
2491
|
}
|
|
2648
|
-
function listAgents() {
|
|
2649
|
-
console.log(`
|
|
2650
|
-
\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\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557
|
|
2651
|
-
\u2551 \u{1F4CB} Available Scouts \u2551
|
|
2652
|
-
\u255A\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\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D
|
|
2653
|
-
|
|
2654
|
-
BUILT-IN SCOUTS:
|
|
2655
|
-
\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
2656
|
-
security Security vulnerabilities, injection risks, auth issues
|
|
2657
|
-
privacy GDPR, HIPAA, PII handling, data encryption
|
|
2658
|
-
legal GDPR, CCPA, consent patterns, data retention
|
|
2659
|
-
accessibility WCAG 2.1 accessibility, keyboard nav, screen readers
|
|
2660
|
-
software-architect Code organization, SOLID principles, scalability
|
|
2661
|
-
bug-finding Null safety, edge cases, async issues
|
|
2662
|
-
user-testing Simulate users: happy path, security tester, confused user
|
|
2663
|
-
typecheck Type errors, missing annotations, null checks
|
|
2664
|
-
devops Config issues, logging, env vars, deployment
|
|
2665
|
-
trie_clean Clean up AI-generated code patterns
|
|
2666
|
-
moneybags Estimates dollar cost of bugs (IBM/NIST cost models)
|
|
2667
|
-
production-ready Production gate: health checks, scaling, security headers
|
|
2668
|
-
|
|
2669
|
-
Custom Skills:
|
|
2670
|
-
\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500`);
|
|
2671
|
-
const skillsDir = join2(getTrieDirectory(getWorkingDirectory(void 0, true)), "agents");
|
|
2672
|
-
if (existsSync4(skillsDir)) {
|
|
2673
|
-
try {
|
|
2674
|
-
const { readdirSync } = __require("fs");
|
|
2675
|
-
const files = readdirSync(skillsDir).filter((f) => f.endsWith(".json"));
|
|
2676
|
-
if (files.length > 0) {
|
|
2677
|
-
for (const file of files) {
|
|
2678
|
-
const config = JSON.parse(readFileSync(join2(skillsDir, file), "utf-8"));
|
|
2679
|
-
console.log(` ${config.name.padEnd(18)} ${config.description || "Custom skill"}`);
|
|
2680
|
-
}
|
|
2681
|
-
} else {
|
|
2682
|
-
console.log(` (No custom skills found)`);
|
|
2683
|
-
}
|
|
2684
|
-
} catch {
|
|
2685
|
-
console.log(` (No custom skills found)`);
|
|
2686
|
-
}
|
|
2687
|
-
} else {
|
|
2688
|
-
console.log(` (No custom skills found)`);
|
|
2689
|
-
}
|
|
2690
|
-
console.log(`
|
|
2691
|
-
CREATE CUSTOM SKILLS:
|
|
2692
|
-
\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
2693
|
-
You can create skills from PDF, TXT, or MD documents:
|
|
2694
|
-
|
|
2695
|
-
Via MCP: Use trie_create_skill tool
|
|
2696
|
-
CLI: trie-create --file book.pdf --name my-skill
|
|
2697
|
-
|
|
2698
|
-
The agent will learn patterns from your document and apply them
|
|
2699
|
-
to code reviews. Great for style guides, compliance docs, etc.
|
|
2700
|
-
`);
|
|
2701
|
-
}
|
|
2702
2492
|
function showVersion() {
|
|
2703
2493
|
showBanner();
|
|
2704
2494
|
console.error(`v${getCliVersion()}`);
|
|
@@ -2793,7 +2583,7 @@ Next steps:
|
|
|
2793
2583
|
}
|
|
2794
2584
|
if (subcommand === "edit") {
|
|
2795
2585
|
const editor = process.env.EDITOR || process.env.VISUAL || "nano";
|
|
2796
|
-
const projectPath =
|
|
2586
|
+
const projectPath = join3(getTrieDirectory(workDir), "PROJECT.md");
|
|
2797
2587
|
if (!projectInfoExists(workDir)) {
|
|
2798
2588
|
console.log("No PROJECT.md found. Creating one first...");
|
|
2799
2589
|
await initProjectInfo(workDir);
|
|
@@ -2839,7 +2629,7 @@ This info is available via trie://project MCP resource.
|
|
|
2839
2629
|
\u2551 \u{1F4CB} Project Information \u2551
|
|
2840
2630
|
\u255A\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\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D
|
|
2841
2631
|
|
|
2842
|
-
Path: ${
|
|
2632
|
+
Path: ${join3(getTrieDirectory(workDir), "PROJECT.md")}
|
|
2843
2633
|
|
|
2844
2634
|
${"-".repeat(68)}
|
|
2845
2635
|
`);
|
|
@@ -2922,23 +2712,11 @@ async function main() {
|
|
|
2922
2712
|
case "save":
|
|
2923
2713
|
handleCheckpointCommand(restArgs);
|
|
2924
2714
|
break;
|
|
2925
|
-
case "scouts":
|
|
2926
|
-
case "agents":
|
|
2927
|
-
// Alias for backward compatibility
|
|
2928
|
-
case "list":
|
|
2929
|
-
case "list-scouts":
|
|
2930
|
-
case "list-agents":
|
|
2931
|
-
listAgents();
|
|
2932
|
-
break;
|
|
2933
2715
|
case "project":
|
|
2934
2716
|
case "info":
|
|
2935
2717
|
case "project-info":
|
|
2936
2718
|
handleProject(restArgs);
|
|
2937
2719
|
break;
|
|
2938
|
-
case "skills":
|
|
2939
|
-
case "skill":
|
|
2940
|
-
handleSkillsCommand(restArgs);
|
|
2941
|
-
break;
|
|
2942
2720
|
case "audit":
|
|
2943
2721
|
handleAuditCommand(restArgs);
|
|
2944
2722
|
break;
|
|
@@ -2995,16 +2773,6 @@ async function main() {
|
|
|
2995
2773
|
case "snooze":
|
|
2996
2774
|
handleQuietCommand();
|
|
2997
2775
|
break;
|
|
2998
|
-
case "agent-smith":
|
|
2999
|
-
case "smith":
|
|
3000
|
-
case "trie_agent_smith":
|
|
3001
|
-
runScan(["--scouts", "agent-smith", ...restArgs]);
|
|
3002
|
-
break;
|
|
3003
|
-
case "super-reviewer":
|
|
3004
|
-
case "reviewer":
|
|
3005
|
-
case "trie_super_reviewer":
|
|
3006
|
-
runScan(["--scouts", "super-reviewer", ...restArgs]);
|
|
3007
|
-
break;
|
|
3008
2776
|
case "ci":
|
|
3009
2777
|
case "ci-setup":
|
|
3010
2778
|
handleCISetupCommand(restArgs);
|