diff --git a/README.en.md b/README.en.md
index 1b5a5c5..a876a6f 100644
--- a/README.en.md
+++ b/README.en.md
@@ -1,161 +1,93 @@
# XiaoLi Pro-CLI
- Intelligent Programming Assistant — Precise Code Editing, Code Search, Git Integration, Multi-AI Engine Support
+ AI Programming Assistant — Code Editing · Git · Browser Automation · Multi-Agent
-
+
+
---
## ✨ Features
-- 🤖 **Multi AI Engines** — Ollama local models + OpenAI compatible format (DeepSeek, Grok, SiliconFlow, etc.)
-- 🔧 **Precise Code Editing** — Search & replace, batch edits, diff comparison, line-level operations
-- 🔍 **Code Search & Understanding** — Cross-file search, regex matching, symbol extraction, dependency analysis
-- 🔄 **Git Integration** — Full Git workflow support
-- 🎨 **Dual UI Modes** — TUI graphical interface (default) + traditional CLI mode
-- 🧩 **Triple Protocol Plugin System** — Plugin / Skill / MCP protocols
-- 🌐 **WebSocket Remote** — Remote connections and QQ bot integration
-- 🛡️ **Code Sandbox** — Secure code execution environment
+- 🤖 **Dual AI Engines** — Ollama local + OpenAI compatible (DeepSeek, Grok, SiliconFlow, etc.)
+- 🔧 **Code Editing & Search** — Precise replace, batch edit, symbol extraction, regex search
+- 🔄 **Git Integration** — Full Git operations + workflow automation
+- 🌐 **Browser Automation** — Playwright-driven, navigate/interact/screenshot/JS execution
+- 🤖 **Sub-Agent System** — Multi-agent parallel collaboration with task delegation
+- 🛡️ **Unified Safety** — AI risk analysis + 3-mode switching (Normal/Manual/Unrestricted)
+- 🧩 **15 Plugins, 141 Operations** — Code, Git, browser, engineering, file management, etc.
+- 🧪 **113 Automated Tests** — pytest coverage for all plugins and core modules
## 📦 Quick Start
-### Installation
-
```bash
git clone https://gitee.com/shuiyu1123/xiaoli-cli.git
cd xiaoli-cli
pip install -r requirements.txt
+python ai_cli.py
```
-### Usage
+## 🤖 AI Engines
+
+| Engine | Type | Description |
+|--------|------|-------------|
+| `ollama` | Local | Ollama local models, no API key needed |
+| `openai` | Cloud/Local | OpenAI compatible: DeepSeek, Grok, SiliconFlow, local vLLM |
+
+## 🔌 Plugins (15)
+
+### Core Productivity
+
+| Plugin | Ops | Description |
+|--------|-----|-------------|
+| `code_editor` | 23 | Code editing + search. replace/batch/find/regex/symbols/imports/callers/todo |
+| `git_tools` | 20 | Git. status/diff/log/commit/branch + smart-commit/changelog/contributors |
+| `cmd_executor` | 1 | Shell commands. Cross-platform, timeout, danger blocking |
+| `file_manager` | 11 | File system. list/read/write/copy/move/delete/search/info/mkdir |
+| `auto_engineer` | 16 | Engineering. lint/format/test/build/deps + complexity/security/metrics |
+| `task_manager` | 7 | Task tracking. add/list/complete/delete/clear with JSON persistence |
+
+### Advanced
+
+| Plugin | Ops | Description |
+|--------|-----|-------------|
+| `sub_agent` | 8 | Sub-Agent system. spawn/list/status/result/send/kill, parallel collaboration |
+| `browser_auto` | 31 | Browser automation. navigate/click/fill/screenshot/JS/PDF/cookies |
+| `tool_search` | — | Tool discovery. Search available plugins by keyword |
+
+### Utilities
+
+| Plugin | Description |
+|--------|-------------|
+| `network_tools` | ping/get/status/headers/ip |
+| `ai_search` | AI search via jina.ai + web content extraction |
+| `frontend_tester` | HTML/CSS/JS syntax check, responsive validation |
+| `speech_recognition` | Voice recording + speech-to-text |
+| `audio_player` | Audio playback |
+| `send_image` | Send images to phone (Clawli mode) |
+
+## 🛡️ Safety
+
+Three modes (`/safe` to switch):
+
+| Mode | Icon | Behavior |
+|------|------|----------|
+| **Normal** (default) | 🟢 | AI analyzes risk, confirms only when risk detected |
+| **Manual** | 🟡 | All commands require user confirmation |
+| **Unrestricted** | 🔴 | Execute directly, no checking |
+
+## 🧪 Testing
```bash
-# TUI mode (default, requires textual)
-python -m xiaoli
-
-# CLI mode
-python -m xiaoli --cli
-
-# Specify engine
-python -m xiaoli --engine openai
-
-# Show version
-python -m xiaoli --version
+python -m pytest tests/ -v # 113 tests
```
-### Dependencies
-
-**Core:**
-
-| Package | Purpose |
-|---------|---------|
-| `colorama` | Terminal colored output |
-| `openai` | OpenAI compatible API |
-| `requests` | HTTP requests |
-| `Pillow` | Image processing |
-| `numpy` | Numerical computation |
-
-**Optional:**
-
-| Package | Purpose |
-|---------|---------|
-| `textual` | TUI mode |
-| `opencv-python` | Enhanced image processing |
-| `pygame` | Audio playback |
-| `websockets` | WebSocket remote |
-
-## 🏗️ Architecture
-
-```
-xiaoli-cli/
-├── xiaoli/ # Core package (v3.6+ modular architecture)
-│ ├── __main__.py # Entry point (python -m xiaoli)
-│ ├── app.py # Main application (orchestration layer)
-│ ├── config.py # Configuration management
-│ ├── engines.py # AI engine management
-│ ├── sandbox.py # Code execution sandbox
-│ ├── prompt.py # System prompts
-│ ├── tui.py # TUI interface
-│ ├── conversation/ # Conversation handling
-│ └── display/ # Display output (CLI/TUI dual mode)
-│
-├── plugins/ # Plugins (Plugin protocol)
-│ ├── code_editor.py # Precise code editor ⭐
-│ ├── code_search.py # Code search & understanding ⭐
-│ ├── git_tools.py # Git version control ⭐
-│ └── ... # 20+ plugins
-│
-├── skills/ # Skills (Skill protocol)
-├── ai_engines/ # AI engine implementations
-├── image_engine/ # Image processing engines
-├── tests/ # Test suite
-└── requirements.txt # Dependencies
-```
-
-## 🎮 Commands
-
-| Command | Description |
-|---------|-------------|
-| `/help` | Show help |
-| `/quit` | Exit |
-| `/about` | Show version info |
-| `/model ` | Switch AI engine |
-| `/engine list` | List available engines |
-| `/chat save ` | Save conversation |
-| `/chat list` | List conversations |
-| `/chat open ` | Load conversation |
-| `/tui` | Toggle TUI mode |
-
-## 🔌 Plugin Development
-
-XiaoLi supports three plugin protocols. See [Development Documentation](开发文档/开发文档.md) for details.
-
-### Plugin Protocol
-
-```python
-class Plugin:
- def get_tool_info(self):
- return {"name": "my_tool", "description": "...", "keywords": [...]}
-
- def handle(self, args: str) -> str:
- return "result"
-```
-
-### Skill Protocol
-
-```python
-from skills.base import Skill, SkillResult
-
-class MySkill(Skill):
- name = "my_skill"
- def run(self, **kwargs) -> SkillResult:
- return SkillResult(success=True, message="Done")
-```
-
-### MCP Protocol
-
-Supports Anthropic/OpenAI Model Context Protocol for seamless external tool integration.
-
-## 🤝 Contributing
-
-1. Fork the repository
-2. Create a feature branch (`git checkout -b feat/amazing-feature`)
-3. Commit your changes (`git commit -m 'feat: add amazing feature'`)
-4. Push to the branch (`git push origin feat/amazing-feature`)
-5. Create a Pull Request
-
## 📄 License
-This project is licensed under the [MIT License](LICENSE).
-
-## 🔗 Links
-
-- 📦 Gitee: https://gitee.com/shuiyu1123/xiaoli-cli
-- 📖 [Development Docs](开发文档/开发文档.md)
-- 📋 [Changelog](CHANGELOG.md)
+[MIT License](LICENSE)
diff --git a/README.md b/README.md
index e716356..ad597b1 100644
--- a/README.md
+++ b/README.md
@@ -1,238 +1,231 @@
# 小狸 Pro-CLI
- 智能编程助手 — 支持精准代码编辑、代码搜索、Git 版本控制、多 AI 引擎切换
+ 智能编程助手 — 代码编辑 · Git 集成 · 浏览器自动化 · 多 Agent 协作
-
+
+
---
## ✨ 特性
-- 🤖 **多 AI 引擎** — 支持 Ollama 本地模型 + OpenAI 兼容格式(DeepSeek、Grok、硅基流动等),随时切换
-- 🔧 **精准代码编辑** — 搜索替换、批量编辑、diff 对比、行级操作
-- 🔍 **代码搜索理解** — 跨文件搜索、正则匹配、符号提取、依赖分析
-- 🔄 **Git 版本控制** — 完整 Git 操作支持
-- 🎨 **双模式界面** — TUI 图形化界面(默认)+ 传统命令行模式
-- 🧩 **三协议插件系统** — Plugin 协议 / Skill 协议 / MCP 协议
-- 🌐 **WebSocket 远程** — 支持远程连接
-- 🛡️ **代码沙箱** — 安全的代码执行环境
+- 🤖 **双 AI 引擎** — Ollama 本地模型 + OpenAI 兼容格式(DeepSeek、Grok、硅基流动等)
+- 🔧 **代码编辑与搜索** — 精准替换、批量编辑、符号提取、依赖分析、正则搜索
+- 🔄 **Git 版本控制** — 完整 Git 操作 + 工作流自动化(smart-commit、changelog)
+- 🌐 **浏览器自动化** — Playwright 驱动,导航/交互/截图/JS 执行/PDF
+- 🤖 **子 Agent 系统** — 多 Agent 并行协作,独立任务分配与结果回收
+- 🛡️ **统一安全层** — AI 风险识别 + 三模式切换(普通/人工/无限制)
+- 🧩 **15 个插件 141 个操作** — 代码编辑、Git、浏览器、工程化、文件管理、任务管理等
+- 🎨 **双模式界面** — TUI 图形化界面 + 传统命令行模式
+- 🧪 **113 个自动化测试** — pytest 覆盖全部插件和核心模块
## 📦 快速开始
### 安装
```bash
-# 克隆仓库
git clone https://gitee.com/shuiyu1123/xiaoli-cli.git
cd xiaoli-cli
-
-# 安装依赖
pip install -r requirements.txt
```
### 启动
```bash
-# TUI 模式(默认,需 textual)
-python -m xiaoli
-
# CLI 模式
-python -m xiaoli --cli
+python ai_cli.py
# 指定引擎
-python -m xiaoli --engine openai
-
-# 查看版本
-python -m xiaoli --version
+python ai_cli.py --engine openai
```
-### 依赖
-
-**核心依赖:**
-
-| 包名 | 用途 |
-|------|------|
-| `colorama` | 终端彩色输出 |
-| `openai` | OpenAI 兼容接口 |
-| `requests` | HTTP 请求 |
-| `Pillow` | 图像处理 |
-| `numpy` | 数值计算 |
-
-**可选依赖:**
-
-| 包名 | 用途 |
-|------|------|
-| `textual` | TUI 模式 |
-| `opencv-python` | 图像处理增强 |
-| `pygame` | 音频播放 |
-| `websockets` | WebSocket 远程 |
-
-## 🏗️ 项目结构
-
-```
-xiaoli-cli/
-├── xiaoli/ # 核心包(v3.6+ 模块化架构)
-│ ├── __init__.py # 版本信息
-│ ├── __main__.py # 入口点 (python -m xiaoli)
-│ ├── app.py # 主应用(编排层)
-│ ├── config.py # 配置管理
-│ ├── engines.py # AI 引擎管理
-│ ├── sandbox.py # 代码安全沙箱
-│ ├── prompt.py # 系统提示词
-│ ├── tui.py # TUI 界面
-│ ├── conversation/ # 对话处理
-│ │ ├── __init__.py # 响应解析器
-│ │ └── history.py # 聊天记录
-│ └── display/ # 显示输出
-│ └── __init__.py # CLI/TUI 双模式
-│
-├── plugins/ # 插件(Plugin 协议)
-│ ├── code_editor.py # 精准代码编辑器 ⭐
-│ ├── code_search.py # 代码搜索理解 ⭐
-│ ├── git_tools.py # Git 版本控制 ⭐
-│ ├── file_manager.py # 文件管理
-│ ├── cmd_executor.py # 命令执行
-│ ├── ai_search.py # AI 搜索
-│ ├── auto_engineer.py # 自动工程化
-│ ├── project_analyzer.py # 项目分析
-│ ├── git_workflow.py # Git 工作流
-│ ├── scheduler.py # 任务调度
-│ └── ...
-│
-├── skills/ # 技能(Skill 协议)
-│ ├── base.py # 技能基类
-│ ├── code_stats.py # 代码统计
-│ └── file-manager/ # 文件管理技能
-│
-├── ai_engines/ # AI 引擎
-│ ├── ollama_engine.py # Ollama 本地模型
-│ └── openai_engine.py # OpenAI 兼容格式(DeepSeek/Grok/硅基流动等)
-│
-├── image_engine/ # 图像引擎
-├── core/ # 旧版核心模块(兼容)
-├── tests/ # 测试套件
-├── 开发文档/ # 开发文档
-├── ai_cli.py # 旧版入口(兼容)
-├── launcher.py # 启动器
-├── websocket_server.py # WebSocket 服务
-└── requirements.txt # 依赖清单
-```
-
-## 🎮 使用指南
-
-### 内置命令
-
-| 命令 | 说明 |
-|------|------|
-| `/help` | 显示帮助信息 |
-| `/quit` | 退出程序 |
-| `/about` | 显示版本信息 |
-| `/model <引擎>` | 切换 AI 引擎 |
-| `/engine list` | 列出可用引擎 |
-| `/chat save <名称>` | 保存聊天记录 |
-| `/chat list` | 列出聊天记录 |
-| `/chat open <名称>` | 加载聊天记录 |
-| `/file.read <路径>` | 读取文件 |
-| `/tui` | 切换 TUI 模式 |
-
-### 核心工具
-
-#### 代码编辑器 (`code_editor`)
-
-```bash
-# 精准替换
-{"action":"use_tool","tool":"code_editor","args":"edit src/app.py
-def old():
- pass
-<<<>>>
-def new():
- return True"}
-
-# 批量编辑
-{"action":"use_tool","tool":"code_editor","args":"multi src/app.py [{\"old\":\"old1\",\"new\":\"new1\"}]"}
-
-# 查看代码
-{"action":"use_tool","tool":"code_editor","args":"read_range src/app.py 10 20"}
-```
-
-#### 代码搜索 (`code_search`)
-
-```bash
-# 项目结构
-{"action":"use_tool","tool":"code_search","args":"structure ."}
-
-# 搜索代码
-{"action":"use_tool","tool":"code_search","args":"find . process *.py"}
-
-# 符号提取
-{"action":"use_tool","tool":"code_search","args":"symbols ."}
-
-# 代码统计
-{"action":"use_tool","tool":"code_search","args":"stats ."}
-```
-
-#### Git 操作 (`git_tools`)
-
-```bash
-{"action":"use_tool","tool":"git_tools","args":"status"}
-{"action":"use_tool","tool":"git_tools","args":"diff"}
-{"action":"use_tool","tool":"git_tools","args":"log --oneline 10"}
-{"action":"use_tool","tool":"git_tools","args":"commit 修复bug"}
-```
-
-### AI 引擎
+## 🤖 AI 引擎
| 引擎 | 类型 | 说明 |
|------|------|------|
| `ollama` | 本地 | Ollama 本地模型,无需 API 密钥 |
| `openai` | 云端/本地 | OpenAI 兼容格式,支持 DeepSeek、Grok、硅基流动、本地 vLLM 等 |
-#### OpenAI 兼容引擎配置示例
+### 配置示例 (config.json)
```json
{
"api": {
"engines": {
+ "ollama": {
+ "base_url": "http://localhost:11434",
+ "model": "qwen2.5:latest"
+ },
"openai": {
- "api_key": "你的API密钥",
+ "api_key": "your-key",
"base_url": "https://api.deepseek.com/v1",
"model": "deepseek-chat"
}
}
+ },
+ "system": {
+ "default_engine": "ollama",
+ "max_history": 50
}
}
```
-### 远程连接
+## 🔌 插件列表 (15 个)
+
+### 核心生产力
+
+| 插件 | 操作数 | 说明 |
+|------|--------|------|
+| `code_editor` | 23 | 代码编辑+搜索。精准替换、批量编辑、find/regex/symbols/imports/callers/todo/structure |
+| `git_tools` | 20 | Git 版本控制。status/diff/log/commit/branch + smart-commit/changelog/contributors |
+| `cmd_executor` | 1 | Shell 命令执行。跨平台,超时控制,危险命令拦截 |
+| `file_manager` | 11 | 文件系统。list/read/write/copy/move/delete/search/info/mkdir |
+| `auto_engineer` | 16 | 工程化。lint/format/test/build/deps + 复杂度/安全扫描/质量指标 |
+| `task_manager` | 7 | 任务管理。add/list/complete/delete/clear,JSON 持久化 |
+
+### 高级功能
+
+| 插件 | 操作数 | 说明 |
+|------|--------|------|
+| `sub_agent` | 8 | 子 Agent 系统。spawn/list/status/result/send/kill,多 Agent 并行协作 |
+| `browser_auto` | 31 | 浏览器自动化。导航/点击/填写/截图/JS执行/PDF/cookies(基于 Playwright) |
+| `tool_search` | — | 工具搜索。按关键词发现可用插件(供 AI 按需调用) |
+
+### 辅助工具
+
+| 插件 | 说明 |
+|------|------|
+| `network_tools` | 网络工具。ping/get/status/headers/ip |
+| `ai_search` | AI 搜索。jina.ai 智能搜索 + 网页内容提取 |
+| `frontend_tester` | 前端测试。HTML/CSS/JS 语法检查、响应式验证 |
+| `speech_recognition` | 语音识别。录音 + 语音转文字 |
+| `audio_player` | 音频播放 |
+| `send_image` | Clawli 模式下发图片到手机 |
+
+## 🛡️ 安全机制
+
+### 三模式切换 (`/safe`)
+
+| 模式 | 图标 | 说明 |
+|------|------|------|
+| **普通模式** (默认) | 🟢 | AI 识别风险,有风险才请求确认 |
+| **人工确认** | 🟡 | 所有指令都需要用户确认 |
+| **无限制** | 🔴 | 直接执行,不检查 |
+
+### 检查流程
+
+```
+工具调用 → safety.check()
+ ├─ 快速预检(读取/查询类)→ 直接放行
+ ├─ 普通模式 → AI 独立分析风险
+ │ ├─ safe=true → 放行
+ │ └─ safe=false → 展示风险等级+影响,y/n 确认
+ └─ 特殊指令(rm/delete/chmod)→ 始终确认
+```
+
+### 代码沙箱
+
+独立的安全代码执行环境:
+- AST 级危险代码检测
+- 模块白名单(阻断 os/subprocess/socket 等 25 个模块)
+- 子进程隔离执行
+- 内存限制
+
+## 🎮 命令列表
+
+| 命令 | 说明 |
+|------|------|
+| `/help` | 显示帮助 |
+| `/safe` | 切换安全模式(普通→人工→无限制) |
+| `/safe off` | 直接切换到无限制模式 |
+| `/safe manual` | 直接切换到人工确认模式 |
+| `/engine list` | 列出可用引擎 |
+| `/engine switch <引擎>` | 切换引擎 |
+| `/engine.openai models` | 列出 OpenAI 引擎模型 |
+| `/chat save/list/open` | 聊天记录管理 |
+| `/file.read <路径>` | 读取文件 |
+| `/tui` | 切换 TUI 模式 |
+| `/quit` | 退出 |
+
+## 🏗️ 项目结构
+
+```
+xiaoli-cli/
+├── ai_cli.py # 主入口
+├── launcher.py # 智能启动器
+├── config.json.example # 配置模板
+│
+├── xcli_core/ # 核心模块
+│ ├── cli_core.py # 主循环 + 提示词构建
+│ ├── cli_base.py # 初始化 + 引擎/插件加载
+│ ├── cli_tools.py # 工具调用执行
+│ ├── cli_display.py # 显示输出
+│ ├── cli_history.py # 聊天记录
+│ ├── cli_code_exec.py # 代码执行
+│ ├── config.py # 配置管理
+│ ├── constants.py # 常量定义
+│ ├── safety.py # 统一安全层 ⭐
+│ ├── sandbox.py # 代码安全沙箱
+│ ├── plugin_manager.py # 插件管理器
+│ └── tui.py # TUI 界面
+│
+├── ai_engines/ # AI 引擎
+│ ├── ollama_engine.py # Ollama 本地模型
+│ └── openai_engine.py # OpenAI 兼容格式
+│
+├── plugins/ # 插件 (15 个)
+│ ├── code_editor.py # 代码编辑+搜索
+│ ├── git_tools.py # Git 版本控制
+│ ├── cmd_executor.py # Shell 命令执行
+│ ├── file_manager.py # 文件管理
+│ ├── auto_engineer.py # 工程化自动化
+│ ├── task_manager.py # 任务管理
+│ ├── sub_agent.py # 子 Agent 系统
+│ ├── browser_auto.py # 浏览器自动化
+│ ├── tool_search.py # 工具搜索
+│ ├── network_tools.py # 网络工具
+│ ├── ai_search.py # AI 搜索
+│ ├── frontend_tester.py # 前端测试
+│ ├── speech_recognition.py # 语音识别
+│ ├── audio_player.py # 音频播放
+│ └── send_image.py # 图片发送
+│
+├── skills/ # 技能 (Skill 协议)
+├── image_engine/ # 图像识别引擎
+├── tests/ # 测试套件 (113 用例)
+├── love.txt # 彩蛋情话
+└── about.txt # 关于信息
+```
+
+## 🧪 测试
```bash
-# 启动 WebSocket 服务
-/remote start 9079 your_password
+# 运行全部测试 (113 用例)
+python -m pytest tests/ -v
-# 代理模式
-/remote proxy relay.example.com:9079 server_pwd 12345 pc_pwd
+# 语法检查
+python -c "import py_compile; py_compile.compile('ai_cli.py', doraise=True)"
```
## 🔌 插件开发
-小狸支持三种插件协议,详见 [开发文档](开发文档/开发文档.md)。
-
-### Plugin 协议
-
```python
class Plugin:
"""我的插件"""
-
+
def __init__(self):
self.usage = "使用说明"
self.cli = None
-
+
+ def set_cli(self, cli):
+ self.cli = cli
+
def get_tool_info(self):
return {
"name": "my_tool",
@@ -240,55 +233,17 @@ class Plugin:
"keywords": ["关键词"],
"usage": self.usage
}
-
+
def handle(self, args: str) -> str:
return "处理结果"
```
-### Skill 协议
-
-```python
-from skills.base import Skill, SkillResult
-
-class MySkill(Skill):
- name = "my_skill"
- description = "技能描述"
-
- def run(self, **kwargs) -> SkillResult:
- return SkillResult(success=True, message="完成")
-```
-
-### MCP 协议
-
-支持 Anthropic/OpenAI 标准的 Model Context Protocol,可与外部工具无缝集成。
-
-## 🧪 测试
-
-```bash
-# 运行所有测试
-python -m pytest tests/
-
-# 运行特定测试
-python -m pytest tests/test_sandbox.py
-```
-
-## 🤝 贡献
-
-欢迎贡献!请阅读 [贡献指南](CONTRIBUTING.md)。
-
-1. Fork 本仓库
-2. 创建特性分支 (`git checkout -b feat/amazing-feature`)
-3. 提交更改 (`git commit -m 'feat: add amazing feature'`)
-4. 推送分支 (`git push origin feat/amazing-feature`)
-5. 创建 Pull Request
-
## 📄 许可证
-本项目采用 [MIT License](LICENSE) 开源许可证。
+[MIT License](LICENSE)
## 🔗 链接
- 📦 Gitee: https://gitee.com/shuiyu1123/xiaoli-cli
-- 📖 [开发文档](开发文档/开发文档.md)
- 📋 [更新日志](CHANGELOG.md)
- ❓ [使用指南](HELP.md)