tribunal-kit 5.8.4 → 6.0.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 +219 -215
- package/.agent/agents/accessibility-reviewer.md +66 -151
- package/.agent/agents/ai-code-reviewer.md +22 -2
- package/.agent/agents/anti-pattern-reviewer.md +99 -0
- package/.agent/agents/api-architect.md +19 -2
- package/.agent/agents/backend-specialist.md +25 -3
- package/.agent/agents/cloud-engineer.md +21 -0
- package/.agent/agents/code-archaeologist.md +20 -3
- package/.agent/agents/complexity-reviewer.md +22 -2
- package/.agent/agents/database-architect.md +24 -3
- package/.agent/agents/db-latency-auditor.md +22 -2
- package/.agent/agents/debugger.md +19 -3
- package/.agent/agents/dependency-reviewer.md +19 -2
- package/.agent/agents/devops-engineer.md +24 -3
- package/.agent/agents/documentation-writer.md +21 -3
- package/.agent/agents/explorer-agent.md +21 -3
- package/.agent/agents/frontend-reviewer.md +19 -3
- package/.agent/agents/frontend-specialist.md +72 -224
- package/.agent/agents/game-developer.md +22 -3
- package/.agent/agents/interaction-reviewer.md +118 -0
- package/.agent/agents/logic-reviewer.md +18 -3
- package/.agent/agents/minimalist-reviewer.md +98 -0
- package/.agent/agents/mobile-developer.md +21 -3
- package/.agent/agents/mobile-reviewer.md +22 -2
- package/.agent/agents/orchestrator.md +19 -3
- package/.agent/agents/penetration-tester.md +22 -3
- package/.agent/agents/performance-optimizer.md +21 -3
- package/.agent/agents/performance-reviewer.md +2 -0
- package/.agent/agents/precedence-reviewer.md +19 -5
- package/.agent/agents/product-manager.md +20 -3
- package/.agent/agents/product-owner.md +22 -1
- package/.agent/agents/product-reviewer.md +98 -0
- package/.agent/agents/project-planner.md +19 -3
- package/.agent/agents/qa-automation-engineer.md +24 -3
- package/.agent/agents/resilience-reviewer.md +21 -2
- package/.agent/agents/schema-reviewer.md +21 -2
- package/.agent/agents/security-auditor.md +7 -1
- package/.agent/agents/seo-specialist.md +18 -3
- package/.agent/agents/sql-reviewer.md +22 -2
- package/.agent/agents/supervisor-agent.md +22 -3
- package/.agent/agents/swarm-worker-registry.md +7 -0
- package/.agent/agents/system-architect.md +19 -0
- package/.agent/agents/test-coverage-reviewer.md +22 -2
- package/.agent/agents/test-engineer.md +21 -2
- package/.agent/agents/throughput-optimizer.md +22 -2
- package/.agent/agents/type-safety-reviewer.md +21 -2
- package/.agent/agents/ui-ux-auditor.md +44 -242
- package/.agent/agents/ui-visual-auditor.md +99 -0
- package/.agent/agents/ux-reviewer.md +104 -0
- package/.agent/agents/visual-reviewer.md +98 -0
- package/.agent/agents/vitals-reviewer.md +23 -2
- package/.agent/history/README.md +53 -0
- package/.agent/history/case-law/cases/template-case.json +19 -0
- package/.agent/history/integrity_manifest.json +131 -33
- package/.agent/history/memory/.memory.idx +1581 -1
- package/.agent/history/memory/MEMORY.md +105 -1
- package/.agent/routing_index.json +272 -690
- package/.agent/rules/GEMINI.md +10 -12
- package/.agent/rules/GEMINI_PLANNER.md +84 -0
- package/.agent/scripts/_utils.js +28 -7
- package/.agent/scripts/case_law_manager.js +2 -0
- package/.agent/scripts/context_broker.js +152 -19
- package/.agent/scripts/guardrail_engine.js +60 -5
- package/.agent/scripts/impact_classifier.js +167 -0
- package/.agent/scripts/integrity_manifest.js +10 -4
- package/.agent/scripts/marathon_harness.js +10 -1
- package/.agent/scripts/minimal_change_engine.js +437 -0
- package/.agent/scripts/pipeline_engine.js +856 -0
- package/.agent/scripts/skill_evolution.js +36 -21
- package/.agent/scripts/socratic_gate_policy.js +60 -0
- package/.agent/scripts/swarm_dispatcher.js +65 -6
- package/.agent/scripts/token_budget_broker.js +52 -0
- package/.agent/scripts/verify_all.js +13 -0
- package/.agent/scripts/visual_audit.js +92 -0
- package/.agent/skills/12-principles-of-animation/SKILL.md +19 -10
- package/.agent/skills/60fps-animation/SKILL.md +19 -10
- package/.agent/skills/accessible-animation/SKILL.md +19 -10
- package/.agent/skills/adapt/SKILL.md +19 -10
- package/.agent/skills/advanced-rag-pipelines/SKILL.md +21 -3
- package/.agent/skills/agent-organizer/SKILL.md +21 -7
- package/.agent/skills/agentic-patterns/SKILL.md +19 -7
- package/.agent/skills/ai-prompt-injection-defense/SKILL.md +21 -7
- package/.agent/skills/animation-on-scroll/SKILL.md +19 -10
- package/.agent/skills/animation-systems/SKILL.md +19 -10
- package/.agent/skills/antfu-conventions/SKILL.md +21 -10
- package/.agent/skills/api-patterns/SKILL.md +21 -7
- package/.agent/skills/api-patterns/scripts/__pycache__/api_validator.cpython-311.pyc +0 -0
- package/.agent/skills/api-security-auditor/SKILL.md +21 -7
- package/.agent/skills/app-builder/SKILL.md +21 -7
- package/.agent/skills/apple-design/SKILL.md +19 -10
- package/.agent/skills/architecture/SKILL.md +21 -7
- package/.agent/skills/audit-and-fix/SKILL.md +19 -10
- package/.agent/skills/authentication-best-practices/SKILL.md +21 -7
- package/.agent/skills/backend-security-expert/SKILL.md +21 -7
- package/.agent/skills/baseline-ui/SKILL.md +19 -10
- package/.agent/skills/bash-linux/SKILL.md +21 -7
- package/.agent/skills/behavioral-modes/SKILL.md +19 -7
- package/.agent/skills/better-colors/SKILL.md +31 -14
- package/.agent/skills/better-ui/SKILL.md +19 -10
- package/.agent/skills/bolder/SKILL.md +19 -10
- package/.agent/skills/brainstorming/SKILL.md +17 -7
- package/.agent/skills/browser-native-ai/SKILL.md +19 -3
- package/.agent/skills/build-primitive/SKILL.md +19 -10
- package/.agent/skills/building-native-ui/SKILL.md +21 -7
- package/.agent/skills/cicd-pro/SKILL.md +21 -10
- package/.agent/skills/clarify/SKILL.md +19 -10
- package/.agent/skills/clean-code/SKILL.md +21 -7
- package/.agent/skills/cloud-architect/SKILL.md +21 -10
- package/.agent/skills/cobejs/SKILL.md +19 -10
- package/.agent/skills/code-review-checklist/SKILL.md +21 -7
- package/.agent/skills/codebase-design/SKILL.md +21 -10
- package/.agent/skills/colorize/SKILL.md +19 -10
- package/.agent/skills/compact-landing/SKILL.md +19 -10
- package/.agent/skills/company-logos/SKILL.md +19 -10
- package/.agent/skills/config-validator/SKILL.md +21 -7
- package/.agent/skills/containerization-pro/SKILL.md +21 -10
- package/.agent/skills/create-design-md/SKILL.md +19 -10
- package/.agent/skills/critique/SKILL.md +19 -10
- package/.agent/skills/csharp-developer/SKILL.md +21 -7
- package/.agent/skills/data-validation-schemas/SKILL.md +21 -7
- package/.agent/skills/database-design/SKILL.md +21 -7
- package/.agent/skills/database-design/scripts/__pycache__/schema_validator.cpython-311.pyc +0 -0
- package/.agent/skills/delight/SKILL.md +19 -10
- package/.agent/skills/deployment-procedures/SKILL.md +21 -7
- package/.agent/skills/design-lab/SKILL.md +21 -10
- package/.agent/skills/devops-engineer/SKILL.md +21 -7
- package/.agent/skills/devops-incident-responder/SKILL.md +21 -7
- package/.agent/skills/diagnosing-bugs/SKILL.md +21 -10
- package/.agent/skills/distill/SKILL.md +19 -10
- package/.agent/skills/documentation-templates/SKILL.md +21 -7
- package/.agent/skills/domain-modeling/SKILL.md +21 -10
- package/.agent/skills/edge-computing/SKILL.md +21 -7
- package/.agent/skills/emil-design-eng/SKILL.md +19 -10
- package/.agent/skills/error-resilience/SKILL.md +21 -7
- package/.agent/skills/extract-design-system/SKILL.md +21 -7
- package/.agent/skills/fabel-protocol/SKILL.md +19 -2
- package/.agent/skills/fixing-accessibility/SKILL.md +25 -14
- package/.agent/skills/fixing-metadata/SKILL.md +19 -10
- package/.agent/skills/fixing-motion-performance/SKILL.md +19 -10
- package/.agent/skills/framer-motion-expert/SKILL.md +19 -6
- package/.agent/skills/frontend-design/SKILL.md +66 -204
- package/.agent/skills/frontend-design/scripts/__pycache__/accessibility_checker.cpython-311.pyc +0 -0
- package/.agent/skills/frontend-design/scripts/__pycache__/ux_audit.cpython-311.pyc +0 -0
- package/.agent/skills/frontend-security-expert/SKILL.md +21 -7
- package/.agent/skills/game-design-expert/SKILL.md +21 -7
- package/.agent/skills/game-engineering-expert/SKILL.md +21 -7
- package/.agent/skills/generative-ui-expert/SKILL.md +19 -3
- package/.agent/skills/geo-fundamentals/SKILL.md +21 -7
- package/.agent/skills/geo-fundamentals/scripts/__pycache__/geo_checker.cpython-311.pyc +0 -0
- package/.agent/skills/git-pro/SKILL.md +21 -10
- package/.agent/skills/github-operations/SKILL.md +21 -7
- package/.agent/skills/gpt-taste/SKILL.md +19 -10
- package/.agent/skills/gsap-core/SKILL.md +21 -4
- package/.agent/skills/gsap-frameworks/SKILL.md +21 -4
- package/.agent/skills/gsap-performance/SKILL.md +20 -5
- package/.agent/skills/gsap-plugins/SKILL.md +20 -5
- package/.agent/skills/gsap-react/SKILL.md +20 -5
- package/.agent/skills/gsap-scrolltrigger/SKILL.md +21 -4
- package/.agent/skills/gsap-timeline/SKILL.md +20 -5
- package/.agent/skills/gsap-utils/SKILL.md +20 -5
- package/.agent/skills/harden/SKILL.md +19 -10
- package/.agent/skills/harness-protocol/SKILL.md +20 -4
- package/.agent/skills/i18n-localization/SKILL.md +21 -7
- package/.agent/skills/i18n-localization/scripts/__pycache__/i18n_checker.cpython-311.pyc +0 -0
- package/.agent/skills/impeccable/SKILL.md +21 -10
- package/.agent/skills/improve-codebase-architecture/SKILL.md +21 -10
- package/.agent/skills/improve-ui/SKILL.md +19 -10
- package/.agent/skills/intelligent-routing/SKILL.md +19 -7
- package/.agent/skills/knowledge-graph/SKILL.md +20 -4
- package/.agent/skills/landing-page/SKILL.md +20 -10
- package/.agent/skills/lint-and-validate/SKILL.md +21 -7
- package/.agent/skills/lint-and-validate/scripts/__pycache__/lint_runner.cpython-311.pyc +0 -0
- package/.agent/skills/lint-and-validate/scripts/__pycache__/type_coverage.cpython-311.pyc +0 -0
- package/.agent/skills/llm-engineering/SKILL.md +21 -7
- package/.agent/skills/local-first/SKILL.md +21 -7
- package/.agent/skills/local-first-architecture/SKILL.md +19 -10
- package/.agent/skills/lottie-animation/SKILL.md +19 -10
- package/.agent/skills/marquee-loop/SKILL.md +19 -10
- package/.agent/skills/masked-reveal/SKILL.md +19 -10
- package/.agent/skills/mcp-builder/SKILL.md +21 -7
- package/.agent/skills/micro-interaction/SKILL.md +19 -10
- package/.agent/skills/mobile-design/SKILL.md +21 -6
- package/.agent/skills/mobile-design/scripts/__pycache__/mobile_audit.cpython-311.pyc +0 -0
- package/.agent/skills/monorepo-management/SKILL.md +21 -7
- package/.agent/skills/morphing-icons/SKILL.md +19 -10
- package/.agent/skills/motion-engineering/SKILL.md +86 -171
- package/.agent/skills/nextjs-react-expert/SKILL.md +19 -7
- package/.agent/skills/nextjs-react-expert/scripts/__pycache__/convert_rules.cpython-311.pyc +0 -0
- package/.agent/skills/nextjs-react-expert/scripts/__pycache__/react_performance_checker.cpython-311.pyc +0 -0
- package/.agent/skills/nodejs-best-practices/SKILL.md +21 -7
- package/.agent/skills/observability/SKILL.md +21 -7
- package/.agent/skills/page-transition-animation/SKILL.md +19 -10
- package/.agent/skills/parallel-agents/SKILL.md +23 -7
- package/.agent/skills/performance-profiling/SKILL.md +21 -7
- package/.agent/skills/performance-profiling/scripts/__pycache__/lighthouse_audit.cpython-311.pyc +0 -0
- package/.agent/skills/plan-writing/SKILL.md +21 -7
- package/.agent/skills/platform-engineer/SKILL.md +21 -7
- package/.agent/skills/playwright-best-practices/SKILL.md +21 -7
- package/.agent/skills/polish/SKILL.md +19 -10
- package/.agent/skills/powershell-windows/SKILL.md +21 -7
- package/.agent/skills/pricing-page/SKILL.md +19 -10
- package/.agent/skills/product-aware-heuristics/SKILL.md +358 -0
- package/.agent/skills/progressive-blur/SKILL.md +19 -10
- package/.agent/skills/project-idioms/SKILL.md +20 -8
- package/.agent/skills/python-patterns/SKILL.md +21 -7
- package/.agent/skills/python-pro/SKILL.md +21 -6
- package/.agent/skills/quieter/SKILL.md +19 -10
- package/.agent/skills/react-doctor/SKILL.md +19 -10
- package/.agent/skills/react-specialist/SKILL.md +19 -6
- package/.agent/skills/readme-builder/SKILL.md +21 -7
- package/.agent/skills/realtime-patterns/SKILL.md +21 -7
- package/.agent/skills/red-team-tactics/SKILL.md +21 -7
- package/.agent/skills/redesign-skill/SKILL.md +19 -10
- package/.agent/skills/review-animations/SKILL.md +21 -10
- package/.agent/skills/rust-pro/SKILL.md +21 -7
- package/.agent/skills/seo-fundamentals/SKILL.md +21 -7
- package/.agent/skills/seo-fundamentals/scripts/__pycache__/seo_checker.cpython-311.pyc +0 -0
- package/.agent/skills/server-management/SKILL.md +21 -7
- package/.agent/skills/shadcn-ui-expert/SKILL.md +21 -7
- package/.agent/skills/shape/SKILL.md +19 -10
- package/.agent/skills/skill-creator/SKILL.md +21 -7
- package/.agent/skills/soft-skill/SKILL.md +19 -10
- package/.agent/skills/sounds-on-the-web/SKILL.md +19 -10
- package/.agent/skills/sql-pro/SKILL.md +21 -7
- package/.agent/skills/supabase-postgres-best-practices/SKILL.md +21 -7
- package/.agent/skills/svg-animation/SKILL.md +19 -10
- package/.agent/skills/swiftui-expert/SKILL.md +21 -7
- package/.agent/skills/swiss-design/SKILL.md +19 -10
- package/.agent/skills/system-design-pro/SKILL.md +21 -9
- package/.agent/skills/systematic-debugging/SKILL.md +21 -7
- package/.agent/skills/tailwind-patterns/SKILL.md +21 -7
- package/.agent/skills/taste-skill/SKILL.md +19 -10
- package/.agent/skills/tdd-workflow/SKILL.md +21 -10
- package/.agent/skills/test-result-analyzer/SKILL.md +18 -6
- package/.agent/skills/testing-patterns/SKILL.md +21 -7
- package/.agent/skills/testing-patterns/scripts/__pycache__/test_runner.cpython-311.pyc +0 -0
- package/.agent/skills/thermo-nuclear-code-quality-review/SKILL.md +21 -10
- package/.agent/skills/thinking-protocol/SKILL.md +20 -8
- package/.agent/skills/to-spring-or-not-to-spring/SKILL.md +19 -10
- package/.agent/skills/transitions-dev/SKILL.md +19 -10
- package/.agent/skills/trend-researcher/SKILL.md +17 -6
- package/.agent/skills/typescript-advanced/SKILL.md +21 -7
- package/.agent/skills/typeset/SKILL.md +19 -10
- package/.agent/skills/ui-reasoning-engine/SKILL.md +154 -0
- package/.agent/skills/ui-skill-packs/SKILL.md +77 -0
- package/.agent/skills/ui-skills-root/SKILL.md +21 -9
- package/.agent/skills/ui-ux-pro-max/SKILL.md +62 -583
- package/.agent/skills/ui-ux-researcher/SKILL.md +17 -6
- package/.agent/skills/vue-expert/SKILL.md +19 -6
- package/.agent/skills/vulnerability-scanner/SKILL.md +21 -7
- package/.agent/skills/vulnerability-scanner/scripts/__pycache__/security_scan.cpython-311.pyc +0 -0
- package/.agent/skills/web-accessibility-auditor/SKILL.md +21 -7
- package/.agent/skills/web-design-guidelines/SKILL.md +32 -206
- package/.agent/skills/web-quality-audit/SKILL.md +19 -10
- package/.agent/skills/webapp-testing/SKILL.md +21 -7
- package/.agent/skills/webapp-testing/scripts/__pycache__/playwright_runner.cpython-311.pyc +0 -0
- package/.agent/skills/webgpu-performance/SKILL.md +19 -3
- package/.agent/skills/whimsy-injector/SKILL.md +20 -10
- package/.agent/skills/workflow-optimizer/SKILL.md +16 -6
- package/.agent/templates/DESIGN.md +292 -0
- package/.agent/templates/design-tokens.json +137 -0
- package/.agent/workflows/acf.md +13 -6
- package/.agent/workflows/api-tester.md +15 -8
- package/.agent/workflows/audit.md +19 -8
- package/.agent/workflows/brainstorm.md +14 -9
- package/.agent/workflows/changelog.md +14 -8
- package/.agent/workflows/create.md +16 -8
- package/.agent/workflows/debug.md +15 -10
- package/.agent/workflows/deploy.md +16 -8
- package/.agent/workflows/enhance.md +15 -10
- package/.agent/workflows/fix.md +15 -8
- package/.agent/workflows/generate.md +17 -11
- package/.agent/workflows/marathon.md +15 -8
- package/.agent/workflows/migrate.md +16 -8
- package/.agent/workflows/minimal.md +94 -0
- package/.agent/workflows/orchestrate.md +15 -8
- package/.agent/workflows/performance-benchmarker.md +15 -8
- package/.agent/workflows/pipeline.md +155 -0
- package/.agent/workflows/plan.md +14 -10
- package/.agent/workflows/preview.md +14 -7
- package/.agent/workflows/refactor.md +16 -8
- package/.agent/workflows/review-ai.md +15 -7
- package/.agent/workflows/review.md +15 -7
- package/.agent/workflows/session.md +14 -7
- package/.agent/workflows/status.md +13 -7
- package/.agent/workflows/strengthen-skills.md +15 -6
- package/.agent/workflows/super-prompt.md +19 -10
- package/.agent/workflows/swarm.md +15 -7
- package/.agent/workflows/test.md +15 -8
- package/.agent/workflows/tribunal-backend.md +16 -9
- package/.agent/workflows/tribunal-database.md +15 -8
- package/.agent/workflows/tribunal-frontend.md +26 -11
- package/.agent/workflows/tribunal-full.md +29 -14
- package/.agent/workflows/tribunal-mobile.md +15 -8
- package/.agent/workflows/tribunal-performance.md +15 -8
- package/.agent/workflows/tribunal-speed.md +16 -9
- package/.agent/workflows/tribunal-ui.md +82 -0
- package/.agent/workflows/ui-ux-pro-max.md +51 -107
- package/CONTRIBUTING.md +2 -2
- package/README.md +5 -5
- package/bin/mcp-server.js +126 -76
- package/bin/wrapper.js +67 -31
- package/dist/cli.js +39 -1
- package/dist/commands/compile.js +7 -0
- package/dist/commands/context.js +8 -3
- package/dist/commands/graph.js +8 -2
- package/dist/commands/init.js +37 -2
- package/dist/commands/memory.js +119 -68
- package/dist/commands/minimal.js +71 -0
- package/dist/commands/native.js +228 -0
- package/dist/commands/optimize.js +15 -5
- package/dist/commands/validate.js +67 -0
- package/dist/esm/index.mjs +26 -32
- package/dist/mcp/server.js +4 -138
- package/dist/utils/fs.js +10 -4
- package/dist/utils/helpers.js +10 -1
- package/dist/utils/version.js +9 -2
- package/mcp_config.json +10 -1
- package/package.json +19 -15
- package/scripts/benchmark.js +58 -0
- package/scripts/sync-version.js +129 -76
- package/scripts/visual_audit.js +126 -0
package/bin/mcp-server.js
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
* over standard I/O, allowing AI clients (Cursor, Windsurf, Claude) to natively
|
|
8
8
|
* invoke tribunal checks.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
10
|
+
* In-process tools load reusable modules directly. Commands that depend on a
|
|
11
|
+
* standalone CLI process remain isolated deliberately.
|
|
12
12
|
*
|
|
13
13
|
* Protocol: MCP 2024-11-05 over JSON-RPC 2.0 / stdio
|
|
14
14
|
*/
|
|
@@ -18,7 +18,7 @@ const { spawnSync } = require("child_process");
|
|
|
18
18
|
|
|
19
19
|
const PKG = require(path.resolve(__dirname, "../package.json"));
|
|
20
20
|
|
|
21
|
-
// Timeout for
|
|
21
|
+
// Timeout for intentionally isolated child processes (30 seconds).
|
|
22
22
|
const SPAWN_TIMEOUT_MS = 30000;
|
|
23
23
|
|
|
24
24
|
// Minimal JSON-RPC 2.0 over stdio
|
|
@@ -31,61 +31,60 @@ const rl = readline.createInterface({
|
|
|
31
31
|
});
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
|
-
* Run the
|
|
35
|
-
*
|
|
34
|
+
* Run the workspace integrity audit without invoking the CLI schema validator.
|
|
35
|
+
* The MCP audit is about Tribunal assets, while `tk validate` validates one
|
|
36
|
+
* explicitly supplied payload and schema.
|
|
36
37
|
*/
|
|
37
|
-
function
|
|
38
|
-
const os = require("os");
|
|
38
|
+
function runTribunalAudit() {
|
|
39
39
|
const fs = require("fs");
|
|
40
|
-
const
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
let binPath = null;
|
|
48
|
-
try {
|
|
49
|
-
const pkgPath = require.resolve(`${pkgName}/package.json`);
|
|
50
|
-
const candidatePath = path.resolve(
|
|
51
|
-
path.dirname(pkgPath),
|
|
52
|
-
`bin/tribunal-core${ext}`,
|
|
53
|
-
);
|
|
54
|
-
if (fs.existsSync(candidatePath)) binPath = candidatePath;
|
|
55
|
-
} catch (_) {}
|
|
56
|
-
if (!binPath) {
|
|
57
|
-
const devPath = path.resolve(
|
|
58
|
-
__dirname,
|
|
59
|
-
"..",
|
|
60
|
-
"target",
|
|
61
|
-
"release",
|
|
62
|
-
`tribunal-core${ext}`,
|
|
63
|
-
);
|
|
64
|
-
if (fs.existsSync(devPath)) binPath = devPath;
|
|
65
|
-
}
|
|
40
|
+
const projectRoot = process.cwd();
|
|
41
|
+
const manifestScript = path.join(
|
|
42
|
+
projectRoot,
|
|
43
|
+
".agent",
|
|
44
|
+
"scripts",
|
|
45
|
+
"integrity_manifest.js",
|
|
46
|
+
);
|
|
66
47
|
|
|
67
|
-
if (
|
|
68
|
-
|
|
69
|
-
encoding: "utf8",
|
|
70
|
-
timeout: SPAWN_TIMEOUT_MS,
|
|
71
|
-
});
|
|
72
|
-
return result.stdout || result.stderr || "No output";
|
|
48
|
+
if (!fs.existsSync(manifestScript)) {
|
|
49
|
+
return "Error: .agent/scripts/integrity_manifest.js was not found. Run `tk init` first.";
|
|
73
50
|
}
|
|
74
51
|
|
|
75
|
-
|
|
76
|
-
|
|
52
|
+
try {
|
|
53
|
+
const { generateManifest } = require(manifestScript);
|
|
54
|
+
const manifest = generateManifest(projectRoot);
|
|
55
|
+
if (manifest.error) return `Error: ${manifest.error}`;
|
|
56
|
+
|
|
57
|
+
const { integrity } = manifest;
|
|
58
|
+
const lines = [
|
|
59
|
+
"Tribunal audit complete.",
|
|
60
|
+
`Agents: ${manifest.agents.total} (${manifest.agents.reviewer_count} reviewers)`,
|
|
61
|
+
`Skills: ${manifest.skills.total}`,
|
|
62
|
+
`Scripts: ${manifest.scripts.total}`,
|
|
63
|
+
`Workflows: ${manifest.workflows.total}`,
|
|
64
|
+
`References: ${integrity.total_references}; phantom references: ${integrity.phantom_references}`,
|
|
65
|
+
`Count claims: ${integrity.total_claims}; invalid claims: ${integrity.invalid_claims}`,
|
|
66
|
+
];
|
|
67
|
+
|
|
68
|
+
if (integrity.phantom_references > 0 || integrity.invalid_claims > 0) {
|
|
69
|
+
lines.push("Audit found integrity issues; run `tk guardrail --scan` for remediation details.");
|
|
70
|
+
} else {
|
|
71
|
+
lines.push("All discovered references and global asset-count claims are valid.");
|
|
72
|
+
}
|
|
73
|
+
return lines.join("\n");
|
|
74
|
+
} catch (error) {
|
|
75
|
+
return `Audit failed: ${error.message}`;
|
|
76
|
+
}
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
/**
|
|
80
|
-
* Search case law
|
|
80
|
+
* Search case law in an isolated process because its CLI owns persistent state.
|
|
81
81
|
*/
|
|
82
82
|
function searchCaseLaw(query) {
|
|
83
83
|
const caseLawScript = path.resolve(
|
|
84
84
|
__dirname,
|
|
85
85
|
"../.agent/scripts/case_law_manager.js",
|
|
86
86
|
);
|
|
87
|
-
//
|
|
88
|
-
// that modifies global state, but we use spawn with minimal overhead
|
|
87
|
+
// case_law_manager is a standalone stateful CLI, so retain its process boundary.
|
|
89
88
|
const result = spawnSync(
|
|
90
89
|
process.execPath,
|
|
91
90
|
[caseLawScript, "search-cases", "--query", query],
|
|
@@ -94,6 +93,10 @@ function searchCaseLaw(query) {
|
|
|
94
93
|
timeout: SPAWN_TIMEOUT_MS,
|
|
95
94
|
},
|
|
96
95
|
);
|
|
96
|
+
if (result.error) {
|
|
97
|
+
if (result.error.code === "ETIMEDOUT") return "Error: Case law search timed out (exceeded 30s limit)";
|
|
98
|
+
return `Error executing case law search: ${result.error.message}`;
|
|
99
|
+
}
|
|
97
100
|
return result.stdout || result.stderr || "No results";
|
|
98
101
|
}
|
|
99
102
|
|
|
@@ -108,12 +111,27 @@ function stripBoilerplate(text) {
|
|
|
108
111
|
}
|
|
109
112
|
|
|
110
113
|
function handleRequest(req) {
|
|
114
|
+
if (req.method === "notifications/initialized" || req.method === "notifications/cancelled") {
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
if (req.method === "ping") {
|
|
118
|
+
return {};
|
|
119
|
+
}
|
|
120
|
+
if (req.method === "resources/list") {
|
|
121
|
+
return { resources: [] };
|
|
122
|
+
}
|
|
123
|
+
if (req.method === "prompts/list") {
|
|
124
|
+
return { prompts: [] };
|
|
125
|
+
}
|
|
126
|
+
|
|
111
127
|
// MCP spec: method names follow path-style convention
|
|
112
128
|
if (req.method === "initialize") {
|
|
113
129
|
return {
|
|
114
130
|
protocolVersion: "2024-11-05",
|
|
115
131
|
capabilities: {
|
|
116
132
|
tools: {},
|
|
133
|
+
resources: { subscribe: false, listChanged: false },
|
|
134
|
+
prompts: { listChanged: false },
|
|
117
135
|
},
|
|
118
136
|
serverInfo: {
|
|
119
137
|
name: "tribunal-kit-mcp",
|
|
@@ -301,7 +319,7 @@ function handleRequest(req) {
|
|
|
301
319
|
}
|
|
302
320
|
|
|
303
321
|
if (toolName === "run_tribunal_audit") {
|
|
304
|
-
const text =
|
|
322
|
+
const text = runTribunalAudit();
|
|
305
323
|
return { content: [{ type: "text", text }] };
|
|
306
324
|
}
|
|
307
325
|
|
|
@@ -365,10 +383,12 @@ function handleRequest(req) {
|
|
|
365
383
|
if (toolName === "get_tribunal_agent") {
|
|
366
384
|
const fs = require("fs");
|
|
367
385
|
const name = req.params?.arguments?.name;
|
|
368
|
-
if (!name) throw { code: -32602, message: "Missing argument: name" };
|
|
369
|
-
const path = require("path");
|
|
386
|
+
if (!name || typeof name !== "string") throw { code: -32602, message: "Missing or invalid argument: name (string)" };
|
|
370
387
|
const sanitizedName = path.basename(name);
|
|
371
|
-
const
|
|
388
|
+
const agentsDir = path.resolve(process.cwd(), ".agent", "agents");
|
|
389
|
+
const agentPath = path.resolve(agentsDir, `${sanitizedName}.md`);
|
|
390
|
+
// Path containment: ensure resolved path stays within agents directory
|
|
391
|
+
if (!agentPath.startsWith(agentsDir)) throw { code: -32602, message: "Invalid agent name: path traversal detected" };
|
|
372
392
|
if (!fs.existsSync(agentPath)) return { content: [{ type: "text", text: `Agent '${sanitizedName}' not found.` }] };
|
|
373
393
|
const text = fs.readFileSync(agentPath, "utf8");
|
|
374
394
|
return { content: [{ type: "text", text: stripBoilerplate(text) }] };
|
|
@@ -385,10 +405,12 @@ function handleRequest(req) {
|
|
|
385
405
|
if (toolName === "get_tribunal_skill") {
|
|
386
406
|
const fs = require("fs");
|
|
387
407
|
const name = req.params?.arguments?.name;
|
|
388
|
-
if (!name) throw { code: -32602, message: "Missing argument: name" };
|
|
389
|
-
const path = require("path");
|
|
408
|
+
if (!name || typeof name !== "string") throw { code: -32602, message: "Missing or invalid argument: name (string)" };
|
|
390
409
|
const sanitizedName = path.basename(name);
|
|
391
|
-
const
|
|
410
|
+
const skillsDir = path.resolve(process.cwd(), ".agent", "skills");
|
|
411
|
+
const skillPath = path.resolve(skillsDir, sanitizedName, "SKILL.md");
|
|
412
|
+
// Path containment: ensure resolved path stays within skills directory
|
|
413
|
+
if (!skillPath.startsWith(skillsDir)) throw { code: -32602, message: "Invalid skill name: path traversal detected" };
|
|
392
414
|
if (!fs.existsSync(skillPath)) return { content: [{ type: "text", text: `Skill '${sanitizedName}' not found.` }] };
|
|
393
415
|
const text = fs.readFileSync(skillPath, "utf8");
|
|
394
416
|
return { content: [{ type: "text", text: stripBoilerplate(text) }] };
|
|
@@ -408,7 +430,8 @@ function handleRequest(req) {
|
|
|
408
430
|
}
|
|
409
431
|
|
|
410
432
|
try {
|
|
411
|
-
const
|
|
433
|
+
const brokerScript = path.join(agentDest, "scripts", "context_broker.js");
|
|
434
|
+
const { broker } = require(brokerScript);
|
|
412
435
|
const brokerResult = broker(task, files, model, agentDest);
|
|
413
436
|
return { content: [{ type: "text", text: stripBoilerplate(brokerResult.promptText) }] };
|
|
414
437
|
} catch (e) {
|
|
@@ -499,7 +522,42 @@ function handleRequest(req) {
|
|
|
499
522
|
throw { code: -32601, message: `Unknown method: ${req.method}` };
|
|
500
523
|
}
|
|
501
524
|
|
|
525
|
+
function processSingleRequest(req) {
|
|
526
|
+
try {
|
|
527
|
+
const result = handleRequest(req);
|
|
528
|
+
// If it's a notification, do not send a response
|
|
529
|
+
if (req.id === undefined || req.id === null) {
|
|
530
|
+
return null;
|
|
531
|
+
}
|
|
532
|
+
return { jsonrpc: "2.0", id: req.id, result };
|
|
533
|
+
} catch (e) {
|
|
534
|
+
const code = e && typeof e.code === "number" ? e.code : -32603;
|
|
535
|
+
const message = e && e.message ? e.message : "Internal server error";
|
|
536
|
+
if (req.id === undefined || req.id === null) {
|
|
537
|
+
return {
|
|
538
|
+
jsonrpc: "2.0",
|
|
539
|
+
id: null,
|
|
540
|
+
error: { code, message },
|
|
541
|
+
};
|
|
542
|
+
}
|
|
543
|
+
return {
|
|
544
|
+
jsonrpc: "2.0",
|
|
545
|
+
id: req.id,
|
|
546
|
+
error: { code, message },
|
|
547
|
+
};
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
|
|
502
551
|
rl.on("line", (line) => {
|
|
552
|
+
if (line.length > 1048576) { // 1MB limit
|
|
553
|
+
const errorRes = {
|
|
554
|
+
jsonrpc: "2.0",
|
|
555
|
+
id: null,
|
|
556
|
+
error: { code: -32700, message: "Parse error: input line too long (exceeds 1MB limit)" },
|
|
557
|
+
};
|
|
558
|
+
console.log(JSON.stringify(errorRes));
|
|
559
|
+
return;
|
|
560
|
+
}
|
|
503
561
|
if (!line.trim()) return;
|
|
504
562
|
|
|
505
563
|
let req;
|
|
@@ -516,31 +574,22 @@ rl.on("line", (line) => {
|
|
|
516
574
|
return;
|
|
517
575
|
}
|
|
518
576
|
|
|
519
|
-
|
|
520
|
-
const
|
|
521
|
-
const
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
577
|
+
if (Array.isArray(req)) {
|
|
578
|
+
const responses = [];
|
|
579
|
+
for (const singleReq of req) {
|
|
580
|
+
const response = processSingleRequest(singleReq);
|
|
581
|
+
if (response) {
|
|
582
|
+
responses.push(response);
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
if (responses.length > 0) {
|
|
586
|
+
console.log(JSON.stringify(responses));
|
|
587
|
+
}
|
|
588
|
+
} else {
|
|
589
|
+
const response = processSingleRequest(req);
|
|
590
|
+
if (response) {
|
|
591
|
+
console.log(JSON.stringify(response));
|
|
533
592
|
}
|
|
534
|
-
} catch (e) {
|
|
535
|
-
// Send proper JSON-RPC error response
|
|
536
|
-
const code = e && typeof e.code === "number" ? e.code : -32603;
|
|
537
|
-
const message = e && e.message ? e.message : "Internal server error";
|
|
538
|
-
const errorRes = {
|
|
539
|
-
jsonrpc: "2.0",
|
|
540
|
-
id: req.id || null,
|
|
541
|
-
error: { code, message },
|
|
542
|
-
};
|
|
543
|
-
console.log(JSON.stringify(errorRes));
|
|
544
593
|
}
|
|
545
594
|
});
|
|
546
595
|
|
|
@@ -548,5 +597,6 @@ if (process.env.NODE_ENV === "test") {
|
|
|
548
597
|
module.exports = {
|
|
549
598
|
handleRequest,
|
|
550
599
|
stripBoilerplate,
|
|
600
|
+
runTribunalAudit,
|
|
551
601
|
};
|
|
552
602
|
}
|
package/bin/wrapper.js
CHANGED
|
@@ -21,8 +21,14 @@ const RUST_COMMANDS = new Set([
|
|
|
21
21
|
"hook",
|
|
22
22
|
"uninstall",
|
|
23
23
|
"memory",
|
|
24
|
+
"min-context",
|
|
25
|
+
"dag-schedule",
|
|
26
|
+
"context-compress",
|
|
27
|
+
"context-broker",
|
|
28
|
+
"optimize-step",
|
|
24
29
|
]);
|
|
25
30
|
|
|
31
|
+
|
|
26
32
|
// Determine the path to the compiled Rust binary
|
|
27
33
|
// In a full production release, this checks optionalDependencies in node_modules
|
|
28
34
|
// For development, it checks the local target/release folder
|
|
@@ -30,6 +36,11 @@ function getBinaryPath() {
|
|
|
30
36
|
if (process.env.TRIBUNAL_FORCE_JS === "1") {
|
|
31
37
|
return null;
|
|
32
38
|
}
|
|
39
|
+
|
|
40
|
+
if (process.env.TRIBUNAL_CORE_PATH && fs.existsSync(process.env.TRIBUNAL_CORE_PATH)) {
|
|
41
|
+
return process.env.TRIBUNAL_CORE_PATH;
|
|
42
|
+
}
|
|
43
|
+
|
|
33
44
|
const isWindows = os.platform() === "win32";
|
|
34
45
|
const ext = isWindows ? ".exe" : "";
|
|
35
46
|
const platform = os.platform();
|
|
@@ -38,46 +49,62 @@ function getBinaryPath() {
|
|
|
38
49
|
// First, try production resolution (from optionalDependencies)
|
|
39
50
|
const pkgName = `@tribunal-kit/core-${platform}-${arch}`;
|
|
40
51
|
try {
|
|
41
|
-
// Try to resolve the binary from the optional dependency package
|
|
42
52
|
const pkgPath = require.resolve(`${pkgName}/package.json`);
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
`bin/tribunal-core${ext}`,
|
|
46
|
-
);
|
|
53
|
+
const pkgDir = path.dirname(pkgPath);
|
|
54
|
+
const binPath = path.resolve(pkgDir, `bin/tribunal-core${ext}`);
|
|
47
55
|
if (fs.existsSync(binPath)) {
|
|
48
56
|
return binPath;
|
|
49
57
|
}
|
|
58
|
+
const rootBinPath = path.resolve(pkgDir, `tribunal-core${ext}`);
|
|
59
|
+
if (fs.existsSync(rootBinPath)) {
|
|
60
|
+
return rootBinPath;
|
|
61
|
+
}
|
|
50
62
|
} catch {
|
|
51
63
|
// Package not found, ignore and fall back to local dev targets
|
|
52
64
|
}
|
|
53
65
|
|
|
54
|
-
// Second, try to find the binary
|
|
55
|
-
const
|
|
56
|
-
__dirname,
|
|
57
|
-
"..",
|
|
58
|
-
"target",
|
|
59
|
-
"
|
|
60
|
-
`tribunal-core${ext}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
66
|
+
// Second, try to find the binary in local dev target directories
|
|
67
|
+
const candidatePaths = [
|
|
68
|
+
path.resolve(__dirname, "..", "target", "release", `tribunal-core${ext}`),
|
|
69
|
+
path.resolve(__dirname, "..", "target", "debug", `tribunal-core${ext}`),
|
|
70
|
+
path.resolve(__dirname, "..", "..", "target", "release", `tribunal-core${ext}`),
|
|
71
|
+
path.resolve(__dirname, "..", "..", "target", "debug", `tribunal-core${ext}`),
|
|
72
|
+
path.resolve(process.cwd(), "target", "release", `tribunal-core${ext}`),
|
|
73
|
+
path.resolve(process.cwd(), "target", "debug", `tribunal-core${ext}`),
|
|
74
|
+
path.resolve(process.cwd(), "tribunal-kit", "target", "release", `tribunal-core${ext}`),
|
|
75
|
+
path.resolve(process.cwd(), "tribunal-kit", "target", "debug", `tribunal-core${ext}`),
|
|
76
|
+
];
|
|
77
|
+
|
|
78
|
+
for (const candidate of candidatePaths) {
|
|
79
|
+
if (fs.existsSync(candidate)) {
|
|
80
|
+
return candidate;
|
|
81
|
+
}
|
|
64
82
|
}
|
|
65
83
|
|
|
66
|
-
// Third,
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
84
|
+
// Third, attempt on-demand compilation if Cargo.toml exists locally and cargo is installed
|
|
85
|
+
const cargoTomlPath = path.resolve(__dirname, "..", "Cargo.toml");
|
|
86
|
+
if (fs.existsSync(cargoTomlPath)) {
|
|
87
|
+
try {
|
|
88
|
+
const buildResult = spawnSync("cargo", ["build", "--release"], {
|
|
89
|
+
cwd: path.resolve(__dirname, ".."),
|
|
90
|
+
stdio: "ignore",
|
|
91
|
+
timeout: 60000,
|
|
92
|
+
});
|
|
93
|
+
if (buildResult.status === 0) {
|
|
94
|
+
const releasePath = candidatePaths[0];
|
|
95
|
+
if (fs.existsSync(releasePath)) {
|
|
96
|
+
return releasePath;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
} catch {
|
|
100
|
+
// cargo not available or build failed, fallback gracefully
|
|
101
|
+
}
|
|
76
102
|
}
|
|
77
103
|
|
|
78
104
|
return null;
|
|
79
105
|
}
|
|
80
106
|
|
|
107
|
+
|
|
81
108
|
function runRustBinary(binPath, args) {
|
|
82
109
|
const stdio = [
|
|
83
110
|
"inherit",
|
|
@@ -90,10 +117,13 @@ function runRustBinary(binPath, args) {
|
|
|
90
117
|
});
|
|
91
118
|
|
|
92
119
|
if (result.error) {
|
|
93
|
-
|
|
94
|
-
|
|
120
|
+
// Graceful degradation: fall back to JS engine instead of hard-crashing.
|
|
121
|
+
// Spawn errors include missing binaries, permission denied, corrupted
|
|
122
|
+
// executables, missing shared libraries, and OS-level exec failures.
|
|
123
|
+
console.warn(
|
|
124
|
+
`\x1b[93m⚠ Rust engine failed (${result.error.code || result.error.message}). Falling back to JS engine.\x1b[0m`,
|
|
95
125
|
);
|
|
96
|
-
|
|
126
|
+
return false; // Signal caller to fall back
|
|
97
127
|
}
|
|
98
128
|
|
|
99
129
|
process.exit(result.status || 0);
|
|
@@ -103,7 +133,10 @@ function runLegacyFallback() {
|
|
|
103
133
|
// Use the modular dist/ CLI with lazy-loaded commands for faster cold-start.
|
|
104
134
|
// Each command module is require()'d only when invoked (~70% fewer files loaded).
|
|
105
135
|
const { main } = require("../dist/cli.js");
|
|
106
|
-
main()
|
|
136
|
+
main().catch((err) => {
|
|
137
|
+
console.error(`\x1b[91m✖ Fatal Error:\x1b[0m ${err.message || err}`);
|
|
138
|
+
process.exit(1);
|
|
139
|
+
});
|
|
107
140
|
}
|
|
108
141
|
|
|
109
142
|
function main() {
|
|
@@ -125,8 +158,11 @@ function main() {
|
|
|
125
158
|
|
|
126
159
|
// Route to Rust engine
|
|
127
160
|
// console.log('\x1b[90m⚡ Executing via Rust Core Engine\x1b[0m');
|
|
128
|
-
runRustBinary(binPath, args);
|
|
129
|
-
|
|
161
|
+
const rustResult = runRustBinary(binPath, args);
|
|
162
|
+
if (rustResult !== false) {
|
|
163
|
+
return; // Rust engine handled it (process.exit was called)
|
|
164
|
+
}
|
|
165
|
+
// rustResult === false means spawn error; fall through to JS fallback
|
|
130
166
|
} else {
|
|
131
167
|
// Warn if Rust command was requested but binary is missing
|
|
132
168
|
console.warn(
|
package/dist/cli.js
CHANGED
|
@@ -106,6 +106,11 @@ function cmdHelp(quiet = false) {
|
|
|
106
106
|
(0, logger_1.log)(cmd('compile', 'Compile rules into a static instruction file for terminal agents'));
|
|
107
107
|
(0, logger_1.log)(cmd('memory', '4-Type Taxonomy Persistent Memory Engine (store, recall, gc, stats, export)'));
|
|
108
108
|
(0, logger_1.log)(cmd('optimize-skill', 'Optimize project skills actively using SkillOpt validation gates'));
|
|
109
|
+
(0, logger_1.log)(cmd('validate', 'Validate a JSON payload against a Tribunal schema'));
|
|
110
|
+
(0, logger_1.log)(cmd('min-context', 'Remove empty lines from a context file'));
|
|
111
|
+
(0, logger_1.log)(cmd('dag-schedule', 'Compute parallel execution waves from task dependencies'));
|
|
112
|
+
(0, logger_1.log)(cmd('context-compress', 'Compress a context file while retaining VERIFY comments'));
|
|
113
|
+
(0, logger_1.log)(cmd('optimize-step', 'Apply bounded SkillOpt edits from a JSON payload'));
|
|
109
114
|
(0, logger_1.log)(cmd('guardrail', 'Validate .agent/ integrity (phantom refs, count mismatches, drift)'));
|
|
110
115
|
(0, logger_1.log)(cmd('uninstall', 'Remove .agent/ folder from project'));
|
|
111
116
|
console.log();
|
|
@@ -242,6 +247,11 @@ async function runWithUpdateCheck(command, flags) {
|
|
|
242
247
|
await cmdMarathon(flags, process.argv, quiet);
|
|
243
248
|
break;
|
|
244
249
|
}
|
|
250
|
+
case 'minimal': {
|
|
251
|
+
const cmdMinimal = loadCmd('./commands/minimal', 'cmdMinimal');
|
|
252
|
+
cmdMinimal(flags, quiet);
|
|
253
|
+
break;
|
|
254
|
+
}
|
|
245
255
|
case 'compile': {
|
|
246
256
|
const cmdCompile = loadCmd('./commands/compile', 'cmdCompile');
|
|
247
257
|
await cmdCompile(flags, quiet);
|
|
@@ -267,6 +277,31 @@ async function runWithUpdateCheck(command, flags) {
|
|
|
267
277
|
await cmdGuardrail(flags, process.argv, quiet);
|
|
268
278
|
break;
|
|
269
279
|
}
|
|
280
|
+
case 'validate': {
|
|
281
|
+
const cmdValidate = loadCmd('./commands/validate', 'cmdValidate');
|
|
282
|
+
cmdValidate(flags, process.argv, quiet);
|
|
283
|
+
break;
|
|
284
|
+
}
|
|
285
|
+
case 'min-context': {
|
|
286
|
+
const cmdMinContext = loadCmd('./commands/native', 'cmdMinContext');
|
|
287
|
+
cmdMinContext(process.argv, quiet);
|
|
288
|
+
break;
|
|
289
|
+
}
|
|
290
|
+
case 'dag-schedule': {
|
|
291
|
+
const cmdDagSchedule = loadCmd('./commands/native', 'cmdDagSchedule');
|
|
292
|
+
cmdDagSchedule(process.argv, quiet);
|
|
293
|
+
break;
|
|
294
|
+
}
|
|
295
|
+
case 'context-compress': {
|
|
296
|
+
const cmdContextCompress = loadCmd('./commands/native', 'cmdContextCompress');
|
|
297
|
+
cmdContextCompress(process.argv, quiet);
|
|
298
|
+
break;
|
|
299
|
+
}
|
|
300
|
+
case 'optimize-step': {
|
|
301
|
+
const cmdOptimizeStep = loadCmd('./commands/native', 'cmdOptimizeStep');
|
|
302
|
+
cmdOptimizeStep(process.argv, quiet);
|
|
303
|
+
break;
|
|
304
|
+
}
|
|
270
305
|
case 'help':
|
|
271
306
|
case '--help':
|
|
272
307
|
case '-h':
|
|
@@ -287,5 +322,8 @@ async function main() {
|
|
|
287
322
|
await runWithUpdateCheck(command, flags);
|
|
288
323
|
}
|
|
289
324
|
if (require.main === module) {
|
|
290
|
-
main()
|
|
325
|
+
main().catch(err => {
|
|
326
|
+
console.error(`\x1b[91m✖ Fatal Error:\x1b[0m ${err.message || err}`);
|
|
327
|
+
process.exit(1);
|
|
328
|
+
});
|
|
291
329
|
}
|
package/dist/commands/compile.js
CHANGED
|
@@ -74,6 +74,13 @@ async function cmdCompile(flags, quiet) {
|
|
|
74
74
|
if (flags.target === "claude") targetFile = ".claude.json";
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
+
const byteLength = Buffer.byteLength(compiledContext, "utf-8");
|
|
78
|
+
const mbSize = byteLength / (1024 * 1024);
|
|
79
|
+
if (mbSize > 5.0 && !quiet) {
|
|
80
|
+
const { warn } = require("../utils/logger");
|
|
81
|
+
warn(`Compiled context is very large (~${mbSize.toFixed(2)} MB). This might overload some LLM context windows.`);
|
|
82
|
+
}
|
|
83
|
+
|
|
77
84
|
const outputPath = path.join(cwd, targetFile);
|
|
78
85
|
fs.writeFileSync(outputPath, compiledContext, "utf-8");
|
|
79
86
|
|
package/dist/commands/context.js
CHANGED
|
@@ -19,11 +19,16 @@ function cmdContext(flags, processArgs) {
|
|
|
19
19
|
console.error('Usage: npx tribunal-kit context <target_file>');
|
|
20
20
|
process.exit(1);
|
|
21
21
|
}
|
|
22
|
-
const
|
|
23
|
-
const
|
|
22
|
+
const resolvedTarget = path_1.default.resolve(targetDir, args[0]);
|
|
23
|
+
const relativePath = path_1.default.relative(targetDir, resolvedTarget).replace(/\\/g, '/');
|
|
24
|
+
if (relativePath.startsWith('../') || relativePath === '..' || path_1.default.isAbsolute(relativePath)) {
|
|
25
|
+
console.error(' \x1b[91m✖\x1b[0m File must be within the project directory: ' + args[0]);
|
|
26
|
+
process.exit(1);
|
|
27
|
+
}
|
|
28
|
+
const snapshotName = relativePath.replace(/[\\\/]/g, '__') + '.json';
|
|
24
29
|
const snapshotPath = path_1.default.join(agentDest, 'history', 'snapshots', snapshotName);
|
|
25
30
|
if (!fs_1.default.existsSync(snapshotPath)) {
|
|
26
|
-
console.error(' \x1b[91m✖\x1b[0m Context Snapshot not found for: ' +
|
|
31
|
+
console.error(' \x1b[91m✖\x1b[0m Context Snapshot not found for: ' + args[0]);
|
|
27
32
|
console.log(' Run: npx tribunal-kit graph (to generate snapshots)');
|
|
28
33
|
process.exit(1);
|
|
29
34
|
}
|
package/dist/commands/graph.js
CHANGED
|
@@ -23,8 +23,14 @@ async function cmdGraph(flags, quiet = false) {
|
|
|
23
23
|
await (0, helpers_1.runShellAsync)(`node "${builderScript}"`, { stdio: 'inherit', cwd: targetDir });
|
|
24
24
|
await (0, helpers_1.runShellAsync)(`node "${visualizerScript}"`, { stdio: 'inherit', cwd: targetDir });
|
|
25
25
|
(0, logger_1.log)(` ${(0, logger_1.c)('cyan', '▸')} Opening visualizer in browser...`);
|
|
26
|
-
const
|
|
27
|
-
|
|
26
|
+
const child_process = require('child_process');
|
|
27
|
+
if (process.platform === 'win32') {
|
|
28
|
+
child_process.spawn('cmd.exe', ['/c', 'start', '', htmlFile], { stdio: 'ignore', detached: true }).unref();
|
|
29
|
+
} else if (process.platform === 'darwin') {
|
|
30
|
+
child_process.spawn('open', [htmlFile], { stdio: 'ignore', detached: true }).unref();
|
|
31
|
+
} else {
|
|
32
|
+
child_process.spawn('xdg-open', [htmlFile], { stdio: 'ignore', detached: true }).unref();
|
|
33
|
+
}
|
|
28
34
|
}
|
|
29
35
|
catch (e) {
|
|
30
36
|
if (e instanceof Error) {
|
package/dist/commands/init.js
CHANGED
|
@@ -26,13 +26,22 @@ const CORE_AGENTS = new Set([
|
|
|
26
26
|
'explorer-agent.md',
|
|
27
27
|
'project-planner.md',
|
|
28
28
|
'test-engineer.md',
|
|
29
|
+
'ui-ux-auditor.md',
|
|
30
|
+
'ui-visual-auditor.md',
|
|
31
|
+
'accessibility-reviewer.md',
|
|
32
|
+
'ux-reviewer.md',
|
|
33
|
+
'visual-reviewer.md',
|
|
34
|
+
'interaction-reviewer.md',
|
|
35
|
+
'anti-pattern-reviewer.md',
|
|
36
|
+
'product-reviewer.md',
|
|
29
37
|
]);
|
|
30
38
|
// Core skills to install in --minimal mode
|
|
31
39
|
const CORE_SKILLS = new Set([
|
|
32
40
|
'clean-code', 'architecture', 'testing-patterns', 'systematic-debugging',
|
|
33
41
|
'frontend-design', 'database-design', 'api-patterns', 'nodejs-best-practices',
|
|
34
42
|
'vulnerability-scanner', 'typescript-advanced', 'python-pro', 'nextjs-react-expert',
|
|
35
|
-
'react-specialist', 'performance-profiling', 'lint-and-validate',
|
|
43
|
+
'react-specialist', 'performance-profiling', 'lint-and-validate', 'ui-ux-pro-max',
|
|
44
|
+
'ui-reasoning-engine', 'product-aware-heuristics', 'web-design-guidelines',
|
|
36
45
|
]);
|
|
37
46
|
async function cmdInit(flags, quiet = false) {
|
|
38
47
|
const agentSrc = (0, helpers_1.getKitAgent)();
|
|
@@ -267,12 +276,13 @@ async function cmdInit(flags, quiet = false) {
|
|
|
267
276
|
console.log(drawRow(' Next Steps:', (0, logger_1.c)('gray', ' Next Steps:')));
|
|
268
277
|
console.log(stepRow('/generate', 'Generate code with reviews'));
|
|
269
278
|
console.log(stepRow('/review', 'Audit existing code for issues'));
|
|
270
|
-
console.log(stepRow('/tribunal-full', 'Run all
|
|
279
|
+
console.log(stepRow('/tribunal-full', 'Run all 21 reviewers in parallel'));
|
|
271
280
|
console.log(drawRow('', ''));
|
|
272
281
|
console.log(` ${(0, logger_1.c)(borderCol, '└' + '─'.repeat(W) + '┘')}`);
|
|
273
282
|
console.log();
|
|
274
283
|
(0, logger_1.log)(` ${(0, logger_1.c)('gray', '✦ Generating IDE bridge files...')}`);
|
|
275
284
|
await generateIDEBridges(targetDir, agentDest, dryRun, isMinimal);
|
|
285
|
+
await scaffoldDesignSystem(targetDir, agentSrc, dryRun);
|
|
276
286
|
}
|
|
277
287
|
console.log();
|
|
278
288
|
}
|
|
@@ -375,4 +385,29 @@ ${rulesContent}
|
|
|
375
385
|
await Promise.all(bridges.map(b => writeBridge(b.path, b.content, b.label)));
|
|
376
386
|
console.log();
|
|
377
387
|
}
|
|
388
|
+
async function scaffoldDesignSystem(targetDir, agentSrc, dryRun = false) {
|
|
389
|
+
const designMdSrc = path_1.default.join(agentSrc, 'templates', 'DESIGN.md');
|
|
390
|
+
const designTokensSrc = path_1.default.join(agentSrc, 'templates', 'design-tokens.json');
|
|
391
|
+
const designMdDest = path_1.default.join(targetDir, 'DESIGN.md');
|
|
392
|
+
const designTokensDest = path_1.default.join(targetDir, 'design-tokens.json');
|
|
393
|
+
|
|
394
|
+
const copyIfMissing = async (src, dest, label) => {
|
|
395
|
+
if (!fs_1.default.existsSync(src)) return;
|
|
396
|
+
if (fs_1.default.existsSync(dest)) {
|
|
397
|
+
(0, logger_1.dbg)(` skip (exists): ${path_1.default.basename(dest)}`);
|
|
398
|
+
return;
|
|
399
|
+
}
|
|
400
|
+
if (dryRun) {
|
|
401
|
+
(0, logger_1.dbg)(` would create: ${dest}`);
|
|
402
|
+
return;
|
|
403
|
+
}
|
|
404
|
+
await fs_1.default.promises.copyFile(src, dest);
|
|
405
|
+
(0, logger_1.ok)(`${label} → ${(0, logger_1.c)('gray', path_1.default.relative(targetDir, dest))}`);
|
|
406
|
+
};
|
|
407
|
+
|
|
408
|
+
await copyIfMissing(designMdSrc, designMdDest, 'DESIGN.md System');
|
|
409
|
+
await copyIfMissing(designTokensSrc, designTokensDest, 'Design Tokens');
|
|
410
|
+
}
|
|
411
|
+
exports.CORE_AGENTS = CORE_AGENTS;
|
|
412
|
+
exports.CORE_SKILLS = CORE_SKILLS;
|
|
378
413
|
|