tribunal-kit 4.0.0 → 4.2.0

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 (108) hide show
  1. package/.agent/GEMINI.md +4 -2
  2. package/.agent/agents/api-architect.md +66 -0
  3. package/.agent/agents/db-latency-auditor.md +216 -0
  4. package/.agent/agents/precedence-reviewer.md +41 -4
  5. package/.agent/agents/resilience-reviewer.md +88 -0
  6. package/.agent/agents/schema-reviewer.md +67 -0
  7. package/.agent/agents/throughput-optimizer.md +299 -0
  8. package/.agent/agents/vitals-reviewer.md +223 -0
  9. package/.agent/history/case-law/cases/case-0001.json +33 -0
  10. package/.agent/history/case-law/index.json +35 -0
  11. package/.agent/rules/GEMINI.md +20 -3
  12. package/.agent/scripts/case_law_manager.py +237 -7
  13. package/.agent/skills/agent-organizer/SKILL.md +42 -0
  14. package/.agent/skills/agentic-patterns/SKILL.md +42 -0
  15. package/.agent/skills/ai-prompt-injection-defense/SKILL.md +42 -0
  16. package/.agent/skills/api-patterns/SKILL.md +42 -0
  17. package/.agent/skills/api-security-auditor/SKILL.md +42 -0
  18. package/.agent/skills/app-builder/SKILL.md +42 -0
  19. package/.agent/skills/app-builder/templates/SKILL.md +70 -0
  20. package/.agent/skills/appflow-wireframe/SKILL.md +42 -0
  21. package/.agent/skills/architecture/SKILL.md +42 -0
  22. package/.agent/skills/authentication-best-practices/SKILL.md +42 -0
  23. package/.agent/skills/bash-linux/SKILL.md +42 -0
  24. package/.agent/skills/behavioral-modes/SKILL.md +42 -0
  25. package/.agent/skills/brainstorming/SKILL.md +42 -0
  26. package/.agent/skills/building-native-ui/SKILL.md +42 -0
  27. package/.agent/skills/clean-code/SKILL.md +42 -0
  28. package/.agent/skills/code-review-checklist/SKILL.md +42 -0
  29. package/.agent/skills/config-validator/SKILL.md +42 -0
  30. package/.agent/skills/csharp-developer/SKILL.md +42 -0
  31. package/.agent/skills/data-validation-schemas/SKILL.md +320 -0
  32. package/.agent/skills/database-design/SKILL.md +42 -0
  33. package/.agent/skills/deployment-procedures/SKILL.md +42 -0
  34. package/.agent/skills/devops-engineer/SKILL.md +42 -0
  35. package/.agent/skills/devops-incident-responder/SKILL.md +42 -0
  36. package/.agent/skills/documentation-templates/SKILL.md +42 -0
  37. package/.agent/skills/edge-computing/SKILL.md +42 -0
  38. package/.agent/skills/error-resilience/SKILL.md +420 -0
  39. package/.agent/skills/extract-design-system/SKILL.md +42 -0
  40. package/.agent/skills/framer-motion-expert/SKILL.md +42 -0
  41. package/.agent/skills/frontend-design/SKILL.md +42 -0
  42. package/.agent/skills/game-design-expert/SKILL.md +42 -0
  43. package/.agent/skills/game-engineering-expert/SKILL.md +42 -0
  44. package/.agent/skills/geo-fundamentals/SKILL.md +42 -0
  45. package/.agent/skills/github-operations/SKILL.md +42 -0
  46. package/.agent/skills/gsap-core/SKILL.md +302 -0
  47. package/.agent/skills/gsap-frameworks/SKILL.md +201 -0
  48. package/.agent/skills/gsap-performance/SKILL.md +127 -0
  49. package/.agent/skills/gsap-plugins/SKILL.md +474 -0
  50. package/.agent/skills/gsap-react/SKILL.md +183 -0
  51. package/.agent/skills/gsap-scrolltrigger/SKILL.md +344 -0
  52. package/.agent/skills/gsap-timeline/SKILL.md +155 -0
  53. package/.agent/skills/gsap-utils/SKILL.md +332 -0
  54. package/.agent/skills/i18n-localization/SKILL.md +42 -0
  55. package/.agent/skills/intelligent-routing/SKILL.md +72 -1
  56. package/.agent/skills/lint-and-validate/SKILL.md +42 -0
  57. package/.agent/skills/llm-engineering/SKILL.md +42 -0
  58. package/.agent/skills/local-first/SKILL.md +42 -0
  59. package/.agent/skills/mcp-builder/SKILL.md +42 -0
  60. package/.agent/skills/mobile-design/SKILL.md +42 -0
  61. package/.agent/skills/monorepo-management/SKILL.md +326 -0
  62. package/.agent/skills/motion-engineering/SKILL.md +42 -0
  63. package/.agent/skills/nextjs-react-expert/SKILL.md +42 -0
  64. package/.agent/skills/nodejs-best-practices/SKILL.md +42 -0
  65. package/.agent/skills/observability/SKILL.md +42 -0
  66. package/.agent/skills/parallel-agents/SKILL.md +42 -0
  67. package/.agent/skills/performance-profiling/SKILL.md +42 -0
  68. package/.agent/skills/plan-writing/SKILL.md +42 -0
  69. package/.agent/skills/platform-engineer/SKILL.md +42 -0
  70. package/.agent/skills/playwright-best-practices/SKILL.md +42 -0
  71. package/.agent/skills/powershell-windows/SKILL.md +42 -0
  72. package/.agent/skills/project-idioms/SKILL.md +42 -0
  73. package/.agent/skills/python-patterns/SKILL.md +42 -0
  74. package/.agent/skills/python-pro/SKILL.md +42 -0
  75. package/.agent/skills/react-specialist/SKILL.md +42 -0
  76. package/.agent/skills/readme-builder/SKILL.md +42 -0
  77. package/.agent/skills/realtime-patterns/SKILL.md +42 -0
  78. package/.agent/skills/red-team-tactics/SKILL.md +42 -0
  79. package/.agent/skills/rust-pro/SKILL.md +42 -0
  80. package/.agent/skills/seo-fundamentals/SKILL.md +42 -0
  81. package/.agent/skills/server-management/SKILL.md +42 -0
  82. package/.agent/skills/shadcn-ui-expert/SKILL.md +42 -0
  83. package/.agent/skills/skill-creator/SKILL.md +42 -0
  84. package/.agent/skills/sql-pro/SKILL.md +42 -0
  85. package/.agent/skills/supabase-postgres-best-practices/SKILL.md +42 -0
  86. package/.agent/skills/swiftui-expert/SKILL.md +42 -0
  87. package/.agent/skills/systematic-debugging/SKILL.md +42 -0
  88. package/.agent/skills/tailwind-patterns/SKILL.md +42 -0
  89. package/.agent/skills/tdd-workflow/SKILL.md +42 -0
  90. package/.agent/skills/test-result-analyzer/SKILL.md +42 -0
  91. package/.agent/skills/testing-patterns/SKILL.md +42 -0
  92. package/.agent/skills/trend-researcher/SKILL.md +42 -0
  93. package/.agent/skills/typescript-advanced/SKILL.md +327 -0
  94. package/.agent/skills/ui-ux-pro-max/SKILL.md +42 -0
  95. package/.agent/skills/ui-ux-researcher/SKILL.md +42 -0
  96. package/.agent/skills/vue-expert/SKILL.md +42 -0
  97. package/.agent/skills/vulnerability-scanner/SKILL.md +42 -0
  98. package/.agent/skills/web-accessibility-auditor/SKILL.md +42 -0
  99. package/.agent/skills/web-design-guidelines/SKILL.md +42 -0
  100. package/.agent/skills/webapp-testing/SKILL.md +42 -0
  101. package/.agent/skills/whimsy-injector/SKILL.md +42 -0
  102. package/.agent/skills/workflow-optimizer/SKILL.md +42 -0
  103. package/.agent/workflows/tribunal-backend.md +13 -2
  104. package/.agent/workflows/tribunal-full.md +15 -8
  105. package/.agent/workflows/tribunal-speed.md +183 -0
  106. package/bin/tribunal-kit.js +17 -10
  107. package/package.json +5 -2
  108. package/.agent/skills/gsap-expert/SKILL.md +0 -194
