OpenCowork
开发指南

贡献指南

如何为 OpenCowork 贡献代码。

贡献指南 / Contributing

欢迎为 OpenCowork 贡献代码!以下是参与贡献的指南。

开始之前 / Before You Start

  1. Fork AIDotNet/OpenCowork
  2. 克隆你的 Fork:git clone https://github.com/YOUR_USERNAME/OpenCowork.git
  3. 搭建开发环境:参见 开发环境搭建

开发流程 / 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-name

Commit 规范 / Commit Convention

使用 Conventional Commits 规范:

类型说明
feat新功能
fixBug 修复
docs文档更新
refactor代码重构
chore构建/工具链变更

添加新工具 / Adding a New Tool

  1. src/renderer/src/lib/tools/ 创建工具文件
  2. 实现 ToolHandler 接口
  3. src/renderer/src/App.tsx 的工具注册处添加
// 工具实现示例
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

  1. src/main/channels/providers/ 创建平台目录
  2. 实现 MessagingChannelService 接口
  3. ChannelManager 中注册工厂

问题反馈 / Reporting Issues

GitHub Issues 提交问题,请包含:

  • 操作系统和版本
  • OpenCowork 版本
  • 复现步骤
  • 错误日志(~/.open-cowork/crash.log

On this page