tribunal-kit 4.2.0 → 4.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (186) hide show
  1. package/.agent/ARCHITECTURE.md +21 -14
  2. package/.agent/agents/swarm-worker-contracts.md +5 -5
  3. package/.agent/agents/ui-ux-auditor.md +292 -0
  4. package/.agent/rules/GEMINI.md +8 -8
  5. package/.agent/scripts/__pycache__/_colors.cpython-311.pyc +0 -0
  6. package/.agent/scripts/__pycache__/_utils.cpython-311.pyc +0 -0
  7. package/.agent/scripts/__pycache__/case_law_manager.cpython-311.pyc +0 -0
  8. package/.agent/scripts/_colors.js +18 -0
  9. package/.agent/scripts/_utils.js +42 -0
  10. package/.agent/scripts/auto_preview.js +197 -0
  11. package/.agent/scripts/bundle_analyzer.js +290 -0
  12. package/.agent/scripts/case_law_manager.js +684 -0
  13. package/.agent/scripts/checklist.js +266 -0
  14. package/.agent/scripts/colors.js +17 -0
  15. package/.agent/scripts/compress_skills.js +141 -0
  16. package/.agent/scripts/consolidate_skills.js +149 -0
  17. package/.agent/scripts/context_broker.js +609 -0
  18. package/.agent/scripts/deep_compress.js +150 -0
  19. package/.agent/scripts/dependency_analyzer.js +272 -0
  20. package/.agent/scripts/graph_builder.js +199 -0
  21. package/.agent/scripts/graph_zoom.js +154 -0
  22. package/.agent/scripts/inner_loop_validator.js +465 -0
  23. package/.agent/scripts/lint_runner.js +187 -0
  24. package/.agent/scripts/minify_context.js +100 -0
  25. package/.agent/scripts/patch_skills_meta.js +156 -0
  26. package/.agent/scripts/patch_skills_output.js +244 -0
  27. package/.agent/scripts/schema_validator.js +297 -0
  28. package/.agent/scripts/security_scan.js +303 -0
  29. package/.agent/scripts/session_manager.js +276 -0
  30. package/.agent/scripts/skill_evolution.js +644 -0
  31. package/.agent/scripts/skill_integrator.js +313 -0
  32. package/.agent/scripts/strengthen_skills.js +193 -0
  33. package/.agent/scripts/strip_tribunal.js +47 -0
  34. package/.agent/scripts/swarm_dispatcher.js +360 -0
  35. package/.agent/scripts/test_runner.js +193 -0
  36. package/.agent/scripts/utils.js +32 -0
  37. package/.agent/scripts/verify_all.js +256 -0
  38. package/.agent/skills/agent-organizer/SKILL.md +12 -4
  39. package/.agent/skills/agentic-patterns/SKILL.md +12 -4
  40. package/.agent/skills/ai-prompt-injection-defense/SKILL.md +12 -4
  41. package/.agent/skills/api-patterns/SKILL.md +209 -201
  42. package/.agent/skills/api-security-auditor/SKILL.md +12 -4
  43. package/.agent/skills/app-builder/SKILL.md +12 -4
  44. package/.agent/skills/app-builder/templates/SKILL.md +76 -68
  45. package/.agent/skills/app-builder/templates/astro-static/TEMPLATE.md +1 -1
  46. package/.agent/skills/app-builder/templates/chrome-extension/TEMPLATE.md +1 -1
  47. package/.agent/skills/app-builder/templates/cli-tool/TEMPLATE.md +1 -1
  48. package/.agent/skills/app-builder/templates/electron-desktop/TEMPLATE.md +1 -1
  49. package/.agent/skills/app-builder/templates/express-api/TEMPLATE.md +1 -1
  50. package/.agent/skills/app-builder/templates/flutter-app/TEMPLATE.md +1 -1
  51. package/.agent/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +1 -1
  52. package/.agent/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +1 -1
  53. package/.agent/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +1 -1
  54. package/.agent/skills/app-builder/templates/nextjs-static/TEMPLATE.md +1 -1
  55. package/.agent/skills/app-builder/templates/nuxt-app/TEMPLATE.md +1 -1
  56. package/.agent/skills/app-builder/templates/python-fastapi/TEMPLATE.md +1 -1
  57. package/.agent/skills/app-builder/templates/react-native-app/TEMPLATE.md +1 -1
  58. package/.agent/skills/appflow-wireframe/SKILL.md +12 -4
  59. package/.agent/skills/architecture/SKILL.md +12 -4
  60. package/.agent/skills/authentication-best-practices/SKILL.md +12 -4
  61. package/.agent/skills/bash-linux/SKILL.md +12 -4
  62. package/.agent/skills/behavioral-modes/SKILL.md +12 -4
  63. package/.agent/skills/brainstorming/SKILL.md +12 -4
  64. package/.agent/skills/building-native-ui/SKILL.md +12 -4
  65. package/.agent/skills/clean-code/SKILL.md +12 -4
  66. package/.agent/skills/code-review-checklist/SKILL.md +12 -4
  67. package/.agent/skills/config-validator/SKILL.md +12 -4
  68. package/.agent/skills/csharp-developer/SKILL.md +12 -4
  69. package/.agent/skills/data-validation-schemas/SKILL.md +290 -282
  70. package/.agent/skills/database-design/SKILL.md +202 -194
  71. package/.agent/skills/deployment-procedures/SKILL.md +12 -4
  72. package/.agent/skills/devops-engineer/SKILL.md +12 -4
  73. package/.agent/skills/devops-incident-responder/SKILL.md +12 -4
  74. package/.agent/skills/doc.md +1 -1
  75. package/.agent/skills/documentation-templates/SKILL.md +12 -4
  76. package/.agent/skills/edge-computing/SKILL.md +12 -4
  77. package/.agent/skills/error-resilience/SKILL.md +390 -382
  78. package/.agent/skills/extract-design-system/SKILL.md +12 -4
  79. package/.agent/skills/framer-motion-expert/SKILL.md +206 -199
  80. package/.agent/skills/frontend-design/SKILL.md +163 -155
  81. package/.agent/skills/game-design-expert/SKILL.md +12 -4
  82. package/.agent/skills/game-engineering-expert/SKILL.md +12 -4
  83. package/.agent/skills/geo-fundamentals/SKILL.md +12 -4
  84. package/.agent/skills/github-operations/SKILL.md +12 -4
  85. package/.agent/skills/gsap-core/SKILL.md +54 -48
  86. package/.agent/skills/gsap-frameworks/SKILL.md +54 -48
  87. package/.agent/skills/gsap-performance/SKILL.md +54 -48
  88. package/.agent/skills/gsap-plugins/SKILL.md +54 -48
  89. package/.agent/skills/gsap-react/SKILL.md +54 -48
  90. package/.agent/skills/gsap-scrolltrigger/SKILL.md +54 -48
  91. package/.agent/skills/gsap-timeline/SKILL.md +54 -48
  92. package/.agent/skills/gsap-utils/SKILL.md +54 -48
  93. package/.agent/skills/i18n-localization/SKILL.md +12 -4
  94. package/.agent/skills/intelligent-routing/SKILL.md +41 -33
  95. package/.agent/skills/knowledge-graph/SKILL.md +36 -0
  96. package/.agent/skills/lint-and-validate/SKILL.md +12 -4
  97. package/.agent/skills/llm-engineering/SKILL.md +12 -4
  98. package/.agent/skills/local-first/SKILL.md +12 -4
  99. package/.agent/skills/mcp-builder/SKILL.md +12 -4
  100. package/.agent/skills/mobile-design/SKILL.md +225 -217
  101. package/.agent/skills/monorepo-management/SKILL.md +296 -288
  102. package/.agent/skills/motion-engineering/SKILL.md +195 -187
  103. package/.agent/skills/nextjs-react-expert/SKILL.md +196 -188
  104. package/.agent/skills/nodejs-best-practices/SKILL.md +12 -4
  105. package/.agent/skills/observability/SKILL.md +12 -4
  106. package/.agent/skills/parallel-agents/SKILL.md +12 -4
  107. package/.agent/skills/performance-profiling/SKILL.md +12 -4
  108. package/.agent/skills/plan-writing/SKILL.md +12 -4
  109. package/.agent/skills/platform-engineer/SKILL.md +12 -4
  110. package/.agent/skills/playwright-best-practices/SKILL.md +12 -4
  111. package/.agent/skills/powershell-windows/SKILL.md +12 -4
  112. package/.agent/skills/project-idioms/SKILL.md +12 -4
  113. package/.agent/skills/python-patterns/SKILL.md +12 -4
  114. package/.agent/skills/python-pro/SKILL.md +285 -277
  115. package/.agent/skills/react-specialist/SKILL.md +239 -231
  116. package/.agent/skills/readme-builder/SKILL.md +12 -4
  117. package/.agent/skills/realtime-patterns/SKILL.md +12 -4
  118. package/.agent/skills/red-team-tactics/SKILL.md +12 -4
  119. package/.agent/skills/rust-pro/SKILL.md +12 -4
  120. package/.agent/skills/seo-fundamentals/SKILL.md +12 -4
  121. package/.agent/skills/server-management/SKILL.md +12 -4
  122. package/.agent/skills/shadcn-ui-expert/SKILL.md +12 -4
  123. package/.agent/skills/skill-creator/SKILL.md +12 -4
  124. package/.agent/skills/sql-pro/SKILL.md +12 -4
  125. package/.agent/skills/supabase-postgres-best-practices/SKILL.md +12 -4
  126. package/.agent/skills/swiftui-expert/SKILL.md +12 -4
  127. package/.agent/skills/systematic-debugging/SKILL.md +12 -4
  128. package/.agent/skills/tailwind-patterns/SKILL.md +12 -4
  129. package/.agent/skills/tdd-workflow/SKILL.md +12 -4
  130. package/.agent/skills/test-result-analyzer/SKILL.md +12 -4
  131. package/.agent/skills/testing-patterns/SKILL.md +12 -4
  132. package/.agent/skills/trend-researcher/SKILL.md +12 -4
  133. package/.agent/skills/typescript-advanced/SKILL.md +297 -289
  134. package/.agent/skills/ui-ux-pro-max/SKILL.md +12 -4
  135. package/.agent/skills/ui-ux-researcher/SKILL.md +12 -4
  136. package/.agent/skills/vue-expert/SKILL.md +237 -229
  137. package/.agent/skills/vulnerability-scanner/SKILL.md +12 -4
  138. package/.agent/skills/web-accessibility-auditor/SKILL.md +12 -4
  139. package/.agent/skills/web-design-guidelines/SKILL.md +12 -4
  140. package/.agent/skills/webapp-testing/SKILL.md +12 -4
  141. package/.agent/skills/whimsy-injector/SKILL.md +12 -4
  142. package/.agent/skills/workflow-optimizer/SKILL.md +12 -4
  143. package/.agent/workflows/audit.md +6 -6
  144. package/.agent/workflows/deploy.md +1 -1
  145. package/.agent/workflows/generate.md +23 -6
  146. package/.agent/workflows/session.md +5 -5
  147. package/.agent/workflows/swarm.md +2 -2
  148. package/README.md +242 -186
  149. package/bin/tribunal-kit.js +297 -57
  150. package/package.json +81 -77
  151. package/scripts/changelog.js +167 -0
  152. package/scripts/sync-version.js +81 -0
  153. package/scripts/validate-payload.js +73 -0
  154. package/.agent/scripts/__pycache__/auto_preview.cpython-311.pyc +0 -0
  155. package/.agent/scripts/__pycache__/bundle_analyzer.cpython-311.pyc +0 -0
  156. package/.agent/scripts/__pycache__/checklist.cpython-311.pyc +0 -0
  157. package/.agent/scripts/__pycache__/dependency_analyzer.cpython-311.pyc +0 -0
  158. package/.agent/scripts/__pycache__/security_scan.cpython-311.pyc +0 -0
  159. package/.agent/scripts/__pycache__/session_manager.cpython-311.pyc +0 -0
  160. package/.agent/scripts/__pycache__/skill_integrator.cpython-311.pyc +0 -0
  161. package/.agent/scripts/__pycache__/swarm_dispatcher.cpython-311.pyc +0 -0
  162. package/.agent/scripts/__pycache__/test_runner.cpython-311.pyc +0 -0
  163. package/.agent/scripts/__pycache__/verify_all.cpython-311.pyc +0 -0
  164. package/.agent/scripts/auto_preview.py +0 -180
  165. package/.agent/scripts/bundle_analyzer.py +0 -259
  166. package/.agent/scripts/case_law_manager.py +0 -755
  167. package/.agent/scripts/checklist.py +0 -209
  168. package/.agent/scripts/compress_skills.py +0 -167
  169. package/.agent/scripts/consolidate_skills.py +0 -173
  170. package/.agent/scripts/deep_compress.py +0 -202
  171. package/.agent/scripts/dependency_analyzer.py +0 -247
  172. package/.agent/scripts/lint_runner.py +0 -188
  173. package/.agent/scripts/minify_context.py +0 -80
  174. package/.agent/scripts/patch_skills_meta.py +0 -177
  175. package/.agent/scripts/patch_skills_output.py +0 -285
  176. package/.agent/scripts/schema_validator.py +0 -279
  177. package/.agent/scripts/security_scan.py +0 -224
  178. package/.agent/scripts/session_manager.py +0 -261
  179. package/.agent/scripts/skill_evolution.py +0 -563
  180. package/.agent/scripts/skill_integrator.py +0 -234
  181. package/.agent/scripts/strengthen_skills.py +0 -220
  182. package/.agent/scripts/strip_tribunal.py +0 -41
  183. package/.agent/scripts/swarm_dispatcher.py +0 -350
  184. package/.agent/scripts/test_runner.py +0 -192
  185. package/.agent/scripts/test_swarm_dispatcher.py +0 -163
  186. package/.agent/scripts/verify_all.py +0 -195
