commit-message-template
v1.0.1
Published
Interactive git commit message formatter with ticket number support
Maintainers
Readme
commit-message-template
A Node.js CLI tool for creating standardized git commit messages with ticket numbers and customizable templates.
📦 Installation
npm install -g commit-message-templateThe tool will automatically set up the git alias during installation.
🚀 Quick Start
# Create a commit with interactive prompt
git ffc
# Update the commit message template
git ffc --update-template="path/to/template.txt"
# Bypass validation checks if needed
git ffc --nocheck✨ Features
- 🎯 Interactive Interface: User-friendly command-line prompts
- 🎨 Colored Output: Better readability with syntax highlighting
- 🎫 Ticket Integration: Automatic ticket number detection from branch names
- 📝 Template System: Customizable commit message templates
- 🔄 Multi-line Support: Easy addition of detailed change descriptions
- 🌐 Cross-platform: Works on Windows, macOS, and Linux
- 🔒 Basic Validation: Essential checks for paths, templates, and ticket numbers
- 📋 Staging Checks: Automatic verification of staged files before commit
📋 Usage
Basic Usage
git ffcThe tool will:
- Check for staged files and display them (up to 10 files)
- Guide you through creating a commit message with the following structure:
FWF-123: [Type] Description
- Change 1
- Change 2
- Change 3Staged Files Display
When you run git ffc, the tool will first show you which files are staged for commit:
📦 Files staged for commit:
-------------------
- src/file1.js
- src/file2.js
- src/file3.js
- ... and 7 other files
-------------------If no files are staged, you'll see:
⚠️ No files are staged for commit.
Use git add to stage files before running this command.Custom Templates
You can customize the commit message format by providing your own template:
git ffc --update-template="path/to/template.txt"Template Format
The template file should be a text file containing placeholders for the commit message components:
{ticket}: [{type}] {description}
{body}Required placeholders:
{ticket}: The ticket number (e.g., FWF-123){type}: The commit type{description}: The commit description{body}: Optional multi-line body (will be removed if no body is provided)
Bypassing Validation
If you encounter validation issues, you can bypass the checks using the --nocheck flag:
git ffc --nocheckThis will skip:
- Path validation
- Template validation
- Ticket number format validation
- Permission checks
🔧 Configuration
Commit Types
The tool supports the following commit types:
| Type | Description |
|------|-------------|
| Feature | New features or functionalities |
| Bugfix | Corrections of code errors or bugs |
| Hotfix | Urgent fixes addressing critical issues |
| Modified | General modifications or updates |
| Documentation | Documentation/changelog changes only |
Features in Detail
Ticket Number
- Automatically detects ticket number from branch name (pattern:
FWF-XXX) - Validates ticket number format
- Required field
- Automatically detects ticket number from branch name (pattern:
Commit Type
- Interactive selection from predefined types
- Each type has a description
- Required field
Description
- Free-form text description of the changes
- Required field
Body
- Optional multi-line body for detailed changes
- Each line is automatically prefixed with a hyphen
- Press Enter twice to finish
Staging Checks
- Automatically verifies staged files before proceeding
- Shows up to 10 staged files with a count of remaining files
- Prevents commits when no files are staged
- Provides clear instructions when files need to be staged
📝 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Acknowledgments
- Inspired by conventional commit messages
- Built with inquirer for interactive prompts
- Uses chalk for colored output
- Powered by simple-git for git operations
