diff --git a/README.md b/README.md index b3c38e6f9..fb0c02d8b 100644 --- a/README.md +++ b/README.md @@ -1,260 +1,117 @@ -# Claude Code Best V5 (CCB) +# CC_Pure — 纯净版 Claude Code -[![GitHub Stars](https://img.shields.io/github/stars/claude-code-best/claude-code?style=flat-square&logo=github&color=yellow)](https://github.com/claude-code-best/claude-code/stargazers) -[![GitHub Contributors](https://img.shields.io/github/contributors/claude-code-best/claude-code?style=flat-square&color=green)](https://github.com/claude-code-best/claude-code/graphs/contributors) -[![GitHub Issues](https://img.shields.io/github/issues/claude-code-best/claude-code?style=flat-square&color=orange)](https://github.com/claude-code-best/claude-code/issues) -[![GitHub License](https://img.shields.io/github/license/claude-code-best/claude-code?style=flat-square)](https://github.com/claude-code-best/claude-code/blob/main/LICENSE) -[![Last Commit](https://img.shields.io/github/last-commit/claude-code-best/claude-code?style=flat-square&color=blue)](https://github.com/claude-code-best/claude-code/commits/main) [![Bun](https://img.shields.io/badge/runtime-Bun-black?style=flat-square&logo=bun)](https://bun.sh/) -[![Discord](https://img.shields.io/badge/Discord-Join-5865F2?style=flat-square&logo=discord)](https://discord.gg/uApuzJWGKX) +[![tsc](https://img.shields.io/badge/tsc-0%20errors-brightgreen?style=flat-square)](https://www.typescriptlang.org/) +[![Build](https://img.shields.io/badge/build-passing-brightgreen?style=flat-square)]() +[![Tests](https://img.shields.io/badge/tests-3340%20pass-brightgreen?style=flat-square)]() -> Which Claude do you like? The open source one is the best. +> 从 [Claude Code Best (CCB)](https://github.com/claude-code-best/claude-code) 分叉的纯净分支 — 去遥测、去企业全家桶、保留核心能力,可审计、可自建。 -牢 A (Anthropic) 官方 [Claude Code](https://docs.anthropic.com/en/docs/claude-code) 完整复原的工程化项目。虽然很难绷, 但是它叫做 CCB(踩踩背)... 而且, 我们实现了企业版或者需要登陆 Claude 账号才能使用的特性, 并在此基础上扩展了更多好玩的特性。 +--- -[Peri Code](https://github.com/KonghaYao/peri):Claude Code 兼容的 Rust Agent,多年大模型经验匠心制作,国内大模型(DeepSeek/GLM)精调,CPU/内存极致优化,在开发版/树莓派上也能跑 CC 一样的体验。 +## 与 CCB 官方项目的关系 -[文档在这里](https://ccb.agent-aura.top/) | [留影文档在这里](./Friends.md) | [Discord 群组,群主在线答疑](https://discord.gg/uApuzJWGKX) +CC_Pure 基于 CCB v2.6.6 反编译源码,做了以下核心变更: -| 特性 | 说明 | 文档 | -| --------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | -| **Claude 群控技术** | Pipe IPC 多实例协作:同机 main/sub 自动编排 + LAN 跨机器零配置发现与通讯,`/pipes` 选择面板 + `Shift+↓` 交互 + 消息广播路由 | [Pipe IPC](https://ccb.agent-aura.top/docs/features/uds-inbox) / [LAN](https://ccb.agent-aura.top/docs/features/lan-pipes) | -| **ACP 协议一等一支持** | 支持接入 Zed、Cursor 等 IDE,支持会话恢复、Skills、权限桥接 | [文档](https://ccb.agent-aura.top/docs/features/acp-zed) | -| **Remote Control 私有部署** | Docker 自托管远程界面, 可以手机上看 CC | [文档](https://ccb.agent-aura.top/docs/features/remote-control-self-hosting) | -| **Langfuse 监控** | 企业级 Agent 监控, 可以清晰看到每次 agent loop 细节, 可以一键转化为数据集 | [文档](https://ccb.agent-aura.top/docs/features/langfuse-monitoring) | -| **Web Search** | 内置网页搜索工具, 支持 bing 和 brave 搜索 | [文档](https://ccb.agent-aura.top/docs/features/web-browser-tool) | -| **Poor Mode** | 穷鬼模式,关闭记忆提取和键入建议,大幅度减少并发请求 | /poor 可以开关 | -| **Channels 频道通知** | MCP 服务器推送外部消息到会话(飞书/Slack/Discord/微信等),`--channels plugin:name@marketplace` 启用 | [文档](https://ccb.agent-aura.top/docs/features/channels) | -| **自定义模型供应商** | OpenAI/Anthropic/Gemini/Grok 兼容 (`/login`) | [文档](https://ccb.agent-aura.top/docs/features/all-features-guide) | -| Voice Mode | 语音输入,支持豆包语言输入(`/voice doubao`) | [文档](https://ccb.agent-aura.top/docs/features/voice-mode) | -| Computer Use | 屏幕截图、键鼠控制 | [文档](https://ccb.agent-aura.top/docs/features/computer-use) | -| Chrome Use | 浏览器自动化、表单填写、数据抓取 | [自托管](https://ccb.agent-aura.top/docs/features/chrome-use-mcp) [原生版](https://ccb.agent-aura.top/docs/features/claude-in-chrome-mcp) | -| Sentry | 企业级错误追踪 | [文档](https://ccb.agent-aura.top/docs/internals/sentry-setup) | -| GrowthBook | 企业级特性开关 | [文档](https://ccb.agent-aura.top/docs/internals/growthbook-adapter) | -| /dream 记忆整理 | 自动整理和优化记忆文件 | [文档](https://ccb.agent-aura.top/docs/features/auto-dream) | +### 移除的内容(CCB V6 企业全家桶) -- 🚀 [想要启动项目](#-快速开始源码版) -- 🐛 [想要调试项目](#vs-code-调试) -- 📖 [想要学习项目](#teach-me-学习项目) +| 移除项 | 原因 | +|--------|------| +| Langfuse 监控 | 企业级 Agent 监控,依赖外部 SaaS | +| Sentry 错误追踪 | 数据上报第三方 | +| Pipe IPC / LAN Pipes | 多机编排,个人使用不需要 | +| UDS_INBOX | 进程间通信管道,构建后 Node.js 环境卡死 | +| GrowthBook 远程配置 | 运行时保留但默认关闭(见下方遥测说明) | +| BigQuery / 1P Event Logging | 运行时保留但默认关闭 | -## ⚡ 快速开始(安装版) +### 遥测处理策略 -不用克隆仓库, 从 NPM 下载后, 直接使用 +**源码保留,运行时默认关闭。** Datadog、Sentry、OpenTelemetry 默认不初始化;GrowthBook / BigQuery / 1P Event Logging 通过 `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1` 环境变量在启动层阻断。strace 实测零外连。 -```sh -npm i -g claude-code-best +> 保留遥测源码是为了企业级部署需要 — 需要时可以打开,不需要时零开销。 -# bun 安装比较多问题, 推荐 npm 装 -# bun i -g claude-code-best -# bun pm -g trust claude-code-best @claude-code-best/mcp-chrome-bridge +### 保留并验证的核心能力 -ccb # 以 nodejs 打开 claude code -ccb-bun # 以 bun 形态打开 -ccb update # 更新到最新版本 -CLAUDE_BRIDGE_BASE_URL=https://remote-control.claude-code-best.win/ CLAUDE_BRIDGE_OAUTH_TOKEN=test-my-key ccb --remote-control # 我们有自部署的远程控制 -``` +| Feature | 状态 | 说明 | +|---------|:---:|------| +| BRIDGE_MODE | ✅ | WebSocket 远程控制 | +| DAEMON | ✅ | 守护进程 + 后台 worker | +| ULTRATHINK | ✅ | 扩展深度推理 | +| ACP | ✅ | 外部 Agent 协议(Zed/Cursor 兼容) | +| MONITOR_TOOL | ✅ | 会话监控工具 | +| VOICE_MODE | ✅ | 语音输入 | +| KAIROS | ✅ | 定时任务系统 | +| PROACTIVE | ✅ | 自主代理模式 | +| COORDINATOR_MODE | ✅ | 多 worker 编排 | -> **安装/更新失败?** 先 `npm rm -g claude-code-best` 清理旧版本,再 `npm i -g claude-code-best@latest`。仍失败则指定版本号:`npm i -g claude-code-best@<版本号>` +### 工程质量 -## ⚡ 快速开始(源码版) +| 指标 | v1.3.0 基线 | CC_Pure 当前 | 提升 | +|------|:----------:|:----------:|:----:| +| tsc 错误 | 62 | **0** | ✅ 全绿 | +| 测试通过 | 3007 | **3340** | +333 | +| 构建 | 不稳定 | **稳定(splitting: true, 562 files)** | ✅ | +| 遥测外连 | 1 次 | **0** | ✅ | -### ⚙️ 环境要求 +### 上游追踪 -一定要最新版本的 bun 啊, 不然一堆奇奇怪怪的 BUG!!! bun upgrade!!! +CC_Pure 持续跟踪 CCB 上游更新,选择性合入关键补丁(非企业全家桶部分)。详见 [CHANGELOG.md](CHANGELOG.md)。 -- 📦 [Bun](https://bun.sh/) >= 1.3.11 +--- -**安装 Bun:** +## ⚡ 快速开始 + +### 环境要求 + +- [Bun](https://bun.sh/) >= 1.3.11(目前强制 Bun 运行时) ```bash -# Linux 和 macOS curl -fsSL https://bun.sh/install | bash - -# Windows (PowerShell) -powershell -c "irm bun.sh/install.ps1 | iex" ``` -**安装后的操作:** - -1. **让当前终端识别 `bun` 命令** - - 安装脚本会把 `~/.bun/bin` 写入对应的 shell 配置文件。macOS 默认 zsh 环境通常会看到: - - ```text - Added "~/.bun/bin" to $PATH in "~/.zshrc" - ``` - - 可以按安装脚本提示重启当前 shell: - - ```bash - exec /bin/zsh - ``` - - 如果你使用 bash,重新加载 bash 配置: - - ```bash - source ~/.bashrc - ``` - - Windows PowerShell 用户关闭并重新打开 PowerShell 即可。 - -2. **验证 Bun 是否可用** - - ```bash - bun --help - bun --version - ``` - -3. **如果已经安装过 Bun,更新到最新版本** - - ```bash - bun upgrade - ``` - -- ⚙️ 常规的配置 CC 的方式, 各大提供商都有自己的配置方式 - -### 📍 命令执行位置 - -- 安装或检查 Bun 的命令可以在任意目录执行: - `curl -fsSL https://bun.sh/install | bash`、`bun --help`、`bun --version`、`bun upgrade` -- 安装本项目依赖、启动开发模式、构建项目时,必须先进入本仓库根目录,也就是包含 `package.json` 的目录。 - -### 📥 安装 +### 安装与运行 ```bash -cd /path/to/claude-code +git clone https://github.com/GhostDragon124/CC_Pure.git +cd CC_Pure bun install +bun run build # 构建到 dist/ +bun dist/cli.js -p "hello" # 测试 ``` -### ▶️ 运行 +### 配置 API ```bash -# 开发模式, 看到版本号 888 说明就是对了 +# 方式一:环境变量 +export ANTHROPIC_BASE_URL="https://your-api/v1" +export ANTHROPIC_API_KEY="sk-xxx" + +# 方式二:REPL 内 /login 命令 bun run dev - -# 构建 -bun run build +# 然后在 REPL 中输入 /login → 选择 Anthropic Compatible ``` -构建采用 code splitting 多文件打包(`build.ts`),产物输出到 `dist/` 目录(入口 `dist/cli.js` + 约 450 个 chunk 文件)。 +--- -构建出的版本 bun 和 node 都可以启动, 你 publish 到私有源可以直接启动 +## 📖 完整文档 -如果遇到 bug 请直接提一个 issues, 我们优先解决 +- **[CCB 原版 README](README_CCB.md)** — 上游项目的完整文档(功能特性、调试指南、学习资源) +- **[CCB 在线文档](https://ccb.agent-aura.top/)** +- **[CCB 官方仓库](https://github.com/claude-code-best/claude-code)** -### 👤 新人配置 /login +--- -首次运行后,在 REPL 中输入 `/login` 命令进入登录配置界面,选择 **Anthropic Compatible** 即可对接第三方 API 兼容服务(无需 Anthropic 官方账号)。 -选择 OpenAI 和 Gemini 对应的栏目都是支持相应协议的 +## ⚠️ 免责声明 -需要填写的字段: +1. **本项目仅供学习研究用途。** Claude Code 的所有权利归 [Anthropic](https://www.anthropic.com/) 所有。 +2. **非 CCB 官方发布。** CC_Pure 是个人维护的纯净分叉,未经 CCB 团队审核或认可。 +3. **不提供任何保证。** 使用本软件即表示您自行承担风险。作者不对因使用本软件造成的任何损失负责。 +4. **API 使用合规。** 使用第三方 API(DeepSeek、OpenRouter 等)需遵守相应服务商的条款。本项目不提供任何 API 密钥。 +5. **企业部署警告。** 如需启用遥测模块(GrowthBook / BigQuery / Sentry),请确认您的部署环境符合相关数据隐私法规。 -| 📌 字段 | 📝 说明 | 💡 示例 | -| ------------ | ------------- | ---------------------------- | -| Base URL | API 服务地址 | `https://api.example.com/v1` | -| API Key | 认证密钥 | `sk-xxx` | -| Haiku Model | 快速模型 ID | `claude-haiku-4-5-20251001` | -| Sonnet Model | 均衡模型 ID | `claude-sonnet-4-6` | -| Opus Model | 高性能模型 ID | `claude-opus-4-6` | - -- ⌨️ **Tab / Shift+Tab** 切换字段,**Enter** 确认并跳到下一个,最后一个字段按 Enter 保存 - -> ℹ️ 支持所有 Anthropic API 兼容服务(如 OpenRouter、AWS Bedrock 代理等),只要接口兼容 Messages API 即可。 - -## Feature Flags - -所有功能开关通过 `FEATURE_=1` 环境变量启用,例如: - -```bash -FEATURE_BUDDY=1 FEATURE_FORK_SUBAGENT=1 bun run dev -``` - -各 Feature 的详细说明见 [`docs/features/`](docs/features/) 目录,欢迎投稿补充。 - -## VS Code 调试 - -TUI (REPL) 模式需要真实终端,无法直接通过 VS Code launch 启动调试。使用 **attach 模式**: - -### 步骤 - -1. **终端启动 inspect 服务**: - - ```bash - bun run dev:inspect - ``` - - 会输出类似 `ws://localhost:8888/xxxxxxxx` 的地址。 -2. **VS Code 附着调试器**: - - - 在 `src/` 文件中打断点 - - F5 → 选择 **"Attach to Bun (TUI debug)"** - -## Teach Me 学习项目 - -我们新加了一个 teach-me skills, 通过问答式引导帮你理解这个项目的任何模块。(调整 [sigma skill 而来](https://github.com/sanyuan0704/sanyuan-skills)) - -```bash -# 在 REPL 中直接输入 -/teach-me Claude Code 架构 -/teach-me React Ink 终端渲染 --level beginner -/teach-me Tool 系统 --resume -``` - -### 它能做什么 - -- **诊断水平** — 自动评估你对相关概念的掌握程度,跳过已知的、聚焦薄弱的 -- **构建学习路径** — 将主题拆解为 5-15 个原子概念,按依赖排序逐步推进 -- **苏格拉底式提问** — 用选项引导思考,而非直接给答案 -- **错误概念追踪** — 发现并纠正深层误解 -- **断点续学** — `--resume` 从上次进度继续 - -### 学习记录 - -学习进度保存在 `.claude/skills/teach-me/` 目录下,支持跨主题学习者档案。 - -## 相关文档及网站 - -- **在线文档(Mintlify)**: [ccb.agent-aura.top](https://ccb.agent-aura.top/) — 文档源码位于 [`docs/`](docs/) 目录,欢迎投稿 PR -- **DeepWiki**: [https://deepwiki.com/claude-code-best/claude-code](https://deepwiki.com/claude-code-best/claude-code) - -## Contributors - - - Contributors - - -## Star History - - - - - - Star History Chart - - +--- ## 致谢 -- [doubaoime-asr](https://github.com/starccy/doubaoime-asr) — 豆包 ASR 语音识别 SDK,为 Voice Mode 提供无需 Anthropic OAuth 的语音输入方案 - -## Changelog - -### v1.3.0 (2026-06-01) - -**遥测彻底清理 & 测试修复 & 新功能** - -- 🔒 **遥测唯一漏网之鱼修复**: `preconnectAnthropicApi()` 加入 `isEssentialTrafficOnly()` 门控,`strace` 实测零外连。已向上游提 PR (#1253) -- 🧠 **Proactive 自主代理模式**: 补全 `notifyAutomationStateChanged` 胶水函数,开启 `PROACTIVE` feature flag。AI 空闲时通过 SleepTool 暂停 tick 省 token -- 🔐 **LocalVault 加密存储**: 补 `keychain.ts` Linux stub,AES-256-GCM 文件加密降级方案完整可用。VaultHttpFetch 加入子代理黑名单(AC18 安全门控) -- 🧪 **测试修复**: 从 3007→3206 pass (+199),42→4 失败 - - 批量修复:时区/effort level/Anthropic input_tokens 规范/DeepSeek v4 reasoning_content - - 补齐缺失 mock 和源文件(13 个 module-not-found 消除) - - 4 个显式 skip(compound command quote 缺陷/ExecuteTool 子进程隔离/CtxInspectTool feature flag) - - 剩余 4 个为 Bun mock 模块缓存缺陷(单独跑全过) -- 📦 **构建**: `bun run build` ✅ 通过(562 files) - -### v1.2.0 - -## 许可证 - -本项目仅供学习研究用途。Claude Code 的所有权利归 [Anthropic](https://www.anthropic.com/) 所有。 +- [Claude Code Best](https://github.com/claude-code-best/claude-code) — 逆向工程和开源的基础 +- [Anthropic](https://www.anthropic.com/) — Claude Code 原作者 diff --git a/README_CCB.md b/README_CCB.md new file mode 100644 index 000000000..b3c38e6f9 --- /dev/null +++ b/README_CCB.md @@ -0,0 +1,260 @@ +# Claude Code Best V5 (CCB) + +[![GitHub Stars](https://img.shields.io/github/stars/claude-code-best/claude-code?style=flat-square&logo=github&color=yellow)](https://github.com/claude-code-best/claude-code/stargazers) +[![GitHub Contributors](https://img.shields.io/github/contributors/claude-code-best/claude-code?style=flat-square&color=green)](https://github.com/claude-code-best/claude-code/graphs/contributors) +[![GitHub Issues](https://img.shields.io/github/issues/claude-code-best/claude-code?style=flat-square&color=orange)](https://github.com/claude-code-best/claude-code/issues) +[![GitHub License](https://img.shields.io/github/license/claude-code-best/claude-code?style=flat-square)](https://github.com/claude-code-best/claude-code/blob/main/LICENSE) +[![Last Commit](https://img.shields.io/github/last-commit/claude-code-best/claude-code?style=flat-square&color=blue)](https://github.com/claude-code-best/claude-code/commits/main) +[![Bun](https://img.shields.io/badge/runtime-Bun-black?style=flat-square&logo=bun)](https://bun.sh/) +[![Discord](https://img.shields.io/badge/Discord-Join-5865F2?style=flat-square&logo=discord)](https://discord.gg/uApuzJWGKX) + +> Which Claude do you like? The open source one is the best. + +牢 A (Anthropic) 官方 [Claude Code](https://docs.anthropic.com/en/docs/claude-code) 完整复原的工程化项目。虽然很难绷, 但是它叫做 CCB(踩踩背)... 而且, 我们实现了企业版或者需要登陆 Claude 账号才能使用的特性, 并在此基础上扩展了更多好玩的特性。 + +[Peri Code](https://github.com/KonghaYao/peri):Claude Code 兼容的 Rust Agent,多年大模型经验匠心制作,国内大模型(DeepSeek/GLM)精调,CPU/内存极致优化,在开发版/树莓派上也能跑 CC 一样的体验。 + +[文档在这里](https://ccb.agent-aura.top/) | [留影文档在这里](./Friends.md) | [Discord 群组,群主在线答疑](https://discord.gg/uApuzJWGKX) + +| 特性 | 说明 | 文档 | +| --------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | +| **Claude 群控技术** | Pipe IPC 多实例协作:同机 main/sub 自动编排 + LAN 跨机器零配置发现与通讯,`/pipes` 选择面板 + `Shift+↓` 交互 + 消息广播路由 | [Pipe IPC](https://ccb.agent-aura.top/docs/features/uds-inbox) / [LAN](https://ccb.agent-aura.top/docs/features/lan-pipes) | +| **ACP 协议一等一支持** | 支持接入 Zed、Cursor 等 IDE,支持会话恢复、Skills、权限桥接 | [文档](https://ccb.agent-aura.top/docs/features/acp-zed) | +| **Remote Control 私有部署** | Docker 自托管远程界面, 可以手机上看 CC | [文档](https://ccb.agent-aura.top/docs/features/remote-control-self-hosting) | +| **Langfuse 监控** | 企业级 Agent 监控, 可以清晰看到每次 agent loop 细节, 可以一键转化为数据集 | [文档](https://ccb.agent-aura.top/docs/features/langfuse-monitoring) | +| **Web Search** | 内置网页搜索工具, 支持 bing 和 brave 搜索 | [文档](https://ccb.agent-aura.top/docs/features/web-browser-tool) | +| **Poor Mode** | 穷鬼模式,关闭记忆提取和键入建议,大幅度减少并发请求 | /poor 可以开关 | +| **Channels 频道通知** | MCP 服务器推送外部消息到会话(飞书/Slack/Discord/微信等),`--channels plugin:name@marketplace` 启用 | [文档](https://ccb.agent-aura.top/docs/features/channels) | +| **自定义模型供应商** | OpenAI/Anthropic/Gemini/Grok 兼容 (`/login`) | [文档](https://ccb.agent-aura.top/docs/features/all-features-guide) | +| Voice Mode | 语音输入,支持豆包语言输入(`/voice doubao`) | [文档](https://ccb.agent-aura.top/docs/features/voice-mode) | +| Computer Use | 屏幕截图、键鼠控制 | [文档](https://ccb.agent-aura.top/docs/features/computer-use) | +| Chrome Use | 浏览器自动化、表单填写、数据抓取 | [自托管](https://ccb.agent-aura.top/docs/features/chrome-use-mcp) [原生版](https://ccb.agent-aura.top/docs/features/claude-in-chrome-mcp) | +| Sentry | 企业级错误追踪 | [文档](https://ccb.agent-aura.top/docs/internals/sentry-setup) | +| GrowthBook | 企业级特性开关 | [文档](https://ccb.agent-aura.top/docs/internals/growthbook-adapter) | +| /dream 记忆整理 | 自动整理和优化记忆文件 | [文档](https://ccb.agent-aura.top/docs/features/auto-dream) | + +- 🚀 [想要启动项目](#-快速开始源码版) +- 🐛 [想要调试项目](#vs-code-调试) +- 📖 [想要学习项目](#teach-me-学习项目) + +## ⚡ 快速开始(安装版) + +不用克隆仓库, 从 NPM 下载后, 直接使用 + +```sh +npm i -g claude-code-best + +# bun 安装比较多问题, 推荐 npm 装 +# bun i -g claude-code-best +# bun pm -g trust claude-code-best @claude-code-best/mcp-chrome-bridge + +ccb # 以 nodejs 打开 claude code +ccb-bun # 以 bun 形态打开 +ccb update # 更新到最新版本 +CLAUDE_BRIDGE_BASE_URL=https://remote-control.claude-code-best.win/ CLAUDE_BRIDGE_OAUTH_TOKEN=test-my-key ccb --remote-control # 我们有自部署的远程控制 +``` + +> **安装/更新失败?** 先 `npm rm -g claude-code-best` 清理旧版本,再 `npm i -g claude-code-best@latest`。仍失败则指定版本号:`npm i -g claude-code-best@<版本号>` + +## ⚡ 快速开始(源码版) + +### ⚙️ 环境要求 + +一定要最新版本的 bun 啊, 不然一堆奇奇怪怪的 BUG!!! bun upgrade!!! + +- 📦 [Bun](https://bun.sh/) >= 1.3.11 + +**安装 Bun:** + +```bash +# Linux 和 macOS +curl -fsSL https://bun.sh/install | bash + +# Windows (PowerShell) +powershell -c "irm bun.sh/install.ps1 | iex" +``` + +**安装后的操作:** + +1. **让当前终端识别 `bun` 命令** + + 安装脚本会把 `~/.bun/bin` 写入对应的 shell 配置文件。macOS 默认 zsh 环境通常会看到: + + ```text + Added "~/.bun/bin" to $PATH in "~/.zshrc" + ``` + + 可以按安装脚本提示重启当前 shell: + + ```bash + exec /bin/zsh + ``` + + 如果你使用 bash,重新加载 bash 配置: + + ```bash + source ~/.bashrc + ``` + + Windows PowerShell 用户关闭并重新打开 PowerShell 即可。 + +2. **验证 Bun 是否可用** + + ```bash + bun --help + bun --version + ``` + +3. **如果已经安装过 Bun,更新到最新版本** + + ```bash + bun upgrade + ``` + +- ⚙️ 常规的配置 CC 的方式, 各大提供商都有自己的配置方式 + +### 📍 命令执行位置 + +- 安装或检查 Bun 的命令可以在任意目录执行: + `curl -fsSL https://bun.sh/install | bash`、`bun --help`、`bun --version`、`bun upgrade` +- 安装本项目依赖、启动开发模式、构建项目时,必须先进入本仓库根目录,也就是包含 `package.json` 的目录。 + +### 📥 安装 + +```bash +cd /path/to/claude-code +bun install +``` + +### ▶️ 运行 + +```bash +# 开发模式, 看到版本号 888 说明就是对了 +bun run dev + +# 构建 +bun run build +``` + +构建采用 code splitting 多文件打包(`build.ts`),产物输出到 `dist/` 目录(入口 `dist/cli.js` + 约 450 个 chunk 文件)。 + +构建出的版本 bun 和 node 都可以启动, 你 publish 到私有源可以直接启动 + +如果遇到 bug 请直接提一个 issues, 我们优先解决 + +### 👤 新人配置 /login + +首次运行后,在 REPL 中输入 `/login` 命令进入登录配置界面,选择 **Anthropic Compatible** 即可对接第三方 API 兼容服务(无需 Anthropic 官方账号)。 +选择 OpenAI 和 Gemini 对应的栏目都是支持相应协议的 + +需要填写的字段: + +| 📌 字段 | 📝 说明 | 💡 示例 | +| ------------ | ------------- | ---------------------------- | +| Base URL | API 服务地址 | `https://api.example.com/v1` | +| API Key | 认证密钥 | `sk-xxx` | +| Haiku Model | 快速模型 ID | `claude-haiku-4-5-20251001` | +| Sonnet Model | 均衡模型 ID | `claude-sonnet-4-6` | +| Opus Model | 高性能模型 ID | `claude-opus-4-6` | + +- ⌨️ **Tab / Shift+Tab** 切换字段,**Enter** 确认并跳到下一个,最后一个字段按 Enter 保存 + +> ℹ️ 支持所有 Anthropic API 兼容服务(如 OpenRouter、AWS Bedrock 代理等),只要接口兼容 Messages API 即可。 + +## Feature Flags + +所有功能开关通过 `FEATURE_=1` 环境变量启用,例如: + +```bash +FEATURE_BUDDY=1 FEATURE_FORK_SUBAGENT=1 bun run dev +``` + +各 Feature 的详细说明见 [`docs/features/`](docs/features/) 目录,欢迎投稿补充。 + +## VS Code 调试 + +TUI (REPL) 模式需要真实终端,无法直接通过 VS Code launch 启动调试。使用 **attach 模式**: + +### 步骤 + +1. **终端启动 inspect 服务**: + + ```bash + bun run dev:inspect + ``` + + 会输出类似 `ws://localhost:8888/xxxxxxxx` 的地址。 +2. **VS Code 附着调试器**: + + - 在 `src/` 文件中打断点 + - F5 → 选择 **"Attach to Bun (TUI debug)"** + +## Teach Me 学习项目 + +我们新加了一个 teach-me skills, 通过问答式引导帮你理解这个项目的任何模块。(调整 [sigma skill 而来](https://github.com/sanyuan0704/sanyuan-skills)) + +```bash +# 在 REPL 中直接输入 +/teach-me Claude Code 架构 +/teach-me React Ink 终端渲染 --level beginner +/teach-me Tool 系统 --resume +``` + +### 它能做什么 + +- **诊断水平** — 自动评估你对相关概念的掌握程度,跳过已知的、聚焦薄弱的 +- **构建学习路径** — 将主题拆解为 5-15 个原子概念,按依赖排序逐步推进 +- **苏格拉底式提问** — 用选项引导思考,而非直接给答案 +- **错误概念追踪** — 发现并纠正深层误解 +- **断点续学** — `--resume` 从上次进度继续 + +### 学习记录 + +学习进度保存在 `.claude/skills/teach-me/` 目录下,支持跨主题学习者档案。 + +## 相关文档及网站 + +- **在线文档(Mintlify)**: [ccb.agent-aura.top](https://ccb.agent-aura.top/) — 文档源码位于 [`docs/`](docs/) 目录,欢迎投稿 PR +- **DeepWiki**: [https://deepwiki.com/claude-code-best/claude-code](https://deepwiki.com/claude-code-best/claude-code) + +## Contributors + + + Contributors + + +## Star History + + + + + + Star History Chart + + + +## 致谢 + +- [doubaoime-asr](https://github.com/starccy/doubaoime-asr) — 豆包 ASR 语音识别 SDK,为 Voice Mode 提供无需 Anthropic OAuth 的语音输入方案 + +## Changelog + +### v1.3.0 (2026-06-01) + +**遥测彻底清理 & 测试修复 & 新功能** + +- 🔒 **遥测唯一漏网之鱼修复**: `preconnectAnthropicApi()` 加入 `isEssentialTrafficOnly()` 门控,`strace` 实测零外连。已向上游提 PR (#1253) +- 🧠 **Proactive 自主代理模式**: 补全 `notifyAutomationStateChanged` 胶水函数,开启 `PROACTIVE` feature flag。AI 空闲时通过 SleepTool 暂停 tick 省 token +- 🔐 **LocalVault 加密存储**: 补 `keychain.ts` Linux stub,AES-256-GCM 文件加密降级方案完整可用。VaultHttpFetch 加入子代理黑名单(AC18 安全门控) +- 🧪 **测试修复**: 从 3007→3206 pass (+199),42→4 失败 + - 批量修复:时区/effort level/Anthropic input_tokens 规范/DeepSeek v4 reasoning_content + - 补齐缺失 mock 和源文件(13 个 module-not-found 消除) + - 4 个显式 skip(compound command quote 缺陷/ExecuteTool 子进程隔离/CtxInspectTool feature flag) + - 剩余 4 个为 Bun mock 模块缓存缺陷(单独跑全过) +- 📦 **构建**: `bun run build` ✅ 通过(562 files) + +### v1.2.0 + +## 许可证 + +本项目仅供学习研究用途。Claude Code 的所有权利归 [Anthropic](https://www.anthropic.com/) 所有。