tribunal-kit 5.8.5 → 6.0.1
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/.manifest.json +78 -0
- package/.agent/ARCHITECTURE.md +32 -253
- 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 +63 -33
- package/.agent/history/memory/.memory.idx +2701 -1
- package/.agent/history/memory/MEMORY.md +179 -1
- package/.agent/routing_index.json +273 -690
- package/.agent/rules/GEMINI.md +11 -13
- package/.agent/rules/GEMINI_PLANNER.md +84 -0
- package/.agent/scripts/case_law_manager.js +2 -0
- package/.agent/scripts/context_broker.js +152 -0
- package/.agent/scripts/guardrail_engine.js +59 -4
- package/.agent/scripts/impact_classifier.js +167 -0
- package/.agent/scripts/minimal_change_engine.js +437 -0
- package/.agent/scripts/pipeline_engine.js +856 -0
- package/.agent/scripts/socratic_gate_policy.js +60 -0
- 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/skill_topic_map.json +218 -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/agentic-workflows-2026/SKILL.md +76 -0
- package/.agent/skills/ai-app-hardening/SKILL.md +58 -0
- 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-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 +19 -10
- 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/context-engineering-pro/SKILL.md +69 -0
- 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/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/duckdb-analytical-sql/SKILL.md +55 -0
- package/.agent/skills/edge-ai-mobile/SKILL.md +46 -0
- 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/expo-router-v4/SKILL.md +80 -0
- 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 +19 -10
- 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 +64 -201
- 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/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/impeccable/SKILL.md +19 -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/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/monorepo-management/SKILL.md +21 -7
- package/.agent/skills/morphing-icons/SKILL.md +19 -10
- package/.agent/skills/motion-engineering/SKILL.md +20 -7
- package/.agent/skills/nextjs-react-expert/SKILL.md +19 -7
- package/.agent/skills/nodejs-best-practices/SKILL.md +21 -7
- package/.agent/skills/observability/SKILL.md +21 -7
- package/.agent/skills/opentelemetry-observability/SKILL.md +58 -0
- 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/plan-writing/SKILL.md +21 -7
- package/.agent/skills/platform-engineer/SKILL.md +21 -7
- package/.agent/skills/platform-engineering-opentofu/SKILL.md +67 -0
- package/.agent/skills/playwright-ai-e2e/SKILL.md +59 -0
- 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/property-based-testing/SKILL.md +60 -0
- 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/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/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/vector-search-pgvector/SKILL.md +77 -0
- package/.agent/skills/vue-expert/SKILL.md +19 -6
- package/.agent/skills/vulnerability-scanner/SKILL.md +21 -7
- 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/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/skills/zero-trust-passkeys/SKILL.md +85 -0
- 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 +41 -26
- 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 +82 -60
- package/SECURITY.md +3 -3
- package/bin/mcp-server.js +253 -57
- package/bin/wrapper.js +24 -10
- package/dist/cli.js +29 -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 +13 -2
- package/dist/commands/memory.js +120 -68
- package/dist/commands/minimal.js +71 -0
- package/dist/commands/native.js +36 -0
- package/dist/commands/optimize.js +15 -5
- package/dist/esm/index.mjs +58 -32
- package/dist/index.d.ts +50 -2
- 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 +16 -10
- package/scripts/benchmark.js +16 -0
- package/scripts/sync-version.js +1 -1
- package/scripts/visual_audit.js +126 -0
package/bin/mcp-server.js
CHANGED
|
@@ -93,6 +93,10 @@ function searchCaseLaw(query) {
|
|
|
93
93
|
timeout: SPAWN_TIMEOUT_MS,
|
|
94
94
|
},
|
|
95
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
|
+
}
|
|
96
100
|
return result.stdout || result.stderr || "No results";
|
|
97
101
|
}
|
|
98
102
|
|
|
@@ -106,13 +110,30 @@ function stripBoilerplate(text) {
|
|
|
106
110
|
return minified.trim();
|
|
107
111
|
}
|
|
108
112
|
|
|
113
|
+
function getAgentDir() {
|
|
114
|
+
const fs = require("fs");
|
|
115
|
+
const local = path.join(process.cwd(), ".agent");
|
|
116
|
+
if (fs.existsSync(local)) return local;
|
|
117
|
+
return path.resolve(__dirname, "../.agent");
|
|
118
|
+
}
|
|
119
|
+
|
|
109
120
|
function handleRequest(req) {
|
|
121
|
+
const fs = require("fs");
|
|
122
|
+
if (req.method === "notifications/initialized" || req.method === "notifications/cancelled") {
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
if (req.method === "ping") {
|
|
126
|
+
return {};
|
|
127
|
+
}
|
|
128
|
+
|
|
110
129
|
// MCP spec: method names follow path-style convention
|
|
111
130
|
if (req.method === "initialize") {
|
|
112
131
|
return {
|
|
113
|
-
protocolVersion: "
|
|
132
|
+
protocolVersion: "2025-03-26",
|
|
114
133
|
capabilities: {
|
|
115
134
|
tools: {},
|
|
135
|
+
resources: { subscribe: false, listChanged: false },
|
|
136
|
+
prompts: { listChanged: false },
|
|
116
137
|
},
|
|
117
138
|
serverInfo: {
|
|
118
139
|
name: "tribunal-kit-mcp",
|
|
@@ -121,6 +142,148 @@ function handleRequest(req) {
|
|
|
121
142
|
};
|
|
122
143
|
}
|
|
123
144
|
|
|
145
|
+
if (req.method === "resources/list") {
|
|
146
|
+
const agentDir = getAgentDir();
|
|
147
|
+
const resources = [];
|
|
148
|
+
|
|
149
|
+
// Agents
|
|
150
|
+
const agentsDir = path.join(agentDir, "agents");
|
|
151
|
+
if (fs.existsSync(agentsDir)) {
|
|
152
|
+
const files = fs.readdirSync(agentsDir).filter((f) => f.endsWith(".md"));
|
|
153
|
+
for (const f of files) {
|
|
154
|
+
const name = path.basename(f, ".md");
|
|
155
|
+
resources.push({
|
|
156
|
+
uri: `tribunal://agent/${name}`,
|
|
157
|
+
name: `Agent: ${name}`,
|
|
158
|
+
description: `Tribunal Specialist Agent rule file for ${name}`,
|
|
159
|
+
mimeType: "text/markdown",
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// Skills
|
|
165
|
+
const skillsDir = path.join(agentDir, "skills");
|
|
166
|
+
if (fs.existsSync(skillsDir)) {
|
|
167
|
+
const dirs = fs.readdirSync(skillsDir, { withFileTypes: true });
|
|
168
|
+
for (const d of dirs) {
|
|
169
|
+
if (d.isDirectory()) {
|
|
170
|
+
const skillFile = path.join(skillsDir, d.name, "SKILL.md");
|
|
171
|
+
if (fs.existsSync(skillFile)) {
|
|
172
|
+
resources.push({
|
|
173
|
+
uri: `tribunal://skill/${d.name}`,
|
|
174
|
+
name: `Skill: ${d.name}`,
|
|
175
|
+
description: `Tribunal Skill instruction file for ${d.name}`,
|
|
176
|
+
mimeType: "text/markdown",
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// Workflows
|
|
184
|
+
const workflowsDir = path.join(agentDir, "workflows");
|
|
185
|
+
if (fs.existsSync(workflowsDir)) {
|
|
186
|
+
const files = fs.readdirSync(workflowsDir).filter((f) => f.endsWith(".md"));
|
|
187
|
+
for (const f of files) {
|
|
188
|
+
const name = path.basename(f, ".md");
|
|
189
|
+
resources.push({
|
|
190
|
+
uri: `tribunal://workflow/${name}`,
|
|
191
|
+
name: `Workflow: ${name}`,
|
|
192
|
+
description: `Tribunal Workflow guide for ${name}`,
|
|
193
|
+
mimeType: "text/markdown",
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
return { resources };
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
if (req.method === "resources/read") {
|
|
202
|
+
const uri = req.params && req.params.uri;
|
|
203
|
+
if (!uri) throw new Error("Missing uri parameter");
|
|
204
|
+
const agentDir = getAgentDir();
|
|
205
|
+
let filePath = null;
|
|
206
|
+
|
|
207
|
+
if (uri.startsWith("tribunal://agent/")) {
|
|
208
|
+
const name = uri.replace("tribunal://agent/", "");
|
|
209
|
+
filePath = path.join(agentDir, "agents", `${name}.md`);
|
|
210
|
+
} else if (uri.startsWith("tribunal://skill/")) {
|
|
211
|
+
const name = uri.replace("tribunal://skill/", "");
|
|
212
|
+
filePath = path.join(agentDir, "skills", name, "SKILL.md");
|
|
213
|
+
} else if (uri.startsWith("tribunal://workflow/")) {
|
|
214
|
+
const name = uri.replace("tribunal://workflow/", "");
|
|
215
|
+
filePath = path.join(agentDir, "workflows", `${name}.md`);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
if (!filePath || !fs.existsSync(filePath)) {
|
|
219
|
+
throw new Error(`Resource not found: ${uri}`);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
const text = fs.readFileSync(filePath, "utf8");
|
|
223
|
+
return {
|
|
224
|
+
contents: [
|
|
225
|
+
{
|
|
226
|
+
uri,
|
|
227
|
+
mimeType: "text/markdown",
|
|
228
|
+
text,
|
|
229
|
+
},
|
|
230
|
+
],
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
if (req.method === "prompts/list") {
|
|
235
|
+
const agentDir = getAgentDir();
|
|
236
|
+
const prompts = [];
|
|
237
|
+
const workflowsDir = path.join(agentDir, "workflows");
|
|
238
|
+
|
|
239
|
+
if (fs.existsSync(workflowsDir)) {
|
|
240
|
+
const files = fs.readdirSync(workflowsDir).filter((f) => f.endsWith(".md"));
|
|
241
|
+
for (const f of files) {
|
|
242
|
+
const name = path.basename(f, ".md");
|
|
243
|
+
prompts.push({
|
|
244
|
+
name,
|
|
245
|
+
description: `Execute tribunal workflow /${name}`,
|
|
246
|
+
arguments: [
|
|
247
|
+
{
|
|
248
|
+
name: "task",
|
|
249
|
+
description: "The task or target file to execute the workflow against",
|
|
250
|
+
required: false,
|
|
251
|
+
},
|
|
252
|
+
],
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
return { prompts };
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
if (req.method === "prompts/get") {
|
|
261
|
+
const name = req.params && req.params.name;
|
|
262
|
+
const task = (req.params && req.params.arguments && req.params.arguments.task) || "";
|
|
263
|
+
if (!name) throw new Error("Missing prompt name parameter");
|
|
264
|
+
|
|
265
|
+
const agentDir = getAgentDir();
|
|
266
|
+
const workflowPath = path.join(agentDir, "workflows", `${name}.md`);
|
|
267
|
+
if (!fs.existsSync(workflowPath)) {
|
|
268
|
+
throw new Error(`Prompt workflow not found: ${name}`);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
const content = fs.readFileSync(workflowPath, "utf8");
|
|
272
|
+
const promptText = task ? `${content}\n\nTarget Task/File: ${task}` : content;
|
|
273
|
+
|
|
274
|
+
return {
|
|
275
|
+
messages: [
|
|
276
|
+
{
|
|
277
|
+
role: "user",
|
|
278
|
+
content: {
|
|
279
|
+
type: "text",
|
|
280
|
+
text: promptText,
|
|
281
|
+
},
|
|
282
|
+
},
|
|
283
|
+
],
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
|
|
124
287
|
if (req.method === "tools/list") {
|
|
125
288
|
return {
|
|
126
289
|
tools: [
|
|
@@ -318,26 +481,28 @@ function handleRequest(req) {
|
|
|
318
481
|
],
|
|
319
482
|
};
|
|
320
483
|
}
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
484
|
+
try {
|
|
485
|
+
const { generateIDEBridges } = require(path.resolve(__dirname, "../dist/commands/init.js"));
|
|
486
|
+
// generateIDEBridges is async — execute synchronously in MCP context
|
|
487
|
+
generateIDEBridges(cwd, agentDest, true).then(() => {}).catch(() => {});
|
|
488
|
+
return {
|
|
489
|
+
content: [
|
|
490
|
+
{
|
|
491
|
+
type: "text",
|
|
492
|
+
text: "Sync complete",
|
|
493
|
+
},
|
|
494
|
+
],
|
|
495
|
+
};
|
|
496
|
+
} catch (e) {
|
|
497
|
+
return {
|
|
498
|
+
content: [
|
|
499
|
+
{
|
|
500
|
+
type: "text",
|
|
501
|
+
text: `Sync failed: ${e.message}`,
|
|
502
|
+
},
|
|
503
|
+
],
|
|
504
|
+
};
|
|
505
|
+
}
|
|
341
506
|
}
|
|
342
507
|
|
|
343
508
|
if (toolName === "search_case_law") {
|
|
@@ -355,7 +520,7 @@ function handleRequest(req) {
|
|
|
355
520
|
|
|
356
521
|
if (toolName === "list_tribunal_agents") {
|
|
357
522
|
const fs = require("fs");
|
|
358
|
-
const agentDir = path.join(
|
|
523
|
+
const agentDir = path.join(getAgentDir(), "agents");
|
|
359
524
|
if (!fs.existsSync(agentDir)) return { content: [{ type: "text", text: "No agents found or .agent directory missing." }] };
|
|
360
525
|
const agents = fs.readdirSync(agentDir).filter(f => f.endsWith('.md')).map(f => f.replace('.md', ''));
|
|
361
526
|
return { content: [{ type: "text", text: "Available Agents:\n- " + agents.join("\n- ") }] };
|
|
@@ -364,10 +529,12 @@ function handleRequest(req) {
|
|
|
364
529
|
if (toolName === "get_tribunal_agent") {
|
|
365
530
|
const fs = require("fs");
|
|
366
531
|
const name = req.params?.arguments?.name;
|
|
367
|
-
if (!name) throw { code: -32602, message: "Missing argument: name" };
|
|
368
|
-
const path = require("path");
|
|
532
|
+
if (!name || typeof name !== "string") throw { code: -32602, message: "Missing or invalid argument: name (string)" };
|
|
369
533
|
const sanitizedName = path.basename(name);
|
|
370
|
-
const
|
|
534
|
+
const agentsDir = path.resolve(getAgentDir(), "agents");
|
|
535
|
+
const agentPath = path.resolve(agentsDir, `${sanitizedName}.md`);
|
|
536
|
+
// Path containment: ensure resolved path stays within agents directory
|
|
537
|
+
if (!agentPath.startsWith(agentsDir)) throw { code: -32602, message: "Invalid agent name: path traversal detected" };
|
|
371
538
|
if (!fs.existsSync(agentPath)) return { content: [{ type: "text", text: `Agent '${sanitizedName}' not found.` }] };
|
|
372
539
|
const text = fs.readFileSync(agentPath, "utf8");
|
|
373
540
|
return { content: [{ type: "text", text: stripBoilerplate(text) }] };
|
|
@@ -375,7 +542,7 @@ function handleRequest(req) {
|
|
|
375
542
|
|
|
376
543
|
if (toolName === "list_tribunal_skills") {
|
|
377
544
|
const fs = require("fs");
|
|
378
|
-
const skillsDir = path.join(
|
|
545
|
+
const skillsDir = path.join(getAgentDir(), "skills");
|
|
379
546
|
if (!fs.existsSync(skillsDir)) return { content: [{ type: "text", text: "No skills found or .agent directory missing." }] };
|
|
380
547
|
const skills = fs.readdirSync(skillsDir, { withFileTypes: true }).filter(d => d.isDirectory()).map(d => d.name);
|
|
381
548
|
return { content: [{ type: "text", text: "Available Skills:\n- " + skills.join("\n- ") }] };
|
|
@@ -384,10 +551,12 @@ function handleRequest(req) {
|
|
|
384
551
|
if (toolName === "get_tribunal_skill") {
|
|
385
552
|
const fs = require("fs");
|
|
386
553
|
const name = req.params?.arguments?.name;
|
|
387
|
-
if (!name) throw { code: -32602, message: "Missing argument: name" };
|
|
388
|
-
const path = require("path");
|
|
554
|
+
if (!name || typeof name !== "string") throw { code: -32602, message: "Missing or invalid argument: name (string)" };
|
|
389
555
|
const sanitizedName = path.basename(name);
|
|
390
|
-
const
|
|
556
|
+
const skillsDir = path.resolve(getAgentDir(), "skills");
|
|
557
|
+
const skillPath = path.resolve(skillsDir, sanitizedName, "SKILL.md");
|
|
558
|
+
// Path containment: ensure resolved path stays within skills directory
|
|
559
|
+
if (!skillPath.startsWith(skillsDir)) throw { code: -32602, message: "Invalid skill name: path traversal detected" };
|
|
391
560
|
if (!fs.existsSync(skillPath)) return { content: [{ type: "text", text: `Skill '${sanitizedName}' not found.` }] };
|
|
392
561
|
const text = fs.readFileSync(skillPath, "utf8");
|
|
393
562
|
return { content: [{ type: "text", text: stripBoilerplate(text) }] };
|
|
@@ -400,14 +569,15 @@ function handleRequest(req) {
|
|
|
400
569
|
|
|
401
570
|
if (!task) throw { code: -32602, message: "Missing required argument: task" };
|
|
402
571
|
|
|
403
|
-
const agentDest =
|
|
572
|
+
const agentDest = getAgentDir();
|
|
404
573
|
const fs = require("fs");
|
|
405
574
|
if (!fs.existsSync(agentDest)) {
|
|
406
575
|
return { content: [{ type: "text", text: "Error: .agent/ directory not found. Run `tk init` first." }] };
|
|
407
576
|
}
|
|
408
577
|
|
|
409
578
|
try {
|
|
410
|
-
const
|
|
579
|
+
const brokerScript = path.join(agentDest, "scripts", "context_broker.js");
|
|
580
|
+
const { broker } = require(brokerScript);
|
|
411
581
|
const brokerResult = broker(task, files, model, agentDest);
|
|
412
582
|
return { content: [{ type: "text", text: stripBoilerplate(brokerResult.promptText) }] };
|
|
413
583
|
} catch (e) {
|
|
@@ -421,7 +591,7 @@ function handleRequest(req) {
|
|
|
421
591
|
throw { code: -32602, message: "Missing or invalid required argument: query (string)" };
|
|
422
592
|
}
|
|
423
593
|
const budget = req.params?.arguments?.budget || 2000;
|
|
424
|
-
const agentDest =
|
|
594
|
+
const agentDest = getAgentDir();
|
|
425
595
|
const fs = require("fs");
|
|
426
596
|
if (!fs.existsSync(agentDest)) {
|
|
427
597
|
return { content: [{ type: "text", text: "Error: .agent/ directory not found. Run `tk init` first." }] };
|
|
@@ -455,7 +625,7 @@ function handleRequest(req) {
|
|
|
455
625
|
if (!validTypes.includes(memType)) {
|
|
456
626
|
throw { code: -32602, message: `Invalid memory type: "${memType}". Must be one of: ${validTypes.join(", ")}` };
|
|
457
627
|
}
|
|
458
|
-
const agentDest =
|
|
628
|
+
const agentDest = getAgentDir();
|
|
459
629
|
const fs = require("fs");
|
|
460
630
|
if (!fs.existsSync(agentDest)) {
|
|
461
631
|
return { content: [{ type: "text", text: "Error: .agent/ directory not found. Run `tk init` first." }] };
|
|
@@ -498,7 +668,42 @@ function handleRequest(req) {
|
|
|
498
668
|
throw { code: -32601, message: `Unknown method: ${req.method}` };
|
|
499
669
|
}
|
|
500
670
|
|
|
671
|
+
function processSingleRequest(req) {
|
|
672
|
+
try {
|
|
673
|
+
const result = handleRequest(req);
|
|
674
|
+
// If it's a notification, do not send a response
|
|
675
|
+
if (req.id === undefined || req.id === null) {
|
|
676
|
+
return null;
|
|
677
|
+
}
|
|
678
|
+
return { jsonrpc: "2.0", id: req.id, result };
|
|
679
|
+
} catch (e) {
|
|
680
|
+
const code = e && typeof e.code === "number" ? e.code : -32603;
|
|
681
|
+
const message = e && e.message ? e.message : "Internal server error";
|
|
682
|
+
if (req.id === undefined || req.id === null) {
|
|
683
|
+
return {
|
|
684
|
+
jsonrpc: "2.0",
|
|
685
|
+
id: null,
|
|
686
|
+
error: { code, message },
|
|
687
|
+
};
|
|
688
|
+
}
|
|
689
|
+
return {
|
|
690
|
+
jsonrpc: "2.0",
|
|
691
|
+
id: req.id,
|
|
692
|
+
error: { code, message },
|
|
693
|
+
};
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
|
|
501
697
|
rl.on("line", (line) => {
|
|
698
|
+
if (line.length > 1048576) { // 1MB limit
|
|
699
|
+
const errorRes = {
|
|
700
|
+
jsonrpc: "2.0",
|
|
701
|
+
id: null,
|
|
702
|
+
error: { code: -32700, message: "Parse error: input line too long (exceeds 1MB limit)" },
|
|
703
|
+
};
|
|
704
|
+
console.log(JSON.stringify(errorRes));
|
|
705
|
+
return;
|
|
706
|
+
}
|
|
502
707
|
if (!line.trim()) return;
|
|
503
708
|
|
|
504
709
|
let req;
|
|
@@ -515,31 +720,22 @@ rl.on("line", (line) => {
|
|
|
515
720
|
return;
|
|
516
721
|
}
|
|
517
722
|
|
|
518
|
-
|
|
519
|
-
const
|
|
520
|
-
const
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
723
|
+
if (Array.isArray(req)) {
|
|
724
|
+
const responses = [];
|
|
725
|
+
for (const singleReq of req) {
|
|
726
|
+
const response = processSingleRequest(singleReq);
|
|
727
|
+
if (response) {
|
|
728
|
+
responses.push(response);
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
if (responses.length > 0) {
|
|
732
|
+
console.log(JSON.stringify(responses));
|
|
733
|
+
}
|
|
734
|
+
} else {
|
|
735
|
+
const response = processSingleRequest(req);
|
|
736
|
+
if (response) {
|
|
737
|
+
console.log(JSON.stringify(response));
|
|
532
738
|
}
|
|
533
|
-
} catch (e) {
|
|
534
|
-
// Send proper JSON-RPC error response
|
|
535
|
-
const code = e && typeof e.code === "number" ? e.code : -32603;
|
|
536
|
-
const message = e && e.message ? e.message : "Internal server error";
|
|
537
|
-
const errorRes = {
|
|
538
|
-
jsonrpc: "2.0",
|
|
539
|
-
id: req.id || null,
|
|
540
|
-
error: { code, message },
|
|
541
|
-
};
|
|
542
|
-
console.log(JSON.stringify(errorRes));
|
|
543
739
|
}
|
|
544
740
|
});
|
|
545
741
|
|
package/bin/wrapper.js
CHANGED
|
@@ -24,7 +24,9 @@ const RUST_COMMANDS = new Set([
|
|
|
24
24
|
"min-context",
|
|
25
25
|
"dag-schedule",
|
|
26
26
|
"context-compress",
|
|
27
|
+
"context-broker",
|
|
27
28
|
"optimize-step",
|
|
29
|
+
"impact-tier",
|
|
28
30
|
]);
|
|
29
31
|
|
|
30
32
|
|
|
@@ -87,6 +89,7 @@ function getBinaryPath() {
|
|
|
87
89
|
const buildResult = spawnSync("cargo", ["build", "--release"], {
|
|
88
90
|
cwd: path.resolve(__dirname, ".."),
|
|
89
91
|
stdio: "ignore",
|
|
92
|
+
timeout: 60000,
|
|
90
93
|
});
|
|
91
94
|
if (buildResult.status === 0) {
|
|
92
95
|
const releasePath = candidatePaths[0];
|
|
@@ -115,10 +118,13 @@ function runRustBinary(binPath, args) {
|
|
|
115
118
|
});
|
|
116
119
|
|
|
117
120
|
if (result.error) {
|
|
118
|
-
|
|
119
|
-
|
|
121
|
+
// Graceful degradation: fall back to JS engine instead of hard-crashing.
|
|
122
|
+
// Spawn errors include missing binaries, permission denied, corrupted
|
|
123
|
+
// executables, missing shared libraries, and OS-level exec failures.
|
|
124
|
+
console.warn(
|
|
125
|
+
`\x1b[93m⚠ Rust engine failed (${result.error.code || result.error.message}). Falling back to JS engine.\x1b[0m`,
|
|
120
126
|
);
|
|
121
|
-
|
|
127
|
+
return false; // Signal caller to fall back
|
|
122
128
|
}
|
|
123
129
|
|
|
124
130
|
process.exit(result.status || 0);
|
|
@@ -128,7 +134,10 @@ function runLegacyFallback() {
|
|
|
128
134
|
// Use the modular dist/ CLI with lazy-loaded commands for faster cold-start.
|
|
129
135
|
// Each command module is require()'d only when invoked (~70% fewer files loaded).
|
|
130
136
|
const { main } = require("../dist/cli.js");
|
|
131
|
-
main()
|
|
137
|
+
main().catch((err) => {
|
|
138
|
+
console.error(`\x1b[91m✖ Fatal Error:\x1b[0m ${err.message || err}`);
|
|
139
|
+
process.exit(1);
|
|
140
|
+
});
|
|
132
141
|
}
|
|
133
142
|
|
|
134
143
|
function main() {
|
|
@@ -150,13 +159,18 @@ function main() {
|
|
|
150
159
|
|
|
151
160
|
// Route to Rust engine
|
|
152
161
|
// console.log('\x1b[90m⚡ Executing via Rust Core Engine\x1b[0m');
|
|
153
|
-
runRustBinary(binPath, args);
|
|
154
|
-
|
|
162
|
+
const rustResult = runRustBinary(binPath, args);
|
|
163
|
+
if (rustResult !== false) {
|
|
164
|
+
return; // Rust engine handled it (process.exit was called)
|
|
165
|
+
}
|
|
166
|
+
// rustResult === false means spawn error; fall through to JS fallback
|
|
155
167
|
} else {
|
|
156
|
-
// Warn if Rust command was requested but binary is missing
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
168
|
+
// Warn if Rust command was requested but binary is missing (in verbose mode)
|
|
169
|
+
if (process.env.TK_VERBOSE || process.env.VERBOSE) {
|
|
170
|
+
console.warn(
|
|
171
|
+
"\x1b[93m⚠ Rust binary not found in target/. Falling back to JS engine.\x1b[0m",
|
|
172
|
+
);
|
|
173
|
+
}
|
|
160
174
|
}
|
|
161
175
|
}
|
|
162
176
|
|
package/dist/cli.js
CHANGED
|
@@ -42,6 +42,15 @@ function parseArgs(argv) {
|
|
|
42
42
|
args.flags.minimal = true;
|
|
43
43
|
continue;
|
|
44
44
|
}
|
|
45
|
+
if (arg.startsWith('--profile=')) {
|
|
46
|
+
args.flags.profile = arg.split('=').slice(1).join('=');
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
if (arg === '--profile') {
|
|
50
|
+
const idx = raw.indexOf('--profile');
|
|
51
|
+
args.flags.profile = raw[idx + 1] || 'full';
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
45
54
|
if (arg === '--skip-update-check') {
|
|
46
55
|
args.flags.skipUpdateCheck = true;
|
|
47
56
|
continue;
|
|
@@ -112,6 +121,7 @@ function cmdHelp(quiet = false) {
|
|
|
112
121
|
(0, logger_1.log)(cmd('context-compress', 'Compress a context file while retaining VERIFY comments'));
|
|
113
122
|
(0, logger_1.log)(cmd('optimize-step', 'Apply bounded SkillOpt edits from a JSON payload'));
|
|
114
123
|
(0, logger_1.log)(cmd('guardrail', 'Validate .agent/ integrity (phantom refs, count mismatches, drift)'));
|
|
124
|
+
(0, logger_1.log)(cmd('impact-tier', 'Classify task governance impact tier (0-3)'));
|
|
115
125
|
(0, logger_1.log)(cmd('uninstall', 'Remove .agent/ folder from project'));
|
|
116
126
|
console.log();
|
|
117
127
|
(0, logger_1.log)((0, logger_1.bold)(' Options'));
|
|
@@ -126,6 +136,7 @@ function cmdHelp(quiet = false) {
|
|
|
126
136
|
(0, logger_1.log)(opt('--skip-update-check', 'Skip auto-update version check'));
|
|
127
137
|
(0, logger_1.log)(opt('--head', '(learn) Diff against last commit instead of staged'));
|
|
128
138
|
(0, logger_1.log)(opt('--write', '(align) Write aligned output in-place to the target file'));
|
|
139
|
+
(0, logger_1.log)(opt('--version, -v', 'Print installed version'));
|
|
129
140
|
console.log();
|
|
130
141
|
(0, logger_1.log)((0, logger_1.bold)(' Aliases'));
|
|
131
142
|
(0, logger_1.log)(` ${(0, logger_1.c)('gray', '─'.repeat(40))}`);
|
|
@@ -247,6 +258,11 @@ async function runWithUpdateCheck(command, flags) {
|
|
|
247
258
|
await cmdMarathon(flags, process.argv, quiet);
|
|
248
259
|
break;
|
|
249
260
|
}
|
|
261
|
+
case 'minimal': {
|
|
262
|
+
const cmdMinimal = loadCmd('./commands/minimal', 'cmdMinimal');
|
|
263
|
+
cmdMinimal(flags, quiet);
|
|
264
|
+
break;
|
|
265
|
+
}
|
|
250
266
|
case 'compile': {
|
|
251
267
|
const cmdCompile = loadCmd('./commands/compile', 'cmdCompile');
|
|
252
268
|
await cmdCompile(flags, quiet);
|
|
@@ -297,12 +313,21 @@ async function runWithUpdateCheck(command, flags) {
|
|
|
297
313
|
cmdOptimizeStep(process.argv, quiet);
|
|
298
314
|
break;
|
|
299
315
|
}
|
|
316
|
+
case 'impact-tier': {
|
|
317
|
+
const cmdImpactTier = loadCmd('./commands/native', 'cmdImpactTier');
|
|
318
|
+
cmdImpactTier(process.argv, quiet);
|
|
319
|
+
break;
|
|
320
|
+
}
|
|
300
321
|
case 'help':
|
|
301
322
|
case '--help':
|
|
302
323
|
case '-h':
|
|
303
324
|
case null:
|
|
304
325
|
cmdHelp(quiet);
|
|
305
326
|
break;
|
|
327
|
+
case '--version':
|
|
328
|
+
case '-v':
|
|
329
|
+
(0, logger_1.log)(CURRENT_VERSION);
|
|
330
|
+
break;
|
|
306
331
|
default:
|
|
307
332
|
(0, logger_1.err)(`Unknown command: "${command}"`);
|
|
308
333
|
console.log();
|
|
@@ -317,5 +342,8 @@ async function main() {
|
|
|
317
342
|
await runWithUpdateCheck(command, flags);
|
|
318
343
|
}
|
|
319
344
|
if (require.main === module) {
|
|
320
|
-
main()
|
|
345
|
+
main().catch(err => {
|
|
346
|
+
console.error(`\x1b[91m✖ Fatal Error:\x1b[0m ${err.message || err}`);
|
|
347
|
+
process.exit(1);
|
|
348
|
+
});
|
|
321
349
|
}
|
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,7 +276,7 @@ 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();
|
|
@@ -399,4 +408,6 @@ async function scaffoldDesignSystem(targetDir, agentSrc, dryRun = false) {
|
|
|
399
408
|
await copyIfMissing(designMdSrc, designMdDest, 'DESIGN.md System');
|
|
400
409
|
await copyIfMissing(designTokensSrc, designTokensDest, 'Design Tokens');
|
|
401
410
|
}
|
|
411
|
+
exports.CORE_AGENTS = CORE_AGENTS;
|
|
412
|
+
exports.CORE_SKILLS = CORE_SKILLS;
|
|
402
413
|
|