ui-gateway 0.1.1 → 0.1.2

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 (362) hide show
  1. package/AGENTS.md +41 -6
  2. package/BENCHMARK.md +141 -0
  3. package/CHANGELOG.md +200 -2
  4. package/CONTRIBUTING.md +48 -6
  5. package/NON-GOALS.md +9 -6
  6. package/README.md +136 -41
  7. package/SECURITY.md +22 -1
  8. package/SKILL.md +71 -17
  9. package/action.yml +90 -0
  10. package/dist/evals/src/baseline.d.ts +4 -1
  11. package/dist/evals/src/baseline.d.ts.map +1 -1
  12. package/dist/evals/src/baseline.js +28 -6
  13. package/dist/evals/src/baseline.js.map +1 -1
  14. package/dist/evals/src/metrics.d.ts +35 -0
  15. package/dist/evals/src/metrics.d.ts.map +1 -1
  16. package/dist/evals/src/metrics.js +24 -0
  17. package/dist/evals/src/metrics.js.map +1 -1
  18. package/dist/packages/adapters/src/angular/index.js +2 -2
  19. package/dist/packages/adapters/src/angular/manifest.d.ts.map +1 -1
  20. package/dist/packages/adapters/src/angular/manifest.js +2 -8
  21. package/dist/packages/adapters/src/angular/manifest.js.map +1 -1
  22. package/dist/packages/adapters/src/antd/index.js +2 -2
  23. package/dist/packages/adapters/src/antd/manifest.d.ts.map +1 -1
  24. package/dist/packages/adapters/src/antd/manifest.js +2 -8
  25. package/dist/packages/adapters/src/antd/manifest.js.map +1 -1
  26. package/dist/packages/adapters/src/bootstrap/index.js +2 -2
  27. package/dist/packages/adapters/src/bootstrap/manifest.d.ts.map +1 -1
  28. package/dist/packages/adapters/src/bootstrap/manifest.js +2 -8
  29. package/dist/packages/adapters/src/bootstrap/manifest.js.map +1 -1
  30. package/dist/packages/adapters/src/chakra/index.d.ts.map +1 -1
  31. package/dist/packages/adapters/src/chakra/index.js +30 -5
  32. package/dist/packages/adapters/src/chakra/index.js.map +1 -1
  33. package/dist/packages/adapters/src/chakra/manifest.d.ts.map +1 -1
  34. package/dist/packages/adapters/src/chakra/manifest.js +309 -10
  35. package/dist/packages/adapters/src/chakra/manifest.js.map +1 -1
  36. package/dist/packages/adapters/src/index.d.ts +4 -0
  37. package/dist/packages/adapters/src/index.d.ts.map +1 -1
  38. package/dist/packages/adapters/src/index.js +18 -14
  39. package/dist/packages/adapters/src/index.js.map +1 -1
  40. package/dist/packages/adapters/src/local.d.ts.map +1 -1
  41. package/dist/packages/adapters/src/local.js +4 -2
  42. package/dist/packages/adapters/src/local.js.map +1 -1
  43. package/dist/packages/adapters/src/mantine/index.js +3 -3
  44. package/dist/packages/adapters/src/mantine/manifest.d.ts.map +1 -1
  45. package/dist/packages/adapters/src/mantine/manifest.js +8 -21
  46. package/dist/packages/adapters/src/mantine/manifest.js.map +1 -1
  47. package/dist/packages/adapters/src/mui/index.js +3 -3
  48. package/dist/packages/adapters/src/mui/manifest.d.ts.map +1 -1
  49. package/dist/packages/adapters/src/mui/manifest.js +2 -11
  50. package/dist/packages/adapters/src/mui/manifest.js.map +1 -1
  51. package/dist/packages/adapters/src/nuxt-ui/index.d.ts +5 -0
  52. package/dist/packages/adapters/src/nuxt-ui/index.d.ts.map +1 -0
  53. package/dist/packages/adapters/src/nuxt-ui/index.js +79 -0
  54. package/dist/packages/adapters/src/nuxt-ui/index.js.map +1 -0
  55. package/dist/packages/adapters/src/nuxt-ui/manifest.d.ts +3 -0
  56. package/dist/packages/adapters/src/nuxt-ui/manifest.d.ts.map +1 -0
  57. package/dist/packages/adapters/src/nuxt-ui/manifest.js +295 -0
  58. package/dist/packages/adapters/src/nuxt-ui/manifest.js.map +1 -0
  59. package/dist/packages/adapters/src/radix/index.d.ts +5 -0
  60. package/dist/packages/adapters/src/radix/index.d.ts.map +1 -0
  61. package/dist/packages/adapters/src/radix/index.js +71 -0
  62. package/dist/packages/adapters/src/radix/index.js.map +1 -0
  63. package/dist/packages/adapters/src/radix/manifest.d.ts +3 -0
  64. package/dist/packages/adapters/src/radix/manifest.d.ts.map +1 -0
  65. package/dist/packages/adapters/src/radix/manifest.js +331 -0
  66. package/dist/packages/adapters/src/radix/manifest.js.map +1 -0
  67. package/dist/packages/adapters/src/registry.d.ts +1 -1
  68. package/dist/packages/adapters/src/registry.d.ts.map +1 -1
  69. package/dist/packages/adapters/src/registry.js +16 -12
  70. package/dist/packages/adapters/src/registry.js.map +1 -1
  71. package/dist/packages/adapters/src/shadcn/index.js +3 -3
  72. package/dist/packages/adapters/src/shadcn/manifest.d.ts.map +1 -1
  73. package/dist/packages/adapters/src/shadcn/manifest.js +2 -11
  74. package/dist/packages/adapters/src/shadcn/manifest.js.map +1 -1
  75. package/dist/packages/adapters/src/solid/index.js +2 -2
  76. package/dist/packages/adapters/src/solid/manifest.d.ts.map +1 -1
  77. package/dist/packages/adapters/src/solid/manifest.js +2 -8
  78. package/dist/packages/adapters/src/solid/manifest.js.map +1 -1
  79. package/dist/packages/adapters/src/svelte/index.js +2 -2
  80. package/dist/packages/adapters/src/svelte/manifest.d.ts.map +1 -1
  81. package/dist/packages/adapters/src/svelte/manifest.js +2 -8
  82. package/dist/packages/adapters/src/svelte/manifest.js.map +1 -1
  83. package/dist/packages/adapters/src/vue/index.js +2 -2
  84. package/dist/packages/adapters/src/vue/manifest.d.ts.map +1 -1
  85. package/dist/packages/adapters/src/vue/manifest.js +2 -8
  86. package/dist/packages/adapters/src/vue/manifest.js.map +1 -1
  87. package/dist/packages/design-md/src/compile.js +2 -2
  88. package/dist/packages/design-md/src/derive.d.ts +41 -0
  89. package/dist/packages/design-md/src/derive.d.ts.map +1 -0
  90. package/dist/packages/design-md/src/derive.js +341 -0
  91. package/dist/packages/design-md/src/derive.js.map +1 -0
  92. package/dist/packages/design-md/src/index.d.ts +1 -0
  93. package/dist/packages/design-md/src/index.d.ts.map +1 -1
  94. package/dist/packages/design-md/src/index.js +6 -5
  95. package/dist/packages/design-md/src/index.js.map +1 -1
  96. package/dist/packages/gateway/src/confidence.d.ts +51 -1
  97. package/dist/packages/gateway/src/confidence.d.ts.map +1 -1
  98. package/dist/packages/gateway/src/confidence.js +198 -6
  99. package/dist/packages/gateway/src/confidence.js.map +1 -1
  100. package/dist/packages/gateway/src/gateway.d.ts +10 -2
  101. package/dist/packages/gateway/src/gateway.d.ts.map +1 -1
  102. package/dist/packages/gateway/src/gateway.js +190 -14
  103. package/dist/packages/gateway/src/gateway.js.map +1 -1
  104. package/dist/packages/gateway/src/index.d.ts +1 -0
  105. package/dist/packages/gateway/src/index.d.ts.map +1 -1
  106. package/dist/packages/gateway/src/index.js +7 -6
  107. package/dist/packages/gateway/src/index.js.map +1 -1
  108. package/dist/packages/gateway/src/preview.d.ts +12 -0
  109. package/dist/packages/gateway/src/preview.d.ts.map +1 -0
  110. package/dist/packages/gateway/src/preview.js +113 -0
  111. package/dist/packages/gateway/src/preview.js.map +1 -0
  112. package/dist/packages/gateway/src/validate.d.ts +5 -2
  113. package/dist/packages/gateway/src/validate.d.ts.map +1 -1
  114. package/dist/packages/gateway/src/validate.js +46 -18
  115. package/dist/packages/gateway/src/validate.js.map +1 -1
  116. package/dist/packages/kb/src/bundle-size.d.ts +8 -9
  117. package/dist/packages/kb/src/bundle-size.d.ts.map +1 -1
  118. package/dist/packages/kb/src/bundle-size.js +14 -12
  119. package/dist/packages/kb/src/bundle-size.js.map +1 -1
  120. package/dist/packages/kb/src/entry.d.ts +19 -1
  121. package/dist/packages/kb/src/entry.d.ts.map +1 -1
  122. package/dist/packages/kb/src/entry.js +13 -1
  123. package/dist/packages/kb/src/entry.js.map +1 -1
  124. package/dist/packages/kb/src/freshness.d.ts +76 -0
  125. package/dist/packages/kb/src/freshness.d.ts.map +1 -0
  126. package/dist/packages/kb/src/freshness.js +186 -0
  127. package/dist/packages/kb/src/freshness.js.map +1 -0
  128. package/dist/packages/kb/src/index.d.ts +2 -1
  129. package/dist/packages/kb/src/index.d.ts.map +1 -1
  130. package/dist/packages/kb/src/index.js +6 -5
  131. package/dist/packages/kb/src/index.js.map +1 -1
  132. package/dist/packages/kb/src/ingest.d.ts +3 -0
  133. package/dist/packages/kb/src/ingest.d.ts.map +1 -1
  134. package/dist/packages/kb/src/ingest.js +7 -1
  135. package/dist/packages/kb/src/ingest.js.map +1 -1
  136. package/dist/packages/kb/src/kb.d.ts +5 -0
  137. package/dist/packages/kb/src/kb.d.ts.map +1 -1
  138. package/dist/packages/kb/src/kb.js +5 -2
  139. package/dist/packages/kb/src/kb.js.map +1 -1
  140. package/dist/packages/matcher/src/anthropic.js +1 -1
  141. package/dist/packages/matcher/src/index.d.ts +8 -1
  142. package/dist/packages/matcher/src/index.d.ts.map +1 -1
  143. package/dist/packages/matcher/src/index.js +21 -11
  144. package/dist/packages/matcher/src/index.js.map +1 -1
  145. package/dist/packages/matcher/src/scaffold.d.ts.map +1 -1
  146. package/dist/packages/matcher/src/scaffold.js +62 -19
  147. package/dist/packages/matcher/src/scaffold.js.map +1 -1
  148. package/dist/packages/matcher/src/score.d.ts +8 -1
  149. package/dist/packages/matcher/src/score.d.ts.map +1 -1
  150. package/dist/packages/matcher/src/score.js +90 -25
  151. package/dist/packages/matcher/src/score.js.map +1 -1
  152. package/dist/packages/matcher/src/select.d.ts +15 -1
  153. package/dist/packages/matcher/src/select.d.ts.map +1 -1
  154. package/dist/packages/matcher/src/select.js +53 -3
  155. package/dist/packages/matcher/src/select.js.map +1 -1
  156. package/dist/packages/orchestrator/src/figma.d.ts +12 -0
  157. package/dist/packages/orchestrator/src/figma.d.ts.map +1 -0
  158. package/dist/packages/orchestrator/src/figma.js +102 -0
  159. package/dist/packages/orchestrator/src/figma.js.map +1 -0
  160. package/dist/packages/orchestrator/src/index.d.ts +1 -0
  161. package/dist/packages/orchestrator/src/index.d.ts.map +1 -1
  162. package/dist/packages/orchestrator/src/index.js +3 -2
  163. package/dist/packages/orchestrator/src/index.js.map +1 -1
  164. package/dist/packages/orchestrator/src/orchestrator.d.ts.map +1 -1
  165. package/dist/packages/orchestrator/src/orchestrator.js +14 -3
  166. package/dist/packages/orchestrator/src/orchestrator.js.map +1 -1
  167. package/dist/packages/profile/src/detect.d.ts +9 -0
  168. package/dist/packages/profile/src/detect.d.ts.map +1 -1
  169. package/dist/packages/profile/src/detect.js +52 -5
  170. package/dist/packages/profile/src/detect.js.map +1 -1
  171. package/dist/packages/profile/src/index.js +7 -7
  172. package/dist/packages/profile/src/local-components.d.ts.map +1 -1
  173. package/dist/packages/profile/src/local-components.js +70 -1
  174. package/dist/packages/profile/src/local-components.js.map +1 -1
  175. package/dist/packages/profile/src/registry.d.ts.map +1 -1
  176. package/dist/packages/profile/src/registry.js +3 -1
  177. package/dist/packages/profile/src/registry.js.map +1 -1
  178. package/dist/packages/profile/src/skills.js +1 -1
  179. package/dist/packages/protocol/src/errors.js +1 -1
  180. package/dist/packages/protocol/src/errors.js.map +1 -1
  181. package/dist/packages/protocol/src/event-log.d.ts.map +1 -1
  182. package/dist/packages/protocol/src/event-log.js +11 -5
  183. package/dist/packages/protocol/src/event-log.js.map +1 -1
  184. package/dist/packages/protocol/src/events.js +5 -5
  185. package/dist/packages/protocol/src/hashing.d.ts +6 -0
  186. package/dist/packages/protocol/src/hashing.d.ts.map +1 -1
  187. package/dist/packages/protocol/src/hashing.js +8 -2
  188. package/dist/packages/protocol/src/hashing.js.map +1 -1
  189. package/dist/packages/protocol/src/index.js +12 -12
  190. package/dist/packages/protocol/src/lease.js +2 -2
  191. package/dist/packages/protocol/src/schemas.d.ts +2803 -116
  192. package/dist/packages/protocol/src/schemas.d.ts.map +1 -1
  193. package/dist/packages/protocol/src/schemas.js +54 -4
  194. package/dist/packages/protocol/src/schemas.js.map +1 -1
  195. package/dist/packages/protocol/src/semantic.js +1 -1
  196. package/dist/packages/protocol/src/state-machine.js +1 -1
  197. package/dist/packages/transports/src/check.d.ts +30 -0
  198. package/dist/packages/transports/src/check.d.ts.map +1 -0
  199. package/dist/packages/transports/src/check.js +190 -0
  200. package/dist/packages/transports/src/check.js.map +1 -0
  201. package/dist/packages/transports/src/cli.d.ts +1 -1
  202. package/dist/packages/transports/src/cli.js +278 -25
  203. package/dist/packages/transports/src/cli.js.map +1 -1
  204. package/dist/packages/transports/src/exit-codes.d.ts +8 -0
  205. package/dist/packages/transports/src/exit-codes.d.ts.map +1 -0
  206. package/dist/packages/transports/src/exit-codes.js +19 -0
  207. package/dist/packages/transports/src/exit-codes.js.map +1 -0
  208. package/dist/packages/transports/src/http.js +2 -2
  209. package/dist/packages/transports/src/http.js.map +1 -1
  210. package/dist/packages/transports/src/index.d.ts +5 -0
  211. package/dist/packages/transports/src/index.d.ts.map +1 -1
  212. package/dist/packages/transports/src/index.js +11 -6
  213. package/dist/packages/transports/src/index.js.map +1 -1
  214. package/dist/packages/transports/src/init.d.ts +32 -0
  215. package/dist/packages/transports/src/init.d.ts.map +1 -0
  216. package/dist/packages/transports/src/init.js +110 -0
  217. package/dist/packages/transports/src/init.js.map +1 -0
  218. package/dist/packages/transports/src/mcp-config.d.ts +27 -0
  219. package/dist/packages/transports/src/mcp-config.d.ts.map +1 -0
  220. package/dist/packages/transports/src/mcp-config.js +99 -0
  221. package/dist/packages/transports/src/mcp-config.js.map +1 -0
  222. package/dist/packages/transports/src/mcp.js +3 -3
  223. package/dist/packages/transports/src/paths.d.ts +9 -0
  224. package/dist/packages/transports/src/paths.d.ts.map +1 -0
  225. package/dist/packages/transports/src/paths.js +32 -0
  226. package/dist/packages/transports/src/paths.js.map +1 -0
  227. package/dist/packages/transports/src/receipt.d.ts +8 -0
  228. package/dist/packages/transports/src/receipt.d.ts.map +1 -0
  229. package/dist/packages/transports/src/receipt.js +87 -0
  230. package/dist/packages/transports/src/receipt.js.map +1 -0
  231. package/dist/packages/transports/src/resources.js +3 -3
  232. package/dist/packages/transports/src/resources.js.map +1 -1
  233. package/dist/packages/transports/src/tools.d.ts.map +1 -1
  234. package/dist/packages/transports/src/tools.js +284 -10
  235. package/dist/packages/transports/src/tools.js.map +1 -1
  236. package/dist/packages/verifier/src/index.js +7 -7
  237. package/dist/packages/verifier/src/lint.js +1 -1
  238. package/dist/packages/verifier/src/page.js +2 -2
  239. package/dist/packages/verifier/src/render-axe.js +1 -1
  240. package/dist/packages/verifier/src/verify.js +4 -4
  241. package/dist/scripts/build-site.d.ts +2 -0
  242. package/dist/scripts/build-site.d.ts.map +1 -0
  243. package/dist/scripts/build-site.js +254 -0
  244. package/dist/scripts/build-site.js.map +1 -0
  245. package/dist/scripts/calibration.js +33 -2
  246. package/dist/scripts/calibration.js.map +1 -1
  247. package/dist/scripts/fix-imports.js +32 -2
  248. package/dist/scripts/fix-imports.js.map +1 -1
  249. package/dist/scripts/generate-kb.d.ts +3 -0
  250. package/dist/scripts/generate-kb.d.ts.map +1 -0
  251. package/dist/scripts/generate-kb.js +195 -0
  252. package/dist/scripts/generate-kb.js.map +1 -0
  253. package/dist/scripts/generate-refusal-catalog.d.ts +3 -0
  254. package/dist/scripts/generate-refusal-catalog.d.ts.map +1 -0
  255. package/dist/scripts/generate-refusal-catalog.js +50 -0
  256. package/dist/scripts/generate-refusal-catalog.js.map +1 -0
  257. package/dist/scripts/generate-tool-docs.d.ts +3 -0
  258. package/dist/scripts/generate-tool-docs.d.ts.map +1 -0
  259. package/dist/scripts/generate-tool-docs.js +24 -0
  260. package/dist/scripts/generate-tool-docs.js.map +1 -0
  261. package/dist/scripts/mcp-config.js +28 -60
  262. package/dist/scripts/mcp-config.js.map +1 -1
  263. package/docs/archive/UI Gateway Final Project Roadmap.md +285 -0
  264. package/docs/benchmarks/external-repos.json +26 -0
  265. package/docs/benchmarks/local-gemma3-1b-stride32.json +455 -0
  266. package/docs/calibration.svg +44 -0
  267. package/docs/design-import.md +19 -0
  268. package/docs/design-md.md +109 -0
  269. package/docs/distribution.md +41 -0
  270. package/docs/engineering-principles.md +152 -0
  271. package/docs/layers-plan.md +372 -0
  272. package/docs/metrics.md +153 -0
  273. package/docs/modes.md +22 -0
  274. package/docs/parking-lot.md +25 -0
  275. package/docs/quickstart.md +72 -0
  276. package/docs/refusal-catalog.md +32 -0
  277. package/docs/spike-source-discovery.md +36 -0
  278. package/docs/telemetry.md +26 -0
  279. package/evals/fixtures/external-repos.json +55 -0
  280. package/evals/fixtures/kb-generated/angular.json +72 -0
  281. package/evals/fixtures/kb-generated/antd.json +72 -0
  282. package/evals/fixtures/kb-generated/bootstrap.json +72 -0
  283. package/evals/fixtures/kb-generated/chakra.json +14939 -0
  284. package/evals/fixtures/kb-generated/mantine.json +192 -0
  285. package/evals/fixtures/kb-generated/mui.json +8997 -0
  286. package/evals/fixtures/kb-generated/shadcn.json +192 -0
  287. package/evals/fixtures/kb-generated/solid.json +72 -0
  288. package/evals/fixtures/kb-generated/svelte.json +72 -0
  289. package/evals/fixtures/kb-generated/vue.json +72 -0
  290. package/evals/fixtures/projects/existing-chakra-v3/package.json +10 -0
  291. package/evals/fixtures/projects/existing-nuxt-ui/package.json +9 -0
  292. package/evals/fixtures/projects/existing-radix/package.json +9 -0
  293. package/evals/out/agent-report.json +190 -11
  294. package/evals/out/baseline-report.json +1441 -387
  295. package/evals/out/calibration.json +387 -42
  296. package/evals/out/external-repos-report.json +112 -0
  297. package/evals/out/local-benchmark-report.json +455 -0
  298. package/evals/src/agent-eval.test.ts +3 -0
  299. package/evals/src/agent-eval.ts +26 -4
  300. package/evals/src/baseline.ts +48 -7
  301. package/evals/src/blind-labeling-cli.ts +5 -0
  302. package/evals/src/blind-labeling.ts +46 -0
  303. package/evals/src/external-repos.ts +179 -0
  304. package/evals/src/metrics.ts +70 -0
  305. package/evals/src/mutations.ts +6 -6
  306. package/evals/src/page-a11y-eval.ts +37 -36
  307. package/evals/src/page-real-eval.ts +8 -7
  308. package/evals/src/plain-agent.test.ts +14 -0
  309. package/evals/src/plain-agent.ts +240 -0
  310. package/evals/src/run-agent-evals.ts +3 -0
  311. package/evals/src/run-external-repos.ts +43 -0
  312. package/evals/src/run-local-benchmark.ts +105 -0
  313. package/evals/src/run-plain-agent.ts +81 -0
  314. package/examples/README.md +32 -0
  315. package/examples/build-handoff.ts +106 -0
  316. package/examples/design-md.md +24 -0
  317. package/examples/handoff-input.json +59 -0
  318. package/examples/handoff.json +216 -0
  319. package/examples/layer-operations.json +18 -0
  320. package/examples/website-demo-handoff.json +580 -0
  321. package/package.json +29 -6
  322. package/references/design-md.md +3 -1
  323. package/references/errors.md +1 -1
  324. package/references/handoff.md +16 -1
  325. package/references/outcomes.md +60 -11
  326. package/references/patterns.md +3 -3
  327. package/references/tools.md +86 -27
  328. package/scripts/action-review.mjs +59 -0
  329. package/scripts/bench-latency.ts +90 -0
  330. package/scripts/build-site.ts +324 -0
  331. package/scripts/calibration.ts +50 -14
  332. package/scripts/fix-imports.ts +31 -2
  333. package/scripts/generate-kb.ts +214 -0
  334. package/scripts/generate-refusal-catalog.ts +58 -0
  335. package/scripts/generate-tool-docs.ts +31 -0
  336. package/scripts/mcp-config.ts +26 -83
  337. package/scripts/package-plugin.mjs +50 -0
  338. package/scripts/sbom.mjs +46 -0
  339. package/scripts/visual-diff.mjs +52 -0
  340. package/site/data.json +187 -0
  341. package/site/index.html +151 -0
  342. package/skills/ui-gateway-cli/SKILL.md +41 -0
  343. package/templates/next-shadcn/.github/workflows/ui-check.yml +14 -0
  344. package/templates/next-shadcn/.mcp.json +8 -0
  345. package/templates/next-shadcn/DESIGN.md +35 -0
  346. package/templates/next-shadcn/README.md +14 -0
  347. package/templates/next-shadcn/app/page.tsx +8 -0
  348. package/templates/next-shadcn/package.json +19 -0
  349. package/templates/vite-mantine/.github/workflows/ui-check.yml +14 -0
  350. package/templates/vite-mantine/.mcp.json +8 -0
  351. package/templates/vite-mantine/DESIGN.md +30 -0
  352. package/templates/vite-mantine/README.md +7 -0
  353. package/templates/vite-mantine/package.json +21 -0
  354. package/templates/vite-mantine/src/App.tsx +10 -0
  355. package/templates/vite-mui/.github/workflows/ui-check.yml +14 -0
  356. package/templates/vite-mui/.mcp.json +8 -0
  357. package/templates/vite-mui/DESIGN.md +30 -0
  358. package/templates/vite-mui/README.md +8 -0
  359. package/templates/vite-mui/package.json +22 -0
  360. package/templates/vite-mui/src/App.tsx +12 -0
  361. package/scripts/fetch-bundle-sizes.ts +0 -106
  362. package/scripts/test-bundlephobia.ts +0 -11