@@ -273,3 +273,45 @@ Every file with animations MUST include:
273
273
  - **Verify `will-change` usage** — only apply to actively animating elements, remove after animation completes.
274
274
 
275
275
  ---
276
+
277
+
278
+ ---
279
+
280
+ ## 🤖 LLM-Specific Traps
281
+
282
+ AI coding assistants often fall into specific bad habits when dealing with this domain. These are strictly forbidden:
283
+
284
+ 1. **Over-engineering:** Proposing complex abstractions or distributed systems when a simpler approach suffices.
285
+ 2. **Hallucinated Libraries/Methods:** Using non-existent methods or packages. Always `// VERIFY` or check `package.json` / `requirements.txt`.
286
+ 3. **Skipping Edge Cases:** Writing the "happy path" and ignoring error handling, timeouts, or data validation.
287
+ 4. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
288
+ 5. **Silent Degradation:** Catching and suppressing errors without logging or re-raising.
289
+
290
+ ---
291
+
292
+ ## 🏛️ Tribunal Integration (Anti-Hallucination)
293
+
294
+ **Slash command: `/review` or `/tribunal-full`**
295
+ **Active reviewers: `logic-reviewer` · `security-auditor`**
296
+
297
+ ### ❌ Forbidden AI Tropes
298
+
299
+ 1. **Blind Assumptions:** Never make an assumption without documenting it clearly with `// VERIFY: [reason]`.
300
+ 2. **Silent Degradation:** Catching and suppressing errors without logging or handling.
301
+ 3. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
302
+
303
+ ### ✅ Pre-Flight Self-Audit
304
+
305
+ Review these questions before confirming output:
306
+ ```
307
+ ✅ Did I rely ONLY on real, verified tools and methods?
308
+ ✅ Is this solution appropriately scoped to the user's constraints?
309
+ ✅ Did I handle potential failure modes and edge cases?
310
+ ✅ Have I avoided generic boilerplate that doesn't add value?
311
+ ```
312
+
313
+ ### 🛑 Verification-Before-Completion (VBC) Protocol
314
+
315
+ **CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
316
+ - ❌ **Forbidden:** Declaring a task complete because the output "looks correct."
317
+ - ✅ **Required:** You are explicitly forbidden from finalizing any task without providing **concrete evidence** (terminal output, passing tests, compile success, or equivalent proof) that your output works as intended.
@@ -177,3 +177,45 @@ Before analyzing, check for these common quick wins:
177
177
  - **Acknowledge uncertainty**: "Cannot determine if calls 3-5 had data dependency — may be correctly sequential."
178
178
 
179
179
  ---
180
+
181
+
182
+ ---
183
+
184
+ ## 🤖 LLM-Specific Traps
185
+
186
+ AI coding assistants often fall into specific bad habits when dealing with this domain. These are strictly forbidden:
187
+
188
+ 1. **Over-engineering:** Proposing complex abstractions or distributed systems when a simpler approach suffices.
189
+ 2. **Hallucinated Libraries/Methods:** Using non-existent methods or packages. Always `// VERIFY` or check `package.json` / `requirements.txt`.
190
+ 3. **Skipping Edge Cases:** Writing the "happy path" and ignoring error handling, timeouts, or data validation.
191
+ 4. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
192
+ 5. **Silent Degradation:** Catching and suppressing errors without logging or re-raising.
193
+
194
+ ---
195
+
196
+ ## 🏛️ Tribunal Integration (Anti-Hallucination)
197
+
198
+ **Slash command: `/review` or `/tribunal-full`**
199
+ **Active reviewers: `logic-reviewer` · `security-auditor`**
200
+
201
+ ### ❌ Forbidden AI Tropes
202
+
203
+ 1. **Blind Assumptions:** Never make an assumption without documenting it clearly with `// VERIFY: [reason]`.
204
+ 2. **Silent Degradation:** Catching and suppressing errors without logging or handling.
205
+ 3. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
206
+
207
+ ### ✅ Pre-Flight Self-Audit
208
+
209
+ Review these questions before confirming output:
210
+ ```
211
+ ✅ Did I rely ONLY on real, verified tools and methods?
212
+ ✅ Is this solution appropriately scoped to the user's constraints?
213
+ ✅ Did I handle potential failure modes and edge cases?
214
+ ✅ Have I avoided generic boilerplate that doesn't add value?
215
+ ```
216
+
217
+ ### 🛑 Verification-Before-Completion (VBC) Protocol
218
+
219
+ **CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
220
+ - ❌ **Forbidden:** Declaring a task complete because the output "looks correct."
221
+ - ✅ **Required:** You are explicitly forbidden from finalizing any task without providing **concrete evidence** (terminal output, passing tests, compile success, or equivalent proof) that your output works as intended.
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: Backend-specific Tribunal. Runs Logic + Security + Dependency + Type Safety reviewers. Use for API routes, server logic, auth code, middleware, Server Actions, and any server-side business logic.
2
+ description: Backend-specific Tribunal. Runs Logic + Security + Dependency + Type Safety + Resilience + Schema reviewers. Use for API routes, server logic, auth code, middleware, Server Actions, and any server-side business logic.
3
3
  ---
