tribunal-kit 4.3.0 → 4.4.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 (120) hide show
  1. package/.agent/history/architecture-explorer.html +352 -0
  2. package/.agent/history/architecture-graph.yaml +109 -0
  3. package/.agent/history/graph-cache.json +215 -0
  4. package/.agent/history/snapshots/migrate_refs.js.json +11 -0
  5. package/.agent/history/snapshots/scripts__changelog.js.json +12 -0
  6. package/.agent/history/snapshots/scripts__sync-version.js.json +11 -0
  7. package/.agent/history/snapshots/scripts__validate-payload.js.json +11 -0
  8. package/.agent/history/snapshots/test__integration__bridges.test.js.json +13 -0
  9. package/.agent/history/snapshots/test__integration__init.test.js.json +13 -0
  10. package/.agent/history/snapshots/test__integration__routing.test.js.json +11 -0
  11. package/.agent/history/snapshots/test__integration__swarm_dispatcher.test.js.json +13 -0
  12. package/.agent/history/snapshots/test__integration__wave2.test.js.json +13 -0
  13. package/.agent/history/snapshots/test__unit__args.test.js.json +10 -0
  14. package/.agent/history/snapshots/test__unit__case_law_manager.test.js.json +10 -0
  15. package/.agent/history/snapshots/test__unit__copyDir.test.js.json +13 -0
  16. package/.agent/history/snapshots/test__unit__graph_tools.test.js.json +11 -0
  17. package/.agent/history/snapshots/test__unit__selfInstall.test.js.json +13 -0
  18. package/.agent/history/snapshots/test__unit__semver.test.js.json +10 -0
  19. package/.agent/history/snapshots/test__unit__swarm_dispatcher.test.js.json +11 -0
  20. package/.agent/scripts/case_law_manager.js +684 -684
  21. package/.agent/scripts/dependency_analyzer.js +1 -1
  22. package/.agent/scripts/graph_builder.js +311 -0
  23. package/.agent/scripts/graph_visualizer.js +384 -0
  24. package/.agent/scripts/graph_zoom.js +154 -0
  25. package/.agent/scripts/mutation_runner.js +280 -0
  26. package/.agent/skills/agent-organizer/SKILL.md +9 -1
  27. package/.agent/skills/agentic-patterns/SKILL.md +9 -1
  28. package/.agent/skills/ai-prompt-injection-defense/SKILL.md +9 -1
  29. package/.agent/skills/api-patterns/SKILL.md +206 -198
  30. package/.agent/skills/api-security-auditor/SKILL.md +9 -1
  31. package/.agent/skills/app-builder/SKILL.md +9 -1
  32. package/.agent/skills/app-builder/templates/SKILL.md +77 -69
  33. package/.agent/skills/appflow-wireframe/SKILL.md +9 -1
  34. package/.agent/skills/architecture/SKILL.md +9 -1
  35. package/.agent/skills/authentication-best-practices/SKILL.md +9 -1
  36. package/.agent/skills/bash-linux/SKILL.md +9 -1
  37. package/.agent/skills/behavioral-modes/SKILL.md +9 -1
  38. package/.agent/skills/brainstorming/SKILL.md +9 -1
  39. package/.agent/skills/building-native-ui/SKILL.md +9 -1
  40. package/.agent/skills/clean-code/SKILL.md +9 -1
  41. package/.agent/skills/code-review-checklist/SKILL.md +9 -1
  42. package/.agent/skills/config-validator/SKILL.md +9 -1
  43. package/.agent/skills/csharp-developer/SKILL.md +9 -1
  44. package/.agent/skills/data-validation-schemas/SKILL.md +287 -279
  45. package/.agent/skills/database-design/SKILL.md +199 -191
  46. package/.agent/skills/deployment-procedures/SKILL.md +9 -1
  47. package/.agent/skills/devops-engineer/SKILL.md +9 -1
  48. package/.agent/skills/devops-incident-responder/SKILL.md +9 -1
  49. package/.agent/skills/documentation-templates/SKILL.md +9 -1
  50. package/.agent/skills/edge-computing/SKILL.md +9 -1
  51. package/.agent/skills/error-resilience/SKILL.md +387 -379
  52. package/.agent/skills/extract-design-system/SKILL.md +9 -1
  53. package/.agent/skills/framer-motion-expert/SKILL.md +203 -195
  54. package/.agent/skills/frontend-design/SKILL.md +160 -152
  55. package/.agent/skills/game-design-expert/SKILL.md +9 -1
  56. package/.agent/skills/game-engineering-expert/SKILL.md +9 -1
  57. package/.agent/skills/geo-fundamentals/SKILL.md +9 -1
  58. package/.agent/skills/github-operations/SKILL.md +9 -1
  59. package/.agent/skills/gsap-core/SKILL.md +54 -46
  60. package/.agent/skills/gsap-frameworks/SKILL.md +54 -46
  61. package/.agent/skills/gsap-performance/SKILL.md +54 -46
  62. package/.agent/skills/gsap-plugins/SKILL.md +54 -46
  63. package/.agent/skills/gsap-react/SKILL.md +54 -46
  64. package/.agent/skills/gsap-scrolltrigger/SKILL.md +54 -46
  65. package/.agent/skills/gsap-timeline/SKILL.md +54 -46
  66. package/.agent/skills/gsap-utils/SKILL.md +54 -46
  67. package/.agent/skills/i18n-localization/SKILL.md +9 -1
  68. package/.agent/skills/intelligent-routing/SKILL.md +38 -30
  69. package/.agent/skills/knowledge-graph/SKILL.md +52 -0
  70. package/.agent/skills/lint-and-validate/SKILL.md +9 -1
  71. package/.agent/skills/llm-engineering/SKILL.md +9 -1
  72. package/.agent/skills/local-first/SKILL.md +9 -1
  73. package/.agent/skills/mcp-builder/SKILL.md +9 -1
  74. package/.agent/skills/mobile-design/SKILL.md +222 -214
  75. package/.agent/skills/monorepo-management/SKILL.md +293 -285
  76. package/.agent/skills/motion-engineering/SKILL.md +193 -185
  77. package/.agent/skills/nextjs-react-expert/SKILL.md +193 -185
  78. package/.agent/skills/nodejs-best-practices/SKILL.md +9 -1
  79. package/.agent/skills/observability/SKILL.md +9 -1
  80. package/.agent/skills/parallel-agents/SKILL.md +9 -1
  81. package/.agent/skills/performance-profiling/SKILL.md +9 -1
  82. package/.agent/skills/plan-writing/SKILL.md +9 -1
  83. package/.agent/skills/platform-engineer/SKILL.md +9 -1
  84. package/.agent/skills/playwright-best-practices/SKILL.md +9 -1
  85. package/.agent/skills/powershell-windows/SKILL.md +9 -1
  86. package/.agent/skills/project-idioms/SKILL.md +9 -1
  87. package/.agent/skills/python-patterns/SKILL.md +9 -1
  88. package/.agent/skills/python-pro/SKILL.md +282 -274
  89. package/.agent/skills/react-specialist/SKILL.md +236 -228
  90. package/.agent/skills/readme-builder/SKILL.md +9 -1
  91. package/.agent/skills/realtime-patterns/SKILL.md +9 -1
  92. package/.agent/skills/red-team-tactics/SKILL.md +9 -1
  93. package/.agent/skills/rust-pro/SKILL.md +9 -1
  94. package/.agent/skills/seo-fundamentals/SKILL.md +9 -1
  95. package/.agent/skills/server-management/SKILL.md +9 -1
  96. package/.agent/skills/shadcn-ui-expert/SKILL.md +9 -1
  97. package/.agent/skills/skill-creator/SKILL.md +9 -1
  98. package/.agent/skills/sql-pro/SKILL.md +9 -1
  99. package/.agent/skills/supabase-postgres-best-practices/SKILL.md +9 -1
  100. package/.agent/skills/swiftui-expert/SKILL.md +9 -1
  101. package/.agent/skills/systematic-debugging/SKILL.md +9 -1
  102. package/.agent/skills/tailwind-patterns/SKILL.md +9 -1
  103. package/.agent/skills/tdd-workflow/SKILL.md +9 -1
  104. package/.agent/skills/test-result-analyzer/SKILL.md +9 -1
  105. package/.agent/skills/testing-patterns/SKILL.md +28 -3
  106. package/.agent/skills/trend-researcher/SKILL.md +9 -1
  107. package/.agent/skills/typescript-advanced/SKILL.md +294 -286
  108. package/.agent/skills/ui-ux-pro-max/SKILL.md +561 -116
  109. package/.agent/skills/ui-ux-researcher/SKILL.md +9 -1
  110. package/.agent/skills/vue-expert/SKILL.md +234 -226
  111. package/.agent/skills/vulnerability-scanner/SKILL.md +9 -1
  112. package/.agent/skills/web-accessibility-auditor/SKILL.md +9 -1
  113. package/.agent/skills/web-design-guidelines/SKILL.md +9 -1
  114. package/.agent/skills/webapp-testing/SKILL.md +9 -1
  115. package/.agent/skills/whimsy-injector/SKILL.md +9 -1
  116. package/.agent/skills/workflow-optimizer/SKILL.md +9 -1
  117. package/README.md +242 -242
  118. package/bin/tribunal-kit.js +157 -21
  119. package/package.json +81 -80
  120. package/scripts/validate-payload.js +73 -0
