tribunal-kit 4.4.0 → 4.4.2

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 (90) hide show
  1. package/.agent/agents/api-architect.md +66 -66
  2. package/.agent/agents/db-latency-auditor.md +216 -216
  3. package/.agent/agents/precedence-reviewer.md +250 -250
  4. package/.agent/agents/resilience-reviewer.md +88 -88
  5. package/.agent/agents/schema-reviewer.md +67 -67
  6. package/.agent/agents/throughput-optimizer.md +299 -299
  7. package/.agent/agents/ui-ux-auditor.md +292 -292
  8. package/.agent/agents/vitals-reviewer.md +223 -223
  9. package/.agent/history/architecture-graph.yaml +32 -1
  10. package/.agent/history/graph-cache.json +66 -19
  11. package/.agent/history/snapshots/bin__tribunal-kit.js.json +19 -0
  12. package/.agent/history/snapshots/eslint.config.js.json +9 -0
  13. package/.agent/history/snapshots/migrate_refs.js.json +3 -3
  14. package/.agent/history/snapshots/scripts__changelog.js.json +2 -1
  15. package/.agent/history/snapshots/scripts__sync-version.js.json +2 -1
  16. package/.agent/history/snapshots/scripts__validate-payload.js.json +1 -0
  17. package/.agent/history/snapshots/test__integration__bridges.test.js.json +2 -1
  18. package/.agent/history/snapshots/test__integration__init.test.js.json +1 -0
  19. package/.agent/history/snapshots/test__integration__routing.test.js.json +1 -0
  20. package/.agent/history/snapshots/test__integration__swarm_dispatcher.test.js.json +2 -1
  21. package/.agent/history/snapshots/test__integration__wave2.test.js.json +2 -1
  22. package/.agent/history/snapshots/test__unit__args.test.js.json +11 -1
  23. package/.agent/history/snapshots/test__unit__case_law_manager.test.js.json +1 -0
  24. package/.agent/history/snapshots/test__unit__context_broker.test.js.json +11 -0
  25. package/.agent/history/snapshots/test__unit__copyDir.test.js.json +11 -1
  26. package/.agent/history/snapshots/test__unit__graph_tools.test.js.json +1 -0
  27. package/.agent/history/snapshots/test__unit__inner_loop_validator.test.js.json +11 -0
  28. package/.agent/history/snapshots/test__unit__selfInstall.test.js.json +11 -1
  29. package/.agent/history/snapshots/test__unit__semver.test.js.json +11 -1
  30. package/.agent/history/snapshots/test__unit__swarm_dispatcher.test.js.json +1 -0
  31. package/.agent/scripts/_colors.js +154 -2
  32. package/.agent/scripts/_utils.js +205 -3
  33. package/.agent/scripts/append_flow.js +72 -72
  34. package/.agent/scripts/auto_preview.js +197 -197
  35. package/.agent/scripts/bundle_analyzer.js +90 -119
  36. package/.agent/scripts/case_law_manager.js +18 -13
  37. package/.agent/scripts/checklist.js +100 -88
  38. package/.agent/scripts/colors.js +7 -13
  39. package/.agent/scripts/compress_skills.js +141 -141
  40. package/.agent/scripts/consolidate_skills.js +149 -149
  41. package/.agent/scripts/context_broker.js +605 -609
  42. package/.agent/scripts/deep_compress.js +150 -150
  43. package/.agent/scripts/dependency_analyzer.js +68 -106
  44. package/.agent/scripts/graph_builder.js +341 -311
  45. package/.agent/scripts/graph_visualizer.js +390 -384
  46. package/.agent/scripts/graph_zoom.js +6 -4
  47. package/.agent/scripts/inner_loop_validator.js +445 -465
  48. package/.agent/scripts/lint_runner.js +27 -28
  49. package/.agent/scripts/minify_context.js +100 -100
  50. package/.agent/scripts/mutation_runner.js +280 -280
  51. package/.agent/scripts/patch_skills_meta.js +156 -156
  52. package/.agent/scripts/patch_skills_output.js +244 -244
  53. package/.agent/scripts/schema_validator.js +280 -297
  54. package/.agent/scripts/security_scan.js +37 -64
  55. package/.agent/scripts/session_manager.js +270 -276
  56. package/.agent/scripts/skill_evolution.js +637 -644
  57. package/.agent/scripts/skill_integrator.js +307 -313
  58. package/.agent/scripts/strengthen_skills.js +193 -193
  59. package/.agent/scripts/strip_tribunal.js +47 -47
  60. package/.agent/scripts/swarm_dispatcher.js +360 -360
  61. package/.agent/scripts/test_runner.js +32 -39
  62. package/.agent/scripts/utils.js +10 -25
  63. package/.agent/scripts/verify_all.js +84 -92
  64. package/.agent/skills/app-builder/templates/astro-static/TEMPLATE.md +1 -1
  65. package/.agent/skills/app-builder/templates/chrome-extension/TEMPLATE.md +1 -1
  66. package/.agent/skills/app-builder/templates/cli-tool/TEMPLATE.md +1 -1
  67. package/.agent/skills/app-builder/templates/electron-desktop/TEMPLATE.md +1 -1
  68. package/.agent/skills/app-builder/templates/express-api/TEMPLATE.md +1 -1
  69. package/.agent/skills/app-builder/templates/flutter-app/TEMPLATE.md +1 -1
  70. package/.agent/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +1 -1
  71. package/.agent/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +1 -1
  72. package/.agent/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +1 -1
  73. package/.agent/skills/app-builder/templates/nextjs-static/TEMPLATE.md +1 -1
  74. package/.agent/skills/app-builder/templates/nuxt-app/TEMPLATE.md +1 -1
  75. package/.agent/skills/app-builder/templates/python-fastapi/TEMPLATE.md +1 -1
  76. package/.agent/skills/app-builder/templates/react-native-app/TEMPLATE.md +1 -1
  77. package/.agent/skills/doc.md +1 -1
  78. package/.agent/skills/knowledge-graph/SKILL.md +52 -52
  79. package/.agent/skills/ui-ux-pro-max/SKILL.md +562 -562
  80. package/.agent/workflows/generate.md +183 -183
  81. package/.agent/workflows/tribunal-speed.md +183 -183
  82. package/README.md +1 -1
  83. package/bin/tribunal-kit.js +76 -87
  84. package/package.json +6 -3
  85. package/scripts/changelog.js +167 -167
  86. package/scripts/sync-version.js +81 -81
  87. package/.agent/history/architecture-explorer.html +0 -352
  88. package/.agent/scripts/__pycache__/_colors.cpython-311.pyc +0 -0
  89. package/.agent/scripts/__pycache__/_utils.cpython-311.pyc +0 -0
  90. package/.agent/scripts/__pycache__/case_law_manager.cpython-311.pyc +0 -0
