commic
v1.0.2
Published
AI-powered Git commit message generator with Conventional Commits support
Maintainers
Readme
Commic ✨
AI-powered Git commit message generator that creates beautiful, Conventional Commits compliant messages using Google's Gemini API.
Features
🤖 AI-Powered: Leverages Google Gemini to analyze your changes and generate contextual commit messages
📝 Conventional Commits: All messages follow the Conventional Commits specification
🎨 Beautiful UI: Colorful, emoji-enhanced terminal interface
⚡ Fast & Easy: Interactive selection from 3-5 AI-generated suggestions
🔧 Flexible: Works with any Git repository, supports custom paths
Installation
Global Installation
npm install -g commicLocal Development
git clone <repository-url>
cd commic
npm install
npm linkFirst-Time Setup
On your first run, Commic will guide you through a quick setup:
- API Key: You'll be prompted to enter your Google Gemini API key
- Get your free API key at Google AI Studio
- Model Selection: Choose your preferred Gemini model
- Currently supports: Gemini 3 Flash Preview
Your configuration is saved to ~/.commic/config.json for future use.
Usage
Basic Usage
Run in your current Git repository:
commic .Specify a Repository Path
Commit to a different repository:
# Relative path
commic ../other-repo/
# Absolute path
commic /path/to/repository/Reconfigure
Update your API key or model preference:
commic --reconfigureHow It Works
- 🔍 Analyzes your Git changes (staged and unstaged)
- 🤖 Generates 5 commit message suggestions using AI
- 🎯 Validates all messages against Conventional Commits spec
- ✨ Presents an interactive menu for selection
- 🚀 Commits automatically with your chosen message
Conventional Commits Format
All generated messages follow this format:
<type>[optional scope]: <description>
[optional body]
[optional footer(s)]Types
feat: New featurefix: Bug fixdocs: Documentation changesstyle: Code style changes (formatting, etc.)refactor: Code refactoringtest: Adding or updating testschore: Maintenance tasksperf: Performance improvementsci: CI/CD changesbuild: Build system changes
Examples
feat(auth): add JWT authentication
fix: resolve memory leak in event handler
docs: update installation instructions
refactor(api)!: restructure endpoint handlers
BREAKING CHANGE: API endpoints now require authenticationTroubleshooting
"No Git repository found"
Make sure you're running the command in a Git repository or providing a valid path to one.
git init # Initialize a new repository if needed"Repository has no commits"
Create an initial commit first:
git add .
git commit -m "Initial commit""API key invalid"
Reconfigure with a valid API key:
commic --reconfigure"No changes to commit"
Make some changes to your files first, or check if everything is already committed:
git statusConfiguration
Configuration is stored at ~/.commic/config.json:
{
"apiKey": "your-api-key",
"model": "gemini-3-flash-preview",
"version": "1.0.0"
}Requirements
- Node.js >= 18.0.0
- Git installed and configured
- Google Gemini API key
Contributing
We welcome contributions from the open-source community! This guide will help you get started.
Development Setup
Fork and clone the repository
git clone https://github.com/your-username/commic.git cd commicInstall dependencies and set up Git hooks
npm installNote:
npm installautomatically runs thepreparescript which sets up Git hooks via Husky. If Git hooks don't work after installation, manually runnpm run prepareto set them up.Link the package locally for testing
npm link
Code Quality & Linting
This project uses Biome for linting and formatting to ensure consistent code quality.
Automatic Linting on Commit
We use Husky to automatically run linting and auto-fix issues before each commit. This ensures all code follows our standards:
- Pre-commit hook: Automatically runs
biome check --write --unsafebefore every commit - Auto-fix: Automatically fixes linting issues that can be auto-fixed
- Commit blocked: If there are unfixable errors, the commit will be blocked
Setup: Git hooks are automatically set up when you run
npm install(via thepreparescript). If hooks don't work, runnpm run preparemanually.
You don't need to do anything special - just commit as normal, and the hook will handle the rest!
Manual Linting Commands
You can also run linting manually:
# Check for linting issues
npm run lint
# Auto-fix linting issues
npm run lint:fix
# Format code only
npm run formatLinting Rules
Our Biome configuration enforces:
- ✅ Code formatting: Consistent indentation, spacing, and line breaks
- ✅ Import organization: Automatic import sorting
- ✅ Unused code detection: Flags unused variables and imports
- ✅ Best practices: Enforces const usage, template literals, and more
- ⚠️ TypeScript: Warns on explicit
anytypes
Making Changes
Create a feature branch
git checkout -b feat/your-feature-name # or git checkout -b fix/your-bug-fixMake your changes
- Write clean, readable code
- Follow existing code patterns
- Add comments for complex logic
Test your changes
npm run build npm run link # Test locallyCommit your changes
commic .The pre-commit hook will automatically:
- Format your code
- Fix linting issues
- Organize imports
If there are errors that can't be auto-fixed, fix them manually and try again.
Push and create a Pull Request
git push origin feat/your-feature-name
Commit Message Guidelines
We follow Conventional Commits specification:
feat:- New featuresfix:- Bug fixesdocs:- Documentation changesstyle:- Code style changes (formatting, etc.)refactor:- Code refactoringtest:- Adding or updating testschore:- Maintenance tasksci:- CI/CD changesbuild:- Build system changes
Pull Request Process
- Ensure your code passes all linting checks (handled automatically)
- Update documentation if needed
- Write clear commit messages
- Reference any related issues in your PR description
- Wait for code review and address feedback
Questions?
If you have questions or need help, feel free to:
- Open an issue for discussion
- Check existing issues and PRs
- Review the codebase to understand patterns
Thank you for contributing! 🎉
License
MIT
