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
|
@@ -1,197 +1,207 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* auto_preview.js — Start, stop, or check a local development server.
|
|
4
|
-
*
|
|
5
|
-
* Usage:
|
|
6
|
-
* node .agent/scripts/auto_preview.js start
|
|
7
|
-
* node .agent/scripts/auto_preview.js stop
|
|
8
|
-
* node .agent/scripts/auto_preview.js status
|
|
9
|
-
* node .agent/scripts/auto_preview.js restart
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const fs = require(
|
|
15
|
-
const path = require(
|
|
16
|
-
const { spawn } = require(
|
|
17
|
-
const net = require(
|
|
18
|
-
|
|
19
|
-
const PID_FILE = ".preview.pid";
|
|
20
|
-
const DEFAULT_PORT = 3000;
|
|
21
|
-
const TIMEOUT_SECONDS = 30;
|
|
22
|
-
|
|
23
|
-
const { GREEN, RED, YELLOW, BOLD, RESET } = require(
|
|
24
|
-
|
|
25
|
-
function findStartCommand() {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function getPortFromEnv() {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
function isPortOpen(port) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
function
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
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
|
-
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
if (
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* auto_preview.js — Start, stop, or check a local development server.
|
|
4
|
+
*
|
|
5
|
+
* Usage:
|
|
6
|
+
* node .agent/scripts/auto_preview.js start
|
|
7
|
+
* node .agent/scripts/auto_preview.js stop
|
|
8
|
+
* node .agent/scripts/auto_preview.js status
|
|
9
|
+
* node .agent/scripts/auto_preview.js restart
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
"use strict";
|
|
13
|
+
|
|
14
|
+
const fs = require("fs");
|
|
15
|
+
const path = require("path");
|
|
16
|
+
const { spawn } = require("child_process");
|
|
17
|
+
const net = require("net");
|
|
18
|
+
|
|
19
|
+
const PID_FILE = ".preview.pid";
|
|
20
|
+
const DEFAULT_PORT = 3000;
|
|
21
|
+
const TIMEOUT_SECONDS = 30;
|
|
22
|
+
|
|
23
|
+
const { GREEN, RED, YELLOW, BOLD, RESET } = require("./colors.js");
|
|
24
|
+
|
|
25
|
+
function findStartCommand() {
|
|
26
|
+
const pkgPath = path.resolve("package.json");
|
|
27
|
+
if (!fs.existsSync(pkgPath)) return { cmd: [], found: false };
|
|
28
|
+
|
|
29
|
+
try {
|
|
30
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
|
|
31
|
+
const scripts = pkg.scripts || {};
|
|
32
|
+
if (scripts.dev) return { cmd: ["npm", "run", "dev"], found: true };
|
|
33
|
+
if (scripts.start) return { cmd: ["npm", "run", "start"], found: true };
|
|
34
|
+
} catch {
|
|
35
|
+
// Ignore
|
|
36
|
+
}
|
|
37
|
+
return { cmd: [], found: false };
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function getPortFromEnv() {
|
|
41
|
+
const envPath = path.resolve(".env");
|
|
42
|
+
if (fs.existsSync(envPath)) {
|
|
43
|
+
try {
|
|
44
|
+
const data = fs.readFileSync(envPath, "utf8");
|
|
45
|
+
for (const line of data.split("\n")) {
|
|
46
|
+
if (line.trim().startsWith("PORT=")) {
|
|
47
|
+
return parseInt(line.split("=")[1].trim(), 10);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
} catch {}
|
|
51
|
+
}
|
|
52
|
+
return DEFAULT_PORT;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function isPortOpen(port) {
|
|
56
|
+
return new Promise((resolve) => {
|
|
57
|
+
const client = new net.Socket();
|
|
58
|
+
client.setTimeout(1000);
|
|
59
|
+
client
|
|
60
|
+
.once("connect", () => {
|
|
61
|
+
client.destroy();
|
|
62
|
+
resolve(true);
|
|
63
|
+
})
|
|
64
|
+
.once("timeout", () => {
|
|
65
|
+
client.destroy();
|
|
66
|
+
resolve(false);
|
|
67
|
+
})
|
|
68
|
+
.once("error", () => {
|
|
69
|
+
resolve(false);
|
|
70
|
+
})
|
|
71
|
+
.connect(port, "localhost");
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function readPid() {
|
|
76
|
+
if (fs.existsSync(PID_FILE)) {
|
|
77
|
+
try {
|
|
78
|
+
return parseInt(fs.readFileSync(PID_FILE, "utf8").trim(), 10);
|
|
79
|
+
} catch {}
|
|
80
|
+
}
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function writePid(pid) {
|
|
85
|
+
fs.writeFileSync(PID_FILE, String(pid), "utf8");
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function clearPid() {
|
|
89
|
+
if (fs.existsSync(PID_FILE)) {
|
|
90
|
+
fs.unlinkSync(PID_FILE);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
async function startServer() {
|
|
95
|
+
const port = getPortFromEnv();
|
|
96
|
+
|
|
97
|
+
if (await isPortOpen(port)) {
|
|
98
|
+
console.log(`${YELLOW}⚠️ Port ${port} is already in use.${RESET}`);
|
|
99
|
+
const pid = readPid();
|
|
100
|
+
if (pid) console.log(` Known PID: ${pid}`);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const { cmd, found } = findStartCommand();
|
|
105
|
+
if (!found) {
|
|
106
|
+
console.log(`${RED}❌ No dev/start script found.${RESET}`);
|
|
107
|
+
console.log(
|
|
108
|
+
` This project has no package.json, or its package.json has no 'dev' or 'start' script.`,
|
|
109
|
+
);
|
|
110
|
+
console.log(
|
|
111
|
+
` Add a script to package.json, or start your server manually.`,
|
|
112
|
+
);
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
console.log(`${BOLD}Starting: ${cmd.join(" ")}${RESET}`);
|
|
117
|
+
// Adjust command for windows (npm.cmd instead of npm)
|
|
118
|
+
const executable = process.platform === "win32" ? `${cmd[0]}.cmd` : cmd[0];
|
|
119
|
+
|
|
120
|
+
const proc = spawn(executable, cmd.slice(1), {
|
|
121
|
+
stdio: "pipe",
|
|
122
|
+
detached: true,
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
// Ignore children stdout inside detached mode to let node exit
|
|
126
|
+
proc.stdout.unref();
|
|
127
|
+
proc.stderr.unref();
|
|
128
|
+
proc.unref();
|
|
129
|
+
|
|
130
|
+
writePid(proc.pid);
|
|
131
|
+
|
|
132
|
+
process.stdout.write(`Waiting for port ${port}…`);
|
|
133
|
+
for (let i = 0; i < TIMEOUT_SECONDS; i++) {
|
|
134
|
+
if (await isPortOpen(port)) {
|
|
135
|
+
console.log(`\n${GREEN}✅ Server started${RESET}`);
|
|
136
|
+
console.log(` URL: http://localhost:${port}`);
|
|
137
|
+
console.log(` PID: ${proc.pid}`);
|
|
138
|
+
console.log(` Command: ${cmd.join(" ")}`);
|
|
139
|
+
console.log(`\nStop with: node .agent/scripts/auto_preview.js stop`);
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
process.stdout.write(".");
|
|
143
|
+
await new Promise((r) => setTimeout(r, 1000));
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
console.log(
|
|
147
|
+
`\n${RED}❌ Server did not start within ${TIMEOUT_SECONDS}s${RESET}`,
|
|
148
|
+
);
|
|
149
|
+
try {
|
|
150
|
+
process.kill(proc.pid, "SIGTERM");
|
|
151
|
+
} catch {}
|
|
152
|
+
clearPid();
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function stopServer() {
|
|
156
|
+
const pid = readPid();
|
|
157
|
+
if (!pid) {
|
|
158
|
+
console.log(`${YELLOW}⚠️ No stored server PID found${RESET}`);
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
try {
|
|
162
|
+
process.kill(pid, "SIGTERM");
|
|
163
|
+
console.log(`${GREEN}✅ Server stopped (PID ${pid})${RESET}`);
|
|
164
|
+
} catch {
|
|
165
|
+
console.log(`${YELLOW}Process ${pid} was not running${RESET}`);
|
|
166
|
+
} finally {
|
|
167
|
+
clearPid();
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
async function showStatus() {
|
|
172
|
+
const port = getPortFromEnv();
|
|
173
|
+
const pid = readPid();
|
|
174
|
+
if (await isPortOpen(port)) {
|
|
175
|
+
console.log(`${GREEN}🟢 Running — http://localhost:${port}${RESET}`);
|
|
176
|
+
if (pid) console.log(` PID: ${pid}`);
|
|
177
|
+
} else {
|
|
178
|
+
console.log(`${RED}🔴 Not running on port ${port}${RESET}`);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
async function main() {
|
|
183
|
+
const args = process.argv.slice(2);
|
|
184
|
+
const actions = new Set(["start", "stop", "status", "restart"]);
|
|
185
|
+
|
|
186
|
+
if (args.length < 1 || !actions.has(args[0])) {
|
|
187
|
+
console.log(`Usage: node auto_preview.js [start|stop|status|restart]`);
|
|
188
|
+
process.exit(1);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
const action = args[0];
|
|
192
|
+
if (action === "start") {
|
|
193
|
+
await startServer();
|
|
194
|
+
} else if (action === "stop") {
|
|
195
|
+
stopServer();
|
|
196
|
+
} else if (action === "status") {
|
|
197
|
+
await showStatus();
|
|
198
|
+
} else if (action === "restart") {
|
|
199
|
+
stopServer();
|
|
200
|
+
await new Promise((r) => setTimeout(r, 1000));
|
|
201
|
+
await startServer();
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
if (require.main === module) {
|
|
206
|
+
main();
|
|
207
|
+
}
|