ai-review

Nikita-FilonovApache-2.0活跃维护

接入 OpenAI、Claude、Gemini 等大模型的自动化代码审查工具,支持 GitHub、GitLab、Bitbucket、Azure DevOps 和 Gitea,帮团队在合并请求里自动发现问题。

🚀 AI-powered code review tool for GitHub, GitLab, Bitbucket Cloud, Bitbucket Server, Azure DevOps and Gitea — built with LLMs like OpenAI, Claude, Gemini, Ollama, Bedrock, OpenRouter and Azure OpenAI

v1.4.0发布于 2026-10-03 15:52 UTC601star103fork同步于 2026-11-07 07:32 UTC

怎么上手

由 README 提炼,执行前请确认
pip install xai-review
ai-review run-summary
硬件要求按 README 说明

README 未说明;工具完全在客户端运行,LLM 可选用 Ollama 本地部署或云端 API。

有 Docker 镜像
下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

把 LLM 代码审查接进 CI/CD,自动在 MR/PR 里发评论的客户端工具

接入 OpenAI、Claude、Gemini 等大模型的自动化代码审查工具,支持 GitHub、GitLab、Bitbucket、Azure DevOps 和 Gitea,帮团队在合并请求里自动发现问题。

核心能力

  • 支持 OpenAI、Claude、Gemini、Ollama 等多家 LLM 随时切换
  • 内置 GitHub、GitLab、Bitbucket、Azure DevOps、Gitea 集成
  • 提供 inline、context、summary 三种审查模式及回复模式
  • Agent 模式用 ls/cat/rg/git 探索仓库后再出审查结论
  • 用 YAML、JSON 或 ENV 配置,可在 CI 中覆盖参数

容易踩的坑

运行前需在项目根目录准备 .ai-review.yaml 等配置文件并填好 LLM 与 VCS 的 api_token;ai-review run 会同时跑 inline 和 summary,只想跑一种要用对应子命令;GitLab CI 需设置 GIT_DEPTH 为 0 才能拿到完整历史。

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

