tribunal-kit 4.0.1 → 4.3.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 (196) hide show
  1. package/.agent/ARCHITECTURE.md +21 -14
  2. package/.agent/GEMINI.md +4 -2
  3. package/.agent/agents/api-architect.md +66 -0
  4. package/.agent/agents/db-latency-auditor.md +216 -0
  5. package/.agent/agents/precedence-reviewer.md +41 -4
  6. package/.agent/agents/resilience-reviewer.md +88 -0
  7. package/.agent/agents/schema-reviewer.md +67 -0
  8. package/.agent/agents/swarm-worker-contracts.md +5 -5
  9. package/.agent/agents/throughput-optimizer.md +299 -0
  10. package/.agent/agents/ui-ux-auditor.md +292 -0
  11. package/.agent/agents/vitals-reviewer.md +223 -0
  12. package/.agent/history/case-law/cases/case-0001.json +33 -0
  13. package/.agent/history/case-law/index.json +35 -0
  14. package/.agent/rules/GEMINI.md +28 -11
  15. package/.agent/scripts/__pycache__/_colors.cpython-311.pyc +0 -0
  16. package/.agent/scripts/__pycache__/_utils.cpython-311.pyc +0 -0
  17. package/.agent/scripts/__pycache__/case_law_manager.cpython-311.pyc +0 -0
  18. package/.agent/scripts/_colors.js +18 -0
  19. package/.agent/scripts/_utils.js +42 -0
  20. package/.agent/scripts/auto_preview.js +197 -0
  21. package/.agent/scripts/bundle_analyzer.js +290 -0
  22. package/.agent/scripts/case_law_manager.js +684 -0
  23. package/.agent/scripts/checklist.js +266 -0
  24. package/.agent/scripts/colors.js +17 -0
  25. package/.agent/scripts/compress_skills.js +141 -0
  26. package/.agent/scripts/consolidate_skills.js +149 -0
  27. package/.agent/scripts/context_broker.js +609 -0
  28. package/.agent/scripts/deep_compress.js +150 -0
  29. package/.agent/scripts/dependency_analyzer.js +272 -0
  30. package/.agent/scripts/inner_loop_validator.js +465 -0
  31. package/.agent/scripts/lint_runner.js +187 -0
  32. package/.agent/scripts/minify_context.js +100 -0
  33. package/.agent/scripts/patch_skills_meta.js +156 -0
  34. package/.agent/scripts/patch_skills_output.js +244 -0
  35. package/.agent/scripts/schema_validator.js +297 -0
  36. package/.agent/scripts/security_scan.js +303 -0
  37. package/.agent/scripts/session_manager.js +276 -0
  38. package/.agent/scripts/skill_evolution.js +644 -0
  39. package/.agent/scripts/skill_integrator.js +313 -0
  40. package/.agent/scripts/strengthen_skills.js +193 -0
  41. package/.agent/scripts/strip_tribunal.js +47 -0
  42. package/.agent/scripts/swarm_dispatcher.js +360 -0
  43. package/.agent/scripts/test_runner.js +193 -0
  44. package/.agent/scripts/utils.js +32 -0
  45. package/.agent/scripts/verify_all.js +256 -0
  46. package/.agent/skills/agent-organizer/SKILL.md +42 -0
  47. package/.agent/skills/agentic-patterns/SKILL.md +42 -0
  48. package/.agent/skills/ai-prompt-injection-defense/SKILL.md +42 -0
  49. package/.agent/skills/api-patterns/SKILL.md +42 -0
  50. package/.agent/skills/api-security-auditor/SKILL.md +42 -0
  51. package/.agent/skills/app-builder/SKILL.md +42 -0
  52. package/.agent/skills/app-builder/templates/SKILL.md +70 -0
  53. package/.agent/skills/app-builder/templates/astro-static/TEMPLATE.md +1 -1
  54. package/.agent/skills/app-builder/templates/chrome-extension/TEMPLATE.md +1 -1
  55. package/.agent/skills/app-builder/templates/cli-tool/TEMPLATE.md +1 -1
  56. package/.agent/skills/app-builder/templates/electron-desktop/TEMPLATE.md +1 -1
  57. package/.agent/skills/app-builder/templates/express-api/TEMPLATE.md +1 -1
  58. package/.agent/skills/app-builder/templates/flutter-app/TEMPLATE.md +1 -1
  59. package/.agent/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +1 -1
  60. package/.agent/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +1 -1
  61. package/.agent/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +1 -1
  62. package/.agent/skills/app-builder/templates/nextjs-static/TEMPLATE.md +1 -1
  63. package/.agent/skills/app-builder/templates/nuxt-app/TEMPLATE.md +1 -1
  64. package/.agent/skills/app-builder/templates/python-fastapi/TEMPLATE.md +1 -1
  65. package/.agent/skills/app-builder/templates/react-native-app/TEMPLATE.md +1 -1
  66. package/.agent/skills/appflow-wireframe/SKILL.md +42 -0
  67. package/.agent/skills/architecture/SKILL.md +42 -0
  68. package/.agent/skills/authentication-best-practices/SKILL.md +42 -0
  69. package/.agent/skills/bash-linux/SKILL.md +42 -0
  70. package/.agent/skills/behavioral-modes/SKILL.md +42 -0
  71. package/.agent/skills/brainstorming/SKILL.md +42 -0
  72. package/.agent/skills/building-native-ui/SKILL.md +42 -0
  73. package/.agent/skills/clean-code/SKILL.md +42 -0
  74. package/.agent/skills/code-review-checklist/SKILL.md +42 -0
  75. package/.agent/skills/config-validator/SKILL.md +42 -0
  76. package/.agent/skills/csharp-developer/SKILL.md +42 -0
  77. package/.agent/skills/data-validation-schemas/SKILL.md +320 -0
  78. package/.agent/skills/database-design/SKILL.md +42 -0
  79. package/.agent/skills/deployment-procedures/SKILL.md +42 -0
  80. package/.agent/skills/devops-engineer/SKILL.md +42 -0
  81. package/.agent/skills/devops-incident-responder/SKILL.md +42 -0
  82. package/.agent/skills/doc.md +1 -1
  83. package/.agent/skills/documentation-templates/SKILL.md +42 -0
  84. package/.agent/skills/edge-computing/SKILL.md +42 -0
  85. package/.agent/skills/error-resilience/SKILL.md +420 -0
  86. package/.agent/skills/extract-design-system/SKILL.md +42 -0
  87. package/.agent/skills/framer-motion-expert/SKILL.md +42 -1
  88. package/.agent/skills/frontend-design/SKILL.md +42 -0
  89. package/.agent/skills/game-design-expert/SKILL.md +42 -0
  90. package/.agent/skills/game-engineering-expert/SKILL.md +42 -0
  91. package/.agent/skills/geo-fundamentals/SKILL.md +42 -0
  92. package/.agent/skills/github-operations/SKILL.md +42 -0
  93. package/.agent/skills/gsap-core/SKILL.md +300 -0
  94. package/.agent/skills/gsap-frameworks/SKILL.md +199 -0
  95. package/.agent/skills/gsap-performance/SKILL.md +125 -0
  96. package/.agent/skills/gsap-plugins/SKILL.md +472 -0
  97. package/.agent/skills/gsap-react/SKILL.md +181 -0
  98. package/.agent/skills/gsap-scrolltrigger/SKILL.md +342 -0
  99. package/.agent/skills/gsap-timeline/SKILL.md +153 -0
  100. package/.agent/skills/gsap-utils/SKILL.md +330 -0
  101. package/.agent/skills/i18n-localization/SKILL.md +42 -0
  102. package/.agent/skills/intelligent-routing/SKILL.md +72 -1
  103. package/.agent/skills/lint-and-validate/SKILL.md +42 -0
  104. package/.agent/skills/llm-engineering/SKILL.md +42 -0
  105. package/.agent/skills/local-first/SKILL.md +42 -0
  106. package/.agent/skills/mcp-builder/SKILL.md +42 -0
  107. package/.agent/skills/mobile-design/SKILL.md +42 -0
  108. package/.agent/skills/monorepo-management/SKILL.md +326 -0
  109. package/.agent/skills/motion-engineering/SKILL.md +42 -0
  110. package/.agent/skills/nextjs-react-expert/SKILL.md +42 -0
  111. package/.agent/skills/nodejs-best-practices/SKILL.md +42 -0
  112. package/.agent/skills/observability/SKILL.md +42 -0
  113. package/.agent/skills/parallel-agents/SKILL.md +42 -0
  114. package/.agent/skills/performance-profiling/SKILL.md +42 -0
  115. package/.agent/skills/plan-writing/SKILL.md +42 -0
  116. package/.agent/skills/platform-engineer/SKILL.md +42 -0
  117. package/.agent/skills/playwright-best-practices/SKILL.md +42 -0
  118. package/.agent/skills/powershell-windows/SKILL.md +42 -0
  119. package/.agent/skills/project-idioms/SKILL.md +42 -0
  120. package/.agent/skills/python-patterns/SKILL.md +42 -0
  121. package/.agent/skills/python-pro/SKILL.md +42 -0
  122. package/.agent/skills/react-specialist/SKILL.md +42 -0
  123. package/.agent/skills/readme-builder/SKILL.md +42 -0
  124. package/.agent/skills/realtime-patterns/SKILL.md +42 -0
  125. package/.agent/skills/red-team-tactics/SKILL.md +42 -0
  126. package/.agent/skills/rust-pro/SKILL.md +42 -0
  127. package/.agent/skills/seo-fundamentals/SKILL.md +42 -0
  128. package/.agent/skills/server-management/SKILL.md +42 -0
  129. package/.agent/skills/shadcn-ui-expert/SKILL.md +42 -0
  130. package/.agent/skills/skill-creator/SKILL.md +42 -0
  131. package/.agent/skills/sql-pro/SKILL.md +42 -0
  132. package/.agent/skills/supabase-postgres-best-practices/SKILL.md +42 -0
  133. package/.agent/skills/swiftui-expert/SKILL.md +42 -0
  134. package/.agent/skills/systematic-debugging/SKILL.md +42 -0
  135. package/.agent/skills/tailwind-patterns/SKILL.md +42 -0
  136. package/.agent/skills/tdd-workflow/SKILL.md +42 -0
  137. package/.agent/skills/test-result-analyzer/SKILL.md +42 -0
  138. package/.agent/skills/testing-patterns/SKILL.md +42 -0
  139. package/.agent/skills/trend-researcher/SKILL.md +42 -0
  140. package/.agent/skills/typescript-advanced/SKILL.md +327 -0
  141. package/.agent/skills/ui-ux-pro-max/SKILL.md +42 -0
  142. package/.agent/skills/ui-ux-researcher/SKILL.md +42 -0
  143. package/.agent/skills/vue-expert/SKILL.md +42 -0
  144. package/.agent/skills/vulnerability-scanner/SKILL.md +42 -0
  145. package/.agent/skills/web-accessibility-auditor/SKILL.md +42 -0
  146. package/.agent/skills/web-design-guidelines/SKILL.md +42 -0
  147. package/.agent/skills/webapp-testing/SKILL.md +42 -0
  148. package/.agent/skills/whimsy-injector/SKILL.md +42 -0
  149. package/.agent/skills/workflow-optimizer/SKILL.md +42 -0
  150. package/.agent/workflows/audit.md +6 -6
  151. package/.agent/workflows/deploy.md +1 -1
  152. package/.agent/workflows/generate.md +23 -6
  153. package/.agent/workflows/session.md +5 -5
  154. package/.agent/workflows/swarm.md +2 -2
  155. package/.agent/workflows/tribunal-backend.md +13 -2
  156. package/.agent/workflows/tribunal-full.md +15 -8
  157. package/.agent/workflows/tribunal-speed.md +183 -0
  158. package/README.md +64 -8
  159. package/bin/tribunal-kit.js +281 -41
  160. package/package.json +9 -6
  161. package/scripts/changelog.js +167 -0
  162. package/scripts/sync-version.js +81 -0
  163. package/.agent/scripts/__pycache__/auto_preview.cpython-311.pyc +0 -0
  164. package/.agent/scripts/__pycache__/bundle_analyzer.cpython-311.pyc +0 -0
  165. package/.agent/scripts/__pycache__/checklist.cpython-311.pyc +0 -0
  166. package/.agent/scripts/__pycache__/dependency_analyzer.cpython-311.pyc +0 -0
  167. package/.agent/scripts/__pycache__/security_scan.cpython-311.pyc +0 -0
  168. package/.agent/scripts/__pycache__/session_manager.cpython-311.pyc +0 -0
  169. package/.agent/scripts/__pycache__/skill_integrator.cpython-311.pyc +0 -0
  170. package/.agent/scripts/__pycache__/swarm_dispatcher.cpython-311.pyc +0 -0
  171. package/.agent/scripts/__pycache__/test_runner.cpython-311.pyc +0 -0
  172. package/.agent/scripts/__pycache__/verify_all.cpython-311.pyc +0 -0
  173. package/.agent/scripts/auto_preview.py +0 -180
  174. package/.agent/scripts/bundle_analyzer.py +0 -259
  175. package/.agent/scripts/case_law_manager.py +0 -525
  176. package/.agent/scripts/checklist.py +0 -209
  177. package/.agent/scripts/compress_skills.py +0 -167
  178. package/.agent/scripts/consolidate_skills.py +0 -173
  179. package/.agent/scripts/deep_compress.py +0 -202
  180. package/.agent/scripts/dependency_analyzer.py +0 -247
  181. package/.agent/scripts/lint_runner.py +0 -188
  182. package/.agent/scripts/minify_context.py +0 -80
  183. package/.agent/scripts/patch_skills_meta.py +0 -177
  184. package/.agent/scripts/patch_skills_output.py +0 -285
  185. package/.agent/scripts/schema_validator.py +0 -279
  186. package/.agent/scripts/security_scan.py +0 -224
  187. package/.agent/scripts/session_manager.py +0 -261
  188. package/.agent/scripts/skill_evolution.py +0 -563
  189. package/.agent/scripts/skill_integrator.py +0 -234
  190. package/.agent/scripts/strengthen_skills.py +0 -220
  191. package/.agent/scripts/strip_tribunal.py +0 -41
  192. package/.agent/scripts/swarm_dispatcher.py +0 -350
  193. package/.agent/scripts/test_runner.py +0 -192
  194. package/.agent/scripts/test_swarm_dispatcher.py +0 -163
  195. package/.agent/scripts/verify_all.py +0 -195
  196. package/.agent/skills/gsap-expert/SKILL.md +0 -194
