Claude Code restored for Node.js — extracted from official Bun SEA binaries and patched for Node.js runtime compatibility.
Starting from v2.1.113, Anthropic ships Claude Code as native Bun binaries instead of Node.js-runnable JavaScript. This project restores the npm package format so it can run under Node.js.
npm install -g @cometix/claude-code- Downloads official Claude Code binaries from all 8 platforms (darwin/linux/win32 × arm64/x64)
- Extracts the embedded JavaScript and native modules from Bun SEA format
- Patches the code for Node.js compatibility (hardcoded paths, Bun-only APIs, module loading)
- Reassembles into a standard npm package with
vendor/dependencies
| Patch | Description |
|---|---|
| P1 | fileURLToPath/createRequire hardcoded build paths → __filename/require |
| P2 | Bun.Transpiler guard → graceful null return |
| P3 | /$bunfs/root/ native module requires → vendor/ fallback |
| P5 | EMBEDDED_SEARCH_TOOLS guard restored — enables Grep/Glob Tool by default; set EMBEDDED_SEARCH_TOOLS=true to switch to bfs/ugrep Bash shadow mode (auto-detects binary availability) |
| P6 | Bun polyfill shim injection (global Bun API stubs) |
| P7 | HttpsProxyAgent exposed on globalThis for Node.js ws proxy support |
| P8 | AF_() shadow function patched — resolves system bfs/ugrep via which instead of ARGV0 multicall |
Claude Code has two search paths, controlled by the EMBEDDED_SEARCH_TOOLS environment variable:
| Mode | Env setting | Search method | Requirements |
|---|---|---|---|
| Tool mode (default) | unset | Grep/Glob Tool → ripgrep (bundled) | None |
| Shadow mode | =true |
Bash find → bfs, grep → ugrep |
bfs + ugrep installed |
In Tool mode, the model uses the built-in Grep and Glob tools powered by bundled ripgrep. In Shadow mode, find/grep commands in the Bash tool are redirected to bfs/ugrep for enhanced search.
If EMBEDDED_SEARCH_TOOLS=true is set but bfs/ugrep are not installed, it automatically falls back to Tool mode.
# Tool mode (default, recommended)
claude
# Shadow mode (requires: brew install bfs ugrep)
EMBEDDED_SEARCH_TOOLS=true claudecli.js Node.js entry point
sdk-tools.d.ts SDK type definitions
vendor/
├── ripgrep/ Code search (6 platforms)
├── audio-capture/ Voice input (6 platforms)
└── seccomp/ Linux sandbox (arm64 + x64)
A GitHub Actions workflow checks for new Claude Code versions every 6 hours, builds the restored package, and publishes to both GitHub Releases and npm.
This project redistributes Claude Code under Anthropic's terms. Vendored dependencies retain their original licenses (ripgrep: Unlicense/MIT, seccomp: Apache-2.0).