AI-powered code review tool using LLMs
Project description
Coderev
An AI-powered code review tool that uses LLMs to provide intelligent feedback on your pull requests.
- Supports multiple LLM providers (OpenAI, Anthropic, Gemini, Mistral)
- Seamless Git integration
- Customizable review focus and guidelines
- Command-line interface with persistent configuration
Installation
pip install coderev
Requirements
- Python ≥ 3.8
- Git repository
- One of the following:
- OpenAI API key for GPT-4 models
- Anthropic API key for Claude models
- Mistral API key for Mistral models
- Gemini API key for Google models
- Local Ollama installation
Quick Start
- Initialize Coderev in your git repository:
coderev init
- Set up your preferred LLM provider (e.g., OpenAI):
export OPENAI_API_KEY='your-api-key'
- Review your changes:
coderev review
Usage
Basic Commands
# Review current branch
coderev review
# Review specific branch
coderev review feature/xyz
# Review specific files
coderev review -f src/main.py tests/test_main.py
# List available branches
coderev list
Command Options
coderev review [OPTIONS] [BRANCH_NAME]
Options:
--base-branch TEXT Base branch for comparison (default: main/master)
-f, --review-files FILE Review specific files
--model TEXT LLM model to use (default: gpt-4o)
--temperature FLOAT Model temperature 0-1 (default: 0.0)
--system-message TEXT Custom system message/persona
--review-instructions TEXT Custom review guidelines
--debug Enable debug mode
--help Show this message and exit
Configuration
Configure defaults in .coderev.config
:
# View configuration
coderev config list
# Set values
coderev config set model gpt-4o
coderev config set base_branch main
coderev config set temperature 0.0
coderev config set system_message "Custom reviewer persona"
coderev config set review_instructions "Custom review focus"
Supported Models
Coderev uses litellm for model integration and supports:
-
OpenAI models (requires
OPENAI_API_KEY
):gpt-4o
(recommended)o1-mini
(faster)
-
Anthropic models (requires
ANTHROPIC_API_KEY
):claude-3-sonnet-20240320
-
Mistral models (requires
MISTRAL_API_KEY
):mistral/mistral-large-latest
-
Gemini models (requires
GEMINI_API_KEY
):gemini/gemini-1.5-pro-latest
-
Local models (requires Ollama):
ollama/qwen2.5-coder
Environment Variables
Variable | Description | Required For |
---|---|---|
OPENAI_API_KEY |
OpenAI API key | OpenAI models |
ANTHROPIC_API_KEY |
Anthropic API key | Claude models |
MISTRAL_API_KEY |
Mistral API key | Mistral models |
GEMINI_API_KEY |
Google API key | Gemini models |
CODEREV_DEBUG_ENABLED |
Enable debug mode | Debugging (optional) |
Development
Setup Development Environment
# Clone the repository
git clone https://github.com/isavita/coderev
cd coderev
# Create and activate virtual environment
python -m venv venv
source venv/bin/activate # or `venv\Scripts\activate` on Windows
# Install development dependencies
pip install -e ".[dev]"
Running Tests
# Run tests with coverage
pytest
# Run specific test
pytest tests/test_main.py -k test_name
# Run with debug output
pytest -vv
Project Structure
coderev/
├── src/
│ └── coderev/
│ ├── __init__.py # Package version and metadata
│ └── main.py # Core functionality
├── tests/
│ ├── __init__.py
│ └── test_main.py # Tests
├── setup.cfg # Package metadata and config
├── pyproject.toml # Build system requirements
└── README.md # This file
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
Credits
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
Built Distribution
File details
Details for the file coderev-0.1.3.tar.gz
.
File metadata
- Download URL: coderev-0.1.3.tar.gz
- Upload date:
- Size: 16.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 90a6e5aa17f2c76af2dc879456f1e92ff2a50d1843709c8bdea27228f02889b4 |
|
MD5 | 0571ac6bc079890317fd5df69609e011 |
|
BLAKE2b-256 | f18e4acc3316e5d0f23faf4baea6a81fa22deebc18568f2bfa12e30316a1759b |
File details
Details for the file coderev-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: coderev-0.1.3-py3-none-any.whl
- Upload date:
- Size: 9.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | be0013d393a4018377d71761544fb790e68edc7c8aa6aea92111995d7fb5670c |
|
MD5 | cde018f52fbe8289cdcf802ced35a753 |
|
BLAKE2b-256 | 16b1d061537eacb5cae107692b7d6e2cd1c5be0dd64fb040bd3483c3a6eb53ff |