openpencil/packages/cli
Marc Went 8c72b62da0
feat(cli): export Storybook stories beside many documents (#761)
* feat(cli): export Storybook stories beside many documents

Accept several documents, or a quoted glob such as 'src/**/*.pen', and add --beside to write each document's stories, design images, and manifest into the document's own folder, next to the component's code. Documents export one after another, since documents in one folder share its manifest; a failed document is reported and the rest still export. --watch covers every matched document through one queue. Several documents need --beside or --output, and --page takes a single document.

Refs #727

* fix(cli): resolve Storybook export documents by existence, not glob syntax

Deciding between a path and a pattern by looking for glob characters missed
extglobs, so 'src/+(a|b).pen' was opened as a literal filename, and it flagged
an escaped star, so a file genuinely named that way went to the matcher. The
character list also could not agree with Node's matcher: is-glob rejects a
bare '?', picomatch accepts a parenthesised directory name.

An existing path is now that file, and everything else goes to glob(), which
matches a plain path to itself and expands every pattern it supports.

---------

Co-authored-by: Danila Poyarkov <dev@dannote.net>
2026-09-30 22:05:51 +04:00
..
bin build: publish node-compatible packages 2026-05-21 17:03:19 +03:00
src feat(cli): export Storybook stories beside many documents (#761) 2026-09-30 22:05:51 +04:00
tests feat: add Figma-style variants and component libraries (#512) 2026-08-14 19:31:41 +03:00
AGENTS.md docs: route contributors through per-domain guides and ship npm license text (#785) 2026-09-29 01:02:06 +04:00
package.json feat: export components as Storybook stories (#751) 2026-09-30 03:16:47 +04:00
README.md docs: route contributors through per-domain guides and ship npm license text (#785) 2026-09-29 01:02:06 +04:00
tsconfig.json feat(cli): import DOM/CSS documents 2026-06-30 10:48:13 +03:00
tsdown.config.ts feat: add Figma-style variants and component libraries (#512) 2026-08-14 19:31:41 +03:00

@open-pencil/cli

Headless command line for OpenPencil and .fig files: inspect documents and layers, query with XPath, export to PNG, JPG, WEBP, SVG, PDF, PPTX, JSX, HTML, or .fig, import HTML/CSS/Tailwind, lint design files, analyze and extract design tokens, and script documents with a Figma Plugin API-compatible figma global through eval.

npm install -g @open-pencil/cli   # or: bun add -g @open-pencil/cli
openpencil --help
openpencil eval design.fig -c "return figma.currentPage.children.length"

Inspection commands support --json for automation. The MCP server ships separately as @open-pencil/mcp.

MIT License.