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.
- package/AGENTS.md +41 -6
- package/BENCHMARK.md +141 -0
- package/CHANGELOG.md +200 -2
- package/CONTRIBUTING.md +48 -6
- package/NON-GOALS.md +9 -6
- package/README.md +136 -41
- package/SECURITY.md +22 -1
- package/SKILL.md +71 -17
- package/action.yml +90 -0
- package/dist/evals/src/baseline.d.ts +4 -1
- package/dist/evals/src/baseline.d.ts.map +1 -1
- package/dist/evals/src/baseline.js +28 -6
- package/dist/evals/src/baseline.js.map +1 -1
- package/dist/evals/src/metrics.d.ts +35 -0
- package/dist/evals/src/metrics.d.ts.map +1 -1
- package/dist/evals/src/metrics.js +24 -0
- package/dist/evals/src/metrics.js.map +1 -1
- package/dist/packages/adapters/src/angular/index.js +2 -2
- package/dist/packages/adapters/src/angular/manifest.d.ts.map +1 -1
- package/dist/packages/adapters/src/angular/manifest.js +2 -8
- package/dist/packages/adapters/src/angular/manifest.js.map +1 -1
- package/dist/packages/adapters/src/antd/index.js +2 -2
- package/dist/packages/adapters/src/antd/manifest.d.ts.map +1 -1
- package/dist/packages/adapters/src/antd/manifest.js +2 -8
- package/dist/packages/adapters/src/antd/manifest.js.map +1 -1
- package/dist/packages/adapters/src/bootstrap/index.js +2 -2
- package/dist/packages/adapters/src/bootstrap/manifest.d.ts.map +1 -1
- package/dist/packages/adapters/src/bootstrap/manifest.js +2 -8
- package/dist/packages/adapters/src/bootstrap/manifest.js.map +1 -1
- package/dist/packages/adapters/src/chakra/index.d.ts.map +1 -1
- package/dist/packages/adapters/src/chakra/index.js +30 -5
- package/dist/packages/adapters/src/chakra/index.js.map +1 -1
- package/dist/packages/adapters/src/chakra/manifest.d.ts.map +1 -1
- package/dist/packages/adapters/src/chakra/manifest.js +309 -10
- package/dist/packages/adapters/src/chakra/manifest.js.map +1 -1
- package/dist/packages/adapters/src/index.d.ts +4 -0
- package/dist/packages/adapters/src/index.d.ts.map +1 -1
- package/dist/packages/adapters/src/index.js +18 -14
- package/dist/packages/adapters/src/index.js.map +1 -1
- package/dist/packages/adapters/src/local.d.ts.map +1 -1
- package/dist/packages/adapters/src/local.js +4 -2
- package/dist/packages/adapters/src/local.js.map +1 -1
- package/dist/packages/adapters/src/mantine/index.js +3 -3
- package/dist/packages/adapters/src/mantine/manifest.d.ts.map +1 -1
- package/dist/packages/adapters/src/mantine/manifest.js +8 -21
- package/dist/packages/adapters/src/mantine/manifest.js.map +1 -1
- package/dist/packages/adapters/src/mui/index.js +3 -3
- package/dist/packages/adapters/src/mui/manifest.d.ts.map +1 -1
- package/dist/packages/adapters/src/mui/manifest.js +2 -11
- package/dist/packages/adapters/src/mui/manifest.js.map +1 -1
- package/dist/packages/adapters/src/nuxt-ui/index.d.ts +5 -0
- package/dist/packages/adapters/src/nuxt-ui/index.d.ts.map +1 -0
- package/dist/packages/adapters/src/nuxt-ui/index.js +79 -0
- package/dist/packages/adapters/src/nuxt-ui/index.js.map +1 -0
- package/dist/packages/adapters/src/nuxt-ui/manifest.d.ts +3 -0
- package/dist/packages/adapters/src/nuxt-ui/manifest.d.ts.map +1 -0
- package/dist/packages/adapters/src/nuxt-ui/manifest.js +295 -0
- package/dist/packages/adapters/src/nuxt-ui/manifest.js.map +1 -0
- package/dist/packages/adapters/src/radix/index.d.ts +5 -0
- package/dist/packages/adapters/src/radix/index.d.ts.map +1 -0
- package/dist/packages/adapters/src/radix/index.js +71 -0
- package/dist/packages/adapters/src/radix/index.js.map +1 -0
- package/dist/packages/adapters/src/radix/manifest.d.ts +3 -0
- package/dist/packages/adapters/src/radix/manifest.d.ts.map +1 -0
- package/dist/packages/adapters/src/radix/manifest.js +331 -0
- package/dist/packages/adapters/src/radix/manifest.js.map +1 -0
- package/dist/packages/adapters/src/registry.d.ts +1 -1
- package/dist/packages/adapters/src/registry.d.ts.map +1 -1
- package/dist/packages/adapters/src/registry.js +16 -12
- package/dist/packages/adapters/src/registry.js.map +1 -1
- package/dist/packages/adapters/src/shadcn/index.js +3 -3
- package/dist/packages/adapters/src/shadcn/manifest.d.ts.map +1 -1
- package/dist/packages/adapters/src/shadcn/manifest.js +2 -11
- package/dist/packages/adapters/src/shadcn/manifest.js.map +1 -1
- package/dist/packages/adapters/src/solid/index.js +2 -2
- package/dist/packages/adapters/src/solid/manifest.d.ts.map +1 -1
- package/dist/packages/adapters/src/solid/manifest.js +2 -8
- package/dist/packages/adapters/src/solid/manifest.js.map +1 -1
- package/dist/packages/adapters/src/svelte/index.js +2 -2
- package/dist/packages/adapters/src/svelte/manifest.d.ts.map +1 -1
- package/dist/packages/adapters/src/svelte/manifest.js +2 -8
- package/dist/packages/adapters/src/svelte/manifest.js.map +1 -1
- package/dist/packages/adapters/src/vue/index.js +2 -2
- package/dist/packages/adapters/src/vue/manifest.d.ts.map +1 -1
- package/dist/packages/adapters/src/vue/manifest.js +2 -8
- package/dist/packages/adapters/src/vue/manifest.js.map +1 -1
- package/dist/packages/design-md/src/compile.js +2 -2
- package/dist/packages/design-md/src/derive.d.ts +41 -0
- package/dist/packages/design-md/src/derive.d.ts.map +1 -0
- package/dist/packages/design-md/src/derive.js +341 -0
- package/dist/packages/design-md/src/derive.js.map +1 -0
- package/dist/packages/design-md/src/index.d.ts +1 -0
- package/dist/packages/design-md/src/index.d.ts.map +1 -1
- package/dist/packages/design-md/src/index.js +6 -5
- package/dist/packages/design-md/src/index.js.map +1 -1
- package/dist/packages/gateway/src/confidence.d.ts +51 -1
- package/dist/packages/gateway/src/confidence.d.ts.map +1 -1
- package/dist/packages/gateway/src/confidence.js +198 -6
- package/dist/packages/gateway/src/confidence.js.map +1 -1
- package/dist/packages/gateway/src/gateway.d.ts +10 -2
- package/dist/packages/gateway/src/gateway.d.ts.map +1 -1
- package/dist/packages/gateway/src/gateway.js +190 -14
- package/dist/packages/gateway/src/gateway.js.map +1 -1
- package/dist/packages/gateway/src/index.d.ts +1 -0
- package/dist/packages/gateway/src/index.d.ts.map +1 -1
- package/dist/packages/gateway/src/index.js +7 -6
- package/dist/packages/gateway/src/index.js.map +1 -1
- package/dist/packages/gateway/src/preview.d.ts +12 -0
- package/dist/packages/gateway/src/preview.d.ts.map +1 -0
- package/dist/packages/gateway/src/preview.js +113 -0
- package/dist/packages/gateway/src/preview.js.map +1 -0
- package/dist/packages/gateway/src/validate.d.ts +5 -2
- package/dist/packages/gateway/src/validate.d.ts.map +1 -1
- package/dist/packages/gateway/src/validate.js +46 -18
- package/dist/packages/gateway/src/validate.js.map +1 -1
- package/dist/packages/kb/src/bundle-size.d.ts +8 -9
- package/dist/packages/kb/src/bundle-size.d.ts.map +1 -1
- package/dist/packages/kb/src/bundle-size.js +14 -12
- package/dist/packages/kb/src/bundle-size.js.map +1 -1
- package/dist/packages/kb/src/entry.d.ts +19 -1
- package/dist/packages/kb/src/entry.d.ts.map +1 -1
- package/dist/packages/kb/src/entry.js +13 -1
- package/dist/packages/kb/src/entry.js.map +1 -1
- package/dist/packages/kb/src/freshness.d.ts +76 -0
- package/dist/packages/kb/src/freshness.d.ts.map +1 -0
- package/dist/packages/kb/src/freshness.js +186 -0
- package/dist/packages/kb/src/freshness.js.map +1 -0
- package/dist/packages/kb/src/index.d.ts +2 -1
- package/dist/packages/kb/src/index.d.ts.map +1 -1
- package/dist/packages/kb/src/index.js +6 -5
- package/dist/packages/kb/src/index.js.map +1 -1
- package/dist/packages/kb/src/ingest.d.ts +3 -0
- package/dist/packages/kb/src/ingest.d.ts.map +1 -1
- package/dist/packages/kb/src/ingest.js +7 -1
- package/dist/packages/kb/src/ingest.js.map +1 -1
- package/dist/packages/kb/src/kb.d.ts +5 -0
- package/dist/packages/kb/src/kb.d.ts.map +1 -1
- package/dist/packages/kb/src/kb.js +5 -2
- package/dist/packages/kb/src/kb.js.map +1 -1
- package/dist/packages/matcher/src/anthropic.js +1 -1
- package/dist/packages/matcher/src/index.d.ts +8 -1
- package/dist/packages/matcher/src/index.d.ts.map +1 -1
- package/dist/packages/matcher/src/index.js +21 -11
- package/dist/packages/matcher/src/index.js.map +1 -1
- package/dist/packages/matcher/src/scaffold.d.ts.map +1 -1
- package/dist/packages/matcher/src/scaffold.js +62 -19
- package/dist/packages/matcher/src/scaffold.js.map +1 -1
- package/dist/packages/matcher/src/score.d.ts +8 -1
- package/dist/packages/matcher/src/score.d.ts.map +1 -1
- package/dist/packages/matcher/src/score.js +90 -25
- package/dist/packages/matcher/src/score.js.map +1 -1
- package/dist/packages/matcher/src/select.d.ts +15 -1
- package/dist/packages/matcher/src/select.d.ts.map +1 -1
- package/dist/packages/matcher/src/select.js +53 -3
- package/dist/packages/matcher/src/select.js.map +1 -1
- package/dist/packages/orchestrator/src/figma.d.ts +12 -0
- package/dist/packages/orchestrator/src/figma.d.ts.map +1 -0
- package/dist/packages/orchestrator/src/figma.js +102 -0
- package/dist/packages/orchestrator/src/figma.js.map +1 -0
- package/dist/packages/orchestrator/src/index.d.ts +1 -0
- package/dist/packages/orchestrator/src/index.d.ts.map +1 -1
- package/dist/packages/orchestrator/src/index.js +3 -2
- package/dist/packages/orchestrator/src/index.js.map +1 -1
- package/dist/packages/orchestrator/src/orchestrator.d.ts.map +1 -1
- package/dist/packages/orchestrator/src/orchestrator.js +14 -3
- package/dist/packages/orchestrator/src/orchestrator.js.map +1 -1
- package/dist/packages/profile/src/detect.d.ts +9 -0
- package/dist/packages/profile/src/detect.d.ts.map +1 -1
- package/dist/packages/profile/src/detect.js +52 -5
- package/dist/packages/profile/src/detect.js.map +1 -1
- package/dist/packages/profile/src/index.js +7 -7
- package/dist/packages/profile/src/local-components.d.ts.map +1 -1
- package/dist/packages/profile/src/local-components.js +70 -1
- package/dist/packages/profile/src/local-components.js.map +1 -1
- package/dist/packages/profile/src/registry.d.ts.map +1 -1
- package/dist/packages/profile/src/registry.js +3 -1
- package/dist/packages/profile/src/registry.js.map +1 -1
- package/dist/packages/profile/src/skills.js +1 -1
- package/dist/packages/protocol/src/errors.js +1 -1
- package/dist/packages/protocol/src/errors.js.map +1 -1
- package/dist/packages/protocol/src/event-log.d.ts.map +1 -1
- package/dist/packages/protocol/src/event-log.js +11 -5
- package/dist/packages/protocol/src/event-log.js.map +1 -1
- package/dist/packages/protocol/src/events.js +5 -5
- package/dist/packages/protocol/src/hashing.d.ts +6 -0
- package/dist/packages/protocol/src/hashing.d.ts.map +1 -1
- package/dist/packages/protocol/src/hashing.js +8 -2
- package/dist/packages/protocol/src/hashing.js.map +1 -1
- package/dist/packages/protocol/src/index.js +12 -12
- package/dist/packages/protocol/src/lease.js +2 -2
- package/dist/packages/protocol/src/schemas.d.ts +2803 -116
- package/dist/packages/protocol/src/schemas.d.ts.map +1 -1
- package/dist/packages/protocol/src/schemas.js +54 -4
- package/dist/packages/protocol/src/schemas.js.map +1 -1
- package/dist/packages/protocol/src/semantic.js +1 -1
- package/dist/packages/protocol/src/state-machine.js +1 -1
- package/dist/packages/transports/src/check.d.ts +30 -0
- package/dist/packages/transports/src/check.d.ts.map +1 -0
- package/dist/packages/transports/src/check.js +190 -0
- package/dist/packages/transports/src/check.js.map +1 -0
- package/dist/packages/transports/src/cli.d.ts +1 -1
- package/dist/packages/transports/src/cli.js +278 -25
- package/dist/packages/transports/src/cli.js.map +1 -1
- package/dist/packages/transports/src/exit-codes.d.ts +8 -0
- package/dist/packages/transports/src/exit-codes.d.ts.map +1 -0
- package/dist/packages/transports/src/exit-codes.js +19 -0
- package/dist/packages/transports/src/exit-codes.js.map +1 -0
- package/dist/packages/transports/src/http.js +2 -2
- package/dist/packages/transports/src/http.js.map +1 -1
- package/dist/packages/transports/src/index.d.ts +5 -0
- package/dist/packages/transports/src/index.d.ts.map +1 -1
- package/dist/packages/transports/src/index.js +11 -6
- package/dist/packages/transports/src/index.js.map +1 -1
- package/dist/packages/transports/src/init.d.ts +32 -0
- package/dist/packages/transports/src/init.d.ts.map +1 -0
- package/dist/packages/transports/src/init.js +110 -0
- package/dist/packages/transports/src/init.js.map +1 -0
- package/dist/packages/transports/src/mcp-config.d.ts +27 -0
- package/dist/packages/transports/src/mcp-config.d.ts.map +1 -0
- package/dist/packages/transports/src/mcp-config.js +99 -0
- package/dist/packages/transports/src/mcp-config.js.map +1 -0
- package/dist/packages/transports/src/mcp.js +3 -3
- package/dist/packages/transports/src/paths.d.ts +9 -0
- package/dist/packages/transports/src/paths.d.ts.map +1 -0
- package/dist/packages/transports/src/paths.js +32 -0
- package/dist/packages/transports/src/paths.js.map +1 -0
- package/dist/packages/transports/src/receipt.d.ts +8 -0
- package/dist/packages/transports/src/receipt.d.ts.map +1 -0
- package/dist/packages/transports/src/receipt.js +87 -0
- package/dist/packages/transports/src/receipt.js.map +1 -0
- package/dist/packages/transports/src/resources.js +3 -3
- package/dist/packages/transports/src/resources.js.map +1 -1
- package/dist/packages/transports/src/tools.d.ts.map +1 -1
- package/dist/packages/transports/src/tools.js +284 -10
- package/dist/packages/transports/src/tools.js.map +1 -1
- package/dist/packages/verifier/src/index.js +7 -7
- package/dist/packages/verifier/src/lint.js +1 -1
- package/dist/packages/verifier/src/page.js +2 -2
- package/dist/packages/verifier/src/render-axe.js +1 -1
- package/dist/packages/verifier/src/verify.js +4 -4
- package/dist/scripts/build-site.d.ts +2 -0
- package/dist/scripts/build-site.d.ts.map +1 -0
- package/dist/scripts/build-site.js +254 -0
- package/dist/scripts/build-site.js.map +1 -0
- package/dist/scripts/calibration.js +33 -2
- package/dist/scripts/calibration.js.map +1 -1
- package/dist/scripts/fix-imports.js +32 -2
- package/dist/scripts/fix-imports.js.map +1 -1
- package/dist/scripts/generate-kb.d.ts +3 -0
- package/dist/scripts/generate-kb.d.ts.map +1 -0
- package/dist/scripts/generate-kb.js +195 -0
- package/dist/scripts/generate-kb.js.map +1 -0
- package/dist/scripts/generate-refusal-catalog.d.ts +3 -0
- package/dist/scripts/generate-refusal-catalog.d.ts.map +1 -0
- package/dist/scripts/generate-refusal-catalog.js +50 -0
- package/dist/scripts/generate-refusal-catalog.js.map +1 -0
- package/dist/scripts/generate-tool-docs.d.ts +3 -0
- package/dist/scripts/generate-tool-docs.d.ts.map +1 -0
- package/dist/scripts/generate-tool-docs.js +24 -0
- package/dist/scripts/generate-tool-docs.js.map +1 -0
- package/dist/scripts/mcp-config.js +28 -60
- package/dist/scripts/mcp-config.js.map +1 -1
- package/docs/archive/UI Gateway Final Project Roadmap.md +285 -0
- package/docs/benchmarks/external-repos.json +26 -0
- package/docs/benchmarks/local-gemma3-1b-stride32.json +455 -0
- package/docs/calibration.svg +44 -0
- package/docs/design-import.md +19 -0
- package/docs/design-md.md +109 -0
- package/docs/distribution.md +41 -0
- package/docs/engineering-principles.md +152 -0
- package/docs/layers-plan.md +372 -0
- package/docs/metrics.md +153 -0
- package/docs/modes.md +22 -0
- package/docs/parking-lot.md +25 -0
- package/docs/quickstart.md +72 -0
- package/docs/refusal-catalog.md +32 -0
- package/docs/spike-source-discovery.md +36 -0
- package/docs/telemetry.md +26 -0
- package/evals/fixtures/external-repos.json +55 -0
- package/evals/fixtures/kb-generated/angular.json +72 -0
- package/evals/fixtures/kb-generated/antd.json +72 -0
- package/evals/fixtures/kb-generated/bootstrap.json +72 -0
- package/evals/fixtures/kb-generated/chakra.json +14939 -0
- package/evals/fixtures/kb-generated/mantine.json +192 -0
- package/evals/fixtures/kb-generated/mui.json +8997 -0
- package/evals/fixtures/kb-generated/shadcn.json +192 -0
- package/evals/fixtures/kb-generated/solid.json +72 -0
- package/evals/fixtures/kb-generated/svelte.json +72 -0
- package/evals/fixtures/kb-generated/vue.json +72 -0
- package/evals/fixtures/projects/existing-chakra-v3/package.json +10 -0
- package/evals/fixtures/projects/existing-nuxt-ui/package.json +9 -0
- package/evals/fixtures/projects/existing-radix/package.json +9 -0
- package/evals/out/agent-report.json +190 -11
- package/evals/out/baseline-report.json +1441 -387
- package/evals/out/calibration.json +387 -42
- package/evals/out/external-repos-report.json +112 -0
- package/evals/out/local-benchmark-report.json +455 -0
- package/evals/src/agent-eval.test.ts +3 -0
- package/evals/src/agent-eval.ts +26 -4
- package/evals/src/baseline.ts +48 -7
- package/evals/src/blind-labeling-cli.ts +5 -0
- package/evals/src/blind-labeling.ts +46 -0
- package/evals/src/external-repos.ts +179 -0
- package/evals/src/metrics.ts +70 -0
- package/evals/src/mutations.ts +6 -6
- package/evals/src/page-a11y-eval.ts +37 -36
- package/evals/src/page-real-eval.ts +8 -7
- package/evals/src/plain-agent.test.ts +14 -0
- package/evals/src/plain-agent.ts +240 -0
- package/evals/src/run-agent-evals.ts +3 -0
- package/evals/src/run-external-repos.ts +43 -0
- package/evals/src/run-local-benchmark.ts +105 -0
- package/evals/src/run-plain-agent.ts +81 -0
- package/examples/README.md +32 -0
- package/examples/build-handoff.ts +106 -0
- package/examples/design-md.md +24 -0
- package/examples/handoff-input.json +59 -0
- package/examples/handoff.json +216 -0
- package/examples/layer-operations.json +18 -0
- package/examples/website-demo-handoff.json +580 -0
- package/package.json +29 -6
- package/references/design-md.md +3 -1
- package/references/errors.md +1 -1
- package/references/handoff.md +16 -1
- package/references/outcomes.md +60 -11
- package/references/patterns.md +3 -3
- package/references/tools.md +86 -27
- package/scripts/action-review.mjs +59 -0
- package/scripts/bench-latency.ts +90 -0
- package/scripts/build-site.ts +324 -0
- package/scripts/calibration.ts +50 -14
- package/scripts/fix-imports.ts +31 -2
- package/scripts/generate-kb.ts +214 -0
- package/scripts/generate-refusal-catalog.ts +58 -0
- package/scripts/generate-tool-docs.ts +31 -0
- package/scripts/mcp-config.ts +26 -83
- package/scripts/package-plugin.mjs +50 -0
- package/scripts/sbom.mjs +46 -0
- package/scripts/visual-diff.mjs +52 -0
- package/site/data.json +187 -0
- package/site/index.html +151 -0
- package/skills/ui-gateway-cli/SKILL.md +41 -0
- package/templates/next-shadcn/.github/workflows/ui-check.yml +14 -0
- package/templates/next-shadcn/.mcp.json +8 -0
- package/templates/next-shadcn/DESIGN.md +35 -0
- package/templates/next-shadcn/README.md +14 -0
- package/templates/next-shadcn/app/page.tsx +8 -0
- package/templates/next-shadcn/package.json +19 -0
- package/templates/vite-mantine/.github/workflows/ui-check.yml +14 -0
- package/templates/vite-mantine/.mcp.json +8 -0
- package/templates/vite-mantine/DESIGN.md +30 -0
- package/templates/vite-mantine/README.md +7 -0
- package/templates/vite-mantine/package.json +21 -0
- package/templates/vite-mantine/src/App.tsx +10 -0
- package/templates/vite-mui/.github/workflows/ui-check.yml +14 -0
- package/templates/vite-mui/.mcp.json +8 -0
- package/templates/vite-mui/DESIGN.md +30 -0
- package/templates/vite-mui/README.md +8 -0
- package/templates/vite-mui/package.json +22 -0
- package/templates/vite-mui/src/App.tsx +12 -0
- package/scripts/fetch-bundle-sizes.ts +0 -106
- package/scripts/test-bundlephobia.ts +0 -11
package/README.md
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
[](https://www.npmjs.com/package/ui-gateway)
|
|
2
2
|
[](https://www.npmjs.com/package/ui-gateway)
|
|
3
3
|
[](LICENSE)
|
|
4
|
-
[](https://nodejs.org/)
|
|
5
|
+
[](https://github.com/yuvraajnarula/uigateway/actions/workflows/ci.yml)
|
|
5
6
|
|
|
6
7
|
# UI Gateway
|
|
7
8
|
|
|
@@ -9,7 +10,7 @@ A library-agnostic, project-aware gateway that turns a design handoff into
|
|
|
9
10
|
**verified** UI component mappings. It fails closed: when it cannot answer
|
|
10
11
|
safely it returns a typed refusal that names what is missing.
|
|
11
12
|
|
|
12
|
-
- **
|
|
13
|
+
- **12 adapters, one conformance suite.** shadcn/ui, MUI, Chakra UI v2 and v3, Mantine, Nuxt UI, unified Radix, Vue, Svelte, Angular, SolidJS, Bootstrap and Ant Design. Every adapter implements the same interface and passes the same suite.
|
|
13
14
|
- **Project-aware.** Detects framework, styling systems, installed UI libraries,
|
|
14
15
|
local components and project skill files. Mode is `greenfield` or `existing`,
|
|
15
16
|
detected and overridable.
|
|
@@ -21,25 +22,58 @@ safely it returns a typed refusal that names what is missing.
|
|
|
21
22
|
- **Protocol with ownership.** Leases, a hash-chained append-only event log,
|
|
22
23
|
idempotency, and `RETURNED` as the only exit.
|
|
23
24
|
|
|
25
|
+
## Quality
|
|
26
|
+
|
|
27
|
+
- **CI:** typecheck, build, tests, coverage thresholds, docs examples, evals and
|
|
28
|
+
the end-to-end demo run on Linux, Windows and macOS; packed-install smoke tests
|
|
29
|
+
run on Node 20/22/24. See `.github/workflows/ci.yml`.
|
|
30
|
+
- **Coverage:** `npm run test:coverage` enforces floors (statements/lines 78%,
|
|
31
|
+
branches 74%, functions 76%); current coverage is ~79% statements.
|
|
32
|
+
- **Latency:** `npm run bench` reports handoff-to-result percentiles (p50/p90/p99).
|
|
33
|
+
- **Evals:** the pre-registered harness compares the gateway against a plain-agent
|
|
34
|
+
baseline. The only committed model-backed sample (a 6-item CPU run, `gemma3:1b`)
|
|
35
|
+
is directional, not a frontier result:
|
|
36
|
+
|
|
37
|
+
| Arm | Hit rate | Compiles | Constraints | Mean wall |
|
|
38
|
+
| --- | --- | --- | --- | --- |
|
|
39
|
+
| gateway full skill | 66.7% (30.0–90.3) | 100% (51.0–100) | 100% | 5.6 s |
|
|
40
|
+
| plain agent, no gateway | 0% | 16.7% | 83.3% | 24.3 s |
|
|
41
|
+
|
|
42
|
+
Intervals are Wilson 95%. See `BENCHMARK.md` for method and reproduction.
|
|
43
|
+
A key-backed frontier run at full stride is pending; `BENCHMARK.md` has the
|
|
44
|
+
exact steps and a table to fill from the committed JSON.
|
|
45
|
+
|
|
24
46
|
## Installation
|
|
25
47
|
|
|
26
48
|
```bash
|
|
27
49
|
npm install ui-gateway
|
|
28
50
|
```
|
|
29
51
|
|
|
30
|
-
Then
|
|
52
|
+
Then set up your target project with one command:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
npx ui-gateway init --project /absolute/path/to/your/app
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
`init` detects Claude Code, Cursor, VS Code, OpenCode or a generic MCP client,
|
|
59
|
+
writes/merges the client config, copies the skill into `.ui-gateway/skill`, and
|
|
60
|
+
prints project detection plus any `needs_input` questions. To print a config
|
|
61
|
+
without writing anything:
|
|
31
62
|
|
|
32
63
|
```bash
|
|
33
64
|
npx ui-gateway mcp:config --project /absolute/path/to/your/app
|
|
65
|
+
npx ui-gateway mcp:config --project /absolute/path/to/your/app --client cursor
|
|
34
66
|
```
|
|
35
67
|
|
|
36
|
-
|
|
37
|
-
project — it returns scaffolds, mappings, and typed refusals for you to apply.
|
|
68
|
+
Clients without MCP can use the CLI equivalent:
|
|
38
69
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
70
|
+
```bash
|
|
71
|
+
npx ui-gateway init --project /absolute/path/to/your/app --print-skill
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
The gateway never writes to your project — it returns scaffolds, mappings and
|
|
75
|
+
typed refusals for you to apply. See [NON-GOALS.md](./NON-GOALS.md) for
|
|
76
|
+
deliberate limits.
|
|
43
77
|
|
|
44
78
|
## Quick start
|
|
45
79
|
|
|
@@ -52,14 +86,18 @@ npm run eval # pre-registered eval harness (offline stand-in arms)
|
|
|
52
86
|
npm run eval:agent # build -> validate -> submit contract over the golden set
|
|
53
87
|
npm run eval:claude # real Claude three-arm run (requires ANTHROPIC_API_KEY)
|
|
54
88
|
npm run eval:groq # OpenAI-compatible/Groq run (requires GROQ_API_KEY)
|
|
89
|
+
npm run eval:local # real local Ollama benchmark + plain-agent arm
|
|
90
|
+
npm run eval:repos # pinned external repos; add -- --pins-only to resolve commits
|
|
91
|
+
npm run site # regenerate site/index.html from eval artifacts
|
|
55
92
|
npm run eval:site # Playwright site eval over the dashboard fixture
|
|
56
93
|
npm run eval:page # generated page shell: axe, keyboard, states, disclosure
|
|
57
94
|
npm run eval:page:real # actual MUI/Chakra/Mantine scaffolds and themes
|
|
58
|
-
npm run calibration # reliability curve -> docs/calibration.svg
|
|
95
|
+
npm run calibration # reliability curve -> docs/calibration.svg\nnpm run site # generated open-caveats status page -> site/index.html
|
|
59
96
|
```
|
|
60
97
|
|
|
61
|
-
Node
|
|
62
|
-
|
|
98
|
+
Node 20+ is required. The default in-memory event log has no native
|
|
99
|
+
dependencies. `--sqlite <file>` needs Node 22.5+ because it uses `node:sqlite`,
|
|
100
|
+
and fails with an explicit message on older Node.
|
|
63
101
|
|
|
64
102
|
## Agent skill
|
|
65
103
|
|
|
@@ -79,26 +117,28 @@ references and examples:
|
|
|
79
117
|
| `examples/handoff-input.json` | Builder input for regenerating the example handoff. |
|
|
80
118
|
| `examples/handoff.json` | Complete, hash-pinned example handoff. |
|
|
81
119
|
|
|
82
|
-
The skill expects the MCP server. Print a ready-to-paste config
|
|
83
|
-
repository:
|
|
120
|
+
The skill expects the MCP server. Print a ready-to-paste config:
|
|
84
121
|
|
|
85
122
|
```bash
|
|
86
|
-
|
|
87
|
-
|
|
123
|
+
npx ui-gateway mcp:config --project /absolute/path/to/your/app
|
|
124
|
+
npx ui-gateway mcp:config --project /absolute/path/to/your/app --client opencode
|
|
88
125
|
```
|
|
89
126
|
|
|
90
|
-
The first form prints a generic `mcpServers` config;
|
|
91
|
-
|
|
92
|
-
repository.
|
|
127
|
+
The first form prints a generic `mcpServers` config; `--client` also accepts
|
|
128
|
+
`claude`, `cursor` and `vscode`. `--project` is the application the agent edits,
|
|
129
|
+
not this repository. `npx ui-gateway init` writes the config for you.
|
|
93
130
|
|
|
94
131
|
## MCP
|
|
95
132
|
|
|
96
|
-
The MCP server exposes
|
|
133
|
+
The MCP server exposes 14 tools over stdio:
|
|
97
134
|
|
|
98
135
|
- `detect_project` — profile, provenance, confidence, `needs_input`.
|
|
99
136
|
- `describe_kb` — supported libraries, entries, `kb_version`.
|
|
100
137
|
- `hash_design_md` — normalized Design MD hash.
|
|
138
|
+
- `import_design_md` — read and validate a Design MD file from disk.
|
|
139
|
+
- `import_design_tokens` — convert DTCG JSON into Design MD tokens.
|
|
101
140
|
- `validate_design_md` — grammar, normalizations, policy, satisfiability.
|
|
141
|
+
- `derive_design_md` — infer a valid Design MD from the project's tokens.
|
|
102
142
|
- `build_handoff` — generates the wireframe, pins the profile/hash and returns a
|
|
103
143
|
validation report.
|
|
104
144
|
- `validate_handoff` — the gateway's pre-flight checks plus a strict semantic
|
|
@@ -106,11 +146,32 @@ The MCP server exposes nine tools over stdio:
|
|
|
106
146
|
satisfiability.
|
|
107
147
|
- `submit_handoff` — returns the result, `state` and `ownership_returned`,
|
|
108
148
|
plus `page_plan`, `page`, `token_projection` and `warnings` when present.
|
|
149
|
+
- `map_ui` — two-call happy path: detect/derive, build, validate and submit.
|
|
109
150
|
- `verify_page` — read-only page check for anchors, ids, unused imports, basic
|
|
110
151
|
a11y, the main landmark, duplicate display utilities and responsive
|
|
111
152
|
breakpoint conflicts; can optionally compile the page and its related
|
|
112
153
|
scaffolds in a throwaway TypeScript project.
|
|
113
154
|
- `get_handoff` — state, ownership, lease and result from the event log.
|
|
155
|
+
- `refusal_ledger` — repeated refusal reasons and suggested fixes.
|
|
156
|
+
|
|
157
|
+
<!-- TOOLS:START -->
|
|
158
|
+
| Tool | Purpose |
|
|
159
|
+
| --- | --- |
|
|
160
|
+
| `detect_project` | Detect the UI profile of a project: framework, styling, libraries, local components and project skill files. |
|
|
161
|
+
| `describe_kb` | List supported libraries, licenses, availability and component entries. |
|
|
162
|
+
| `hash_design_md` | Compute the Design MD sha256 after the gateway's deterministic normalization. |
|
|
163
|
+
| `import_design_md` | Read a Design MD file from the project filesystem, validate it against the strict grammar, and return its normalized content, hash and validation report. |
|
|
164
|
+
| `import_design_tokens` | Read a DTCG (Design Tokens Community Group) JSON file and convert its tokens into Design MD token entries. |
|
|
165
|
+
| `validate_design_md` | Validate a Design MD against the strict grammar and the project profile. |
|
|
166
|
+
| `build_handoff` | Build a complete, hash-pinned handoff from a Design MD and intents. |
|
|
167
|
+
| `validate_handoff` | Run the gateway's pre-flight checks plus a strict semantic gate: schema, supported schema version, design hash, Design MD compilation, semantics, satisfiability, profile hash, KB freshness and adapter support. |
|
|
168
|
+
| `submit_handoff` | Submit a validated handoff and receive verified component mappings. |
|
|
169
|
+
| `verify_page` | Read-only page check: syntax, broken or dead anchors, missing page_plan region ids, duplicate ids, unused imports, missing img alt, unlabeled links/buttons and the main landmark. |
|
|
170
|
+
| `derive_design_md` | Infer a strict Design MD from the project's CSS variables, Tailwind config, DTCG token files and an existing DESIGN.md. |
|
|
171
|
+
| `map_ui` | Two-call happy path. |
|
|
172
|
+
| `refusal_ledger` | Summarize repeated refusals from the event log (missing information, ambiguity, unsatisfiable constraints) and suggest fixes. |
|
|
173
|
+
| `get_handoff` | Read a handoff's state, ownership and result from the event log. |
|
|
174
|
+
<!-- TOOLS:END -->
|
|
114
175
|
|
|
115
176
|
It also serves the references and examples as MCP resources
|
|
116
177
|
(`ui-gateway://reference/handoff`, `ui-gateway://example/handoff`, and so on).
|
|
@@ -131,20 +192,36 @@ gateway expects.
|
|
|
131
192
|
## CLI
|
|
132
193
|
|
|
133
194
|
```bash
|
|
195
|
+
npm run cli -- init evals/fixtures/projects/existing-mui --dry-run
|
|
134
196
|
npm run cli -- detect evals/fixtures/projects/existing-mui
|
|
135
197
|
npm run cli -- kb --library shadcn
|
|
136
198
|
npm run cli -- validate examples/handoff.json
|
|
137
199
|
npm run cli -- validate-design examples/design-md.md
|
|
138
200
|
npm run cli -- build-handoff examples/handoff-input.json --out examples/handoff.json
|
|
139
201
|
npm run cli -- submit examples/handoff.json --project evals/fixtures/projects/greenfield-react
|
|
202
|
+
npm run cli -- submit examples/handoff.json --out .tmp/response.json # echoes "wrote <path>" on stderr
|
|
203
|
+
npm run cli -- preview .tmp/response.json --out .tmp/preview.html
|
|
140
204
|
npm run cli -- submit examples/handoff.json --sqlite .tmp/events.sqlite
|
|
141
205
|
npm run cli -- status <handoff_id> --sqlite .tmp/events.sqlite
|
|
142
206
|
npm run cli -- label evals/fixtures/labels.jsonl
|
|
143
207
|
```
|
|
144
208
|
|
|
145
|
-
`submit` prints the full `SubmitResponse` JSON
|
|
146
|
-
|
|
147
|
-
|
|
209
|
+
`submit` prints the full `SubmitResponse` JSON; `--out` writes it to a file and
|
|
210
|
+
confirms the path on stderr, so stdout stays JSON. Exit codes follow the outcome
|
|
211
|
+
(0 `COMPLETED`, 1 `REJECTED`, 3 `NEEDS_INPUT`, …) — see `references/outcomes.md`.
|
|
212
|
+
`build-handoff` reads a `HandoffInput` JSON file and writes or prints the complete
|
|
213
|
+
handoff. `preview` renders a result as standalone, dependency-free HTML.
|
|
214
|
+
`check` prints JSON by default; add `--text` for the one-line-per-finding list.
|
|
215
|
+
`kb-freshness <library> --current <version>` fetches the npm registry and any
|
|
216
|
+
`--docs <url>` pages and prints drift proposals with citations and a 0–1
|
|
217
|
+
confidence score; it never edits the KB or opens a PR. Documentation URLs must
|
|
218
|
+
be on the library's official host (from its `source_url`, plus any
|
|
219
|
+
`--official <host>`), and non-official URLs are rejected rather than cited.
|
|
220
|
+
|
|
221
|
+
Every KB library records the version line its entries were verified against
|
|
222
|
+
(`describe_kb` → `libraries[].library_version`, entries and mappings carry the
|
|
223
|
+
same field). Generated scaffolds start with `// library@line`, so a scaffold is
|
|
224
|
+
never silently reused across majors.
|
|
148
225
|
|
|
149
226
|
## HTTP transport
|
|
150
227
|
|
|
@@ -186,10 +263,19 @@ project — it returns scaffolds, mappings, and typed refusals for you to apply.
|
|
|
186
263
|
|
|
187
264
|
### Releasing
|
|
188
265
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
266
|
+
Versioning and the changelog are managed by
|
|
267
|
+
[Changesets](https://github.com/changesets/changesets). Maintainers merge the
|
|
268
|
+
automated **Version Packages** pull request, then push a `vX.Y.Z` tag; the
|
|
269
|
+
`release` workflow publishes to npm with provenance and uploads the SBOM. See
|
|
270
|
+
`CONTRIBUTING.md`.
|
|
271
|
+
|
|
272
|
+
## Maintainers
|
|
273
|
+
|
|
274
|
+
- [@yuvraajnarula](https://github.com/yuvraajnarula)
|
|
275
|
+
|
|
276
|
+
Maintainers are the default owners in [`.github/CODEOWNERS`](./.github/CODEOWNERS).
|
|
277
|
+
Want to help maintain the project? See the "Becoming a maintainer" section in
|
|
278
|
+
[`CONTRIBUTING.md`](./CONTRIBUTING.md).
|
|
193
279
|
|
|
194
280
|
The repo is MIT licensed. See `LICENSE` for details.
|
|
195
281
|
|
|
@@ -249,7 +335,7 @@ Error codes (retryable in brackets): `INVALID_HANDOFF`, `INTEGRITY_MISMATCH`
|
|
|
249
335
|
| `@uigw/design-md` | strict Design MD parser, normalizer, constraint compiler, satisfiability |
|
|
250
336
|
| `@uigw/profile` | project detector with provenance/confidence, local component derivation, skill capture, conflicts |
|
|
251
337
|
| `@uigw/kb` | three-layer knowledge base, provenance tiers, ingest quarantine, staleness, drift |
|
|
252
|
-
| `@uigw/adapters` | adapter interface, shadcn, MUI, Chakra v2, Mantine, Vue, Svelte, Angular, SolidJS, Bootstrap, Ant Design, local-components adapter, conformance suite |
|
|
338
|
+
| `@uigw/adapters` | adapter interface, shadcn, MUI, Chakra v2/v3, Mantine, Nuxt UI, Radix, Vue, Svelte, Angular, SolidJS, Bootstrap, Ant Design, local-components adapter, conformance suite |
|
|
253
339
|
| `@uigw/matcher` | filter, rank, closed-ID selection, code-written scaffolds |
|
|
254
340
|
| `@uigw/verifier` | TSX AST checks, design lint, coverage, optional tsc sandbox |
|
|
255
341
|
| `@uigw/gateway` | wiring, leases, retries, acceptance, validation report, result assembly |
|
|
@@ -304,9 +390,11 @@ const handoff = buildHandoff({
|
|
|
304
390
|
});
|
|
305
391
|
|
|
306
392
|
const response = await gateway.submit(handoff);
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
393
|
+
// `ok` is true only for COMPLETED; every other outcome still carries a result.
|
|
394
|
+
console.log(
|
|
395
|
+
response.outcome,
|
|
396
|
+
response.result?.intents.map((intent) => intent.mappings[0]?.component_id),
|
|
397
|
+
);
|
|
310
398
|
```
|
|
311
399
|
|
|
312
400
|
## Evaluations
|
|
@@ -315,9 +403,17 @@ if (response.ok) {
|
|
|
315
403
|
- `npm run eval:agent` runs the exact agent path (`build_handoff` ->
|
|
316
404
|
`validate_handoff` -> `submit_handoff`) and writes
|
|
317
405
|
`evals/out/agent-report.json`. It fails if any item cannot be built, validated
|
|
318
|
-
or submitted, or if the positive mapped rate drops below 70%.
|
|
406
|
+
or submitted, or if the positive mapped rate drops below 70%. It also reports
|
|
407
|
+
rounds (`tool_calls_total`, `tool_calls_per_item`, `max_tool_calls`) so a
|
|
408
|
+
contract change that adds retries is visible.
|
|
319
409
|
- `npm run eval:claude` runs the real Claude arms (`ANTHROPIC_API_KEY`).
|
|
320
410
|
- `npm run eval:groq` runs the OpenAI-compatible/Groq arms (`GROQ_API_KEY`).
|
|
411
|
+
- `npm run eval:local` runs the gateway and plain-agent arms against Ollama
|
|
412
|
+
(`UIGW_LOCAL_MODEL`; results are local-model results, not frontier numbers).
|
|
413
|
+
- `npm run eval:repos -- --pins-only` resolves every external fixture commit
|
|
414
|
+
with `git ls-remote`; `npm run eval:repos` shallow-clones and detects them.
|
|
415
|
+
- `npm run site` writes `site/index.html`, a generated status page for the open
|
|
416
|
+
caveats, benchmark numbers, adapters and external pins.
|
|
321
417
|
- `npm run eval:site` serves the dashboard fixture and drives it in installed
|
|
322
418
|
Chrome with `playwright-core`; it checks anchors, search/empty state, row
|
|
323
419
|
detail, mobile navigation and console errors. It is not part of `npm test`.
|
|
@@ -358,15 +454,14 @@ if (response.ok) {
|
|
|
358
454
|
offline evals also include simulated behaviors; see `docs/metrics.md`.
|
|
359
455
|
- The `tsc` sandbox stubs library types. It catches syntax and local type
|
|
360
456
|
errors; prop correctness comes from the KB AST check.
|
|
361
|
-
- Local component derivation handles exported function and arrow components
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
current KB/scaffold contract does not model; v3 support is parked.
|
|
457
|
+
- Local component derivation handles exported function and arrow components,
|
|
458
|
+
class components, and re-exported library components.
|
|
459
|
+
- v1 supports React-family frameworks (shadcn, MUI, Chakra v2/v3, Mantine,
|
|
460
|
+
unified Radix), Vue, Svelte, Angular, SolidJS, Bootstrap and Ant Design.
|
|
461
|
+
- The Chakra adapter is version-aware: v2 projects receive flat exports, v3
|
|
462
|
+
projects receive dotted namespaces (`Table.Root`, `Dialog.Root`). Nuxt UI and
|
|
463
|
+
Radix output is a component sketch; Nuxt UI does not yet emit a compiled Vue
|
|
464
|
+
SFC, and both adapters remain experimental until labeled eval data exists.
|
|
370
465
|
- The golden set meets the Phase 6 count gate (124 dev + 48 test) across five
|
|
371
466
|
fixtures — greenfield, existing-shadcn, existing-MUI, existing-Chakra and
|
|
372
467
|
existing-Mantine — so every shipping adapter has labeled positives. Its labels are
|
package/SECURITY.md
CHANGED
|
@@ -8,11 +8,13 @@
|
|
|
8
8
|
|
|
9
9
|
## Reporting a Vulnerability
|
|
10
10
|
|
|
11
|
-
Please report security vulnerabilities to
|
|
11
|
+
Please report security vulnerabilities to ynarula678@gmail.com.
|
|
12
12
|
|
|
13
13
|
Do not open a public GitHub issue for security concerns. We will acknowledge
|
|
14
14
|
your report within 48 hours and provide an initial assessment within 7 days.
|
|
15
15
|
|
|
16
|
+
Maintainers are listed in [`.github/CODEOWNERS`](./.github/CODEOWNERS).
|
|
17
|
+
|
|
16
18
|
## Security Practices
|
|
17
19
|
|
|
18
20
|
- UI Gateway never writes files to your project, installs packages or opens pull requests.
|
|
@@ -25,6 +27,25 @@ your report within 48 hours and provide an initial assessment within 7 days.
|
|
|
25
27
|
- The `tsc` compile sandbox runs in the OS temp directory, never inside the repo,
|
|
26
28
|
and stubs all library modules so untrusted code cannot resolve installed packages.
|
|
27
29
|
|
|
30
|
+
## Threat model
|
|
31
|
+
|
|
32
|
+
| Asset | Threat | Control |
|
|
33
|
+
| --- | --- | --- |
|
|
34
|
+
| Design MD constraints | prompt injection in prose or project skill files | Design MD is parsed by a strict grammar; free text is data, never instructions. `injection.test.ts` asserts hostile `AGENTS.md`/`SKILL.md` text cannot change mappings, scaffolds or confidence. |
|
|
35
|
+
| Generated code | a model invents imports/props/components | closed-ID selection, AST checks, adapter conformance, throwaway `tsc` sandbox |
|
|
36
|
+
| Host project | generated code escapes the sandbox or reads host `node_modules` | sandbox lives in the OS temp dir, stubs every bare module, `types: []`; real types are copied from a pinned source only when explicitly requested |
|
|
37
|
+
| KB integrity | stale or tampered manifests | schema validation, provenance tiers, quarantine, freshness pins, hash chain in the event log |
|
|
38
|
+
| Event log | tampering or replay | hash-chained append-only events, idempotency by content hash, lease ownership |
|
|
39
|
+
| Release supply chain | compromised dependency or build | `npm publish --provenance`, generated SBOM, CI checks on the packed tarball across Node 20/22/24 |
|
|
40
|
+
| Untrusted Figma/text input | injected instructions become code | deterministic layer-to-intent mapping; text is escaped into descriptions; generated code still passes the verifier |
|
|
41
|
+
| Oversized request body | memory exhaustion during validation (DoS) | the HTTP transport caps request bodies (`maxBodyBytes`, default 5 MiB) and returns `413` |
|
|
42
|
+
|
|
43
|
+
## Accepted risks
|
|
44
|
+
|
|
45
|
+
| Advisory | Status | Mitigation / plan |
|
|
46
|
+
| --- | --- | --- |
|
|
47
|
+
| GHSA-mrhx-c7xc-m3w5 (zod memory exhaustion on oversized constrained collections) | Accepted for 0.1.x | The HTTP transport caps body size (default 5 MiB). The fix is `zod@4` (a major with breaking schema changes); migration is tracked separately and automated by Renovate. `npm audit` runs report-only in CI until then. |
|
|
48
|
+
|
|
28
49
|
## Disclosure Policy
|
|
29
50
|
|
|
30
51
|
We follow coordinated disclosure. Once a fix is ready, we will:
|
package/SKILL.md
CHANGED
|
@@ -36,7 +36,24 @@ libraries, and obey explicit design constraints.
|
|
|
36
36
|
Read `references/tools.md` for the tool contract and
|
|
37
37
|
`references/handoff.md` before building your first handoff.
|
|
38
38
|
|
|
39
|
-
##
|
|
39
|
+
## Fast path (two calls)
|
|
40
|
+
|
|
41
|
+
For a normal task, use `map_ui` and skip the granular flow:
|
|
42
|
+
|
|
43
|
+
```text
|
|
44
|
+
map_ui({ intents, path: "." })
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
`map_ui` detects the project, derives a Design MD when none is supplied,
|
|
48
|
+
builds and validates the handoff, submits it, and returns the mappings plus
|
|
49
|
+
scaffolds. It defaults to `submit`; use `mode: "lookup"` when the user only
|
|
50
|
+
asks "which component should I use?" (no lease or event-log write). If the
|
|
51
|
+
same intent keeps being refused, call `refusal_ledger` to group the reasons and
|
|
52
|
+
suggest a local component or a Design MD change. Only fall
|
|
53
|
+
back to the granular workflow below when you need to inspect or edit the
|
|
54
|
+
handoff, the Design MD, or the KB.
|
|
55
|
+
|
|
56
|
+
## Workflow (granular)
|
|
40
57
|
|
|
41
58
|
1. **Detect.** Call `detect_project`. Use `"."` for the target project.
|
|
42
59
|
- Read `profile.framework`, `profile.styling`, `profile.libraries` and
|
|
@@ -52,9 +69,12 @@ Read `references/tools.md` for the tool contract and
|
|
|
52
69
|
- Use only component ids returned here or by `preferred_components`.
|
|
53
70
|
- Supported libraries are dynamic; do not assume shadcn.
|
|
54
71
|
|
|
55
|
-
3. **
|
|
56
|
-
|
|
57
|
-
|
|
72
|
+
3. **Get the Design MD.** Call `derive_design_md` first. It reads CSS
|
|
73
|
+
variables, Tailwind config, DTCG token files and an existing `DESIGN.md`,
|
|
74
|
+
and validates the result. If it returns `questions`, ask the user only those
|
|
75
|
+
(defaulted brand tokens, unresolved constraints) instead of authoring a full
|
|
76
|
+
Design MD. Only edit it when the user needs a constraint it could not infer.
|
|
77
|
+
The strict grammar is in `references/design-md.md`.
|
|
58
78
|
- If the Design MD already exists as a file in the project, call
|
|
59
79
|
`import_design_md` with its path to read and validate it; the returned
|
|
60
80
|
`design_md` and `hash` are pinned for `build_handoff`.
|
|
@@ -99,6 +119,9 @@ Read `references/tools.md` for the tool contract and
|
|
|
99
119
|
`PARTIAL`.
|
|
100
120
|
- Preserve the scaffold's imports, component names, props, variants and
|
|
101
121
|
`data-element` attributes. Formatting-only changes are fine.
|
|
122
|
+
- Keep the scaffold's `library_version` header: a scaffold verified against
|
|
123
|
+
one major line (for example MUI 6.x) must not be reused on another. If the
|
|
124
|
+
project is on a different major, re-detect and rebuild.
|
|
102
125
|
- The gateway never writes files; you do.
|
|
103
126
|
- If `dependency_changes` contains `requires_approval: true`, ask before
|
|
104
127
|
installing anything.
|
|
@@ -120,9 +143,10 @@ Read `references/tools.md` for the tool contract and
|
|
|
120
143
|
imported from; if no prefix is supplied the gateway infers one from the
|
|
121
144
|
project's `tsconfig.json` `paths` (first `@/*`, then `~/`, then the first
|
|
122
145
|
non-relative alias).
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
146
|
+
- Call `verify_page` on the page source (pass the intent scaffolds as
|
|
147
|
+
`files` and the same `page_plan`). Fix broken anchors, missing ids,
|
|
148
|
+
unused imports, missing accessible names and any `MISSING_STATE`
|
|
149
|
+
(declared required states that are not wired) before claiming done. A
|
|
126
150
|
`COMPILE_ERROR` whose message says `tsc timed out in the compile sandbox`
|
|
127
151
|
is a slow sandbox, not a code defect: retry once, then report the exact
|
|
128
152
|
message instead of rewriting the page.
|
|
@@ -141,19 +165,27 @@ Read `references/tools.md` for the tool contract and
|
|
|
141
165
|
| `FAILED` | Write nothing. Report the error code and details. |
|
|
142
166
|
| `EXPIRED` | Check `get_handoff`; rebuild with a fresh deadline only if the user still wants it. |
|
|
143
167
|
|
|
144
|
-
`submit_handoff`
|
|
145
|
-
|
|
146
|
-
|
|
168
|
+
`submit_handoff` sets `ok: true` only when `outcome` is `COMPLETED`. Every other
|
|
169
|
+
outcome returns `ok: false`, a single `blocking` object (`kind`, `code`,
|
|
170
|
+
`message`, `retryable`, `fix`) and usually the result, so read `blocking.code`
|
|
171
|
+
and `blocking.fix` before the rest of the result. `REJECTED` means pre-flight
|
|
172
|
+
validation
|
|
173
|
+
failed and there is no result; report the typed error.
|
|
174
|
+
|
|
175
|
+
In page mode, `result.page.verification` is the gateway's own check of the page
|
|
176
|
+
it composed. If any of those checks fail the outcome is `PARTIAL`, and
|
|
177
|
+
`verification.issues` names the problem (for example a nav target that matches
|
|
178
|
+
no id). Fix the plan or ask; do not write a page that failed its checks.
|
|
147
179
|
|
|
148
180
|
## Error and retry policy
|
|
149
181
|
|
|
150
182
|
- `INVALID_HANDOFF`, `UNSATISFIABLE_CONSTRAINTS`, `UNSUPPORTED`, `CONFLICT`,
|
|
151
|
-
`RESULT_REJECTED`: deterministic. Fix the payload or ask
|
|
152
|
-
resubmit unchanged.
|
|
183
|
+
`INTEGRITY_MISMATCH`, `RESULT_REJECTED`: deterministic. Fix the payload or ask
|
|
184
|
+
the user; never resubmit unchanged. `INTEGRITY_MISMATCH` means re-detect and
|
|
185
|
+
rebuild — the same bytes will fail the same way.
|
|
153
186
|
- `KB_STALE`: call `describe_kb`, update `kb_version`, rebuild, resubmit once.
|
|
154
187
|
- `LEASE_EXPIRED` / `LEASE_CONFLICT`: call `get_handoff`; wait for the lease,
|
|
155
188
|
do not submit in parallel.
|
|
156
|
-
- `INTEGRITY_MISMATCH`: re-detect, rebuild, resubmit once. If it persists, stop.
|
|
157
189
|
- Validation errors: at most two repair attempts. Then report the exact report
|
|
158
190
|
and ask.
|
|
159
191
|
|
|
@@ -202,7 +234,29 @@ Files:
|
|
|
202
234
|
```
|
|
203
235
|
|
|
204
236
|
For `PARTIAL` / `NEEDS_INPUT` / `AMBIGUOUS` / `FAILED`, list what was not
|
|
205
|
-
applied and ask the exact questions. Do not dump the full gateway JSON.
|
|
237
|
+
applied and ask the exact questions. Do not dump the full gateway JSON. Read
|
|
238
|
+
`blocking.fix` first — it names the concrete next step. For a shareable report,
|
|
239
|
+
`ui-gateway receipt <result.json>` renders the outcome, the blocking cause and
|
|
240
|
+
fix, the closest rejected candidates and confidence as standalone HTML.
|
|
241
|
+
|
|
242
|
+
Non-COMPLETED shape (fill from the result; never invent fields):
|
|
243
|
+
|
|
244
|
+
```markdown
|
|
245
|
+
## UI Gateway result
|
|
246
|
+
|
|
247
|
+
Outcome: PARTIAL (2/3 mapped, acceptance failed)
|
|
248
|
+
|
|
249
|
+
Applied:
|
|
250
|
+
- `submit-order` -> shadcn `Button` (verification: passed)
|
|
251
|
+
|
|
252
|
+
Not applied:
|
|
253
|
+
- `orders-table` — no candidate passed verification (closest: shadcn/Table, role overlap). Fix: add a local `OrdersTable` or relax the constraint.
|
|
254
|
+
|
|
255
|
+
Blocking: acceptance / ACCEPTANCE_FAILED — acceptance criteria failed: all_intents_mapped. Do next: satisfy the failed criteria, or change acceptance_criteria if the criteria are wrong.
|
|
256
|
+
|
|
257
|
+
Checks:
|
|
258
|
+
- `all_intents_mapped`: failed
|
|
259
|
+
```
|
|
206
260
|
|
|
207
261
|
## References
|
|
208
262
|
|
|
@@ -217,13 +271,13 @@ applied and ask the exact questions. Do not dump the full gateway JSON.
|
|
|
217
271
|
- `references/tools.md` — tool order, inputs, resources and MCP setup.
|
|
218
272
|
- `examples/design-md.md`, `examples/handoff.json` — complete examples.
|
|
219
273
|
|
|
220
|
-
##
|
|
274
|
+
## Before reporting done
|
|
221
275
|
|
|
222
|
-
|
|
276
|
+
After writing the files, verify:
|
|
223
277
|
|
|
224
278
|
- Every navigation item has a target (href/route).
|
|
225
279
|
- Every button/link does something (action or navigation).
|
|
226
|
-
- Empty, loading, and error states exist.
|
|
280
|
+
- Empty, loading, and error states exist and `verify_page`'s `states` check passes.
|
|
227
281
|
- Keyboard and mobile paths work.
|
|
228
282
|
- No hidden-only labels.
|
|
229
283
|
- Typecheck, lint, and browser smoke test pass.
|
package/action.yml
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
name: "UI Gateway Check"
|
|
2
|
+
description: "Check changed UI files against a Design MD: forbidden libraries/patterns, anchors, a11y and compile errors."
|
|
3
|
+
author: "ui-gateway"
|
|
4
|
+
branding:
|
|
5
|
+
icon: "check-circle"
|
|
6
|
+
color: "blue"
|
|
7
|
+
|
|
8
|
+
inputs:
|
|
9
|
+
project:
|
|
10
|
+
description: "Project directory to resolve paths and the Design MD against."
|
|
11
|
+
required: false
|
|
12
|
+
default: "."
|
|
13
|
+
files:
|
|
14
|
+
description: "Space-separated files or directories. Defaults to files changed in the PR/push."
|
|
15
|
+
required: false
|
|
16
|
+
default: ""
|
|
17
|
+
design-md:
|
|
18
|
+
description: "Path to the Design MD. Defaults to DESIGN.md/design.md/docs/DESIGN.md."
|
|
19
|
+
required: false
|
|
20
|
+
default: ""
|
|
21
|
+
version:
|
|
22
|
+
description: "ui-gateway version to run from npm."
|
|
23
|
+
required: false
|
|
24
|
+
default: "latest"
|
|
25
|
+
compile:
|
|
26
|
+
description: "Run the throwaway TypeScript compile sandbox."
|
|
27
|
+
required: false
|
|
28
|
+
default: "false"
|
|
29
|
+
post-comments:
|
|
30
|
+
description: "Post inline PR review comments for findings."
|
|
31
|
+
required: false
|
|
32
|
+
default: "true"
|
|
33
|
+
|
|
34
|
+
outputs:
|
|
35
|
+
report:
|
|
36
|
+
description: "Path to the JSON check report."
|
|
37
|
+
value: ${{ steps.check.outputs.report }}
|
|
38
|
+
|
|
39
|
+
runs:
|
|
40
|
+
using: "composite"
|
|
41
|
+
steps:
|
|
42
|
+
- name: Resolve changed files
|
|
43
|
+
id: files
|
|
44
|
+
shell: bash
|
|
45
|
+
run: |
|
|
46
|
+
set -euo pipefail
|
|
47
|
+
if [ -n "${{ inputs.files }}" ]; then
|
|
48
|
+
echo "files=${{ inputs.files }}" >> "$GITHUB_OUTPUT"
|
|
49
|
+
exit 0
|
|
50
|
+
fi
|
|
51
|
+
if [ "${{ github.event_name }}" = "pull_request" ]; then
|
|
52
|
+
base="${{ github.event.pull_request.base.sha }}"
|
|
53
|
+
elif [ "${{ github.event.before }}" != "0000000000000000000000000000000000000000" ]; then
|
|
54
|
+
base="${{ github.event.before }}"
|
|
55
|
+
else
|
|
56
|
+
base="HEAD~1"
|
|
57
|
+
fi
|
|
58
|
+
changed=$(git diff --name-only --diff-filter=ACMR "$base"...HEAD -- '*.tsx' '*.jsx' '*.ts' '*.js' '*.vue' '*.svelte' | tr '\n' ' ')
|
|
59
|
+
echo "files=$changed" >> "$GITHUB_OUTPUT"
|
|
60
|
+
|
|
61
|
+
- name: Run check
|
|
62
|
+
id: check
|
|
63
|
+
shell: bash
|
|
64
|
+
run: |
|
|
65
|
+
set -uo pipefail
|
|
66
|
+
report="$RUNNER_TEMP/ui-gateway-report.json"
|
|
67
|
+
echo "report=$report" >> "$GITHUB_OUTPUT"
|
|
68
|
+
files="${{ steps.files.outputs.files }}"
|
|
69
|
+
if [ -z "${files// /}" ]; then
|
|
70
|
+
echo "No UI source files changed; nothing to check."
|
|
71
|
+
printf '{"ok":true,"checked":[],"findings":[],"summary":{"errors":0,"warnings":0},"design_path":null}\n' > "$report"
|
|
72
|
+
exit 0
|
|
73
|
+
fi
|
|
74
|
+
args=(check $files --project "${{ inputs.project }}" --json)
|
|
75
|
+
if [ -n "${{ inputs.design-md }}" ]; then args+=(--design "${{ inputs.design-md }}"); fi
|
|
76
|
+
if [ "${{ inputs.compile }}" = "true" ]; then args+=(--compile); fi
|
|
77
|
+
npx --yes "ui-gateway@${{ inputs.version }}" "${args[@]}" > "$report" || true
|
|
78
|
+
cat "$report"
|
|
79
|
+
|
|
80
|
+
- name: Post inline review comments
|
|
81
|
+
if: ${{ inputs.post-comments == 'true' && github.event_name == 'pull_request' }}
|
|
82
|
+
shell: bash
|
|
83
|
+
env:
|
|
84
|
+
GITHUB_TOKEN: ${{ github.token }}
|
|
85
|
+
run: node "${{ github.action_path }}/scripts/action-review.mjs" "$RUNNER_TEMP/ui-gateway-report.json"
|
|
86
|
+
|
|
87
|
+
- name: Fail on hard findings
|
|
88
|
+
shell: bash
|
|
89
|
+
run: |
|
|
90
|
+
node -e "const r=require(process.argv[1]); if(!r.ok) process.exit(1)" "$RUNNER_TEMP/ui-gateway-report.json"
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { type ConfidenceSignals } from "@uigw/protocol";
|
|
1
2
|
import { type ModelCall, type SelectionModel } from "@uigw/matcher";
|
|
2
3
|
import { coverageMatrix, type GoldenSet } from "./golden";
|
|
3
|
-
import { checkThresholds, type CalibrationReport, type MetricsReport, type Thresholds } from "./metrics";
|
|
4
|
+
import { checkThresholds, type CalibrationReport, type MetricsReport, type TaskOutcomeReport, type Thresholds } from "./metrics";
|
|
4
5
|
import { type LocalLlmOptions, type OpenAiCompatibleOptions, type SimulatedBehaviorName } from "./local-llm";
|
|
5
6
|
export interface ArmReport {
|
|
6
7
|
name: string;
|
|
@@ -11,6 +12,7 @@ export interface ArmReport {
|
|
|
11
12
|
predicted: string[];
|
|
12
13
|
acceptable: string[];
|
|
13
14
|
confidence: number;
|
|
15
|
+
signals?: ConfidenceSignals;
|
|
14
16
|
}>;
|
|
15
17
|
}
|
|
16
18
|
export interface BaselineModelInfo {
|
|
@@ -36,6 +38,7 @@ export interface BaselineReport {
|
|
|
36
38
|
threshold_checks: ReturnType<typeof checkThresholds>;
|
|
37
39
|
thresholds_passed: boolean;
|
|
38
40
|
calibration: CalibrationReport;
|
|
41
|
+
task_outcomes: TaskOutcomeReport;
|
|
39
42
|
model_info: BaselineModelInfo | null;
|
|
40
43
|
n_sample_agreement: NSampleAgreementReport | null;
|
|
41
44
|
notes: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"baseline.d.ts","sourceRoot":"","sources":["../../../evals/src/baseline.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"baseline.d.ts","sourceRoot":"","sources":["../../../evals/src/baseline.ts"],"names":[],"mappings":"AAMA,OAAO,EAAuB,KAAK,iBAAiB,EAAmC,MAAM,gBAAgB,CAAC;AAE9G,OAAO,EAEL,KAAK,SAAS,EACd,KAAK,cAAc,EAEpB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,cAAc,EAA+C,KAAK,SAAS,EAAE,MAAM,UAAU,CAAC;AACvG,OAAO,EACL,eAAe,EAIf,KAAK,iBAAiB,EAEtB,KAAK,aAAa,EAElB,KAAK,iBAAiB,EACtB,KAAK,UAAU,EAChB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAsK,KAAK,eAAe,EAAE,KAAK,uBAAuB,EAAE,KAAK,qBAAqB,EAA2D,MAAM,aAAa,CAAC;AAE1U,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,aAAa,CAAC;IACvB,WAAW,EAAE,KAAK,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,EAAE,MAAM,EAAE,CAAC;QACpB,UAAU,EAAE,MAAM,EAAE,CAAC;QACrB,UAAU,EAAE,MAAM,CAAC;QACnB,OAAO,CAAC,EAAE,iBAAiB,CAAC;KAC7B,CAAC,CAAC;CACJ;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,sBAAsB;IACrC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,KAAK,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;QAChB,WAAW,EAAE,MAAM,EAAE,EAAE,CAAC;QACxB,cAAc,EAAE,MAAM,CAAC;QACvB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;KAC5B,CAAC,CAAC;IACH,sBAAsB,EAAE,MAAM,CAAC;IAC/B,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,MAAM,WAAW,cAAc;IAC7B,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;IAC5C,IAAI,EAAE,SAAS,EAAE,CAAC;IAClB,gBAAgB,EAAE,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC;IACrD,iBAAiB,EAAE,OAAO,CAAC;IAC3B,WAAW,EAAE,iBAAiB,CAAC;IAC/B,aAAa,EAAE,iBAAiB,CAAC;IACjC,UAAU,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACrC,kBAAkB,EAAE,sBAAsB,GAAG,IAAI,CAAC;IAClD,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,2EAA2E;IAC3E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,kFAAkF;IAClF,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,oFAAoF;IACpF,gBAAgB,CAAC,EAAE,cAAc,CAAC;IAClC,uFAAuF;IACvF,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B,uEAAuE;IACvE,gBAAgB,CAAC,EAAE,uBAAuB,CAAC;IAC3C,0DAA0D;IAC1D,iBAAiB,CAAC,EAAE,qBAAqB,CAAC;IAC1C,gIAAgI;IAChI,SAAS,CAAC,EAAE,MAAM,GAAG,cAAc,GAAG,OAAO,GAAG,gBAAgB,GAAG,KAAK,CAAC;IACzE,kDAAkD;IAClD,SAAS,CAAC,EAAE,iBAAiB,CAAC;IAC9B,yDAAyD;IACzD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gGAAgG;IAChG,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,wDAAwD;IACxD,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;;;GAIG;AACH,wBAAsB,aAAa,CAAC,OAAO,GAAE,eAAoB,GAAG,OAAO,CAAC,cAAc,CAAC,CA8N1F;AA8OD,wBAAgB,cAAc,CAAC,QAAQ,SAAgB,GAAG,UAAU,CAEnE;AAED;;;;;;;;;GASG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,SAAS,CAA6B;IAE9C,+EAA+E;IAC/E,OAAO,CAAC,YAAY;IAepB,OAAO,CAAC,QAAQ;IAShB,oFAAoF;IACpF,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO;CAM5E;AAiKD,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,SAAS,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAElF"}
|