4
4
 
5
5
  # /tribunal-backend — Backend Code Audit
@@ -20,7 +20,7 @@ $ARGUMENTS
20
20
 
21
21
  ---
22
22
 
23
- ## 4 Active Reviewers (All Run Simultaneously)
23
+ ## 6 Active Reviewers (All Run Simultaneously)
24
24
 
25
25
  ### precedence-reviewer → Checks local repo Case Law for past rejections
26
26
  logic-reviewer
@@ -50,6 +50,17 @@ logic-reviewer
50
50
  - Unsafe type assertions (`as User` without runtime check)
51
51
  - Return type mismatches
52
52
 
53
+ ### schema-reviewer
54
+ - Missing input validation on req.body/req.query
55
+ - Validation applied client-side only
56
+ - Loosely defined Zod/Pydantic schemas
57
+
58
+ ### resilience-reviewer
59
+ - Swallowed errors (empty catch blocks)
60
+ - Missing timeouts on network fetches
61
+ - Unhandled Promise rejections
62
+ - Missing retries for temporal network failures
63
+
53
64
  ---
54
65
 
55
66
  ## Verdict System
@@ -1,8 +1,8 @@
1
1
  ---
2
- description: Run ALL 11 Tribunal reviewer agents simultaneously. Maximum hallucination coverage. Use before merging any AI-generated code, before production deployments, or when maximum confidence is required.
2
+ description: Run ALL 16 Tribunal reviewer agents simultaneously. Maximum hallucination coverage. Use before merging any AI-generated code, before production deployments, or when maximum confidence is required.
3
3
  ---
4
4
 
5
- # /tribunal-full — Complete 11-Reviewer Audit
5
+ # /tribunal-full — Complete 16-Reviewer Audit
6
6
 
7
7
  $ARGUMENTS
8
8
 
@@ -20,17 +20,19 @@ $ARGUMENTS
20
20
 
21
21
  ---
22
22
 
23
- ## 11 Reviewers — All Active Simultaneously
23
+ ## 16 Reviewers — All Active Simultaneously
24
24
 
25
25
  ```
26
26
  Tier 1: Always active (universal concerns)
27
27
  ├── precedence-reviewer → Checks local repo Case Law for past rejections
28
28
  ├── logic-reviewer → Hallucinated methods, impossible logic, undefined refs
29
- └── security-auditor → OWASP 2025, injection, JWT, SSRF, IDOR
29
+ ├── security-auditor → OWASP 2025, injection, JWT, SSRF, IDOR
30
+ └── resilience-reviewer → Swallowed errors, unhandled rejections, missing retries
30
31
 
31
32
  Tier 2: Code quality
32
33
  ├── dependency-reviewer → Fabricated packages, supply chain, version compatibility
33
34
  ├── type-safety-reviewer → 'any' epidemic, Zod parse vs cast, unguarded access
35
+ ├── schema-reviewer → Missing input validation, loose schemas, raw req.body
34
36
  └── sql-reviewer → Injection, N+1, missing indexes, unscoped mutations
35
37
 
36
38
  Tier 3: Domain-specific
@@ -40,6 +42,11 @@ Tier 3: Domain-specific
40
42
  ├── ai-code-reviewer → Model name hallucinations, prompt injection, cost explosion
41
43
  ├── test-coverage-reviewer → Happy path only, brittle selectors, missing edge cases
42
44
  └── accessibility-reviewer → WCAG 2.2 AA, ARIA misuse, focus management, live regions
45
+
46
+ Tier 4: Performance Swarm (token-scoped specialists)
47
+ ├── vitals-reviewer → Frontend CWV depth: Suspense waterfalls, paint jank, animation leaks
48
+ ├── db-latency-auditor → DB layer: N+1, unbounded queries, unindexed WHERE, pool config
49
+ └── throughput-optimizer → Server runtime: event-loop blocks, serialized awaits, memory leaks
43
50
  ```
