openpencil/apps/cli/README.hi.md
Kayshen Xu b4d1d2a7bb
V0.5.1 (#77)
* fix(docker): support multi-platform builds and fix monorepo paths

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* perf(renderer): cache pre-rasterized paragraph images to avoid per-frame glyph rasterization   (#76)

* fix(canvas): stabilize frame label size during zoom

  Draw frame labels in screen-space after the viewport transform
  restore, converting scene coords manually. Previously fontSize=12/zoom
  fed into Math.ceil caused integer-boundary jumps that made labels
  flicker during zoom. Also skip shadow rendering while actively
  zooming for smoother performance.

* perf(renderer): cache pre-rasterized paragraph images to avoid per-frame glyph rasterization

   - Add paraImageCache (SkImage, 128 MB LRU limit) keyed on the same key as paraCache
   - Use drawImageRect instead of drawParagraph on cache hit, skipping per-frame glyph shaping and rasterization
   - Fall back to direct drawParagraph only when off-screen surface creation (MakeSurface) fails
   - Extract _dpr getter to deduplicate device-pixel-ratio resolution logic across draw paths
   - Evict oldest entries when cache exceeds byte limit; delete SkImage on eviction and dispose()

* feat(cli): introduce OpenPencil CLI for terminal control of the design tool

- Added a new CLI application under `apps/cli` to manage OpenPencil from the terminal.
- Implemented commands for app control (`start`, `stop`, `status`), document operations (`open`, `save`, `get`, `selection`), and design manipulation (`design`, `import`).
- Enhanced documentation with usage instructions and platform support details.
- Updated build scripts to include CLI compilation and publishing processes.
- Introduced a new GitHub Actions workflow for publishing the CLI to npm.
- Updated existing workflows to integrate CLI build steps and ensure proper versioning across packages.

* docs: update README files to include CLI tool details and multi-platform code export

- Added CLI section to README files in multiple languages, detailing commands for terminal control of the design tool.
- Included instructions for global installation and usage examples for the CLI.
- Expanded documentation on multi-platform code export capabilities from a single `.op` file to various frameworks.
- Updated CLAUDE.md to reference the new CLI documentation and its integration with the design tool.

* chore(bun.lock): update package dependencies to specific versions

- Removed workspace references for several packages in the bun.lock file.
- Updated dependencies for `@zseven-w/pen-core`, `@zseven-w/pen-types`, `@zseven-w/pen-codegen`, `@zseven-w/pen-figma`, and `@zseven-w/pen-renderer` to version `0.5.1-beta.1`.
- Ensured consistency in dependency management across the project.

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: leinaldo <60176594+leinaldo@users.noreply.github.com>
2026-03-23 21:20:59 +08:00

5.7 KiB

@zseven-w/openpencil

English · 简体中文 · 繁體中文 · 日本語 · 한국어 · Français · Español · Deutsch · Português · Русский · हिन्दी · Türkçe · ไทย · Tiếng Việt · Bahasa Indonesia

OpenPencil के लिए CLI — अपने टर्मिनल से डिज़ाइन टूल को नियंत्रित करें।

इंस्टॉल करें

npm install -g @zseven-w/openpencil

प्लेटफ़ॉर्म समर्थन

CLI सभी प्लेटफ़ॉर्म पर OpenPencil डेस्कटॉप ऐप को स्वचालित रूप से पहचानता और लॉन्च करता है:

प्लेटफ़ॉर्म पहचाने गए इंस्टॉलेशन पथ
macOS /Applications/OpenPencil.app, ~/Applications/OpenPencil.app
Windows NSIS प्रति-उपयोगकर्ता (%LOCALAPPDATA%), प्रति-मशीन (%PROGRAMFILES%), पोर्टेबल
Linux /usr/bin, /usr/local/bin, ~/.local/bin, AppImage (~/Applications, ~/Downloads), Snap, Flatpak

उपयोग

op <कमांड> [विकल्प]

इनपुट विधियाँ

JSON या DSL स्वीकार करने वाले आर्गुमेंट तीन तरीकों से पास किए जा सकते हैं:

op design '...'              # इनलाइन स्ट्रिंग (छोटे पेलोड)
op design @design.txt        # फ़ाइल से पढ़ें (बड़े डिज़ाइन के लिए अनुशंसित)
cat design.txt | op design - # stdin से पढ़ें (पाइपिंग)

ऐप नियंत्रण

op start [--desktop|--web]   # OpenPencil लॉन्च करें (डिफ़ॉल्ट रूप से डेस्कटॉप)
op stop                      # चल रहे इंस्टेंस को बंद करें
op status                    # जाँचें कि चल रहा है या नहीं

डिज़ाइन (बैच DSL)

op design <dsl|@file|-> [--post-process] [--canvas-width N]
op design:skeleton <json|@file|->
op design:content <section-id> <json|@file|->
op design:refine --root-id <id>

दस्तावेज़ संचालन

op open [file.op]            # फ़ाइल खोलें या लाइव कैनवास से कनेक्ट करें
op save <file.op>            # वर्तमान दस्तावेज़ सहेजें
op get [--type X] [--name Y] [--id Z] [--depth N]
op selection                 # वर्तमान कैनवास चयन प्राप्त करें

नोड हेरफेर

op insert <json> [--parent P] [--index N] [--post-process]
op update <id> <json> [--post-process]
op delete <id>
op move <id> --parent <P> [--index N]
op copy <id> [--parent P]
op replace <id> <json> [--post-process]

कोड निर्यात

op export <format> [--out file]
# प्रारूप: react, html, vue, svelte, flutter, swiftui, compose, rn, css

वेरिएबल और थीम

op vars                      # वेरिएबल प्राप्त करें
op vars:set <json>           # वेरिएबल सेट करें
op themes                    # थीम प्राप्त करें
op themes:set <json>         # थीम सेट करें
op theme:save <file.optheme> # थीम प्रीसेट सहेजें
op theme:load <file.optheme> # थीम प्रीसेट लोड करें
op theme:list [dir]          # थीम प्रीसेट सूचीबद्ध करें

पेज

op page list                 # पेज सूचीबद्ध करें
op page add [--name N]       # एक पेज जोड़ें
op page remove <id>          # एक पेज हटाएँ
op page rename <id> <name>   # एक पेज का नाम बदलें
op page reorder <id> <index> # एक पेज का क्रम बदलें
op page duplicate <id>       # एक पेज डुप्लिकेट करें

आयात

op import:svg <file.svg>     # SVG फ़ाइल आयात करें
op import:figma <file.fig>   # Figma .fig फ़ाइल आयात करें

लेआउट

op layout [--parent P] [--depth N]
op find-space [--direction right|bottom|left|top]

वैश्विक फ़्लैग

--file <path>     लक्ष्य .op फ़ाइल (डिफ़ॉल्ट: लाइव कैनवास)
--page <id>       लक्ष्य पेज ID
--pretty          मानव-पठनीय JSON आउटपुट
--help            सहायता दिखाएँ
--version         संस्करण दिखाएँ

लाइसेंस

MIT