designfit

v0.2.1
io.github.as9978/designfit Checked 2 days ago Published 2 months ago

Validate AI-built front-ends against Figma by tokens and geometry, not pixels.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

designfit_validate Validate design fidelity

Validate a rendered front-end against its Figma design. Tag each built element with data-designfit-id="<figmaNodeId>", pass the design spec (geometry + tokens, from designfit_extract or relayed from Figma's MCP), the running URL, and the component map. Returns a fidelity score and a machine-actionable fix-list of token, geometry, and presence violations.

ParameterTypeDescription
componentMap *array
design *object
url *string
viewport *object
tolerancesobject

designfit_extract Extract a design spec from Figma

Turn a Figma frame into the design spec designfit_validate expects. Give it a Figma link (https://www.figma.com/design/<fileKey>/...?node-id=...), or fileKey + nodeId, and it fetches the node via Figma's REST API using the FIGMA_TOKEN env var; or paste the raw GET /v1/files/:key/nodes response as `nodes` and nothing is fetched. Returns { design, componentMap, viewport }: add `url` and call designfit_validate. Deterministic. Hidden nodes are skipped; a frame made only of vectors is one leaf (an icon). `maxDepth` limits how deep to go.

ParameterTypeDescription
fileKeystring
maxDepthinteger
nodeIdstring
nodesobject
urlstring