Skip to content

HM2006/claude-code-source

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Claude Code Source

Disclaimer: This repository contains source code reverse-engineered from the published cli.js.map source map file of @anthropic-ai/claude-code (v2.1.88). This code is proprietary software owned by Anthropic PBC. All rights reserved. Use is subject to Anthropic's Legal Agreements.

Claude Code is Anthropic's official CLI tool that brings Claude, their AI assistant, directly to your terminal. Claude can understand your codebase, edit files, run terminal commands, and handle entire workflows for you.

Overview

Field Details
Package @anthropic-ai/claude-code
Version 2.1.88
Runtime Node.js >= 18.0.0
Build Tool Bun (with conditional compilation via bun:bundle)
Language TypeScript / TSX
License Proprietary (see Anthropic's Terms)

Features

  • Terminal-based AI Assistant — Interactive REPL interface powered by React + Ink
  • Code Understanding — Parses and understands entire codebases
  • File Operations — Read, write, and edit files with AI assistance
  • Shell Execution — Run terminal commands safely with sandboxing
  • MCP (Model Context Protocol) — Extensible tool/server integration
  • Multi-cloud API — Supports Anthropic Direct, AWS Bedrock, Google Vertex AI
  • OAuth Authentication — Supports Claude.ai (Pro/Max/Team/Enterprise) and API Key auth
  • Remote Sessions — Full remote session support with REPL bridging and JWT auth
  • Plugin System — Extensible plugin and skill architecture
  • Vim Mode — Built-in Vim keybinding support
  • Voice Mode — Voice input/output capabilities

Project Structure

src/
├── assistant/          # Assistant session history management
├── bootstrap/          # Startup state management
├── bridge/             # Remote bridging (REPL, JWT auth, device trust)
├── buddy/              # Visual companion character
├── cli/                # CLI utilities (exit handling, NDJSON, structured IO)
├── commands/           # Slash commands (commit, review, init, etc.)
├── components/         # React UI components (100+ components)
├── constants/          # Constants (API limits, betas, OAuth, prompts)
├── context/            # React contexts (messages, modals, notifications)
├── coordinator/        # Coordinator mode
├── entrypoints/        # Entry points (CLI, MCP server, Agent SDK, Sandbox)
├── hooks/              # React Hooks (80+ hooks)
├── ink/                # Custom Ink terminal rendering engine
├── keybindings/        # Keybinding system (Vim mode, custom bindings)
├── memdir/             # Memory directory (search, aging, team memory)
├── migrations/         # Configuration migrations (v1–v11)
├── plugins/            # Plugin system (built-in plugins)
├── screens/            # Screens (REPL, diagnostics, session recovery)
├── server/             # Direct-connect session & manager
├── services/           # Service layer (analytics, rate limiting, voice)
├── skills/             # Skill system (bundled skills, MCP skill builder)
├── state/              # Application state (AppState, Store, selectors)
├── tasks/              # Task management
├── tools/              # AI tools (30+ tools)
├── types/              # TypeScript type definitions
├── upstreamproxy/      # Upstream proxy relay
├── utils/              # Utility functions (200+ files)
└── vendor/             # Native module sources

Built-in AI Tools

Tool Description
BashTool Execute shell commands (with sandboxing)
FileReadTool Read files (including images)
FileWriteTool Write files
FileEditTool Edit files with search/replace
GlobTool File pattern matching
GrepTool Content search (powered by ripgrep)
WebSearchTool Web search
WebFetchTool Fetch web page content
MCPTool MCP server tool calls
AgentTool Sub-agent execution (Explore, Plan, General)
AskUserQuestionTool Ask user questions
TodoWriteTool Todo list management
NotebookEditTool Jupyter Notebook editing
LSPTool Language Server Protocol integration
ScheduleCronTool Cron job management
SkillTool Skill execution
...and more

Tech Stack

  • Runtime: Bun / Node.js
  • Language: TypeScript, TSX
  • UI Framework: React + Ink (terminal rendering)
  • CLI Framework: Commander.js
  • Validation: Zod
  • Image Processing: Sharp
  • Search: ripgrep
  • API SDKs: @anthropic-ai/bedrock-sdk, @anthropic-ai/foundry-sdk

Installation (Original)

npm install -g @anthropic-ai/claude-code

Source Restoration Method

This source code was extracted from the cli.js.map source map file included in the npm package. The source map (57MB) contained embedded source content for all 4,756 files, which were parsed and restored to their original file paths.

# Extraction process
python3 extract_sources.py cli.js.map ./restored-src
# Result: 4,756 files restored

Links

License

This software is proprietary and owned by Anthropic PBC. All rights reserved. Use is subject to Anthropic's Legal Agreements. This repository is provided for educational and research purposes only.

About

Claude Code v2.1.88 source code restored from source map — Anthropic's terminal-based AI assistant (TypeScript/React/Ink)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors