- Root uses Bun workspaces. Code lives under
packages/withcli(Markdown → Figma Slides CLI, WebSocket server) andplugin(Figma plugin bundle withcode.ts+ui.html). Tests sit inpackages/cli/src/*.test.ts. Reference Markdown samples inexamples/, docs source inpackages/docs/src/content/docs/. Build outputs land in each package’sdist/.
- Install deps:
bun install. - Build all packages:
bun run build(runs tsup for the CLI and esbuild for the plugin). - Dev/watch:
cd packages/cli && bun run devfor the CLI;cd packages/plugin && bun run watchfor plugin reloads. - Type-check everything:
bun run typecheck. - Lint/format via Biome:
bun run lint(check),bun run format(write). Prefer format before committing. - Tests:
cd packages/cli && bun test(usesbun:test; mirrors the*.test.tsfiles insrc/).
- TypeScript with ES modules. Follow Biome defaults: 2-space indentation, double quotes, required semicolons. Config lives in
biome.json. - Keep CLI utilities pure and reusable under
packages/cli/src/; add WebSocket-facing code inws-server.ts. - Use
camelCasefor functions/variables,PascalCasefor types/interfaces, andkebab-casefor file names.
- Add
*.test.tsalongside the logic inpackages/cli/src/; prefer unit tests with clear inputs/outputs (e.g., color normalization, gradient parsing). - When touching parsing or rendering rules, include edge cases (whitespace, shorthand colors, gradient angles). Avoid relying on network/Figma in tests.
- Run
bun testplusbun run lintbefore opening a PR.
- Commit messages: short, imperative summaries; prefix with a scope when helpful (e.g.,
feat:,fix:,chore:). Keep changes cohesive per commit. - Pull requests: include a concise description, testing notes (commands run), and link related issues. For plugin UI/visual tweaks, attach a screenshot or brief demo steps. Ensure builds succeed (
bun run build) before requesting review.
- The CLI listens on port 4141 for the plugin; avoid exposing it publicly. Do not commit Figma tokens or personal files from
dist/. Regeneratedist/assets via the build commands rather than checking in manual edits.