@@ -373,6 +373,35 @@ function cmdInit(flags) {
373
373
  }
374
374
  // ────────────────────────────────────────────────────────
375
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
+
376
405
  banner();
377
406
 
378
407
  if (dryRun) {
@@ -395,25 +424,6 @@ function cmdInit(flags) {
395
424
  process.exit(0);
396
425
  }
397
426
 
398
- if (!dryRun && fs.existsSync(agentDest) && flags.force) {
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'];
402
- for (const sub of subdirs) {
403
- const subPath = path.join(agentDest, sub);
404
- if (fs.existsSync(subPath)) {
405
- fs.rmSync(subPath, { recursive: true, force: true });
406
- }
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
- }
415
- }
416
-
417
427
  // Ensure history dirs exist (Case Law + Skill Evolution)
418
428
  if (!dryRun) {
419
429
  const caseDir = path.join(agentDest, 'history', 'case-law', 'cases');
@@ -671,7 +681,6 @@ function cmdLearn(flags) {
671
681
 
672
682
  const dryRun = flags.dryRun ? '--dry-run' : '';
673
683
  const useHead = flags.head ? '--head' : '';
674
- const python = process.platform === 'win32' ? 'python' : 'python3';
675
684
  const { execSync } = require('child_process');
676
685
 
677
686
  // Phase 1: Skill Evolution
@@ -736,6 +745,15 @@ async function runWithUpdateCheck(command, flags) {
736
745
  case 'hook':
737
746
  cmdHook(flags);
738
747
  break;
748
+ case 'graph':
749
+ cmdGraph(flags);
750
+ break;
751
+ case 'mutate':
752
+ cmdMutate(flags);
753
+ break;
754
+ case 'context':
755
+ cmdContext(flags);
756
+ break;
739
757
  case 'uninstall':
740
758
  cmdUninstall(flags);
741
759
  break;
@@ -780,7 +798,6 @@ function cmdCase(flags) {
780
798
  process.exit(1);
781
799
  }
782
800
 
783
- const python = process.platform === 'win32' ? 'python' : 'python3';
784
801
  const caseLawScript = path.join(agentDest, 'scripts', 'case_law_manager.js');
785
802
 
786
803
  // Make shorthand aliases
@@ -796,6 +813,34 @@ function cmdCase(flags) {
796
813
  }
797
814
  }
798
815
 
816
+ function cmdGraph(flags) {
817
+ const targetDir = flags.path ? path.resolve(flags.path) : process.cwd();
818
+ const agentDest = path.join(targetDir, '.agent');
819
+
820
+ if (!fs.existsSync(agentDest)) {
821
+ err('.agent/ not found. Run: npx tribunal-kit init');
822
+ process.exit(1);
823
+ }
824
+
825
+ banner();
826
+ const { execSync } = require('child_process');
827
+ const builderScript = path.join(agentDest, 'scripts', 'graph_builder.js');
828
+ const visualizerScript = path.join(agentDest, 'scripts', 'graph_visualizer.js');
829
+ const htmlFile = path.join(agentDest, 'history', 'architecture-explorer.html');
830
+
831
+ try {
832
+ execSync(`node "${builderScript}"`, { stdio: 'inherit', cwd: targetDir });
833
+ execSync(`node "${visualizerScript}"`, { stdio: 'inherit', cwd: targetDir });
834
+
835
+ log(` ${c('cyan', '▸')} Opening visualizer in browser...`);
836
+ const opener = process.platform === 'win32' ? 'start' : process.platform === 'darwin' ? 'open' : 'xdg-open';
837
+ execSync(`${opener} "${htmlFile}"`);
838
+ } catch (e) {
839
+ err(`Graph generation failed: ${e.message}`);
840
+ process.exit(1);
841
+ }
842
+ }
843
+
799
844
  function cmdHook(flags) {
800
845
  const targetDir = flags.path ? path.resolve(flags.path) : process.cwd();
801
846
  const gitDir = path.join(targetDir, '.git');
@@ -821,6 +866,30 @@ function cmdHook(flags) {
821
866
  console.log();
822
867
  }
823
868
 
869
+ function cmdMutate(flags) {
870
+ const targetDir = flags.path ? path.resolve(flags.path) : process.cwd();
871
+ const agentDest = path.join(targetDir, '.agent');
872
+
873
+ if (!fs.existsSync(agentDest)) {
874
+ err('.agent/ not found. Run: npx tribunal-kit init');
875
+ process.exit(1);
876
+ }
877
+
878
+ const args = process.argv.slice(3);
879
+ if (args.length < 2) {
880
+ err('Usage: npx tribunal-kit mutate <target_file> <test_command>');
881
+ process.exit(1);
882
+ }
883
+
884
+ const mutateScript = path.join(agentDest, 'scripts', 'mutation_runner.js');
885
+ const { execSync } = require('child_process');
886
+ try {
887
+ execSync(`node "${mutateScript}" ${args.join(' ')}`, { stdio: 'inherit', cwd: targetDir });
888
+ } catch (e) {
889
+ process.exit(1);
890
+ }
891
+ }
892
+
824
893
  function cmdUninstall(flags) {
825
894
  const targetDir = flags.path ? path.resolve(flags.path) : process.cwd();
826
895
  const agentDest = path.join(targetDir, '.agent');
@@ -895,6 +964,9 @@ function cmdHelp() {
895
964
  log(cmd('status', 'Check if .agent/ is installed'));
896
965
  log(cmd('learn', 'Evolve project idioms based on git diffs'));
897
966
  log(cmd('case', 'Manage Case Law precedents (add, search, list, show, stats, overrule)'));
967
+ log(cmd('graph', 'Build and visualize the architecture graph'));
968
+ log(cmd('mutate', 'Run the Mutation Engine to test test-suite reliability'));
969
+ log(cmd('context', 'Retrieve a highly-optimized Context Snapshot for a file'));
898
970
  log(cmd('hook', 'Install pre-push git hook for auto-learning'));
899
971
  log(cmd('uninstall','Remove .agent/ folder from project'));
900
972
  console.log();
@@ -931,11 +1003,75 @@ function cmdHelp() {
931
1003
  log(ex('tk case stats'));
932
1004
  log(ex('tk case export'));
933
1005
  log(ex('tk case overrule --id 1'));
1006
+ log(ex('tk graph'));
1007
+ log(ex('tk mutate src/utils.js "npm test"'));
934
1008
  log(ex('tk hook'));
935
1009
  log(ex('tk uninstall'));
936
1010
  console.log();
937
1011
  }
938
1012
 
1013
+
1014
+ function cmdContext(flags) {
1015
+ const targetDir = flags.path ? require('path').resolve(flags.path) : process.cwd();
1016
+ const agentDest = require('path').join(targetDir, '.agent');
1017
+
1018
+ if (!require('fs').existsSync(agentDest)) {
1019
+ console.error(' \x1b[91m✖\x1b[0m .agent/ not found. Run: npx tribunal-kit init');
1020
+ process.exit(1);
1021
+ }
1022
+
1023
+ const args = process.argv.slice(3);
1024
+ if (args.length === 0 || args[0] === 'help' || args[0] === '--help') {
1025
+ console.error('Usage: npx tribunal-kit context <target_file>');
1026
+ process.exit(1);
1027
+ }
1028
+
1029
+ const targetFile = args[0].replace(/\\/g, '/');
1030
+ const snapshotName = targetFile.replace(/[\\\/]/g, '__') + '.json';
1031
+ const snapshotPath = require('path').join(agentDest, 'history', 'snapshots', snapshotName);
1032
+
1033
+ if (!require('fs').existsSync(snapshotPath)) {
1034
+ console.error(' \x1b[91m✖\x1b[0m Context Snapshot not found for: ' + targetFile);
1035
+ console.log(' Run: npx tribunal-kit graph (to generate snapshots)');
1036
+ process.exit(1);
1037
+ }
1038
+
1039
+ try {
1040
+ const snapshot = JSON.parse(require('fs').readFileSync(snapshotPath, 'utf8'));
1041
+
1042
+ console.log('\n# Context Snapshot: ' + snapshot.file);
1043
+ process.stdout.write('> Size Estimate: ' + (snapshot['estimatedTokens'] || 'Unknown') + '\n');
1044
+ console.log('> Risk Score: ' + snapshot.riskScore + ' (Blast Radius: ' + snapshot.blastRadius + ')\n');
1045
+
1046
+ if (Object.keys(snapshot.imports).length > 0) {
1047
+ console.log('## Imports');
1048
+ for (const [imp, exports] of Object.entries(snapshot.imports)) {
1049
+ if (exports && exports.length > 0) {
1050
+ console.log('- `' + imp + '` (exports: ' + exports.join(', ') + ')');
1051
+ } else {
1052
+ console.log('- `' + imp + '`');
1053
+ }
1054
+ }
1055
+ console.log();
1056
+ }
1057
+
1058
+ if (snapshot.dependents && snapshot.dependents.length > 0) {
1059
+ console.log('## Dependents');
1060
+ for (const dep of snapshot.dependents) {
1061
+ console.log('- `' + dep + '`');
1062
+ }
1063
+ console.log();
1064
+ }
1065
+
1066
+ console.log('## Source Code');
1067
+ console.log('```javascript\n' + snapshot.content + '\n```\n');
1068
+
1069
+ } catch (e) {
1070
+ console.error('Failed to read snapshot: ' + e.message);
1071
+ process.exit(1);
1072
+ }
1073
+ }
1074
+
939
1075
  // ── Main ──────────────────────────────────────────────────
940
1076
  const { command, flags } = parseArgs(process.argv);
941
1077
 
package/package.json CHANGED
@@ -1,80 +1,81 @@
1
- {
2
- "name": "tribunal-kit",
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
- "keywords": [
6
- "ai",
7
- "ai-agent",
8
- "agent",
9
- "agents",
10
- "multi-agent",
11
- "agentic",
12
- "swarm",
13
- "orchestration",
14
- "llm",
15
- "anti-hallucination",
16
- "hallucination",
17
- "code-review",
18
- "code-quality",
19
- "cursor",
20
- "cursor-rules",
21
- "cursorrules",
22
- "windsurf",
23
- "copilot",
24
- "cline",
25
- "gemini",
26
- "antigravity",
27
- "tribunal",
28
- "mcp",
29
- "model-context-protocol",
30
- "cli",
31
- "devtools",
32
- "ai-coding",
33
- "autonomous-agents",
34
- "coding-assistant",
35
- "automation"
36
- ],
37
- "homepage": "https://github.com/Harmitx7/tribunal-kit",
38
- "repository": {
39
- "type": "git",
40
- "url": "git+https://github.com/Harmitx7/tribunal-kit.git"
41
- },
42
- "license": "MIT",
43
- "bin": {
44
- "tribunal-kit": "bin/tribunal-kit.js",
45
- "tk": "bin/tribunal-kit.js"
46
- },
47
- "files": [
48
- "bin/",
49
- "scripts/",
50
- ".agent/",
51
- "README.md",
52
- "LICENSE"
53
- ],
54
- "engines": {
55
- "node": ">=18.0.0"
56
- },
57
- "scripts": {
58
- "test": "jest --coverage",
59
- "test:unit": "jest test/unit --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"
66
- },
67
- "devDependencies": {
68
- "jest": "^29.7.0"
69
- },
70
- "jest": {
71
- "testMatch": [
72
- "**/test/**/*.test.js"
73
- ],
74
- "testEnvironment": "node",
75
- "coverageDirectory": "coverage",
76
- "collectCoverageFrom": [
77
- "bin/**/*.js"
78
- ]
79
- }
80
- }
1
+ {
2
+ "name": "tribunal-kit",
3
+ "version": "4.4.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
+ "keywords": [
6
+ "ai",
7
+ "ai-agent",
8
+ "agent",
9
+ "agents",
10
+ "multi-agent",
11
+ "agentic",
12
+ "swarm",
13
+ "orchestration",
14
+ "llm",
15
+ "anti-hallucination",
16
+ "hallucination",
17
+ "code-review",
18
+ "code-quality",
19
+ "cursor",
20
+ "cursor-rules",
21
+ "cursorrules",
22
+ "windsurf",
23
+ "copilot",
24
+ "cline",
25
+ "gemini",
26
+ "antigravity",
27
+ "tribunal",
28
+ "mcp",
29
+ "model-context-protocol",
30
+ "cli",
31
+ "devtools",
32
+ "ai-coding",
33
+ "autonomous-agents",
34
+ "coding-assistant",
35
+ "automation"
36
+ ],
37
+ "homepage": "https://github.com/Harmitx7/tribunal-kit",
38
+ "repository": {
39
+ "type": "git",
40
+ "url": "git+https://github.com/Harmitx7/tribunal-kit.git"
41
+ },
42
+ "license": "MIT",
43
+ "bin": {
44
+ "tribunal-kit": "bin/tribunal-kit.js",
45
+ "tk": "bin/tribunal-kit.js"
46
+ },
47
+ "files": [
48
+ "bin/",
49
+ "scripts/",
50
+ ".agent/",
51
+ "README.md",
52
+ "LICENSE"
53
+ ],
54
+ "engines": {
55
+ "node": ">=18.0.0"
56
+ },
57
+ "scripts": {
58
+ "test": "npm run validate-payload && jest --coverage",
59
+ "test:unit": "jest test/unit --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",
66
+ "validate-payload": "node scripts/validate-payload.js"
67
+ },
68
+ "devDependencies": {
69
+ "jest": "^29.7.0"
70
+ },
71
+ "jest": {
72
+ "testMatch": [
73
+ "**/test/**/*.test.js"
74
+ ],
75
+ "testEnvironment": "node",
76
+ "coverageDirectory": "coverage",
77
+ "collectCoverageFrom": [
78
+ "bin/**/*.js"
79
+ ]
80
+ }
81
+ }
@@ -0,0 +1,73 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+
4
+ // Simple Markdown frontmatter and Tribunal header validator
5
+ function validateMarkdownFile(filePath) {
6
+ const content = fs.readFileSync(filePath, 'utf8');
7
+ let errors = [];
8
+
9
+ // Check for frontmatter
10
+ if (content.startsWith('---')) {
11
+ const parts = content.split('---');
12
+ if (parts.length < 3) {
13
+ errors.push('Malformed YAML frontmatter (missing closing ---)');
14
+ }
15
+ }
16
+
17
+ // If it's a skill, check for mandatory headers
18
+ if (filePath.includes('/skills/') || filePath.includes('\\skills\\')) {
19
+ // Exclude templates and documentation that aren't strict skills
20
+ if (!filePath.includes('SKILL.md')) return errors;
21
+
22
+ if (!content.includes('Pre-Flight Checklist') && !content.includes('Pre-Flight')) {
23
+ errors.push('Missing mandatory header/section: Pre-Flight Checklist');
24
+ }
25
+ if (!content.includes('VBC Protocol') && !content.includes('VBC')) {
26
+ errors.push('Missing mandatory header/section: VBC Protocol');
27
+ }
28
+ }
29
+
30
+ return errors;
31
+ }
32
+
33
+ function walkDir(dir, callback) {
34
+ fs.readdirSync(dir).forEach(f => {
35
+ let dirPath = path.join(dir, f);
36
+ let isDirectory = fs.statSync(dirPath).isDirectory();
37
+ isDirectory ? walkDir(dirPath, callback) : callback(path.join(dir, f));
38
+ });
39
+ }
40
+
41
+ function run() {
42
+ const agentDir = path.join(__dirname, '..', '.agent');
43
+ if (!fs.existsSync(agentDir)) {
44
+ console.error('No .agent directory found.');
45
+ process.exit(1);
46
+ }
47
+
48
+ let hasErrors = false;
49
+ let checkedCount = 0;
50
+
51
+ console.log('Validating .agent payload...');
52
+
53
+ walkDir(agentDir, function(filePath) {
54
+ if (filePath.endsWith('.md')) {
55
+ checkedCount++;
56
+ const errors = validateMarkdownFile(filePath);
57
+ if (errors.length > 0) {
58
+ console.error(`\x1b[31m[FAIL]\x1b[0m ${filePath}`);
59
+ errors.forEach(e => console.error(` - ${e}`));
60
+ hasErrors = true;
61
+ }
62
+ }
63
+ });
64
+
65
+ if (hasErrors) {
66
+ console.error(`\nPayload validation failed. Checked ${checkedCount} files.`);
67
+ process.exit(1);
68
+ } else {
69
+ console.log(`\x1b[32mPayload validation passed.\x1b[0m Checked ${checkedCount} files.`);
70
+ }
71
+ }
72
+
73
+ run();