ltd-cli-commit
v1.0.11
Published
Professional CLI tool for conventional commits with Husky integration
Maintainers
Readme
🔧 CLI Commit - Professional Conventional Commits Tool
Professional CLI tool for creating conventional commits with Husky integration
✨ Features
- 🎨 Beautiful Colorful Output - Terminal UI with colors and emojis
- 📝 Conventional Commits - Full support for the conventional commits specification
- 🤖 Husky Integration - Seamlessly works with Husky Git hooks
- ✅ Message Validation - Validates commit messages before creation
- ⚡ Interactive Prompts - User-friendly command line interface
- 🔧 Flexible Configuration - Customizable commit types and scopes
- 📦 Easy Installation - Install globally and use anywhere
- 🚀 TypeScript - Written in TypeScript for type safety
📦 Installation
Global Installation (Recommended)
npm install -g cli-commitLocal Installation
npm install --save-dev cli-commitUsing npx (No Installation)
npx cli-commit commit🚀 Quick Start
Interactive Mode
cli-commit commit
# or
cc commit
# or
cc cWith Options
# Create a feature commit
cli-commit commit -t feat -m "add user authentication"
# Create a fix commit with scope
cli-commit commit -t fix -s api -m "resolve CORS issue"
# Create a breaking change
cli-commit commit -t feat -m "change API structure" --breaking
# Commit all changes
cli-commit commit -t feat -m "major update" --all📋 Commit Types
| Type | Description | Emoji |
|---------|---------------------------------------|-------|
| feat | A new feature | ✨ |
| fix | A bug fix | 🐛 |
| docs | Documentation only changes | 📝 |
| style | Code style changes (formatting) | 💄 |
| refactor | Code refactoring | ♻️ |
| perf | Performance improvements | ⚡ |
| test | Adding or updating tests | 🧪 |
| build | Build system or dependency changes | 📦 |
| ci | CI/CD configuration changes | 👷 |
| chore | Maintenance tasks | 🔧 |
| revert | Reverting changes | ⏪ |
| merge | Merging branches | 🔀 |
| hotfix | Urgent bug fix | 🚑 |
🔧 Commands
cli-commit commit (alias: cc c)
Create a new conventional commit.
Options:
| Option | Alias | Description | Example |
|--------|-------|-------------|---------|
| --type | -t | Commit type | -t feat |
| --scope | -s | Scope of the change | -s api |
| --message | -m | Commit message | -m "add feature" |
| --body | -b | Commit body | -b "details" |
| --footer | -f | Commit footer | -f "Closes #123" |
| --breaking | -B | Breaking change flag | --breaking |
| --issue | -i | Issue reference | -i #123 |
| --all | -a | Stage all changes | --all |
| --dry-run | -d | Show without committing | --dry-run |
| --skip-validation | | Skip validation | --skip-validation |
| --skip-push | | Skip push after commit | --skip-push |
| --no-emoji | | Disable emoji output | --no-emoji |
Examples:
# Basic usage
cli-commit commit
# With type and message
cli-commit commit -t fix -m "resolve login bug"
# With scope
cli-commit commit -t feat -s auth -m "add OAuth support"
# Breaking change
cli-commit commit -t api -m "change response format" --breaking
# Commit all changes
cli-commit commit -t chore -m "update dependencies" -a
# Dry run
cli-commit commit -t feat -m "new feature" --dry-runcli-commit list (alias: cc ls)
List all available commit types.
cli-commit list
# Output:
# ✨ feat Feature A new feature
# 🐛 fix Bug Fix A bug fix
# 📝 docs Documentation Documentation only changes
# ...cli-commit status (alias: cc st)
Show git status and commit readiness.
cli-commit statuscli-commit validate <message> (alias: cc v)
Validate a commit message.
cli-commit validate "feat(api): add new endpoint"cli-commit info (alias: cc i)
Show CLI Commit information.
cli-commit info🎨 Output Examples
Interactive Commit Creation
╔════════════════════════════════════════════════════════════════════╗
║ ║
║ CLI Commit - Conventional Commits Tool ║
║ ║
╚════════════════════════════════════════════════════════════════════╝
Branch: main
✓ Husky installed (9.0.0)
✓ Commitlint configured
? Select the type of commit: (Use arrow keys)
✨ feat - A new feature
🐛 fix - A bug fix
...
✓ Commit created successfully!
Hash: a1b2c3d
? Push to remote? (y/N)Commit Preview
Commit Preview:
────────────────────────────────────────────────────────────
✨ feat(api): add user authentication
Add JWT-based authentication with refresh tokens
────────────────────────────────────────────────────────────
Is this a BREAKING CHANGE? (y/N)🔗 Integration
With Husky
CLI Commit works seamlessly with Husky. Just install Husky and use cli-commit in your commit workflow:
# Install Husky
npm install husky --save-dev
npx husky install
# Add to package.json
{
"scripts": {
"commit": "cli-commit commit"
}
}With commitlint
Validate commit messages with commitlint:
npm install @commitlint/config-conventional --save-devGit Aliases
Add to your ~/.gitconfig:
[alias]
cc = !cli-commit commit
ccc = !cli-commit commit --all📁 Project Structure
cli-commit/
├── bin/
│ ├── cli-commit.js # Binary entry point
│ └── postinstall.js # Post-install script
├── src/
│ ├── index.ts # Main CLI entry
│ ├── commands/
│ │ └── commit.ts # Commit command
│ ├── config/
│ │ └── commit-config.ts # Commit types & prompts
│ ├── types/
│ │ └── index.ts # TypeScript types
│ └── utils/
│ ├── colors.ts # Color utilities
│ ├── commit-builder.ts # Message builder
│ └── git.ts # Git utilities
├── test/ # Test files
├── docs/ # Documentation
├── package.json
├── tsconfig.json
└── README.md🧪 Testing
# Run all tests
npm test
# Run with coverage
npm run test:coverage
# Run in watch mode
npm run test -- --watch🤝 Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feat/amazing-feature) - Commit your changes (
git commit -m 'feat: add amazing feature') - Push to the branch (
git push origin feat/amazing-feature) - Open a Pull Request
📄 License
This project is licensed under the MIT License.
👥 Author
LTD - Laboratório de Transformação Digital
- Website: ltdestacio.com.br
- Email: [email protected]
🙏 Acknowledgments
Made with ❤️ by LTD - Laboratório de Transformação Digital
Estácio - Campus Florianópolis
