@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.
Files changed (41) hide show
  1. package/README.md +545 -406
  2. package/dist/agent-smith-BECRZH73.js +12 -0
  3. package/dist/{agent-smith-runner-ZTDCJJQG.js → agent-smith-runner-LZRXM2Q2.js} +7 -7
  4. package/dist/agent-smith-runner-LZRXM2Q2.js.map +1 -0
  5. package/dist/{chunk-KQOMSIVR.js → chunk-A43476GB.js} +13 -9
  6. package/dist/chunk-A43476GB.js.map +1 -0
  7. package/dist/{chunk-IMFD4SJC.js → chunk-ASGSTVVF.js} +1 -1
  8. package/dist/chunk-ASGSTVVF.js.map +1 -0
  9. package/dist/chunk-C3AS5OXW.js +1177 -0
  10. package/dist/chunk-C3AS5OXW.js.map +1 -0
  11. package/dist/chunk-IEFAQFDQ.js +2061 -0
  12. package/dist/chunk-IEFAQFDQ.js.map +1 -0
  13. package/dist/{chunk-GLC62PGD.js → chunk-KB5ZN6K2.js} +2 -2
  14. package/dist/{chunk-VZYCZXEQ.js → chunk-TOE75CFZ.js} +2034 -391
  15. package/dist/chunk-TOE75CFZ.js.map +1 -0
  16. package/dist/{chunk-JDICQHNT.js → chunk-YKUCIKTU.js} +171 -1245
  17. package/dist/chunk-YKUCIKTU.js.map +1 -0
  18. package/dist/cli/create-agent.js +2 -2
  19. package/dist/cli/main.js +428 -71
  20. package/dist/cli/main.js.map +1 -1
  21. package/dist/cli/yolo-daemon.js +32 -20
  22. package/dist/cli/yolo-daemon.js.map +1 -1
  23. package/dist/comprehension-46F7ZNKL.js +821 -0
  24. package/dist/comprehension-46F7ZNKL.js.map +1 -0
  25. package/dist/index.js +478 -122
  26. package/dist/index.js.map +1 -1
  27. package/dist/workers/agent-worker.js +11 -11
  28. package/dist/workers/agent-worker.js.map +1 -1
  29. package/package.json +3 -1
  30. package/dist/agent-smith-5QOZXLMV.js +0 -11
  31. package/dist/agent-smith-runner-ZTDCJJQG.js.map +0 -1
  32. package/dist/chunk-6T7S77U7.js +0 -852
  33. package/dist/chunk-6T7S77U7.js.map +0 -1
  34. package/dist/chunk-IMFD4SJC.js.map +0 -1
  35. package/dist/chunk-JDICQHNT.js.map +0 -1
  36. package/dist/chunk-KQOMSIVR.js.map +0 -1
  37. package/dist/chunk-PZDQIFKO.js +0 -1598
  38. package/dist/chunk-PZDQIFKO.js.map +0 -1
  39. package/dist/chunk-VZYCZXEQ.js.map +0 -1
  40. /package/dist/{agent-smith-5QOZXLMV.js.map → agent-smith-BECRZH73.js.map} +0 -0
  41. /package/dist/{chunk-GLC62PGD.js.map → chunk-KB5ZN6K2.js.map} +0 -0