package/AGENTS.md CHANGED
@@ -1,7 +1,8 @@
1
1
  # AGENTS.md
2
2
 
3
3
  Contributor guide for this repository. Read this before changing code, and read
4
- `SKILL.md` before changing the agent-facing contract.
4
+ `SKILL.md` before changing the agent-facing contract. `docs/engineering-principles.md`
5
+ holds the rules behind the section below (`must` blocks a release).
5
6
 
6
7
  ## What this is
7
8
 
@@ -9,7 +10,9 @@ UI Gateway turns a design handoff into verified UI component mappings. The
9
10
  gateway returns code and typed refusals; it never writes files, installs
10
11
  packages or opens pull requests. The agent using the skill is the only writer.
11
12
 
12
- Node 22.5+ is required because the event log uses `node:sqlite`.
13
+ Node 20+ is required. The default in-memory event log has no native
14
+ dependency; `--sqlite` needs Node 22.5+ because it uses `node:sqlite` and fails
15
+ with an explicit error on older Node.
13
16
 
14
17
  ## Commands
15
18
 
@@ -18,6 +21,11 @@ npm install
18
21
  npm run typecheck
19
22
  npm test
20
23
  npm run check # typecheck + test
24
+ npm run docs:examples # run the skill/reference examples against the tools
25
+ npm run eval:plain-agent # plain-agent code arm (local/DeepSeek/Anthropic/OpenAI/Groq)
26
+ npm run eval:local # gateway + plain-agent arms against local Ollama
27
+ npm run eval:repos # detection/derivation on pinned external repos
28
+ npm run eval:repos -- --pins-only # resolve commits without cloning
21
29
  npm run demo # end-to-end greenfield shadcn + existing MUI
