mirror of
http://10.0.2.1:3031/sauer/claude-code.git
synced 2026-06-30 12:46:58 +10:00
137 lines
4.6 KiB
Markdown
137 lines
4.6 KiB
Markdown
# Claude Code v2.1.88 — Full Source
|
|
|
|
Source code extracted from `@anthropic-ai/claude-code@2.1.88` npm package via source maps.
|
|
|
|
The 57MB source map (`cli.js.map`) shipped inside the npm package and pointed to a Cloudflare R2 bucket containing the full TypeScript source. No reverse engineering was performed — Anthropic published it themselves.
|
|
|
|
---
|
|
|
|
## Quick Start
|
|
|
|
**Requirements:** Node.js 18+
|
|
|
|
```bash
|
|
git clone https://github.com/antonoly/claude-code.git
|
|
cd claude-code
|
|
node cli.js
|
|
```
|
|
|
|
On first launch, you'll be prompted to log in with your Anthropic account. If you have a Claude Max/Pro subscription, it works immediately — no API key needed.
|
|
|
|
### With an API Key
|
|
|
|
```bash
|
|
export ANTHROPIC_API_KEY=sk-ant-...
|
|
node cli.js
|
|
```
|
|
|
|
### With AWS Bedrock
|
|
|
|
```bash
|
|
export CLAUDE_CODE_USE_BEDROCK=1
|
|
export AWS_REGION=us-east-1
|
|
node cli.js
|
|
```
|
|
|
|
### With Google Vertex AI
|
|
|
|
```bash
|
|
export CLAUDE_CODE_USE_VERTEX=1
|
|
export CLOUD_ML_REGION=us-east5
|
|
node cli.js
|
|
```
|
|
|
|
### Custom API Endpoint
|
|
|
|
```bash
|
|
export ANTHROPIC_BASE_URL=https://your-proxy.example.com
|
|
export ANTHROPIC_API_KEY=your-key
|
|
node cli.js
|
|
```
|
|
|
|
### With Local Models (Ollama + Qwen3-Coder)
|
|
|
|
We patched the source to add `LOCAL_MODEL_BASE_URL` — routes only model API calls to your local proxy while letting auth/startup use Anthropic's servers normally.
|
|
|
|
**Requirements:** [Ollama](https://ollama.com) + [litellm](https://github.com/BerriAI/litellm) + a Claude subscription (for auth)
|
|
|
|
```bash
|
|
# Step 1: Pull a model with 128K+ context (required for Claude Code's system prompt)
|
|
ollama pull qwen3-coder:30b
|
|
|
|
# Step 2: Create litellm config that maps Claude's model name to your local model
|
|
cat > litellm-config.yaml << 'CONF'
|
|
model_list:
|
|
- model_name: "claude-sonnet-4-20250514"
|
|
litellm_params:
|
|
model: "ollama/qwen3-coder:30b"
|
|
num_ctx: 65536
|
|
litellm_settings:
|
|
drop_params: true
|
|
CONF
|
|
|
|
# Step 3: Start litellm proxy (needs Python 3.10+)
|
|
pip install 'litellm[proxy]'
|
|
litellm --config litellm-config.yaml --port 8080
|
|
|
|
# Step 4: Run Claude Code (in another terminal)
|
|
LOCAL_MODEL_BASE_URL=http://localhost:8080 node cli.js
|
|
```
|
|
|
|
Claude Code authenticates with Anthropic normally (you need a subscription), but all model inference runs locally on Qwen3-Coder via Ollama. Works with any model that has 128K+ context — qwen3-coder, deepseek-r1, llama4, etc.
|
|
|
|
---
|
|
|
|
## What's Inside
|
|
|
|
| Stat | Value |
|
|
|------|-------|
|
|
| Lines of TypeScript | 512K |
|
|
| Source files | 1,923 |
|
|
| Built-in tools | 43 |
|
|
| Package version | 2.1.88 |
|
|
|
|
### Key Findings
|
|
|
|
- **`buddy/`** — Full Tamagotchi pet system: 18 species, rarity tiers (1% legendary, 0.01% shiny legendary), 5 stats, gacha PRNG seeded per-user, ASCII art sprites
|
|
- **`utils/undercover.ts`** — Auto-activates on public repos. Injects system prompt: *"Do not blow your cover."* No force-OFF switch
|
|
- **`outputStyles/`** — Anti-distillation defenses: strips tool lists, model info, and thinking content to prevent competitors from scraping behavior
|
|
- **`coordinator/`** — KAIROS/Auto-Dream: autonomous multi-step planning with self-reflection loops
|
|
- **`context/`** — 4-layer context compression: pruning → summarization → truncation → eviction
|
|
|
|
### Source Tree
|
|
|
|
```
|
|
├── cli.js # Bundled CLI entry point (12MB)
|
|
├── package.json # Original npm package metadata
|
|
├── vendor/ # Native binaries (ripgrep, audio-capture)
|
|
├── buddy/ # BUDDY pet system
|
|
├── tools/ # 43 built-in tools
|
|
├── commands/ # Slash commands
|
|
├── components/ # React/Ink terminal UI
|
|
├── context/ # Context window management
|
|
├── coordinator/ # Multi-agent orchestration
|
|
├── hooks/ # Pre/post tool execution hooks
|
|
├── plugins/ # Plugin/skill marketplace
|
|
├── services/ # API clients, auth, billing
|
|
├── skills/ # Built-in skills
|
|
├── utils/ # Undercover mode, anti-distillation, models
|
|
│ ├── undercover.ts # "Do not blow your cover"
|
|
│ └── model/ # Model definitions, codename stripping
|
|
├── voice/ # Voice mode
|
|
└── vim/ # Vim keybindings
|
|
```
|
|
|
|
---
|
|
|
|
## Full Analysis
|
|
|
|
Independent architecture analysis with source code evidence:
|
|
|
|
**[verified-skill.com/insights/claude-code](https://verified-skill.com/insights/claude-code)**
|
|
|
|
---
|
|
|
|
## Disclaimer
|
|
|
|
This repository contains source code that was publicly exposed via npm source maps on March 31, 2026. All code was directly readable from the published npm package `@anthropic-ai/claude-code@2.1.88`. No reverse engineering, decompilation, or circumvention of technical protection measures was performed. |