@@ -1,11 +1,15 @@
1
- #!/usr/bin/env node
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
 
@@ -324,6 +373,35 @@ function cmdInit(flags) {
324
373
  }
325
374
  // ────────────────────────────────────────────────────────
326
375
 
376
+ // ── Backup / Cleanup ────────────────────────────────────
377
+ if (!dryRun && fs.existsSync(agentDest) && flags.force) {
378
+ // Backup the existing subdirectories before overwriting
379
+ const backupDir = path.join(agentDest, '.backups', `backup-${Date.now()}`);
380
+ fs.mkdirSync(backupDir, { recursive: true });
381
+
382
+ // PRESERVE_DIRS: user-generated content that must survive updates
383
+ const PRESERVE_DIRS = ['history', 'patterns', 'mcp_config.json'];
384
+ const subdirs = ['agents', 'workflows', 'skills', 'scripts', '.shared', 'rules'];
385
+ for (const sub of subdirs) {
386
+ const subPath = path.join(agentDest, sub);
387
+ if (fs.existsSync(subPath)) {
388
+ // Copy to backup dir
389
+ copyDir(subPath, path.join(backupDir, sub), false);
390
+ fs.rmSync(subPath, { recursive: true, force: true });
391
+ }
392
+ }
393
+ log(` ${c('gray', '✦ Backed up existing configurations to .agent/.backups/')}`);
394
+
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
+ }
402
+ }
403
+ // ────────────────────────────────────────────────────────
404
+
327
405
  banner();