22
30
  npm run eval # golden set + stand-in arms
23
31
  npm run eval:agent # agent tool contract (build -> validate -> submit)
@@ -27,8 +35,14 @@ npm run eval:site # Playwright site eval (installed Chrome)
27
35
  npm run eval:page # generated page shell accessibility eval (installed Chrome)
28
36
  npm run eval:page:real # real MUI/Chakra/Mantine scaffold + theme browser eval
29
37
  npm run calibration # writes docs/calibration.svg
38
+ npm run site # writes site/index.html from eval artifacts
30
39
  npm run cli -- <args>
31
40
  npm run mcp:config -- --project <target>
41
+ npm run docs:tools # regenerate README tool table from TOOLS
42
+ npm run docs:refusals # regenerate docs/refusal-catalog.md
43
+ npm run kb:generate # refresh .d.ts-derived KB snapshots
44
+ npm run sbom # write .tmp/sbom.cdx.json
45
+ npm run plugin:bundle # write a self-contained skill/MCP bundle
32
46
  ```
33
47
 
34
48
  Use `npm run check` before calling a change done. Tests are offline by default;
@@ -42,7 +56,7 @@ do not add network-dependent tests to `npm test`.
42
56
  | `packages/design-md` | Strict Design MD parser/normalizer, constraint compiler, satisfiability. |
43
57
  | `packages/profile` | Project detection, local component derivation, skill capture, conflicts. |
44
58
  | `packages/kb` | Knowledge base, provenance tiers, ingest quarantine, freshness/drift. |
45
- | `packages/adapters` | Adapter interface, shadcn/MUI/Chakra v2/Mantine/local adapters, conformance suite. |
59
+ | `packages/adapters` | Adapter interface, shadcn/MUI/Chakra v2+v3/Mantine/Nuxt UI/Radix/Vue/Svelte/Angular/Solid/Bootstrap/Ant Design/local adapters, conformance suite. |
46
60
  | `packages/matcher` | Filtering, ranking, closed-ID selection, scaffold generation. |
47
61
  | `packages/verifier` | TSX AST checks, design lint, coverage, optional `tsc` sandbox. |
48
62
  | `packages/gateway` | Wiring, leases, retries, acceptance, result assembly, `validate.ts`. |
@@ -110,9 +124,16 @@ empty `stdout` must not hide a timeout or a crash.
110
124
 
111
125
  ## Contract rules
112
126
 
127
+ The short form lives here; `docs/engineering-principles.md` has the full set and
128
+ its definition of done.
129
+
113
130
  - **Fail closed.** Unknown Design MD sections/keys/values, unsupported
114
131
  libraries, stale KBs and integrity mismatches must be typed refusals. Do not
115
132
  add a fallback that guesses.
133
+ - **`ok` agrees with `outcome`.** `SubmitResponse.ok` is true only for
134
+ `COMPLETED`. Every other outcome returns `ok: false` with its result attached
135
+ (except `REJECTED`, which has no result) and maps to its own CLI exit code
136
+ (`packages/transports/src/exit-codes.ts`). Do not restore a silent success.
116
137
  - **One validation path.** `packages/gateway/src/validate.ts` is shared by the
117
138
  CLI, MCP and HTTP. If you change pre-flight checks, update that file and the
118
139
  references, not just one transport.
@@ -142,7 +163,10 @@ empty `stdout` must not hide a timeout or a crash.
142
163
 
143
164
  Manifests are validated by `packages/kb/src/entry.ts`. `variants` only accepts
144
165
  string groups (`values` + string `default`); booleans belong in `props`.
145
- Quarantined entries fail conformance.
166
+ Quarantined entries fail conformance. Every manifest declares `library_version`
167
+ (the version line its entries were verified against, for example `6.x` or
168
+ `2.x/3.x`); ingest stamps it onto each entry and the conformance test asserts it,
169
+ so a scaffold cannot be silently reused across a major.
146
170
 
147
171
  ## Agent surface changes
148
172
 
@@ -170,6 +194,13 @@ Quarantined entries fail conformance.
170
194
  - Property-based tests live in `packages/verifier/src/verifier.pbt.test.ts`.
171
195
  - Do not weaken an eval threshold or delete a failing item to make a change
172
196
  pass. Report the failure.
197
+ - `packages/transports/src/doc-examples.test.ts` executes what the docs show:
198
+ Design MD blocks are validated, JSON blocks are parsed as the handoff, intent,
199
+ page plan or MCP config they illustrate, `ui-gateway <command>` and
200
+ `tool({...})` snippets must resolve, and `examples/` must validate. It also
201
+ fails when a doc pins a `kb_version` other than `buildKnowledgeBase().version`,
202
+ so a KB bump means updating `examples/handoff.json` and any doc that quotes a
203
+ version. Keep examples passing rather than adding them to a skip list.
173
204
 
174
205
  ## Gotchas
175
206
 
@@ -181,5 +212,9 @@ Quarantined entries fail conformance.
181
212
  - The repo is published to npm as `ui-gateway`. Distribution includes the npm
182
213
  package plus `SKILL.md`, `references/`, `examples/`, and a generated MCP config.
183
214
  Install with `npm install ui-gateway`, then run `npx ui-gateway mcp:config --project <app>`.
184
- - Chakra v3 dotted namespaces (`Table.Root`) are intentionally parked; the
185
- adapter targets v2 flat exports.
215
+ - Chakra is one adapter with two surfaces: v2 flat exports and v3 dotted
216
+ namespaces (`Table.Root`). Keep the version filter in `chakra/index.ts`; do not
217
+ expose v3 entries to a v2 project.
218
+ - Nuxt UI and unified Radix (`radix-ui`) are experimental. Nuxt UI uses the
219
+ `#components` alias because the package root does not export component values;
220
+ its generated output is a sketch, not a compiled Vue SFC.
package/BENCHMARK.md ADDED
@@ -0,0 +1,141 @@
1
+ # Benchmark: gateway vs. plain agent
2
+
3
+ This file is the method and reproduction guide. It deliberately does not invent
4
+ numbers: run the commands below on the pinned data and publish the generated
5
+ JSON. The pre-registered thresholds live in `evals/fixtures/thresholds.json` and
6
+ are defined in `docs/metrics.md`.
7
+
8
+ ## Arms
9
+
10
+ | Arm | Command | What it measures |
11
+ | --- | --- | --- |
12
+ | full skill | `npm run eval:claude` | detect → derive/validate Design MD → rank → closed-ID select → scaffold → verify |
13
+ | no retrieval | same run | model picks from an unranked candidate list |
14
+ | plain generation | same run | model names a component id with no candidate list |
15
+ | plain agent, no gateway | `npm run eval:plain-agent` | same model writes code in the same project with a normal toolset; outcomes measured by the project verifier |
16
+ | deterministic stand-ins | `npm run eval` | offline separation check, no model |
17
+ | real repos | `npm run eval:repos` | detection + Design MD derivation on pinned open-source projects |
18
+
19
+ `eval:plain-agent` and `eval:claude` require `ANTHROPIC_API_KEY`. `eval:repos`
20
+ needs network on the first run and caches clones under `.tmp/external-repos`.
21
+
22
+ ## Unit of measurement
23
+
24
+ The plain-agent arm records task outcomes, not just a component id:
25
+
26
+ - `compiles` — the project verifier's TypeScript sandbox accepted the file;
27
+ - `lint_clean` — no error-severity page findings;
28
+ - `a11y_clean` — no missing alt, unlabeled control or missing main landmark;
29
+ - `constraints_ok` — no forbidden library/pattern from the Design MD;
30
+ - `libraries_allowed` — every external import is installed or allowed;
31
+ - `tokens_matched` — at least half of the sampled Design MD token values appear;
32
+ - `tool_calls`, `tokens`, `wall_ms` — cost and latency, where the provider exposes them.
33
+
34
+ `computeTaskOutcomes` in `evals/src/metrics.ts` reports rates and Wilson
35
+ intervals. The gateway arms keep the existing component-selection metrics plus
36
+ the verifier checks, so the two units coexist rather than replace each other.
37
+
38
+ ## Reproduce
39
+
40
+ ```bash
41
+ npm ci
42
+ npm run typecheck
43
+ npm test
44
+
45
+ # Offline separation (no key)
46
+ npm run eval
47
+ npm run eval:agent
48
+
49
+ # Real model arms (one command writes evals/out/claude-baseline-report.json)
50
+ export ANTHROPIC_API_KEY=...
51
+ npm run eval:claude
52
+ npm run eval:plain-agent
53
+
54
+ # Stratified sample when a provider rate-limits
55
+ UIGW_EVAL_STRIDE=8 npm run eval:claude
56
+ UIGW_EVAL_STRIDE=8 npm run eval:plain-agent
57
+
58
+ # Real repositories (pins resolved commits; --update-pins writes them back)
59
+ npm run eval:repos -- --update-pins
60
+ npm run eval:repos
61
+ ```
62
+
63
+ Every report records `model_info`, sampling (`limit`/`stride`) and the golden set
64
+ coverage, so a reader can reproduce the table from the committed JSON.
65
+
66
+ ## Local-model sample (real run)
67
+
68
+ This is the only model-backed table currently committed. It is a **6-item
69
+ stratified sample** on a small CPU model, not a frontier result. Treat the
70
+ intervals as wide and the conclusion as directional.
71
+
72
+ | Arm | Hit rate | Compiles | Constraints | Mean wall |
73
+ | --- | --- | --- | --- | --- |
74
+ | gateway full skill | 66.7% (30.0–90.3) | 100% (51.0–100) | 100% | 5.6 s |
75
+ | no-retrieval model | 0% | n/a | 100% | n/a |
76
+ | plain generation (id only) | 0% (100% hallucination) | n/a | 100% | n/a |
77
+ | plain agent, no gateway | 0% | 16.7% | 83.3% | 24.3 s |
78
+
79
+ - Model: `gemma3:1b` through Ollama on CPU.
80
+ - Sample: `UIGW_EVAL_STRIDE=32` (6 of 172), `UIGW_LOCAL_SAMPLES=1`.
81
+ - Gateway calibration on this sample: ECE 0.052, Brier 0.003; abstention 33.3%.
82
+ - The plain-agent arm's only compile success was a trivial file; the rest failed
83
+ type-checking. This is the competitor the roadmap asked for, not a stand-in.
84
+ - This sample is too small to settle the pre-registered kill rule. A key-backed
85
+ frontier run at a larger stride is still required.
86
+
87
+ Raw report: `docs/benchmarks/local-gemma3-1b-stride32.json`.
88
+ Reproduce with:
89
+
90
+ ```bash
91
+ UIGW_LOCAL_MODEL=gemma3:1b UIGW_EVAL_STRIDE=32 UIGW_LOCAL_SAMPLES=1 npm run eval:local
92
+ ```
93
+
94
+ ## Frontier run (pending)
95
+
96
+ The key-backed frontier table is **not yet committed**. To publish it:
97
+
98
+ ```bash
99
+ export ANTHROPIC_API_KEY=...
100
+ # Full 172-item run (or UIGW_EVAL_STRIDE=4 to save budget)
101
+ npm run eval:claude
102
+ npm run eval:plain-agent
103
+ # Copy the generated report into the repo
104
+ cp evals/out/claude-baseline-report.json docs/benchmarks/
105
+ ```
106
+
107
+ Then fill the table below with the measured rates and Wilson intervals and
108
+ replace every `pending`:
109
+
110
+ | Arm | Hit rate | Compiles | Constraints | Mean wall |
111
+ | --- | --- | --- | --- | --- |
112
+ | gateway full skill | pending | pending | pending | pending |
113
+ | plain agent, no gateway | pending | pending | pending | pending |
114
+
115
+ An independent reviewer should be able to reproduce this table from the
116
+ committed JSON alone.
117
+
118
+ ## Pre-registered decision rule
119
+
120
+ The gateway arm is worth keeping only if it beats the plain-agent arm on
121
+ compile pass rate **or** constraint-violation rate by more than the confidence
122
+ intervals overlap. If it does not, the standalone verifier (`ui-gateway check`
123
+ and the GitHub Action) becomes the product; the agent flow stays an optional
124
+ layer. This rule is written before the first plain-agent run and must not be
125
+ changed after seeing the result.
126
+
127
+ ## Status in this workspace
128
+
129
+ | Piece | Status |
130
+ | --- | --- |
131
+ | Deterministic arms and thresholds | implemented (`npm run eval`) |
132
+ | Claude/Groq/Ollama arms | implemented; real numbers require a key |
133
+ | Plain-agent code arm | implemented (`evals/src/plain-agent.ts`) |
134
+ | Task-outcome metrics | implemented (`computeTaskOutcomes`) |
135
+ | Pinned external repos | 6/6 commits resolved with `git ls-remote`; Vite React template clone detected and derived a Design MD (`docs/benchmarks/external-repos.json`) |
136
+ | Local-model arm (Ollama) | implemented (`npm run eval:local`); a small stratified sample is recorded below |
137
+ | Blind labeling + 15% relabel | implemented (`--relabel 0.15`); annotators still a pilot |
138
+ | Published frontier benchmark table | pending a key-backed run; see "Frontier run (pending)" above |
139
+
140
+ The existing author-labeled offline result is documented in `docs/metrics.md`
141
+ and must stay labelled "author-labeled" until independent human labels exist.
package/CHANGELOG.md CHANGED
@@ -4,15 +4,213 @@ All notable changes to UI Gateway are documented in this file.
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ### Changed
8
+ - `ui-gateway receipt` now renders the single `blocking` cause (kind, code,
9
+ message) and its concrete `fix` steps, and labels the alternatives column
10
+ "Closest rejected candidates" with the reason each was rejected. Every
11
+ non-COMPLETED receipt names what was chosen, the closest rejected candidates
12
+ and the exact fields the caller must change.
13
+ - `refusal_ledger` prefers a result's concrete `blocking.fix` over the keyword
14
+ heuristic, so a refusal cluster carries the exact next action when the gateway
15
+ already computed one.
16
+ - `derive_design_md` (tool and CLI) returns `questions`: precise next steps for
17
+ defaulted brand tokens and unresolved constraints, so a caller gets a usable
18
+ starting point plus a short question list instead of authoring a full Design
19
+ MD from scratch.
20
+ - `verify_page` adds a `states` check: when `page_plan.required_states` is set,
21
+ the page must wire each state as plain semantic HTML (`state === "<state>"`,
22
+ `aria-busy` for loading, `role="status"` for empty/error) or it fails closed.
23
+ No invented components are introduced.
24
+ - `SKILL.md` stays in sync: step 3 reads `derive_design_md` `questions`, step 7
25
+ lists the `MISSING_STATE` check, and the reporting section points at
26
+ `ui-gateway receipt` and `blocking.fix`.
27
+ - Adapter maturity is now gated by data: the conformance suite fails if a GA
28
+ adapter has no labeled eval items, or if an adapter reaches the 50-item
29
+ promotion target without being marked GA. No "supported on paper".
30
+ - The single-blocking stage is extracted from `gateway.ts` into `blocking.ts`
31
+ (`blockingFor`/`fixForCode`) with its own tests, so the "one blocking object"
32
+ rule is testable and swappable independently of the pipeline. Behavior is
33
+ unchanged.
34
+ - The outcome stage is extracted into `outcome.ts` (`aggregateOutcome`,
35
+ `IntentOutcome`) with unit tests covering strict mode and the
36
+ all-unmapped-needs-input case. `gateway.ts` keeps only orchestration.
37
+ - The adapter-selection and install-package stages are extracted into
38
+ `resolve.ts` (`selectTargetAdapters`, `collectInstallPackages`) with unit
39
+ tests. Behavior is unchanged.
40
+ - The profile stage is extracted into `profile.ts` (`resolveProfile`) with its
41
+ dependencies injected and unit tests for detection, greenfield and hash
42
+ mismatch. `gateway.ts` is now a thin orchestrator over named stages.
43
+ - The intent result-assembly stage is extracted into `intent-result.ts`
44
+ (`unmappedIntentResult`, `noMatchFailure`) with unit tests, so building an
45
+ unmapped result and the NO_MATCH failure are testable independently of the
46
+ `runIntent` loop. Behavior is unchanged.
47
+ - `SKILL.md` apply step now pins `library_version` (no cross-major reuse) and the
48
+ reporting section shows a non-COMPLETED (PARTIAL) template with the blocking
49
+ cause and fix.
50
+
51
+ ## [0.1.1] - 2026-11-28
52
+
53
+ ### Added
54
+ - `ui-gateway mcp:config` CLI command that prints a ready-to-paste config for
55
+ generic, Claude Code, Cursor, VS Code and OpenCode clients using the published
56
+ `npx -y ui-gateway mcp` command.
57
+ - `ui-gateway init` one-command setup: detects the client, writes/merges the MCP
58
+ config, copies the skill/references/examples and prints project detection with
59
+ `needs_input` questions.
60
+ - `ui-gateway init --print-skill` lean skill-only mode for clients without MCP.
61
+ - `map_ui` two-call tool (`submit` and read-only `lookup`) and `derive_design_md`.
62
+ - `refusal_ledger` tool that groups repeated refusals and suggests fixes.
63
+ - `ui-gateway check` for existing files, a composite GitHub Action with inline PR
64
+ comments, `ui-gateway receipt` HTML reports and `import-figma` intent import.
65
+ - `ui-gateway derive-design-md` and derivation from CSS variables, Tailwind
66
+ config, DTCG files or an existing DESIGN.md.
67
+ - BM25 retrieval, rules-first/LLM escalation selection, fitted confidence
68
+ weights, isotonic calibration and ECE reporting.
69
+ - Adapter maturity metadata (GA vs experimental) in `describe_kb`.
70
+ - Type-derived KB snapshots, a nightly KB freshness workflow, SBOM generation and
71
+ a provenance release workflow.
72
+ - `eval:plain-agent`, `eval:repos`, task-outcome metrics and `BENCHMARK.md`.
73
+ - Adversarial skill-injection and parser/schema fuzz tests.
74
+ - Starter templates for Next + shadcn, Vite + MUI and Vite + Mantine.
75
+ - `examples/`, `docs/`, `templates/`, `skills/` and `action.yml` are now shipped
76
+ in the npm package.
77
+
78
+ ### Fixed
79
+ - The CLI shebang is `node`, not `tsx`, so an installed package runs without a
80
+ devDependency on tsx.
81
+ - Reference and example resources resolve from both source and compiled layouts.
82
+ - `--sqlite` now fails with an explicit "Node 22.5+" message instead of a raw
83
+ `node:sqlite` import error; the default in-memory log runs on Node 20.
84
+ - README tool list matches `TOOLS` (11 tools) and documents `mcp:config`, `init`
85
+ and the CLI fallback.
86
+
87
+ ## [0.1.2] - 2026-11-29
88
+
89
+ ### Breaking
90
+ - `SubmitResponse.ok` is true only for `COMPLETED`; every other outcome returns
91
+ `ok: false` with the result attached and a `blocking` cause. Read `outcome`,
92
+ not `ok`, to decide what happened.
93
+ - CLI exit codes follow the outcome (0 `COMPLETED`, 1 `REJECTED`, 3
94
+ `NEEDS_INPUT`, 4 `PARTIAL`, 5 `FAILED`, 6 `AMBIGUOUS`, 7 `EXPIRED`).
95
+ - Bundle-size ranking is gone: `bundle_size_kb` values were package-level
96
+ duplicates, not measurements. The field, the `bundleSizeScoring` option and
97
+ the `bundle-size` helpers are deprecated no-ops for one minor (below); the
98
+ script that wrote the fabricated values is removed.
99
+
100
+ ### Migration
101
+ - Replace `if (response.ok)` with a check on `response.outcome`, and report
102
+ `blocking.code` / `blocking.fix` for non-success runs.
103
+ - Update CI scripts that treated any response as success: only exit 0 means
104
+ `COMPLETED`; 3, 4, 6 and 7 still carry a result.
105
+ - Drop `bundleSizeScoring` from gateway/matcher calls. Passing it is accepted
106
+ but ignored until 0.3.0; no per-component size data exists, and the
107
+ `bundle-size` exports must not be used for size claims.
108
+ - Read `library_version` from `describe_kb` entries/mappings and keep generated
109
+ scaffolds on the same major; the scaffold header records `library@line`.
110
+
111
+ ### Deprecated
112
+ - `bundle_size_kb` (KB entry schema), `bundleSizeScoring` (gateway/matcher
113
+ options) and the `@uigw/kb` `bundle-size` exports (`fetchBundleSizeFromBundlephobia`,
114
+ `fetchBundleSizes`, `bytesToKb`, `estimateComponentBundleSize`) are accepted
115
+ and ignored for one minor, then removed in 0.3.0.
116
+
7
117
  ### Added