@@ -1,149 +1,149 @@
1
- #!/usr/bin/env node
2
- /**
3
- * consolidate_skills.js
4
- */
5
-
6
- 'use strict';
7
-
8
- const fs = require('fs');
9
- const path = require('path');
10
-
11
- const BASE = '.agent/skills';
12
-
13
- const STRIP_PATTERNS = [
14
- /^## šŸ›ļø Tribunal Integration.*?(?=\n## |$)/gms,
15
- /^## Tribunal Integration.*?(?=\n## |$)/gms,
16
- /^### āœ… Pre-Flight Self-Audit.*?(?=\n###|\n## |$)/gms,
17
- /^## Pre-Flight Self-Audit.*?(?=\n## |$)/gms,
18
- /^## Output Format\b.*?(?=\n## |$)/gms,
19
- /^## šŸ”§ Runtime Scripts.*?(?=\n## |$)/gms,
20
- /^## šŸ”“ MANDATORY.*?(?=\n## |$)/gms,
21
- /^## āš ļø CRITICAL: ASK BEFORE ASSUMING.*?(?=\n## |$)/gms,
22
- /^## šŸ“ CHECKPOINT \(MANDATORY.*?(?=\n## |$)/gms,
23
- /^## Output Format.*?```\n[^`]*```\n?(?=\n## |$)/gms,
24
- /^\*\*Execute these for validation.*?---\n/gms,
25
- /^\*\*VBC \(Verification-Before-Completion\).*?\n/gms,
26
- /^\*\*ā›” DO NOT start.*?---\n?/gms,
27
- /^> 🧠 \*\*mobile-design.*?\n/gms,
28
- /^> \*\*STOP.*?\n/gms,
29
- ];
30
-
31
- function adjustHeadings(content, offset = 1) {
32
- const lines = content.split('\n');
33
- const out = [];
34
- for (let line of lines) {
35
- const m = line.match(/^(#{1,5}) /);
36
- if (m) {
37
- const level = m[1].length;
38
- const newLevel = Math.min(level + offset, 6);
39
- line = '#'.repeat(newLevel) + line.substring(level);
40
- }
41
- out.push(line);
42
- }
43
- return out.join('\n');
44
- }
45
-
46
- function cleanContent(content) {
47
- for (const p of STRIP_PATTERNS) {
48
- content = content.replace(p, '');
49
- }
50
- content = content.replace(/\n{3,}/g, '\n\n');
51
- return content.trim();
52
- }
53
-
54
- function extractFrontmatter(content) {
55
- const m = content.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n/);
56
- if (m) {
57
- return [m[1], content.substring(m[0].length)];
58
- }
59
- return ['', content];
60
- }
61
-
62
- function consolidate(skillDir) {
63
- const skillName = path.basename(skillDir);
64
- const mainPath = path.join(skillDir, 'SKILL.md');
65
- if (!fs.existsSync(mainPath)) return false;
66
-
67
- const files = fs.readdirSync(skillDir);
68
- const subFiles = files.filter(f => f.endsWith('.md') && f !== 'SKILL.md').sort();
69
-
70
- if (subFiles.length === 0) return false;
71
-
72
- console.log(`\n → Consolidating: ${skillName} (${subFiles.length} sub-files)`);
73
-
74
- const mainContent = fs.readFileSync(mainPath, 'utf8');
75
- let [frontmatter, mainBody] = extractFrontmatter(mainContent);
76
-
77
- const fmLines = frontmatter.split('\n');
78
- const newFm = [];
79
- for (const line of fmLines) {
80
- if (line.startsWith('version:')) newFm.push('version: 3.1.0');
81
- else if (line.startsWith('last-updated:')) newFm.push('last-updated: 2026-04-06');
82
- else newFm.push(line);
83
- }
84
- frontmatter = newFm.join('\n');
85
-
86
- mainBody = cleanContent(mainBody);
87
- mainBody = mainBody.replace(/\|.*?\.md.*?\|.*?\|.*?\|\n/g, '');
88
- mainBody = mainBody.replace(/^\|[-| ]+\|\n/gm, '');
89
- mainBody = mainBody.replace(/\n{3,}/g, '\n\n');
90
-
91
- const mergedSections = [];
92
- for (const fname of subFiles) {
93
- const fpath = path.join(skillDir, fname);
94
- const raw = fs.readFileSync(fpath, 'utf8');
95
- let [, body] = extractFrontmatter(raw);
96
- body = cleanContent(body);
97
- body = adjustHeadings(body, 1);
98
- if (body.trim()) {
99
- mergedSections.push(body.trim());
100
- }
101
- }
102
-
103
- let combined = `---\n${frontmatter}\n---\n\n${mainBody}`;
104
- if (mergedSections.length > 0) {
105
- combined += '\n\n---\n\n' + mergedSections.join('\n\n---\n\n');
106
- }
107
-
108
- combined = combined.replace(/\n{3,}/g, '\n\n');
109
- combined = combined.trim() + '\n';
110
-
111
- let totalSubBytes = 0;
112
- for (const f of subFiles) totalSubBytes += fs.statSync(path.join(skillDir, f)).size;
113
- console.log(` Sub-files total: ${Math.floor(totalSubBytes / 1024)}KB`);
114
-
115
- fs.writeFileSync(mainPath, combined, 'utf8');
116
- const newSize = fs.statSync(mainPath).size;
117
- console.log(` New SKILL.md: ${Math.floor(newSize / 1024)}KB (from ${Math.floor(Buffer.byteLength(mainContent, 'utf8') / 1024)}KB main + ${Math.floor(totalSubBytes / 1024)}KB subs → ${Math.floor(newSize / 1024)}KB)`);
118
-
119
- for (const fname of subFiles) {
120
- fs.unlinkSync(path.join(skillDir, fname));
121
- console.log(` Deleted: ${fname}`);
122
- }
123
-
124
- return true;
125
- }
126
-
127
- function main() {
128
- const target = process.argv.length > 2 ? process.argv[2] : null;
129
-
130
- let processed = 0;
131
- if (!fs.existsSync(BASE)) return;
132
-
133
- for (const skillName of fs.readdirSync(BASE)) {
134
- const skillDir = path.join(BASE, skillName);
135
- if (!fs.statSync(skillDir).isDirectory()) continue;
136
- if (target && skillName !== target) continue;
137
- if (consolidate(skillDir)) processed++;
138
- }
139
-
140
- if (processed === 0) {
141
- console.log('No skills with sub-files found (or target not matched).');
142
- } else {
143
- console.log(`\nāœ… Consolidated ${processed} skills.`);
144
- }
145
- }
146
-
147
- if (require.main === module) {
148
- main();
149
- }
1
+ #!/usr/bin/env node
2
+ /**
3
+ * consolidate_skills.js
4
+ */
5
+
6
+ 'use strict';
7
+
8
+ const fs = require('fs');
9
+ const path = require('path');
10
+
11
+ const BASE = '.agent/skills';
12
+
13
+ const STRIP_PATTERNS = [
14
+ /^## šŸ›ļø Tribunal Integration.*?(?=\n## |$)/gms,
15
+ /^## Tribunal Integration.*?(?=\n## |$)/gms,
16
+ /^### āœ… Pre-Flight Self-Audit.*?(?=\n###|\n## |$)/gms,
17
+ /^## Pre-Flight Self-Audit.*?(?=\n## |$)/gms,
18
+ /^## Output Format\b.*?(?=\n## |$)/gms,
19
+ /^## šŸ”§ Runtime Scripts.*?(?=\n## |$)/gms,
20
+ /^## šŸ”“ MANDATORY.*?(?=\n## |$)/gms,
21
+ /^## āš ļø CRITICAL: ASK BEFORE ASSUMING.*?(?=\n## |$)/gms,
22
+ /^## šŸ“ CHECKPOINT \(MANDATORY.*?(?=\n## |$)/gms,
23
+ /^## Output Format.*?```\n[^`]*```\n?(?=\n## |$)/gms,
24
+ /^\*\*Execute these for validation.*?---\n/gms,
25
+ /^\*\*VBC \(Verification-Before-Completion\).*?\n/gms,
26
+ /^\*\*ā›” DO NOT start.*?---\n?/gms,
27
+ /^> 🧠 \*\*mobile-design.*?\n/gms,
28
+ /^> \*\*STOP.*?\n/gms,
29
+ ];
30
+
31
+ function adjustHeadings(content, offset = 1) {
32
+ const lines = content.split('\n');
33
+ const out = [];
34
+ for (let line of lines) {
35
+ const m = line.match(/^(#{1,5}) /);
36
+ if (m) {
37
+ const level = m[1].length;
38
+ const newLevel = Math.min(level + offset, 6);
39
+ line = '#'.repeat(newLevel) + line.substring(level);
40
+ }
41
+ out.push(line);
42
+ }
43
+ return out.join('\n');
44
+ }
45
+
46
+ function cleanContent(content) {
47
+ for (const p of STRIP_PATTERNS) {
48
+ content = content.replace(p, '');
49
+ }
50
+ content = content.replace(/\n{3,}/g, '\n\n');
51
+ return content.trim();
52
+ }
53
+
54
+ function extractFrontmatter(content) {
55
+ const m = content.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n/);
56
+ if (m) {
57
+ return [m[1], content.substring(m[0].length)];
58
+ }
59
+ return ['', content];
60
+ }
61
+
62
+ function consolidate(skillDir) {
63
+ const skillName = path.basename(skillDir);
64
+ const mainPath = path.join(skillDir, 'SKILL.md');
65
+ if (!fs.existsSync(mainPath)) return false;
66
+
67
+ const files = fs.readdirSync(skillDir);
68
+ const subFiles = files.filter(f => f.endsWith('.md') && f !== 'SKILL.md').sort();
69
+
70
+ if (subFiles.length === 0) return false;
71
+
72
+ console.log(`\n → Consolidating: ${skillName} (${subFiles.length} sub-files)`);
73
+
74
+ const mainContent = fs.readFileSync(mainPath, 'utf8');
75
+ let [frontmatter, mainBody] = extractFrontmatter(mainContent);
76
+
77
+ const fmLines = frontmatter.split('\n');
78
+ const newFm = [];
79
+ for (const line of fmLines) {
80
+ if (line.startsWith('version:')) newFm.push('version: 3.1.0');
81
+ else if (line.startsWith('last-updated:')) newFm.push('last-updated: 2026-04-06');
82
+ else newFm.push(line);
83
+ }
84
+ frontmatter = newFm.join('\n');
85
+
86
+ mainBody = cleanContent(mainBody);
87
+ mainBody = mainBody.replace(/\|.*?\.md.*?\|.*?\|.*?\|\n/g, '');
88
+ mainBody = mainBody.replace(/^\|[-| ]+\|\n/gm, '');
89
+ mainBody = mainBody.replace(/\n{3,}/g, '\n\n');
90
+
91
+ const mergedSections = [];
92
+ for (const fname of subFiles) {
93
+ const fpath = path.join(skillDir, fname);
94
+ const raw = fs.readFileSync(fpath, 'utf8');
95
+ let [, body] = extractFrontmatter(raw);
96
+ body = cleanContent(body);
97
+ body = adjustHeadings(body, 1);
98
+ if (body.trim()) {
99
+ mergedSections.push(body.trim());
100
+ }
101
+ }
102
+
103
+ let combined = `---\n${frontmatter}\n---\n\n${mainBody}`;
104
+ if (mergedSections.length > 0) {
105
+ combined += '\n\n---\n\n' + mergedSections.join('\n\n---\n\n');
106
+ }
107
+
108
+ combined = combined.replace(/\n{3,}/g, '\n\n');
109
+ combined = combined.trim() + '\n';
110
+
111
+ let totalSubBytes = 0;
112
+ for (const f of subFiles) totalSubBytes += fs.statSync(path.join(skillDir, f)).size;
113
+ console.log(` Sub-files total: ${Math.floor(totalSubBytes / 1024)}KB`);
114
+
115
+ fs.writeFileSync(mainPath, combined, 'utf8');
116
+ const newSize = fs.statSync(mainPath).size;
117
+ console.log(` New SKILL.md: ${Math.floor(newSize / 1024)}KB (from ${Math.floor(Buffer.byteLength(mainContent, 'utf8') / 1024)}KB main + ${Math.floor(totalSubBytes / 1024)}KB subs → ${Math.floor(newSize / 1024)}KB)`);
118
+
119
+ for (const fname of subFiles) {
120
+ fs.unlinkSync(path.join(skillDir, fname));
121
+ console.log(` Deleted: ${fname}`);
122
+ }
123
+
124
+ return true;
125
+ }
126
+
127
+ function main() {
128
+ const target = process.argv.length > 2 ? process.argv[2] : null;
129
+
130
+ let processed = 0;
131
+ if (!fs.existsSync(BASE)) return;
132
+
133
+ for (const skillName of fs.readdirSync(BASE)) {
134
+ const skillDir = path.join(BASE, skillName);
135
+ if (!fs.statSync(skillDir).isDirectory()) continue;
136
+ if (target && skillName !== target) continue;
137
+ if (consolidate(skillDir)) processed++;
138
+ }
139
+
140
+ if (processed === 0) {
141
+ console.log('No skills with sub-files found (or target not matched).');
142
+ } else {
143
+ console.log(`\nāœ… Consolidated ${processed} skills.`);
144
+ }
145
+ }
146
+
147
+ if (require.main === module) {
148
+ main();
149
+ }