328
406
 
329
407
  if (dryRun) {
@@ -346,16 +424,6 @@ function cmdInit(flags) {
346
424
  process.exit(0);
347
425
  }
348
426
 
349
- if (!dryRun && fs.existsSync(agentDest) && flags.force) {
350
- const subdirs = ['agents', 'workflows', 'skills', 'scripts', '.shared'];
351
- for (const sub of subdirs) {
352
- const subPath = path.join(agentDest, sub);
353
- if (fs.existsSync(subPath)) {
354
- fs.rmSync(subPath, { recursive: true, force: true });
355
- }
356
- }
357
- }
358
-
359
427
  // Ensure history dirs exist (Case Law + Skill Evolution)
360
428
  if (!dryRun) {
361
429
  const caseDir = path.join(agentDest, 'history', 'case-law', 'cases');
@@ -369,11 +437,27 @@ function cmdInit(flags) {
369
437
  }
370
438
 
371
439
  // Count what we're installing
440
+ const isMinimal = flags.minimal || false;
441
+ if (isMinimal) {
442
+ log(` ${c('yellow','⚡')} ${bold('Minimal mode')} — installing core agents and skills only`);
443
+ console.log();
444
+ }
372
445
  const totalFiles = countDir(agentSrc);
446
+ dbg(`Source: ${agentSrc}`);
447
+ dbg(`Target: ${agentDest}`);
448
+ dbg(`Total source files: ${totalFiles}`);
373
449
  log(` ${c('gray','▸')} Scanning ${c('white', String(totalFiles))} files ${c('gray','→')} ${c('gray', agentDest)}`);
374
450
 
375
451
  try {
376
- const copied = copyDir(agentSrc, agentDest, dryRun);
452
+ // Build filter for --minimal mode
453
+ const minimalFilter = isMinimal ? (name, parentDir) => {
454
+ const parentName = path.basename(parentDir);
455
+ if (parentName === 'agents') return CORE_AGENTS.has(name);
456
+ if (parentName === 'skills') return CORE_SKILLS.has(name);
457
+ return true; // everything else passes
458
+ } : null;
459
+
460
+ const copied = copyDir(agentSrc, agentDest, dryRun, minimalFilter);
377
461
 
378
462
  console.log();
379
463
  if (dryRun) {
@@ -421,11 +505,12 @@ function cmdInit(flags) {
421
505
  console.log(plainRow(` Next steps:`, s => c('gray', s)));
422
506
  console.log(stepRow('/generate', 'Generate code with anti-hallucination'));
423
507
  console.log(stepRow('/review', 'Audit existing code for issues'));
424
- console.log(stepRow('/tribunal-full', 'Run all 14 reviewers in parallel'));
508
+ console.log(stepRow('/tribunal-full', 'Run all 16 reviewers in parallel'));
425
509
  console.log(plainRow('', () => ''));
426
510
  console.log(` ${c('cyan', '╚' + '═'.repeat(W) + '╝')}`);
427
511
  console.log();
428
- log(` ${c('gray', '✦ Your AI IDE will pick up changes automatically.')}`);
512
+ log(` ${c('gray', '✦ Generating IDE bridge files...')}`);
513
+ generateIDEBridges(targetDir, agentDest, dryRun);
429
514
  }
430
515
 
431
516
  console.log();
@@ -435,6 +520,120 @@ function cmdInit(flags) {
435
520
  }
436
521
  }
437
522
 
523
+ // ── IDE Bridge Files ──────────────────────────────────────
524
+ // Each AI IDE reads rules from a different location.
525
+ // We generate bridge files that point each IDE at .agent/
526
+ function generateIDEBridges(targetDir, agentDest, dryRun = false) {
527
+ const rulesFile = path.join(agentDest, 'rules', 'GEMINI.md');
528
+ let rulesContent = '';
529
+ if (fs.existsSync(rulesFile)) {
530
+ rulesContent = fs.readFileSync(rulesFile, 'utf8');
531
+ }
532
+
533
+ // Helper: write a bridge file only if it doesn't already exist
534
+ const writeBridge = (filePath, content, label) => {
535
+ if (dryRun) {
536
+ dbg(` would create: ${filePath}`);
537
+ return;
538
+ }
539
+ const dir = path.dirname(filePath);
540
+ if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
541
+ if (fs.existsSync(filePath)) {
542
+ dbg(` skip (exists): ${path.basename(filePath)}`);
543
+ return;
544
+ }
545
+ fs.writeFileSync(filePath, content, 'utf8');
546
+ ok(`${label} → ${c('gray', path.relative(targetDir, filePath))}`);
547
+ };
548
+
549
+ // ── 1. Cursor (.cursorrules) ──────────────────────────
550
+ const cursorRules = `# Tribunal Kit — Cursor Bridge
551
+ # Auto-generated by tribunal-kit init. Do not edit manually.
552
+ # Source: .agent/rules/GEMINI.md
553
+
554
+ ${rulesContent}
555
+ `;
556
+ writeBridge(
557
+ path.join(targetDir, '.cursorrules'),
558
+ cursorRules,
559
+ 'Cursor'
560
+ );
561
+
562
+ // ── 2. Windsurf (.windsurfrules) ─────────────────────
563
+ const windsurfRules = `# Tribunal Kit — Windsurf Bridge
564
+ # Auto-generated by tribunal-kit init. Do not edit manually.
565
+ # Source: .agent/rules/GEMINI.md
566
+
567
+ ${rulesContent}
568
+ `;
569
+ writeBridge(
570
+ path.join(targetDir, '.windsurfrules'),
571
+ windsurfRules,
572
+ 'Windsurf'
573
+ );
574
+
575
+ // ── 3. Gemini / Antigravity (.gemini/settings.json) ──
576
+ const geminiSettings = JSON.stringify({
577
+ "$schema": "https://raw.githubusercontent.com/anthropics/anthropic-cookbook/main/.gemini/settings.schema.json",
578
+ "rules": [
579
+ { "path": "../.agent/rules/GEMINI.md", "trigger": "always_on" }
580
+ ],
581
+ "agents": { "directory": "../.agent/agents" },
582
+ "skills": { "directory": "../.agent/skills" },
583
+ "workflows": { "directory": "../.agent/workflows" }
584
+ }, null, 2) + '\n';
585
+ writeBridge(
586
+ path.join(targetDir, '.gemini', 'settings.json'),
587
+ geminiSettings,
588
+ 'Gemini/Antigravity'
589
+ );
590
+
591
+ // ── Also create .gemini/GEMINI.md as a direct rules file ──
592
+ const geminiRulesBridge = `---
593
+ trigger: always_on
594
+ ---
595
+
596
+ # Tribunal Kit — Gemini Bridge
597
+ # Auto-generated by tribunal-kit init.
598
+ # Full rules: .agent/rules/GEMINI.md
599
+
600
+ ${rulesContent}
601
+ `;
602
+ writeBridge(
603
+ path.join(targetDir, '.gemini', 'GEMINI.md'),
604
+ geminiRulesBridge,
605
+ 'Gemini rules'
606
+ );
607
+
608
+ // ── 4. GitHub Copilot (.github/copilot-instructions.md) ──
609
+ const copilotInstructions = `# Tribunal Kit — Copilot Bridge
610
+ # Auto-generated by tribunal-kit init. Do not edit manually.
611
+ # Source: .agent/rules/GEMINI.md
612
+
613
+ ${rulesContent}
614
+ `;
615
+ writeBridge(
616
+ path.join(targetDir, '.github', 'copilot-instructions.md'),
617
+ copilotInstructions,
618
+ 'GitHub Copilot'
619
+ );
620
+
621
+ // ── 5. Claude (.claude/CLAUDE.md) ─────────────────────
622
+ const claudeRules = `# Tribunal Kit — Claude Bridge
623
+ # Auto-generated by tribunal-kit init. Do not edit manually.
624
+ # Source: .agent/rules/GEMINI.md
625
+
626
+ ${rulesContent}
627
+ `;
628
+ writeBridge(
629
+ path.join(targetDir, '.claude', 'CLAUDE.md'),
630
+ claudeRules,
631
+ 'Claude'
632
+ );
633
+
634
+ console.log();
635
+ }
636
+
438
637
  function cmdUpdate(flags) {
439
638
  // ── Self-install guard (early, before banner) ───────────
440
639
  const targetDir = flags.path ? path.resolve(flags.path) : process.cwd();
@@ -482,17 +681,16 @@ function cmdLearn(flags) {
482
681
 
483
682
  const dryRun = flags.dryRun ? '--dry-run' : '';
484
683
  const useHead = flags.head ? '--head' : '';
485
- const python = process.platform === 'win32' ? 'python' : 'python3';
486
684
  const { execSync } = require('child_process');
487
685
 
488
686
  // Phase 1: Skill Evolution
489
687
  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');
688
+ const evoScript = path.join(agentDest, 'scripts', 'skill_evolution.js');
491
689
  if (!fs.existsSync(evoScript)) {
492
- warn('skill_evolution.py not found \u2014 run: npx tribunal-kit update');
690
+ warn('skill_evolution.js not found \u2014 run: npx tribunal-kit update');
493
691
  } else {
494
692
  try {
495
- const cmd = `${python} "${evoScript}" digest ${dryRun} ${useHead}`.trim();
693
+ const cmd = `node "${evoScript}" digest ${dryRun} ${useHead}`.trim();
496
694
  execSync(cmd, { stdio: 'inherit', cwd: targetDir });
497
695
  } catch (e) {
498
696
  warn(`Skill Evolution error: ${e.message}`);
@@ -547,6 +745,9 @@ async function runWithUpdateCheck(command, flags) {
547
745
  case 'hook':
548
746
  cmdHook(flags);
549
747
  break;
748
+ case 'uninstall':
749
+ cmdUninstall(flags);
750
+ break;
550
751
  case 'help':
551
752
  case '--help':
552
753
  case '-h':
@@ -588,8 +789,7 @@ function cmdCase(flags) {
588
789
  process.exit(1);
589
790
  }
590
791
 
591
- const python = process.platform === 'win32' ? 'python' : 'python3';
592
- const caseLawScript = path.join(agentDest, 'scripts', 'case_law_manager.py');
792
+ const caseLawScript = path.join(agentDest, 'scripts', 'case_law_manager.js');
593
793
 
594
794
  // Make shorthand aliases
595
795
  let pyArgs = args;
@@ -598,7 +798,7 @@ function cmdCase(flags) {
598
798
 
599
799
  try {
600
800
  const { execSync } = require('child_process');
601
- execSync(`${python} "${caseLawScript}" ${pyArgs}`, { stdio: 'inherit', cwd: targetDir });
801
+ execSync(`node "${caseLawScript}" ${pyArgs}`, { stdio: 'inherit', cwd: targetDir });
602
802
  } catch (e) {
603
803
  process.exit(1); // Script already prints errors
604
804
  }
@@ -629,6 +829,37 @@ function cmdHook(flags) {
629
829
  console.log();
630
830
  }
631
831
 
832
+ function cmdUninstall(flags) {
833
+ const targetDir = flags.path ? path.resolve(flags.path) : process.cwd();
834
+ const agentDest = path.join(targetDir, '.agent');
835
+
836
+ banner();
837
+
838
+ if (!fs.existsSync(agentDest)) {
839
+ log(` ${c('yellow','⚠')} ${bold('.agent/')} is not installed in this project.`);
840
+ console.log();
841
+ return;
842
+ }
843
+
844
+ if (flags.dryRun) {
845
+ log(colorize('yellow', ' DRY RUN — would remove:'));
846
+ log(` ${c('gray',' ╰─')} ${agentDest}`);
847
+ console.log();
848
+ return;
849
+ }
850
+
851
+ try {
852
+ fs.rmSync(agentDest, { recursive: true, force: true });
853
+ log(` ${c('green','✔')} ${bold('.agent/')} has been removed from this project.`);
854
+ console.log();
855
+ log(` ${c('gray','▸')} To reinstall: ${c('cyan','npx tribunal-kit init')}`);
856
+ console.log();
857
+ } catch (e) {
858
+ err(`Failed to remove .agent/: ${e.message}`);
859
+ process.exit(1);
860
+ }
861
+ }
862
+
632
863
  function cmdStatus(flags) {
633
864
  const targetDir = flags.path ? path.resolve(flags.path) : process.cwd();
634
865
  const agentDest = path.join(targetDir, '.agent');
@@ -667,41 +898,49 @@ function cmdHelp() {
667
898
 
668
899
  log(bold(' Commands'));
669
900
  log(` ${c('gray','─'.repeat(40))}`);
670
- log(cmd('init', 'Install .agent/ into current project'));
671
- log(cmd('update', 'Re-install to get latest version'));
672
- log(cmd('status', 'Check if .agent/ is installed'));
673
- log(cmd('learn', 'Evolve project idioms based on git diffs'));
674
- log(cmd('case', 'Manage Case Law precedents (add, search, list, show, stats, overrule)'));
675
- log(cmd('hook', 'Install pre-push git hook for auto-learning'));
901
+ log(cmd('init', 'Install .agent/ into current project'));
902
+ log(cmd('update', 'Re-install to get latest version'));
903
+ log(cmd('status', 'Check if .agent/ is installed'));
904
+ log(cmd('learn', 'Evolve project idioms based on git diffs'));
905
+ log(cmd('case', 'Manage Case Law precedents (add, search, list, show, stats, overrule)'));
906
+ log(cmd('hook', 'Install pre-push git hook for auto-learning'));
907
+ log(cmd('uninstall','Remove .agent/ folder from project'));
676
908
  console.log();
677
909
  log(bold(' Options'));
678
910
  log(` ${c('gray','─'.repeat(40))}`);
679
911
  log(opt('--force', 'Overwrite existing .agent/ folder'));
680
912
  log(opt('--path <dir>', 'Install in specific directory'));
681
913
  log(opt('--quiet', 'Suppress all output'));
914
+ log(opt('--verbose', 'Show detailed debug logging'));
682
915
  log(opt('--dry-run', 'Preview actions without executing'));
916
+ log(opt('--minimal', 'Install core agents/skills only (~13 agents)'));
683
917
  log(opt('--skip-update-check', 'Skip auto-update version check'));
684
918
  log(opt('--head', '(learn) Diff against last commit instead of staged'));
685
919
  console.log();
920
+ log(bold(' Aliases'));
921
+ log(` ${c('gray','─'.repeat(40))}`);
922
+ log(` ${c('cyan', 'tk')} ${c('gray', 'Shorthand for tribunal-kit (e.g., tk init, tk status)')}`);
923
+ console.log();
686
924
  log(bold(' Examples'));
687
925
  log(` ${c('gray','─'.repeat(40))}`);
688
926
  log(ex('npx tribunal-kit init'));
689
- log(ex('npx tribunal-kit init --force'));
690
- log(ex('npx tribunal-kit init --path ./my-app'));
927
+ log(ex('tk init --force'));
928
+ log(ex('tk init --path ./my-app'));
691
929
  log(ex('npx tribunal-kit init --dry-run'));
692
- log(ex('npx tribunal-kit update'));
693
- log(ex('npx tribunal-kit status'));
694
- log(ex('npx tribunal-kit learn'));
695
- log(ex('npx tribunal-kit learn --dry-run'));
696
- log(ex('npx tribunal-kit learn --head'));
697
- log(ex('npx tribunal-kit case add'));
698
- log(ex('npx tribunal-kit case search "useEffect"'));
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'));
704
- log(ex('npx tribunal-kit hook'));
930
+ log(ex('tk update'));
931
+ log(ex('tk status'));
932
+ log(ex('tk learn'));
933
+ log(ex('tk learn --dry-run'));
934
+ log(ex('tk learn --head'));
935
+ log(ex('tk case add'));
936
+ log(ex('tk case search "useEffect"'));
937
+ log(ex('tk case list'));
938
+ log(ex('tk case show --id 1'));
939
+ log(ex('tk case stats'));
940
+ log(ex('tk case export'));
941
+ log(ex('tk case overrule --id 1'));
942
+ log(ex('tk hook'));
943
+ log(ex('tk uninstall'));
705
944
  console.log();
706
945
  }
707
946
 
@@ -709,10 +948,11 @@ function cmdHelp() {
709
948
  const { command, flags } = parseArgs(process.argv);
710
949
 
711
950
  if (flags.quiet) quiet = true;
951
+ if (flags.verbose) verbose = true;
712
952
 
713
953
  runWithUpdateCheck(command, flags);
714
954
 
715
955
  // -- Exports (for testing) -- do not remove
716
956
  if (require.main !== module) {
717
- module.exports = { parseArgs, compareSemver, copyDir, countDir, isSelfInstall };
957
+ module.exports = { parseArgs, compareSemver, copyDir, countDir, isSelfInstall, CORE_AGENTS, CORE_SKILLS, generateIDEBridges };
718
958
  }