openpencil/CONTRIBUTING.md
Danila Poyarkov 661b83e749 Port analyze/diff tools from figma-use, split tools into domain files
Analyze: colors, typography, spacing, clusters
Diff: diff_create (tree diff), diff_show (preview changes)
Utility: get_components, get_current_page, arrange, node_to_component

Split schema.ts (2600 lines) into read, create, modify, structure,
variables, vector, analyze, registry — each under 600 lines.

Clean up inline types (use Color, Vector, SceneNode from existing defs).
Update AGENTS.md and CONTRIBUTING.md with code quality guidelines.
2026-03-05 19:16:23 +03:00

1.7 KiB

Contributing

Setup

git clone https://github.com/open-pencil/open-pencil.git
cd open-pencil
bun install

Development

bun run dev          # Vite dev server on localhost:1420
bun run tauri dev    # Tauri desktop app with hot reload

Quality checks

Run all of these before submitting a PR:

bun run check        # oxlint + typecheck
bun run format       # oxfmt with import sorting
bun run test:dupes   # jscpd < 3% duplication
bun run test:unit    # bun:test (tests/engine/)
bun run test         # Playwright E2E (auto-starts dev server)

Project structure

  • packages/core — scene graph, renderer, layout, codec (zero DOM deps)
  • packages/cli — headless CLI for .fig inspection and export
  • packages/mcp — MCP server for AI tools (stdio + HTTP)
  • packages/acp — ACP (Agent Client Protocol) server
  • packages/docs — VitePress documentation site (openpencil.dev)
  • src/ — Tauri/Vite desktop editor

Conventions

See AGENTS.md for the full architecture reference, code conventions, and quality checklist. Key points:

  • Bun runtime, not Node
  • Tailwind 4 for styles, no inline CSS or <style> blocks
  • No any, no ! non-null assertions
  • @/ import alias for app code, relative imports within core
  • Use crypto.getRandomValues(), never Math.random()
  • Icons via unplugin-icons (<icon-lucide-*>)
  • Use existing deps and Reka UI components before hand-rolling (see AGENTS.md → Code quality)

Test fixtures

.fig fixtures in tests/fixtures/ are Git LFS. Use git push --no-verify to skip the slow LFS pre-push hook unless you changed .fig files.

Commits

Follow the existing style in git log. Keep messages concise. Update CHANGELOG.md for user-facing changes.