tribunal-kit 6.0.0 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (353) hide show
  1. package/.agent/.manifest.json +78 -0
  2. package/.agent/ARCHITECTURE.md +19 -241
  3. package/.agent/agents/accessibility-reviewer.md +23 -16
  4. package/.agent/agents/ai-code-reviewer.md +25 -21
  5. package/.agent/agents/anti-pattern-reviewer.md +12 -7
  6. package/.agent/agents/api-architect.md +1 -0
  7. package/.agent/agents/backend-specialist.md +23 -22
  8. package/.agent/agents/cloud-engineer.md +1 -0
  9. package/.agent/agents/code-archaeologist.md +1 -0
  10. package/.agent/agents/complexity-reviewer.md +10 -7
  11. package/.agent/agents/database-architect.md +3 -2
  12. package/.agent/agents/db-latency-auditor.md +6 -2
  13. package/.agent/agents/debugger.md +3 -2
  14. package/.agent/agents/dependency-reviewer.md +1 -0
  15. package/.agent/agents/devops-engineer.md +9 -8
  16. package/.agent/agents/documentation-writer.md +6 -5
  17. package/.agent/agents/explorer-agent.md +1 -0
  18. package/.agent/agents/frontend-reviewer.md +21 -17
  19. package/.agent/agents/frontend-specialist.md +23 -20
  20. package/.agent/agents/game-developer.md +1 -0
  21. package/.agent/agents/interaction-reviewer.md +10 -5
  22. package/.agent/agents/logic-reviewer.md +3 -0
  23. package/.agent/agents/minimalist-reviewer.md +6 -0
  24. package/.agent/agents/mobile-developer.md +7 -6
  25. package/.agent/agents/mobile-reviewer.md +14 -13
  26. package/.agent/agents/orchestrator.md +3 -0
  27. package/.agent/agents/penetration-tester.md +1 -0
  28. package/.agent/agents/performance-optimizer.md +6 -5
  29. package/.agent/agents/performance-reviewer.md +6 -6
  30. package/.agent/agents/pipeline-reviewer.md +144 -0
  31. package/.agent/agents/precedence-reviewer.md +1 -0
  32. package/.agent/agents/product-manager.md +1 -0
  33. package/.agent/agents/product-owner.md +1 -0
  34. package/.agent/agents/product-reviewer.md +12 -7
  35. package/.agent/agents/project-planner.md +3 -0
  36. package/.agent/agents/qa-automation-engineer.md +50 -43
  37. package/.agent/agents/resilience-reviewer.md +1 -0
  38. package/.agent/agents/schema-reviewer.md +1 -0
  39. package/.agent/agents/security-auditor.md +24 -24
  40. package/.agent/agents/seo-specialist.md +33 -23
  41. package/.agent/agents/sql-reviewer.md +5 -4
  42. package/.agent/agents/supervisor-agent.md +12 -2
  43. package/.agent/agents/swarm-worker-contracts.md +13 -13
  44. package/.agent/agents/swarm-worker-registry.md +51 -51
  45. package/.agent/agents/system-architect.md +1 -0
  46. package/.agent/agents/test-coverage-reviewer.md +25 -22
  47. package/.agent/agents/test-engineer.md +12 -11
  48. package/.agent/agents/throughput-optimizer.md +45 -40
  49. package/.agent/agents/type-safety-reviewer.md +5 -4
  50. package/.agent/agents/ui-ux-auditor.md +6 -4
  51. package/.agent/agents/ui-visual-auditor.md +3 -0
  52. package/.agent/agents/ux-reviewer.md +11 -6
  53. package/.agent/agents/visual-reviewer.md +11 -6
  54. package/.agent/agents/vitals-reviewer.md +5 -4
  55. package/.agent/history/memory/.memory.idx +3716 -1
  56. package/.agent/history/memory/MEMORY.md +246 -1
  57. package/.agent/mcp_config.json +1 -6
  58. package/.agent/routing_index.json +2034 -263
  59. package/.agent/rules/GEMINI.md +12 -10
  60. package/.agent/rules/GEMINI_PLANNER.md +19 -21
  61. package/.agent/scripts/_colors.js +52 -54
  62. package/.agent/scripts/_utils.js +52 -53
  63. package/.agent/scripts/auto_preview.js +39 -43
  64. package/.agent/scripts/bundle_analyzer.js +47 -60
  65. package/.agent/scripts/case_law_manager.js +200 -294
  66. package/.agent/scripts/checklist.js +73 -94
  67. package/.agent/scripts/cicd_validator.js +305 -0
  68. package/.agent/scripts/compile_router.py +4 -111
  69. package/.agent/scripts/context_broker.js +317 -412
  70. package/.agent/scripts/contract_engine.js +402 -0
  71. package/.agent/scripts/dependency_analyzer.js +112 -124
  72. package/.agent/scripts/graph_builder.js +75 -103
  73. package/.agent/scripts/graph_visualizer.js +10 -12
  74. package/.agent/scripts/graph_zoom.js +38 -55
  75. package/.agent/scripts/guardrail_engine.js +195 -145
  76. package/.agent/scripts/impact_classifier.js +55 -30
  77. package/.agent/scripts/inner_loop_validator.js +108 -159
  78. package/.agent/scripts/integrity_manifest.js +59 -67
  79. package/.agent/scripts/lint_runner.js +65 -75
  80. package/.agent/scripts/marathon_harness.js +131 -208
  81. package/.agent/scripts/migrate_skills_frontmatter.py +4 -63
  82. package/.agent/scripts/minify_context.js +29 -33
  83. package/.agent/scripts/minimal_change_engine.js +95 -87
  84. package/.agent/scripts/mutation_runner.js +46 -62
  85. package/.agent/scripts/pipeline_engine.js +320 -209
  86. package/.agent/scripts/prompt_compiler.js +118 -93
  87. package/.agent/scripts/schema_validator.js +73 -121
  88. package/.agent/scripts/security_scan.js +88 -117
  89. package/.agent/scripts/session_manager.js +52 -69
  90. package/.agent/scripts/signal_detector.js +24 -22
  91. package/.agent/scripts/skill_evolution.js +184 -245
  92. package/.agent/scripts/skill_integrator.js +35 -48
  93. package/.agent/scripts/socratic_gate_policy.js +15 -12
  94. package/.agent/scripts/strengthen_skills.js +29 -33
  95. package/.agent/scripts/swarm_dispatcher.js +120 -151
  96. package/.agent/scripts/test_runner.js +54 -56
  97. package/.agent/scripts/token_budget_broker.js +9 -7
  98. package/.agent/scripts/trace_engine.js +126 -0
  99. package/.agent/scripts/verify_all.js +76 -93
  100. package/.agent/scripts/visual_audit.js +16 -21
  101. package/.agent/skill_topic_map.json +237 -0
  102. package/.agent/skills/12-principles-of-animation/SKILL.md +7 -0
  103. package/.agent/skills/60fps-animation/SKILL.md +7 -0
  104. package/.agent/skills/accessible-animation/SKILL.md +5 -1
  105. package/.agent/skills/adapt/SKILL.md +7 -1
  106. package/.agent/skills/advanced-rag-pipelines/SKILL.md +1 -0
  107. package/.agent/skills/agent-organizer/SKILL.md +1 -0
  108. package/.agent/skills/agentic-patterns/SKILL.md +33 -25
  109. package/.agent/skills/agentic-workflows-2026/SKILL.md +80 -0
  110. package/.agent/skills/ai-app-hardening/SKILL.md +59 -0
  111. package/.agent/skills/ai-prompt-injection-defense/SKILL.md +7 -6
  112. package/.agent/skills/animation-on-scroll/SKILL.md +24 -15
  113. package/.agent/skills/animation-systems/SKILL.md +11 -10
  114. package/.agent/skills/antfu-conventions/SKILL.md +7 -2
  115. package/.agent/skills/api-patterns/SKILL.md +14 -10
  116. package/.agent/skills/api-security-auditor/SKILL.md +15 -14
  117. package/.agent/skills/app-builder/SKILL.md +1 -0
  118. package/.agent/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +2 -2
  119. package/.agent/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +1 -1
  120. package/.agent/skills/app-builder/templates/nextjs-static/TEMPLATE.md +12 -12
  121. package/.agent/skills/app-builder/templates/nuxt-app/TEMPLATE.md +3 -3
  122. package/.agent/skills/apple-design/SKILL.md +8 -7
  123. package/.agent/skills/architecture/SKILL.md +3 -2
  124. package/.agent/skills/audit-and-fix/SKILL.md +8 -5
  125. package/.agent/skills/authentication-best-practices/SKILL.md +9 -8
  126. package/.agent/skills/backend-security-expert/SKILL.md +1 -0
  127. package/.agent/skills/baseline-ui/SKILL.md +8 -7
  128. package/.agent/skills/bash-linux/SKILL.md +1 -0
  129. package/.agent/skills/behavioral-modes/SKILL.md +1 -0
  130. package/.agent/skills/better-colors/SKILL.md +11 -7
  131. package/.agent/skills/better-typography/SKILL.md +30 -16
  132. package/.agent/skills/better-ui/SKILL.md +17 -10
  133. package/.agent/skills/bolder/SKILL.md +6 -0
  134. package/.agent/skills/brainstorming/SKILL.md +6 -4
  135. package/.agent/skills/browser-native-ai/SKILL.md +5 -4
  136. package/.agent/skills/build-primitive/SKILL.md +5 -0
  137. package/.agent/skills/building-native-ui/SKILL.md +1 -0
  138. package/.agent/skills/cicd-pro/SKILL.md +2 -1
  139. package/.agent/skills/clarify/SKILL.md +19 -14
  140. package/.agent/skills/clean-code/SKILL.md +16 -15
  141. package/.agent/skills/cloud-architect/SKILL.md +1 -0
  142. package/.agent/skills/cobejs/SKILL.md +7 -9
  143. package/.agent/skills/code-review-checklist/SKILL.md +1 -0
  144. package/.agent/skills/codebase-design/SKILL.md +7 -2
  145. package/.agent/skills/colorize/SKILL.md +8 -3
  146. package/.agent/skills/compact-landing/SKILL.md +8 -3
  147. package/.agent/skills/company-logos/SKILL.md +6 -0
  148. package/.agent/skills/config-validator/SKILL.md +10 -9
  149. package/.agent/skills/containerization-pro/SKILL.md +6 -5
  150. package/.agent/skills/context-engineering-pro/SKILL.md +70 -0
  151. package/.agent/skills/create-design-md/SKILL.md +13 -5
  152. package/.agent/skills/critique/SKILL.md +10 -8
  153. package/.agent/skills/csharp-developer/SKILL.md +1 -0
  154. package/.agent/skills/data-validation-schemas/SKILL.md +28 -23
  155. package/.agent/skills/database-design/SKILL.md +2 -1
  156. package/.agent/skills/delight/SKILL.md +6 -0
  157. package/.agent/skills/deployment-procedures/SKILL.md +2 -1
  158. package/.agent/skills/design-lab/SKILL.md +5 -0
  159. package/.agent/skills/devops-engineer/SKILL.md +3 -2
  160. package/.agent/skills/devops-incident-responder/SKILL.md +2 -1
  161. package/.agent/skills/diagnosing-bugs/SKILL.md +12 -2
  162. package/.agent/skills/distill/SKILL.md +7 -2
  163. package/.agent/skills/documentation-templates/SKILL.md +3 -2
  164. package/.agent/skills/domain-modeling/SKILL.md +12 -4
  165. package/.agent/skills/duckdb-analytical-sql/SKILL.md +59 -0
  166. package/.agent/skills/edge-ai-mobile/SKILL.md +50 -0
  167. package/.agent/skills/edge-computing/SKILL.md +9 -8
  168. package/.agent/skills/emil-design-eng/SKILL.md +43 -27
  169. package/.agent/skills/error-resilience/SKILL.md +34 -16
  170. package/.agent/skills/expo-router-v4/SKILL.md +81 -0
  171. package/.agent/skills/extract-design-system/SKILL.md +12 -11
  172. package/.agent/skills/fabel-protocol/SKILL.md +24 -17
  173. package/.agent/skills/fixing-accessibility/SKILL.md +23 -16
  174. package/.agent/skills/fixing-metadata/SKILL.md +24 -13
  175. package/.agent/skills/fixing-motion-performance/SKILL.md +7 -5
  176. package/.agent/skills/framer-motion-expert/SKILL.md +29 -15
  177. package/.agent/skills/frontend-design/SKILL.md +21 -13
  178. package/.agent/skills/frontend-security-expert/SKILL.md +1 -0
  179. package/.agent/skills/game-design-expert/SKILL.md +1 -0
  180. package/.agent/skills/game-engineering-expert/SKILL.md +1 -0
  181. package/.agent/skills/generative-ui-expert/SKILL.md +3 -2
  182. package/.agent/skills/geo-fundamentals/SKILL.md +2 -1
  183. package/.agent/skills/git-pro/SKILL.md +10 -9
  184. package/.agent/skills/github-operations/SKILL.md +2 -1
  185. package/.agent/skills/gpt-taste/SKILL.md +7 -0
  186. package/.agent/skills/gsap-core/SKILL.md +26 -22
  187. package/.agent/skills/gsap-frameworks/SKILL.md +6 -5
  188. package/.agent/skills/gsap-performance/SKILL.md +4 -3
  189. package/.agent/skills/gsap-plugins/SKILL.md +34 -33
  190. package/.agent/skills/gsap-react/SKILL.md +9 -8
  191. package/.agent/skills/gsap-scrolltrigger/SKILL.md +34 -33
  192. package/.agent/skills/gsap-timeline/SKILL.md +18 -15
  193. package/.agent/skills/gsap-utils/SKILL.md +25 -24
  194. package/.agent/skills/harden/SKILL.md +9 -3
  195. package/.agent/skills/harness-protocol/SKILL.md +1 -0
  196. package/.agent/skills/i18n-localization/SKILL.md +10 -9
  197. package/.agent/skills/impeccable/SKILL.md +5 -0
  198. package/.agent/skills/improve-codebase-architecture/SKILL.md +10 -5
  199. package/.agent/skills/improve-ui/SKILL.md +12 -5
  200. package/.agent/skills/intelligent-routing/SKILL.md +7 -6
  201. package/.agent/skills/knowledge-graph/SKILL.md +1 -0
  202. package/.agent/skills/landing-page/SKILL.md +1 -0
  203. package/.agent/skills/lint-and-validate/SKILL.md +9 -4
  204. package/.agent/skills/llm-engineering/SKILL.md +55 -54
  205. package/.agent/skills/local-first/SKILL.md +20 -19
  206. package/.agent/skills/local-first-architecture/SKILL.md +6 -1
  207. package/.agent/skills/lottie-animation/SKILL.md +7 -3
  208. package/.agent/skills/marquee-loop/SKILL.md +1 -0
  209. package/.agent/skills/masked-reveal/SKILL.md +17 -4
  210. package/.agent/skills/mcp-builder/SKILL.md +13 -10
  211. package/.agent/skills/micro-interaction/SKILL.md +20 -5
  212. package/.agent/skills/mobile-design/SKILL.md +26 -15
  213. package/.agent/skills/monorepo-management/SKILL.md +3 -2
  214. package/.agent/skills/morphing-icons/SKILL.md +16 -6
  215. package/.agent/skills/motion-engineering/SKILL.md +19 -15
  216. package/.agent/skills/nextjs-react-expert/SKILL.md +26 -21
  217. package/.agent/skills/nodejs-best-practices/SKILL.md +89 -76
  218. package/.agent/skills/observability/SKILL.md +45 -44
  219. package/.agent/skills/opentelemetry-observability/SKILL.md +59 -0
  220. package/.agent/skills/page-transition-animation/SKILL.md +6 -3
  221. package/.agent/skills/parallel-agents/SKILL.md +7 -2
  222. package/.agent/skills/performance-profiling/SKILL.md +24 -13
  223. package/.agent/skills/plan-writing/SKILL.md +1 -0
  224. package/.agent/skills/platform-engineer/SKILL.md +3 -2
  225. package/.agent/skills/platform-engineering-opentofu/SKILL.md +68 -0
  226. package/.agent/skills/playwright-ai-e2e/SKILL.md +60 -0
  227. package/.agent/skills/playwright-best-practices/SKILL.md +29 -28
  228. package/.agent/skills/polish/SKILL.md +13 -12
  229. package/.agent/skills/powershell-windows/SKILL.md +1 -0
  230. package/.agent/skills/pricing-page/SKILL.md +8 -3
  231. package/.agent/skills/product-aware-heuristics/SKILL.md +122 -72
  232. package/.agent/skills/progressive-blur/SKILL.md +9 -4
  233. package/.agent/skills/project-idioms/SKILL.md +1 -0
  234. package/.agent/skills/property-based-testing/SKILL.md +58 -0
  235. package/.agent/skills/python-patterns/SKILL.md +1 -0
  236. package/.agent/skills/python-pro/SKILL.md +1 -0
  237. package/.agent/skills/quieter/SKILL.md +6 -0
  238. package/.agent/skills/react-doctor/SKILL.md +6 -0
  239. package/.agent/skills/react-specialist/SKILL.md +32 -28
  240. package/.agent/skills/readme-builder/SKILL.md +1 -0
  241. package/.agent/skills/realtime-patterns/SKILL.md +34 -33
  242. package/.agent/skills/red-team-tactics/SKILL.md +1 -0
  243. package/.agent/skills/redesign-skill/SKILL.md +6 -0
  244. package/.agent/skills/review-animations/SKILL.md +5 -2
  245. package/.agent/skills/review-animations/STANDARDS.md +37 -23
  246. package/.agent/skills/rust-pro/SKILL.md +1 -0
  247. package/.agent/skills/seo-fundamentals/SKILL.md +4 -3
  248. package/.agent/skills/server-management/SKILL.md +1 -0
  249. package/.agent/skills/shadcn-ui-expert/SKILL.md +28 -22
  250. package/.agent/skills/shape/SKILL.md +9 -2
  251. package/.agent/skills/skill-creator/SKILL.md +1 -0
  252. package/.agent/skills/soft-skill/SKILL.md +6 -0
  253. package/.agent/skills/sounds-on-the-web/SKILL.md +1 -0
  254. package/.agent/skills/sql-pro/SKILL.md +1 -0
  255. package/.agent/skills/supabase-postgres-best-practices/SKILL.md +1 -0
  256. package/.agent/skills/svg-animation/SKILL.md +16 -7
  257. package/.agent/skills/swiftui-expert/SKILL.md +1 -0
  258. package/.agent/skills/swiss-design/SKILL.md +5 -0
  259. package/.agent/skills/system-design-pro/SKILL.md +1 -0
  260. package/.agent/skills/systematic-debugging/SKILL.md +1 -0
  261. package/.agent/skills/tailwind-patterns/SKILL.md +25 -11
  262. package/.agent/skills/taste-skill/SKILL.md +6 -0
  263. package/.agent/skills/tdd-workflow/SKILL.md +5 -0
  264. package/.agent/skills/test-result-analyzer/SKILL.md +1 -0
  265. package/.agent/skills/testing-patterns/SKILL.md +123 -115
  266. package/.agent/skills/thermo-nuclear-code-quality-review/SKILL.md +5 -0
  267. package/.agent/skills/thinking-protocol/SKILL.md +3 -0
  268. package/.agent/skills/to-spring-or-not-to-spring/SKILL.md +9 -8
  269. package/.agent/skills/transitions-dev/SKILL.md +19 -6
  270. package/.agent/skills/trend-researcher/SKILL.md +1 -0
  271. package/.agent/skills/typescript-advanced/SKILL.md +23 -18
  272. package/.agent/skills/typeset/SKILL.md +10 -1
  273. package/.agent/skills/ui-reasoning-engine/SKILL.md +67 -48
  274. package/.agent/skills/ui-skill-packs/SKILL.md +6 -1
  275. package/.agent/skills/ui-skills-root/SKILL.md +39 -38
  276. package/.agent/skills/ui-ux-pro-max/SKILL.md +34 -26
  277. package/.agent/skills/ui-ux-researcher/SKILL.md +1 -0
  278. package/.agent/skills/vector-search-pgvector/SKILL.md +78 -0
  279. package/.agent/skills/vue-expert/SKILL.md +22 -19
  280. package/.agent/skills/vulnerability-scanner/SKILL.md +22 -21
  281. package/.agent/skills/web-accessibility-auditor/SKILL.md +2 -1
  282. package/.agent/skills/web-design-guidelines/SKILL.md +16 -10
  283. package/.agent/skills/web-quality-audit/SKILL.md +5 -0
  284. package/.agent/skills/webapp-testing/SKILL.md +14 -13
  285. package/.agent/skills/webgpu-performance/SKILL.md +1 -0
  286. package/.agent/skills/whimsy-injector/SKILL.md +9 -5
  287. package/.agent/skills/workflow-optimizer/SKILL.md +1 -0
  288. package/.agent/skills/zero-trust-passkeys/SKILL.md +90 -0
  289. package/.agent/templates/DESIGN.md +119 -110
  290. package/.agent/templates/design-tokens.json +9 -6
  291. package/.agent/workflows/acf.md +1 -0
  292. package/.agent/workflows/api-tester.md +1 -0
  293. package/.agent/workflows/audit.md +1 -0
  294. package/.agent/workflows/brainstorm.md +1 -0
  295. package/.agent/workflows/changelog.md +1 -0
  296. package/.agent/workflows/contract.md +60 -0
  297. package/.agent/workflows/create.md +1 -0
  298. package/.agent/workflows/debug.md +1 -0
  299. package/.agent/workflows/deploy.md +1 -0
  300. package/.agent/workflows/enhance.md +1 -0
  301. package/.agent/workflows/fix-ci.md +89 -0
  302. package/.agent/workflows/fix.md +1 -0
  303. package/.agent/workflows/generate.md +1 -0
  304. package/.agent/workflows/marathon.md +1 -0
  305. package/.agent/workflows/migrate.md +1 -0
  306. package/.agent/workflows/minimal.md +9 -7
  307. package/.agent/workflows/orchestrate.md +1 -0
  308. package/.agent/workflows/performance-benchmarker.md +1 -0
  309. package/.agent/workflows/pipeline.md +26 -21
  310. package/.agent/workflows/plan.md +1 -0
  311. package/.agent/workflows/preview.md +1 -0
  312. package/.agent/workflows/refactor.md +3 -2
  313. package/.agent/workflows/review-ai.md +4 -3
  314. package/.agent/workflows/review.md +1 -0
  315. package/.agent/workflows/session.md +1 -0
  316. package/.agent/workflows/status.md +1 -0
  317. package/.agent/workflows/strengthen-skills.md +1 -0
  318. package/.agent/workflows/super-prompt.md +1 -0
  319. package/.agent/workflows/swarm.md +15 -3
  320. package/.agent/workflows/test.md +8 -7
  321. package/.agent/workflows/tribunal-backend.md +3 -2
  322. package/.agent/workflows/tribunal-cicd.md +104 -0
  323. package/.agent/workflows/tribunal-database.md +1 -0
  324. package/.agent/workflows/tribunal-frontend.md +8 -6
  325. package/.agent/workflows/tribunal-full.md +15 -14
  326. package/.agent/workflows/tribunal-mobile.md +6 -5
  327. package/.agent/workflows/tribunal-performance.md +1 -0
  328. package/.agent/workflows/tribunal-speed.md +1 -0
  329. package/.agent/workflows/tribunal-ui.md +29 -21
  330. package/.agent/workflows/ui-ux-pro-max.md +19 -15
  331. package/CONTRIBUTING.md +3 -3
  332. package/README.md +160 -88
  333. package/SECURITY.md +11 -11
  334. package/bin/mcp-server.js +512 -233
  335. package/bin/tribunal-kit.js +29 -30
  336. package/bin/wrapper.js +45 -48
  337. package/dist/cli.js +26 -0
  338. package/dist/commands/case.js +2 -0
  339. package/dist/commands/contract.js +440 -0
  340. package/dist/commands/memory.js +3 -2
  341. package/dist/commands/native.js +36 -0
  342. package/dist/commands/status.js +6 -0
  343. package/dist/esm/index.mjs +32 -0
  344. package/dist/index.d.ts +58 -3
  345. package/package.json +20 -16
  346. package/scripts/benchmark.js +62 -86
  347. package/scripts/changelog.js +67 -73
  348. package/scripts/fix-vbc.js +13 -15
  349. package/scripts/fix-vbc.ps1 +2 -118
  350. package/scripts/stress_benchmark.js +358 -0
  351. package/scripts/sync-version.js +71 -41
  352. package/scripts/validate-payload.js +23 -30
  353. package/scripts/visual_audit.js +23 -13
