The-PR-Agent/pr-agent
GitHub: The-PR-Agent/pr-agent
开源 AI 驱动的 Pull Request 代码审查工具,帮助开发团队自动化 PR 审查、改进建议与描述生成。
Stars: 11847 | Forks: 1592
本仓库包含开源的 PR Agent 项目。 它不是 Qodo 免费版。 PR-Agent 是一款开源的、AI 驱动的代码审查工具,也是由 Qodo 社区维护的遗留项目。它与 Qodo 主要的 AI 代码审查产品不同,后者提供了功能丰富、具备上下文感知能力的体验。Qodo 现在提供了一个免费版,可与 GitHub、GitLab、Bitbucket 和 Azure DevOps 无缝集成,以实现高质量的自动化审查。 ## 目录 - [快速入门](#getting-started) - [为什么使用 PR-Agent?](#why-use-pr-agent) - [功能](#features) - [实际效果](#see-it-in-action) - [工作原理](#how-it-works) - [数据隐私](#data-privacy) - [贡献指南](#contributing) ## 快速入门 ### 🚀 PR-Agent 快速开始 #### 1. GitHub Action(推荐) 通过一个简单的工作流文件,为你的仓库添加自动化 PR 审查: ``` # .github/workflows/pr-agent.yml name: PR Agent on: pull_request: types: [opened, synchronize] jobs: pr_agent_job: runs-on: ubuntu-latest steps: - name: PR Agent action step uses: the-pr-agent/pr-agent@main env: OPENAI_KEY: ${{ secrets.OPENAI_KEY }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} ``` [完整的 GitHub Action 设置指南](https://docs.pr-agent.ai/installation/github/#run-as-a-github-action) #### 2. CLI 使用(本地开发) 在你的本地仓库中运行 PR-Agent: ``` pip install pr-agent export OPENAI_KEY=your_key_here pr-agent --pr_url https://github.com/owner/repo/pull/123 review ``` [完整的 CLI 设置指南](https://docs.pr-agent.ai/usage-guide/automations_and_usage/#local-repo-cli) #### 3. 其他平台 - [GitLab webhook 设置](https://docs.pr-agent.ai/installation/gitlab/) - [BitBucket app 安装](https://docs.pr-agent.ai/installation/bitbucket/) - [Azure DevOps 设置](https://docs.pr-agent.ai/installation/azure/) ## 为什么使用 PR-Agent? ### 🎯 专为真实开发团队打造 **快速且高性价比**:每个工具(`/review`、`/improve`、`/ask`)仅使用一次 LLM 调用(约 30 秒,成本低) **处理任意大小的 PR**:我们的 [PR 压缩策略](https://docs.pr-agent.ai/core-abilities/#pr-compression-strategy)能有效处理大小各异的 PR **高度可定制**:基于 JSON 的提示词机制,允许通过[配置文件](pr_agent/settings/configuration.toml)轻松自定义审查类别和行为 **平台无关性**: - **Git 提供商**:GitHub、GitLab、BitBucket、Azure DevOps、Gitea - **部署方式**:CLI、GitHub Actions、Docker、自托管、webhook - **AI 模型**:OpenAI GPT、Claude、Deepseek 等 **开源优势**: - 完全掌控你的数据和基础设施 - 根据团队需求自定义提示词和行为 - 无供应商锁定 - 社区驱动的开发模式 ## 功能
PR-Agent 提供了全面的 pull request 功能,并与各种 git 提供商集成:
| | | GitHub | GitLab | Bitbucket | Azure DevOps | Gitea |
|---------------------------------------------------------|----------------------------------------------------------------------------------------|:------:|:------:|:---------:|:------------:|:-----:|
| [工具](https://docs.pr-agent.ai/tools/) | [描述](https://docs.pr-agent.ai/tools/describe/) | ✅ | ✅ | ✅ | ✅ | ✅ |
| | [审查](https://docs.pr-agent.ai/tools/review/) | ✅ | ✅ | ✅ | ✅ | ✅ |
| | [改进](https://docs.pr-agent.ai/tools/improve/) | ✅ | ✅ | ✅ | ✅ | ✅ |
| | [提问](https://docs.pr-agent.ai/tools/ask/) | ✅ | ✅ | ✅ | ✅ | |
| | ⮑ [针对代码行提问](https://docs.pr-agent.ai/tools/ask/#ask-lines) | ✅ | ✅ | | | |
| | [帮助文档](https://docs.pr-agent.ai/tools/help_docs/?h=auto#auto-approval) | ✅ | ✅ | ✅ | | |
| | [更新 CHANGELOG](https://docs.pr-agent.ai/tools/update_changelog/) | ✅ | ✅ | ✅ | ✅ | |
| | | | | | | |
| [使用方式](https://docs.pr-agent.ai/usage-guide/) | [CLI](https://docs.pr-agent.ai/usage-guide/automations_and_usage/#local-repo-cli) | ✅ | ✅ | ✅ | ✅ | ✅ |
| | [App / webhook](https://docs.pr-agent.ai/usage-guide/automations_and_usage/#github-app) | ✅ | ✅ | ✅ | ✅ | ✅ |
| | [标记机器人](https://github.com/the-pr-agent/pr-agent#try-it-now) | ✅ | | | | |
| | [Actions](https://docs.pr-agent.ai/installation/github/#run-as-a-github-action) | ✅ | ✅ | ✅ | ✅ | |
| | | | | | | |
| [核心](https://docs.pr-agent.ai/core-abilities/) | [自适应且感知 token 的文件补丁适配](https://docs.pr-agent.ai/core-abilities/compression_strategy/) | ✅ | ✅ | ✅ | ✅ | |
| | [动态上下文](https://docs.pr-agent.ai/core-abilities/dynamic_context/) | ✅ | ✅ | ✅ | ✅ | |
| | [获取 ticket 上下文](https://docs.pr-agent.ai/core-abilities/fetching_ticket_context/) | ✅ | ✅ | ✅ | | |
| | [交互性](https://docs.pr-agent.ai/core-abilities/interactivity/) | ✅ | ✅ | | | |
| | [本地和全局元数据](https://docs.pr-agent.ai/core-abilities/metadata/) | ✅ | ✅ | ✅ | ✅ | |
| | [多模型支持](https://docs.pr-agent.ai/usage-guide/changing_a_model/) | ✅ | ✅ | ✅ | ✅ | |
| | [PR 压缩](https://docs.pr-agent.ai/core-abilities/compression_strategy/) | ✅ | ✅ | ✅ | ✅ | |
| | [自我反思](https://docs.pr-agent.ai/core-abilities/self_reflection/) | ✅ | ✅ | ✅ | ✅ | |
## 实际效果
/describe
/review
/improve
## 工作原理 下图展示了 PR-Agent 的工具及其流程:  ## 数据隐私 ### 自托管 PR-Agent - 如果你使用自己的 OpenAI API key 托管 PR-Agent,数据交互仅发生在你与 OpenAI 之间。你可以在此处阅读他们的 API 数据隐私政策: https://openai.com/enterprise-privacy ## PR-Agent 重大消息 PR-Agent 迎来了新家! 在与社区共同打造这款工具多年之后,Qodo 已将 PR-Agent 捐赠给开源社区——我们对未来的发展感到无比兴奋。 该项目现在位于 GitHub 上的 PR-Agent org 中,完全归社区所有,并开放接受贡献和征集新的维护者。 其他变更: - 文档已迁移至 - www.pr-agent.ai - Qodo Merge (Qodo 1.0)(之前的托管 URL,曾是 PR-Agent 的企业版)已重塑品牌并升级为 Qodo (Qodo 2.0),这是一个完整的 AI 代码审查平台。 ## ❤️ 社区 这个开源版本作为 Qodo 对社区的贡献保留在这里——它是现代 AI 驱动代码协作的起源。我们很自豪能将其分享出来,并激励全球的开发者。 该项目现在迎来了第一位外部维护者 Naor ([@naorpeled](https://github.com/naorpeled)),目前正在将其捐赠给开源基金会的过程中。
标签:GitHub Action, Petitpotam, SOC Prime, 人工智能, 代码审查, 开发工具, 用户模式Hook绕过, 请求拦截, 逆向工具