The cr-bot
is a command line application developed in Rust.
It leverages OpenAI models (default gpt-4o-mini) to review changes, either from a PR on GitHub, or a local git diff.
You can compile the bot from source using the following command:
cargo build --release
The resulting binary will be located in the target/release
directory.
This program relies on two environment variables to function correctly. Set the following before running the application:
-
OPENAI_API_KEY
: This is your OpenAI API Key. It allows the program to access the OpenAI API for processing and generating the data. -
GH_PR_TOKEN
: This is a GitHub API token with 'repo' scope. It's used to fetch details from pull requests during the reviews. Note that while this is needed for reviewing private repositories, it's not required for public repositories.
Ensure both of these environment variables are properly set in your shell or the environment where this program will run.
The bot can be invoked in two ways:
To review a PR use the following format:
cr-bot <owner> <repo> <pr_number>
e.g.
cr-bot nihilok cr-bot 9
To review changes on your current branch against main
, use the --local
option:
cr-bot --local
For additional help:
cr-bot --help
You may edit the system message for the bot before compile time by modifying the src/system-message.txt
file.