38 lines
1.6 KiB
Markdown
38 lines
1.6 KiB
Markdown
完成!我为你创建了完整的 **Jenkins + Claude Code 自动代码审查** 方案。
|
||
|
||
## 创建的文件
|
||
|
||
| 文件 | 说明 |
|
||
| ----------------------------------- | --------------------------------- |
|
||
| `scripts/ci/claude_code_review.sh` | Bash 版本审查脚本(生成提示文件) |
|
||
| `scripts/ci/claude_code_review.bat` | Windows 版本审查脚本 |
|
||
| `scripts/ci/claude_api_review.py` | Claude API 自动审查(Python) |
|
||
| `docs/jenkins-claude-review.md` | 完整配置文档 |
|
||
| 修改 `Jenkinsfile` | 新增 `Claude Code Review` stage |
|
||
|
||
## 工作流程
|
||
|
||
```
|
||
Git Push ──► Jenkins ──► Unity Build ──► Airtest ──► Claude Review ──► 归档报告
|
||
```
|
||
|
||
## 使用方式
|
||
|
||
### 方式一:手动审查(无需 API Key)
|
||
构建完成后下载 `Logs/ci/reviews/*-review-prompt.md`,然后在 Claude Code 中打开:
|
||
```bash
|
||
claude < review-prompt.md
|
||
```
|
||
|
||
### 方式二:API 自动审查
|
||
1. Jenkins 安装 Python 依赖:`pip install anthropic`
|
||
2. Jenkins 配置凭据 ID 为 `anthropic-api-key` 的 Secret text
|
||
3. 构建完成后自动调用 Claude API 生成审查报告
|
||
|
||
## Jenkinsfile 关键修改
|
||
|
||
- **新增 stage**: `Claude Code Review`(在 `Publish Project Build` 之后)
|
||
- **权限更新**: 添加了 `claude_code_review.sh` 和 `claude_api_review.py` 的执行权限
|
||
- **产物归档**: 包含 `Logs/ci/reviews/**` 中的所有审查文件
|
||
|
||
需要我帮你配置 Jenkins 凭据或测试这个流程吗? |