Tool Commands and Environment Variables
Everything goes through just. The justfile at the root of the repository
is the documented interface; do not invent ad-hoc build steps when a recipe
exists. Typing just alone lists the recipes. What each test checks, and
which ones to run after a change, is in
Code Testing Suites.
What you need
Section titled “What you need”| Tool | For |
|---|---|
| CMake 3.28 or newer, Ninja, a C++23 compiler | the core, the engine and the command line tool |
just |
running the recipes |
| Python 3 | the contract tests, the CLI tests, the regression suite, the API generator |
| Node 22 | the app; Node 22.22 or newer for the website |
| LLVM (optional) | just check (clang-tidy) |
| Emscripten (optional) | just site-demo, the engine as WebAssembly |
| Upstream BurrTools, built (optional) | just burrtools-compare and just bench; at ../burr-tools or BURRTOOLS_DIR |
A first build
Section titled “A first build”just build # the dev preset, into build/devjust test # unit and contract tests, without the slow casesjust build release # the optimized engine the app and its tests usejust app-install # the app's packages (npm ci)just app-dev # run the app against the dev engineThe core
Section titled “The core”just build [preset] # dev (default), release, asan, tsan; macOS also release-x64, release-arm64just test [preset] # unit + contract tests without [slow]; the quick loopjust test-all [preset] # everything; run before calling work donejust test-asan # Address + UndefinedBehavior sanitizersjust test-tsan # ThreadSanitizer on the [parallel] cases, then the contract suitejust gate [groups] # every suite one after another, with a table of what passedjust check-names # no name from before the rename to sl / SHAPELOGIC_ is backjust check [files] # the names check, then clang-tidy over the project's own sources, or those whose path matchesjust clean # remove every build directoryThe presets are in CMakePresets.json: base (shared settings), dev,
release, release-x64, release-arm64, asan, tsan and wasm.
Warnings are errors in dev and release. On macOS every preset builds
for macOS 13 (CMAKE_OSX_DEPLOYMENT_TARGET in base), the lowest the
app’s Electron runs on, so a library call newer than that fails to compile.
Each preset builds into
build/<preset>/: the test binary at build/<preset>/tests/sl_tests, the
engine at build/<preset>/engine/shapelogic_engine, the CLI at
build/<preset>/cli/shapelogic_cli.
The regression suite
Section titled “The regression suite”The regression suite checks the solver’s answers against the recorded ones, on puzzle files of this repository; see The regression suite. Comparing with upstream BurrTools runs only on request.
just regress [--tier …] # assembly and solution counts, levels and moves against the recorded onesjust regress-text # the CLI's text output against the recorded runs, byte for bytejust burrtools-compare # on request: speed and counts against upstream BurrTools (../burr-tools)just bench [--set …] # speed benchmarksThe Python module
Section titled “The Python module”just python-test [preset] # python/tests on a preset's modulejust python-wheel # the wheel in build/wheel, installed into a fresh venv and testedThe module is built when CMake finds Python’s headers (SL_PYTHON=AUTO);
set -DSL_PYTHON=ON to require it or OFF to skip it.
The app
Section titled “The app”just app-install # npm ci in web/just app-gen # web/src/engine/api.generated.ts from api/*.jsonjust app-check # type checks (node, renderer and e2e projects), ESLint, Prettierjust app-test # unit tests; the engine tests too when build/release existsjust app-dev # the app with live reload (electron-vite dev)just app-e2e [args] # build, then the Playwright end-to-end tests; args go to Playwrightjust app-dist [--dir] # the packaged app for this platform, in web/dist; --dir unpacked onlyjust app-smoke # the packaged app's smoke test (after just app-dist --dir)Inside web/, the npm scripts behind these are gen, check, test,
dev, e2e, dist, and also format (Prettier writes), record (the
fake engine’s sessions recorded again after a change to what the engine
sends), build (electron-vite into out/) and demo (the website’s demo).
just app-e2e -g picking runs the tests matching a name;
--update-snapshots records the reference screenshots again. The app
recipes clear ELECTRON_RUN_AS_NODE, which some editors’ terminals set and
which turns Electron into plain Node.
The website
Section titled “The website”just site-dev # http://localhost:4321 with live reloadjust site-build # build, check the links, check the app's Help URLsjust docs-screenshots # retake the guide's screenshots from the built app (after just build release)just site-demo [--check] # rebuild the browser demo (needs Emscripten); --check drives it in ChromeInside site/, npm run dev, npm run build and npm test are the
scripts behind these.
Releases
Section titled “Releases”just release # the next version and the release stepsjust release v1.4 # a new release: check, push the tag, make the draft releasejust release v1.3.1 # a patch: updates the published v1.3 release when publishedjust release-fetch v1.4 # a copy of a release's installers in release/v1.4Creating a New Release explains the whole flow.
Environment variables
Section titled “Environment variables”| Variable | Effect |
|---|---|
BURRTOOLS_DIR |
where upstream BurrTools is checked out and built, for just burrtools-compare and just bench |
SHAPELOGIC_ENGINE |
the engine binary the app in development and the engine tests use; otherwise build/dev/engine/shapelogic_engine, else the release one |
SHAPELOGIC_CALL_LOG |
a file every call the renderer makes is logged to, with how it ended; the e2e tests read it |
SHAPELOGIC_AUTOSAVE_SECONDS |
the least time between two rescue copies of a running solve (a minute without it), for the e2e tests |
SHAPELOGIC_BACKGROUND |
the app’s windows stay hidden and it has no Dock icon, so nothing covers the app in front; the e2e tests set it (set it empty, SHAPELOGIC_BACKGROUND=, to watch a run) |
SHAPELOGIC_USER_DATA |
moves the app’s data directory (settings, recent files, the rescue copy); the only switch a packaged app takes. Its name up to v2.1, BT_USER_DATA, still works when it is not set |
SHAPELOGIC_PACKAGED_APP |
another executable for just app-smoke to test |
SHAPELOGIC_VERSION |
the version to build (v1.4 or 1.4.0) instead of the newest git tag’s; the Release workflow sets it from the tag |
CSC_NAME, CSC_LINK, CSC_KEY_PASSWORD, APPLE_API_KEY, APPLE_API_KEY_ID, APPLE_API_ISSUER |
code signing and notarisation for just app-dist; see web/README.md |
A packaged app ignores every development switch but SHAPELOGIC_USER_DATA
(web/src/main/security.ts). Nothing in core/ reads the environment: the
original’s environment switches became fields of the options structs. The
command line tool reads a few for its sliding and Panex searches
(SHAPELOGIC_SLIDE_DIR and others); see
Environment variables in the
Command Line Tool page.
Setting a variable
Section titled “Setting a variable”Each variable is read when a command starts, so set it in the terminal you
run the command from. BURRTOOLS_DIR is the example here; the others work the
same way.
For one command only, put it in front of the command (macOS and Linux):
BURRTOOLS_DIR=/path/to/burr-tools just burrtools-compareFor the rest of the terminal session:
export BURRTOOLS_DIR=/path/to/burr-toolsFor every new terminal, add that export line to your shell’s startup file
(~/.zshrc for zsh, the macOS default; ~/.bashrc for bash), then open a
new terminal.
On Windows, in PowerShell:
$env:BURRTOOLS_DIR = "C:\path\to\burr-tools" # this session onlysetx BURRTOOLS_DIR "C:\path\to\burr-tools" # every new terminal (not this one)To check it, echo $BURRTOOLS_DIR prints the value ($env:BURRTOOLS_DIR in
PowerShell). Without it, the comparison uses ../burr-tools.