8
118
  - Library adapters for Vue, Svelte, Angular, SolidJS, Bootstrap and Ant Design (10 total)
9
119
  - Compiled output build (`tsconfig.build.json`, `npm run build`, `dist/`)
10
120
  - npm `main`, `types`, `exports` and `bin` fields pointing to compiled output
11
121
  - CI workflow runs `npm run build` to verify compilation
122
+ - Every non-success `SubmitResponse` (and its result) carries one `blocking`
123
+ object: `kind` (`error`, `input`, `acceptance`, `page_check`), `code`,
124
+ `message`, `retryable` and concrete `fix` steps.
125
+ - `ui-gateway preview <result.json>` renders a result as standalone HTML with no
126
+ React, build step or JavaScript.
127
+ - `ui-gateway kb-freshness <library> --current <version>` (and the
128
+ `checkFreshness` module) compares the KB pin with the npm registry and cited
129
+ `--docs` pages. It returns proposals only and never edits the KB or opens a PR.
130
+ - Validation reports now carry typed `errors` (`code`, `message`, `retryable`);
131
+ `design_errors` entries carry a `code` and `retryable` too.
132
+ - Agent eval reports rounds: `tool_calls_total`, `tool_calls_per_item` and
133
+ `max_tool_calls`.
134
+ - Tests for Design MD prose and hostile wireframe labels, a Brew Atlas
135
+ card/form/feedback regression, and adapter-count/changelog drift checks.
136
+ - KB entries and mappings carry `library_version` (the version line the entries
137
+ were verified against), `describe_kb` exposes it per library, and every
138
+ scaffold starts with a `// library@line` header so it is not reused across
139
+ majors. The KB version moves to `kb-2026.11.3`.
140
+ - Freshness checks accept an `official_hosts` allowlist: a documentation URL on
141
+ any other host is rejected and never cited. Reports carry
142
+ `confidence_score` (0–1) alongside the human confidence band.
143
+
144
+ ### Changed
145
+ - README updated to reflect the current adapter set and npm publishing
146
+ - `NON-GOALS.md` updated for the current adapter support
147
+ - `--out` on the CLI echoes `wrote <path>` on stderr, so stdout stays machine
148
+ readable. `check` prints JSON by default; `--text` keeps the readable list.
149
+ - `NO_MATCH` now names the closest candidate, the verification failure that
150
+ rejected it and a suggested fix instead of only reporting an attempt count.
151
+ - `INTEGRITY_MISMATCH` is `retryable: false` (the same bytes always fail), the
152
+ skill and reference tables agree, and the tool error helper uses the code's
153
+ real retryability instead of a hard-coded `false`.
154
+ - Runtime dependencies are pinned exactly (`typescript`, `undici`, `zod`).
155
+ - A near-tie in selection is resolved when exactly one close candidate declares
156
+ a prop that the wireframe element names (element `customer-email` selects the
157
+ input whose `type` includes `email`). Candidate scores are unchanged; two prop
158
+ matches, or a match far behind the top two, still abstain. Golden-set hit rate
159
+ moves 0.983 → 0.988 with silent-wrong unchanged at 0.012.
12
160
 
