@alibaba-group/open-code-review 1.1.7 → 1.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "open-code-review",
3
+ "owner": {
4
+ "name": "alibaba"
5
+ },
6
+ "description": "AI-powered code review agent that reads Git diffs, analyzes changed files with LLM tool-use capabilities, and generates structured line-level review comments with cross-referential context awareness.",
7
+ "plugins": [
8
+ {
9
+ "name": "open-code-review",
10
+ "source": "./plugins/open-code-review",
11
+ "description": "Perform AI code review on Git diffs — supports workspace changes, branch ranges, and single commits with concurrent per-file analysis, codebase search, and deep context-aware review.",
12
+ "version": "1.0.0",
13
+ "license": "Apache-2.0"
14
+ }
15
+ ]
16
+ }
@@ -0,0 +1,218 @@
1
+ # Contributing to OpenCodeReview
2
+
3
+ Thank you for your interest in contributing to OpenCodeReview! Every contribution matters — whether it's fixing a typo, reporting a bug, or implementing a new feature.
4
+
5
+ [简体中文版](CONTRIBUTING.zh-CN.md)
6
+
7
+ ## Code of Conduct
8
+
9
+ By participating in this project, you agree to maintain a respectful and inclusive environment. Please be kind and constructive in all interactions.
10
+
11
+ ## Ways to Contribute
12
+
13
+ There are many ways to contribute beyond writing code:
14
+
15
+ - **Report bugs** — Found something broken? Open an issue with reproduction steps.
16
+ - **Suggest features** — Have an idea for improvement? You can start a conversation in [GitHub Discussions](https://github.com/alibaba/open-code-review/discussions/categories/ideas) or open a [Feature Request](https://github.com/alibaba/open-code-review/issues/new?template=feature_request.yml) issue.
17
+ - **Improve documentation** — Fix typos, clarify explanations, or add examples. You can also open a [Documentation Issue](https://github.com/alibaba/open-code-review/issues/new?template=docs_report.yml) to report problems.
18
+ - **Review pull requests** — Help us review code from other contributors.
19
+ - **Write code** — Fix bugs, add features, or improve performance.
20
+
21
+ ## Getting Started
22
+
23
+ ### Prerequisites
24
+
25
+ - [Go 1.25+](https://go.dev/dl/)
26
+ - [Git](https://git-scm.com/)
27
+ - [Make](https://www.gnu.org/software/make/)
28
+
29
+ ### Setup
30
+
31
+ ```bash
32
+ # 1. Fork the repository on GitHub
33
+
34
+ # 2. Clone your fork
35
+ git clone https://github.com/<your-username>/open-code-review.git
36
+ cd open-code-review
37
+
38
+ # 3. Add upstream remote (for syncing updates from the main repo)
39
+ git remote add upstream https://github.com/alibaba/open-code-review.git
40
+
41
+ # 4. Build the project
42
+ make build
43
+
44
+ # 5. Run tests
45
+ make test
46
+ ```
47
+
48
+ If everything passes, you're ready to contribute.
49
+
50
+ > **Note:** The `upstream` remote is read-only for contributors — it is used to pull the latest changes from the main repository. You cannot push directly to upstream. All contributions must be pushed to your fork (`origin`) and submitted via Pull Request.
51
+
52
+ ## Development Workflow
53
+
54
+ ### Branching
55
+
56
+ Create a feature branch from `main`:
57
+
58
+ ```bash
59
+ git checkout main
60
+ git pull upstream main
61
+ git checkout -b feat/your-feature-name
62
+ ```
63
+
64
+ Use prefixes to indicate the type of change:
65
+
66
+ | Prefix | Purpose |
67
+ | ----------- | ------------------------------------- |
68
+ | `feat/` | New feature |
69
+ | `fix/` | Bug fix |
70
+ | `docs/` | Documentation only |
71
+ | `refactor/` | Code refactoring (no behavior change) |
72
+ | `test/` | Adding or updating tests |
73
+ | `chore/` | Build, CI, or tooling changes |
74
+
75
+ ### Commit Messages
76
+
77
+ Follow [Conventional Commits](https://www.conventionalcommits.org/) format:
78
+
79
+ ```
80
+ <type>(<scope>): <short summary>
81
+
82
+ [optional body]
83
+ ```
84
+
85
+ Examples:
86
+
87
+ ```
88
+ feat(agent): add support for custom tool definitions
89
+ fix(llm): handle timeout errors in Anthropic API calls
90
+ docs(README): update configuration examples
91
+ ```
92
+
93
+ ### Code Quality
94
+
95
+ Before submitting your changes, make sure they pass all checks:
96
+
97
+ ```bash
98
+ # Format and lint (Go standard tooling)
99
+ go fmt ./...
100
+ go vet ./...
101
+
102
+ # Run tests with race detection
103
+ make test
104
+
105
+ # Build successfully
106
+ make build
107
+ ```
108
+
109
+ ### Project Structure
110
+
111
+ ```
112
+ ├── cmd/opencodereview/ # CLI entry point
113
+ ├── internal/
114
+ │ ├── agent/ # Review agent logic
115
+ │ ├── config/ # Configuration management
116
+ │ ├── diff/ # Git diff parsing
117
+ │ ├── llm/ # LLM API client (Anthropic & OpenAI)
118
+ │ ├── model/ # Data models
119
+ │ ├── session/ # Review session management
120
+ │ ├── tool/ # Built-in tools (file_read, code_search, etc.)
121
+ │ ├── telemetry/ # OpenTelemetry integration
122
+ │ └── viewer/ # WebUI session viewer
123
+ ├── pages/ # WebUI frontend
124
+ ├── scripts/ # Build & install scripts
125
+ └── bin/ # NPM wrapper
126
+ ```
127
+
128
+ ## Contributing to Documentation
129
+
130
+ Documentation is a crucial part of OpenCodeReview. We welcome improvements to README files, inline code comments, configuration examples, and any user-facing text.
131
+
132
+ ### What Counts as a Documentation Contribution
133
+
134
+ - Fixing typos, grammar errors, or broken links
135
+ - Clarifying confusing explanations or adding missing context
136
+ - Adding usage examples for commands or configuration options
137
+ - Updating outdated content (e.g., after a feature change)
138
+ - Translating or improving the Chinese documentation (`README.zh-CN.md`, `CONTRIBUTING.zh-CN.md`)
139
+
140
+ ### Documentation Workflow
141
+
142
+ 1. If you spot an issue but don't plan to fix it yourself, open a [Documentation Issue](https://github.com/alibaba/open-code-review/issues/new?template=docs_report.yml).
143
+ 2. If you'd like to fix it, fork the repo, make your changes, and submit a PR with the `docs/` branch prefix (e.g., `docs/fix-config-example`).
144
+ 3. Documentation-only PRs don't require test changes, but please verify that any commands or code snippets you include are accurate.
145
+
146
+ ### Documentation Files
147
+
148
+ | File | Purpose |
149
+ | ----------------------- | ------------------------------------ |
150
+ | `README.md` | Main project documentation (English) |
151
+ | `README.zh-CN.md` | Chinese translation |
152
+ | `CONTRIBUTING.md` | Contribution guide (English) |
153
+ | `CONTRIBUTING.zh-CN.md` | Contribution guide (Chinese) |
154
+
155
+ ## Submitting Changes
156
+
157
+ ### Opening an Issue
158
+
159
+ Before working on a significant change, please open an issue first to discuss the approach. This prevents duplicate work and ensures your contribution aligns with the project's direction.
160
+
161
+ When reporting a bug, include:
162
+
163
+ 1. OpenCodeReview version (`ocr version`)
164
+ 2. OS and architecture
165
+ 3. Steps to reproduce
166
+ 4. Expected vs. actual behavior
167
+ 5. Relevant logs or error messages
168
+
169
+ ### Pull Request Process
170
+
171
+ 1. **Keep PRs focused** — One logical change per PR. If you have multiple independent changes, submit separate PRs.
172
+ 2. **Write tests** — Add or update tests for any behavior changes.
173
+ 3. **Update docs** — If your change affects user-facing behavior, update the relevant documentation.
174
+ 4. **Sign the CLA** — All contributors must sign the Contributor License Agreement before their PR can be merged (see below).
175
+ 5. **Fill in the PR template** — Describe what your change does and why.
176
+
177
+ ### PR Title Format
178
+
179
+ Use the same Conventional Commits format as commit messages:
180
+
181
+ ```
182
+ feat(agent): add support for custom tool definitions
183
+ ```
184
+
185
+ ### Review Process
186
+
187
+ - A maintainer will review your PR, usually within a few business days.
188
+ - We may request changes — this is normal and collaborative, not adversarial.
189
+ - Once approved, a maintainer will merge your PR.
190
+
191
+ ## Contributor License Agreement (CLA)
192
+
193
+ We require all contributors to sign the Alibaba Open Source Contributor License Agreement before we can merge your contributions. This ensures that the project can be distributed under its license terms.
194
+
195
+ When you open your first PR, a CLA bot will post a comment with instructions. Simply follow the link to sign electronically — it only takes a minute.
196
+
197
+ ## First-Time Contributors
198
+
199
+ New to the project? Look for issues labeled:
200
+
201
+ - [`good first issue`](https://github.com/alibaba/open-code-review/labels/good%20first%20issue) — Small, well-scoped tasks ideal for getting started.
202
+ - [`help wanted`](https://github.com/alibaba/open-code-review/labels/help%20wanted) — Issues where we'd appreciate community help.
203
+
204
+ Some good areas to start:
205
+
206
+ - Improving error messages and CLI output
207
+ - Writing tests for untested code paths
208
+ - Documentation improvements
209
+
210
+ ## Community
211
+
212
+ - **Bug Reports** — [GitHub Issues](https://github.com/alibaba/open-code-review/issues)
213
+ - **Feature Suggestions** — [GitHub Discussions (Ideas)](https://github.com/alibaba/open-code-review/discussions/categories/ideas) or [Feature Request Issue](https://github.com/alibaba/open-code-review/issues/new?template=feature_request.yml)
214
+ - **Questions & Help** — If you have any questions about using OpenCodeReview, feel free to ask in [GitHub Discussions](https://github.com/alibaba/open-code-review/discussions)
215
+
216
+ ## License
217
+
218
+ By contributing to OpenCodeReview, you agree that your contributions will be licensed under the [Apache License 2.0](LICENSE).
@@ -0,0 +1,218 @@
1
+ # 贡献指南
2
+
3
+ 感谢你对 OpenCodeReview 的关注!无论是修复拼写错误、报告 Bug,还是实现新功能,每一份贡献都很有价值。
4
+
5
+ [English version](CONTRIBUTING.md)
6
+
7
+ ## 行为准则
8
+
9
+ 参与本项目即表示你同意维护一个尊重和包容的环境。请在所有交流中保持友善和建设性。
10
+
11
+ ## 贡献方式
12
+
13
+ 除了写代码,还有很多方式可以参与贡献:
14
+
15
+ - **报告 Bug** — 发现问题?请提交 issue 并附上复现步骤。
16
+ - **建议功能** — 有改进想法?可以在 [GitHub Discussions](https://github.com/alibaba/open-code-review/discussions/categories/ideas) 中发起讨论,或直接提交一个 [Feature Request](https://github.com/alibaba/open-code-review/issues/new?template=feature_request.yml) issue。
17
+ - **改进文档** — 修复错别字、完善说明或补充示例。也可以提交一个 [Documentation Issue](https://github.com/alibaba/open-code-review/issues/new?template=docs_report.yml) 来报告文档问题。
18
+ - **审查 PR** — 帮助我们审查其他贡献者的代码。
19
+ - **编写代码** — 修复 Bug、添加功能或提升性能。
20
+
21
+ ## 快速开始
22
+
23
+ ### 前置条件
24
+
25
+ - [Go 1.25+](https://go.dev/dl/)
26
+ - [Git](https://git-scm.com/)
27
+ - [Make](https://www.gnu.org/software/make/)
28
+
29
+ ### 环境搭建
30
+
31
+ ```bash
32
+ # 1. 在 GitHub 上 Fork 本仓库
33
+
34
+ # 2. 克隆你的 Fork
35
+ git clone https://github.com/<你的用户名>/open-code-review.git
36
+ cd open-code-review
37
+
38
+ # 3. 添加上游远端(用于同步主仓库的最新变更)
39
+ git remote add upstream https://github.com/alibaba/open-code-review.git
40
+
41
+ # 4. 构建项目
42
+ make build
43
+
44
+ # 5. 运行测试
45
+ make test
46
+ ```
47
+
48
+ 如果一切通过,就可以开始贡献了。
49
+
50
+ > **注意:** `upstream` 远端对贡献者是只读的,仅用于拉取主仓库的最新更新。你不能直接向 upstream 推送代码,所有贡献必须推送到你的 fork(`origin`),然后通过 Pull Request 提交。
51
+
52
+ ## 开发工作流
53
+
54
+ ### 分支管理
55
+
56
+ 从 `main` 创建功能分支:
57
+
58
+ ```bash
59
+ git checkout main
60
+ git pull upstream main
61
+ git checkout -b feat/your-feature-name
62
+ ```
63
+
64
+ 使用前缀标明变更类型:
65
+
66
+ | 前缀 | 用途 |
67
+ | ----------- | ---------------------- |
68
+ | `feat/` | 新功能 |
69
+ | `fix/` | Bug 修复 |
70
+ | `docs/` | 仅文档变更 |
71
+ | `refactor/` | 代码重构(无行为变化) |
72
+ | `test/` | 添加或更新测试 |
73
+ | `chore/` | 构建、CI 或工具链变更 |
74
+
75
+ ### 提交信息
76
+
77
+ 遵循 [Conventional Commits](https://www.conventionalcommits.org/) 规范:
78
+
79
+ ```
80
+ <type>(<scope>): <简短描述>
81
+
82
+ [可选的详细说明]
83
+ ```
84
+
85
+ 示例:
86
+
87
+ ```
88
+ feat(agent): add support for custom tool definitions
89
+ fix(llm): handle timeout errors in Anthropic API calls
90
+ docs(README): update configuration examples
91
+ ```
92
+
93
+ ### 代码质量
94
+
95
+ 提交前请确保通过以下检查:
96
+
97
+ ```bash
98
+ # 格式化和静态检查
99
+ go fmt ./...
100
+ go vet ./...
101
+
102
+ # 带竞态检测运行测试
103
+ make test
104
+
105
+ # 构建成功
106
+ make build
107
+ ```
108
+
109
+ ### 项目结构
110
+
111
+ ```
112
+ ├── cmd/opencodereview/ # CLI 入口
113
+ ├── internal/
114
+ │ ├── agent/ # 评审 Agent 逻辑
115
+ │ ├── config/ # 配置管理
116
+ │ ├── diff/ # Git diff 解析
117
+ │ ├── llm/ # LLM API 客户端(Anthropic & OpenAI)
118
+ │ ├── model/ # 数据模型
119
+ │ ├── session/ # 评审会话管理
120
+ │ ├── tool/ # 内置工具(file_read, code_search 等)
121
+ │ ├── telemetry/ # OpenTelemetry 集成
122
+ │ └── viewer/ # WebUI 会话查看器
123
+ ├── pages/ # WebUI 前端
124
+ ├── scripts/ # 构建和安装脚本
125
+ └── bin/ # NPM 包装器
126
+ ```
127
+
128
+ ## 文档贡献
129
+
130
+ 文档是 OpenCodeReview 的重要组成部分。我们欢迎对 README、代码注释、配置示例以及任何面向用户的文本进行改进。
131
+
132
+ ### 哪些算文档贡献
133
+
134
+ - 修复错别字、语法错误或失效链接
135
+ - 完善表述不清的说明或补充缺失的上下文
136
+ - 为命令或配置项添加使用示例
137
+ - 更新过时的内容(例如功能变更后的文档同步)
138
+ - 翻译或改进中英文文档(`README.zh-CN.md`、`CONTRIBUTING.zh-CN.md`)
139
+
140
+ ### 文档贡献流程
141
+
142
+ 1. 如果你发现问题但暂时不打算自己修复,请提交一个 [Documentation Issue](https://github.com/alibaba/open-code-review/issues/new?template=docs_report.yml)。
143
+ 2. 如果你想直接修复,fork 仓库后修改,提交 PR 时使用 `docs/` 分支前缀(例如 `docs/fix-config-example`)。
144
+ 3. 纯文档 PR 不需要修改测试,但请确保文中涉及的命令和代码片段准确无误。
145
+
146
+ ### 文档文件一览
147
+
148
+ | 文件 | 用途 |
149
+ | ----------------------- | -------------------- |
150
+ | `README.md` | 项目主文档(英文) |
151
+ | `README.zh-CN.md` | 中文翻译 |
152
+ | `CONTRIBUTING.md` | 贡献指南(英文) |
153
+ | `CONTRIBUTING.zh-CN.md` | 贡献指南(中文) |
154
+
155
+ ## 提交变更
156
+
157
+ ### 提交 Issue
158
+
159
+ 在进行重大修改之前,请先开一个 issue 讨论方案。这可以避免重复劳动,并确保你的贡献与项目方向一致。
160
+
161
+ 报告 Bug 时请包含:
162
+
163
+ 1. OpenCodeReview 版本(`ocr version`)
164
+ 2. 操作系统和架构
165
+ 3. 复现步骤
166
+ 4. 预期行为与实际行为
167
+ 5. 相关日志或错误信息
168
+
169
+ ### Pull Request 流程
170
+
171
+ 1. **保持 PR 聚焦** — 每个 PR 只包含一个逻辑变更。多个独立改动请分别提交 PR。
172
+ 2. **编写测试** — 为行为变更添加或更新测试。
173
+ 3. **更新文档** — 如果变更影响用户侧行为,请同步更新相关文档。
174
+ 4. **签署 CLA** — 所有贡献者需在 PR 合并前签署贡献者许可协议(详见下方)。
175
+ 5. **填写 PR 模板** — 描述你的改动是什么以及为什么这样做。
176
+
177
+ ### PR 标题格式
178
+
179
+ 使用与 commit message 相同的 Conventional Commits 格式:
180
+
181
+ ```
182
+ feat(agent): add support for custom tool definitions
183
+ ```
184
+
185
+ ### 审查流程
186
+
187
+ - 维护者通常会在几个工作日内审查你的 PR。
188
+ - 我们可能会要求修改——这很正常,是协作而非对立。
189
+ - 一旦批准,维护者会合并你的 PR。
190
+
191
+ ## 贡献者许可协议(CLA)
192
+
193
+ 我们要求所有贡献者在合并代码前签署阿里巴巴开源贡献者许可协议(CLA)。这确保项目可以在其许可条款下合法分发。
194
+
195
+ 当你首次提交 PR 时,CLA bot 会自动发布评论并附上签署说明。只需点击链接进行电子签署即可,整个过程只需一分钟。
196
+
197
+ ## 新手推荐
198
+
199
+ 第一次参与?可以关注以下标签的 issue:
200
+
201
+ - [`good first issue`](https://github.com/alibaba/open-code-review/labels/good%20first%20issue) — 小型、范围明确的任务,适合快速上手。
202
+ - [`help wanted`](https://github.com/alibaba/open-code-review/labels/help%20wanted) — 我们希望得到社区帮助的问题。
203
+
204
+ 适合入手的方向:
205
+
206
+ - 改善错误信息和 CLI 输出
207
+ - 为未覆盖的代码路径编写测试
208
+ - 文档改进
209
+
210
+ ## 社区
211
+
212
+ - **Bug 报告** — [GitHub Issues](https://github.com/alibaba/open-code-review/issues)
213
+ - **功能建议** — [GitHub Discussions (Ideas)](https://github.com/alibaba/open-code-review/discussions/categories/ideas) 或 [Feature Request Issue](https://github.com/alibaba/open-code-review/issues/new?template=feature_request.yml)
214
+ - **使用疑问与帮助** — 对 OpenCodeReview 的使用有任何疑问,欢迎在 [GitHub Discussions](https://github.com/alibaba/open-code-review/discussions) 中提问交流
215
+
216
+ ## 许可证
217
+
218
+ 向 OpenCodeReview 贡献代码即表示你同意你的贡献将以 [Apache License 2.0](LICENSE) 进行许可。