tribunal-kit 5.7.0 โ†’ 5.8.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 (59) hide show
  1. package/.agent/ARCHITECTURE.md +6 -7
  2. package/.agent/agents/frontend-reviewer.md +13 -0
  3. package/.agent/agents/frontend-specialist.md +14 -0
  4. package/.agent/agents/logic-reviewer.md +11 -0
  5. package/.agent/agents/orchestrator.md +15 -0
  6. package/.agent/agents/project-planner.md +5 -0
  7. package/.agent/agents/security-auditor.md +13 -0
  8. package/.agent/agents/ui-ux-auditor.md +7 -31
  9. package/.agent/history/memory/.memory.idx +1693 -0
  10. package/.agent/history/memory/MEMORY.md +123 -0
  11. package/.agent/routing_index.json +694 -714
  12. package/.agent/rules/GEMINI.md +88 -13
  13. package/.agent/scripts/_colors.js +131 -89
  14. package/.agent/scripts/_utils.js +163 -128
  15. package/.agent/scripts/auto_preview.js +207 -197
  16. package/.agent/scripts/bundle_analyzer.js +227 -192
  17. package/.agent/scripts/case_law_manager.js +991 -689
  18. package/.agent/scripts/checklist.js +233 -190
  19. package/.agent/scripts/context_broker.js +930 -605
  20. package/.agent/scripts/dependency_analyzer.js +275 -184
  21. package/.agent/scripts/graph_builder.js +412 -341
  22. package/.agent/scripts/graph_visualizer.js +392 -390
  23. package/.agent/scripts/graph_zoom.js +198 -156
  24. package/.agent/scripts/inner_loop_validator.js +523 -445
  25. package/.agent/scripts/lint_runner.js +199 -157
  26. package/.agent/scripts/marathon_harness.js +819 -661
  27. package/.agent/scripts/minify_context.js +115 -100
  28. package/.agent/scripts/mutation_runner.js +321 -280
  29. package/.agent/scripts/prompt_compiler.js +62 -42
  30. package/.agent/scripts/schema_validator.js +373 -280
  31. package/.agent/scripts/security_scan.js +333 -190
  32. package/.agent/scripts/session_manager.js +306 -270
  33. package/.agent/scripts/skill_evolution.js +810 -637
  34. package/.agent/scripts/skill_integrator.js +327 -307
  35. package/.agent/scripts/strengthen_skills.js +203 -193
  36. package/.agent/scripts/swarm_dispatcher.js +558 -457
  37. package/.agent/scripts/test_runner.js +178 -152
  38. package/.agent/scripts/verify_all.js +200 -168
  39. package/.agent/skills/fabel-protocol/SKILL.md +271 -0
  40. package/.agent/skills/thinking-protocol/SKILL.md +27 -0
  41. package/.agent/workflows/generate.md +2 -1
  42. package/.agent/workflows/tribunal-full.md +4 -3
  43. package/.agent/workflows/tribunal-speed.md +1 -1
  44. package/README.md +184 -58
  45. package/bin/mcp-server.js +496 -173
  46. package/bin/tribunal-kit.js +1245 -987
  47. package/bin/wrapper.js +108 -74
  48. package/dist/cli.js +44 -0
  49. package/dist/commands/align.js +201 -0
  50. package/dist/commands/case.js +23 -0
  51. package/dist/commands/compile.js +84 -0
  52. package/dist/commands/init.js +42 -0
  53. package/dist/commands/learn.js +57 -0
  54. package/dist/commands/memory.js +456 -0
  55. package/package.json +22 -10
  56. package/scripts/benchmark.js +162 -125
  57. package/scripts/changelog.js +196 -168
  58. package/scripts/sync-version.js +94 -81
  59. package/scripts/validate-payload.js +85 -78