@@ -0,0 +1,440 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * contract.js — CLI command handler for `tk contract`
5
+ *
6
+ * Commands:
7
+ * tk contract init → Scaffold .tribunal/contracts/ with starter rules
8
+ * tk contract verify → Run contract checks against target/modified files
9
+ * tk contract verify --file <path> → Run contract checks against a single file
10
+ * tk contract list → List loaded contracts and details
11
+ * tk contract trace list → List captured failure context snapshots
12
+ * tk contract replay <id> → Replay failure trace snapshot in CLI
13
+ * tk contract generate --from-case <id> → Auto-generate a contract from a Case Law entry
14
+ */
15
+
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.cmdContract = cmdContract;
18
+
19
+ const fs = require("fs");
20
+ const path = require("path");
21
+ const logger_1 = require("../utils/logger");
22
+
23
+ async function cmdContract(flags, argv, quiet = false) {
24
+ const projectRoot = flags.path ? path.resolve(flags.path) : process.cwd();
25
+ const rawArgs = argv.slice(3);
26
+ const subCmd = rawArgs[0] || "verify";
27
+
28
+ if (subCmd === "help" || subCmd === "--help" || subCmd === "-h") {
29
+ showContractHelp(quiet);
30
+ return;
31
+ }
32
+
33
+ const contractEngineScript = path.join(
34
+ projectRoot,
35
+ ".agent",
36
+ "scripts",
37
+ "contract_engine.js",
38
+ );
39
+ const traceEngineScript = path.join(
40
+ projectRoot,
41
+ ".agent",
42
+ "scripts",
43
+ "trace_engine.js",
44
+ );
45
+
46
+ const contractEngine = fs.existsSync(contractEngineScript)
47
+ ? require(contractEngineScript)
48
+ : null;
49
+ const traceEngine = fs.existsSync(traceEngineScript)
50
+ ? require(traceEngineScript)
51
+ : null;
52
+
53
+ switch (subCmd) {
54
+ case "init":
55
+ scaffoldContracts(projectRoot, quiet);
56
+ break;
57
+
58
+ case "list":
59
+ if (!contractEngine) {
60
+ (0, logger_1.err)("contract_engine.js not found. Run `tk init` first.");
61
+ process.exit(1);
62
+ }
63
+ listContracts(projectRoot, contractEngine, quiet);
64
+ break;
65
+
66
+ case "verify":
67
+ if (!contractEngine) {
68
+ (0, logger_1.err)("contract_engine.js not found. Run `tk init` first.");
69
+ process.exit(1);
70
+ }
71
+ runVerify(projectRoot, contractEngine, traceEngine, argv, flags, quiet);
72
+ break;
73
+
74
+ case "trace":
75
+ if (!traceEngine) {
76
+ (0, logger_1.err)("trace_engine.js not found. Run `tk init` first.");
77
+ process.exit(1);
78
+ }
79
+ runTraceList(projectRoot, traceEngine, quiet);
80
+ break;
81
+
82
+ case "replay":
83
+ if (!traceEngine) {
84
+ (0, logger_1.err)("trace_engine.js not found. Run `tk init` first.");
85
+ process.exit(1);
86
+ }
87
+ runReplay(projectRoot, traceEngine, rawArgs[1], quiet);
88
+ break;
89
+
90
+ case "generate":
91
+ generateFromCase(projectRoot, rawArgs, quiet);
92
+ break;
93
+
94
+ default:
95
+ if (fs.existsSync(subCmd) || subCmd.startsWith("--")) {
96
+ // Treat as verify with arguments
97
+ runVerify(projectRoot, contractEngine, traceEngine, argv, flags, quiet);
98
+ } else {
99
+ (0, logger_1.err)(`Unknown contract subcommand: "${subCmd}"`);
100
+ showContractHelp(quiet);
101
+ process.exit(1);
102
+ }
103
+ }
104
+ }
105
+
106
+ // ── Subcommand Implementations ───────────────────────────────────────────────
107
+
108
+ function scaffoldContracts(projectRoot, quiet) {
109
+ const contractsDir = path.join(projectRoot, ".tribunal", "contracts");
110
+ if (!fs.existsSync(contractsDir)) {
111
+ fs.mkdirSync(contractsDir, { recursive: true });
112
+ }
113
+
114
+ const starters = [
115
+ {
116
+ file: "no-console-log.yaml",
117
+ content: `name: "No console.log in production code"
118
+ description: "Prevents debug logging from reaching production"
119
+ scope: "src/**/*.ts, src/**/*.tsx, src/**/*.js"
120
+ exclude: "**/*.test.*, **/*.spec.*, scripts/**"
121
+ when: file_modified
122
+ severity: warn
123
+ must_not:
124
+ - pattern: "console.log"
125
+ message: "Use a structured logger instead of console.log"
126
+ `,
127
+ },
128
+ {
129
+ file: "no-any-type.yaml",
130
+ content: `name: "No TypeScript 'any' escape hatch"
131
+ description: "Enforces strict typing in TypeScript files"
132
+ scope: "src/**/*.ts, src/**/*.tsx"
133
+ exclude: "**/*.d.ts"
134
+ when: file_modified
135
+ severity: warn
136
+ must_not:
137
+ - pattern: "regex:: any[;,\\\\s\\\\)\\\\]]"
138
+ message: "Avoid 'any' type annotations — use unknown or a specific type"
139
+ `,
140
+ },
141
+ {
142
+ file: "require-error-handling.yaml",
143
+ content: `name: "Async functions must handle errors"
144
+ description: "Every async function should have error handling"
145
+ scope: "src/**/*.ts, src/**/*.tsx"
146
+ when: file_modified
147
+ severity: info
148
+ must:
149
+ - pattern: "regex:(try\\\\s*\\\\{|.catch\\\\(|\\\\.catch\\\\s*\\\\()"
150
+ message: "Async functions should include try/catch or .catch() for error handling"
151
+ metadata:
152
+ tags: ["resilience", "error-handling"]
153
+ `,
154
+ },
155
+ ];
156
+
157
+ let createdCount = 0;
158
+ for (const starter of starters) {
159
+ const filePath = path.join(contractsDir, starter.file);
160
+ if (!fs.existsSync(filePath)) {
161
+ fs.writeFileSync(filePath, starter.content, "utf8");
162
+ createdCount++;
163
+ }
164
+ }
165
+
166
+ if (!quiet) {
167
+ console.log();
168
+ (0, logger_1.log)(
169
+ ` ${(0, logger_1.c)("green", "✔")} Scaffolded .tribunal/contracts/ with ${createdCount} starter behavioral contracts.`,
170
+ );
171
+ (0, logger_1.log)(
172
+ ` ${(0, logger_1.c)("gray", "▸")} Edit files in .tribunal/contracts/ or run \`tk contract verify\` to enforce.`,
173
+ );
174
+ console.log();
175
+ }
176
+ }
177
+
178
+ function listContracts(projectRoot, contractEngine, quiet) {
179
+ const contracts = contractEngine.loadContracts(projectRoot);
180
+ if (quiet) return;
181
+
182
+ console.log();
183
+ (0, logger_1.log)(
184
+ ` ${(0, logger_1.c)("cyan", "📜")} ${(0, logger_1.bold)("Loaded Behavioral Contracts")}`,
185
+ );
186
+ (0, logger_1.log)(` ${(0, logger_1.c)("gray", "─".repeat(50))}`);
187
+
188
+ if (contracts.length === 0) {
189
+ (0, logger_1.log)(
190
+ ` No contracts found in .tribunal/contracts/. Run \`tk contract init\` to create starter rules.`,
191
+ );
192
+ console.log();
193
+ return;
194
+ }
195
+
196
+ for (const c of contracts) {
197
+ const sevColor =
198
+ c.severity === "block" ? "red" : c.severity === "warn" ? "yellow" : "blue";
199
+ const rulesCount = (c.must?.length || 0) + (c.must_not?.length || 0);
200
+
201
+ (0, logger_1.log)(
202
+ ` ${(0, logger_1.c)("cyan", "•")} ${(0, logger_1.bold)(c.name)} [${(0, logger_1.c)(sevColor, c.severity.toUpperCase())}]`,
203
+ );
204
+ (0, logger_1.log)(` Scope: ${(0, logger_1.c)("gray", c.scope || "*")}`);
205
+ (0, logger_1.log)(
206
+ ` Rules: ${(0, logger_1.c)("white", String(rulesCount))} (${c.must?.length || 0} must, ${c.must_not?.length || 0} must_not)`,
207
+ );
208
+ if (c.description) {
209
+ (0, logger_1.log)(` Note: ${(0, logger_1.c)("gray", c.description)}`);
210
+ }
211
+ console.log();
212
+ }
213
+ }
214
+
215
+ function runVerify(projectRoot, contractEngine, traceEngine, argv, flags, quiet) {
216
+ const jsonMode = argv.includes("--json");
217
+ const fileArg = extractFileArg(argv);
218
+
219
+ let targetFiles = null;
220
+ if (fileArg) {
221
+ const resolved = path.resolve(fileArg);
222
+ if (!fs.existsSync(resolved)) {
223
+ (0, logger_1.err)(`File not found: ${fileArg}`);
224
+ process.exit(1);
225
+ }
226
+ targetFiles = [resolved];
227
+ }
228
+
229
+ const results = contractEngine.verifyWorkspace(projectRoot, targetFiles);
230
+
231
+ // Capture failure context snapshots for block/warn violations if traceEngine exists
232
+ if (traceEngine && results.violations.length > 0) {
233
+ for (const v of results.violations) {
234
+ if (v.severity === "block" || v.severity === "warn") {
235
+ try {
236
+ traceEngine.captureSnapshot(projectRoot, v);
237
+ } catch {
238
+ // Non-critical snapshot capture fallback
239
+ }
240
+ }
241
+ }
242
+ }
243
+
244
+ if (jsonMode) {
245
+ console.log(JSON.stringify(results, null, 2));
246
+ process.exit(results.blocked ? 1 : 0);
247
+ }
248
+
249
+ if (quiet) {
250
+ process.exit(results.blocked ? 1 : 0);
251
+ }
252
+
253
+ console.log();
254
+ (0, logger_1.log)(
255
+ ` ${(0, logger_1.c)("cyan", "📜")} ${(0, logger_1.bold)("Contract Verification Report")}`,
256
+ );
257
+ (0, logger_1.log)(` ${(0, logger_1.c)("gray", "─".repeat(50))}`);
258
+ (0, logger_1.log)(
259
+ ` Contracts loaded: ${(0, logger_1.c)("white", String(results.contracts_loaded))}`,
260
+ );
261
+ (0, logger_1.log)(
262
+ ` Files scanned: ${(0, logger_1.c)("white", String(results.files_checked))}`,
263
+ );
264
+ (0, logger_1.log)(
265
+ ` Total violations: ${results.violations.length > 0 ? (0, logger_1.c)("yellow", String(results.violations.length)) : (0, logger_1.c)("green", "0")}`,
266
+ );
267
+ (0, logger_1.log)(` ${(0, logger_1.c)("gray", "─".repeat(50))}`);
268
+
269
+ if (results.violations.length > 0) {
270
+ for (const v of results.violations) {
271
+ const icon =
272
+ v.severity === "block"
273
+ ? (0, logger_1.c)("red", "✖ BLOCK")
274
+ : v.severity === "warn"
275
+ ? (0, logger_1.c)("yellow", "⚠ WARN")
276
+ : (0, logger_1.c)("blue", "ℹ INFO");
277
+
278
+ const lineInfo = v.line ? `:${v.line}` : "";
279
+ (0, logger_1.log)(
280
+ ` ${icon} [${(0, logger_1.bold)(v.contract)}] ${(0, logger_1.c)("cyan", v.file + lineInfo)}`,
281
+ );
282
+ (0, logger_1.log)(` ${(0, logger_1.c)("white", v.message)}`);
283
+ if (v.snippet) {
284
+ (0, logger_1.log)(` ${(0, logger_1.c)("gray", "Snippet:")} ${(0, logger_1.c)("gray", v.snippet)}`);
285
+ }
286
+ }
287
+ } else {
288
+ (0, logger_1.log)(
289
+ ` ${(0, logger_1.c)("green", "✅")} All contracts satisfied. Zero behavioral violations detected.`,
290
+ );
291
+ }
292
+
293
+ console.log();
294
+ process.exit(results.blocked ? 1 : 0);
295
+ }
296
+
297
+ function runTraceList(projectRoot, traceEngine, quiet) {
298
+ const snapshots = traceEngine.listSnapshots(projectRoot);
299
+ if (quiet) return;
300
+
301
+ console.log();
302
+ (0, logger_1.log)(
303
+ ` ${(0, logger_1.c)("cyan", "🎥")} ${(0, logger_1.bold)("Failure Context Snapshots")}`,
304
+ );
305
+ (0, logger_1.log)(` ${(0, logger_1.c)("gray", "─".repeat(50))}`);
306
+
307
+ if (snapshots.length === 0) {
308
+ (0, logger_1.log)(` No failure context snapshots recorded.`);
309
+ console.log();
310
+ return;
311
+ }
312
+
313
+ for (const s of snapshots.slice(0, 10)) {
314
+ const sevColor = s.severity === "block" ? "red" : "yellow";
315
+ (0, logger_1.log)(
316
+ ` ${(0, logger_1.c)("cyan", "•")} ${(0, logger_1.bold)(s.id)} [${(0, logger_1.c)(sevColor, s.severity.toUpperCase())}]`,
317
+ );
318
+ (0, logger_1.log)(` Contract: ${s.contract}`);
319
+ (0, logger_1.log)(` Target: ${(0, logger_1.c)("gray", s.target_file)}`);
320
+ (0, logger_1.log)(` Time: ${(0, logger_1.c)("gray", s.timestamp)}`);
321
+ console.log();
322
+ }
323
+ }
324
+
325
+ function runReplay(projectRoot, traceEngine, traceId, quiet) {
326
+ if (!traceId) {
327
+ (0, logger_1.err)("Missing trace ID. Usage: tk contract replay <trace_id>");
328
+ process.exit(1);
329
+ }
330
+
331
+ const snapshot = traceEngine.replaySnapshot(projectRoot, traceId);
332
+ if (!snapshot) {
333
+ (0, logger_1.err)(`Trace snapshot not found: "${traceId}"`);
334
+ process.exit(1);
335
+ }
336
+
337
+ if (quiet) return;
338
+
339
+ console.log();
340
+ (0, logger_1.log)(
341
+ ` ${(0, logger_1.c)("cyan", "🎬")} ${(0, logger_1.bold)("Replaying Failure Trace Snapshot")}`,
342
+ );
343
+ (0, logger_1.log)(` ${(0, logger_1.c)("gray", "─".repeat(50))}`);
344
+ (0, logger_1.log)(` ID: ${(0, logger_1.c)("white", snapshot.id)}`);
345
+ (0, logger_1.log)(` Contract: ${(0, logger_1.bold)(snapshot.contract)}`);
346
+ (0, logger_1.log)(` Severity: ${(0, logger_1.c)(snapshot.severity === "block" ? "red" : "yellow", snapshot.severity.toUpperCase())}`);
347
+ (0, logger_1.log)(` Target: ${(0, logger_1.c)("cyan", snapshot.target_file)}`);
348
+ (0, logger_1.log)(` Time: ${snapshot.timestamp}`);
349
+ (0, logger_1.log)(` ${(0, logger_1.c)("gray", "─".repeat(50))}`);
350
+ (0, logger_1.log)(
351
+ ` ${(0, logger_1.c)("red", "Violation:")} ${snapshot.violation.message}`,
352
+ );
353
+ if (snapshot.violation.snippet) {
354
+ (0, logger_1.log)(
355
+ ` ${(0, logger_1.c)("yellow", "Code Snippet:")} ${snapshot.violation.snippet}`,
356
+ );
357
+ }
358
+ console.log();
359
+ }
360
+
361
+ function generateFromCase(projectRoot, rawArgs, quiet) {
362
+ const caseIdx = rawArgs.indexOf("--from-case");
363
+ const caseId = caseIdx !== -1 ? rawArgs[caseIdx + 1] : null;
364
+
365
+ if (!caseId) {
366
+ (0, logger_1.err)(
367
+ "Missing case ID. Usage: tk contract generate --from-case <id>",
368
+ );
369
+ process.exit(1);
370
+ }
371
+
372
+ const contractsDir = path.join(projectRoot, ".tribunal", "contracts");
373
+ if (!fs.existsSync(contractsDir)) {
374
+ fs.mkdirSync(contractsDir, { recursive: true });
375
+ }
376
+
377
+ const contractFileName = `case-${caseId}-rule.yaml`;
378
+ const contractPath = path.join(contractsDir, contractFileName);
379
+
380
+ const content = `name: "Contract from Case #${caseId}"
381
+ description: "Auto-generated behavioral contract to prevent recurrence of Case #${caseId}"
382
+ scope: "src/**/*.ts, src/**/*.js"
383
+ when: file_modified
384
+ severity: block
385
+ must_not:
386
+ - pattern: "UNVERIFIED_API_PATTERN"
387
+ message: "Precedent Case #${caseId} violation prevented by contract"
388
+ metadata:
389
+ generated_from_case: "${caseId}"
390
+ created: "${new Date().toISOString().split("T")[0]}"
391
+ `;
392
+
393
+ fs.writeFileSync(contractPath, content, "utf8");
394
+
395
+ if (!quiet) {
396
+ console.log();
397
+ (0, logger_1.log)(
398
+ ` ${(0, logger_1.c)("green", "✔")} Auto-generated contract template from Case #${caseId}:`,
399
+ );
400
+ (0, logger_1.log)(` ${(0, logger_1.c)("cyan", contractPath)}`);
401
+ console.log();
402
+ }
403
+ }
404
+
405
+ function extractFileArg(argv) {
406
+ const idx = argv.indexOf("--file");
407
+ if (idx !== -1 && argv[idx + 1]) return argv[idx + 1];
408
+ return null;
409
+ }
410
+
411
+ function showContractHelp(quiet) {
412
+ if (quiet) return;
413
+ console.log();
414
+ (0, logger_1.log)(
415
+ ` ${(0, logger_1.bold)("Tribunal Behavioral Contract Engine (tk contract)")}`,
416
+ );
417
+ (0, logger_1.log)(` ${(0, logger_1.c)("gray", "─".repeat(50))}`);
418
+ (0, logger_1.log)(
419
+ ` ${(0, logger_1.c)("cyan", "init")} Scaffold .tribunal/contracts/ with starter rules`,
420
+ );
421
+ (0, logger_1.log)(
422
+ ` ${(0, logger_1.c)("cyan", "verify")} Verify code against loaded contracts`,
423
+ );
424
+ (0, logger_1.log)(
425
+ ` ${(0, logger_1.c)("cyan", "verify --file <path>")} Verify a specific target file`,
426
+ );
427
+ (0, logger_1.log)(
428
+ ` ${(0, logger_1.c)("cyan", "list")} List all active contracts`,
429
+ );
430
+ (0, logger_1.log)(
431
+ ` ${(0, logger_1.c)("cyan", "trace list")} List recorded failure context snapshots`,
432
+ );
433
+ (0, logger_1.log)(
434
+ ` ${(0, logger_1.c)("cyan", "replay <id>")} Replay failure context trace snapshot`,
435
+ );
436
+ (0, logger_1.log)(
437
+ ` ${(0, logger_1.c)("cyan", "generate --from-case <id>")} Generate contract template from Case Law`,
438
+ );
439
+ console.log();
440
+ }
@@ -43,8 +43,9 @@ function acquireLock(agentDest) {
43
43
  if (err.code !== 'EEXIST') {
44
44
  throw err;
45
45
  }
46
- const start = Date.now();
47
- while (Date.now() - start < 50) {}
46
+ // Non-blocking sleep — avoids busy-wait event loop blocking
47
+ const waitBuf = new Int32Array(new SharedArrayBuffer(4));
48
+ Atomics.wait(waitBuf, 0, 0, 50);
48
49
  }
