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.1.tar.gz
.
File metadata
- Download URL: coderev-0.1.1.tar.gz
- Upload date:
- Size: 15.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d46f0b55c2aa2c962b9f6e1b0e443d8686d0cac1bd1845d1eb65690b0746bf42 |
|
MD5 | d3fd23df81feef4d7061c8a2c826fb7c |
|
BLAKE2b-256 | eebfea7eccd7717939c1c9963bd06660870c94a2925d0f1b57b18f0a85ff8f4a |
File details
Details for the file coderev-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: coderev-0.1.1-py3-none-any.whl
- Upload date:
- Size: 9.3 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 | 69464a4eb792575289d7343c050cbb627127f7d694454d96c5ec0568bdd4bfdd |
|
MD5 | b4e450e4bf04549f2a441dd46cd11e73 |
|
BLAKE2b-256 | 21bc675e828ad22b9a346bf208d859563e90b55de7f188e792b871a805bc8e4d |