tribunal-kit 9.0.2 → 9.2.3

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 (691) hide show
  1. package/.agent/agents/backend-specialist.md +1 -1
  2. package/.agent/agents/code-archaeologist.md +1 -1
  3. package/.agent/agents/database-architect.md +1 -1
  4. package/.agent/agents/debugger.md +1 -1
  5. package/.agent/agents/devops-engineer.md +1 -1
  6. package/.agent/agents/documentation-writer.md +1 -1
  7. package/.agent/agents/explorer-agent.md +1 -1
  8. package/.agent/agents/game-developer.md +1 -1
  9. package/.agent/agents/minimalist-reviewer.md +1 -1
  10. package/.agent/agents/mobile-developer.md +1 -1
  11. package/.agent/agents/orchestrator.md +44 -2
  12. package/.agent/agents/penetration-tester.md +1 -1
  13. package/.agent/agents/performance-optimizer.md +1 -1
  14. package/.agent/agents/product-manager.md +1 -1
  15. package/.agent/agents/product-owner.md +1 -1
  16. package/.agent/agents/project-planner.md +1 -1
  17. package/.agent/agents/qa-automation-engineer.md +1 -1
  18. package/.agent/agents/seo-specialist.md +1 -1
  19. package/.agent/agents/test-engineer.md +1 -1
  20. package/.agent/config/claude.json +1 -1
  21. package/.agent/config/plugin.json +1 -1
  22. package/.agent/history/architecture-explorer.html +352 -0
  23. package/.agent/history/architecture-graph.yaml +181 -1
  24. package/.agent/history/graph-cache.json +323 -13
  25. package/.agent/history/integrity_manifest.json +3937 -299
  26. package/.agent/history/memory/.memory.idx +50 -50
  27. package/.agent/history/snapshots/.opencode__plugins__tribunal.js.json +12 -0
  28. package/.agent/history/snapshots/.pi__extensions__tribunal.ts.json +12 -0
  29. package/.agent/history/snapshots/bin__adapter-install.js.json +1 -1
  30. package/.agent/history/snapshots/bin__mcp-server.js.json +4 -2
  31. package/.agent/history/snapshots/bin__proxy-server.js.json +1 -1
  32. package/.agent/history/snapshots/bin__spawn-agent.js.json +1 -1
  33. package/.agent/history/snapshots/bin__wrapper.js.json +1 -1
  34. package/.agent/history/snapshots/eslint.config.js.json +1 -1
  35. package/.agent/history/snapshots/hooks__session-start.js.json +11 -0
  36. package/.agent/history/snapshots/scripts__apply-version.js.json +11 -0
  37. package/.agent/history/snapshots/scripts__audit_skill_sdo.js.json +11 -0
  38. package/.agent/history/snapshots/scripts__clean-pycache.js.json +11 -0
  39. package/.agent/history/snapshots/scripts__context_compiler.js.json +17 -0
  40. package/.agent/history/snapshots/scripts__modernize_skills.js.json +11 -0
  41. package/.agent/history/snapshots/scripts__package-cores.js.json +12 -0
  42. package/.agent/history/snapshots/scripts__skill_enhancement_engine.js.json +11 -0
  43. package/.agent/history/snapshots/scripts__sync-skills.js.json +11 -0
  44. package/.agent/history/snapshots/scripts__telemetry_gc.js.json +11 -0
  45. package/.agent/history/snapshots/scripts__validate-payload.js.json +1 -1
  46. package/.agent/history/snapshots/test__integration__browser_cli.test.js.json +12 -0
  47. package/.agent/history/snapshots/test__integration__sync_status.test.js.json +1 -1
  48. package/.agent/history/snapshots/test__unit__ast_context_loader.test.js.json +12 -0
  49. package/.agent/history/snapshots/test__unit__browser_case_bridge.test.js.json +11 -0
  50. package/.agent/history/snapshots/test__unit__browser_discovery.test.js.json +10 -0
  51. package/.agent/history/snapshots/test__unit__browser_idpi.test.js.json +10 -0
  52. package/.agent/history/snapshots/test__unit__browser_sentinel.test.js.json +11 -0
  53. package/.agent/history/snapshots/test__unit__browser_synapse.test.js.json +10 -0
  54. package/.agent/history/snapshots/test__unit__browser_trimmer.test.js.json +10 -0
  55. package/.agent/history/snapshots/test__unit__context_compiler.test.js.json +26 -0
  56. package/.agent/history/snapshots/test__unit__init.test.js.json +1 -1
  57. package/.agent/history/snapshots/test__unit__learn.test.js.json +1 -1
  58. package/.agent/history/snapshots/test__unit__mcp_server.test.js.json +1 -1
  59. package/.agent/history/snapshots/test__unit__platform_download_audit.test.js.json +11 -0
  60. package/.agent/history/snapshots/test__unit__prompt_compiler.test.js.json +10 -0
  61. package/.agent/history/snapshots/test__unit__sdd_integration.test.js.json +12 -0
  62. package/.agent/history/snapshots/test__unit__stress.test.js.json +1 -1
  63. package/.agent/history/snapshots/test__unit__token_budget_broker.test.js.json +10 -0
  64. package/.agent/history/snapshots/test__unit__tui.test.js.json +10 -0
  65. package/.agent/routing_index.json +266 -1531
  66. package/.agent/rules/kernel.md +86 -0
  67. package/.agent/scripts/_utils.js +78 -0
  68. package/.agent/scripts/browser_audit.js +13 -5
  69. package/.agent/scripts/bundle_analyzer.js +7 -3
  70. package/.agent/scripts/context_broker.js +0 -8
  71. package/.agent/scripts/context_compiler.js +1106 -3
  72. package/.agent/scripts/dependency_analyzer.js +16 -16
  73. package/.agent/scripts/guardrail_engine.js +48 -11
  74. package/.agent/scripts/inner_loop_validator.js +1 -1
  75. package/.agent/scripts/memory_engine.js +490 -329
  76. package/.agent/scripts/payload_schemas.js +18 -0
  77. package/.agent/scripts/pipeline_engine.js +29 -105
  78. package/.agent/scripts/schema_validator.js +2 -1
  79. package/.agent/scripts/swarm_dispatcher.js +148 -46
  80. package/.agent/scripts/test_runner.js +1 -2
  81. package/.agent/skill_topic_map.json +71 -22
  82. package/.agent/skills/12-principles-of-animation/SKILL.md +1 -76
  83. package/.agent/skills/60fps-animation/SKILL.md +4 -77
  84. package/.agent/skills/accessible-animation/SKILL.md +9 -86
  85. package/.agent/skills/adapt/SKILL.md +1 -76
  86. package/.agent/skills/advanced-rag-pipelines/SKILL.md +1 -76
  87. package/.agent/skills/agent-organizer/SKILL.md +1 -76
  88. package/.agent/skills/agentic-patterns/SKILL.md +1 -76
  89. package/.agent/skills/agentic-workflows-2026/SKILL.md +1 -75
  90. package/.agent/skills/ai-app-hardening/SKILL.md +1 -75
  91. package/.agent/skills/ai-prompt-injection-defense/SKILL.md +1 -76
  92. package/.agent/skills/animation-on-scroll/SKILL.md +16 -87
  93. package/.agent/skills/animation-systems/SKILL.md +15 -90
  94. package/.agent/skills/antfu-conventions/SKILL.md +0 -75
  95. package/.agent/skills/api-patterns/SKILL.md +1 -76
  96. package/.agent/skills/api-security-auditor/SKILL.md +1 -76
  97. package/.agent/skills/app-builder/SKILL.md +1 -76
  98. package/.agent/skills/appflow-wireframe/SKILL.md +1 -78
  99. package/.agent/skills/apple-design/SKILL.md +1 -76
  100. package/.agent/skills/architecture/SKILL.md +1 -76
  101. package/.agent/skills/audit-and-fix/SKILL.md +41 -77
  102. package/.agent/skills/authentication-best-practices/SKILL.md +1 -76
  103. package/.agent/skills/backend-security-expert/SKILL.md +1 -76
  104. package/.agent/skills/baseline-ui/SKILL.md +1 -76
  105. package/.agent/skills/bash-linux/SKILL.md +1 -76
  106. package/.agent/skills/behavioral-modes/SKILL.md +1 -76
  107. package/.agent/skills/better-colors/SKILL.md +1 -76
  108. package/.agent/skills/better-typography/SKILL.md +1 -75
  109. package/.agent/skills/better-ui/SKILL.md +18 -81
  110. package/.agent/skills/bolder/SKILL.md +1 -76
  111. package/.agent/skills/brainstorming/SKILL.md +1 -75
  112. package/.agent/skills/browser-audit/SKILL.md +15 -83
  113. package/.agent/skills/browser-native-ai/SKILL.md +1 -76
  114. package/.agent/skills/build-primitive/SKILL.md +1 -76
  115. package/.agent/skills/building-native-ui/SKILL.md +1 -76
  116. package/.agent/skills/cicd-pro/SKILL.md +1 -76
  117. package/.agent/skills/clarify/SKILL.md +1 -76
  118. package/.agent/skills/clean-code/SKILL.md +1 -76
  119. package/.agent/skills/cloud-architect/SKILL.md +1 -76
  120. package/.agent/skills/cobejs/SKILL.md +1 -76
  121. package/.agent/skills/code-review-checklist/SKILL.md +1 -76
  122. package/.agent/skills/codebase-design/SKILL.md +1 -76
  123. package/.agent/skills/colorize/SKILL.md +1 -76
  124. package/.agent/skills/compact-landing/SKILL.md +1 -76
  125. package/.agent/skills/company-logos/SKILL.md +1 -76
  126. package/.agent/skills/config-validator/SKILL.md +1 -76
  127. package/.agent/skills/containerization-pro/SKILL.md +1 -76
  128. package/.agent/skills/context-engineering-pro/SKILL.md +1 -75
  129. package/.agent/skills/create-design-md/SKILL.md +1 -76
  130. package/.agent/skills/critique/SKILL.md +1 -76
  131. package/.agent/skills/csharp-developer/SKILL.md +1 -76
  132. package/.agent/skills/data-validation-schemas/SKILL.md +1 -76
  133. package/.agent/skills/database-design/SKILL.md +1 -76
  134. package/.agent/skills/delight/SKILL.md +1 -76
  135. package/.agent/skills/deployment-procedures/SKILL.md +1 -76
  136. package/.agent/skills/design-lab/SKILL.md +0 -75
  137. package/.agent/skills/devops-engineer/SKILL.md +1 -76
  138. package/.agent/skills/devops-incident-responder/SKILL.md +1 -76
  139. package/.agent/skills/diagnosing-bugs/SKILL.md +0 -75
  140. package/.agent/skills/distill/SKILL.md +1 -76
  141. package/.agent/skills/documentation-templates/SKILL.md +1 -76
  142. package/.agent/skills/domain-modeling/SKILL.md +1 -76
  143. package/.agent/skills/duckdb-analytical-sql/SKILL.md +1 -75
  144. package/.agent/skills/edge-ai-mobile/SKILL.md +1 -75
  145. package/.agent/skills/edge-computing/SKILL.md +1 -76
  146. package/.agent/skills/emil-design-eng/SKILL.md +1 -76
  147. package/.agent/skills/error-resilience/SKILL.md +1 -76
  148. package/.agent/skills/expo-router-v4/SKILL.md +1 -75
  149. package/.agent/skills/extract-design-system/SKILL.md +1 -76
  150. package/.agent/skills/fabel-protocol/SKILL.md +1 -76
  151. package/.agent/skills/fixing-accessibility/SKILL.md +1 -76
  152. package/.agent/skills/fixing-metadata/SKILL.md +1 -76
  153. package/.agent/skills/fixing-motion-performance/SKILL.md +1 -76
  154. package/.agent/skills/framer-motion-expert/SKILL.md +1 -76
  155. package/.agent/skills/frontend-design/SKILL.md +1 -76
  156. package/.agent/skills/frontend-security-expert/SKILL.md +1 -76
  157. package/.agent/skills/game-design-expert/SKILL.md +1 -76
  158. package/.agent/skills/game-engineering-expert/SKILL.md +1 -76
  159. package/.agent/skills/generative-ui-expert/SKILL.md +1 -76
  160. package/.agent/skills/geo-fundamentals/SKILL.md +1 -76
  161. package/.agent/skills/git-pro/SKILL.md +1 -76
  162. package/.agent/skills/github-operations/SKILL.md +1 -76
  163. package/.agent/skills/gpt-taste/SKILL.md +1 -76
  164. package/.agent/skills/gsap-core/SKILL.md +1 -76
  165. package/.agent/skills/gsap-frameworks/SKILL.md +1 -76
  166. package/.agent/skills/gsap-performance/SKILL.md +1 -76
  167. package/.agent/skills/gsap-plugins/SKILL.md +1 -76
  168. package/.agent/skills/gsap-react/SKILL.md +1 -76
  169. package/.agent/skills/gsap-scrolltrigger/SKILL.md +1 -76
  170. package/.agent/skills/gsap-timeline/SKILL.md +1 -76
  171. package/.agent/skills/gsap-utils/SKILL.md +1 -76
  172. package/.agent/skills/harden/SKILL.md +1 -76
  173. package/.agent/skills/harness-protocol/SKILL.md +1 -76
  174. package/.agent/skills/i18n-localization/SKILL.md +1 -76
  175. package/.agent/skills/impeccable/SKILL.md +1 -76
  176. package/.agent/skills/improve-codebase-architecture/SKILL.md +1 -76
  177. package/.agent/skills/improve-ui/SKILL.md +1 -76
  178. package/.agent/skills/intelligent-routing/SKILL.md +2 -87
  179. package/.agent/skills/knowledge-graph/SKILL.md +1 -76
  180. package/.agent/skills/landing-page/SKILL.md +1 -76
  181. package/.agent/skills/lint-and-validate/SKILL.md +1 -76
  182. package/.agent/skills/llm-engineering/SKILL.md +1 -76
  183. package/.agent/skills/local-first/SKILL.md +1 -76
  184. package/.agent/skills/local-first-architecture/SKILL.md +1 -76
  185. package/.agent/skills/lottie-animation/SKILL.md +1 -76
  186. package/.agent/skills/marquee-loop/SKILL.md +1 -76
  187. package/.agent/skills/masked-reveal/SKILL.md +1 -76
  188. package/.agent/skills/mcp-builder/SKILL.md +1 -76
  189. package/.agent/skills/micro-interaction/SKILL.md +19 -87
  190. package/.agent/skills/mobile-design/SKILL.md +1 -76
  191. package/.agent/skills/monorepo-management/SKILL.md +1 -76
  192. package/.agent/skills/morphing-icons/SKILL.md +1 -76
  193. package/.agent/skills/motion-engineering/SKILL.md +1 -76
  194. package/.agent/skills/nextjs-react-expert/SKILL.md +1 -76
  195. package/.agent/skills/nodejs-best-practices/SKILL.md +1 -76
  196. package/.agent/skills/observability/SKILL.md +1 -76
  197. package/.agent/skills/opentelemetry-observability/SKILL.md +1 -75
  198. package/.agent/skills/page-transition-animation/SKILL.md +1 -76
  199. package/.agent/skills/parallel-agents/SKILL.md +1 -76
  200. package/.agent/skills/performance-profiling/SKILL.md +1 -76
  201. package/.agent/skills/plan-writing/SKILL.md +1 -76
  202. package/.agent/skills/platform-engineer/SKILL.md +1 -76
  203. package/.agent/skills/platform-engineering-opentofu/SKILL.md +1 -75
  204. package/.agent/skills/playwright-ai-e2e/SKILL.md +1 -75
  205. package/.agent/skills/playwright-best-practices/SKILL.md +1 -76
  206. package/.agent/skills/polish/SKILL.md +1 -76
  207. package/.agent/skills/powershell-windows/SKILL.md +1 -76
  208. package/.agent/skills/pricing-page/SKILL.md +1 -76
  209. package/.agent/skills/product-aware-heuristics/SKILL.md +1 -76
  210. package/.agent/skills/progressive-blur/SKILL.md +1 -76
  211. package/.agent/skills/project-idioms/SKILL.md +1 -76
  212. package/.agent/skills/property-based-testing/SKILL.md +1 -75
  213. package/.agent/skills/python-patterns/SKILL.md +1 -76
  214. package/.agent/skills/python-pro/SKILL.md +1 -76
  215. package/.agent/skills/quieter/SKILL.md +1 -76
  216. package/.agent/skills/react-doctor/SKILL.md +1 -76
  217. package/.agent/skills/react-specialist/SKILL.md +1 -76
  218. package/.agent/skills/readme-builder/SKILL.md +1 -76
  219. package/.agent/skills/realtime-patterns/SKILL.md +1 -76
  220. package/.agent/skills/red-team-tactics/SKILL.md +1 -76
  221. package/.agent/skills/redesign-skill/SKILL.md +1 -76
  222. package/.agent/skills/review-animations/SKILL.md +1 -76
  223. package/.agent/skills/rust-pro/SKILL.md +1 -76
  224. package/.agent/skills/seo-fundamentals/SKILL.md +1 -76
  225. package/.agent/skills/server-management/SKILL.md +1 -76
  226. package/.agent/skills/shadcn-ui-expert/SKILL.md +1 -76
  227. package/.agent/skills/shape/SKILL.md +1 -76
  228. package/.agent/skills/skill-creator/SKILL.md +127 -86
  229. package/.agent/skills/soft-skill/SKILL.md +1 -76
  230. package/.agent/skills/sounds-on-the-web/SKILL.md +1 -76
  231. package/.agent/skills/sql-pro/SKILL.md +1 -76
  232. package/.agent/skills/supabase-postgres-best-practices/SKILL.md +1 -76
  233. package/.agent/skills/svg-animation/SKILL.md +1 -76
  234. package/.agent/skills/swiftui-expert/SKILL.md +1 -76
  235. package/.agent/skills/swiss-design/SKILL.md +1 -76
  236. package/.agent/skills/system-design-pro/SKILL.md +1 -76
  237. package/.agent/skills/systematic-debugging/SKILL.md +2 -76
  238. package/.agent/skills/systematic-debugging/condition-based-waiting.md +14 -9
  239. package/.agent/skills/systematic-debugging/defense-in-depth.md +9 -3
  240. package/.agent/skills/systematic-debugging/root-cause-tracing.md +14 -0
  241. package/.agent/skills/tailwind-patterns/SKILL.md +1 -76
  242. package/.agent/skills/taste-skill/SKILL.md +1 -76
  243. package/.agent/skills/tdd-workflow/SKILL.md +8 -82
  244. package/.agent/skills/test-result-analyzer/SKILL.md +1 -76
  245. package/.agent/skills/testing-patterns/SKILL.md +1 -76
  246. package/.agent/skills/thermo-nuclear-code-quality-review/SKILL.md +1 -76
  247. package/.agent/skills/thinking-protocol/SKILL.md +1 -77
  248. package/.agent/skills/to-spring-or-not-to-spring/SKILL.md +1 -76
  249. package/.agent/skills/transitions-dev/SKILL.md +1 -76
  250. package/.agent/skills/trend-researcher/SKILL.md +1 -76
  251. package/.agent/skills/typescript-advanced/SKILL.md +1 -76
  252. package/.agent/skills/typeset/SKILL.md +1 -76
  253. package/.agent/skills/ui-reasoning-engine/SKILL.md +1 -76
  254. package/.agent/skills/ui-skill-packs/SKILL.md +1 -76
  255. package/.agent/skills/ui-skills-root/SKILL.md +1 -76
  256. package/.agent/skills/ui-ux-pro-max/SKILL.md +1 -76
  257. package/.agent/skills/ui-ux-researcher/SKILL.md +1 -76
  258. package/.agent/skills/vector-search-pgvector/SKILL.md +1 -75
  259. package/.agent/skills/verification-before-completion/SKILL.md +20 -91
  260. package/.agent/skills/vue-expert/SKILL.md +1 -76
  261. package/.agent/skills/vulnerability-scanner/SKILL.md +1 -76
  262. package/.agent/skills/web-accessibility-auditor/SKILL.md +1 -76
  263. package/.agent/skills/web-design-guidelines/SKILL.md +1 -76
  264. package/.agent/skills/web-quality-audit/SKILL.md +1 -76
  265. package/.agent/skills/webapp-testing/SKILL.md +1 -76
  266. package/.agent/skills/webgpu-performance/SKILL.md +1 -76
  267. package/.agent/skills/whimsy-injector/SKILL.md +1 -76
  268. package/.agent/skills/workflow-optimizer/SKILL.md +1 -76
  269. package/.agent/skills/zero-trust-passkeys/SKILL.md +1 -75
  270. package/.agent/templates/DESIGN.md +312 -290
  271. package/.agent/templates/sdd/task-reviewer-prompt.md +2 -2
  272. package/.agent/workflows/audit-live.md +4 -3
  273. package/.agent/workflows/brainstorm.md +1 -0
  274. package/.agent/workflows/context.md +9 -7
  275. package/.agent/workflows/generate.md +1 -1
  276. package/.agent/workflows/minimal.md +3 -2
  277. package/.agent/workflows/orchestrate.md +1 -1
  278. package/.agent/workflows/plan.md +1 -1
  279. package/.agent/workflows/review-ai.md +1 -1
  280. package/.agent/workflows/sdd.md +15 -0
  281. package/.agent/workflows/skill-enhancement-engine.md +17 -21
  282. package/.agent/workflows/super-prompt.md +25 -24
  283. package/.agent/workflows/swarm.md +1 -1
  284. package/.agent/workflows/tribunal-backend.md +1 -1
  285. package/.agent/workflows/tribunal-cicd.md +1 -1
  286. package/.agent/workflows/tribunal-database.md +1 -1
  287. package/.agent/workflows/tribunal-frontend.md +1 -1
  288. package/.agent/workflows/tribunal-full.md +9 -9
  289. package/.agent/workflows/tribunal-mobile.md +1 -1
  290. package/.agent/workflows/tribunal-speed.md +1 -1
  291. package/.agent/workflows/tribunal-ui.md +1 -1
  292. package/.agents/skills/12-principles-of-animation/SKILL.md +1 -76
  293. package/.agents/skills/60fps-animation/SKILL.md +4 -77
  294. package/.agents/skills/accessible-animation/SKILL.md +9 -86
  295. package/.agents/skills/adapt/SKILL.md +1 -76
  296. package/.agents/skills/advanced-rag-pipelines/SKILL.md +1 -76
  297. package/.agents/skills/agent-organizer/SKILL.md +1 -76
  298. package/.agents/skills/agentic-patterns/SKILL.md +1 -76
  299. package/.agents/skills/agentic-workflows-2026/SKILL.md +1 -75
  300. package/.agents/skills/ai-app-hardening/SKILL.md +1 -75
  301. package/.agents/skills/ai-prompt-injection-defense/SKILL.md +1 -76
  302. package/.agents/skills/animation-on-scroll/SKILL.md +16 -87
  303. package/.agents/skills/animation-systems/SKILL.md +15 -90
  304. package/.agents/skills/antfu-conventions/SKILL.md +0 -75
  305. package/.agents/skills/api-patterns/SKILL.md +1 -76
  306. package/.agents/skills/api-security-auditor/SKILL.md +1 -76
  307. package/.agents/skills/app-builder/SKILL.md +1 -76
  308. package/.agents/skills/appflow-wireframe/SKILL.md +1 -78
  309. package/.agents/skills/apple-design/SKILL.md +1 -76
  310. package/.agents/skills/architecture/SKILL.md +1 -76
  311. package/.agents/skills/audit-and-fix/SKILL.md +41 -77
  312. package/.agents/skills/authentication-best-practices/SKILL.md +1 -76
  313. package/.agents/skills/backend-security-expert/SKILL.md +1 -76
  314. package/.agents/skills/baseline-ui/SKILL.md +1 -76
  315. package/.agents/skills/bash-linux/SKILL.md +1 -76
  316. package/.agents/skills/behavioral-modes/SKILL.md +1 -76
  317. package/.agents/skills/better-colors/SKILL.md +1 -76
  318. package/.agents/skills/better-typography/SKILL.md +1 -75
  319. package/.agents/skills/better-ui/SKILL.md +18 -81
  320. package/.agents/skills/bolder/SKILL.md +1 -76
  321. package/.agents/skills/brainstorming/SKILL.md +1 -75
  322. package/.agents/skills/browser-audit/SKILL.md +15 -83
  323. package/.agents/skills/browser-native-ai/SKILL.md +1 -76
  324. package/.agents/skills/build-primitive/SKILL.md +1 -76
  325. package/.agents/skills/building-native-ui/SKILL.md +1 -76
  326. package/.agents/skills/cicd-pro/SKILL.md +1 -76
  327. package/.agents/skills/clarify/SKILL.md +1 -76
  328. package/.agents/skills/clean-code/SKILL.md +1 -76
  329. package/.agents/skills/cloud-architect/SKILL.md +1 -76
  330. package/.agents/skills/cobejs/SKILL.md +1 -76
  331. package/.agents/skills/code-review-checklist/SKILL.md +1 -76
  332. package/.agents/skills/codebase-design/SKILL.md +1 -76
  333. package/.agents/skills/colorize/SKILL.md +1 -76
  334. package/.agents/skills/compact-landing/SKILL.md +1 -76
  335. package/.agents/skills/company-logos/SKILL.md +1 -76
  336. package/.agents/skills/config-validator/SKILL.md +1 -76
  337. package/.agents/skills/containerization-pro/SKILL.md +1 -76
  338. package/.agents/skills/context-engineering-pro/SKILL.md +1 -75
  339. package/.agents/skills/create-design-md/SKILL.md +1 -76
  340. package/.agents/skills/critique/SKILL.md +1 -76
  341. package/.agents/skills/csharp-developer/SKILL.md +1 -76
  342. package/.agents/skills/data-validation-schemas/SKILL.md +1 -76
  343. package/.agents/skills/database-design/SKILL.md +1 -76
  344. package/.agents/skills/delight/SKILL.md +1 -76
  345. package/.agents/skills/deployment-procedures/SKILL.md +1 -76
  346. package/.agents/skills/design-lab/SKILL.md +0 -75
  347. package/.agents/skills/devops-engineer/SKILL.md +1 -76
  348. package/.agents/skills/devops-incident-responder/SKILL.md +1 -76
  349. package/.agents/skills/diagnosing-bugs/SKILL.md +0 -75
  350. package/.agents/skills/distill/SKILL.md +1 -76
  351. package/.agents/skills/documentation-templates/SKILL.md +1 -76
  352. package/.agents/skills/domain-modeling/SKILL.md +1 -76
  353. package/.agents/skills/duckdb-analytical-sql/SKILL.md +1 -75
  354. package/.agents/skills/edge-ai-mobile/SKILL.md +1 -75
  355. package/.agents/skills/edge-computing/SKILL.md +1 -76
  356. package/.agents/skills/emil-design-eng/SKILL.md +1 -76
  357. package/.agents/skills/error-resilience/SKILL.md +1 -76
  358. package/.agents/skills/expo-router-v4/SKILL.md +1 -75
  359. package/.agents/skills/extract-design-system/SKILL.md +1 -76
  360. package/.agents/skills/fabel-protocol/SKILL.md +1 -76
  361. package/.agents/skills/fixing-accessibility/SKILL.md +1 -76
  362. package/.agents/skills/fixing-metadata/SKILL.md +1 -76
  363. package/.agents/skills/fixing-motion-performance/SKILL.md +1 -76
  364. package/.agents/skills/framer-motion-expert/SKILL.md +1 -76
  365. package/.agents/skills/frontend-design/SKILL.md +1 -76
  366. package/.agents/skills/frontend-security-expert/SKILL.md +1 -76
  367. package/.agents/skills/game-design-expert/SKILL.md +1 -76
  368. package/.agents/skills/game-engineering-expert/SKILL.md +1 -76
  369. package/.agents/skills/generative-ui-expert/SKILL.md +1 -76
  370. package/.agents/skills/geo-fundamentals/SKILL.md +1 -76
  371. package/.agents/skills/git-pro/SKILL.md +1 -76
  372. package/.agents/skills/github-operations/SKILL.md +1 -76
  373. package/.agents/skills/gpt-taste/SKILL.md +1 -76
  374. package/.agents/skills/gsap-core/SKILL.md +1 -76
  375. package/.agents/skills/gsap-frameworks/SKILL.md +1 -76
  376. package/.agents/skills/gsap-performance/SKILL.md +1 -76
  377. package/.agents/skills/gsap-plugins/SKILL.md +1 -76
  378. package/.agents/skills/gsap-react/SKILL.md +1 -76
  379. package/.agents/skills/gsap-scrolltrigger/SKILL.md +1 -76
  380. package/.agents/skills/gsap-timeline/SKILL.md +1 -76
  381. package/.agents/skills/gsap-utils/SKILL.md +1 -76
  382. package/.agents/skills/harden/SKILL.md +1 -76
  383. package/.agents/skills/harness-protocol/SKILL.md +1 -76
  384. package/.agents/skills/i18n-localization/SKILL.md +1 -76
  385. package/.agents/skills/impeccable/SKILL.md +1 -76
  386. package/.agents/skills/improve-codebase-architecture/SKILL.md +1 -76
  387. package/.agents/skills/improve-ui/SKILL.md +1 -76
  388. package/.agents/skills/intelligent-routing/SKILL.md +2 -87
  389. package/.agents/skills/knowledge-graph/SKILL.md +1 -76
  390. package/.agents/skills/landing-page/SKILL.md +1 -76
  391. package/.agents/skills/lint-and-validate/SKILL.md +1 -76
  392. package/.agents/skills/llm-engineering/SKILL.md +1 -76
  393. package/.agents/skills/local-first/SKILL.md +1 -76
  394. package/.agents/skills/local-first-architecture/SKILL.md +1 -76
  395. package/.agents/skills/lottie-animation/SKILL.md +1 -76
  396. package/.agents/skills/marquee-loop/SKILL.md +1 -76
  397. package/.agents/skills/masked-reveal/SKILL.md +1 -76
  398. package/.agents/skills/mcp-builder/SKILL.md +1 -76
  399. package/.agents/skills/micro-interaction/SKILL.md +19 -87
  400. package/.agents/skills/mobile-design/SKILL.md +1 -76
  401. package/.agents/skills/monorepo-management/SKILL.md +1 -76
  402. package/.agents/skills/morphing-icons/SKILL.md +1 -76
  403. package/.agents/skills/motion-engineering/SKILL.md +1 -76
  404. package/.agents/skills/nextjs-react-expert/SKILL.md +1 -76
  405. package/.agents/skills/nodejs-best-practices/SKILL.md +1 -76
  406. package/.agents/skills/observability/SKILL.md +1 -76
  407. package/.agents/skills/opentelemetry-observability/SKILL.md +1 -75
  408. package/.agents/skills/page-transition-animation/SKILL.md +1 -76
  409. package/.agents/skills/parallel-agents/SKILL.md +1 -76
  410. package/.agents/skills/performance-profiling/SKILL.md +1 -76
  411. package/.agents/skills/plan-writing/SKILL.md +1 -76
  412. package/.agents/skills/platform-engineer/SKILL.md +1 -76
  413. package/.agents/skills/platform-engineering-opentofu/SKILL.md +1 -75
  414. package/.agents/skills/playwright-ai-e2e/SKILL.md +1 -75
  415. package/.agents/skills/playwright-best-practices/SKILL.md +1 -76
  416. package/.agents/skills/polish/SKILL.md +1 -76
  417. package/.agents/skills/powershell-windows/SKILL.md +1 -76
  418. package/.agents/skills/pricing-page/SKILL.md +1 -76
  419. package/.agents/skills/product-aware-heuristics/SKILL.md +1 -76
  420. package/.agents/skills/progressive-blur/SKILL.md +1 -76
  421. package/.agents/skills/project-idioms/SKILL.md +1 -76
  422. package/.agents/skills/property-based-testing/SKILL.md +1 -75
  423. package/.agents/skills/python-patterns/SKILL.md +1 -76
  424. package/.agents/skills/python-pro/SKILL.md +1 -76
  425. package/.agents/skills/quieter/SKILL.md +1 -76
  426. package/.agents/skills/react-doctor/SKILL.md +1 -76
  427. package/.agents/skills/react-specialist/SKILL.md +1 -76
  428. package/.agents/skills/readme-builder/SKILL.md +1 -76
  429. package/.agents/skills/realtime-patterns/SKILL.md +1 -76
  430. package/.agents/skills/red-team-tactics/SKILL.md +1 -76
  431. package/.agents/skills/redesign-skill/SKILL.md +1 -76
  432. package/.agents/skills/review-animations/SKILL.md +1 -76
  433. package/.agents/skills/rust-pro/SKILL.md +1 -76
  434. package/.agents/skills/seo-fundamentals/SKILL.md +1 -76
  435. package/.agents/skills/server-management/SKILL.md +1 -76
  436. package/.agents/skills/shadcn-ui-expert/SKILL.md +1 -76
  437. package/.agents/skills/shape/SKILL.md +1 -76
  438. package/.agents/skills/skill-creator/SKILL.md +127 -86
  439. package/.agents/skills/soft-skill/SKILL.md +1 -76
  440. package/.agents/skills/sounds-on-the-web/SKILL.md +1 -76
  441. package/.agents/skills/sql-pro/SKILL.md +1 -76
  442. package/.agents/skills/supabase-postgres-best-practices/SKILL.md +1 -76
  443. package/.agents/skills/svg-animation/SKILL.md +1 -76
  444. package/.agents/skills/swiftui-expert/SKILL.md +1 -76
  445. package/.agents/skills/swiss-design/SKILL.md +1 -76
  446. package/.agents/skills/system-design-pro/SKILL.md +1 -76
  447. package/.agents/skills/systematic-debugging/SKILL.md +2 -76
  448. package/.agents/skills/systematic-debugging/condition-based-waiting.md +14 -9
  449. package/.agents/skills/systematic-debugging/defense-in-depth.md +9 -3
  450. package/.agents/skills/systematic-debugging/root-cause-tracing.md +14 -0
  451. package/.agents/skills/tailwind-patterns/SKILL.md +1 -76
  452. package/.agents/skills/taste-skill/SKILL.md +1 -76
  453. package/.agents/skills/tdd-workflow/SKILL.md +8 -82
  454. package/.agents/skills/test-result-analyzer/SKILL.md +1 -76
  455. package/.agents/skills/testing-patterns/SKILL.md +1 -76
  456. package/.agents/skills/thermo-nuclear-code-quality-review/SKILL.md +1 -76
  457. package/.agents/skills/thinking-protocol/SKILL.md +1 -77
  458. package/.agents/skills/to-spring-or-not-to-spring/SKILL.md +1 -76
  459. package/.agents/skills/transitions-dev/SKILL.md +1 -76
  460. package/.agents/skills/trend-researcher/SKILL.md +1 -76
  461. package/.agents/skills/typescript-advanced/SKILL.md +1 -76
  462. package/.agents/skills/typeset/SKILL.md +1 -76
  463. package/.agents/skills/ui-reasoning-engine/SKILL.md +1 -76
  464. package/.agents/skills/ui-skill-packs/SKILL.md +1 -76
  465. package/.agents/skills/ui-skills-root/SKILL.md +1 -76
  466. package/.agents/skills/ui-ux-pro-max/SKILL.md +1 -76
  467. package/.agents/skills/ui-ux-researcher/SKILL.md +1 -76
  468. package/.agents/skills/vector-search-pgvector/SKILL.md +1 -75
  469. package/.agents/skills/verification-before-completion/SKILL.md +20 -91
  470. package/.agents/skills/vue-expert/SKILL.md +1 -76
  471. package/.agents/skills/vulnerability-scanner/SKILL.md +1 -76
  472. package/.agents/skills/web-accessibility-auditor/SKILL.md +1 -76
  473. package/.agents/skills/web-design-guidelines/SKILL.md +1 -76
  474. package/.agents/skills/web-quality-audit/SKILL.md +1 -76
  475. package/.agents/skills/webapp-testing/SKILL.md +1 -76
  476. package/.agents/skills/webgpu-performance/SKILL.md +1 -76
  477. package/.agents/skills/whimsy-injector/SKILL.md +1 -76
  478. package/.agents/skills/workflow-optimizer/SKILL.md +1 -76
  479. package/.agents/skills/zero-trust-passkeys/SKILL.md +1 -75
  480. package/.codex-plugin/plugin.json +1 -5
  481. package/.kimi-plugin/plugin.json +1 -5
  482. package/.opencode/INSTALL.md +1 -0
  483. package/.opencode/plugins/tribunal.js +15 -6
  484. package/.pi/extensions/tribunal.ts +26 -29
  485. package/AGENTS.md +15 -13
  486. package/CLAUDE.md +3 -1
  487. package/README.md +23 -16
  488. package/bin/adapter-install.js +1 -1
  489. package/bin/mcp-server.js +88 -58
  490. package/bin/wrapper.js +22 -2
  491. package/dist/commands/init.js +25 -11
  492. package/dist/tui/banner.js +77 -77
  493. package/gemini-extension.json +1 -1
  494. package/package.json +13 -10
  495. package/plugin.json +1 -1
  496. package/scripts/apply-version.js +2 -2
  497. package/scripts/audit_skill_sdo.js +6 -4
  498. package/scripts/context_compiler.js +256 -83
  499. package/scripts/modernize_skills.js +25 -11
  500. package/scripts/package-cores.js +4 -1
  501. package/scripts/skill_enhancement_engine.js +212 -77
  502. package/scripts/telemetry_gc.js +156 -0
  503. package/scripts/validate-payload.js +1 -6
  504. package/skills/12-principles-of-animation/SKILL.md +1 -76
  505. package/skills/60fps-animation/SKILL.md +4 -77
  506. package/skills/accessible-animation/SKILL.md +9 -86
  507. package/skills/adapt/SKILL.md +1 -76
  508. package/skills/advanced-rag-pipelines/SKILL.md +1 -76
  509. package/skills/agent-organizer/SKILL.md +1 -76
  510. package/skills/agentic-patterns/SKILL.md +1 -76
  511. package/skills/agentic-workflows-2026/SKILL.md +1 -75
  512. package/skills/ai-app-hardening/SKILL.md +1 -75
  513. package/skills/ai-prompt-injection-defense/SKILL.md +1 -76
  514. package/skills/animation-on-scroll/SKILL.md +16 -87
  515. package/skills/animation-systems/SKILL.md +15 -90
  516. package/skills/antfu-conventions/SKILL.md +0 -75
  517. package/skills/api-patterns/SKILL.md +1 -76
  518. package/skills/api-security-auditor/SKILL.md +1 -76
  519. package/skills/app-builder/SKILL.md +1 -76
  520. package/skills/appflow-wireframe/SKILL.md +1 -78
  521. package/skills/apple-design/SKILL.md +1 -76
  522. package/skills/architecture/SKILL.md +1 -76
  523. package/skills/audit-and-fix/SKILL.md +41 -77
  524. package/skills/authentication-best-practices/SKILL.md +1 -76
  525. package/skills/backend-security-expert/SKILL.md +1 -76
  526. package/skills/baseline-ui/SKILL.md +1 -76
  527. package/skills/bash-linux/SKILL.md +1 -76
  528. package/skills/behavioral-modes/SKILL.md +1 -76
  529. package/skills/better-colors/SKILL.md +1 -76
  530. package/skills/better-typography/SKILL.md +1 -75
  531. package/skills/better-ui/SKILL.md +18 -81
  532. package/skills/bolder/SKILL.md +1 -76
  533. package/skills/brainstorming/SKILL.md +1 -75
  534. package/skills/browser-audit/SKILL.md +15 -83
  535. package/skills/browser-native-ai/SKILL.md +1 -76
  536. package/skills/build-primitive/SKILL.md +1 -76
  537. package/skills/building-native-ui/SKILL.md +1 -76
  538. package/skills/cicd-pro/SKILL.md +1 -76
  539. package/skills/clarify/SKILL.md +1 -76
  540. package/skills/clean-code/SKILL.md +1 -76
  541. package/skills/cloud-architect/SKILL.md +1 -76
  542. package/skills/cobejs/SKILL.md +1 -76
  543. package/skills/code-review-checklist/SKILL.md +1 -76
  544. package/skills/codebase-design/SKILL.md +1 -76
  545. package/skills/colorize/SKILL.md +1 -76
  546. package/skills/compact-landing/SKILL.md +1 -76
  547. package/skills/company-logos/SKILL.md +1 -76
  548. package/skills/config-validator/SKILL.md +1 -76
  549. package/skills/containerization-pro/SKILL.md +1 -76
  550. package/skills/context-engineering-pro/SKILL.md +1 -75
  551. package/skills/create-design-md/SKILL.md +1 -76
  552. package/skills/critique/SKILL.md +1 -76
  553. package/skills/csharp-developer/SKILL.md +1 -76
  554. package/skills/data-validation-schemas/SKILL.md +1 -76
  555. package/skills/database-design/SKILL.md +1 -76
  556. package/skills/delight/SKILL.md +1 -76
  557. package/skills/deployment-procedures/SKILL.md +1 -76
  558. package/skills/design-lab/SKILL.md +0 -75
  559. package/skills/devops-engineer/SKILL.md +1 -76
  560. package/skills/devops-incident-responder/SKILL.md +1 -76
  561. package/skills/diagnosing-bugs/SKILL.md +0 -75
  562. package/skills/distill/SKILL.md +1 -76
  563. package/skills/documentation-templates/SKILL.md +1 -76
  564. package/skills/domain-modeling/SKILL.md +1 -76
  565. package/skills/duckdb-analytical-sql/SKILL.md +1 -75
  566. package/skills/edge-ai-mobile/SKILL.md +1 -75
  567. package/skills/edge-computing/SKILL.md +1 -76
  568. package/skills/emil-design-eng/SKILL.md +1 -76
  569. package/skills/error-resilience/SKILL.md +1 -76
  570. package/skills/expo-router-v4/SKILL.md +1 -75
  571. package/skills/extract-design-system/SKILL.md +1 -76
  572. package/skills/fabel-protocol/SKILL.md +1 -76
  573. package/skills/fixing-accessibility/SKILL.md +1 -76
  574. package/skills/fixing-metadata/SKILL.md +1 -76
  575. package/skills/fixing-motion-performance/SKILL.md +1 -76
  576. package/skills/framer-motion-expert/SKILL.md +1 -76
  577. package/skills/frontend-design/SKILL.md +1 -76
  578. package/skills/frontend-security-expert/SKILL.md +1 -76
  579. package/skills/game-design-expert/SKILL.md +1 -76
  580. package/skills/game-engineering-expert/SKILL.md +1 -76
  581. package/skills/generative-ui-expert/SKILL.md +1 -76
  582. package/skills/geo-fundamentals/SKILL.md +1 -76
  583. package/skills/git-pro/SKILL.md +1 -76
  584. package/skills/github-operations/SKILL.md +1 -76
  585. package/skills/gpt-taste/SKILL.md +1 -76
  586. package/skills/gsap-core/SKILL.md +1 -76
  587. package/skills/gsap-frameworks/SKILL.md +1 -76
  588. package/skills/gsap-performance/SKILL.md +1 -76
  589. package/skills/gsap-plugins/SKILL.md +1 -76
  590. package/skills/gsap-react/SKILL.md +1 -76
  591. package/skills/gsap-scrolltrigger/SKILL.md +1 -76
  592. package/skills/gsap-timeline/SKILL.md +1 -76
  593. package/skills/gsap-utils/SKILL.md +1 -76
  594. package/skills/harden/SKILL.md +1 -76
  595. package/skills/harness-protocol/SKILL.md +1 -76
  596. package/skills/i18n-localization/SKILL.md +1 -76
  597. package/skills/impeccable/SKILL.md +1 -76
  598. package/skills/improve-codebase-architecture/SKILL.md +1 -76
  599. package/skills/improve-ui/SKILL.md +1 -76
  600. package/skills/intelligent-routing/SKILL.md +2 -87
  601. package/skills/knowledge-graph/SKILL.md +1 -76
  602. package/skills/landing-page/SKILL.md +1 -76
  603. package/skills/lint-and-validate/SKILL.md +1 -76
  604. package/skills/llm-engineering/SKILL.md +1 -76
  605. package/skills/local-first/SKILL.md +1 -76
  606. package/skills/local-first-architecture/SKILL.md +1 -76
  607. package/skills/lottie-animation/SKILL.md +1 -76
  608. package/skills/marquee-loop/SKILL.md +1 -76
  609. package/skills/masked-reveal/SKILL.md +1 -76
  610. package/skills/mcp-builder/SKILL.md +1 -76
  611. package/skills/micro-interaction/SKILL.md +19 -87
  612. package/skills/mobile-design/SKILL.md +1 -76
  613. package/skills/monorepo-management/SKILL.md +1 -76
  614. package/skills/morphing-icons/SKILL.md +1 -76
  615. package/skills/motion-engineering/SKILL.md +1 -76
  616. package/skills/nextjs-react-expert/SKILL.md +1 -76
  617. package/skills/nodejs-best-practices/SKILL.md +1 -76
  618. package/skills/observability/SKILL.md +1 -76
  619. package/skills/opentelemetry-observability/SKILL.md +1 -75
  620. package/skills/page-transition-animation/SKILL.md +1 -76
  621. package/skills/parallel-agents/SKILL.md +1 -76
  622. package/skills/performance-profiling/SKILL.md +1 -76
  623. package/skills/plan-writing/SKILL.md +1 -76
  624. package/skills/platform-engineer/SKILL.md +1 -76
  625. package/skills/platform-engineering-opentofu/SKILL.md +1 -75
  626. package/skills/playwright-ai-e2e/SKILL.md +1 -75
  627. package/skills/playwright-best-practices/SKILL.md +1 -76
  628. package/skills/polish/SKILL.md +1 -76
  629. package/skills/powershell-windows/SKILL.md +1 -76
  630. package/skills/pricing-page/SKILL.md +1 -76
  631. package/skills/product-aware-heuristics/SKILL.md +1 -76
  632. package/skills/progressive-blur/SKILL.md +1 -76
  633. package/skills/project-idioms/SKILL.md +1 -76
  634. package/skills/property-based-testing/SKILL.md +1 -75
  635. package/skills/python-patterns/SKILL.md +1 -76
  636. package/skills/python-pro/SKILL.md +1 -76
  637. package/skills/quieter/SKILL.md +1 -76
  638. package/skills/react-doctor/SKILL.md +1 -76
  639. package/skills/react-specialist/SKILL.md +1 -76
  640. package/skills/readme-builder/SKILL.md +1 -76
  641. package/skills/realtime-patterns/SKILL.md +1 -76
  642. package/skills/red-team-tactics/SKILL.md +1 -76
  643. package/skills/redesign-skill/SKILL.md +1 -76
  644. package/skills/review-animations/SKILL.md +1 -76
  645. package/skills/rust-pro/SKILL.md +1 -76
  646. package/skills/seo-fundamentals/SKILL.md +1 -76
  647. package/skills/server-management/SKILL.md +1 -76
  648. package/skills/shadcn-ui-expert/SKILL.md +1 -76
  649. package/skills/shape/SKILL.md +1 -76
  650. package/skills/skill-creator/SKILL.md +127 -86
  651. package/skills/soft-skill/SKILL.md +1 -76
  652. package/skills/sounds-on-the-web/SKILL.md +1 -76
  653. package/skills/sql-pro/SKILL.md +1 -76
  654. package/skills/supabase-postgres-best-practices/SKILL.md +1 -76
  655. package/skills/svg-animation/SKILL.md +1 -76
  656. package/skills/swiftui-expert/SKILL.md +1 -76
  657. package/skills/swiss-design/SKILL.md +1 -76
  658. package/skills/system-design-pro/SKILL.md +1 -76
  659. package/skills/systematic-debugging/SKILL.md +2 -76
  660. package/skills/systematic-debugging/condition-based-waiting.md +14 -9
  661. package/skills/systematic-debugging/defense-in-depth.md +9 -3
  662. package/skills/systematic-debugging/root-cause-tracing.md +14 -0
  663. package/skills/tailwind-patterns/SKILL.md +1 -76
  664. package/skills/taste-skill/SKILL.md +1 -76
  665. package/skills/tdd-workflow/SKILL.md +8 -82
  666. package/skills/test-result-analyzer/SKILL.md +1 -76
  667. package/skills/testing-patterns/SKILL.md +1 -76
  668. package/skills/thermo-nuclear-code-quality-review/SKILL.md +1 -76
  669. package/skills/thinking-protocol/SKILL.md +1 -77
  670. package/skills/to-spring-or-not-to-spring/SKILL.md +1 -76
  671. package/skills/transitions-dev/SKILL.md +1 -76
  672. package/skills/trend-researcher/SKILL.md +1 -76
  673. package/skills/typescript-advanced/SKILL.md +1 -76
  674. package/skills/typeset/SKILL.md +1 -76
  675. package/skills/ui-reasoning-engine/SKILL.md +1 -76
  676. package/skills/ui-skill-packs/SKILL.md +1 -76
  677. package/skills/ui-skills-root/SKILL.md +1 -76
  678. package/skills/ui-ux-pro-max/SKILL.md +1 -76
  679. package/skills/ui-ux-researcher/SKILL.md +1 -76
  680. package/skills/vector-search-pgvector/SKILL.md +1 -75
  681. package/skills/verification-before-completion/SKILL.md +20 -91
  682. package/skills/vue-expert/SKILL.md +1 -76
  683. package/skills/vulnerability-scanner/SKILL.md +1 -76
  684. package/skills/web-accessibility-auditor/SKILL.md +1 -76
  685. package/skills/web-design-guidelines/SKILL.md +1 -76
  686. package/skills/web-quality-audit/SKILL.md +1 -76
  687. package/skills/webapp-testing/SKILL.md +1 -76
  688. package/skills/webgpu-performance/SKILL.md +1 -76
  689. package/skills/whimsy-injector/SKILL.md +1 -76
  690. package/skills/workflow-optimizer/SKILL.md +1 -76
  691. package/skills/zero-trust-passkeys/SKILL.md +1 -75
