贡献指南
如何为 OpenCowork 贡献代码。
贡献指南 / Contributing
欢迎为 OpenCowork 贡献代码!
开始之前 / Before You Start
- Fork AIDotNet/OpenCowork
- 克隆你的 Fork:
git clone https://github.com/YOUR_USERNAME/OpenCowork.git - 搭建开发环境:参见 开发环境搭建
开发流程 / Development Workflow
# 创建功能分支
git checkout -b feature/your-feature-name
# 开发并测试
npm run dev
# 类型检查
npm run typecheck
# 代码规范检查
npm run lint
# 提交
git commit -m "feat: add your feature"
# 推送并创建 PR
git push origin feature/your-feature-nameCommit 规范 / Commit Convention
使用 Conventional Commits 规范:
| 类型 | 说明 | 示例 |
|---|---|---|
feat | 新功能 | feat(tools): add git status tool |
fix | Bug 修复 | fix(agent): handle null tool result |
docs | 文档更新 | docs: update installation guide |
refactor | 代码重构 | refactor(store): migrate to immer |
chore | 构建/工具链变更 | chore: bump electron to v36 |
添加新工具 / Adding a New Tool
- 在
src/renderer/src/lib/tools/创建工具文件 - 实现
ToolHandler接口 - 在
src/renderer/src/lib/tools/index.ts的注册处添加
export const myTool: ToolHandler = {
definition: {
name: 'MyTool',
description: '工具描述',
input_schema: {
type: 'object',
properties: {
param: { type: 'string', description: '参数说明' }
},
required: ['param']
}
},
async execute(input, ctx) {
const { param } = input as { param: string }
return { type: 'text', text: `结果: ${param}` }
}
}添加新消息平台插件 / Adding a New Plugin
- 在
src/main/channels/providers/创建平台目录 - 实现
MessagingChannelService接口(或继承BasePluginService) - 在
src/main/index.ts的ChannelManager中注册工厂 - 在文档中添加对应的配置页面
更新文档 / Updating Docs
文档站点是独立的 Fumadocs + Next.js 项目:
cd docs
npm run devMDX 源文件在 docs/docs/ 目录下,修改后提交即可。
问题反馈 / Reporting Issues
在 GitHub Issues 提交问题,请包含:
- 操作系统和版本
- OpenCowork 版本
- 复现步骤
- 错误日志(
~/.open-cowork/crash.log)