component_map
Map Figma component instances to existing local code components, enabling reuse instead of regeneration. Matches via fuzzy scan and explicit documentation file.
Instructions
Map the Figma component instances in a selection/subtree to existing local code components, so they can be reused instead of regenerated. Joins the grounded Figma component names (and their variant axes) against an AST scan of the project; an explicit docs/figma-component-map.md row (FigmaName | code/path) overrides the fuzzy match — this file is the durable record a verified mapping is written back to, so the next run reuses it instead of re-guessing. A row whose target no longer resolves (deleted/renamed) is reported in staleOverrides and degrades to the fuzzy result rather than a phantom import. Each distinct component is mapped once with all its instance ids. A mapped candidate also reports matchedProps (Figma axes the component already has) and unmatchedProps (axes it lacks → component-extension TODOs). Returns { mappings (candidate + confidence + status high/medium/low/unmapped), unmapped, staleOverrides, profile }.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| nodeId | No | Root node id; omit to use the selection or current page | |
| rootDir | No | Project root to scan; defaults to the server cwd | |
| threshold | No | Confidence at/above which a match counts as a reliable reuse (default 0.7) |