tribunal-kit 3.1.0 → 4.0.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 (57) hide show
  1. package/.agent/agents/precedence-reviewer.md +213 -0
  2. package/.agent/scripts/append_flow.js +72 -0
  3. package/.agent/scripts/case_law_manager.py +525 -0
  4. package/.agent/scripts/skill_evolution.py +563 -0
  5. package/.agent/skills/agent-organizer/SKILL.md +8 -0
  6. package/.agent/skills/ai-prompt-injection-defense/SKILL.md +8 -0
  7. package/.agent/skills/app-builder/SKILL.md +8 -0
  8. package/.agent/skills/appflow-wireframe/SKILL.md +8 -0
  9. package/.agent/skills/architecture/SKILL.md +169 -161
  10. package/.agent/skills/bash-linux/SKILL.md +9 -0
  11. package/.agent/skills/brainstorming/SKILL.md +8 -0
  12. package/.agent/skills/building-native-ui/SKILL.md +9 -0
  13. package/.agent/skills/clean-code/SKILL.md +8 -0
  14. package/.agent/skills/config-validator/SKILL.md +8 -0
  15. package/.agent/skills/deployment-procedures/SKILL.md +8 -0
  16. package/.agent/skills/devops-incident-responder/SKILL.md +8 -0
  17. package/.agent/skills/documentation-templates/SKILL.md +8 -0
  18. package/.agent/skills/edge-computing/SKILL.md +8 -0
  19. package/.agent/skills/extract-design-system/SKILL.md +8 -0
  20. package/.agent/skills/game-design-expert/SKILL.md +8 -0
  21. package/.agent/skills/game-engineering-expert/SKILL.md +8 -0
  22. package/.agent/skills/geo-fundamentals/SKILL.md +8 -0
  23. package/.agent/skills/i18n-localization/SKILL.md +9 -0
  24. package/.agent/skills/intelligent-routing/SKILL.md +8 -0
  25. package/.agent/skills/lint-and-validate/SKILL.md +8 -0
  26. package/.agent/skills/local-first/SKILL.md +8 -0
  27. package/.agent/skills/mcp-builder/SKILL.md +8 -0
  28. package/.agent/skills/parallel-agents/SKILL.md +8 -0
  29. package/.agent/skills/plan-writing/SKILL.md +8 -0
  30. package/.agent/skills/platform-engineer/SKILL.md +8 -0
  31. package/.agent/skills/playwright-best-practices/SKILL.md +9 -0
  32. package/.agent/skills/project-idioms/SKILL.md +87 -0
  33. package/.agent/skills/python-patterns/SKILL.md +8 -0
  34. package/.agent/skills/readme-builder/SKILL.md +8 -0
  35. package/.agent/skills/red-team-tactics/SKILL.md +8 -0
  36. package/.agent/skills/seo-fundamentals/SKILL.md +9 -0
  37. package/.agent/skills/server-management/SKILL.md +8 -0
  38. package/.agent/skills/shadcn-ui-expert/SKILL.md +9 -0
  39. package/.agent/skills/skill-creator/SKILL.md +8 -0
  40. package/.agent/skills/supabase-postgres-best-practices/SKILL.md +9 -0
  41. package/.agent/skills/swiftui-expert/SKILL.md +9 -0
  42. package/.agent/skills/systematic-debugging/SKILL.md +8 -0
  43. package/.agent/skills/tdd-workflow/SKILL.md +8 -0
  44. package/.agent/skills/ui-ux-pro-max/SKILL.md +8 -0
  45. package/.agent/skills/web-accessibility-auditor/SKILL.md +9 -0
  46. package/.agent/skills/web-design-guidelines/SKILL.md +8 -0
  47. package/.agent/skills/webapp-testing/SKILL.md +8 -0
  48. package/.agent/workflows/generate.md +1 -0
  49. package/.agent/workflows/tribunal-backend.md +2 -1
  50. package/.agent/workflows/tribunal-database.md +2 -1
  51. package/.agent/workflows/tribunal-frontend.md +2 -1
  52. package/.agent/workflows/tribunal-full.md +1 -0
  53. package/.agent/workflows/tribunal-mobile.md +2 -1
  54. package/.agent/workflows/tribunal-performance.md +2 -1
  55. package/README.md +30 -1
  56. package/bin/tribunal-kit.js +175 -12
  57. package/package.json +25 -4
