This tool automates the process of code review using the Gemini API. It helps developers streamline their code review process by generating detailed feedback and suggestions for improvement.
-
Calculate Git Diffs: Automatically calculates the differences between the current branch and the main branch of a Git repository.
-
Send Diffs for Review: Sends the calculated diffs to the Gemini API for a detailed code review.
-
Save Review Reports: Saves the review feedback in a HTML file for easy reference and sharing.
- Python 3.x
- gitpython library
- request library
- Gemini API token
-
Clone this repository to your local machine:
https://github.com/heroesofcode/pullpanda-cli.git cd pullpanda-cli
-
Install the required Python packages:
pip install gitpython requests
- Set up your Gemini API token:
-
Open the script file in a text editor.
-
Replace the GEMINI_AI_TOKEN variable with your actual Gemini API token:
GEMINI_AI_TOKEN = "your_api_token_here"
- Run the script:
python pullpanda.py
-
Enter the path to your local project repository when prompted.
-
The script will calculate the diff between the current branch and the main branch (assumed to be develop in this example). Modify the script if your main branch has a different name.
-
The diff will be sent to the Gemini API for review.
-
The review feedback will be saved as a HTML file in the reports directory within the script's directory.
Upon successful execution, you will see a message indicating where the review report has been saved:
The report file has been saved at: /path/to/reports/pullpanda_report.html
- Main Branch: If your main branch is not named develop, change the line in the get_diff function:
main_branch = repo.heads['your_main_branch']
- Review Prompt: Customize the review prompt in the send_diff_for_code_review function if needed:
"text": "Your custom prompt here: " + diff
This project is licensed under the MIT License.