copilotkit-contribute
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseContributing to CopilotKit
为CopilotKit贡献代码
Important: CopilotKit's internal v2 packages use thenamespace. The public API that users install is@copilotkit/*. When contributing, you work with@copilotkit/*source but users never see that namespace.@copilotkit/*
重要提示: CopilotKit内部v2包使用命名空间。用户安装的公共API同样为@copilotkit/*。贡献代码时你操作的是@copilotkit/*源码,但用户不会感知到该命名空间的存在。@copilotkit/*
Live Documentation (MCP)
实时文档(MCP)
This plugin includes an MCP server () that provides and tools for querying live CopilotKit documentation and source code.
copilotkit-docssearch-docssearch-code- Claude Code: Auto-configured by the plugin's -- no setup needed.
.mcp.json - Codex: Requires manual configuration. See the copilotkit-debug skill for setup instructions.
本插件包含一个MCP服务器(),提供和工具,可用于查询CopilotKit实时文档和源代码。
copilotkit-docssearch-docssearch-code- Claude Code: 插件的会自动完成配置,无需额外设置。
.mcp.json - Codex: 需要手动配置。查看copilotkit-debug skill获取设置说明。
Workflow
工作流程
- Fork and clone the CopilotKit/CopilotKit repository.
- Install dependencies with (requires pnpm v9.x and Node 20+).
pnpm install - Build once with to bootstrap all packages.
pnpm build - Create a branch using the naming convention: ,
feat/<ISSUE>-<name>, orfix/<ISSUE>-<name>.docs/<ISSUE>-<name> - Develop with (watches all packages) or target a specific package with
pnpm dev.nx run @copilotkit/<pkg>:dev - Write and run tests with . All v2 packages use Vitest.
nx run @copilotkit/<pkg>:test - Lint and format with .
pnpm run lint --fix && pnpm run format - Commit using conventional commit format: (enforced by commitlint).
<type>(<scope>): <subject> - Push and open a PR against the branch. CI builds all packages and publishes preview packages via pkg-pr-new.
main
- Fork并克隆 CopilotKit/CopilotKit仓库。
- 安装依赖:执行(需要pnpm v9.x和Node 20及以上版本)。
pnpm install - 首次构建:执行来初始化所有包。
pnpm build - 创建分支,分支命名规范为:、
feat/<ISSUE>-<name>或fix/<ISSUE>-<name>。docs/<ISSUE>-<name> - 开发:执行(监听所有包的变化),或者指定单独包运行:
pnpm dev。nx run @copilotkit/<pkg>:dev - 编写并运行测试:执行。所有v2包都使用Vitest。
nx run @copilotkit/<pkg>:test - 代码检查与格式化:执行。
pnpm run lint --fix && pnpm run format - 提交代码:使用约定式提交格式:(由commitlint强制校验)。
<type>(<scope>): <subject> - 推送代码并提交PR:目标分支为。CI会构建所有包,并通过pkg-pr-new发布预览版本包。
main
Before Opening a PR
提交PR前注意事项
- Reach out to the maintainers first for any significant work (file an issue or ask on Discord).
- Run to verify all tests pass.
pnpm run test - Run to verify the full build succeeds.
pnpm run build - Run to verify formatting.
pnpm run check-prettier - Ensure commit messages follow the format.
<type>(<scope>): <subject>
- 如果你要做重大改动,请先联系维护者(提交issue或在Discord上询问)。
- 运行确认所有测试通过。
pnpm run test - 运行确认完整构建成功。
pnpm run build - 运行确认代码格式符合规范。
pnpm run check-prettier - 确保提交信息遵循格式。
<type>(<scope>): <subject>
Quick Reference
快速参考
| Task | Command |
|---|---|
| Install dependencies | |
| Build all packages | |
| Dev mode (all) | |
| Dev mode (v2 only) | |
| Run all tests | |
| Run v2 tests only | |
| Run single package tests | |
| Test with coverage | |
| Lint | |
| Format | |
| Check formatting | |
| Type check | |
| Package quality checks | |
| Dependency graph | |
| 任务 | 命令 |
|---|---|
| 安装依赖 | |
| 构建所有包 | |
| 全量开发模式 | |
| 仅v2版本开发模式 | |
| 运行所有测试 | |
| 仅运行v2版本测试 | |
| 运行单个包的测试 | |
| 带覆盖率的测试 | |
| 代码检查 | |
| 代码格式化 | |
| 格式检查 | |
| 类型检查 | |
| 包质量检查 | |
| 依赖关系图 | |
Key Architecture Points
核心架构要点
- V2 () is the real implementation. V1 (
@copilotkit/*) wraps V2.@copilotkit/* - New features always go in V2 packages under .
packages/v2/ - Communication between frontend and runtime uses the AG-UI protocol (SSE-based events).
- The monorepo uses Nx for task orchestration and pnpm workspaces.
- V2版本()是核心实现。V1版本(
@copilotkit/*)是V2的封装。@copilotkit/* - 新功能永远提交到目录下的V2包中。
packages/v2/ - 前端和运行时之间的通信使用AG-UI协议(基于SSE的事件)。
- 该monorepo使用Nx进行任务编排,使用pnpm workspace管理依赖。
Reference Documents
参考文档
- Contribution Guide — full onboarding walkthrough
- Repo Structure — package layout and architecture
- Testing Guide — Vitest setup, running tests, coverage
- PR Guidelines — CI checks, review process, expectations
- 贡献指南 —— 完整的上手流程
- 仓库结构 —— 包布局和架构说明
- 测试指南 —— Vitest配置、测试运行、覆盖率相关说明
- PR规范 —— CI检查、评审流程、要求说明