English | 简体中文
An AI-powered command-line tool that helps developers generate commit messages, perform code reviews, and streamline daily development tasks based on Git repository changes.
- Download Pre-built Binaries: Get the latest release from Releases and add the directory to your
PATH. - Build from Source (requires Go >= 1.24.0):
The
git clone https://github.com/loveRyujin/ReviewBot.git cd ReviewBot make installmake installcommand will compile and install the executable toGOBIN(orGOPATH/bin). If you only want to build the binary in the repository, runmake build, which places the executable atbin/reviewbot(bin/reviewbot.exeon Windows).
To verify the installation:
reviewbot --helpYou should see the following output:
____ _ ____ _
| _ \ ___ __ __ (_) ___ __ __ | __ ) ___ | _
| |_) | / _ \ \ \ / / | | / _ \ \ \ /\ / / | _ \ / _ \ | __|
| _ < | __/ \ V / | | | __/ \ V V / | |_) | | (_) | | _
|_| \_\ \___| \_/ |_| \___| \_/\_/ |____/ \___/ \__|
A command-line tool that helps generate git commit messages, code reviews, etc.
Usage:
reviewbot [flags]
reviewbot [command]
Available Commands:
commit Automically generate commit message
config Manage configuration settings
help Help about any command
init Initialize ReviewBot configuration
review Auto review code changes in git stage
Flags:
-c, --config string config file path
-h, --help help for reviewbot
--version version[=true] Print version information and quit.
Use "reviewbot [command] --help" for more information about a command.
- Generate git commit messages following Conventional Commits specification
- Automatically review code changes and provide suggestions
- Support for multiple output languages with translation
- Stream output support for real-time feedback
- Read external git diff from stdin, file, or command-line arguments
- Customize git diff context lines
- Configure ignore file patterns
- Custom prompt template directory via configuration or environment variables
- Network configuration including proxy, base_url, and request timeout
- Flexible AI provider and model selection via configuration or command-line arguments
Configuration priority from lowest to highest:
- YAML configuration file (in order:
~/.config/reviewbot/reviewbot.yaml, project root directory,config/directory in project root) - Environment variables (prefixed with
REVIEWBOT_, using_as separator, e.g.,REVIEWBOT_AI_BASE_URLmaps toai.base_url) - Global flags
--providerand--modelcan override the current session's provider and model, taking precedence over configuration files and environment variables - Command-line flags (use
-hor--helpto view available options for each command)
Run reviewbot init to set up configuration interactively. The system will generate a configuration file at the default path ~/.config/reviewbot/reviewbot.yaml.
To customize prompts, set prompt.folder in the configuration file (or use the REVIEWBOT_PROMPT_FOLDER environment variable). Templates in this directory will override built-in templates (keep the same filename). Currently customizable templates include:
code_review_file_diff.tmplconventional_commit.tmplsummarize_file_diff.tmplsummarize_title.tmpltranslation.tmpl
All templates use Go text/template syntax and rely on predefined placeholders (e.g., {{ .file_diffs }}, {{ .summary_points }}, {{ .output_language }}).
You can copy templates from the prompt/template/ directory to your custom directory and modify them, for example:
Below is the code patch, please provide feedback:
{{ .file_diffs }}
As long as you maintain the placeholder names, the system will populate them with the appropriate data during prompt generation.
Common placeholder descriptions:
{{ .file_diffs }}: The complete Git diff or individual file diff text{{ .summary_points }}: List of file-level summaries generated by the model, commonly used for subsequent commit message refinement{{ .output_language }}: Target output language identifier (e.g.,en,zh-cn){{ .output_message }}: Original text content to be translated
Display semantic version:
reviewbot --versionDisplay detailed version information:
reviewbot --version=rawreviewbot initgit add .
reviewbot commitPreview mode:
git add .
reviewbot commit --previewgit add .
reviewbot reviewreviewbot config listreviewbot config set ai.api_key xxxxxxreviewbot review --streamreviewbot review --output_lang=zh-cn
reviewbot commit --output_lang=zh-cnSpecify --mode=external:
- Standard input (pipe, redirection):
git add . git diff --staged | reviewbot review --mode=external

- File:
git add . git diff --staged > git_diff.txt reviewbot review --mode=external --diff_file=git_diff.txt

- Command-line arguments:
reviewbot review --mode=external your_git_diff_content

If your network environment cannot directly access certain LLM APIs, you can configure a custom base_url as shown in the config/reviewbot.yaml example.
We recommend using openrouter.
Check out TODO.md to learn about the project's improvement plans and development roadmap. Contributions and suggestions are welcome!
This project is inspired by and references appleboy/CodeGPT. CodeGPT is a command-line tool written in Go that uses ChatGPT AI (such as gpt-4o, gpt-4-turbo, gpt-3.5-turbo models) to automatically generate Git commit messages or perform code review summaries, and automatically installs git prepare-commit-msg hooks.
This project is licensed under the MIT License. See the LICENSE file for details.









