AIReview is a command-line tool that leverages LLM to provide code reviews for your Git changes.
- Automatic detection of Git changes
- AI-powered code review using OpenAI's GPT models
- Customizable review prompts and project context
- Markdown-formatted review output
- Support for multiple file reviews in a single run
Install this tool using pip
:
pip install aireview
Create a configuration file named aireview.config
with the following structure in your project root:
[ai]
model = gpt-4
api_key = your_openai_api_key
base_url = https://api.openai.com/v1 # Optional: for custom OpenAI-compatible endpoints
[review]
output = ai-review.md # Output file for the review comments
[context]
project_context = Your project context description... # Example, I am working on Nodejs, typescript project
[prompt]
prompt_template = Your custom review prompt... # Example, Review the changes and provide feedback on the code quality and best practices
- Make some changes in your Git repository
- Add changes to the staging area:
git add the/changed/files
- Run AIReview:
aireview --config path/to/aireview.config # you can skip --config if the config file is in the project root
The tool will:
- Detect your Git changes
- Send them to the LLM for review
- Generate a markdown file with the review comments
- Clone the repository:
git clone https://github.com/setkyar/aireview.git
cd aireview
- Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
- Install the package:
pip install -e .
# Install test dependencies
pip install -e ".[test]"
# Run tests
pytest
# Run tests with coverage
coverage run -m pytest
coverage report
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request