OCOpenCowork
Get startedInstallChannelsAgentsCapabilitiesSkillsModelsPlatformsOpsReferenceHelp

贡献指南

如何为 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新功能feat(tools): add git status tool
fixBug 修复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

  1. src/renderer/src/lib/tools/ 创建工具文件
  2. 实现 ToolHandler 接口
  3. 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

  1. src/main/channels/providers/ 创建平台目录
  2. 实现 MessagingChannelService 接口(或继承 BasePluginService
  3. src/main/index.tsChannelManager 中注册工厂
  4. 在文档中添加对应的配置页面

更新文档 / Updating Docs

文档站点是独立的 Fumadocs + Next.js 项目:

cd docs
npm run dev

MDX 源文件在 docs/docs/ 目录下,修改后提交即可。

问题反馈 / Reporting Issues

GitHub Issues 提交问题,请包含:

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

On this page