@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
|
@@ -0,0 +1,956 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getTrieDirectory,
|
|
3
|
+
getWorkingDirectory
|
|
4
|
+
} from "./chunk-R4AAPFXC.js";
|
|
5
|
+
|
|
6
|
+
// src/utils/project-info.ts
|
|
7
|
+
import { readFile, writeFile, mkdir } from "fs/promises";
|
|
8
|
+
import { existsSync } from "fs";
|
|
9
|
+
import { join } from "path";
|
|
10
|
+
var PROJECT_MD_PATH = "PROJECT.md";
|
|
11
|
+
function getProjectTemplate() {
|
|
12
|
+
return `# Project Information
|
|
13
|
+
|
|
14
|
+
> This file stores important project context for AI assistants.
|
|
15
|
+
> Edit freely - this file is yours, not auto-generated.
|
|
16
|
+
> Available via MCP resource: \`trie://project\`
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Project Overview
|
|
21
|
+
|
|
22
|
+
<!-- Describe your project's purpose and goals -->
|
|
23
|
+
|
|
24
|
+
[Add project description here]
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Technology Stack
|
|
29
|
+
|
|
30
|
+
<!-- List frameworks, languages, databases, cloud services, etc. -->
|
|
31
|
+
|
|
32
|
+
- **Language:**
|
|
33
|
+
- **Framework:**
|
|
34
|
+
- **Database:**
|
|
35
|
+
- **Hosting:**
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Architecture
|
|
40
|
+
|
|
41
|
+
<!-- Key patterns, architectural decisions, and system design -->
|
|
42
|
+
|
|
43
|
+
[Describe your architecture here]
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Coding Conventions
|
|
48
|
+
|
|
49
|
+
<!-- Style guidelines, naming conventions, patterns to follow -->
|
|
50
|
+
|
|
51
|
+
-
|
|
52
|
+
-
|
|
53
|
+
-
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Environment
|
|
58
|
+
|
|
59
|
+
<!-- URLs, API endpoints, deployment info -->
|
|
60
|
+
|
|
61
|
+
| Environment | URL | Notes |
|
|
62
|
+
|-------------|-----|-------|
|
|
63
|
+
| Development | | |
|
|
64
|
+
| Staging | | |
|
|
65
|
+
| Production | | |
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## Team
|
|
70
|
+
|
|
71
|
+
<!-- Ownership, contacts, responsibilities -->
|
|
72
|
+
|
|
73
|
+
- **Owner:**
|
|
74
|
+
- **Team:**
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## Compliance
|
|
79
|
+
|
|
80
|
+
<!-- HIPAA, SOC2, GDPR, PCI-DSS requirements if applicable -->
|
|
81
|
+
|
|
82
|
+
- [ ] GDPR
|
|
83
|
+
- [ ] SOC2
|
|
84
|
+
- [ ] HIPAA
|
|
85
|
+
- [ ] PCI-DSS
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## AI Instructions
|
|
90
|
+
|
|
91
|
+
<!-- Special instructions for AI assistants working on this project -->
|
|
92
|
+
|
|
93
|
+
When working on this project, AI assistants should:
|
|
94
|
+
|
|
95
|
+
1.
|
|
96
|
+
2.
|
|
97
|
+
3.
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
*This file is read by Trie agents and exposed via \`trie://project\` MCP resource.*
|
|
102
|
+
*Edit this file to provide context to Claude Code, Cursor, GitHub Actions, and other AI tools.*
|
|
103
|
+
`;
|
|
104
|
+
}
|
|
105
|
+
function projectInfoExists(workDir) {
|
|
106
|
+
const dir = workDir || getWorkingDirectory(void 0, true);
|
|
107
|
+
const projectPath = join(getTrieDirectory(dir), PROJECT_MD_PATH);
|
|
108
|
+
return existsSync(projectPath);
|
|
109
|
+
}
|
|
110
|
+
async function loadProjectInfo(workDir) {
|
|
111
|
+
const dir = workDir || getWorkingDirectory(void 0, true);
|
|
112
|
+
const projectPath = join(getTrieDirectory(dir), PROJECT_MD_PATH);
|
|
113
|
+
try {
|
|
114
|
+
if (!existsSync(projectPath)) {
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
return await readFile(projectPath, "utf-8");
|
|
118
|
+
} catch {
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
async function saveProjectInfo(content, workDir) {
|
|
123
|
+
const dir = workDir || getWorkingDirectory(void 0, true);
|
|
124
|
+
const trieDir = getTrieDirectory(dir);
|
|
125
|
+
const projectPath = join(trieDir, PROJECT_MD_PATH);
|
|
126
|
+
await mkdir(trieDir, { recursive: true });
|
|
127
|
+
await writeFile(projectPath, content, "utf-8");
|
|
128
|
+
}
|
|
129
|
+
async function initProjectInfo(workDir) {
|
|
130
|
+
const dir = workDir || getWorkingDirectory(void 0, true);
|
|
131
|
+
const projectPath = join(getTrieDirectory(dir), PROJECT_MD_PATH);
|
|
132
|
+
if (existsSync(projectPath)) {
|
|
133
|
+
return { created: false, path: projectPath };
|
|
134
|
+
}
|
|
135
|
+
await saveProjectInfo(getProjectTemplate(), dir);
|
|
136
|
+
return { created: true, path: projectPath };
|
|
137
|
+
}
|
|
138
|
+
async function getProjectSection(sectionName, workDir) {
|
|
139
|
+
const content = await loadProjectInfo(workDir);
|
|
140
|
+
if (!content) return null;
|
|
141
|
+
const sectionRegex = new RegExp(
|
|
142
|
+
`## ${escapeRegex(sectionName)}\\s*\\n([\\s\\S]*?)(?=\\n## |\\n---\\s*$|$)`,
|
|
143
|
+
"i"
|
|
144
|
+
);
|
|
145
|
+
const match = content.match(sectionRegex);
|
|
146
|
+
if (match?.[1]) {
|
|
147
|
+
return match[1].trim();
|
|
148
|
+
}
|
|
149
|
+
return null;
|
|
150
|
+
}
|
|
151
|
+
async function updateProjectSection(sectionName, newContent, workDir) {
|
|
152
|
+
let content = await loadProjectInfo(workDir);
|
|
153
|
+
if (!content) {
|
|
154
|
+
await initProjectInfo(workDir);
|
|
155
|
+
content = await loadProjectInfo(workDir);
|
|
156
|
+
if (!content) return false;
|
|
157
|
+
}
|
|
158
|
+
const sectionRegex = new RegExp(
|
|
159
|
+
`(## ${escapeRegex(sectionName)}\\s*\\n)([\\s\\S]*?)((?=\\n## )|(?=\\n---\\s*$)|$)`,
|
|
160
|
+
"i"
|
|
161
|
+
);
|
|
162
|
+
if (content.match(sectionRegex)) {
|
|
163
|
+
const updatedContent = content.replace(sectionRegex, `$1
|
|
164
|
+
${newContent}
|
|
165
|
+
|
|
166
|
+
$3`);
|
|
167
|
+
await saveProjectInfo(updatedContent, workDir);
|
|
168
|
+
return true;
|
|
169
|
+
}
|
|
170
|
+
return false;
|
|
171
|
+
}
|
|
172
|
+
async function appendToSection(sectionName, contentToAdd, workDir) {
|
|
173
|
+
const currentContent = await getProjectSection(sectionName, workDir);
|
|
174
|
+
if (currentContent === null) return false;
|
|
175
|
+
const newContent = currentContent + "\n" + contentToAdd;
|
|
176
|
+
return updateProjectSection(sectionName, newContent, workDir);
|
|
177
|
+
}
|
|
178
|
+
async function getProjectSections(workDir) {
|
|
179
|
+
const content = await loadProjectInfo(workDir);
|
|
180
|
+
if (!content) return [];
|
|
181
|
+
const sectionRegex = /^## (.+)$/gm;
|
|
182
|
+
const sections = [];
|
|
183
|
+
let match;
|
|
184
|
+
while ((match = sectionRegex.exec(content)) !== null) {
|
|
185
|
+
if (match[1]) {
|
|
186
|
+
sections.push(match[1].trim());
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
return sections;
|
|
190
|
+
}
|
|
191
|
+
async function getProjectInfoStructured(workDir) {
|
|
192
|
+
const dir = workDir || getWorkingDirectory(void 0, true);
|
|
193
|
+
const projectPath = join(getTrieDirectory(dir), PROJECT_MD_PATH);
|
|
194
|
+
const content = await loadProjectInfo(dir);
|
|
195
|
+
if (!content) {
|
|
196
|
+
return {
|
|
197
|
+
exists: false,
|
|
198
|
+
path: projectPath,
|
|
199
|
+
sections: {},
|
|
200
|
+
raw: null
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
const sectionNames = await getProjectSections(dir);
|
|
204
|
+
const sections = {};
|
|
205
|
+
for (const name of sectionNames) {
|
|
206
|
+
const sectionContent = await getProjectSection(name, dir);
|
|
207
|
+
if (sectionContent) {
|
|
208
|
+
sections[name] = sectionContent;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
return {
|
|
212
|
+
exists: true,
|
|
213
|
+
path: projectPath,
|
|
214
|
+
sections,
|
|
215
|
+
raw: content
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
function escapeRegex(str) {
|
|
219
|
+
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// src/utils/context-state.ts
|
|
223
|
+
import { readFile as readFile2, mkdir as mkdir2 } from "fs/promises";
|
|
224
|
+
import { existsSync as existsSync2 } from "fs";
|
|
225
|
+
import { join as join2, basename } from "path";
|
|
226
|
+
var STATE_JSON_PATH = "state.json";
|
|
227
|
+
async function loadContextState() {
|
|
228
|
+
const workDir = getWorkingDirectory(void 0, true);
|
|
229
|
+
const statePath = join2(getTrieDirectory(workDir), STATE_JSON_PATH);
|
|
230
|
+
const defaults = getDefaultState();
|
|
231
|
+
try {
|
|
232
|
+
if (existsSync2(statePath)) {
|
|
233
|
+
const content = await readFile2(statePath, "utf-8");
|
|
234
|
+
const loaded = JSON.parse(content);
|
|
235
|
+
return {
|
|
236
|
+
...defaults,
|
|
237
|
+
...loaded,
|
|
238
|
+
skills: loaded.skills || defaults.skills
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
} catch {
|
|
242
|
+
}
|
|
243
|
+
return defaults;
|
|
244
|
+
}
|
|
245
|
+
function getDefaultState() {
|
|
246
|
+
return {
|
|
247
|
+
lastScan: null,
|
|
248
|
+
healthScore: 0,
|
|
249
|
+
activePriorities: [
|
|
250
|
+
"Initial setup required - run first scan with `trie scan`",
|
|
251
|
+
"Configure agents in `.trie/config.json`",
|
|
252
|
+
"Set up CI/CD integration"
|
|
253
|
+
],
|
|
254
|
+
contextSignals: {},
|
|
255
|
+
agentStatus: {},
|
|
256
|
+
scanHistory: [],
|
|
257
|
+
customAgents: [],
|
|
258
|
+
skills: {},
|
|
259
|
+
environment: detectEnvironment()
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
function detectEnvironment() {
|
|
263
|
+
if (process.env.GITHUB_ACTIONS) return "github-actions";
|
|
264
|
+
if (process.env.GITLAB_CI) return "gitlab-ci";
|
|
265
|
+
if (process.env.CI) return "ci";
|
|
266
|
+
const parent = process.env._ || "";
|
|
267
|
+
if (parent.includes("cursor")) return "cursor";
|
|
268
|
+
if (parent.includes("claude")) return "claude-code";
|
|
269
|
+
return "cli";
|
|
270
|
+
}
|
|
271
|
+
async function getContextForAI() {
|
|
272
|
+
const state = await loadContextState();
|
|
273
|
+
const workDir = getWorkingDirectory(void 0, true);
|
|
274
|
+
const lines = [];
|
|
275
|
+
if (projectInfoExists(workDir)) {
|
|
276
|
+
const projectInfo = await loadProjectInfo(workDir);
|
|
277
|
+
if (projectInfo) {
|
|
278
|
+
lines.push(projectInfo);
|
|
279
|
+
lines.push("");
|
|
280
|
+
lines.push("---");
|
|
281
|
+
lines.push("");
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
lines.push(
|
|
285
|
+
"## Trie Scan Context",
|
|
286
|
+
"",
|
|
287
|
+
`**Health Score:** ${state.healthScore}%`,
|
|
288
|
+
`**Last Scan:** ${state.lastScan ? new Date(state.lastScan.timestamp).toLocaleString() : "Never"}`,
|
|
289
|
+
"",
|
|
290
|
+
"**Active Priorities:**",
|
|
291
|
+
...state.activePriorities.map((p) => `- ${p}`),
|
|
292
|
+
""
|
|
293
|
+
);
|
|
294
|
+
if (state.lastScan) {
|
|
295
|
+
lines.push(
|
|
296
|
+
"**Recent Issues:**",
|
|
297
|
+
`- Critical: ${state.lastScan.issues.critical}`,
|
|
298
|
+
`- Serious: ${state.lastScan.issues.serious}`,
|
|
299
|
+
`- Moderate: ${state.lastScan.issues.moderate}`,
|
|
300
|
+
`- Low: ${state.lastScan.issues.low}`,
|
|
301
|
+
""
|
|
302
|
+
);
|
|
303
|
+
if (state.lastScan.hotFiles.length > 0) {
|
|
304
|
+
lines.push(
|
|
305
|
+
"**Hot Files (most issues):**",
|
|
306
|
+
...state.lastScan.hotFiles.slice(0, 5).map((f) => `- ${f.file}: ${f.issueCount} issues`),
|
|
307
|
+
""
|
|
308
|
+
);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
return lines.join("\n");
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
// src/utils/trie-init.ts
|
|
315
|
+
import { existsSync as existsSync3 } from "fs";
|
|
316
|
+
import { join as join3 } from "path";
|
|
317
|
+
var INIT_MARKERS = [
|
|
318
|
+
"PROJECT.md",
|
|
319
|
+
"RULES.md",
|
|
320
|
+
"TEAM.md",
|
|
321
|
+
"BOOTSTRAP.md",
|
|
322
|
+
"AGENTS.md",
|
|
323
|
+
"config.json"
|
|
324
|
+
];
|
|
325
|
+
function isTrieInitialized(workDir) {
|
|
326
|
+
const dir = workDir || getWorkingDirectory(void 0, true);
|
|
327
|
+
const trieDir = getTrieDirectory(dir);
|
|
328
|
+
return INIT_MARKERS.some((marker) => existsSync3(join3(trieDir, marker)));
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
// src/skills/audit-logger.ts
|
|
332
|
+
function formatAuditLog(_entry) {
|
|
333
|
+
return "Audit logging has been integrated into the decision ledger";
|
|
334
|
+
}
|
|
335
|
+
function getAuditStatistics() {
|
|
336
|
+
return {
|
|
337
|
+
totalScans: 0,
|
|
338
|
+
totalIssues: 0,
|
|
339
|
+
criticalCount: 0,
|
|
340
|
+
seriousCount: 0,
|
|
341
|
+
moderateCount: 0,
|
|
342
|
+
lowCount: 0,
|
|
343
|
+
totalExecutions: 0,
|
|
344
|
+
successfulExecutions: 0,
|
|
345
|
+
failedExecutions: 0,
|
|
346
|
+
uniqueSkills: 0,
|
|
347
|
+
totalCommands: 0,
|
|
348
|
+
blockedCommands: 0,
|
|
349
|
+
totalNetworkCalls: 0,
|
|
350
|
+
blockedNetworkCalls: 0
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
function createAuditEntry(skillName, skillSource, triggeredBy, targetPath) {
|
|
354
|
+
return {
|
|
355
|
+
skillName,
|
|
356
|
+
skillSource,
|
|
357
|
+
triggeredBy,
|
|
358
|
+
targetPath,
|
|
359
|
+
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
360
|
+
commands: []
|
|
361
|
+
};
|
|
362
|
+
}
|
|
363
|
+
function completeAuditEntry(entry, success, error) {
|
|
364
|
+
const result = {
|
|
365
|
+
...entry,
|
|
366
|
+
completedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
367
|
+
success
|
|
368
|
+
};
|
|
369
|
+
if (error !== void 0) {
|
|
370
|
+
result.error = error;
|
|
371
|
+
}
|
|
372
|
+
return result;
|
|
373
|
+
}
|
|
374
|
+
async function logSkillExecution(_execution) {
|
|
375
|
+
}
|
|
376
|
+
async function getRecentAuditLogs(_limit = 10) {
|
|
377
|
+
return [];
|
|
378
|
+
}
|
|
379
|
+
async function getSkillAuditLogs(_skillName) {
|
|
380
|
+
return [];
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
// src/bootstrap/stack-detector.ts
|
|
384
|
+
import { readFile as readFile3 } from "fs/promises";
|
|
385
|
+
import { existsSync as existsSync4 } from "fs";
|
|
386
|
+
import { join as join4 } from "path";
|
|
387
|
+
var SKILL_MAPPINGS = {
|
|
388
|
+
// Frontend Frameworks - React/Next.js
|
|
389
|
+
"next": [
|
|
390
|
+
"vercel-labs/agent-skills vercel-react-best-practices",
|
|
391
|
+
"vercel-labs/agent-skills web-design-guidelines",
|
|
392
|
+
"anthropics/skills frontend-design",
|
|
393
|
+
"wshobson/agents nextjs-app-router-patterns"
|
|
394
|
+
],
|
|
395
|
+
"react": [
|
|
396
|
+
"vercel-labs/agent-skills vercel-react-best-practices",
|
|
397
|
+
"anthropics/skills frontend-design",
|
|
398
|
+
"wshobson/agents react-state-management"
|
|
399
|
+
],
|
|
400
|
+
// Vue/Nuxt Ecosystem
|
|
401
|
+
"vue": [
|
|
402
|
+
"hyf0/vue-skills vue-best-practices",
|
|
403
|
+
"hyf0/vue-skills pinia-best-practices",
|
|
404
|
+
"hyf0/vue-skills vueuse-best-practices",
|
|
405
|
+
"onmax/nuxt-skills vue"
|
|
406
|
+
],
|
|
407
|
+
"nuxt": [
|
|
408
|
+
"onmax/nuxt-skills nuxt",
|
|
409
|
+
"onmax/nuxt-skills nuxt-ui",
|
|
410
|
+
"onmax/nuxt-skills nuxt-content",
|
|
411
|
+
"onmax/nuxt-skills nuxt-modules",
|
|
412
|
+
"onmax/nuxt-skills nuxt-better-auth",
|
|
413
|
+
"onmax/nuxt-skills nuxthub"
|
|
414
|
+
],
|
|
415
|
+
"pinia": [
|
|
416
|
+
"hyf0/vue-skills pinia-best-practices"
|
|
417
|
+
],
|
|
418
|
+
"@vueuse/core": [
|
|
419
|
+
"hyf0/vue-skills vueuse-best-practices",
|
|
420
|
+
"onmax/nuxt-skills vueuse"
|
|
421
|
+
],
|
|
422
|
+
// Mobile - Expo
|
|
423
|
+
"expo": [
|
|
424
|
+
"expo/skills building-native-ui",
|
|
425
|
+
"expo/skills upgrading-expo",
|
|
426
|
+
"expo/skills native-data-fetching",
|
|
427
|
+
"expo/skills expo-dev-client",
|
|
428
|
+
"expo/skills expo-deployment",
|
|
429
|
+
"expo/skills expo-api-routes",
|
|
430
|
+
"expo/skills expo-tailwind-setup",
|
|
431
|
+
"expo/skills expo-cicd-workflows",
|
|
432
|
+
"expo/skills use-dom"
|
|
433
|
+
],
|
|
434
|
+
// Mobile - React Native
|
|
435
|
+
"react-native": [
|
|
436
|
+
"callstackincubator/agent-skills react-native-best-practices",
|
|
437
|
+
"wshobson/agents react-native-architecture"
|
|
438
|
+
],
|
|
439
|
+
// Backend Frameworks
|
|
440
|
+
"@nestjs/core": [
|
|
441
|
+
"kadajett/agent-nestjs-skills nestjs-best-practices"
|
|
442
|
+
],
|
|
443
|
+
"nestjs": [
|
|
444
|
+
"kadajett/agent-nestjs-skills nestjs-best-practices"
|
|
445
|
+
],
|
|
446
|
+
"elysia": [
|
|
447
|
+
"elysiajs/skills elysiajs"
|
|
448
|
+
],
|
|
449
|
+
"hono": [
|
|
450
|
+
"elysiajs/skills elysiajs"
|
|
451
|
+
],
|
|
452
|
+
// Database/BaaS
|
|
453
|
+
"@supabase/supabase-js": [
|
|
454
|
+
"supabase/agent-skills supabase-postgres-best-practices"
|
|
455
|
+
],
|
|
456
|
+
"convex": [
|
|
457
|
+
"waynesutton/convexskills convex-best-practices"
|
|
458
|
+
],
|
|
459
|
+
"pg": [
|
|
460
|
+
"wshobson/agents postgresql-table-design"
|
|
461
|
+
],
|
|
462
|
+
"postgres": [
|
|
463
|
+
"wshobson/agents postgresql-table-design"
|
|
464
|
+
],
|
|
465
|
+
// Auth
|
|
466
|
+
"better-auth": [
|
|
467
|
+
"better-auth/skills better-auth-best-practices",
|
|
468
|
+
"better-auth/skills create-auth-skill"
|
|
469
|
+
],
|
|
470
|
+
// Payments
|
|
471
|
+
"stripe": [
|
|
472
|
+
"stripe/ai stripe-best-practices"
|
|
473
|
+
],
|
|
474
|
+
"@stripe/stripe-js": [
|
|
475
|
+
"stripe/ai stripe-best-practices"
|
|
476
|
+
],
|
|
477
|
+
// Media/Graphics
|
|
478
|
+
"remotion": [
|
|
479
|
+
"remotion-dev/skills remotion-best-practices"
|
|
480
|
+
],
|
|
481
|
+
"three": [
|
|
482
|
+
"cloudai-x/threejs-skills threejs-fundamentals",
|
|
483
|
+
"cloudai-x/threejs-skills threejs-animation",
|
|
484
|
+
"cloudai-x/threejs-skills threejs-materials",
|
|
485
|
+
"cloudai-x/threejs-skills threejs-shaders",
|
|
486
|
+
"cloudai-x/threejs-skills threejs-lighting",
|
|
487
|
+
"cloudai-x/threejs-skills threejs-geometry",
|
|
488
|
+
"cloudai-x/threejs-skills threejs-textures",
|
|
489
|
+
"cloudai-x/threejs-skills threejs-loaders",
|
|
490
|
+
"cloudai-x/threejs-skills threejs-interaction",
|
|
491
|
+
"cloudai-x/threejs-skills threejs-postprocessing"
|
|
492
|
+
],
|
|
493
|
+
// UI Libraries
|
|
494
|
+
"tailwindcss": [
|
|
495
|
+
"wshobson/agents tailwind-design-system",
|
|
496
|
+
"jezweb/claude-skills tailwind-v4-shadcn",
|
|
497
|
+
"wshobson/agents responsive-design"
|
|
498
|
+
],
|
|
499
|
+
"@shadcn/ui": [
|
|
500
|
+
"giuseppe-trisciuoglio/developer-kit shadcn-ui"
|
|
501
|
+
],
|
|
502
|
+
"shadcn": [
|
|
503
|
+
"giuseppe-trisciuoglio/developer-kit shadcn-ui"
|
|
504
|
+
],
|
|
505
|
+
"@radix-ui/react-slot": [
|
|
506
|
+
"onmax/nuxt-skills reka-ui"
|
|
507
|
+
],
|
|
508
|
+
// State Management
|
|
509
|
+
"@tanstack/react-query": [
|
|
510
|
+
"jezweb/claude-skills tanstack-query"
|
|
511
|
+
],
|
|
512
|
+
// Testing
|
|
513
|
+
"playwright": [
|
|
514
|
+
"anthropics/skills webapp-testing",
|
|
515
|
+
"wshobson/agents e2e-testing-patterns"
|
|
516
|
+
],
|
|
517
|
+
"puppeteer": [
|
|
518
|
+
"anthropics/skills webapp-testing"
|
|
519
|
+
],
|
|
520
|
+
"vitest": [
|
|
521
|
+
"wshobson/agents e2e-testing-patterns"
|
|
522
|
+
],
|
|
523
|
+
"jest": [
|
|
524
|
+
"wshobson/agents e2e-testing-patterns"
|
|
525
|
+
],
|
|
526
|
+
// DevTools/MCP
|
|
527
|
+
"@modelcontextprotocol/sdk": [
|
|
528
|
+
"anthropics/skills mcp-builder"
|
|
529
|
+
],
|
|
530
|
+
// Security
|
|
531
|
+
"semgrep": [
|
|
532
|
+
"trailofbits/skills semgrep"
|
|
533
|
+
],
|
|
534
|
+
// Monorepos
|
|
535
|
+
"turbo": [
|
|
536
|
+
"wshobson/agents monorepo-management"
|
|
537
|
+
],
|
|
538
|
+
"nx": [
|
|
539
|
+
"wshobson/agents monorepo-management"
|
|
540
|
+
],
|
|
541
|
+
"lerna": [
|
|
542
|
+
"wshobson/agents monorepo-management"
|
|
543
|
+
],
|
|
544
|
+
// TypeScript (handled separately based on tsconfig.json)
|
|
545
|
+
"typescript": [
|
|
546
|
+
"wshobson/agents typescript-advanced-types"
|
|
547
|
+
]
|
|
548
|
+
};
|
|
549
|
+
var SKILL_CATEGORIES = {
|
|
550
|
+
documents: [
|
|
551
|
+
"anthropics/skills pdf",
|
|
552
|
+
"anthropics/skills xlsx",
|
|
553
|
+
"anthropics/skills pptx",
|
|
554
|
+
"anthropics/skills docx",
|
|
555
|
+
"anthropics/skills doc-coauthoring"
|
|
556
|
+
],
|
|
557
|
+
design: [
|
|
558
|
+
"anthropics/skills canvas-design",
|
|
559
|
+
"anthropics/skills theme-factory",
|
|
560
|
+
"anthropics/skills web-artifacts-builder",
|
|
561
|
+
"anthropics/skills algorithmic-art",
|
|
562
|
+
"anthropics/skills brand-guidelines",
|
|
563
|
+
"anthropics/skills slack-gif-creator",
|
|
564
|
+
"nextlevelbuilder/ui-ux-pro-max ui-ux-pro-max",
|
|
565
|
+
"superdesigndev/superdesign-skill superdesign",
|
|
566
|
+
"wshobson/agents design-system-patterns"
|
|
567
|
+
],
|
|
568
|
+
marketing: [
|
|
569
|
+
"coreyhaines31/marketingskills seo-audit",
|
|
570
|
+
"coreyhaines31/marketingskills copywriting",
|
|
571
|
+
"coreyhaines31/marketingskills marketing-psychology",
|
|
572
|
+
"coreyhaines31/marketingskills programmatic-seo",
|
|
573
|
+
"coreyhaines31/marketingskills marketing-ideas",
|
|
574
|
+
"coreyhaines31/marketingskills copy-editing",
|
|
575
|
+
"coreyhaines31/marketingskills pricing-strategy",
|
|
576
|
+
"coreyhaines31/marketingskills social-content",
|
|
577
|
+
"coreyhaines31/marketingskills launch-strategy",
|
|
578
|
+
"coreyhaines31/marketingskills page-cro",
|
|
579
|
+
"coreyhaines31/marketingskills competitor-alternatives",
|
|
580
|
+
"coreyhaines31/marketingskills analytics-tracking",
|
|
581
|
+
"coreyhaines31/marketingskills schema-markup",
|
|
582
|
+
"coreyhaines31/marketingskills onboarding-cro",
|
|
583
|
+
"coreyhaines31/marketingskills email-sequence",
|
|
584
|
+
"coreyhaines31/marketingskills paid-ads",
|
|
585
|
+
"coreyhaines31/marketingskills signup-flow-cro",
|
|
586
|
+
"coreyhaines31/marketingskills free-tool-strategy",
|
|
587
|
+
"coreyhaines31/marketingskills form-cro",
|
|
588
|
+
"coreyhaines31/marketingskills paywall-upgrade-cro",
|
|
589
|
+
"coreyhaines31/marketingskills referral-program",
|
|
590
|
+
"coreyhaines31/marketingskills popup-cro",
|
|
591
|
+
"coreyhaines31/marketingskills ab-test-setup"
|
|
592
|
+
],
|
|
593
|
+
development: [
|
|
594
|
+
"obra/superpowers brainstorming",
|
|
595
|
+
"obra/superpowers test-driven-development",
|
|
596
|
+
"obra/superpowers systematic-debugging",
|
|
597
|
+
"obra/superpowers writing-plans",
|
|
598
|
+
"obra/superpowers executing-plans",
|
|
599
|
+
"obra/superpowers verification-before-completion",
|
|
600
|
+
"obra/superpowers using-superpowers",
|
|
601
|
+
"obra/superpowers subagent-driven-development",
|
|
602
|
+
"obra/superpowers requesting-code-review",
|
|
603
|
+
"obra/superpowers writing-skills",
|
|
604
|
+
"obra/superpowers dispatching-parallel-agents",
|
|
605
|
+
"obra/superpowers receiving-code-review",
|
|
606
|
+
"obra/superpowers using-git-worktrees",
|
|
607
|
+
"obra/superpowers finishing-a-development-branch",
|
|
608
|
+
"wshobson/agents code-review-excellence",
|
|
609
|
+
"wshobson/agents api-design-principles",
|
|
610
|
+
"wshobson/agents architecture-patterns",
|
|
611
|
+
"wshobson/agents error-handling-patterns",
|
|
612
|
+
"wshobson/agents nodejs-backend-patterns",
|
|
613
|
+
"wshobson/agents microservices-patterns",
|
|
614
|
+
"wshobson/agents modern-javascript-patterns",
|
|
615
|
+
"wshobson/agents web-component-design",
|
|
616
|
+
"wshobson/agents async-python-patterns",
|
|
617
|
+
"wshobson/agents python-testing-patterns",
|
|
618
|
+
"boristane/agent-skills logging-best-practices"
|
|
619
|
+
],
|
|
620
|
+
productivity: [
|
|
621
|
+
"softaworks/agent-toolkit daily-meeting-update",
|
|
622
|
+
"softaworks/agent-toolkit agent-md-refactor",
|
|
623
|
+
"softaworks/agent-toolkit session-handoff",
|
|
624
|
+
"softaworks/agent-toolkit meme-factory",
|
|
625
|
+
"softaworks/agent-toolkit qa-test-planner",
|
|
626
|
+
"softaworks/agent-toolkit writing-clearly-and-concisely",
|
|
627
|
+
"softaworks/agent-toolkit commit-work",
|
|
628
|
+
"softaworks/agent-toolkit mermaid-diagrams",
|
|
629
|
+
"softaworks/agent-toolkit dependency-updater",
|
|
630
|
+
"softaworks/agent-toolkit crafting-effective-readmes",
|
|
631
|
+
"softaworks/agent-toolkit reducing-entropy",
|
|
632
|
+
"softaworks/agent-toolkit feedback-mastery",
|
|
633
|
+
"softaworks/agent-toolkit marp-slide",
|
|
634
|
+
"softaworks/agent-toolkit professional-communication",
|
|
635
|
+
"softaworks/agent-toolkit difficult-workplace-conversations",
|
|
636
|
+
"anthropics/skills internal-comms",
|
|
637
|
+
"othmanadi/planning-with-files planning-with-files"
|
|
638
|
+
],
|
|
639
|
+
security: [
|
|
640
|
+
"trailofbits/skills semgrep",
|
|
641
|
+
"trailofbits/skills secure-workflow-guide",
|
|
642
|
+
"trailofbits/skills codeql",
|
|
643
|
+
"trailofbits/skills property-based-testing",
|
|
644
|
+
"trailofbits/skills variant-analysis",
|
|
645
|
+
"trailofbits/skills guidelines-advisor",
|
|
646
|
+
"trailofbits/skills sharp-edges",
|
|
647
|
+
"trailofbits/skills differential-review",
|
|
648
|
+
"trailofbits/skills ask-questions-if-underspecified",
|
|
649
|
+
"squirrelscan/skills audit-website"
|
|
650
|
+
],
|
|
651
|
+
mobile: [
|
|
652
|
+
"wshobson/agents mobile-ios-design",
|
|
653
|
+
"wshobson/agents mobile-android-design",
|
|
654
|
+
"dimillian/skills swiftui-ui-patterns",
|
|
655
|
+
"dimillian/skills swiftui-liquid-glass"
|
|
656
|
+
],
|
|
657
|
+
obsidian: [
|
|
658
|
+
"kepano/obsidian-skills obsidian-markdown",
|
|
659
|
+
"kepano/obsidian-skills obsidian-bases",
|
|
660
|
+
"kepano/obsidian-skills json-canvas"
|
|
661
|
+
],
|
|
662
|
+
prompts: [
|
|
663
|
+
"f/awesome-chatgpt-prompts skill-lookup",
|
|
664
|
+
"f/awesome-chatgpt-prompts prompt-lookup",
|
|
665
|
+
"wshobson/agents prompt-engineering-patterns"
|
|
666
|
+
],
|
|
667
|
+
browser: [
|
|
668
|
+
"vercel-labs/agent-browser agent-browser"
|
|
669
|
+
],
|
|
670
|
+
content: [
|
|
671
|
+
"op7418/humanizer-zh humanizer-zh",
|
|
672
|
+
"blader/humanizer humanizer",
|
|
673
|
+
"op7418/youtube-clipper-skill youtube-clipper",
|
|
674
|
+
"jimliu/baoyu-skills baoyu-slide-deck",
|
|
675
|
+
"jimliu/baoyu-skills baoyu-article-illustrator",
|
|
676
|
+
"jimliu/baoyu-skills baoyu-cover-image",
|
|
677
|
+
"jimliu/baoyu-skills baoyu-comic",
|
|
678
|
+
"jimliu/baoyu-skills baoyu-infographic",
|
|
679
|
+
"jimliu/baoyu-skills baoyu-image-gen"
|
|
680
|
+
],
|
|
681
|
+
integrations: [
|
|
682
|
+
"intellectronica/agent-skills context7",
|
|
683
|
+
"softaworks/agent-toolkit gemini",
|
|
684
|
+
"softaworks/agent-toolkit codex"
|
|
685
|
+
]
|
|
686
|
+
};
|
|
687
|
+
async function detectStack(projectDir) {
|
|
688
|
+
const stack = {
|
|
689
|
+
suggestedSkills: [],
|
|
690
|
+
suggestedAgents: ["security", "bugs"],
|
|
691
|
+
dependencies: /* @__PURE__ */ new Set()
|
|
692
|
+
};
|
|
693
|
+
if (existsSync4(join4(projectDir, "tsconfig.json"))) {
|
|
694
|
+
stack.language = "TypeScript";
|
|
695
|
+
stack.suggestedAgents.push("typecheck");
|
|
696
|
+
stack.suggestedSkills.push("wshobson/agents typescript-advanced-types");
|
|
697
|
+
} else if (existsSync4(join4(projectDir, "package.json"))) {
|
|
698
|
+
stack.language = "JavaScript";
|
|
699
|
+
} else if (existsSync4(join4(projectDir, "requirements.txt")) || existsSync4(join4(projectDir, "pyproject.toml"))) {
|
|
700
|
+
stack.language = "Python";
|
|
701
|
+
} else if (existsSync4(join4(projectDir, "go.mod"))) {
|
|
702
|
+
stack.language = "Go";
|
|
703
|
+
} else if (existsSync4(join4(projectDir, "Cargo.toml"))) {
|
|
704
|
+
stack.language = "Rust";
|
|
705
|
+
}
|
|
706
|
+
if (existsSync4(join4(projectDir, "Package.swift")) || existsSync4(join4(projectDir, "project.pbxproj")) || existsSync4(join4(projectDir, "*.xcodeproj"))) {
|
|
707
|
+
stack.language = "Swift";
|
|
708
|
+
stack.suggestedSkills.push("dimillian/skills swiftui-ui-patterns");
|
|
709
|
+
stack.suggestedSkills.push("dimillian/skills swiftui-liquid-glass");
|
|
710
|
+
}
|
|
711
|
+
if (existsSync4(join4(projectDir, "pnpm-lock.yaml"))) {
|
|
712
|
+
stack.packageManager = "pnpm";
|
|
713
|
+
} else if (existsSync4(join4(projectDir, "yarn.lock"))) {
|
|
714
|
+
stack.packageManager = "yarn";
|
|
715
|
+
} else if (existsSync4(join4(projectDir, "bun.lockb"))) {
|
|
716
|
+
stack.packageManager = "bun";
|
|
717
|
+
} else if (existsSync4(join4(projectDir, "package-lock.json"))) {
|
|
718
|
+
stack.packageManager = "npm";
|
|
719
|
+
}
|
|
720
|
+
if (existsSync4(join4(projectDir, ".github", "workflows"))) {
|
|
721
|
+
stack.suggestedSkills.push("wshobson/agents github-actions-templates");
|
|
722
|
+
}
|
|
723
|
+
try {
|
|
724
|
+
const pkgPath = join4(projectDir, "package.json");
|
|
725
|
+
if (existsSync4(pkgPath)) {
|
|
726
|
+
const pkgContent = await readFile3(pkgPath, "utf-8");
|
|
727
|
+
const pkg = JSON.parse(pkgContent);
|
|
728
|
+
const deps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
729
|
+
for (const dep of Object.keys(deps)) {
|
|
730
|
+
stack.dependencies.add(dep);
|
|
731
|
+
}
|
|
732
|
+
for (const dep of Object.keys(deps)) {
|
|
733
|
+
const skills = SKILL_MAPPINGS[dep];
|
|
734
|
+
if (skills) {
|
|
735
|
+
stack.suggestedSkills.push(...skills);
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
if (deps["next"]) {
|
|
739
|
+
stack.framework = `Next.js ${deps["next"].replace("^", "")}`;
|
|
740
|
+
stack.suggestedAgents.push("accessibility", "design");
|
|
741
|
+
} else if (deps["react"]) {
|
|
742
|
+
stack.framework = `React ${deps["react"].replace("^", "")}`;
|
|
743
|
+
stack.suggestedAgents.push("accessibility");
|
|
744
|
+
} else if (deps["vue"]) {
|
|
745
|
+
stack.framework = `Vue ${deps["vue"].replace("^", "")}`;
|
|
746
|
+
} else if (deps["nuxt"]) {
|
|
747
|
+
stack.framework = `Nuxt ${deps["nuxt"].replace("^", "")}`;
|
|
748
|
+
} else if (deps["svelte"]) {
|
|
749
|
+
stack.framework = "Svelte";
|
|
750
|
+
} else if (deps["express"]) {
|
|
751
|
+
stack.framework = "Express.js";
|
|
752
|
+
} else if (deps["fastify"]) {
|
|
753
|
+
stack.framework = "Fastify";
|
|
754
|
+
} else if (deps["hono"]) {
|
|
755
|
+
stack.framework = "Hono";
|
|
756
|
+
} else if (deps["elysia"]) {
|
|
757
|
+
stack.framework = "Elysia";
|
|
758
|
+
} else if (deps["@nestjs/core"]) {
|
|
759
|
+
stack.framework = "NestJS";
|
|
760
|
+
}
|
|
761
|
+
if (deps["next-auth"] || deps["@auth/core"]) {
|
|
762
|
+
stack.auth = "NextAuth.js";
|
|
763
|
+
} else if (deps["passport"]) {
|
|
764
|
+
stack.auth = "Passport.js";
|
|
765
|
+
} else if (deps["@clerk/nextjs"] || deps["@clerk/clerk-react"]) {
|
|
766
|
+
stack.auth = "Clerk";
|
|
767
|
+
} else if (deps["better-auth"]) {
|
|
768
|
+
stack.auth = "Better Auth";
|
|
769
|
+
}
|
|
770
|
+
if (deps["prisma"] || deps["@prisma/client"]) {
|
|
771
|
+
stack.database = "Prisma ORM";
|
|
772
|
+
} else if (deps["drizzle-orm"]) {
|
|
773
|
+
stack.database = "Drizzle ORM";
|
|
774
|
+
} else if (deps["@supabase/supabase-js"]) {
|
|
775
|
+
stack.database = "Supabase";
|
|
776
|
+
} else if (deps["mongoose"]) {
|
|
777
|
+
stack.database = "MongoDB (Mongoose)";
|
|
778
|
+
} else if (deps["pg"]) {
|
|
779
|
+
stack.database = "PostgreSQL";
|
|
780
|
+
} else if (deps["convex"]) {
|
|
781
|
+
stack.database = "Convex";
|
|
782
|
+
}
|
|
783
|
+
if (deps["stripe"] || deps["@stripe/stripe-js"]) {
|
|
784
|
+
stack.suggestedAgents.push("moneybags");
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
} catch {
|
|
788
|
+
}
|
|
789
|
+
if (!stack.database) {
|
|
790
|
+
if (existsSync4(join4(projectDir, "prisma", "schema.prisma"))) {
|
|
791
|
+
stack.database = "Prisma ORM";
|
|
792
|
+
} else if (existsSync4(join4(projectDir, "drizzle.config.ts"))) {
|
|
793
|
+
stack.database = "Drizzle ORM";
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
stack.suggestedSkills = [...new Set(stack.suggestedSkills)];
|
|
797
|
+
stack.suggestedAgents = [...new Set(stack.suggestedAgents)];
|
|
798
|
+
return stack;
|
|
799
|
+
}
|
|
800
|
+
function getSkillsByCategory(category) {
|
|
801
|
+
return SKILL_CATEGORIES[category] || [];
|
|
802
|
+
}
|
|
803
|
+
function getSkillCategories() {
|
|
804
|
+
return Object.entries(SKILL_CATEGORIES).map(([name, skills]) => ({
|
|
805
|
+
name,
|
|
806
|
+
count: skills.length
|
|
807
|
+
}));
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
// src/utils/command-runner.ts
|
|
811
|
+
import { exec, execFile, execSync } from "child_process";
|
|
812
|
+
import { promisify } from "util";
|
|
813
|
+
var execAsync = promisify(exec);
|
|
814
|
+
var execFileAsync = promisify(execFile);
|
|
815
|
+
function redact(text) {
|
|
816
|
+
return text.replace(/\b(AWS|ANTHROPIC|OPENAI|GITHUB)_[A-Z0-9_]*\s*=\s*([^\s"'`]+)/gi, "$1_<REDACTED>=<REDACTED>").replace(/\bBearer\s+[A-Za-z0-9\-._~+/]+=*\b/g, "Bearer <REDACTED>").replace(/\bghp_[A-Za-z0-9]{20,}\b/g, "ghp_<REDACTED>").replace(/\b(?:xox[baprs]-)[A-Za-z0-9-]{10,}\b/g, "<REDACTED_SLACK_TOKEN>").replace(/\bAKIA[0-9A-Z]{16}\b/g, "AKIA<REDACTED>");
|
|
817
|
+
}
|
|
818
|
+
function clampOutput(text, maxChars) {
|
|
819
|
+
if (text.length <= maxChars) return text;
|
|
820
|
+
return text.slice(0, maxChars) + `
|
|
821
|
+
\u2026(truncated ${text.length - maxChars} chars)`;
|
|
822
|
+
}
|
|
823
|
+
function buildCommandRecord(command) {
|
|
824
|
+
return {
|
|
825
|
+
command,
|
|
826
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
827
|
+
};
|
|
828
|
+
}
|
|
829
|
+
async function finalizeAndWrite(entry, cmd, outcome, options) {
|
|
830
|
+
const duration = Date.now() - outcome.startedAt;
|
|
831
|
+
cmd.duration = duration;
|
|
832
|
+
if (outcome.exitCode !== void 0) {
|
|
833
|
+
cmd.exitCode = outcome.exitCode;
|
|
834
|
+
}
|
|
835
|
+
const captureOutput = options?.captureOutput ?? false;
|
|
836
|
+
const redactOutput = options?.redactOutput ?? true;
|
|
837
|
+
const maxOutputChars = options?.maxOutputChars ?? 2e3;
|
|
838
|
+
if (captureOutput) {
|
|
839
|
+
const out = outcome.stdout ?? "";
|
|
840
|
+
const err = outcome.stderr ?? "";
|
|
841
|
+
cmd.stdout = redactOutput ? redact(clampOutput(out, maxOutputChars)) : clampOutput(out, maxOutputChars);
|
|
842
|
+
cmd.stderr = redactOutput ? redact(clampOutput(err, maxOutputChars)) : clampOutput(err, maxOutputChars);
|
|
843
|
+
}
|
|
844
|
+
const completed = completeAuditEntry(entry, outcome.success, outcome.error);
|
|
845
|
+
await logSkillExecution(completed);
|
|
846
|
+
}
|
|
847
|
+
async function runShellCommand(command, audit, options) {
|
|
848
|
+
const startedAt = Date.now();
|
|
849
|
+
const entry = createAuditEntry(audit.actor, audit.source ?? "trie", audit.triggeredBy, audit.targetPath);
|
|
850
|
+
const cmd = buildCommandRecord(command);
|
|
851
|
+
entry.commands?.push(cmd);
|
|
852
|
+
try {
|
|
853
|
+
const { stdout, stderr } = await execAsync(command, {
|
|
854
|
+
cwd: options?.cwd,
|
|
855
|
+
timeout: options?.timeoutMs,
|
|
856
|
+
maxBuffer: options?.maxBuffer
|
|
857
|
+
});
|
|
858
|
+
await finalizeAndWrite(entry, cmd, { success: true, exitCode: 0, stdout, stderr, startedAt }, options);
|
|
859
|
+
return { stdout: stdout ?? "", stderr: stderr ?? "", exitCode: 0 };
|
|
860
|
+
} catch (e) {
|
|
861
|
+
const err = e;
|
|
862
|
+
const stdout = typeof err.stdout === "string" ? err.stdout : "";
|
|
863
|
+
const stderr = typeof err.stderr === "string" ? err.stderr : "";
|
|
864
|
+
const exitCode = typeof err.code === "number" ? err.code : 1;
|
|
865
|
+
await finalizeAndWrite(
|
|
866
|
+
entry,
|
|
867
|
+
cmd,
|
|
868
|
+
{ success: false, exitCode, stdout, stderr, error: err.message, startedAt },
|
|
869
|
+
// Capture output for failures by default (so audits are useful)
|
|
870
|
+
{ ...options, captureOutput: options?.captureOutput ?? true }
|
|
871
|
+
);
|
|
872
|
+
return { stdout, stderr, exitCode };
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
function runShellCommandSync(command, audit, options) {
|
|
876
|
+
const startedAt = Date.now();
|
|
877
|
+
const entry = createAuditEntry(audit.actor, audit.source ?? "trie", audit.triggeredBy, audit.targetPath);
|
|
878
|
+
const cmd = buildCommandRecord(command);
|
|
879
|
+
entry.commands?.push(cmd);
|
|
880
|
+
try {
|
|
881
|
+
const stdout = execSync(command, {
|
|
882
|
+
cwd: options?.cwd,
|
|
883
|
+
timeout: options?.timeoutMs,
|
|
884
|
+
maxBuffer: options?.maxBuffer,
|
|
885
|
+
encoding: "utf-8",
|
|
886
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
887
|
+
});
|
|
888
|
+
void finalizeAndWrite(entry, cmd, { success: true, exitCode: 0, stdout, stderr: "", startedAt }, options);
|
|
889
|
+
return { stdout: stdout ?? "", exitCode: 0 };
|
|
890
|
+
} catch (e) {
|
|
891
|
+
const err = e;
|
|
892
|
+
const stdout = typeof err.stdout === "string" ? err.stdout : "";
|
|
893
|
+
const stderr = typeof err.stderr === "string" ? err.stderr : "";
|
|
894
|
+
const exitCode = typeof err.status === "number" ? err.status : 1;
|
|
895
|
+
void finalizeAndWrite(
|
|
896
|
+
entry,
|
|
897
|
+
cmd,
|
|
898
|
+
{ success: false, exitCode, stdout, stderr, error: err.message, startedAt },
|
|
899
|
+
{ ...options, captureOutput: options?.captureOutput ?? true }
|
|
900
|
+
);
|
|
901
|
+
return { stdout, exitCode };
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
async function runExecFile(file, args, audit, options) {
|
|
905
|
+
const startedAt = Date.now();
|
|
906
|
+
const command = [file, ...args].join(" ");
|
|
907
|
+
const entry = createAuditEntry(audit.actor, audit.source ?? "trie", audit.triggeredBy, audit.targetPath);
|
|
908
|
+
const cmd = buildCommandRecord(command);
|
|
909
|
+
entry.commands?.push(cmd);
|
|
910
|
+
try {
|
|
911
|
+
const { stdout, stderr } = await execFileAsync(file, args, {
|
|
912
|
+
cwd: options?.cwd,
|
|
913
|
+
timeout: options?.timeoutMs,
|
|
914
|
+
maxBuffer: options?.maxBuffer
|
|
915
|
+
});
|
|
916
|
+
await finalizeAndWrite(entry, cmd, { success: true, exitCode: 0, stdout: String(stdout ?? ""), stderr: String(stderr ?? ""), startedAt }, options);
|
|
917
|
+
return { stdout: String(stdout ?? ""), stderr: String(stderr ?? ""), exitCode: 0 };
|
|
918
|
+
} catch (e) {
|
|
919
|
+
const err = e;
|
|
920
|
+
const stdout = typeof err.stdout === "string" ? err.stdout : "";
|
|
921
|
+
const stderr = typeof err.stderr === "string" ? err.stderr : "";
|
|
922
|
+
const exitCode = typeof err.code === "number" ? err.code : 1;
|
|
923
|
+
await finalizeAndWrite(
|
|
924
|
+
entry,
|
|
925
|
+
cmd,
|
|
926
|
+
{ success: false, exitCode, stdout, stderr, error: err.message, startedAt },
|
|
927
|
+
{ ...options, captureOutput: options?.captureOutput ?? true }
|
|
928
|
+
);
|
|
929
|
+
return { stdout, stderr, exitCode };
|
|
930
|
+
}
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
export {
|
|
934
|
+
formatAuditLog,
|
|
935
|
+
getAuditStatistics,
|
|
936
|
+
getRecentAuditLogs,
|
|
937
|
+
getSkillAuditLogs,
|
|
938
|
+
runShellCommand,
|
|
939
|
+
runShellCommandSync,
|
|
940
|
+
runExecFile,
|
|
941
|
+
detectStack,
|
|
942
|
+
getSkillsByCategory,
|
|
943
|
+
getSkillCategories,
|
|
944
|
+
projectInfoExists,
|
|
945
|
+
loadProjectInfo,
|
|
946
|
+
initProjectInfo,
|
|
947
|
+
getProjectSection,
|
|
948
|
+
updateProjectSection,
|
|
949
|
+
appendToSection,
|
|
950
|
+
getProjectSections,
|
|
951
|
+
getProjectInfoStructured,
|
|
952
|
+
loadContextState,
|
|
953
|
+
getContextForAI,
|
|
954
|
+
isTrieInitialized
|
|
955
|
+
};
|
|
956
|
+
//# sourceMappingURL=chunk-HSNE46VE.js.map
|