5 个版本v1.4.0
  1. v1.4.0最新正式版2026-10-03 · 2026-10-03 15:52 UTC

    这个版本没有写更新说明。

  2. v1.3.02026-10-03 · 2026-10-03 14:50 UTC

    这个版本没有写更新说明。

  3. v1.2.02026-10-03 · 2026-10-03 13:04 UTC

    这个版本没有写更新说明。

  4. v1.1.02026-09-20 · 2026-09-20 14:44 UTC

    这个版本没有写更新说明。

  5. v1.0.02026-09-20 · 2026-09-20 14:11 UTC

    这个版本没有写更新说明。

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    AI Review

    AI-powered code review tool.

    CI codecov PyPI version License GitHub stars Support

    Made with ❤️ by @NikitaFilonov


    ❤️ Support AI Review

    If AI Review helps you reduce noise in pull requests and saves time in code reviews, consider supporting its development.

    Your support helps to:

    • improve review accuracy and reduce false positives
    • expand integrations (GitHub, GitLab, Azure DevOps, etc.)
    • develop new features and maintain the project

    👉 https://boosty.to/ai_review


    📑 Table of Contents


    ✨ About

    AI Review is a developer tool that brings AI-powered code review directly into your workflow. It helps teams improve code quality, enforce consistency, and speed up the review process.

    ✨ Key features:

    • Multiple LLM providers — choose between OpenAI, Claude, Gemini, Ollama, Bedrock, OpenRouter, or Azure OpenAI and switch anytime.
    • VCS integration — works out of the box with GitLab, GitHub, Bitbucket Cloud, Bitbucket Server, Azure DevOps, and Gitea.
    • Customizable prompts — adapt inline, context, and summary reviews to match your team’s coding guidelines.
    • Agent mode — iterative ReAct-style loop where the model can explore the repository with shell commands (ls, cat, rg, git) before producing a final review, giving it deeper context than a single-shot call.
    • Reply modes — AI can now participate in existing review threads, adding follow-up replies in both inline and summary discussions.
    • Flexible configuration — supports YAML, JSON, and ENV, with seamless overrides in CI/CD pipelines.
    • AI Review runs fully client-side — it never proxies or inspects your requests.

    AI Review runs automatically in your CI/CD pipeline and posts both inline comments, summary reviews, and now AI-generated replies directly inside your merge requests. With agent mode enabled, the model can autonomously explore the codebase before reviewing, resulting in more accurate and context-aware feedback. This makes reviews faster, more conversational, and still fully under human control.


    🧪 Live Preview

    Curious how AI Review works in practice? Here are three real Pull Requests reviewed entirely by the tool — one per mode:

    ModeDescription🐙 GitHub🦊 GitLab🪣 Bitbucket
    🧩 InlineAdds line-by-line comments directly in the diff. Focuses on specific code changes.View on GitHubView on GitLabView on Bitbucket
    🧠 ContextPerforms a broader analysis across multiple files, detecting cross-file issues and inconsistencies.View on GitHubView on GitLabView on Bitbucket
    📄 SummaryPosts a concise high-level summary with key highlights, strengths, and major issues.View on GitHubView on GitLabView on Bitbucket
    💬 Inline ReplyGenerates a context-aware reply to an existing inline comment thread. Can clarify decisions, propose fixes, or provide code suggestions.View on GitHubView on GitLabView on Bitbucket
    💬 Summary ReplyContinues the summary-level review discussion, responding to reviewer comments with clarifications, rationale, or actionable next steps.View on GitHubView on GitLabView on Bitbucket

    👉 Each review was generated automatically via GitHub Actions using the corresponding mode:

    ai-review run-inline
    ai-review run-summary
    ai-review run-context
    ai-review run-inline-reply
    ai-review run-summary-reply
    

    🚀 Quick Start

    Install via pip:

    pip install xai-review
    

    📦 Available on PyPI


    Or run directly via Docker:

    docker run --rm -v $(pwd):/app nikitafilonov/ai-review:latest ai-review run-summary
    

    🐳 Pull from DockerHub

    👉 Before running, create a basic configuration file .ai-review.yaml in the root of your project:

    llm:
      provider: OPENAI
    
      meta:
        model: gpt-4o-mini
        max_tokens: 1200
        temperature: 0.3
    
      http_client:
        timeout: 120
        api_url: https://api.openai.com/v1
        api_token: ${OPENAI_API_KEY}
    
    vcs:
      provider: GITLAB
    
      pipeline:
        project_id: "1"
        merge_request_id: "100"
    
      http_client:
        timeout: 120
        api_url: https://gitlab.com
        api_token: ${GITLAB_API_TOKEN}
    

    👉 This will:

    • Run AI Review against your codebase.
    • Generate inline and/or summary comments (depending on the selected mode).
    • Use your chosen LLM provider (OpenAI GPT-4o-mini in this example).

    Note: Running ai-review run executes the full review (inline + summary). To run only one mode, use the dedicated subcommands:

    • ai-review run-inline
    • ai-review run-context
    • ai-review run-summary
    • ai-review run-inline-reply
    • ai-review run-summary-reply

    AI Review can be configured via .ai-review.yaml, .ai-review.json, or .env. See ./docs/configs for complete, ready-to-use examples.

    Key things you can customize:

    • LLM provider — OpenAI, Gemini, Claude, Ollama, Bedrock, OpenRouter, or Azure OpenAI
    • Model settings — model name, temperature, max tokens
    • VCS integration — works out of the box with GitLab, GitHub, Bitbucket Cloud, Bitbucket Server, Azure DevOps, and Gitea
    • Agent mode — enable iterative repository exploration before review
    • Review policy — which files to include/exclude, review modes
    • Prompts — inline/context/summary/agent prompt templates

    👉 Minimal configuration is enough to get started. Use the full reference configs if you want fine-grained control ( timeouts, artifacts, logging, etc.).


    ⚙️ CI/CD Integration

    AI Review works out-of-the-box with major CI providers. Use these snippets to run AI Review automatically on Pull/Merge Requests.
    Each integration uses environment variables for LLM and VCS configuration.

    For full configuration details (timeouts, artifacts, logging, prompt overrides), see ./docs/configs.

    🚀 GitHub Actions

    Add a workflow like this (manual trigger from Actions tab):

    name: AI Review
    
    on:
      workflow_dispatch:
        inputs:
          review-command:
            type: choice
            default: run
            options:
              - run
              - run-inline
              - run-context
              - run-summary
              - run-inline-reply
              - run-summary-reply
              - clear
              - clear-inline
              - clear-summary
              - clear-inline-reply
              - clear-summary-reply
          pull-request-number:
            type: string
            required: true
    jobs:
      ai-review:
        runs-on: ubuntu-latest
        steps:
          - uses: actions/checkout@v6
            with:
              fetch-depth: 0
    
          - uses: Nikita-Filonov/[email protected]
            with:
              review-command: ${{ inputs.review-command }}
            env:
              # --- LLM configuration ---
              LLM__PROVIDER: "OPENAI"
              LLM__META__MODEL: "gpt-4o-mini"
              LLM__META__MAX_TOKENS: "15000"
              LLM__META__TEMPERATURE: "0.3"
              LLM__HTTP_CLIENT__API_URL: "https://api.openai.com/v1"
              LLM__HTTP_CLIENT__API_TOKEN: ${{ secrets.OPENAI_API_KEY }}
    
              # --- GitHub integration ---
              VCS__PROVIDER: "GITHUB"
              VCS__PIPELINE__OWNER: ${{ github.repository_owner }}
              VCS__PIPELINE__REPO: ${{ github.event.repository.name }}
              VCS__PIPELINE__PULL_NUMBER: ${{ inputs.pull-request-number }}
              VCS__HTTP_CLIENT__API_URL: "https://api.github.com"
              VCS__HTTP_CLIENT__API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    
    

    🔗 Full example: ./docs/ci/github.yaml

    🚀 GitLab CI/CD

    For GitLab users:

    ai-review:
      stage: review
      image: nikitafilonov/ai-review:latest
      rules:
        - if: '$CI_MERGE_REQUEST_IID'
          when: manual
      script:
        - ai-review run
      variables:
        # --- Mandatory ---
        GIT_DEPTH: "0"
    
        # --- LLM configuration ---
        LLM__PROVIDER: "OPENAI"
        LLM__META__MODEL: "gpt-4o-mini"
        LLM__META__MAX_TOKENS: "15000"
        LLM__META__TEMPERATURE: "0.3"
        LLM__HTTP_CLIENT__API_URL: "https://api.openai.com/v1"
        LLM__HTTP_CLIENT__API_TOKEN: "$OPENAI_API_KEY"
    
        # --- GitLab integration ---
        VCS__PROVIDER: "GITLAB"
        VCS__PIPELINE__PROJECT_ID: "$CI_PROJECT_ID"
        VCS__PIPELINE__MERGE_REQUEST_ID: "$CI_MERGE_REQUEST_IID"
        VCS__HTTP_CLIENT__API_URL: "$CI_SERVER_URL"
        VCS__HTTP_CLIENT__API_TOKEN: "$GITLAB_API_TOKEN"
      allow_failure: true  # Optional: don't block pipeline if AI review fails
    
    

    🔗 Full example: ./docs/ci/gitlab.yaml


    📘 Documentation

    See these folders for reference templates and full configuration options:

    • ./docs/ci — CI/CD integration templates (GitHub Actions, GitLab CI, Bitbucket Pipelines, Jenkins)
    • ./docs/cli — CLI command reference and usage examples
    • ./docs/hooks — hook reference and lifecycle events
    • ./docs/configs — full configuration examples (.yaml, .json, .env)
    • ./docs/prompts — prompt templates for Python/Go (light & strict modes)
    • ./docs/troubleshooting.md — common environment and Git-related issues

    ⚠️ Privacy & Responsibility Notice

    AI Review does not store, log, or transmit your source code to any external service other than the LLM provider explicitly configured in your .ai-review.yaml.

    All data is sent directly from your CI/CD environment to the selected LLM API endpoint (e.g. OpenAI, Gemini, Claude, OpenRouter). No intermediary servers or storage layers are involved.

    If you use Ollama, requests are sent to your local or self-hosted Ollama runtime
    (by default http://localhost:11434). This allows you to run reviews completely offline, keeping all data strictly inside your infrastructure.

    ⚠️ Please ensure you use proper API tokens and avoid exposing corporate or personal secrets. If you accidentally leak private code or credentials due to incorrect configuration (e.g., using a personal key instead of an enterprise one), it is your responsibility — the tool does not retain or share any data by itself.


    🧠 AI Review — open-source AI-powered code reviewer