Skip to content

Languages and Tools

ShapeLogic has a C++ core, a TypeScript desktop app, a Python module and an Astro website. This page lists what each part is built with and why.

The core, the engine and the command line tool

Section titled “The core, the engine and the command line tool”
Language C++23 (std::expected, ranges), in namespace sl
Build CMake 3.28 or newer with presets, the Ninja generator
Task runner just (the justfile at the root is the documented interface)
Compilers Apple clang 17, GCC 13, MinGW-w64 GCC 13, Emscripten 3.1 or newer
Tests Catch2 v3, one binary sl_tests; Python scripts for the engine’s contract tests and the CLI
Lint clang-tidy (optional, needs LLVM); .clang-format gives the style, nothing enforces it
Sanitizers AddressSanitizer with UndefinedBehaviorSanitizer (asan preset), ThreadSanitizer (tsan preset)

Decision record docs/decisions/0001-language-and-build.md explains the choice: the code is ported from BurrTools, which is C++, so porting stays mechanical and the algorithms keep their behavior.

Every dependency is fetched by CMake (FetchContent), pinned to an exact release and hash in cmake/Dependencies.cmake. A dependency is added in the stage that first needs it, and none of them is used in core/ beyond zlib, zstd and Manifold.

Library Version Used for Used by
zlib 1.3.1 .xmpuzzle files are gzip-compressed XML core/io
zstd 1.5.7 the files a sliding search writes to disk are compressed core/base (compress.cpp)
nlohmann/json 3.12.0 the engine’s JSON-RPC messages engine/ only
Manifold 3.5.2 the STL meshes of the prism, rhombic and tetra-octa grids core/mesh
Catch2 3.16.0 the unit tests tests/unit
pybind11 3.0.0 the Python module, when it is built python/

The XML parser, the gzip wrapper, the dancing-links matrix, the SIMD covers and the meshers are the project’s own code, ported from the original.

macOS (Apple silicon and Intel), Linux x86-64 and Windows x86-64 (built with MinGW). SIMD code is gated behind runtime detection with a scalar fallback: AVX2 and AVX-512 on x86-64, NEON on arm64. The engine also compiles to WebAssembly with Emscripten (the wasm preset) for the website’s demo.

Language TypeScript, strict, with noUncheckedIndexedAccess; only erasable syntax (no enum, no namespace), so Node can run the tools by stripping types
Runtime Electron 44 (Node 22 for the tools)
Bundler electron-vite 5 over Vite 7: the main process and the preload bundled for Node, the renderer by Vite
3D three.js 0.186 (the only runtime package; it is bundled into the renderer)
UI framework none: plain DOM with template strings that re-render a card from state, taken over from the design mockup (docs/mockup/index.html)
Lint and format ESLint’s strict type-checked rules, Prettier
Unit and engine tests Vitest
End-to-end tests Playwright’s Electron driver
Packaging electron-builder: a .dmg and .zip on macOS, an NSIS installer on Windows, an AppImage and .deb on Linux

The exact versions are pinned in web/package.json. Decision record docs/decisions/0013-web-front-end.md settles the shape of the app: one engine process per window, a sandboxed renderer that reaches the engine only through window.sl, and the mockup’s code as the basis.

The engine’s TypeScript types are not written by hand. web/tools/gen-api.ts generates web/src/engine/api.generated.ts from the JSON Schema in api/, and a unit test fails when the generated file is stale.

The methods and events of shapelogic_engine are defined once, as JSON Schema 2020-12, in api/*.json. A small Python script, api/apischema.py, checks the schema and validates messages against it with no packages installed, by using only a subset of the keywords. The schema is the source for three things: the reference docs/API.md (generated by api/gen_api_md.py), the contract tests, and the app’s types.

python/ builds shapelogic, a module with the classes and names of the original BurrTools Python module over the new core. It is built with pybind11 when CMake finds Python’s headers (SL_PYTHON=AUTO), and python/pyproject.toml builds a wheel with scikit-build-core.

Framework Astro 7 with Starlight 0.42 (this guide) and a hand-written landing page
Search Pagefind, which Starlight builds in
Link check starlight-links-validator fails the build on a broken internal link
Hosting Cloudflare Workers Builds, deploying from the main branch; site/wrangler.jsonc
Demo the app’s renderer built for the browser over the engine compiled to WebAssembly, in site/public/demo/

Five GitHub Actions workflows live in .github/workflows/. None runs on a plain push to main.

  • Release (release.yml) builds the installers for Linux, Windows and macOS when a version tag is pushed (just release vX.Y pushes it), or by hand. The macOS builds are signed, notarised and stapled. The app’s version is the tag’s.
  • Publish (publish.yml) runs at the end of a Release run on a tag: it renames the installers and attaches them to the tag’s draft GitHub release, which a maintainer then publishes.
  • Staple (staple.yml) staples the notarisation tickets onto a Release run’s .dmg and .zip when Apple took longer than Release waited, then publishes.
  • Patch (patch.yml) runs when a patch release (vX.Y.Z) is published: it folds it into the release it fixes, which moves to the new tag with the new installers and notes, so a small fix updates the existing release page instead of adding one.
  • Site (site.yml) builds this website on pull requests that touch it, checks its links and checks that the pages the app’s Help menu opens still exist. Cloudflare does the actual deploy.

Creating a New Release explains how the first four are used to make a release.