tribunal-kit 4.4.0 → 4.4.2

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 (90) hide show
  1. package/.agent/agents/api-architect.md +66 -66
  2. package/.agent/agents/db-latency-auditor.md +216 -216
  3. package/.agent/agents/precedence-reviewer.md +250 -250
  4. package/.agent/agents/resilience-reviewer.md +88 -88
  5. package/.agent/agents/schema-reviewer.md +67 -67
  6. package/.agent/agents/throughput-optimizer.md +299 -299
  7. package/.agent/agents/ui-ux-auditor.md +292 -292
  8. package/.agent/agents/vitals-reviewer.md +223 -223
  9. package/.agent/history/architecture-graph.yaml +32 -1
  10. package/.agent/history/graph-cache.json +66 -19
  11. package/.agent/history/snapshots/bin__tribunal-kit.js.json +19 -0
  12. package/.agent/history/snapshots/eslint.config.js.json +9 -0
  13. package/.agent/history/snapshots/migrate_refs.js.json +3 -3
  14. package/.agent/history/snapshots/scripts__changelog.js.json +2 -1
  15. package/.agent/history/snapshots/scripts__sync-version.js.json +2 -1
  16. package/.agent/history/snapshots/scripts__validate-payload.js.json +1 -0
  17. package/.agent/history/snapshots/test__integration__bridges.test.js.json +2 -1
  18. package/.agent/history/snapshots/test__integration__init.test.js.json +1 -0
  19. package/.agent/history/snapshots/test__integration__routing.test.js.json +1 -0
  20. package/.agent/history/snapshots/test__integration__swarm_dispatcher.test.js.json +2 -1
  21. package/.agent/history/snapshots/test__integration__wave2.test.js.json +2 -1
  22. package/.agent/history/snapshots/test__unit__args.test.js.json +11 -1
  23. package/.agent/history/snapshots/test__unit__case_law_manager.test.js.json +1 -0
  24. package/.agent/history/snapshots/test__unit__context_broker.test.js.json +11 -0
  25. package/.agent/history/snapshots/test__unit__copyDir.test.js.json +11 -1
  26. package/.agent/history/snapshots/test__unit__graph_tools.test.js.json +1 -0
  27. package/.agent/history/snapshots/test__unit__inner_loop_validator.test.js.json +11 -0
  28. package/.agent/history/snapshots/test__unit__selfInstall.test.js.json +11 -1
  29. package/.agent/history/snapshots/test__unit__semver.test.js.json +11 -1
  30. package/.agent/history/snapshots/test__unit__swarm_dispatcher.test.js.json +1 -0
  31. package/.agent/scripts/_colors.js +154 -2
  32. package/.agent/scripts/_utils.js +205 -3
  33. package/.agent/scripts/append_flow.js +72 -72
  34. package/.agent/scripts/auto_preview.js +197 -197
  35. package/.agent/scripts/bundle_analyzer.js +90 -119
  36. package/.agent/scripts/case_law_manager.js +18 -13
  37. package/.agent/scripts/checklist.js +100 -88
  38. package/.agent/scripts/colors.js +7 -13
  39. package/.agent/scripts/compress_skills.js +141 -141
  40. package/.agent/scripts/consolidate_skills.js +149 -149
  41. package/.agent/scripts/context_broker.js +605 -609
  42. package/.agent/scripts/deep_compress.js +150 -150
  43. package/.agent/scripts/dependency_analyzer.js +68 -106
  44. package/.agent/scripts/graph_builder.js +341 -311
  45. package/.agent/scripts/graph_visualizer.js +390 -384
  46. package/.agent/scripts/graph_zoom.js +6 -4
  47. package/.agent/scripts/inner_loop_validator.js +445 -465
  48. package/.agent/scripts/lint_runner.js +27 -28
  49. package/.agent/scripts/minify_context.js +100 -100
  50. package/.agent/scripts/mutation_runner.js +280 -280
  51. package/.agent/scripts/patch_skills_meta.js +156 -156
  52. package/.agent/scripts/patch_skills_output.js +244 -244
  53. package/.agent/scripts/schema_validator.js +280 -297
  54. package/.agent/scripts/security_scan.js +37 -64
  55. package/.agent/scripts/session_manager.js +270 -276
  56. package/.agent/scripts/skill_evolution.js +637 -644
  57. package/.agent/scripts/skill_integrator.js +307 -313
  58. package/.agent/scripts/strengthen_skills.js +193 -193
  59. package/.agent/scripts/strip_tribunal.js +47 -47
  60. package/.agent/scripts/swarm_dispatcher.js +360 -360
  61. package/.agent/scripts/test_runner.js +32 -39
  62. package/.agent/scripts/utils.js +10 -25
  63. package/.agent/scripts/verify_all.js +84 -92
  64. package/.agent/skills/app-builder/templates/astro-static/TEMPLATE.md +1 -1
  65. package/.agent/skills/app-builder/templates/chrome-extension/TEMPLATE.md +1 -1
  66. package/.agent/skills/app-builder/templates/cli-tool/TEMPLATE.md +1 -1
  67. package/.agent/skills/app-builder/templates/electron-desktop/TEMPLATE.md +1 -1
  68. package/.agent/skills/app-builder/templates/express-api/TEMPLATE.md +1 -1
  69. package/.agent/skills/app-builder/templates/flutter-app/TEMPLATE.md +1 -1
  70. package/.agent/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +1 -1
  71. package/.agent/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +1 -1
  72. package/.agent/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +1 -1
  73. package/.agent/skills/app-builder/templates/nextjs-static/TEMPLATE.md +1 -1
  74. package/.agent/skills/app-builder/templates/nuxt-app/TEMPLATE.md +1 -1
  75. package/.agent/skills/app-builder/templates/python-fastapi/TEMPLATE.md +1 -1
  76. package/.agent/skills/app-builder/templates/react-native-app/TEMPLATE.md +1 -1
  77. package/.agent/skills/doc.md +1 -1
  78. package/.agent/skills/knowledge-graph/SKILL.md +52 -52
  79. package/.agent/skills/ui-ux-pro-max/SKILL.md +562 -562
  80. package/.agent/workflows/generate.md +183 -183
  81. package/.agent/workflows/tribunal-speed.md +183 -183
  82. package/README.md +1 -1
  83. package/bin/tribunal-kit.js +76 -87
  84. package/package.json +6 -3
  85. package/scripts/changelog.js +167 -167
  86. package/scripts/sync-version.js +81 -81
  87. package/.agent/history/architecture-explorer.html +0 -352
  88. package/.agent/scripts/__pycache__/_colors.cpython-311.pyc +0 -0
  89. package/.agent/scripts/__pycache__/_utils.cpython-311.pyc +0 -0
  90. 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**, **32 slash commands**, **16 parallel Tribunal reviewers**, and a core **Swarm/Supervisor** engine.
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
 
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env node
2
2
  /**
3
3
  * tribunal-kit CLI (alias: tk)
4
4
  *
@@ -324,16 +324,11 @@ function banner() {
324
324
  ██║ ██║ ██║██║██████╔╝╚██████╔╝██║ ╚████║██║ ██║███████╗ ██║ ██╗██║ ██║
325
325
  ╚═╝ ╚═╝ ╚═╝╚═╝╚═════╝ ╚═════╝ ╚═╝ ╚═══╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ `.split('\n').filter(Boolean);
326
326
  console.log();
327
- const maxLen = Math.max(...art.map(line => line.length));
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
- const p = maxLen > 1 ? i / (maxLen - 1) : 0;
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 PRESERVE_DIRS = ['history', 'patterns', 'mcp_config.json'];
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
- // Verify preserved dirs still exist after cleanup
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
- const { execSync } = require('child_process');
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)`);
@@ -748,11 +737,11 @@ async function runWithUpdateCheck(command, flags) {
748
737
  case 'graph':
749
738
  cmdGraph(flags);
750
739
  break;
751
- case 'mutate':
752
- cmdMutate(flags);
753
- break;
754
- case 'context':
755
- cmdContext(flags);
740
+ case 'mutate':
741
+ cmdMutate(flags);
742
+ break;
743
+ case 'context':
744
+ cmdContext(flags);
756
745
  break;
757
746
  case 'uninstall':
758
747
  cmdUninstall(flags);
@@ -808,7 +797,7 @@ function cmdCase(flags) {
808
797
  try {
809
798
  const { execSync } = require('child_process');
810
799
  execSync(`node "${caseLawScript}" ${pyArgs}`, { stdio: 'inherit', cwd: targetDir });
811
- } catch (e) {
800
+ } catch {
812
801
  process.exit(1); // Script already prints errors
813
802
  }
814
803
  }
@@ -885,7 +874,7 @@ function cmdMutate(flags) {
885
874
  const { execSync } = require('child_process');
886
875
  try {
887
876
  execSync(`node "${mutateScript}" ${args.join(' ')}`, { stdio: 'inherit', cwd: targetDir });
888
- } catch (e) {
877
+ } catch {
889
878
  process.exit(1);
890
879
  }
891
880
  }
@@ -965,7 +954,7 @@ function cmdHelp() {
965
954
  log(cmd('learn', 'Evolve project idioms based on git diffs'));
966
955
  log(cmd('case', 'Manage Case Law precedents (add, search, list, show, stats, overrule)'));
967
956
  log(cmd('graph', 'Build and visualize the architecture graph'));
968
- log(cmd('mutate', 'Run the Mutation Engine to test test-suite reliability'));
957
+ log(cmd('mutate', 'Run the Mutation Engine to test test-suite reliability'));
969
958
  log(cmd('context', 'Retrieve a highly-optimized Context Snapshot for a file'));
970
959
  log(cmd('hook', 'Install pre-push git hook for auto-learning'));
971
960
  log(cmd('uninstall','Remove .agent/ folder from project'));
@@ -1010,68 +999,68 @@ function cmdHelp() {
1010
999
  console.log();
1011
1000
  }
1012
1001
 
1013
-
1014
- function cmdContext(flags) {
1015
- const targetDir = flags.path ? require('path').resolve(flags.path) : process.cwd();
1016
- const agentDest = require('path').join(targetDir, '.agent');
1017
-
1018
- if (!require('fs').existsSync(agentDest)) {
1019
- console.error(' \x1b[91m✖\x1b[0m .agent/ not found. Run: npx tribunal-kit init');
1020
- process.exit(1);
1021
- }
1022
-
1023
- const args = process.argv.slice(3);
1024
- if (args.length === 0 || args[0] === 'help' || args[0] === '--help') {
1025
- console.error('Usage: npx tribunal-kit context <target_file>');
1026
- process.exit(1);
1027
- }
1028
-
1029
- const targetFile = args[0].replace(/\\/g, '/');
1030
- const snapshotName = targetFile.replace(/[\\\/]/g, '__') + '.json';
1031
- const snapshotPath = require('path').join(agentDest, 'history', 'snapshots', snapshotName);
1032
-
1033
- if (!require('fs').existsSync(snapshotPath)) {
1034
- console.error(' \x1b[91m✖\x1b[0m Context Snapshot not found for: ' + targetFile);
1035
- console.log(' Run: npx tribunal-kit graph (to generate snapshots)');
1036
- process.exit(1);
1037
- }
1038
-
1039
- try {
1040
- const snapshot = JSON.parse(require('fs').readFileSync(snapshotPath, 'utf8'));
1041
-
1042
- console.log('\n# Context Snapshot: ' + snapshot.file);
1043
- process.stdout.write('> Size Estimate: ' + (snapshot['estimatedTokens'] || 'Unknown') + '\n');
1044
- console.log('> Risk Score: ' + snapshot.riskScore + ' (Blast Radius: ' + snapshot.blastRadius + ')\n');
1045
-
1046
- if (Object.keys(snapshot.imports).length > 0) {
1047
- console.log('## Imports');
1048
- for (const [imp, exports] of Object.entries(snapshot.imports)) {
1049
- if (exports && exports.length > 0) {
1050
- console.log('- `' + imp + '` (exports: ' + exports.join(', ') + ')');
1051
- } else {
1052
- console.log('- `' + imp + '`');
1053
- }
1054
- }
1055
- console.log();
1056
- }
1057
-
1058
- if (snapshot.dependents && snapshot.dependents.length > 0) {
1059
- console.log('## Dependents');
1060
- for (const dep of snapshot.dependents) {
1061
- console.log('- `' + dep + '`');
1062
- }
1063
- console.log();
1064
- }
1065
-
1066
- console.log('## Source Code');
1067
- console.log('```javascript\n' + snapshot.content + '\n```\n');
1068
-
1069
- } catch (e) {
1070
- console.error('Failed to read snapshot: ' + e.message);
1071
- process.exit(1);
1072
- }
1073
- }
1074
-
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
+
1075
1064
  // ── Main ──────────────────────────────────────────────────
1076
1065
  const { command, flags } = parseArgs(process.argv);
1077
1066
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tribunal-kit",
3
- "version": "4.4.0",
3
+ "version": "4.4.2",
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": [