tribunal-kit 4.3.1 → 4.4.1
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/.agent/agents/api-architect.md +66 -66
- package/.agent/agents/db-latency-auditor.md +216 -216
- package/.agent/agents/precedence-reviewer.md +250 -250
- package/.agent/agents/resilience-reviewer.md +88 -88
- package/.agent/agents/schema-reviewer.md +67 -67
- package/.agent/agents/throughput-optimizer.md +299 -299
- package/.agent/agents/ui-ux-auditor.md +292 -292
- package/.agent/agents/vitals-reviewer.md +223 -223
- package/.agent/scripts/_colors.js +18 -18
- package/.agent/scripts/_utils.js +42 -42
- package/.agent/scripts/append_flow.js +72 -72
- package/.agent/scripts/auto_preview.js +197 -197
- package/.agent/scripts/bundle_analyzer.js +290 -290
- package/.agent/scripts/case_law_manager.js +17 -6
- package/.agent/scripts/checklist.js +266 -266
- package/.agent/scripts/colors.js +17 -17
- package/.agent/scripts/compress_skills.js +141 -141
- package/.agent/scripts/consolidate_skills.js +149 -149
- package/.agent/scripts/context_broker.js +611 -609
- package/.agent/scripts/deep_compress.js +150 -150
- package/.agent/scripts/dependency_analyzer.js +272 -272
- package/.agent/scripts/graph_builder.js +151 -37
- package/.agent/scripts/graph_visualizer.js +384 -0
- package/.agent/scripts/inner_loop_validator.js +451 -465
- package/.agent/scripts/lint_runner.js +187 -187
- package/.agent/scripts/minify_context.js +100 -100
- package/.agent/scripts/mutation_runner.js +280 -0
- package/.agent/scripts/patch_skills_meta.js +156 -156
- package/.agent/scripts/patch_skills_output.js +244 -244
- package/.agent/scripts/schema_validator.js +297 -297
- package/.agent/scripts/security_scan.js +303 -303
- package/.agent/scripts/session_manager.js +276 -276
- package/.agent/scripts/skill_evolution.js +644 -644
- package/.agent/scripts/skill_integrator.js +313 -313
- package/.agent/scripts/strengthen_skills.js +193 -193
- package/.agent/scripts/strip_tribunal.js +47 -47
- package/.agent/scripts/swarm_dispatcher.js +360 -360
- package/.agent/scripts/test_runner.js +193 -193
- package/.agent/scripts/utils.js +32 -32
- package/.agent/scripts/verify_all.js +257 -256
- package/.agent/skills/app-builder/templates/astro-static/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/chrome-extension/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/cli-tool/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/electron-desktop/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/express-api/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/flutter-app/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/nextjs-static/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/nuxt-app/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/python-fastapi/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/react-native-app/TEMPLATE.md +1 -1
- package/.agent/skills/doc.md +1 -1
- package/.agent/skills/knowledge-graph/SKILL.md +32 -16
- package/.agent/skills/testing-patterns/SKILL.md +19 -2
- package/.agent/skills/ui-ux-pro-max/SKILL.md +480 -43
- package/.agent/workflows/generate.md +183 -183
- package/.agent/workflows/tribunal-speed.md +183 -183
- package/README.md +1 -1
- package/bin/tribunal-kit.js +134 -17
- package/package.json +6 -3
- package/scripts/changelog.js +167 -167
- package/scripts/sync-version.js +81 -81
- package/.agent/scripts/__pycache__/_colors.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/_utils.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/case_law_manager.cpython-311.pyc +0 -0
|
@@ -1,183 +1,183 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Full-stack parallel performance audit. Runs 3 scoped specialists simultaneously — vitals-reviewer (Frontend CWV), db-latency-auditor (SQL/ORM), throughput-optimizer (Node.js server) — then synthesizes a single ranked report. Maximum 5 AI calls regardless of project size. Use when full-stack performance profiling is needed.
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# /tribunal-speed — Full-Stack Performance Swarm
|
|
6
|
-
|
|
7
|
-
$ARGUMENTS
|
|
8
|
-
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
## When to Use /tribunal-speed
|
|
12
|
-
|
|
13
|
-
|Use `/tribunal-speed` when...|Use something else when...|
|
|
14
|
-
|:---|:---|
|
|
15
|
-
|Full-stack performance audit needed|Frontend only → `/tribunal-performance`|
|
|
16
|
-
|Changes span UI + DB + Server layers|Single file review → `/review`|
|
|
17
|
-
|Pre-deploy performance validation|Security-focused → `/tribunal-full`|
|
|
18
|
-
|Investigating end-to-end latency|Architecture planning → `/plan`|
|
|
19
|
-
|Need scoped specialist depth (not generic)|Quick generic check → `/tribunal-performance`|
|
|
20
|
-
|
|
21
|
-
---
|
|
22
|
-
|
|
23
|
-
## Architecture: 3-Phase Fan-Out (5 AI Calls Max)
|
|
24
|
-
|
|
25
|
-
```
|
|
26
|
-
Phase 1 — File Classification (1 call)
|
|
27
|
-
│
|
|
28
|
-
│ Classify all submitted files into:
|
|
29
|
-
│ ├── Frontend (.tsx, .jsx, .css, .module.css)
|
|
30
|
-
│ ├── Database (.sql, schema.prisma, files with prisma./db./drizzle(/knex()
|
|
31
|
-
│ └── Server (.ts/.js in /api, /server, /lib, /utils, /routes, /middleware)
|
|
32
|
-
│
|
|
33
|
-
│ Files that don't match any category → skip (not performance-relevant)
|
|
34
|
-
│
|
|
35
|
-
▼
|
|
36
|
-
Phase 2 — Parallel Specialist Audit (3 concurrent calls)
|
|
37
|
-
│
|
|
38
|
-
│ ┌──────────────────────┬──────────────────────┬───────────────────────┐
|
|
39
|
-
│ │ vitals-reviewer │ db-latency-auditor │ throughput-optimizer │
|
|
40
|
-
│ │ │ │ │
|
|
41
|
-
│ │ Receives ONLY │ Receives ONLY │ Receives ONLY │
|
|
42
|
-
│ │ Frontend files │ Database files │ Server files │
|
|
43
|
-
│ │ │ │ │
|
|
44
|
-
│ │ Checks: │ Checks: │ Checks: │
|
|
45
|
-
│ │ - LCP blockers │ - N+1 queries │ - Event-loop blocks │
|
|
46
|
-
│ │ - INP violations │ - Missing LIMIT │ - Serialized awaits │
|
|
47
|
-
│ │ - CLS triggers │ - Unindexed WHERE │ - Memory leaks │
|
|
48
|
-
│ │ - Suspense waterfalls│ - SELECT * abuse │ - Missing Workers │
|
|
49
|
-
│ │ - Paint jank │ - Pool config │ - Streaming gaps │
|
|
50
|
-
│ │ - Animation leaks │ - Wide transactions │ - No keep-alive │
|
|
51
|
-
│ └──────────────────────┴──────────────────────┴───────────────────────┘
|
|
52
|
-
│
|
|
53
|
-
│ Each specialist returns findings in its verdict format.
|
|
54
|
-
│ allSettled — one specialist failure does NOT block siblings.
|
|
55
|
-
│
|
|
56
|
-
▼
|
|
57
|
-
Phase 3 — Synthesis (1 call)
|
|
58
|
-
│
|
|
59
|
-
│ Merges 3 specialist reports into a single ranked issue list.
|
|
60
|
-
│ Priority: Critical → High → Medium → Low
|
|
61
|
-
│ Each issue tagged with: [AGENT] [FILE:LINE] [IMPACT METRIC] [FIX]
|
|
62
|
-
│
|
|
63
|
-
▼
|
|
64
|
-
Human Gate — Final report shown
|
|
65
|
-
Y = acknowledge | N = discard | R = re-audit with different scope
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
**Total cost: 5 AI calls maximum** — predictable, repeatable, project-size-independent.
|
|
69
|
-
|
|
70
|
-
---
|
|
71
|
-
|
|
72
|
-
## Token Discipline Rules
|
|
73
|
-
|
|
74
|
-
```
|
|
75
|
-
Rule 1: Each specialist reads ONLY its scoped files — never the full project
|
|
76
|
-
Rule 2: If a category has zero files, that specialist is skipped (saves 1 call)
|
|
77
|
-
Rule 3: File contents are trimmed to relevant sections via targeted grep
|
|
78
|
-
Rule 4: Synthesis call receives only verdict summaries, not full file contents
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
---
|
|
82
|
-
|
|
83
|
-
## 3 Specialist Agents
|
|
84
|
-
|
|
85
|
-
### vitals-reviewer (Frontend)
|
|
86
|
-
- **Scope:** `.tsx`, `.jsx`, `.css`, `.module.css`
|
|
87
|
-
- **Metrics:** INP, LCP, CLS, FCP
|
|
88
|
-
- **Key patterns:** React 19 `use()` waterfalls, non-passive listeners, missing `content-visibility`, `useGSAP` leaks, View Transitions jank, Suspense placement
|
|
89
|
-
|
|
90
|
-
### db-latency-auditor (Database)
|
|
91
|
-
- **Scope:** `.sql`, `schema.prisma`, files with `prisma.`, `db.`, `drizzle(`, `knex(`
|
|
92
|
-
- **Metrics:** Query count, query latency, connection overhead
|
|
93
|
-
- **Key patterns:** N+1 queries, missing LIMIT, unindexed WHERE, SELECT *, no connection pooling, over-scoped transactions, mass assignment
|
|
94
|
-
|
|
95
|
-
### throughput-optimizer (Server)
|
|
96
|
-
- **Scope:** `.ts/.js` in `/api`, `/server`, `/lib`, `/utils`, `/routes`, `/middleware`
|
|
97
|
-
- **Metrics:** RPS, p95 latency, memory usage
|
|
98
|
-
- **Key patterns:** Sync `fs.*`, serialized `await` loops, global Map without TTL, no Worker Threads for CPU ops, buffer bloat, missing keep-alive
|
|
99
|
-
|
|
100
|
-
---
|
|
101
|
-
|
|
102
|
-
## Synthesis Output Format
|
|
103
|
-
|
|
104
|
-
```
|
|
105
|
-
━━━ Tribunal Speed: Full-Stack Performance Audit ━━━━━━━━━━━━━━
|
|
106
|
-
|
|
107
|
-
Specialists dispatched: 3 | Completed: 3 | Skipped: 0
|
|
108
|
-
|
|
109
|
-
━━━ Critical Issues ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
110
|
-
|
|
111
|
-
[CRITICAL] throughput-optimizer | api/orders.ts:47
|
|
112
|
-
Pattern: SERIALIZED-AWAIT
|
|
113
|
-
Issue: await inside for-loop serializes 5 DB calls (1500ms vs 300ms parallel)
|
|
114
|
-
Fix: const results = await Promise.all(ids.map(id => fetchOrder(id)));
|
|
115
|
-
Impact: -1200ms p95 API latency
|
|
116
|
-
|
|
117
|
-
[CRITICAL] db-latency-auditor | lib/users.ts:23
|
|
118
|
-
Pattern: N+1
|
|
119
|
-
Issue: findMany in loop generates 101 queries for 100 users
|
|
120
|
-
Fix: Use prisma.user.findMany({ include: { posts: true } })
|
|
121
|
-
Impact: 101 queries → 1 query
|
|
122
|
-
|
|
123
|
-
━━━ High Issues ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
124
|
-
|
|
125
|
-
[HIGH] vitals-reviewer | components/Hero.tsx:12
|
|
126
|
-
Pattern: LCP
|
|
127
|
-
Issue: Hero image without priority prop — browser discovers it late
|
|
128
|
-
Fix: Add priority={true} to next/image component
|
|
129
|
-
Impact: LCP improvement ~500ms
|
|
130
|
-
|
|
131
|
-
━━━ Medium Issues ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
132
|
-
|
|
133
|
-
[MEDIUM] vitals-reviewer | app/feed/page.tsx:89
|
|
134
|
-
Pattern: CLS
|
|
135
|
-
Issue: Feed items missing content-visibility: auto
|
|
136
|
-
Fix: Add content-visibility: auto; contain-intrinsic-size: auto 200px;
|
|
137
|
-
Impact: Reduced off-screen rendering cost
|
|
138
|
-
|
|
139
|
-
━━━ Summary ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
140
|
-
|
|
141
|
-
Total issues: 7 (2 Critical, 2 High, 3 Medium)
|
|
142
|
-
AI calls used: 5
|
|
143
|
-
Token budget: Within scope (specialists read only categorized files)
|
|
144
|
-
|
|
145
|
-
━━━ Human Gate ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
146
|
-
Acknowledged? Y = close | R = re-audit different scope
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
---
|
|
150
|
-
|
|
151
|
-
## Specialist Failure Handling
|
|
152
|
-
|
|
153
|
-
```
|
|
154
|
-
If a specialist fails after 3 retries:
|
|
155
|
-
→ Log failure with agent name + error
|
|
156
|
-
→ Continue with remaining specialists
|
|
157
|
-
→ Include "[SPECIALIST FAILED]" in synthesis report
|
|
158
|
-
→ Never silently skip — always visible in output
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
---
|
|
162
|
-
|
|
163
|
-
## Versus Other Commands
|
|
164
|
-
|
|
165
|
-
|Command|Agents|Depth|When to Use|
|
|
166
|
-
|:---|:---|:---|:---|
|
|
167
|
-
|`/tribunal-performance`|logic + performance-reviewer|Generic CWV check|Quick single-file perf scan|
|
|
168
|
-
|`/tribunal-speed`|vitals + db-latency + throughput|Deep 3-domain parallel|Full-stack perf audit|
|
|
169
|
-
|`/tribunal-full`|All 14 agents|Everything|Maximum coverage (security + perf + all)|
|
|
170
|
-
|`/performance-benchmarker`|Lighthouse + bundle|Measurement only|Get actual scores, not code review|
|
|
171
|
-
|
|
172
|
-
---
|
|
173
|
-
|
|
174
|
-
## Usage Examples
|
|
175
|
-
|
|
176
|
-
```
|
|
177
|
-
/tribunal-speed the entire checkout flow (UI + API + DB queries)
|
|
178
|
-
/tribunal-speed all files changed in this PR for performance regression
|
|
179
|
-
/tribunal-speed the dashboard page end-to-end (data fetch + render + DB)
|
|
180
|
-
/tribunal-speed the search feature: autocomplete UI + search API + query plan
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
---
|
|
1
|
+
---
|
|
2
|
+
description: Full-stack parallel performance audit. Runs 3 scoped specialists simultaneously — vitals-reviewer (Frontend CWV), db-latency-auditor (SQL/ORM), throughput-optimizer (Node.js server) — then synthesizes a single ranked report. Maximum 5 AI calls regardless of project size. Use when full-stack performance profiling is needed.
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# /tribunal-speed — Full-Stack Performance Swarm
|
|
6
|
+
|
|
7
|
+
$ARGUMENTS
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## When to Use /tribunal-speed
|
|
12
|
+
|
|
13
|
+
|Use `/tribunal-speed` when...|Use something else when...|
|
|
14
|
+
|:---|:---|
|
|
15
|
+
|Full-stack performance audit needed|Frontend only → `/tribunal-performance`|
|
|
16
|
+
|Changes span UI + DB + Server layers|Single file review → `/review`|
|
|
17
|
+
|Pre-deploy performance validation|Security-focused → `/tribunal-full`|
|
|
18
|
+
|Investigating end-to-end latency|Architecture planning → `/plan`|
|
|
19
|
+
|Need scoped specialist depth (not generic)|Quick generic check → `/tribunal-performance`|
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Architecture: 3-Phase Fan-Out (5 AI Calls Max)
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
Phase 1 — File Classification (1 call)
|
|
27
|
+
│
|
|
28
|
+
│ Classify all submitted files into:
|
|
29
|
+
│ ├── Frontend (.tsx, .jsx, .css, .module.css)
|
|
30
|
+
│ ├── Database (.sql, schema.prisma, files with prisma./db./drizzle(/knex()
|
|
31
|
+
│ └── Server (.ts/.js in /api, /server, /lib, /utils, /routes, /middleware)
|
|
32
|
+
│
|
|
33
|
+
│ Files that don't match any category → skip (not performance-relevant)
|
|
34
|
+
│
|
|
35
|
+
▼
|
|
36
|
+
Phase 2 — Parallel Specialist Audit (3 concurrent calls)
|
|
37
|
+
│
|
|
38
|
+
│ ┌──────────────────────┬──────────────────────┬───────────────────────┐
|
|
39
|
+
│ │ vitals-reviewer │ db-latency-auditor │ throughput-optimizer │
|
|
40
|
+
│ │ │ │ │
|
|
41
|
+
│ │ Receives ONLY │ Receives ONLY │ Receives ONLY │
|
|
42
|
+
│ │ Frontend files │ Database files │ Server files │
|
|
43
|
+
│ │ │ │ │
|
|
44
|
+
│ │ Checks: │ Checks: │ Checks: │
|
|
45
|
+
│ │ - LCP blockers │ - N+1 queries │ - Event-loop blocks │
|
|
46
|
+
│ │ - INP violations │ - Missing LIMIT │ - Serialized awaits │
|
|
47
|
+
│ │ - CLS triggers │ - Unindexed WHERE │ - Memory leaks │
|
|
48
|
+
│ │ - Suspense waterfalls│ - SELECT * abuse │ - Missing Workers │
|
|
49
|
+
│ │ - Paint jank │ - Pool config │ - Streaming gaps │
|
|
50
|
+
│ │ - Animation leaks │ - Wide transactions │ - No keep-alive │
|
|
51
|
+
│ └──────────────────────┴──────────────────────┴───────────────────────┘
|
|
52
|
+
│
|
|
53
|
+
│ Each specialist returns findings in its verdict format.
|
|
54
|
+
│ allSettled — one specialist failure does NOT block siblings.
|
|
55
|
+
│
|
|
56
|
+
▼
|
|
57
|
+
Phase 3 — Synthesis (1 call)
|
|
58
|
+
│
|
|
59
|
+
│ Merges 3 specialist reports into a single ranked issue list.
|
|
60
|
+
│ Priority: Critical → High → Medium → Low
|
|
61
|
+
│ Each issue tagged with: [AGENT] [FILE:LINE] [IMPACT METRIC] [FIX]
|
|
62
|
+
│
|
|
63
|
+
▼
|
|
64
|
+
Human Gate — Final report shown
|
|
65
|
+
Y = acknowledge | N = discard | R = re-audit with different scope
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
**Total cost: 5 AI calls maximum** — predictable, repeatable, project-size-independent.
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Token Discipline Rules
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
Rule 1: Each specialist reads ONLY its scoped files — never the full project
|
|
76
|
+
Rule 2: If a category has zero files, that specialist is skipped (saves 1 call)
|
|
77
|
+
Rule 3: File contents are trimmed to relevant sections via targeted grep
|
|
78
|
+
Rule 4: Synthesis call receives only verdict summaries, not full file contents
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## 3 Specialist Agents
|
|
84
|
+
|
|
85
|
+
### vitals-reviewer (Frontend)
|
|
86
|
+
- **Scope:** `.tsx`, `.jsx`, `.css`, `.module.css`
|
|
87
|
+
- **Metrics:** INP, LCP, CLS, FCP
|
|
88
|
+
- **Key patterns:** React 19 `use()` waterfalls, non-passive listeners, missing `content-visibility`, `useGSAP` leaks, View Transitions jank, Suspense placement
|
|
89
|
+
|
|
90
|
+
### db-latency-auditor (Database)
|
|
91
|
+
- **Scope:** `.sql`, `schema.prisma`, files with `prisma.`, `db.`, `drizzle(`, `knex(`
|
|
92
|
+
- **Metrics:** Query count, query latency, connection overhead
|
|
93
|
+
- **Key patterns:** N+1 queries, missing LIMIT, unindexed WHERE, SELECT *, no connection pooling, over-scoped transactions, mass assignment
|
|
94
|
+
|
|
95
|
+
### throughput-optimizer (Server)
|
|
96
|
+
- **Scope:** `.ts/.js` in `/api`, `/server`, `/lib`, `/utils`, `/routes`, `/middleware`
|
|
97
|
+
- **Metrics:** RPS, p95 latency, memory usage
|
|
98
|
+
- **Key patterns:** Sync `fs.*`, serialized `await` loops, global Map without TTL, no Worker Threads for CPU ops, buffer bloat, missing keep-alive
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## Synthesis Output Format
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
━━━ Tribunal Speed: Full-Stack Performance Audit ━━━━━━━━━━━━━━
|
|
106
|
+
|
|
107
|
+
Specialists dispatched: 3 | Completed: 3 | Skipped: 0
|
|
108
|
+
|
|
109
|
+
━━━ Critical Issues ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
110
|
+
|
|
111
|
+
[CRITICAL] throughput-optimizer | api/orders.ts:47
|
|
112
|
+
Pattern: SERIALIZED-AWAIT
|
|
113
|
+
Issue: await inside for-loop serializes 5 DB calls (1500ms vs 300ms parallel)
|
|
114
|
+
Fix: const results = await Promise.all(ids.map(id => fetchOrder(id)));
|
|
115
|
+
Impact: -1200ms p95 API latency
|
|
116
|
+
|
|
117
|
+
[CRITICAL] db-latency-auditor | lib/users.ts:23
|
|
118
|
+
Pattern: N+1
|
|
119
|
+
Issue: findMany in loop generates 101 queries for 100 users
|
|
120
|
+
Fix: Use prisma.user.findMany({ include: { posts: true } })
|
|
121
|
+
Impact: 101 queries → 1 query
|
|
122
|
+
|
|
123
|
+
━━━ High Issues ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
124
|
+
|
|
125
|
+
[HIGH] vitals-reviewer | components/Hero.tsx:12
|
|
126
|
+
Pattern: LCP
|
|
127
|
+
Issue: Hero image without priority prop — browser discovers it late
|
|
128
|
+
Fix: Add priority={true} to next/image component
|
|
129
|
+
Impact: LCP improvement ~500ms
|
|
130
|
+
|
|
131
|
+
━━━ Medium Issues ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
132
|
+
|
|
133
|
+
[MEDIUM] vitals-reviewer | app/feed/page.tsx:89
|
|
134
|
+
Pattern: CLS
|
|
135
|
+
Issue: Feed items missing content-visibility: auto
|
|
136
|
+
Fix: Add content-visibility: auto; contain-intrinsic-size: auto 200px;
|
|
137
|
+
Impact: Reduced off-screen rendering cost
|
|
138
|
+
|
|
139
|
+
━━━ Summary ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
140
|
+
|
|
141
|
+
Total issues: 7 (2 Critical, 2 High, 3 Medium)
|
|
142
|
+
AI calls used: 5
|
|
143
|
+
Token budget: Within scope (specialists read only categorized files)
|
|
144
|
+
|
|
145
|
+
━━━ Human Gate ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
146
|
+
Acknowledged? Y = close | R = re-audit different scope
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## Specialist Failure Handling
|
|
152
|
+
|
|
153
|
+
```
|
|
154
|
+
If a specialist fails after 3 retries:
|
|
155
|
+
→ Log failure with agent name + error
|
|
156
|
+
→ Continue with remaining specialists
|
|
157
|
+
→ Include "[SPECIALIST FAILED]" in synthesis report
|
|
158
|
+
→ Never silently skip — always visible in output
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## Versus Other Commands
|
|
164
|
+
|
|
165
|
+
|Command|Agents|Depth|When to Use|
|
|
166
|
+
|:---|:---|:---|:---|
|
|
167
|
+
|`/tribunal-performance`|logic + performance-reviewer|Generic CWV check|Quick single-file perf scan|
|
|
168
|
+
|`/tribunal-speed`|vitals + db-latency + throughput|Deep 3-domain parallel|Full-stack perf audit|
|
|
169
|
+
|`/tribunal-full`|All 14 agents|Everything|Maximum coverage (security + perf + all)|
|
|
170
|
+
|`/performance-benchmarker`|Lighthouse + bundle|Measurement only|Get actual scores, not code review|
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## Usage Examples
|
|
175
|
+
|
|
176
|
+
```
|
|
177
|
+
/tribunal-speed the entire checkout flow (UI + API + DB queries)
|
|
178
|
+
/tribunal-speed all files changed in this PR for performance regression
|
|
179
|
+
/tribunal-speed the dashboard page end-to-end (data fetch + render + DB)
|
|
180
|
+
/tribunal-speed the search feature: autocomplete UI + search API + query plan
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
---
|
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
<br><br>
|
|
15
15
|
|
|
16
16
|
> 🚨 **AI GENERATES CODE. TRIBUNAL ENSURES IT WORKS.**
|
|
17
|
-
> A plug-in `.agent/` intelligence payload that upgrades your IDE with **41 specialist agents**, **
|
|
17
|
+
> A plug-in `.agent/` intelligence payload that upgrades your IDE with **41 specialist agents**, **31 slash commands**, **91 hardened skills**, and a **16-reviewer Tribunal pipeline** — zero hallucinations, zero configuration.
|
|
18
18
|
|
|
19
19
|
---
|
|
20
20
|
|
package/bin/tribunal-kit.js
CHANGED
|
@@ -324,16 +324,11 @@ function banner() {
|
|
|
324
324
|
██║ ██║ ██║██║██████╔╝╚██████╔╝██║ ╚████║██║ ██║███████╗ ██║ ██╗██║ ██║
|
|
325
325
|
╚═╝ ╚═╝ ╚═╝╚═╝╚═════╝ ╚═════╝ ╚═╝ ╚═══╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ `.split('\n').filter(Boolean);
|
|
326
326
|
console.log();
|
|
327
|
-
const
|
|
327
|
+
const _maxLen = Math.max(...art.map(line => line.length));
|
|
328
328
|
for (const line of art) {
|
|
329
329
|
let gradientLine = ' ' + C.bold;
|
|
330
330
|
for (let i = 0; i < line.length; i++) {
|
|
331
|
-
|
|
332
|
-
// Solid #ff1637 (R: 255, G: 22, B: 55)
|
|
333
|
-
const r = 255;
|
|
334
|
-
const g = 22;
|
|
335
|
-
const b = 55;
|
|
336
|
-
gradientLine += `\x1b[38;2;${r};${g};${b}m${line[i]}`;
|
|
331
|
+
gradientLine += `\x1b[38;2;255;22;55m${line[i]}`;
|
|
337
332
|
}
|
|
338
333
|
gradientLine += C.reset;
|
|
339
334
|
log(gradientLine);
|
|
@@ -380,7 +375,7 @@ function cmdInit(flags) {
|
|
|
380
375
|
fs.mkdirSync(backupDir, { recursive: true });
|
|
381
376
|
|
|
382
377
|
// PRESERVE_DIRS: user-generated content that must survive updates
|
|
383
|
-
const
|
|
378
|
+
const _PRESERVE_DIRS = ['history', 'patterns', 'mcp_config.json'];
|
|
384
379
|
const subdirs = ['agents', 'workflows', 'skills', 'scripts', '.shared', 'rules'];
|
|
385
380
|
for (const sub of subdirs) {
|
|
386
381
|
const subPath = path.join(agentDest, sub);
|
|
@@ -392,13 +387,7 @@ function cmdInit(flags) {
|
|
|
392
387
|
}
|
|
393
388
|
log(` ${c('gray', '✦ Backed up existing configurations to .agent/.backups/')}`);
|
|
394
389
|
|
|
395
|
-
|
|
396
|
-
for (const kept of PRESERVE_DIRS) {
|
|
397
|
-
const keptPath = path.join(agentDest, kept);
|
|
398
|
-
if (kept.includes('.') ? false : !fs.existsSync(keptPath)) {
|
|
399
|
-
// It's okay if it doesn't exist yet — it'll be created below
|
|
400
|
-
}
|
|
401
|
-
}
|
|
390
|
+
|
|
402
391
|
}
|
|
403
392
|
// ────────────────────────────────────────────────────────
|
|
404
393
|
|
|
@@ -681,7 +670,7 @@ function cmdLearn(flags) {
|
|
|
681
670
|
|
|
682
671
|
const dryRun = flags.dryRun ? '--dry-run' : '';
|
|
683
672
|
const useHead = flags.head ? '--head' : '';
|
|
684
|
-
|
|
673
|
+
|
|
685
674
|
|
|
686
675
|
// Phase 1: Skill Evolution
|
|
687
676
|
log(` ${c('cyan', '\u229b')} ${bold('Phase 1')} \u2014 Skill Evolution Forge (auto-generating project idioms)`);
|
|
@@ -745,6 +734,15 @@ async function runWithUpdateCheck(command, flags) {
|
|
|
745
734
|
case 'hook':
|
|
746
735
|
cmdHook(flags);
|
|
747
736
|
break;
|
|
737
|
+
case 'graph':
|
|
738
|
+
cmdGraph(flags);
|
|
739
|
+
break;
|
|
740
|
+
case 'mutate':
|
|
741
|
+
cmdMutate(flags);
|
|
742
|
+
break;
|
|
743
|
+
case 'context':
|
|
744
|
+
cmdContext(flags);
|
|
745
|
+
break;
|
|
748
746
|
case 'uninstall':
|
|
749
747
|
cmdUninstall(flags);
|
|
750
748
|
break;
|
|
@@ -799,11 +797,39 @@ function cmdCase(flags) {
|
|
|
799
797
|
try {
|
|
800
798
|
const { execSync } = require('child_process');
|
|
801
799
|
execSync(`node "${caseLawScript}" ${pyArgs}`, { stdio: 'inherit', cwd: targetDir });
|
|
802
|
-
} catch
|
|
800
|
+
} catch {
|
|
803
801
|
process.exit(1); // Script already prints errors
|
|
804
802
|
}
|
|
805
803
|
}
|
|
806
804
|
|
|
805
|
+
function cmdGraph(flags) {
|
|
806
|
+
const targetDir = flags.path ? path.resolve(flags.path) : process.cwd();
|
|
807
|
+
const agentDest = path.join(targetDir, '.agent');
|
|
808
|
+
|
|
809
|
+
if (!fs.existsSync(agentDest)) {
|
|
810
|
+
err('.agent/ not found. Run: npx tribunal-kit init');
|
|
811
|
+
process.exit(1);
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
banner();
|
|
815
|
+
const { execSync } = require('child_process');
|
|
816
|
+
const builderScript = path.join(agentDest, 'scripts', 'graph_builder.js');
|
|
817
|
+
const visualizerScript = path.join(agentDest, 'scripts', 'graph_visualizer.js');
|
|
818
|
+
const htmlFile = path.join(agentDest, 'history', 'architecture-explorer.html');
|
|
819
|
+
|
|
820
|
+
try {
|
|
821
|
+
execSync(`node "${builderScript}"`, { stdio: 'inherit', cwd: targetDir });
|
|
822
|
+
execSync(`node "${visualizerScript}"`, { stdio: 'inherit', cwd: targetDir });
|
|
823
|
+
|
|
824
|
+
log(` ${c('cyan', '▸')} Opening visualizer in browser...`);
|
|
825
|
+
const opener = process.platform === 'win32' ? 'start' : process.platform === 'darwin' ? 'open' : 'xdg-open';
|
|
826
|
+
execSync(`${opener} "${htmlFile}"`);
|
|
827
|
+
} catch (e) {
|
|
828
|
+
err(`Graph generation failed: ${e.message}`);
|
|
829
|
+
process.exit(1);
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
|
|
807
833
|
function cmdHook(flags) {
|
|
808
834
|
const targetDir = flags.path ? path.resolve(flags.path) : process.cwd();
|
|
809
835
|
const gitDir = path.join(targetDir, '.git');
|
|
@@ -829,6 +855,30 @@ function cmdHook(flags) {
|
|
|
829
855
|
console.log();
|
|
830
856
|
}
|
|
831
857
|
|
|
858
|
+
function cmdMutate(flags) {
|
|
859
|
+
const targetDir = flags.path ? path.resolve(flags.path) : process.cwd();
|
|
860
|
+
const agentDest = path.join(targetDir, '.agent');
|
|
861
|
+
|
|
862
|
+
if (!fs.existsSync(agentDest)) {
|
|
863
|
+
err('.agent/ not found. Run: npx tribunal-kit init');
|
|
864
|
+
process.exit(1);
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
const args = process.argv.slice(3);
|
|
868
|
+
if (args.length < 2) {
|
|
869
|
+
err('Usage: npx tribunal-kit mutate <target_file> <test_command>');
|
|
870
|
+
process.exit(1);
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
const mutateScript = path.join(agentDest, 'scripts', 'mutation_runner.js');
|
|
874
|
+
const { execSync } = require('child_process');
|
|
875
|
+
try {
|
|
876
|
+
execSync(`node "${mutateScript}" ${args.join(' ')}`, { stdio: 'inherit', cwd: targetDir });
|
|
877
|
+
} catch {
|
|
878
|
+
process.exit(1);
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
|
|
832
882
|
function cmdUninstall(flags) {
|
|
833
883
|
const targetDir = flags.path ? path.resolve(flags.path) : process.cwd();
|
|
834
884
|
const agentDest = path.join(targetDir, '.agent');
|
|
@@ -903,6 +953,9 @@ function cmdHelp() {
|
|
|
903
953
|
log(cmd('status', 'Check if .agent/ is installed'));
|
|
904
954
|
log(cmd('learn', 'Evolve project idioms based on git diffs'));
|
|
905
955
|
log(cmd('case', 'Manage Case Law precedents (add, search, list, show, stats, overrule)'));
|
|
956
|
+
log(cmd('graph', 'Build and visualize the architecture graph'));
|
|
957
|
+
log(cmd('mutate', 'Run the Mutation Engine to test test-suite reliability'));
|
|
958
|
+
log(cmd('context', 'Retrieve a highly-optimized Context Snapshot for a file'));
|
|
906
959
|
log(cmd('hook', 'Install pre-push git hook for auto-learning'));
|
|
907
960
|
log(cmd('uninstall','Remove .agent/ folder from project'));
|
|
908
961
|
console.log();
|
|
@@ -939,11 +992,75 @@ function cmdHelp() {
|
|
|
939
992
|
log(ex('tk case stats'));
|
|
940
993
|
log(ex('tk case export'));
|
|
941
994
|
log(ex('tk case overrule --id 1'));
|
|
995
|
+
log(ex('tk graph'));
|
|
996
|
+
log(ex('tk mutate src/utils.js "npm test"'));
|
|
942
997
|
log(ex('tk hook'));
|
|
943
998
|
log(ex('tk uninstall'));
|
|
944
999
|
console.log();
|
|
945
1000
|
}
|
|
946
1001
|
|
|
1002
|
+
|
|
1003
|
+
function cmdContext(flags) {
|
|
1004
|
+
const targetDir = flags.path ? path.resolve(flags.path) : process.cwd();
|
|
1005
|
+
const agentDest = path.join(targetDir, '.agent');
|
|
1006
|
+
|
|
1007
|
+
if (!fs.existsSync(agentDest)) {
|
|
1008
|
+
err('.agent/ not found. Run: npx tribunal-kit init');
|
|
1009
|
+
process.exit(1);
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
const args = process.argv.slice(3);
|
|
1013
|
+
if (args.length === 0 || args[0] === 'help' || args[0] === '--help') {
|
|
1014
|
+
console.error('Usage: npx tribunal-kit context <target_file>');
|
|
1015
|
+
process.exit(1);
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
const targetFile = args[0].replace(/\\/g, '/');
|
|
1019
|
+
const snapshotName = targetFile.replace(/[\\\/]/g, '__') + '.json';
|
|
1020
|
+
const snapshotPath = require('path').join(agentDest, 'history', 'snapshots', snapshotName);
|
|
1021
|
+
|
|
1022
|
+
if (!require('fs').existsSync(snapshotPath)) {
|
|
1023
|
+
console.error(' \x1b[91m✖\x1b[0m Context Snapshot not found for: ' + targetFile);
|
|
1024
|
+
console.log(' Run: npx tribunal-kit graph (to generate snapshots)');
|
|
1025
|
+
process.exit(1);
|
|
1026
|
+
}
|
|
1027
|
+
|
|
1028
|
+
try {
|
|
1029
|
+
const snapshot = JSON.parse(require('fs').readFileSync(snapshotPath, 'utf8'));
|
|
1030
|
+
|
|
1031
|
+
console.log('\n# Context Snapshot: ' + snapshot.file);
|
|
1032
|
+
process.stdout.write('> Size Estimate: ' + (snapshot['estimatedTokens'] || 'Unknown') + '\n');
|
|
1033
|
+
console.log('> Risk Score: ' + snapshot.riskScore + ' (Blast Radius: ' + snapshot.blastRadius + ')\n');
|
|
1034
|
+
|
|
1035
|
+
if (Object.keys(snapshot.imports).length > 0) {
|
|
1036
|
+
console.log('## Imports');
|
|
1037
|
+
for (const [imp, exports] of Object.entries(snapshot.imports)) {
|
|
1038
|
+
if (exports && exports.length > 0) {
|
|
1039
|
+
console.log('- `' + imp + '` (exports: ' + exports.join(', ') + ')');
|
|
1040
|
+
} else {
|
|
1041
|
+
console.log('- `' + imp + '`');
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
console.log();
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1047
|
+
if (snapshot.dependents && snapshot.dependents.length > 0) {
|
|
1048
|
+
console.log('## Dependents');
|
|
1049
|
+
for (const dep of snapshot.dependents) {
|
|
1050
|
+
console.log('- `' + dep + '`');
|
|
1051
|
+
}
|
|
1052
|
+
console.log();
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1055
|
+
console.log('## Source Code');
|
|
1056
|
+
console.log('```javascript\n' + snapshot.content + '\n```\n');
|
|
1057
|
+
|
|
1058
|
+
} catch (e) {
|
|
1059
|
+
console.error('Failed to read snapshot: ' + e.message);
|
|
1060
|
+
process.exit(1);
|
|
1061
|
+
}
|
|
1062
|
+
}
|
|
1063
|
+
|
|
947
1064
|
// ── Main ──────────────────────────────────────────────────
|
|
948
1065
|
const { command, flags } = parseArgs(process.argv);
|
|
949
1066
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tribunal-kit",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.4.1",
|
|
4
4
|
"description": "Anti-Hallucination AI Agent Kit — 40 specialist agents, 31 slash commands, 16 parallel Tribunal reviewers, Performance Swarm engine, and Supreme Court case law pipeline.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -63,10 +63,13 @@
|
|
|
63
63
|
"changelog": "node scripts/changelog.js",
|
|
64
64
|
"changelog:preview": "node scripts/changelog.js --preview",
|
|
65
65
|
"sync": "node scripts/sync-version.js",
|
|
66
|
-
"validate-payload": "node scripts/validate-payload.js"
|
|
66
|
+
"validate-payload": "node scripts/validate-payload.js",
|
|
67
|
+
"build": "echo 'No build step required for this project'"
|
|
67
68
|
},
|
|
68
69
|
"devDependencies": {
|
|
69
|
-
"jest": "^29.7.0"
|
|
70
|
+
"jest": "^29.7.0",
|
|
71
|
+
"typescript": "^5.4.5",
|
|
72
|
+
"eslint": "^9.1.1"
|
|
70
73
|
},
|
|
71
74
|
"jest": {
|
|
72
75
|
"testMatch": [
|