Skip to content

Commit 0127849

Browse files
authored
Merge pull request #55 from TencentCloudBase/claude/issue-54-20250710_084932
feat: add OpenCode CLI support
2 parents 1725101 + c8154c5 commit 0127849

5 files changed

Lines changed: 244 additions & 2 deletions

File tree

README.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ npx -y clear-npx-cache
153153
| [Claude Code](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/ide-setup/claude-code) | 命令行工具 | [查看指引](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/ide-setup/claude-code) |
154154
| [Gemini CLI](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/ide-setup/gemini-cli) | 命令行工具 | [查看指引](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/ide-setup/gemini-cli) |
155155
| [OpenAI Codex CLI](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/ide-setup/openai-codex-cli) | 命令行工具 | [查看指引](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/ide-setup/openai-codex-cli) |
156+
| [OpenCode](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/ide-setup/opencode) | 命令行工具 | [查看指引](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/ide-setup/opencode) |
156157

157158

158159
<details>
@@ -700,6 +701,63 @@ codex --config .codex/config.toml
700701

701702
</details>
702703

704+
<details>
705+
<summary><strong>🧑‍💻 OpenCode 配置</strong></summary>
706+
707+
#### 步骤1:安装 OpenCode
708+
709+
[OpenCode GitHub](https://github.com/opencode-ai/opencode) 下载并安装 OpenCode CLI 工具
710+
711+
#### 步骤2:配置 MCP
712+
713+
> [!TIP]
714+
> 如果安装以后工具数量一直为 0,请参考[常见问题](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/faq#mcp-%E6%98%BE%E7%A4%BA%E5%B7%A5%E5%85%B7%E6%95%B0%E9%87%8F%E4%B8%BA-0-%E6%80%8E%E4%B9%88%E5%8A%9E)
715+
716+
如果使用模板项目,MCP 配置已经预置完成。如果不是从模板开始,在项目根目录创建 `.opencode.json` 文件:
717+
718+
```json
719+
{
720+
"mcpServers": {
721+
"cloudbase-mcp": {
722+
"command": "npx",
723+
"args": ["-y", "@cloudbase/cloudbase-mcp@latest"]
724+
}
725+
}
726+
}
727+
```
728+
729+
#### 步骤3:启用 AI 规则
730+
731+
OpenCode 支持多种规则文件格式,模板中已包含 `OPENCODE.md` 文件。如果不是从模板开始,可以让 AI 帮你下载云开发规则:
732+
733+
```
734+
在当前项目中下载云开发 AI 规则
735+
```
736+
737+
#### 步骤4:开始开发
738+
739+
启动 OpenCode CLI:
740+
741+
```bash
742+
opencode
743+
```
744+
745+
或者直接提问:
746+
747+
```bash
748+
opencode -p "登录云开发"
749+
```
750+
751+
在 OpenCode CLI 中与 AI 对话:
752+
753+
```
754+
登录云开发
755+
```
756+
757+
然后就可以进行需求的开发了
758+
759+
</details>
760+
703761
<details>
704762
<summary><strong>🔄 更新 CloudBase AI ToolKit</strong></summary>
705763

config/.opencode.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"mcpServers": {
3+
"cloudbase-mcp": {
4+
"command": "npx",
5+
"args": ["-y", "@cloudbase/cloudbase-mcp@latest"]
6+
}
7+
}
8+
}

doc/faq.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
4. 对 AI 说"登录云开发"开始开发
2020

2121
### 支持哪些 AI 开发工具?
22-
支持 Cursor、WindSurf、CodeBuddy、CLINE、GitHub Copilot、Claude Code、Gemini CLI、OpenAI Codex CLI、Trae、通义灵码、RooCode、文心快码、Augment Code 等主流 AI 开发工具。
22+
支持 Cursor、WindSurf、CodeBuddy、CLINE、GitHub Copilot、Claude Code、Gemini CLI、OpenAI Codex CLI、OpenCode、Trae、通义灵码、RooCode、文心快码、Augment Code 等主流 AI 开发工具。
2323

2424
## 🛠️ 技术问题
2525

doc/ide-setup/opencode.md

Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
# CloudBase AI Toolkit + OpenCode
2+
3+
<div align="center">
4+
5+
**🚀 OpenCode + 云开发 = 几分钟内从想法到上线的全栈应用**
6+
7+
[![GitHub Stars](https://img.shields.io/github/stars/TencentCloudBase/CloudBase-AI-ToolKit?style=social)](https://github.com/TencentCloudBase/CloudBase-AI-ToolKit)
8+
[![开源协议](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/TencentCloudBase/CloudBase-AI-ToolKit/blob/main/LICENSE)
9+
10+
</div>
11+
12+
> 💡 **为什么选择 OpenCode + CloudBase AI Toolkit?**
13+
> OpenCode 是一个开源的 AI 编程 CLI 工具,支持多种 AI 模型和 MCP 协议,具有强大的代码生成和项目管理能力。结合 CloudBase AI Toolkit,让你通过自然语言描述需求,AI 自动生成并部署全栈应用到腾讯云开发平台。特别适合命令行开发者、自动化部署场景和多环境管理。
14+
15+
## ✨ 核心优势
16+
17+
| 🎯 **开发效率** |**部署速度** | 🛡️ **稳定可靠** |
18+
|---|---|---|
19+
| AI 自动生成代码和架构<br/>内置云开发最佳实践规则<br/>智能错误修复和优化 | 一键部署到腾讯云开发<br/>国内 CDN 加速访问<br/>Serverless 架构免运维 | 330万开发者验证的平台<br/>企业级安全和稳定性<br/>完善的监控和日志系统 |
20+
21+
## 🚀 5分钟快速开始
22+
23+
### 方式一:使用项目模板(推荐)
24+
25+
选择预配置的项目模板,开箱即用:
26+
27+
<div align="center">
28+
29+
**[📦 查看所有项目模板](../templates)**
30+
31+
</div>
32+
33+
### 方式二:现有项目集成
34+
35+
如果你已有项目,只需 3 步集成:
36+
37+
```bash
38+
# 1. 配置 MCP(具体配置见下方详细步骤)
39+
# 2. 下载 AI 规则
40+
# 3. 开始使用
41+
```
42+
43+
配置完成后,运行 OpenCode 并说:**"登录云开发"** 即可开始!
44+
45+
## 🔧 详细配置指南
46+
47+
### 步骤 1:安装 OpenCode
48+
49+
[OpenCode GitHub](https://github.com/opencode-ai/opencode) 下载并安装 OpenCode CLI 工具。
50+
51+
```bash
52+
# 使用 npm 安装
53+
npm install -g opencode
54+
55+
# 或者使用 yarn
56+
yarn global add opencode
57+
58+
# 或者直接从 GitHub 下载二进制文件
59+
```
60+
61+
### 步骤 2:配置 CloudBase MCP
62+
63+
> [!TIP]
64+
> 如果安装以后工具数量一直为 0,请参考[常见问题](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/faq#mcp-%E6%98%BE%E7%A4%BA%E5%B7%A5%E5%85%B7%E6%95%B0%E9%87%8F%E4%B8%BA-0-%E6%80%8E%E4%B9%88%E5%8A%9E)
65+
66+
在项目根目录创建 `.opencode.json` 文件:
67+
68+
```json
69+
{
70+
"mcpServers": {
71+
"cloudbase-mcp": {
72+
"command": "npx",
73+
"args": ["-y", "@cloudbase/cloudbase-mcp@latest"]
74+
}
75+
}
76+
}
77+
```
78+
79+
### 步骤 3:启用 AI 规则
80+
81+
OpenCode 支持多种规则文件格式,已包含 `OPENCODE.md` 规则文件。如果是现有项目,对 AI 说:
82+
```
83+
在当前项目中下载云开发 AI 规则
84+
```
85+
86+
### 步骤 4:开始开发
87+
88+
使用 OpenCode CLI 与 AI 对话:
89+
90+
```bash
91+
# 启动 OpenCode
92+
opencode
93+
94+
# 或者直接提问
95+
opencode "登录云开发"
96+
```
97+
98+
## 🎯 开始使用
99+
100+
配置完成后,对 AI 说:
101+
102+
```
103+
登录云开发
104+
```
105+
106+
然后就可以开始开发了,例如:
107+
108+
```
109+
创建一个在线投票系统,支持创建投票、参与投票、结果统计,使用云数据库存储,最后部署
110+
```
111+
112+
## 🌟 CloudBase AI Toolkit 开源项目
113+
114+
<div align="center">
115+
116+
### 🔥 加入开源社区
117+
118+
[![GitHub](https://img.shields.io/badge/GitHub-TencentCloudBase/CloudBase--AI--ToolKit-black?style=for-the-badge&logo=github)](https://github.com/TencentCloudBase/CloudBase-AI-ToolKit)
119+
[![CNB社区](https://img.shields.io/badge/CNB-CloudBase--AI--ToolKit-orange?style=for-the-badge)](https://cnb.cool/tencent/cloud/cloudbase/CloudBase-AI-ToolKit)
120+
121+
**⭐ Star 项目 | 🤝 贡献代码 | 💬 技术交流**
122+
123+
</div>
124+
125+
## 🛠️ 故障排除
126+
127+
### 常见问题
128+
129+
**Q: MCP 连接失败?**
130+
A:
131+
1. 检查配置文件格式是否正确
132+
2. 重启 OpenCode
133+
3. 确认网络连接正常
134+
4. 检查 Node.js 版本(建议 18+)
135+
136+
**Q: AI 生成的代码不符合预期?**
137+
A:
138+
1. 明确描述技术栈和框架要求
139+
2. 使用项目模板确保规范一致性
140+
3. 提供更详细的需求描述
141+
142+
**Q: 命令行工具无响应?**
143+
A:
144+
1. 检查是否正确安装了 OpenCode
145+
2. 确认 MCP 服务器配置正确
146+
3. 尝试重新启动终端
147+
148+
更多问题请查看:[完整 FAQ](../faq)
149+
150+
## 📚 相关资源
151+
152+
- [📖 开发指南](../development) - 深入了解开发最佳实践
153+
- [🎯 使用案例](../examples) - 查看实际应用案例
154+
- [🔧 MCP 工具](../mcp-tools) - 了解所有可用工具
155+
- [❓ 常见问题](../faq) - 查看常见问题解答
156+
157+
## 💬 技术交流
158+
159+
### 微信技术交流群
160+
161+
<div align="center">
162+
<img src="https://7463-tcb-advanced-a656fc-1257967285.tcb.qcloud.la/mcp/toolkit-qrcode.png" width="200" alt="微信群二维码"/>
163+
<br/>
164+
<i>扫码加入微信技术交流群</i>
165+
</div>
166+
167+
---
168+
169+
<div align="center">
170+
171+
**🚀 立即开始使用 OpenCode + CloudBase AI Toolkit**
172+
173+
[开始使用](../getting-started) | [查看模板](../templates) | [GitHub 仓库](https://github.com/TencentCloudBase/CloudBase-AI-ToolKit)
174+
175+
</div>

doc/index.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
</div>
1616

17-
当你在**Cursor/ VSCode GitHub Copilot/WinSurf/CodeBuddy/Augment Code/Claude Code/OpenAI Codex CLI**等AI编程工具里写代码时,它能自动帮你生成可直接部署的前后端应用+小程序,并一键发布到腾讯云开发 CloudBase。
17+
当你在**Cursor/ VSCode GitHub Copilot/WinSurf/CodeBuddy/Augment Code/Claude Code/OpenAI Codex CLI/OpenCode**等AI编程工具里写代码时,它能自动帮你生成可直接部署的前后端应用+小程序,并一键发布到腾讯云开发 CloudBase。
1818

1919
:::tip 🌟 开源项目
2020
- **GitHub 仓库**: [TencentCloudBase/CloudBase-AI-ToolKit](https://github.com/TencentCloudBase/CloudBase-AI-ToolKit) - 欢迎 Star 和贡献代码
@@ -61,6 +61,7 @@
6161
| [Claude Code](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/ide-setup/claude-code) | 命令行工具 | [查看指引](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/ide-setup/claude-code) |
6262
| [Gemini CLI](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/ide-setup/gemini-cli) | 命令行工具 | [查看指引](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/ide-setup/gemini-cli) |
6363
| [OpenAI Codex CLI](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/ide-setup/openai-codex-cli) | 命令行工具 | [查看指引](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/ide-setup/openai-codex-cli) |
64+
| [OpenCode](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/ide-setup/opencode) | 命令行工具 | [查看指引](https://docs.cloudbase.net/ai/cloudbase-ai-toolkit/ide-setup/opencode) |
6465

6566
## 🎯 快速导航
6667

0 commit comments

Comments
 (0)