AI-native design editor. Open-source Figma alternative.
docs: trim the README CLI section and align its examples (#885)
Danila Poyarkov403cbd24ab6e
diff --git a/README.md b/README.mdindex 2d6ec2cfe..c13233c02 100644--- a/README.md+++ b/README.md@@ -68,68 +68,34 @@ openpencil info design.fig### Query with XPath-Use XPath selectors to find nodes by type, attributes, and structure:+Find nodes by type, attributes, and structure:```sh-openpencil query design.fig "//FRAME" # All frames-openpencil query design.fig "//FRAME[@width < 300]" # Frames under 300px-openpencil query design.fig "//TEXT[contains(@name, 'Button')]" # Text with 'Button' in name-openpencil query design.fig "//*[@cornerRadius > 0]" # Rounded corners-openpencil query design.fig "//SECTION//TEXT" # Text inside sections+openpencil query design.fig "//FRAME[@width < 300]" # Frames under 300px+openpencil query design.fig "//SECTION//TEXT" # Text inside sections```-### Export+### Export, convert, and import-Render to PNG, JPG, WEBP, SVG, PDF, PPTX, HTML, JSX, Storybook stories, or `.fig` — or export selections/pages as `.fig` and convert whole documents between supported formats:+Render to PNG, JPG, WEBP, SVG, PDF, PPTX, HTML, JSX, Storybook stories, or `.fig`, convert between document formats, and turn HTML/CSS into editable layers:```sh-openpencil export design.fig # PNG-openpencil export design.fig -f jpg -s 2 -q 90 # JPG at 2x, quality 90-openpencil export design.fig -f fig --page "Page 1" # Export a page as .fig-openpencil export design.fig -f jsx --style tailwind # Tailwind JSX-openpencil export design.fig -f html --css tailwind # Tailwind HTML fragment-openpencil export design.fig -f html --html standalone --assets external # HTML + assets-openpencil export design.fig -f storybook --framework vue # Storybook stories per component-openpencil convert design.pen output.fig # Convert between document formats-openpencil import page.html --css styles.css -o page.fig # HTML/CSS → editable .fig+openpencil export design.fig # PNG+openpencil export design.fig -f jpg -s 2 # JPG at 2x+openpencil export design.fig -f tailwind-jsx # Tailwind JSX+openpencil export design.fig -f storybook # Storybook stories per component+openpencil convert design.pen design.fig # Between document formats+openpencil import card.html --css card.css # HTML/CSS → editable .fig```-DOM/CSS input flows through `@open-pencil/dom-css`, so HTML, authored CSS, and Tailwind utility CSS can become editable OpenPencil layers:+### Lint and analyze-```sh-openpencil import card.html --css card.css -o card.fig-openpencil import card.html --tailwind "flex flex-col gap-3 w-80 p-6 rounded-xl bg-white" -o card.fig-```--```html-<div className="flex flex-col gap-4 p-6 bg-white rounded-xl">- <p className="text-2xl font-bold text-[#1D1B20]">Card Title</p>- <p className="text-sm text-[#49454F]">Description text</p>-</div>-```--### Lint design files--Catch naming, layout, structure, and accessibility issues from the terminal:--```sh-openpencil lint design.fig-openpencil lint design.pen --preset strict-openpencil lint design.fig --rule color-contrast-openpencil lint design.fig --list-rules-```--### Analyze and extract design tokens--Audit an entire design system from the terminal — find inconsistencies, extract the real palette, and spot components waiting to be extracted:+Catch naming, layout, and accessibility issues, and audit a design system's real palette, type scale, spacing, and repeated components:```sh-openpencil analyze colors design.fig-openpencil analyze typography design.fig-openpencil analyze spacing design.fig-openpencil analyze clusters design.fig-openpencil analyze overlaps design.fig-openpencil variables design.fig+openpencil lint design.fig --preset strict # Naming, layout, accessibility+openpencil analyze colors design.fig # Also typography, spacing, clusters+openpencil variables design.fig # Variables and collections``````@@ -137,38 +103,29 @@ openpencil variables design.fig#49454f ██████████████████████████████ 9814×#ffffff ██████████████████████████████ 8620×#6750a4 ██████████████████████████████ 3967×--3771× frame "container" (100% match)- size: 40×40, structure: Frame > [Frame]--2982× instance "Checkboxes" (100% match)- size: 48×48, structure: Instance > [Frame]```-### Script with Figma Plugin API+### Script with the Figma Plugin API-`eval` gives you the full Figma Plugin API. Modify the file, write it back:+`eval` runs JavaScript against the document with Figma's Plugin API; `-w` writes the result back:```sh-openpencil eval design.fig -c "figma.currentPage.children.length"openpencil eval design.fig -c "figma.currentPage.selection.forEach(n => n.opacity = 0.5)" -w```### Control the running app-When the desktop app is running, omit the file argument — the CLI connects via RPC and operates on the live canvas. Useful for automation scripts, CI pipelines, or AI agents that need to interact with the editor:+Omit the file argument and the CLI works on the document open in the editor:```sh-openpencil tree # Inspect the live document-openpencil export -f png # Screenshot the current canvas-openpencil eval -c "figma.currentPage.name" # Query the editor-openpencil documents list # Open tabs; also open/new/save/close/activate-openpencil tool call set_fill --args '{"id":"0:5","color":"#2563eb"}' # Any MCP tool-openpencil undo # Undo the newest automation change-openpencil settings set appearance.theme light+openpencil tree # Inspect the live document+openpencil documents list # Also open, new, save, close, activate+openpencil tool call get_selection # Run any MCP tool+openpencil undo # Undo the newest automation change+openpencil settings set appearance.theme light # Change editor settings```-All commands support `--json` for machine-readable output.+Every command supports `--json`. See the [CLI reference](https://openpencil.dev/reference/cli) for all commands and options.## AI & MCP@@ -182,7 +139,7 @@ Not every provider works in the browser, and not every model streams tool callsUse Claude Code, Codex, or Gemini CLI directly in the chat panel. The agent connects to the editor's MCP server and uses all 100+ design tools. Requires the desktop app and the agent CLI installed locally.-Pi is also available as an optional AI SDK Harness provider. Install its companion CLI with `npm install -g @open-pencil/harness`, then add a **Pi** model profile in **Settings → AI & agents**. The companion is installed separately so OpenPencil does not bundle a JavaScript runtime for users who do not enable Harness providers.+Pi works too: install `@open-pencil/harness` globally, then add a **Pi** model profile in **Settings → AI & agents**.**Setup (Claude Code):**@@ -226,9 +183,7 @@ For other MCP clients:openpencil-mcp-http # Unix socket on macOS/Linux + http://127.0.0.1:7600/mcp```-Local clients discover the private Unix socket automatically and fall back to localhost TCP. Set `PORT=0` to disable TCP on macOS/Linux.--**File access:** Set `OPENPENCIL_MCP_ROOT` to scope file operations (`open_file`, `new_document`, export `path` param) to a directory. Defaults to the current working directory.+Set `OPENPENCIL_MCP_ROOT` to limit file access to one directory; it defaults to the current working directory.### [AI agent skill](skills/open-pencil/SKILL.md)