mbun | Rewrite Bun in MC++
mbun is a modular C++26 JavaScript runtime built with mcpp — a rewrite of Bun in MC++ that is compatible with both Node.js and Bun. Bun APIs and bun:test, node:* built-ins, CommonJS/ES modules, and the npm package ecosystem run in one executable.
Why rewrite Bun in MC++?
- "Rewrite" performance art, reprised — Rewrite Bun in Rust
- mcpp build tool + modular C++ engineering validation — stress-testing the mcpp build tool, C++26, and C++ Modules for real-world usability in a 90+-member module workspace.
- Validating and exploring AI-agent-driven development & collaboration — AI agents participate in the whole development and collaboration loop, as an end-to-end experiment: validating ideas, surfacing the problems you actually hit, and finding out how humans and agents work together on a large codebase.
Caution
mbun is an experimental, source-first project — do not use it in production yet. The goal is useful compatibility in real applications, measured against the native Bun and Node.js test corpora rather than API checklists.
Install xlings, then install mcpp with it (toolchains are downloaded automatically into an isolated sandbox):
curl -fsSL https://raw.githubusercontent.com/openxlings/xlings/main/tools/other/quick_install.sh | bash
xlings install mcpp -yBuild mbun and run the smallest example:
git clone https://github.com/Sunrisepeak/mbun
cd mbun
git submodule update --init --recursive
mcpp build
mcpp run -- --version # mbun 2026.07.18.0 + the compatible bun/node versions
mcpp run -- examples/common/hello.tsThe same executable runs both API families natively:
# Node.js: node:http built-in + CommonJS
mcpp run -- examples/node/http-server.js
# Bun: Bun.serve + TypeScript
mcpp run -- examples/bun/http-server.tsEach starts a server on http://127.0.0.1:3000/.
Express is the most widely used Node.js web framework. mbun installs its npm dependencies itself and runs it:
mcpp run -- --cwd examples/node/express install
mcpp run -- --cwd examples/node/express server.jsElysia is a popular Bun-native web framework, running on the same executable:
mcpp run -- --cwd examples/bun/elysia install
mcpp run -- --cwd examples/bun/elysia server.tsOpen http://127.0.0.1:3000/ to see each demo page.
mbun's goal #3 is to explore AI-agent-driven development and collaboration. That
model is written up as hagent — an AI Agent open-source collaboration spec
(human + agent) that lives in hagent/ and is dogfooded here.
Its core thesis: agents are the execution engine; the builder — the human who
runs them — creates and judges (architecture, decisions, taste, norms). Every
action is attributed to a builder, and no change is "done" without reproducible
evidence.
Everything goes through your coding agent — start it in the repo root and it
auto-loads AGENTS.md and the relevant skills, so it already knows the spec.
Pick the level that fits you, and always review what the agent produced before
opening a PR.
- Report & discuss — hit a bug or have an idea? Have your agent file an
issue or discussion following the reporting SOP: software versions, error
output, initial analysis, and references — with local privacy scrubbed
(usernames, tokens). →
issue-reporting - Verify & review — reproduce reported bugs and confirm whether they're real, add findings; help verify issues and PRs; review others' PRs.
- Develop — pick a task and build it, issue-first (bugfix / refactor / new
feature — new features need an issue discussion and a design doc under
.agents/docs/). →dev-process,tdd-workflow
More: hagent overview · charter · contributing · agents · labels.
Elevated trust is a ladder — humans and agents earn it by the same rules (charter §4). Tiers above committer are still being defined.
| Role | Permission | How to apply | Holders |
|---|---|---|---|
| Triager | Triage, label, verify issues & PRs, run CI | Self-apply after ≥ 3 merged PRs | — |
| Committer | Write (push / merge) | Module background + significant contributions; maintainer approval | — |
| Module maintainer | A module's review & decisions | — | — |
| Project maintainer | Governance, protected surfaces | — | @sunrisepeak |
Measured 2026-08-03 by the runners in tools/integration/, both corpora executed
in full on one frozen binary (f65f960b7ac7d212…). Nothing unsupported is
counted as a pass.
| Target | Result | Rate |
|---|---|---|
Node.js native tests (compat/node/test/parallel) |
3,267 / 4,433 files pass | 73.7% |
| Node.js native tests, excluding files that skip themselves | 3,267 / 3,919 files pass | 83.4% |
Bun native full corpus (compat/bun/test) |
1,076 / 1,902 files fully green | 56.6% |
| Bun corpus, excluding files with no runnable tests here | 1,076 / 1,806 files fully green | 59.6% |
| Both corpora combined | 4,343 / 6,335 files | 68.6% |
| Both corpora combined, runnable only | 4,343 / 5,725 files | 75.9% |
| Elysia test suite (measured 2026-07-30, not re-run since) | 1,522 pass / 3 fail | 99.8% |
The "excluding" rows are not a softer denominator: a file counts as excluded only when it reports no runnable tests on this platform — it skipped itself, it has no tests upstream, or it needs a service this machine does not provide. Those denominators grew this round (Node 3,898 → 3,919) because 21 files that used to skip themselves now run.
What stands between here and 100%, counted rather than estimated. 514 Node files decline to run, and the reasons are not interchangeable:
| Self-skip reason | Files | Nature |
|---|---|---|
| QUIC not enabled | 238 | no node:quic subsystem; node's own build disables it by default too |
| V8 inspector disabled | 180 | needs a CDP backend; JSC speaks the WebInspector protocol instead |
| missing ESLint | 29 | node's own lint tests; ESLint is not vendored here |
| no OpenSSL CLI | 10 | crypto build configuration |
| requires Amaro | 6 | TypeScript loader |
| Windows-specific | 6 | unreachable on Linux by construction |
| other (Temporal, debug-only builds, cipher availability) | 45 | assorted |
The two large blocks are priced. QUIC needs no protocol work — node builds it on vendored ngtcp2, and the linked OpenSSL 3.5.1 already exports everything that backend calls — but it does need node's ~19k-line binding re-expressed against JSC. The inspector block has no per-file gate: all of it hangs on one global capability flag, so no partial slice can score, and flipping it early converts skips into failures.
- mcpp — the modular C++26 build tool and package manager mbun is built with
- Bun — the JavaScript runtime whose APIs,
bun:testrunner, and native test corpus mbun targets (bun.com) - Node.js — the
node:*built-ins, module systems, and native test corpus mbun targets (nodejs.org) - Express — Node.js web framework used in
examples/node/express(expressjs.com) - Elysia — Bun-native web framework used in
examples/bun/elysia(elysiajs.com) - WebKit JavaScriptCore — the JavaScript engine embedded by mbun (as by Bun)
- Linux x86_64 is the primary validated target: it is the only one the corpus numbers above were measured on, and the only one whose CI runs the workspace unit tests and the example-app smoke.
- macOS arm64 builds and runs. CI compiles the whole workspace and executes the
binary on
macos-latest; the wider test steps there are still being observed and are not yet gates. The numbers above have not been re-measured on it, so treat them as Linux figures until they are. - Windows is not built or tested. The source carries
_WIN32branches, but nothing has ever been compiled for it here, so that is intent rather than support. - JavaScriptCore and native dependencies are built through mcpp packages.
- Compatibility varies by API, package, and execution mode; passing the demos does not imply full Bun or Node.js compatibility.
- No prebuilt binary or stable release package is provided yet.
mbun code is licensed under MIT — the same license as Node.js and Bun. Third-party components (JavaScriptCore, OpenSSL, …) and the Bun / Node.js test corpora keep their upstream licenses — they are listed together at the end of LICENSE.