44
51
 
45
52
  ---
@@ -50,9 +57,9 @@ Not all 11 reviewers produce meaningful findings on all code types. Active revie
50
57
 
51
58
  |Code Under Review|Critical Reviewers|
52
59
  |:---|:---|
53
- |REST API route|logic, security, dependency, type-safety, sql|
54
- |React component|logic, frontend, accessibility, type-safety|
55
- |Database query|logic, security, sql|
60
+ |REST API route|logic, security, dependency, type-safety, sql, schema, resilience|
61
+ |React component|logic, frontend, accessibility, type-safety, resilience|
62
+ |Database query|logic, security, sql, resilience|
56
63
  |AI LLM integration|logic, security, ai-code, dependency|
57
64
  |Test file|test-coverage, logic|
58
65
  |React Native / Expo|mobile, logic, security, performance|
@@ -64,7 +71,7 @@ Not all 11 reviewers produce meaningful findings on all code types. Active revie
64
71
  ## Verdict Aggregation
65
72
 
66
73
  ```
67
- All 11 verdicts are collected. Aggregated result:
74
+ All 16 verdicts are collected. Aggregated result:
68
75
 
69
76
  If ANY reviewer = ❌ REJECTED → Global verdict: ❌ REJECTED (must fix before Human Gate)
70
77
  If any reviewer = ⚠️ WARNING → Global verdict: ⚠️ WARNINGS (proceed with attention)
@@ -0,0 +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
+ ---
@@ -142,16 +142,16 @@ function compareSemver(a, b) {
142
142
  }
143
143
 
144
144
  /**
145
- * Fetch the latest version from GitHub Releases.
146
- * Returns the version string (e.g. '2.4.0') or null on failure.
145
+ * Fetch the latest version from npm registry.
146
+ * Returns the version string (e.g. '4.0.0') or null on failure.
147
147
  */
148
148
  function fetchLatestVersion() {
149
149
  return new Promise((resolve) => {
150
150
  const req = https.get(
151
- 'https://api.github.com/repos/Harmitx7/tribunal-kit/releases/latest',
151
+ 'https://registry.npmjs.org/tribunal-kit/latest',
152
152
  {
153
153
  headers: {
154
- 'Accept': 'application/vnd.github.v3+json',
154
+ 'Accept': 'application/json',
155
155
  'User-Agent': `tribunal-kit/${CURRENT_VERSION}`
156
156
  },
157
157
  timeout: 5000
@@ -162,8 +162,7 @@ function fetchLatestVersion() {
162
162
  res.on('end', () => {
163
163
  try {
164
164
  const json = JSON.parse(data);
165
- // GitHub tags usually have a 'v' prefix (e.g., 'v2.4.0')
166
- const version = json.tag_name ? json.tag_name.replace(/^v/, '') : null;
165
+ const version = json.version || null;
167
166
  resolve(version);
168
167
  } catch {
169
168
  resolve(null);
@@ -207,9 +206,9 @@ async function autoUpdateCheck(originalArgs) {
207
206
  log('');
208
207
 
209
208
  try {
210
- // Build the command pulling directly from GitHub
209
+ // Build the command pulling from npm registry
211
210
  const args = originalArgs.join(' ');
212
- const cmd = `npx -y github:Harmitx7/tribunal-kit#v${latestVersion} ${args}`;
211
+ const cmd = `npx -y tribunal-kit@${latestVersion} ${args}`;
213
212
 
