Jeeves
Jeeves is a command-line tool that helps you create AI-powered Git commit messages. It streamlines your Git workflow by automatically generating meaningful commit messages based on your code changes.
Features
- Generate intelligent conventional commit messages with gitmoji based on your staged changes.
- Option to automatically stage all changes before committing
- Option to push changes after committing
- Customizable AI prompts for tailored commit message generation
- Choose any AI model (chat-gpt 4.1-mini by default)
Installation
Requirements
- Ruby 2.6 or higher
- Git
Option 1: Install as a Gem (Recommended)
gem install jeeves-git-commit
This automatically adds Jeeves to your PATH.
Option 2: Build and Install from Source
- Clone this repository:
git clone https://github.com/jubishop/Jeeves.git
cd Jeeves
- Build and install the gem:
gem build jeeves.gemspec
gem install jeeves-git-commit-*.gem
Option 3: Use the Install Script
- Clone this repository:
git clone https://github.com/jubishop/Jeeves.git
cd Jeeves
- Run the install script:
./install.sh
The script will:
- Install Jeeves to
/usr/local/bin(or~/.local/binif you don't have write access) - Add the install location to your PATH if necessary
- Set up the config directory with the default prompt file
- Make sure the script is executable
Option 4: Manual Installation
- Clone this repository:
git clone https://github.com/jubishop/Jeeves.git
cd Jeeves
- Make the script executable:
chmod +x bin/jeeves
- Create a symbolic link to make Jeeves available globally:
ln -s "$(pwd)/bin/jeeves" /usr/local/bin/jeeves
Configuration
API Key Setup
Jeeves requires an OpenRouter API key to generate commit messages. You need to set this as an environment variable:
export OPENROUTER_API_KEY="your_openrouter_api_key"
You can get an API key from OpenRouter.
Optionally, you can specify a different model by setting:
export GIT_COMMIT_MODEL="openai/gpt-4o"
The default model is openai/gpt-4.1-mini if not specified.
Prompt Configuration
Jeeves supports two levels of prompt configuration:
- Global Prompt (Default): Stored in
~/.config/jeeves/prompt. This is used for all repositories unless overridden. - Repository-Specific Prompt: Create a
.jeeves_promptfile in the root of your Git repository to customize the prompt for that specific project.
When you run Jeeves, it will:
- First look for a
.jeeves_promptfile in the root of the current Git repository - If not found, fall back to the global prompt at
~/.config/jeeves/prompt
When you run Jeeves for the first time, if there's no global prompt file in the config directory, it will copy config/prompt to the config directory automatically.
The special string: {{DIFF}}, in your prompt will be replaced with the current git diff.
Usage
Navigate to your Git repository and run:
jeeves [options]
Options:
-a, --all: Stage all changes before committing-p, --push: Push changes after committing--version: Show version information-h, --help: Show help message
Examples
# Generate a commit message for already staged changes
jeeves
# Stage all changes and generate a commit message
jeeves -a
# Stage all changes, generate a commit message, and push
jeeves -a -p
License
MIT
Development
Project Structure
Jeeves follows a specific project structure where all gemspec files and built gem files (.gem) are placed in the gemspec/ folder rather than the root directory. This keeps the root directory clean and organized.
Rake Tasks
Jeeves provides several rake tasks to streamline development:
# Run the test suite
rake test
# Build the gem and place it in the gemspec/ folder
rake build
# Build, install and test the gem
rake install
# Build and push the gem to RubyGems
rake push
The default task is rake test.
Testing
Jeeves uses Minitest for testing. To run the tests:
bundle install
rake test
The test suite includes:
- Unit tests for the CLI functionality
- Tests for version consistency
- Mock tests for API interactions (using WebMock)