A powerful Deno CLI application that helps you generate meaningful commit messages by analyzing your Git changes.
Commit Sage analyzes the changes in your Git repository and uses AI to generate contextually relevant commit messages. It saves you time and helps maintain a consistent commit history with descriptive messages.
- Analyzes staged and unstaged changes in your Git repository
- Generates commit messages based on the actual code changes
- Supports different types of changes (staged, unstaged, untracked, deleted)
- Skips submodule changes automatically
- Works with any Git repository
You can download the prebuilt binary for your platform from the Releases page on GitHub. Follow these steps:
- Visit the Releases page.
- Download the appropriate binary for your operating system (e.g.,
commit-sage-linux
,commit-sage-macos
, orcommit-sage-windows.exe
). - Rename the binary to
commit-sage
and place it in a directory included in your$PATH
(e.g.,~/.local/bin
for Linux/macOS or any directory for Windows). - Ensure the binary is executable (on Linux/macOS, run
chmod u+x commit-sage
). - Run
commit-sage
from your terminal to use the tool.
Alternatively, you can build from source.
Clone the repository and compile the executable:
git clone https://github.com/AhmedOsman101/commit-sage-cli.git commit-sage
cd commit-sage
# Compiles the executable to your `~/.local/bin` directory. Ensure `~/.local/bin` is added to your $PATH.
deno task run compile
Note
If you plan to compile the project yourself, make sure you have Deno installed on your system.
Navigate to your Git repository and run commit-sage
to generate a commit message based on your changes:
For enhanced functionality, consider using the git-commit
wrapper script from AhmedOsman101/shellScripts.
This wrapper script extends commit-sage
with:
- Conventional commit message support
- AI-powered commit messages using
commit-sage
- Additional Git integration features
To use the wrapper script:
- Install it from AhmedOsman101/shellScripts
- Run
git-commit --ai
in your repository instead ofcommit-sage
The wrapper script provides a seamless integration between conventional commit formats and AI-generated messages.
The app requires an API key for the AI service it uses. You can set it up in two ways:
Add the following to your shell configuration file (e.g., ~/.bashrc
, ~/.zshrc
):
export SERVICE_API_KEY='your_api_key'
Replace SERVICE
with the appropriate service name and your_api_key
with your actual API key.
After adding these lines, restart your terminal or run source ~/.bashrc
to apply the changes.
This method sets the API key for a single run.
SERVICE_API_KEY='your_api_key' commit-sage
You can customize any options in the configuration file located at ~/.config/commit-sage/config.json
.
- Deno 2.x or higher (if compiling from source)
- Git installed and accessible in your PATH
- Internet connection for AI service communication (unless using Ollama)
- Commit Sage detects if you're in a Git repository
- It analyzes the changes in your repository (staged, unstaged, etc.)
- The changes are processed and sent to an AI service
- The AI generates a contextually relevant commit message
- The suggested commit message is displayed for you to use
Commit Sage provides clear error messages for common issues:
- When no changes are detected
- When the API key is not set
- When Git is not installed or the directory is not a Git repository
Contributions are welcome! Please feel free to submit a Pull Request.
By contributing to commit-sage-cli
, you agree to license your contributions under the GNU General Public License v3.0.
The following are known limitations in the current version of commit-sage, with plans to address them in future updates:
- Handle files with spaces in their names. Currently, the program may fail or behave unexpectedly when processing files containing spaces.
commit-sage-cli
is a derivative work based on the CommitSage VS Code extension by Ivan K. (GitHub), licensed under the MIT License. I cloned and significantly modified the CommitSage codebase to create a Deno CLI tool, adapting its innovative approach to commit generation for CLI use. Thank you, Ivan, for your open-source contribution, which inspired and enabled this project!
commit-sage-cli
is licensed under the GNU General Public License v3.0. The full text of the GPLv3 is available in the LICENSE file.
For reference, the original CommitSage project is licensed under the MIT License by Ivan K. The MIT License text is available at https://github.com/VizzleTF/CommitSage/ for further details.
For questions or feedback about commit-sage-cli
, please contact me via GitHub or email at ahmad.ali.othman@outlook.com.