@@ -1,11 +1,15 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * tribunal-kit CLI
3
+ * tribunal-kit CLI (alias: tk)
4
4
  *
5
5
  * Commands:
6
- * init — Install .agent/ into target project
7
- * update — Re-install to get latest changes
8
- * status — Check if .agent/ is installed
6
+ * init — Install .agent/ into target project
7
+ * update — Re-install to get latest changes
8
+ * status — Check if .agent/ is installed
9
+ * learn — Evolve project idioms based on git diffs
10
+ * case — Manage Case Law precedents
11
+ * hook — Install pre-push git hook
12
+ * uninstall — Remove .agent/ from project
9
13
  *
10
14
  * Usage:
11
15
  * npx tribunal-kit init
@@ -15,6 +19,7 @@
15
19
  * npx tribunal-kit init --dry-run
16
20
  * tribunal-kit update
17
21
  * tribunal-kit status
22
+ * tribunal-kit uninstall
18
23
  */
19
24
 
20
25
  const fs = require('fs');
@@ -50,12 +55,14 @@ function bold(text) { return `${C.bold}${text}${C.reset}`; }
50
55
 
51
56
  // ── Logging ──────────────────────────────────────────────
52
57
  let quiet = false;
58
+ let verbose = false;
53
59
 
54
60
  function log(msg) { if (!quiet) console.log(msg); }
