Contributor notes
Repository layout
Bun workspaces tie it together. The root package.json scripts are the entry points.
Rules for the core
- Pure functions over plain objects. Inputs are never mutated; outputs are new objects. No classes in the public API.
- No environment. Nothing under
src/coremay reference the DOM, timers,globalThis, or React. The SSR test imports both entry points in a bare process to enforce it. - Deterministic. Same input, same output, same strategy. Randomness has no place in a solver.
- Strategies are explicit. Every solver path ends in a named
SolveStrategy; adding a path means adding a name to the union and a fixture that reaches it. - Neutral naming. Ids, fixtures, and comments use generic layout words (
header,chart,sidebar,stat-1,group-a). No product names, page names, or ticket numbers anywhere in the public repository. - Document exports. The API reference is generated from JSDoc on exported declarations. An export without a doc comment shows up as a gap in the reference (the generator prints the list). Write the comment where the declaration is.
Rules for the React adapter
- Headless. Components render structure and data attributes, never visual styles beyond geometry.
- Minimal rerenders. State lives in the external store; components subscribe to slices with equality functions. A drag must not rerender the item list.
- Every gesture path is a thin wrapper over a core solver call with the rendered layout.
Tests
bun run check runs formatting, lint, type check, and the unit suites; it is what CI runs first.
Toolchain
Rslib builds the package, Rsbuild builds the examples, Rspress builds this site, Oxlint and Oxfmt lint and format, TypeScript 7 type-checks, Bun runs unit tests, Playwright runs browser tests. Changesets drive versions and changelogs: every user-facing change adds a changeset file (bun run changeset).
Making a change
- Add or adjust a fixture first (see adding solver fixtures).
- Make the change in the core; keep the strategy names accurate.
- Run
bun run checkandbun run bench --check. - If an export changed, update its JSDoc, then run
bun run generateinsidewebsite/and commit the regenerateddocs/api. - Add a changeset. Breaking changes go under a "Breaking" heading with a before/after.