tribunal-kit 3.1.0 → 4.0.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 (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 +182 -20
  57. package/package.json +28 -4
@@ -142,16 +142,16 @@ function compareSemver(a, b) {
142
142
  }
143
143
 
144
144
  /**
145
- * Fetch the latest version from GitHub Releases.
146
- * Returns the version string (e.g. '2.4.0') or null on failure.
145
+ * Fetch the latest version from npm registry.
146
+ * Returns the version string (e.g. '4.0.0') or null on failure.
147
147
  */
148
148
  function fetchLatestVersion() {
149
149
  return new Promise((resolve) => {
150
150
  const req = https.get(
151
- 'https://api.github.com/repos/Harmitx7/tribunal-kit/releases/latest',
151
+ 'https://registry.npmjs.org/tribunal-kit/latest',
152
152
  {
153
153
  headers: {
154
- 'Accept': 'application/vnd.github.v3+json',
154
+ 'Accept': 'application/json',
155
155
  'User-Agent': `tribunal-kit/${CURRENT_VERSION}`
156
156
  },
157
157
  timeout: 5000
@@ -162,8 +162,7 @@ function fetchLatestVersion() {
162
162
  res.on('end', () => {
163
163
  try {
164
164
  const json = JSON.parse(data);
165
- // GitHub tags usually have a 'v' prefix (e.g., 'v2.4.0')
166
- const version = json.tag_name ? json.tag_name.replace(/^v/, '') : null;
165
+ const version = json.version || null;
167
166
  resolve(version);
168
167
  } catch {
169
168
  resolve(null);
@@ -207,9 +206,9 @@ async function autoUpdateCheck(originalArgs) {
207
206
  log('');
208
207
 
209
208
  try {
210
- // Build the command pulling directly from GitHub
209
+ // Build the command pulling from npm registry
211
210
  const args = originalArgs.join(' ');
212
- const cmd = `npx -y github:Harmitx7/tribunal-kit#v${latestVersion} ${args}`;
211
+ const cmd = `npx -y tribunal-kit@${latestVersion} ${args}`;
213
212
 
214
213
  execSync(cmd, {
215
214
  stdio: 'inherit',
@@ -270,17 +269,30 @@ function banner() {
270
269
  if (quiet) return;
271
270
  // Big ASCII art (TRIBUNAL-KIT)
272
271
  const art = String.raw`
273
- ___________ ._____. .__ ____ __.__ __
274
- \__ ___/______|__\_ |__ __ __ ____ _____ | | | |/ _|__|/ |_
275
- | | \_ __ \ || __ \| | \/ \\__ \ | | ______ | < | \ __\
276
- | | | | \/ || \_\ \ | / | \/ __ \| |__ /_____/ | | \| || |
277
- |____| |__| |__||___ /____/|___| (____ /____/ |____|__ \__||__|
278
- \/ \/ \/ \/ `.split('\n').filter(Boolean);
272
+ ████████╗██████╗ ██╗██████╗ ██╗ ██╗███╗ ██╗ █████╗ ██╗ ██╗ ██╗██╗████████╗
273
+ ╚══██╔══╝██╔══██╗██║██╔══██╗██║ ██║████╗ ██║██╔══██╗██║ ██║ ██╔╝██║╚══██╔══╝
274
+ ██║ ██████╔╝██║██████╔╝██║ ██║██╔██╗ ██║███████║██║█████╗█████╔╝ ██║ ██║
275
+ ██║ ██╔══██╗██║██╔══██╗██║ ██║██║╚██╗██║██╔══██║██║╚════╝██╔═██╗ ██║ ██║
276
+ ██║ ██║ ██║██║██████╔╝╚██████╔╝██║ ╚████║██║ ██║███████╗ ██║ ██╗██║ ██║
277
+ ╚═╝ ╚═╝ ╚═╝╚═╝╚═════╝ ╚═════╝ ╚═╝ ╚═══╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ `.split('\n').filter(Boolean);
279
278
  console.log();
280
- for (const line of art) log(` ${c('cyan', bold(line))}`);
279
+ const maxLen = Math.max(...art.map(line => line.length));
280
+ for (const line of art) {
281
+ let gradientLine = ' ' + C.bold;
282
+ for (let i = 0; i < line.length; i++) {
283
+ 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));
288
+ gradientLine += `\x1b[38;2;${r};${g};${b}m${line[i]}`;
289
+ }
290
+ gradientLine += C.reset;
291
+ log(gradientLine);
292
+ }
281
293
  console.log();
282
294
  // Subtitle strip
283
- const W = 80;
295
+ const W = 84;
284
296
  const sub = 'Anti-Hallucination Agent System';
285
297
  const sp = Math.max(0, W - sub.length);
286
298
  const centred = ' '.repeat(Math.floor(sp / 2)) + sub + ' '.repeat(Math.ceil(sp / 2));
@@ -344,6 +356,18 @@ function cmdInit(flags) {
344
356
  }
345
357
  }
346
358
 
359
+ // Ensure history dirs exist (Case Law + Skill Evolution)
360
+ if (!dryRun) {
361
+ const caseDir = path.join(agentDest, 'history', 'case-law', 'cases');
362
+ const evoDir = path.join(agentDest, 'history', 'skill-evolution');
363
+ fs.mkdirSync(caseDir, { recursive: true });
364
+ fs.mkdirSync(evoDir, { recursive: true });
365
+ const gkCase = path.join(caseDir, '.gitkeep');
366
+ const gkEvo = path.join(evoDir, '.gitkeep');
367
+ if (!fs.existsSync(gkCase)) fs.writeFileSync(gkCase, '');
368
+ if (!fs.existsSync(gkEvo)) fs.writeFileSync(gkEvo, '');
369
+ }
370
+
347
371
  // Count what we're installing
348
372
  const totalFiles = countDir(agentSrc);
349
373
  log(` ${c('gray','▸')} Scanning ${c('white', String(totalFiles))} files ${c('gray','→')} ${c('gray', agentDest)}`);
@@ -436,6 +460,60 @@ function cmdUpdate(flags) {
436
460
  cmdInit(flags);
437
461
  }
438
462
 
463
+
464
+ function cmdLearn(flags) {
465
+ const targetDir = flags.path ? path.resolve(flags.path) : process.cwd();
466
+ const agentDest = path.join(targetDir, '.agent');
467
+
468
+ if (!fs.existsSync(agentDest)) {
469
+ err('.agent/ not found. Run: npx tribunal-kit init');
470
+ process.exit(1);
471
+ }
472
+
473
+ banner();
474
+
475
+ const W = 62;
476
+ const title = ' Tribunal Learn — Supreme Court Mode';
477
+ const trail = ' '.repeat(Math.max(0, W - title.length));
478
+ console.log(` ${c('cyan', '\u2554' + '\u2550'.repeat(W) + '\u2557')}`);
479
+ console.log(` ${c('cyan', '\u2551')}${c('bold', c('white', title))}${trail}${c('cyan', '\u2551')}`);
480
+ console.log(` ${c('cyan', '\u255a' + '\u2550'.repeat(W) + '\u255d')}`);
481
+ console.log();
482
+
483
+ const dryRun = flags.dryRun ? '--dry-run' : '';
484
+ const useHead = flags.head ? '--head' : '';
485
+ const python = process.platform === 'win32' ? 'python' : 'python3';
486
+ const { execSync } = require('child_process');
487
+
488
+ // Phase 1: Skill Evolution
489
+ 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');
491
+ if (!fs.existsSync(evoScript)) {
492
+ warn('skill_evolution.py not found \u2014 run: npx tribunal-kit update');
493
+ } else {
494
+ try {
495
+ const cmd = `${python} "${evoScript}" digest ${dryRun} ${useHead}`.trim();
496
+ execSync(cmd, { stdio: 'inherit', cwd: targetDir });
497
+ } catch (e) {
498
+ warn(`Skill Evolution error: ${e.message}`);
499
+ }
500
+ }
501
+
502
+ console.log();
503
+
504
+ // Phase 2: Case Law prompt
505
+ log(` ${c('cyan', '\u229b')} ${bold('Phase 2')} \u2014 Case Law Engine (building precedence record)`);
506
+ console.log();
507
+ log(` ${c('gray','\u25b8')} Record a new rejection precedent:`);
508
+ log(` ${c('white', 'npx tribunal-kit case add')}`);
509
+ console.log();
510
+ log(` ${c('gray','\u25b8')} Search existing case law:`);
511
+ log(` ${c('white', 'npx tribunal-kit case search "your query"')}`);
512
+ console.log();
513
+ log(` ${c('green', '\u2714')} ${bold('Learn cycle complete.')} Your Tribunal grows smarter with every commit.`);
514
+ console.log();
515
+ }
516
+
439
517
  // ── Async Main Wrapper ───────────────────────────────────
440
518
  async function runWithUpdateCheck(command, flags) {
441
519
  const shouldSkip = flags.skipUpdateCheck || process.env.TK_SKIP_UPDATE_CHECK === '1';
@@ -460,6 +538,15 @@ async function runWithUpdateCheck(command, flags) {
460
538
  case 'status':
461
539
  cmdStatus(flags);
462
540
  break;
541
+ case 'learn':
542
+ cmdLearn(flags);
543
+ break;
544
+ case 'case':
545
+ cmdCase(flags);
546
+ break;
547
+ case 'hook':
548
+ cmdHook(flags);
549
+ break;
463
550
  case 'help':
464
551
  case '--help':
465
552
  case '-h':
@@ -474,6 +561,70 @@ async function runWithUpdateCheck(command, flags) {
474
561
  }
475
562
  }
476
563
 
564
+ function cmdCase(flags) {
565
+ const targetDir = flags.path ? path.resolve(flags.path) : process.cwd();
566
+ const agentDest = path.join(targetDir, '.agent');
567
+
568
+ if (!fs.existsSync(agentDest)) {
569
+ err('.agent/ not found. Run: npx tribunal-kit init');
570
+ process.exit(1);
571
+ }
572
+
573
+ const args = process.argv.slice(3).join(' ');
574
+ if (!args || args === 'help' || args === '--help' || args === '-h') {
575
+ banner();
576
+ log(` ${c('cyan', '\u2554' + '\u2550'.repeat(60) + '\u2557')}`);
577
+ log(` ${c('cyan', '\u2551')}${c('bold', c('white', ' Tribunal Case Law Engine \u2014 Supreme Court '))}${c('cyan', '\u2551')}`);
578
+ log(` ${c('cyan', '\u255a' + '\u2550'.repeat(60) + '\u255d')}`);
579
+ console.log();
580
+ log(` ${c('cyan', 'add'.padEnd(10))} ${c('gray', 'Record a new Case Law rejection pattern')}`);
581
+ log(` ${c('cyan', 'search'.padEnd(10))} ${c('gray', 'Search existing cases (e.g., search "query")')}`);
582
+ log(` ${c('cyan', 'list'.padEnd(10))} ${c('gray', 'List all recorded case law')}`);
583
+ console.log();
584
+ process.exit(1);
585
+ }
586
+
587
+ const python = process.platform === 'win32' ? 'python' : 'python3';
588
+ const caseLawScript = path.join(agentDest, 'scripts', 'case_law_manager.py');
589
+
590
+ // Make shorthand aliases
591
+ let pyArgs = args;
592
+ if (pyArgs.startsWith('add')) pyArgs = pyArgs.replace(/^add/, 'add-case');
593
+ if (pyArgs.startsWith('search')) pyArgs = pyArgs.replace(/^search/, 'search-cases');
594
+
595
+ try {
596
+ const { execSync } = require('child_process');
597
+ execSync(`${python} "${caseLawScript}" ${pyArgs}`, { stdio: 'inherit', cwd: targetDir });
598
+ } catch (e) {
599
+ process.exit(1); // Script already prints errors
600
+ }
601
+ }
602
+
603
+ function cmdHook(flags) {
604
+ const targetDir = flags.path ? path.resolve(flags.path) : process.cwd();
605
+ const gitDir = path.join(targetDir, '.git');
606
+
607
+ if (!fs.existsSync(gitDir)) {
608
+ err('Not a git repository. Cannot install git hooks here.');
609
+ process.exit(1);
610
+ }
611
+
612
+ const hooksDir = path.join(gitDir, 'hooks');
613
+ if (!fs.existsSync(hooksDir)) {
614
+ fs.mkdirSync(hooksDir, { recursive: true });
615
+ }
616
+
617
+ const prePushPath = path.join(hooksDir, 'pre-push');
618
+ const hookScript = `#!/bin/sh\n# Supreme Court - Auto Learn on Push\necho "⚖️ Tribunal Supreme Court: Evolving Skills..."\nnpx tribunal-kit learn --head\n`;
619
+
620
+ fs.writeFileSync(prePushPath, hookScript, { mode: 0o755 });
621
+
622
+ console.log();
623
+ log(` ${c('green', '✔')} Installed pre-push git hook.`);
624
+ log(` ${c('gray', '▸')} Skill Evolution will now run automatically every time you git push.`);
625
+ console.log();
626
+ }
627
+
477
628
  function cmdStatus(flags) {
478
629
  const targetDir = flags.path ? path.resolve(flags.path) : process.cwd();
479
630
  const agentDest = path.join(targetDir, '.agent');
@@ -515,6 +666,9 @@ function cmdHelp() {
515
666
  log(cmd('init', 'Install .agent/ into current project'));
516
667
  log(cmd('update', 'Re-install to get latest version'));
517
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'));
518
672
  console.log();
519
673
  log(bold(' Options'));
520
674
  log(` ${c('gray','─'.repeat(40))}`);
@@ -523,6 +677,7 @@ function cmdHelp() {
523
677
  log(opt('--quiet', 'Suppress all output'));
524
678
  log(opt('--dry-run', 'Preview actions without executing'));
525
679
  log(opt('--skip-update-check', 'Skip auto-update version check'));
680
+ log(opt('--head', '(learn) Diff against last commit instead of staged'));
526
681
  console.log();
527
682
  log(bold(' Examples'));
528
683
  log(` ${c('gray','─'.repeat(40))}`);
@@ -532,6 +687,13 @@ function cmdHelp() {
532
687
  log(ex('npx tribunal-kit init --dry-run'));
533
688
  log(ex('npx tribunal-kit update'));
534
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'));
535
697
  console.log();
536
698
  }
537
699
 
@@ -541,8 +703,8 @@ const { command, flags } = parseArgs(process.argv);
541
703
  if (flags.quiet) quiet = true;
542
704
 
543
705
  runWithUpdateCheck(command, flags);
544
-
545
- // -- Exports (for testing) -- do not remove
546
- if (require.main !== module) {
547
- module.exports = { parseArgs, compareSemver, copyDir, countDir, isSelfInstall };
706
+
707
+ // -- Exports (for testing) -- do not remove
708
+ if (require.main !== module) {
709
+ module.exports = { parseArgs, compareSemver, copyDir, countDir, isSelfInstall };
548
710
  }
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.1",
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": {
@@ -49,5 +70,8 @@
49
70
  "collectCoverageFrom": [
50
71
  "bin/**/*.js"
51
72
  ]
73
+ },
74
+ "dependencies": {
75
+ "tribunal-kit": "^4.0.0"
52
76
  }
53
77
  }