Problem
Currently, the sanitizeCommitMessage() function removes all emojis from commit messages. There's a TODO comment indicating this is a known limitation.
Location: utils/sanitizeCommitMessage.js:1
// TODO should allow emojis
export function sanitizeCommitMessage(message) {
// Unicode regex: Allow only all characters (including Japanese and Traditional Chinese), numbers, spaces, and symbols.
return message.replace(/[^\p{L}\p{N}\s.:@<>\/-]/gu, '')
}
Current behavior:
sanitizeCommitMessage('fix: bug 🐛🔥💥')
// Result: 'fix: bug ' (emojis removed)
Test expectation (tests/utils/sanitizeCommitMessage.test.js:47-49):
it('should remove emojis and unsupported unicode', () => {
expect(sanitizeCommitMessage('fix: bug 🐛🔥💥')).toBe('fix: bug ')
})
User Request
Many developers use emojis in commit messages for visual clarity:
- 🐛 for bug fixes
- ✨ for new features
- 🔥 for removing code/files
- 📝 for documentation
- ♻️ for refactoring
- 🚀 for deployment
- ✅ for tests
Popular projects like gitmoji encourage this practice.
Proposed Solution
Option 1: Allow All Emojis (Simple)
/**
* Sanitizes commit message by removing dangerous characters
* Allows: letters, numbers, spaces, common symbols, and emojis
* @param {string} message - Raw commit message
* @returns {string} Sanitized commit message
*/
export function sanitizeCommitMessage(message) {
// Allow all characters except potentially dangerous ones
// \p{L} = letters, \p{N} = numbers, \p{Emoji} = emojis
return message.replace(/[^\p{L}\p{N}\p{Emoji}\s.:@<>\/-]/gu, '')
}
Test update:
it('should allow emojis in commit messages', () => {
expect(sanitizeCommitMessage('fix: bug 🐛🔥💥')).toBe('fix: bug 🐛🔥💥')
})
Option 2: Allow Specific Emoji Categories
/**
* Sanitizes commit message
* Allows common emojis but blocks potentially problematic ones
*/
export function sanitizeCommitMessage(message) {
// Allow: letters, numbers, emojis, and safe symbols
// Block: control characters, private use area, format characters
return message.replace(
/[^\p{L}\p{N}\p{Emoji_Presentation}\s.:@<>\/-]/gu,
''
)
}
Option 3: Configurable Emoji Support
// Add to config
{
"model": "gpt-5-mini",
"language": "English",
"prefixEnabled": true,
"allowEmojis": true // ← New option
}
// In sanitizeCommitMessage
export function sanitizeCommitMessage(message, allowEmojis = true) {
if (allowEmojis) {
return message.replace(/[^\p{L}\p{N}\p{Emoji}\s.:@<>\/-]/gu, '')
}
// Original behavior (no emojis)
return message.replace(/[^\p{L}\p{N}\s.:@<>\/-]/gu, '')
}
// Add CLI command
program
.command('emoji')
.description('Toggle emoji support in commit messages')
.action(async () => {
const response = await prompts({
type: 'select',
name: 'value',
message: 'Allow emojis in commit messages?',
choices: [
{ title: 'Enable emojis 🎉', value: true },
{ title: 'Disable emojis', value: false },
],
initial: config.allowEmojis ? 0 : 1,
})
saveConfig({ allowEmojis: response.value })
console.log(`Emojis ${response.value ? 'enabled' : 'disabled'}`)
})
Considerations
Pros
- ✅ Better visual clarity in commit history
- ✅ Aligns with popular practices (gitmoji)
- ✅ OpenAI may generate emoji-enhanced messages
- ✅ No functional impact (emojis are valid in git)
Cons
- ⚠️ Some terminal/font configurations don't display emojis well
- ⚠️ Can look unprofessional in some corporate environments
- ⚠️ May complicate commit message parsing
Git Compatibility
Emojis work perfectly in git commit messages:
$ git commit -m "✨ Add new feature"
$ git log
commit abc123...
✨ Add new feature
Recommendation
Option 3 (Configurable) is the most flexible:
- Default: Enabled (modern practice)
- Users who don't want emojis can disable
- Backward compatible
Implementation Plan
- Update
sanitizeCommitMessage() to accept allowEmojis parameter
- Add emoji configuration option to config file
- Add
git gpt emoji command to toggle
- Update tests to verify emoji support
- Update documentation
- Consider asking OpenAI to suggest appropriate emojis
Acceptance Criteria
Priority
Low - Feature request, not a blocker
Related
Problem
Currently, the
sanitizeCommitMessage()function removes all emojis from commit messages. There's a TODO comment indicating this is a known limitation.Location: utils/sanitizeCommitMessage.js:1
Current behavior:
Test expectation (tests/utils/sanitizeCommitMessage.test.js:47-49):
User Request
Many developers use emojis in commit messages for visual clarity:
Popular projects like gitmoji encourage this practice.
Proposed Solution
Option 1: Allow All Emojis (Simple)
Test update:
Option 2: Allow Specific Emoji Categories
Option 3: Configurable Emoji Support
Considerations
Pros
Cons
Git Compatibility
Emojis work perfectly in git commit messages:
$ git commit -m "✨ Add new feature" $ git log commit abc123... ✨ Add new featureRecommendation
Option 3 (Configurable) is the most flexible:
Implementation Plan
sanitizeCommitMessage()to acceptallowEmojisparametergit gpt emojicommand to toggleAcceptance Criteria
sanitizeCommitMessage()preserves emojis when enabledallowEmojisconfig option (default: true)git gpt emojicommandPriority
Low - Feature request, not a blocker
Related