gitwhisper 0.0.18
gitwhisper: ^0.0.18 copied to clipboard
AI-powered Git commit message generator that whispers the perfect commit message for your changes
gitwhisper #
Generated by the Very Good CLI π€
Git Whisper is an AI-powered Git commit message generator that whispers the perfect commit message based on your staged changes.
Getting Started π #
If the CLI application is available on pub, activate globally via:
dart pub global activate gitwhisper
Or locally via:
dart pub global activate --source=path <path to this package>
, claude-3-opus, etc.)
- π Securely saves API keys for future use
- π Supports multiple AI models:
- Claude (Anthropic)
- OpenAI (GPT)
- Gemini (Google)
- Grok (xAI)
- Llama (Meta)
- Deepseek (DeepSeek, Inc.)
Usage #
# Generate a commit message (main command)
gitwhisper commit --model openai
gitwhisper # shorthand for 'gitwhisper commit' - runs commit command by default
gw # even shorter command - also runs 'gitwhisper commit' by default
# Choose a specific model variant
gitwhisper commit --model openai --model-variant gpt-4o
# Add a ticket number prefix to your commit message
gitwhisper commit --prefix "JIRA-123"
# Use a specific template for formatting
gitwhisper commit --template "detailed"
# List available models
gitwhisper list-models
# List available variants for a specific model
gitwhisper list-variants --model claude
# Save an API key for future use
gitwhisper save-key --model claude --key "your-claude-key"
# Set defaults
gitwhisper set-defaults --model openai --model-variant gpt-4o --template default
# Clear defaults
gitwhisper clear-defaults
# Template management
gitwhisper template list # List all templates
gitwhisper template add --name "custom" --format "{{type}}: {{emoji}} {{description}}" # Add template
gitwhisper template show --name "default" # Show template details
gitwhisper template delete --name "custom" # Delete a template
# Get help
gitwhisper --help
Shorter Command #
Instead of using the full gitwhisper command you can also use the shortened one gw. Both gitwhisper and gw without any subcommands will automatically run the commit command by default.
Command Structure #
GitWhisper uses a command-based structure:
commit: Generate and apply a commit message (main command)list-models: Show all supported AI modelslist-variants: Show available variants for each AI modelsave-key: Store an API key for future useupdate: Update GitWhisper to the latest versionset-defaults: Set default model, variant and template for future useclear-defaults: Clear any set default preferencestemplate: Manage commit message templatestemplate list: Show all available templatestemplate add: Add or update a templatetemplate show: Show a specific templatetemplate delete: Delete a template
API Keys #
You can provide API keys in several ways:
- Command line argument:
--key "your-api-key" - Environment variables:
ANTHROPIC_API_KEY(for Claude)OPENAI_API_KEY(for OpenAI)GEMINI_API_KEY(for Gemini)GROK_API_KEY(for Grok)LLAMA_API_KEY(for Llama)
- Saved configuration: Use the
save-keycommand to store your API key permanently
Model Variants #
GitWhisper supports a comprehensive range of model variants:
OpenAI #
gpt-4(default)gpt-4-turbo-2024-04-09gpt-4ogpt-4o-minigpt-4.5-previewgpt-3.5-turbo-0125gpt-3.5-turbo-instructo1-previewo1-minio3-mini
Claude (Anthropic) #
claude-3-opus-20240307(default)claude-3-sonnet-20240307claude-3-haiku-20240307claude-3-5-sonnet-20240620claude-3-5-sonnet-20241022claude-3-7-sonnet-20250219
Gemini (Google) #
gemini-1.0-pro(default)gemini-1.0-ultragemini-1.5-pro-002gemini-1.5-flash-002gemini-1.5-flash-8bgemini-2.0-progemini-2.0-flashgemini-2.0-flash-litegemini-2.0-flash-thinking
Grok (xAI) #
grok-1(default)grok-2grok-3grok-2-mini
Llama (Meta) #
llama-3-70b-instruct(default)llama-3-8b-instructllama-3.1-8b-instructllama-3.1-70b-instructllama-3.1-405b-instructllama-3.2-1b-instructllama-3.2-3b-instructllama-3.3-70b-instruct
Deekseek (DeepSeek, Inc.) #
deekseek-chat(default)deepseek-reasoner
GitHub (Free to use models) - rate limited #
gpt-4o(default)Llama-3.3-70B-InstructDeepSeek-R1etc - Check for more herehttps://github.com/marketplace?type=models
To run GitHub models you may need the following:
To authenticate with the model you will need to generate a personal access token (PAT) in your GitHub settings. Create your PAT token by following instructions here: https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens
How It Works #
Git Whisper:
- Checks if you have staged changes in your repository
- Retrieves the diff of your staged changes
- Sends the diff to the selected AI model
- Generates a commit message following the conventional commit format with emojis
- Applies any prefix/ticket number if specified
- Submits the commit with the generated message
Configuration #
Configuration is stored in ~/.git_whisper.yaml and contains your saved API keys and default settings:
api_keys:
claude: "your-claude-key"
openai: "your-openai-key"
# ...
default_model: "openai"
default_variant: "gpt-4o"
default_template: "detailed"
Templates are stored in ~/.git_whisper_templates.json:
{
"default": "{{type}}: {{emoji}} {{description}}",
"detailed": "[{{prefix}}] {{type}}({{scope}}): {{emoji}} {{description}}",
"simple": "{{type}}: {{description}}"
}
Requirements #
- Dart SDK (^3.5.0)
- Git installed and available in your PATH
Conventional Commit Format #
Git Whisper generates commit messages following the conventional commit format with emojis:
<type>([scope]): <emoji> <description>
With prefix option:
<type>([scope]): <emoji> PREFIX-123 -> <description>
Common types and their emojis include:
feat: β¨New featurefix: πBug fixdocs: πDocumentation changesstyle: πCode style changes (formatting, etc.)refactor: β»οΈCode changes that neither fix bugs nor add featurestest: π§ͺAdding or fixing testschore: π§Changes to the build process or auxiliary toolsperf: β‘Performance improvementsci: π·CI/CD related changesbuild: π¦Changes affecting build system or dependenciesrevert: βͺReverting a previous commit
Custom Templates #
You can create custom templates for commit messages to fit your team's workflow:
gitwhisper template add --name "detailed" --format "[{{prefix}}] {{type}}({{scope}}): {{emoji}} {{description}}"
Available template placeholders:
{{type}}- Commit type (feat, fix, etc.){{scope}}- Optional commit scope (auth, ui, etc.){{emoji}}- Type-specific emoji{{description}}- Commit description{{prefix}}- User-specified prefix (e.g., ticket number)
Example template formats:
"[{{prefix}}] {{type}}({{scope}}): {{emoji}} {{description}}""{{emoji}} {{type}}: {{description}}""{{type}}: {{prefix}} - {{description}}""{{type}}({{scope}}): {{description}} ({{prefix}})"
Use templates when generating commit messages:
gitwhisper commit --template "detailed"
Set a default template:
gitwhisper set-defaults --template "detailed"
Contributing #
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License #
This project is licensed under the MIT License - see the LICENSE file for details.