13
161
  ### Changed
14
- - README updated to reflect 10 adapters and npm publishing
15
- - `NON-GOALS.md` updated for 10-adapter support
162
+ - `SubmitResponse.ok` is true only when `outcome` is `COMPLETED`. `PARTIAL`,
163
+ `NEEDS_INPUT`, `AMBIGUOUS`, `FAILED` and `EXPIRED` now return `ok: false` with
164
+ the result still attached; only `REJECTED` has no result. **Breaking** for
165
+ callers that read `ok` as "a response arrived": read `outcome` instead.
166
+ - `ui-gateway submit` and the other submit-style commands exit 0, 1, 3, 4, 5, 6
167
+ or 7 for `COMPLETED`, `REJECTED`, `NEEDS_INPUT`, `PARTIAL`, `FAILED`,
168
+ `AMBIGUOUS` and `EXPIRED`; 2 remains an internal error. The table is in
169
+ `references/outcomes.md` and the CLI usage text.
170
+ - `result_hash` now covers the result body minus `result_hash`, `started_at`,
171
+ `completed_at` and `owner`, so identical handoffs hash identically across
172
+ clock values and gateway processes.
173
+
174
+ ### Fixed
175
+ - Scaffolds no longer emit `href="#"`. A navigation intent uses its pinned
176
+ `target`; without one the scaffold renders no link and adds a cleanup note.
177
+ - Composed pages are checked by the page verifier before they are returned.
178
+ Failing checks downgrade `COMPLETED` to `PARTIAL` and are reported in
179
+ `result.page.verification` (`passed`, `checks`, `issues`).
180
+ - Removed the stale duplicate `DEFAULT_KB_VERSION` (`kb-2026.11.1`) from
181
+ `packages/protocol`; the adapters registry value is the only source.
182
+ - `NON-GOALS.md` no longer claims a `design_md_updates` write path or that the
183
+ gateway may edit a Design MD; it now states the read-only contract and the
184
+ three CLI writers.
185
+ - `examples/handoff.json`, `examples/website-demo-handoff.json` and
186
+ `references/handoff.md` pinned the previous KB version; they match the KB
187
+ again, and the demo handoff's navigation intents carry real targets.
188
+ - Wireframe labels are escaped before they reach JSX text or attributes, so a
189
+ label containing markup, quotes or braces renders as text and cannot inject
190
+ elements or statements into a scaffold.
191
+ - Scaffolds no longer invent placeholder content: the `"Item"` fallback,
192
+ `option-1`/`tab-1` values and the fake `/avatar.png` are gone. Copy comes from
193
+ the intent label, then element name, then description; with none the component
194
+ renders without children. Loading/empty/error states come from the page shell
195
+ (`page_plan.required_states`), not from advice text in each component.
196
+
197
+ ### Removed
198
+ - Bundle-size scoring and the per-component `bundle_size_kb` values: they were
199
+ package-level duplicates, not measurements. The schema field, ranking option,
200
+ `packages/kb/src/bundle-size.ts` and `scripts/fetch-bundle-sizes.ts` are gone,
201
+ and `docs/parking-lot.md` says so.
202
+
203
+ ### Documentation
204
+ - `docs/engineering-principles.md`: the rules behind the contract section of
205
+ `AGENTS.md`, split into ten areas (correctness, honest interfaces, errors,
206
+ agent-first design, output quality, testing, security, KB freshness, change
207
+ management, definition of done) and using "must" only for rules a release can
208
+ be blocked on. Linked from `AGENTS.md` and `CONTRIBUTING.md`.
209
+
210
+ **Release note:** 0.1.2 is a pre-1.0 release that changes the
211
+ `SubmitResponse` shape, CLI exit codes, the KB version and the bundle-size
212
+ surface. The engineering-principles doc ships in the npm package's existing
213
+ `docs/` directory.
16
214
 
