代码审查工具 是 AI Skill Hub 本期精选AI工具之一。综合评分 8.0 分,整体质量较高。我们强烈推荐将其纳入你的 AI 工具库,帮助提升工作效率。
自动审查pull/merge请求,提高代码质量
代码审查工具 是一款基于 Python 开发的开源工具,专注于 代码审查、AI工具、Python 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。
自动审查pull/merge请求,提高代码质量
代码审查工具 是一款基于 Python 开发的开源工具,专注于 代码审查、AI工具、Python 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。
# 方式一:pip 安装(推荐)
pip install rag_for_git
# 方式二:虚拟环境安装(推荐生产环境)
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install rag_for_git
# 方式三:从源码安装(获取最新功能)
git clone https://github.com/mimfort/rag_for_git
cd rag_for_git
pip install -e .
# 验证安装
python -c "import rag_for_git; print('安装成功')"
# 命令行使用
rag_for_git --help
# 基本用法
rag_for_git input_file -o output_file
# Python 代码中调用
import rag_for_git
# 示例
result = rag_for_git.process("input")
print(result)
# rag_for_git 配置文件示例(config.yml) app: name: "rag_for_git" debug: false log_level: "INFO" # 运行时指定配置文件 rag_for_git --config config.yml # 或通过环境变量配置 export RAG_FOR_GIT_API_KEY="your-key" export RAG_FOR_GIT_OUTPUT_DIR="./output"
AI-assisted pull-request reviews grounded in whole-repository context: hybrid search, a code graph, and inline comments anchored to changed lines.
Requires Python 3.11–3.13 and external Voyage, PostgreSQL/ParadeDB, and Neo4j services. Publishing reviews also requires credentials for the selected version-control provider.
>=3.11,<3.14;Run reviewer init to write the selected env file and reviewer check to validate it. Resolution order is REVIEWER_ENV_FILE → $XDG_CONFIG_HOME/rag-reviewer/.env → ./.env.
Important groups:
- Voyage: VOYAGE_API_KEY; - stores: PG_DSN, NEO4J_URI, NEO4J_USER, NEO4J_PASSWORD; - VCS: provider token plus optional API base; - repository scope: DEFAULT_REPO, REVIEW_BRANCHES (branch allowlist fallback; a per-repo home layer takes precedence — see Repositories and branches); - board credentials: provider-specific env declared in the registry.
Published host ports of the Compose storage services are variables, not literals: PARADEDB_PUBLISH_PORT (default 5433), NEO4J_BOLT_PUBLISH_PORT (default 7687) and NEO4J_HTTP_PUBLISH_PORT (default 7474). Container ports stay fixed. reviewer init asks for them in the storage group and derives the first two from PG_DSN and NEO4J_URI, so the client string and the published port cannot drift apart silently; a mismatch on a local host prints a warning without blocking.
PARADEDB_PUBLISH_PORT=6543 NEO4J_BOLT_PUBLISH_PORT=7999 \
docker compose -f ~/.config/rag-reviewer/docker-compose.yml up -d
reviewer start and reviewer stop manage that Compose file for you:
reviewer start # up -d --wait, waits for the ParadeDB and Neo4j healthchecks
reviewer stop # stops the containers; named volumes and the built index survive
reviewer stop also stops the web admin when it was started with --profile web: without an explicit profile selection docker compose does not see it. It leaves the test services (--profile test) alone — those belong to the repository clone's own Compose project. Both storages declare stop_grace_period: 60s: the default 10s are not enough for the Neo4j JVM to shut down cleanly, which left the store to be recovered on the next start.
Both run under the explicit Compose project rag-reviewer. A clone of this repository runs its own stack under the project name rag_for_git — the two publish the same host ports and keep separate volumes, so do not run them at the same time. Contributors working inside the clone should keep using docker compose up -d there.
reviewer stop never removes volumes: it runs docker compose stop, which has no -v flag at all.
On Docker Engine older than 25.0, the start_interval healthcheck key is ignored, so the first Neo4j probe only happens after the plain interval (300s) — exactly the --wait timeout used by reviewer start. On such engines reviewer start can report a timeout failure even though the stack came up fine; upgrading Docker Engine removes the issue.
Prefer variables over editing the Compose file: a hand-edited ~/.config/rag-reviewer/docker-compose.yml no longer matches its recorded hash, so `reviewer update treats it as user-modified (status preserved`) and stops delivering new Compose definitions to it. A preserved Compose file also stops receiving new healthcheck definitions, so reviewer start falls back to waiting for the running state instead of real readiness.
Credentials stay server-side. Credentials are not returned by board metadata or discovery tools and must not be placed in .review.yml.
This route assumes that team members open their AI-client sessions on one shared host under one service account. Each client launches its own reviewer-mcp stdio process; those processes share PostgreSQL/ParadeDB and Neo4j through the Compose services bound to 127.0.0.1, plus the service account's reviewer env. It is not one central MCP daemon. MCP requests carry repository, branch, project, and provider_options, and tool results return selected code context to the AI client. For separate workstations, use secured network-accessible stores and configure their DSNs and reviewer env on every workstation instead of using the loopback Compose defaults.
reviewer update
docker compose -f ~/.config/rag-reviewer/docker-compose.yml up -d
reviewer init
2. Choose repository and branch scope. Set DEFAULT_REPO as the fallback repo, and either the ordered REVIEW_BRANCHES CSV allowlist in server env or (preferred) a per-repo home layer — see Repositories and branches. Put repository-specific policy, ignored paths, context limits, and non-secret board metadata in .review.yml.
reviewer index /srv/rag_for_git --ref main --repo mimfort/rag_for_git
reviewer check
reviewer status /srv/rag_for_git --branch main --json
reviewer install --all
reviewer install codex --dry-run
Run installation on the shared host as the same service account. --all configures the supported clients for that account; --dry-run reports planned config writes. Open a new chat or CLI session afterwards; IDE integrations may also require Reload Window.
5. Add optional board context. Select a registered provider in .review.yml, keep its credentials in the reviewer env, and validate the exact project:
reviewer check --board-project TYPE=PROJECT
Repeat --board-project for additional providers. See Task boards and the provider reference.
Persistent CLI:
uv tool install rag-reviewer
reviewer update
uv tool install takes the package name and installs both of its commands, reviewer and reviewer-mcp. Its --from option only pins a different source for the same package (--from rag-reviewer==0.4.3, --from git+…); --from PACKAGE COMMAND is uvx syntax and uv tool install rejects it.
For the one-time transition from 0.4.3, start the new lifecycle through latest uvx and explicitly allow it to upgrade the existing persistent tool:
uvx --refresh --from rag-reviewer@latest reviewer update --upgrade-tool
Every later update is the short command reviewer update. It performs one lifecycle:
uv tool package when a newer version exists;$XDG_CONFIG_HOME/rag-reviewer/docker-compose.yml from the canonical repository;.reviewer-update.json.If the Compose file differs from its recorded hash, reviewer treats it as user-modified, leaves it unchanged, and prints a warning. Update does not run docker compose pull, restart services, remove containers, or delete volumes, so existing databases, indexes, tasks, and subsystem summaries stay intact. Apply a new Compose definition when convenient with the documented `docker compose ... up -d` command.
Temporary/latest invocation:
uvx --from rag-reviewer@latest reviewer --help
An ordinary uvx invocation never mutates a separate persistent tool; only the explicit --upgrade-tool bootstrap does. Use reviewer install CLIENT --dry-run to inspect a named integration write.
/rag-reviewer:sync-codebase --path /srv/repo --ref main.uvx, reviewer services, Voyage, and optional SCIP./rag-reviewer:pr-walkthrough owner/repo#123.Reviewer grounding in plan/review phases lets planning and review phases reuse session-less reviewer tools when the base index is current.
Reviewer grounding (plan/review, optional, fail-open). Runreviewer status /path/to/repo --branch main --jsonfirst. Whendrift == 0, prefersearch_codebasefor cross-file facts and usecallers,related_symbols,definition,implementations, orfamilyonly for central symbols. The base index does not see uncommitted edits, so read changed files from disk. If reviewer or the index is unavailable, fall back to local search/read tools instead of blocking.
- family(repo, node_id, branch) — the family of look-alike symbols ("who else is like this"): inheritance plus structural contract match. For roll-out tasks ("add a field to every provider"), where one file found is a representative of a family of N.
| Location | Owner | Stores | Must not store |
|---|---|---|---|
global .env | deployment/operator | secrets, credentials, DSNs, runtime infrastructure and compatibility fallbacks | repository policy |
| home global YAML | OS account running reviewer | shared non-secret defaults | credentials |
| home per-repo YAML | OS account running reviewer | repository.primary_branch, repository.index_branches, operator-owned repo policy | credentials |
committed .review.yml | repository team | team-visible review policy and non-secret task-board metadata | credentials or repository |
| git remote / CLI | repository/operator | canonical owner/name identity and explicit command overrides | persisted secrets |
| Postgres / Neo4j | reviewer runtime | derived indexes, task/review state and code graph | source-of-truth configuration |
Run reviewer init from the clone, inspect the global .env and home per-repo previews, then run reviewer check and reviewer config show --repo owner/name.
Run reviewer init --scope repo from the second clone. It creates or previews only that repository's home per-repo YAML and does not rewrite global .env or the first repository's config.
Inject secrets into global .env or the process from a secret manager. Use noninteractive init only for deterministic preview/write, mount home YAML for the service account, and keep team-owned policy in committed .review.yml. Pass --repo owner/name when no usable git remote is present.
- When: tune tracked branches, ignored paths, retrieval limits, summary clustering, or board metadata. - Invoke: /rag-reviewer:configure-review. - Needs: a git repository; MCP and databases are not required for baseline analysis. - Reads/writes: reads tracked Python structure/history and changes approved YAML fields in either home:repos/<owner>/<name>.yml or committed .review.yml; branch values always go to the home per-repo YAML. - Result: preserved foreign keys/comments plus exact rebuild guidance.
| Goal | Commands |
|---|---|
| Configure and integrate | init, install, install-skills, update |
| Validate environment | check |
| Manage local infrastructure | start, stop |
| Manage indexes | index, status, search, migrate-branches, gc |
| Run observability UI | serve |
| Start MCP directly | reviewer-mcp |
Use reviewer COMMAND --help for the current option set. status does not spend Voyage tokens; search and indexing do.
The examples below use Claude-style /rag-reviewer:... invocation. Codex exposes the same namespaced skills with $rag-reviewer:....
Reviewer workflows are delivered as namespaced skills. Each skill defines its own read/write boundaries and confirmation gates; the MCP server performs storage, graph, VCS, and board work.
Use ask for onboarding and codebase Q&A. Answers cite real path:line locations from the base index and code graph. It reads and explains; it neither reviews a PR nor modifies code.
/rag-reviewer:ask how does index freshness work?.path:line citations.rag_for_git 是一个基于 RAG(检索增强生成)技术、代码图谱(Code Graph)以及 Claude Code 构建的智能 Agent。它能够自动对 Pull Request (PR) 或 Merge Request 进行深度审查,通过结合上下文感知能力,为开发者提供精准的代码变更分析与质量评估。
运行本项目需要 Docker 环境以及 uv 工具(包含 uvx)。此外,用户需要准备 Voyage API key 用于向量检���,以及 GitHub token 用于访问代码仓库。若需结合任务看板功能,还需配置相应的任务上下文读取权限。
推荐使用一键安装方式:直接将提供的 Prompt 复制并粘贴到任何 AI 编程助手(如 Claude Code, Cursor, Copilot 等)中即可完成 MCP server 的设置。本项目通过 PyPI 发布的 `rag-reviewer` 包运行,建议使用 `uvx --from rag-reviewer@latest reviewer-mcp` 命令,无需手动 clone 仓库或使用 pip install。
安装完成后,在 Claude Code 的仓库根目录下,可以通过特定的 Skill 命令进行交互。例如,使用 `/rag-reviewer:reviewer_review-pr` 来审查指定的 PR;使用 `/rag-reviewer:reviewer_sync-codebase` 来构建或更新本地代码库的向量存储与代码图谱;或使用 `sync-tasks` 来同步任务看板信息。
项目提供交互式配置向导,通过运行 `reviewer init` 命令,可以方便地设置 VOYAGE_API_KEY、GITHUB_TOKEN 以及配置存储、多仓库模式和任务看板(task board)等参数。对于 macOS/Linux 用户,手动配置 JSON 时需注意使用 `bash -lc` 包装器以确保能正确找到 uvx 路径。
可以通过执行 `uv tool upgrade rag-reviewer` 来升级 CLI 工具。在 Windows 环境下,建议优先使用 `reviewer install` 命令进行跨平台安装,它会自动注入 uvx 的绝对路径,避免手动配置复杂的环境变量。
本项目采用 MCP server (stdio transport) 架构,由 AI 助手自动启动。其核心工作流结合了 RAG 与代码图谱技术:即使在未进行全量 index 的情况下,Agent 也能基于 diff 和 overlay 进行初步审查;若需进行全仓库级别的变更影响分析,建议先针对目标分支运行 index 命令以构建完整的上下文。
该工具未明确声明开源协议,商业使用前请联系原作者确认授权范围,避免侵权风险。
AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。
建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。
经综合评估,代码审查工具 在AI工具赛道中表现稳健,质量优秀。如果你已有明确的使用需求,可以直接上手体验;如果还在评估阶段,建议对比同类工具后再做决策。
| 原始名称 | rag_for_git |
| 原始描述 | 开源AI工具:Агент ревью pull/merge request'ов: RAG + граф кода + LLM (OpenRouter/Voyage)。⭐11 · Python |
| Topics | 代码审查AI工具Python |
| GitHub | https://github.com/mimfort/rag_for_git |
| 语言 | Python |
收录时间:2026-06-20 · 更新时间:2026-06-20 · License:未公布 · AI Skill Hub 不对第三方内容的准确性作法律背书。