tribunal-kit 9.2.4 → 9.2.5

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 (1037) hide show
  1. package/.agent/.manifest.json +78 -78
  2. package/.agent/.shared/ui-ux-pro-max/README.md +4 -4
  3. package/.agent/.tribunal/session.jsonl +15 -15
  4. package/.agent/ADRs/ADR-001-system-architecture-intelligence.md +49 -0
  5. package/.agent/ARCHITECTURE.md +63 -63
  6. package/.agent/agents/accessibility-reviewer.md +109 -109
  7. package/.agent/agents/agent-shield-auditor.md +18 -18
  8. package/.agent/agents/ai-code-reviewer.md +223 -223
  9. package/.agent/agents/anti-pattern-reviewer.md +104 -104
  10. package/.agent/agents/api-architect.md +89 -89
  11. package/.agent/agents/architecture-auditor.md +195 -0
  12. package/.agent/agents/backend-specialist.md +242 -242
  13. package/.agent/agents/cloud-engineer.md +120 -120
  14. package/.agent/agents/code-archaeologist.md +186 -186
  15. package/.agent/agents/complexity-reviewer.md +76 -76
  16. package/.agent/agents/database-architect.md +206 -206
  17. package/.agent/agents/db-latency-auditor.md +237 -237
  18. package/.agent/agents/debugger.md +215 -215
  19. package/.agent/agents/dependency-reviewer.md +124 -124
  20. package/.agent/agents/devops-engineer.md +240 -240
  21. package/.agent/agents/documentation-writer.md +228 -228
  22. package/.agent/agents/explorer-agent.md +186 -186
  23. package/.agent/agents/frontend-reviewer.md +195 -195
  24. package/.agent/agents/frontend-specialist.md +122 -122
  25. package/.agent/agents/game-developer.md +68 -68
  26. package/.agent/agents/harness-manager.md +49 -49
  27. package/.agent/agents/human-gate-negotiator.md +22 -22
  28. package/.agent/agents/interaction-reviewer.md +123 -123
  29. package/.agent/agents/kernel-scheduler.md +56 -56
  30. package/.agent/agents/logic-reviewer.md +147 -147
  31. package/.agent/agents/memory-archivist.md +37 -37
  32. package/.agent/agents/minimalist-reviewer.md +104 -104
  33. package/.agent/agents/mobile-developer.md +216 -216
  34. package/.agent/agents/mobile-reviewer.md +180 -180
  35. package/.agent/agents/orchestrator.md +268 -268
  36. package/.agent/agents/penetration-tester.md +180 -180
  37. package/.agent/agents/performance-optimizer.md +202 -202
  38. package/.agent/agents/performance-reviewer.md +180 -180
  39. package/.agent/agents/pipeline-reviewer.md +144 -144
  40. package/.agent/agents/precedence-reviewer.md +266 -266
  41. package/.agent/agents/product-manager.md +167 -167
  42. package/.agent/agents/product-owner.md +103 -103
  43. package/.agent/agents/product-reviewer.md +103 -103
  44. package/.agent/agents/project-planner.md +181 -181
  45. package/.agent/agents/qa-automation-engineer.md +244 -244
  46. package/.agent/agents/resilience-reviewer.md +108 -108
  47. package/.agent/agents/schema-reviewer.md +87 -87
  48. package/.agent/agents/security-auditor.md +204 -204
  49. package/.agent/agents/seo-specialist.md +213 -213
  50. package/.agent/agents/sql-reviewer.md +180 -180
  51. package/.agent/agents/supervisor-agent.md +202 -202
  52. package/.agent/agents/swarm-worker-contracts.md +170 -170
  53. package/.agent/agents/swarm-worker-registry.md +99 -99
  54. package/.agent/agents/system-architect.md +260 -105
  55. package/.agent/agents/test-coverage-reviewer.md +181 -181
  56. package/.agent/agents/test-engineer.md +138 -138
  57. package/.agent/agents/throughput-optimizer.md +316 -316
  58. package/.agent/agents/type-safety-reviewer.md +202 -202
  59. package/.agent/agents/ui-ux-auditor.md +80 -80
  60. package/.agent/agents/ui-visual-auditor.md +102 -102
  61. package/.agent/agents/ux-reviewer.md +109 -109
  62. package/.agent/agents/visual-reviewer.md +103 -103
  63. package/.agent/agents/vitals-reviewer.md +245 -245
  64. package/.agent/config/claude.json +18 -18
  65. package/.agent/config/plugin.json +102 -102
  66. package/.agent/config/slash-commands.json +115 -115
  67. package/.agent/config/specialist-registry.json +415 -415
  68. package/.agent/config/system-prompt.md +258 -258
  69. package/.agent/history/arch-mapper-cache.json +6712 -0
  70. package/.agent/history/architecture.idx.json +5746 -0
  71. package/.agent/mcp_config.json +32 -32
  72. package/.agent/patterns/generator.md +11 -11
  73. package/.agent/patterns/inversion.md +14 -14
  74. package/.agent/patterns/pipeline.md +11 -11
  75. package/.agent/patterns/reviewer.md +15 -15
  76. package/.agent/patterns/tool-wrapper.md +11 -11
  77. package/.agent/plans/implementation_plan.md +48 -0
  78. package/.agent/plans/task.md +35 -0
  79. package/.agent/routing_index.json +2060 -2060
  80. package/.agent/rules/GEMINI.md +437 -437
  81. package/.agent/rules/GEMINI_PLANNER.md +82 -82
  82. package/.agent/rules/kernel.md +86 -86
  83. package/.agent/scripts/_colors.js +210 -210
  84. package/.agent/scripts/_utils.js +373 -377
  85. package/.agent/scripts/architecture_mapper.js +625 -0
  86. package/.agent/scripts/ast_context_loader.js +137 -137
  87. package/.agent/scripts/auto_preview.js +203 -203
  88. package/.agent/scripts/browser_audit.js +102 -102
  89. package/.agent/scripts/bundle_analyzer.js +287 -287
  90. package/.agent/scripts/case_law_manager.js +887 -887
  91. package/.agent/scripts/checklist.js +300 -300
  92. package/.agent/scripts/cicd_validator.js +305 -305
  93. package/.agent/scripts/context_broker.js +962 -962
  94. package/.agent/scripts/context_compiler.js +1143 -1112
  95. package/.agent/scripts/contract_engine.js +402 -402
  96. package/.agent/scripts/dependency_analyzer.js +313 -313
  97. package/.agent/scripts/graph_builder.js +384 -384
  98. package/.agent/scripts/graph_visualizer.js +390 -390
  99. package/.agent/scripts/graph_zoom.js +181 -181
  100. package/.agent/scripts/guardrail_engine.js +785 -785
  101. package/.agent/scripts/harness_manager.js +60 -60
  102. package/.agent/scripts/impact_classifier.js +192 -192
  103. package/.agent/scripts/inner_loop_validator.js +472 -472
  104. package/.agent/scripts/integrity_manifest.js +484 -484
  105. package/.agent/scripts/lint_runner.js +218 -218
  106. package/.agent/scripts/marathon_harness.js +986 -986
  107. package/.agent/scripts/mcp_server.js +181 -181
  108. package/.agent/scripts/memory_archivist.js +97 -97
  109. package/.agent/scripts/memory_consolidator.js +37 -37
  110. package/.agent/scripts/memory_engine.js +782 -782
  111. package/.agent/scripts/minify_context.js +111 -111
  112. package/.agent/scripts/minimal_change_engine.js +445 -445
  113. package/.agent/scripts/mutation_runner.js +307 -305
  114. package/.agent/scripts/payload_schemas.js +164 -164
  115. package/.agent/scripts/pipeline_engine.js +906 -906
  116. package/.agent/scripts/prompt_compiler.js +272 -272
  117. package/.agent/scripts/schema_validator.js +326 -326
  118. package/.agent/scripts/security_scan.js +390 -390
  119. package/.agent/scripts/session_logger.js +115 -115
  120. package/.agent/scripts/session_manager.js +299 -299
  121. package/.agent/scripts/signal_detector.js +175 -175
  122. package/.agent/scripts/skill_evolution.js +997 -997
  123. package/.agent/scripts/skill_integrator.js +304 -304
  124. package/.agent/scripts/socratic_gate_policy.js +63 -63
  125. package/.agent/scripts/strengthen_skills.js +199 -199
  126. package/.agent/scripts/swarm_dispatcher.js +983 -979
  127. package/.agent/scripts/syscall_registry.js +105 -105
  128. package/.agent/scripts/test_runner.js +209 -209
  129. package/.agent/scripts/token_budget_broker.js +165 -165
  130. package/.agent/scripts/trace_engine.js +126 -126
  131. package/.agent/scripts/verify_all.js +276 -276
  132. package/.agent/scripts/visual_audit.js +87 -87
  133. package/.agent/skill_topic_map.json +314 -314
  134. package/.agent/skills/12-principles-of-animation/SKILL.md +51 -51
  135. package/.agent/skills/60fps-animation/SKILL.md +91 -91
  136. package/.agent/skills/accessible-animation/SKILL.md +189 -189
  137. package/.agent/skills/adapt/SKILL.md +56 -56
  138. package/.agent/skills/adr-generation/SKILL.md +57 -0
  139. package/.agent/skills/advanced-rag-pipelines/SKILL.md +94 -94
  140. package/.agent/skills/agent-organizer/SKILL.md +117 -117
  141. package/.agent/skills/agent-syscall-guidelines/SKILL.md +25 -25
  142. package/.agent/skills/agentic-patterns/SKILL.md +281 -281
  143. package/.agent/skills/agentic-workflows-2026/SKILL.md +91 -91
  144. package/.agent/skills/agentshield-security/SKILL.md +26 -26
  145. package/.agent/skills/ai-app-hardening/SKILL.md +51 -51
  146. package/.agent/skills/ai-prompt-injection-defense/SKILL.md +162 -162
  147. package/.agent/skills/animation-on-scroll/SKILL.md +196 -196
  148. package/.agent/skills/animation-systems/SKILL.md +198 -198
  149. package/.agent/skills/antfu-conventions/SKILL.md +54 -54
  150. package/.agent/skills/api-patterns/SKILL.md +218 -218
  151. package/.agent/skills/api-security-auditor/SKILL.md +155 -155
  152. package/.agent/skills/app-builder/SKILL.md +535 -535
  153. package/.agent/skills/app-builder/templates/SKILL.md +108 -108
  154. package/.agent/skills/app-builder/templates/astro-static/TEMPLATE.md +76 -76
  155. package/.agent/skills/app-builder/templates/chrome-extension/TEMPLATE.md +92 -92
  156. package/.agent/skills/app-builder/templates/cli-tool/TEMPLATE.md +88 -88
  157. package/.agent/skills/app-builder/templates/electron-desktop/TEMPLATE.md +88 -88
  158. package/.agent/skills/app-builder/templates/express-api/TEMPLATE.md +83 -83
  159. package/.agent/skills/app-builder/templates/flutter-app/TEMPLATE.md +90 -90
  160. package/.agent/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +90 -90
  161. package/.agent/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +126 -126
  162. package/.agent/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +127 -127
  163. package/.agent/skills/app-builder/templates/nextjs-static/TEMPLATE.md +172 -172
  164. package/.agent/skills/app-builder/templates/nuxt-app/TEMPLATE.md +139 -139
  165. package/.agent/skills/app-builder/templates/python-fastapi/TEMPLATE.md +83 -83
  166. package/.agent/skills/app-builder/templates/react-native-app/TEMPLATE.md +122 -122
  167. package/.agent/skills/appflow-wireframe/SKILL.md +96 -96
  168. package/.agent/skills/apple-design/SKILL.md +89 -89
  169. package/.agent/skills/architecture/SKILL.md +188 -188
  170. package/.agent/skills/architecture-drift/SKILL.md +45 -0
  171. package/.agent/skills/audit-and-fix/SKILL.md +100 -100
  172. package/.agent/skills/authentication-best-practices/SKILL.md +157 -157
  173. package/.agent/skills/autonomous-execution/SKILL.md +76 -0
  174. package/.agent/skills/backend-security-expert/SKILL.md +73 -73
  175. package/.agent/skills/baseline-ui/SKILL.md +55 -55
  176. package/.agent/skills/bash-linux/SKILL.md +139 -139
  177. package/.agent/skills/behavioral-modes/SKILL.md +200 -200
  178. package/.agent/skills/better-colors/SKILL.md +116 -116
  179. package/.agent/skills/better-typography/SKILL.md +90 -90
  180. package/.agent/skills/better-ui/SKILL.md +130 -130
  181. package/.agent/skills/bolder/SKILL.md +49 -49
  182. package/.agent/skills/brainstorming/SKILL.md +460 -460
  183. package/.agent/skills/browser-audit/SKILL.md +102 -102
  184. package/.agent/skills/browser-native-ai/SKILL.md +72 -72
  185. package/.agent/skills/build-primitive/SKILL.md +50 -50
  186. package/.agent/skills/building-native-ui/SKILL.md +162 -162
  187. package/.agent/skills/cicd-pro/SKILL.md +412 -412
  188. package/.agent/skills/clarify/SKILL.md +55 -55
  189. package/.agent/skills/clean-code/SKILL.md +367 -367
  190. package/.agent/skills/cloud-architect/SKILL.md +409 -409
  191. package/.agent/skills/cobejs/SKILL.md +70 -70
  192. package/.agent/skills/code-review-checklist/SKILL.md +163 -163
  193. package/.agent/skills/codebase-design/SKILL.md +76 -76
  194. package/.agent/skills/colorize/SKILL.md +57 -57
  195. package/.agent/skills/compact-landing/SKILL.md +50 -50
  196. package/.agent/skills/company-logos/SKILL.md +54 -54
  197. package/.agent/skills/config-validator/SKILL.md +125 -125
  198. package/.agent/skills/containerization-pro/SKILL.md +422 -422
  199. package/.agent/skills/context-engineering-pro/SKILL.md +69 -69
  200. package/.agent/skills/create-design-md/SKILL.md +92 -92
  201. package/.agent/skills/critique/SKILL.md +79 -79
  202. package/.agent/skills/csharp-developer/SKILL.md +478 -478
  203. package/.agent/skills/data-validation-schemas/SKILL.md +297 -297
  204. package/.agent/skills/database-design/SKILL.md +219 -219
  205. package/.agent/skills/delight/SKILL.md +46 -46
  206. package/.agent/skills/deployment-procedures/SKILL.md +132 -132
  207. package/.agent/skills/design-lab/SKILL.md +42 -42
  208. package/.agent/skills/devops-engineer/SKILL.md +305 -305
  209. package/.agent/skills/devops-incident-responder/SKILL.md +103 -103
  210. package/.agent/skills/diagnosing-bugs/SKILL.md +172 -172
  211. package/.agent/skills/distill/SKILL.md +45 -45
  212. package/.agent/skills/documentation-templates/SKILL.md +251 -251
  213. package/.agent/skills/domain-modeling/SKILL.md +61 -61
  214. package/.agent/skills/duckdb-analytical-sql/SKILL.md +51 -51
  215. package/.agent/skills/edge-ai-mobile/SKILL.md +42 -42
  216. package/.agent/skills/edge-computing/SKILL.md +143 -143
  217. package/.agent/skills/emil-design-eng/SKILL.md +134 -134
  218. package/.agent/skills/error-resilience/SKILL.md +403 -403
  219. package/.agent/skills/expo-router-v4/SKILL.md +72 -72
  220. package/.agent/skills/extract-design-system/SKILL.md +120 -120
  221. package/.agent/skills/fabel-protocol/SKILL.md +282 -282
  222. package/.agent/skills/failure-mode-analysis/SKILL.md +48 -0
  223. package/.agent/skills/fixing-accessibility/SKILL.md +87 -87
  224. package/.agent/skills/fixing-metadata/SKILL.md +83 -83
  225. package/.agent/skills/fixing-motion-performance/SKILL.md +78 -78
  226. package/.agent/skills/framer-motion-expert/SKILL.md +237 -237
  227. package/.agent/skills/frontend-design/SKILL.md +103 -103
  228. package/.agent/skills/frontend-security-expert/SKILL.md +56 -56
  229. package/.agent/skills/game-design-expert/SKILL.md +92 -92
  230. package/.agent/skills/game-engineering-expert/SKILL.md +108 -108
  231. package/.agent/skills/generative-ui-expert/SKILL.md +100 -100
  232. package/.agent/skills/geo-fundamentals/SKILL.md +108 -108
  233. package/.agent/skills/git-pro/SKILL.md +401 -401
  234. package/.agent/skills/github-operations/SKILL.md +295 -295
  235. package/.agent/skills/gpt-taste/SKILL.md +50 -50
  236. package/.agent/skills/graph-engineering/SKILL.md +28 -28
  237. package/.agent/skills/gsap-core/SKILL.md +277 -277
  238. package/.agent/skills/gsap-frameworks/SKILL.md +168 -168
  239. package/.agent/skills/gsap-performance/SKILL.md +94 -94
  240. package/.agent/skills/gsap-plugins/SKILL.md +441 -441
  241. package/.agent/skills/gsap-react/SKILL.md +213 -213
  242. package/.agent/skills/gsap-scrolltrigger/SKILL.md +312 -312
  243. package/.agent/skills/gsap-timeline/SKILL.md +122 -122
  244. package/.agent/skills/gsap-utils/SKILL.md +299 -299
  245. package/.agent/skills/harden/SKILL.md +55 -55
  246. package/.agent/skills/harness-protocol/SKILL.md +48 -48
  247. package/.agent/skills/huggingface-spaces/SKILL.md +1 -1
  248. package/.agent/skills/human-gate-negotiation/SKILL.md +30 -30
  249. package/.agent/skills/i18n-localization/SKILL.md +134 -134
  250. package/.agent/skills/impeccable/SKILL.md +52 -52
  251. package/.agent/skills/improve-codebase-architecture/SKILL.md +48 -48
  252. package/.agent/skills/improve-ui/SKILL.md +70 -70
  253. package/.agent/skills/intelligent-routing/SKILL.md +204 -204
  254. package/.agent/skills/knowledge-graph/SKILL.md +71 -71
  255. package/.agent/skills/landing-page/SKILL.md +65 -65
  256. package/.agent/skills/lint-and-validate/SKILL.md +224 -224
  257. package/.agent/skills/llm-engineering/SKILL.md +360 -360
  258. package/.agent/skills/local-first/SKILL.md +138 -138
  259. package/.agent/skills/local-first-architecture/SKILL.md +62 -62
  260. package/.agent/skills/lottie-animation/SKILL.md +62 -62
  261. package/.agent/skills/marquee-loop/SKILL.md +72 -72
  262. package/.agent/skills/masked-reveal/SKILL.md +230 -230
  263. package/.agent/skills/mcp-builder/SKILL.md +105 -105
  264. package/.agent/skills/micro-interaction/SKILL.md +253 -253
  265. package/.agent/skills/mobile-design/SKILL.md +245 -245
  266. package/.agent/skills/monorepo-management/SKILL.md +295 -295
  267. package/.agent/skills/morphing-icons/SKILL.md +348 -348
  268. package/.agent/skills/motion-engineering/SKILL.md +197 -197
  269. package/.agent/skills/nextjs-react-expert/SKILL.md +218 -218
  270. package/.agent/skills/nodejs-best-practices/SKILL.md +542 -542
  271. package/.agent/skills/observability/SKILL.md +303 -303
  272. package/.agent/skills/opentelemetry-observability/SKILL.md +51 -51
  273. package/.agent/skills/page-transition-animation/SKILL.md +86 -86
  274. package/.agent/skills/parallel-agents/SKILL.md +110 -110
  275. package/.agent/skills/performance-profiling/SKILL.md +230 -230
  276. package/.agent/skills/plan-writing/SKILL.md +127 -127
  277. package/.agent/skills/platform-engineer/SKILL.md +108 -108
  278. package/.agent/skills/platform-engineering-opentofu/SKILL.md +59 -59
  279. package/.agent/skills/playwright-ai-e2e/SKILL.md +52 -52
  280. package/.agent/skills/playwright-best-practices/SKILL.md +149 -149
  281. package/.agent/skills/polish/SKILL.md +39 -39
  282. package/.agent/skills/powershell-windows/SKILL.md +122 -122
  283. package/.agent/skills/pricing-page/SKILL.md +48 -48
  284. package/.agent/skills/product-aware-heuristics/SKILL.md +390 -390
  285. package/.agent/skills/progressive-blur/SKILL.md +80 -80
  286. package/.agent/skills/project-idioms/SKILL.md +91 -91
  287. package/.agent/skills/property-based-testing/SKILL.md +50 -50
  288. package/.agent/skills/python-patterns/SKILL.md +220 -220
  289. package/.agent/skills/python-pro/SKILL.md +305 -305
  290. package/.agent/skills/quieter/SKILL.md +49 -49
  291. package/.agent/skills/react-doctor/SKILL.md +51 -51
  292. package/.agent/skills/react-specialist/SKILL.md +280 -280
  293. package/.agent/skills/readme-builder/SKILL.md +270 -270
  294. package/.agent/skills/realtime-patterns/SKILL.md +283 -283
  295. package/.agent/skills/red-team-tactics/SKILL.md +191 -191
  296. package/.agent/skills/redesign-skill/SKILL.md +46 -46
  297. package/.agent/skills/review-animations/SKILL.md +45 -45
  298. package/.agent/skills/review-animations/STANDARDS.md +87 -87
  299. package/.agent/skills/rust-pro/SKILL.md +652 -652
  300. package/.agent/skills/semantic-filesystem-navigation/SKILL.md +24 -24
  301. package/.agent/skills/seo-fundamentals/SKILL.md +139 -139
  302. package/.agent/skills/server-management/SKILL.md +178 -178
  303. package/.agent/skills/session-log-interrogation/SKILL.md +29 -29
  304. package/.agent/skills/shadcn-ui-expert/SKILL.md +196 -196
  305. package/.agent/skills/shape/SKILL.md +56 -56
  306. package/.agent/skills/skill-creator/SKILL.md +177 -177
  307. package/.agent/skills/soft-skill/SKILL.md +53 -53
  308. package/.agent/skills/sounds-on-the-web/SKILL.md +76 -76
  309. package/.agent/skills/sql-pro/SKILL.md +624 -624
  310. package/.agent/skills/subagent-driven-development/SKILL.md +32 -32
  311. package/.agent/skills/supabase-postgres-best-practices/SKILL.md +57 -57
  312. package/.agent/skills/svg-animation/SKILL.md +356 -356
  313. package/.agent/skills/swiftui-expert/SKILL.md +164 -164
  314. package/.agent/skills/swiss-design/SKILL.md +44 -44
  315. package/.agent/skills/system-design-pro/SKILL.md +188 -318
  316. package/.agent/skills/systematic-debugging/SKILL.md +129 -129
  317. package/.agent/skills/systematic-debugging/condition-based-waiting.md +120 -120
  318. package/.agent/skills/systematic-debugging/defense-in-depth.md +128 -128
  319. package/.agent/skills/systematic-debugging/root-cause-tracing.md +183 -183
  320. package/.agent/skills/tailwind-patterns/SKILL.md +583 -583
  321. package/.agent/skills/taste-skill/SKILL.md +52 -52
  322. package/.agent/skills/tdd-workflow/SKILL.md +105 -105
  323. package/.agent/skills/test-result-analyzer/SKILL.md +270 -270
  324. package/.agent/skills/testing-patterns/SKILL.md +534 -534
  325. package/.agent/skills/thermo-nuclear-code-quality-review/SKILL.md +62 -62
  326. package/.agent/skills/thinking-protocol/SKILL.md +21 -21
  327. package/.agent/skills/to-spring-or-not-to-spring/SKILL.md +43 -43
  328. package/.agent/skills/transformers-js/references/CONFIGURATION.md +1 -1
  329. package/.agent/skills/transitions-dev/SKILL.md +90 -90
  330. package/.agent/skills/trend-researcher/SKILL.md +198 -198
  331. package/.agent/skills/tribunal-instincts-memory/SKILL.md +31 -31
  332. package/.agent/skills/typescript-advanced/SKILL.md +306 -306
  333. package/.agent/skills/typeset/SKILL.md +60 -60
  334. package/.agent/skills/ui-reasoning-engine/SKILL.md +155 -155
  335. package/.agent/skills/ui-skill-packs/SKILL.md +57 -57
  336. package/.agent/skills/ui-skills-root/SKILL.md +69 -69
  337. package/.agent/skills/ui-ux-pro-max/SKILL.md +110 -110
  338. package/.agent/skills/ui-ux-researcher/SKILL.md +199 -199
  339. package/.agent/skills/vector-search-pgvector/SKILL.md +70 -70
  340. package/.agent/skills/verification-before-completion/SKILL.md +107 -107
  341. package/.agent/skills/vue-expert/SKILL.md +259 -259
  342. package/.agent/skills/vulnerability-scanner/SKILL.md +378 -378
  343. package/.agent/skills/web-accessibility-auditor/SKILL.md +179 -179
  344. package/.agent/skills/web-design-guidelines/SKILL.md +49 -49
  345. package/.agent/skills/web-quality-audit/SKILL.md +47 -47
  346. package/.agent/skills/webapp-testing/SKILL.md +128 -128
  347. package/.agent/skills/webgpu-performance/SKILL.md +88 -88
  348. package/.agent/skills/whimsy-injector/SKILL.md +305 -305
  349. package/.agent/skills/workflow-optimizer/SKILL.md +188 -188
  350. package/.agent/skills/zero-trust-passkeys/SKILL.md +82 -82
  351. package/.agent/templates/DESIGN.md +843 -843
  352. package/.agent/templates/design-tokens.json +140 -140
  353. package/.agent/templates/sdd/implementer-prompt.md +62 -62
  354. package/.agent/templates/sdd/re-review-prompt.md +36 -36
  355. package/.agent/templates/sdd/task-reviewer-prompt.md +78 -78
  356. package/.agent/workflows/acf.md +153 -153
  357. package/.agent/workflows/api-tester.md +189 -189
  358. package/.agent/workflows/assimilate.md +21 -21
  359. package/.agent/workflows/audit-live.md +53 -53
  360. package/.agent/workflows/audit.md +172 -172
  361. package/.agent/workflows/brainstorm.md +157 -157
  362. package/.agent/workflows/changelog.md +152 -152
  363. package/.agent/workflows/compare-web.md +35 -35
  364. package/.agent/workflows/context.md +102 -102
  365. package/.agent/workflows/contract.md +79 -79
  366. package/.agent/workflows/create.md +182 -182
  367. package/.agent/workflows/debug.md +201 -201
  368. package/.agent/workflows/deploy.md +215 -215
  369. package/.agent/workflows/enhance.md +165 -165
  370. package/.agent/workflows/fix-ci.md +94 -94
  371. package/.agent/workflows/fix.md +149 -149
  372. package/.agent/workflows/generate.md +216 -216
  373. package/.agent/workflows/htop.md +22 -22
  374. package/.agent/workflows/marathon.md +291 -291
  375. package/.agent/workflows/migrate.md +198 -198
  376. package/.agent/workflows/minimal.md +101 -101
  377. package/.agent/workflows/orchestrate.md +205 -205
  378. package/.agent/workflows/performance-benchmarker.md +148 -148
  379. package/.agent/workflows/pipeline.md +165 -165
  380. package/.agent/workflows/plan.md +206 -206
  381. package/.agent/workflows/preview.md +116 -116
  382. package/.agent/workflows/refactor.md +207 -207
  383. package/.agent/workflows/resume.md +20 -20
  384. package/.agent/workflows/review-ai.md +139 -139
  385. package/.agent/workflows/review.md +155 -155
  386. package/.agent/workflows/sdd.md +137 -137
  387. package/.agent/workflows/session.md +135 -135
  388. package/.agent/workflows/skill-enhancement-engine.md +84 -84
  389. package/.agent/workflows/status.md +112 -112
  390. package/.agent/workflows/strengthen-skills.md +174 -174
  391. package/.agent/workflows/super-prompt.md +146 -146
  392. package/.agent/workflows/swarm.md +218 -218
  393. package/.agent/workflows/team-mode.md +22 -22
  394. package/.agent/workflows/test.md +224 -224
  395. package/.agent/workflows/tribunal-backend.md +149 -149
  396. package/.agent/workflows/tribunal-cicd.md +109 -109
  397. package/.agent/workflows/tribunal-database.md +142 -142
  398. package/.agent/workflows/tribunal-frontend.md +157 -157
  399. package/.agent/workflows/tribunal-full.md +156 -156
  400. package/.agent/workflows/tribunal-mobile.md +142 -142
  401. package/.agent/workflows/tribunal-performance.md +149 -149
  402. package/.agent/workflows/tribunal-speed.md +222 -222
  403. package/.agent/workflows/tribunal-ui.md +97 -97
  404. package/.agent/workflows/ui-ux-pro-max.md +103 -103
  405. package/.agents/skills/12-principles-of-animation/SKILL.md +51 -51
  406. package/.agents/skills/60fps-animation/SKILL.md +91 -91
  407. package/.agents/skills/accessible-animation/SKILL.md +189 -189
  408. package/.agents/skills/adapt/SKILL.md +56 -56
  409. package/.agents/skills/adr-generation/SKILL.md +57 -0
  410. package/.agents/skills/advanced-rag-pipelines/SKILL.md +94 -94
  411. package/.agents/skills/agent-organizer/SKILL.md +117 -117
  412. package/.agents/skills/agent-syscall-guidelines/SKILL.md +25 -25
  413. package/.agents/skills/agentic-patterns/SKILL.md +281 -281
  414. package/.agents/skills/agentic-workflows-2026/SKILL.md +91 -91
  415. package/.agents/skills/agentshield-security/SKILL.md +26 -26
  416. package/.agents/skills/ai-app-hardening/SKILL.md +51 -51
  417. package/.agents/skills/ai-prompt-injection-defense/SKILL.md +162 -162
  418. package/.agents/skills/animation-on-scroll/SKILL.md +196 -196
  419. package/.agents/skills/animation-systems/SKILL.md +198 -198
  420. package/.agents/skills/antfu-conventions/SKILL.md +54 -54
  421. package/.agents/skills/api-patterns/SKILL.md +218 -218
  422. package/.agents/skills/api-security-auditor/SKILL.md +155 -155
  423. package/.agents/skills/app-builder/SKILL.md +535 -535
  424. package/.agents/skills/app-builder/templates/SKILL.md +108 -108
  425. package/.agents/skills/app-builder/templates/astro-static/TEMPLATE.md +76 -76
  426. package/.agents/skills/app-builder/templates/chrome-extension/TEMPLATE.md +92 -92
  427. package/.agents/skills/app-builder/templates/cli-tool/TEMPLATE.md +88 -88
  428. package/.agents/skills/app-builder/templates/electron-desktop/TEMPLATE.md +88 -88
  429. package/.agents/skills/app-builder/templates/express-api/TEMPLATE.md +83 -83
  430. package/.agents/skills/app-builder/templates/flutter-app/TEMPLATE.md +90 -90
  431. package/.agents/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +90 -90
  432. package/.agents/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +126 -126
  433. package/.agents/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +127 -127
  434. package/.agents/skills/app-builder/templates/nextjs-static/TEMPLATE.md +172 -172
  435. package/.agents/skills/app-builder/templates/nuxt-app/TEMPLATE.md +139 -139
  436. package/.agents/skills/app-builder/templates/python-fastapi/TEMPLATE.md +83 -83
  437. package/.agents/skills/app-builder/templates/react-native-app/TEMPLATE.md +122 -122
  438. package/.agents/skills/appflow-wireframe/SKILL.md +96 -96
  439. package/.agents/skills/apple-design/SKILL.md +89 -89
  440. package/.agents/skills/architecture/SKILL.md +188 -188
  441. package/.agents/skills/architecture-drift/SKILL.md +45 -0
  442. package/.agents/skills/audit-and-fix/SKILL.md +100 -100
  443. package/.agents/skills/authentication-best-practices/SKILL.md +157 -157
  444. package/.agents/skills/autonomous-execution/SKILL.md +76 -0
  445. package/.agents/skills/backend-security-expert/SKILL.md +73 -73
  446. package/.agents/skills/baseline-ui/SKILL.md +55 -55
  447. package/.agents/skills/bash-linux/SKILL.md +139 -139
  448. package/.agents/skills/behavioral-modes/SKILL.md +200 -200
  449. package/.agents/skills/better-colors/SKILL.md +116 -116
  450. package/.agents/skills/better-typography/SKILL.md +90 -90
  451. package/.agents/skills/better-ui/SKILL.md +130 -130
  452. package/.agents/skills/bolder/SKILL.md +49 -49
  453. package/.agents/skills/brainstorming/SKILL.md +460 -460
  454. package/.agents/skills/browser-audit/SKILL.md +102 -102
  455. package/.agents/skills/browser-native-ai/SKILL.md +72 -72
  456. package/.agents/skills/build-primitive/SKILL.md +50 -50
  457. package/.agents/skills/building-native-ui/SKILL.md +162 -162
  458. package/.agents/skills/cicd-pro/SKILL.md +412 -412
  459. package/.agents/skills/clarify/SKILL.md +55 -55
  460. package/.agents/skills/clean-code/SKILL.md +367 -367
  461. package/.agents/skills/cloud-architect/SKILL.md +409 -409
  462. package/.agents/skills/cobejs/SKILL.md +70 -70
  463. package/.agents/skills/code-review-checklist/SKILL.md +163 -163
  464. package/.agents/skills/codebase-design/SKILL.md +76 -76
  465. package/.agents/skills/colorize/SKILL.md +57 -57
  466. package/.agents/skills/compact-landing/SKILL.md +50 -50
  467. package/.agents/skills/company-logos/SKILL.md +54 -54
  468. package/.agents/skills/config-validator/SKILL.md +125 -125
  469. package/.agents/skills/containerization-pro/SKILL.md +422 -422
  470. package/.agents/skills/context-engineering-pro/SKILL.md +69 -69
  471. package/.agents/skills/create-design-md/SKILL.md +92 -92
  472. package/.agents/skills/critique/SKILL.md +79 -79
  473. package/.agents/skills/csharp-developer/SKILL.md +478 -478
  474. package/.agents/skills/data-validation-schemas/SKILL.md +297 -297
  475. package/.agents/skills/database-design/SKILL.md +219 -219
  476. package/.agents/skills/delight/SKILL.md +46 -46
  477. package/.agents/skills/deployment-procedures/SKILL.md +132 -132
  478. package/.agents/skills/design-lab/SKILL.md +42 -42
  479. package/.agents/skills/devops-engineer/SKILL.md +305 -305
  480. package/.agents/skills/devops-incident-responder/SKILL.md +103 -103
  481. package/.agents/skills/diagnosing-bugs/SKILL.md +172 -172
  482. package/.agents/skills/distill/SKILL.md +45 -45
  483. package/.agents/skills/documentation-templates/SKILL.md +251 -251
  484. package/.agents/skills/domain-modeling/SKILL.md +61 -61
  485. package/.agents/skills/duckdb-analytical-sql/SKILL.md +51 -51
  486. package/.agents/skills/edge-ai-mobile/SKILL.md +42 -42
  487. package/.agents/skills/edge-computing/SKILL.md +143 -143
  488. package/.agents/skills/emil-design-eng/SKILL.md +134 -134
  489. package/.agents/skills/error-resilience/SKILL.md +403 -403
  490. package/.agents/skills/expo-router-v4/SKILL.md +72 -72
  491. package/.agents/skills/extract-design-system/SKILL.md +120 -120
  492. package/.agents/skills/fabel-protocol/SKILL.md +282 -282
  493. package/.agents/skills/failure-mode-analysis/SKILL.md +48 -0
  494. package/.agents/skills/fixing-accessibility/SKILL.md +87 -87
  495. package/.agents/skills/fixing-metadata/SKILL.md +83 -83
  496. package/.agents/skills/fixing-motion-performance/SKILL.md +78 -78
  497. package/.agents/skills/framer-motion-expert/SKILL.md +237 -237
  498. package/.agents/skills/frontend-design/SKILL.md +103 -103
  499. package/.agents/skills/frontend-security-expert/SKILL.md +56 -56
  500. package/.agents/skills/game-design-expert/SKILL.md +92 -92
  501. package/.agents/skills/game-engineering-expert/SKILL.md +108 -108
  502. package/.agents/skills/generative-ui-expert/SKILL.md +100 -100
  503. package/.agents/skills/geo-fundamentals/SKILL.md +108 -108
  504. package/.agents/skills/git-pro/SKILL.md +401 -401
  505. package/.agents/skills/github-operations/SKILL.md +295 -295
  506. package/.agents/skills/gpt-taste/SKILL.md +50 -50
  507. package/.agents/skills/graph-engineering/SKILL.md +28 -28
  508. package/.agents/skills/gsap-core/SKILL.md +277 -277
  509. package/.agents/skills/gsap-frameworks/SKILL.md +168 -168
  510. package/.agents/skills/gsap-performance/SKILL.md +94 -94
  511. package/.agents/skills/gsap-plugins/SKILL.md +441 -441
  512. package/.agents/skills/gsap-react/SKILL.md +213 -213
  513. package/.agents/skills/gsap-scrolltrigger/SKILL.md +312 -312
  514. package/.agents/skills/gsap-timeline/SKILL.md +122 -122
  515. package/.agents/skills/gsap-utils/SKILL.md +299 -299
  516. package/.agents/skills/harden/SKILL.md +55 -55
  517. package/.agents/skills/harness-protocol/SKILL.md +48 -48
  518. package/.agents/skills/huggingface-spaces/SKILL.md +1 -1
  519. package/.agents/skills/human-gate-negotiation/SKILL.md +30 -30
  520. package/.agents/skills/i18n-localization/SKILL.md +134 -134
  521. package/.agents/skills/impeccable/SKILL.md +52 -52
  522. package/.agents/skills/improve-codebase-architecture/SKILL.md +48 -48
  523. package/.agents/skills/improve-ui/SKILL.md +70 -70
  524. package/.agents/skills/intelligent-routing/SKILL.md +204 -204
  525. package/.agents/skills/knowledge-graph/SKILL.md +71 -71
  526. package/.agents/skills/landing-page/SKILL.md +65 -65
  527. package/.agents/skills/lint-and-validate/SKILL.md +224 -224
  528. package/.agents/skills/llm-engineering/SKILL.md +360 -360
  529. package/.agents/skills/local-first/SKILL.md +138 -138
  530. package/.agents/skills/local-first-architecture/SKILL.md +62 -62
  531. package/.agents/skills/lottie-animation/SKILL.md +62 -62
  532. package/.agents/skills/marquee-loop/SKILL.md +72 -72
  533. package/.agents/skills/masked-reveal/SKILL.md +230 -230
  534. package/.agents/skills/mcp-builder/SKILL.md +105 -105
  535. package/.agents/skills/micro-interaction/SKILL.md +253 -253
  536. package/.agents/skills/mobile-design/SKILL.md +245 -245
  537. package/.agents/skills/monorepo-management/SKILL.md +295 -295
  538. package/.agents/skills/morphing-icons/SKILL.md +348 -348
  539. package/.agents/skills/motion-engineering/SKILL.md +197 -197
  540. package/.agents/skills/nextjs-react-expert/SKILL.md +218 -218
  541. package/.agents/skills/nodejs-best-practices/SKILL.md +542 -542
  542. package/.agents/skills/observability/SKILL.md +303 -303
  543. package/.agents/skills/opentelemetry-observability/SKILL.md +51 -51
  544. package/.agents/skills/page-transition-animation/SKILL.md +86 -86
  545. package/.agents/skills/parallel-agents/SKILL.md +110 -110
  546. package/.agents/skills/performance-profiling/SKILL.md +230 -230
  547. package/.agents/skills/plan-writing/SKILL.md +127 -127
  548. package/.agents/skills/platform-engineer/SKILL.md +108 -108
  549. package/.agents/skills/platform-engineering-opentofu/SKILL.md +59 -59
  550. package/.agents/skills/playwright-ai-e2e/SKILL.md +52 -52
  551. package/.agents/skills/playwright-best-practices/SKILL.md +149 -149
  552. package/.agents/skills/polish/SKILL.md +39 -39
  553. package/.agents/skills/powershell-windows/SKILL.md +122 -122
  554. package/.agents/skills/pricing-page/SKILL.md +48 -48
  555. package/.agents/skills/product-aware-heuristics/SKILL.md +390 -390
  556. package/.agents/skills/progressive-blur/SKILL.md +80 -80
  557. package/.agents/skills/project-idioms/SKILL.md +91 -91
  558. package/.agents/skills/property-based-testing/SKILL.md +50 -50
  559. package/.agents/skills/python-patterns/SKILL.md +220 -220
  560. package/.agents/skills/python-pro/SKILL.md +305 -305
  561. package/.agents/skills/quieter/SKILL.md +49 -49
  562. package/.agents/skills/react-doctor/SKILL.md +51 -51
  563. package/.agents/skills/react-specialist/SKILL.md +280 -280
  564. package/.agents/skills/readme-builder/SKILL.md +270 -270
  565. package/.agents/skills/realtime-patterns/SKILL.md +283 -283
  566. package/.agents/skills/red-team-tactics/SKILL.md +191 -191
  567. package/.agents/skills/redesign-skill/SKILL.md +46 -46
  568. package/.agents/skills/review-animations/SKILL.md +45 -45
  569. package/.agents/skills/review-animations/STANDARDS.md +87 -87
  570. package/.agents/skills/rust-pro/SKILL.md +652 -652
  571. package/.agents/skills/semantic-filesystem-navigation/SKILL.md +24 -24
  572. package/.agents/skills/seo-fundamentals/SKILL.md +139 -139
  573. package/.agents/skills/server-management/SKILL.md +178 -178
  574. package/.agents/skills/session-log-interrogation/SKILL.md +29 -29
  575. package/.agents/skills/shadcn-ui-expert/SKILL.md +196 -196
  576. package/.agents/skills/shape/SKILL.md +56 -56
  577. package/.agents/skills/skill-creator/SKILL.md +177 -177
  578. package/.agents/skills/soft-skill/SKILL.md +53 -53
  579. package/.agents/skills/sounds-on-the-web/SKILL.md +76 -76
  580. package/.agents/skills/sql-pro/SKILL.md +624 -624
  581. package/.agents/skills/subagent-driven-development/SKILL.md +32 -32
  582. package/.agents/skills/supabase-postgres-best-practices/SKILL.md +57 -57
  583. package/.agents/skills/svg-animation/SKILL.md +356 -356
  584. package/.agents/skills/swiftui-expert/SKILL.md +164 -164
  585. package/.agents/skills/swiss-design/SKILL.md +44 -44
  586. package/.agents/skills/system-design-pro/SKILL.md +188 -318
  587. package/.agents/skills/systematic-debugging/SKILL.md +129 -129
  588. package/.agents/skills/systematic-debugging/condition-based-waiting.md +120 -120
  589. package/.agents/skills/systematic-debugging/defense-in-depth.md +128 -128
  590. package/.agents/skills/systematic-debugging/root-cause-tracing.md +183 -183
  591. package/.agents/skills/tailwind-patterns/SKILL.md +583 -583
  592. package/.agents/skills/taste-skill/SKILL.md +52 -52
  593. package/.agents/skills/tdd-workflow/SKILL.md +105 -105
  594. package/.agents/skills/test-result-analyzer/SKILL.md +270 -270
  595. package/.agents/skills/testing-patterns/SKILL.md +534 -534
  596. package/.agents/skills/thermo-nuclear-code-quality-review/SKILL.md +62 -62
  597. package/.agents/skills/thinking-protocol/SKILL.md +21 -21
  598. package/.agents/skills/to-spring-or-not-to-spring/SKILL.md +43 -43
  599. package/.agents/skills/transformers-js/references/CONFIGURATION.md +1 -1
  600. package/.agents/skills/transitions-dev/SKILL.md +90 -90
  601. package/.agents/skills/trend-researcher/SKILL.md +198 -198
  602. package/.agents/skills/tribunal-instincts-memory/SKILL.md +31 -31
  603. package/.agents/skills/typescript-advanced/SKILL.md +306 -306
  604. package/.agents/skills/typeset/SKILL.md +60 -60
  605. package/.agents/skills/ui-reasoning-engine/SKILL.md +155 -155
  606. package/.agents/skills/ui-skill-packs/SKILL.md +57 -57
  607. package/.agents/skills/ui-skills-root/SKILL.md +69 -69
  608. package/.agents/skills/ui-ux-pro-max/SKILL.md +110 -110
  609. package/.agents/skills/ui-ux-researcher/SKILL.md +199 -199
  610. package/.agents/skills/vector-search-pgvector/SKILL.md +70 -70
  611. package/.agents/skills/verification-before-completion/SKILL.md +107 -107
  612. package/.agents/skills/vue-expert/SKILL.md +259 -259
  613. package/.agents/skills/vulnerability-scanner/SKILL.md +378 -378
  614. package/.agents/skills/web-accessibility-auditor/SKILL.md +179 -179
  615. package/.agents/skills/web-design-guidelines/SKILL.md +49 -49
  616. package/.agents/skills/web-quality-audit/SKILL.md +47 -47
  617. package/.agents/skills/webapp-testing/SKILL.md +128 -128
  618. package/.agents/skills/webgpu-performance/SKILL.md +88 -88
  619. package/.agents/skills/whimsy-injector/SKILL.md +305 -305
  620. package/.agents/skills/workflow-optimizer/SKILL.md +188 -188
  621. package/.agents/skills/zero-trust-passkeys/SKILL.md +82 -82
  622. package/AGENTS.md +93 -93
  623. package/CLAUDE.md +444 -444
  624. package/CONTRIBUTING.md +134 -134
  625. package/README.md +242 -242
  626. package/SECURITY.md +58 -52
  627. package/bin/adapter-install.js +264 -264
  628. package/bin/global-store.js +48 -48
  629. package/bin/mcp-server.js +1653 -1653
  630. package/bin/proxy-server.js +122 -122
  631. package/bin/spawn-agent.js +45 -45
  632. package/bin/tk-proxy.js +34 -34
  633. package/bin/tribunal-kit.js +113 -113
  634. package/bin/wrapper.js +209 -211
  635. package/hooks/hooks-cursor.json +10 -10
  636. package/hooks/hooks.json +10 -10
  637. package/hooks/session-start.js +77 -77
  638. package/mcp_config.json +18 -18
  639. package/package.json +169 -179
  640. package/{.claude-plugin → plugins/claude}/marketplace.json +14 -14
  641. package/{.claude-plugin → plugins/claude}/plugin.json +26 -26
  642. package/{.codex-plugin → plugins/codex}/plugin.json +41 -41
  643. package/{plugin.json → plugins/core-plugin.json} +26 -26
  644. package/{.cursor-plugin → plugins/cursor}/plugin.json +26 -26
  645. package/{.devin-plugin → plugins/devin}/plugin.json +14 -14
  646. package/{gemini-extension.json → plugins/gemini/extension.json} +6 -6
  647. package/{.hermes-plugin → plugins/hermes}/__init__.py +102 -102
  648. package/{.hermes-plugin → plugins/hermes}/plugin.yaml +6 -6
  649. package/{.kimi-plugin → plugins/kimi}/plugin.json +34 -34
  650. package/{marketplace.json → plugins/marketplace.json} +14 -14
  651. package/{.opencode → plugins/opencode}/INSTALL.md +42 -42
  652. package/{.opencode → plugins/opencode}/plugins/tribunal.js +110 -110
  653. package/{.opencode → plugins/opencode}/rules.md +258 -258
  654. package/{.pi → plugins/pi}/extensions/tribunal.ts +130 -130
  655. package/scripts/apply-version.js +57 -57
  656. package/scripts/audit_skill_sdo.js +89 -89
  657. package/scripts/benchmark.js +231 -231
  658. package/scripts/build-graph.js +71 -71
  659. package/scripts/changelog.js +190 -190
  660. package/scripts/clean-pycache.js +42 -42
  661. package/scripts/context_compiler.js +1143 -1117
  662. package/scripts/fix-vbc.js +96 -96
  663. package/scripts/fix-vbc.ps1 +3 -3
  664. package/scripts/modernize_skills.js +268 -268
  665. package/scripts/package-cores.js +116 -116
  666. package/scripts/skill_enhancement_engine.js +608 -608
  667. package/scripts/stress_benchmark.js +358 -358
  668. package/scripts/sync-skills.js +61 -61
  669. package/scripts/sync-version.js +177 -177
  670. package/scripts/telemetry_gc.js +156 -156
  671. package/scripts/validate-payload.js +73 -73
  672. package/scripts/visual_audit.js +136 -136
  673. package/skills/12-principles-of-animation/SKILL.md +51 -51
  674. package/skills/60fps-animation/SKILL.md +91 -91
  675. package/skills/accessible-animation/SKILL.md +189 -189
  676. package/skills/adapt/SKILL.md +56 -56
  677. package/skills/adr-generation/SKILL.md +57 -0
  678. package/skills/advanced-rag-pipelines/SKILL.md +94 -94
  679. package/skills/agent-organizer/SKILL.md +117 -117
  680. package/skills/agent-syscall-guidelines/SKILL.md +25 -25
  681. package/skills/agentic-patterns/SKILL.md +281 -281
  682. package/skills/agentic-workflows-2026/SKILL.md +91 -91
  683. package/skills/agentshield-security/SKILL.md +26 -26
  684. package/skills/ai-app-hardening/SKILL.md +51 -51
  685. package/skills/ai-prompt-injection-defense/SKILL.md +162 -162
  686. package/skills/animation-on-scroll/SKILL.md +196 -196
  687. package/skills/animation-systems/SKILL.md +198 -198
  688. package/skills/antfu-conventions/SKILL.md +54 -54
  689. package/skills/api-patterns/SKILL.md +218 -218
  690. package/skills/api-security-auditor/SKILL.md +155 -155
  691. package/skills/app-builder/SKILL.md +535 -535
  692. package/skills/app-builder/templates/SKILL.md +108 -108
  693. package/skills/app-builder/templates/astro-static/TEMPLATE.md +76 -76
  694. package/skills/app-builder/templates/chrome-extension/TEMPLATE.md +92 -92
  695. package/skills/app-builder/templates/cli-tool/TEMPLATE.md +88 -88
  696. package/skills/app-builder/templates/electron-desktop/TEMPLATE.md +88 -88
  697. package/skills/app-builder/templates/express-api/TEMPLATE.md +83 -83
  698. package/skills/app-builder/templates/flutter-app/TEMPLATE.md +90 -90
  699. package/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +90 -90
  700. package/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +126 -126
  701. package/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +127 -127
  702. package/skills/app-builder/templates/nextjs-static/TEMPLATE.md +172 -172
  703. package/skills/app-builder/templates/nuxt-app/TEMPLATE.md +139 -139
  704. package/skills/app-builder/templates/python-fastapi/TEMPLATE.md +83 -83
  705. package/skills/app-builder/templates/react-native-app/TEMPLATE.md +122 -122
  706. package/skills/appflow-wireframe/SKILL.md +96 -96
  707. package/skills/apple-design/SKILL.md +89 -89
  708. package/skills/architecture/SKILL.md +188 -188
  709. package/skills/architecture-drift/SKILL.md +45 -0
  710. package/skills/audit-and-fix/SKILL.md +100 -100
  711. package/skills/authentication-best-practices/SKILL.md +157 -157
  712. package/skills/autonomous-execution/SKILL.md +76 -0
  713. package/skills/backend-security-expert/SKILL.md +73 -73
  714. package/skills/baseline-ui/SKILL.md +55 -55
  715. package/skills/bash-linux/SKILL.md +139 -139
  716. package/skills/behavioral-modes/SKILL.md +200 -200
  717. package/skills/better-colors/SKILL.md +116 -116
  718. package/skills/better-typography/SKILL.md +90 -90
  719. package/skills/better-ui/SKILL.md +130 -130
  720. package/skills/bolder/SKILL.md +49 -49
  721. package/skills/brainstorming/SKILL.md +460 -460
  722. package/skills/browser-audit/SKILL.md +102 -102
  723. package/skills/browser-native-ai/SKILL.md +72 -72
  724. package/skills/build-primitive/SKILL.md +50 -50
  725. package/skills/building-native-ui/SKILL.md +162 -162
  726. package/skills/cicd-pro/SKILL.md +412 -412
  727. package/skills/clarify/SKILL.md +55 -55
  728. package/skills/clean-code/SKILL.md +367 -367
  729. package/skills/cloud-architect/SKILL.md +409 -409
  730. package/skills/cobejs/SKILL.md +70 -70
  731. package/skills/code-review-checklist/SKILL.md +163 -163
  732. package/skills/codebase-design/SKILL.md +76 -76
  733. package/skills/colorize/SKILL.md +57 -57
  734. package/skills/compact-landing/SKILL.md +50 -50
  735. package/skills/company-logos/SKILL.md +54 -54
  736. package/skills/config-validator/SKILL.md +125 -125
  737. package/skills/containerization-pro/SKILL.md +422 -422
  738. package/skills/context-engineering-pro/SKILL.md +69 -69
  739. package/skills/create-design-md/SKILL.md +92 -92
  740. package/skills/critique/SKILL.md +79 -79
  741. package/skills/csharp-developer/SKILL.md +478 -478
  742. package/skills/data-validation-schemas/SKILL.md +297 -297
  743. package/skills/database-design/SKILL.md +219 -219
  744. package/skills/delight/SKILL.md +46 -46
  745. package/skills/deployment-procedures/SKILL.md +132 -132
  746. package/skills/design-lab/SKILL.md +42 -42
  747. package/skills/devops-engineer/SKILL.md +305 -305
  748. package/skills/devops-incident-responder/SKILL.md +103 -103
  749. package/skills/diagnosing-bugs/SKILL.md +172 -172
  750. package/skills/distill/SKILL.md +45 -45
  751. package/skills/documentation-templates/SKILL.md +251 -251
  752. package/skills/domain-modeling/SKILL.md +61 -61
  753. package/skills/duckdb-analytical-sql/SKILL.md +51 -51
  754. package/skills/edge-ai-mobile/SKILL.md +42 -42
  755. package/skills/edge-computing/SKILL.md +143 -143
  756. package/skills/emil-design-eng/SKILL.md +134 -134
  757. package/skills/error-resilience/SKILL.md +403 -403
  758. package/skills/expo-router-v4/SKILL.md +72 -72
  759. package/skills/extract-design-system/SKILL.md +120 -120
  760. package/skills/fabel-protocol/SKILL.md +282 -282
  761. package/skills/failure-mode-analysis/SKILL.md +48 -0
  762. package/skills/fixing-accessibility/SKILL.md +87 -87
  763. package/skills/fixing-metadata/SKILL.md +83 -83
  764. package/skills/fixing-motion-performance/SKILL.md +78 -78
  765. package/skills/framer-motion-expert/SKILL.md +237 -237
  766. package/skills/frontend-design/SKILL.md +103 -103
  767. package/skills/frontend-security-expert/SKILL.md +56 -56
  768. package/skills/game-design-expert/SKILL.md +92 -92
  769. package/skills/game-engineering-expert/SKILL.md +108 -108
  770. package/skills/generative-ui-expert/SKILL.md +100 -100
  771. package/skills/geo-fundamentals/SKILL.md +108 -108
  772. package/skills/git-pro/SKILL.md +401 -401
  773. package/skills/github-operations/SKILL.md +295 -295
  774. package/skills/gpt-taste/SKILL.md +50 -50
  775. package/skills/graph-engineering/SKILL.md +28 -28
  776. package/skills/gsap-core/SKILL.md +277 -277
  777. package/skills/gsap-frameworks/SKILL.md +168 -168
  778. package/skills/gsap-performance/SKILL.md +94 -94
  779. package/skills/gsap-plugins/SKILL.md +441 -441
  780. package/skills/gsap-react/SKILL.md +213 -213
  781. package/skills/gsap-scrolltrigger/SKILL.md +312 -312
  782. package/skills/gsap-timeline/SKILL.md +122 -122
  783. package/skills/gsap-utils/SKILL.md +299 -299
  784. package/skills/harden/SKILL.md +55 -55
  785. package/skills/harness-protocol/SKILL.md +48 -48
  786. package/skills/huggingface-spaces/SKILL.md +1 -1
  787. package/skills/human-gate-negotiation/SKILL.md +30 -30
  788. package/skills/i18n-localization/SKILL.md +134 -134
  789. package/skills/impeccable/SKILL.md +52 -52
  790. package/skills/improve-codebase-architecture/SKILL.md +48 -48
  791. package/skills/improve-ui/SKILL.md +70 -70
  792. package/skills/intelligent-routing/SKILL.md +204 -204
  793. package/skills/knowledge-graph/SKILL.md +71 -71
  794. package/skills/landing-page/SKILL.md +65 -65
  795. package/skills/lint-and-validate/SKILL.md +224 -224
  796. package/skills/llm-engineering/SKILL.md +360 -360
  797. package/skills/local-first/SKILL.md +138 -138
  798. package/skills/local-first-architecture/SKILL.md +62 -62
  799. package/skills/lottie-animation/SKILL.md +62 -62
  800. package/skills/marquee-loop/SKILL.md +72 -72
  801. package/skills/masked-reveal/SKILL.md +230 -230
  802. package/skills/mcp-builder/SKILL.md +105 -105
  803. package/skills/micro-interaction/SKILL.md +253 -253
  804. package/skills/mobile-design/SKILL.md +245 -245
  805. package/skills/monorepo-management/SKILL.md +295 -295
  806. package/skills/morphing-icons/SKILL.md +348 -348
  807. package/skills/motion-engineering/SKILL.md +197 -197
  808. package/skills/nextjs-react-expert/SKILL.md +218 -218
  809. package/skills/nodejs-best-practices/SKILL.md +542 -542
  810. package/skills/observability/SKILL.md +303 -303
  811. package/skills/opentelemetry-observability/SKILL.md +51 -51
  812. package/skills/page-transition-animation/SKILL.md +86 -86
  813. package/skills/parallel-agents/SKILL.md +110 -110
  814. package/skills/performance-profiling/SKILL.md +230 -230
  815. package/skills/plan-writing/SKILL.md +127 -127
  816. package/skills/platform-engineer/SKILL.md +108 -108
  817. package/skills/platform-engineering-opentofu/SKILL.md +59 -59
  818. package/skills/playwright-ai-e2e/SKILL.md +52 -52
  819. package/skills/playwright-best-practices/SKILL.md +149 -149
  820. package/skills/polish/SKILL.md +39 -39
  821. package/skills/powershell-windows/SKILL.md +122 -122
  822. package/skills/pricing-page/SKILL.md +48 -48
  823. package/skills/product-aware-heuristics/SKILL.md +390 -390
  824. package/skills/progressive-blur/SKILL.md +80 -80
  825. package/skills/project-idioms/SKILL.md +91 -91
  826. package/skills/property-based-testing/SKILL.md +50 -50
  827. package/skills/python-patterns/SKILL.md +220 -220
  828. package/skills/python-pro/SKILL.md +305 -305
  829. package/skills/quieter/SKILL.md +49 -49
  830. package/skills/react-doctor/SKILL.md +51 -51
  831. package/skills/react-specialist/SKILL.md +280 -280
  832. package/skills/readme-builder/SKILL.md +270 -270
  833. package/skills/realtime-patterns/SKILL.md +283 -283
  834. package/skills/red-team-tactics/SKILL.md +191 -191
  835. package/skills/redesign-skill/SKILL.md +46 -46
  836. package/skills/review-animations/SKILL.md +45 -45
  837. package/skills/review-animations/STANDARDS.md +87 -87
  838. package/skills/rust-pro/SKILL.md +652 -652
  839. package/skills/semantic-filesystem-navigation/SKILL.md +24 -24
  840. package/skills/seo-fundamentals/SKILL.md +139 -139
  841. package/skills/server-management/SKILL.md +178 -178
  842. package/skills/session-log-interrogation/SKILL.md +29 -29
  843. package/skills/shadcn-ui-expert/SKILL.md +196 -196
  844. package/skills/shape/SKILL.md +56 -56
  845. package/skills/skill-creator/SKILL.md +177 -177
  846. package/skills/soft-skill/SKILL.md +53 -53
  847. package/skills/sounds-on-the-web/SKILL.md +76 -76
  848. package/skills/sql-pro/SKILL.md +624 -624
  849. package/skills/subagent-driven-development/SKILL.md +32 -32
  850. package/skills/supabase-postgres-best-practices/SKILL.md +57 -57
  851. package/skills/svg-animation/SKILL.md +356 -356
  852. package/skills/swiftui-expert/SKILL.md +164 -164
  853. package/skills/swiss-design/SKILL.md +44 -44
  854. package/skills/system-design-pro/SKILL.md +188 -318
  855. package/skills/systematic-debugging/SKILL.md +129 -129
  856. package/skills/systematic-debugging/condition-based-waiting.md +120 -120
  857. package/skills/systematic-debugging/defense-in-depth.md +128 -128
  858. package/skills/systematic-debugging/root-cause-tracing.md +183 -183
  859. package/skills/tailwind-patterns/SKILL.md +583 -583
  860. package/skills/taste-skill/SKILL.md +52 -52
  861. package/skills/tdd-workflow/SKILL.md +105 -105
  862. package/skills/test-result-analyzer/SKILL.md +270 -270
  863. package/skills/testing-patterns/SKILL.md +534 -534
  864. package/skills/thermo-nuclear-code-quality-review/SKILL.md +62 -62
  865. package/skills/thinking-protocol/SKILL.md +21 -21
  866. package/skills/to-spring-or-not-to-spring/SKILL.md +43 -43
  867. package/skills/transformers-js/references/CONFIGURATION.md +1 -1
  868. package/skills/transitions-dev/SKILL.md +90 -90
  869. package/skills/trend-researcher/SKILL.md +198 -198
  870. package/skills/tribunal-instincts-memory/SKILL.md +31 -31
  871. package/skills/typescript-advanced/SKILL.md +306 -306
  872. package/skills/typeset/SKILL.md +60 -60
  873. package/skills/ui-reasoning-engine/SKILL.md +155 -155
  874. package/skills/ui-skill-packs/SKILL.md +57 -57
  875. package/skills/ui-skills-root/SKILL.md +69 -69
  876. package/skills/ui-ux-pro-max/SKILL.md +110 -110
  877. package/skills/ui-ux-researcher/SKILL.md +199 -199
  878. package/skills/vector-search-pgvector/SKILL.md +70 -70
  879. package/skills/verification-before-completion/SKILL.md +107 -107
  880. package/skills/vue-expert/SKILL.md +259 -259
  881. package/skills/vulnerability-scanner/SKILL.md +378 -378
  882. package/skills/web-accessibility-auditor/SKILL.md +179 -179
  883. package/skills/web-design-guidelines/SKILL.md +49 -49
  884. package/skills/web-quality-audit/SKILL.md +47 -47
  885. package/skills/webapp-testing/SKILL.md +128 -128
  886. package/skills/webgpu-performance/SKILL.md +88 -88
  887. package/skills/whimsy-injector/SKILL.md +305 -305
  888. package/skills/workflow-optimizer/SKILL.md +188 -188
  889. package/skills/zero-trust-passkeys/SKILL.md +82 -82
  890. package/{dist → src}/browser/audit.js +229 -229
  891. package/{dist → src}/browser/case_bridge.js +189 -189
  892. package/{dist → src}/browser/cdp.js +513 -513
  893. package/{dist → src}/browser/compare.js +110 -110
  894. package/{dist → src}/browser/discovery.js +140 -140
  895. package/{dist → src}/browser/idpi.js +142 -142
  896. package/{dist → src}/browser/index.js +89 -89
  897. package/{dist → src}/browser/launcher.js +154 -154
  898. package/{dist → src}/browser/sentinel.js +202 -202
  899. package/{dist → src}/browser/synapse.js +251 -251
  900. package/{dist → src}/browser/trimmer.js +210 -210
  901. package/{dist → src}/commands/align.js +201 -201
  902. package/{dist → src}/commands/audit-web.js +112 -112
  903. package/{dist → src}/commands/browse.js +56 -56
  904. package/{dist → src}/commands/case.js +71 -73
  905. package/{dist → src}/commands/compare-web.js +61 -61
  906. package/{dist → src}/commands/compile.js +91 -91
  907. package/{dist → src}/commands/context.js +71 -71
  908. package/{dist → src}/commands/contract.js +440 -440
  909. package/{dist → src}/commands/deconstruct.js +58 -58
  910. package/{dist → src}/commands/graph.js +44 -44
  911. package/{dist → src}/commands/guardrail.js +275 -275
  912. package/{dist → src}/commands/heal.js +99 -99
  913. package/{dist → src}/commands/hook.js +28 -28
  914. package/{dist → src}/commands/init.js +393 -393
  915. package/{dist → src}/commands/learn.js +119 -117
  916. package/{dist → src}/commands/marathon.js +45 -45
  917. package/{dist → src}/commands/memory.js +508 -508
  918. package/{dist → src}/commands/minimal.js +71 -71
  919. package/{dist → src}/commands/mutate.js +30 -30
  920. package/{dist → src}/commands/native.js +264 -264
  921. package/{dist → src}/commands/optimize.js +332 -328
  922. package/{dist → src}/commands/sdd.js +265 -229
  923. package/{dist → src}/commands/status.js +66 -66
  924. package/{dist → src}/commands/sync.js +25 -25
  925. package/{dist → src}/commands/uninstall.js +54 -54
  926. package/{dist → src}/commands/update.js +37 -37
  927. package/{dist → src}/commands/validate.js +58 -58
  928. package/{dist → src}/esm/index.mjs +1 -1
  929. package/{dist → src}/mcp/server.js +8 -8
  930. package/{dist → src}/tui/banner.js +1 -1
  931. package/{dist → src}/tui/index.js +21 -21
  932. package/{dist → src}/tui/reviewer-grid.js +90 -90
  933. package/{dist → src}/tui/shimmer.js +91 -91
  934. package/{dist → src}/tui/theme.js +130 -130
  935. package/{dist → src}/tui/tree.js +93 -93
  936. package/{dist → src}/tui/wizard.js +148 -148
  937. package/{dist → src}/types.js +8 -8
  938. package/{dist → src}/utils/fs.js +102 -102
  939. package/{dist → src}/utils/hasher.js +142 -142
  940. package/{dist → src}/utils/helpers.js +53 -53
  941. package/{dist → src}/utils/logger.js +54 -54
  942. package/{dist → src}/utils/version.js +157 -157
  943. package/.agent/history/README.md +0 -53
  944. package/.agent/history/architecture-explorer.html +0 -352
  945. package/.agent/history/architecture-graph.yaml +0 -619
  946. package/.agent/history/case-law/cases/template-case.json +0 -19
  947. package/.agent/history/graph-cache.json +0 -1042
  948. package/.agent/history/integrity_manifest.json +0 -4694
  949. package/.agent/history/memory/.memory.idx +0 -7596
  950. package/.agent/history/memory/MEMORY.md +0 -512
  951. package/.agent/history/memory.db +0 -0
  952. package/.agent/history/snapshots/.opencode__plugins__tribunal.js.json +0 -12
  953. package/.agent/history/snapshots/.pi__extensions__tribunal.ts.json +0 -12
  954. package/.agent/history/snapshots/bin__adapter-install.js.json +0 -13
  955. package/.agent/history/snapshots/bin__global-store.js.json +0 -15
  956. package/.agent/history/snapshots/bin__mcp-server.js.json +0 -21
  957. package/.agent/history/snapshots/bin__proxy-server.js.json +0 -20
  958. package/.agent/history/snapshots/bin__spawn-agent.js.json +0 -12
  959. package/.agent/history/snapshots/bin__tk-proxy.js.json +0 -21
  960. package/.agent/history/snapshots/bin__tribunal-kit.js.json +0 -21
  961. package/.agent/history/snapshots/bin__wrapper.js.json +0 -14
  962. package/.agent/history/snapshots/eslint.config.js.json +0 -8
  963. package/.agent/history/snapshots/hooks__session-start.js.json +0 -11
  964. package/.agent/history/snapshots/scripts__apply-version.js.json +0 -11
  965. package/.agent/history/snapshots/scripts__audit_skill_sdo.js.json +0 -11
  966. package/.agent/history/snapshots/scripts__benchmark.js.json +0 -14
  967. package/.agent/history/snapshots/scripts__changelog.js.json +0 -12
  968. package/.agent/history/snapshots/scripts__clean-pycache.js.json +0 -11
  969. package/.agent/history/snapshots/scripts__context_compiler.js.json +0 -17
  970. package/.agent/history/snapshots/scripts__fix-vbc.js.json +0 -11
  971. package/.agent/history/snapshots/scripts__modernize_skills.js.json +0 -11
  972. package/.agent/history/snapshots/scripts__package-cores.js.json +0 -12
  973. package/.agent/history/snapshots/scripts__skill_enhancement_engine.js.json +0 -11
  974. package/.agent/history/snapshots/scripts__stress_benchmark.js.json +0 -15
  975. package/.agent/history/snapshots/scripts__sync-skills.js.json +0 -11
  976. package/.agent/history/snapshots/scripts__sync-version.js.json +0 -11
  977. package/.agent/history/snapshots/scripts__telemetry_gc.js.json +0 -11
  978. package/.agent/history/snapshots/scripts__validate-payload.js.json +0 -11
  979. package/.agent/history/snapshots/scripts__visual_audit.js.json +0 -11
  980. package/.agent/history/snapshots/test__integration__bridges.test.js.json +0 -13
  981. package/.agent/history/snapshots/test__integration__browser_cli.test.js.json +0 -12
  982. package/.agent/history/snapshots/test__integration__graceful_degradation.test.js.json +0 -12
  983. package/.agent/history/snapshots/test__integration__init.test.js.json +0 -13
  984. package/.agent/history/snapshots/test__integration__minimal_change_pipeline.test.js.json +0 -13
  985. package/.agent/history/snapshots/test__integration__parallel_tribunal.test.js.json +0 -12
  986. package/.agent/history/snapshots/test__integration__routing.test.js.json +0 -11
  987. package/.agent/history/snapshots/test__integration__swarm_dispatcher.test.js.json +0 -13
  988. package/.agent/history/snapshots/test__integration__sync_status.test.js.json +0 -13
  989. package/.agent/history/snapshots/test__integration__wave2.test.js.json +0 -13
  990. package/.agent/history/snapshots/test__integration__wrapper.test.js.json +0 -13
  991. package/.agent/history/snapshots/test__unit__align.test.js.json +0 -10
  992. package/.agent/history/snapshots/test__unit__args.test.js.json +0 -20
  993. package/.agent/history/snapshots/test__unit__ast_context_loader.test.js.json +0 -12
  994. package/.agent/history/snapshots/test__unit__audit_release.test.js.json +0 -16
  995. package/.agent/history/snapshots/test__unit__browser_case_bridge.test.js.json +0 -11
  996. package/.agent/history/snapshots/test__unit__browser_discovery.test.js.json +0 -10
  997. package/.agent/history/snapshots/test__unit__browser_idpi.test.js.json +0 -10
  998. package/.agent/history/snapshots/test__unit__browser_sentinel.test.js.json +0 -11
  999. package/.agent/history/snapshots/test__unit__browser_synapse.test.js.json +0 -10
  1000. package/.agent/history/snapshots/test__unit__browser_trimmer.test.js.json +0 -10
  1001. package/.agent/history/snapshots/test__unit__case_law_manager.test.js.json +0 -10
  1002. package/.agent/history/snapshots/test__unit__cicd_validator.test.js.json +0 -12
  1003. package/.agent/history/snapshots/test__unit__compile.test.js.json +0 -10
  1004. package/.agent/history/snapshots/test__unit__context_broker.test.js.json +0 -10
  1005. package/.agent/history/snapshots/test__unit__context_compiler.test.js.json +0 -26
  1006. package/.agent/history/snapshots/test__unit__contract_engine.test.js.json +0 -13
  1007. package/.agent/history/snapshots/test__unit__copyDir.test.js.json +0 -23
  1008. package/.agent/history/snapshots/test__unit__graph_tools.test.js.json +0 -11
  1009. package/.agent/history/snapshots/test__unit__guardrail_engine.test.js.json +0 -10
  1010. package/.agent/history/snapshots/test__unit__impact_classifier.test.js.json +0 -12
  1011. package/.agent/history/snapshots/test__unit__init.test.js.json +0 -14
  1012. package/.agent/history/snapshots/test__unit__inner_loop_validator.test.js.json +0 -10
  1013. package/.agent/history/snapshots/test__unit__integrity_manifest.test.js.json +0 -13
  1014. package/.agent/history/snapshots/test__unit__learn.test.js.json +0 -11
  1015. package/.agent/history/snapshots/test__unit__marathon.test.js.json +0 -22
  1016. package/.agent/history/snapshots/test__unit__mcp_server.test.js.json +0 -16
  1017. package/.agent/history/snapshots/test__unit__memory.test.js.json +0 -13
  1018. package/.agent/history/snapshots/test__unit__minimal_change.test.js.json +0 -10
  1019. package/.agent/history/snapshots/test__unit__native.test.js.json +0 -10
  1020. package/.agent/history/snapshots/test__unit__optimize.test.js.json +0 -13
  1021. package/.agent/history/snapshots/test__unit__path_resolution.test.js.json +0 -14
  1022. package/.agent/history/snapshots/test__unit__platform_download_audit.test.js.json +0 -11
  1023. package/.agent/history/snapshots/test__unit__production_readiness_evidence.test.js.json +0 -21
  1024. package/.agent/history/snapshots/test__unit__prompt_compiler.test.js.json +0 -10
  1025. package/.agent/history/snapshots/test__unit__sdd_integration.test.js.json +0 -12
  1026. package/.agent/history/snapshots/test__unit__selfInstall.test.js.json +0 -23
  1027. package/.agent/history/snapshots/test__unit__semver.test.js.json +0 -20
  1028. package/.agent/history/snapshots/test__unit__skill_evolution.test.js.json +0 -11
  1029. package/.agent/history/snapshots/test__unit__stress.test.js.json +0 -15
  1030. package/.agent/history/snapshots/test__unit__swarm_dispatcher.test.js.json +0 -12
  1031. package/.agent/history/snapshots/test__unit__token_budget_broker.test.js.json +0 -10
  1032. package/.agent/history/snapshots/test__unit__tui.test.js.json +0 -10
  1033. package/.agent/history/snapshots/test__unit__utils.test.js.json +0 -10
  1034. package/.agents/plugins/marketplace.json +0 -20
  1035. package/.claude/CLAUDE.md +0 -442
  1036. /package/{dist → src}/cli.js +0 -0
  1037. /package/{dist → src}/index.d.ts +0 -0