49
50
  }
50
51
  try {
@@ -219,10 +219,46 @@ function cmdOptimizeStep(processArgs, quiet = false) {
219
219
  console.log(JSON.stringify(result));
220
220
  return true;
221
221
  }
222
+ function cmdImpactTier(processArgs, quiet = false) {
223
+ const args = processArgs.slice(3);
224
+ const files = getOption(args, ["--files"]) || "";
225
+ const lines = parseInt(getOption(args, ["--lines"]) || "0", 10);
226
+ const task = getOption(args, ["--task"]) || "";
227
+
228
+ const fileList = files ? files.split(",").map(f => f.trim()).filter(Boolean) : [];
229
+ const fileCount = fileList.length;
230
+
231
+ // Tier classification heuristics (mirrors Rust ImpactTier logic)
232
+ let tier = 0;
233
+ if (fileCount === 0 && lines <= 5) tier = 0;
234
+ else if (fileCount <= 1 && lines <= 50) tier = 1;
235
+ else if (fileCount <= 5 && lines <= 200) tier = 2;
236
+ else tier = 3;
237
+
238
+ // Check for high-risk patterns that force Tier 3
239
+ const highRiskPatterns = /\b(auth|migration|schema|security|password|token|jwt|rbac|permissions)\b/i;
240
+ const highRiskExtensions = /\.(sql|prisma|tf|tofu)$/i;
241
+ if (highRiskPatterns.test(task) || fileList.some(f => highRiskExtensions.test(f))) {
242
+ tier = Math.max(tier, 3);
243
+ }
244
+
245
+ const tierNames = ["Fast-Pass", "Express Pass", "Targeted Audit", "Full Gauntlet"];
246
+ const result = {
247
+ tier,
248
+ tier_name: tierNames[tier],
249
+ file_count: fileCount,
250
+ line_count: lines,
251
+ socratic_gate: tier >= 3 ? "required" : tier >= 2 ? "conditional" : "bypass",
252
+ };
253
+ if (!quiet) console.error(`✓ Impact Tier: ${tier} (${tierNames[tier]})`);
254
+ console.log(JSON.stringify(result));
255
+ return true;
256
+ }
222
257
 
223
258
  module.exports = {
224
259
  cmdMinContext,
225
260
  cmdDagSchedule,
226
261
  cmdContextCompress,
227
262
  cmdOptimizeStep,
263
+ cmdImpactTier,
228
264
  };
@@ -31,5 +31,11 @@ function cmdStatus(flags, quiet = false) {
31
31
  (0, logger_1.log)(` ${icons[sub]} ${(0, logger_1.c)(colors[sub], sub.padEnd(12))}${(0, logger_1.c)('white', String(count).padStart(3))} files`);
32
32
  }
33
33
  }
