Skip to content

Latest commit

ย 

History

History
123 lines (110 loc) ยท 5.92 KB

README.en.md

File metadata and controls

123 lines (110 loc) ยท 5.92 KB

Cloud-code Cracked Version

English | ็ฎ€ไฝ“ไธญๆ–‡

Source Code Study Docs

Welcome to try it: https://cloud-code-study.vercel.app/

How to Use

  • The source code in this repository has already been restored. See the claude-code-source directory.
  • How to compile and run it locally? Please refer to claude-code-source/README.md.
    • My computer is a MacBook Pro with an Apple chip. So the Bun runtime architecture used there is adapted for Apple chips.
    • For other CPU chip architectures, please figure out the installation yourself, or let AI handle it directly.
  • There is an ai-cloud-xxxx.tgz file in the root directory. This is the original npm package for 2188.

Restoration Method Used in This Repository

# 1. Download the package from npm
npm pack @anthropic-ai/claude-code --registry https://registry.npmjs.org

# 2. Extract it
tar xzf anthropic-ai-claude-code-2.1.88.tgz

# 3. Parse cli.js.map and write sourcesContent back to the original paths
node -e "
const fs = require('fs');
const path = require('path');
const map = JSON.parse(fs.readFileSync('package/cli.js.map', 'utf8'));
const outDir = './claude-code-source';
for (let i = 0; i < map.sources.length; i++) {
  const content = map.sourcesContent[i];
  if (!content) continue;
  let relPath = map.sources[i];
  while (relPath.startsWith('../')) relPath = relPath.slice(3);
  const outPath = path.join(outDir, relPath);
  fs.mkdirSync(path.dirname(outPath), { recursive: true });
  fs.writeFileSync(outPath, content);
}
"

The source map contains 4756 source files and their complete source code (sourcesContent), which can restore all original TypeScript/TSX code without loss.

Directory Structure

.
โ”œโ”€โ”€ src/                  # Core source code (1902 files)
โ”‚   โ”œโ”€โ”€ main.tsx          # Application entry
โ”‚   โ”œโ”€โ”€ Tool.ts           # Tool base class
โ”‚   โ”œโ”€โ”€ Task.ts           # Task management
โ”‚   โ”œโ”€โ”€ QueryEngine.ts    # Query engine
โ”‚   โ”œโ”€โ”€ commands.ts       # Command registration
โ”‚   โ”œโ”€โ”€ tools.ts          # Tool registration
โ”‚   โ”œโ”€โ”€ assistant/        # Session history management
โ”‚   โ”œโ”€โ”€ bootstrap/        # Startup initialization
โ”‚   โ”œโ”€โ”€ bridge/           # Bridge layer (31 files)
โ”‚   โ”œโ”€โ”€ buddy/            # Sub-agent system (6)
โ”‚   โ”œโ”€โ”€ cli/              # CLI parameter parsing and entry (19)
โ”‚   โ”œโ”€โ”€ commands/         # Slash command implementation (207)
โ”‚   โ”œโ”€โ”€ components/       # Terminal UI components, based on Ink (389)
โ”‚   โ”œโ”€โ”€ constants/        # Shared constants (21)
โ”‚   โ”œโ”€โ”€ context/          # Context management (9)
โ”‚   โ”œโ”€โ”€ coordinator/      # Agent coordinator (1)
โ”‚   โ”œโ”€โ”€ entrypoints/      # Various entry points (8)
โ”‚   โ”œโ”€โ”€ hooks/            # Lifecycle hooks (104)
โ”‚   โ”œโ”€โ”€ ink/              # Custom Ink terminal rendering engine (96)
โ”‚   โ”œโ”€โ”€ keybindings/      # Shortcut key management (14)
โ”‚   โ”œโ”€โ”€ memdir/           # Memory directory system (8)
โ”‚   โ”œโ”€โ”€ migrations/       # Data migrations (11)
โ”‚   โ”œโ”€โ”€ moreright/        # Permission system (1)
โ”‚   โ”œโ”€โ”€ native-ts/        # Native TS tools (4)
โ”‚   โ”œโ”€โ”€ outputStyles/     # Output formatting (1)
โ”‚   โ”œโ”€โ”€ plugins/          # Plugin system (2)
โ”‚   โ”œโ”€โ”€ query/            # Query processing (4)
โ”‚   โ”œโ”€โ”€ remote/           # Remote execution (4)
โ”‚   โ”œโ”€โ”€ schemas/          # Data schema definitions (1)
โ”‚   โ”œโ”€โ”€ screens/          # Screen views (3)
โ”‚   โ”œโ”€โ”€ server/           # Server mode (3)
โ”‚   โ”œโ”€โ”€ services/         # Core services (130)
โ”‚   โ”œโ”€โ”€ skills/           # Skill system (20)
โ”‚   โ”œโ”€โ”€ state/            # State management (6)
โ”‚   โ”œโ”€โ”€ tasks/            # Task execution (12)
โ”‚   โ”œโ”€โ”€ tools/            # Tool implementation (184)
โ”‚   โ”œโ”€โ”€ types/            # TypeScript type definitions (11)
โ”‚   โ”œโ”€โ”€ upstreamproxy/    # Upstream proxy support (2)
โ”‚   โ”œโ”€โ”€ utils/            # Utility functions (564)
โ”‚   โ”œโ”€โ”€ vim/              # Vim mode (5)
โ”‚   โ””โ”€โ”€ voice/            # Voice input (1)
โ”œโ”€โ”€ vendor/               # Internal vendor code (4 files)
โ”‚   โ”œโ”€โ”€ modifiers-napi-src/   # Native module for key modifiers
โ”‚   โ”œโ”€โ”€ url-handler-src/      # URL handling
โ”‚   โ”œโ”€โ”€ audio-capture-src/    # Audio capture
โ”‚   โ””โ”€โ”€ image-processor-src/  # Image processing
โ””โ”€โ”€ node_modules/         # Packaged third-party dependencies (2850 files)

Core Module Description

Module File Count Description
utils/ 564 Utility function set โ€” file I/O, Git operations, permission checks, diff handling, etc.
components/ 389 Terminal UI components, built based on Ink (the CLI version of React)
commands/ 207 Slash command implementation, such as /commit, /review, etc.
tools/ 184 Agent tool implementation โ€” Read, Write, Edit, Bash, Glob, Grep, etc.
services/ 130 Core services โ€” API client, authentication, configuration, session management, etc.
hooks/ 104 Lifecycle hooks โ€” interception and permission control before and after tool execution
ink/ 96 Self-developed Ink rendering engine, including layout, focus management, and rendering optimization
bridge/ 31 Bridge layer โ€” communication between IDE extensions and the CLI
skills/ 20 Skill loading and execution system
cli/ 19 CLI parameter parsing and startup logic
keybindings/ 14 Keyboard shortcut binding and customization
tasks/ 12 Background tasks and scheduled task management

Stats

Metric Value
Total source files 4,756
Core source code (src/ + vendor/) 1,906 files
Third-party dependencies (node_modules/) 2,850 files
Source map size 57 MB
Package version 2.1.88