Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

Claude Code CLI - Deobfuscated & Reorganized

This is the fully deobfuscated and reorganized version of Claude Code CLI v1.0.115, extracted from the original webpack bundle.

📁 Project Structure

claude-code-organized/
├── src/
│   ├── main.js                    # Main entry point
│   ├── auth/                      # Authentication modules
│   │   ├── oauth.js               # OAuth flow implementation
│   │   └── api-key.js             # API key management
│   ├── tools/                     # Tool implementations
│   │   ├── bash.js                # Bash command execution
│   │   ├── write.js               # File writing
│   │   ├── edit.js                # File editing
│   │   └── read.js                # File reading
│   ├── ui/                        # Terminal UI components
│   │   ├── terminal.js            # Main terminal interface
│   │   └── components/
│   │       └── spinner.js         # Loading indicators
│   ├── conversation/              # Conversation handling
│   │   └── loop.js                # Main conversation loop
│   ├── network/                   # (To be added)
│   │   ├── client.js              # HTTP client
│   │   └── streaming.js           # SSE streaming
│   ├── filesystem/                # (To be added)
│   │   └── permissions.js         # File permission management
│   ├── mcp/                       # (To be added)
│   │   └── server.js              # MCP server connections
│   ├── hooks/                     # (To be added)
│   │   └── manager.js             # Hook system
│   ├── config/                    # (To be added)
│   │   └── settings.js            # Configuration management
│   └── utils/                     # Utility modules
│       └── circular-buffer.js     # Circular buffer for output
├── package.json                   # Package configuration
└── README.md                      # This file

🚀 Installation

# Install dependencies
npm install

# Make executable
chmod +x src/main.js

# Create symlink (optional)
npm link

🔧 Usage

Authentication

# OAuth login (recommended)
claude login

# API key login
claude login --api-key

# Logout
claude logout

Basic Usage

# Start conversation
claude

# Check status
claude status

# Specify model
claude -m claude-3-opus-20240229

🛠️ Key Components

Authentication (src/auth/)

  • OAuth Flow: Full PKCE-based OAuth implementation for Claude.ai
  • API Key: Support for Anthropic API keys with validation

Tools (src/tools/)

  • Bash: Execute shell commands with timeout and background support
  • Write: Create and overwrite files with safety checks
  • Edit: Find and replace text in files
  • Read: Read files with support for text, images, PDFs, and notebooks

UI (src/ui/)

  • Terminal Interface: React-based terminal UI using Ink
  • Components: Spinners, progress bars, activity indicators

Conversation (src/conversation/)

  • Loop: Main conversation processing with tool execution
  • Token Management: Track and manage token usage
  • Microcompaction: Automatic conversation compression

🔑 Environment Variables

# API Key
export ANTHROPIC_API_KEY="sk-ant-api..."

# Custom base URL (optional)
export ANTHROPIC_BASE_URL="https://api.anthropic.com"

# Proxy settings (optional)
export HTTP_PROXY="http://proxy:8080"
export HTTPS_PROXY="http://proxy:8080"

📝 Features Recovered

Core Functionality

  • ✅ Full conversation loop with streaming
  • ✅ Tool system (Bash, File operations)
  • ✅ OAuth and API key authentication
  • ✅ Terminal UI with React/Ink
  • ✅ Token usage tracking
  • ✅ Auto-compaction for long conversations

Advanced Features

  • ✅ Background task execution
  • ✅ File permission management
  • ✅ Multi-edit operations
  • ✅ Progress indicators
  • ✅ Error handling and recovery

Not Yet Extracted

  • ⏳ MCP server connections
  • ⏳ Hook system for extensions
  • ⏳ Web search and fetch tools
  • ⏳ Full configuration management
  • ⏳ Installation and update system

🔍 Deobfuscation Process

This code was extracted from a webpack-bundled and heavily obfuscated JavaScript file containing 50,360 lines. The deobfuscation process involved:

  1. Variable Renaming: Restored meaningful names for ~10,000+ mangled variables
  2. Function Extraction: Identified and separated ~500+ functions
  3. Module Reconstruction: Rebuilt the original module structure
  4. Type Recovery: Inferred types and interfaces from usage patterns
  5. Flow Analysis: Traced control flow through complex async operations

⚠️ Important Notes

  1. Work in Progress: Not all features have been extracted yet
  2. Dependencies: Some dependencies may be missing or need updating
  3. Testing: Extensive testing is needed before production use
  4. Security: Review authentication and file operations before deployment

🤝 Contributing

This is a deobfuscation project for educational and transparency purposes. The original Claude Code is property of Anthropic.

📄 License

This deobfuscated version is provided for educational purposes. The original Claude Code is subject to Anthropic's terms of service.


Note: This is a reconstructed version from obfuscated code. Some implementation details may differ from the original source.