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.
Files changed (322) hide show
  1. package/.agent/ARCHITECTURE.md +219 -215
  2. package/.agent/agents/accessibility-reviewer.md +66 -151
  3. package/.agent/agents/ai-code-reviewer.md +22 -2
  4. package/.agent/agents/anti-pattern-reviewer.md +99 -0
  5. package/.agent/agents/api-architect.md +19 -2
  6. package/.agent/agents/backend-specialist.md +25 -3
  7. package/.agent/agents/cloud-engineer.md +21 -0
  8. package/.agent/agents/code-archaeologist.md +20 -3
  9. package/.agent/agents/complexity-reviewer.md +22 -2
  10. package/.agent/agents/database-architect.md +24 -3
  11. package/.agent/agents/db-latency-auditor.md +22 -2
  12. package/.agent/agents/debugger.md +19 -3
  13. package/.agent/agents/dependency-reviewer.md +19 -2
  14. package/.agent/agents/devops-engineer.md +24 -3
  15. package/.agent/agents/documentation-writer.md +21 -3
  16. package/.agent/agents/explorer-agent.md +21 -3
  17. package/.agent/agents/frontend-reviewer.md +19 -3
  18. package/.agent/agents/frontend-specialist.md +72 -224
  19. package/.agent/agents/game-developer.md +22 -3
  20. package/.agent/agents/interaction-reviewer.md +118 -0
  21. package/.agent/agents/logic-reviewer.md +18 -3
  22. package/.agent/agents/minimalist-reviewer.md +98 -0
  23. package/.agent/agents/mobile-developer.md +21 -3
  24. package/.agent/agents/mobile-reviewer.md +22 -2
  25. package/.agent/agents/orchestrator.md +19 -3
  26. package/.agent/agents/penetration-tester.md +22 -3
  27. package/.agent/agents/performance-optimizer.md +21 -3
  28. package/.agent/agents/performance-reviewer.md +2 -0
  29. package/.agent/agents/precedence-reviewer.md +19 -5
  30. package/.agent/agents/product-manager.md +20 -3
  31. package/.agent/agents/product-owner.md +22 -1
  32. package/.agent/agents/product-reviewer.md +98 -0
  33. package/.agent/agents/project-planner.md +19 -3
  34. package/.agent/agents/qa-automation-engineer.md +24 -3
  35. package/.agent/agents/resilience-reviewer.md +21 -2
  36. package/.agent/agents/schema-reviewer.md +21 -2
  37. package/.agent/agents/security-auditor.md +7 -1
  38. package/.agent/agents/seo-specialist.md +18 -3
  39. package/.agent/agents/sql-reviewer.md +22 -2
  40. package/.agent/agents/supervisor-agent.md +22 -3
  41. package/.agent/agents/swarm-worker-registry.md +7 -0
  42. package/.agent/agents/system-architect.md +19 -0
  43. package/.agent/agents/test-coverage-reviewer.md +22 -2
  44. package/.agent/agents/test-engineer.md +21 -2
  45. package/.agent/agents/throughput-optimizer.md +22 -2
  46. package/.agent/agents/type-safety-reviewer.md +21 -2
  47. package/.agent/agents/ui-ux-auditor.md +44 -242
  48. package/.agent/agents/ui-visual-auditor.md +99 -0
  49. package/.agent/agents/ux-reviewer.md +104 -0
  50. package/.agent/agents/visual-reviewer.md +98 -0
  51. package/.agent/agents/vitals-reviewer.md +23 -2
  52. package/.agent/history/README.md +53 -0
  53. package/.agent/history/case-law/cases/template-case.json +19 -0
  54. package/.agent/history/integrity_manifest.json +131 -33
  55. package/.agent/history/memory/.memory.idx +1581 -1
  56. package/.agent/history/memory/MEMORY.md +105 -1
  57. package/.agent/routing_index.json +272 -690
  58. package/.agent/rules/GEMINI.md +10 -12
  59. package/.agent/rules/GEMINI_PLANNER.md +84 -0
  60. package/.agent/scripts/_utils.js +28 -7
  61. package/.agent/scripts/case_law_manager.js +2 -0
  62. package/.agent/scripts/context_broker.js +152 -19
  63. package/.agent/scripts/guardrail_engine.js +60 -5
  64. package/.agent/scripts/impact_classifier.js +167 -0
  65. package/.agent/scripts/integrity_manifest.js +10 -4
  66. package/.agent/scripts/marathon_harness.js +10 -1
  67. package/.agent/scripts/minimal_change_engine.js +437 -0
  68. package/.agent/scripts/pipeline_engine.js +856 -0
  69. package/.agent/scripts/skill_evolution.js +36 -21
  70. package/.agent/scripts/socratic_gate_policy.js +60 -0
  71. package/.agent/scripts/swarm_dispatcher.js +65 -6
  72. package/.agent/scripts/token_budget_broker.js +52 -0
  73. package/.agent/scripts/verify_all.js +13 -0
  74. package/.agent/scripts/visual_audit.js +92 -0
  75. package/.agent/skills/12-principles-of-animation/SKILL.md +19 -10
  76. package/.agent/skills/60fps-animation/SKILL.md +19 -10
  77. package/.agent/skills/accessible-animation/SKILL.md +19 -10
  78. package/.agent/skills/adapt/SKILL.md +19 -10
  79. package/.agent/skills/advanced-rag-pipelines/SKILL.md +21 -3
  80. package/.agent/skills/agent-organizer/SKILL.md +21 -7
  81. package/.agent/skills/agentic-patterns/SKILL.md +19 -7
  82. package/.agent/skills/ai-prompt-injection-defense/SKILL.md +21 -7
  83. package/.agent/skills/animation-on-scroll/SKILL.md +19 -10
  84. package/.agent/skills/animation-systems/SKILL.md +19 -10
  85. package/.agent/skills/antfu-conventions/SKILL.md +21 -10
  86. package/.agent/skills/api-patterns/SKILL.md +21 -7
  87. package/.agent/skills/api-patterns/scripts/__pycache__/api_validator.cpython-311.pyc +0 -0
  88. package/.agent/skills/api-security-auditor/SKILL.md +21 -7
  89. package/.agent/skills/app-builder/SKILL.md +21 -7
  90. package/.agent/skills/apple-design/SKILL.md +19 -10
  91. package/.agent/skills/architecture/SKILL.md +21 -7
  92. package/.agent/skills/audit-and-fix/SKILL.md +19 -10
  93. package/.agent/skills/authentication-best-practices/SKILL.md +21 -7
  94. package/.agent/skills/backend-security-expert/SKILL.md +21 -7
  95. package/.agent/skills/baseline-ui/SKILL.md +19 -10
  96. package/.agent/skills/bash-linux/SKILL.md +21 -7
  97. package/.agent/skills/behavioral-modes/SKILL.md +19 -7
  98. package/.agent/skills/better-colors/SKILL.md +31 -14
  99. package/.agent/skills/better-ui/SKILL.md +19 -10
  100. package/.agent/skills/bolder/SKILL.md +19 -10
  101. package/.agent/skills/brainstorming/SKILL.md +17 -7
  102. package/.agent/skills/browser-native-ai/SKILL.md +19 -3
  103. package/.agent/skills/build-primitive/SKILL.md +19 -10
  104. package/.agent/skills/building-native-ui/SKILL.md +21 -7
  105. package/.agent/skills/cicd-pro/SKILL.md +21 -10
  106. package/.agent/skills/clarify/SKILL.md +19 -10
  107. package/.agent/skills/clean-code/SKILL.md +21 -7
  108. package/.agent/skills/cloud-architect/SKILL.md +21 -10
  109. package/.agent/skills/cobejs/SKILL.md +19 -10
  110. package/.agent/skills/code-review-checklist/SKILL.md +21 -7
  111. package/.agent/skills/codebase-design/SKILL.md +21 -10
  112. package/.agent/skills/colorize/SKILL.md +19 -10
  113. package/.agent/skills/compact-landing/SKILL.md +19 -10
  114. package/.agent/skills/company-logos/SKILL.md +19 -10
  115. package/.agent/skills/config-validator/SKILL.md +21 -7
  116. package/.agent/skills/containerization-pro/SKILL.md +21 -10
  117. package/.agent/skills/create-design-md/SKILL.md +19 -10
  118. package/.agent/skills/critique/SKILL.md +19 -10
  119. package/.agent/skills/csharp-developer/SKILL.md +21 -7
  120. package/.agent/skills/data-validation-schemas/SKILL.md +21 -7
  121. package/.agent/skills/database-design/SKILL.md +21 -7
  122. package/.agent/skills/database-design/scripts/__pycache__/schema_validator.cpython-311.pyc +0 -0
  123. package/.agent/skills/delight/SKILL.md +19 -10
  124. package/.agent/skills/deployment-procedures/SKILL.md +21 -7
  125. package/.agent/skills/design-lab/SKILL.md +21 -10
  126. package/.agent/skills/devops-engineer/SKILL.md +21 -7
  127. package/.agent/skills/devops-incident-responder/SKILL.md +21 -7
  128. package/.agent/skills/diagnosing-bugs/SKILL.md +21 -10
  129. package/.agent/skills/distill/SKILL.md +19 -10
  130. package/.agent/skills/documentation-templates/SKILL.md +21 -7
  131. package/.agent/skills/domain-modeling/SKILL.md +21 -10
  132. package/.agent/skills/edge-computing/SKILL.md +21 -7
  133. package/.agent/skills/emil-design-eng/SKILL.md +19 -10
  134. package/.agent/skills/error-resilience/SKILL.md +21 -7
  135. package/.agent/skills/extract-design-system/SKILL.md +21 -7
  136. package/.agent/skills/fabel-protocol/SKILL.md +19 -2
  137. package/.agent/skills/fixing-accessibility/SKILL.md +25 -14
  138. package/.agent/skills/fixing-metadata/SKILL.md +19 -10
  139. package/.agent/skills/fixing-motion-performance/SKILL.md +19 -10
  140. package/.agent/skills/framer-motion-expert/SKILL.md +19 -6
  141. package/.agent/skills/frontend-design/SKILL.md +66 -204
  142. package/.agent/skills/frontend-design/scripts/__pycache__/accessibility_checker.cpython-311.pyc +0 -0
  143. package/.agent/skills/frontend-design/scripts/__pycache__/ux_audit.cpython-311.pyc +0 -0
  144. package/.agent/skills/frontend-security-expert/SKILL.md +21 -7
  145. package/.agent/skills/game-design-expert/SKILL.md +21 -7
  146. package/.agent/skills/game-engineering-expert/SKILL.md +21 -7
  147. package/.agent/skills/generative-ui-expert/SKILL.md +19 -3
  148. package/.agent/skills/geo-fundamentals/SKILL.md +21 -7
  149. package/.agent/skills/geo-fundamentals/scripts/__pycache__/geo_checker.cpython-311.pyc +0 -0
  150. package/.agent/skills/git-pro/SKILL.md +21 -10
  151. package/.agent/skills/github-operations/SKILL.md +21 -7
  152. package/.agent/skills/gpt-taste/SKILL.md +19 -10
  153. package/.agent/skills/gsap-core/SKILL.md +21 -4
  154. package/.agent/skills/gsap-frameworks/SKILL.md +21 -4
  155. package/.agent/skills/gsap-performance/SKILL.md +20 -5
  156. package/.agent/skills/gsap-plugins/SKILL.md +20 -5
  157. package/.agent/skills/gsap-react/SKILL.md +20 -5
  158. package/.agent/skills/gsap-scrolltrigger/SKILL.md +21 -4
  159. package/.agent/skills/gsap-timeline/SKILL.md +20 -5
  160. package/.agent/skills/gsap-utils/SKILL.md +20 -5
  161. package/.agent/skills/harden/SKILL.md +19 -10
  162. package/.agent/skills/harness-protocol/SKILL.md +20 -4
  163. package/.agent/skills/i18n-localization/SKILL.md +21 -7
  164. package/.agent/skills/i18n-localization/scripts/__pycache__/i18n_checker.cpython-311.pyc +0 -0
  165. package/.agent/skills/impeccable/SKILL.md +21 -10
  166. package/.agent/skills/improve-codebase-architecture/SKILL.md +21 -10
  167. package/.agent/skills/improve-ui/SKILL.md +19 -10
  168. package/.agent/skills/intelligent-routing/SKILL.md +19 -7
  169. package/.agent/skills/knowledge-graph/SKILL.md +20 -4
  170. package/.agent/skills/landing-page/SKILL.md +20 -10
  171. package/.agent/skills/lint-and-validate/SKILL.md +21 -7
  172. package/.agent/skills/lint-and-validate/scripts/__pycache__/lint_runner.cpython-311.pyc +0 -0
  173. package/.agent/skills/lint-and-validate/scripts/__pycache__/type_coverage.cpython-311.pyc +0 -0
  174. package/.agent/skills/llm-engineering/SKILL.md +21 -7
  175. package/.agent/skills/local-first/SKILL.md +21 -7
  176. package/.agent/skills/local-first-architecture/SKILL.md +19 -10
  177. package/.agent/skills/lottie-animation/SKILL.md +19 -10
  178. package/.agent/skills/marquee-loop/SKILL.md +19 -10
  179. package/.agent/skills/masked-reveal/SKILL.md +19 -10
  180. package/.agent/skills/mcp-builder/SKILL.md +21 -7
  181. package/.agent/skills/micro-interaction/SKILL.md +19 -10
  182. package/.agent/skills/mobile-design/SKILL.md +21 -6
  183. package/.agent/skills/mobile-design/scripts/__pycache__/mobile_audit.cpython-311.pyc +0 -0
  184. package/.agent/skills/monorepo-management/SKILL.md +21 -7
  185. package/.agent/skills/morphing-icons/SKILL.md +19 -10
  186. package/.agent/skills/motion-engineering/SKILL.md +86 -171
  187. package/.agent/skills/nextjs-react-expert/SKILL.md +19 -7
  188. package/.agent/skills/nextjs-react-expert/scripts/__pycache__/convert_rules.cpython-311.pyc +0 -0
  189. package/.agent/skills/nextjs-react-expert/scripts/__pycache__/react_performance_checker.cpython-311.pyc +0 -0
  190. package/.agent/skills/nodejs-best-practices/SKILL.md +21 -7
  191. package/.agent/skills/observability/SKILL.md +21 -7
  192. package/.agent/skills/page-transition-animation/SKILL.md +19 -10
  193. package/.agent/skills/parallel-agents/SKILL.md +23 -7
  194. package/.agent/skills/performance-profiling/SKILL.md +21 -7
  195. package/.agent/skills/performance-profiling/scripts/__pycache__/lighthouse_audit.cpython-311.pyc +0 -0
  196. package/.agent/skills/plan-writing/SKILL.md +21 -7
  197. package/.agent/skills/platform-engineer/SKILL.md +21 -7
  198. package/.agent/skills/playwright-best-practices/SKILL.md +21 -7
  199. package/.agent/skills/polish/SKILL.md +19 -10
  200. package/.agent/skills/powershell-windows/SKILL.md +21 -7
  201. package/.agent/skills/pricing-page/SKILL.md +19 -10
  202. package/.agent/skills/product-aware-heuristics/SKILL.md +358 -0
  203. package/.agent/skills/progressive-blur/SKILL.md +19 -10
  204. package/.agent/skills/project-idioms/SKILL.md +20 -8
  205. package/.agent/skills/python-patterns/SKILL.md +21 -7
  206. package/.agent/skills/python-pro/SKILL.md +21 -6
  207. package/.agent/skills/quieter/SKILL.md +19 -10
  208. package/.agent/skills/react-doctor/SKILL.md +19 -10
  209. package/.agent/skills/react-specialist/SKILL.md +19 -6
  210. package/.agent/skills/readme-builder/SKILL.md +21 -7
  211. package/.agent/skills/realtime-patterns/SKILL.md +21 -7
  212. package/.agent/skills/red-team-tactics/SKILL.md +21 -7
  213. package/.agent/skills/redesign-skill/SKILL.md +19 -10
  214. package/.agent/skills/review-animations/SKILL.md +21 -10
  215. package/.agent/skills/rust-pro/SKILL.md +21 -7
  216. package/.agent/skills/seo-fundamentals/SKILL.md +21 -7
  217. package/.agent/skills/seo-fundamentals/scripts/__pycache__/seo_checker.cpython-311.pyc +0 -0
  218. package/.agent/skills/server-management/SKILL.md +21 -7
  219. package/.agent/skills/shadcn-ui-expert/SKILL.md +21 -7
  220. package/.agent/skills/shape/SKILL.md +19 -10
  221. package/.agent/skills/skill-creator/SKILL.md +21 -7
  222. package/.agent/skills/soft-skill/SKILL.md +19 -10
  223. package/.agent/skills/sounds-on-the-web/SKILL.md +19 -10
  224. package/.agent/skills/sql-pro/SKILL.md +21 -7
  225. package/.agent/skills/supabase-postgres-best-practices/SKILL.md +21 -7
  226. package/.agent/skills/svg-animation/SKILL.md +19 -10
  227. package/.agent/skills/swiftui-expert/SKILL.md +21 -7
  228. package/.agent/skills/swiss-design/SKILL.md +19 -10
  229. package/.agent/skills/system-design-pro/SKILL.md +21 -9
  230. package/.agent/skills/systematic-debugging/SKILL.md +21 -7
  231. package/.agent/skills/tailwind-patterns/SKILL.md +21 -7
  232. package/.agent/skills/taste-skill/SKILL.md +19 -10
  233. package/.agent/skills/tdd-workflow/SKILL.md +21 -10
  234. package/.agent/skills/test-result-analyzer/SKILL.md +18 -6
  235. package/.agent/skills/testing-patterns/SKILL.md +21 -7
  236. package/.agent/skills/testing-patterns/scripts/__pycache__/test_runner.cpython-311.pyc +0 -0
  237. package/.agent/skills/thermo-nuclear-code-quality-review/SKILL.md +21 -10
  238. package/.agent/skills/thinking-protocol/SKILL.md +20 -8
  239. package/.agent/skills/to-spring-or-not-to-spring/SKILL.md +19 -10
  240. package/.agent/skills/transitions-dev/SKILL.md +19 -10
  241. package/.agent/skills/trend-researcher/SKILL.md +17 -6
  242. package/.agent/skills/typescript-advanced/SKILL.md +21 -7
  243. package/.agent/skills/typeset/SKILL.md +19 -10
  244. package/.agent/skills/ui-reasoning-engine/SKILL.md +154 -0
  245. package/.agent/skills/ui-skill-packs/SKILL.md +77 -0
  246. package/.agent/skills/ui-skills-root/SKILL.md +21 -9
  247. package/.agent/skills/ui-ux-pro-max/SKILL.md +62 -583
  248. package/.agent/skills/ui-ux-researcher/SKILL.md +17 -6
  249. package/.agent/skills/vue-expert/SKILL.md +19 -6
  250. package/.agent/skills/vulnerability-scanner/SKILL.md +21 -7
  251. package/.agent/skills/vulnerability-scanner/scripts/__pycache__/security_scan.cpython-311.pyc +0 -0
  252. package/.agent/skills/web-accessibility-auditor/SKILL.md +21 -7
  253. package/.agent/skills/web-design-guidelines/SKILL.md +32 -206
  254. package/.agent/skills/web-quality-audit/SKILL.md +19 -10
  255. package/.agent/skills/webapp-testing/SKILL.md +21 -7
  256. package/.agent/skills/webapp-testing/scripts/__pycache__/playwright_runner.cpython-311.pyc +0 -0
  257. package/.agent/skills/webgpu-performance/SKILL.md +19 -3
  258. package/.agent/skills/whimsy-injector/SKILL.md +20 -10
  259. package/.agent/skills/workflow-optimizer/SKILL.md +16 -6
  260. package/.agent/templates/DESIGN.md +292 -0
  261. package/.agent/templates/design-tokens.json +137 -0
  262. package/.agent/workflows/acf.md +13 -6
  263. package/.agent/workflows/api-tester.md +15 -8
  264. package/.agent/workflows/audit.md +19 -8
  265. package/.agent/workflows/brainstorm.md +14 -9
  266. package/.agent/workflows/changelog.md +14 -8
  267. package/.agent/workflows/create.md +16 -8
  268. package/.agent/workflows/debug.md +15 -10
  269. package/.agent/workflows/deploy.md +16 -8
  270. package/.agent/workflows/enhance.md +15 -10
  271. package/.agent/workflows/fix.md +15 -8
  272. package/.agent/workflows/generate.md +17 -11
  273. package/.agent/workflows/marathon.md +15 -8
  274. package/.agent/workflows/migrate.md +16 -8
  275. package/.agent/workflows/minimal.md +94 -0
  276. package/.agent/workflows/orchestrate.md +15 -8
  277. package/.agent/workflows/performance-benchmarker.md +15 -8
  278. package/.agent/workflows/pipeline.md +155 -0
  279. package/.agent/workflows/plan.md +14 -10
  280. package/.agent/workflows/preview.md +14 -7
  281. package/.agent/workflows/refactor.md +16 -8
  282. package/.agent/workflows/review-ai.md +15 -7
  283. package/.agent/workflows/review.md +15 -7
  284. package/.agent/workflows/session.md +14 -7
  285. package/.agent/workflows/status.md +13 -7
  286. package/.agent/workflows/strengthen-skills.md +15 -6
  287. package/.agent/workflows/super-prompt.md +19 -10
  288. package/.agent/workflows/swarm.md +15 -7
  289. package/.agent/workflows/test.md +15 -8
  290. package/.agent/workflows/tribunal-backend.md +16 -9
  291. package/.agent/workflows/tribunal-database.md +15 -8
  292. package/.agent/workflows/tribunal-frontend.md +26 -11
  293. package/.agent/workflows/tribunal-full.md +29 -14
  294. package/.agent/workflows/tribunal-mobile.md +15 -8
  295. package/.agent/workflows/tribunal-performance.md +15 -8
  296. package/.agent/workflows/tribunal-speed.md +16 -9
  297. package/.agent/workflows/tribunal-ui.md +82 -0
  298. package/.agent/workflows/ui-ux-pro-max.md +51 -107
  299. package/CONTRIBUTING.md +2 -2
  300. package/README.md +5 -5
  301. package/bin/mcp-server.js +126 -76
  302. package/bin/wrapper.js +67 -31
  303. package/dist/cli.js +39 -1
  304. package/dist/commands/compile.js +7 -0
  305. package/dist/commands/context.js +8 -3
  306. package/dist/commands/graph.js +8 -2
  307. package/dist/commands/init.js +37 -2
  308. package/dist/commands/memory.js +119 -68
  309. package/dist/commands/minimal.js +71 -0
  310. package/dist/commands/native.js +228 -0
  311. package/dist/commands/optimize.js +15 -5
  312. package/dist/commands/validate.js +67 -0
  313. package/dist/esm/index.mjs +26 -32
  314. package/dist/mcp/server.js +4 -138
  315. package/dist/utils/fs.js +10 -4
  316. package/dist/utils/helpers.js +10 -1
  317. package/dist/utils/version.js +9 -2
  318. package/mcp_config.json +10 -1
  319. package/package.json +19 -15
  320. package/scripts/benchmark.js +58 -0
  321. package/scripts/sync-version.js +129 -76
  322. 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
