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.
Install 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
# Show help
gsmart --help
When --yes
is set, GSmart stages all detected changesβincluding renamesβand skips interactive prompts so you can automate message generation.
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)
login Configure AI provider and API key
reset Reset all API keys and configuration
help [command] Display help for command
Provider | Model | Get API Key |
---|---|---|
OpenAI | GPT-4o | 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 |
# 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 prettier
src/
βββ commands/ # CLI command implementations
βββ utils/
β βββ ai.ts # AI provider integrations
β βββ git.ts # Git operations
β βββ config.ts # Configuration management
βββ gsmart.ts # Command registration
βββ index.ts # CLI entry point
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