tribunal-kit 4.2.0 → 4.3.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 +21 -14
- package/.agent/agents/swarm-worker-contracts.md +5 -5
- package/.agent/agents/ui-ux-auditor.md +292 -0
- package/.agent/rules/GEMINI.md +8 -8
- package/.agent/scripts/__pycache__/_colors.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/_utils.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/case_law_manager.cpython-311.pyc +0 -0
- package/.agent/scripts/_colors.js +18 -0
- package/.agent/scripts/_utils.js +42 -0
- package/.agent/scripts/auto_preview.js +197 -0
- package/.agent/scripts/bundle_analyzer.js +290 -0
- package/.agent/scripts/case_law_manager.js +684 -0
- package/.agent/scripts/checklist.js +266 -0
- package/.agent/scripts/colors.js +17 -0
- package/.agent/scripts/compress_skills.js +141 -0
- package/.agent/scripts/consolidate_skills.js +149 -0
- package/.agent/scripts/context_broker.js +609 -0
- package/.agent/scripts/deep_compress.js +150 -0
- package/.agent/scripts/dependency_analyzer.js +272 -0
- package/.agent/scripts/inner_loop_validator.js +465 -0
- package/.agent/scripts/lint_runner.js +187 -0
- package/.agent/scripts/minify_context.js +100 -0
- package/.agent/scripts/patch_skills_meta.js +156 -0
- package/.agent/scripts/patch_skills_output.js +244 -0
- package/.agent/scripts/schema_validator.js +297 -0
- package/.agent/scripts/security_scan.js +303 -0
- package/.agent/scripts/session_manager.js +276 -0
- package/.agent/scripts/skill_evolution.js +644 -0
- package/.agent/scripts/skill_integrator.js +313 -0
- package/.agent/scripts/strengthen_skills.js +193 -0
- package/.agent/scripts/strip_tribunal.js +47 -0
- package/.agent/scripts/swarm_dispatcher.js +360 -0
- package/.agent/scripts/test_runner.js +193 -0
- package/.agent/scripts/utils.js +32 -0
- package/.agent/scripts/verify_all.js +256 -0
- package/.agent/skills/agent-organizer/SKILL.md +3 -3
- package/.agent/skills/agentic-patterns/SKILL.md +3 -3
- package/.agent/skills/ai-prompt-injection-defense/SKILL.md +3 -3
- package/.agent/skills/api-patterns/SKILL.md +3 -3
- package/.agent/skills/api-security-auditor/SKILL.md +3 -3
- package/.agent/skills/app-builder/SKILL.md +3 -3
- package/.agent/skills/app-builder/templates/SKILL.md +1 -1
- package/.agent/skills/app-builder/templates/astro-static/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/chrome-extension/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/cli-tool/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/electron-desktop/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/express-api/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/flutter-app/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/nextjs-static/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/nuxt-app/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/python-fastapi/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/react-native-app/TEMPLATE.md +1 -1
- package/.agent/skills/appflow-wireframe/SKILL.md +3 -3
- package/.agent/skills/architecture/SKILL.md +3 -3
- package/.agent/skills/authentication-best-practices/SKILL.md +3 -3
- package/.agent/skills/bash-linux/SKILL.md +3 -3
- package/.agent/skills/behavioral-modes/SKILL.md +3 -3
- package/.agent/skills/brainstorming/SKILL.md +3 -3
- package/.agent/skills/building-native-ui/SKILL.md +3 -3
- package/.agent/skills/clean-code/SKILL.md +3 -3
- package/.agent/skills/code-review-checklist/SKILL.md +3 -3
- package/.agent/skills/config-validator/SKILL.md +3 -3
- package/.agent/skills/csharp-developer/SKILL.md +3 -3
- package/.agent/skills/data-validation-schemas/SKILL.md +3 -3
- package/.agent/skills/database-design/SKILL.md +3 -3
- package/.agent/skills/deployment-procedures/SKILL.md +3 -3
- package/.agent/skills/devops-engineer/SKILL.md +3 -3
- package/.agent/skills/devops-incident-responder/SKILL.md +3 -3
- package/.agent/skills/doc.md +1 -1
- package/.agent/skills/documentation-templates/SKILL.md +3 -3
- package/.agent/skills/edge-computing/SKILL.md +3 -3
- package/.agent/skills/error-resilience/SKILL.md +3 -3
- package/.agent/skills/extract-design-system/SKILL.md +3 -3
- package/.agent/skills/framer-motion-expert/SKILL.md +3 -4
- package/.agent/skills/frontend-design/SKILL.md +3 -3
- package/.agent/skills/game-design-expert/SKILL.md +3 -3
- package/.agent/skills/game-engineering-expert/SKILL.md +3 -3
- package/.agent/skills/geo-fundamentals/SKILL.md +3 -3
- package/.agent/skills/github-operations/SKILL.md +3 -3
- package/.agent/skills/gsap-core/SKILL.md +0 -2
- package/.agent/skills/gsap-frameworks/SKILL.md +0 -2
- package/.agent/skills/gsap-performance/SKILL.md +0 -2
- package/.agent/skills/gsap-plugins/SKILL.md +0 -2
- package/.agent/skills/gsap-react/SKILL.md +0 -2
- package/.agent/skills/gsap-scrolltrigger/SKILL.md +0 -2
- package/.agent/skills/gsap-timeline/SKILL.md +0 -2
- package/.agent/skills/gsap-utils/SKILL.md +0 -2
- package/.agent/skills/i18n-localization/SKILL.md +3 -3
- package/.agent/skills/intelligent-routing/SKILL.md +3 -3
- package/.agent/skills/lint-and-validate/SKILL.md +3 -3
- package/.agent/skills/llm-engineering/SKILL.md +3 -3
- package/.agent/skills/local-first/SKILL.md +3 -3
- package/.agent/skills/mcp-builder/SKILL.md +3 -3
- package/.agent/skills/mobile-design/SKILL.md +3 -3
- package/.agent/skills/monorepo-management/SKILL.md +3 -3
- package/.agent/skills/motion-engineering/SKILL.md +4 -4
- package/.agent/skills/nextjs-react-expert/SKILL.md +3 -3
- package/.agent/skills/nodejs-best-practices/SKILL.md +3 -3
- package/.agent/skills/observability/SKILL.md +3 -3
- package/.agent/skills/parallel-agents/SKILL.md +3 -3
- package/.agent/skills/performance-profiling/SKILL.md +3 -3
- package/.agent/skills/plan-writing/SKILL.md +3 -3
- package/.agent/skills/platform-engineer/SKILL.md +3 -3
- package/.agent/skills/playwright-best-practices/SKILL.md +3 -3
- package/.agent/skills/powershell-windows/SKILL.md +3 -3
- package/.agent/skills/project-idioms/SKILL.md +3 -3
- package/.agent/skills/python-patterns/SKILL.md +3 -3
- package/.agent/skills/python-pro/SKILL.md +3 -3
- package/.agent/skills/react-specialist/SKILL.md +3 -3
- package/.agent/skills/readme-builder/SKILL.md +3 -3
- package/.agent/skills/realtime-patterns/SKILL.md +3 -3
- package/.agent/skills/red-team-tactics/SKILL.md +3 -3
- package/.agent/skills/rust-pro/SKILL.md +3 -3
- package/.agent/skills/seo-fundamentals/SKILL.md +3 -3
- package/.agent/skills/server-management/SKILL.md +3 -3
- package/.agent/skills/shadcn-ui-expert/SKILL.md +3 -3
- package/.agent/skills/skill-creator/SKILL.md +3 -3
- package/.agent/skills/sql-pro/SKILL.md +3 -3
- package/.agent/skills/supabase-postgres-best-practices/SKILL.md +3 -3
- package/.agent/skills/swiftui-expert/SKILL.md +3 -3
- package/.agent/skills/systematic-debugging/SKILL.md +3 -3
- package/.agent/skills/tailwind-patterns/SKILL.md +3 -3
- package/.agent/skills/tdd-workflow/SKILL.md +3 -3
- package/.agent/skills/test-result-analyzer/SKILL.md +3 -3
- package/.agent/skills/testing-patterns/SKILL.md +3 -3
- package/.agent/skills/trend-researcher/SKILL.md +3 -3
- package/.agent/skills/typescript-advanced/SKILL.md +3 -3
- package/.agent/skills/ui-ux-pro-max/SKILL.md +3 -3
- package/.agent/skills/ui-ux-researcher/SKILL.md +3 -3
- package/.agent/skills/vue-expert/SKILL.md +3 -3
- package/.agent/skills/vulnerability-scanner/SKILL.md +3 -3
- package/.agent/skills/web-accessibility-auditor/SKILL.md +3 -3
- package/.agent/skills/web-design-guidelines/SKILL.md +3 -3
- package/.agent/skills/webapp-testing/SKILL.md +3 -3
- package/.agent/skills/whimsy-injector/SKILL.md +3 -3
- package/.agent/skills/workflow-optimizer/SKILL.md +3 -3
- package/.agent/workflows/audit.md +6 -6
- package/.agent/workflows/deploy.md +1 -1
- package/.agent/workflows/generate.md +23 -6
- package/.agent/workflows/session.md +5 -5
- package/.agent/workflows/swarm.md +2 -2
- package/README.md +64 -8
- package/bin/tribunal-kit.js +277 -45
- package/package.json +9 -6
- package/scripts/changelog.js +167 -0
- package/scripts/sync-version.js +81 -0
- package/.agent/scripts/__pycache__/auto_preview.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/bundle_analyzer.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/checklist.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/dependency_analyzer.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/security_scan.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/session_manager.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/skill_integrator.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/swarm_dispatcher.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/test_runner.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/verify_all.cpython-311.pyc +0 -0
- package/.agent/scripts/auto_preview.py +0 -180
- package/.agent/scripts/bundle_analyzer.py +0 -259
- package/.agent/scripts/case_law_manager.py +0 -755
- package/.agent/scripts/checklist.py +0 -209
- package/.agent/scripts/compress_skills.py +0 -167
- package/.agent/scripts/consolidate_skills.py +0 -173
- package/.agent/scripts/deep_compress.py +0 -202
- package/.agent/scripts/dependency_analyzer.py +0 -247
- package/.agent/scripts/lint_runner.py +0 -188
- package/.agent/scripts/minify_context.py +0 -80
- package/.agent/scripts/patch_skills_meta.py +0 -177
- package/.agent/scripts/patch_skills_output.py +0 -285
- package/.agent/scripts/schema_validator.py +0 -279
- package/.agent/scripts/security_scan.py +0 -224
- package/.agent/scripts/session_manager.py +0 -261
- package/.agent/scripts/skill_evolution.py +0 -563
- package/.agent/scripts/skill_integrator.py +0 -234
- package/.agent/scripts/strengthen_skills.py +0 -220
- package/.agent/scripts/strip_tribunal.py +0 -41
- package/.agent/scripts/swarm_dispatcher.py +0 -350
- package/.agent/scripts/test_runner.py +0 -192
- package/.agent/scripts/test_swarm_dispatcher.py +0 -163
- package/.agent/scripts/verify_all.py +0 -195
package/bin/tribunal-kit.js
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* tribunal-kit CLI
|
|
3
|
+
* tribunal-kit CLI (alias: tk)
|
|
4
4
|
*
|
|
5
5
|
* Commands:
|
|
6
|
-
* init
|
|
7
|
-
* update
|
|
8
|
-
* status
|
|
6
|
+
* init — Install .agent/ into target project
|
|
7
|
+
* update — Re-install to get latest changes
|
|
8
|
+
* status — Check if .agent/ is installed
|
|
9
|
+
* learn — Evolve project idioms based on git diffs
|
|
10
|
+
* case — Manage Case Law precedents
|
|
11
|
+
* hook — Install pre-push git hook
|
|
12
|
+
* uninstall — Remove .agent/ from project
|
|
9
13
|
*
|
|
10
14
|
* Usage:
|
|
11
15
|
* npx tribunal-kit init
|
|
@@ -15,6 +19,7 @@
|
|
|
15
19
|
* npx tribunal-kit init --dry-run
|
|
16
20
|
* tribunal-kit update
|
|
17
21
|
* tribunal-kit status
|
|
22
|
+
* tribunal-kit uninstall
|
|
18
23
|
*/
|
|
19
24
|
|
|
20
25
|
const fs = require('fs');
|
|
@@ -50,12 +55,14 @@ function bold(text) { return `${C.bold}${text}${C.reset}`; }
|
|
|
50
55
|
|
|
51
56
|
// ── Logging ──────────────────────────────────────────────
|
|
52
57
|
let quiet = false;
|
|
58
|
+
let verbose = false;
|
|
53
59
|
|
|
54
60
|
function log(msg) { if (!quiet) console.log(msg); }
|
|
55
61
|
function ok(msg) { if (!quiet) console.log(` ${c('green', '✔')} ${msg}`); }
|
|
56
62
|
function warn(msg) { if (!quiet) console.log(` ${c('yellow', '⚠')} ${msg}`); }
|
|
57
63
|
function err(msg) { console.error(` ${c('red', '✖')} ${msg}`); }
|
|
58
64
|
function dim(msg) { if (!quiet) console.log(` ${c('gray', msg)}`); }
|
|
65
|
+
function dbg(msg) { if (verbose) console.log(` ${c('gray', '⊡')} ${c('gray', msg)}`); }
|
|
59
66
|
|
|
60
67
|
// ── Arg Parser ───────────────────────────────────────────
|
|
61
68
|
function parseArgs(argv) {
|
|
@@ -70,14 +77,22 @@ function parseArgs(argv) {
|
|
|
70
77
|
}
|
|
71
78
|
if (arg === '--force') { args.flags.force = true; continue; }
|
|
72
79
|
if (arg === '--quiet') { args.flags.quiet = true; continue; }
|
|
80
|
+
if (arg === '--verbose') { args.flags.verbose = true; continue; }
|
|
73
81
|
if (arg === '--dry-run') { args.flags.dryRun = true; continue; }
|
|
82
|
+
if (arg === '--minimal') { args.flags.minimal = true; continue; }
|
|
74
83
|
if (arg === '--skip-update-check') { args.flags.skipUpdateCheck = true; continue; }
|
|
84
|
+
if (arg === '--head') { args.flags.head = true; continue; }
|
|
75
85
|
if (arg.startsWith('--path=')) {
|
|
76
86
|
args.flags.path = arg.split('=').slice(1).join('=');
|
|
77
87
|
}
|
|
78
88
|
if (arg === '--path') {
|
|
79
89
|
const idx = raw.indexOf('--path');
|
|
80
|
-
|
|
90
|
+
const nextVal = raw[idx + 1];
|
|
91
|
+
if (!nextVal || nextVal.startsWith('--')) {
|
|
92
|
+
console.error(` \x1b[91m✖ --path requires a directory argument\x1b[0m`);
|
|
93
|
+
process.exit(1);
|
|
94
|
+
}
|
|
95
|
+
args.flags.path = nextVal;
|
|
81
96
|
}
|
|
82
97
|
if (arg.startsWith('--branch=')) {
|
|
83
98
|
args.flags.branch = arg.split('=').slice(1).join('=');
|
|
@@ -88,7 +103,33 @@ function parseArgs(argv) {
|
|
|
88
103
|
}
|
|
89
104
|
|
|
90
105
|
// ── File Utilities ────────────────────────────────────────
|
|
91
|
-
|
|
106
|
+
|
|
107
|
+
// Core agents to install in --minimal mode
|
|
108
|
+
const CORE_AGENTS = new Set([
|
|
109
|
+
'backend-specialist.md',
|
|
110
|
+
'frontend-specialist.md',
|
|
111
|
+
'database-architect.md',
|
|
112
|
+
'debugger.md',
|
|
113
|
+
'security-auditor.md',
|
|
114
|
+
'logic-reviewer.md',
|
|
115
|
+
'dependency-reviewer.md',
|
|
116
|
+
'type-safety-reviewer.md',
|
|
117
|
+
'performance-reviewer.md',
|
|
118
|
+
'orchestrator.md',
|
|
119
|
+
'explorer-agent.md',
|
|
120
|
+
'project-planner.md',
|
|
121
|
+
'test-engineer.md',
|
|
122
|
+
]);
|
|
123
|
+
|
|
124
|
+
// Core skills to install in --minimal mode
|
|
125
|
+
const CORE_SKILLS = new Set([
|
|
126
|
+
'clean-code', 'architecture', 'testing-patterns', 'systematic-debugging',
|
|
127
|
+
'frontend-design', 'database-design', 'api-patterns', 'nodejs-best-practices',
|
|
128
|
+
'vulnerability-scanner', 'typescript-advanced', 'python-pro', 'nextjs-react-expert',
|
|
129
|
+
'react-specialist', 'performance-profiling', 'lint-and-validate',
|
|
130
|
+
]);
|
|
131
|
+
|
|
132
|
+
function copyDir(src, dest, dryRun = false, filter = null) {
|
|
92
133
|
if (!dryRun) {
|
|
93
134
|
fs.mkdirSync(dest, { recursive: true });
|
|
94
135
|
}
|
|
@@ -97,15 +138,22 @@ function copyDir(src, dest, dryRun = false) {
|
|
|
97
138
|
let count = 0;
|
|
98
139
|
|
|
99
140
|
for (const entry of entries) {
|
|
141
|
+
// Apply filter if provided (for --minimal mode)
|
|
142
|
+
if (filter && !filter(entry.name, src)) {
|
|
143
|
+
dbg(` skip: ${entry.name}`);
|
|
144
|
+
continue;
|
|
145
|
+
}
|
|
146
|
+
|
|
100
147
|
const srcPath = path.join(src, entry.name);
|
|
101
148
|
const destPath = path.join(dest, entry.name);
|
|
102
149
|
|
|
103
150
|
if (entry.isDirectory()) {
|
|
104
|
-
count += copyDir(srcPath, destPath, dryRun);
|
|
151
|
+
count += copyDir(srcPath, destPath, dryRun, filter);
|
|
105
152
|
} else {
|
|
106
153
|
if (!dryRun) {
|
|
107
154
|
fs.cpSync(srcPath, destPath, { force: true });
|
|
108
155
|
}
|
|
156
|
+
dbg(` copy: ${entry.name}`);
|
|
109
157
|
count++;
|
|
110
158
|
}
|
|
111
159
|
}
|
|
@@ -281,10 +329,10 @@ function banner() {
|
|
|
281
329
|
let gradientLine = ' ' + C.bold;
|
|
282
330
|
for (let i = 0; i < line.length; i++) {
|
|
283
331
|
const p = maxLen > 1 ? i / (maxLen - 1) : 0;
|
|
284
|
-
//
|
|
285
|
-
const r =
|
|
286
|
-
const g =
|
|
287
|
-
const b =
|
|
332
|
+
// Solid #ff1637 (R: 255, G: 22, B: 55)
|
|
333
|
+
const r = 255;
|
|
334
|
+
const g = 22;
|
|
335
|
+
const b = 55;
|
|
288
336
|
gradientLine += `\x1b[38;2;${r};${g};${b}m${line[i]}`;
|
|
289
337
|
}
|
|
290
338
|
gradientLine += C.reset;
|
|
@@ -296,9 +344,10 @@ function banner() {
|
|
|
296
344
|
const sub = 'Anti-Hallucination Agent System';
|
|
297
345
|
const sp = Math.max(0, W - sub.length);
|
|
298
346
|
const centred = ' '.repeat(Math.floor(sp / 2)) + sub + ' '.repeat(Math.ceil(sp / 2));
|
|
299
|
-
|
|
300
|
-
console.log(` ${
|
|
301
|
-
console.log(` ${c('
|
|
347
|
+
const RED_ANSI = '\x1b[38;2;255;22;55m';
|
|
348
|
+
console.log(` ${RED_ANSI}╔${'═'.repeat(W)}╗${C.reset}`);
|
|
349
|
+
console.log(` ${RED_ANSI}║${C.reset}${c('gray', centred)}${RED_ANSI}║${C.reset}`);
|
|
350
|
+
console.log(` ${RED_ANSI}╚${'═'.repeat(W)}╝${C.reset}`);
|
|
302
351
|
console.log();
|
|
303
352
|
}
|
|
304
353
|
|
|
@@ -347,13 +396,22 @@ function cmdInit(flags) {
|
|
|
347
396
|
}
|
|
348
397
|
|
|
349
398
|
if (!dryRun && fs.existsSync(agentDest) && flags.force) {
|
|
350
|
-
|
|
399
|
+
// PRESERVE_DIRS: user-generated content that must survive updates
|
|
400
|
+
const PRESERVE_DIRS = ['history', 'patterns', 'mcp_config.json'];
|
|
401
|
+
const subdirs = ['agents', 'workflows', 'skills', 'scripts', '.shared', 'rules'];
|
|
351
402
|
for (const sub of subdirs) {
|
|
352
403
|
const subPath = path.join(agentDest, sub);
|
|
353
404
|
if (fs.existsSync(subPath)) {
|
|
354
405
|
fs.rmSync(subPath, { recursive: true, force: true });
|
|
355
406
|
}
|
|
356
407
|
}
|
|
408
|
+
// Verify preserved dirs still exist after cleanup
|
|
409
|
+
for (const kept of PRESERVE_DIRS) {
|
|
410
|
+
const keptPath = path.join(agentDest, kept);
|
|
411
|
+
if (kept.includes('.') ? false : !fs.existsSync(keptPath)) {
|
|
412
|
+
// It's okay if it doesn't exist yet — it'll be created below
|
|
413
|
+
}
|
|
414
|
+
}
|
|
357
415
|
}
|
|
358
416
|
|
|
359
417
|
// Ensure history dirs exist (Case Law + Skill Evolution)
|
|
@@ -369,11 +427,27 @@ function cmdInit(flags) {
|
|
|
369
427
|
}
|
|
370
428
|
|
|
371
429
|
// Count what we're installing
|
|
430
|
+
const isMinimal = flags.minimal || false;
|
|
431
|
+
if (isMinimal) {
|
|
432
|
+
log(` ${c('yellow','⚡')} ${bold('Minimal mode')} — installing core agents and skills only`);
|
|
433
|
+
console.log();
|
|
434
|
+
}
|
|
372
435
|
const totalFiles = countDir(agentSrc);
|
|
436
|
+
dbg(`Source: ${agentSrc}`);
|
|
437
|
+
dbg(`Target: ${agentDest}`);
|
|
438
|
+
dbg(`Total source files: ${totalFiles}`);
|
|
373
439
|
log(` ${c('gray','▸')} Scanning ${c('white', String(totalFiles))} files ${c('gray','→')} ${c('gray', agentDest)}`);
|
|
374
440
|
|
|
375
441
|
try {
|
|
376
|
-
|
|
442
|
+
// Build filter for --minimal mode
|
|
443
|
+
const minimalFilter = isMinimal ? (name, parentDir) => {
|
|
444
|
+
const parentName = path.basename(parentDir);
|
|
445
|
+
if (parentName === 'agents') return CORE_AGENTS.has(name);
|
|
446
|
+
if (parentName === 'skills') return CORE_SKILLS.has(name);
|
|
447
|
+
return true; // everything else passes
|
|
448
|
+
} : null;
|
|
449
|
+
|
|
450
|
+
const copied = copyDir(agentSrc, agentDest, dryRun, minimalFilter);
|
|
377
451
|
|
|
378
452
|
console.log();
|
|
379
453
|
if (dryRun) {
|
|
@@ -421,11 +495,12 @@ function cmdInit(flags) {
|
|
|
421
495
|
console.log(plainRow(` Next steps:`, s => c('gray', s)));
|
|
422
496
|
console.log(stepRow('/generate', 'Generate code with anti-hallucination'));
|
|
423
497
|
console.log(stepRow('/review', 'Audit existing code for issues'));
|
|
424
|
-
console.log(stepRow('/tribunal-full', 'Run all
|
|
498
|
+
console.log(stepRow('/tribunal-full', 'Run all 16 reviewers in parallel'));
|
|
425
499
|
console.log(plainRow('', () => ''));
|
|
426
500
|
console.log(` ${c('cyan', '╚' + '═'.repeat(W) + '╝')}`);
|
|
427
501
|
console.log();
|
|
428
|
-
log(` ${c('gray', '✦
|
|
502
|
+
log(` ${c('gray', '✦ Generating IDE bridge files...')}`);
|
|
503
|
+
generateIDEBridges(targetDir, agentDest, dryRun);
|
|
429
504
|
}
|
|
430
505
|
|
|
431
506
|
console.log();
|
|
@@ -435,6 +510,120 @@ function cmdInit(flags) {
|
|
|
435
510
|
}
|
|
436
511
|
}
|
|
437
512
|
|
|
513
|
+
// ── IDE Bridge Files ──────────────────────────────────────
|
|
514
|
+
// Each AI IDE reads rules from a different location.
|
|
515
|
+
// We generate bridge files that point each IDE at .agent/
|
|
516
|
+
function generateIDEBridges(targetDir, agentDest, dryRun = false) {
|
|
517
|
+
const rulesFile = path.join(agentDest, 'rules', 'GEMINI.md');
|
|
518
|
+
let rulesContent = '';
|
|
519
|
+
if (fs.existsSync(rulesFile)) {
|
|
520
|
+
rulesContent = fs.readFileSync(rulesFile, 'utf8');
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
// Helper: write a bridge file only if it doesn't already exist
|
|
524
|
+
const writeBridge = (filePath, content, label) => {
|
|
525
|
+
if (dryRun) {
|
|
526
|
+
dbg(` would create: ${filePath}`);
|
|
527
|
+
return;
|
|
528
|
+
}
|
|
529
|
+
const dir = path.dirname(filePath);
|
|
530
|
+
if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
|
|
531
|
+
if (fs.existsSync(filePath)) {
|
|
532
|
+
dbg(` skip (exists): ${path.basename(filePath)}`);
|
|
533
|
+
return;
|
|
534
|
+
}
|
|
535
|
+
fs.writeFileSync(filePath, content, 'utf8');
|
|
536
|
+
ok(`${label} → ${c('gray', path.relative(targetDir, filePath))}`);
|
|
537
|
+
};
|
|
538
|
+
|
|
539
|
+
// ── 1. Cursor (.cursorrules) ──────────────────────────
|
|
540
|
+
const cursorRules = `# Tribunal Kit — Cursor Bridge
|
|
541
|
+
# Auto-generated by tribunal-kit init. Do not edit manually.
|
|
542
|
+
# Source: .agent/rules/GEMINI.md
|
|
543
|
+
|
|
544
|
+
${rulesContent}
|
|
545
|
+
`;
|
|
546
|
+
writeBridge(
|
|
547
|
+
path.join(targetDir, '.cursorrules'),
|
|
548
|
+
cursorRules,
|
|
549
|
+
'Cursor'
|
|
550
|
+
);
|
|
551
|
+
|
|
552
|
+
// ── 2. Windsurf (.windsurfrules) ─────────────────────
|
|
553
|
+
const windsurfRules = `# Tribunal Kit — Windsurf Bridge
|
|
554
|
+
# Auto-generated by tribunal-kit init. Do not edit manually.
|
|
555
|
+
# Source: .agent/rules/GEMINI.md
|
|
556
|
+
|
|
557
|
+
${rulesContent}
|
|
558
|
+
`;
|
|
559
|
+
writeBridge(
|
|
560
|
+
path.join(targetDir, '.windsurfrules'),
|
|
561
|
+
windsurfRules,
|
|
562
|
+
'Windsurf'
|
|
563
|
+
);
|
|
564
|
+
|
|
565
|
+
// ── 3. Gemini / Antigravity (.gemini/settings.json) ──
|
|
566
|
+
const geminiSettings = JSON.stringify({
|
|
567
|
+
"$schema": "https://raw.githubusercontent.com/anthropics/anthropic-cookbook/main/.gemini/settings.schema.json",
|
|
568
|
+
"rules": [
|
|
569
|
+
{ "path": "../.agent/rules/GEMINI.md", "trigger": "always_on" }
|
|
570
|
+
],
|
|
571
|
+
"agents": { "directory": "../.agent/agents" },
|
|
572
|
+
"skills": { "directory": "../.agent/skills" },
|
|
573
|
+
"workflows": { "directory": "../.agent/workflows" }
|
|
574
|
+
}, null, 2) + '\n';
|
|
575
|
+
writeBridge(
|
|
576
|
+
path.join(targetDir, '.gemini', 'settings.json'),
|
|
577
|
+
geminiSettings,
|
|
578
|
+
'Gemini/Antigravity'
|
|
579
|
+
);
|
|
580
|
+
|
|
581
|
+
// ── Also create .gemini/GEMINI.md as a direct rules file ──
|
|
582
|
+
const geminiRulesBridge = `---
|
|
583
|
+
trigger: always_on
|
|
584
|
+
---
|
|
585
|
+
|
|
586
|
+
# Tribunal Kit — Gemini Bridge
|
|
587
|
+
# Auto-generated by tribunal-kit init.
|
|
588
|
+
# Full rules: .agent/rules/GEMINI.md
|
|
589
|
+
|
|
590
|
+
${rulesContent}
|
|
591
|
+
`;
|
|
592
|
+
writeBridge(
|
|
593
|
+
path.join(targetDir, '.gemini', 'GEMINI.md'),
|
|
594
|
+
geminiRulesBridge,
|
|
595
|
+
'Gemini rules'
|
|
596
|
+
);
|
|
597
|
+
|
|
598
|
+
// ── 4. GitHub Copilot (.github/copilot-instructions.md) ──
|
|
599
|
+
const copilotInstructions = `# Tribunal Kit — Copilot Bridge
|
|
600
|
+
# Auto-generated by tribunal-kit init. Do not edit manually.
|
|
601
|
+
# Source: .agent/rules/GEMINI.md
|
|
602
|
+
|
|
603
|
+
${rulesContent}
|
|
604
|
+
`;
|
|
605
|
+
writeBridge(
|
|
606
|
+
path.join(targetDir, '.github', 'copilot-instructions.md'),
|
|
607
|
+
copilotInstructions,
|
|
608
|
+
'GitHub Copilot'
|
|
609
|
+
);
|
|
610
|
+
|
|
611
|
+
// ── 5. Claude (.claude/CLAUDE.md) ─────────────────────
|
|
612
|
+
const claudeRules = `# Tribunal Kit — Claude Bridge
|
|
613
|
+
# Auto-generated by tribunal-kit init. Do not edit manually.
|
|
614
|
+
# Source: .agent/rules/GEMINI.md
|
|
615
|
+
|
|
616
|
+
${rulesContent}
|
|
617
|
+
`;
|
|
618
|
+
writeBridge(
|
|
619
|
+
path.join(targetDir, '.claude', 'CLAUDE.md'),
|
|
620
|
+
claudeRules,
|
|
621
|
+
'Claude'
|
|
622
|
+
);
|
|
623
|
+
|
|
624
|
+
console.log();
|
|
625
|
+
}
|
|
626
|
+
|
|
438
627
|
function cmdUpdate(flags) {
|
|
439
628
|
// ── Self-install guard (early, before banner) ───────────
|
|
440
629
|
const targetDir = flags.path ? path.resolve(flags.path) : process.cwd();
|
|
@@ -487,12 +676,12 @@ function cmdLearn(flags) {
|
|
|
487
676
|
|
|
488
677
|
// Phase 1: Skill Evolution
|
|
489
678
|
log(` ${c('cyan', '\u229b')} ${bold('Phase 1')} \u2014 Skill Evolution Forge (auto-generating project idioms)`);
|
|
490
|
-
const evoScript = path.join(agentDest, 'scripts', 'skill_evolution.
|
|
679
|
+
const evoScript = path.join(agentDest, 'scripts', 'skill_evolution.js');
|
|
491
680
|
if (!fs.existsSync(evoScript)) {
|
|
492
|
-
warn('skill_evolution.
|
|
681
|
+
warn('skill_evolution.js not found \u2014 run: npx tribunal-kit update');
|
|
493
682
|
} else {
|
|
494
683
|
try {
|
|
495
|
-
const cmd =
|
|
684
|
+
const cmd = `node "${evoScript}" digest ${dryRun} ${useHead}`.trim();
|
|
496
685
|
execSync(cmd, { stdio: 'inherit', cwd: targetDir });
|
|
497
686
|
} catch (e) {
|
|
498
687
|
warn(`Skill Evolution error: ${e.message}`);
|
|
@@ -547,6 +736,9 @@ async function runWithUpdateCheck(command, flags) {
|
|
|
547
736
|
case 'hook':
|
|
548
737
|
cmdHook(flags);
|
|
549
738
|
break;
|
|
739
|
+
case 'uninstall':
|
|
740
|
+
cmdUninstall(flags);
|
|
741
|
+
break;
|
|
550
742
|
case 'help':
|
|
551
743
|
case '--help':
|
|
552
744
|
case '-h':
|
|
@@ -589,7 +781,7 @@ function cmdCase(flags) {
|
|
|
589
781
|
}
|
|
590
782
|
|
|
591
783
|
const python = process.platform === 'win32' ? 'python' : 'python3';
|
|
592
|
-
const caseLawScript = path.join(agentDest, 'scripts', 'case_law_manager.
|
|
784
|
+
const caseLawScript = path.join(agentDest, 'scripts', 'case_law_manager.js');
|
|
593
785
|
|
|
594
786
|
// Make shorthand aliases
|
|
595
787
|
let pyArgs = args;
|
|
@@ -598,7 +790,7 @@ function cmdCase(flags) {
|
|
|
598
790
|
|
|
599
791
|
try {
|
|
600
792
|
const { execSync } = require('child_process');
|
|
601
|
-
execSync(
|
|
793
|
+
execSync(`node "${caseLawScript}" ${pyArgs}`, { stdio: 'inherit', cwd: targetDir });
|
|
602
794
|
} catch (e) {
|
|
603
795
|
process.exit(1); // Script already prints errors
|
|
604
796
|
}
|
|
@@ -629,6 +821,37 @@ function cmdHook(flags) {
|
|
|
629
821
|
console.log();
|
|
630
822
|
}
|
|
631
823
|
|
|
824
|
+
function cmdUninstall(flags) {
|
|
825
|
+
const targetDir = flags.path ? path.resolve(flags.path) : process.cwd();
|
|
826
|
+
const agentDest = path.join(targetDir, '.agent');
|
|
827
|
+
|
|
828
|
+
banner();
|
|
829
|
+
|
|
830
|
+
if (!fs.existsSync(agentDest)) {
|
|
831
|
+
log(` ${c('yellow','⚠')} ${bold('.agent/')} is not installed in this project.`);
|
|
832
|
+
console.log();
|
|
833
|
+
return;
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
if (flags.dryRun) {
|
|
837
|
+
log(colorize('yellow', ' DRY RUN — would remove:'));
|
|
838
|
+
log(` ${c('gray',' ╰─')} ${agentDest}`);
|
|
839
|
+
console.log();
|
|
840
|
+
return;
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
try {
|
|
844
|
+
fs.rmSync(agentDest, { recursive: true, force: true });
|
|
845
|
+
log(` ${c('green','✔')} ${bold('.agent/')} has been removed from this project.`);
|
|
846
|
+
console.log();
|
|
847
|
+
log(` ${c('gray','▸')} To reinstall: ${c('cyan','npx tribunal-kit init')}`);
|
|
848
|
+
console.log();
|
|
849
|
+
} catch (e) {
|
|
850
|
+
err(`Failed to remove .agent/: ${e.message}`);
|
|
851
|
+
process.exit(1);
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
|
|
632
855
|
function cmdStatus(flags) {
|
|
633
856
|
const targetDir = flags.path ? path.resolve(flags.path) : process.cwd();
|
|
634
857
|
const agentDest = path.join(targetDir, '.agent');
|
|
@@ -667,41 +890,49 @@ function cmdHelp() {
|
|
|
667
890
|
|
|
668
891
|
log(bold(' Commands'));
|
|
669
892
|
log(` ${c('gray','─'.repeat(40))}`);
|
|
670
|
-
log(cmd('init',
|
|
671
|
-
log(cmd('update',
|
|
672
|
-
log(cmd('status',
|
|
673
|
-
log(cmd('learn',
|
|
674
|
-
log(cmd('case',
|
|
675
|
-
log(cmd('hook',
|
|
893
|
+
log(cmd('init', 'Install .agent/ into current project'));
|
|
894
|
+
log(cmd('update', 'Re-install to get latest version'));
|
|
895
|
+
log(cmd('status', 'Check if .agent/ is installed'));
|
|
896
|
+
log(cmd('learn', 'Evolve project idioms based on git diffs'));
|
|
897
|
+
log(cmd('case', 'Manage Case Law precedents (add, search, list, show, stats, overrule)'));
|
|
898
|
+
log(cmd('hook', 'Install pre-push git hook for auto-learning'));
|
|
899
|
+
log(cmd('uninstall','Remove .agent/ folder from project'));
|
|
676
900
|
console.log();
|
|
677
901
|
log(bold(' Options'));
|
|
678
902
|
log(` ${c('gray','─'.repeat(40))}`);
|
|
679
903
|
log(opt('--force', 'Overwrite existing .agent/ folder'));
|
|
680
904
|
log(opt('--path <dir>', 'Install in specific directory'));
|
|
681
905
|
log(opt('--quiet', 'Suppress all output'));
|
|
906
|
+
log(opt('--verbose', 'Show detailed debug logging'));
|
|
682
907
|
log(opt('--dry-run', 'Preview actions without executing'));
|
|
908
|
+
log(opt('--minimal', 'Install core agents/skills only (~13 agents)'));
|
|
683
909
|
log(opt('--skip-update-check', 'Skip auto-update version check'));
|
|
684
910
|
log(opt('--head', '(learn) Diff against last commit instead of staged'));
|
|
685
911
|
console.log();
|
|
912
|
+
log(bold(' Aliases'));
|
|
913
|
+
log(` ${c('gray','─'.repeat(40))}`);
|
|
914
|
+
log(` ${c('cyan', 'tk')} ${c('gray', 'Shorthand for tribunal-kit (e.g., tk init, tk status)')}`);
|
|
915
|
+
console.log();
|
|
686
916
|
log(bold(' Examples'));
|
|
687
917
|
log(` ${c('gray','─'.repeat(40))}`);
|
|
688
918
|
log(ex('npx tribunal-kit init'));
|
|
689
|
-
log(ex('
|
|
690
|
-
log(ex('
|
|
919
|
+
log(ex('tk init --force'));
|
|
920
|
+
log(ex('tk init --path ./my-app'));
|
|
691
921
|
log(ex('npx tribunal-kit init --dry-run'));
|
|
692
|
-
log(ex('
|
|
693
|
-
log(ex('
|
|
694
|
-
log(ex('
|
|
695
|
-
log(ex('
|
|
696
|
-
log(ex('
|
|
697
|
-
log(ex('
|
|
698
|
-
log(ex('
|
|
699
|
-
log(ex('
|
|
700
|
-
log(ex('
|
|
701
|
-
log(ex('
|
|
702
|
-
log(ex('
|
|
703
|
-
log(ex('
|
|
704
|
-
log(ex('
|
|
922
|
+
log(ex('tk update'));
|
|
923
|
+
log(ex('tk status'));
|
|
924
|
+
log(ex('tk learn'));
|
|
925
|
+
log(ex('tk learn --dry-run'));
|
|
926
|
+
log(ex('tk learn --head'));
|
|
927
|
+
log(ex('tk case add'));
|
|
928
|
+
log(ex('tk case search "useEffect"'));
|
|
929
|
+
log(ex('tk case list'));
|
|
930
|
+
log(ex('tk case show --id 1'));
|
|
931
|
+
log(ex('tk case stats'));
|
|
932
|
+
log(ex('tk case export'));
|
|
933
|
+
log(ex('tk case overrule --id 1'));
|
|
934
|
+
log(ex('tk hook'));
|
|
935
|
+
log(ex('tk uninstall'));
|
|
705
936
|
console.log();
|
|
706
937
|
}
|
|
707
938
|
|
|
@@ -709,10 +940,11 @@ function cmdHelp() {
|
|
|
709
940
|
const { command, flags } = parseArgs(process.argv);
|
|
710
941
|
|
|
711
942
|
if (flags.quiet) quiet = true;
|
|
943
|
+
if (flags.verbose) verbose = true;
|
|
712
944
|
|
|
713
945
|
runWithUpdateCheck(command, flags);
|
|
714
946
|
|
|
715
947
|
// -- Exports (for testing) -- do not remove
|
|
716
948
|
if (require.main !== module) {
|
|
717
|
-
module.exports = { parseArgs, compareSemver, copyDir, countDir, isSelfInstall };
|
|
949
|
+
module.exports = { parseArgs, compareSemver, copyDir, countDir, isSelfInstall, CORE_AGENTS, CORE_SKILLS, generateIDEBridges };
|
|
718
950
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tribunal-kit",
|
|
3
|
-
"version": "4.
|
|
4
|
-
"description": "Anti-Hallucination AI Agent Kit —
|
|
3
|
+
"version": "4.3.0",
|
|
4
|
+
"description": "Anti-Hallucination AI Agent Kit — 40 specialist agents, 31 slash commands, 16 parallel Tribunal reviewers, Performance Swarm engine, and Supreme Court case law pipeline.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
7
7
|
"ai-agent",
|
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
},
|
|
47
47
|
"files": [
|
|
48
48
|
"bin/",
|
|
49
|
+
"scripts/",
|
|
49
50
|
".agent/",
|
|
50
51
|
"README.md",
|
|
51
52
|
"LICENSE"
|
|
@@ -56,7 +57,12 @@
|
|
|
56
57
|
"scripts": {
|
|
57
58
|
"test": "jest --coverage",
|
|
58
59
|
"test:unit": "jest test/unit --coverage",
|
|
59
|
-
"test:integration": "jest test/integration --coverage"
|
|
60
|
+
"test:integration": "jest test/integration --coverage",
|
|
61
|
+
"preversion": "node scripts/sync-version.js",
|
|
62
|
+
"version": "node scripts/changelog.js && git add CHANGELOG.md",
|
|
63
|
+
"changelog": "node scripts/changelog.js",
|
|
64
|
+
"changelog:preview": "node scripts/changelog.js --preview",
|
|
65
|
+
"sync": "node scripts/sync-version.js"
|
|
60
66
|
},
|
|
61
67
|
"devDependencies": {
|
|
62
68
|
"jest": "^29.7.0"
|
|
@@ -70,8 +76,5 @@
|
|
|
70
76
|
"collectCoverageFrom": [
|
|
71
77
|
"bin/**/*.js"
|
|
72
78
|
]
|
|
73
|
-
},
|
|
74
|
-
"dependencies": {
|
|
75
|
-
"tribunal-kit": "^4.0.0"
|
|
76
79
|
}
|
|
77
80
|
}
|