- * PERF: Commands are loaded in-process via require() no child process spawn.
11
- * This eliminates ~200-500ms overhead per tool call that spawnSync introduced.
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 spawned processes (30 seconds) — only used for Rust binary calls
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 validate command via the Rust binary (if available) or JS fallback.
35
- * This is the only command that still benefits from process spawn (Rust speed).
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 runValidateCommand() {
38
- const os = require("os");
38
+ function runTribunalAudit() {
39
39
  const fs = require("fs");
40
- const isWindows = os.platform() === "win32";
41
- const ext = isWindows ? ".exe" : "";
42
- const platform = os.platform();
43
- const arch = os.arch();
44
-
45
- // Try Rust binary first
46
- const pkgName = `@tribunal-kit/core-${platform}-${arch}`;
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 (binPath) {
68
- const result = spawnSync(binPath, ["validate"], {
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
- // JS fallback — in-process
76
- return "Validate command requires the Rust binary. Run: cargo build --release";
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 loaded in-process for zero-spawn latency.
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
- // We still spawn for case_law_manager since it's a standalone script
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 = runValidateCommand();
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 agentPath = path.join(process.cwd(), ".agent", "agents", `${sanitizedName}.md`);
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 skillPath = path.join(process.cwd(), ".agent", "skills", sanitizedName, "SKILL.md");
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 { broker } = require("../.agent/scripts/context_broker.js");
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
- try {
520
- const result = handleRequest(req);
521
- const res = { jsonrpc: "2.0", id: req.id, result };
522
- console.log(JSON.stringify(res));
523
-
524
- // After initialize, send the initialized notification per MCP spec
525
- if (req.method === "initialize") {
526
- console.log(
527
- JSON.stringify({
528
- jsonrpc: "2.0",
529
- method: "notifications/initialized",
530
- params: {},
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 binPath = path.resolve(
44
- path.dirname(pkgPath),
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 compiled from crates/core/Cargo.toml (Local dev)
55
- const devPath = path.resolve(
56
- __dirname,
57
- "..",
58
- "target",
59
- "release",
60
- `tribunal-core${ext}`,
61
- );
62
- if (fs.existsSync(devPath)) {
63
- return devPath;
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, try target/debug (if they ran `cargo build` instead of `--release`)
67
- const debugPath = path.resolve(
68
- __dirname,
69
- "..",
70
- "target",
71
- "debug",
72
- `tribunal-core${ext}`,
73
- );
74
- if (fs.existsSync(debugPath)) {
75
- return debugPath;
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
- console.error(
94
- `\x1b[91m✖ Failed to execute Rust engine:\x1b[0m ${result.error.message}`,
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
- process.exit(1);
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
- return;
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
  }
@@ -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
 
@@ -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 targetFile = args[0].replace(/\\/g, '/');
23
- const snapshotName = targetFile.replace(/[\\\/]/g, '__') + '.json';
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: ' + targetFile);
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
  }
@@ -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 opener = process.platform === 'win32' ? 'start' : process.platform === 'darwin' ? 'open' : 'xdg-open';
27
- await (0, helpers_1.runShellAsync)(`${opener} "${htmlFile}"`, { stdio: 'ignore' });
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) {
@@ -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 20 reviewers in parallel'));
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