17
215
  ## [0.1.0] - 2026-11-28
18
216
 
package/CONTRIBUTING.md CHANGED
@@ -16,7 +16,8 @@ Node 22.5+ is required (the event log uses `node:sqlite`).
16
16
  ## How to contribute
17
17
 
18
18
  1. **Fork the repo** and create a feature branch from `main`.
19
- 2. **Make your changes** following the conventions in `AGENTS.md`.
19
+ 2. **Make your changes** following the conventions in `AGENTS.md` and the
20
+ principles in [`docs/engineering-principles.md`](./docs/engineering-principles.md).
20
21
  3. **Run the full check:** `npm run check` (typecheck + all tests).
21
22
  4. **Run lint** if available.
22
23
  5. **Commit** with conventional commit messages (`feat:`, `fix:`, `docs:`, `test:`, `chore:`).
@@ -49,17 +50,58 @@ Node 22.5+ is required (the event log uses `node:sqlite`).
49
50
 
50
51
  ## Code conventions
51
52
 
53
+ [`docs/engineering-principles.md`](./docs/engineering-principles.md) is the
54
+ full rule set, including the definition of done. The core rules:
55
+
52
56
  - No comments in code unless asked (see `AGENTS.md`).
53
57
  - Fail closed: unknown values are typed refusals, never fallbacks.
