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
@@ -8,179 +8,221 @@
8
8
  * node .agent/scripts/lint_runner.js . --files src/index.ts src/utils.ts
9
9
  */
10
10
 
11
- 'use strict';
11
+ "use strict";
12
12
 
13
- const fs = require('fs');
14
- const path = require('path');
15
- const { spawnSync } = require('child_process');
13
+ const fs = require("fs");
14
+ const path = require("path");
15
+ const { spawnSync } = require("child_process");
16
16
 
17
17
  const {
18
- RED, GREEN, YELLOW, BLUE, BOLD, DIM, CYAN, RESET,
19
- banner, sectionHeader, summaryTable, timer, formatMs,
20
- ok, fail, skip,
21
- } = require('./_colors');
18
+ RED,
19
+ GREEN,
20
+ BOLD,
21
+ DIM,
22
+ CYAN,
23
+ RESET,
24
+ banner,
25
+ sectionHeader,
26
+ summaryTable,
27
+ timer,
28
+ formatMs,
29
+ ok,
30
+ fail,
31
+ skip,
32
+ } = require("./_colors");
22
33
 
23
34
  const RESULTS = [];
24
35
 
25
36
  function runLinter(label, cmd, cwd) {
26
- const elapsed = timer();
27
- try {
28
- const executable = process.platform === 'win32' && cmd[0] === 'npx' ? 'npx.cmd' : cmd[0];
29
- const result = spawnSync(executable, cmd.slice(1), {
30
- cwd,
31
- encoding: 'utf8',
32
- timeout: 120000,
33
- shell: process.platform === 'win32'
34
- });
35
-
36
- const ms = elapsed();
37
- if (result.status === 0) {
38
- ok(`${label} clean ${DIM}(${formatMs(ms)})${RESET}`);
39
- RESULTS.push({ name: label, status: 'pass', ms });
40
- return true;
41
- }
42
-
43
- fail(`${label} — issues found ${DIM}(${formatMs(ms)})${RESET}`);
44
- RESULTS.push({ name: label, status: 'fail', ms });
45
- if (result.error) {
46
- console.log(` Error: ${result.error.message}`);
47
- }
48
- const out = result.stdout ? result.stdout.toString() : '';
49
- const err = result.stderr ? result.stderr.toString() : '';
50
- const output = (out + "\n" + err).trim();
51
- if (output) {
52
- const lines = output.split('\n');
53
- for (const line of lines.slice(0, 15)) {
54
- console.log(` ${line}`);
55
- }
56
- if (lines.length > 15) {
57
- console.log(` ... and ${lines.length - 15} more lines`);
58
- }
59
- }
60
- return false;
61
- } catch {
62
- skip(`${label} — tool not installed`);
63
- RESULTS.push({ name: label, status: 'skip' });
64
- return true;
37
+ const elapsed = timer();
38
+ try {
39
+ const executable =
40
+ process.platform === "win32" && cmd[0] === "npx" ? "npx.cmd" : cmd[0];
41
+ const result = spawnSync(executable, cmd.slice(1), {
42
+ cwd,
43
+ encoding: "utf8",
44
+ timeout: 120000,
45
+ shell: process.platform === "win32",
46
+ });
47
+
48
+ const ms = elapsed();
49
+ if (result.status === 0) {
50
+ ok(`${label} clean ${DIM}(${formatMs(ms)})${RESET}`);
51
+ RESULTS.push({ name: label, status: "pass", ms });
52
+ return true;
65
53
  }
66
- }
67
54
 
68
- function detectLinters(projectRoot) {
69
- const available = {};
70
- const pkgJson = path.join(projectRoot, "package.json");
71
-
72
- if (fs.existsSync(pkgJson)) {
73
- const eslintFiles = [".eslintrc", ".eslintrc.js", ".eslintrc.json", ".eslintrc.yml", "eslint.config.js", "eslint.config.mjs"];
74
- available.eslint = eslintFiles.some(f => fs.existsSync(path.join(projectRoot, f)));
75
-
76
- const prettierFiles = [".prettierrc", ".prettierrc.js", ".prettierrc.json", "prettier.config.js"];
77
- available.prettier = prettierFiles.some(f => fs.existsSync(path.join(projectRoot, f)));
55
+ fail(`${label} — issues found ${DIM}(${formatMs(ms)})${RESET}`);
56
+ RESULTS.push({ name: label, status: "fail", ms });
57
+ if (result.error) {
58
+ console.log(` Error: ${result.error.message}`);
78
59
  }
60
+ const out = result.stdout ? result.stdout.toString() : "";
61
+ const err = result.stderr ? result.stderr.toString() : "";
62
+ const output = (out + "\n" + err).trim();
63
+ if (output) {
64
+ const lines = output.split("\n");
65
+ for (const line of lines.slice(0, 15)) {
66
+ console.log(` ${line}`);
67
+ }
68
+ if (lines.length > 15) {
69
+ console.log(` ... and ${lines.length - 15} more lines`);
70
+ }
71
+ }
72
+ return false;
73
+ } catch {
74
+ skip(`${label} — tool not installed`);
75
+ RESULTS.push({ name: label, status: "skip" });
76
+ return true;
77
+ }
78
+ }
79
79
 
80
- available.ruff = fs.existsSync(path.join(projectRoot, "pyproject.toml")) || fs.existsSync(path.join(projectRoot, "ruff.toml"));
81
- available.flake8 = fs.existsSync(path.join(projectRoot, ".flake8")) || fs.existsSync(path.join(projectRoot, "setup.cfg"));
82
-
83
- return available;
80
+ function detectLinters(projectRoot) {
81
+ const available = {};
82
+ const pkgJson = path.join(projectRoot, "package.json");
83
+
84
+ if (fs.existsSync(pkgJson)) {
85
+ const eslintFiles = [
86
+ ".eslintrc",
87
+ ".eslintrc.js",
88
+ ".eslintrc.json",
89
+ ".eslintrc.yml",
90
+ "eslint.config.js",
91
+ "eslint.config.mjs",
92
+ ];
93
+ available.eslint = eslintFiles.some((f) =>
94
+ fs.existsSync(path.join(projectRoot, f)),
95
+ );
96
+
97
+ const prettierFiles = [
98
+ ".prettierrc",
99
+ ".prettierrc.js",
100
+ ".prettierrc.json",
101
+ "prettier.config.js",
102
+ ];
103
+ available.prettier = prettierFiles.some((f) =>
104
+ fs.existsSync(path.join(projectRoot, f)),
105
+ );
106
+ }
107
+
108
+ available.ruff =
109
+ fs.existsSync(path.join(projectRoot, "pyproject.toml")) ||
110
+ fs.existsSync(path.join(projectRoot, "ruff.toml"));
111
+ available.flake8 =
112
+ fs.existsSync(path.join(projectRoot, ".flake8")) ||
113
+ fs.existsSync(path.join(projectRoot, "setup.cfg"));
114
+
115
+ return available;
84
116
  }
85
117
 
86
118
  function main() {
87
- const args = process.argv.slice(2);
88
- let targetPath = null;
89
- let fixFlag = false;
90
- let fileArgs = [];
91
-
92
- let i = 0;
93
- while (i < args.length) {
94
- if (args[i] === '--fix') fixFlag = true;
95
- else if (args[i] === '--files') {
96
- i++;
97
- while (i < args.length && !args[i].startsWith('--')) {
98
- fileArgs.push(args[i++]);
99
- }
100
- continue;
101
- } else if (!targetPath && !args[i].startsWith('-')) {
102
- targetPath = args[i];
103
- }
104
- i++;
105
- }
106
-
107
- if (!targetPath) {
108
- console.log("Usage: node lint_runner.js <path> [--fix] [--files <file1> <file2> ...]");
109
- process.exit(1);
119
+ const args = process.argv.slice(2);
120
+ let targetPath = null;
121
+ let fixFlag = false;
122
+ let fileArgs = [];
123
+
124
+ let i = 0;
125
+ while (i < args.length) {
126
+ if (args[i] === "--fix") fixFlag = true;
127
+ else if (args[i] === "--files") {
128
+ i++;
129
+ while (i < args.length && !args[i].startsWith("--")) {
130
+ fileArgs.push(args[i++]);
131
+ }
132
+ continue;
133
+ } else if (!targetPath && !args[i].startsWith("-")) {
134
+ targetPath = args[i];
110
135
  }
111
-
112
- const projectRoot = path.resolve(targetPath);
113
- if (!fs.existsSync(projectRoot) || !fs.statSync(projectRoot).isDirectory()) {
114
- fail(`Directory not found: ${projectRoot}`);
115
- process.exit(1);
116
- }
117
-
118
- console.log(banner('lint_runner.js', { Project: projectRoot, Mode: fixFlag ? 'fix' : 'check' }));
119
-
120
- const available = detectLinters(projectRoot);
121
- if (!Object.values(available).some(Boolean)) {
122
- skip("No linter configuration detected in this project");
123
- process.exit(0);
124
- }
125
-
126
- RESULTS.length = 0;
127
- let failures = 0;
128
-
129
- if (available.eslint) {
130
- console.log(sectionHeader('ESLint'));
131
- const cmd = ["npx", "eslint"];
132
- if (fixFlag) cmd.push("--fix");
133
- if (fileArgs.length) cmd.push(...fileArgs);
134
- else cmd.push(".", "--max-warnings=0");
135
- if (!runLinter("ESLint", cmd, projectRoot)) failures++;
136
- }
137
-
138
- if (available.prettier) {
139
- console.log(sectionHeader('Prettier'));
140
- const cmd = ["npx", "prettier"];
141
- if (fixFlag) cmd.push("--write");
142
- else cmd.push("--check");
143
- if (fileArgs.length) cmd.push(...fileArgs);
144
- else cmd.push(".");
145
- if (!runLinter("Prettier", cmd, projectRoot)) failures++;
146
- }
147
-
148
- if (available.ruff) {
149
- console.log(sectionHeader('Ruff (Python)'));
150
- const cmd = ["ruff", "check"];
151
- if (fixFlag) cmd.push("--fix");
152
- if (fileArgs.length) cmd.push(...fileArgs);
153
- else cmd.push(".");
154
- if (!runLinter("Ruff", cmd, projectRoot)) failures++;
155
- }
156
-
157
- if (available.flake8 && !available.ruff) {
158
- console.log(sectionHeader('Flake8 (Python)'));
159
- const cmd = ["flake8"];
160
- if (fileArgs.length) cmd.push(...fileArgs);
161
- else cmd.push(".");
162
- if (!runLinter("Flake8", cmd, projectRoot)) failures++;
163
- }
164
-
165
- if (fs.existsSync(path.join(projectRoot, "tsconfig.json"))) {
166
- console.log(sectionHeader('TypeScript'));
167
- if (!runLinter("TypeScript", ["npx", "tsc", "--noEmit"], projectRoot)) failures++;
168
- }
169
-
170
- console.log(`\n${BOLD}${CYAN}━━━ Lint Summary ━━━${RESET}`);
171
- if (RESULTS.length > 0) {
172
- summaryTable(RESULTS);
173
- }
174
-
175
- if (failures === 0) {
176
- console.log(`\n${GREEN}${BOLD} ✔ All linters passed.${RESET}\n`);
177
- } else {
178
- console.log(`\n${RED}${BOLD} ✖ ${failures} linter(s) reported issues.${RESET}\n`);
179
- }
180
-
181
- process.exit(failures > 0 ? 1 : 0);
136
+ i++;
137
+ }
138
+
139
+ if (!targetPath) {
140
+ console.log(
141
+ "Usage: node lint_runner.js <path> [--fix] [--files <file1> <file2> ...]",
142
+ );
143
+ process.exit(1);
144
+ }
145
+
146
+ const projectRoot = path.resolve(targetPath);
147
+ if (!fs.existsSync(projectRoot) || !fs.statSync(projectRoot).isDirectory()) {
148
+ fail(`Directory not found: ${projectRoot}`);
149
+ process.exit(1);
150
+ }
151
+
152
+ console.log(
153
+ banner("lint_runner.js", {
154
+ Project: projectRoot,
155
+ Mode: fixFlag ? "fix" : "check",
156
+ }),
157
+ );
158
+
159
+ const available = detectLinters(projectRoot);
160
+ if (!Object.values(available).some(Boolean)) {
161
+ skip("No linter configuration detected in this project");
162
+ process.exit(0);
163
+ }
164
+
165
+ RESULTS.length = 0;
166
+ let failures = 0;
167
+
168
+ if (available.eslint) {
169
+ console.log(sectionHeader("ESLint"));
170
+ const cmd = ["npx", "eslint"];
171
+ if (fixFlag) cmd.push("--fix");
172
+ if (fileArgs.length) cmd.push(...fileArgs);
173
+ else cmd.push(".", "--max-warnings=0");
174
+ if (!runLinter("ESLint", cmd, projectRoot)) failures++;
175
+ }
176
+
177
+ if (available.prettier) {
178
+ console.log(sectionHeader("Prettier"));
179
+ const cmd = ["npx", "prettier"];
180
+ if (fixFlag) cmd.push("--write");
181
+ else cmd.push("--check");
182
+ if (fileArgs.length) cmd.push(...fileArgs);
183
+ else cmd.push(".");
184
+ if (!runLinter("Prettier", cmd, projectRoot)) failures++;
185
+ }
186
+
187
+ if (available.ruff) {
188
+ console.log(sectionHeader("Ruff (Python)"));
189
+ const cmd = ["ruff", "check"];
190
+ if (fixFlag) cmd.push("--fix");
191
+ if (fileArgs.length) cmd.push(...fileArgs);
192
+ else cmd.push(".");
193
+ if (!runLinter("Ruff", cmd, projectRoot)) failures++;
194
+ }
195
+
196
+ if (available.flake8 && !available.ruff) {
197
+ console.log(sectionHeader("Flake8 (Python)"));
198
+ const cmd = ["flake8"];
199
+ if (fileArgs.length) cmd.push(...fileArgs);
200
+ else cmd.push(".");
201
+ if (!runLinter("Flake8", cmd, projectRoot)) failures++;
202
+ }
203
+
204
+ if (fs.existsSync(path.join(projectRoot, "tsconfig.json"))) {
205
+ console.log(sectionHeader("TypeScript"));
206
+ if (!runLinter("TypeScript", ["npx", "tsc", "--noEmit"], projectRoot))
207
+ failures++;
208
+ }
209
+
210
+ console.log(`\n${BOLD}${CYAN}━━━ Lint Summary ━━━${RESET}`);
211
+ if (RESULTS.length > 0) {
212
+ summaryTable(RESULTS);
213
+ }
214
+
215
+ if (failures === 0) {
216
+ console.log(`\n${GREEN}${BOLD} ✔ All linters passed.${RESET}\n`);
217
+ } else {
218
+ console.log(
219
+ `\n${RED}${BOLD} ✖ ${failures} linter(s) reported issues.${RESET}\n`,
220
+ );
221
+ }
222
+
223
+ process.exit(failures > 0 ? 1 : 0);
182
224
  }
183
225
 
184
226
  if (require.main === module) {
185
- main();
227
+ main();
186
228
  }