Generation Quick Start
Run Contract Enforcement During AI UI Generation
Use this flow at Generation time when Lovable or Figma Make produces new UI and you want immediate policy visibility before CI/CD time promotion.
Canonical policy source: contracts/surfaces.web.contract.json
Quick Start
- Start adapter service. Run the adapter once and keep it running while generating UI.
- Build descriptor payload from generated output. Include surfaceId, emitted primitives, generated color values, and icon import sources.
- Send descriptor to the adapter endpoint. Use POST /surfaces.validateGeneration with tool, mode=descriptor, and descriptor array.
- Apply phased descriptor parity. Descriptor mode enforces shell + color + icon policy for rollout-enabled surfaces (`contracts/generation-descriptor-parity.json`).
- Read status and findings. pass continues, warn continues with visibility, block stops and requires regeneration/fix.
- Repeat until status is pass or acceptable warn. Treat block as a hard stop for publish/export decisions.
Copy/Paste Start
# 1) Start the adapter service (reference-target contract)
pnpm run adapter:serve-generation -- \
--contract /Users/mike/SurfacesPlatform/surfaces-webapps/contracts/generated/reference-target-web.contract.json
# 2) Submit generated descriptor output
curl -sS -X POST http://127.0.0.1:7777/surfaces.validateGeneration \
-H 'content-type: application/json' \
-d '{
"requestId":"gen-001",
"tool":"figma-make",
"surfaceId":"reference-target-web",
"mode":"descriptor",
"descriptor":[{
"surfaceId":"reference-target-web",
"primitives":[],
"colors":[{"value":"var(--background)","source":"generated.css"}],
"icons":[{"value":"@heroicons/react/24/outline","source":"generated.tsx"}]
}]
}'- Descriptor mode checks generation boundaries only (no full workspace validation).
- Descriptor parity is phased by surface; initial enforcement starts with reference-target-web.
- For non-enforced surfaces, keep CI fallback as the authoritative promotion gate.
- Use CI fallback later if your generator cannot hard-block inside its own UI.
- Use the contract for your target surface: contracts/generated/reference-target-web.contract.json for reference-target demos, contracts/surfaces.web.contract.json for canonical surfaces.
Status Rules
pass No findings. Continue.
warn Warnings only. Continue with visibility.
block Strict/error finding present. Stop and fix.
Next Context
surfaces.dev quick start • generation