Skip to content

CLI Reference

All commands accept a .fig file as a positional argument. When omitted, the CLI connects to the running desktop app via RPC.

info

Show document info — pages, node counts, fonts, file size.

sh
open-pencil info [file] [--json]
OptionDescription
--jsonOutput as JSON

tree

Print the node hierarchy.

sh
open-pencil tree [file] [options]
OptionDescription
--pagePage name (default: first page)
--depthMax depth (default: unlimited)
--jsonOutput as JSON

find

Search nodes by name or type.

sh
open-pencil find [file] [options]
OptionDescription
--nameNode name (partial match, case-insensitive)
--typeNode type: FRAME, TEXT, RECTANGLE, INSTANCE, etc.
--pagePage name (default: all pages)
--limitMax results (default: 100)
--jsonOutput as JSON

node

Show detailed properties of a node.

sh
open-pencil node [file] --id <id> [--json]
OptionDescription
--idRequired. Node ID (e.g. 1:23)
--jsonOutput as JSON

pages

List all pages in the document.

sh
open-pencil pages [file] [--json]
OptionDescription
--jsonOutput as JSON

variables

List design variables and collections.

sh
open-pencil variables [file] [options]
OptionDescription
--collectionFilter by collection name
--typeFilter by type: COLOR, FLOAT, STRING, BOOLEAN
--jsonOutput as JSON

export

Export to PNG, JPG, WEBP, SVG, or JSX.

sh
open-pencil export [file] [options]
OptionAliasDescription
--format-fpng (default), jpg, webp, svg, jsx
--output-oOutput file path (default: <name>.<format>)
--scale-sExport scale (default: 1)
--quality-qQuality 0–100, JPG/WEBP only (default: 90)
--pagePage name (default: first page)
--nodeNode ID to export (default: all top-level nodes)
--styleJSX style: openpencil (default), tailwind
--thumbnailExport page thumbnail instead of full render
--widthThumbnail width (default: 1920)
--heightThumbnail height (default: 1080)

eval

Execute JavaScript with the Figma Plugin API.

sh
open-pencil eval [file] [options]
OptionAliasDescription
--code-cJavaScript code to execute
--stdinRead code from stdin
--write-wWrite changes back to the input file
--output-oWrite to a different file
--jsonOutput as JSON
--quiet-qSuppress output

analyze colors

Analyze color palette usage across the document.

sh
open-pencil analyze colors [file] [options]
OptionDescription
--limitMax colors to show (default: 30)
--thresholdDistance threshold for clustering similar colors, 0–50 (default: 15)
--similarShow similar color clusters
--jsonOutput as JSON

analyze typography

Analyze font family, size, and weight distribution.

sh
open-pencil analyze typography [file] [options]
OptionDescription
--group-byGroup by: family, size, weight (default: show all styles)
--limitMax styles to show (default: 30)
--jsonOutput as JSON

analyze spacing

Analyze gap and padding values across auto-layout frames.

sh
open-pencil analyze spacing [file] [options]
OptionDescription
--gridBase grid size to check against (default: 8)
--jsonOutput as JSON

analyze clusters

Find repeated node patterns — potential components.

sh
open-pencil analyze clusters [file] [options]
OptionDescription
--limitMax clusters to show (default: 20)
--min-sizeMin node size in px (default: 30)
--min-countMin instances to form a cluster (default: 2)
--jsonOutput as JSON

Released under the MIT License.