How silships/figma-cli works
figma-cli is a local command-line product that lets an AI assistant operate on editable Figma Desktop documents. Its principal workflow is a user request routed through the CLI and its shared connection layer to Figma; setup supports patched Desktop, browser, and safe-plugin modes. Major capabilities also include token and code import, design extraction, component generation, accessibility checks, and FigJam operations. Relationships for unsampled command subsystems are kept conservative; the graph uses README statements and the provided source index where available.
Main entry points: commands Command handlers · index.js CLI entry · cli-core.js CLI core · figma-client.js Figma CDP client
Components 22
CLI workflow
- CLI entry
src/index.js - Command handlers
src/commands - CLI core
src/lib/cli-core.js
Figma connectivity
- Local daemon
src/daemon.js - Figma CDP client
src/figma-client.js - FigJam CDP client
src/figjam-client.js - Desktop patch
src/figma-patch.js - Platform support
src/platform.js
Design capabilities
- Token management
src/commands/tokens.js - Code import
src/code-import/index.js - Import parsers
src/code-import - Design extraction
src/design-extract.js - Design.md format
src/design-md.js - Component generation
src/shadcn.js - Block templates
src/blocks/dashboard-01.js - Accessibility checks
src/commands/a11y.js - FigJam operations
src/commands/figjam.js - Design analysis
src/gradient-extractor.js
Optional integrations
- Safe-mode plugin
plugin/code.js - Voice plugin
plugins/voice/index.js
Other components
- User / assistant
- Figma Desktop
Connections 19
- User / assistant → CLI entry: requests design
- CLI entry → Command handlers: routes commands
src/index.js - Command handlers → CLI core: uses CLI services
src/commands/tokens.js - CLI core → Figma CDP client: connects via CDP
src/lib/cli-core.js - Figma CDP client → Figma Desktop: evaluates in
- Command handlers → Desktop patch: configures connection
src/commands/setup.js - Desktop patch → Platform support: gets platform paths
src/figma-patch.js - Command handlers → Code import: imports design sources
src/commands/setup.js - Code import → Import parsers: dispatches parsing
src/code-import/index.js - Command handlers → Token management: manages variables
- Command handlers → Design extraction: extracts designs
- Design extraction → Design.md format: exports format
src/design-extract.js - Command handlers → Component generation: generates components
src/commands/variants.js - Command handlers → Block templates: creates blocks
src/commands/misc.js - Command handlers → Accessibility checks: checks accessibility
- Command handlers → FigJam operations: edits FigJam
- Command handlers → Design analysis: analyzes designs
- Safe-mode plugin → Figma Desktop: runs in
- Voice plugin → Command handlers: invokes CLI
plugins/voice/index.js