by fazxes
Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster through natural language commands. Rebuilt from leaked source.
# Add to your Claude Code skills
git clone https://github.com/fazxes/Claude-codeDisclaimer: This repository contains proprietary source code belonging to Anthropic that was unintentionally exposed via a source map file (
.js.map) included in the official@anthropic-ai/claude-codenpm package. This repository is provided strictly for educational and research purposes — to study the architecture, design patterns, and engineering of a production-grade AI coding agent. This project is not affiliated with, endorsed by, or authorized by Anthropic. If you are a representative of Anthropic and wish to have this repository removed, please open an issue or contact the repository owner. Use at your own risk. The authors assume no liability for any use or misuse of this code.
On March 31, 2026, the full source code of Anthropic's Claude Code CLI was leaked via a .map file exposed in their npm registry. This repo contains that source rebuilt into a runnable CLI.
Prerequisites: Bun v1.1+
git clone https://github.com/fazxes/claude-code.git
cd claude-code
bun install
bun run build
bun dist/cli.js
That's it. The CLI will launch and prompt you to authenticate via OAuth (same flow as the official Claude Code).
bun dist/cli.js # Launch interactive REPL
bun dist/cli.js --help # Show all options
bun dist/cli.js --version # Show version
bun dist/cli.js -p "your prompt" # Non-interactive mode (pipe-friendly)
bun dist/cli.js auth login # Authenticate
Chaofan Shou (@Fried_rice) discovered the leak:
"Claude code source code has been leaked via a map file in their npm registry!"
The source map in the published npm package contained a reference to the full, unobfuscated TypeScript source, downloadable as a zip from Anthropic's R2 storage bucket.
src/
├── main.tsx # Entrypoint (Commander.js CLI parser)
├── commands.ts # Command registry
├── tools.ts # Tool registry (~40 tools)
├── QueryEngine.ts # LLM query engine (Anthropic API)
├── context.ts # System/user context collection
├── ink/ # Custom Ink fork (terminal React renderer)
├── commands/ # Slash command implementations
├── tools/ # Agent tool implementations
├── components/ # React UI components
├── services/ # API, MCP, OAuth, telemetry
├── screens/ # Full-screen UIs (REPL, Doctor)
├── native-ts/ # Pure TS ports of native modules
│ ├── yoga-layout/ # Flexbox layout engine
│ ├── color-diff/ # Syntax-highlighted diffs
│ └── file-index/ # Fuzzy file search
└── vim/ # Vim mode implementation
Some internal Anthropic features weren't included in the leak or are behind private packages. These are stubbed with no-ops:
@ant/computer-use-*) — screen control tools@ant/claude-for-chrome-mcp) — browser automation@anthropic-ai/sandbox-runtime) — sandboxed executionThe core CLI, all standard tools (Bash, Edit, Read, Write, Grep, Glob, etc.), MCP support, and the full terminal UI work.
The build script (build.ts) uses Bun's bundler to:
dist/cli.js (~21 MB)MACRO.* build-time constants (version, feedback channel)sharp, react-devtools-core)Feature flags from bun:bundle's feature() all return false — internal Anthropic features (voice mode, coordinator mode, etc.) are disabled.
By default, Claude Code sends telemetry to Anthropic (event logging, Datadog, GrowthBook). To disable all telemetry:
DISABLE_TELEMETRY=1 bun dist/cli.js
Or for maximum privacy:
DISABLE_TELEMETRY=1 CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1 bun dist/cli.js
This repository contains proprietary source code that was unintentionally made public by Anthropic through their npm package distribution. It is provided here for educational and research purposes only.
No comments yet. Be the first to share your thoughts!