@@ -1,9 +1,1112 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * context_compiler.js — Tribunal Kit SOTA Context Compiler Engine (tribunal-kit .agent mirror)
3
+ * context_compiler.js — Tribunal Kit SOTA Context Compiler Engine
4
+ * ════════════════════════════════════════════════════════════════════
5
+ * Deterministic, high-speed context extraction engine for:
6
+ * 1. Single Files (Flight Data HUD Dossier)
7
+ * 2. Multi-File Pairs (Interface Bridge Dossier)
8
+ * 3. Project Folders (Subsystem Macro Dossier)
9
+ * 4. Batch Vault Crawling (--crawl)
10
+ * 5. Semantic Drift Sentinel (--check)
11
+ *
12
+ * Designed for both CLI execution and in-process MCP server integration.
4
13
  */
14
+
5
15
  'use strict';
6
- module.exports = require('../../scripts/context_compiler.js');
16
+
17
+ const fs = require('fs');
18
+ const path = require('path');
19
+ const crypto = require('crypto');
20
+ const { execSync } = require('child_process');
21
+
22
+ // Optional ANSI colors
23
+ let C = {
24
+ GREEN: '\x1b[92m',
25
+ YELLOW: '\x1b[93m',
26
+ CYAN: '\x1b[96m',
27
+ RED: '\x1b[91m',
28
+ BLUE: '\x1b[94m',
29
+ BOLD: '\x1b[1m',
30
+ DIM: '\x1b[2m',
31
+ RESET: '\x1b[0m',
32
+ };
33
+
34
+ try {
35
+ const colorsMod = require('./_colors');
36
+ if (colorsMod) C = Object.assign({}, C, colorsMod);
37
+ } catch {
38
+ try {
39
+ const colorsMod = require('../.agent/scripts/_colors');
40
+ if (colorsMod) C = Object.assign({}, C, colorsMod);
41
+ } catch {
42
+ // Fallback C used
43
+ }
44
+ }
45
+
46
+ // ── Hashing Helpers ─────────────────────────────────────────────────────────
47
+
48
+ function computeSha256(content) {
49
+ const normalized = content.replace(/\r\n/g, '\n').trim();
50
+ return crypto.createHash('sha256').update(normalized, 'utf8').digest('hex').substring(0, 16);
51
+ }
52
+
53
+ function computeInterfaceHash(signatures) {
54
+ const text = signatures
55
+ .map(s => `${s.kind}:${s.name}:${s.signature}`)
56
+ .sort()
57
+ .join('\n');
58
+ return crypto.createHash('sha256').update(text, 'utf8').digest('hex').substring(0, 16);
59
+ }
60
+
61
+ // ── Multi-Language AST / Regex Skeleton Extractor ───────────────────────────
62
+
63
+ function extractFileSkeleton(filePath, rawContent) {
64
+ const ext = path.extname(filePath).toLowerCase();
65
+ const lines = rawContent.split(/\r?\n/);
66
+ const imports = [];
67
+ const exports = [];
68
+ const types = [];
69
+ const landmines = [];
70
+
71
+ // 1. Comments and Landmines (Chesterton's Fences)
72
+ lines.forEach((line, idx) => {
73
+ const trimmed = line.trim();
74
+ if (
75
+ trimmed.includes('// VERIFY') ||
76
+ trimmed.includes('// NOTE') ||
77
+ trimmed.includes('// FIX') ||
78
+ trimmed.includes('// HACK') ||
79
+ trimmed.includes('// CAUTION') ||
80
+ trimmed.includes('// INVARIANT') ||
81
+ trimmed.includes('// DO NOT') ||
82
+ trimmed.includes('# VERIFY') ||
83
+ trimmed.includes('# NOTE')
84
+ ) {
85
+ landmines.push({
86
+ line: idx + 1,
87
+ content: trimmed,
88
+ });
89
+ }
90
+ });
91
+
92
+ // 2. Language-Specific Parsers
93
+ if (ext === '.ts' || ext === '.tsx' || ext === '.js' || ext === '.jsx' || ext === '.mjs') {
94
+ // Phase 1: Try Rust AST Extraction
95
+ try {
96
+ const absPath = path.resolve(process.cwd(), filePath);
97
+ let corePath = null;
98
+ try {
99
+ const { getBinaryPath } = require('./_utils');
100
+ corePath = getBinaryPath();
101
+ } catch (_) {
102
+ try {
103
+ const wrapper = require('../../bin/wrapper');
104
+ corePath = wrapper.getBinaryPath ? wrapper.getBinaryPath() : null;
105
+ } catch (_2) {}
106
+ }
107
+
108
+ if (!corePath && process.env.TRIBUNAL_CORE_PATH && fs.existsSync(process.env.TRIBUNAL_CORE_PATH)) {
109
+ corePath = process.env.TRIBUNAL_CORE_PATH;
110
+ }
111
+
112
+ if (corePath && fs.existsSync(corePath)) {
113
+ const result = require('child_process').execSync(`"${corePath}" ast-extract --file "${absPath}"`, { encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] });
114
+ const data = JSON.parse(result);
115
+ if (data && data.success) {
116
+ // We map the Rust JSON into the exact format expected by the rest of the JS code
117
+ const mappedImports = data.imports.map(i => ({ source: i.source, specifiers: i.specifiers, line: 0 }));
118
+ const mappedExports = data.exports.map(e => ({ kind: e.kind, name: e.name, signature: e.signature, line: 0 }));
119
+ const mappedTypes = data.types.map(t => ({ kind: t.kind, name: t.name, signature: t.signature, line: 0 }));
120
+
121
+ return {
122
+ imports: mappedImports,
123
+ exports: mappedExports,
124
+ types: mappedTypes,
125
+ landmines: data.landmines,
126
+ interfaceHash: computeInterfaceHash(mappedExports.concat(mappedTypes))
127
+ };
128
+ }
129
+ }
130
+ } catch(e) {
131
+ // Silent fallback to Regex parsing
132
+ }
133
+
134
+ lines.forEach((line, idx) => {
135
+ const trimmed = line.trim();
136
+
137
+ // Imports
138
+ const importMatch = trimmed.match(
139
+ /^import\s+(?:type\s+)?(?:(.+?)\s+from\s+)?['"]([^'"]+)['"]/,
140
+ );
141
+ if (importMatch) {
142
+ imports.push({
143
+ source: importMatch[2],
144
+ specifiers: importMatch[1] ? importMatch[1].trim() : '*',
145
+ line: idx + 1,
146
+ });
147
+ }
148
+ const requireMatch = trimmed.match(
149
+ /(?:const|let|var)\s+(.+?)\s*=\s*require\(['"]([^'"]+)['"]\)/,
150
+ );
151
+ if (requireMatch) {
152
+ imports.push({
153
+ source: requireMatch[2],
154
+ specifiers: requireMatch[1].trim(),
155
+ line: idx + 1,
156
+ });
157
+ }
158
+
159
+ // Exports
160
+ const exportFunc = trimmed.match(
161
+ /^export\s+(?:default\s+)?(?:async\s+)?function\s+(\w+)\s*(\(.*?\))/,
162
+ );
163
+ if (exportFunc) {
164
+ exports.push({
165
+ kind: 'function',
166
+ name: exportFunc[1],
167
+ signature: `function ${exportFunc[1]}${exportFunc[2]}`,
168
+ line: idx + 1,
169
+ });
170
+ }
171
+
172
+ const exportConst = trimmed.match(
173
+ /^export\s+const\s+(\w+)(?:\s*:\s*([^=]+))?\s*=\s*(?:async\s+)?(?:\((.*?)\)|(\w+))\s*=>/,
174
+ );
175
+ if (exportConst) {
176
+ exports.push({
177
+ kind: 'arrow_function',
178
+ name: exportConst[1],
179
+ signature: `const ${exportConst[1]}: (${exportConst[3] || exportConst[4] || ''}) => ...`,
180
+ line: idx + 1,
181
+ });
182
+ }
183
+
184
+ const exportClass = trimmed.match(
185
+ /^export\s+(?:default\s+)?class\s+(\w+)(?:\s+extends\s+(\w+))?/,
186
+ );
187
+ if (exportClass) {
188
+ exports.push({
189
+ kind: 'class',
190
+ name: exportClass[1],
191
+ signature: `class ${exportClass[1]}${exportClass[2] ? ' extends ' + exportClass[2] : ''}`,
192
+ line: idx + 1,
193
+ });
194
+ }
195
+
196
+ // Types & Interfaces
197
+ const exportType = trimmed.match(/^export\s+type\s+(\w+)(?:<.*?>)?\s*=/);
198
+ if (exportType) {
199
+ types.push({
200
+ kind: 'type',
201
+ name: exportType[1],
202
+ signature: trimmed.replace(/;?$/, ''),
203
+ line: idx + 1,
204
+ });
205
+ }
206
+
207
+ const exportInterface = trimmed.match(
208
+ /^export\s+interface\s+(\w+)(?:<.*?>)?(?:\s+extends\s+.*?)?\s*\{?/,
209
+ );
210
+ if (exportInterface) {
211
+ types.push({
212
+ kind: 'interface',
213
+ name: exportInterface[1],
214
+ signature: trimmed.replace(/\{?$/, '').trim(),
215
+ line: idx + 1,
216
+ });
217
+ }
218
+ });
219
+ } else if (ext === '.rs') {
220
+ lines.forEach((line, idx) => {
221
+ const trimmed = line.trim();
222
+
223
+ // Use statements
224
+ const useMatch = trimmed.match(/^(?:pub\s+)?use\s+([^;]+);/);
225
+ if (useMatch) {
226
+ imports.push({
227
+ source: useMatch[1].trim(),
228
+ specifiers: useMatch[1].trim(),
229
+ line: idx + 1,
230
+ });
231
+ }
232
+
233
+ // Public Functions
234
+ const pubFn = trimmed.match(
235
+ /^pub(?:\(.*?\))?\s+(?:async\s+)?fn\s+(\w+)(?:<.*?>)?\s*(\(.*?\))(?:\s*->\s*([^{;]+))?/,
236
+ );
237
+ if (pubFn) {
238
+ exports.push({
239
+ kind: 'function',
240
+ name: pubFn[1],
241
+ signature: `pub fn ${pubFn[1]}${pubFn[2]}${pubFn[3] ? ' -> ' + pubFn[3].trim() : ''}`,
242
+ line: idx + 1,
243
+ });
244
+ }
245
+
246
+ // Structs & Enums
247
+ const pubStruct = trimmed.match(/^pub(?:\(.*?\))?\s+struct\s+(\w+)/);
248
+ if (pubStruct) {
249
+ types.push({
250
+ kind: 'struct',
251
+ name: pubStruct[1],
252
+ signature: `pub struct ${pubStruct[1]}`,
253
+ line: idx + 1,
254
+ });
255
+ }
256
+
257
+ const pubEnum = trimmed.match(/^pub(?:\(.*?\))?\s+enum\s+(\w+)/);
258
+ if (pubEnum) {
259
+ types.push({
260
+ kind: 'enum',
261
+ name: pubEnum[1],
262
+ signature: `pub enum ${pubEnum[1]}`,
263
+ line: idx + 1,
264
+ });
265
+ }
266
+
267
+ const pubTrait = trimmed.match(/^pub(?:\(.*?\))?\s+trait\s+(\w+)/);
268
+ if (pubTrait) {
269
+ types.push({
270
+ kind: 'trait',
271
+ name: pubTrait[1],
272
+ signature: `pub trait ${pubTrait[1]}`,
273
+ line: idx + 1,
274
+ });
275
+ }
276
+ });
277
+ } else if (ext === '.py') {
278
+ lines.forEach((line, idx) => {
279
+ const trimmed = line.trim();
280
+
281
+ const importMatch = trimmed.match(/^(?:from\s+([\w.]+)\s+)?import\s+(.+)$/);
282
+ if (importMatch) {
283
+ imports.push({
284
+ source: importMatch[1] || importMatch[2],
285
+ specifiers: importMatch[2],
286
+ line: idx + 1,
287
+ });
288
+ }
289
+
290
+ const defMatch = trimmed.match(
291
+ /^(?:async\s+)?def\s+([a-zA-Z_]\w*)\s*(\(.*?\))(?:\s*->\s*([^:]+))?:/,
292
+ );
293
+ if (defMatch && !defMatch[1].startsWith('_')) {
294
+ exports.push({
295
+ kind: 'function',
296
+ name: defMatch[1],
297
+ signature: `def ${defMatch[1]}${defMatch[2]}${defMatch[3] ? ' -> ' + defMatch[3].trim() : ''}`,
298
+ line: idx + 1,
299
+ });
300
+ }
301
+
302
+ const classMatch = trimmed.match(/^class\s+([a-zA-Z_]\w*)(?:\((.*?)\))?:/);
303
+ if (classMatch && !classMatch[1].startsWith('_')) {
304
+ types.push({
305
+ kind: 'class',
306
+ name: classMatch[1],
307
+ signature: `class ${classMatch[1]}${classMatch[2] ? '(' + classMatch[2] + ')' : ''}`,
308
+ line: idx + 1,
309
+ });
310
+ }
311
+ });
312
+ }
313
+
314
+ const allSignatures = exports.concat(types);
315
+ const interfaceHash = computeInterfaceHash(allSignatures);
316
+
317
+ return {
318
+ imports,
319
+ exports,
320
+ types,
321
+ landmines,
322
+ interfaceHash,
323
+ };
324
+ }
325
+
326
+ // ── Inbound Callers Discovery ───────────────────────────────────────────────
327
+
328
+ function findInboundCallers(targetFilePath, exportNames, workspaceRoot = process.cwd()) {
329
+ const callers = [];
330
+ const baseName = path.basename(targetFilePath);
331
+ const stem = baseName.replace(/\.[^.]+$/, '');
332
+ const relativeTarget = path.relative(workspaceRoot, targetFilePath).replace(/\\/g, '/');
333
+
334
+ // Search tokens: module stem and exported symbol names
335
+ const searchTokens = new Set([stem]);
336
+ exportNames.slice(0, 8).forEach(n => searchTokens.add(n));
337
+
338
+ // Try using git grep or ripgrep if available
339
+ const grepOutputs = [];
340
+ try {
341
+ for (const token of searchTokens) {
342
+ if (!token || token.length < 3) continue;
343
+ try {
344
+ const cmd = `git grep -n -I "${token}" -- ":!docs/" ":!node_modules/" ":!dist/" ":!target/" ":!*.lock"`;
345
+ const res = execSync(cmd, {
346
+ cwd: workspaceRoot,
347
+ stdio: ['ignore', 'pipe', 'ignore'],
348
+ encoding: 'utf8',
349
+ });
350
+ if (res) grepOutputs.push(...res.split('\n').filter(Boolean));
351
+ } catch {
352
+ // Ripgrep fallback
353
+ try {
354
+ const cmd = `rg -n --no-heading --color=never "${token}" -g "!docs/**" -g "!node_modules/**" -g "!target/**" -g "!dist/**"`;
355
+ const res = execSync(cmd, {
356
+ cwd: workspaceRoot,
357
+ stdio: ['ignore', 'pipe', 'ignore'],
358
+ encoding: 'utf8',
359
+ });
360
+ if (res) grepOutputs.push(...res.split('\n').filter(Boolean));
361
+ } catch {
362
+ // Silent catch
363
+ }
364
+ }
365
+ }
366
+ } catch {
367
+ // Grep unavailable
368
+ }
369
+
370
+ const seenSites = new Set();
371
+
372
+ for (const line of grepOutputs) {
373
+ const parts = line.split(':');
374
+ if (parts.length < 3) continue;
375
+ const callerFile = parts[0].replace(/\\/g, '/');
376
+ const lineNum = parseInt(parts[1], 10);
377
+ const lineContent = parts.slice(2).join(':').trim();
378
+
379
+ // Ignore self-references and context docs
380
+ if (
381
+ callerFile === relativeTarget ||
382
+ callerFile.includes('.context.md') ||
383
+ callerFile.includes('INDEX.md')
384
+ ) {
385
+ continue;
386
+ }
387
+
388
+ const key = `${callerFile}:${lineNum}`;
389
+ if (seenSites.has(key)) continue;
390
+ seenSites.add(key);
391
+
392
+ callers.push({
393
+ file: callerFile,
394
+ line: lineNum,
395
+ snippet: lineContent.substring(0, 100),
396
+ isDirectImport:
397
+ lineContent.includes('import') ||
398
+ lineContent.includes('require') ||
399
+ lineContent.includes('use '),
400
+ });
401
+
402
+ if (callers.length >= 12) break; // Cap callers for token efficiency
403
+ }
404
+
405
+ return callers;
406
+ }
407
+
408
+ // ── Test & Skill Discovery ──────────────────────────────────────────────────
409
+
410
+ function discoverTests(targetFilePath, workspaceRoot = process.cwd()) {
411
+ const tests = [];
412
+ const baseName = path.basename(targetFilePath);
413
+ const stem = baseName.replace(/\.[^.]+$/, '');
414
+
415
+ const testPatterns = [`${stem}.test.`, `${stem}.spec.`, `${stem}_test.`, `test_${stem}.`];
416
+
417
+ function walk(dir) {
418
+ if (!fs.existsSync(dir)) return;
419
+ try {
420
+ const entries = fs.readdirSync(dir, { withFileTypes: true });
421
+ for (const entry of entries) {
422
+ if (
423
+ entry.name === 'node_modules' ||
424
+ entry.name === 'target' ||
425
+ entry.name === '.git' ||
426
+ entry.name === 'dist'
427
+ ) {
428
+ continue;
429
+ }
430
+ const full = path.join(dir, entry.name);
431
+ if (entry.isDirectory()) {
432
+ // Only walk tests dirs or immediate directories
433
+ if (
434
+ entry.name === 'tests' ||
435
+ entry.name === '__tests__' ||
436
+ entry.name === 'test' ||
437
+ entry.name === 'crates'
438
+ ) {
439
+ walk(full);
440
+ }
441
+ } else if (entry.isFile()) {
442
+ for (const pat of testPatterns) {
443
+ if (entry.name.includes(pat)) {
444
+ tests.push(path.relative(workspaceRoot, full).replace(/\\/g, '/'));
445
+ break;
446
+ }
447
+ }
448
+ }
449
+ }
450
+ } catch {
451
+ // Ignore read errors
452
+ }
453
+ }
454
+
455
+ walk(workspaceRoot);
456
+ return Array.from(new Set(tests)).slice(0, 5);
457
+ }
458
+
459
+ function resolveSkills(targetFilePath, content) {
460
+ const skills = [];
461
+ const ext = path.extname(targetFilePath).toLowerCase();
462
+ const lowerContent = content.toLowerCase();
463
+
464
+ if (ext === '.rs') skills.push('rust-pro');
465
+ if (ext === '.py') skills.push('python-pro');
466
+ if (ext === '.ts' || ext === '.tsx' || ext === '.js') {
467
+ if (lowerContent.includes('react') || ext.endsWith('x')) skills.push('react-specialist');
468
+ else skills.push('clean-code');
469
+ }
470
+
471
+ if (
472
+ lowerContent.includes('auth') ||
473
+ lowerContent.includes('jwt') ||
474
+ lowerContent.includes('token') ||
475
+ lowerContent.includes('crypto')
476
+ ) {
477
+ skills.push('backend-security-expert');
478
+ }
479
+ if (
480
+ lowerContent.includes('query') ||
481
+ lowerContent.includes('prisma') ||
482
+ lowerContent.includes('sql') ||
483
+ lowerContent.includes('database')
484
+ ) {
485
+ skills.push('database-architect');
486
+ }
487
+ if (
488
+ lowerContent.includes('compress') ||
489
+ lowerContent.includes('tokens') ||
490
+ lowerContent.includes('prompt')
491
+ ) {
492
+ skills.push('context-engineering-pro');
493
+ }
494
+
495
+ skills.push('fabel-protocol');
496
+ return Array.from(new Set(skills));
497
+ }
498
+
499
+ function resolvePath(targetPath, workspaceRoot = process.cwd()) {
500
+ const clean = targetPath.replace(/^['"]|['"]$/g, '');
501
+ if (path.isAbsolute(clean) && fs.existsSync(clean)) return clean;
502
+
503
+ const direct = path.resolve(workspaceRoot, clean);
504
+ if (fs.existsSync(direct)) return direct;
505
+
506
+ if (clean.startsWith('tribunal-kit/') || clean.startsWith('tribunal-kit\\')) {
507
+ const stripped = clean.replace(/^tribunal-kit[/\\]/, '');
508
+ const strippedPath = path.resolve(workspaceRoot, stripped);
509
+ if (fs.existsSync(strippedPath)) return strippedPath;
510
+ }
511
+
512
+ const parentPath = path.resolve(workspaceRoot, '..', clean);
513
+ if (fs.existsSync(parentPath)) return parentPath;
514
+
515
+ return direct;
516
+ }
517
+
518
+ function getDocsDir(workspaceRoot = process.cwd()) {
519
+ const local = path.join(workspaceRoot, 'docs', 'context');
520
+ if (fs.existsSync(local)) {
521
+ try {
522
+ const files = fs
523
+ .readdirSync(local)
524
+ .filter(f => f.endsWith('.context.md') || f.endsWith('.bridge.md'));
525
+ if (files.length > 0) return local;
526
+ } catch {
527
+ // fallback
528
+ }
529
+ }
530
+ const parent = path.join(workspaceRoot, '..', 'docs', 'context');
531
+ if (fs.existsSync(parent)) {
532
+ try {
533
+ const files = fs
534
+ .readdirSync(parent)
535
+ .filter(f => f.endsWith('.context.md') || f.endsWith('.bridge.md'));
536
+ if (files.length > 0) return parent;
537
+ } catch {
538
+ // fallback
539
+ }
540
+ }
541
+ return local;
542
+ }
543
+
544
+ // ── Single-File Context Analysis ────────────────────────────────────────────
545
+
546
+ function analyzeSingleFile(targetPath, workspaceRoot = process.cwd()) {
547
+ const absPath = resolvePath(targetPath, workspaceRoot);
548
+ if (!fs.existsSync(absPath)) {
549
+ throw new Error(`File not found: ${absPath}`);
550
+ }
551
+
552
+ const rawContent = fs.readFileSync(absPath, 'utf8');
553
+ const relativePath = path.relative(workspaceRoot, absPath).replace(/\\/g, '/');
554
+ const sourceHash = computeSha256(rawContent);
555
+ const skeleton = extractFileSkeleton(relativePath, rawContent);
556
+ const exportNames = skeleton.exports.map(e => e.name).concat(skeleton.types.map(t => t.name));
557
+ const callers = findInboundCallers(absPath, exportNames, workspaceRoot);
558
+ const tests = discoverTests(absPath, workspaceRoot);
559
+ const skills = resolveSkills(relativePath, rawContent);
560
+
561
+ // Determine domain layer
562
+ let domainLayer = 'Core Logic / Utility';
563
+ if (relativePath.includes('api') || relativePath.includes('route'))
564
+ domainLayer = 'API / Gateway Layer';
565
+ else if (relativePath.includes('service')) domainLayer = 'Service / Business Logic';
566
+ else if (
567
+ relativePath.includes('model') ||
568
+ relativePath.includes('schema') ||
569
+ relativePath.includes('db')
570
+ )
571
+ domainLayer = 'Data / Persistence Layer';
572
+ else if (relativePath.includes('components') || relativePath.includes('ui'))
573
+ domainLayer = 'UI / Presentation Layer';
574
+ else if (relativePath.includes('commands')) domainLayer = 'Command / Dispatch Layer';
575
+
576
+ return {
577
+ mode: 'single_file',
578
+ filePath: relativePath,
579
+ sourceHash,
580
+ interfaceHash: skeleton.interfaceHash,
581
+ domainLayer,
582
+ imports: skeleton.imports,
583
+ exports: skeleton.exports,
584
+ types: skeleton.types,
585
+ landmines: skeleton.landmines,
586
+ callers,
587
+ tests,
588
+ skills,
589
+ lineCount: rawContent.split('\n').length,
590
+ byteSize: Buffer.byteLength(rawContent, 'utf8'),
591
+ };
592
+ }
593
+
594
+ // ── Multi-File Interface Bridge Analysis ────────────────────────────────────
595
+
596
+ function analyzeMultiFileBridge(pathA, pathB, workspaceRoot = process.cwd()) {
597
+ const metaA = analyzeSingleFile(pathA, workspaceRoot);
598
+ const metaB = analyzeSingleFile(pathB, workspaceRoot);
599
+
600
+ const aImportsB = metaA.imports.some(imp =>
601
+ imp.source.includes(path.basename(metaB.filePath).replace(/\.[^.]+$/, '')),
602
+ );
603
+ const bImportsA = metaB.imports.some(imp =>
604
+ imp.source.includes(path.basename(metaA.filePath).replace(/\.[^.]+$/, '')),
605
+ );
606
+
607
+ const sharedTypes = [];
608
+ const typeNamesA = new Set(metaA.types.map(t => t.name));
609
+ for (const t of metaB.types) {
610
+ if (typeNamesA.has(t.name)) sharedTypes.push(t.name);
611
+ }
612
+
613
+ return {
614
+ mode: 'multi_file_bridge',
615
+ fileA: metaA,
616
+ fileB: metaB,
617
+ coupling: {
618
+ aImportsB,
619
+ bImportsA,
620
+ sharedTypes,
621
+ relationship:
622
+ aImportsB && bImportsA
623
+ ? 'Bidirectional Coupling'
624
+ : aImportsB
625
+ ? 'A depends on B'
626
+ : bImportsA
627
+ ? 'B depends on A'
628
+ : 'Sibling / Peer Modules',
629
+ },
630
+ };
631
+ }
632
+
633
+ // ── Directory / Project Subsystem Analysis ──────────────────────────────────
634
+
635
+ function analyzeDirectory(dirPath, workspaceRoot = process.cwd()) {
636
+ const absDir = path.isAbsolute(dirPath) ? dirPath : path.resolve(workspaceRoot, dirPath);
637
+ if (!fs.existsSync(absDir) || !fs.statSync(absDir).isDirectory()) {
638
+ throw new Error(`Directory not found: ${absDir}`);
639
+ }
640
+
641
+ const relativeDir = path.relative(workspaceRoot, absDir).replace(/\\/g, '/') || '.';
642
+ const manifests = [];
643
+ const subsystems = [];
644
+ let totalFiles = 0;
645
+ const langCounts = {};
646
+
647
+ const ignoreSet = new Set([
648
+ 'node_modules',
649
+ 'target',
650
+ '.git',
651
+ 'dist',
652
+ 'coverage',
653
+ '.gemini',
654
+ 'build',
655
+ ]);
656
+
657
+ // Check top-level manifests
658
+ if (fs.existsSync(path.join(absDir, 'package.json'))) manifests.push('package.json');
659
+ if (fs.existsSync(path.join(absDir, 'Cargo.toml'))) manifests.push('Cargo.toml');
660
+ if (fs.existsSync(path.join(absDir, 'pyproject.toml'))) manifests.push('pyproject.toml');
661
+
662
+ const entries = fs.readdirSync(absDir, { withFileTypes: true });
663
+
664
+ for (const entry of entries) {
665
+ if (ignoreSet.has(entry.name) || entry.name.startsWith('.')) continue;
666
+ const subFull = path.join(absDir, entry.name);
667
+ if (entry.isDirectory()) {
668
+ try {
669
+ const subFiles = fs.readdirSync(subFull);
670
+ subsystems.push({
671
+ name: entry.name,
672
+ fileCount: subFiles.length,
673
+ keySample: subFiles.slice(0, 3).join(', '),
674
+ });
675
+ } catch {
676
+ // Ignore unreadable
677
+ }
678
+ } else if (entry.isFile()) {
679
+ totalFiles++;
680
+ const ext = path.extname(entry.name).toLowerCase() || 'other';
681
+ langCounts[ext] = (langCounts[ext] || 0) + 1;
682
+ }
683
+ }
684
+
685
+ return {
686
+ mode: 'directory_subsystem',
687
+ dirPath: relativeDir,
688
+ manifests,
689
+ subsystems,
690
+ directFiles: totalFiles,
691
+ langCounts,
692
+ };
693
+ }
694
+
695
+ // ── Markdown Dossier Generators ─────────────────────────────────────────────
696
+
697
+ function renderSingleFileDossier(data) {
698
+ const callersTable =
699
+ data.callers.length > 0
700
+ ? data.callers
701
+ .map(
702
+ c =>
703
+ `| \`${c.file}:${c.line}\` | \`${c.snippet}\` | ${c.isDirectImport ? 'Direct Import' : 'Symbol Reference'} |`,
704
+ )
705
+ .join('\n')
706
+ : '| *None detected (potential root entrypoint or test)* | - | - |';
707
+
708
+ const typesTable =
709
+ data.exports.concat(data.types).length > 0
710
+ ? data.exports
711
+ .concat(data.types)
712
+ .slice(0, 10)
713
+ .map(s => `| \`${s.name}\` | \`${s.kind}\` | \`${s.signature}\` | Line ${s.line} |`)
714
+ .join('\n')
715
+ : '| *No explicit exported symbols detected* | - | - | - |';
716
+
717
+ const landminesContent =
718
+ data.landmines.length > 0
719
+ ? data.landmines.map(l => `> [!CAUTION]\n> **Line ${l.line}:** \`${l.content}\``).join('\n\n')
720
+ : '> [!NOTE]\n> No explicit defensive comments (`// VERIFY`, `// NOTE`, `// HACK`) found in source code.';
721
+
722
+ const testCommand = data.tests.length > 0 ? `npm test -- ${data.tests[0]}` : `npm test`;
723
+
724
+ return `---
725
+ version: 2.0.0
726
+ source_file: "${data.filePath}"
727
+ source_hash: "${data.sourceHash}"
728
+ interface_hash: "${data.interfaceHash}"
729
+ last_synced: "${new Date().toISOString().split('T')[0]}"
730
+ domain_layer: "${data.domainLayer}"
731
+ associated_skills:
732
+ ${data.skills.map(s => ` - ${s}`).join('\n')}
733
+ associated_tests:
734
+ ${data.tests.length > 0 ? data.tests.map(t => ` - ${t}`).join('\n') : ' - none'}
735
+ ---
736
+
737
+ <!-- AI_QUICK_INJECT_START -->
738
+ > [!TIP]
739
+ > **AI Prompt Injection Card (Copy into future prompts touching this file):**
740
+ > \`\`\`yaml
741
+ > Target: ${data.filePath} (${data.domainLayer})
742
+ > Role: Core logic for ${path.basename(data.filePath)}.
743
+ > Exports: [${data.exports
744
+ .map(e => e.name)
745
+ .slice(0, 6)
746
+ .join(', ')}]
747
+ > Inbound Callers: ${data.callers.length} active consumer sites.
748
+ > Invariant Check: Verify test passing before merge: ${testCommand}
749
+ > \`\`\`
750
+ <!-- AI_QUICK_INJECT_END -->
751
+
752
+ # 🧭 FILE DOSSIER: \`${path.basename(data.filePath)}\`
753
+ \`${data.filePath}\` • **${data.domainLayer}** • **Hash:** \`${data.sourceHash}\`
754
+
755
+ | Freshness | Blast Radius | Exports Count | Test Coverage | Primary Callers |
756
+ | :--- | :--- | :--- | :--- | :--- |
757
+ | 🟢 **Fresh** (\`${data.sourceHash}\`) | **${data.callers.length} Callers** | **${data.exports.length} Symbols** | ${data.tests.length > 0 ? '✅ Linked (' + data.tests.length + ' files)' : '⚠️ Unlinked'} | \`${data.callers[0] ? data.callers[0].file : 'Entrypoint'}\` |
758
+
759
+ ---
760
+
761
+ ## ⚡ 30-Second Mental Model
762
+ > **Mission:** Implements ${data.domainLayer.toLowerCase()} responsibilities for \`${data.filePath}\`, exposing verified interfaces to callers while adhering to Tribunal safety standards.
763
+
764
+ ---
765
+
766
+ ## 📋 Public API & Type Contract Matrix
767
+
768
+ | Symbol | Kind | Signature | Location |
769
+ | :--- | :--- | :--- | :--- |
770
+ ${typesTable}
771
+
772
+ ---
773
+
774
+ ## 🔗 Blast Radius & Call Topology
775
+
776
+ \`\`\`mermaid
777
+ graph LR
778
+ classDef target fill:#1e293b,stroke:#3b82f6,stroke-width:2px,color:#fff;
779
+ classDef ext fill:#0f172a,stroke:#64748b,stroke-width:1px,color:#94a3b8;
780
+
781
+ subgraph Inbound Callers
782
+ ${
783
+ data.callers
784
+ .slice(0, 4)
785
+ .map((c, i) => ` C${i}["${c.file}"]:::ext`)
786
+ .join('\n') || ' C0["Entrypoint / CLI"]:::ext'
787
+ }
788
+ end
789
+
790
+ T["${path.basename(data.filePath)}"]:::target
791
+
792
+ subgraph Dependencies
793
+ ${
794
+ data.imports
795
+ .slice(0, 4)
796
+ .map((imp, i) => ` D${i}["${imp.source}"]:::ext`)
797
+ .join('\n') || ' D0["Stdlib"]:::ext'
798
+ }
799
+ end
800
+
801
+ ${
802
+ data.callers
803
+ .slice(0, 4)
804
+ .map((_, i) => ` C${i} --> T`)
805
+ .join('\n') || ' C0 --> T'
806
+ }
807
+ ${
808
+ data.imports
809
+ .slice(0, 4)
810
+ .map((_, i) => ` T --> D${i}`)
811
+ .join('\n') || ' T --> D0'
812
+ }
813
+ \`\`\`
814
+
815
+ ### Inbound Consumer Sites
816
+ | Caller File | Line Snippet | Vector |
817
+ | :--- | :--- | :--- |
818
+ ${callersTable}
819
+
820
+ ---
821
+
822
+ ## ⚠️ Chesterton's Fences & Non-Obvious Quirks
823
+
824
+ ${landminesContent}
825
+
826
+ ---
827
+
828
+ ## 🧪 Verification & Test Harness
829
+
830
+ \`\`\`bash
831
+ # Run isolated tests for this module:
832
+ ${testCommand}
833
+ \`\`\`
834
+ `;
835
+ }
836
+
837
+ function renderBridgeDossier(data) {
838
+ return `---
839
+ version: 2.0.0
840
+ bridge: "${data.fileA.filePath} <--> ${data.fileB.filePath}"
841
+ relationship: "${data.coupling.relationship}"
842
+ last_synced: "${new Date().toISOString().split('T')[0]}"
843
+ ---
844
+
845
+ # 🌉 INTERFACE BRIDGE DOSSIER
846
+ **Module A:** \`${data.fileA.filePath}\`
847
+ **Module B:** \`${data.fileB.filePath}\`
848
+ **Coupling Relationship:** \`${data.coupling.relationship}\`
849
+
850
+ ---
851
+
852
+ ## 🗺️ Cross-Boundary Topology
853
+
854
+ \`\`\`mermaid
855
+ graph LR
856
+ A["${path.basename(data.fileA.filePath)}"]
857
+ B["${path.basename(data.fileB.filePath)}"]
858
+
859
+ ${data.coupling.aImportsB ? 'A -->|"Imports & Calls"| B' : ''}
860
+ ${data.coupling.bImportsA ? 'B -->|"Imports & Calls"| A' : ''}
861
+ ${!data.coupling.aImportsB && !data.coupling.bImportsA ? 'A -.->|"Sibling / Parallel"| B' : ''}
862
+ \`\`\`
863
+
864
+ ## 📦 Shared Types & Interfaces
865
+ ${
866
+ data.coupling.sharedTypes.length > 0
867
+ ? data.coupling.sharedTypes.map(t => `- \`${t}\``).join('\n')
868
+ : '- *No identical type names detected between modules.*'
869
+ }
870
+
871
+ ## 📋 Interface Alignment Summary
872
+ - **${path.basename(data.fileA.filePath)} Exports:** ${data.fileA.exports.length} symbols.
873
+ - **${path.basename(data.fileB.filePath)} Exports:** ${data.fileB.exports.length} symbols.
874
+ `;
875
+ }
876
+
877
+ function renderDirectoryDossier(data) {
878
+ return `---
879
+ version: 2.0.0
880
+ target_dir: "${data.dirPath}"
881
+ manifests: [${data.manifests.join(', ')}]
882
+ last_synced: "${new Date().toISOString().split('T')[0]}"
883
+ ---
884
+
885
+ <!-- PROJECT_AI_ONBOARDING_CARD -->
886
+ Project Subsystem: ${data.dirPath}
887
+ Manifests: ${data.manifests.join(', ') || 'None'}
888
+ Subsystems: ${data.subsystems.map(s => s.name).join(', ')}
889
+ <!-- /PROJECT_AI_ONBOARDING_CARD -->
890
+
891
+ # 🏛️ SUBSYSTEM DOSSIER: \`${data.dirPath}\`
892
+
893
+ ## 🗺️ Subsystem Architecture Clusters
894
+ \`\`\`mermaid
895
+ graph TD
896
+ ${data.subsystems.map(s => ` S_${s.name}["${s.name} (${s.fileCount} files)"]`).join('\n')}
897
+ \`\`\`
898
+
899
+ ## 📂 Subsystem Breakdown
900
+ | Subsystem Folder | File Count | Samples |
901
+ | :--- | :--- | :--- |
902
+ ${data.subsystems.map(s => `| \`${s.name}/\` | ${s.fileCount} | \`${s.keySample}\` |`).join('\n')}
903
+ `;
904
+ }
905
+
906
+ // ── Living Vault Manager ───────────────────────────────────────────────────
907
+
908
+ function syncVaultIndex(workspaceRoot = process.cwd()) {
909
+ const docsDir = getDocsDir(workspaceRoot);
910
+ const indexFile = path.join(docsDir, 'INDEX.md');
911
+
912
+ if (!fs.existsSync(docsDir)) {
913
+ fs.mkdirSync(docsDir, { recursive: true });
914
+ }
915
+
916
+ const files = fs
917
+ .readdirSync(docsDir)
918
+ .filter(f => f.endsWith('.context.md') || f.endsWith('.bridge.md'));
919
+
920
+ const rows = [];
921
+ for (const f of files) {
922
+ const content = fs.readFileSync(path.join(docsDir, f), 'utf8');
923
+ const sourceMatch = content.match(/source_file:\s*["']?([^"'\n]+)/);
924
+ const bridgeMatch = content.match(/bridge:\s*["']?([^"'\n]+)/);
925
+ const dirMatch = content.match(/target_dir:\s*["']?([^"'\n]+)/);
926
+ const hashMatch = content.match(/source_hash:\s*["']?([^"'\n]+)/);
927
+ const domainMatch = content.match(/domain_layer:\s*["']?([^"'\n]+)/);
928
+
929
+ let source = f;
930
+ let domain = 'General';
931
+ const hash = hashMatch ? hashMatch[1] : 'n/a';
932
+ let status = '🟢 Fresh';
933
+
934
+ if (sourceMatch) {
935
+ source = sourceMatch[1].replace(/["']/g, '');
936
+ domain = domainMatch ? domainMatch[1].replace(/["']/g, '') : 'Single Module';
937
+ const absSource = resolvePath(source, workspaceRoot);
938
+ if (fs.existsSync(absSource)) {
939
+ const curHash = computeSha256(fs.readFileSync(absSource, 'utf8'));
940
+ if (curHash !== hash) {
941
+ status = '🔴 Stale';
942
+ }
943
+ } else {
944
+ status = '⚪ Missing';
945
+ }
946
+ } else if (bridgeMatch) {
947
+ source = bridgeMatch[1].replace(/["']/g, '');
948
+ domain = 'Interface Bridge';
949
+ status = '🟢 Linked';
950
+ } else if (dirMatch) {
951
+ source = dirMatch[1].replace(/["']/g, '');
952
+ domain = 'Subsystem Cluster';
953
+ const absDir = resolvePath(source, workspaceRoot);
954
+ status = fs.existsSync(absDir) ? '🟢 Active' : '⚪ Missing';
955
+ }
956
+
957
+ rows.push(`| [\`${source}\`](${f}) | ${domain} | \`${hash}\` | ${status} |`);
958
+ }
959
+
960
+ const indexContent = `# 📚 Codebase Context Vault Registry
961
+ > Living architectural catalog generated and verified by \`/context\`.
962
+
963
+ | Source Target | Domain Layer | Hash Snapshot | Status |
964
+ | :--- | :--- | :--- | :--- |
965
+ ${rows.join('\n') || '| *No context dossiers generated yet. Run `/context <file>` to begin.* | - | - | - |'}
966
+
967
+ ---
968
+ *Run \`node scripts/context_compiler.js --check\` to audit context freshness across all files.*
969
+ `;
970
+
971
+ fs.writeFileSync(indexFile, indexContent, 'utf8');
972
+ return { indexedCount: files.length, indexFile };
973
+ }
974
+
975
+ function checkDrift(workspaceRoot = process.cwd()) {
976
+ const syncRes = syncVaultIndex(workspaceRoot);
977
+ const content = fs.readFileSync(syncRes.indexFile, 'utf8');
978
+ const staleCount = (content.match(/🔴 Stale/g) || []).length;
979
+ const freshCount = (content.match(/🟢 Fresh/g) || []).length;
980
+
981
+ return {
982
+ total: syncRes.indexedCount,
983
+ fresh: freshCount,
984
+ stale: staleCount,
985
+ isHealthy: staleCount === 0,
986
+ };
987
+ }
988
+
989
+ // ── CLI Dispatcher ─────────────────────────────────────────────────────────
990
+
991
+ function main() {
992
+ const args = process.argv.slice(2);
993
+ const workspaceRoot = process.cwd();
994
+
995
+ if (args.includes('--check')) {
996
+ const drift = checkDrift(workspaceRoot);
997
+ if (args.includes('--json')) {
998
+ console.log(JSON.stringify(drift));
999
+ process.exit(0);
1000
+ }
1001
+ console.log(`\n${C.BOLD}═══ Context Vault Drift Audit ═══${C.RESET}`);
1002
+ console.log(`Total Dossiers: ${drift.total}`);
1003
+ console.log(`🟢 Fresh: ${drift.fresh}`);
1004
+ console.log(`🔴 Stale: ${drift.stale}`);
1005
+ console.log(
1006
+ `Status: ${drift.isHealthy ? C.GREEN + 'HEALTHY' : C.RED + 'DRIFT DETECTED'}${C.RESET}\n`,
1007
+ );
1008
+ process.exit(drift.isHealthy ? 0 : 1);
1009
+ }
1010
+
1011
+ let fileArg = null;
1012
+ let dirArg = null;
1013
+ let multiArgs = [];
1014
+ const writeFlag = args.includes('--write');
1015
+ const jsonFlag = args.includes('--json');
1016
+
1017
+ for (let i = 0; i < args.length; i++) {
1018
+ if (args[i] === '--file' && args[i + 1]) {
1019
+ fileArg = args[++i];
1020
+ } else if (args[i] === '--dir' && args[i + 1]) {
1021
+ dirArg = args[++i];
1022
+ } else if (args[i] === '--multi' && args[i + 1] && args[i + 2]) {
1023
+ multiArgs = [args[++i], args[++i]];
1024
+ } else if (!args[i].startsWith('--')) {
1025
+ if (!fileArg && !dirArg) {
1026
+ // Autodetect positional arg
1027
+ const candidate = args[i].replace(/^['"]|['"]$/g, '');
1028
+ if (fs.existsSync(candidate)) {
1029
+ if (fs.statSync(candidate).isDirectory()) {
1030
+ dirArg = candidate;
1031
+ } else {
1032
+ fileArg = candidate;
1033
+ }
1034
+ }
1035
+ }
1036
+ }
1037
+ }
1038
+
1039
+ if (multiArgs.length === 2) {
1040
+ const result = analyzeMultiFileBridge(multiArgs[0], multiArgs[1], workspaceRoot);
1041
+ if (jsonFlag) {
1042
+ console.log(JSON.stringify(result, null, 2));
1043
+ } else {
1044
+ const md = renderBridgeDossier(result);
1045
+ if (writeFlag) {
1046
+ const outName = `${path.basename(multiArgs[0]).replace(/\.[^.]+$/, '')}__${path.basename(multiArgs[1]).replace(/\.[^.]+$/, '')}.bridge.md`;
1047
+ const dest = path.join(workspaceRoot, 'docs', 'context', outName);
1048
+ fs.mkdirSync(path.dirname(dest), { recursive: true });
1049
+ fs.writeFileSync(dest, md, 'utf8');
1050
+ syncVaultIndex(workspaceRoot);
1051
+ console.log(`${C.GREEN}✔ Bridge Dossier written to ${dest}${C.RESET}`);
1052
+ } else {
1053
+ console.log(md);
1054
+ }
1055
+ }
1056
+ } else if (dirArg) {
1057
+ const result = analyzeDirectory(dirArg, workspaceRoot);
1058
+ if (jsonFlag) {
1059
+ console.log(JSON.stringify(result, null, 2));
1060
+ } else {
1061
+ const md = renderDirectoryDossier(result);
1062
+ if (writeFlag) {
1063
+ const outName = `${path.basename(dirArg)}.context.md`;
1064
+ const dest = path.join(workspaceRoot, 'docs', 'context', outName);
1065
+ fs.mkdirSync(path.dirname(dest), { recursive: true });
1066
+ fs.writeFileSync(dest, md, 'utf8');
1067
+ syncVaultIndex(workspaceRoot);
1068
+ console.log(`${C.GREEN}✔ Directory Dossier written to ${dest}${C.RESET}`);
1069
+ } else {
1070
+ console.log(md);
1071
+ }
1072
+ }
1073
+ } else if (fileArg) {
1074
+ const result = analyzeSingleFile(fileArg, workspaceRoot);
1075
+ if (jsonFlag) {
1076
+ console.log(JSON.stringify(result, null, 2));
1077
+ } else {
1078
+ const md = renderSingleFileDossier(result);
1079
+ if (writeFlag) {
1080
+ const outName = `${path.basename(fileArg).replace(/\.[^.]+$/, '')}.context.md`;
1081
+ const dest = path.join(workspaceRoot, 'docs', 'context', outName);
1082
+ fs.mkdirSync(path.dirname(dest), { recursive: true });
1083
+ fs.writeFileSync(dest, md, 'utf8');
1084
+ syncVaultIndex(workspaceRoot);
1085
+ console.log(`${C.GREEN}✔ Single-File Dossier written to ${dest}${C.RESET}`);
1086
+ } else {
1087
+ console.log(md);
1088
+ }
1089
+ }
1090
+ } else {
1091
+ console.error(
1092
+ `${C.RED}Error: Provide --file <path>, --dir <path>, --multi <fileA> <fileB>, or --check${C.RESET}`,
1093
+ );
1094
+ process.exit(1);
1095
+ }
1096
+ }
1097
+
1098
+ // Export functions for in-process MCP server use
1099
+ module.exports = {
1100
+ analyzeSingleFile,
1101
+ analyzeMultiFileBridge,
1102
+ analyzeDirectory,
1103
+ renderSingleFileDossier,
1104
+ renderBridgeDossier,
1105
+ renderDirectoryDossier,
1106
+ syncVaultIndex,
1107
+ checkDrift,
1108
+ };
1109
+
7
1110
  if (require.main === module) {
8
- require('../../scripts/context_compiler.js');
1111
+ main();
9
1112
  }