An intelligent code review and fix agent powered by LangGraph and OpenAI. This tool automatically analyzes your repository, identifies issues, searches for solutions, and implements fixes - all while providing detailed explanations of its actions.
- 🔍 Automated Code Review: Analyzes code quality, patterns, and potential issues
- 🛠️ Automatic Fix Implementation: Implements solutions for identified problems
- 🔎 Solution Search: Uses SerpAPI to find relevant documentation and best practices
- 📊 Git Integration: Full Git command support for repository analysis
- 📝 Detailed Reporting: Provides comprehensive explanations of all changes made
- Python 3.8+
- OpenAI API key
- SerpAPI key
- Git installed and configured
- Clone the repository:
git clone https://github.com/travis-burmaster/Git-Code-Review-Agent.git
cd Git-Code-Review-Agent- Install required packages:
pip install -r requirements.txt- Set up your environment variables:
python -m venv venv
source venv/bin/activate
pip install langgraph langchain-openai langchain-community
export OPENAI_API_KEY='your-openai-api-key'
export SERPAPI_API_KEY='your-serpapi-api-key'from code_review_agent import run_code_review
messages = run_code_review(
user_input="Please review the code in src/main.py and fix any performance issues",
repo_path="/path/to/your/repo",
openai_api_key="your-openai-api-key",
serpapi_api_key="your-serpapi-api-key"
)- Review specific file:
"Please review src/main.py for potential performance issues"- Analyze entire repository:
"Perform a full repository review focusing on security best practices"- Fix specific issues:
"Fix memory leaks in the data processing module"- Request Analysis: The agent processes your review request
- Repository Scan: Checks repository status and relevant files
- Code Analysis: Reviews code for issues and improvements
- Solution Search: If needed, searches for best practices and solutions
- Fix Implementation: Applies necessary changes
- Verification: Verifies changes and their impact
- Reporting: Provides detailed explanation of actions taken
You can customize the agent's behavior by modifying the following parameters:
- Model selection (default: gpt-4-1106-preview)
- Temperature setting for response generation
- Custom tool configurations
- Git command preferences
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- OpenAI for their powerful language models
- LangGraph for the workflow framework
- SerpAPI for search capabilities
- All contributors who help improve this tool
If you have any questions or run into issues, please open an issue in the GitHub repository.