AI-native design editor. Open-source Figma alternative.
Merge origin/master: P2P collab, MCP server, multi-file tabs, 29 tools, performance
Anton A S311a0d82087a
diff --cc AGENTS.mdindex fc5bea41a,e5cdcc57b..a0b7555ff--- a/AGENTS.md+++ b/AGENTS.md@@@ -10,7 -10,7 +10,8 @@@ Bun workspace with three packages- `packages/core` — `@open-pencil/core`: scene graph, renderer, layout, codec, kiwi, clipboard, vector, snap, undo. Zero DOM deps, runs headless in Bun.- `packages/cli` — `@open-pencil/cli`: headless CLI for .fig inspection, export, linting. Uses `citty` + `agentfmt`.+- `packages/docs` — `@open-pencil/docs`: VitePress documentation site. Run with `cd packages/docs && bun run dev`.+ - `packages/mcp` — `@open-pencil/mcp`: MCP server for AI coding tools. Stdio + HTTP (Hono). Reuses `createServer()` factory with all core tools.The root app (`src/`) is the Tauri/Vite desktop editor. Its `src/engine/` files are thin re-export shims from `@open-pencil/core`.@@@ -33,8 -33,50 +34,51 @@@- `bun open-pencil analyze typography <file>` — font/size/weight stats- `bun open-pencil analyze spacing <file>` — gap/padding values- `bun open-pencil analyze clusters <file>` — repeated patterns+- `bun open-pencil eval <file> --code '<js>'` — execute JS with Figma Plugin API+ ## Releases & CI++ ### How to release++ 1. Update version in `package.json`, `packages/core/package.json`, `packages/cli/package.json`, `desktop/tauri.conf.json`+ 2. Update `CHANGELOG.md` — move "Unreleased" items under new version heading with date+ 3. Commit: `Release v0.x.y`+ 4. Tag: `git tag v0.x.y && git push --tags`+ 5. The `build.yml` workflow triggers on `v*` tags and:+ - Builds Tauri binaries for macOS (arm64 + x64), Windows (x64 + arm64), Linux (x64)+ - Creates a draft GitHub Release with all platform binaries+ - Publishes `@open-pencil/core` and `@open-pencil/cli` to npm with provenance+ 6. Go to GitHub Releases → edit the draft → paste changelog section → publish++ ### CI workflows++ | Workflow | Trigger | What it does |+ |----------|---------|--------------|+ | `build.yml` | `v*` tag push or manual | Build Tauri desktop apps (5 targets), create GitHub Release, publish npm |+ | `app.yml` | Push to `master` (non-docs) | Build web app, deploy to Cloudflare Pages (`app.openpencil.dev`) |+ | `docs.yml` | Push to `master` (`packages/docs/**`) | Build VitePress docs, deploy to Cloudflare Pages (`openpencil.dev`) |++ ### Before committing++ Run all quality gates:++ ```sh+ bun run check # oxlint + typecheck+ bun run format # oxfmt+ bun run test:dupes # jscpd < 3%+ bun run test:unit # bun:test+ bun run test # Playwright E2E+ ```++ ## Documentation++ - `CHANGELOG.md` — all user-facing changes, grouped by version. "Unreleased" section at top for in-progress work.+ - `README.md` — user-facing: features, getting started, CLI, project structure. No implementation details.+ - `AGENTS.md` (this file) — contributor/agent reference: architecture, conventions, how to release.+ - `packages/docs/` — VitePress site deployed at `openpencil.dev`. User guide, reference, development docs.++ When adding features, update `CHANGELOG.md` (Unreleased section) and `README.md` (if user-facing). Update `AGENTS.md` when architecture or conventions change.+## CLI- All CLI output must use `agentfmt` formatters — `fmtList`, `fmtHistogram`, `fmtSummary`, `fmtNode`, `fmtTree`, `kv`, `entity`, `bold`, `dim`, etc.diff --cc packages/docs/guide/comparison.mdindex a7b6b8c68,86216aef7..5ec2673b1--- a/packages/docs/guide/comparison.md+++ b/packages/docs/guide/comparison.md@@@ -6,15 -10,15 +10,15 @@@ Penpot 2.x includes a Rust/Skia WASM re| Metric | Open Pencil | Penpot ||--------|-------------|--------|- | Total LOC | **~26,000** | **~292,000** |-| Total LOC | **~14,500** | **~299,000** |-| Source files | 53 | ~2,900 |++| Total LOC | **~26,000** | **~299,000** |+| Source files | 125 | ~2,900 || Languages | TypeScript, Vue | Clojure, ClojureScript, Rust, JS, SQL, SCSS |- | Rendering engine | 1,646 LOC (TS) | 22,000 LOC (Rust) |+ | Rendering engine | 1,646 LOC (TS) | 22,000 LOC (Rust/Skia WASM) || UI code | ~4,500 LOC | ~175,000 LOC (CLJS + SCSS) || Backend | None (local-first) | 32,600 LOC + 151 SQL files |- | LOC ratio | **1x** | **~11x** |-| LOC ratio | **1×** | **~20×** |++| LOC ratio | **1×** | **~11×** |- Open Pencil is **11x smaller** — and that's the whole point. It's not a simplification; it's a fundamentally different architecture.-Open Pencil is **~20x smaller** — and that's the whole point. It's not a simplification; it's a fundamentally different architecture.++Open Pencil is **~11× smaller** — and that's the whole point. It's not a simplification; it's a fundamentally different architecture.## 2. Architecture@@@ -280,4 -285,4 +289,4 @@@ OpenPencil ships with an [`eval` comman| **Self-hosting** | Penpot | Docker-ready vs desktop-only || **Ecosystem maturity** | Penpot | Years of production vs early stage |- Open Pencil is architecturally superior for a design tool — leaner, faster, more maintainable, and Figma-compatible by design. Penpot carries the weight of a server-first architecture with 11x more code spread across 4 languages, which creates compounding maintenance burden. The tradeoff is that Penpot already has production collaboration and a plugin ecosystem, while Open Pencil is still building toward those.-Open Pencil is architecturally leaner — a single-process CanvasKit renderer in ~14.5K LOC of TypeScript, Figma-compatible by design. Penpot is a full-stack platform with ~299K LOC across Clojure, ClojureScript, Rust, and SCSS, plus a Docker service fleet. The tradeoff is that Penpot already has production collaboration, a plugin ecosystem, and server-side export, while Open Pencil is still building toward those.++Open Pencil is architecturally leaner — a single-process CanvasKit renderer in ~26K LOC of TypeScript, Figma-compatible by design. Penpot is a full-stack platform with ~299K LOC across Clojure, ClojureScript, Rust, and SCSS, plus a Docker service fleet. The tradeoff is that Penpot already has production collaboration, a plugin ecosystem, and server-side export, while Open Pencil is still building toward those.diff --cc packages/docs/guide/figma-comparison.mdindex 936859344,920bf6c57..990713a40--- a/packages/docs/guide/figma-comparison.md+++ b/packages/docs/guide/figma-comparison.md@@@ -6,7 -6,7 +6,7 @@@ Feature-by-feature comparison of Figma✅ Supported — feature works end-to-end · 🟡 Partial — core behavior exists, some sub-features missing · 🔲 Not yet implemented:::- **Coverage:** 85 of 152 Figma feature items addressed — 66 ✅ fully supported, 19 🟡 partial, 67 🔲 not yet. Last updated: 2026-03-01.-**Coverage:** 83 of 150 Figma feature items addressed — 64 ✅ fully supported, 19 🟡 partial, 67 🔲 not yet. Last updated: 2026-03-01.++**Coverage:** 87 of 152 Figma feature items addressed — 69 ✅ fully supported, 18 🟡 partial, 65 🔲 not yet. Last updated: 2026-03-03.## Interface & Navigation@@@ -27,8 -27,7 +27,8 @@@| Layer outlines view | 🔲 | Wireframe view of all layers || Custom file thumbnails | 🔲 | Thumbnail generated on export, but no custom thumbnail picker || Nudge value settings | 🔲 | Default 1px/10px; Figma allows custom small/big nudge values |-| AI tools | 🟡 | 26 AI tools via OpenRouter (create/modify/delete shapes, fills/strokes/effects, layout, constraints, components, groups, pages, variables); no AI-generated images or AI-powered search yet |+| App menu (browser mode) | ✅ | File, Edit, View, Object, Text, Arrange menus; Tauri uses native menus |- | AI tools | 🟡 | 10 tools via OpenRouter + unified tool definitions + eval command integration; no AI image generation yet |++| AI tools | 🟡 | 29 tools via OpenRouter + MCP server; no AI-generated images or AI-powered search yet |## Layers & Shapes@@@ -188,10 -187,10 +188,10 @@@| Feature | Status | Notes ||---------|--------|-------|| .fig file import | ✅ | Full Kiwi codec: 194 definitions, ~390 fields per NodeChange |- | .fig file export | ✅ | Kiwi encoding + Zstd compression + thumbnail generation; COMPONENT/COMPONENT_SET correctly mapped to SYMBOL for Figma round-trip |-| .fig file export | ✅ | Kiwi encoding + Zstd compression + thumbnail generation |-| Save / Save As | ✅ | ⌘S / ⇧⌘S with native OS dialogs (Tauri) |++| .fig file export | ✅ | Kiwi encoding + Zstd compression + thumbnail generation; COMPONENT/COMPONENT_SET mapped to SYMBOL for round-trip |+| Save / Save As | ✅ | ⌘S / ⇧⌘S; native dialogs (Tauri), File System Access API (Chrome/Edge), download fallback (Safari) |- | Figma clipboard (paste) | ✅ | Decode fig-kiwi binary from Figma clipboard |- | Figma clipboard (copy) | ✅ | Encode fig-kiwi binary that Figma can read |+ | Figma clipboard (paste) | ✅ | Decode Kiwi binary from Figma clipboard |+ | Figma clipboard (copy) | ✅ | Encode Kiwi binary that Figma can read || Sketch file import | 🔲 | .sketch file parsing || Image/SVG export | 🟡 | PNG/JPG/WEBP with scale selector and live preview; SVG/PDF not yet || Version history | 🔲 | Browse and restore previous versions |@@@ -208,15 -201,15 +208,15 @@@| Feature | Status | Notes ||---------|--------|-------|| Comments (pin, thread, resolve) | 🔲 | Planned for Phase 6 |--| Real-time multiplayer | 🔲 | Planned (Yjs-based) |++| Real-time multiplayer | ✅ | P2P via Trystero + Yjs CRDT, cursors, follow mode; no server required || Cursor chat | 🔲 | Inline chat bubbles at cursor || Branching & merging | 🔲 | Version branches for design files || Dev Mode (inspect) | 🟡 | Code tab shows JSX representation of selection; no CSS properties or handoff specs || Code Connect | 🔲 | Link design components to code || Code snippets | 🟡 | JSX export with syntax highlighting and copy; no CSS/Swift/Kotlin snippets || Figma for VS Code | 🔲 | Editor plugin integration |- | MCP server | 🔲 | Planned for Phase 5; 117-tool MCP server from figma-use |- | CLI tools | 🟡 | Headless CLI: info, tree, find, export, analyze (colors/typography/spacing/clusters), node, pages, variables; MCP server not yet |-| MCP server | 🔲 | Planned; porting 118 tools from figma-use (26 currently available as AI tools) |-| CLI tools | 🟡 | Headless CLI: info, tree, find, export, analyze (colors/typography/spacing/clusters), node, pages, variables, eval; MCP server not yet |++| MCP server | ✅ | @open-pencil/mcp with stdio + HTTP transports; 29 core tools + 3 file management tools |++| CLI tools | ✅ | Headless CLI: info, tree, find, export, analyze, node, pages, variables, eval; MCP server with stdio + HTTP |## Figma Draw