tribunal-kit 5.7.0 → 5.8.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.
- package/.agent/ARCHITECTURE.md +6 -7
- package/.agent/agents/frontend-reviewer.md +13 -0
- package/.agent/agents/frontend-specialist.md +14 -0
- package/.agent/agents/logic-reviewer.md +11 -0
- package/.agent/agents/orchestrator.md +15 -0
- package/.agent/agents/security-auditor.md +13 -0
- package/.agent/agents/ui-ux-auditor.md +7 -31
- package/.agent/history/memory/.memory.idx +766 -0
- package/.agent/history/memory/MEMORY.md +62 -0
- package/.agent/routing_index.json +694 -714
- package/.agent/rules/GEMINI.md +58 -8
- package/.agent/scripts/_colors.js +131 -89
- package/.agent/scripts/_utils.js +163 -128
- package/.agent/scripts/auto_preview.js +207 -197
- package/.agent/scripts/bundle_analyzer.js +227 -192
- package/.agent/scripts/case_law_manager.js +991 -689
- package/.agent/scripts/checklist.js +233 -190
- package/.agent/scripts/context_broker.js +930 -605
- package/.agent/scripts/dependency_analyzer.js +275 -184
- package/.agent/scripts/graph_builder.js +412 -341
- package/.agent/scripts/graph_visualizer.js +392 -390
- package/.agent/scripts/graph_zoom.js +198 -156
- package/.agent/scripts/inner_loop_validator.js +523 -445
- package/.agent/scripts/lint_runner.js +199 -157
- package/.agent/scripts/marathon_harness.js +819 -661
- package/.agent/scripts/minify_context.js +115 -100
- package/.agent/scripts/mutation_runner.js +321 -280
- package/.agent/scripts/prompt_compiler.js +62 -42
- package/.agent/scripts/schema_validator.js +373 -280
- package/.agent/scripts/security_scan.js +333 -190
- package/.agent/scripts/session_manager.js +306 -270
- package/.agent/scripts/skill_evolution.js +810 -637
- package/.agent/scripts/skill_integrator.js +327 -307
- package/.agent/scripts/strengthen_skills.js +203 -193
- package/.agent/scripts/swarm_dispatcher.js +558 -457
- package/.agent/scripts/test_runner.js +178 -152
- package/.agent/scripts/verify_all.js +200 -168
- package/.agent/skills/fabel-protocol/SKILL.md +235 -0
- package/.agent/skills/thinking-protocol/SKILL.md +27 -0
- package/.agent/workflows/generate.md +1 -1
- package/.agent/workflows/tribunal-speed.md +1 -1
- package/README.md +53 -53
- package/bin/mcp-server.js +460 -175
- package/bin/tribunal-kit.js +1245 -987
- package/bin/wrapper.js +104 -74
- package/dist/cli.js +31 -0
- package/dist/commands/case.js +23 -0
- package/dist/commands/compile.js +84 -0
- package/dist/commands/init.js +42 -0
- package/dist/commands/learn.js +57 -0
- package/dist/commands/memory.js +456 -0
- package/package.json +2 -2
- package/scripts/benchmark.js +162 -125
- package/scripts/changelog.js +196 -168
- package/scripts/sync-version.js +94 -81
- 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
|
-
|
|
11
|
+
"use strict";
|
|
12
12
|
|
|
13
|
-
const fs = require(
|
|
14
|
-
const path = require(
|
|
15
|
-
const { spawnSync } = require(
|
|
13
|
+
const fs = require("fs");
|
|
14
|
+
const path = require("path");
|
|
15
|
+
const { spawnSync } = require("child_process");
|
|
16
16
|
|
|
17
17
|
const {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
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
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
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
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
if (
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
if (
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
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
|
-
|
|
227
|
+
main();
|
|
186
228
|
}
|