M31A builds with plain Node scripts, TypeScript project references, and esbuild. There is no separate monorepo build tool: npm run build drives scripts/build.js, which compiles each npm workspace.
Build commands
| Command | Effect |
|---|---|
npm run build | Compile all workspaces via scripts/build.js. |
npm run build:packages | Run the build script of each workspace. |
npm run bundle | Generate commit info, build browser MCP assets, run esbuild.config.js, copy bundle assets. |
npm run build:all | npm run build plus the sandbox image. |
npm run build:sandbox | Build the container sandbox via scripts/build_sandbox.js. |
npm run build:binary | Produce a SEA binary via scripts/build_binary.js. |
npm run generate | Generate git commit information used by the build. |
npm run clean | Remove generated artifacts with scripts/clean.js. |
npm run preflight | Clean, install, format, build, lint, typecheck, and test. |
TypeScript configuration
The root tsconfig.json is strict, uses NodeNext module resolution, targets modern ECMAScript, and enables composite project references with the react-jsx transform. Each workspace has its own tsconfig.json; imports must stay within package boundaries (enforced by ESLint).
Bundling
esbuild.config.js bundles packages/cli/index.ts into bundle/m31a.js, the npm package's bin target, with splitting: true and ESM output. It also builds the Ink worker entry point at bundle/worker/worker-entry.js and embeds the WASM loader. Native modules such as @lydell/node-pty and @github/keytar are external.
scripts/copy_bundle_assets.js copies Seatbelt .sb profiles, core policy TOMLs into bundle/policies/, bundled browser MCP assets, built-in skills into bundle/builtin/, extension examples into bundle/examples/, and any root docs/ directory. scripts/build_package.js also copies root docs into packages/core/dist/docs/ when present.
npm run bundle first runs npm run generate, builds @m31a/genai, @m31a/core, and @m31a/devtools, and builds the browser MCP assets for core before invoking esbuild.
Sandbox image
npm run build:sandbox builds ghcr.io/eshanized/m31a-sandbox:0.2.0 from the root Dockerfile. The container sandbox workflow is documented in Sandboxing.
Single-executable applications
npm run build:binary cleans dist/, re-bundles the CLI, copies the host ripgrep binary into bundle/vendor/ripgrep/, stages and signs native modules into bundle/native_modules/, and writes a bundle/manifest.json with SHA-256 hashes for every embedded file. It then produces dist/<platform>-<arch>/m31a (or m31a.exe on Windows).
On Node 25.5 and newer it uses native node --build-sea; older versions use --experimental-sea-config and postject with the standard SEA sentinel. macOS binaries are codesigned with APPLE_IDENTITY, Windows binaries use signtool, and Linux binaries are unsigned. SKIP_SIGNING=true bypasses signing.
The launcher sea/sea-launch.cjs extracts assets to a per-user runtime directory, verifies each hash, and launches m31a.mjs.
The release workflow builds binaries for:
linux-x64linux-arm64darwin-arm64darwin-x64win32-x64
sea/sea-launch.cjs is the launcher bootstrap; sea/sea-launch.test.js verifies it. SHA256SUMS is published with each release.
Generated files
| Path | Generator |
|---|---|
packages/cli/src/generated/ | Build-time commit information. |
packages/core/src/generated/ | Build-time generated sources. |
packages/devtools/src/_client-assets.ts | Embedded client assets. |
schemas/settings.schema.json | npm run schema:settings. |
Generated paths are ignored by git and removed by npm run clean.
Quality gates
npm run lint:ciruns the repository lint driver (scripts/lint.js).node scripts/lint.js --check-github-actions-pinningenforces 40-character SHAs for workflow actions.npm run typecheckchecks all workspaces and test projects.npm run test:ciruns workspace tests, script tests, and SEA launch tests.
See Testing for the full test matrix.
Next steps
See Architecture for the runtime view and Releases for published artifacts.