@@ -270,17 +270,30 @@ function banner() {
270
270
  if (quiet) return;
271
271
  // Big ASCII art (TRIBUNAL-KIT)
272
272
  const art = String.raw`
273
- ___________ ._____. .__ ____ __.__ __
274
- \__ ___/______|__\_ |__ __ __ ____ _____ | | | |/ _|__|/ |_
275
- | | \_ __ \ || __ \| | \/ \\__ \ | | ______ | < | \ __\
276
- | | | | \/ || \_\ \ | / | \/ __ \| |__ /_____/ | | \| || |
277
- |____| |__| |__||___ /____/|___| (____ /____/ |____|__ \__||__|
278
- \/ \/ \/ \/ `.split('\n').filter(Boolean);
273
+ ████████╗██████╗ ██╗██████╗ ██╗ ██╗███╗ ██╗ █████╗ ██╗ ██╗ ██╗██╗████████╗
274
+ ╚══██╔══╝██╔══██╗██║██╔══██╗██║ ██║████╗ ██║██╔══██╗██║ ██║ ██╔╝██║╚══██╔══╝
275
+ ██║ ██████╔╝██║██████╔╝██║ ██║██╔██╗ ██║███████║██║█████╗█████╔╝ ██║ ██║
276
+ ██║ ██╔══██╗██║██╔══██╗██║ ██║██║╚██╗██║██╔══██║██║╚════╝██╔═██╗ ██║ ██║
277
+ ██║ ██║ ██║██║██████╔╝╚██████╔╝██║ ╚████║██║ ██║███████╗ ██║ ██╗██║ ██║
278
+ ╚═╝ ╚═╝ ╚═╝╚═╝╚═════╝ ╚═════╝ ╚═╝ ╚═══╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ `.split('\n').filter(Boolean);
279
279
  console.log();
280
- for (const line of art) log(` ${c('cyan', bold(line))}`);
280
+ const maxLen = Math.max(...art.map(line => line.length));
281
+ for (const line of art) {
282
+ let gradientLine = ' ' + C.bold;
283
+ for (let i = 0; i < line.length; i++) {
284
+ const p = maxLen > 1 ? i / (maxLen - 1) : 0;
285
+ // Coquelicot #FF4000 to Penn Blue #0A1045
286
+ const r = Math.round(255 + p * (10 - 255));
287
+ const g = Math.round(64 + p * (16 - 64));
288
+ const b = Math.round(0 + p * (69 - 0));
289
+ gradientLine += `\x1b[38;2;${r};${g};${b}m${line[i]}`;
290
+ }
291
+ gradientLine += C.reset;
292
+ log(gradientLine);
293
+ }
281
294
  console.log();
282
295
  // Subtitle strip
283
- const W = 80;
296
+ const W = 84;
284
297
  const sub = 'Anti-Hallucination Agent System';
285
298
  const sp = Math.max(0, W - sub.length);
286
299
  const centred = ' '.repeat(Math.floor(sp / 2)) + sub + ' '.repeat(Math.ceil(sp / 2));
@@ -344,6 +357,18 @@ function cmdInit(flags) {
344
357
  }
345
358
  }
346
359
 
360
+ // Ensure history dirs exist (Case Law + Skill Evolution)
361
+ if (!dryRun) {
362
+ const caseDir = path.join(agentDest, 'history', 'case-law', 'cases');
363
+ const evoDir = path.join(agentDest, 'history', 'skill-evolution');
364
+ fs.mkdirSync(caseDir, { recursive: true });
365
+ fs.mkdirSync(evoDir, { recursive: true });
366
+ const gkCase = path.join(caseDir, '.gitkeep');
367
+ const gkEvo = path.join(evoDir, '.gitkeep');
368
+ if (!fs.existsSync(gkCase)) fs.writeFileSync(gkCase, '');
369
+ if (!fs.existsSync(gkEvo)) fs.writeFileSync(gkEvo, '');
370
+ }
371
+
347
372
  // Count what we're installing
348
373
  const totalFiles = countDir(agentSrc);
349
374
  log(` ${c('gray','▸')} Scanning ${c('white', String(totalFiles))} files ${c('gray','→')} ${c('gray', agentDest)}`);
@@ -436,6 +461,60 @@ function cmdUpdate(flags) {
436
461
  cmdInit(flags);
437
462
  }
438
463
 
464
+
465
+ function cmdLearn(flags) {
466
+ const targetDir = flags.path ? path.resolve(flags.path) : process.cwd();
467
+ const agentDest = path.join(targetDir, '.agent');
468
+
469
+ if (!fs.existsSync(agentDest)) {
470
+ err('.agent/ not found. Run: npx tribunal-kit init');
471
+ process.exit(1);
472
+ }
473
+
474
+ banner();
475
+
476
+ const W = 62;
477
+ const title = ' Tribunal Learn — Supreme Court Mode';
478
+ const trail = ' '.repeat(Math.max(0, W - title.length));
479
+ console.log(` ${c('cyan', '\u2554' + '\u2550'.repeat(W) + '\u2557')}`);
480
+ console.log(` ${c('cyan', '\u2551')}${c('bold', c('white', title))}${trail}${c('cyan', '\u2551')}`);
481
+ console.log(` ${c('cyan', '\u255a' + '\u2550'.repeat(W) + '\u255d')}`);
482
+ console.log();
483
+
484
+ const dryRun = flags.dryRun ? '--dry-run' : '';
485
+ const useHead = flags.head ? '--head' : '';
486
+ const python = process.platform === 'win32' ? 'python' : 'python3';
487
+ const { execSync } = require('child_process');
488
+
489
+ // Phase 1: Skill Evolution
490
+ log(` ${c('cyan', '\u229b')} ${bold('Phase 1')} \u2014 Skill Evolution Forge (auto-generating project idioms)`);
491
+ const evoScript = path.join(agentDest, 'scripts', 'skill_evolution.py');
492
+ if (!fs.existsSync(evoScript)) {
493
+ warn('skill_evolution.py not found \u2014 run: npx tribunal-kit update');
494
+ } else {
495
+ try {
496
+ const cmd = `${python} "${evoScript}" digest ${dryRun} ${useHead}`.trim();
497
+ execSync(cmd, { stdio: 'inherit', cwd: targetDir });
498
+ } catch (e) {
499
+ warn(`Skill Evolution error: ${e.message}`);
500
+ }
501
+ }
502
+
503
+ console.log();
504
+
505
+ // Phase 2: Case Law prompt
506
+ log(` ${c('cyan', '\u229b')} ${bold('Phase 2')} \u2014 Case Law Engine (building precedence record)`);
507
+ console.log();
508
+ log(` ${c('gray','\u25b8')} Record a new rejection precedent:`);
509
+ log(` ${c('white', 'npx tribunal-kit case add')}`);
510
+ console.log();
511
+ log(` ${c('gray','\u25b8')} Search existing case law:`);
512
+ log(` ${c('white', 'npx tribunal-kit case search "your query"')}`);
513
+ console.log();
514
+ log(` ${c('green', '\u2714')} ${bold('Learn cycle complete.')} Your Tribunal grows smarter with every commit.`);
515
+ console.log();
516
+ }
517
+
439
518
  // ── Async Main Wrapper ───────────────────────────────────
440
519
  async function runWithUpdateCheck(command, flags) {
441
520
  const shouldSkip = flags.skipUpdateCheck || process.env.TK_SKIP_UPDATE_CHECK === '1';
@@ -460,6 +539,15 @@ async function runWithUpdateCheck(command, flags) {
460
539
  case 'status':
461
540
  cmdStatus(flags);
462
541
  break;
542
+ case 'learn':
543
+ cmdLearn(flags);
544
+ break;
545
+ case 'case':
546
+ cmdCase(flags);
547
+ break;
548
+ case 'hook':
549
+ cmdHook(flags);
550
+ break;
463
551
  case 'help':
464
552
  case '--help':
465
553
  case '-h':
@@ -474,6 +562,70 @@ async function runWithUpdateCheck(command, flags) {
474
562
  }
475
563
  }
476
564
 
565
+ function cmdCase(flags) {
566
+ const targetDir = flags.path ? path.resolve(flags.path) : process.cwd();
567
+ const agentDest = path.join(targetDir, '.agent');
568
+
569
+ if (!fs.existsSync(agentDest)) {
570
+ err('.agent/ not found. Run: npx tribunal-kit init');
571
+ process.exit(1);
572
+ }
573
+
574
+ const args = process.argv.slice(3).join(' ');
575
+ if (!args || args === 'help' || args === '--help' || args === '-h') {
576
+ banner();
577
+ log(` ${c('cyan', '\u2554' + '\u2550'.repeat(60) + '\u2557')}`);
578
+ log(` ${c('cyan', '\u2551')}${c('bold', c('white', ' Tribunal Case Law Engine \u2014 Supreme Court '))}${c('cyan', '\u2551')}`);
579
+ log(` ${c('cyan', '\u255a' + '\u2550'.repeat(60) + '\u255d')}`);
580
+ console.log();
581
+ log(` ${c('cyan', 'add'.padEnd(10))} ${c('gray', 'Record a new Case Law rejection pattern')}`);
582
+ log(` ${c('cyan', 'search'.padEnd(10))} ${c('gray', 'Search existing cases (e.g., search "query")')}`);
583
+ log(` ${c('cyan', 'list'.padEnd(10))} ${c('gray', 'List all recorded case law')}`);
584
+ console.log();
585
+ process.exit(1);
586
+ }
587
+
588
+ const python = process.platform === 'win32' ? 'python' : 'python3';
589
+ const caseLawScript = path.join(agentDest, 'scripts', 'case_law_manager.py');
590
+
591
+ // Make shorthand aliases
592
+ let pyArgs = args;
593
+ if (pyArgs.startsWith('add')) pyArgs = pyArgs.replace(/^add/, 'add-case');
594
+ if (pyArgs.startsWith('search')) pyArgs = pyArgs.replace(/^search/, 'search-cases');
595
+
596
+ try {
597
+ const { execSync } = require('child_process');
598
+ execSync(`${python} "${caseLawScript}" ${pyArgs}`, { stdio: 'inherit', cwd: targetDir });
599
+ } catch (e) {
600
+ process.exit(1); // Script already prints errors
601
+ }
602
+ }
603
+
604
+ function cmdHook(flags) {
605
+ const targetDir = flags.path ? path.resolve(flags.path) : process.cwd();
606
+ const gitDir = path.join(targetDir, '.git');
607
+
608
+ if (!fs.existsSync(gitDir)) {
609
+ err('Not a git repository. Cannot install git hooks here.');
610
+ process.exit(1);
611
+ }
612
+
613
+ const hooksDir = path.join(gitDir, 'hooks');
614
+ if (!fs.existsSync(hooksDir)) {
615
+ fs.mkdirSync(hooksDir, { recursive: true });
616
+ }
617
+
618
+ const prePushPath = path.join(hooksDir, 'pre-push');
619
+ const hookScript = `#!/bin/sh\n# Supreme Court - Auto Learn on Push\necho "⚖️ Tribunal Supreme Court: Evolving Skills..."\nnpx tribunal-kit learn --head\n`;
620
+
621
+ fs.writeFileSync(prePushPath, hookScript, { mode: 0o755 });
622
+
623
+ console.log();
624
+ log(` ${c('green', '✔')} Installed pre-push git hook.`);
625
+ log(` ${c('gray', '▸')} Skill Evolution will now run automatically every time you git push.`);
626
+ console.log();
627
+ }
628
+
477
629
  function cmdStatus(flags) {
478
630
  const targetDir = flags.path ? path.resolve(flags.path) : process.cwd();
479
631
  const agentDest = path.join(targetDir, '.agent');
@@ -515,6 +667,9 @@ function cmdHelp() {
515
667
  log(cmd('init', 'Install .agent/ into current project'));
516
668
  log(cmd('update', 'Re-install to get latest version'));
517
669
  log(cmd('status', 'Check if .agent/ is installed'));
670
+ log(cmd('learn', 'Evolve project idioms based on git diffs'));
671
+ log(cmd('case', 'Manage Case Law precedents (add, search, list)'));
672
+ log(cmd('hook', 'Install pre-push git hook for auto-learning'));
518
673
  console.log();
519
674
  log(bold(' Options'));
520
675
  log(` ${c('gray','─'.repeat(40))}`);
@@ -523,6 +678,7 @@ function cmdHelp() {
523
678
  log(opt('--quiet', 'Suppress all output'));
524
679
  log(opt('--dry-run', 'Preview actions without executing'));
525
680
  log(opt('--skip-update-check', 'Skip auto-update version check'));
681
+ log(opt('--head', '(learn) Diff against last commit instead of staged'));
526
682
  console.log();
527
683
  log(bold(' Examples'));
528
684
  log(` ${c('gray','─'.repeat(40))}`);
@@ -532,6 +688,13 @@ function cmdHelp() {
532
688
  log(ex('npx tribunal-kit init --dry-run'));
533
689
  log(ex('npx tribunal-kit update'));
534
690
  log(ex('npx tribunal-kit status'));
691
+ log(ex('npx tribunal-kit learn'));
692
+ log(ex('npx tribunal-kit learn --dry-run'));
693
+ log(ex('npx tribunal-kit learn --head'));
694
+ log(ex('npx tribunal-kit case add'));
695
+ log(ex('npx tribunal-kit case search "useEffect"'));
696
+ log(ex('npx tribunal-kit case list'));
697
+ log(ex('npx tribunal-kit hook'));
535
698
  console.log();
536
699
  }
537
700
 
@@ -541,8 +704,8 @@ const { command, flags } = parseArgs(process.argv);
541
704
  if (flags.quiet) quiet = true;
542
705
 
543
706
  runWithUpdateCheck(command, flags);
544
-
545
- // -- Exports (for testing) -- do not remove
546
- if (require.main !== module) {
547
- module.exports = { parseArgs, compareSemver, copyDir, countDir, isSelfInstall };
707
+
708
+ // -- Exports (for testing) -- do not remove
709
+ if (require.main !== module) {
710
+ module.exports = { parseArgs, compareSemver, copyDir, countDir, isSelfInstall };
548
711
  }
package/package.json CHANGED
@@ -1,17 +1,38 @@
1
1
  {
2
2
  "name": "tribunal-kit",
3
- "version": "3.1.0",
4
- "description": "Anti-Hallucination AI Agent Kit — 33 specialist agents, 25 slash commands, Swarm/Supervisor engine, and Tribunal review pipeline for Cursor, Windsurf, and Antigravity.",
3
+ "version": "4.0.0",
4
+ "description": "Anti-Hallucination AI Agent Kit — 34 specialist agents, 26 slash commands, Swarm/Supervisor engine, and Supreme Court Tribunal review pipeline.",
5
5
  "keywords": [
6
6
  "ai",
7
+ "ai-agent",
7
8
  "agent",
9
+ "agents",
10
+ "multi-agent",
11
+ "agentic",
12
+ "swarm",
13
+ "orchestration",
14
+ "llm",
15
+ "anti-hallucination",
8
16
  "hallucination",
17
+ "code-review",
18
+ "code-quality",
9
19
  "cursor",
20
+ "cursor-rules",
21
+ "cursorrules",
10
22
  "windsurf",
23
+ "copilot",
24
+ "cline",
25
+ "gemini",
11
26
  "antigravity",
12
27
  "tribunal",
13
- "code-review",
14
- "llm"
28
+ "mcp",
29
+ "model-context-protocol",
30
+ "cli",
31
+ "devtools",
32
+ "ai-coding",
33
+ "autonomous-agents",
34
+ "coding-assistant",
35
+ "automation"
15
36
  ],
16
37
  "homepage": "https://github.com/Harmitx7/tribunal-kit",
17
38
  "repository": {