Code Base
This section is for developers who want to read, build or change ShapeLogic. The rest of the user guide explains how to use the app; these pages explain how it is made.
ShapeLogic is three programs over one library:
the desktop app (web/: Electron + TypeScript + three.js) │ JSON-RPC 2.0 over stdio, binary frames for meshes ▼ shapelogic_engine (engine/) shapelogic_cli (cli/) shapelogic (python/, the Python module) │ │ │ └──────────────┬──────────────┴───────────────────────────┘ ▼ libsl_core (core/shapelogic/) app Document, undo/redo, editing commands, queries, playback, explorers solve assemblers, disassemblers, rotation rules, SolveSession mesh half-edge meshes and drawing meshes for all grids io XML, gzip, .xmpuzzle reader/writer model Puzzle, Problem, Assembly, Disassembly, Solution grid grid types, voxel spaces, symmetry tables base StopToken, SolveState, Result/Error, SL_ASSERT, thread pool- The core (
core/) is a C++ library. It knows nothing about windows, JSON or files on disk beyond reading and writing puzzles. It never prints and has no global state. - The engine (
engine/) wraps one open puzzle (aDocument) in a process that speaks JSON-RPC over its standard input and output. Every feature the app offers is a method of the engine. - The app (
web/) is an Electron application. Its window is a sandboxed web page that can only talk to the engine. The 3D view is three.js. The app never computes what the engine can answer: cells, fits, counts, meshes and sort orders all come from the engine. - The command line tool (
cli/) and the Python module (python/) use the same core directly, without the engine. - The website (
site/) is this user guide and the landing page, built with Astro Starlight, plus a browser demo of the app with the engine compiled to WebAssembly.
ShapeLogic is a rebuild of BurrTools. Its answers were checked against the original’s while it was ported, and a regression suite keeps them: it compares the solver with the answers recorded then. Many files begin with a comment naming the original file they were ported from.
The pages in this section
Section titled “The pages in this section”- Languages and Tools: C++23, TypeScript, Electron, three.js, CMake, just, and the libraries each part depends on.
- Repository Layout: what is in each directory.
- Tool Commands and Environment Variables:
the
justrecipes, the npm scripts, the build presets and the environment variables. - Code Testing Suites: every kind of test by name, what it checks, the command that runs it, and what to run after a change.
- Where the Code Lives: the files and classes behind each feature, from the voxel grids to the Solver tab.
- Engine Protocol: how the app and the engine talk, and the rules every call follows.
- Example Solve Flow: what happens, function by function, when you press Solve on a Brick puzzle.
- Conventions and Further Reading: the code rules, the testing rules, and the documents inside the repository that go deeper.
- Creating a New Release:
just release, for a new version or a patch to the current one, and what runs on GitHub.
Reading order
Section titled “Reading order”If you are new, read the pages in the order above. The Example Solve Flow ties the others together: it crosses every layer, from a button in the web page to the threads of the search and back.
The repository’s own documents go further than these pages. Start with
AGENTS.md at the root (the working rules), then docs/ARCHITECTURE.md
(a map of every module, file by file, and its rules) and the decision
records in docs/decisions/; the hand-off notes in docs/handoff/ are the
history. The engine’s methods are
documented in docs/API.md, generated from the schema in api/.