token_map
Map Figma variables to project design tokens, preventing hard-coded values and enabling code to reference existing tokens.
Instructions
Map the document's Figma variables to the project's design tokens, so generated code references existing tokens instead of hard-coded values. Joins the grounded Figma variable names + values against tokens parsed from the project CSS (Tailwind v4 @theme or :root custom properties); the match is name-based with an exact color value-match as confirmation. On a Tailwind project a variable that hits a framework built-in scale (spacing/N, line-height/N, weight/*) is reported as status 'framework-builtin' with { builtin: { scale, step } } rather than unmapped — it has no @theme token but the utility (p-4 / gap-4, leading-7, font-bold) is still usable. tokenSource overrides the detected styling config; rootDir defaults to the server cwd. Tailwind v3 JS configs are not yet parsed (pass tokenSource to a CSS file). Returns { mappings (candidate + confidence + status + matchedBy + builtin), unmapped, tokenSource, profile }.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| rootDir | No | Project root; defaults to the server cwd | |
| threshold | No | Confidence at/above which a match counts as reliable (default 0.7) | |
| tokenSource | No | Path (relative to rootDir) to a CSS file holding the tokens; overrides detection |