|
1 | | -# mpp-vscode |
| 1 | +<p align="center"> |
| 2 | + <img src="media/pluginIcon.png" width="160px" height="160px" alt="logo" /> |
| 3 | +</p> |
| 4 | +<h1 align="center">AutoDev for VSCode (KMP Edition)</h1> |
| 5 | +<p align="center"> |
| 6 | + <a href="https://marketplace.visualstudio.com/items?itemName=Phodal.autodev"> |
| 7 | + <img src="https://img.shields.io/visual-studio-marketplace/v/Phodal.autodev" alt="Visual Studio Marketplace Version" /> |
| 8 | + </a> |
| 9 | + <a href="https://github.com/unit-mesh/auto-dev-vscode/actions/workflows/ci.yml"> |
| 10 | + <img src="https://github.com/unit-mesh/auto-dev-vscode/actions/workflows/ci.yml/badge.svg" alt="CI" /> |
| 11 | + </a> |
| 12 | +</p> |
| 13 | + |
| 14 | +> 🧙 AI-powered coding wizard with multilingual support 🌐, auto code generation 🏗️, and a helpful bug-slaying assistant 🐞! Built with **Kotlin Multiplatform** for cross-platform capabilities. 🚀 |
| 15 | +
|
| 16 | +This is the **Kotlin Multiplatform (KMP) edition** of AutoDev, rewritten from the ground up to leverage Kotlin's cross-platform capabilities for future iOS, Android, and Desktop support. |
| 17 | + |
| 18 | +## 🌟 Key Features |
| 19 | + |
| 20 | +- **💬 Chat Mode**: Interactive AI assistant with context-aware code understanding |
| 21 | +- **🔍 CodeLens**: Inline AI actions above functions and classes |
| 22 | + - Quick Chat, Explain Code, Optimize Code |
| 23 | + - Auto Comment, Auto Test, Auto Method |
| 24 | +- **🧪 Auto Test Generation**: Generate unit tests with Tree-sitter AST parsing |
| 25 | +- **📝 Auto Documentation**: Generate JSDoc/DocString comments |
| 26 | +- **🔧 Code Actions**: Explain, optimize, and fix code with AI |
| 27 | +- **🤖 Agent Support**: Extensible agent system via MCP (Model Context Protocol) |
| 28 | +- **🌐 Multi-LLM Support**: OpenAI, Anthropic, Google, DeepSeek, Ollama, OpenRouter |
| 29 | + |
| 30 | +## 🚀 Quick Start |
| 31 | + |
| 32 | +1. **Install the Extension**: Search for "AutoDev" in VSCode Marketplace |
| 33 | +2. **Configure LLM Provider**: Open Settings → AutoDev → Set your API key and model |
| 34 | +3. **Start Coding**: Press `Cmd+Shift+A` (Mac) / `Ctrl+Shift+A` (Windows/Linux) to open chat |
| 35 | + |
| 36 | +## 📖 Configuration |
| 37 | + |
| 38 | +### LLM Provider Setup |
| 39 | + |
| 40 | +```json |
| 41 | +{ |
| 42 | + "autodev.provider": "openai", |
| 43 | + "autodev.model": "gpt-4o-mini", |
| 44 | + "autodev.apiKey": "your-api-key-here" |
| 45 | +} |
| 46 | +``` |
| 47 | + |
| 48 | +### CodeLens Settings |
| 49 | + |
| 50 | +```json |
| 51 | +{ |
| 52 | + "autodev.codelens.enable": true, |
| 53 | + "autodev.codelens.displayMode": "expand", |
| 54 | + "autodev.codelens.items": [ |
| 55 | + "quickChat", |
| 56 | + "autoTest", |
| 57 | + "autoComment" |
| 58 | + ] |
| 59 | +} |
| 60 | +``` |
| 61 | + |
| 62 | +## 🏗️ Architecture (Kotlin Multiplatform) |
2 | 63 |
|
3 | | -基于 Kotlin Multiplatform (KMP) 的 VSCode 扩展,复用 mpp-core 的核心能力。 |
| 64 | +This version is built with: |
4 | 65 |
|
5 | | -## 架构概述 |
| 66 | +- **mpp-core**: Kotlin Multiplatform core library (shared logic) |
| 67 | +- **mpp-vscode**: VSCode extension (TypeScript + mpp-core via JS bindings) |
| 68 | +- **Tree-sitter**: Accurate code parsing for 8 languages (TS, JS, Python, Java, Kotlin, Go, Rust, etc.) |
| 69 | +- **MCP Protocol**: Model Context Protocol for IDE server integration |
| 70 | + |
| 71 | +### Project Structure |
6 | 72 |
|
7 | 73 | ``` |
8 | 74 | mpp-vscode/ |
9 | | -├── package.json # VSCode 扩展配置 |
10 | | -├── src/ |
11 | | -│ ├── extension.ts # 入口点 |
12 | | -│ ├── services/ |
13 | | -│ │ ├── ide-server.ts # MCP 协议服务器 |
14 | | -│ │ ├── diff-manager.ts # Diff 管理 |
15 | | -│ │ └── chat-service.ts # Chat 服务 |
16 | | -│ ├── providers/ |
17 | | -│ │ ├── chat-view.ts # Webview Provider |
18 | | -│ │ └── diff-content.ts # Diff Content Provider |
19 | | -│ ├── commands/ |
20 | | -│ │ └── index.ts # 命令注册 |
21 | | -│ └── bridge/ |
22 | | -│ └── mpp-core.ts # mpp-core 桥接层 |
23 | | -├── webview/ # Webview UI |
24 | | -│ ├── src/ |
25 | | -│ │ ├── App.tsx |
26 | | -│ │ └── components/ |
27 | | -│ └── package.json |
28 | | -└── tsconfig.json |
| 75 | +├── src/ # TypeScript extension code |
| 76 | +│ ├── extension.ts # Main entry point |
| 77 | +│ ├── providers/ # CodeLens, Chat providers |
| 78 | +│ ├── services/ # IDE Server, Diff Manager |
| 79 | +│ └── commands/ # CodeLens commands |
| 80 | +├── webview/ # React-based chat UI |
| 81 | +├── dist/ # Build output |
| 82 | +│ └── wasm/ # Tree-sitter WASM files |
| 83 | +└── scripts/ # Build scripts |
29 | 84 | ``` |
30 | 85 |
|
31 | | -## TODO List |
32 | | - |
33 | | -### Phase 1: 项目基础设施 ✅ |
34 | | -- [x] 创建项目目录结构 |
35 | | -- [x] 创建 package.json (VSCode 扩展配置) |
36 | | -- [x] 创建 tsconfig.json |
37 | | -- [x] 配置 esbuild 打包 |
38 | | -- [x] 配置 vitest 测试框架 |
39 | | - |
40 | | -### Phase 2: 核心服务 ✅ |
41 | | -- [x] 实现 mpp-core 桥接层 (`src/bridge/mpp-core.ts`) |
42 | | - - [x] 导入 @autodev/mpp-core |
43 | | - - [x] 封装 LLMService (JsKoogLLMService) |
44 | | - - [x] 封装 CodingAgent (JsCodingAgent) |
45 | | - - [x] 封装 ToolRegistry (JsToolRegistry) |
46 | | - - [x] 封装 CompletionManager (JsCompletionManager) |
47 | | - - [x] 封装 DevInsCompiler (JsDevInsCompiler) |
48 | | -- [x] 实现 extension.ts 入口 |
49 | | - - [x] 扩展激活/停用 |
50 | | - - [x] 服务初始化 |
51 | | -- [x] 添加单元测试 (`test/bridge/mpp-core.test.ts`) |
52 | | - |
53 | | -### Phase 3: IDE 集成 ✅ |
54 | | -- [x] 实现 IDE Server (MCP 协议) |
55 | | - - [x] Express HTTP 服务器 |
56 | | - - [x] 端点: /health, /context, /diff/open, /diff/close, /file/read, /file/write |
57 | | - - [x] 认证和 CORS 保护 |
58 | | - - [x] 端口文件写入 (~/.autodev/ide-server.json) |
59 | | -- [x] 实现 Diff Manager |
60 | | - - [x] showDiff() - 显示差异 |
61 | | - - [x] acceptDiff() - 接受更改 |
62 | | - - [x] cancelDiff() - 取消更改 |
63 | | - - [x] closeDiffByPath() - 按路径关闭 |
64 | | - - [x] DiffContentProvider |
65 | | -- [x] 添加单元测试 (`test/services/`) |
66 | | - |
67 | | -### Phase 4: Chat 界面 ✅ |
68 | | -- [x] 实现 Chat Webview Provider |
69 | | - - [x] Webview 创建和管理 |
70 | | - - [x] 消息桥接 (VSCode ↔ Webview) |
71 | | - - [x] LLM 服务集成 |
72 | | -- [x] 创建 Webview UI (内嵌 HTML) |
73 | | - - [x] 聊天消息组件 |
74 | | - - [x] 输入框组件 |
75 | | - - [x] 流式响应显示 |
76 | | - |
77 | | -### Phase 5: 命令和功能 ✅ |
78 | | -- [x] 注册 VSCode 命令 |
79 | | - - [x] autodev.chat - 打开聊天 |
80 | | - - [x] autodev.acceptDiff - 接受差异 |
81 | | - - [x] autodev.cancelDiff - 取消差异 |
82 | | - - [x] autodev.runAgent - 运行 Agent |
83 | | -- [x] 快捷键绑定 (Cmd+Shift+A) |
84 | | -- [x] 状态栏集成 |
85 | | - |
86 | | -### Phase 6: 高级功能 ✅ |
87 | | -- [x] DevIns 语言支持 |
88 | | - - [x] 语法高亮 (TextMate grammar) |
89 | | - - [x] 自动补全 (/, @, $ 触发) |
90 | | -- [x] React Webview UI |
91 | | - - [x] React + Vite 构建 |
92 | | - - [x] Markdown 渲染 (react-markdown + remark-gfm) |
93 | | - - [x] VSCode 主题集成 |
94 | | - - [x] 流式响应动画 |
95 | | -- [ ] 代码索引集成 |
96 | | -- [ ] 领域词典支持 |
97 | | - |
98 | | -## 参考项目 |
99 | | - |
100 | | -1. **autodev-vscode** - 早期 AutoDev VSCode 版本,全功能实现 |
101 | | -2. **gemini-cli/vscode-ide-companion** - Gemini 的轻量级 MCP 桥接器 |
102 | | -3. **mpp-ui** - 现有的 CLI 工具,展示如何使用 mpp-core |
103 | | - |
104 | | -## 开发指南 |
105 | | - |
106 | | -### 构建 mpp-core |
| 86 | +## 🔌 Supported Languages |
107 | 87 |
|
108 | | -```bash |
109 | | -cd /Volumes/source/ai/autocrud |
110 | | -./gradlew :mpp-core:assembleJsPackage |
111 | | -``` |
| 88 | +CodeLens and code parsing support: |
112 | 89 |
|
113 | | -### 安装依赖 |
| 90 | +- TypeScript/JavaScript (including React/TSX) |
| 91 | +- Python |
| 92 | +- Java |
| 93 | +- Kotlin |
| 94 | +- Go |
| 95 | +- Rust |
| 96 | + |
| 97 | +## 🛠️ Development |
| 98 | + |
| 99 | +### Prerequisites |
| 100 | + |
| 101 | +- Node.js 18+ |
| 102 | +- VSCode 1.77+ |
| 103 | + |
| 104 | +### Build from Source |
114 | 105 |
|
115 | 106 | ```bash |
| 107 | +# Install dependencies |
116 | 108 | cd mpp-vscode |
117 | 109 | npm install |
118 | | -``` |
119 | 110 |
|
120 | | -### 开发模式 |
| 111 | +# Build |
| 112 | +npm run build |
121 | 113 |
|
122 | | -```bash |
| 114 | +# Watch mode |
123 | 115 | npm run watch |
124 | | -``` |
125 | 116 |
|
126 | | -### 打包扩展 |
127 | | - |
128 | | -```bash |
| 117 | +# Package extension |
129 | 118 | npm run package |
130 | 119 | ``` |
131 | 120 |
|
132 | | -## 技术栈 |
| 121 | +## 📚 Documentation |
| 122 | + |
| 123 | +- **Official Docs**: [https://vscode.unitmesh.cc/](https://vscode.unitmesh.cc/) |
| 124 | +- **JetBrains IDE Version**: [https://github.com/unit-mesh/auto-dev](https://github.com/unit-mesh/auto-dev) |
| 125 | +- **Contributing**: [https://vscode.unitmesh.cc/development](https://vscode.unitmesh.cc/development) |
| 126 | + |
| 127 | +## 🤝 Join the Community |
| 128 | + |
| 129 | +<img src="https://unitmesh.cc/images/qrcode.jpg" height="400px" alt="wechat qrcode" /> |
| 130 | + |
| 131 | +If you are interested in AutoDev, you can join our WeChat group by scanning the QR code above. |
| 132 | + |
| 133 | +(如果群二维码过期,可以添加我的微信号:`phodal02`,注明 `AutoDev`,我拉你入群) |
| 134 | + |
| 135 | +## 📋 Feature Comparison |
| 136 | + |
| 137 | +| Feature | KMP Edition | Original VSCode | |
| 138 | +|------------------------|-------------|-----------------| |
| 139 | +| Chat mode | ✅ | ✅ | |
| 140 | +| CodeLens | ✅ | ✅ | |
| 141 | +| AutoDoc | ✅ | ✅ | |
| 142 | +| AutoTest | ✅ | ✅ | |
| 143 | +| Tree-sitter Parsing | ✅ | ✅ | |
| 144 | +| MCP Protocol | ✅ | ❌ | |
| 145 | +| Cross-platform Core | ✅ (KMP) | ❌ | |
| 146 | +| iOS Support (Future) | 🚧 | ❌ | |
| 147 | +| Android Support (Future)| 🚧 | ❌ | |
| 148 | + |
| 149 | +## 🎯 Roadmap |
| 150 | + |
| 151 | +- [x] Basic Chat functionality |
| 152 | +- [x] CodeLens with Tree-sitter |
| 153 | +- [x] Auto Test/Doc/Method |
| 154 | +- [x] Multi-LLM support |
| 155 | +- [ ] Enhanced agent system |
| 156 | +- [ ] iOS/Android support (via KMP) |
| 157 | +- [ ] Desktop standalone app |
| 158 | + |
| 159 | +## 📄 License |
| 160 | + |
| 161 | +Apache-2.0 |
133 | 162 |
|
134 | | -- **TypeScript** - 主要开发语言 |
135 | | -- **mpp-core (Kotlin/JS)** - 核心 LLM 和 Agent 能力 |
136 | | -- **React** - Webview UI |
137 | | -- **Express** - MCP 服务器 |
138 | | -- **esbuild** - 打包工具 |
| 163 | +## 🙏 Acknowledgments |
139 | 164 |
|
| 165 | +Built on the foundation of [AutoDev VSCode](https://github.com/unit-mesh/auto-dev-vscode), reimagined with Kotlin Multiplatform for next-generation cross-platform AI coding assistance. |
0 commit comments