openpencil/openspec/changes/archive/2026-03-01-sync-variables-export-cli/specs/cli/spec.md
Anton A S adea7eb645 Sync specs & docs: variables, image export, CLI, core extraction
- Update specs: scene-graph (variables/collections/modes/bindings/.fig import),
  editor-ui (VariablesPanel, ExportSection, splash), canvas-rendering
  (variable resolution, image export, sceneVersion/renderVersion),
  desktop-app (monorepo), tooling (Bun workspace), testing (variable tests)
- Create cli spec: info, tree, find, export commands
- Update docs: features, figma-comparison (79/150), roadmap (Phase 4 ,
  Phase 5 🟡), keyboard-shortcuts (⇧⌘E), contributing (monorepo structure)
- Restore vitepress devDependency lost during merge
- Archive sync-variables-export-cli change
2026-03-01 02:17:48 +03:00

1.6 KiB
Raw Blame History

cli Specification (delta — new spec domain)

Purpose

Headless CLI for .fig file operations. Runs in Bun/Node without a GUI, using CanvasKit CPU rasterization for rendering.

New Requirements

Requirement: CLI package

@open-pencil/cli SHALL be a separate package in packages/cli/ providing headless .fig file operations. It imports @open-pencil/core for engine access and uses CanvasKit CPU rasterization for rendering without WebGL.

Requirement: CLI commands

The CLI SHALL support the following commands:

  • open-pencil info <file> — document stats, node type counts, font list
  • open-pencil tree <file> — visual node tree with formatted output
  • open-pencil find <file> — search nodes by name or type
  • open-pencil export <file> — render to PNG/JPG/WEBP at any scale

All commands SHALL support --json for machine-readable output.

Scenario: Info command

  • WHEN bun open-pencil info design.fig is run
  • THEN document stats, node type counts, and font list are printed

Scenario: Export command

  • WHEN bun open-pencil export design.fig --format png --scale 2 is run
  • THEN the document is rendered headlessly and exported as 2× PNG

Scenario: JSON output

  • WHEN bun open-pencil tree design.fig --json is run
  • THEN the node tree is output as JSON

Requirement: Workspace integration

The CLI SHALL be runnable via bun open-pencil within the Bun workspace, without global installation.

Scenario: Run from workspace root

  • WHEN bun open-pencil info design.fig is run from the project root
  • THEN the CLI executes using the workspace-linked binary