2026-03-03 14:24:45 +00:00
|
|
|
# Contributing
|
|
|
|
|
|
|
|
|
|
## Setup
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
git clone https://github.com/open-pencil/open-pencil.git
|
|
|
|
|
cd open-pencil
|
|
|
|
|
bun install
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Development
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
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:
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
bun run check # oxlint + typecheck
|
|
|
|
|
bun run format # oxfmt with import sorting
|
|
|
|
|
bun run test:dupes # jscpd < 3% duplication
|
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 16:00:40 +00:00
|
|
|
bun run test:unit # bun:test (tests/engine/)
|
|
|
|
|
bun run test # Playwright E2E (auto-starts dev server)
|
2026-03-03 14:24:45 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## 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)
|
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 16:00:40 +00:00
|
|
|
- `packages/acp` — ACP (Agent Client Protocol) server
|
|
|
|
|
- `packages/docs` — VitePress documentation site (openpencil.dev)
|
2026-03-03 14:24:45 +00:00
|
|
|
- `src/` — Tauri/Vite desktop editor
|
|
|
|
|
|
|
|
|
|
## Conventions
|
|
|
|
|
|
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 16:00:40 +00:00
|
|
|
See [`AGENTS.md`](./AGENTS.md) for the full architecture reference, code conventions, and quality checklist. Key points:
|
|
|
|
|
|
2026-03-03 14:24:45 +00:00
|
|
|
- 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-*>`)
|
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 16:00:40 +00:00
|
|
|
- Use existing deps and Reka UI components before hand-rolling (see AGENTS.md → Code quality)
|
2026-03-03 14:24:45 +00:00
|
|
|
|
|
|
|
|
## 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.
|