Skip to content

CLI Reference ​

Document commands accept a .fig file as a positional argument. When omitted, the CLI connects to the running desktop app via RPC. documents, undo, redo, and settings always act on the running app.

A user error — a bad flag, a missing file, a refused combination — prints its message and exits 1 without a stack trace. Set PAIRDRAW_DEBUG=1 to print the stack as well, which a crash needs to be read.

info ​

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

sh
pairdraw info [file] [--json]
OptionDescription
--jsonOutput as JSON

tree ​

Print the node hierarchy.

sh
pairdraw tree [file] [options]
OptionDescription
--pagePage name (default: first page)
--depthMax depth (default: unlimited); a non-negative integer, other values are refused
--jsonOutput as JSON

find ​

Search nodes by name or type.

sh
pairdraw 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); a positive integer, other values are refused
--jsonOutput as JSON

node ​

Show detailed properties of a node.

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

--json reports the shape details a layer carries: per-corner radii (topLeftRadius, topRightRadius, bottomRightRadius, bottomLeftRadius) when the corners are independent and disagree, otherwise one cornerRadius when it is above zero; isMask and maskType while the layer masks; and a boolean layer's booleanOperation. A plain layer carries none of them.

pages ​

List all pages in the document.

sh
pairdraw pages [file] [--json]
OptionDescription
--jsonOutput as JSON

variables ​

List design variables and collections.

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

tokens ​

Print design variables as a stylesheet of CSS custom properties. Default mode values go in :root; every other mode overrides them under its condition, [data-<collection>="<mode>"] unless the mode names a selector or @media query. Aliases stay var() references. Tokens or modes that cannot be written are listed on stderr.

sh
pairdraw tokens [file] [options]
OptionDescription
--formatcss (default), tailwind for a Tailwind v4 @theme with a @custom-variant per mode, or dtcg for W3C design token files
--out, -oFolder the dtcg files are written to; required for that format
--collectionFilter by collection name
--typeFilter by type: COLOR, FLOAT, STRING, BOOLEAN
--jsonOutput { css, tokenCount, issues } as JSON

With --import, the command reads a local stylesheet's custom properties into the document's variables instead of printing them: :root holds each collection's default values, .dark and other selectors become modes, and Tailwind's @theme works too.

sh
pairdraw tokens app.fig --import theme.css --write

With --project, the command reads a local project folder instead of one stylesheet. Tailwind v4 @theme blocks and plain custom properties are imported. A shadcn/ui :root and .dark pair becomes one collection with Light and Dark modes. tailwind.config.js and other project JavaScript are reported and not run. A path that leaves the folder is refused, and a file over 1 MiB is skipped. Reading also stops, and reports it, after 200 files or 8 MiB in total. Component source is not imported.

sh
pairdraw tokens app.fig --project ./app --write
OptionDescription
--importLocal CSS file to import as variables
--projectLocal project folder whose CSS variables are imported
--checkCompare the document's variables with a stylesheet or project folder and list what differs; exits 1 on a difference
--syncBring a stylesheet's or project folder's changes into the variables and remember the link; tokens also changed on the canvas are left unless --conflicts says otherwise
--conflictsWith --sync, what a token changed on both sides takes: skip (default), code, or canvas
--writeWrite the import back to the input file
--outputWrite to a different file instead

--out is refused with --import or --project: it writes dtcg token files, while an import writes the document itself with --write or --output.

check ​

Check design documents in CI: render each frame at several widths, compare variables with the stylesheet they come from, and list the design memory's findings. Nothing is written back to a document.

sh
pairdraw check [files...] [options]
OptionDescription
--configSettings file (default: .pairdraw/check.json)
--baseFolder holding the base revision's copies at the same paths, so only findings this change introduced fail
--outReport folder (default: pairdraw-report): report.json, report.md, renders/
--image-baseURL prefix for the render images in report.md
--fail-onerror, warning, or never; overrides the settings file
--jsonOutput the report as JSON

Exit codes: 0 pass, 1 findings at the configured level, 2 the check could not run. See CI Checks on a Pull Request for the settings file and the GitHub Action.

export ​

Export to PNG, JPG, WEBP, SVG, PDF, PowerPoint, draw.io, JSX, HTML, .fig, or Storybook stories, or record the page's prototype as an MP4, GIF, or WebM video. The app does not offer PowerPoint or draw.io export; the CLI does.

