Automate Pull Request Reviews with ChatGPT, Grok & Gemini
Welcome to AI Code Reviewer, a Python tool built by AnyMaint to streamline code reviews using large language models (LLMs). Catch issues, summarize PRs, and even comment directly on GitHub—all powered by ChatGPT, Grok or Gemini. We’re open-sourcing this to share with the community and grow our startup’s footprint!
- General Overview: Get a high-level summary of what a PR does, based on its description and changes.
- Issue Detection: Identify potential problems in diffs (ignores unchanged code by default).
- PR Comments: Automatically post issues as inline comments on open pull requests.
- Multi-LLM Support: Switch between ChatGPT, Grok and Gemini with a simple flag.
- Deep Review Mode: Use
--deep
for verbose reviews including non-bug feedback like data migration or documentation; default mode focuses on critical bugs only.
- Clone the repo:
git clone https://github.com/AnyMaint/code-reviewer.git
cd
8000
code-reviewer
- Install dependencies:
pip install -r requirements.txt
- Set environment variables:
export GITHUB_TOKEN="your-github-token" #
export BITBUCKET_APP_PASSWORD="your-bitbucket-app-password" #
export BITBUCKET_USERNAME="your-bitbucket-username" #
export BITBUCKET_WORKSPACE="your-bitbucket-workspace" # by default username will reused
export OPENAI_API_KEY="your-openai-key" # For ChatGPT
export GOOGLE_API_KEY="your-google-key" # For Gemini
export XAI_API_KEY="your-x-key" # For Grok
export GITLAB_TOKEN="your-gitlab-token" # For GitLab
export OPENAI_BASE_URL="http://localhost:11434/v1" # For ollama or self-managged instance of OpenAI-compatible LLM.
export OPENAI_MODEL=llama3.1:8b #
There are 2 scripts - describe-pr.py
for general PR summary and review.py
for issues and comments.
There is an article how to use the tool. It may be outdated, but it is a good start: How to Use AI Code Reviewer
- General PR Summary using Gitlab::
python describe-pr.py "owner/repo" 123 --vcsp gitlab
- **List Issues Only Using Grok **:
python review.py "owner/repo" 123 --mode issues --llm grok
- List Issues with Verbose Feedback Using ChatGPT:
python review.py "owner/repo" 123 --mode issues --llm chatgpt --deep
- Post Comments to PR in GitHub with Gemini:
python review.py "owner/repo" --pr 123 --mode comments --llm gemini
- Add
--full-context
to include whole files, or--debug
to see LLM requests.
We’re a small startup and love community help! Fork it, fix it, PR it—see CONTRIBUTING.md for details. Found a bug? Open an issue!
AnyMaint delivers a web-based CMMS for maintenance management, blending machine learning with modular design to monitor equipment, schedule calibrations, and optimize workflows. Tailored for industries like pharmaceuticals and medical devices, we simplify data-driven decisions for production floors.
Licensed under the BSD 3-Clause License - see the LICENSE file for details.
- Built with inspiration from Grok at xAI.
- Powered by ChatGPT (OpenAI), Grok (xAI) and Gemini (Google).