Skip to main content

LLM-agnostic GitHub AI Code Review Tool with integration to GitHub actions

Project description

PYPI Release Pylint Tests License

🤖 AI Code Review Tool

An AI-powered GitHub code review tool that uses LLMs to detect high-confidence, high-impact issues—such as security vulnerabilities, bugs, and maintainability concerns.

✨ Features

  • Automatically reviews pull requests via GitHub Actions
  • Focuses on critical issues (e.g., bugs, security risks, design flaws)
  • Posts review results as a comment on your PR
  • Can be used locally; works with both local and remote Git repositories
  • Optional, fun AI-generated code awards 🏆
  • Easily configurable via .ai-code-review.toml in your repository root
  • Extremely fast, parallel LLM usage
  • Model-agnostic (OpenAI, Anthropic, Google, local PyTorch inference, etc.)

See code review in action: example

🚀 Quickstart

1. Review Pull Requests via GitHub Actions

Create a .github/workflows/ai-code-review.yml file:

name: AI Code Review
on: { pull_request: { types: [opened, synchronize, reopened] } }
jobs:
  review:
    runs-on: ubuntu-latest
    permissions: { contents: read, pull-requests: write } # 'write' for leaving the summary comment
    steps:
    - uses: actions/checkout@v4
      with: { fetch-depth: 0 }
    - name: Set up Python
      uses: actions/setup-python@v5
      with: { python-version: "3.13" }
    - name: Install AI Code Review tool
      run: pip install ai-code-review==0.4.1
    - name: Run AI code analysis
      env:
        LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
        LLM_API_TYPE: openai
        MODEL: "gpt-4.1"
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      run: |
        ai-code-review
        ai-code-review github-comment --token ${{ secrets.GITHUB_TOKEN }}
    - uses: actions/upload-artifact@v4
      with:
        name: ai-code-review-results
        path: |
          code-review-report.txt
          code-review-report.json

⚠️ Make sure to add LLM_API_KEY to your repository’s GitHub secrets.

💪 Done!
PRs to your repository will now receive AI code reviews automatically. ✨

2. Run Code Analysis Locally

Install and run:

# Prerequisites: Python 3.11+
pip install ai-code-review

# One-time setup using interactive wizard (saves configuration in ~/.env.ai-code-review)
ai-code-review setup

# Run review on committed changes in current branch vs main
ai-code-review

To review a remote repository:

ai-code-review remote --url https://github.com/owner/repo --branch feature-branch

🔧 Configuration

Change behavior via .ai-code-review.toml:

  • Prompt templates, filtering and post-processing using Python code snippets
  • Tagging, severity, and confidence settings
  • Custom AI awards for developer brilliance
  • Output customization

You can override the default config by placing .ai-code-review.toml in your repo root.

See default configuration here.

💻 Development Setup

Install dependencies:

make install

Format code and check style:

make black
make cs

Run tests:

pytest

🤝 Contributing

We ❤️ contributions! See CONTRIBUTING.md.

📝 License

Licensed under the MIT License.

© 2025 Vitalii Stepanenko

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ai_cr-0.4.5.tar.gz (14.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ai_cr-0.4.5-py3-none-any.whl (17.1 kB view details)

Uploaded Python 3

File details

Details for the file ai_cr-0.4.5.tar.gz.

File metadata

  • Download URL: ai_cr-0.4.5.tar.gz
  • Upload date:
  • Size: 14.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for ai_cr-0.4.5.tar.gz
Algorithm Hash digest
SHA256 728c2c48331445b104b30a4c05674858e18b69fae47743f3f86b73b36675c8c1
MD5 98fa7d5932205617512b01701c48ac8b
BLAKE2b-256 6c0ab9ade4039652057e40f608a8c8f86ac43d581315bde47f7374d8e1d48286

See more details on using hashes here.

File details

Details for the file ai_cr-0.4.5-py3-none-any.whl.

File metadata

  • Download URL: ai_cr-0.4.5-py3-none-any.whl
  • Upload date:
  • Size: 17.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for ai_cr-0.4.5-py3-none-any.whl
Algorithm Hash digest
SHA256 7867a7672dea59aa1c47aec4e70dcd9ea17ce16ab8e6b403ee0edc8f9813cc98
MD5 6f0a5befe56a21122984f923de6c6dfd
BLAKE2b-256 6f528cf71ac28ac2484bf8f84efcce1e0eabe35292d64c1ff3e774d703e2595a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page