Skip to content

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 ​

CommandEffect
npm run buildCompile all workspaces via scripts/build.js.
npm run build:packagesRun the build script of each workspace.
npm run bundleGenerate commit info, build browser MCP assets, run esbuild.config.js, copy bundle assets.
npm run build:allnpm run build plus the sandbox image.
npm run build:sandboxBuild the container sandbox via scripts/build_sandbox.js.
npm run build:binaryProduce a SEA binary via scripts/build_binary.js.
npm run generateGenerate git commit information used by the build.
npm run cleanRemove generated artifacts with scripts/clean.js.
npm run preflightClean, 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-x64
  • linux-arm64
  • darwin-arm64
  • darwin-x64
  • win32-x64

sea/sea-launch.cjs is the launcher bootstrap; sea/sea-launch.test.js verifies it. SHA256SUMS is published with each release.

Generated files ​

PathGenerator
packages/cli/src/generated/Build-time commit information.
packages/core/src/generated/Build-time generated sources.
packages/devtools/src/_client-assets.tsEmbedded client assets.
schemas/settings.schema.jsonnpm run schema:settings.

Generated paths are ignored by git and removed by npm run clean.

Quality gates ​

  • npm run lint:ci runs the repository lint driver (scripts/lint.js).
  • node scripts/lint.js --check-github-actions-pinning enforces 40-character SHAs for workflow actions.
  • npm run typecheck checks all workspaces and test projects.
  • npm run test:ci runs 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.

Built with VitePress. Powered by NVIDIA NIM.