The smart way to write your commit messages using AI π€
GSmart is a CLI tool that automatically generates Conventional Commits by analyzing your staged git changes. Simply stage your files and let AI craft the perfect commit message for you.
--debug flag for detailed logging and timing information--dry-runInstall GSmart globally using npm or pnpm:
# Using npm
npm install -g gsmart
# Using pnpm
pnpm add -g gsmart
# Using yarn
yarn global add gsmart
gsmart login
Youβll be prompted to select a provider and enter your API key:
? Select a provider βΊ Use arrow keys to navigate
β― OpenAI
Anthropic
Google Gemini
Mistral
Fireworks AI
PlataformIA
# Stage your changes
git add .
# Generate and apply commit message
gsmart
Thatβs it! GSmart will analyze your staged changes and generate a conventional commit message.
# Stage some files
git add src/components/Button.tsx
# Generate commit message
gsmart
# Output: "feat(components): add Button component with primary and secondary variants"
# Use a specific provider
gsmart --provider anthropic
# Use a custom prompt
gsmart --prompt "Focus on the security implications of these changes"
# Run non-interactively (auto-stage + commit if possible)
gsmart --yes
# Preview staged files without committing
gsmart --dry-run
# Enable debug logging for troubleshooting
gsmart --debug
# Show help
gsmart --help
# Open the interactive configuration menu
gsmart config
# Set a default prompt that will be used on every run
gsmart config --add-custom-prompt "Always use imperative mood and mention the ticket number"
# Show the current default prompt
gsmart config --show
# Clear the default prompt
gsmart config --clear-custom-prompt
When --yes is set, GSmart stages all detected changesβincluding renamesβand skips interactive prompts so you can automate message generation.
| Variable | Description | Default |
|---|---|---|
GSMART_TIMEOUT |
AI request timeout in milliseconds | 30000 |
# Set a custom timeout (e.g., 60 seconds)
GSMART_TIMEOUT=60000 gsmart
If a request exceeds the timeout, GSmart exits cleanly with a user-friendly error message instead of hanging indefinitely.
Usage: gsmart [options] [command]
CLI to generate smart commit messages using AI. generate command is the default command.
Options:
-V, --version Output the version number
-h, --help Display help for command
Commands:
generate [options] Generate a commit message based on staged changes (default)
--provider <provider> Use a specific AI provider
--prompt <prompt> Custom prompt for the AI model
--yes Run non-interactively (auto stage + commit)
--dry-run Preview staged files without committing
--debug Enable debug logging and timing
login Configure AI provider and API key
reset Reset all API keys and configuration
config [options] Manage gsmart configuration (default prompt, commit style)
-s, --show Show current configuration
--add-custom-prompt <prompt> Set the default prompt non-interactively
--clear-custom-prompt Clear the default prompt non-interactively
completions <shell> Output shell completion script (bash, zsh, or fish)
help [command] Display help for command
GSmart supports tab completions for bash, zsh, and fish. Run the completions command and add the output to your shell configuration:
Add to your ~/.bashrc:
eval "$(gsmart completions bash)"
Add to your ~/.zshrc:
eval "$(gsmart completions zsh)"
gsmart completions fish > ~/.config/fish/completions/gsmart.fish
| Provider | Model | Get API Key |
|---|---|---|
| OpenAI | GPT-5 Codex | Get Key |
| Anthropic | Claude | Get Key |
| Gemini 2.0 Flash | Get Key | |
| Mistral | Mistral Large | Get Key |
| Fireworks AI | FireFunction V1 | Get Key |
| PlataformIA | Radiance | Get Key |
Do your AI agents write commits for you? Improve your commit quality with the write-conventional-commit skill.
Install it with:
npx skills add ragnarok22/agent-skills --skill write-conventional-commit
Repository: ragnarok22/agent-skills
# Install dependencies
pnpm install
# Development mode
pnpm run dev
# Build the project
pnpm run build
# Run tests
pnpm test
# Lint code
pnpm run lint
# Format code
pnpm run format
src/
βββ index.ts # CLI entry point
βββ gsmart.ts # Command registration
βββ definitions.ts # Shared types and interfaces
βββ build-info.ts # Generated build metadata
βββ commands/ # CLI command implementations
β βββ main.ts # Default command for commit message generation
β βββ login.ts # API key configuration
β βββ reset.ts # Configuration reset
β βββ config.ts # Custom prompt configuration (set, get, clear)
β βββ completions.ts # Shell completion script generator (bash, zsh, fish)
β βββ index.ts # Command barrel export
βββ utils/ # Reusable helpers
βββ ai.ts # AI provider integrations, retry handling, and timeout
βββ config.ts # Configuration and API key management
βββ constants.ts # Shared constants (defaults, timeouts)
βββ debug.ts # Debug logging utilities
βββ git.ts # Git operations
βββ holiday.ts # Seasonal greeting messages
βββ index.ts # File staging, clipboard, and retrieval logic
βββ prompt-config.ts # Custom prompt persistence
βββ providers.ts # AI provider definitions and active-provider filter
βββ version-check.ts # Update notification via update-notifier
git checkout -b feature/amazing-feature)gsmart)git push origin feature/amazing-feature)See CHANGELOG.md for details about releases and changes.
This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.
Built with β€οΈ by @ragnarok22