# claude code **Repository Path**: appcccc/claude-code ## Basic Information - **Project Name**: claude code - **Description**: claude code - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-04-08 - **Last Updated**: 2026-04-08 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # claude-code-sourcemap [![linux.do](https://img.shields.io/badge/linux.do-huo0-blue?logo=linux&logoColor=white)](https://linux.do) > [!WARNING] > This repository is **unofficial** and is reconstructed from the public npm package and source map analysis, **for research purposes only**. > It does **not** represent the original internal development repository structure. > > 本仓库为**非官方**整理版,基于公开 npm 发布包与 source map 分析还原,**仅供研究使用**。 > **不代表**官方原始内部开发仓库结构。 > 一切基于L站"飘然与我同"的情报提供 ## 概述 本仓库通过 npm 发布包(`@anthropic-ai/claude-code`)内附带的 source map(`cli.js.map`)还原的 TypeScript 源码,版本为 `2.1.88`。 ## 来源 - npm 包:[@anthropic-ai/claude-code](https://www.npmjs.com/package/@anthropic-ai/claude-code) - 还原版本:`2.1.88` - 还原文件数:**4756 个**(含 1884 个 `.ts`/`.tsx` 源文件) - 还原方式:提取 `cli.js.map` 中的 `sourcesContent` 字段 ## 目录结构 ``` restored-src/src/ ├── main.tsx # CLI 入口 ├── tools/ # 工具实现(Bash、FileEdit、Grep、MCP 等 30+ 个) ├── commands/ # 命令实现(commit、review、config 等 40+ 个) ├── services/ # API、MCP、分析等服务 ├── utils/ # 工具函数(git、model、auth、env 等) ├── context/ # React Context ├── coordinator/ # 多 Agent 协调模式 ├── assistant/ # 助手模式(KAIROS) ├── buddy/ # AI 伴侣 UI ├── remote/ # 远程会话 ├── plugins/ # 插件系统 ├── skills/ # 技能系统 ├── voice/ # 语音交互 └── vim/ # Vim 模式 ``` ## 声明 - 源码版权归 [Anthropic](https://www.anthropic.com) 所有 - 本仓库仅用于技术研究与学习,请勿用于商业用途 - 如有侵权,请联系删除 ## 编译 `claude-code-sourcemap` 是通过 Source Map 还原的 Claude Code 源码,**必须用 Bun 编译**(不能用 Node.js),因为项目大量使用了 Bun 专有 API(如 `bun:bundle`、`feature` 宏)。 ### 一、环境准备 1. **安装 Bun**(必须 ≥ v1.0.20) ```bash # macOS/Linux curl -fsSL https://bun.sh/install | bash # Windows (PowerShell) powershell -c "irm bun.sh/install.ps1|iex" ``` 2. **克隆仓库** ```bash git clone https://github.com/ChinaSiro/claude-code-sourcemap.git cd claude-code-sourcemap ``` ### 二、安装依赖 ```bash bun install ``` - 项目已包含缺失私有包的 **stub 替代**,可直接安装。 ### 三、编译构建 #### 方式1:生产构建(生成单文件) ```bash bun run build ``` - 输出:`dist/cli.js`(约 17MB) #### 方式2:开发模式(热更新) ```bash bun run dev ``` ### 四、运行 ```bash # 直接运行 bun dist/cli.js # 或用启动脚本 ./claude.sh ``` - 首次运行需配置 **Anthropic API Key**(环境变量或交互输入)。 ### 五、常见问题 1. **`Cannot find module 'bun:bundle'`** - 原因:用了 Node.js 运行 - 解决:**必须用 `bun` 命令** 2. **`Feature not enabled: xxx`** - 编辑 `build.ts`,在 `featureFlags` 中开启对应特性 3. **依赖安装失败** ```bash bun install --force ``` ### 六、重要提醒 - 此为 **非官方泄露源码**,仅供**学习研究**,**禁止商用** - 编译后仅能运行 Claude Code CLI,**不包含模型权重** 需要我帮你生成一份可直接复制的 **一键编译脚本**(含环境检查、依赖安装、构建、运行全流程)吗?