A smart commit message generator that analyzes your code changes and suggests appropriate commit messages based on conventional commits standard. Works with any programming language and framework.
- Universal language support - 30+ programming languages
- Comprehensive framework detection - 20+ popular frameworks
- Smart prediction based on git changes and code patterns
- Advanced scope detection for precise commit messages
- Multi-platform support - Web, Mobile, Game Development
- Conventional commits compliance
- Interactive and CLI modes
- Custom templates support
- Git integration
- Cross-platform compatibility
npm install -g @ballspins/commit-gennpx @ballspins/commit-gen [options]git clone <repository>
cd commit-gen
npm install
npm linkThe smart mode analyzes your git changes and suggests appropriate commit messages:
commit-gen --smart
# or
commit-gen -SFor guided commit message creation:
commit-gen --interactive
# or
commit-gen -i# Smart prediction for any project
commit-gen -S
# Interactive mode
commit-gen -i
# Quick commit generation
commit-gen --type feat --scope auth --description "add login functionality"Laravel Project:
cd your-laravel-project
commit-gen -S
# Output: feat(controllers): add user management functionalityReact Project:
cd your-react-project
commit-gen -S
# Output: feat(components): create user profile componentDjango Project:
cd your-django-project
commit-gen -S
# Output: feat(views): add user management viewsSpring Boot Project:
cd your-spring-project
commit-gen -S
# Output: feat(controllers): implement user API endpoints# Validate a commit message
commit-gen --validate "feat(auth): add login functionality"
# Get scope suggestions
commit-gen --suggest-scope user-S, --smart- Use smart prediction based on git changes-i, --interactive- Use interactive mode-t, --type <type>- Commit type (feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert)-s, --scope <scope>- Commit scope-d, --description <description>- Commit description-b, --breaking- Indicate breaking change--validate <message>- Validate a commit message--suggest-scope <input>- Get scope suggestions based on input-h, --help- Show help message-v, --version- Show version number
- JavaScript/TypeScript: .js, .jsx, .ts, .tsx, .mjs, .cjs, .mts, .cts
- PHP: .php, .php4, .php5, .php7, .phtml
- Python: .py, .pyw, .pyx, .pyc, .pyo, .pyd
- Java: .java, .class, .jar
- Go: .go, .mod, .sum
- Ruby: .rb, .rbw, .rake, .gemspec
- C#: .cs, .csx
- C/C++: .c, .cpp, .cc, .cxx, .h, .hpp, .hh, .hxx
- Rust: .rs, .rlib
- Swift: .swift
- Kotlin: .kt, .kts
- Scala: .scala, .sc
- Dart: .dart
- And 20+ more languages through advanced file extension detection
- PHP: Laravel, Symfony
- JavaScript/TypeScript: React, Vue, Angular, Next.js, Nuxt, Svelte, SolidJS
- Node.js: Express, NestJS, Fastify
- Python: Django, Flask, FastAPI
- Java: Spring, JavaFX
- Ruby: Rails
- Go: Gin, Echo
- .NET: ASP.NET
- Flutter (Dart)
- React Native (JavaScript/TypeScript)
- Unity (C#)
- Godot (GDScript)
- Git Analysis: Reads
git diff --cachedto analyze staged changes - Language Detection: Identifies programming languages from file extensions
- Framework Detection: Matches file patterns against known framework structures
- Change Classification: Categorizes changes as features, fixes, refactors, etc.
- Scope Detection: Determines appropriate scope from file paths and project structure
- Message Generation: Creates conventional commit message based on analysis
- New controller file in Laravel:
feat(controllers): add user management - Modified test files:
test: add user authentication tests - Style changes:
style: update button components - Configuration updates:
chore: update database configuration - Bug fixes in small files:
fix: resolve authentication issue
Create a commit-gen.json file in your project root to customize behavior:
{
"scopes": ["auth", "api", "ui", "database"],
"types": {
"feat": "Features",
"fix": "Bug Fixes"
},
"framework": "laravel",
"template": "custom"
}scopes: Array of custom scopes for your projecttypes: Custom commit type descriptionsframework: Force specific framework detectiontemplate: Use custom message templates
The tool automatically detects project structure:
Laravel: app/Http/Controllers/ → scope: "controllers"
React: src/components/ → scope: "components"
Django: apps/users/views.py → scope: "views"
Spring: src/main/java/controller/ → scope: "controllers"
All generated messages follow the Conventional Commits specification:
<type>(<scope>): <description>
[optional body]
[optional footer(s)]
feat: New featuresfix: Bug fixesdocs: Documentation changesstyle: Code style changes (formatting, etc.)refactor: Code refactoringperf: Performance improvementstest: Test additions/modificationsbuild: Build system changesci: CI configuration changeschore: Other changesrevert: Revert previous commits
Add to your .git/hooks/prepare-commit-msg:
#!/bin/bash
COMMIT_MSG_FILE=$1
commit-gen --smart > $COMMIT_MSG_FILEAdd to your .gitconfig:
[alias]
smart-commit = "!f() { commit-gen --smart | git commit -F -; }; f""No changes detected"
- Ensure you have staged changes:
git add .
"Not a git repository"
- Initialize git:
git init - Or use interactive mode:
commit-gen -i
"Prediction confidence low"
- The tool works best with conventional project structures
- Use interactive mode for more control
Framework not detected
- Ensure your project follows standard directory structure
- Use
--scopeflag to manually specify scope
Set environment variable for detailed output:
DEBUG=commit-gen commit-gen --smartgit clone https://github.com/BallSpins/commit-gen.git
cd commit-gen
npm install
npm test
npm linknpm test- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
MIT License - see LICENSE file for details
For issues and feature requests, please create an issue in the GitHub repository.
- 1.1.0: Expanded framework support (20+ frameworks) and language detection (30+ languages)
- 1.0.1: Fixed installation instructions for scoped package
- 1.0.0: Initial release with universal language support
- Features: Smart prediction, framework detection, conventional commits