55
61
  function ok(msg) { if (!quiet) console.log(` ${c('green', '✔')} ${msg}`); }
56
62
  function warn(msg) { if (!quiet) console.log(` ${c('yellow', '⚠')} ${msg}`); }
57
63
  function err(msg) { console.error(` ${c('red', '✖')} ${msg}`); }
58
64
  function dim(msg) { if (!quiet) console.log(` ${c('gray', msg)}`); }
65
+ function dbg(msg) { if (verbose) console.log(` ${c('gray', '⊡')} ${c('gray', msg)}`); }
59
66
 
60
67
  // ── Arg Parser ───────────────────────────────────────────
61
68
  function parseArgs(argv) {
@@ -70,14 +77,22 @@ function parseArgs(argv) {
70
77
  }
71
78
  if (arg === '--force') { args.flags.force = true; continue; }
72
79
  if (arg === '--quiet') { args.flags.quiet = true; continue; }
80
+ if (arg === '--verbose') { args.flags.verbose = true; continue; }
73
81
  if (arg === '--dry-run') { args.flags.dryRun = true; continue; }
82
+ if (arg === '--minimal') { args.flags.minimal = true; continue; }
74
83
  if (arg === '--skip-update-check') { args.flags.skipUpdateCheck = true; continue; }
84
+ if (arg === '--head') { args.flags.head = true; continue; }
75
85
  if (arg.startsWith('--path=')) {
76
86
  args.flags.path = arg.split('=').slice(1).join('=');
77
87
  }
78
88
  if (arg === '--path') {
79
89
  const idx = raw.indexOf('--path');
80
- args.flags.path = raw[idx + 1] || null;
90
+ const nextVal = raw[idx + 1];
91
+ if (!nextVal || nextVal.startsWith('--')) {
92
+ console.error(` \x1b[91m✖ --path requires a directory argument\x1b[0m`);
93
+ process.exit(1);
94
+ }
95
+ args.flags.path = nextVal;
81
96
  }
82
97
  if (arg.startsWith('--branch=')) {
83
98
  args.flags.branch = arg.split('=').slice(1).join('=');
@@ -88,7 +103,33 @@ function parseArgs(argv) {
88
103
  }
89
104
 
90
105
  // ── File Utilities ────────────────────────────────────────
91
- function copyDir(src, dest, dryRun = false) {
106
+
107
+ // Core agents to install in --minimal mode
108
+ const CORE_AGENTS = new Set([
109
+ 'backend-specialist.md',
110
+ 'frontend-specialist.md',
111
+ 'database-architect.md',
112
+ 'debugger.md',
113
+ 'security-auditor.md',
114
+ 'logic-reviewer.md',
115
+ 'dependency-reviewer.md',
116
+ 'type-safety-reviewer.md',
117
+ 'performance-reviewer.md',
118
+ 'orchestrator.md',
119
+ 'explorer-agent.md',
120
+ 'project-planner.md',
121
+ 'test-engineer.md',
122
+ ]);
123
+
124
+ // Core skills to install in --minimal mode
125
+ const CORE_SKILLS = new Set([
126
+ 'clean-code', 'architecture', 'testing-patterns', 'systematic-debugging',
127
+ 'frontend-design', 'database-design', 'api-patterns', 'nodejs-best-practices',
128
+ 'vulnerability-scanner', 'typescript-advanced', 'python-pro', 'nextjs-react-expert',
129
+ 'react-specialist', 'performance-profiling', 'lint-and-validate',
130
+ ]);
131
+
132
+ function copyDir(src, dest, dryRun = false, filter = null) {
92
133
  if (!dryRun) {
93
134
  fs.mkdirSync(dest, { recursive: true });
94
135
  }
@@ -97,15 +138,22 @@ function copyDir(src, dest, dryRun = false) {
97
138
  let count = 0;
98
139
 
99
140
  for (const entry of entries) {
141
+ // Apply filter if provided (for --minimal mode)
142
+ if (filter && !filter(entry.name, src)) {
143
+ dbg(` skip: ${entry.name}`);
144
+ continue;
145
+ }
146
+
100
147
  const srcPath = path.join(src, entry.name);
101
148
  const destPath = path.join(dest, entry.name);
102
149
 
103
150
  if (entry.isDirectory()) {
104
- count += copyDir(srcPath, destPath, dryRun);
151
+ count += copyDir(srcPath, destPath, dryRun, filter);
105
152
  } else {
106
153
  if (!dryRun) {
107
154
  fs.cpSync(srcPath, destPath, { force: true });
108
155
  }
156
+ dbg(` copy: ${entry.name}`);
109
157
  count++;
110
158
  }
111
159
  }
@@ -281,10 +329,10 @@ function banner() {
281
329
  let gradientLine = ' ' + C.bold;
282
330
  for (let i = 0; i < line.length; i++) {
283
331
  const p = maxLen > 1 ? i / (maxLen - 1) : 0;
284
- // Coquelicot #FF4000 to Penn Blue #0A1045
285
- const r = Math.round(255 + p * (10 - 255));
286
- const g = Math.round(64 + p * (16 - 64));
287
- const b = Math.round(0 + p * (69 - 0));
332
+ // Solid #ff1637 (R: 255, G: 22, B: 55)
333
+ const r = 255;
334
+ const g = 22;
335
+ const b = 55;
288
336
  gradientLine += `\x1b[38;2;${r};${g};${b}m${line[i]}`;
289
337
  }
290
338
  gradientLine += C.reset;
@@ -296,9 +344,10 @@ function banner() {
296
344
  const sub = 'Anti-Hallucination Agent System';
297
345
  const sp = Math.max(0, W - sub.length);
298
346
  const centred = ' '.repeat(Math.floor(sp / 2)) + sub + ' '.repeat(Math.ceil(sp / 2));
299
- console.log(` ${c('cyan', '╔' + ''.repeat(W) + '╗')}`);
300
- console.log(` ${c('cyan', '║')}${c('gray', centred)}${c('cyan', '║')}`);
301
- console.log(` ${c('cyan', '╚' + '═'.repeat(W) + '╝')}`);
347
+ const RED_ANSI = '\x1b[38;2;255;22;55m';
348
+ console.log(` ${RED_ANSI}╔${''.repeat(W)}╗${C.reset}`);
349
+ console.log(` ${RED_ANSI}║${C.reset}${c('gray', centred)}${RED_ANSI}║${C.reset}`);
350
+ console.log(` ${RED_ANSI}╚${'═'.repeat(W)}╝${C.reset}`);
302
351
  console.log();
303
352
  }
304
353
 
@@ -347,13 +396,22 @@ function cmdInit(flags) {
347
396
  }
348
397
 
349
398
  if (!dryRun && fs.existsSync(agentDest) && flags.force) {
350
- const subdirs = ['agents', 'workflows', 'skills', 'scripts', '.shared'];
399
+ // PRESERVE_DIRS: user-generated content that must survive updates
400
+ const PRESERVE_DIRS = ['history', 'patterns', 'mcp_config.json'];
401
+ const subdirs = ['agents', 'workflows', 'skills', 'scripts', '.shared', 'rules'];
351
402
  for (const sub of subdirs) {
352
403
  const subPath = path.join(agentDest, sub);
353
404
  if (fs.existsSync(subPath)) {
354
405
  fs.rmSync(subPath, { recursive: true, force: true });
355
406
  }
356
407
  }
408
+ // Verify preserved dirs still exist after cleanup
409
+ for (const kept of PRESERVE_DIRS) {
410
+ const keptPath = path.join(agentDest, kept);
411
+ if (kept.includes('.') ? false : !fs.existsSync(keptPath)) {
412
+ // It's okay if it doesn't exist yet — it'll be created below
413
+ }
414
+ }
357
415
  }
358
416
 
359
417
  // Ensure history dirs exist (Case Law + Skill Evolution)
@@ -369,11 +427,27 @@ function cmdInit(flags) {
369
427
  }
370
428
 
371
429
  // Count what we're installing
430
+ const isMinimal = flags.minimal || false;
431
+ if (isMinimal) {
432
+ log(` ${c('yellow','⚡')} ${bold('Minimal mode')} — installing core agents and skills only`);
433
+ console.log();
434
+ }
372
435
  const totalFiles = countDir(agentSrc);
436
+ dbg(`Source: ${agentSrc}`);
437
+ dbg(`Target: ${agentDest}`);
438
+ dbg(`Total source files: ${totalFiles}`);
373
439
  log(` ${c('gray','▸')} Scanning ${c('white', String(totalFiles))} files ${c('gray','→')} ${c('gray', agentDest)}`);
374
440
 
375
441
  try {
376
- const copied = copyDir(agentSrc, agentDest, dryRun);
442
+ // Build filter for --minimal mode
443
+ const minimalFilter = isMinimal ? (name, parentDir) => {
444
+ const parentName = path.basename(parentDir);
445
+ if (parentName === 'agents') return CORE_AGENTS.has(name);
446
+ if (parentName === 'skills') return CORE_SKILLS.has(name);
447
+ return true; // everything else passes
448
+ } : null;
449
+
450
+ const copied = copyDir(agentSrc, agentDest, dryRun, minimalFilter);
377
451
 
378
452
  console.log();
379
453
  if (dryRun) {
@@ -421,11 +495,12 @@ function cmdInit(flags) {
421
495
  console.log(plainRow(` Next steps:`, s => c('gray', s)));
422
496
  console.log(stepRow('/generate', 'Generate code with anti-hallucination'));
423
497
  console.log(stepRow('/review', 'Audit existing code for issues'));
424
- console.log(stepRow('/tribunal-full', 'Run all 11 reviewers in parallel'));
498
+ console.log(stepRow('/tribunal-full', 'Run all 16 reviewers in parallel'));
425
499
  console.log(plainRow('', () => ''));
426
500
  console.log(` ${c('cyan', '╚' + '═'.repeat(W) + '╝')}`);
427
501
  console.log();
428
- log(` ${c('gray', '✦ Your AI IDE will pick up changes automatically.')}`);
502
+ log(` ${c('gray', '✦ Generating IDE bridge files...')}`);
503
+ generateIDEBridges(targetDir, agentDest, dryRun);
429
504
  }
430
505
 
431
506
  console.log();
@@ -435,6 +510,120 @@ function cmdInit(flags) {
435
510
  }
436
511
  }
437
512
 
513
+ // ── IDE Bridge Files ──────────────────────────────────────
514
+ // Each AI IDE reads rules from a different location.
515
+ // We generate bridge files that point each IDE at .agent/
516
+ function generateIDEBridges(targetDir, agentDest, dryRun = false) {
517
+ const rulesFile = path.join(agentDest, 'rules', 'GEMINI.md');
518
+ let rulesContent = '';
519
+ if (fs.existsSync(rulesFile)) {
520
+ rulesContent = fs.readFileSync(rulesFile, 'utf8');
521
+ }
522
+
523
+ // Helper: write a bridge file only if it doesn't already exist
524
+ const writeBridge = (filePath, content, label) => {
525
+ if (dryRun) {
526
+ dbg(` would create: ${filePath}`);
527
+ return;
528
+ }
529
+ const dir = path.dirname(filePath);
530
+ if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
531
+ if (fs.existsSync(filePath)) {
532
+ dbg(` skip (exists): ${path.basename(filePath)}`);
533
+ return;
534
+ }
535
+ fs.writeFileSync(filePath, content, 'utf8');
536
+ ok(`${label} → ${c('gray', path.relative(targetDir, filePath))}`);
537
+ };
538
+
539
+ // ── 1. Cursor (.cursorrules) ──────────────────────────
540
+ const cursorRules = `# Tribunal Kit — Cursor Bridge
541
+ # Auto-generated by tribunal-kit init. Do not edit manually.
542
+ # Source: .agent/rules/GEMINI.md
543
+
544
+ ${rulesContent}
545
+ `;
546
+ writeBridge(
547
+ path.join(targetDir, '.cursorrules'),
548
+ cursorRules,
549
+ 'Cursor'
550
+ );
551
+
552
+ // ── 2. Windsurf (.windsurfrules) ─────────────────────
553
+ const windsurfRules = `# Tribunal Kit — Windsurf Bridge
554
+ # Auto-generated by tribunal-kit init. Do not edit manually.
555
+ # Source: .agent/rules/GEMINI.md
556
+
557
+ ${rulesContent}
558
+ `;
559
+ writeBridge(
560
+ path.join(targetDir, '.windsurfrules'),
561
+ windsurfRules,
562
+ 'Windsurf'
563
+ );
564
+
565
+ // ── 3. Gemini / Antigravity (.gemini/settings.json) ──
566
+ const geminiSettings = JSON.stringify({
567
+ "$schema": "https://raw.githubusercontent.com/anthropics/anthropic-cookbook/main/.gemini/settings.schema.json",
568
+ "rules": [
569
+ { "path": "../.agent/rules/GEMINI.md", "trigger": "always_on" }
570
+ ],
571
+ "agents": { "directory": "../.agent/agents" },
572
+ "skills": { "directory": "../.agent/skills" },
573
+ "workflows": { "directory": "../.agent/workflows" }
574
+ }, null, 2) + '\n';
575
+ writeBridge(
576
+ path.join(targetDir, '.gemini', 'settings.json'),
577
+ geminiSettings,
578
+ 'Gemini/Antigravity'
579
+ );
580
+
581
+ // ── Also create .gemini/GEMINI.md as a direct rules file ──
582
+ const geminiRulesBridge = `---
583
+ trigger: always_on
584
+ ---
585
+
586
+ # Tribunal Kit — Gemini Bridge
587
+ # Auto-generated by tribunal-kit init.
588
+ # Full rules: .agent/rules/GEMINI.md
589
+
590
+ ${rulesContent}
591
+ `;
592
+ writeBridge(
593
+ path.join(targetDir, '.gemini', 'GEMINI.md'),
594
+ geminiRulesBridge,
595
+ 'Gemini rules'
596
+ );
597
+
598
+ // ── 4. GitHub Copilot (.github/copilot-instructions.md) ──
599
+ const copilotInstructions = `# Tribunal Kit — Copilot Bridge
600
+ # Auto-generated by tribunal-kit init. Do not edit manually.
601
+ # Source: .agent/rules/GEMINI.md
602
+
603
+ ${rulesContent}
604
+ `;
605
+ writeBridge(
606
+ path.join(targetDir, '.github', 'copilot-instructions.md'),
607
+ copilotInstructions,
608
+ 'GitHub Copilot'
609
+ );
610
+
611
+ // ── 5. Claude (.claude/CLAUDE.md) ─────────────────────
612
+ const claudeRules = `# Tribunal Kit — Claude Bridge
613
+ # Auto-generated by tribunal-kit init. Do not edit manually.
614
+ # Source: .agent/rules/GEMINI.md
615
+
616
+ ${rulesContent}
617
+ `;
618
+ writeBridge(
619
+ path.join(targetDir, '.claude', 'CLAUDE.md'),
620
+ claudeRules,
621
+ 'Claude'
622
+ );
623
+
624
+ console.log();
625
+ }
626
+
438
627
  function cmdUpdate(flags) {
439
628
  // ── Self-install guard (early, before banner) ───────────
440
629
  const targetDir = flags.path ? path.resolve(flags.path) : process.cwd();
@@ -487,12 +676,12 @@ function cmdLearn(flags) {
487
676
 
488
677
  // Phase 1: Skill Evolution
489
678
  log(` ${c('cyan', '\u229b')} ${bold('Phase 1')} \u2014 Skill Evolution Forge (auto-generating project idioms)`);
490
- const evoScript = path.join(agentDest, 'scripts', 'skill_evolution.py');
679
+ const evoScript = path.join(agentDest, 'scripts', 'skill_evolution.js');
491
680
  if (!fs.existsSync(evoScript)) {
492
- warn('skill_evolution.py not found \u2014 run: npx tribunal-kit update');
681
+ warn('skill_evolution.js not found \u2014 run: npx tribunal-kit update');
493
682
  } else {
494
683
  try {
495
- const cmd = `${python} "${evoScript}" digest ${dryRun} ${useHead}`.trim();
684
+ const cmd = `node "${evoScript}" digest ${dryRun} ${useHead}`.trim();
496
685
  execSync(cmd, { stdio: 'inherit', cwd: targetDir });
497
686
  } catch (e) {
498
687
  warn(`Skill Evolution error: ${e.message}`);
@@ -547,6 +736,9 @@ async function runWithUpdateCheck(command, flags) {
547
736
  case 'hook':
548
737
  cmdHook(flags);
549
738
  break;
739
+ case 'uninstall':
740
+ cmdUninstall(flags);
741
+ break;
550
742
  case 'help':
551
743
  case '--help':
552
744
  case '-h':
@@ -580,12 +772,16 @@ function cmdCase(flags) {
580
772
  log(` ${c('cyan', 'add'.padEnd(10))} ${c('gray', 'Record a new Case Law rejection pattern')}`);
581
773
  log(` ${c('cyan', 'search'.padEnd(10))} ${c('gray', 'Search existing cases (e.g., search "query")')}`);
582
774
  log(` ${c('cyan', 'list'.padEnd(10))} ${c('gray', 'List all recorded case law')}`);
775
+ log(` ${c('cyan', 'show'.padEnd(10))} ${c('gray', 'Show full diff for a case (e.g., show --id 1)')}`);
776
+ log(` ${c('cyan', 'stats'.padEnd(10))} ${c('gray', 'Show case law stats by domain/verdict')}`);
777
+ log(` ${c('cyan', 'export'.padEnd(10))} ${c('gray', 'Export all cases to Markdown')}`);
778
+ log(` ${c('cyan', 'overrule'.padEnd(10))} ${c('gray', 'Overrule a past precedent (e.g., overrule --id 1)')}`);
583
779
  console.log();
584
780
  process.exit(1);
585
781
  }
586
782
 
587
783
  const python = process.platform === 'win32' ? 'python' : 'python3';
588
- const caseLawScript = path.join(agentDest, 'scripts', 'case_law_manager.py');
784
+ const caseLawScript = path.join(agentDest, 'scripts', 'case_law_manager.js');
589
785
 
590
786
  // Make shorthand aliases
591
787
  let pyArgs = args;
@@ -594,7 +790,7 @@ function cmdCase(flags) {
594
790
 
595
791
  try {
596
792
  const { execSync } = require('child_process');
597
- execSync(`${python} "${caseLawScript}" ${pyArgs}`, { stdio: 'inherit', cwd: targetDir });
793
+ execSync(`node "${caseLawScript}" ${pyArgs}`, { stdio: 'inherit', cwd: targetDir });
598
794
  } catch (e) {
599
795
  process.exit(1); // Script already prints errors
600
796
  }
@@ -625,6 +821,37 @@ function cmdHook(flags) {
625
821
  console.log();
626
822
  }
627
823
 
824
+ function cmdUninstall(flags) {
825
+ const targetDir = flags.path ? path.resolve(flags.path) : process.cwd();
826
+ const agentDest = path.join(targetDir, '.agent');
827
+
828
+ banner();
829
+
830
+ if (!fs.existsSync(agentDest)) {
831
+ log(` ${c('yellow','⚠')} ${bold('.agent/')} is not installed in this project.`);
832
+ console.log();
833
+ return;
834
+ }
835
+
836
+ if (flags.dryRun) {
837
+ log(colorize('yellow', ' DRY RUN — would remove:'));
838
+ log(` ${c('gray',' ╰─')} ${agentDest}`);
839
+ console.log();
840
+ return;
841
+ }
842
+
843
+ try {
844
+ fs.rmSync(agentDest, { recursive: true, force: true });
845
+ log(` ${c('green','✔')} ${bold('.agent/')} has been removed from this project.`);
846
+ console.log();
847
+ log(` ${c('gray','▸')} To reinstall: ${c('cyan','npx tribunal-kit init')}`);
848
+ console.log();
849
+ } catch (e) {
850
+ err(`Failed to remove .agent/: ${e.message}`);
851
+ process.exit(1);
852
+ }
853
+ }
854
+
628
855
  function cmdStatus(flags) {
629
856
  const targetDir = flags.path ? path.resolve(flags.path) : process.cwd();
630
857
  const agentDest = path.join(targetDir, '.agent');
@@ -663,37 +890,49 @@ function cmdHelp() {
663
890
 
664
891
  log(bold(' Commands'));
665
892
  log(` ${c('gray','─'.repeat(40))}`);
666
- log(cmd('init', 'Install .agent/ into current project'));
667
- log(cmd('update', 'Re-install to get latest version'));
668
- log(cmd('status', 'Check if .agent/ is installed'));
669
- log(cmd('learn', 'Evolve project idioms based on git diffs'));
670
- log(cmd('case', 'Manage Case Law precedents (add, search, list)'));
671
- log(cmd('hook', 'Install pre-push git hook for auto-learning'));
893
+ log(cmd('init', 'Install .agent/ into current project'));
894
+ log(cmd('update', 'Re-install to get latest version'));
895
+ log(cmd('status', 'Check if .agent/ is installed'));
896
+ log(cmd('learn', 'Evolve project idioms based on git diffs'));
897
+ log(cmd('case', 'Manage Case Law precedents (add, search, list, show, stats, overrule)'));
898
+ log(cmd('hook', 'Install pre-push git hook for auto-learning'));
899
+ log(cmd('uninstall','Remove .agent/ folder from project'));
672
900
  console.log();
673
901
  log(bold(' Options'));
674
902
  log(` ${c('gray','─'.repeat(40))}`);
675
903
  log(opt('--force', 'Overwrite existing .agent/ folder'));
676
904
  log(opt('--path <dir>', 'Install in specific directory'));
677
905
  log(opt('--quiet', 'Suppress all output'));
906
+ log(opt('--verbose', 'Show detailed debug logging'));
678
907
  log(opt('--dry-run', 'Preview actions without executing'));
908
+ log(opt('--minimal', 'Install core agents/skills only (~13 agents)'));
679
909
  log(opt('--skip-update-check', 'Skip auto-update version check'));
680
910
  log(opt('--head', '(learn) Diff against last commit instead of staged'));
681
911
  console.log();
912
+ log(bold(' Aliases'));
913
+ log(` ${c('gray','─'.repeat(40))}`);
914
+ log(` ${c('cyan', 'tk')} ${c('gray', 'Shorthand for tribunal-kit (e.g., tk init, tk status)')}`);
915
+ console.log();
682
916
  log(bold(' Examples'));
683
917
  log(` ${c('gray','─'.repeat(40))}`);
684
918
  log(ex('npx tribunal-kit init'));
685
- log(ex('npx tribunal-kit init --force'));
686
- log(ex('npx tribunal-kit init --path ./my-app'));
919
+ log(ex('tk init --force'));
920
+ log(ex('tk init --path ./my-app'));
687
921
  log(ex('npx tribunal-kit init --dry-run'));
688
- log(ex('npx tribunal-kit update'));
689
- log(ex('npx tribunal-kit status'));
690
- log(ex('npx tribunal-kit learn'));
691
- log(ex('npx tribunal-kit learn --dry-run'));
692
- log(ex('npx tribunal-kit learn --head'));
693
- log(ex('npx tribunal-kit case add'));
694
- log(ex('npx tribunal-kit case search "useEffect"'));
695
- log(ex('npx tribunal-kit case list'));
696
- log(ex('npx tribunal-kit hook'));
922
+ log(ex('tk update'));
923
+ log(ex('tk status'));
924
+ log(ex('tk learn'));
925
+ log(ex('tk learn --dry-run'));
926
+ log(ex('tk learn --head'));
927
+ log(ex('tk case add'));
928
+ log(ex('tk case search "useEffect"'));
929
+ log(ex('tk case list'));
930
+ log(ex('tk case show --id 1'));
931
+ log(ex('tk case stats'));
932
+ log(ex('tk case export'));
933
+ log(ex('tk case overrule --id 1'));
934
+ log(ex('tk hook'));
935
+ log(ex('tk uninstall'));
697
936
  console.log();
698
937
  }
699
938
 
@@ -701,10 +940,11 @@ function cmdHelp() {
701
940
  const { command, flags } = parseArgs(process.argv);
702
941
 
703
942
  if (flags.quiet) quiet = true;
943
+ if (flags.verbose) verbose = true;
704
944
 
705
945
  runWithUpdateCheck(command, flags);
706
946
 
707
947
  // -- Exports (for testing) -- do not remove
708
948
  if (require.main !== module) {
709
- module.exports = { parseArgs, compareSemver, copyDir, countDir, isSelfInstall };
949
+ module.exports = { parseArgs, compareSemver, copyDir, countDir, isSelfInstall, CORE_AGENTS, CORE_SKILLS, generateIDEBridges };
710
950
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tribunal-kit",
3
- "version": "4.0.1",
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.3.0",
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",
7
7
  "ai-agent",
@@ -46,6 +46,7 @@
46
46
  },
47
47
  "files": [
48
48
  "bin/",
49
+ "scripts/",
49
50
  ".agent/",
50
51
  "README.md",
51
52
  "LICENSE"
@@ -56,7 +57,12 @@
56
57
  "scripts": {
57
58
  "test": "jest --coverage",
58
59
  "test:unit": "jest test/unit --coverage",
59
- "test:integration": "jest test/integration --coverage"
60
+ "test:integration": "jest test/integration --coverage",
61
+ "preversion": "node scripts/sync-version.js",
62
+ "version": "node scripts/changelog.js && git add CHANGELOG.md",
63
+ "changelog": "node scripts/changelog.js",
64
+ "changelog:preview": "node scripts/changelog.js --preview",
65
+ "sync": "node scripts/sync-version.js"
60
66
  },
61
67
  "devDependencies": {
62
68
  "jest": "^29.7.0"
@@ -70,8 +76,5 @@
70
76
  "collectCoverageFrom": [
71
77
  "bin/**/*.js"
72
78
  ]
73
- },
74
- "dependencies": {
75
- "tribunal-kit": "^4.0.0"
76
79
  }
77
80
  }