214
213
  execSync(cmd, {
215
214
  stdio: 'inherit',
@@ -422,7 +421,7 @@ function cmdInit(flags) {
422
421
  console.log(plainRow(` Next steps:`, s => c('gray', s)));
423
422
  console.log(stepRow('/generate', 'Generate code with anti-hallucination'));
424
423
  console.log(stepRow('/review', 'Audit existing code for issues'));
425
- console.log(stepRow('/tribunal-full', 'Run all 11 reviewers in parallel'));
424
+ console.log(stepRow('/tribunal-full', 'Run all 14 reviewers in parallel'));
426
425
  console.log(plainRow('', () => ''));
427
426
  console.log(` ${c('cyan', '╚' + '═'.repeat(W) + '╝')}`);
428
427
  console.log();
@@ -581,6 +580,10 @@ function cmdCase(flags) {
581
580
  log(` ${c('cyan', 'add'.padEnd(10))} ${c('gray', 'Record a new Case Law rejection pattern')}`);
582
581
  log(` ${c('cyan', 'search'.padEnd(10))} ${c('gray', 'Search existing cases (e.g., search "query")')}`);
583
582
  log(` ${c('cyan', 'list'.padEnd(10))} ${c('gray', 'List all recorded case law')}`);
583
+ log(` ${c('cyan', 'show'.padEnd(10))} ${c('gray', 'Show full diff for a case (e.g., show --id 1)')}`);
584
+ log(` ${c('cyan', 'stats'.padEnd(10))} ${c('gray', 'Show case law stats by domain/verdict')}`);
585
+ log(` ${c('cyan', 'export'.padEnd(10))} ${c('gray', 'Export all cases to Markdown')}`);
586
+ log(` ${c('cyan', 'overrule'.padEnd(10))} ${c('gray', 'Overrule a past precedent (e.g., overrule --id 1)')}`);
584
587
  console.log();
585
588
  process.exit(1);
586
589
  }
@@ -668,7 +671,7 @@ function cmdHelp() {
668
671
  log(cmd('update', 'Re-install to get latest version'));
669
672
  log(cmd('status', 'Check if .agent/ is installed'));
670
673
  log(cmd('learn', 'Evolve project idioms based on git diffs'));
671
- log(cmd('case', 'Manage Case Law precedents (add, search, list)'));
674
+ log(cmd('case', 'Manage Case Law precedents (add, search, list, show, stats, overrule)'));
672
675
  log(cmd('hook', 'Install pre-push git hook for auto-learning'));
673
676
  console.log();
674
677
  log(bold(' Options'));
@@ -694,6 +697,10 @@ function cmdHelp() {
694
697
  log(ex('npx tribunal-kit case add'));
695
698
  log(ex('npx tribunal-kit case search "useEffect"'));
696
699
  log(ex('npx tribunal-kit case list'));
700
+ log(ex('npx tribunal-kit case show --id 1'));
701
+ log(ex('npx tribunal-kit case stats'));
702
+ log(ex('npx tribunal-kit case export'));
703
+ log(ex('npx tribunal-kit case overrule --id 1'));
697
704
  log(ex('npx tribunal-kit hook'));
698
705
  console.log();
699
706
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tribunal-kit",
3
- "version": "4.0.0",
4
- "description": "Anti-Hallucination AI Agent Kit — 34 specialist agents, 26 slash commands, Swarm/Supervisor engine, and Supreme Court Tribunal review pipeline.",
3
+ "version": "4.2.0",
4
+ "description": "Anti-Hallucination AI Agent Kit — 37 specialist agents, 31 slash commands, Performance Swarm engine, and Supreme Court Tribunal review pipeline.",
5
5
  "keywords": [
6
6
  "ai",
7
7
  "ai-agent",
@@ -70,5 +70,8 @@
70
70
  "collectCoverageFrom": [
71
71
  "bin/**/*.js"
72
72
  ]
73
+ },
74
+ "dependencies": {
75
+ "tribunal-kit": "^4.0.0"
73
76
  }
74
77
  }
@@ -1,194 +0,0 @@
1
- ---
2
- name: gsap-expert
3
- description: GreenSock Animation Platform (GSAP 3.12+) mastery. Core tweens, timelines, ScrollTrigger, ScrollSmoother, plugins, React useGSAP hook, responsive animations, performance. Use when building scroll-driven animations, complex sequencing, SVG morphing, or any animation beyond CSS capabilities.
4
- allowed-tools: Read, Write, Edit, Glob, Grep
5
- version: 3.2.0
6
- last-updated: 2026-04-07
7
- applies-to-model: gemini-3-1-pro, claude-3-7-sonnet
8
- ---
9
-
10
- # GSAP Expert — 3.12+ Dense Reference
11
-
12
- ## Hallucination Traps (Read First)
13
- - ❌ `gsap.registerPlugin(ScrollTrigger)` optional → ✅ **REQUIRED** before any use — must call before component mounts
14
- - ❌ `easeInOut`, `Power2.easeOut` (GSAP 2 syntax) → ✅ `"power2.inOut"` (string, GSAP 3)
15
- - ❌ `raw useEffect` for GSAP in React → ✅ `useGSAP` from `@gsap/react` — handles cleanup automatically
16
- - ❌ Timeline position as 2nd arg → ✅ position is the **3rd** arg: `tl.to(el, { x: 100 }, "<")`
17
- - ❌ `markers: true` in production → ✅ Debug only — never ship. `gsap.config({ markers: false })`
18
- - ❌ Animate `width`, `height`, `top`, `left` → ✅ Only `x`, `y`, `scale`, `rotation`, `opacity` (GPU composited)
19
- - ❌ 1 ScrollTrigger per list item → ✅ Use `ScrollTrigger.batch()` for lists — 1 battery per N items
20
- - ❌ `dependencies` option spelled `deps` → ✅ option is `dependencies` (not `deps`)
21
- - ❌ GSAP in Next.js Server Components → ✅ Always `"use client"` — GSAP is browser-only
22
-
23
- ---
24
-
25
- ## Core Tweens
26
-
27
- ```javascript
28
- gsap.to(".box", { x: 100, opacity: 1, duration: 1, ease: "power2.out" });
29
- gsap.from(".box", { y: -50, opacity: 0, duration: 0.8 });
30
- gsap.fromTo(".box", { x: -100 }, { x: 0, duration: 1, ease: "expo.out" });
31
- gsap.set(".box", { transformOrigin: "center center", willChange: "transform" });
32
-
33
- // Stagger (multiple elements)
34
- gsap.from(".item", { opacity: 0, y: 30, stagger: 0.08, ease: "power3.out" });
35
- gsap.from(".item", { opacity: 0, stagger: { each: 0.1, from: "center", grid: "auto" } });
36
- ```
37
-
38
- ---
39
-
40
- ## Timelines
41
-
42
- ```javascript
43
- const tl = gsap.timeline({ defaults: { ease: "power2.out", duration: 0.6 } });
44
-
45
- tl.from(".hero-title", { y: 60, opacity: 0 })
46
- .from(".hero-sub", { y: 40, opacity: 0 }, "-=0.4") // overlap 0.4s
47
- .from(".hero-cta", { scale: 0.9, opacity: 0 }, "<0.1") // 0.1s after prev starts
48
- .to(".hero-img", { x: 0, opacity: 1 }, 0.3); // absolute 0.3s into tl
49
-
50
- // Position symbols:
51
- // "<" → same start time as previous tween
52
- // ">" → after previous ends
53
- // "-=0.5" → 0.5s before previous ends (overlap)
54
- // "+=0.5" → 0.5s after previous ends (gap)
55
- // "2" → absolute 2s from timeline start
56
-
57
- // Runtime control
58
- tl.play(); tl.pause(); tl.reverse(); tl.seek(1.5); tl.timeScale(2); // 2x speed
59
- ```
60
-
61
- ---
62
-
63
- ## ScrollTrigger
64
-
65
- ```javascript
66
- import { gsap } from "gsap";
67
- import { ScrollTrigger } from "gsap/ScrollTrigger";
68
- gsap.registerPlugin(ScrollTrigger); // REQUIRED — call once at module level
69
-
70
- // Basic scroll-triggered animation
71
- gsap.from(".section", {
72
- scrollTrigger: {
73
- trigger: ".section",
74
- start: "top 80%", // "triggerEdge viewportEdge"
75
- end: "bottom 20%",
76
- scrub: 1, // smooth scrubbing (seconds to catch up) | true = instant
77
- pin: true, // pin element during scroll
78
- anticipatePin: 1, // prevents jump on pin
79
- markers: false, // NEVER true in production
80
- },
81
- y: 100, opacity: 0,
82
- });
83
-
84
- // Batch — for lists (1 ST instance per group, not per item)
85
- ScrollTrigger.batch(".card", {
86
- onEnter: (elements) => gsap.from(elements, { opacity: 0, y: 40, stagger: 0.08 }),
87
- start: "top 85%",
88
- });
89
-
90
- // Pin + scrub storytelling
91
- const tl = gsap.timeline({
92
- scrollTrigger: { trigger: ".scene", pin: true, scrub: true, end: "+=3000" }
93
- });
94
- tl.from(".layer-1", { x: -200 }).from(".layer-2", { x: 200 }, "<");
95
-
96
- // Cleanup — MANDATORY on SPA route unmount
97
- ScrollTrigger.killAll(); // in component cleanup / router onChange
98
- ```
99
-
100
- ---
101
-
102
- ## React Integration (`useGSAP`)
103
-
104
- ```tsx
105
- import { useGSAP } from "@gsap/react";
106
- import { gsap } from "gsap";
107
- import { ScrollTrigger } from "gsap/ScrollTrigger";
108
- import { useRef } from "react";
109
-
110
- gsap.registerPlugin(ScrollTrigger); // once, outside component
111
-
112
- export function HeroSection() {
113
- const container = useRef<HTMLDivElement>(null);
114
-
115
- useGSAP(() => {
116
- // ✅ All GSAP code here is automatically scoped & cleaned up
117
- gsap.from(".hero-title", { y: 60, opacity: 0, duration: 0.8 });
118
-
119
- gsap.from(".hero-card", {
120
- scrollTrigger: { trigger: ".hero-card", start: "top 80%" },
121
- y: 40, opacity: 0, stagger: 0.1,
122
- });
123
- }, { scope: container, dependencies: [] }); // re-runs when dependencies change
124
-
125
- return <div ref={container}><h1 className="hero-title">...</h1></div>;
126
- }
127
-
128
- // With cleanup for dynamic content:
129
- useGSAP(() => {
130
- const ctx = gsap.context(() => {
131
- gsap.from(".item", { opacity: 0, stagger: 0.05 });
132
- }, container);
133
- return () => ctx.revert(); // explicit cleanup if needed beyond useGSAP scope
134
- }, { scope: container, dependencies: [items] });
135
- ```
136
-
137
- ---
138
-
139
- ## Responsive Animations (`gsap.matchMedia`)
140
-
141
- ```javascript
142
- // Replaces window.matchMedia listeners + resize handlers
143
- const mm = gsap.matchMedia();
144
-
145
- mm.add("(min-width: 768px)", () => {
146
- gsap.to(".sidebar", { x: 0, duration: 0.5 });
147
- // Return cleanup function
148
- return () => gsap.set(".sidebar", { x: -300 });
149
- });
150
-
151
- mm.add("(max-width: 767px)", () => {
152
- gsap.to(".mobile-menu", { y: 0, duration: 0.4 });
153
- });
154
-
155
- // In React — use inside useGSAP
156
- useGSAP(() => {
157
- const mm = gsap.matchMedia();
158
- mm.add("(prefers-reduced-motion: no-preference)", () => {
159
- gsap.from(".hero", { y: 100, duration: 1 });
160
- });
161
- mm.add("(prefers-reduced-motion: reduce)", () => {
162
- gsap.set(".hero", { opacity: 1 }); // instant, no animation
163
- });
164
- });
165
- ```
166
-
167
- ---
168
-
169
- ## Plugin Reference
170
-
171
- | Plugin | Use For | Registration |
172
- |--------|---------|-------------|
173
- | `ScrollTrigger` | Scroll-driven animations | `gsap.registerPlugin(ScrollTrigger)` |
174
- | `ScrollSmoother` | Smooth native scroll momentum | Requires `ScrollTrigger` + Club GSAP |
175
- | `Flip` | Stateful layout morphing (FLIP technique) | `gsap.registerPlugin(Flip)` |
176
- | `Draggable` | Interactive drag/sort/resize | `gsap.registerPlugin(Draggable)` |
177
- | `SplitText` | Character/word/line text splits | Call `.revert()` after use to prevent SEO damage |
178
- | `DrawSVG` | SVG stroke-dasharray animations | Club GSAP |
179
- | `MorphSVG` | SVG path morphing | Club GSAP |
180
- | `ScrollToPlugin` | Programmatic scroll-to | `gsap.registerPlugin(ScrollToPlugin)` |
181
-
182
- ---
183
-
184
- ## Performance Rules
185
-
186
- ```
187
- ✅ Animate: x, y, scale, rotation, skewX/Y, opacity (GPU composited transforms)
188
- ❌ Never: width, height, top, left, padding, margin (triggers layout/paint)
189
- ✅ Use willChange: "transform" on elements that will animate
190
- ✅ overwrite: "auto" to kill conflicting tweens automatically
191
- ✅ ScrollTrigger.batch() for lists — NOT 1 instance per item
192
- ✅ gsap.ticker.lagSmoothing(0) in high-framerate contexts (optional)
193
- ❌ Don't animate SVG path 'd' attribute directly — use MorphSVG plugin
194
- ```