sh
pairdraw export [file] [options]
OptionAliasDescription
--format-fpng (default), jpg, webp, svg, pdf, pptx, drawio, jsx, tailwind-jsx, html, fig, storybook; mp4, gif, and webm record the prototype
--output-oOutput file path (default: <name>.<format>); a directory for storybook (default: <name>-stories)
--scale-sExport scale (default: 1)
--quality-qQuality 0–100, JPG/WEBP only (default: 90)
--pagePage name (default: first page; fig, pptx, and storybook default to every page)
--nodeNode ID to export (default: all top-level nodes)
--styleJSX style: pairdraw (default), tailwind (same as -f tailwind-jsx)
--htmlHTML mode: fragment (default), standalone
--cssHTML CSS output: inline (default), tailwind
--assetsStandalone HTML assets: inline (default), external
--fontsStandalone HTML font output: assets, none (default)
--frameworkStorybook framework: react (default), vue, html
--design-imagesStorybook: render a PNG per variant for the Design panel (default: on; --no-design-images to skip)
--watchStorybook: re-export whenever the document is saved
--besideStorybook: write each document's stories into the document's own folder; the file argument can then be several files or a quoted glob
--thumbnailExport a page thumbnail fitted to --width and --height; PNG, JPG, or WEBP. Cannot combine with --node (a thumbnail is a whole page)
--widthThumbnail width (default: 1920)
--heightThumbnail height (default: 1080)
--startVideo: top-level frame name or ID to play from (default: the selected or the page's first frame)
--fpsVideo: frames per second (default: 30, or 15 for GIF; GIF plays at most 50)
--max-edgeVideo: longest width or height in pixels (default: 1920, or 960 for GIF); --scale sets the start frame's size below it
--max-durationVideo: seconds the clip may last at most (default: 30, at most 120)
--tailVideo: seconds the last frame stays when the flow ends (default: 1)
--clickVideo: a click to run, <seconds>:<layer name or ID>; repeat it for more clicks

A video plays the prototype from its start frame as Play does, following each After delay and its Dissolve or Smart animate on a virtual clock rather than in real time, so the clip is the same on every run. It ends when play returns to the start frame (the GIF then loops), when nothing else happens, or at --max-duration. The command prints each step it recorded. MP4 (H.264) and WebM (VP9) are encoded with WebCodecs in the running app; from a file the CLI encodes them with ffmpeg when it is on the path (with libx264 and libvpx-vp9), and otherwise records only GIF:

sh
pairdraw export hero.fig -f gif --start "Hero 1" -o hero.gif
pairdraw export -f mp4 --start "Hero 1" -o hero.mp4      # app mode
pairdraw export app.fig -f gif --click 1.5:"Buy button" --click 3:Close

libraries ​

Manage filesystem catalogs of component libraries.

sh
pairdraw libraries list --root ./catalog
pairdraw libraries publish components.fig --root ./catalog --id my-lib --name "My Library"
pairdraw libraries seed --root ./catalog
SubcommandDescription
listList the catalog's libraries; --root is required, --json prints machine-readable output
publishPublish a .fig document as a revision; --id and --name name the library, --write saves new asset keys back to the source, --previous expects a revision
seedPublish the built-in original Pairdraw Basics set (button, input, badge, card, avatar) into the catalog; does nothing when it is already there

import ​

Import HTML/CSS/Tailwind into an editable Pairdraw document.

sh
pairdraw import page.html [options]
OptionAliasDescription
--format-fOutput format: fig (default), json
--output-oOutput file path (default: <name>.<format>)
--cssCSS file to apply before conversion
--css-textInline CSS text to apply before conversion
--tailwindTailwind utility candidates to compile and apply
--tailwind-fileFile containing Tailwind utility candidates
--page-nameScene graph page name (default: DOM/CSS)
--jsonPrint a machine-readable summary

Examples:

sh
pairdraw import card.html --css card.css -o card.fig
pairdraw import card.html --tailwind "flex flex-col gap-3 w-80 p-6 rounded-xl bg-white" -o card.fig

eval ​

Execute JavaScript with the Figma Plugin API.

sh
pairdraw 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
--preview-outputWrite a PNG of the current page after the script runs
--preview-scalePreview scale from 0.1 to 4 (default: 1); the longest edge stays within 1280 pixels
--jsonOutput as JSON
--quiet-qSuppress output

design-memory ​

Show the document's design memory: the colors, fonts, font sizes, spacing, and corner radii agents may use and how each is enforced, its decisions, and its examples. See Analyzing Designs.

sh
pairdraw design-memory [file] [--json]

analyze colors ​

Analyze color palette usage across the document.

sh
pairdraw 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
pairdraw 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
pairdraw 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
pairdraw 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

diff create ​

Patch that turns one node tree into another, as JSX attribute changes plus moved, added, and removed children. Children match by name; see Comparing designs for the format.

sh
pairdraw diff create [file] --from <id> --to <id> [options]
OptionDescription
--fromSource node ID
--toTarget node ID
--depthMax tree depth (default: 10)
--jsonOutput as JSON

diff jsx ​

Structural diff between two nodes as design JSX.

sh
pairdraw diff jsx [file] --from <id> --to <id> [--json]

diff show ​

Preview the patch that setting JSX attributes on a node would produce, without changing it.

sh
pairdraw diff show <id> [file] --attributes '<jsx attributes>' [--json]

--attributes takes attributes as the JSX export writes them, such as 'w={200} bg="#FF0000"'.

diff apply ​

Apply a patch from diff create, diff show, or diff files. Every node must still match the patch's old values unless --force is set, and nothing changes unless every hunk applies.

sh
pairdraw diff apply <patch> [file] [options]
OptionAliasDescription
--dry-runValidate and list changes without applying
--forceApply even when current values differ from the patch
--write-wWrite changes back to the input file
--output-oWrite to a different file
--jsonOutput as JSON

Pass - as the patch path to read it from stdin.

diff visual ​

Pixel diff between two rendered nodes, written as a PNG with changed pixels in red.

sh
pairdraw diff visual [file] --from <id> --to <id> --output <png> [options]
OptionAliasDescription
--output-oDiff PNG path
--scaleRender scale before the max-edge limit (default: 1)
--max-edgeMaximum image width or height (default: 1280)
--thresholdColor tolerance 0–1; smaller is stricter (default: 0.1)
--jsonOutput as JSON

diff files ​

Structural diff of two documents, page by page. Pages match by name and nodes by name path, so two versions of a file compare even though their node IDs differ. Exits with status 1 when the documents differ and 2 when the options are invalid, such as a --page neither document has.

sh
pairdraw diff files <before> <after> [options]
OptionDescription
--pageCompare only the page with this name
--depthMax tree depth below each page (default: unlimited)
--jsonOutput as JSON

documents ​

Manage documents (tabs) in the running app. See Controlling the App. Commands share one cli session unless PAIRDRAW_SESSION names another.

sh
pairdraw documents list [--json]
pairdraw documents open <file> [--json]
pairdraw documents new [--path <file>] [--json]
pairdraw documents save [--path <file>] [--document-id <id>] [--json]
pairdraw documents close [--save | --discard] [--path <file>] [--document-id <id>] [--json]
pairdraw documents activate <document-id> [--page-id <id>] [--json]
OptionDescription
--path.fig path to create or save to; relative to the current directory
--saveclose: save unsaved changes first
--discardclose: close without saving; unsaved changes are lost
--document-idDocument to use. Save defaults to the document this CLI session is targeting, or the one in front. Close defaults only to a document this session opened
--page-idPage to switch the activated document to
--jsonOutput the result and target document as JSON

undo / redo ​

Undo or redo the newest change made through the CLI or MCP in the running app. Fails when the newest change was made in the editor; see Controlling the App.

sh
pairdraw undo [--document-id <id>] [--json]
pairdraw redo [--document-id <id>] [--json]

settings ​

Read and change editor settings in the running app by dotted key. Values parse as JSON, falling back to plain strings.

sh
pairdraw settings get [key] [--json]
pairdraw settings set <key> <value> [--json]

See Controlling the App for the available keys.

tool ​

List, describe, and call the editor tools that the MCP server exposes.

sh
pairdraw tool list [--json]
pairdraw tool describe <name> [--json]
pairdraw tool call <name> [file] [options]
OptionAliasDescription
--argsTool arguments as a JSON object
--args-fileRead arguments from a JSON file, or - for stdin
--enforce-design-memoryFail the call and write nothing when it uses a color or font the document's design memory refuses; without it, such values are warnings in the result
--write-wHeadless: write changes back to the input file
--output-oHeadless: write changes to a different file
--preview-outputWrite a PNG of the current page after the tool changes the document
--preview-scalePreview scale from 0.1 to 4 (default: 1); the longest edge stays within 1280 pixels
--document-idApp: target document
--page-idApp: target page
--jsonOutput as JSON

shell ​

Open a document once and run tools on it line by line, with save() and exit(). Reads lines from stdin when it is not a terminal and exits with status 1 if any line failed. See Controlling the App.

sh
pairdraw shell [file] [options]
OptionAliasDescription
--output-oWhere save() writes without a path (default: the input file)
--preview-outputWrite a PNG of the current page after each change
--preview-scalePreview scale from 0.1 to 4 (default: 1); the longest edge stays within 1280 pixels
--document-idApp: target document
--page-idApp: target page

models ​

List the AI providers and models the chat can use, and the ACP agents.

sh
pairdraw models [--provider <id>] [--json]
OptionAliasDescription
--provider-pOnly this provider or ACP agent, by ID (for example openrouter or acp:codex)
--jsonOutput as JSON

fonts ​

Report fonts used by a document.

sh
pairdraw fonts [file] [options]
OptionDescription
--document-idTarget Pairdraw document/tab ID when connected to the running app
--page-idTarget page ID when connected to the running app
--jsonOutput as JSON

selection ​

Get current selection from the running app.

sh
pairdraw selection [options]
OptionDescription
--document-idTarget Pairdraw document/tab ID when connected to the running app
--page-idTarget page ID when connected to the running app
--jsonOutput as JSON

formats ​

List supported document and export formats.

sh
pairdraw formats [options]
OptionDescription
--jsonOutput as JSON

convert ​

Convert a document to another writable format.

sh
pairdraw convert <file> [options]
OptionAliasDescription
--output-oOutput file path (default: <name>.<format>)
--format-fOutput format: fig (default), pen, or drawio
--font-policyWhen a font of the document is missing: warn, strict (fail without writing), or allow (default: warn)

lint ​

sh
pairdraw lint <file> [options]

Check a .fig or .pen document for consistency, structure, and accessibility issues, without opening the app.

  • --preset <name> — recommended (default), strict, or accessibility
  • --rule <name> — run one rule only; repeat for several
  • --fix — apply safe fixes: bind colours that match a variable and round to whole pixels; write the result with -o
  • -o, --output <file> — where --fix writes the fixed .fig
  • --list-rules — list the rules and exit
  • --json — print the report as JSON
pairdraw lint design.fig
pairdraw lint design.fig --preset strict --json
pairdraw lint design.fig --fix -o design.fixed.fig

agent ​

Drive a document from a model: run, and see which tools it may call.

sh
pairdraw agent run [file] [--model <id>] [--json]
pairdraw agent tools [--json]
pairdraw agent list [--json]
SubcommandDescription
runRun a design agent on a document through an OpenAI-compatible model
toolsList the tools an agent run can call by default
listList the named agents a run can put in a team

query ​

Query nodes using XPath selectors. A selector's tag is a node type, spelled as find --type spells it: CANVAS, FRAME, RECTANGLE, ROUNDED_RECTANGLE, ELLIPSE, TEXT, LINE, STAR, POLYGON, VECTOR, BOOLEAN_OPERATION, GROUP, SECTION, COMPONENT, COMPONENT_SET, INSTANCE, CONNECTOR, SHAPE_WITH_TEXT, STICKY, or SCRIPT. //RECTANGLE matches rectangles; //RECT matches nothing.

sh
pairdraw query [file] [selector] [options]
OptionDescription
selectorXPath selector (e.g. //FRAME[@width < 300], //TEXT[contains(@name, "Label")])
--pagePage name (default: all pages)
--limitMax results (default: 1000); a positive integer, other values are refused
--document-idTarget Pairdraw document/tab ID when connected to the running app
--page-idTarget page ID when connected to the running app
--jsonOutput as JSON

Released under the MIT License.