@@ -1,852 +0,0 @@
1
- import {
2
- getWorkingDirectory
3
- } from "./chunk-IMFD4SJC.js";
4
-
5
- // src/cli/checkpoint.ts
6
- import { existsSync } from "fs";
7
- import { mkdir, writeFile, readFile } from "fs/promises";
8
- import { join } from "path";
9
- async function saveCheckpoint(options) {
10
- const workDir = options.workDir || getWorkingDirectory(void 0, true);
11
- const trieDir = join(workDir, ".trie");
12
- const checkpointPath = join(trieDir, "checkpoints.json");
13
- await mkdir(trieDir, { recursive: true });
14
- let log = { checkpoints: [] };
15
- try {
16
- if (existsSync(checkpointPath)) {
17
- log = JSON.parse(await readFile(checkpointPath, "utf-8"));
18
- }
19
- } catch {
20
- log = { checkpoints: [] };
21
- }
22
- const checkpoint = {
23
- id: `cp-${Date.now().toString(36)}`,
24
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
25
- message: options.message,
26
- files: options.files || [],
27
- notes: options.notes,
28
- createdBy: options.createdBy || "cli"
29
- };
30
- log.checkpoints.push(checkpoint);
31
- log.lastCheckpoint = checkpoint.id;
32
- if (log.checkpoints.length > 50) {
33
- log.checkpoints = log.checkpoints.slice(-50);
34
- }
35
- await writeFile(checkpointPath, JSON.stringify(log, null, 2));
36
- await updateAgentsMdWithCheckpoint(checkpoint, workDir);
37
- return checkpoint;
38
- }
39
- async function listCheckpoints(workDir) {
40
- const dir = workDir || getWorkingDirectory(void 0, true);
41
- const checkpointPath = join(dir, ".trie", "checkpoints.json");
42
- try {
43
- if (existsSync(checkpointPath)) {
44
- const log = JSON.parse(await readFile(checkpointPath, "utf-8"));
45
- return log.checkpoints;
46
- }
47
- } catch {
48
- }
49
- return [];
50
- }
51
- async function getLastCheckpoint(workDir) {
52
- const checkpoints = await listCheckpoints(workDir);
53
- return checkpoints.length > 0 ? checkpoints[checkpoints.length - 1] : null;
54
- }
55
- async function updateAgentsMdWithCheckpoint(checkpoint, workDir) {
56
- const agentsPath = join(workDir, ".trie", "AGENTS.md");
57
- let content = "";
58
- try {
59
- if (existsSync(agentsPath)) {
60
- content = await readFile(agentsPath, "utf-8");
61
- }
62
- } catch {
63
- content = "";
64
- }
65
- const checkpointSection = `
66
- ## Last Checkpoint
67
-
68
- - **ID:** ${checkpoint.id}
69
- - **Time:** ${checkpoint.timestamp}
70
- ${checkpoint.message ? `- **Message:** ${checkpoint.message}` : ""}
71
- ${checkpoint.files.length > 0 ? `- **Files:** ${checkpoint.files.length} files` : ""}
72
- ${checkpoint.notes ? `- **Notes:** ${checkpoint.notes}` : ""}
73
- `;
74
- const checkpointRegex = /## Last Checkpoint[\s\S]*?(?=\n## |\n---|\Z)/;
75
- if (checkpointRegex.test(content)) {
76
- content = content.replace(checkpointRegex, checkpointSection.trim());
77
- } else {
78
- content = content.trim() + "\n\n" + checkpointSection.trim() + "\n";
79
- }
80
- await writeFile(agentsPath, content);
81
- }
82
- async function handleCheckpointCommand(args) {
83
- const subcommand = args[0] || "save";
84
- switch (subcommand) {
85
- case "save": {
86
- let message;
87
- let notes;
88
- const files = [];
89
- for (let i = 1; i < args.length; i++) {
90
- if (args[i] === "-m" || args[i] === "--message") {
91
- message = args[++i];
92
- } else if (args[i] === "-n" || args[i] === "--notes") {
93
- notes = args[++i];
94
- } else if (args[i] === "-f" || args[i] === "--file") {
95
- files.push(args[++i]);
96
- } else if (!args[i].startsWith("-")) {
97
- message = args[i];
98
- }
99
- }
100
- const checkpoint = await saveCheckpoint({ message, files, notes });
101
- console.log("\n Checkpoint saved\n");
102
- console.log(` ID: ${checkpoint.id}`);
103
- console.log(` Time: ${checkpoint.timestamp}`);
104
- if (checkpoint.message) {
105
- console.log(` Message: ${checkpoint.message}`);
106
- }
107
- if (checkpoint.files.length > 0) {
108
- console.log(` Files: ${checkpoint.files.join(", ")}`);
109
- }
110
- console.log("\n Context saved to .trie/\n");
111
- break;
112
- }
113
- case "list": {
114
- const checkpoints = await listCheckpoints();
115
- if (checkpoints.length === 0) {
116
- console.log("\n No checkpoints yet. Run `trie checkpoint` to save one.\n");
117
- return;
118
- }
119
- console.log("\n Checkpoints:\n");
120
- for (const cp of checkpoints.slice(-10).reverse()) {
121
- const date = new Date(cp.timestamp).toLocaleString();
122
- console.log(` ${cp.id} ${date} ${cp.message || "(no message)"}`);
123
- }
124
- console.log("");
125
- break;
126
- }
127
- case "last": {
128
- const checkpoint = await getLastCheckpoint();
129
- if (!checkpoint) {
130
- console.log("\n No checkpoints yet. Run `trie checkpoint` to save one.\n");
131
- return;
132
- }
133
- console.log("\n Last Checkpoint:\n");
134
- console.log(` ID: ${checkpoint.id}`);
135
- console.log(` Time: ${new Date(checkpoint.timestamp).toLocaleString()}`);
136
- if (checkpoint.message) {
137
- console.log(` Message: ${checkpoint.message}`);
138
- }
139
- if (checkpoint.notes) {
140
- console.log(` Notes: ${checkpoint.notes}`);
141
- }
142
- if (checkpoint.files.length > 0) {
143
- console.log(` Files: ${checkpoint.files.join(", ")}`);
144
- }
145
- console.log("");
146
- break;
147
- }
148
- default:
149
- console.log(`
150
- Usage: trie checkpoint [command] [options]
151
-
152
- Commands:
153
- save [message] Save a checkpoint (default)
154
- list List recent checkpoints
155
- last Show the last checkpoint
156
-
157
- Options:
158
- -m, --message Checkpoint message
159
- -n, --notes Additional notes
160
- -f, --file File to include (can be repeated)
161
-
162
- Examples:
163
- trie checkpoint "finished auth flow"
164
- trie checkpoint save -m "WIP: payment integration" -n "needs testing"
165
- trie checkpoint list
166
- `);
167
- }
168
- }
169
-
170
- // src/bootstrap/stack-detector.ts
171
- import { readFile as readFile2 } from "fs/promises";
172
- import { existsSync as existsSync2 } from "fs";
173
- import { join as join2 } from "path";
174
- var SKILL_MAPPINGS = {
175
- // Frontend Frameworks - React/Next.js
176
- "next": [
177
- "vercel-labs/agent-skills vercel-react-best-practices",
178
- "vercel-labs/agent-skills web-design-guidelines",
179
- "anthropics/skills frontend-design",
180
- "wshobson/agents nextjs-app-router-patterns"
181
- ],
182
- "react": [
183
- "vercel-labs/agent-skills vercel-react-best-practices",
184
- "anthropics/skills frontend-design",
185
- "wshobson/agents react-state-management"
186
- ],
187
- // Vue/Nuxt Ecosystem
188
- "vue": [
189
- "hyf0/vue-skills vue-best-practices",
190
- "hyf0/vue-skills pinia-best-practices",
191
- "hyf0/vue-skills vueuse-best-practices",
192
- "onmax/nuxt-skills vue"
193
- ],
194
- "nuxt": [
195
- "onmax/nuxt-skills nuxt",
196
- "onmax/nuxt-skills nuxt-ui",
197
- "onmax/nuxt-skills nuxt-content",
198
- "onmax/nuxt-skills nuxt-modules",
199
- "onmax/nuxt-skills nuxt-better-auth",
200
- "onmax/nuxt-skills nuxthub"
201
- ],
202
- "pinia": [
203
- "hyf0/vue-skills pinia-best-practices"
204
- ],
205
- "@vueuse/core": [
206
- "hyf0/vue-skills vueuse-best-practices",
207
- "onmax/nuxt-skills vueuse"
208
- ],
209
- // Mobile - Expo
210
- "expo": [
211
- "expo/skills building-native-ui",
212
- "expo/skills upgrading-expo",
213
- "expo/skills native-data-fetching",
214
- "expo/skills expo-dev-client",
215
- "expo/skills expo-deployment",
216
- "expo/skills expo-api-routes",
217
- "expo/skills expo-tailwind-setup",
218
- "expo/skills expo-cicd-workflows",
219
- "expo/skills use-dom"
220
- ],
221
- // Mobile - React Native
222
- "react-native": [
223
- "callstackincubator/agent-skills react-native-best-practices",
224
- "wshobson/agents react-native-architecture"
225
- ],
226
- // Backend Frameworks
227
- "@nestjs/core": [
228
- "kadajett/agent-nestjs-skills nestjs-best-practices"
229
- ],
230
- "nestjs": [
231
- "kadajett/agent-nestjs-skills nestjs-best-practices"
232
- ],
233
- "elysia": [
234
- "elysiajs/skills elysiajs"
235
- ],
236
- "hono": [
237
- "elysiajs/skills elysiajs"
238
- ],
239
- // Database/BaaS
240
- "@supabase/supabase-js": [
241
- "supabase/agent-skills supabase-postgres-best-practices"
242
- ],
243
- "convex": [
244
- "waynesutton/convexskills convex-best-practices"
245
- ],
246
- "pg": [
247
- "wshobson/agents postgresql-table-design"
248
- ],
249
- "postgres": [
250
- "wshobson/agents postgresql-table-design"
251
- ],
252
- // Auth
253
- "better-auth": [
254
- "better-auth/skills better-auth-best-practices",
255
- "better-auth/skills create-auth-skill"
256
- ],
257
- // Payments
258
- "stripe": [
259
- "stripe/ai stripe-best-practices"
260
- ],
261
- "@stripe/stripe-js": [
262
- "stripe/ai stripe-best-practices"
263
- ],
264
- // Media/Graphics
265
- "remotion": [
266
- "remotion-dev/skills remotion-best-practices"
267
- ],
268
- "three": [
269
- "cloudai-x/threejs-skills threejs-fundamentals",
270
- "cloudai-x/threejs-skills threejs-animation",
271
- "cloudai-x/threejs-skills threejs-materials",
272
- "cloudai-x/threejs-skills threejs-shaders",
273
- "cloudai-x/threejs-skills threejs-lighting",
274
- "cloudai-x/threejs-skills threejs-geometry",
275
- "cloudai-x/threejs-skills threejs-textures",
276
- "cloudai-x/threejs-skills threejs-loaders",
277
- "cloudai-x/threejs-skills threejs-interaction",
278
- "cloudai-x/threejs-skills threejs-postprocessing"
279
- ],
280
- // UI Libraries
281
- "tailwindcss": [
282
- "wshobson/agents tailwind-design-system",
283
- "jezweb/claude-skills tailwind-v4-shadcn",
284
- "wshobson/agents responsive-design"
285
- ],
286
- "@shadcn/ui": [
287
- "giuseppe-trisciuoglio/developer-kit shadcn-ui"
288
- ],
289
- "shadcn": [
290
- "giuseppe-trisciuoglio/developer-kit shadcn-ui"
291
- ],
292
- "@radix-ui/react-slot": [
293
- "onmax/nuxt-skills reka-ui"
294
- ],
295
- // State Management
296
- "@tanstack/react-query": [
297
- "jezweb/claude-skills tanstack-query"
298
- ],
299
- // Testing
300
- "playwright": [
301
- "anthropics/skills webapp-testing",
302
- "wshobson/agents e2e-testing-patterns"
303
- ],
304
- "puppeteer": [
305
- "anthropics/skills webapp-testing"
306
- ],
307
- "vitest": [
308
- "wshobson/agents e2e-testing-patterns"
309
- ],
310
- "jest": [
311
- "wshobson/agents e2e-testing-patterns"
312
- ],
313
- // DevTools/MCP
314
- "@modelcontextprotocol/sdk": [
315
- "anthropics/skills mcp-builder"
316
- ],
317
- // Security
318
- "semgrep": [
319
- "trailofbits/skills semgrep"
320
- ],
321
- // Monorepos
322
- "turbo": [
323
- "wshobson/agents monorepo-management"
324
- ],
325
- "nx": [
326
- "wshobson/agents monorepo-management"
327
- ],
328
- "lerna": [
329
- "wshobson/agents monorepo-management"
330
- ],
331
- // TypeScript (handled separately based on tsconfig.json)
332
- "typescript": [
333
- "wshobson/agents typescript-advanced-types"
334
- ]
335
- };
336
- var SKILL_CATEGORIES = {
337
- documents: [
338
- "anthropics/skills pdf",
339
- "anthropics/skills xlsx",
340
- "anthropics/skills pptx",
341
- "anthropics/skills docx",
342
- "anthropics/skills doc-coauthoring"
343
- ],
344
- design: [
345
- "anthropics/skills canvas-design",
346
- "anthropics/skills theme-factory",
347
- "anthropics/skills web-artifacts-builder",
348
- "anthropics/skills algorithmic-art",
349
- "anthropics/skills brand-guidelines",
350
- "anthropics/skills slack-gif-creator",
351
- "nextlevelbuilder/ui-ux-pro-max ui-ux-pro-max",
352
- "superdesigndev/superdesign-skill superdesign",
353
- "wshobson/agents design-system-patterns"
354
- ],
355
- marketing: [
356
- "coreyhaines31/marketingskills seo-audit",
357
- "coreyhaines31/marketingskills copywriting",
358
- "coreyhaines31/marketingskills marketing-psychology",
359
- "coreyhaines31/marketingskills programmatic-seo",
360
- "coreyhaines31/marketingskills marketing-ideas",
361
- "coreyhaines31/marketingskills copy-editing",
362
- "coreyhaines31/marketingskills pricing-strategy",
363
- "coreyhaines31/marketingskills social-content",
364
- "coreyhaines31/marketingskills launch-strategy",
365
- "coreyhaines31/marketingskills page-cro",
366
- "coreyhaines31/marketingskills competitor-alternatives",
367
- "coreyhaines31/marketingskills analytics-tracking",
368
- "coreyhaines31/marketingskills schema-markup",
369
- "coreyhaines31/marketingskills onboarding-cro",
370
- "coreyhaines31/marketingskills email-sequence",
371
- "coreyhaines31/marketingskills paid-ads",
372
- "coreyhaines31/marketingskills signup-flow-cro",
373
- "coreyhaines31/marketingskills free-tool-strategy",
374
- "coreyhaines31/marketingskills form-cro",
375
- "coreyhaines31/marketingskills paywall-upgrade-cro",
376
- "coreyhaines31/marketingskills referral-program",
377
- "coreyhaines31/marketingskills popup-cro",
378
- "coreyhaines31/marketingskills ab-test-setup"
379
- ],
380
- development: [
381
- "obra/superpowers brainstorming",
382
- "obra/superpowers test-driven-development",
383
- "obra/superpowers systematic-debugging",
384
- "obra/superpowers writing-plans",
385
- "obra/superpowers executing-plans",
386
- "obra/superpowers verification-before-completion",
387
- "obra/superpowers using-superpowers",
388
- "obra/superpowers subagent-driven-development",
389
- "obra/superpowers requesting-code-review",
390
- "obra/superpowers writing-skills",
391
- "obra/superpowers dispatching-parallel-agents",
392
- "obra/superpowers receiving-code-review",
393
- "obra/superpowers using-git-worktrees",
394
- "obra/superpowers finishing-a-development-branch",
395
- "wshobson/agents code-review-excellence",
396
- "wshobson/agents api-design-principles",
397
- "wshobson/agents architecture-patterns",
398
- "wshobson/agents error-handling-patterns",
399
- "wshobson/agents nodejs-backend-patterns",
400
- "wshobson/agents microservices-patterns",
401
- "wshobson/agents modern-javascript-patterns",
402
- "wshobson/agents web-component-design",
403
- "wshobson/agents async-python-patterns",
404
- "wshobson/agents python-testing-patterns",
405
- "boristane/agent-skills logging-best-practices"
406
- ],
407
- productivity: [
408
- "softaworks/agent-toolkit daily-meeting-update",
409
- "softaworks/agent-toolkit agent-md-refactor",
410
- "softaworks/agent-toolkit session-handoff",
411
- "softaworks/agent-toolkit meme-factory",
412
- "softaworks/agent-toolkit qa-test-planner",
413
- "softaworks/agent-toolkit writing-clearly-and-concisely",
414
- "softaworks/agent-toolkit commit-work",
415
- "softaworks/agent-toolkit mermaid-diagrams",
416
- "softaworks/agent-toolkit dependency-updater",
417
- "softaworks/agent-toolkit crafting-effective-readmes",
418
- "softaworks/agent-toolkit reducing-entropy",
419
- "softaworks/agent-toolkit feedback-mastery",
420
- "softaworks/agent-toolkit marp-slide",
421
- "softaworks/agent-toolkit professional-communication",
422
- "softaworks/agent-toolkit difficult-workplace-conversations",
423
- "anthropics/skills internal-comms",
424
- "othmanadi/planning-with-files planning-with-files"
425
- ],
426
- security: [
427
- "trailofbits/skills semgrep",
428
- "trailofbits/skills secure-workflow-guide",
429
- "trailofbits/skills codeql",
430
- "trailofbits/skills property-based-testing",
431
- "trailofbits/skills variant-analysis",
432
- "trailofbits/skills guidelines-advisor",
433
- "trailofbits/skills sharp-edges",
434
- "trailofbits/skills differential-review",
435
- "trailofbits/skills ask-questions-if-underspecified",
436
- "squirrelscan/skills audit-website"
437
- ],
438
- mobile: [
439
- "wshobson/agents mobile-ios-design",
440
- "wshobson/agents mobile-android-design",
441
- "dimillian/skills swiftui-ui-patterns",
442
- "dimillian/skills swiftui-liquid-glass"
443
- ],
444
- obsidian: [
445
- "kepano/obsidian-skills obsidian-markdown",
446
- "kepano/obsidian-skills obsidian-bases",
447
- "kepano/obsidian-skills json-canvas"
448
- ],
449
- prompts: [
450
- "f/awesome-chatgpt-prompts skill-lookup",
451
- "f/awesome-chatgpt-prompts prompt-lookup",
452
- "wshobson/agents prompt-engineering-patterns"
453
- ],
454
- browser: [
455
- "vercel-labs/agent-browser agent-browser"
456
- ],
457
- content: [
458
- "op7418/humanizer-zh humanizer-zh",
459
- "blader/humanizer humanizer",
460
- "op7418/youtube-clipper-skill youtube-clipper",
461
- "jimliu/baoyu-skills baoyu-slide-deck",
462
- "jimliu/baoyu-skills baoyu-article-illustrator",
463
- "jimliu/baoyu-skills baoyu-cover-image",
464
- "jimliu/baoyu-skills baoyu-comic",
465
- "jimliu/baoyu-skills baoyu-infographic",
466
- "jimliu/baoyu-skills baoyu-image-gen"
467
- ],
468
- integrations: [
469
- "intellectronica/agent-skills context7",
470
- "softaworks/agent-toolkit gemini",
471
- "softaworks/agent-toolkit codex"
472
- ]
473
- };
474
- async function detectStack(projectDir) {
475
- const stack = {
476
- suggestedSkills: [],
477
- suggestedAgents: ["security", "privacy", "bugs"],
478
- dependencies: /* @__PURE__ */ new Set()
479
- };
480
- if (existsSync2(join2(projectDir, "tsconfig.json"))) {
481
- stack.language = "TypeScript";
482
- stack.suggestedAgents.push("typecheck");
483
- stack.suggestedSkills.push("wshobson/agents typescript-advanced-types");
484
- } else if (existsSync2(join2(projectDir, "package.json"))) {
485
- stack.language = "JavaScript";
486
- } else if (existsSync2(join2(projectDir, "requirements.txt")) || existsSync2(join2(projectDir, "pyproject.toml"))) {
487
- stack.language = "Python";
488
- } else if (existsSync2(join2(projectDir, "go.mod"))) {
489
- stack.language = "Go";
490
- } else if (existsSync2(join2(projectDir, "Cargo.toml"))) {
491
- stack.language = "Rust";
492
- }
493
- if (existsSync2(join2(projectDir, "Package.swift")) || existsSync2(join2(projectDir, "project.pbxproj")) || existsSync2(join2(projectDir, "*.xcodeproj"))) {
494
- stack.language = "Swift";
495
- stack.suggestedSkills.push("dimillian/skills swiftui-ui-patterns");
496
- stack.suggestedSkills.push("dimillian/skills swiftui-liquid-glass");
497
- }
498
- if (existsSync2(join2(projectDir, "pnpm-lock.yaml"))) {
499
- stack.packageManager = "pnpm";
500
- } else if (existsSync2(join2(projectDir, "yarn.lock"))) {
501
- stack.packageManager = "yarn";
502
- } else if (existsSync2(join2(projectDir, "bun.lockb"))) {
503
- stack.packageManager = "bun";
504
- } else if (existsSync2(join2(projectDir, "package-lock.json"))) {
505
- stack.packageManager = "npm";
506
- }
507
- if (existsSync2(join2(projectDir, ".github", "workflows"))) {
508
- stack.suggestedSkills.push("wshobson/agents github-actions-templates");
509
- }
510
- try {
511
- const pkgPath = join2(projectDir, "package.json");
512
- if (existsSync2(pkgPath)) {
513
- const pkgContent = await readFile2(pkgPath, "utf-8");
514
- const pkg = JSON.parse(pkgContent);
515
- const deps = { ...pkg.dependencies, ...pkg.devDependencies };
516
- for (const dep of Object.keys(deps)) {
517
- stack.dependencies.add(dep);
518
- }
519
- for (const dep of Object.keys(deps)) {
520
- const skills = SKILL_MAPPINGS[dep];
521
- if (skills) {
522
- stack.suggestedSkills.push(...skills);
523
- }
524
- }
525
- if (deps["next"]) {
526
- stack.framework = `Next.js ${deps["next"].replace("^", "")}`;
527
- stack.suggestedAgents.push("accessibility", "design");
528
- } else if (deps["react"]) {
529
- stack.framework = `React ${deps["react"].replace("^", "")}`;
530
- stack.suggestedAgents.push("accessibility");
531
- } else if (deps["vue"]) {
532
- stack.framework = `Vue ${deps["vue"].replace("^", "")}`;
533
- } else if (deps["nuxt"]) {
534
- stack.framework = `Nuxt ${deps["nuxt"].replace("^", "")}`;
535
- } else if (deps["svelte"]) {
536
- stack.framework = "Svelte";
537
- } else if (deps["express"]) {
538
- stack.framework = "Express.js";
539
- } else if (deps["fastify"]) {
540
- stack.framework = "Fastify";
541
- } else if (deps["hono"]) {
542
- stack.framework = "Hono";
543
- } else if (deps["elysia"]) {
544
- stack.framework = "Elysia";
545
- } else if (deps["@nestjs/core"]) {
546
- stack.framework = "NestJS";
547
- }
548
- if (deps["next-auth"] || deps["@auth/core"]) {
549
- stack.auth = "NextAuth.js";
550
- } else if (deps["passport"]) {
551
- stack.auth = "Passport.js";
552
- } else if (deps["@clerk/nextjs"] || deps["@clerk/clerk-react"]) {
553
- stack.auth = "Clerk";
554
- } else if (deps["better-auth"]) {
555
- stack.auth = "Better Auth";
556
- }
557
- if (deps["prisma"] || deps["@prisma/client"]) {
558
- stack.database = "Prisma ORM";
559
- } else if (deps["drizzle-orm"]) {
560
- stack.database = "Drizzle ORM";
561
- } else if (deps["@supabase/supabase-js"]) {
562
- stack.database = "Supabase";
563
- } else if (deps["mongoose"]) {
564
- stack.database = "MongoDB (Mongoose)";
565
- } else if (deps["pg"]) {
566
- stack.database = "PostgreSQL";
567
- } else if (deps["convex"]) {
568
- stack.database = "Convex";
569
- }
570
- if (deps["stripe"] || deps["@stripe/stripe-js"]) {
571
- stack.suggestedAgents.push("moneybags");
572
- }
573
- }
574
- } catch {
575
- }
576
- if (!stack.database) {
577
- if (existsSync2(join2(projectDir, "prisma", "schema.prisma"))) {
578
- stack.database = "Prisma ORM";
579
- } else if (existsSync2(join2(projectDir, "drizzle.config.ts"))) {
580
- stack.database = "Drizzle ORM";
581
- }
582
- }
583
- stack.suggestedSkills = [...new Set(stack.suggestedSkills)];
584
- stack.suggestedAgents = [...new Set(stack.suggestedAgents)];
585
- return stack;
586
- }
587
- function getSkillsByCategory(category) {
588
- return SKILL_CATEGORIES[category] || [];
589
- }
590
- function getSkillCategories() {
591
- return Object.entries(SKILL_CATEGORIES).map(([name, skills]) => ({
592
- name,
593
- count: skills.length
594
- }));
595
- }
596
-
597
- // src/bootstrap/files.ts
598
- import { readFile as readFile3, writeFile as writeFile2, unlink, mkdir as mkdir2 } from "fs/promises";
599
- import { existsSync as existsSync3 } from "fs";
600
- import { join as join3 } from "path";
601
- var BOOTSTRAP_FILES = [
602
- { name: "PROJECT.md", type: "user", description: "Project overview and conventions" },
603
- { name: "RULES.md", type: "user", description: "Coding standards agents enforce" },
604
- { name: "TEAM.md", type: "user", description: "Team ownership and escalation" },
605
- { name: "BOOTSTRAP.md", type: "one-time", description: "First-run setup (deleted after)" },
606
- { name: "AGENTS.md", type: "auto", description: "Auto-generated scan context" }
607
- ];
608
- async function loadBootstrapContext(workDir) {
609
- const projectDir = workDir || getWorkingDirectory(void 0, true);
610
- const trieDir = join3(projectDir, ".trie");
611
- const files = [];
612
- const contentParts = [];
613
- let needsBootstrap2 = false;
614
- for (const file of BOOTSTRAP_FILES) {
615
- const filePath = join3(trieDir, file.name);
616
- const exists = existsSync3(filePath);
617
- if (file.name === "BOOTSTRAP.md" && exists) {
618
- needsBootstrap2 = true;
619
- }
620
- let content;
621
- if (exists) {
622
- try {
623
- content = await readFile3(filePath, "utf-8");
624
- if (content.trim() && file.type !== "one-time") {
625
- contentParts.push(`<!-- ${file.name} -->
626
- ${content}`);
627
- }
628
- } catch {
629
- }
630
- }
631
- files.push({
632
- name: file.name,
633
- path: filePath,
634
- type: file.type,
635
- exists,
636
- content
637
- });
638
- }
639
- return {
640
- files,
641
- injectedContent: contentParts.join("\n\n---\n\n"),
642
- needsBootstrap: needsBootstrap2
643
- };
644
- }
645
- async function initializeBootstrapFiles(options = {}) {
646
- const projectDir = options.workDir || getWorkingDirectory(void 0, true);
647
- const trieDir = join3(projectDir, ".trie");
648
- await mkdir2(trieDir, { recursive: true });
649
- const created = [];
650
- const skipped = [];
651
- const stack = await detectStack(projectDir);
652
- for (const file of BOOTSTRAP_FILES) {
653
- const filePath = join3(trieDir, file.name);
654
- const exists = existsSync3(filePath);
655
- if (exists && !options.force) {
656
- skipped.push(file.name);
657
- continue;
658
- }
659
- if (file.name === "BOOTSTRAP.md" && options.skipBootstrap) {
660
- skipped.push(file.name);
661
- continue;
662
- }
663
- if (file.name === "AGENTS.md") {
664
- skipped.push(file.name);
665
- continue;
666
- }
667
- const template = getFileTemplate(file.name, stack);
668
- if (template) {
669
- await writeFile2(filePath, template);
670
- created.push(file.name);
671
- }
672
- }
673
- return { created, skipped, stack };
674
- }
675
- async function completeBootstrap(workDir) {
676
- const projectDir = workDir || getWorkingDirectory(void 0, true);
677
- const bootstrapPath = join3(projectDir, ".trie", "BOOTSTRAP.md");
678
- try {
679
- await unlink(bootstrapPath);
680
- return true;
681
- } catch {
682
- return false;
683
- }
684
- }
685
- function needsBootstrap(workDir) {
686
- const projectDir = workDir || getWorkingDirectory(void 0, true);
687
- const bootstrapPath = join3(projectDir, ".trie", "BOOTSTRAP.md");
688
- return existsSync3(bootstrapPath);
689
- }
690
- async function loadRules(workDir) {
691
- const projectDir = workDir || getWorkingDirectory(void 0, true);
692
- const rulesPath = join3(projectDir, ".trie", "RULES.md");
693
- try {
694
- if (existsSync3(rulesPath)) {
695
- return await readFile3(rulesPath, "utf-8");
696
- }
697
- } catch {
698
- }
699
- return null;
700
- }
701
- async function loadTeamInfo(workDir) {
702
- const projectDir = workDir || getWorkingDirectory(void 0, true);
703
- const teamPath = join3(projectDir, ".trie", "TEAM.md");
704
- try {
705
- if (existsSync3(teamPath)) {
706
- return await readFile3(teamPath, "utf-8");
707
- }
708
- } catch {
709
- }
710
- return null;
711
- }
712
- function getFileTemplate(fileName, stack) {
713
- switch (fileName) {
714
- case "PROJECT.md":
715
- return getProjectTemplate(stack);
716
- case "RULES.md":
717
- return getRulesTemplate(stack);
718
- case "TEAM.md":
719
- return getTeamTemplate();
720
- case "BOOTSTRAP.md":
721
- return getBootstrapTemplate(stack);
722
- default:
723
- return null;
724
- }
725
- }
726
- function getProjectTemplate(stack) {
727
- const lines = ["# Project Overview", "", "> Define your project context here. AI assistants read this first.", ""];
728
- lines.push("## Description", "", "[Describe what this project does and who it's for]", "");
729
- lines.push("## Technology Stack", "");
730
- if (stack.framework) lines.push(`- **Framework:** ${stack.framework}`);
731
- if (stack.language) lines.push(`- **Language:** ${stack.language}`);
732
- if (stack.database) lines.push(`- **Database:** ${stack.database}`);
733
- if (stack.auth) lines.push(`- **Auth:** ${stack.auth}`);
734
- if (!stack.framework && !stack.language && !stack.database) {
735
- lines.push("[Add your technology stack]");
736
- }
737
- lines.push("");
738
- lines.push("## Architecture", "", "[Key patterns and design decisions]", "");
739
- lines.push("## Coding Conventions", "", "[Style rules agents should follow]", "");
740
- lines.push("## AI Instructions", "", "When working on this project:", "1. [Instruction 1]", "2. [Instruction 2]", "3. [Instruction 3]", "");
741
- lines.push("---", "", "*Edit this file to provide project context to AI assistants.*");
742
- return lines.join("\n");
743
- }
744
- function getRulesTemplate(stack) {
745
- const packageManager = stack.packageManager || "npm";
746
- return `# Project Rules
747
-
748
- > These rules are enforced by Trie agents during scans.
749
- > Violations appear as issues with [RULES] prefix.
750
-
751
- ## Code Style
752
-
753
- 1. Use named exports, not default exports
754
- 2. Prefer \`${packageManager}\` for package management
755
- 3. Maximum file length: 300 lines
756
- 4. Use TypeScript strict mode
757
-
758
- ## Testing Requirements
759
-
760
- 1. Critical paths require unit tests
761
- 2. API endpoints require integration tests
762
- 3. Minimum coverage: 70%
763
-
764
- ## Security Rules
765
-
766
- 1. Never log sensitive data (passwords, tokens, PII)
767
- 2. All API routes require authentication
768
- 3. Rate limiting required on public endpoints
769
- 4. SQL queries must use parameterized statements
770
-
771
- ## Review Requirements
772
-
773
- 1. All PRs require at least 1 reviewer
774
- 2. Security-sensitive changes require security review
775
- 3. Database migrations require review
776
-
777
- ---
778
-
779
- *Edit this file to define your project's coding standards.*
780
- `;
781
- }
782
- function getTeamTemplate() {
783
- return `# Team Structure
784
-
785
- ## Code Ownership
786
-
787
- | Area | Owner | Backup | Review Required |
788
- |------|-------|--------|-----------------|
789
- | \`/src/api/\` | @backend-team | - | 1 approver |
790
- | \`/src/ui/\` | @frontend-team | - | 1 approver |
791
- | \`/src/auth/\` | @security-team | - | Security review |
792
-
793
- ## Escalation
794
-
795
- | Severity | First Contact | Escalate To | SLA |
796
- |----------|--------------|-------------|-----|
797
- | Critical | Team lead | CTO | 1 hour |
798
- | Serious | PR reviewer | Team lead | 4 hours |
799
- | Moderate | Self-serve | - | 1 day |
800
-
801
- ## Contacts
802
-
803
- - **Security:** [email/slack]
804
- - **Privacy:** [email/slack]
805
- - **Emergencies:** [phone/pager]
806
-
807
- ---
808
-
809
- *Edit this file to define your team structure.*
810
- `;
811
- }
812
- function getBootstrapTemplate(stack) {
813
- const skillCommands = stack.suggestedSkills.map((s) => `trie skills add ${s}`).join("\n");
814
- const agentList = stack.suggestedAgents.join(", ");
815
- const lines = [
816
- "# Trie Bootstrap Checklist",
817
- "",
818
- "This file guides your first scan setup. **Delete when complete.**",
819
- "",
820
- "## Auto-Detected Stack",
821
- "",
822
- "Based on your project, Trie detected:"
823
- ];
824
- if (stack.framework) lines.push(`- **Framework:** ${stack.framework}`);
825
- if (stack.language) lines.push(`- **Language:** ${stack.language}`);
826
- if (stack.database) lines.push(`- **Database:** ${stack.database}`);
827
- if (stack.auth) lines.push(`- **Auth:** ${stack.auth}`);
828
- lines.push("", "## Recommended Actions", "", "### 1. Skills to Install", "Based on your stack, consider installing:", "```bash");
829
- lines.push(skillCommands || "# No specific skills detected - browse https://skills.sh");
830
- lines.push("```", "", "### 2. Agents to Enable", `Your stack suggests these agents: ${agentList || "security, privacy, bugs"}`, "");
831
- lines.push("### 3. Configure Rules", "Add your coding standards to `.trie/RULES.md`.", "");
832
- lines.push("### 4. Run First Scan", "```bash", "trie scan", "```", "");
833
- lines.push("---", "", "**Delete this file after completing setup.** Run:", "```bash", "rm .trie/BOOTSTRAP.md", "```");
834
- return lines.join("\n");
835
- }
836
-
837
- export {
838
- SKILL_CATEGORIES,
839
- getSkillsByCategory,
840
- getSkillCategories,
841
- loadBootstrapContext,
842
- initializeBootstrapFiles,
843
- completeBootstrap,
844
- needsBootstrap,
845
- loadRules,
846
- loadTeamInfo,
847
- saveCheckpoint,
848
- listCheckpoints,
849
- getLastCheckpoint,
850
- handleCheckpointCommand
851
- };
852
- //# sourceMappingURL=chunk-6T7S77U7.js.map