54
58
  - One validation path: `packages/gateway/src/validate.ts` is shared by CLI, MCP and HTTP.
55
59
  - The gateway never writes files, installs packages or opens PRs.
56
60
  - Free text (intent descriptions, wireframe notes, skill rules) is data, never instructions.
57
61
 
62
+ ## Maintainer note (bus factor)
63
+
64
+ UI Gateway is currently maintained by a single person. To reduce that risk the
65
+ project keeps an explicit roadmap (`docs/archive/UI Gateway Final Project
66
+ Roadmap.md`), a written definition of done (`docs/engineering-principles.md`),
67
+ and a conformance suite that any adapter must pass. Reviewers and co-maintainers
68
+ are welcome; start with a good first issue (below) or by improving test coverage
69
+ (`npm run test:coverage`).
70
+
71
+ ## Good first issues
72
+
73
+ - Add a fixture or test for an untested adapter capability.
74
+ - Improve coverage in a package below the threshold (run `npm run test:coverage`).
75
+ - Fix a documentation gap flagged by `npm run docs:examples`.
76
+ - Add a golden-set item (see `BENCHMARK.md`).
77
+
78
+ Label your PR `good first issue` if it is small and self-contained.
79
+
80
+ ## Becoming a maintainer
81
+
82
+ UI Gateway is currently single-maintainer. To reduce that risk we want a second
83
+ maintainer. The path is:
84
+
85
+ 1. Land a few merged PRs (features, fixes, or test coverage).
86
+ 2. Pick up an issue labeled `help wanted`.
87
+ 3. Ask in a `help wanted` issue or discussion to be added as a maintainer.
88
+
89
+ Maintainers get triage/write access, are added to `.github/CODEOWNERS`, and help
90
+ review PRs and cut releases. Branch protection requires one review and green CI.
91
+
58
92
  ## Releasing
