Thanks to visit codestin.com
Credit goes to github.com

Skip to content

mtizima/ai-review

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

AI Review

AI-powered code review tool.

CI codecov PyPI version License GitHub stars

Made with ❀️ by @NikitaFilonov


πŸ“‘ 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, or Ollama, and switch anytime.
  • VCS integration β€” works out of the box with GitLab, GitHub, and Bitbucket.
  • Customizable prompts β€” adapt inline, context, and summary reviews to match your team’s coding guidelines.
  • 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 and summary reviews right inside your merge requests. This makes reviews faster, more consistent, and less error-prone β€” while still leaving the final decision to human reviewers.


πŸ§ͺ Live Preview

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

Mode Description πŸ™ GitHub 🦊 GitLab
🧩 Inline Adds line-by-line comments directly in the diff View on GitHub View on GitLab
🧠 Context Performs broader analysis across multiple files View on GitHub View on GitLab
πŸ“„ Summary Posts a concise summary review with key highlights View on GitHub View on GitLab

πŸ‘‰ Each review was generated automatically via GitHub Actions using the corresponding mode:

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

πŸš€ 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 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 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, or Ollama
  • Model settings β€” model name, temperature, max tokens
  • VCS integration β€” works out of the box with GitLab, GitHub, and Bitbucket
  • Review policy β€” which files to include/exclude, review modes
  • Prompts β€” inline/context/summary 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 ]
      pull-request-number:
        type: string
        required: true
jobs:
  ai-review:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - 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:
  when: manual
  stage: review
  image: nikitafilonov/ai-review:latest
  rules:
    - if: '$CI_MERGE_REQUEST_IID'
  script:
    - ai-review run
  variables:
    # --- 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: "$CI_JOB_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)
  • ./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)

⚠️ 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). 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

About

πŸš€ AI-powered code review tool

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 99.9%
  • Dockerfile 0.1%