code-to-figma
Code to Figma
Generate a project-specific Figma export pipeline: a walker that reads compiled HTML and CSS, resolves class → token bindings, and pushes a structured JSON artifact to a GitHub Gist that the tokens-sync-to-figma Figma plugin consumes.
The pipeline is intentionally one-directional and CI-anchored. During setup, assess the project once, generate scripts, and wire CI. After that, every push that touches configured token or template paths automatically updates the Gist without a Figma API key. The bundled plugin rebuilds page structure using existing Figma variables; token-value changes require a separate collection update and readback before Figma parity can be claimed.
Commands
| Command | Use when | Outcome |
|---|---|---|
/code-to-figma setup |
First time; no scripts exist yet | Walker + token scripts generated, Gist created, CI wired, config saved |
/code-to-figma sync |
Scripts exist; push current state to Gist | figma-export.json built and patched to Gist |
/code-to-figma update |
Stack or token naming changed significantly | Scripts regenerated, CI and config updated |
/code-to-figma status |
Check pipeline health | Gist age, CI status, script presence, config validity |
For an unqualified setup/sync request, default to /code-to-figma setup when no figma-sync.config.json or walker scripts are found. Preserve explicit read-only status requests: report a missing pipeline rather than creating one.