59
93
 
60
- Maintainers only:
94
+ Versioning and the changelog are managed by
95
+ [Changesets](https://github.com/changesets/changesets). Maintainers only:
61
96
 
62
- ```bash
63
- npm version patch # or minor / major
64
- npm publish
65
- ```
97
+ 1. Merge the automated **Version Packages** pull request (opened by the
98
+ `version` workflow), or run `npx changeset version` locally and push.
99
+ 2. Tag the release and push the tag:
100
+
101
+ ```bash
102
+ git tag vX.Y.Z
103
+ git push origin vX.Y.Z
104
+ ```
105
+
106
+ 3. The `release` workflow publishes to npm with provenance and uploads the SBOM
107
+ artifact. Add a changeset for every user-facing change with `npx changeset`.
package/NON-GOALS.md CHANGED
@@ -5,19 +5,22 @@ Written in Phase 0 and kept current. Scope grows only by moving something off th
5
5
  ## Completed in this phase
6
6
 
7
7
  - **Non-React frameworks.** Vue, Svelte, Angular and Solid now have library adapters with their own compiler checks and scaffold rules.
8
- - **Ten library adapters.** shadcn, MUI, Chakra v2, Mantine, Vue, Svelte, Angular, Solid, Bootstrap and Ant Design are supported.
9
- - **`design_md_updates` feedback loop.** The gateway can now edit the caller's Design MD to resolve conflicts and missing information.
8
+ - **Twelve library adapters.** shadcn, MUI, Chakra v2/v3, Mantine, Nuxt UI, unified Radix, Vue, Svelte, Angular, Solid, Bootstrap and Ant Design are supported.
10
9
  - **Multi-process orchestration.** SQLite leases coordinate cross-process contention on handoffs across multiple gateway processes.
11
- - **Hosted service.** Deployment and hosting infrastructure are in scope.
12
- - **UI / chat surface.** Application layer on top of the gateway is in scope.
13
- - **Model training / fine-tuning.** Selection training pipelines are in scope.
14
10
 
15
11
  ## Not in v2
16
12
 
17
- - **Applying changes to a user's repository (other than Design MD updates).** The gateway returns scaffolds and dependency changes; it never writes files other than the Design MD feedback path, installs packages or opens pull requests.
13
+ - **Applying changes to a user's repository.** The gateway returns scaffolds,
14
+ typed refusals and dependency changes. It never writes files, edits the
15
+ caller's Design MD, installs packages or opens pull requests. The only writers
16
+ are the CLI commands the user invokes: `--out` flags (which echo the path they
17
+ wrote), `ui-gateway init` (which reports every file it copied or merged) and
18
+ `ui-gateway label` (which appends the labels it recorded).
18
19
 
19
20
  ## Explicit quality limits, not goals
20
21
 
21
22
  - The gateway does not promise the *best* component, only a verified acceptable one. Selection quality is measured (acceptable-set hit rate, silent-wrong rate), not assumed.
22
23
  - Semantic errors inside an internally consistent wireframe are only catchable at the producer. The interpretation receipt exists so the caller can diff its meaning against the gateway's.
23
24
  - Tier D sources (docs scraping) are never used for verification; the KB refuses to ingest them.
25
+ - Per-component bundle sizes are not provided. The old values were package-level duplicates rather than measurements, so the field is a deprecated no-op and ranking does not claim a size signal.
26
+ - KB entries pin the library *version line* they were verified against (`library_version`, for example `6.x`), not an exact patch. Exact patch drift is what `kb-freshness` proposes changes for.