| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
基于 Claude Code 架构学习的 AI 编程助手实现。支持文件操作、命令执行、任务管理、会话持久化和权限控制。
| 功能 | 说明 |
|---|---|
| 🤖 核心 Agent 循环 | 自动调用 LLM 并执行工具 |
| 📁 文件操作 | 读取、写入、编辑、搜索文件 |
| 🔧 命令执行 | 执行系统命令(支持 Windows/Linux) |
| 📋 任务管理 | Todo 列表,支持多步骤任务规划 |
| 💾 会话持久化 | 自动保存对话历史,支持断点续传 |
| 🔐 权限系统 | 危险操作需要用户确认 |
| 🗜️ 上下文压缩 | 自动压缩历史对话,节省 token(压缩率 80%+) |
| 💿 文件缓存 | 缓存读取过的文件,加速重复访问 |
| 🧹 缓存清理 | 自动清理过期缓存(7天)和限制大小(100MB) |
| 📊 命令历史 | 上下箭头查看历史命令 |
| ⚡ 错误重试 | API 调用失败自动重试 |
| ⚙️ 配置文件 | 支持 .codeagentrc.json 配置 |
| 工具 | 功能 | 权限 |
|---|---|---|
| bash | 执行系统命令 | ⚠️ 需要确认 |
| read_file | 读取文件 | ✅ 自动允许 |
| write_file | 写入文件 | ⚠️ 需要确认 |
| file_edit | 编辑文件 | ⚠️ 需要确认 |
| glob | 搜索文件 | ✅ 自动允许 |
| grep | 搜索内容 | ✅ 自动允许 |
| todo_write | 任务管理 | ✅ 自动允许 |
| web_fetch | 网络请求 | ✅ 自动允许 |
| ask_user_question | 询问用户 | ⚠️ 需要确认 |
| web_search | 网络搜索 | ⚠️ 需要确认 |
npm install### 配置API key创建 .env 文件:
DEEPSEEK_API_KEY=your_api_key
OPENAI_BASE_URL=https://api.deepseek.com/v1npm run dev| 命令 | 功能 |
|---|---|
| /sessions | 查看所有会话 |
| /save | 保存当前会话 |
| /resume <id> | 切换会话 |
| /rename <名称> | 重命名当前会话 |
| /session-info | 查看会话详情 |
| /delete <id> | 删除会话 |
| exit | 退出会话 |
src/
├── agent/ # Agent 核心
│ ├── loop.ts # 核心循环
│ └── types.ts # 类型定义
├── api/ # LLM 客户端
│ └── client.ts # DeepSeek API
├── tools/ # 工具实现
│ ├── base.ts # 工具基类
│ ├── registry.ts # 工具注册
│ └── *.ts # 具体工具
├── permissions/ # 权限系统
│ ├── types.ts # 权限类型
│ └── checker.ts # 权限检查
├── state/ # 会话管理
│ └── session.ts # 会话存储
└── index.ts # 入口文件本项目基于对 Claude Code 源码的学习,实现了其核心架构:
MIT License
Copyright (c) 2026
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
| Back | FazBrowse Home | New Git URL |