Guides
Like an LLM with a longer context window — but deterministic. Thicker priors → higher rung. Missing priors degrade gracefully; they never hallucinate.
| Rung | You provide | Engine does |
|---|---|---|
| L0 | Nothing | Role dictionary + local React function Card / Vue defineComponent |
| L1 | Color / theme profile | hex → design tokens (byte-equal only) |
| L2 | Repo component index | INSTANCE name → real import + props filter |
| L3 | Index (props sets) | Loop holes ⊆ props, unique tightest cover → import |
| L4 | calque.map.json aliases | Forced figmaName / props-set → import (may override L3) |
L4 > L3 > L2 > L0 hoist > inline map
false-positive mapping < weak hoist
(uncertifiable import paths are forbidden when priors exist)
Quality is monotone non-decreasing: adding a repo only upgrades (local Card → real ProductCard), never tears down correct structure.
| You give | You get |
|---|---|
| Only Figma | Structure + field names + same-file Card/Lane |
| + theme | brand-500 instead of bare hex |
| + repo (INSTANCE) | import { Button } from '@/ui/…' |
| + signature / map | Fragment product cards → <ProductCard/> |
| Nothing but demand fake shadcn | Refused |
normalize → synthesizeLoops
→ applyTokens(colors) // L1
→ match(index) // L2 INSTANCE
→ matchSignatures(index) // L3
→ applyAliases(aliases) // L4
→ dropUnmatchedBindings? // strict when priors present
→ assignLocalComponents // L0 for remaining rich loops
→ render
holes = componentPropIds(loop.template) // ≥2, no nested loop holes
covers = index where holes ⊆ c.props
take unique tightest cover (fewest props)
else → no map (L0 hoist or inline)
Two equally tight covers → refuse. Missing prop → refuse. Prefer small components over kitchen-sink ones.
# L0 only
bun run calque convert page.json --out ./gen-bare
# scan → index file
bun run calque scan-index --repo ./src --out ./calque.index.json
# L2+L3+L4
bun run calque convert page.json \
--index ./calque.index.json --map ./calque.map.json --out ./gen-full
# side-by-side bare vs full (legacy convert helper)
bun run context-diff page.json --index i.json --map m.json --out ./ctx-diff
Schemas: Index · map · context.