spinagram
Reference

Development

Work on spinagram itself.

git clone https://github.com/dangerousplay/spinagram && cd spinagram
uv sync --all-extras && uv run pytest
uv run ruff check src tests examples
node tests/js/figma_mock.mjs out/figma/<slug>-01.js     # dry-run a Figma script on a mock Plugin API

uv sync builds the Rust engine (rust/, compiled with maturin into spinagram._core), so it needs a Rust toolchain; it rebuilds whenever a Rust source changes. SPINAGRAM_RUST=0 runs the pure-Python reference engine instead. rust/README.md covers the Rust tests, lints, Verus proofs and parity checks.

The editor canvas runs the Rust core as WebAssembly (rust/spinagram-wasm). Building the web bundle needs it built first: rustup target add wasm32-unknown-unknown, cargo install wasm-bindgen-cli --locked (the version of the wasm-bindgen crate in rust/Cargo.lock), then bash rust/spinagram-wasm/build.sh, which writes web/src/wasm/. cd rust/spinagram-wasm && bun test runs its tests. rust/README.md has the details.

Feature specs live in .specs/ (spec-driven: project, then spec, design and tasks per feature).

Live UI frontend

Source is in web/ (React + TypeScript + Vite + Tailwind CSS v4, built with bun):

cd web
bash ../rust/spinagram-wasm/build.sh   # the canvas needs the wasm build in web/src/wasm
bun install && bun run dev      # proxies /api to `spinagram serve --port 8765`
bun run build                   # writes src/spinagram/ui/static/ (the .wasm included)

The built bundle is not committed: src/spinagram/ui/static/ is ignored by git. spinagram serve shows a placeholder page until you build it, and the one test that needs the real bundle skips. CI builds it once (the web job), and the wheel and sdist jobs download that build into place before maturin runs, so every wheel and the sdist carry it (include under [tool.maturin] in pyproject.toml keeps the ignored files in the archives). To build a wheel or an sdist yourself, run bun run build first. CI uses the bun version pinned as BUN_VERSION in .github/workflows/ci.yml with bun install --frozen-lockfile; an older bun ignores the lockfile and resolves other versions. Without upgrading bun: bunx bun@1.4.2 install --frozen-lockfile then bunx bun@1.4.2 run build.

Docs

This site is a Fumadocs app in docs/ (Next.js, static export). The search index is built at export time, so search works on GitHub Pages without a server. Every push to main deploys it.

cd docs
bun install && bun run dev      # http://localhost:3000
bun run build                   # static site in docs/out/

Pages are MDX files in docs/content/docs/, one folder per sidebar section; each folder's meta.json sets its title, icon and page order. Code samples are pulled from examples/ with <include>, so they always match the files that the tests run.

The diagrams on these pages are rendered by spinagram itself, from the files in examples/. After changing an example or the renderer, refresh every image the docs show:

bash docs/scripts/render_assets.sh

Releasing

Commits follow Conventional Commits: feat, fix, docs, test, refactor, perf, build, ci, chore. git-cliff turns them into CHANGELOG.md (configuration in cliff.toml).

uv version --bump minor
uvx git-cliff --tag "v$(uv version --short)" -o CHANGELOG.md
git commit -am "chore(release): v$(uv version --short)"
git tag "v$(uv version --short)" && git push --follow-tags

The tag triggers CI, publishes the platform wheels and the sdist to PyPI with trusted publishing and creates a GitHub release whose notes come from git-cliff (uvx git-cliff --latest --strip header).

On this page