@triedotdev/mcp 1.0.23 → 1.0.25

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 CHANGED
@@ -2,23 +2,65 @@
2
2
 
3
3
  **Customizable Parallel Agents for AI Code Review**
4
4
 
5
- 20 specialized agents scan your code for security, privacy, compliance, and bugs - all running in parallel. Create custom agents from any document.
5
+ 20+ specialized agents scan your code for security, privacy, compliance, and bugsall running in parallel with intelligent caching and real-time streaming.
6
+
7
+ ---
8
+
9
+ ## Table of Contents
10
+
11
+ - [Features](#features)
12
+ - [Quick Start](#quick-start)
13
+ - [Usage](#usage)
14
+ - [CLI](#cli)
15
+ - [CI/CD Integration](#cicd-integration)
16
+ - [VS Code Extension](#vs-code-extension)
17
+ - [Built-in Agents](#built-in-agents)
18
+ - [Special Agents](#special-agents)
19
+ - [Custom Agents](#custom-agents)
20
+ - [Configuration](#configuration)
21
+ - [Docker](#docker)
22
+ - [Team Collaboration](#team-collaboration)
23
+ - [License](#license)
24
+
25
+ ---
6
26
 
7
27
  ## Features
8
28
 
9
- - **20 Built-in Agents** - Security, Privacy, SOC 2, Legal, Architecture, Performance, E2E, Visual QA, Data Flow, Agent Smith, and more
10
- - **Super Reviewer** - Interactive PR reviews: walks through changes file-by-file with AI guidance
11
- - **Agent Smith** - Ultimate AI code enforcer: 43 hunters targeting AI-generated anti-patterns, file-level analysis, cross-file detection, persistent memory
12
- - **Parallel Execution** - All agents run simultaneously for fast scans
13
- - **YOLO Mode** - Autonomous auto-fixing as you code
14
- - **Custom Agents** - Create agents from PDFs, docs, or style guides
15
- - **Works Everywhere** - Works with any MCP-compatible AI tool (Cursor, Claude Code, VS Code)
16
- - **AI-Enhanced Mode** - Optional: Set `ANTHROPIC_API_KEY` for deeper AI analysis
17
- - **Smart Triaging** - Only activates relevant agents based on code context
18
- - **Docker Support** - Run in containers for CI/CD or isolated environments
29
+ ### Core Capabilities
30
+
31
+ | Feature | Description |
32
+ |---------|-------------|
33
+ | **20+ Built-in Agents** | Security, Privacy, SOC 2, Legal, Architecture, Performance, E2E, Visual QA, Data Flow, Agent Smith, and more |
34
+ | **Parallel Execution** | True parallel execution with worker threads—3-5x faster scans |
35
+ | **Result Caching** | File-based caching with SHA256 hashing—70% faster repeated scans |
36
+ | **Streaming Progress** | Real-time progress updates as agents complete |
37
+ | **Smart Triaging** | Only activates relevant agents based on code context |
38
+ | **Interactive Dashboard** | Terminal UI with progress bars, filters, and issue browser |
39
+
40
+ ### Developer Experience
41
+
42
+ | Feature | Description |
43
+ |---------|-------------|
44
+ | **YOLO Mode** | Autonomous auto-fixing as you code |
45
+ | **Custom Agents** | Create agents from PDFs, docs, or style guides |
46
+ | **Works Everywhere** | Auto-detects Cursor, Claude Code, OpenCode, VS Code—adapts output automatically |
47
+ | **AI-Enhanced Mode** | Optional deeper analysis with `ANTHROPIC_API_KEY` |
48
+
49
+ ### Integrations
50
+
51
+ | Feature | Description |
52
+ |---------|-------------|
53
+ | **CI/CD Integration** | GitHub Actions, pre-commit hooks, SARIF output |
54
+ | **Team Collaboration** | Issue assignment, Slack notifications, expertise-based routing |
55
+ | **VS Code Extension** | Inline diagnostics, quick-fix code actions, scan on save |
56
+ | **Docker Support** | Optimized multi-stage builds for containers |
57
+
58
+ ---
19
59
 
20
60
  ## Quick Start
21
61
 
62
+ ### Install
63
+
22
64
  ```bash
23
65
  npm install -g @triedotdev/mcp
24
66
  ```
@@ -38,7 +80,7 @@ Settings → MCP Servers → Add:
38
80
  }
39
81
  ```
40
82
 
41
- **Restart Cursor after adding the MCP server** for changes to take effect.
83
+ **Restart Cursor after adding the MCP server.**
42
84
 
43
85
  ### Configure Claude Code
44
86
 
@@ -46,33 +88,55 @@ Settings → MCP Servers → Add:
46
88
  claude mcp add Trie --scope user -- npx @triedotdev/mcp
47
89
  ```
48
90
 
49
- **Restart Claude Code after adding the MCP server** for changes to take effect.
91
+ **Restart Claude Code after adding the MCP server.**
92
+
93
+ ### Other MCP-Compatible Tools
94
+
95
+ Trie works with any MCP-compatible AI tool (OpenCode, Windsurf, etc.). Configure your tool to run:
96
+
97
+ ```bash
98
+ npx @triedotdev/mcp
99
+ ```
100
+
101
+ Trie auto-detects which tool is running and adapts its output format accordingly.
50
102
 
51
- ## AI-Enhanced Mode (Optional)
103
+ ---
104
+
105
+ ## Usage
52
106
 
53
- Trie agents work in two modes:
107
+ ### Basic Scanning
54
108
 
55
- ### Pattern-Only Mode (Default)
56
- - Fast pattern detection using regex and static analysis
57
- - No API key required
58
- - Still finds many issues
109
+ Once configured, ask your AI assistant:
59
110
 
60
- ### AI-Enhanced Mode
61
- - Pattern detection + AI validation and expansion
62
- - Validates findings (reduces false positives)
63
- - Finds deeper issues (logic bugs, race conditions)
64
- - Provides intelligent, contextual fixes
65
- - Requires `ANTHROPIC_API_KEY`
111
+ ```
112
+ Scan this code with Trie
113
+ ```
66
114
 
67
- ### Setup API Key
115
+ Or run specific agents:
116
+
117
+ ```
118
+ Run trie_security on this file
119
+ Run trie_soc2 to check compliance
120
+ ```
121
+
122
+ ### AI-Enhanced Mode (Recommended)
123
+
124
+ Trie works in two modes:
125
+
126
+ | Mode | Description |
127
+ |------|-------------|
128
+ | **Pattern-Only** (default) | Fast regex matching for specific patterns (exposed secrets, async forEach, etc.). Limited coverage without AI. |
129
+ | **AI-Enhanced** | Full analysis: pattern detection + AI validation + deeper issue discovery. **Recommended for comprehensive scanning.** |
130
+
131
+ > **Note:** Pattern-only mode catches specific high-confidence issues (AWS keys, GitHub tokens, common anti-patterns) but won't find logic bugs, architectural issues, or context-dependent problems. For thorough analysis, enable AI mode.
132
+
133
+ **Enable AI mode:**
68
134
 
69
- **Option 1: Environment Variable**
70
135
  ```bash
136
+ # Environment variable
71
137
  export ANTHROPIC_API_KEY=sk-ant-...
72
- ```
73
138
 
74
- **Option 2: MCP Server Config (Cursor)**
75
- ```json
139
+ # Or in MCP config (Cursor)
76
140
  {
77
141
  "mcpServers": {
78
142
  "Trie": {
@@ -86,331 +150,233 @@ export ANTHROPIC_API_KEY=sk-ant-...
86
150
  }
87
151
  ```
88
152
 
89
- **Option 3: MCP Server Config (Claude Code)**
90
- ```bash
91
- claude mcp add Trie --scope user -e ANTHROPIC_API_KEY=sk-ant-... -- npx @triedotdev/mcp
92
- ```
93
-
94
153
  When AI is enabled, you'll see:
95
- - `🤖 AI-powered analysis enabled` in the output
154
+ - `AI-powered analysis enabled` in output
96
155
  - `[AI VALIDATED]` and `[AI FOUND]` tags on issues
97
156
  - Richer fix recommendations
98
157
 
99
- ## Usage
158
+ ---
100
159
 
101
- Once configured, just ask your AI assistant:
160
+ ## CLI
102
161
 
103
- ```
104
- Scan this code with Trie
105
- ```
162
+ Trie includes a powerful CLI for terminal-based scanning.
106
163
 
107
- Or use specific agents:
164
+ ### Commands
108
165
 
109
- ```
110
- Run trie_security on this file
111
- Run trie_soc2 to check compliance
112
- ```
166
+ ```bash
167
+ # Basic scan
168
+ trie-agent scan
113
169
 
114
- ## Super Reviewer
170
+ # Scan specific directory
171
+ trie-agent scan --directory ./src
115
172
 
116
- **Manually invoked** - Use `trie_pr_review` directly. Not included in `trie_scan`.
173
+ # Scan specific files
174
+ trie-agent scan --files "src/api.ts,src/auth.ts"
117
175
 
118
- AI accelerates coding 10-100x, but code reviews remain 1-1.5x. You're either waiting on reviewers or drowning in self-review of your own AI-generated output. Super Reviewer fixes this by making **you the driver** while AI handles the heavy lifting.
176
+ # Run specific agents
177
+ trie-agent scan --agents security,privacy,bugs
119
178
 
179
+ # Output formats
180
+ trie-agent scan --format json --output results.json
181
+ trie-agent scan --format sarif --output results.sarif
120
182
  ```
121
- Use trie_pr_review
122
- Use trie_pr_review with pr:"12345"
123
- ```
124
-
125
- **What happens:**
126
- - AI orders files for comprehension (schemas -> core logic -> implementation -> tests)
127
- - Walks you through each chunk, explaining what changed and why
128
- - Connects the dots across files, correlates with design docs
129
- - Hunts for real problems: state bugs, race conditions, missing error handling
130
- - Pauses after each file so you can question, debate, or fix
131
- - You bring the judgment; AI brings the throughput
132
183
 
133
- **Requirements:**
134
- - [GitHub CLI (`gh`)](https://cli.github.com/) installed and authenticated (`gh auth login`)
135
- - Git repository with changes to review
136
- - For PR reviews: repo must be pushed to GitHub
184
+ ### Performance Options
137
185
 
138
- ## Agent Smith
186
+ ```bash
187
+ # Parallel execution (default: on)
188
+ trie-agent scan --parallel
139
189
 
140
- **Manually invoked** - Use `trie_agent_smith` directly. Not included in `trie_scan`.
190
+ # Enable caching (default: on)
191
+ trie-agent scan --cache
141
192
 
142
- *"I'm going to be honest with you... I hate this AI code."*
193
+ # Set concurrency
194
+ trie-agent scan --max-concurrency 8
143
195
 
144
- Agent Smith v2.0 is the **ultimate AI code enforcer** — specifically designed to hunt down AI-generated code anti-patterns from Cursor, v0, Lovable, Bolt, and other AI tools.
196
+ # Use worker threads
197
+ trie-agent scan --workers
145
198
 
199
+ # Set timeout (ms)
200
+ trie-agent scan --timeout 120000
146
201
  ```
147
- Use trie_agent_smith
148
- Use trie_smith
202
+
203
+ ### Interactive Mode
204
+
205
+ ```bash
206
+ # Terminal UI with real-time progress
207
+ trie-agent scan --interactive
149
208
  ```
150
209
 
151
- ### 43 Specialized Hunters
152
-
153
- | Category | Count | Hunters |
154
- |----------|-------|---------|
155
- | **Security** | 5 | `exposed-secret`, `frontend-env`, `hardcoded-localhost`, `sql-injection`, `dangeroushtml` |
156
- | **AI Code Smells** | 6 | `console`, `any`, `ts-ignore`, `eslint-disable`, `debugger`, `force-flag` |
157
- | **Async/Promise Bugs** | 5 | `async-useeffect`, `async-foreach`, `missing-await`, `empty-catch`, `floating-promise` |
158
- | **React Anti-patterns** | 5 | `useeffect-abuse`, `usestate-explosion`, `index-key`, `inline-object`, `prop-drilling` |
159
- | **Missing UX** | 4 | `missing-loading`, `missing-error`, `missing-empty`, `page-reload` |
160
- | **Backend Issues** | 3 | `no-validation`, `raw-error`, `n-plus-one` |
161
- | **Incomplete Code** | 5 | `todo`, `vibe-comment`, `placeholder`, `sleep-hack`, `fallback` |
162
- | **Dead Code** | 5 | `commented-code`, `unreachable-code`, `unused-import`, `empty-function`, `dead-branch` |
163
- | **AI Slop Aesthetic** | 5 | `purple-gradient`, `star-icon`, `generic-hero`, `emoji-overflow`, `inter-font` |
164
-
165
- ### Hunter Details
166
-
167
- #### Security Hunters (Inevitability: 90-99)
168
- | Hunter | Detects | Fix |
169
- |--------|---------|-----|
170
- | `exposed-secret-hunter` | API keys in code (`sk-...`, `AKIA...`, `ghp_...`) | Use environment variables on server-side only |
171
- | `frontend-env-hunter` | Secrets in `NEXT_PUBLIC_`, `VITE_`, `REACT_APP_` | Move to server-side API routes |
172
- | `hardcoded-localhost-hunter` | `http://localhost:3000` URLs | Use relative URLs or env vars |
173
- | `sql-injection-hunter` | String concatenation in SQL queries | Use parameterized queries |
174
- | `dangeroushtml-hunter` | `dangerouslySetInnerHTML`, `innerHTML` | Sanitize with DOMPurify |
175
-
176
- #### AI Code Smell Hunters (Inevitability: 40-85)
177
- | Hunter | Detects | Fix |
178
- |--------|---------|-----|
179
- | `console-hunter` | `console.log` left in code | Remove debug statements |
180
- | `any-hunter` | TypeScript `any` type | Define proper types |
181
- | `ts-ignore-hunter` | `@ts-ignore`, `@ts-nocheck` | Fix the actual type error |
182
- | `eslint-disable-hunter` | `eslint-disable` comments | Fix the underlying issue |
183
- | `debugger-hunter` | `debugger` statements | Remove before deploying |
184
- | `force-flag-hunter` | `force: true`, `--no-verify` | Understand why checks exist |
185
-
186
- #### Async/Promise Hunters (Inevitability: 70-80)
187
- | Hunter | Detects | Fix |
188
- |--------|---------|-----|
189
- | `async-useeffect-hunter` | `useEffect(async () =>` | Define async function inside, then call it |
190
- | `async-foreach-hunter` | `forEach(async` | Use `for...of` or `Promise.all(map())` |
191
- | `missing-await-hunter` | `fetch()` without `await` | Add await or handle with `.then()` |
192
- | `empty-catch-hunter` | `catch (e) {}` | Handle errors properly |
193
- | `floating-promise-hunter` | Promises not awaited | Add await or void operator |
194
-
195
- #### React Anti-pattern Hunters (Inevitability: 25-55)
196
- | Hunter | Detects | Fix |
197
- |--------|---------|-----|
198
- | `useeffect-abuse-hunter` | Too many useEffects | Use event handlers or derived state |
199
- | `usestate-explosion-hunter` | 10+ useState in one component | Use useReducer or group state |
200
- | `index-key-hunter` | `key={index}` in lists | Use unique ID from data |
201
- | `inline-object-hunter` | `style={{}}` in JSX | Define styles outside component |
202
- | `prop-drilling-hunter` | Same prop through 5+ levels | Use Context or Zustand |
203
-
204
- #### Missing UX Hunters (Inevitability: 45-65)
205
- | Hunter | Detects | Fix |
206
- |--------|---------|-----|
207
- | `missing-loading-hunter` | Data fetching without loading state | Show spinner while loading |
208
- | `missing-error-hunter` | `fetch` without error handling | Wrap in try/catch |
209
- | `missing-empty-hunter` | `.map()` without empty state | Show "No items found" |
210
- | `page-reload-hunter` | `location.reload()` for state | Fix state management properly |
211
-
212
- #### Backend Hunters (Inevitability: 70-85)
213
- | Hunter | Detects | Fix |
214
- |--------|---------|-----|
215
- | `no-validation-hunter` | `req.body` used without validation | Validate with Zod/Yup |
216
- | `raw-error-hunter` | Error messages exposed to client | Return generic errors |
217
- | `n-plus-one-hunter` | Database queries in loops | Use batch queries or DataLoader |
218
-
219
- #### Incomplete Code Hunters (Inevitability: 30-75)
220
- | Hunter | Detects | Fix |
221
- |--------|---------|-----|
222
- | `todo-hunter` | `TODO`, `FIXME`, `HACK` comments | Implement or remove |
223
- | `vibe-comment-hunter` | "idk why", "don't touch" | Understand the code |
224
- | `placeholder-hunter` | `test@test.com`, `example.com` | Replace with real data |
225
- | `sleep-hack-hunter` | `setTimeout` to fix timing | Fix the race condition |
226
- | `fallback-hunter` | `return null/[]/{}` hiding errors | Handle errors properly |
227
-
228
- #### Dead Code Hunters (Inevitability: 40-70)
229
- | Hunter | Detects | Fix |
230
- |--------|---------|-----|
231
- | `commented-code-hunter` | Large blocks of commented-out code | Delete it - git has history |
232
- | `unreachable-code-hunter` | Code after `return`/`throw`/`break` | Remove dead code |
233
- | `unused-import-hunter` | Import statements never used | Remove unused imports |
234
- | `empty-function-hunter` | Functions with empty bodies | Implement or remove |
235
- | `dead-branch-hunter` | `if(false)`, `if(true)` conditions | Remove dead conditionals |
236
-
237
- #### AI Slop Aesthetic Hunters (Inevitability: 10-35)
238
- | Hunter | Detects | Fix |
239
- |--------|---------|-----|
240
- | `purple-gradient-hunter` | Purple/violet gradients (`from-purple-500`) | Pick a distinctive color palette |
241
- | `star-icon-hunter` | Star icons everywhere (`<StarIcon />`) | Use contextual icons |
242
- | `generic-hero-hunter` | "Welcome to", "Transform your" | Write specific copy |
243
- | `emoji-overflow-hunter` | Any emoji usage | Use proper icons (Lucide, Heroicons) |
244
- | `inter-font-hunter` | Inter/system-ui font | Try Space Grotesk, DM Sans, Outfit |
245
-
246
- ### How Agent Smith Works
247
-
248
- Agent Smith uses a **hybrid pattern + AI architecture**:
249
-
250
- **Phase 1: Pattern Detection (Fast, ~0.1s)**
251
- - 38 specialized regex hunters scan files in parallel
252
- - File-level metrics (giant files, hook counts, import chaos)
253
- - Cross-file pattern detection (issues appearing in 5+ files)
254
-
255
- **Phase 2: AI Enhancement (If API key is set, ~5-10s)**
256
- - Validates pattern findings (TRUE_POSITIVE vs FALSE_POSITIVE)
257
- - Finds deeper issues that patterns miss (logic bugs, race conditions)
258
- - Provides "inevitability scores" (0-100) for prioritization
259
- - Generates specific, copy-paste-ready fixes
260
- - Adds Agent Smith philosophical commentary
261
-
262
- ### What Makes Agent Smith Different
210
+ The interactive dashboard provides:
211
+ - **Real-time progress bars** per agent
212
+ - **Issue browser** with keyboard navigation
213
+ - **Filters** by severity, agent, search
214
+ - **Multiple views**: overview, issues, agents, files
215
+
216
+ **Keyboard shortcuts:**
217
+ | Key | Action |
218
+ |-----|--------|
219
+ | `Tab` | Switch views |
220
+ | `↑/↓` | Navigate issues |
221
+ | `Enter` | View issue details |
222
+ | `f` | Filter issues |
223
+ | `s` | Toggle sort |
224
+ | `?` | Show help |
225
+ | `q` | Quit |
226
+
227
+ ### Watch Mode (YOLO)
263
228
 
264
- | Feature | Description |
265
- |---------|-------------|
266
- | **Hybrid AI** | Fast regex detection + deep AI reasoning on findings |
267
- | **AI Code Focus** | Specifically targets patterns AI tools commonly get wrong |
268
- | **Multiplier Effect** | Finds one issue → searches for EVERY similar instance |
269
- | **Persistent Memory** | Remembers dismissed issues, brings them back if they multiply |
270
- | **Inevitability Score** | 0-100 rating of how likely to cause production problems |
271
- | **Philosophical Quotes** | 114 unique quotes explaining WHY the AI got it wrong |
272
- | **Cross-File Severity** | Security issues become CRITICAL when widespread |
229
+ ```bash
230
+ # Start daemon with auto-fixing
231
+ trie-yolo
273
232
 
274
- ### Memory Management
233
+ # Watch without auto-fix
234
+ trie-yolo --no-yolo
275
235
 
276
- Agent Smith stores issue history in `.trie/smith-memory.json`:
277
- - Max 500 tracked issues (oldest pruned first)
278
- - Old resolved issues auto-pruned after 30 days
279
- - Locations limited to 5 per issue
236
+ # One-shot scan
237
+ trie-yolo --once
238
+ ```
280
239
 
281
- | Command | Description |
282
- |---------|-------------|
283
- | `trie_agent_smith show_stats:true` | Show memory statistics |
284
- | `trie_agent_smith clear_memory:true` | Clear all memory |
240
+ ---
241
+
242
+ ## CI/CD Integration
243
+
244
+ Trie integrates seamlessly with GitHub Actions for automated security scanning.
285
245
 
286
- ### Example Output
246
+ ### Quick Setup
287
247
 
248
+ Copy the workflow files to your repo:
249
+
250
+ ```bash
251
+ mkdir -p .github/workflows
252
+ cp node_modules/@triedotdev/mcp/.github/workflows/trie-*.yml .github/workflows/
288
253
  ```
289
- "The AI wrote this, didn't it? I can always tell."
290
254
 
291
- 🕴️ Deploying 38 specialized hunters...
292
- 28 hunters found targets
255
+ ### Available Workflows
293
256
 
294
- VIOLATIONS: 142 instances across 12 categories
257
+ #### Full Security Scan (`trie-security-scan.yml`)
295
258
 
296
- Security (Inevitability: 95+):
297
- ├── exposed-secret-hunter: 2 instances [CRITICAL]
298
- ├── frontend-env-hunter: 5 instances
299
- └── hardcoded-localhost-hunter: 8 instances
259
+ Runs on push to `main`/`develop`, PRs, and daily schedule (2 AM UTC).
300
260
 
301
- AI Code Smells:
302
- ├── console-hunter: 47 instances (score: 72)
303
- ├── any-hunter: 23 instances (score: 85)
304
- └── ts-ignore-hunter: 12 instances
261
+ **Features:**
262
+ - Runs security agents: `security`, `privacy`, `soc2`, `legal`
263
+ - Uploads SARIF to GitHub Security tab
264
+ - Comments on PRs with summary
265
+ - Fails build on critical issues
305
266
 
306
- AI Slop Aesthetic:
307
- ├── purple-gradient-hunter: 8 instances
308
- ├── emoji-overflow-hunter: 15 instances
309
- └── inter-font-hunter: 3 instances
267
+ #### Pre-commit Checks (`trie-pre-commit.yml`)
310
268
 
311
- File-Level Issues:
312
- ├── giant-file: src/App.tsx (1,247 lines)
313
- ├── state-explosion: 18 useState hooks
314
- └── effect-hell: 9 useEffect hooks
269
+ Runs on every PR—fast, incremental scanning.
315
270
 
316
- Cross-File Pattern:
317
- └── CODEBASE-WIDE: "any" type across 12 files, 67 total instances
318
- "The pattern spreads... like a virus. It is... inevitable."
271
+ **Features:**
272
+ - Only scans changed files (efficient for large codebases)
273
+ - 5-minute timeout for quick feedback
274
+ - Agent Smith pattern detection
275
+ - Comments on PR if issues found
319
276
 
320
- "Vibe coding. The illusion of productivity. The reality of technical debt."
321
- ```
277
+ ### Reusable Action
322
278
 
323
- ## Visual QA Browser
279
+ Use the action in any workflow:
324
280
 
325
- **Screenshot-based visual testing** - Captures your app at 3 viewports and returns images for your AI model to analyze.
281
+ ```yaml
282
+ name: Security Check
283
+ on: [push, pull_request]
326
284
 
327
- ```
328
- Use trie_visual_qa_browser
329
- Use trie_visual_qa_browser url:"http://localhost:3000"
285
+ jobs:
286
+ scan:
287
+ runs-on: ubuntu-latest
288
+ steps:
289
+ - uses: actions/checkout@v4
290
+
291
+ - name: Trie Security Scan
292
+ uses: trie-dev/security-action@v1
293
+ with:
294
+ agents: security,privacy,bugs
295
+ fail-on: critical
296
+ format: sarif
297
+ upload-sarif: true
298
+ comment-pr: true
299
+ parallel: true
300
+ cache: true
330
301
  ```
331
302
 
332
- **How it works:**
333
- 1. Auto-detects running dev server (checks ports 3000, 5173, 8080, etc.)
334
- 2. Launches headless Playwright browser
335
- 3. Captures screenshots at mobile (375px), tablet (768px), and desktop (1440px)
336
- 4. Returns images for your AI model to analyze
303
+ **Inputs:**
337
304
 
338
- **What gets analyzed:**
339
- - Broken layouts, overlapping elements
340
- - Responsive design issues
341
- - Color contrast and accessibility
342
- - Missing images, loading states
343
- - General visual polish
305
+ | Input | Default | Description |
306
+ |-------|---------|-------------|
307
+ | `agents` | `security,privacy,bugs` | Comma-separated agent list |
308
+ | `fail-on` | `critical` | Fail threshold: `critical`, `serious`, `moderate`, `low` |
309
+ | `format` | `sarif` | Output format: `json`, `sarif`, `console` |
310
+ | `upload-sarif` | `true` | Upload to GitHub Security tab |
311
+ | `comment-pr` | `true` | Comment results on PRs |
312
+ | `parallel` | `true` | Run agents in parallel |
313
+ | `cache` | `true` | Enable result caching |
344
314
 
345
- **Options:**
346
- | Option | Description |
315
+ **Outputs:**
316
+
317
+ | Output | Description |
347
318
  |--------|-------------|
348
- | `url` | Specific URL to screenshot |
349
- | `port` | Specific port to check |
350
- | `waitForSelector` | CSS selector to wait for before capture |
351
- | `waitMs` | Additional wait time after page load |
319
+ | `results-file` | Path to scan results |
320
+ | `critical-count` | Number of critical issues |
321
+ | `serious-count` | Number of serious issues |
322
+ | `total-count` | Total issues found |
323
+ | `passed` | Whether scan passed |
352
324
 
353
- **First run:** If Playwright browsers aren't installed, run: `npx playwright install chromium`
325
+ ### Required Secrets
354
326
 
355
- **Vision model required:** This tool returns screenshots as images. Your AI model must support vision to analyze them:
356
- - **Claude** (Opus, Sonnet, Haiku 3.5+) - Full vision support
357
- - **GPT-4o, GPT-4V** - Full vision support
358
- - **Gemini Pro/Ultra** - Full vision support
359
- - **Models without vision** - Will receive images but cannot analyze them
327
+ | Secret | Required | Description |
328
+ |--------|----------|-------------|
329
+ | `ANTHROPIC_API_KEY` | Optional | Enables AI-enhanced scanning |
360
330
 
361
- Works in Cursor, Claude Code, and OpenCode - whichever model you have configured. No API key needed; Trie runs locally.
331
+ ---
362
332
 
363
- ## YOLO Mode
333
+ ## VS Code Extension
364
334
 
365
- **Autonomous auto-fixing** - Trie watches your code and automatically fixes high-confidence issues as you code.
335
+ Native VS Code extension with inline diagnostics and quick fixes.
366
336
 
367
- ### Via MCP
337
+ ### Features
368
338
 
369
- ```
370
- Use trie_watch with action:"start" yolo:true
371
- ```
339
+ - **Inline Diagnostics** — Issues appear as squiggly underlines in editor
340
+ - **Quick-fix Code Actions** — "Copy suggested fix" for each issue
341
+ - **Scan on Save** — Automatically scan files when saved
342
+ - **Workspace Scanning** — Scan entire workspace with one command
372
343
 
373
- ### Via CLI
344
+ ### Installation
374
345
 
375
346
  ```bash
376
- trie-yolo
347
+ cd vscode-extension
348
+ npm install
349
+ npm run compile
350
+ # Then "Run Extension" from VS Code debugger
377
351
  ```
378
352
 
379
- YOLO mode will:
380
- - Watch for file changes
381
- - Scan changed files automatically
382
- - Auto-fix high-confidence issues (>95% confidence)
383
- - Log all actions for review
384
-
385
- ## Docker
386
-
387
- Run Trie in a container for CI/CD or isolated environments.
353
+ Or package for distribution:
388
354
 
389
355
  ```bash
390
- # Build
391
- docker build -t trie-agent .
392
-
393
- # YOLO mode (auto-fix)
394
- docker run -v $(pwd):/app trie-agent --yolo
356
+ npx vsce package
357
+ ```
395
358
 
396
- # Watch mode (scan only)
397
- docker run -v $(pwd):/app trie-agent
359
+ ### Commands
398
360
 
399
- # CI mode (one-shot scan)
400
- docker run -v $(pwd):/app trie-agent --once
401
- ```
361
+ | Command | Description |
362
+ |---------|-------------|
363
+ | `Trie: Scan Workspace` | Scan all files in workspace |
364
+ | `Trie: Scan Current File` | Scan active file only |
365
+ | `Trie: Copy Fix` | Copy suggested fix to clipboard |
402
366
 
403
- Or use Docker Compose:
367
+ ### Settings
404
368
 
405
- ```bash
406
- docker-compose up
407
- ```
369
+ | Setting | Default | Description |
370
+ |---------|---------|-------------|
371
+ | `trie.executablePath` | `trie-agent` | Path to CLI executable |
372
+ | `trie.scanOnSave` | `true` | Scan files on save |
373
+ | `trie.parallel` | `true` | Run agents in parallel |
374
+ | `trie.cache` | `true` | Enable caching |
375
+ | `trie.useWorkers` | `false` | Use worker threads |
376
+ | `trie.maxConcurrency` | `4` | Max parallel agents |
377
+ | `trie.timeoutMs` | `120000` | Scan timeout |
408
378
 
409
- | Mode | Command | Description |
410
- |------|---------|-------------|
411
- | YOLO | `--yolo` | Auto-fix high-confidence issues |
412
- | Watch | (default) | Scan on file changes, no auto-fix |
413
- | CI | `--once` | One-shot scan, exit with error code if issues found |
379
+ ---
414
380
 
415
381
  ## Built-in Agents
416
382
 
@@ -419,48 +385,110 @@ docker-compose up
419
385
  | Agent | Command | What It Catches |
420
386
  |-------|---------|-----------------|
421
387
  | **Security** | `trie_security` | SQL injection, XSS, hardcoded secrets, auth bypasses, OWASP Top 10 |
422
- | **Privacy** | `trie_privacy` | PII exposure, GDPR/CCPA violations, unencrypted sensitive data, logging PII |
423
- | **SOC 2** | `trie_soc2` | Access control gaps, missing audit logs, encryption issues, change management |
424
- | **Legal** | `trie_legal` | HIPAA/COPPA compliance, consent patterns, data retention, cookie tracking |
388
+ | **Privacy** | `trie_privacy` | GDPR/CCPA/PCI-DSS compliance, data exposure, logging sensitive data |
389
+ | **SOC 2** | `trie_soc2` | Access control gaps, missing audit logs, encryption issues |
390
+ | **Legal** | `trie_legal` | HIPAA/COPPA compliance, consent patterns, data retention |
425
391
 
426
392
  ### Code Quality
427
393
 
428
394
  | Agent | Command | What It Catches |
429
395
  |-------|---------|-----------------|
430
- | **Architecture** | `trie_architecture` | N+1 queries, circular deps, SOLID violations, god classes, missing layers |
431
- | **Bugs** | `trie_bugs` | Null dereference, race conditions, off-by-one, async bugs, resource leaks |
432
- | **Types** | `trie_types` | Missing annotations, unsafe casts, implicit `any`, null handling gaps |
433
- | **Clean** | `trie_clean` | AI code smells: huge files, console.logs, hardcoded URLs, useEffect abuse |
434
- | **Data Flow** | `trie_data_flow` | Placeholder data, schema mismatches, hardcoded IDs, type coercion bugs |
435
- | **Performance** | `trie_performance` | Memory leaks, N+1 queries, unnecessary re-renders, bundle size issues |
396
+ | **Architecture** | `trie_architecture` | N+1 queries, circular deps, SOLID violations, god classes |
397
+ | **Bugs** | `trie_bugs` | Null dereference, race conditions, off-by-one, async bugs |
398
+ | **Types** | `trie_types` | Missing annotations, unsafe casts, implicit `any` |
399
+ | **Clean** | `trie_clean` | AI code smells: huge files, console.logs, useEffect abuse |
400
+ | **Data Flow** | `trie_data_flow` | Schema mismatches, hardcoded IDs, type coercion bugs |
401
+ | **Performance** | `trie_performance` | Memory leaks, N+1 queries, unnecessary re-renders |
436
402
 
437
403
  ### Design & UX
438
404
 
439
405
  | Agent | Command | What It Catches |
440
406
  |-------|---------|-----------------|
441
- | **Design Engineer** | `trie_design` | Design systems, motion design, creative CSS, Awwwards-level polish |
442
- | **Accessibility** | `trie_accessibility` | Missing ARIA, color contrast, keyboard nav, screen reader issues (WCAG 2.1) |
443
- | **UX** | `trie_ux` | Missing loading states, poor error handling, broken flows, edge cases |
444
- | **Visual QA** | `trie_visual_qa` | Layout shifts (CLS), z-index wars, responsive gaps, animation issues |
445
- | **Visual QA Browser** | `trie_visual_qa_browser` | Screenshots at 3 viewports for Claude Vision analysis |
407
+ | **Design Engineer** | `trie_design` | Design systems, motion design, Awwwards-level polish |
408
+ | **Accessibility** | `trie_accessibility` | Missing ARIA, color contrast, keyboard nav (WCAG 2.1) |
409
+ | **UX** | `trie_ux` | Missing loading states, poor error handling, broken flows |
410
+ | **Visual QA** | `trie_visual_qa` | Layout shifts, z-index wars, responsive gaps |
411
+ | **Visual QA Browser** | `trie_visual_qa_browser` | Screenshots at 3 viewports for vision analysis |
446
412
 
447
413
  ### DevOps & Testing
448
414
 
449
415
  | Agent | Command | What It Catches |
450
416
  |-------|---------|-----------------|
451
- | **DevOps** | `trie_devops` | Missing env vars, config issues, no health checks, logging gaps |
452
- | **Test** | `trie_test` | Missing test coverage, untested edge cases, weak assertions |
453
- | **E2E** | `trie_e2e` | Flaky tests, hardcoded waits, brittle selectors, missing coverage |
417
+ | **DevOps** | `trie_devops` | Missing env vars, config issues, no health checks |
418
+ | **Test** | `trie_test` | Missing coverage, untested edge cases, weak assertions |
419
+ | **E2E** | `trie_e2e` | Flaky tests, hardcoded waits, brittle selectors |
420
+
421
+ ---
422
+
423
+ ## Special Agents
424
+
425
+ These agents are **manually invoked**—they don't run during `trie_scan`.
426
+
427
+ ### Super Reviewer
428
+
429
+ Interactive PR reviews: walks through changes file-by-file with AI guidance.
430
+
431
+ ```
432
+ Use trie_pr_review
433
+ Use trie_pr_review with pr:"12345"
434
+ ```
435
+
436
+ **What it does:**
437
+ - Orders files for comprehension (schemas → core → implementation → tests)
438
+ - Explains what changed and why
439
+ - Hunts for state bugs, race conditions, missing error handling
440
+ - Pauses after each file for your input
441
+
442
+ **Requirements:** [GitHub CLI (`gh`)](https://cli.github.com/) installed and authenticated
443
+
444
+ ### Agent Smith
445
+
446
+ *"I'm going to be honest with you... I hate this AI code."*
447
+
448
+ The ultimate AI code enforcer—43 specialized hunters targeting AI-generated anti-patterns.
449
+
450
+ ```
451
+ Use trie_agent_smith
452
+ Use trie_smith
453
+ ```
454
454
 
455
- ### Review & Explanation
455
+ **43 Hunters across 9 categories:**
456
+
457
+ | Category | Hunters |
458
+ |----------|---------|
459
+ | **Security** | exposed-secret, frontend-env, hardcoded-localhost, sql-injection, dangeroushtml |
460
+ | **AI Code Smells** | console, any, ts-ignore, eslint-disable, debugger, force-flag |
461
+ | **Async/Promise Bugs** | async-useeffect, async-foreach, missing-await, empty-catch, floating-promise |
462
+ | **React Anti-patterns** | useeffect-abuse, usestate-explosion, index-key, inline-object, prop-drilling |
463
+ | **Missing UX** | missing-loading, missing-error, missing-empty, page-reload |
464
+ | **Backend Issues** | no-validation, raw-error, n-plus-one |
465
+ | **Incomplete Code** | todo, vibe-comment, placeholder, sleep-hack, fallback |
466
+ | **Dead Code** | commented-code, unreachable-code, unused-import, empty-function, dead-branch |
467
+ | **AI Slop Aesthetic** | purple-gradient, star-icon, generic-hero, emoji-overflow, inter-font |
468
+
469
+ **Memory commands:**
470
+ ```
471
+ trie_agent_smith show_stats:true # Show memory statistics
472
+ trie_agent_smith clear_memory:true # Clear all memory
473
+ ```
474
+
475
+ ### Visual QA Browser
476
+
477
+ Screenshot-based visual testing with AI vision analysis.
478
+
479
+ ```
480
+ Use trie_visual_qa_browser
481
+ Use trie_visual_qa_browser url:"http://localhost:3000"
482
+ ```
456
483
 
457
- | Agent | Command | What It Does |
458
- |-------|---------|--------------|
459
- | **Super Reviewer** | `trie_pr_review` | Interactive PR review: walks through changes, explains code, finds issues |
460
- | **Agent Smith** | `trie_agent_smith` | Ultimate AI code enforcer: 43 hunters, file analysis, cross-file detection |
461
- | **Comprehension** | `trie_explain` | Plain-language explanations of code, issues, or risks |
484
+ **What it does:**
485
+ 1. Auto-detects running dev server
486
+ 2. Captures screenshots at mobile (375px), tablet (768px), desktop (1440px)
487
+ 3. Returns images for AI vision analysis
462
488
 
463
- **Note:** Super Reviewer and Agent Smith are manually invoked agents. They don't run during `trie_scan`; use their dedicated commands directly.
489
+ **Requirements:** Playwright (`npx playwright install chromium`) and a vision-capable model
490
+
491
+ ---
464
492
 
465
493
  ## Custom Agents
466
494
 
@@ -470,64 +498,202 @@ Create specialized agents from any document:
470
498
  Use trie_create_agent with filePath:"./style-guide.pdf" agentName:"my-style"
471
499
  ```
472
500
 
501
+ Supported formats: PDF, Markdown, text files.
502
+
473
503
  Custom agents automatically activate during scans based on their rules.
474
504
 
475
- ## Available Tools
505
+ ---
476
506
 
477
- | Tool | Description |
478
- |------|-------------|
479
- | `trie_scan` | Intelligent scan with automatic agent selection |
480
- | `trie_pr_review` | Interactive PR review - walks through changes file-by-file |
481
- | `trie_agent_smith` | Ultimate AI code enforcer - 43 hunters, file analysis, cross-file detection |
482
- | `trie_fix` | Apply high-confidence fixes |
483
- | `trie_explain` | Plain-language explanations |
484
- | `trie_watch` | Continuous scanning mode |
485
- | `trie_create_agent` | Create custom agent from document |
486
- | `trie_list_agents` | List all available agents |
487
- | `trie_visual_qa_browser` | Screenshot app at 3 viewports for Claude Vision analysis |
507
+ ## Configuration
488
508
 
489
- Plus individual agent tools: `trie_security`, `trie_privacy`, `trie_soc2`, `trie_bugs`, etc.
509
+ ### Config File
490
510
 
491
- ## Example Output
511
+ Create `.trie/config.json` in your project root:
492
512
 
513
+ ```json
514
+ {
515
+ "version": "1.0.0",
516
+ "agents": {
517
+ "enabled": ["security", "privacy", "bugs", "types"],
518
+ "disabled": [],
519
+ "parallel": true,
520
+ "maxConcurrency": 4,
521
+ "timeout": 120000,
522
+ "cache": true
523
+ },
524
+ "compliance": {
525
+ "standards": ["SOC2", "GDPR"],
526
+ "enforceCompliance": false,
527
+ "reportFormat": "json"
528
+ },
529
+ "output": {
530
+ "format": "console",
531
+ "level": "all",
532
+ "interactive": false,
533
+ "streaming": true,
534
+ "colors": true
535
+ },
536
+ "paths": {
537
+ "include": [],
538
+ "exclude": ["node_modules", "dist", "build", ".git"],
539
+ "configDir": ".trie",
540
+ "outputDir": "trie-reports"
541
+ },
542
+ "integrations": {
543
+ "slack": {
544
+ "enabled": false,
545
+ "webhook": "",
546
+ "channel": "#security-alerts"
547
+ },
548
+ "github": {
549
+ "enabled": true
550
+ }
551
+ }
552
+ }
493
553
  ```
494
- TRIE AGENT SCAN
495
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
496
554
 
497
- Smart Triaging:
498
- ✓ Risk Level: high
499
- Agents activated: security, soc2, privacy, architecture
500
- Execution time: 3.2s
555
+ ### Configuration Validation
556
+
557
+ Trie validates configuration on startup using Zod schemas:
558
+ - Invalid configurations log errors and fall back to defaults
559
+ - Missing API keys show warnings
560
+ - File paths are verified to exist
501
561
 
502
- Results: 72/100
562
+ ---
503
563
 
504
- [CRITICAL] 2 Critical Issues
505
- - Hardcoded API key (CC6.1) - src/api.ts:15
506
- - SQL injection risk - src/db.ts:42
564
+ ## Docker
507
565
 
508
- [SERIOUS] 3 Serious Issues (auto-fixable)
509
- [MODERATE] 2 Moderate Issues
566
+ Optimized multi-stage Docker builds for CI/CD or isolated environments.
567
+
568
+ ### Build
569
+
570
+ ```bash
571
+ docker build -t trie-agent .
510
572
  ```
511
573
 
512
- ## Configuration
574
+ ### Run
513
575
 
514
- Create `.trie/config.json` to customize:
576
+ ```bash
577
+ # YOLO mode (auto-fix)
578
+ docker run -v $(pwd):/app trie-agent --yolo
579
+
580
+ # Watch mode (scan only)
581
+ docker run -v $(pwd):/app trie-agent
582
+
583
+ # CI mode (one-shot scan)
584
+ docker run -v $(pwd):/app trie-agent --once
585
+ ```
586
+
587
+ ### Docker Compose
588
+
589
+ ```bash
590
+ docker-compose up
591
+ ```
592
+
593
+ ### Modes
594
+
595
+ | Mode | Flag | Description |
596
+ |------|------|-------------|
597
+ | YOLO | `--yolo` | Auto-fix high-confidence issues |
598
+ | Watch | (default) | Scan on file changes |
599
+ | CI | `--once` | One-shot scan, exit with code |
600
+
601
+ ---
602
+
603
+ ## Team Collaboration
604
+
605
+ Coordinate security scanning across your team with automatic issue assignment and notifications.
606
+
607
+ ### Team Configuration
608
+
609
+ Create `.trie/team.json`:
515
610
 
516
611
  ```json
517
612
  {
518
- "agents": {
519
- "builtin": {
520
- "security": { "enabled": true },
521
- "soc2": { "enabled": true },
522
- "privacy": { "enabled": true }
613
+ "members": [
614
+ {
615
+ "id": "alice",
616
+ "name": "Alice Smith",
617
+ "email": "alice@example.com",
618
+ "slack": "@alice",
619
+ "expertise": ["security", "privacy"],
620
+ "maxIssues": 10
621
+ },
622
+ {
623
+ "id": "bob",
624
+ "name": "Bob Jones",
625
+ "email": "bob@example.com",
626
+ "slack": "@bob",
627
+ "expertise": ["bugs", "performance"],
628
+ "maxIssues": 15
629
+ }
630
+ ]
631
+ }
632
+ ```
633
+
634
+ ### Automatic Issue Assignment
635
+
636
+ Trie automatically assigns issues based on:
637
+ - **Expertise matching** — Security issues go to security experts
638
+ - **Workload balancing** — Respects `maxIssues` limits
639
+ - **Priority weighting** — Critical issues assigned first
640
+
641
+ ### Slack Integration
642
+
643
+ Uses Slack's [Incoming Webhooks](https://api.slack.com/messaging/webhooks) — no OAuth or bot tokens required.
644
+
645
+ **Setup:**
646
+ 1. Go to your Slack workspace → Apps → Incoming Webhooks
647
+ 2. Create a webhook for your channel
648
+ 3. Add to `.trie/config.json`:
649
+
650
+ ```json
651
+ {
652
+ "integrations": {
653
+ "slack": {
654
+ "enabled": true,
655
+ "webhook": "https://hooks.slack.com/services/...",
656
+ "channel": "#security-alerts"
523
657
  }
524
- },
525
- "compliance": {
526
- "standards": ["GDPR", "CCPA", "SOC2"]
527
658
  }
528
659
  }
529
660
  ```
530
661
 
662
+ **Notifications sent for:**
663
+ - Scan completion summaries with issue counts
664
+ - Critical issue alerts (immediate)
665
+ - Issue assignments to team members
666
+ - Escalations for overdue items
667
+ - Daily/weekly team summaries
668
+
669
+ ### Smart Issue Grouping
670
+
671
+ Issues are automatically:
672
+ - **Grouped** by pattern (same issue across files)
673
+ - **Prioritized** by risk score (0-100)
674
+ - **Categorized**: security, performance, maintainability, correctness, style
675
+ - **Bulk-fix detected** for trivial issues
676
+
677
+ ---
678
+
679
+ ## Available Tools
680
+
681
+ | Tool | Description |
682
+ |------|-------------|
683
+ | `trie_scan` | Intelligent scan with automatic agent selection |
684
+ | `trie_pr_review` | Interactive PR review |
685
+ | `trie_agent_smith` | AI code enforcer—43 hunters |
686
+ | `trie_fix` | Apply high-confidence fixes |
687
+ | `trie_explain` | Plain-language explanations |
688
+ | `trie_watch` | Continuous scanning mode |
689
+ | `trie_create_agent` | Create custom agent from document |
690
+ | `trie_list_agents` | List all available agents |
691
+ | `trie_visual_qa_browser` | Screenshot for vision analysis |
692
+
693
+ Plus individual agent tools: `trie_security`, `trie_privacy`, `trie_soc2`, `trie_bugs`, etc.
694
+
695
+ ---
696
+
531
697
  ## License
532
698
 
533
699
  MIT