fgm is a Figma CLI for exporting screens/assets, comparing designs, and extracting tokens.
It is optimized for fast repeated runs from human or LLM workflows:
- URL-first usage (
fgm "<figma-url>") - cache-first API behavior (disk + memory)
- low-rate export profile and delta skip mode
Note: Independent hobby project (not affiliated with Figma/Adobe). Platform status: primarily tested on macOS.
brew tap dan-hart/tap
brew install fgmgit clone https://github.com/dan-hart/fgm.git
cd fgm
cargo build --release
cp target/release/fgm ~/.local/bin/fgm --versionGet a Figma Personal Access Token: https://www.figma.com/developers/api#access-tokens
Use one of these:
# Environment variable (highest priority)
export FIGMA_TOKEN="figd_your_token_here"
# Or store in config (default)
fgm auth login
# Or store in keychain (opt-in)
fgm auth login --keychain
# Verify
fgm auth statusToken resolution order:
FIGMA_TOKEN- config file
- keychain
# Diagnose local setup
fgm doctor
# Bootstrap a local workspace
fgm init .
# Export all top-level screens from a Figma URL (quick mode)
fgm "https://www.figma.com/design/abc123/MyFile"
# Write images + manifest.json for LLM use
fgm "https://www.figma.com/design/abc123/MyFile" --llm-pack -o ./llm-pack/
# Export one specific frame
fgm export file "https://www.figma.com/design/abc123/MyFile?node-id=1-2" -o ./out/fgm "https://www.figma.com/design/abc123/MyFile" \
--profile low-rate \
--llm-pack \
-o ./llm-pack/fgm "https://www.figma.com/design/abc123/MyFile" \
--profile low-rate \
--delta \
-o ./llm-pack/fgm compare-url "https://www.figma.com/design/abc123/MyFile?node-id=1-2" app-screen.png --threshold 3--llm-pack: writesmanifest.jsonwith asset metadata + telemetry.--profile pixel-perfect: PNG-focused stable exports for visual checks.--profile low-rate: conservative batching + cache/rate-limit friendly behavior.--delta: skip export URL/image fetches if file version is unchanged.--resume: skip rewriting unchanged output files.--format {png|svg|pdf|jpg}and--scale N: output control.-o, --output: output directory.
# Local workspace setup
fgm init . --figma "https://www.figma.com/design/abc123/MyFile"
fgm doctor --report ./.fgm/reports/doctor.html --report-format html
# File inspection
fgm files get "https://www.figma.com/design/abc123/MyFile"
fgm files tree abc123 --depth 3
fgm files versions abc123 --limit 10
# Local image comparison
fgm compare design.png screenshot.png --threshold 5 --output diff.png
fgm compare design.png screenshot.png --report compare.md --report-format md
# Token export
fgm tokens export abc123 --format css -o tokens.css
fgm tokens export abc123 --format tailwind -o tailwind.tokens.js
fgm tokens export abc123 --format style-dictionary -o tokens.sd.json
fgm tokens export abc123 --format android-xml -o values/fgm_tokens.xml
# Terminal preview
fgm preview abc123 --node "1:2"
fgm preview abc123 --pick
# Cache utilities
fgm cache status
fgm cache warmup abc123 --include-images
fgm cache clear --file abc123
# Watch mode
fgm export file abc123 --pick --watch -o ./exports/
fgm compare-url "https://www.figma.com/design/abc123/MyFile?node-id=1-2" screenshot.png --watch
# Mapping and orchestration
fgm map verify -m .fgm/components.toml --report ./.fgm/reports/map.html --report-format html
fgm run jobs.toml --report ./.fgm/reports/run.jsonfgm now defaults to a cache-first and low-churn approach:
- persistent disk+memory cache for API reads
- canonicalized cache keys for nodes/exports
- stale-while-revalidate cache usage
- singleflight request coalescing for duplicate inflight API calls
- endpoint-aware throttling with adaptive pacing
- adaptive export batch sizing with retry/backoff behavior
- separate API vs download concurrency control
For machine workflows, --llm-pack includes telemetry fields like:
api_callsexport_batchescache_hitscache_misses- rate-limit counters
fgm config path
fgm config show
fgm config get defaults.output_format
fgm config set export.default_scale 2# Auth problems
fgm auth debug
# Disable keychain prompts for a run
fgm --no-keychain auth status
# Get verbose logs
fgm --verbose export file abc123 --all-frames
# Inspect cache state
fgm cache statusGPL-3.0-or-later. See LICENSE.