@@ -1,193 +1,203 @@
1
- #!/usr/bin/env node
2
- /**
3
- * strengthen_skills.js โ€” Appends Tribunal guardrails to SKILL.md files missing them.
4
- *
5
- * Usage:
6
- * node .agent/scripts/strengthen_skills.js .
7
- * node .agent/scripts/strengthen_skills.js . --dry-run
8
- * node .agent/scripts/strengthen_skills.js . --skill python-pro
9
- * node .agent/scripts/strengthen_skills.js . --skills-path /custom/skills/dir
10
- */
11
-
12
- 'use strict';
13
-
14
- const fs = require('fs');
15
- const path = require('path');
16
-
17
- const { RED, GREEN, YELLOW, BLUE, BOLD, RESET } = require('./_colors.js');
18
-
19
- const GUARDRAILS_BLOCK = `
20
-
21
- ---
22
-
23
- ## ๐Ÿค– LLM-Specific Traps
24
-
25
- AI coding assistants often fall into specific bad habits when dealing with this domain. These are strictly forbidden:
26
-
27
- 1. **Over-engineering:** Proposing complex abstractions or distributed systems when a simpler approach suffices.
28
- 2. **Hallucinated Libraries/Methods:** Using non-existent methods or packages. Always \`// VERIFY\` or check \`package.json\` / \`requirements.txt\`.
29
- 3. **Skipping Edge Cases:** Writing the "happy path" and ignoring error handling, timeouts, or data validation.
30
- 4. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
31
- 5. **Silent Degradation:** Catching and suppressing errors without logging or re-raising.
32
-
33
- ---
34
-
35
- ## ๐Ÿ›๏ธ Tribunal Integration (Anti-Hallucination)
36
-
37
- **Slash command: \`/review\` or \`/tribunal-full\`**
38
- **Active reviewers: \`logic-reviewer\` ยท \`security-auditor\`**
39
-
40
- ### โŒ Forbidden AI Tropes
41
-
42
- 1. **Blind Assumptions:** Never make an assumption without documenting it clearly with \`// VERIFY: [reason]\`.
43
- 2. **Silent Degradation:** Catching and suppressing errors without logging or handling.
44
- 3. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
45
-
46
- ### โœ… Pre-Flight Self-Audit
47
-
48
- Review these questions before confirming output:
49
- \`\`\`
50
- โœ… Did I rely ONLY on real, verified tools and methods?
51
- โœ… Is this solution appropriately scoped to the user's constraints?
52
- โœ… Did I handle potential failure modes and edge cases?
53
- โœ… Have I avoided generic boilerplate that doesn't add value?
54
- \`\`\`
55
-
56
- ### ๐Ÿ›‘ Verification-Before-Completion (VBC) Protocol
57
-
58
- **CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
59
- - โŒ **Forbidden:** Declaring a task complete because the output "looks correct."
60
- - โœ… **Required:** You are explicitly forbidden from finalizing any task without providing **concrete evidence** (terminal output, passing tests, compile success, or equivalent proof) that your output works as intended.
61
- `;
62
-
63
- const TRIBUNAL_MARKERS = [
64
- "Tribunal Integration",
65
- "Tribunal Integration (Anti-Hallucination)",
66
- ];
67
-
68
- const VBC_MARKERS = [
69
- "Verification-Before-Completion",
70
- "VBC Protocol",
71
- ];
72
-
73
- function hasTribunalBlock(content) {
74
- return TRIBUNAL_MARKERS.some(m => content.includes(m));
75
- }
76
-
77
- function hasVbcBlock(content) {
78
- return VBC_MARKERS.some(m => content.includes(m));
79
- }
80
-
81
- function header(title) { console.log(`\n${BOLD}${BLUE}โ”โ”โ” ${title} โ”โ”โ”${RESET}`); }
82
- function ok(msg) { console.log(` ${GREEN}โœ… ${msg}${RESET}`); }
83
- function skip(msg) { console.log(` ${YELLOW}โญ๏ธ ${msg}${RESET}`); }
84
- function warn(msg) { console.log(` ${YELLOW}โš ๏ธ ${msg}${RESET}`); }
85
- function fail(msg) { console.log(` ${RED}โŒ ${msg}${RESET}`); }
86
-
87
- function processSkill(skillMd, dryRun) {
88
- const skillName = path.basename(path.dirname(skillMd));
89
- try {
90
- const content = fs.readFileSync(skillMd, 'utf8');
91
- const hasTribunal = hasTribunalBlock(content);
92
- const hasVbc = hasVbcBlock(content);
93
-
94
- if (hasTribunal && hasVbc) {
95
- skip(`${skillName} โ€” already has Tribunal + VBC blocks`);
96
- return "skipped";
97
- }
98
-
99
- const missing = [];
100
- if (!hasTribunal) missing.push("Tribunal Integration");
101
- if (!hasVbc) missing.push("VBC Protocol");
102
-
103
- if (dryRun) {
104
- warn(`[DRY RUN] ${skillName} โ€” would add: ${missing.join(', ')}`);
105
- return "updated";
106
- }
107
-
108
- fs.appendFileSync(skillMd, GUARDRAILS_BLOCK, 'utf8');
109
- ok(`${skillName} โ€” strengthened (${missing.join(', ')} added)`);
110
- return "updated";
111
- } catch (e) {
112
- fail(`${skillName} โ€” ${e.message}`);
113
- return "error";
114
- }
115
- }
116
-
117
- function main() {
118
- const args = process.argv.slice(2);
119
- let targetPath = ".";
120
- let dryRun = false;
121
- let skillArg = null;
122
- let skillsPathArg = null;
123
-
124
- let i = 0;
125
- while (i < args.length) {
126
- if (args[i] === '--dry-run') {
127
- dryRun = true;
128
- } else if (args[i] === '--skill' && i + 1 < args.length) {
129
- skillArg = args[++i];
130
- } else if (args[i] === '--skills-path' && i + 1 < args.length) {
131
- skillsPathArg = args[++i];
132
- } else if (args[i] === '-h' || args[i] === '--help') {
133
- console.log("Usage: node strengthen_skills.js <path> [--dry-run] [--skill <name>] [--skills-path <path>]");
134
- process.exit(0);
135
- } else if (!args[i].startsWith('-')) {
136
- targetPath = args[i];
137
- }
138
- i++;
139
- }
140
-
141
- const projectRoot = path.resolve(targetPath);
142
- let skillsDir;
143
- if (skillsPathArg) {
144
- skillsDir = path.resolve(skillsPathArg);
145
- } else {
146
- skillsDir = path.join(projectRoot, ".agent", "skills");
147
- }
148
-
149
- if (!fs.existsSync(skillsDir) || !fs.statSync(skillsDir).isDirectory()) {
150
- fail(`Skills directory not found: ${skillsDir}`);
151
- process.exit(1);
152
- }
153
-
154
- console.log(`${BOLD}Tribunal โ€” strengthen_skills.js${RESET}`);
155
- if (dryRun) console.log(` ${YELLOW}DRY RUN โ€” no files will be written${RESET}`);
156
- console.log(`Skills dir: ${skillsDir}\n`);
157
-
158
- const counts = { updated: 0, skipped: 0, error: 0 };
159
- header("Strengthening Skills");
160
-
161
- const dirs = fs.readdirSync(skillsDir, { withFileTypes: true });
162
- dirs.sort((a, b) => a.name.localeCompare(b.name));
163
-
164
- for (const dir of dirs) {
165
- if (!dir.isDirectory()) continue;
166
- if (skillArg && dir.name !== skillArg) continue;
167
-
168
- const skillMd = path.join(skillsDir, dir.name, "SKILL.md");
169
- if (!fs.existsSync(skillMd)) {
170
- warn(`${dir.name} โ€” no SKILL.md found`);
171
- continue;
172
- }
173
-
174
- const result = processSkill(skillMd, dryRun);
175
- counts[result]++;
176
- }
177
-
178
- console.log(`\n${BOLD}โ”โ”โ” Summary โ”โ”โ”${RESET}`);
179
- console.log(` ${GREEN}โœ… Strengthened: ${counts.updated}${RESET}`);
180
- console.log(` ${YELLOW}โญ๏ธ Skipped: ${counts.skipped}${RESET}`);
181
- if (counts.error > 0) {
182
- console.log(` ${RED}โŒ Errors: ${counts.error}${RESET}`);
183
- }
184
- if (dryRun) {
185
- console.log(` ${YELLOW}(dry-run โ€” nothing written)${RESET}`);
186
- }
187
-
188
- process.exit(counts.error > 0 ? 1 : 0);
189
- }
190
-
191
- if (require.main === module) {
192
- main();
193
- }
1
+ #!/usr/bin/env node
2
+ /**
3
+ * strengthen_skills.js โ€” Appends Tribunal guardrails to SKILL.md files missing them.
4
+ *
5
+ * Usage:
6
+ * node .agent/scripts/strengthen_skills.js .
7
+ * node .agent/scripts/strengthen_skills.js . --dry-run
8
+ * node .agent/scripts/strengthen_skills.js . --skill python-pro
9
+ * node .agent/scripts/strengthen_skills.js . --skills-path /custom/skills/dir
10
+ */
11
+
12
+ "use strict";
13
+
14
+ const fs = require("fs");
15
+ const path = require("path");
16
+
17
+ const { RED, GREEN, YELLOW, BLUE, BOLD, RESET } = require("./_colors.js");
18
+
19
+ const GUARDRAILS_BLOCK = `
20
+
21
+ ---
22
+
23
+ ## ๐Ÿค– LLM-Specific Traps
24
+
25
+ AI coding assistants often fall into specific bad habits when dealing with this domain. These are strictly forbidden:
26
+
27
+ 1. **Over-engineering:** Proposing complex abstractions or distributed systems when a simpler approach suffices.
28
+ 2. **Hallucinated Libraries/Methods:** Using non-existent methods or packages. Always \`// VERIFY\` or check \`package.json\` / \`requirements.txt\`.
29
+ 3. **Skipping Edge Cases:** Writing the "happy path" and ignoring error handling, timeouts, or data validation.
30
+ 4. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
31
+ 5. **Silent Degradation:** Catching and suppressing errors without logging or re-raising.
32
+
33
+ ---
34
+
35
+ ## ๐Ÿ›๏ธ Tribunal Integration (Anti-Hallucination)
36
+
37
+ **Slash command: \`/review\` or \`/tribunal-full\`**
38
+ **Active reviewers: \`logic-reviewer\` ยท \`security-auditor\`**
39
+
40
+ ### โŒ Forbidden AI Tropes
41
+
42
+ 1. **Blind Assumptions:** Never make an assumption without documenting it clearly with \`// VERIFY: [reason]\`.
43
+ 2. **Silent Degradation:** Catching and suppressing errors without logging or handling.
44
+ 3. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
45
+
46
+ ### โœ… Pre-Flight Self-Audit
47
+
48
+ Review these questions before confirming output:
49
+ \`\`\`
50
+ โœ… Did I rely ONLY on real, verified tools and methods?
51
+ โœ… Is this solution appropriately scoped to the user's constraints?
52
+ โœ… Did I handle potential failure modes and edge cases?
53
+ โœ… Have I avoided generic boilerplate that doesn't add value?
54
+ \`\`\`
55
+
56
+ ### ๐Ÿ›‘ Verification-Before-Completion (VBC) Protocol
57
+
58
+ **CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
59
+ - โŒ **Forbidden:** Declaring a task complete because the output "looks correct."
60
+ - โœ… **Required:** You are explicitly forbidden from finalizing any task without providing **concrete evidence** (terminal output, passing tests, compile success, or equivalent proof) that your output works as intended.
61
+ `;
62
+
63
+ const TRIBUNAL_MARKERS = [
64
+ "Tribunal Integration",
65
+ "Tribunal Integration (Anti-Hallucination)",
66
+ ];
67
+
68
+ const VBC_MARKERS = ["Verification-Before-Completion", "VBC Protocol"];
69
+
70
+ function hasTribunalBlock(content) {
71
+ return TRIBUNAL_MARKERS.some((m) => content.includes(m));
72
+ }
73
+
74
+ function hasVbcBlock(content) {
75
+ return VBC_MARKERS.some((m) => content.includes(m));
76
+ }
77
+
78
+ function header(title) {
79
+ console.log(`\n${BOLD}${BLUE}โ”โ”โ” ${title} โ”โ”โ”${RESET}`);
80
+ }
81
+ function ok(msg) {
82
+ console.log(` ${GREEN}โœ… ${msg}${RESET}`);
83
+ }
84
+ function skip(msg) {
85
+ console.log(` ${YELLOW}โญ๏ธ ${msg}${RESET}`);
86
+ }
87
+ function warn(msg) {
88
+ console.log(` ${YELLOW}โš ๏ธ ${msg}${RESET}`);
89
+ }
90
+ function fail(msg) {
91
+ console.log(` ${RED}โŒ ${msg}${RESET}`);
92
+ }
93
+
94
+ function processSkill(skillMd, dryRun) {
95
+ const skillName = path.basename(path.dirname(skillMd));
96
+ try {
97
+ const content = fs.readFileSync(skillMd, "utf8");
98
+ const hasTribunal = hasTribunalBlock(content);
99
+ const hasVbc = hasVbcBlock(content);
100
+
101
+ if (hasTribunal && hasVbc) {
102
+ skip(`${skillName} โ€” already has Tribunal + VBC blocks`);
103
+ return "skipped";
104
+ }
105
+
106
+ const missing = [];
107
+ if (!hasTribunal) missing.push("Tribunal Integration");
108
+ if (!hasVbc) missing.push("VBC Protocol");
109
+
110
+ if (dryRun) {
111
+ warn(`[DRY RUN] ${skillName} โ€” would add: ${missing.join(", ")}`);
112
+ return "updated";
113
+ }
114
+
115
+ fs.appendFileSync(skillMd, GUARDRAILS_BLOCK, "utf8");
116
+ ok(`${skillName} โ€” strengthened (${missing.join(", ")} added)`);
117
+ return "updated";
118
+ } catch (e) {
119
+ fail(`${skillName} โ€” ${e.message}`);
120
+ return "error";
121
+ }
122
+ }
123
+
124
+ function main() {
125
+ const args = process.argv.slice(2);
126
+ let targetPath = ".";
127
+ let dryRun = false;
128
+ let skillArg = null;
129
+ let skillsPathArg = null;
130
+
131
+ let i = 0;
132
+ while (i < args.length) {
133
+ if (args[i] === "--dry-run") {
134
+ dryRun = true;
135
+ } else if (args[i] === "--skill" && i + 1 < args.length) {
136
+ skillArg = args[++i];
137
+ } else if (args[i] === "--skills-path" && i + 1 < args.length) {
138
+ skillsPathArg = args[++i];
139
+ } else if (args[i] === "-h" || args[i] === "--help") {
140
+ console.log(
141
+ "Usage: node strengthen_skills.js <path> [--dry-run] [--skill <name>] [--skills-path <path>]",
142
+ );
143
+ process.exit(0);
144
+ } else if (!args[i].startsWith("-")) {
145
+ targetPath = args[i];
146
+ }
147
+ i++;
148
+ }
149
+
150
+ const projectRoot = path.resolve(targetPath);
151
+ let skillsDir;
152
+ if (skillsPathArg) {
153
+ skillsDir = path.resolve(skillsPathArg);
154
+ } else {
155
+ skillsDir = path.join(projectRoot, ".agent", "skills");
156
+ }
157
+
158
+ if (!fs.existsSync(skillsDir) || !fs.statSync(skillsDir).isDirectory()) {
159
+ fail(`Skills directory not found: ${skillsDir}`);
160
+ process.exit(1);
161
+ }
162
+
163
+ console.log(`${BOLD}Tribunal โ€” strengthen_skills.js${RESET}`);
164
+ if (dryRun)
165
+ console.log(` ${YELLOW}DRY RUN โ€” no files will be written${RESET}`);
166
+ console.log(`Skills dir: ${skillsDir}\n`);
167
+
168
+ const counts = { updated: 0, skipped: 0, error: 0 };
169
+ header("Strengthening Skills");
170
+
171
+ const dirs = fs.readdirSync(skillsDir, { withFileTypes: true });
172
+ dirs.sort((a, b) => a.name.localeCompare(b.name));
173
+
174
+ for (const dir of dirs) {
175
+ if (!dir.isDirectory()) continue;
176
+ if (skillArg && dir.name !== skillArg) continue;
177
+
178
+ const skillMd = path.join(skillsDir, dir.name, "SKILL.md");
179
+ if (!fs.existsSync(skillMd)) {
180
+ warn(`${dir.name} โ€” no SKILL.md found`);
181
+ continue;
182
+ }
183
+
184
+ const result = processSkill(skillMd, dryRun);
185
+ counts[result]++;
186
+ }
187
+
188
+ console.log(`\n${BOLD}โ”โ”โ” Summary โ”โ”โ”${RESET}`);
189
+ console.log(` ${GREEN}โœ… Strengthened: ${counts.updated}${RESET}`);
190
+ console.log(` ${YELLOW}โญ๏ธ Skipped: ${counts.skipped}${RESET}`);
191
+ if (counts.error > 0) {
192
+ console.log(` ${RED}โŒ Errors: ${counts.error}${RESET}`);
193
+ }
194
+ if (dryRun) {
195
+ console.log(` ${YELLOW}(dry-run โ€” nothing written)${RESET}`);
196
+ }
197
+
198
+ process.exit(counts.error > 0 ? 1 : 0);
199
+ }
200
+
201
+ if (require.main === module) {
202
+ main();
203
+ }