tribunal-kit 4.6.1 → 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 +61 -47
- package/bin/mcp-server.js +476 -121
- package/bin/tribunal-kit.js +1245 -987
- package/bin/wrapper.js +104 -73
- package/dist/cli.js +265 -0
- package/dist/commands/case.js +71 -0
- package/dist/commands/compile.js +84 -0
- package/dist/commands/context.js +66 -0
- package/dist/commands/graph.js +38 -0
- package/dist/commands/hook.js +28 -0
- package/dist/commands/init.js +339 -0
- package/dist/commands/learn.js +117 -0
- package/dist/commands/marathon.js +45 -0
- package/dist/commands/memory.js +456 -0
- package/dist/commands/mutate.js +30 -0
- package/dist/commands/status.js +35 -0
- package/dist/commands/sync.js +25 -0
- package/dist/commands/uninstall.js +42 -0
- package/dist/commands/update.js +37 -0
- package/dist/mcp/server.js +142 -0
- package/dist/types.js +8 -0
- package/dist/utils/fs.js +96 -0
- package/dist/utils/hasher.js +142 -0
- package/dist/utils/helpers.js +68 -0
- package/dist/utils/logger.js +54 -0
- package/dist/utils/version.js +150 -0
- package/package.json +3 -2
- package/scripts/benchmark.js +197 -0
- package/scripts/changelog.js +196 -168
- package/scripts/sync-version.js +94 -81
- package/scripts/validate-payload.js +85 -78
package/scripts/sync-version.js
CHANGED
|
@@ -1,81 +1,94 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* sync-version.js — Version Sync for Tribunal Kit
|
|
4
|
-
*
|
|
5
|
-
* Reads the version and counts from package.json and the .agent/ directory,
|
|
6
|
-
* then updates all stale references across documentation files.
|
|
7
|
-
*
|
|
8
|
-
* Run manually or as a preversion npm script:
|
|
9
|
-
* node scripts/sync-version.js
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
const fs = require(
|
|
13
|
-
const path = require(
|
|
14
|
-
|
|
15
|
-
const ROOT = path.resolve(__dirname,
|
|
16
|
-
const PKG = JSON.parse(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
console.log(
|
|
34
|
-
console.log(`
|
|
35
|
-
console.log(`
|
|
36
|
-
console.log(`
|
|
37
|
-
console.log();
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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
|
-
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* sync-version.js — Version Sync for Tribunal Kit
|
|
4
|
+
*
|
|
5
|
+
* Reads the version and counts from package.json and the .agent/ directory,
|
|
6
|
+
* then updates all stale references across documentation files.
|
|
7
|
+
*
|
|
8
|
+
* Run manually or as a preversion npm script:
|
|
9
|
+
* node scripts/sync-version.js
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
const fs = require("fs");
|
|
13
|
+
const path = require("path");
|
|
14
|
+
|
|
15
|
+
const ROOT = path.resolve(__dirname, "..");
|
|
16
|
+
const PKG = JSON.parse(
|
|
17
|
+
fs.readFileSync(path.join(ROOT, "package.json"), "utf8"),
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
// Count actual installed items
|
|
21
|
+
function countItems(dir) {
|
|
22
|
+
const fullPath = path.join(ROOT, ".agent", dir);
|
|
23
|
+
if (!fs.existsSync(fullPath)) return "?";
|
|
24
|
+
return fs.readdirSync(fullPath).filter((f) => !f.startsWith(".")).length;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const version = PKG.version;
|
|
28
|
+
const agents = countItems("agents");
|
|
29
|
+
const skills = countItems("skills");
|
|
30
|
+
const workflows = countItems("workflows");
|
|
31
|
+
const scripts = countItems("scripts");
|
|
32
|
+
|
|
33
|
+
console.log(`\n 📊 Tribunal Kit v${version} — Actual Counts`);
|
|
34
|
+
console.log(` ──────────────────────────────────────`);
|
|
35
|
+
console.log(` Agents: ${agents}`);
|
|
36
|
+
console.log(` Skills: ${skills}`);
|
|
37
|
+
console.log(` Workflows: ${workflows}`);
|
|
38
|
+
console.log(` Scripts: ${scripts}`);
|
|
39
|
+
console.log();
|
|
40
|
+
|
|
41
|
+
// Files to check for stale numbers
|
|
42
|
+
const FILES_TO_CHECK = ["README.md", "AGENT_FLOW.md", ".agent/ARCHITECTURE.md"];
|
|
43
|
+
|
|
44
|
+
let staleFound = 0;
|
|
45
|
+
|
|
46
|
+
for (const relPath of FILES_TO_CHECK) {
|
|
47
|
+
const filePath = path.join(ROOT, relPath);
|
|
48
|
+
if (!fs.existsSync(filePath)) continue;
|
|
49
|
+
|
|
50
|
+
const content = fs.readFileSync(filePath, "utf8");
|
|
51
|
+
|
|
52
|
+
// Check for common stale patterns
|
|
53
|
+
const checks = [
|
|
54
|
+
{
|
|
55
|
+
regex: /(\d+)\s*(specialist\s+)?agents/gi,
|
|
56
|
+
expected: agents,
|
|
57
|
+
label: "agents",
|
|
58
|
+
},
|
|
59
|
+
{ regex: /(\d+)\s*skill\s*modules/gi, expected: skills, label: "skills" },
|
|
60
|
+
{
|
|
61
|
+
regex: /(\d+)\s*slash\s*command/gi,
|
|
62
|
+
expected: workflows,
|
|
63
|
+
label: "workflows",
|
|
64
|
+
},
|
|
65
|
+
];
|
|
66
|
+
|
|
67
|
+
for (const check of checks) {
|
|
68
|
+
let match;
|
|
69
|
+
while ((match = check.regex.exec(content)) !== null) {
|
|
70
|
+
const found = parseInt(match[1]);
|
|
71
|
+
if (found !== check.expected && found > 5) {
|
|
72
|
+
// ignore tiny numbers
|
|
73
|
+
staleFound++;
|
|
74
|
+
const line = content.substring(0, match.index).split("\n").length;
|
|
75
|
+
console.log(
|
|
76
|
+
` ⚠️ ${relPath}:${line} — says ${found} ${check.label}, actual is ${check.expected}`,
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (staleFound === 0) {
|
|
84
|
+
console.log(
|
|
85
|
+
` ✅ All counts are in sync across ${FILES_TO_CHECK.length} files.`,
|
|
86
|
+
);
|
|
87
|
+
} else {
|
|
88
|
+
console.log(
|
|
89
|
+
`\n ❌ Found ${staleFound} stale reference(s). Update manually or run the sync tool.`,
|
|
90
|
+
);
|
|
91
|
+
process.exit(1);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
console.log();
|
|
@@ -1,78 +1,85 @@
|
|
|
1
|
-
const fs = require(
|
|
2
|
-
const path = require(
|
|
3
|
-
|
|
4
|
-
// Simple Markdown frontmatter and Tribunal header validator
|
|
5
|
-
function validateMarkdownFile(filePath) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
1
|
+
const fs = require("fs");
|
|
2
|
+
const path = require("path");
|
|
3
|
+
|
|
4
|
+
// Simple Markdown frontmatter and Tribunal header validator
|
|
5
|
+
function validateMarkdownFile(filePath) {
|
|
6
|
+
let content;
|
|
7
|
+
try {
|
|
8
|
+
content = fs.readFileSync(filePath, "utf8");
|
|
9
|
+
} catch (e) {
|
|
10
|
+
return [`Failed to read file: ${e.message}`];
|
|
11
|
+
}
|
|
12
|
+
let errors = [];
|
|
13
|
+
|
|
14
|
+
// Check for frontmatter
|
|
15
|
+
if (content.startsWith("---")) {
|
|
16
|
+
const parts = content.split("---");
|
|
17
|
+
if (parts.length < 3) {
|
|
18
|
+
errors.push("Malformed YAML frontmatter (missing closing ---)");
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// If it's a skill, check for mandatory headers
|
|
23
|
+
if (filePath.includes("/skills/") || filePath.includes("\\skills\\")) {
|
|
24
|
+
// Exclude templates and documentation that aren't strict skills
|
|
25
|
+
if (!filePath.includes("SKILL.md")) return errors;
|
|
26
|
+
|
|
27
|
+
if (
|
|
28
|
+
!content.includes("Pre-Flight Checklist") &&
|
|
29
|
+
!content.includes("Pre-Flight")
|
|
30
|
+
) {
|
|
31
|
+
errors.push("Missing mandatory header/section: Pre-Flight Checklist");
|
|
32
|
+
}
|
|
33
|
+
if (!content.includes("VBC Protocol") && !content.includes("VBC")) {
|
|
34
|
+
errors.push("Missing mandatory header/section: VBC Protocol");
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return errors;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function walkDir(dir, callback) {
|
|
42
|
+
fs.readdirSync(dir).forEach((f) => {
|
|
43
|
+
let dirPath = path.join(dir, f);
|
|
44
|
+
let isDirectory = fs.statSync(dirPath).isDirectory();
|
|
45
|
+
isDirectory ? walkDir(dirPath, callback) : callback(path.join(dir, f));
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function run() {
|
|
50
|
+
const agentDir = path.join(__dirname, "..", ".agent");
|
|
51
|
+
if (!fs.existsSync(agentDir)) {
|
|
52
|
+
console.error("No .agent directory found.");
|
|
53
|
+
process.exit(1);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
let hasErrors = false;
|
|
57
|
+
let checkedCount = 0;
|
|
58
|
+
|
|
59
|
+
console.log("Validating .agent payload...");
|
|
60
|
+
|
|
61
|
+
walkDir(agentDir, function (filePath) {
|
|
62
|
+
if (filePath.endsWith(".md")) {
|
|
63
|
+
checkedCount++;
|
|
64
|
+
const errors = validateMarkdownFile(filePath);
|
|
65
|
+
if (errors.length > 0) {
|
|
66
|
+
console.error(`\x1b[31m[FAIL]\x1b[0m ${filePath}`);
|
|
67
|
+
errors.forEach((e) => console.error(` - ${e}`));
|
|
68
|
+
hasErrors = true;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
if (hasErrors) {
|
|
74
|
+
console.error(
|
|
75
|
+
`\nPayload validation failed. Checked ${checkedCount} files.`,
|
|
76
|
+
);
|
|
77
|
+
process.exit(1);
|
|
78
|
+
} else {
|
|
79
|
+
console.log(
|
|
80
|
+
`\x1b[32mPayload validation passed.\x1b[0m Checked ${checkedCount} files.`,
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
run();
|