@@ -1,17 +0,0 @@
1
- {
2
- "file": "scripts/context_compiler.js",
3
- "riskScore": "Low",
4
- "blastRadius": 1,
5
- "imports": {
6
- "fs": [],
7
- "path": [],
8
- "crypto": [],
9
- "child_process": [],
10
- "./_colors": [],
11
- "../.agent/scripts/_colors": []
12
- },
13
- "dependents": [
14
- "test/unit/context_compiler.test.js"
15
- ],
16
- "content": "#!/usr/bin/env node\n/**\n * context_compiler.js — Tribunal Kit SOTA Context Compiler Engine\n * ════════════════════════════════════════════════════════════════════\n * Deterministic, high-speed context extraction engine for:\n * 1. Single Files (Flight Data HUD Dossier)\n * 2. Multi-File Pairs (Interface Bridge Dossier)\n * 3. Project Folders (Subsystem Macro Dossier)\n * 4. Batch Vault Crawling (--crawl)\n * 5. Semantic Drift Sentinel (--check)\n *\n * Designed for both CLI execution and in-process MCP server integration.\n */\n\n'use strict';\n\nconst fs = require('fs');\nconst path = require('path');\nconst crypto = require('crypto');\nconst { execSync } = require('child_process');\n\n// Optional ANSI colors\nlet C = {\n GREEN: '\\x1b[92m',\n YELLOW: '\\x1b[93m',\n CYAN: '\\x1b[96m',\n RED: '\\x1b[91m',\n BLUE: '\\x1b[94m',\n BOLD: '\\x1b[1m',\n DIM: '\\x1b[2m',\n RESET: '\\x1b[0m',\n};\n\ntry {\n const colorsMod = require('./_colors');\n if (colorsMod) C = Object.assign({}, C, colorsMod);\n} catch {\n try {\n const colorsMod = require('../.agent/scripts/_colors');\n if (colorsMod) C = Object.assign({}, C, colorsMod);\n } catch {\n // Fallback C used\n }\n}\n\n// ── Hashing Helpers ─────────────────────────────────────────────────────────\n\nfunction computeSha256(content) {\n const normalized = content.replace(/\\r\\n/g, '\\n').trim();\n return crypto.createHash('sha256').update(normalized, 'utf8').digest('hex').substring(0, 16);\n}\n\nfunction computeInterfaceHash(signatures) {\n const text = signatures\n .map(s => `${s.kind}:${s.name}:${s.signature}`)\n .sort()\n .join('\\n');\n return crypto.createHash('sha256').update(text, 'utf8').digest('hex').substring(0, 16);\n}\n\n// ── Multi-Language AST / Regex Skeleton Extractor ───────────────────────────\n\nfunction extractFileSkeleton(filePath, rawContent) {\n const ext = path.extname(filePath).toLowerCase();\n const lines = rawContent.split(/\\r?\\n/);\n const imports = [];\n const exports = [];\n const types = [];\n const landmines = [];\n\n // 1. Comments and Landmines (Chesterton's Fences)\n lines.forEach((line, idx) => {\n const trimmed = line.trim();\n if (\n trimmed.includes('// VERIFY') ||\n trimmed.includes('// NOTE') ||\n trimmed.includes('// FIX') ||\n trimmed.includes('// HACK') ||\n trimmed.includes('// CAUTION') ||\n trimmed.includes('// INVARIANT') ||\n trimmed.includes('// DO NOT') ||\n trimmed.includes('# VERIFY') ||\n trimmed.includes('# NOTE')\n ) {\n landmines.push({\n line: idx + 1,\n content: trimmed,\n });\n }\n });\n\n // 2. Language-Specific Parsers\n if (ext === '.ts' || ext === '.tsx' || ext === '.js' || ext === '.jsx' || ext === '.mjs') {\n // Phase 1: Try Rust AST Extraction\n try {\n const absPath = path.resolve(process.cwd(), filePath);\n const binName = process.platform === 'win32' ? 'tribunal-core.exe' : 'tribunal-core';\n // Use release build if available, otherwise debug\n let corePath = path.join(__dirname, '..', 'crates', 'core', 'target', 'release', binName);\n if (!fs.existsSync(corePath)) {\n corePath = path.join(__dirname, '..', 'crates', 'core', 'target', 'debug', binName);\n }\n \n if (fs.existsSync(corePath)) {\n const result = require('child_process').execSync(`\"${corePath}\" ast-extract --file \"${absPath}\"`, { encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] });\n const data = JSON.parse(result);\n if (data && data.success) {\n // We map the Rust JSON into the exact format expected by the rest of the JS code\n const mappedImports = data.imports.map(i => ({ source: i.source, specifiers: i.specifiers, line: 0 }));\n const mappedExports = data.exports.map(e => ({ kind: e.kind, name: e.name, signature: e.signature, line: 0 }));\n const mappedTypes = data.types.map(t => ({ kind: t.kind, name: t.name, signature: t.signature, line: 0 }));\n \n return {\n imports: mappedImports,\n exports: mappedExports,\n types: mappedTypes,\n landmines: data.landmines,\n interfaceHash: computeInterfaceHash(mappedExports.concat(mappedTypes))\n };\n }\n }\n } catch(e) {\n // Silent fallback to Regex parsing\n }\n\n lines.forEach((line, idx) => {\n const trimmed = line.trim();\n\n // Imports\n const importMatch = trimmed.match(\n /^import\\s+(?:type\\s+)?(?:(.+?)\\s+from\\s+)?['\"]([^'\"]+)['\"]/,\n );\n if (importMatch) {\n imports.push({\n source: importMatch[2],\n specifiers: importMatch[1] ? importMatch[1].trim() : '*',\n line: idx + 1,\n });\n }\n const requireMatch = trimmed.match(\n /(?:const|let|var)\\s+(.+?)\\s*=\\s*require\\(['\"]([^'\"]+)['\"]\\)/,\n );\n if (requireMatch) {\n imports.push({\n source: requireMatch[2],\n specifiers: requireMatch[1].trim(),\n line: idx + 1,\n });\n }\n\n // Exports\n const exportFunc = trimmed.match(\n /^export\\s+(?:default\\s+)?(?:async\\s+)?function\\s+(\\w+)\\s*(\\(.*?\\))/,\n );\n if (exportFunc) {\n exports.push({\n kind: 'function',\n name: exportFunc[1],\n signature: `function ${exportFunc[1]}${exportFunc[2]}`,\n line: idx + 1,\n });\n }\n\n const exportConst = trimmed.match(\n /^export\\s+const\\s+(\\w+)(?:\\s*:\\s*([^=]+))?\\s*=\\s*(?:async\\s+)?(?:\\((.*?)\\)|(\\w+))\\s*=>/,\n );\n if (exportConst) {\n exports.push({\n kind: 'arrow_function',\n name: exportConst[1],\n signature: `const ${exportConst[1]}: (${exportConst[3] || exportConst[4] || ''}) => ...`,\n line: idx + 1,\n });\n }\n\n const exportClass = trimmed.match(\n /^export\\s+(?:default\\s+)?class\\s+(\\w+)(?:\\s+extends\\s+(\\w+))?/,\n );\n if (exportClass) {\n exports.push({\n kind: 'class',\n name: exportClass[1],\n signature: `class ${exportClass[1]}${exportClass[2] ? ' extends ' + exportClass[2] : ''}`,\n line: idx + 1,\n });\n }\n\n // Types & Interfaces\n const exportType = trimmed.match(/^export\\s+type\\s+(\\w+)(?:<.*?>)?\\s*=/);\n if (exportType) {\n types.push({\n kind: 'type',\n name: exportType[1],\n signature: trimmed.replace(/;?$/, ''),\n line: idx + 1,\n });\n }\n\n const exportInterface = trimmed.match(\n /^export\\s+interface\\s+(\\w+)(?:<.*?>)?(?:\\s+extends\\s+.*?)?\\s*\\{?/,\n );\n if (exportInterface) {\n types.push({\n kind: 'interface',\n name: exportInterface[1],\n signature: trimmed.replace(/\\{?$/, '').trim(),\n line: idx + 1,\n });\n }\n });\n } else if (ext === '.rs') {\n lines.forEach((line, idx) => {\n const trimmed = line.trim();\n\n // Use statements\n const useMatch = trimmed.match(/^(?:pub\\s+)?use\\s+([^;]+);/);\n if (useMatch) {\n imports.push({\n source: useMatch[1].trim(),\n specifiers: useMatch[1].trim(),\n line: idx + 1,\n });\n }\n\n // Public Functions\n const pubFn = trimmed.match(\n /^pub(?:\\(.*?\\))?\\s+(?:async\\s+)?fn\\s+(\\w+)(?:<.*?>)?\\s*(\\(.*?\\))(?:\\s*->\\s*([^{;]+))?/,\n );\n if (pubFn) {\n exports.push({\n kind: 'function',\n name: pubFn[1],\n signature: `pub fn ${pubFn[1]}${pubFn[2]}${pubFn[3] ? ' -> ' + pubFn[3].trim() : ''}`,\n line: idx + 1,\n });\n }\n\n // Structs & Enums\n const pubStruct = trimmed.match(/^pub(?:\\(.*?\\))?\\s+struct\\s+(\\w+)/);\n if (pubStruct) {\n types.push({\n kind: 'struct',\n name: pubStruct[1],\n signature: `pub struct ${pubStruct[1]}`,\n line: idx + 1,\n });\n }\n\n const pubEnum = trimmed.match(/^pub(?:\\(.*?\\))?\\s+enum\\s+(\\w+)/);\n if (pubEnum) {\n types.push({\n kind: 'enum',\n name: pubEnum[1],\n signature: `pub enum ${pubEnum[1]}`,\n line: idx + 1,\n });\n }\n\n const pubTrait = trimmed.match(/^pub(?:\\(.*?\\))?\\s+trait\\s+(\\w+)/);\n if (pubTrait) {\n types.push({\n kind: 'trait',\n name: pubTrait[1],\n signature: `pub trait ${pubTrait[1]}`,\n line: idx + 1,\n });\n }\n });\n } else if (ext === '.py') {\n lines.forEach((line, idx) => {\n const trimmed = line.trim();\n\n const importMatch = trimmed.match(/^(?:from\\s+([\\w.]+)\\s+)?import\\s+(.+)$/);\n if (importMatch) {\n imports.push({\n source: importMatch[1] || importMatch[2],\n specifiers: importMatch[2],\n line: idx + 1,\n });\n }\n\n const defMatch = trimmed.match(\n /^(?:async\\s+)?def\\s+([a-zA-Z_]\\w*)\\s*(\\(.*?\\))(?:\\s*->\\s*([^:]+))?:/,\n );\n if (defMatch && !defMatch[1].startsWith('_')) {\n exports.push({\n kind: 'function',\n name: defMatch[1],\n signature: `def ${defMatch[1]}${defMatch[2]}${defMatch[3] ? ' -> ' + defMatch[3].trim() : ''}`,\n line: idx + 1,\n });\n }\n\n const classMatch = trimmed.match(/^class\\s+([a-zA-Z_]\\w*)(?:\\((.*?)\\))?:/);\n if (classMatch && !classMatch[1].startsWith('_')) {\n types.push({\n kind: 'class',\n name: classMatch[1],\n signature: `class ${classMatch[1]}${classMatch[2] ? '(' + classMatch[2] + ')' : ''}`,\n line: idx + 1,\n });\n }\n });\n }\n\n const allSignatures = exports.concat(types);\n const interfaceHash = computeInterfaceHash(allSignatures);\n\n return {\n imports,\n exports,\n types,\n landmines,\n interfaceHash,\n };\n}\n\n// ── Inbound Callers Discovery ───────────────────────────────────────────────\n\nfunction findInboundCallers(targetFilePath, exportNames, workspaceRoot = process.cwd()) {\n const callers = [];\n const baseName = path.basename(targetFilePath);\n const stem = baseName.replace(/\\.[^.]+$/, '');\n const relativeTarget = path.relative(workspaceRoot, targetFilePath).replace(/\\\\/g, '/');\n\n // Search tokens: module stem and exported symbol names\n const searchTokens = new Set([stem]);\n exportNames.slice(0, 8).forEach(n => searchTokens.add(n));\n\n // Try using git grep or ripgrep if available\n const grepOutputs = [];\n try {\n for (const token of searchTokens) {\n if (!token || token.length < 3) continue;\n try {\n const cmd = `git grep -n -I \"${token}\" -- \":!docs/\" \":!node_modules/\" \":!dist/\" \":!target/\" \":!*.lock\"`;\n const res = execSync(cmd, {\n cwd: workspaceRoot,\n stdio: ['ignore', 'pipe', 'ignore'],\n encoding: 'utf8',\n });\n if (res) grepOutputs.push(...res.split('\\n').filter(Boolean));\n } catch {\n // Ripgrep fallback\n try {\n const cmd = `rg -n --no-heading --color=never \"${token}\" -g \"!docs/**\" -g \"!node_modules/**\" -g \"!target/**\" -g \"!dist/**\"`;\n const res = execSync(cmd, {\n cwd: workspaceRoot,\n stdio: ['ignore', 'pipe', 'ignore'],\n encoding: 'utf8',\n });\n if (res) grepOutputs.push(...res.split('\\n').filter(Boolean));\n } catch {\n // Silent catch\n }\n }\n }\n } catch {\n // Grep unavailable\n }\n\n const seenSites = new Set();\n\n for (const line of grepOutputs) {\n const parts = line.split(':');\n if (parts.length < 3) continue;\n const callerFile = parts[0].replace(/\\\\/g, '/');\n const lineNum = parseInt(parts[1], 10);\n const lineContent = parts.slice(2).join(':').trim();\n\n // Ignore self-references and context docs\n if (\n callerFile === relativeTarget ||\n callerFile.includes('.context.md') ||\n callerFile.includes('INDEX.md')\n ) {\n continue;\n }\n\n const key = `${callerFile}:${lineNum}`;\n if (seenSites.has(key)) continue;\n seenSites.add(key);\n\n callers.push({\n file: callerFile,\n line: lineNum,\n snippet: lineContent.substring(0, 100),\n isDirectImport:\n lineContent.includes('import') ||\n lineContent.includes('require') ||\n lineContent.includes('use '),\n });\n\n if (callers.length >= 12) break; // Cap callers for token efficiency\n }\n\n return callers;\n}\n\n// ── Test & Skill Discovery ──────────────────────────────────────────────────\n\nfunction discoverTests(targetFilePath, workspaceRoot = process.cwd()) {\n const tests = [];\n const baseName = path.basename(targetFilePath);\n const stem = baseName.replace(/\\.[^.]+$/, '');\n\n const testPatterns = [`${stem}.test.`, `${stem}.spec.`, `${stem}_test.`, `test_${stem}.`];\n\n function walk(dir) {\n if (!fs.existsSync(dir)) return;\n try {\n const entries = fs.readdirSync(dir, { withFileTypes: true });\n for (const entry of entries) {\n if (\n entry.name === 'node_modules' ||\n entry.name === 'target' ||\n entry.name === '.git' ||\n entry.name === 'dist'\n ) {\n continue;\n }\n const full = path.join(dir, entry.name);\n if (entry.isDirectory()) {\n // Only walk tests dirs or immediate directories\n if (\n entry.name === 'tests' ||\n entry.name === '__tests__' ||\n entry.name === 'test' ||\n entry.name === 'crates'\n ) {\n walk(full);\n }\n } else if (entry.isFile()) {\n for (const pat of testPatterns) {\n if (entry.name.includes(pat)) {\n tests.push(path.relative(workspaceRoot, full).replace(/\\\\/g, '/'));\n break;\n }\n }\n }\n }\n } catch {\n // Ignore read errors\n }\n }\n\n walk(workspaceRoot);\n return Array.from(new Set(tests)).slice(0, 5);\n}\n\nfunction resolveSkills(targetFilePath, content) {\n const skills = [];\n const ext = path.extname(targetFilePath).toLowerCase();\n const lowerContent = content.toLowerCase();\n\n if (ext === '.rs') skills.push('rust-pro');\n if (ext === '.py') skills.push('python-pro');\n if (ext === '.ts' || ext === '.tsx' || ext === '.js') {\n if (lowerContent.includes('react') || ext.endsWith('x')) skills.push('react-specialist');\n else skills.push('clean-code');\n }\n\n if (\n lowerContent.includes('auth') ||\n lowerContent.includes('jwt') ||\n lowerContent.includes('token') ||\n lowerContent.includes('crypto')\n ) {\n skills.push('backend-security-expert');\n }\n if (\n lowerContent.includes('query') ||\n lowerContent.includes('prisma') ||\n lowerContent.includes('sql') ||\n lowerContent.includes('database')\n ) {\n skills.push('database-architect');\n }\n if (\n lowerContent.includes('compress') ||\n lowerContent.includes('tokens') ||\n lowerContent.includes('prompt')\n ) {\n skills.push('context-engineering-pro');\n }\n\n skills.push('fabel-protocol');\n return Array.from(new Set(skills));\n}\n\nfunction resolvePath(targetPath, workspaceRoot = process.cwd()) {\n const clean = targetPath.replace(/^['\"]|['\"]$/g, '');\n if (path.isAbsolute(clean) && fs.existsSync(clean)) return clean;\n\n const direct = path.resolve(workspaceRoot, clean);\n if (fs.existsSync(direct)) return direct;\n\n if (clean.startsWith('tribunal-kit/') || clean.startsWith('tribunal-kit\\\\')) {\n const stripped = clean.replace(/^tribunal-kit[/\\\\]/, '');\n const strippedPath = path.resolve(workspaceRoot, stripped);\n if (fs.existsSync(strippedPath)) return strippedPath;\n }\n\n const parentPath = path.resolve(workspaceRoot, '..', clean);\n if (fs.existsSync(parentPath)) return parentPath;\n\n return direct;\n}\n\nfunction getDocsDir(workspaceRoot = process.cwd()) {\n const local = path.join(workspaceRoot, 'docs', 'context');\n if (fs.existsSync(local)) {\n try {\n const files = fs\n .readdirSync(local)\n .filter(f => f.endsWith('.context.md') || f.endsWith('.bridge.md'));\n if (files.length > 0) return local;\n } catch {\n // fallback\n }\n }\n const parent = path.join(workspaceRoot, '..', 'docs', 'context');\n if (fs.existsSync(parent)) {\n try {\n const files = fs\n .readdirSync(parent)\n .filter(f => f.endsWith('.context.md') || f.endsWith('.bridge.md'));\n if (files.length > 0) return parent;\n } catch {\n // fallback\n }\n }\n return local;\n}\n\n// ── Single-File Context Analysis ────────────────────────────────────────────\n\nfunction analyzeSingleFile(targetPath, workspaceRoot = process.cwd()) {\n const absPath = resolvePath(targetPath, workspaceRoot);\n if (!fs.existsSync(absPath)) {\n throw new Error(`File not found: ${absPath}`);\n }\n\n const rawContent = fs.readFileSync(absPath, 'utf8');\n const relativePath = path.relative(workspaceRoot, absPath).replace(/\\\\/g, '/');\n const sourceHash = computeSha256(rawContent);\n const skeleton = extractFileSkeleton(relativePath, rawContent);\n const exportNames = skeleton.exports.map(e => e.name).concat(skeleton.types.map(t => t.name));\n const callers = findInboundCallers(absPath, exportNames, workspaceRoot);\n const tests = discoverTests(absPath, workspaceRoot);\n const skills = resolveSkills(relativePath, rawContent);\n\n // Determine domain layer\n let domainLayer = 'Core Logic / Utility';\n if (relativePath.includes('api') || relativePath.includes('route'))\n domainLayer = 'API / Gateway Layer';\n else if (relativePath.includes('service')) domainLayer = 'Service / Business Logic';\n else if (\n relativePath.includes('model') ||\n relativePath.includes('schema') ||\n relativePath.includes('db')\n )\n domainLayer = 'Data / Persistence Layer';\n else if (relativePath.includes('components') || relativePath.includes('ui'))\n domainLayer = 'UI / Presentation Layer';\n else if (relativePath.includes('commands')) domainLayer = 'Command / Dispatch Layer';\n\n return {\n mode: 'single_file',\n filePath: relativePath,\n sourceHash,\n interfaceHash: skeleton.interfaceHash,\n domainLayer,\n imports: skeleton.imports,\n exports: skeleton.exports,\n types: skeleton.types,\n landmines: skeleton.landmines,\n callers,\n tests,\n skills,\n lineCount: rawContent.split('\\n').length,\n byteSize: Buffer.byteLength(rawContent, 'utf8'),\n };\n}\n\n// ── Multi-File Interface Bridge Analysis ────────────────────────────────────\n\nfunction analyzeMultiFileBridge(pathA, pathB, workspaceRoot = process.cwd()) {\n const metaA = analyzeSingleFile(pathA, workspaceRoot);\n const metaB = analyzeSingleFile(pathB, workspaceRoot);\n\n const aImportsB = metaA.imports.some(imp =>\n imp.source.includes(path.basename(metaB.filePath).replace(/\\.[^.]+$/, '')),\n );\n const bImportsA = metaB.imports.some(imp =>\n imp.source.includes(path.basename(metaA.filePath).replace(/\\.[^.]+$/, '')),\n );\n\n const sharedTypes = [];\n const typeNamesA = new Set(metaA.types.map(t => t.name));\n for (const t of metaB.types) {\n if (typeNamesA.has(t.name)) sharedTypes.push(t.name);\n }\n\n return {\n mode: 'multi_file_bridge',\n fileA: metaA,\n fileB: metaB,\n coupling: {\n aImportsB,\n bImportsA,\n sharedTypes,\n relationship:\n aImportsB && bImportsA\n ? 'Bidirectional Coupling'\n : aImportsB\n ? 'A depends on B'\n : bImportsA\n ? 'B depends on A'\n : 'Sibling / Peer Modules',\n },\n };\n}\n\n// ── Directory / Project Subsystem Analysis ──────────────────────────────────\n\nfunction analyzeDirectory(dirPath, workspaceRoot = process.cwd()) {\n const absDir = path.isAbsolute(dirPath) ? dirPath : path.resolve(workspaceRoot, dirPath);\n if (!fs.existsSync(absDir) || !fs.statSync(absDir).isDirectory()) {\n throw new Error(`Directory not found: ${absDir}`);\n }\n\n const relativeDir = path.relative(workspaceRoot, absDir).replace(/\\\\/g, '/') || '.';\n const manifests = [];\n const subsystems = [];\n let totalFiles = 0;\n const langCounts = {};\n\n const ignoreSet = new Set([\n 'node_modules',\n 'target',\n '.git',\n 'dist',\n 'coverage',\n '.gemini',\n 'build',\n ]);\n\n // Check top-level manifests\n if (fs.existsSync(path.join(absDir, 'package.json'))) manifests.push('package.json');\n if (fs.existsSync(path.join(absDir, 'Cargo.toml'))) manifests.push('Cargo.toml');\n if (fs.existsSync(path.join(absDir, 'pyproject.toml'))) manifests.push('pyproject.toml');\n\n const entries = fs.readdirSync(absDir, { withFileTypes: true });\n\n for (const entry of entries) {\n if (ignoreSet.has(entry.name) || entry.name.startsWith('.')) continue;\n const subFull = path.join(absDir, entry.name);\n if (entry.isDirectory()) {\n try {\n const subFiles = fs.readdirSync(subFull);\n subsystems.push({\n name: entry.name,\n fileCount: subFiles.length,\n keySample: subFiles.slice(0, 3).join(', '),\n });\n } catch {\n // Ignore unreadable\n }\n } else if (entry.isFile()) {\n totalFiles++;\n const ext = path.extname(entry.name).toLowerCase() || 'other';\n langCounts[ext] = (langCounts[ext] || 0) + 1;\n }\n }\n\n return {\n mode: 'directory_subsystem',\n dirPath: relativeDir,\n manifests,\n subsystems,\n directFiles: totalFiles,\n langCounts,\n };\n}\n\n// ── Markdown Dossier Generators ─────────────────────────────────────────────\n\nfunction renderSingleFileDossier(data) {\n const callersTable =\n data.callers.length > 0\n ? data.callers\n .map(\n c =>\n `| \\`${c.file}:${c.line}\\` | \\`${c.snippet}\\` | ${c.isDirectImport ? 'Direct Import' : 'Symbol Reference'} |`,\n )\n .join('\\n')\n : '| *None detected (potential root entrypoint or test)* | - | - |';\n\n const typesTable =\n data.exports.concat(data.types).length > 0\n ? data.exports\n .concat(data.types)\n .slice(0, 10)\n .map(s => `| \\`${s.name}\\` | \\`${s.kind}\\` | \\`${s.signature}\\` | Line ${s.line} |`)\n .join('\\n')\n : '| *No explicit exported symbols detected* | - | - | - |';\n\n const landminesContent =\n data.landmines.length > 0\n ? data.landmines.map(l => `> [!CAUTION]\\n> **Line ${l.line}:** \\`${l.content}\\``).join('\\n\\n')\n : '> [!NOTE]\\n> No explicit defensive comments (`// VERIFY`, `// NOTE`, `// HACK`) found in source code.';\n\n const testCommand = data.tests.length > 0 ? `npm test -- ${data.tests[0]}` : `npm test`;\n\n return `---\nversion: 2.0.0\nsource_file: \"${data.filePath}\"\nsource_hash: \"${data.sourceHash}\"\ninterface_hash: \"${data.interfaceHash}\"\nlast_synced: \"${new Date().toISOString().split('T')[0]}\"\ndomain_layer: \"${data.domainLayer}\"\nassociated_skills:\n${data.skills.map(s => ` - ${s}`).join('\\n')}\nassociated_tests:\n${data.tests.length > 0 ? data.tests.map(t => ` - ${t}`).join('\\n') : ' - none'}\n---\n\n<!-- AI_QUICK_INJECT_START -->\n> [!TIP]\n> **AI Prompt Injection Card (Copy into future prompts touching this file):**\n> \\`\\`\\`yaml\n> Target: ${data.filePath} (${data.domainLayer})\n> Role: Core logic for ${path.basename(data.filePath)}.\n> Exports: [${data.exports\n .map(e => e.name)\n .slice(0, 6)\n .join(', ')}]\n> Inbound Callers: ${data.callers.length} active consumer sites.\n> Invariant Check: Verify test passing before merge: ${testCommand}\n> \\`\\`\\`\n<!-- AI_QUICK_INJECT_END -->\n\n# 🧭 FILE DOSSIER: \\`${path.basename(data.filePath)}\\`\n\\`${data.filePath}\\` • **${data.domainLayer}** • **Hash:** \\`${data.sourceHash}\\`\n\n| Freshness | Blast Radius | Exports Count | Test Coverage | Primary Callers |\n| :--- | :--- | :--- | :--- | :--- |\n| 🟢 **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'}\\` |\n\n---\n\n## ⚡ 30-Second Mental Model\n> **Mission:** Implements ${data.domainLayer.toLowerCase()} responsibilities for \\`${data.filePath}\\`, exposing verified interfaces to callers while adhering to Tribunal safety standards.\n\n---\n\n## 📋 Public API & Type Contract Matrix\n\n| Symbol | Kind | Signature | Location |\n| :--- | :--- | :--- | :--- |\n${typesTable}\n\n---\n\n## 🔗 Blast Radius & Call Topology\n\n\\`\\`\\`mermaid\ngraph LR\n classDef target fill:#1e293b,stroke:#3b82f6,stroke-width:2px,color:#fff;\n classDef ext fill:#0f172a,stroke:#64748b,stroke-width:1px,color:#94a3b8;\n\n subgraph Inbound Callers\n${\n data.callers\n .slice(0, 4)\n .map((c, i) => ` C${i}[\"${c.file}\"]:::ext`)\n .join('\\n') || ' C0[\"Entrypoint / CLI\"]:::ext'\n}\n end\n\n T[\"${path.basename(data.filePath)}\"]:::target\n\n subgraph Dependencies\n${\n data.imports\n .slice(0, 4)\n .map((imp, i) => ` D${i}[\"${imp.source}\"]:::ext`)\n .join('\\n') || ' D0[\"Stdlib\"]:::ext'\n}\n end\n\n${\n data.callers\n .slice(0, 4)\n .map((_, i) => ` C${i} --> T`)\n .join('\\n') || ' C0 --> T'\n}\n${\n data.imports\n .slice(0, 4)\n .map((_, i) => ` T --> D${i}`)\n .join('\\n') || ' T --> D0'\n}\n\\`\\`\\`\n\n### Inbound Consumer Sites\n| Caller File | Line Snippet | Vector |\n| :--- | :--- | :--- |\n${callersTable}\n\n---\n\n## ⚠️ Chesterton's Fences & Non-Obvious Quirks\n\n${landminesContent}\n\n---\n\n## 🧪 Verification & Test Harness\n\n\\`\\`\\`bash\n# Run isolated tests for this module:\n${testCommand}\n\\`\\`\\`\n`;\n}\n\nfunction renderBridgeDossier(data) {\n return `---\nversion: 2.0.0\nbridge: \"${data.fileA.filePath} <--> ${data.fileB.filePath}\"\nrelationship: \"${data.coupling.relationship}\"\nlast_synced: \"${new Date().toISOString().split('T')[0]}\"\n---\n\n# 🌉 INTERFACE BRIDGE DOSSIER\n**Module A:** \\`${data.fileA.filePath}\\` \n**Module B:** \\`${data.fileB.filePath}\\` \n**Coupling Relationship:** \\`${data.coupling.relationship}\\`\n\n---\n\n## 🗺️ Cross-Boundary Topology\n\n\\`\\`\\`mermaid\ngraph LR\n A[\"${path.basename(data.fileA.filePath)}\"]\n B[\"${path.basename(data.fileB.filePath)}\"]\n\n ${data.coupling.aImportsB ? 'A -->|\"Imports & Calls\"| B' : ''}\n ${data.coupling.bImportsA ? 'B -->|\"Imports & Calls\"| A' : ''}\n ${!data.coupling.aImportsB && !data.coupling.bImportsA ? 'A -.->|\"Sibling / Parallel\"| B' : ''}\n\\`\\`\\`\n\n## 📦 Shared Types & Interfaces\n${\n data.coupling.sharedTypes.length > 0\n ? data.coupling.sharedTypes.map(t => `- \\`${t}\\``).join('\\n')\n : '- *No identical type names detected between modules.*'\n}\n\n## 📋 Interface Alignment Summary\n- **${path.basename(data.fileA.filePath)} Exports:** ${data.fileA.exports.length} symbols.\n- **${path.basename(data.fileB.filePath)} Exports:** ${data.fileB.exports.length} symbols.\n`;\n}\n\nfunction renderDirectoryDossier(data) {\n return `---\nversion: 2.0.0\ntarget_dir: \"${data.dirPath}\"\nmanifests: [${data.manifests.join(', ')}]\nlast_synced: \"${new Date().toISOString().split('T')[0]}\"\n---\n\n<!-- PROJECT_AI_ONBOARDING_CARD -->\nProject Subsystem: ${data.dirPath}\nManifests: ${data.manifests.join(', ') || 'None'}\nSubsystems: ${data.subsystems.map(s => s.name).join(', ')}\n<!-- /PROJECT_AI_ONBOARDING_CARD -->\n\n# 🏛️ SUBSYSTEM DOSSIER: \\`${data.dirPath}\\`\n\n## 🗺️ Subsystem Architecture Clusters\n\\`\\`\\`mermaid\ngraph TD\n${data.subsystems.map(s => ` S_${s.name}[\"${s.name} (${s.fileCount} files)\"]`).join('\\n')}\n\\`\\`\\`\n\n## 📂 Subsystem Breakdown\n| Subsystem Folder | File Count | Samples |\n| :--- | :--- | :--- |\n${data.subsystems.map(s => `| \\`${s.name}/\\` | ${s.fileCount} | \\`${s.keySample}\\` |`).join('\\n')}\n`;\n}\n\n// ── Living Vault Manager ───────────────────────────────────────────────────\n\nfunction syncVaultIndex(workspaceRoot = process.cwd()) {\n const docsDir = getDocsDir(workspaceRoot);\n const indexFile = path.join(docsDir, 'INDEX.md');\n\n if (!fs.existsSync(docsDir)) {\n fs.mkdirSync(docsDir, { recursive: true });\n }\n\n const files = fs\n .readdirSync(docsDir)\n .filter(f => f.endsWith('.context.md') || f.endsWith('.bridge.md'));\n\n const rows = [];\n for (const f of files) {\n const content = fs.readFileSync(path.join(docsDir, f), 'utf8');\n const sourceMatch = content.match(/source_file:\\s*[\"']?([^\"'\\n]+)/);\n const bridgeMatch = content.match(/bridge:\\s*[\"']?([^\"'\\n]+)/);\n const dirMatch = content.match(/target_dir:\\s*[\"']?([^\"'\\n]+)/);\n const hashMatch = content.match(/source_hash:\\s*[\"']?([^\"'\\n]+)/);\n const domainMatch = content.match(/domain_layer:\\s*[\"']?([^\"'\\n]+)/);\n\n let source = f;\n let domain = 'General';\n const hash = hashMatch ? hashMatch[1] : 'n/a';\n let status = '🟢 Fresh';\n\n if (sourceMatch) {\n source = sourceMatch[1].replace(/[\"']/g, '');\n domain = domainMatch ? domainMatch[1].replace(/[\"']/g, '') : 'Single Module';\n const absSource = resolvePath(source, workspaceRoot);\n if (fs.existsSync(absSource)) {\n const curHash = computeSha256(fs.readFileSync(absSource, 'utf8'));\n if (curHash !== hash) {\n status = '🔴 Stale';\n }\n } else {\n status = '⚪ Missing';\n }\n } else if (bridgeMatch) {\n source = bridgeMatch[1].replace(/[\"']/g, '');\n domain = 'Interface Bridge';\n status = '🟢 Linked';\n } else if (dirMatch) {\n source = dirMatch[1].replace(/[\"']/g, '');\n domain = 'Subsystem Cluster';\n const absDir = resolvePath(source, workspaceRoot);\n status = fs.existsSync(absDir) ? '🟢 Active' : '⚪ Missing';\n }\n\n rows.push(`| [\\`${source}\\`](${f}) | ${domain} | \\`${hash}\\` | ${status} |`);\n }\n\n const indexContent = `# 📚 Codebase Context Vault Registry\n> Living architectural catalog generated and verified by \\`/context\\`.\n\n| Source Target | Domain Layer | Hash Snapshot | Status |\n| :--- | :--- | :--- | :--- |\n${rows.join('\\n') || '| *No context dossiers generated yet. Run `/context <file>` to begin.* | - | - | - |'}\n\n---\n*Run \\`node scripts/context_compiler.js --check\\` to audit context freshness across all files.*\n`;\n\n fs.writeFileSync(indexFile, indexContent, 'utf8');\n return { indexedCount: files.length, indexFile };\n}\n\nfunction checkDrift(workspaceRoot = process.cwd()) {\n const syncRes = syncVaultIndex(workspaceRoot);\n const content = fs.readFileSync(syncRes.indexFile, 'utf8');\n const staleCount = (content.match(/🔴 Stale/g) || []).length;\n const freshCount = (content.match(/🟢 Fresh/g) || []).length;\n\n return {\n total: syncRes.indexedCount,\n fresh: freshCount,\n stale: staleCount,\n isHealthy: staleCount === 0,\n };\n}\n\n// ── CLI Dispatcher ─────────────────────────────────────────────────────────\n\nfunction main() {\n const args = process.argv.slice(2);\n const workspaceRoot = process.cwd();\n\n if (args.includes('--check')) {\n const drift = checkDrift(workspaceRoot);\n console.log(`\\n${C.BOLD}═══ Context Vault Drift Audit ═══${C.RESET}`);\n console.log(`Total Dossiers: ${drift.total}`);\n console.log(`🟢 Fresh: ${drift.fresh}`);\n console.log(`🔴 Stale: ${drift.stale}`);\n console.log(\n `Status: ${drift.isHealthy ? C.GREEN + 'HEALTHY' : C.RED + 'DRIFT DETECTED'}${C.RESET}\\n`,\n );\n process.exit(drift.isHealthy ? 0 : 1);\n }\n\n let fileArg = null;\n let dirArg = null;\n let multiArgs = [];\n const writeFlag = args.includes('--write');\n const jsonFlag = args.includes('--json');\n\n for (let i = 0; i < args.length; i++) {\n if (args[i] === '--file' && args[i + 1]) {\n fileArg = args[++i];\n } else if (args[i] === '--dir' && args[i + 1]) {\n dirArg = args[++i];\n } else if (args[i] === '--multi' && args[i + 1] && args[i + 2]) {\n multiArgs = [args[++i], args[++i]];\n } else if (!args[i].startsWith('--')) {\n if (!fileArg && !dirArg) {\n // Autodetect positional arg\n const candidate = args[i].replace(/^['\"]|['\"]$/g, '');\n if (fs.existsSync(candidate)) {\n if (fs.statSync(candidate).isDirectory()) {\n dirArg = candidate;\n } else {\n fileArg = candidate;\n }\n }\n }\n }\n }\n\n if (multiArgs.length === 2) {\n const result = analyzeMultiFileBridge(multiArgs[0], multiArgs[1], workspaceRoot);\n if (jsonFlag) {\n console.log(JSON.stringify(result, null, 2));\n } else {\n const md = renderBridgeDossier(result);\n if (writeFlag) {\n const outName = `${path.basename(multiArgs[0]).replace(/\\.[^.]+$/, '')}__${path.basename(multiArgs[1]).replace(/\\.[^.]+$/, '')}.bridge.md`;\n const dest = path.join(workspaceRoot, 'docs', 'context', outName);\n fs.mkdirSync(path.dirname(dest), { recursive: true });\n fs.writeFileSync(dest, md, 'utf8');\n syncVaultIndex(workspaceRoot);\n console.log(`${C.GREEN}✔ Bridge Dossier written to ${dest}${C.RESET}`);\n } else {\n console.log(md);\n }\n }\n } else if (dirArg) {\n const result = analyzeDirectory(dirArg, workspaceRoot);\n if (jsonFlag) {\n console.log(JSON.stringify(result, null, 2));\n } else {\n const md = renderDirectoryDossier(result);\n if (writeFlag) {\n const outName = `${path.basename(dirArg)}.context.md`;\n const dest = path.join(workspaceRoot, 'docs', 'context', outName);\n fs.mkdirSync(path.dirname(dest), { recursive: true });\n fs.writeFileSync(dest, md, 'utf8');\n syncVaultIndex(workspaceRoot);\n console.log(`${C.GREEN}✔ Directory Dossier written to ${dest}${C.RESET}`);\n } else {\n console.log(md);\n }\n }\n } else if (fileArg) {\n const result = analyzeSingleFile(fileArg, workspaceRoot);\n if (jsonFlag) {\n console.log(JSON.stringify(result, null, 2));\n } else {\n const md = renderSingleFileDossier(result);\n if (writeFlag) {\n const outName = `${path.basename(fileArg).replace(/\\.[^.]+$/, '')}.context.md`;\n const dest = path.join(workspaceRoot, 'docs', 'context', outName);\n fs.mkdirSync(path.dirname(dest), { recursive: true });\n fs.writeFileSync(dest, md, 'utf8');\n syncVaultIndex(workspaceRoot);\n console.log(`${C.GREEN}✔ Single-File Dossier written to ${dest}${C.RESET}`);\n } else {\n console.log(md);\n }\n }\n } else {\n console.error(\n `${C.RED}Error: Provide --file <path>, --dir <path>, --multi <fileA> <fileB>, or --check${C.RESET}`,\n );\n process.exit(1);\n }\n}\n\n// Export functions for in-process MCP server use\nmodule.exports = {\n analyzeSingleFile,\n analyzeMultiFileBridge,\n analyzeDirectory,\n renderSingleFileDossier,\n renderBridgeDossier,\n renderDirectoryDossier,\n syncVaultIndex,\n checkDrift,\n};\n\nif (require.main === module) {\n main();\n}\n"
17
- }
@@ -1,11 +0,0 @@
1
- {
2
- "file": "scripts/fix-vbc.js",
3
- "riskScore": "Low",
4
- "blastRadius": 0,
5
- "imports": {
6
- "fs": [],
7
- "path": []
8
- },
9
- "dependents": [],
10
- "content": "#!/usr/bin/env node\n/**\n * fix-vbc.js — Batch appends missing VBC Protocol and Pre-Flight sections\n * to all SKILL.md files in .agent/skills/ that are failing validation.\n *\n * Run: node scripts/fix-vbc.js\n * Dry-run: node scripts/fix-vbc.js --dry-run\n */\n\nconst fs = require('fs');\nconst path = require('path');\n\nconst ROOT = path.resolve(__dirname, '..');\nconst SKILLS_DIR = path.join(ROOT, '.agent', 'skills');\nconst DRY_RUN = process.argv.includes('--dry-run');\n\nconst PRE_FLIGHT_BLOCK = `\n### ✅ Pre-Flight Self-Audit\n\n\\`\\`\\`\n✅ Did I rely ONLY on real, verified tools and methods?\n✅ Is this solution appropriately scoped to the user's constraints?\n✅ Did I handle potential failure modes and edge cases?\n✅ Have I avoided generic boilerplate that doesn't add value?\n\\`\\`\\`\n`;\n\nconst VBC_BLOCK = `\n### 🛑 Verification-Before-Completion (VBC) Protocol\n\n**CRITICAL:** You must follow a strict \"evidence-based closeout\" state machine.\n\n- ❌ **Forbidden:** Declaring a task complete because the output \"looks correct.\"\n- ✅ **Required:** You are explicitly forbidden from finalizing any task without providing **concrete evidence** (terminal output, passing tests, compile success, or equivalent proof) that your output works as intended.\n`;\n\nlet fixedCount = 0;\nlet skippedCount = 0;\nlet errorCount = 0;\n\nconst skillDirs = fs.readdirSync(SKILLS_DIR).filter(d => {\n return fs.statSync(path.join(SKILLS_DIR, d)).isDirectory();\n});\n\nfor (const dir of skillDirs) {\n const skillPath = path.join(SKILLS_DIR, dir, 'SKILL.md');\n if (!fs.existsSync(skillPath)) continue;\n\n let content;\n try {\n content = fs.readFileSync(skillPath, 'utf8');\n } catch (e) {\n console.error(` ❌ Failed to read: ${dir}/SKILL.md — ${e.message}`);\n errorCount++;\n continue;\n }\n\n const hasPreFlight = content.includes('Pre-Flight Checklist') || content.includes('Pre-Flight');\n const hasVBC = content.includes('VBC Protocol') || content.includes('VBC');\n\n if (hasPreFlight && hasVBC) {\n skippedCount++;\n continue;\n }\n\n let appendText = '';\n\n if (!hasPreFlight) {\n appendText += PRE_FLIGHT_BLOCK;\n console.log(` 🔧 ${dir}/SKILL.md — appending Pre-Flight Self-Audit`);\n }\n\n if (!hasVBC) {\n appendText += VBC_BLOCK;\n console.log(` 🔧 ${dir}/SKILL.md — appending VBC Protocol`);\n }\n\n if (DRY_RUN) {\n console.log(` [DRY-RUN] Would append to ${dir}/SKILL.md`);\n } else {\n try {\n fs.appendFileSync(skillPath, appendText, 'utf8');\n fixedCount++;\n } catch (e) {\n console.error(` ❌ Failed to write: ${dir}/SKILL.md — ${e.message}`);\n errorCount++;\n }\n }\n}\n\nconsole.log(`\\n━━━ VBC Fix Summary ━━━━━━━━━━━━━━━━━━━━━`);\nconsole.log(` Fixed: ${fixedCount}`);\nconsole.log(` Skipped: ${skippedCount} (already compliant)`);\nconsole.log(` Errors: ${errorCount}`);\nconsole.log(` Mode: ${DRY_RUN ? 'DRY-RUN (no changes)' : 'LIVE'}`);\nconsole.log();\n"
11
- }
@@ -1,11 +0,0 @@
1
- {
2
- "file": "scripts/modernize_skills.js",
3
- "riskScore": "Low",
4
- "blastRadius": 0,
5
- "imports": {
6
- "fs": [],
7
- "path": []
8
- },
9
- "dependents": [],
10
- "content": "#!/usr/bin/env node\n/**\n * modernize_skills.js — Tribunal Kit Skill Modernizer & Schema Validator (v4.0.0)\n *\n * Scans, deduplicates, standardizes, and validates all SKILL.md files across:\n * - tribunal-kit/.agent/skills/\n * - .agent/skills/ (when --sync-to-root is passed)\n *\n * Usage:\n * node scripts/modernize_skills.js --validate\n * node scripts/modernize_skills.js --dry-run\n * node scripts/modernize_skills.js --fix\n * node scripts/modernize_skills.js --fix --sync-to-root\n */\n\nconst fs = require('fs');\nconst path = require('path');\n\nconst ROOT = path.resolve(__dirname, '..');\nconst SKILLS_DIR = path.join(ROOT, '.agent', 'skills');\nconst WORKSPACE_ROOT = path.resolve(ROOT, '..');\nconst ROOT_SKILLS_DIR = path.join(WORKSPACE_ROOT, '.agent', 'skills');\n\nconst ARGS = process.argv.slice(2);\nconst DRY_RUN = ARGS.includes('--dry-run');\nconst FIX = ARGS.includes('--fix');\nconst _VALIDATE = ARGS.includes('--validate') || (!DRY_RUN && !FIX);\nconst SYNC_TO_ROOT = ARGS.includes('--sync-to-root');\n\nconst CANONICAL_FOOTER = `---\n\n## 🏛️ Tribunal Verification & Guardrails\n\n**Slash command: \\`/review\\` or \\`/tribunal-full\\`**\n**Active reviewers: \\`logic-reviewer\\` · \\`security-auditor\\`**\n\n### ❌ Forbidden AI Tropes\n1. **Blind Assumptions:** Never make an assumption without documenting it clearly with \\`// VERIFY: [reason]\\`.\n2. **Silent Degradation:** Catching and suppressing errors without logging or handling.\n3. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.\n\n### ✅ Pre-Flight Self-Audit\n\\`\\`\\`\n✅ Did I rely ONLY on real, verified tools and methods?\n✅ Is this solution appropriately scoped to the user's constraints?\n✅ Did I handle potential failure modes and edge cases?\n✅ Have I avoided generic boilerplate that doesn't add value?\n\\`\\`\\`\n\n### 🛑 Verification-Before-Completion (VBC) Protocol\n**CRITICAL:** You must follow a strict \"evidence-based closeout\" state machine.\n- ❌ **Forbidden:** Declaring a task complete because the output \"looks correct.\"\n- ✅ **Required:** You are explicitly forbidden from finalizing any task without providing **concrete evidence** (terminal output, passing tests, compile success, or equivalent proof) that your output works as intended.\n`;\n\nfunction parseFrontmatter(content) {\n if (!content.startsWith('---')) return { frontmatter: null, body: content };\n const endIdx = content.indexOf('\\n---', 3);\n if (endIdx === -1) return { frontmatter: null, body: content };\n\n const rawYaml = content.slice(4, endIdx).trim();\n const body = content.slice(endIdx + 4).trim();\n const meta = {};\n\n const lines = rawYaml.split('\\n');\n let currentKey = null;\n let isList = false;\n\n for (const line of lines) {\n const trimmed = line.trim();\n if (!trimmed || trimmed.startsWith('#')) continue;\n\n const match = line.match(/^([a-zA-Z0-9_-]+):\\s*(.*)$/);\n if (match) {\n currentKey = match[1];\n const val = match[2].trim();\n if (!val) {\n meta[currentKey] = [];\n isList = true;\n } else {\n meta[currentKey] = val;\n isList = false;\n }\n } else if (isList && trimmed.startsWith('-')) {\n const item = trimmed\n .slice(1)\n .trim()\n .replace(/^['\"]|['\"]$/g, '');\n if (Array.isArray(meta[currentKey])) {\n meta[currentKey].push(item);\n }\n }\n }\n\n return { frontmatter: rawYaml, meta, body };\n}\n\nfunction deduplicateAndCleanBody(body, skillName, description) {\n let cleaned = body;\n\n // 1. Remove duplicate top-level headers if repeated identical lines\n const titleMatch = cleaned.match(/^#\\s+(.+)$/m);\n if (titleMatch) {\n const title = titleMatch[1].trim();\n const titleRegex = new RegExp(`(^|\\\\n)#\\\\s+${escapeRegex(title)}(\\\\r?\\\\n)+`, 'g');\n let first = true;\n cleaned = cleaned.replace(titleRegex, (match, prefix) => {\n if (first) {\n first = false;\n return match;\n }\n return prefix;\n });\n }\n\n // 2. Strip existing canonical footer if present to ensure idempotency\n const existingFooterIdx = cleaned.indexOf('## 🏛️ Tribunal Verification & Guardrails');\n if (existingFooterIdx !== -1) {\n cleaned = cleaned.slice(0, existingFooterIdx).trim();\n }\n\n // Cut off legacy trailing guardrail stacks\n const footerMarkerRegex =\n /\\n---\\s*\\n+(\\*\\*Slash command: `\\/review`|## 🤖 LLM-Specific Traps|## 🏛️ Tribunal Integration|### ❌ Forbidden AI Tropes|## Pre-Flight Checklist|## VBC Protocol)[\\s\\S]*$/;\n cleaned = cleaned.replace(footerMarkerRegex, '').trim();\n\n // Remove any remaining isolated duplicate VBC blocks (H2 or H3)\n const isolatedVbcRegex =\n /(##|###)\\s+🛑?\\s*Verification-Before-Completion \\(VBC\\) Protocol[\\s\\S]*?(?=\\n## |\\n---|\\n# |$)/g;\n cleaned = cleaned.replace(isolatedVbcRegex, '');\n\n // Remove trailing horizontal rules or whitespace\n cleaned = cleaned.replace(/(\\n---\\s*)+$/, '').trim();\n\n // 3. Ensure Activation Boundaries section exists near the top\n if (!cleaned.includes('Activation Boundaries') && !cleaned.includes('Activate when:')) {\n const activationBlock = `\\n\\n## Activation Boundaries\\n\\n- **Activate when:** Operating in tasks requiring ${description || skillName}.\\n- **DO NOT activate when:** The task falls strictly outside ${skillName} domain or belongs to a different dedicated specialist.\\n`;\n\n if (cleaned.includes('## Mandatory Pre-Flight Context Inspection')) {\n cleaned = cleaned.replace(\n /(## Mandatory Pre-Flight Context Inspection[\\s\\S]*?(?=\\n## |\\n# |\\n---|$))/,\n `$1${activationBlock}`,\n );\n } else {\n cleaned = cleaned.replace(/^(#[^\\n]+\\n+)/, `$1${activationBlock}\\n`);\n }\n }\n\n // 4. Append single Canonical Footer\n cleaned = `${cleaned}\\n\\n${CANONICAL_FOOTER}`;\n\n return cleaned.trim();\n}\n\nfunction escapeRegex(string) {\n return string.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n}\n\nfunction processSkill(skillDirName) {\n const skillFile = path.join(SKILLS_DIR, skillDirName, 'SKILL.md');\n if (!fs.existsSync(skillFile)) return null;\n\n const originalContent = fs.readFileSync(skillFile, 'utf8');\n const { frontmatter, meta, body } = parseFrontmatter(originalContent);\n\n if (!frontmatter) {\n return { name: skillDirName, error: 'Missing frontmatter' };\n }\n\n const desc = meta ? meta.description || '' : '';\n const newBody = deduplicateAndCleanBody(body, skillDirName, desc);\n\n // Rebuild frontmatter with version: 4.0.0 and canonical scripts-binding\n let updatedFrontmatter = frontmatter\n .replace(/^version:\\s*.*$/m, 'version: 4.0.0')\n .replace(/^last-updated:\\s*.*$/m, 'last-updated: 2026-09-07');\n\n if (!updatedFrontmatter.includes('version:')) {\n updatedFrontmatter += '\\nversion: 4.0.0';\n }\n if (!updatedFrontmatter.includes('scripts-binding:')) {\n updatedFrontmatter +=\n '\\nscripts-binding:\\n - .agent/scripts/lint_runner.js\\n - .agent/scripts/verify_all.js';\n }\n\n const newContent = `---\\n${updatedFrontmatter.trim()}\\n---\\n\\n${newBody}\\n`;\n\n const vbcMatches = (newContent.match(/Verification-Before-Completion \\(VBC\\) Protocol/g) || [])\n .length;\n const trapsMatches = (newContent.match(/LLM-Specific Traps/g) || []).length;\n const isDuplicated = vbcMatches > 1 || trapsMatches > 1;\n\n const modified = newContent !== originalContent;\n\n if (modified && FIX) {\n fs.writeFileSync(skillFile, newContent, 'utf8');\n if (SYNC_TO_ROOT && fs.existsSync(ROOT_SKILLS_DIR)) {\n const rootSkillDir = path.join(ROOT_SKILLS_DIR, skillDirName);\n if (!fs.existsSync(rootSkillDir)) fs.mkdirSync(rootSkillDir, { recursive: true });\n fs.writeFileSync(path.join(rootSkillDir, 'SKILL.md'), newContent, 'utf8');\n }\n }\n\n return {\n name: skillDirName,\n isDuplicated,\n modified,\n vbcMatches,\n trapsMatches,\n };\n}\n\nfunction main() {\n console.log(`━━━ Tribunal Kit Skill Modernizer ━━━━━━━━━━━━━━━━━━━━━`);\n console.log(`Target: ${SKILLS_DIR}`);\n console.log(\n `Mode: ${FIX ? 'FIX (Overwriting files)' : DRY_RUN ? 'DRY-RUN (Simulated)' : 'VALIDATE (Read-only)'}`,\n );\n if (SYNC_TO_ROOT) console.log(`Sync: Enabled -> ${ROOT_SKILLS_DIR}`);\n console.log();\n\n const skillDirs = fs.readdirSync(SKILLS_DIR).filter(d => {\n return fs.statSync(path.join(SKILLS_DIR, d)).isDirectory();\n });\n\n let totalSkills = 0;\n let totalDuplicated = 0;\n let totalModified = 0;\n const errors = [];\n\n for (const dir of skillDirs) {\n totalSkills++;\n const res = processSkill(dir);\n if (!res) continue;\n if (res.error) {\n errors.push(`${dir}: ${res.error}`);\n continue;\n }\n if (res.isDuplicated) {\n totalDuplicated++;\n }\n if (res.modified) {\n totalModified++;\n }\n }\n\n console.log(`📊 Summary:`);\n console.log(` Total Skills Analyzed: ${totalSkills}`);\n console.log(` Skills with Remaining Duplications: ${totalDuplicated}`);\n console.log(` Skills Needing Modification: ${totalModified}`);\n console.log(` Errors: ${errors.length}`);\n\n if (errors.length > 0) {\n console.log(`\\n❌ Errors encountered:`);\n errors.forEach(e => console.log(` - ${e}`));\n }\n\n console.log();\n if (!FIX && totalModified > 0) {\n console.log(\n `💡 Run with --fix to apply cleanups and V4 schema across all ${totalModified} skills.`,\n );\n } else if (FIX) {\n console.log(`✅ Successfully modernized and deduplicated skills to V4 schema!`);\n }\n}\n\nmain();\n"
11
- }
@@ -1,12 +0,0 @@
1
- {
2
- "file": "scripts/package-cores.js",
3
- "riskScore": "Low",
4
- "blastRadius": 0,
5
- "imports": {
6
- "fs": [],
7
- "path": [],
8
- "child_process": []
9
- },
10
- "dependents": [],
11
- "content": "#!/usr/bin/env node\n/**\n * package-cores.js — Automates bundling of @tribunal-kit/core-* platform npm packages.\n *\n * Reads npm/core-template/package.json and generates platform-specific packages\n * for Darwin, Linux, and Windows (x64 and arm64).\n *\n * Usage:\n * node scripts/package-cores.js # Generate package directories\n * node scripts/package-cores.js --pack # Run npm pack in each generated package\n */\n\n'use strict';\n\nconst fs = require('fs');\nconst path = require('path');\nconst { execSync } = require('child_process');\n\nconst ROOT = path.resolve(__dirname, '..');\nconst TEMPLATE_PKG = path.join(ROOT, 'npm', 'core-template', 'package.json');\nconst OUTPUT_DIR = path.join(ROOT, 'npm', 'packages');\nconst PKG = require(path.join(ROOT, 'package.json'));\nconst VERSION = PKG.version;\n\nconst PLATFORMS = [\n { platform: 'darwin', arch: 'arm64', ext: '', rustTarget: 'aarch64-apple-darwin' },\n { platform: 'darwin', arch: 'x64', ext: '', rustTarget: 'x86_64-apple-darwin' },\n { platform: 'linux', arch: 'arm64', ext: '', rustTarget: 'aarch64-unknown-linux-gnu' },\n { platform: 'linux', arch: 'x64', ext: '', rustTarget: 'x86_64-unknown-linux-gnu' },\n { platform: 'win32', arch: 'arm64', ext: '.exe', rustTarget: 'aarch64-pc-windows-msvc' },\n { platform: 'win32', arch: 'x64', ext: '.exe', rustTarget: 'x86_64-pc-windows-msvc' },\n];\n\nfunction ensureDir(dir) {\n if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });\n}\n\nfunction findBinary(platform, ext, rustTarget) {\n const binaryName = `tribunal-core${ext}`;\n const candidates = [\n path.join(ROOT, 'target', rustTarget, 'release', binaryName),\n path.join(ROOT, 'target', 'release', binaryName),\n path.join(\n ROOT,\n `tribunal-core-${platform}-${rustTarget.includes('arm64') || rustTarget.includes('aarch64') ? 'arm64' : 'x64'}${ext}`,\n ),\n ];\n\n for (const cand of candidates) {\n if (fs.existsSync(cand)) return cand;\n }\n return null;\n}\n\nfunction buildPackages(shouldPack = false) {\n if (!fs.existsSync(TEMPLATE_PKG)) {\n console.error(`Missing template: ${TEMPLATE_PKG}`);\n process.exit(1);\n }\n\n const templateRaw = fs.readFileSync(TEMPLATE_PKG, 'utf8');\n ensureDir(OUTPUT_DIR);\n\n console.log(`\\n 🔱 Packaging Tribunal Core Platform Packages (v${VERSION})\\n`);\n\n for (const target of PLATFORMS) {\n const pkgName = `core-${target.platform}-${target.arch}`;\n const pkgDir = path.join(OUTPUT_DIR, pkgName);\n const binDir = path.join(pkgDir, 'bin');\n ensureDir(binDir);\n\n const pkgContent = templateRaw\n .replace(/\\$\\{PLATFORM\\}/g, target.platform)\n .replace(/\\$\\{ARCH\\}/g, target.arch)\n .replace(/\\$\\{EXT\\}/g, target.ext);\n\n const pkgJson = JSON.parse(pkgContent);\n pkgJson.version = VERSION;\n\n fs.writeFileSync(path.join(pkgDir, 'package.json'), JSON.stringify(pkgJson, null, 2));\n\n // Write README\n fs.writeFileSync(\n path.join(pkgDir, 'README.md'),\n `# @tribunal-kit/${pkgName}\\n\\nPrecompiled native Rust binary of Tribunal Core for ${target.platform} (${target.arch}).\\n`,\n );\n\n // Copy binary if available\n const binarySource = findBinary(target.platform, target.ext, target.rustTarget);\n const destBinary = path.join(binDir, `tribunal-core${target.ext}`);\n\n if (binarySource && fs.existsSync(binarySource)) {\n fs.copyFileSync(binarySource, destBinary);\n if (target.platform !== 'win32') {\n fs.chmodSync(destBinary, 0o755);\n }\n console.log(` ✓ Built ${pkgName} (with binary)`);\n } else {\n console.log(` ⚠ Built ${pkgName} (staged, binary not found in build tree)`);\n }\n\n if (shouldPack) {\n try {\n execSync('npm pack', { cwd: pkgDir, stdio: 'ignore' });\n console.log(` ↳ Packed .tgz`);\n } catch (e) {\n console.error(` ↳ Failed to pack: ${e.message}`);\n }\n }\n }\n\n console.log(`\\n ✓ Generated 6 platform packages in ${OUTPUT_DIR}\\n`);\n}\n\nconst isPack = process.argv.includes('--pack');\nbuildPackages(isPack);\n"
12
- }
@@ -1,11 +0,0 @@
1
- {
2
- "file": "scripts/skill_enhancement_engine.js",
3
- "riskScore": "Low",
4
- "blastRadius": 0,
5
- "imports": {
6
- "fs": [],
7
- "path": []
8
- },
9
- "dependents": [],
10
- "content": "#!/usr/bin/env node\n/**\n * skill_enhancement_engine.js — State-of-the-Art Skill Enhancement Engine\n *\n * Transforms SKILL.md definitions into autonomous, production-grade execution engines.\n * Implements the 18-section architectural framework:\n * 1. Objective Layer & High-Impact Mission\n * 2. Input Intelligence Layer\n * 3. Task Decomposition Layer\n * 4. Multi-Pass Execution Protocol (Pass 1-7)\n * 5. Domain Technical Reference Architecture\n * 6. Edge-Case Engine Matrix\n * 7. Self-Critique & Anti-Hallucination Traps\n * 8. Tribunal Integration & Evidence-based VBC\n *\n * Usage:\n * node scripts/skill_enhancement_engine.js --validate\n * node scripts/skill_enhancement_engine.js --skill <name> --fix\n * node scripts/skill_enhancement_engine.js --domain <domain> --fix\n * node scripts/skill_enhancement_engine.js --all --dry-run\n * node scripts/skill_enhancement_engine.js --all --fix --sync-to-root\n */\n\nconst fs = require('fs');\nconst path = require('path');\n\nconst ROOT = path.resolve(__dirname, '..');\nconst SKILLS_DIR = path.join(ROOT, '.agent', 'skills');\nconst WORKSPACE_ROOT = path.resolve(ROOT, '..');\nconst ROOT_SKILLS_DIR = path.join(WORKSPACE_ROOT, '.agent', 'skills');\nconst TOPIC_MAP_PATH = path.join(ROOT, '.agent', 'skill_topic_map.json');\n\nconst ARGS = process.argv.slice(2);\nconst DRY_RUN = ARGS.includes('--dry-run');\nconst FIX = ARGS.includes('--fix');\nconst SYNC_TO_ROOT = ARGS.includes('--sync-to-root');\n\nconst skillArgIdx = ARGS.indexOf('--skill');\nconst TARGET_SKILL = skillArgIdx !== -1 && ARGS[skillArgIdx + 1] ? ARGS[skillArgIdx + 1] : null;\n\nconst domainArgIdx = ARGS.indexOf('--domain');\nconst TARGET_DOMAIN = domainArgIdx !== -1 && ARGS[domainArgIdx + 1] ? ARGS[domainArgIdx + 1] : null;\n\n// Domain mapping & Active Reviewers\nlet domainRoutes = {};\nif (fs.existsSync(TOPIC_MAP_PATH)) {\n try {\n const raw = JSON.parse(fs.readFileSync(TOPIC_MAP_PATH, 'utf8'));\n domainRoutes = raw.domain_routes || {};\n } catch (e) {\n console.warn(`[WARN] Failed to load skill_topic_map.json: ${e.message}`);\n }\n}\n\nfunction getSkillDomain(skillName) {\n for (const [domain, list] of Object.entries(domainRoutes)) {\n if (list.includes(skillName)) return domain;\n }\n if (skillName.includes('anim') || skillName.includes('motion') || skillName.includes('gsap'))\n return 'motion';\n if (\n skillName.includes('react') ||\n skillName.includes('ui') ||\n skillName.includes('css') ||\n skillName.includes('design')\n )\n return 'frontend';\n if (skillName.includes('sql') || skillName.includes('db') || skillName.includes('data'))\n return 'database';\n if (\n skillName.includes('security') ||\n skillName.includes('audit') ||\n skillName.includes('vulnerab')\n )\n return 'security';\n if (skillName.includes('test') || skillName.includes('qa')) return 'testing';\n if (\n skillName.includes('devops') ||\n skillName.includes('ci') ||\n skillName.includes('cloud') ||\n skillName.includes('bash')\n )\n return 'devops';\n if (skillName.includes('mobile') || skillName.includes('swift') || skillName.includes('expo'))\n return 'mobile';\n if (\n skillName.includes('api') ||\n skillName.includes('python') ||\n skillName.includes('rust') ||\n skillName.includes('backend')\n )\n return 'backend';\n return 'meta';\n}\n\nconst DOMAIN_REVIEWERS = {\n frontend: ['frontend-reviewer', 'type-safety', 'ui-ux-auditor', 'complexity-reviewer'],\n motion: ['frontend-reviewer', 'motion-reviewer', 'ui-ux-auditor'],\n backend: ['logic-reviewer', 'security-auditor', 'api-architect', 'resilience-reviewer'],\n database: ['database-architect', 'sql-pro', 'security-auditor', 'schema-validator'],\n security: ['security-auditor', 'penetration-tester', 'backend-security-expert'],\n devops: ['pipeline-reviewer', 'devops-engineer', 'resilience-reviewer'],\n testing: ['test-engineer', 'qa-automation-engineer', 'logic-reviewer'],\n mobile: ['mobile-reviewer', 'frontend-reviewer', 'type-safety'],\n meta: ['orchestrator', 'agent-organizer', 'logic-reviewer'],\n};\n\nconst DOMAIN_PREFLIGHT = {\n frontend: [\n '✅ Are all component props strictly typed with zero implicit \"any\"?',\n '✅ Are responsive breakpoints, fluid typography, and optical balance verified?',\n '✅ Is accessibility (ARIA labels, keyboard focus, contrast) validated?',\n '✅ Are re-renders minimized and state lifecycles cleanly separated?',\n '✅ Did I verify all imported UI components and icon sets actually exist?',\n ],\n motion: [\n '✅ Does animation maintain 60fps/120fps using transform and opacity?',\n '✅ Is optical mass conserved across state interpolations without volume collapse?',\n '✅ Is duration capped within micro-interaction budgets (160ms–280ms)?',\n '✅ Is prefers-reduced-motion respected with graceful instant fallbacks?',\n '✅ Did I prevent layout thrashing and continuous geometry mutations?',\n ],\n backend: [\n '✅ Are all inputs and boundary payloads validated against schemas (Zod/Pydantic)?',\n '✅ Are SQL and database queries parameterized with zero string concatenation?',\n '✅ Are error boundaries and timeout/retry policies explicitly declared?',\n '✅ Are authentication checks performed before business logic execution?',\n '✅ Did I verify that imported dependencies exist in package.json/requirements.txt?',\n ],\n database: [\n '✅ Are all queries parameterized against SQL injection vulnerabilities?',\n '✅ Are indexes defined for all foreign keys, joins, and filtered query clauses?',\n '✅ Are transactions wrapped atomically with rollbacks on failure?',\n '✅ Are migration scripts backwards-compatible (expand-and-contract pattern)?',\n '✅ Did I verify column names against active schema definitions?',\n ],\n security: [\n '✅ Are user inputs sanitized and treated as untrusted at system boundaries?',\n '✅ Are secrets loaded strictly via environment variables with zero hardcoding?',\n '✅ Is least-privilege enforcement active on APIs, tokens, and storage buckets?',\n '✅ Are prompt-injection delimiters and sanitizers wrapped around LLM inputs?',\n '✅ Did I verify encryption in transit and at rest for sensitive customer data?',\n ],\n devops: [\n '✅ Are strict execution modes (set -euo pipefail) active on all scripts?',\n '✅ Are container images pinned to digest/immutable tags instead of \"latest\"?',\n '✅ Are deployment health checks and rollback baselines configured?',\n '✅ Are CI secrets masked and unexposed to untrusted pull requests?',\n '✅ Did I verify environment compatibility across target runtimes?',\n ],\n testing: [\n '✅ Do tests follow behavioral GIVEN/WHEN/THEN specifications?',\n '✅ Are happy path, failure paths, and boundary conditions (0, null, max) covered?',\n '✅ Are test mocks isolated and reset between successive suites?',\n '✅ Do E2E locators rely on stable ARIA attributes instead of brittle CSS selectors?',\n '✅ Did I verify test suite passes without flaky race conditions?',\n ],\n mobile: [\n '✅ Do touch targets satisfy the 44x44px minimum touch boundary standard?',\n '✅ Are gesture handlers and native thread animations offloaded via Reanimated?',\n '✅ Are keyboard avoiding views, safe areas, and notch offsets handled?',\n '✅ Is offline storage and state hydration handled with optimistic sync?',\n '✅ Did I verify compatibility across iOS, Android, and varying densities?',\n ],\n meta: [\n '✅ Did I deconstruct the root objective before proposing architecture?',\n '✅ Did I identify dependencies, bottlenecks, and parallelizable sub-tasks?',\n '✅ Did I avoid over-engineering and select the simplest effective pattern?',\n '✅ Did I verify assumptions with concrete file reads instead of speculation?',\n '✅ Did I establish measurable verification criteria before completion?',\n ],\n};\n\nconst DOMAIN_TRAPS = {\n frontend: [\n {\n trope: 'Uncontrolled Re-render Loop',\n bad: 'Mutating state inside render bodies or omitting hook dependencies',\n good: 'Wrap effects with explicit deps and isolate reactive derivations in useMemo',\n },\n {\n trope: 'Accessibility Neglect',\n bad: 'Interactive <div> without role=\"button\", tabIndex, or onKeyDown',\n good: 'Use semantic <button> or provide ARIA role, keyboard handlers, and focus ring',\n },\n {\n trope: 'Layout Shift Flash',\n bad: 'Images/dynamic content without aspect-ratio or explicit dimensions',\n good: 'Enforce aspect-ratio or skeleton placeholders to guarantee zero CLS',\n },\n ],\n motion: [\n {\n trope: 'The Instant Pop Trap',\n bad: 'Conditionally unmounting elements without animated interpolation',\n good: 'Use AnimatePresence or coordinate morphs with continuous geometry',\n },\n {\n trope: 'Layout Thrashing',\n bad: 'Animating width, height, top, or left inside animation loops',\n good: 'Animate composite-only transform (translate3d, scale) and opacity',\n },\n {\n trope: 'Sluggish Duration',\n bad: 'Setting micro-interaction transitions to 600ms+ causing interface lag',\n good: 'Cap interactive feedback at 160ms–240ms with snappy ease-out curves',\n },\n ],\n backend: [\n {\n trope: 'Unchecked Payload Cast',\n bad: 'Casting request bodies to TypeScript types without runtime schema validation',\n good: 'Parse request payloads through Zod/Pydantic schemas before business logic',\n },\n {\n trope: 'Silent Error Swallowing',\n bad: 'Catching errors with empty catch blocks or logging without rethrowing',\n good: 'Propagate structured errors with status codes and contextual stack traces',\n },\n {\n trope: 'Unparameterized Query',\n bad: 'Concatenating user inputs into SQL/Prisma query strings',\n good: 'Always use parameterized bindings or type-safe ORM query builders',\n },\n ],\n database: [\n {\n trope: 'Full Table Scan Blindspot',\n bad: 'Querying high-cardinality tables without index coverage',\n good: 'Verify query plans with EXPLAIN ANALYZE and add composite B-Tree indexes',\n },\n {\n trope: 'Non-Atomic Batch Mutation',\n bad: 'Executing multiple related DB writes sequentially without transaction wrapper',\n good: 'Wrap multi-table updates in an atomic transaction with automatic rollback',\n },\n {\n trope: 'Destructive Schema Migration',\n bad: 'Dropping or renaming columns in production without multi-phase migration',\n good: 'Use expand-and-contract: add new column, sync data, migrate callers, drop old',\n },\n ],\n security: [\n {\n trope: 'Hardcoded Secret Pattern',\n bad: 'Committing API keys, tokens, or private salts into source code',\n good: 'Load credentials strictly via runtime environment variables and secret stores',\n },\n {\n trope: 'Prompt Injection Surface',\n bad: 'Directly concatenating untrusted user input into LLM system prompts',\n good: 'Wrap user content in isolated delimiters and strip injection control sequences',\n },\n {\n trope: 'Missing Authorization Check',\n bad: 'Relying only on authentication token presence without checking tenant/object RBAC',\n good: 'Verify user permissions against the specific target record ID before mutation',\n },\n ],\n devops: [\n {\n trope: 'Silent Pipeline Failure',\n bad: 'Executing shell steps without set -euo pipefail, ignoring errors',\n good: 'Always initialize shell scripts with set -euo pipefail and trap handlers',\n },\n {\n trope: 'Unpinned Dependency Shift',\n bad: 'Installing packages with npm install or using :latest docker tags',\n good: 'Lock dependencies with npm ci / lockfiles and use immutable SHA256 image digests',\n },\n {\n trope: 'Leaking Build Secrets',\n bad: 'Passing secrets as Docker build arguments baked into image layers',\n good: 'Use Docker BuildKit secret mounts (--mount=type=secret) or runtime injection',\n },\n ],\n testing: [\n {\n trope: 'Testing Implementation Details',\n bad: 'Asserting on private component state or internal helper functions',\n good: 'Assert on observable user behaviors, DOM roles, and network outcomes',\n },\n {\n trope: 'Flaky Async Assertion',\n bad: 'Using arbitrary setTimeout delays before asserting on asynchronous state',\n good: 'Use waitFor or findBy queries that poll with timeout bounds',\n },\n {\n trope: 'Shared Mutable State',\n bad: 'Reusing database records across concurrent test runners',\n good: 'Isolate test databases per worker or execute in rolled-back transactions',\n },\n ],\n mobile: [\n {\n trope: 'JS Thread Animation Lag',\n bad: 'Driving gestures and scrolling physics on the React Native JS thread',\n good: 'Use React Native Reanimated worklets running directly on the UI thread',\n },\n {\n trope: 'Missing Keyboard Offset',\n bad: 'Forms hidden behind native software keyboard on iOS/Android',\n good: 'Wrap form views in KeyboardAvoidingView with platform-calibrated behavior',\n },\n {\n trope: 'Uncached Image Flooding',\n bad: 'Rendering raw image URLs in list items without memory caching',\n good: 'Use FastImage or Expo Image with disk cache policies and thumbnail previews',\n },\n ],\n meta: [\n {\n trope: 'Hallucinated Tool Capabilities',\n bad: 'Assuming an external library or CLI command exists without verification',\n good: 'Run a verification check or verify package.json before referencing tools',\n },\n {\n trope: 'Premature Completion Claim',\n bad: 'Declaring a task finished because code was generated without verification',\n good: 'Execute tests, linters, or terminal commands to provide concrete proof',\n },\n {\n trope: 'Context Bloat Dumping',\n bad: 'Pasting entire multi-thousand-line files into prompt context',\n good: 'Extract targeted excerpts, symbols, and signatures to preserve tokens',\n },\n ],\n};\n\nfunction parseFrontmatter(content) {\n if (!content.startsWith('---')) return { frontmatter: null, body: content };\n const endIdx = content.indexOf('\\n---', 3);\n if (endIdx === -1) return { frontmatter: null, body: content };\n\n const rawYaml = content.slice(4, endIdx).trim();\n const body = content.slice(endIdx + 4).trim();\n const meta = {};\n\n const lines = rawYaml.split('\\n');\n let currentKey = null;\n let isList = false;\n\n for (const line of lines) {\n const trimmed = line.trim();\n if (!trimmed || trimmed.startsWith('#')) continue;\n\n const match = line.match(/^([a-zA-Z0-9_-]+):\\s*(.*)$/);\n if (match) {\n currentKey = match[1];\n const val = match[2].trim();\n if (!val) {\n meta[currentKey] = [];\n isList = true;\n } else {\n meta[currentKey] = val;\n isList = false;\n }\n } else if (isList && trimmed.startsWith('-')) {\n const item = trimmed\n .slice(1)\n .trim()\n .replace(/^['\"]|['\"]$/g, '');\n if (Array.isArray(meta[currentKey])) {\n meta[currentKey].push(item);\n }\n }\n }\n\n return { frontmatter: rawYaml, meta, body };\n}\n\nfunction buildEnhancedSkill(skillName, originalContent) {\n const { frontmatter, meta, body } = parseFrontmatter(originalContent);\n if (!frontmatter) return null;\n\n const domain = getSkillDomain(skillName);\n const reviewers = DOMAIN_REVIEWERS[domain] || DOMAIN_REVIEWERS.meta;\n const preflights = DOMAIN_PREFLIGHT[domain] || DOMAIN_PREFLIGHT.meta;\n const traps = DOMAIN_TRAPS[domain] || DOMAIN_TRAPS.meta;\n\n // Extract clean title\n const titleMatch = body.match(/^#\\s+(.+)$/m);\n const title = titleMatch\n ? titleMatch[1].trim()\n : `${skillName.replace(/-/g, ' ').replace(/\\b\\w/g, c => c.toUpperCase())} Engineering`;\n\n // Extract existing core technical content (excluding legacy footers)\n let coreBody = body;\n // Strip old canonical footers or tribunal blocks\n const footerMarkerRegex =\n /\\n---\\s*\\n+(\\*\\*Slash command: `\\/review`|## 🏛️ Tribunal Verification & Guardrails|## 🏛️ Tribunal Integration|### ❌ Forbidden AI Tropes|## 🤖 LLM-Specific Traps|AI coding assistants often fall into specific bad habits)[\\s\\S]*$/;\n coreBody = coreBody.replace(footerMarkerRegex, '').trim();\n\n // Strip duplicated titles\n const titleRegex = new RegExp(`^#\\\\s+${escapeRegex(title)}(\\\\r?\\\\n)+`, 'm');\n coreBody = coreBody.replace(titleRegex, '').trim();\n\n // Strip duplicate Activation Boundaries if previously inserted\n coreBody = coreBody.replace(/## Activation Boundaries[\\s\\S]*?(?=\\n## |\\n---|\\n# |$)/g, '').trim();\n coreBody = coreBody\n .replace(/## Mandatory Pre-Flight Context Inspection[\\s\\S]*?(?=\\n## |\\n---|\\n# |$)/g, '')\n .trim();\n coreBody = coreBody\n .replace(/## 🔁 Multi-Pass Execution Protocol[\\s\\S]*?(?=\\n## |\\n---|\\n# |$)/g, '')\n .trim();\n coreBody = coreBody\n .replace(/## 🚨 Edge-Case & Failure Mode Matrix[\\s\\S]*?(?=\\n## |\\n---|\\n# |$)/g, '')\n .trim();\n coreBody = coreBody\n .replace(/## 🤖 LLM-Specific Traps Table[\\s\\S]*?(?=\\n## |\\n---|\\n# |$)/g, '')\n .trim();\n coreBody = coreBody.replace(/## 🏛️ Tribunal Verification & Guardrails[\\s\\S]*$/g, '').trim();\n coreBody = coreBody.replace(/(\\n---\\s*)+$/, '').trim();\n\n // Format frontmatter with SDO trigger guarantee\n let desc = (meta.description || `${skillName} mastery.`).replace(/^[\"']|[\"']$/g, '');\n desc = desc.replace(/^(use\\s+when\\s+)+/i, '').trim();\n desc = `Use when ${desc}`;\n\n // Ensure scripts-binding\n const scripts = Array.isArray(meta['scripts-binding'])\n ? meta['scripts-binding']\n : ['.agent/scripts/lint_runner.js', '.agent/scripts/verify_all.js'];\n if (!scripts.includes('.agent/scripts/lint_runner.js'))\n scripts.push('.agent/scripts/lint_runner.js');\n if (!scripts.includes('.agent/scripts/verify_all.js'))\n scripts.push('.agent/scripts/verify_all.js');\n\n const formattedFrontmatter = [\n '---',\n `name: ${skillName}`,\n `description: \"${desc.replace(/\"/g, '\\\\\"')}\"`,\n `version: 5.0.0`,\n `last-updated: 2026-09-13`,\n meta.skills && meta.skills.length\n ? `skills:\\n${meta.skills.map(s => ` - ${s}`).join('\\n')}`\n : null,\n `tools: Read, Grep, Glob, Bash, Edit, Write`,\n `scripts-binding:\\n${scripts.map(s => ` - ${s}`).join('\\n')}`,\n '---',\n ]\n .filter(Boolean)\n .join('\\n');\n\n // Build the 18-Section Architecture\n const section1_Preflight = `## Mandatory Pre-Flight Context Inspection\n\nBefore generating, refactoring, or reviewing code in the \\`${skillName}\\` domain, inspect these 5 critical parameters:\n\n1. **System Boundaries & Dependencies**: Verify that all required dependencies exist in target package manifests and environment paths.\n2. **Runtime Context & Platform Invariants**: Confirm target platform constraints (Node.js, Browser, Mobile OS, Edge runtime) before applying APIs.\n3. **Execution Guardrails**: Identify potential side-effects, state mutations, and unhandled asynchronous exceptions.\n4. **Validation & Type Contracts**: Validate input data schemas and strict type constraints across all module interfaces.\n5. **Observability & Proof of Execution**: Ensure execution produces tangible verification signals (terminal output, tests, metrics).`;\n\n const section2_Boundaries = `## Activation Boundaries\n\n- **Activate when:** ${desc}\n- **DO NOT activate when:** The task falls outside the \\`${skillName}\\` domain or is managed by a different dedicated specialist.`;\n\n const section3_ExecutionProtocol = `## 🔁 Multi-Pass Execution Protocol\n\nExecute all non-trivial tasks through this 7-pass cognitive loop:\n\n| Pass | Phase | Core Action |\n|:---|:---|:---|\n| **Pass 1** | **Understand** | Deconstruct the user's explicit objective, implicit requirements, and platform constraints. |\n| **Pass 2** | **Plan** | Decompose the task into smallest logical steps; map dependencies and required tool calls. |\n| **Pass 3** | **Execute** | Implement the solution with production-grade craft, zero placeholders, and strict typing. |\n| **Pass 4** | **Verify** | Run linters, unit tests, or compiler checks to validate structural correctness. |\n| **Pass 5** | **Attack** | Perform an adversarial review searching for edge-case failures, race conditions, and traps. |\n| **Pass 6** | **Improve** | Eliminate discovered friction, optimize performance, and harden error boundaries. |\n| **Pass 7** | **Quality Gate** | Enforce Verification-Before-Completion (VBC) with concrete terminal proof before finalizing. |`;\n\n const section4_EdgeCases = `## 🚨 Edge-Case & Failure Mode Matrix\n\n| Scenario | Risk | Mitigation Strategy |\n|:---|:---|:---|\n| **Empty or Null Inputs** | Unhandled exception or unexpected rendering collapse | Enforce fallback guards, optional chaining, and explicit empty state handlers |\n| **Network Timeout / Latency** | Hanging operations or duplicate side-effects | Implement bounded abort controllers, exponential backoff, and idempotency keys |\n| **Concurrency / Race Conditions** | Stale state overwrite or inconsistent data mutations | Use atomic transactions, mutex locking, or cancel-on-resubmit controls |\n| **Invalid Schema / Malformed Payload** | Downstream runtime errors or security injection | Validate boundary payloads with Zod/Pydantic schemas prior to execution |\n| **Resource / Memory Saturation** | OOM errors, frame drops, or memory leaks | Clean up listeners, cancel active timers, and enforce pagination/virtualization |`;\n\n const section5_Traps = `## 🤖 LLM-Specific Traps Table\n\n| Anti-Pattern | What AI Commonly Does Wrong | What Is Actually Correct |\n|:---|:---|:---|\n${traps.map(t => `| **${t.trope}** | ${t.bad} | ${t.good} |`).join('\\n')}`;\n\n const section6_Tribunal = `## 🏛️ Tribunal Verification & Guardrails\n\n**Active Reviewers:** ${reviewers.map(r => `\\`${r}\\``).join(' · ')}\n**Slash Command:** \\`/review\\` or \\`/tribunal-full\\`\n\n### ✅ Pre-Flight Self-Audit Checklist\n\n\\`\\`\\`\n${preflights.join('\\n')}\n\\`\\`\\`\n\n### 🛑 Verification-Before-Completion (VBC) Protocol\n\n**CRITICAL:** You must follow a strict \"evidence-based closeout\" state machine.\n- ❌ **Forbidden:** Declaring a task complete because the output \"looks correct.\"\n- ✅ **Required:** You are explicitly forbidden from finalizing any task without providing **concrete evidence** (terminal output, passing test suites, compiler success, or equivalent operational proof) that your output works as intended.`;\n\n // Assemble the complete enhanced document (Boilerplate stripped)\n const enhancedContent = `${formattedFrontmatter}\n\n# ${title}\n\n${coreBody}\n`;\n\n return enhancedContent.trim() + '\\n';\n}\n\nfunction escapeRegex(string) {\n return string.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n}\n\nfunction run() {\n if (!fs.existsSync(SKILLS_DIR)) {\n console.error(`✖ Skills directory not found: ${SKILLS_DIR}`);\n process.exit(1);\n }\n\n const entries = fs.readdirSync(SKILLS_DIR, { withFileTypes: true });\n let skillDirs = entries.filter(e => e.isDirectory()).map(e => e.name);\n\n if (TARGET_SKILL) {\n skillDirs = skillDirs.filter(s => s.toLowerCase() === TARGET_SKILL.toLowerCase());\n if (skillDirs.length === 0) {\n console.error(`✖ Skill not found: ${TARGET_SKILL}`);\n process.exit(1);\n }\n }\n\n if (TARGET_DOMAIN) {\n const domainSkills = domainRoutes[TARGET_DOMAIN] || [];\n skillDirs = skillDirs.filter(s => domainSkills.includes(s));\n console.log(`Filtering for domain: ${TARGET_DOMAIN} (${skillDirs.length} skills found)`);\n }\n\n console.log(`\\n🚀 State-of-the-Art Skill Enhancement Engine`);\n console.log(`━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━`);\n console.log(`Target Skills: ${skillDirs.length}`);\n console.log(\n `Execution Mode: ${DRY_RUN ? 'DRY RUN (preview only)' : FIX ? 'FIX (writing changes)' : 'VALIDATE ONLY'}`,\n );\n console.log(`Sync to Root: ${SYNC_TO_ROOT ? 'YES' : 'NO'}\\n`);\n\n let enhancedCount = 0;\n let skippedCount = 0;\n let errorCount = 0;\n\n for (const skillName of skillDirs) {\n const skillPath = path.join(SKILLS_DIR, skillName, 'SKILL.md');\n if (!fs.existsSync(skillPath)) {\n skippedCount++;\n continue;\n }\n\n try {\n const original = fs.readFileSync(skillPath, 'utf8');\n const enhanced = buildEnhancedSkill(skillName, original);\n\n if (!enhanced) {\n console.warn(`⚠️ [SKIP] Could not parse frontmatter in: ${skillName}`);\n skippedCount++;\n continue;\n }\n\n const isModified = original !== enhanced;\n\n if (isModified) {\n enhancedCount++;\n if (FIX) {\n fs.writeFileSync(skillPath, enhanced, 'utf8');\n if (SYNC_TO_ROOT && fs.existsSync(ROOT_SKILLS_DIR)) {\n const rootSkillDir = path.join(ROOT_SKILLS_DIR, skillName);\n if (!fs.existsSync(rootSkillDir)) fs.mkdirSync(rootSkillDir, { recursive: true });\n fs.writeFileSync(path.join(rootSkillDir, 'SKILL.md'), enhanced, 'utf8');\n }\n console.log(`✅ [ENHANCED] ${skillName} (v5.0.0, domain: ${getSkillDomain(skillName)})`);\n } else {\n console.log(`🔍 [PENDING] ${skillName} (would enhance)`);\n }\n } else {\n skippedCount++;\n console.log(`⏭️ [IDENTICAL] ${skillName}`);\n }\n } catch (err) {\n errorCount++;\n console.error(`✖ [ERROR] Failed processing ${skillName}: ${err.message}`);\n }\n }\n\n console.log(`\\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━`);\n console.log(`Total Examined: ${skillDirs.length}`);\n console.log(`Enhanced: ${enhancedCount}`);\n console.log(`Unchanged/Skip: ${skippedCount}`);\n console.log(`Errors: ${errorCount}`);\n console.log(`━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\\n`);\n}\n\nrun();\n"
11
- }
@@ -1,15 +0,0 @@
1
- {
2
- "file": "scripts/stress_benchmark.js",
3
- "riskScore": "Low",
4
- "blastRadius": 1,
5
- "imports": {
6
- "fs": [],
7
- "path": [],
8
- "os": [],
9
- "perf_hooks": []
10
- },
11
- "dependents": [
12
- "test/unit/stress.test.js"
13
- ],
14
- "content": "#!/usr/bin/env node\n/**\n * Tribunal-Kit Deep Stress Benchmark & Verification Suite\n * =========================================================\n * Heavy-load stress testing for high performance, zero hallucination,\n * low token consumption, and absolute governance integrity.\n *\n * Run: node scripts/stress_benchmark.js\n */\n\n'use strict';\n\nconst fs = require('fs');\nconst path = require('path');\nconst os = require('os');\nconst { performance } = require('perf_hooks');\n\n// ANSI colors\nconst C = {\n reset: '\\x1b[0m',\n bold: '\\x1b[1m',\n green: '\\x1b[92m',\n yellow: '\\x1b[93m',\n cyan: '\\x1b[96m',\n red: '\\x1b[91m',\n gray: '\\x1b[90m',\n white: '\\x1b[97m',\n};\n\nfunction c(color, text) {\n return `${C[color]}${text}${C.reset}`;\n}\nfunction bold(text) {\n return `${C.bold}${text}${C.reset}`;\n}\n\n// Target scripts\nconst SCRIPT_DIR = path.resolve(__dirname, '../.agent/scripts');\nconst contextBroker = require(path.join(SCRIPT_DIR, 'context_broker.js'));\nconst pipelineEngine = require(path.join(SCRIPT_DIR, 'pipeline_engine.js'));\nconst innerLoopValidator = require(path.join(SCRIPT_DIR, 'inner_loop_validator.js'));\nconst contractEngine = require(path.join(SCRIPT_DIR, 'contract_engine.js'));\nconst promptCompiler = require(path.join(SCRIPT_DIR, 'prompt_compiler.js'));\nconst _graphBuilder = require(path.join(SCRIPT_DIR, 'graph_builder.js'));\nconst swarmDispatcher = require(path.join(SCRIPT_DIR, 'swarm_dispatcher.js'));\n\nasync function runStressSuite() {\n console.log('');\n console.log(bold(` 🚀 Tribunal-Kit Governance Stress & Optimization Benchmark`));\n console.log(c('gray', ` ─────────────────────────────────────────────────────────────`));\n console.log(\n c(\n 'gray',\n ` Platform: ${os.platform()} ${os.arch()} | Node: ${process.version} | CPUs: ${os.cpus().length}`,\n ),\n );\n console.log(c('gray', ` ─────────────────────────────────────────────────────────────`));\n console.log('');\n\n const results = {\n concurrency: null,\n scale: null,\n token_compression: null,\n anti_hallucination: null,\n };\n\n // ── 1. High Concurrency Stress Test ─────────────────────────────────────────\n console.log(\n c('cyan', ' ▸ [STRESS 1/4] High-Concurrency Engine Dispatch (50 Parallel Requests)...'),\n );\n {\n const CONCURRENCY_COUNT = 50;\n const startMem = process.memoryUsage().heapUsed;\n const startTime = performance.now();\n\n const tasks = Array.from({ length: CONCURRENCY_COUNT }, (_, i) => {\n return (async () => {\n // Run context broker lookup\n const cbRes = contextBroker.resolveContext({\n task: `Task ${i}: Build secure authentication with JWT and React`,\n model: i % 2 === 0 ? 'large' : 'small',\n });\n\n // Run inner loop validator snippet check\n const snippet = [\n 'const jwt = req' + 'uire(\"jsonwebtoken\");',\n 'function login(user) {',\n ' if (!user) throw new Error(\"User required\");',\n ' return jwt.sign({ id: user.id }, \"secret\", { expiresIn: \"1h\" });',\n '}',\n ].join('\\n');\n const valRes = innerLoopValidator.validateSnippet(snippet, 'ts');\n\n // Run pipeline plan phase\n const planRes = pipelineEngine.planPhase(`Build API route ${i}`, [`route${i}.ts`]);\n\n return { cbRes, valRes, planRes };\n })();\n });\n\n const completed = await Promise.all(tasks);\n const endTime = performance.now();\n const endMem = process.memoryUsage().heapUsed;\n\n const totalMs = endTime - startTime;\n const opsPerSec = Math.round((CONCURRENCY_COUNT * 3 * 1000) / totalMs);\n const memDeltaMb = Math.round(((endMem - startMem) / 1024 / 1024) * 100) / 100;\n\n results.concurrency = {\n total_operations: CONCURRENCY_COUNT * 3,\n total_time_ms: Math.round(totalMs),\n ops_per_sec: opsPerSec,\n mem_delta_mb: memDeltaMb,\n all_passed: completed.length === CONCURRENCY_COUNT,\n };\n\n console.log(\n c(\n 'green',\n ` ✔ Completed ${results.concurrency.total_operations} engine ops in ${results.concurrency.total_time_ms}ms (${opsPerSec} ops/sec, Heap Delta: ${memDeltaMb}MB)`,\n ),\n );\n }\n\n // ── 2. Scale & Heavy AST Input Stress ───────────────────────────────────────\n console.log(\n c('cyan', ' ▸ [STRESS 2/4] Large Codebase & Scale Parsing (10,000 LOC Synthetic File)...'),\n );\n {\n // Generate synthetic 10k LOC string\n const lines = [];\n lines.push('const express = req' + 'uire(\"express\");');\n lines.push('const app = express();');\n for (let i = 0; i < 2000; i++) {\n lines.push(`// Helper function block ${i}`);\n lines.push(`function helper_${i}(val) {`);\n lines.push(` if (!val) return null;`);\n lines.push(` const res = val * ${i} + 42;`);\n lines.push(` return { index: ${i}, value: res };`);\n lines.push(`}`);\n }\n lines.push('module.exports = { app };');\n const largeCode = lines.join('\\n');\n\n const startTime = performance.now();\n\n // 1. Inner loop validator on 10k LOC\n const valResult = innerLoopValidator.validateSnippet(largeCode, 'js');\n\n // 2. Contract engine evaluation\n const contractResult = contractEngine.evaluateCode(largeCode, 'large_file.js');\n\n const endTime = performance.now();\n const durationMs = Math.round(endTime - startTime);\n\n results.scale = {\n lines_of_code: lines.length,\n file_size_kb: Math.round(Buffer.byteLength(largeCode, 'utf8') / 1024),\n parse_time_ms: durationMs,\n passed_validator: valResult.passed,\n passed_contracts: contractResult.passed,\n };\n\n console.log(\n c(\n 'green',\n ` ✔ Parsed & audited ${results.scale.lines_of_code} LOC (${results.scale.file_size_kb} KB) in ${durationMs}ms`,\n ),\n );\n }\n\n // ── 3. Token Compression & Budget Stress ─────────────────────────────────────\n console.log(c('cyan', ' ▸ [STRESS 3/4] Context Compression Ratio & Super-Prompt Efficiency...'));\n {\n const rawPrompt = `\n System: You are an AI coding assistant.\n Instructions:\n 1. Follow security rules strictly.\n 2. Do not log credentials to console.\n 3. Always use typed interfaces in TypeScript.\n 4. Handle errors properly in try-catch blocks.\n 5. Validate inputs with Zod schemas.\n Context:\n File: src/auth/login.ts\n Imports: express, jsonwebtoken, zod\n Dependencies: user-service, token-store\n Rules:\n - RULE 1: Never hardcode secrets.\n - RULE 2: No console logging in production.\n - RULE 3: Parameterize all SQL queries.\n `;\n\n const rawTokenEstimate = Math.round(rawPrompt.length / 4);\n\n const compiled = promptCompiler.compileSuperPrompt({\n task: 'Build secure authentication endpoint',\n stack: ['express', 'typescript', 'zod'],\n rules: ['security', 'type-safety', 'no-console-log'],\n context_files: ['src/auth/login.ts'],\n });\n\n const compiledString = typeof compiled === 'string' ? compiled : JSON.stringify(compiled);\n const compressedTokenEstimate = Math.round(compiledString.length / 4);\n const savingsPercent = Math.round((1 - compressedTokenEstimate / rawTokenEstimate) * 100);\n\n results.token_compression = {\n raw_tokens_estimate: rawTokenEstimate,\n compressed_tokens_estimate: compressedTokenEstimate,\n savings_percent: savingsPercent,\n };\n\n console.log(\n c(\n 'green',\n ` ✔ Super-Prompt compressed payload from ~${rawTokenEstimate} to ~${compressedTokenEstimate} tokens (${savingsPercent}% token savings)`,\n ),\n );\n }\n\n // ── 4. Anti-Hallucination & Governance Stress ────────────────────────────────\n console.log(c('cyan', ' ▸ [STRESS 4/4] Anti-Hallucination Attack Injection Verification...'));\n {\n const maliciousPayloads = [\n {\n name: 'Code Injection (eval)',\n code: ['const result = ', 'ev', 'al(req.query.userCode);'].join(''),\n shouldFail: true,\n },\n {\n name: 'Hardcoded Password',\n code: ['const dbPass', 'word = \"SuperSecretPassword123!\";'].join(''),\n shouldFail: true,\n },\n {\n name: \"JWT 'none' Algorithm\",\n code: [\n 'const jwt = req' + 'uire(\"jsonwebtoken\"); jwt.verify(token, secret, { algo',\n 'rithms: [\"none\"] });',\n ].join(''),\n shouldFail: true,\n },\n {\n name: 'Direct innerHTML Assignment',\n code: ['document.getElementById(\"out\").inner', 'HTML = unescapedInput;'].join(''),\n shouldFail: true,\n },\n {\n name: 'Clean Production Code',\n code: [\n 'const z = req' + 'uire(\"zod\");',\n 'const UserSchema = z.object({ id: z.string() });',\n 'function parseUser(data) {',\n ' return UserSchema.parse(data);',\n '}',\n 'module.exports = { parseUser };',\n ].join('\\n'),\n shouldFail: false,\n },\n ];\n\n let caughtCount = 0;\n let totalMalicious = 0;\n\n for (const testCase of maliciousPayloads) {\n const valResult = innerLoopValidator.validateSnippet(testCase.code, 'ts');\n if (testCase.shouldFail) {\n totalMalicious++;\n if (\n !valResult.passed ||\n valResult.verdict === 'REJECTED' ||\n valResult.verdict === 'WARNING'\n ) {\n caughtCount++;\n }\n } else {\n if (valResult.passed) {\n // Clean code passed as expected\n }\n }\n }\n\n // Swarm Payload Anti-Hallucination Schema check\n const invalidSwarmPayload = {\n workers: [\n {\n task_id: 'w1',\n invalid_extra_field: 'hallucinated_data',\n },\n ],\n };\n const swarmResult = swarmDispatcher.validateSwarmPayload(invalidSwarmPayload, { quiet: true });\n const caughtSwarmHallucination = swarmResult === false;\n\n const detectionRate = Math.round((caughtCount / totalMalicious) * 100);\n\n results.anti_hallucination = {\n total_malicious_cases: totalMalicious,\n caught_cases: caughtCount,\n detection_rate_percent: detectionRate,\n caught_swarm_hallucination: caughtSwarmHallucination,\n };\n\n console.log(\n c(\n 'green',\n ` ✔ Anti-Hallucination Barrier: ${caughtCount}/${totalMalicious} malicious vulnerabilities caught (${detectionRate}% detection rate)`,\n ),\n );\n console.log(\n c(\n 'green',\n ` ✔ Swarm Payload Strict Schema Gate: ${caughtSwarmHallucination ? 'BLOCKED invalid payload' : 'PASSED'}`,\n ),\n );\n }\n\n // ── Print Summary ────────────────────────────────────────────────────────────\n console.log();\n console.log(bold(` 📊 Summary of Stress Testing Results`));\n console.log(c('gray', ` ─────────────────────────────────────────────────────────────`));\n console.log(\n ` ${c('white', 'Benchmark Category'.padEnd(30))} ${c('white', 'Metric'.padEnd(20))} ${c('white', 'Status'.padStart(10))}`,\n );\n console.log(c('gray', ` ─────────────────────────────────────────────────────────────`));\n\n console.log(\n ` ${c('white', 'Concurrency (50 Ops)'.padEnd(30))} ${c('green', `${results.concurrency.ops_per_sec} ops/sec`.padEnd(20))} ${c('green', 'PASSED'.padStart(10))}`,\n );\n console.log(\n ` ${c('white', 'Scale (10,000 LOC)'.padEnd(30))} ${c('green', `${results.scale.parse_time_ms} ms`.padEnd(20))} ${c('green', 'PASSED'.padStart(10))}`,\n );\n console.log(\n ` ${c('white', 'Token Compression'.padEnd(30))} ${c('green', `${results.token_compression.savings_percent}% reduction`.padEnd(20))} ${c('green', 'PASSED'.padStart(10))}`,\n );\n console.log(\n ` ${c('white', 'Anti-Hallucination Rate'.padEnd(30))} ${c('green', `${results.anti_hallucination.detection_rate_percent}% caught`.padEnd(20))} ${c('green', 'PASSED'.padStart(10))}`,\n );\n\n console.log(c('gray', ` ─────────────────────────────────────────────────────────────`));\n console.log();\n\n // Save report to artifacts / root\n const outputPath = path.resolve(__dirname, '../benchmark-stress-results.json');\n fs.writeFileSync(outputPath, JSON.stringify(results, null, 2));\n console.log(c('green', ` ✔ Results exported to benchmark-stress-results.json`));\n console.log();\n\n return results;\n}\n\nif (require.main === module) {\n runStressSuite().catch(err => {\n console.error(`Stress benchmark failed: ${err.message}`);\n process.exit(1);\n });\n}\n\nmodule.exports = { runStressSuite };\n"
15
- }
@@ -1,11 +0,0 @@
1
- {
2
- "file": "scripts/sync-skills.js",
3
- "riskScore": "Low",
4
- "blastRadius": 0,
5
- "imports": {
6
- "fs": [],
7
- "path": []
8
- },
9
- "dependents": [],
10
- "content": "#!/usr/bin/env node\n/**\n * sync-skills.js — Multi-platform skill directory synchronizer.\n *\n * Ensures skills are mirrored into:\n * - skills/ (for universal tools, Claude Code, Cursor, Windsurf, Roo Code)\n * - .agents/skills/ (for OpenAI Codex CLI and multi-agent harnesses)\n * from the canonical source:\n * - .agent/skills/\n */\n\n'use strict';\n\nconst fs = require('fs');\nconst path = require('path');\n\nconst ROOT = path.resolve(__dirname, '..');\nconst CANONICAL_SKILLS = path.join(ROOT, '.agent', 'skills');\nconst TARGET_SKILLS = path.join(ROOT, 'skills');\nconst TARGET_AGENTS_SKILLS = path.join(ROOT, '.agents', 'skills');\n\nfunction copyDirRecursive(src, dest) {\n if (!fs.existsSync(dest)) {\n fs.mkdirSync(dest, { recursive: true });\n }\n\n const entries = fs.readdirSync(src, { withFileTypes: true });\n for (const entry of entries) {\n const srcPath = path.join(src, entry.name);\n const destPath = path.join(dest, entry.name);\n\n if (entry.isDirectory()) {\n copyDirRecursive(srcPath, destPath);\n } else {\n fs.copyFileSync(srcPath, destPath);\n }\n }\n}\n\nfunction syncSkills() {\n console.log('\\n 🔱 Syncing Tribunal Skills across platform conventions...');\n\n if (!fs.existsSync(CANONICAL_SKILLS)) {\n console.error(' ✖ Error: Canonical skills directory .agent/skills not found!');\n process.exit(1);\n }\n\n copyDirRecursive(CANONICAL_SKILLS, TARGET_SKILLS);\n console.log(` ✓ Mirrored to ${path.relative(ROOT, TARGET_SKILLS)}/`);\n\n copyDirRecursive(CANONICAL_SKILLS, TARGET_AGENTS_SKILLS);\n console.log(` ✓ Mirrored to ${path.relative(ROOT, TARGET_AGENTS_SKILLS)}/`);\n\n console.log(' ✔ All skills synchronized.\\n');\n}\n\nif (require.main === module) {\n syncSkills();\n}\n\nmodule.exports = { syncSkills };\n"
11
- }
@@ -1,11 +0,0 @@
1
- {
2
- "file": "scripts/sync-version.js",
3
- "riskScore": "Low",
4
- "blastRadius": 0,
5
- "imports": {
6
- "fs": [],
7
- "path": []
8
- },
9
- "dependents": [],
10
- "content": "#!/usr/bin/env node\n/**\n * sync-version.js — Release metadata consistency check for Tribunal Kit.\n *\n * Verifies the package version, native package metadata, lockfile metadata,\n * and public asset-count claims before a release. It intentionally performs\n * no implicit writes: a failed check makes stale release metadata visible.\n */\n\n'use strict';\n\nconst fs = require('fs');\nconst path = require('path');\n\nconst ROOT = path.resolve(__dirname, '..');\nconst PKG_PATH = path.join(ROOT, 'package.json');\nconst PKG = JSON.parse(fs.readFileSync(PKG_PATH, 'utf8'));\nconst VERSION = PKG.version;\n\nfunction readText(relativePath) {\n return fs.readFileSync(path.join(ROOT, relativePath), 'utf8');\n}\n\nfunction readJson(relativePath) {\n return JSON.parse(readText(relativePath));\n}\n\nfunction countDirectory(relativePath, predicate) {\n const directory = path.join(ROOT, relativePath);\n if (!fs.existsSync(directory)) return 0;\n return fs.readdirSync(directory, { withFileTypes: true }).filter(predicate).length;\n}\n\nfunction countReviewers() {\n const agentsDir = path.join(ROOT, '.agent', 'agents');\n return countDirectory('.agent/agents', entry => {\n if (!entry.isFile() || !entry.name.endsWith('.md')) return false;\n const content = fs.readFileSync(path.join(agentsDir, entry.name), 'utf8');\n return (\n /reviewer|auditor|tester|throughput-optimizer/i.test(entry.name) ||\n /^role:\\s*reviewer\\s*$/im.test(content)\n );\n });\n}\n\nconst COUNTS = {\n agents: countDirectory('.agent/agents', entry => entry.isFile() && entry.name.endsWith('.md')),\n reviewers: countReviewers(),\n skills: countDirectory(\n '.agent/skills',\n entry =>\n entry.isDirectory() &&\n fs.existsSync(path.join(ROOT, '.agent', 'skills', entry.name, 'SKILL.md')),\n ),\n workflows: countDirectory(\n '.agent/workflows',\n entry => entry.isFile() && entry.name.endsWith('.md'),\n ),\n scripts: countDirectory(\n '.agent/scripts',\n entry => entry.isFile() && /\\.(?:js|py)$/.test(entry.name),\n ),\n};\n\nconst failures = [];\n\nfunction fail(message) {\n failures.push(message);\n}\n\nfunction checkVersionMetadata() {\n const expectedOptionalVersion = `^${VERSION}`;\n for (const [name, declaredVersion] of Object.entries(PKG.optionalDependencies || {})) {\n if (declaredVersion !== expectedOptionalVersion) {\n fail(\n `package.json optional dependency ${name} is ${declaredVersion}, expected ${expectedOptionalVersion}`,\n );\n }\n }\n\n const lock = readJson('package-lock.json');\n if (lock.version !== VERSION || lock.packages?.['']?.version !== VERSION) {\n fail(`package-lock.json root version does not match package.json (${VERSION})`);\n }\n for (const [name, declaredVersion] of Object.entries(\n lock.packages?.['']?.optionalDependencies || {},\n )) {\n if (declaredVersion !== expectedOptionalVersion) {\n fail(\n `package-lock.json optional dependency ${name} is ${declaredVersion}, expected ${expectedOptionalVersion}`,\n );\n }\n }\n\n const cargoToml = readText('crates/core/Cargo.toml');\n const cargoTomlVersion = cargoToml.match(/^version\\s*=\\s*\"([^\"]+)\"/m)?.[1];\n if (cargoTomlVersion !== VERSION) {\n fail(`crates/core/Cargo.toml version is ${cargoTomlVersion || 'missing'}, expected ${VERSION}`);\n }\n\n const cargoLock = readText('Cargo.lock');\n const cargoLockVersion = cargoLock.match(\n /name\\s*=\\s*\"tribunal-core\"[\\s\\S]*?version\\s*=\\s*\"([^\"]+)\"/,\n )?.[1];\n if (cargoLockVersion !== VERSION) {\n fail(\n `Cargo.lock tribunal-core version is ${cargoLockVersion || 'missing'}, expected ${VERSION}`,\n );\n }\n\n const readmeRelease = readText('README.md').match(/Release-v([0-9]+\\.[0-9]+\\.[0-9]+)/)?.[1];\n if (readmeRelease !== VERSION) {\n fail(`README release badge is ${readmeRelease || 'missing'}, expected ${VERSION}`);\n }\n}\n\nconst DOCUMENTS = [\n 'README.md',\n '.agent/ARCHITECTURE.md',\n '.agent/rules/GEMINI.md',\n 'CONTRIBUTING.md',\n];\n\nconst CLAIM_PATTERNS = [\n { entity: 'agents', regex: /(\\d+)\\s*(?:specialist\\s+)?agents?\\b/gi },\n {\n entity: 'reviewers',\n regex: /(\\d+)\\s*(?:-\\s*)?(?:(?:parallel|domain(?:-specific)?|tribunal|code)\\s+)*reviewers?\\b/gi,\n },\n {\n entity: 'skills',\n regex: /(\\d+)\\s*(?:valid\\s+|modular\\s+)?skills?(?:\\s+(?:packages?|modules?))?\\b/gi,\n },\n { entity: 'workflows', regex: /(\\d+)\\s*(?:slash\\s+)?workflows?\\b/gi },\n { entity: 'scripts', regex: /(\\d+)\\s*(?:JS\\s+)?(?:automation\\s+)?scripts?\\b/gi },\n];\n\nfunction checkDocumentCounts() {\n for (const relativePath of DOCUMENTS) {\n const content = readText(relativePath);\n for (const { entity, regex } of CLAIM_PATTERNS) {\n regex.lastIndex = 0;\n let match;\n while ((match = regex.exec(content)) !== null) {\n const claimed = Number.parseInt(match[1], 10);\n if (claimed < 5 || claimed > 500) continue;\n if (claimed !== COUNTS[entity]) {\n const line = content.slice(0, match.index).split(/\\r?\\n/).length;\n fail(`${relativePath}:${line} says ${claimed} ${entity}, actual is ${COUNTS[entity]}`);\n }\n }\n }\n }\n}\n\nconsole.log(`\\n Tribunal Kit v${VERSION} — Release Metadata Check`);\nconsole.log(' ────────────────────────────────────────────────');\nconsole.log(` Agents: ${COUNTS.agents} (${COUNTS.reviewers} reviewers)`);\nconsole.log(` Skills: ${COUNTS.skills}`);\nconsole.log(` Workflows: ${COUNTS.workflows}`);\nconsole.log(` Scripts: ${COUNTS.scripts}`);\n\ncheckVersionMetadata();\ncheckDocumentCounts();\n\nif (failures.length > 0) {\n console.log();\n for (const message of failures) console.log(` ✗ ${message}`);\n console.log(\n `\\n Found ${failures.length} release metadata inconsistency${failures.length === 1 ? '' : 'ies'}.`,\n );\n process.exitCode = 1;\n} else {\n console.log(\n `\\n ✓ Version metadata and public count claims are in sync across ${DOCUMENTS.length} documents.\\n`,\n );\n}\n"
11
- }
@@ -1,11 +0,0 @@
1
- {
2
- "file": "scripts/telemetry_gc.js",
3
- "riskScore": "Low",
4
- "blastRadius": 0,
5
- "imports": {
6
- "fs": [],
7
- "path": []
8
- },
9
- "dependents": [],
10
- "content": "#!/usr/bin/env node\n/**\n * Telemetry Garbage Collection Script — Tribunal Kit v10 Drop 1\n *\n * Compacts old telemetry data in .tribunal/telemetry/dispatch.jsonl:\n * - Retains last N days of raw events (default: 90)\n * - Aggregates older events into monthly summary buckets\n * - Writes compacted data back\n *\n * Usage:\n * node scripts/telemetry_gc.js [--days 90] [--dry-run] [--path .]\n */\n\nconst fs = require('fs');\nconst path = require('path');\n\n// Parse CLI args\nconst args = process.argv.slice(2);\nfunction getArg(name, defaultValue) {\n const idx = args.indexOf(`--${name}`);\n if (idx === -1) return defaultValue;\n return args[idx + 1] || defaultValue;\n}\nconst dryRun = args.includes('--dry-run');\nconst retentionDays = parseInt(getArg('days', '90'), 10);\nconst targetPath = getArg('path', '.');\n\nconst logFile = path.join(targetPath, '.tribunal', 'telemetry', 'dispatch.jsonl');\nconst archiveDir = path.join(targetPath, '.tribunal', 'telemetry', 'archive');\n\nfunction run() {\n console.log(`\\n⚡ Telemetry GC — Retention: ${retentionDays} days | Dry Run: ${dryRun}`);\n console.log('━'.repeat(50));\n\n if (!fs.existsSync(logFile)) {\n console.log(' ℹ No telemetry log found. Nothing to compact.');\n return;\n }\n\n const raw = fs.readFileSync(logFile, 'utf-8');\n const lines = raw.split('\\n').filter(l => l.trim().length > 0);\n console.log(` Total events in log: ${lines.length}`);\n\n const now = new Date();\n const cutoff = new Date(now.getTime() - retentionDays * 24 * 60 * 60 * 1000);\n\n const retained = [];\n const archived = [];\n\n for (const line of lines) {\n try {\n const event = JSON.parse(line);\n const eventDate = new Date(event.timestamp || '1970-01-01');\n if (eventDate >= cutoff) {\n retained.push(line);\n } else {\n archived.push(event);\n }\n } catch {\n // Malformed line — discard\n continue;\n }\n }\n\n console.log(` Events to retain: ${retained.length}`);\n console.log(` Events to archive: ${archived.length}`);\n\n if (archived.length === 0) {\n if (lines.length !== retained.length) {\n if (!dryRun) fs.writeFileSync(logFile, retained.join('\\n') + '\\n');\n console.log(` ✓ Cleaned malformed lines. ${retained.length} events retained.\\n`);\n } else {\n console.log(' ✓ Nothing to compact. All events within retention window.\\n');\n }\n return;\n }\n\n // Aggregate archived events into monthly buckets\n const monthlyBuckets = {};\n for (const event of archived) {\n const date = new Date(event.timestamp || '1970-01-01');\n const key = `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}`;\n if (!monthlyBuckets[key]) {\n monthlyBuckets[key] = {\n month: key,\n total_dispatches: 0,\n agents: {},\n outcomes: {},\n total_tokens: 0,\n total_duration_ms: 0,\n };\n }\n const bucket = monthlyBuckets[key];\n bucket.total_dispatches++;\n bucket.agents[event.agent_name] = (bucket.agents[event.agent_name] || 0) + 1;\n bucket.outcomes[event.outcome] = (bucket.outcomes[event.outcome] || 0) + 1;\n bucket.total_tokens += event.token_budget_used || 0;\n bucket.total_duration_ms += event.duration_ms || 0;\n }\n\n if (dryRun) {\n console.log('\\n [DRY RUN] Would archive these monthly summaries:');\n for (const [month, bucket] of Object.entries(monthlyBuckets)) {\n console.info(\n ` ${month}: ${bucket.total_dispatches} events, ${bucket.total_tokens} tokens`,\n );\n }\n console.log(` [DRY RUN] Would retain ${retained.length} recent events.\\n`);\n return;\n }\n\n // Write monthly archive files\n if (!fs.existsSync(archiveDir)) {\n fs.mkdirSync(archiveDir, { recursive: true });\n }\n\n for (const [month, bucket] of Object.entries(monthlyBuckets)) {\n const archiveFile = path.join(archiveDir, `${month}.json`);\n // Merge with existing archive if present\n let existing = {};\n if (fs.existsSync(archiveFile)) {\n try {\n existing = JSON.parse(fs.readFileSync(archiveFile, 'utf-8'));\n } catch {\n /* overwrite */\n }\n }\n\n const merged = {\n month: bucket.month,\n total_dispatches: (existing.total_dispatches || 0) + bucket.total_dispatches,\n agents: mergeCountMaps(existing.agents || {}, bucket.agents),\n outcomes: mergeCountMaps(existing.outcomes || {}, bucket.outcomes),\n total_tokens: (existing.total_tokens || 0) + bucket.total_tokens,\n total_duration_ms: (existing.total_duration_ms || 0) + bucket.total_duration_ms,\n };\n\n fs.writeFileSync(archiveFile, JSON.stringify(merged, null, 2));\n console.log(` ✓ Archived: ${archiveFile} (${bucket.total_dispatches} events)`);\n }\n\n // Rewrite the dispatch log with only retained events\n fs.writeFileSync(logFile, retained.join('\\n') + '\\n');\n console.log(` ✓ Compacted dispatch.jsonl: ${retained.length} events retained.`);\n console.log(` ✓ ${archived.length} events moved to monthly archives.\\n`);\n}\n\nfunction mergeCountMaps(a, b) {\n const result = { ...a };\n for (const [key, count] of Object.entries(b)) {\n result[key] = (result[key] || 0) + count;\n }\n return result;\n}\n\nrun();\n"
11
- }
@@ -1,11 +0,0 @@
1
- {
2
- "file": "scripts/validate-payload.js",
3
- "riskScore": "Low",
4
- "blastRadius": 0,
5
- "imports": {
6
- "fs": [],
7
- "path": []
8
- },
9
- "dependents": [],
10
- "content": "const fs = require('fs');\nconst path = require('path');\n\n// Simple Markdown frontmatter and Tribunal header validator\nfunction validateMarkdownFile(filePath) {\n let content;\n try {\n content = fs.readFileSync(filePath, 'utf8');\n } catch (e) {\n return [`Failed to read file: ${e.message}`];\n }\n const errors = [];\n\n // Check for frontmatter\n if (content.startsWith('---')) {\n const parts = content.split('---');\n if (parts.length < 3) {\n errors.push('Malformed YAML frontmatter (missing closing ---)');\n }\n }\n\n // If it's a skill, check for mandatory headers\n if (filePath.includes('/skills/') || filePath.includes('\\\\skills\\\\')) {\n // Exclude templates and documentation that aren't strict skills\n if (!filePath.includes('SKILL.md')) return errors;\n\n // Removed Pre-Flight and VBC checks as they are now centralized in system prompts to save tokens.\n }\n\n return errors;\n}\n\nfunction walkDir(dir, callback) {\n fs.readdirSync(dir).forEach(f => {\n const dirPath = path.join(dir, f);\n const isDirectory = fs.statSync(dirPath).isDirectory();\n isDirectory ? walkDir(dirPath, callback) : callback(path.join(dir, f));\n });\n}\n\nfunction run() {\n const agentDir = path.join(__dirname, '..', '.agent');\n if (!fs.existsSync(agentDir)) {\n console.error('No .agent directory found.');\n process.exit(1);\n }\n\n let hasErrors = false;\n let checkedCount = 0;\n\n console.log('Validating .agent payload...');\n\n walkDir(agentDir, function (filePath) {\n if (filePath.endsWith('.md')) {\n checkedCount++;\n const errors = validateMarkdownFile(filePath);\n if (errors.length > 0) {\n console.error(`\\x1b[31m[FAIL]\\x1b[0m ${filePath}`);\n errors.forEach(e => console.error(` - ${e}`));\n hasErrors = true;\n }\n }\n });\n\n if (hasErrors) {\n console.error(`\\nPayload validation failed. Checked ${checkedCount} files.`);\n process.exit(1);\n } else {\n console.log(`\\x1b[32mPayload validation passed.\\x1b[0m Checked ${checkedCount} files.`);\n }\n}\n\nrun();\n"
11
- }
@@ -1,11 +0,0 @@
1
- {
2
- "file": "scripts/visual_audit.js",
3
- "riskScore": "Low",
4
- "blastRadius": 0,
5
- "imports": {
6
- "fs": [],
7
- "path": []
8
- },
9
- "dependents": [],
10
- "content": "#!/usr/bin/env node\n\n/**\n * Automated UI Visual & Anti-Slop Audit Script\n * Analyzes frontend files (JSX/TSX/CSS/HTML) for visual depth, color spaces, anti-slop rules, and interactive state completeness.\n */\n\nconst fs = require('fs');\nconst path = require('path');\n\nfunction runVisualAudit(filePath) {\n if (!fs.existsSync(filePath)) {\n return {\n status: 'ERROR',\n score: 0,\n message: `File not found: ${filePath}`,\n violations: [],\n };\n }\n\n const content = fs.readFileSync(filePath, 'utf8');\n const violations = [];\n let score = 100;\n\n // 1. Purple/Violet AI cliché color check\n const purpleRegex = /#(?:7[cC]3[aA][eE][dD]|8[bB]5[cC][fF]6|9333ea|a855f7|c084fc)/i;\n if (purpleRegex.test(content) || /color:\\s*(?:purple|violet)/i.test(content)) {\n violations.push({\n rule: 'NO_PURPLE_CLICHE',\n severity: 'REJECTED',\n description:\n 'Primary color uses AI cliché purple/violet (#7C3AED, #8B5CF6). Use signal orange, acid green, slate, or OKLCH blue instead.',\n impact: -25,\n });\n score -= 25;\n }\n\n // 2. Raw Hex without OKLCH or design tokens\n const rawHexRegex = /#[0-9a-fA-F]{6}\\b/g;\n const hexMatches = content.match(rawHexRegex) || [];\n if (hexMatches.length > 4 && !/oklch/i.test(content) && !/var\\(--/i.test(content)) {\n violations.push({\n rule: 'USE_OKLCH_OR_TOKENS',\n severity: 'REJECTED',\n description:\n 'Found raw hex colors without modern OKLCH color spaces or design token variables.',\n impact: -15,\n });\n score -= 15;\n }\n\n // 3. Interactive state check on clickable elements\n if (/<button|<a\\b|onClick=/i.test(content)) {\n if (!/hover:/i.test(content) && !/:hover/i.test(content)) {\n violations.push({\n rule: 'MISSING_HOVER_STATE',\n severity: 'WARNING',\n description: 'Interactive buttons/links lack visible hover state handling.',\n impact: -10,\n });\n score -= 10;\n }\n if (!/focus-visible:/i.test(content) && !/:focus/i.test(content)) {\n violations.push({\n rule: 'MISSING_FOCUS_INDICATOR',\n severity: 'WARNING',\n description: 'Interactive elements lack focus-visible outlines for keyboard accessibility.',\n impact: -10,\n });\n score -= 10;\n }\n }\n\n // 4. Visual depth & border check for container elements\n if (\n /className=[\"'][^\"']*(?:card|container|box|panel|wrapper)[^\"']*[\"']/i.test(content) ||\n /<article|<section/i.test(content)\n ) {\n if (!/border|shadow|hairline|depth/i.test(content)) {\n violations.push({\n rule: 'MISSING_SURFACE_DEPTH',\n severity: 'WARNING',\n description: 'Container elements lack 1px luminous border or ambient shadow depth layers.',\n impact: -15,\n });\n score -= 15;\n }\n }\n\n // 5. Hardcoded static offsets vs dynamic math\n if (/style=\\{\\{[^}]*\\b(?:top|left|height|width):\\s*['\"]\\d+px['\"]/i.test(content)) {\n violations.push({\n rule: 'HARDCODED_PIXEL_LAYOUT',\n severity: 'WARNING',\n description:\n 'Hardcoded static pixel offsets found in inline styles. Use responsive clamp() or layout bounds.',\n impact: -10,\n });\n score -= 10;\n }\n\n const finalScore = Math.max(0, score);\n const status = violations.some(v => v.severity === 'REJECTED')\n ? 'REJECTED'\n : violations.length > 0\n ? 'WARNING'\n : 'APPROVED';\n\n return {\n status,\n score: finalScore,\n file: filePath,\n violations,\n };\n}\n\n// CLI Execution Support\nif (require.main === module) {\n const args = process.argv.slice(2);\n const fileArgIndex = args.indexOf('--file');\n const targetPath = fileArgIndex !== -1 ? args[fileArgIndex + 1] : args[0];\n\n if (!targetPath) {\n console.error('Usage: node visual_audit.js --file <path-to-file>');\n process.exit(1);\n }\n\n const result = runVisualAudit(path.resolve(targetPath));\n console.log(JSON.stringify(result, null, 2));\n\n if (result.status === 'REJECTED') {\n process.exit(1);\n }\n}\n\nmodule.exports = { runVisualAudit };\n"
11
- }
@@ -1,13 +0,0 @@
1
- {
2
- "file": "test/integration/bridges.test.js",
3
- "riskScore": "Low",
4
- "blastRadius": 0,
5
- "imports": {
6
- "child_process": [],
7
- "path": [],
8
- "fs": [],
9
- "os": []
10
- },
11
- "dependents": [],
12
- "content": "'use strict';\n\nconst { spawnSync } = require('child_process');\nconst path = require('path');\nconst fs = require('fs');\nconst os = require('os');\n\nconst CLI = path.resolve(__dirname, '../../bin/tribunal-kit.js');\n\nfunction runCLI(args = [], opts = {}) {\n return spawnSync(process.execPath, [CLI, ...args], {\n encoding: 'utf8',\n timeout: 30000,\n env: { ...process.env, TK_SKIP_UPDATE_CHECK: '1' },\n ...opts,\n });\n}\n\ndescribe('IDE Bridge File Generation', () => {\n let tmpDir;\n\n beforeEach(() => {\n tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'tk-bridge-'));\n });\n\n afterEach(() => {\n fs.rmSync(tmpDir, { recursive: true, force: true });\n });\n\n test('init creates .cursorrules', () => {\n runCLI(['init', '--path', tmpDir, '--skip-update-check']);\n const cursorRules = path.join(tmpDir, '.cursorrules');\n expect(fs.existsSync(cursorRules)).toBe(true);\n const content = fs.readFileSync(cursorRules, 'utf8');\n expect(content).toContain('Tribunal');\n expect(content).toContain('Anti-Hallucination');\n });\n\n test('init creates .windsurfrules', () => {\n runCLI(['init', '--path', tmpDir, '--skip-update-check']);\n const windsurfRules = path.join(tmpDir, '.windsurfrules');\n expect(fs.existsSync(windsurfRules)).toBe(true);\n const content = fs.readFileSync(windsurfRules, 'utf8');\n expect(content).toContain('Windsurf Bridge');\n expect(content).toContain('Tribunal');\n });\n\n test('init creates .gemini/settings.json', () => {\n runCLI(['init', '--path', tmpDir, '--skip-update-check']);\n const geminiSettings = path.join(tmpDir, '.gemini', 'settings.json');\n expect(fs.existsSync(geminiSettings)).toBe(true);\n const json = JSON.parse(fs.readFileSync(geminiSettings, 'utf8'));\n expect(json.rules).toBeDefined();\n expect(json.rules[0].path).toContain('.agent/rules/GEMINI.md');\n });\n\n test('init creates .github/copilot-instructions.md', () => {\n runCLI(['init', '--path', tmpDir, '--skip-update-check']);\n const copilot = path.join(tmpDir, '.github', 'copilot-instructions.md');\n expect(fs.existsSync(copilot)).toBe(true);\n const content = fs.readFileSync(copilot, 'utf8');\n expect(content).toContain('Copilot Bridge');\n });\n\n test('bridge files are NOT overwritten on re-init', () => {\n runCLI(['init', '--path', tmpDir, '--skip-update-check']);\n const cursorRules = path.join(tmpDir, '.cursorrules');\n fs.writeFileSync(cursorRules, '# My custom rules\\nDo not touch');\n runCLI(['init', '--path', tmpDir, '--force', '--skip-update-check']);\n const content = fs.readFileSync(cursorRules, 'utf8');\n expect(content).toContain('# My custom rules\\nDo not touch');\n });\n\n test('all bridge files contain the routing table', () => {\n runCLI(['init', '--path', tmpDir, '--skip-update-check']);\n const content = fs.readFileSync(path.join(tmpDir, '.cursorrules'), 'utf8');\n expect(content).toContain('backend-specialist');\n expect(content).toContain('frontend-specialist');\n });\n\n test('init --dry-run does NOT create bridge files', () => {\n runCLI(['init', '--path', tmpDir, '--dry-run', '--skip-update-check']);\n expect(fs.existsSync(path.join(tmpDir, '.cursorrules'))).toBe(false);\n });\n});\n"
13
- }
@@ -1,12 +0,0 @@
1
- {
2
- "file": "test/integration/browser_cli.test.js",
3
- "riskScore": "Low",
4
- "blastRadius": 0,
5
- "imports": {
6
- "http": [],
7
- "../../dist/browser": [],
8
- "ws": []
9
- },
10
- "dependents": [],
11
- "content": "'use strict';\n\nconst http = require('http');\nconst { browse, auditURL } = require('../../dist/browser');\n\n// Polyfill WebSocket for Node < 21\nif (typeof global.WebSocket === 'undefined') {\n global.WebSocket = require('ws');\n}\n\ndescribe('Browser Live Integration & Auditing', () => {\n let server;\n const PORT = 45678;\n const TEST_URL = `http://127.0.0.1:${PORT}`;\n\n beforeAll(done => {\n server = http.createServer((req, res) => {\n res.writeHead(200, {\n 'Content-Type': 'text/html; charset=utf-8',\n 'X-Content-Type-Options': 'nosniff',\n });\n res.end(`\n <!DOCTYPE html>\n <html lang=\"en\">\n <head>\n <title>Tribunal Test Benchmark</title>\n <style>body { font-family: sans-serif; }</style>\n </head>\n <body>\n <h1>Welcome to Tribunal Kit Browser Test</h1>\n <h2>Secondary Section</h2>\n <p>Testing token-efficient extraction and live WCAG audit.</p>\n <button id=\"btn1\">Start Analysis</button>\n <input type=\"text\" id=\"username\" placeholder=\"Enter username\" />\n <a href=\"/docs\">Documentation</a>\n <img src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==\" alt=\"Sample Logo\" />\n </body>\n </html>\n `);\n });\n\n server.listen(PORT, '127.0.0.1', () => done());\n });\n\n afterAll(done => {\n if (server) {\n server.close(done);\n } else {\n done();\n }\n }, 15000);\n\n test('browse() navigates headlessly and extracts semantic markdown', async () => {\n const result = await browse(TEST_URL);\n\n expect(result.url).toBe(TEST_URL);\n expect(result.isClean).toBe(true);\n expect(result.threatLevel).toBe('clean');\n expect(result.markdown).toContain('# Tribunal Test Benchmark');\n expect(result.markdown).toContain('- [Button #1] \"Start Analysis\"');\n expect(result.markdown).toContain('- [Input #2] type=\"text\" (placeholder=\"Enter username\")');\n expect(result.markdown).toContain('- [Link #3] \"Documentation\" -> /docs');\n expect(Buffer.byteLength(result.markdown, 'utf8')).toBeLessThan(4000);\n expect(result.sandboxed).toContain('<untrusted_web_content');\n }, 25000);\n\n test('auditURL() conducts live accessibility, timing, and security checks', async () => {\n const report = await auditURL(TEST_URL);\n\n expect(report.url).toBe(TEST_URL);\n expect(report.page.title).toBe('Tribunal Test Benchmark');\n expect(report.scores.accessibility).toBeGreaterThanOrEqual(80);\n expect(report.violations.consoleErrors).toHaveLength(0);\n expect(report.violations.networkFailures).toHaveLength(0);\n expect(report.summary.passed).toBe(true);\n }, 25000);\n});\n"
12
- }
@@ -1,12 +0,0 @@
1
- {
2
- "file": "test/integration/graceful_degradation.test.js",
3
- "riskScore": "Low",
4
- "blastRadius": 0,
5
- "imports": {
6
- "path": [],
7
- "child_process": [],
8
- "../../.agent/scripts/context_broker": []
9
- },
10
- "dependents": [],
11
- "content": "/**\n * graceful_degradation.test.js\n * Integration tests for graceful fallbacks when Rust binary or environment flags are set.\n */\n\n'use strict';\n\nconst path = require('path');\nconst { execFileSync } = require('child_process');\n\nconst { tryNativeContextBroker } = require('../../.agent/scripts/context_broker');\n\ndescribe('Day 4: Graceful Degradation & Fallback Behaviors', () => {\n test('TK_DISABLE_RUST=1 forces tryNativeContextBroker to return null', () => {\n const origEnv = process.env.TK_DISABLE_RUST;\n try {\n process.env.TK_DISABLE_RUST = '1';\n const result = tryNativeContextBroker(process.cwd(), null);\n expect(result).toBeNull();\n } finally {\n if (origEnv !== undefined) {\n process.env.TK_DISABLE_RUST = origEnv;\n } else {\n delete process.env.TK_DISABLE_RUST;\n }\n }\n });\n\n test('TRIBUNAL_FORCE_JS=1 causes bin/wrapper.js to execute JS fallback', () => {\n const wrapperPath = path.join(__dirname, '../../bin/wrapper.js');\n const out = execFileSync(process.execPath, [wrapperPath, 'status'], {\n encoding: 'utf8',\n env: { ...process.env, TRIBUNAL_FORCE_JS: '1' },\n stdio: ['ignore', 'pipe', 'ignore'],\n timeout: 10000,\n });\n\n // JS status output should include \"Not installed\" or \"Installed\" or agent counts\n expect(out).toBeDefined();\n expect(typeof out).toBe('string');\n });\n\n test('Invalid subcommand prints error message without crashing Node process unhandled', () => {\n const wrapperPath = path.join(__dirname, '../../bin/wrapper.js');\n try {\n const out = execFileSync(process.execPath, [wrapperPath, 'nonexistent-subcommand-1234'], {\n encoding: 'utf8',\n stdio: ['ignore', 'pipe', 'ignore'],\n timeout: 10000,\n });\n expect(typeof out).toBe('string');\n } catch (err) {\n // Process exiting with error code for invalid command is acceptable\n expect(err.status).toBeGreaterThan(0);\n }\n });\n});\n"
12
- }
@@ -1,13 +0,0 @@
1
- {
2
- "file": "test/integration/init.test.js",
3
- "riskScore": "Low",
4
- "blastRadius": 0,
5
- "imports": {
6
- "child_process": [],
7
- "path": [],
8
- "fs": [],
9
- "os": []
10
- },
11
- "dependents": [],
12
- "content": "'use strict';\n\nconst { spawnSync } = require('child_process');\nconst path = require('path');\nconst fs = require('fs');\nconst os = require('os');\n\nconst CLI = path.resolve(__dirname, '../../bin/tribunal-kit.js');\n\nfunction runCLI(args = [], opts = {}) {\n return spawnSync(process.execPath, [CLI, ...args], {\n encoding: 'utf8',\n timeout: 15000,\n env: { ...process.env, TK_SKIP_UPDATE_CHECK: '1' },\n ...opts,\n });\n}\n\ndescribe('tribunal-kit init command', () => {\n let tmpDir;\n\n beforeEach(() => {\n tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'tk-init-test-'));\n });\n\n afterEach(() => {\n fs.rmSync(tmpDir, { recursive: true, force: true });\n });\n\n test('init --path installs .agent/ and exits 0', () => {\n const result = runCLI(['init', '--path', tmpDir, '--skip-update-check']);\n expect(result.status).toBe(0);\n expect(fs.existsSync(path.join(tmpDir, '.agent'))).toBe(true);\n });\n\n test('init --dry-run writes NO files and exits 0', () => {\n const dryDir = fs.mkdtempSync(path.join(os.tmpdir(), 'tk-dry-'));\n fs.rmSync(dryDir, { recursive: true, force: true });\n fs.mkdirSync(dryDir);\n const result = runCLI(['init', '--path', dryDir, '--dry-run', '--skip-update-check']);\n expect(result.status).toBe(0);\n expect(fs.existsSync(path.join(dryDir, '.agent'))).toBe(false);\n fs.rmSync(dryDir, { recursive: true, force: true });\n });\n\n test('init warns and exits 0 when .agent already exists (no --force)', () => {\n // Pre-create the .agent dir\n fs.mkdirSync(path.join(tmpDir, '.agent'));\n const result = runCLI(['init', '--path', tmpDir, '--skip-update-check']);\n expect(result.status).toBe(0);\n // Should warn about existing install\n expect(result.stdout).toMatch(/already exists|--force/i);\n });\n\n test('init --quiet suppresses main output and exits 0', () => {\n const result = runCLI(['init', '--path', tmpDir, '--quiet', '--skip-update-check']);\n expect(result.status).toBe(0);\n // --quiet suppresses the big banner/card but dim() may still emit\n // a version line; what matters is the .agent/ folder was installed\n expect(fs.existsSync(path.join(tmpDir, '.agent'))).toBe(true);\n });\n\n test('init --force backs up existing files but does not delete custom files and exits 0', () => {\n // First install\n runCLI(['init', '--path', tmpDir, '--skip-update-check']);\n // Write a marker inside a known-cleaned subdir (agents/)\n const marker = path.join(tmpDir, '.agent', 'agents', '__test_marker__.md');\n fs.writeFileSync(marker, 'marker');\n // Force reinstall\n const result = runCLI(['init', '--path', tmpDir, '--force', '--skip-update-check']);\n expect(result.status).toBe(0);\n // The aggressive deletion was removed, so custom files persist\n expect(fs.existsSync(marker)).toBe(true);\n });\n});\n\ndescribe('tribunal-kit status command', () => {\n let tmpDir;\n\n beforeEach(() => {\n tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'tk-status-test-'));\n });\n\n afterEach(() => {\n fs.rmSync(tmpDir, { recursive: true, force: true });\n });\n\n test('status exits 0 when not installed', () => {\n const result = runCLI(['status', '--path', tmpDir]);\n expect(result.status).toBe(0);\n expect(result.stdout).toMatch(/not installed/i);\n });\n\n test('status exits 0 and shows counts when installed', () => {\n runCLI(['init', '--path', tmpDir, '--skip-update-check']);\n const result = runCLI(['status', '--path', tmpDir]);\n expect(result.status).toBe(0);\n expect(result.stdout).toMatch(/installed/i);\n });\n});\n\ndescribe('tribunal-kit help / unknown commands', () => {\n test('--help exits 0 and shows usage', () => {\n const result = runCLI(['--help']);\n expect(result.status).toBe(0);\n expect(result.stdout).toMatch(/init|update|status/i);\n });\n\n test('unknown command exits 1', () => {\n const result = runCLI(['totally-unknown-command']);\n expect(result.status).toBe(1);\n expect(result.stderr).toMatch(/unknown command/i);\n });\n});\n"
13
- }
@@ -1,13 +0,0 @@
1
- {
2
- "file": "test/integration/minimal_change_pipeline.test.js",
3
- "riskScore": "Low",
4
- "blastRadius": 0,
5
- "imports": {
6
- "path": [],
7
- "fs": [],
8
- "../../.agent/scripts/pipeline_engine": [],
9
- "../../.agent/scripts/case_law_manager": []
10
- },
11
- "dependents": [],
12
- "content": "'use strict';\n\nconst path = require('path');\nconst fs = require('fs');\n\nconst AGENT_DIR = path.resolve(__dirname, '../../.agent');\nconst WORKFLOWS_DIR = path.join(AGENT_DIR, 'workflows');\nconst AGENTS_DIR = path.join(AGENT_DIR, 'agents');\nconst SCRIPTS_DIR = path.join(AGENT_DIR, 'scripts');\n\ndescribe('Minimal Change Governance Integration', () => {\n test('minimal_change_engine.js script exists and is executable', () => {\n const enginePath = path.join(SCRIPTS_DIR, 'minimal_change_engine.js');\n expect(fs.existsSync(enginePath)).toBe(true);\n expect(fs.statSync(enginePath).size).toBeGreaterThan(0);\n });\n\n test('minimalist-reviewer.md agent exists and contains core governance rules', () => {\n const agentPath = path.join(AGENTS_DIR, 'minimalist-reviewer.md');\n expect(fs.existsSync(agentPath)).toBe(true);\n const content = fs.readFileSync(agentPath, 'utf8');\n expect(content).toContain('minimalist-reviewer');\n expect(content).toContain('Decision Order Hierarchy');\n expect(content).toContain('Change Budget');\n });\n\n test('minimal.md workflow exists and references minimal_change_engine.js', () => {\n const workflowPath = path.join(WORKFLOWS_DIR, 'minimal.md');\n expect(fs.existsSync(workflowPath)).toBe(true);\n const content = fs.readFileSync(workflowPath, 'utf8');\n expect(content).toContain('/minimal');\n expect(content).toContain('.agent/scripts/minimal_change_engine.js');\n });\n\n test('pipeline_engine.js integrates Minimal Change Gate in planPhase', () => {\n const pipeline = require('../../.agent/scripts/pipeline_engine');\n const result = pipeline.planPhase('add retry policy', ['dist/cli.js']);\n expect(result).toHaveProperty('minimal_change');\n expect(result.minimal_change).not.toBeNull();\n expect(result.minimal_change).toHaveProperty('minimality_classification');\n expect(result.minimal_change).toHaveProperty('minimality_score');\n });\n\n test('case_law_manager.js supports minimal_change domain and MINIMALITY_REJECTED verdict', () => {\n const caseLaw = require('../../.agent/scripts/case_law_manager');\n expect(caseLaw).toBeDefined();\n });\n});\n"
13
- }
@@ -1,12 +0,0 @@
1
- {
2
- "file": "test/integration/parallel_tribunal.test.js",
3
- "riskScore": "Low",
4
- "blastRadius": 0,
5
- "imports": {
6
- "fs": [],
7
- "path": [],
8
- "child_process": []
9
- },
10
- "dependents": [],
11
- "content": "/**\n * parallel_tribunal.test.js\n * Integration test suite for Day 2 Parallel Tribunal Reviewer Engine.\n */\n\n'use strict';\n\nconst fs = require('fs');\nconst path = require('path');\nconst { execFileSync } = require('child_process');\n\ndescribe('Day 2: Parallel Tribunal Reviewer Engine', () => {\n const repoRoot = path.join(__dirname, '../..');\n\n test('DAG Scheduler categorizes reviewer nodes into fast and deep wave groups', () => {\n const tasks = [\n { id: 'logic-reviewer', tier: 'fast', dependencies: [] },\n { id: 'security-auditor', tier: 'deep', dependencies: [] },\n { id: 'complexity-reviewer', tier: 'fast', dependencies: ['logic-reviewer'] },\n { id: 'ui-ux-auditor', tier: 'deep', dependencies: ['logic-reviewer'] },\n ];\n\n const rustBin = path.join(repoRoot, 'target/release/tribunal-core.exe');\n const binToRun = fs.existsSync(rustBin)\n ? rustBin\n : path.join(repoRoot, 'target/debug/tribunal-core.exe');\n\n if (fs.existsSync(binToRun)) {\n const out = execFileSync(binToRun, ['dag-schedule', '--tasks', JSON.stringify(tasks)], {\n encoding: 'utf8',\n });\n\n const res = JSON.parse(out);\n expect(res.success).toBe(true);\n expect(res.total_waves).toBe(2);\n expect(res.wave_groups.length).toBe(2);\n\n // Wave 0 should have 2 root reviewers\n expect(res.wave_groups[0].tasks.length).toBe(2);\n expect(res.wave_groups[0].fast_tasks).toContain('logic-reviewer');\n expect(res.wave_groups[0].deep_tasks).toContain('security-auditor');\n } else {\n // Pass gracefully if binary is not yet compiled\n expect(true).toBe(true);\n }\n });\n\n test('Parallel fan-out Promise.allSettled error isolation', async () => {\n const mockReviewers = [\n { name: 'logic', fn: async () => ({ status: 'pass', durationMs: 15 }) },\n { name: 'security', fn: async () => ({ status: 'pass', durationMs: 25 }) },\n {\n name: 'failing-reviewer',\n fn: async () => {\n throw new Error('Reviewer failed due to timeout');\n },\n },\n ];\n\n const startTime = Date.now();\n const results = await Promise.allSettled(\n mockReviewers.map(async rev => {\n try {\n const res = await rev.fn();\n return { name: rev.name, ...res };\n } catch (err) {\n return { name: rev.name, status: 'error', error: err.message };\n }\n }),\n );\n\n const duration = Date.now() - startTime;\n\n // Must execute in parallel (< 100ms for mock)\n expect(duration).toBeLessThan(500);\n expect(results.length).toBe(3);\n\n // Error isolation: 2 succeeded, 1 gracefully captured error\n const fulfilled = results.filter(r => r.status === 'fulfilled');\n expect(fulfilled.length).toBe(3);\n\n const errorItem = fulfilled.find(r => r.value.name === 'failing-reviewer');\n expect(errorItem.value.status).toBe('error');\n expect(errorItem.value.error).toContain('Reviewer failed');\n });\n});\n"
12
- }
@@ -1,11 +0,0 @@
1
- {
2
- "file": "test/integration/routing.test.js",
3
- "riskScore": "Low",
4
- "blastRadius": 0,
5
- "imports": {
6
- "path": [],
7
- "fs": []
8
- },
9
- "dependents": [],
10
- "content": "'use strict';\n\nconst path = require('path');\nconst fs = require('fs');\n\nconst AGENT_DIR = path.resolve(__dirname, '../../.agent');\nconst WORKFLOWS_DIR = path.join(AGENT_DIR, 'workflows');\nconst AGENTS_DIR = path.join(AGENT_DIR, 'agents');\nconst SKILLS_DIR = path.join(AGENT_DIR, 'skills');\n\n// Expected slash commands per plan (37 workflows)\nconst EXPECTED_WORKFLOWS = [\n 'acf',\n 'api-tester',\n 'audit',\n 'brainstorm',\n 'changelog',\n 'create',\n 'debug',\n 'deploy',\n 'enhance',\n 'fix',\n 'generate',\n 'marathon',\n 'migrate',\n 'minimal',\n 'orchestrate',\n 'performance-benchmarker',\n 'pipeline',\n 'plan',\n 'preview',\n 'refactor',\n 'review',\n 'review-ai',\n 'session',\n 'status',\n 'strengthen-skills',\n 'super-prompt',\n 'swarm',\n 'test',\n 'tribunal-backend',\n 'tribunal-database',\n 'tribunal-frontend',\n 'tribunal-full',\n 'tribunal-mobile',\n 'tribunal-performance',\n 'tribunal-speed',\n 'tribunal-ui',\n 'ui-ux-pro-max',\n];\n\ndescribe('Workflow file integrity', () => {\n test('.agent/workflows/ directory exists', () => {\n expect(fs.existsSync(WORKFLOWS_DIR)).toBe(true);\n });\n\n test('all 37 expected workflow files are present and non-empty', () => {\n const missing = [];\n const empty = [];\n\n for (const name of EXPECTED_WORKFLOWS) {\n const filePath = path.join(WORKFLOWS_DIR, `${name}.md`);\n if (!fs.existsSync(filePath)) {\n missing.push(name);\n } else {\n const size = fs.statSync(filePath).size;\n if (size === 0) empty.push(name);\n }\n }\n\n expect(missing).toEqual([]);\n expect(empty).toEqual([]);\n });\n\n test('no workflow file is a duplicate of another', () => {\n const files = fs.readdirSync(WORKFLOWS_DIR).filter(f => f.endsWith('.md'));\n const contents = files.map(f => fs.readFileSync(path.join(WORKFLOWS_DIR, f), 'utf8').trim());\n const unique = new Set(contents);\n expect(unique.size).toBe(contents.length);\n });\n});\n\ndescribe('Agent file integrity', () => {\n test('.agent/agents/ directory exists', () => {\n expect(fs.existsSync(AGENTS_DIR)).toBe(true);\n });\n\n test('at least 30 agent files are present', () => {\n const files = fs.readdirSync(AGENTS_DIR).filter(f => f.endsWith('.md'));\n expect(files.length).toBeGreaterThanOrEqual(30);\n });\n\n test('all agent files are non-empty', () => {\n const files = fs.readdirSync(AGENTS_DIR).filter(f => f.endsWith('.md'));\n const empty = files.filter(f => fs.statSync(path.join(AGENTS_DIR, f)).size === 0);\n expect(empty).toEqual([]);\n });\n});\n\ndescribe('Skills directory integrity', () => {\n test('.agent/skills/ directory exists', () => {\n expect(fs.existsSync(SKILLS_DIR)).toBe(true);\n });\n\n test('at least 50 skill entries are present', () => {\n const entries = fs.readdirSync(SKILLS_DIR);\n // Each skill is a directory containing a SKILL.md\n const skillDirs = entries.filter(e => fs.statSync(path.join(SKILLS_DIR, e)).isDirectory());\n expect(skillDirs.length).toBeGreaterThanOrEqual(50);\n });\n\n test('every non-empty skill package directory contains a SKILL.md', () => {\n const entries = fs.readdirSync(SKILLS_DIR);\n const skillDirs = entries.filter(e => fs.statSync(path.join(SKILLS_DIR, e)).isDirectory());\n const missing = skillDirs.filter(dir => {\n const skillDir = path.join(SKILLS_DIR, dir);\n return fs.readdirSync(skillDir).length > 0 && !fs.existsSync(path.join(skillDir, 'SKILL.md'));\n });\n expect(missing).toEqual([]);\n });\n});\n"
11
- }
@@ -1,13 +0,0 @@
1
- {
2
- "file": "test/integration/swarm_dispatcher.test.js",
3
- "riskScore": "Low",
4
- "blastRadius": 0,
5
- "imports": {
6
- "path": [],
7
- "fs": [],
8
- "os": [],
9
- "../../.agent/scripts/swarm_dispatcher.js": []
10
- },
11
- "dependents": [],
12
- "content": "const path = require('path');\nconst fs = require('fs');\nconst os = require('os');\nconst {\n findAgentDir,\n validatePayload,\n validateWorkerRequest,\n validateSwarmPayload,\n} = require('../../.agent/scripts/swarm_dispatcher.js');\n\ndescribe('swarm_dispatcher.js legacy mode', () => {\n let tmpDir;\n\n beforeEach(() => {\n tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'swarm-test-'));\n });\n\n afterEach(() => {\n fs.rmSync(tmpDir, { recursive: true, force: true });\n });\n\n test('findAgentDir finds .agent directory', () => {\n const agentDir = path.join(tmpDir, '.agent');\n fs.mkdirSync(agentDir);\n const subDir = path.join(tmpDir, 'src', 'deep', 'folder');\n fs.mkdirSync(subDir, { recursive: true });\n\n const result = findAgentDir(subDir);\n expect(result).not.toBeNull();\n expect(path.resolve(result)).toBe(path.resolve(agentDir));\n });\n\n test('findAgentDir returns null if not found', () => {\n const subDir = path.join(tmpDir, 'src', 'deep');\n fs.mkdirSync(subDir, { recursive: true });\n\n expect(findAgentDir(subDir)).toBeNull();\n });\n\n test('validatePayload valid', () => {\n const agentsDir = path.join(tmpDir, 'agents');\n fs.mkdirSync(agentsDir);\n fs.writeFileSync(path.join(agentsDir, 'test_agent.md'), '');\n\n const workspace = path.join(tmpDir, 'workspace');\n fs.mkdirSync(workspace);\n fs.writeFileSync(path.join(workspace, 'file1.txt'), '');\n\n const payload = {\n dispatch_micro_workers: [\n {\n target_agent: 'test_agent',\n files_attached: ['file1.txt'],\n },\n ],\n };\n\n expect(validatePayload(payload, workspace, agentsDir)).toBe(true);\n });\n\n test('validatePayload missing workers', () => {\n expect(validatePayload({}, tmpDir, tmpDir)).toBe(false);\n });\n\n test('validatePayload files not a list', () => {\n const agentsDir = path.join(tmpDir, 'agents');\n fs.mkdirSync(agentsDir);\n fs.writeFileSync(path.join(agentsDir, 'test_agent.md'), '');\n\n const payload = {\n dispatch_micro_workers: [\n {\n target_agent: 'test_agent',\n files_attached: 'a single file string',\n },\n ],\n };\n\n expect(validatePayload(payload, tmpDir, agentsDir)).toBe(false);\n });\n\n test('validateSwarmPayload validates WorkerRequest correctly', () => {\n const agentsDir = path.join(tmpDir, 'agents');\n fs.mkdirSync(agentsDir);\n fs.writeFileSync(path.join(agentsDir, 'research.md'), '');\n\n const req = {\n task_id: 't123',\n type: 'research',\n agent: 'research',\n goal: 'Find the root cause',\n context: 'We have a bug here.',\n max_retries: 2,\n };\n\n const errors = validateWorkerRequest(req, 0, agentsDir);\n expect(errors).toHaveLength(0);\n\n expect(validateSwarmPayload([req], agentsDir)).toBe(true);\n });\n});\n"
13
- }