34
+
35
+ const contractsPath = path_1.default.join(targetDir, '.tribunal', 'contracts');
36
+ if (fs_1.default.existsSync(contractsPath)) {
37
+ const contractFiles = fs_1.default.readdirSync(contractsPath).filter(f => f.endsWith('.yaml') || f.endsWith('.yml')).length;
38
+ (0, logger_1.log)(` 📜 ${(0, logger_1.c)('cyan', 'contracts'.padEnd(12))}${(0, logger_1.c)('white', String(contractFiles).padStart(3))} active rules`);
39
+ }
34
40
  console.log();
35
41
  }
@@ -108,3 +108,35 @@ export function cmdUninstall(flags, quiet) {
108
108
  export async function generateIDEBridges(cwd, agentDest, quiet) {
109
109
  return loadCommand('../commands/init.js', 'generateIDEBridges', cwd, agentDest, quiet);
110
110
  }
111
+
112
+ export async function cmdGuardrail(flags, argv, quiet) {
113
+ return loadCommand('../commands/guardrail.js', 'cmdGuardrail', flags, argv, quiet);
114
+ }
115
+
116
+ export async function cmdOptimizeSkill(flags, argv, quiet) {
117
+ return loadCommand('../commands/optimize.js', 'cmdOptimizeSkill', flags, argv, quiet);
118
+ }
119
+
120
+ export function cmdMinimal(flags, quiet) {
121
+ return loadCommand('../commands/minimal.js', 'cmdMinimal', flags, quiet);
122
+ }
123
+
124
+ export function cmdValidate(flags, argv, quiet) {
125
+ return loadCommand('../commands/validate.js', 'cmdValidate', flags, argv, quiet);
126
+ }
127
+
128
+ export function cmdMinContext(argv, quiet) {
129
+ return loadCommand('../commands/native.js', 'cmdMinContext', argv, quiet);
130
+ }
131
+
132
+ export function cmdDagSchedule(argv, quiet) {
133
+ return loadCommand('../commands/native.js', 'cmdDagSchedule', argv, quiet);
134
+ }
135
+
136
+ export function cmdContextCompress(argv, quiet) {
137
+ return loadCommand('../commands/native.js', 'cmdContextCompress', argv, quiet);
138
+ }
139
+
140
+ export function cmdOptimizeStep(argv, quiet) {
141
+ return loadCommand('../commands/native.js', 'cmdOptimizeStep', argv, quiet);
142
+ }
package/dist/index.d.ts CHANGED
@@ -37,8 +37,8 @@ export interface CliFlags {
37
37
  log?: string;
38
38
  /** Memory mutation strategy: 'balanced' | 'harden' | 'repair-only'. */
39
39
  strategy?: string;
40
- /** Enable token-optimized output. */
41
- tokenOptimized?: boolean;
40
+ /** Install profile: 'full' | 'minimal' | 'web' | 'mobile' | 'backend' | 'ai'. */
41
+ profile?: string;
42
42
  }
43
43
 
44
44
  /** Parsed CLI arguments returned by the internal arg parser. */
@@ -145,6 +145,60 @@ export function cmdUninstall(flags: CliFlags, quiet?: boolean): void;
145
145
  */
146
146
  export function generateIDEBridges(cwd: string, agentDest: string, quiet?: boolean): Promise<void>;
147
147
 
148
+ /**
149
+ * Validate `.agent/` integrity (phantom refs, count mismatches, drift).
150
+ * Equivalent to `npx tribunal-kit guardrail`.
151
+ */
152
+ export function cmdGuardrail(flags: CliFlags, argv: string[], quiet?: boolean): Promise<void>;
153
+
154
+ /**
155
+ * AI Agent Behavioral Contract Testing (init, verify, list, trace, replay).
156
+ * Equivalent to `npx tribunal-kit contract`.
157
+ */
158
+ export function cmdContract(flags: CliFlags, argv: string[], quiet?: boolean): Promise<void>;
159
+
160
+ /**
161
+ * Optimize project skills using SkillOpt validation gates.
162
+ * Equivalent to `npx tribunal-kit optimize-skill`.
163
+ */
164
+ export function cmdOptimizeSkill(flags: CliFlags, argv: string[], quiet?: boolean): Promise<void>;
165
+
166
+ /**
167
+ * Show minimal change analysis for the current project.
168
+ * Equivalent to `npx tribunal-kit minimal`.
169
+ */
170
+ export function cmdMinimal(flags: CliFlags, quiet?: boolean): void;
171
+
172
+ /**
173
+ * Validate a JSON payload against a Tribunal schema.
174
+ * Equivalent to `npx tribunal-kit validate`.
175
+ */
176
+ export function cmdValidate(flags: CliFlags, argv: string[], quiet?: boolean): void;
177
+
178
+ /**
179
+ * Remove empty lines from a context file.
180
+ * Equivalent to `npx tribunal-kit min-context`.
181
+ */
182
+ export function cmdMinContext(argv: string[], quiet?: boolean): void;
183
+
184
+ /**
185
+ * Compute parallel execution waves from task dependencies.
186
+ * Equivalent to `npx tribunal-kit dag-schedule`.
187
+ */
188
+ export function cmdDagSchedule(argv: string[], quiet?: boolean): void;
189
+
190
+ /**
191
+ * Compress a context file while retaining VERIFY comments.
192
+ * Equivalent to `npx tribunal-kit context-compress`.
193
+ */
194
+ export function cmdContextCompress(argv: string[], quiet?: boolean): void;
195
+
196
+ /**
197
+ * Apply bounded SkillOpt edits from a JSON payload.
198
+ * Equivalent to `npx tribunal-kit optimize-step`.
199
+ */
200
+ export function cmdOptimizeStep(argv: string[], quiet?: boolean): void;
201
+
148
202
  // ── Logger Utilities ─────────────────────────────────────────────────────────
149
203
 
150
204
  /** ANSI color code map. */
@@ -277,7 +331,8 @@ export type McpToolName =
277
331
  | 'recall_memory'
278
332
  | 'store_memory'
279
333
  | 'get_sparse_context'
280
- | 'align_output';
334
+ | 'align_output'
335
+ | 'verify_contracts';
281
336
 
282
337
  // ── Main Entry Point ─────────────────────────────────────────────────────────
283
338