A Rust CLI tool that automatically prepends appropriate gitmoji to your commit messages based on intelligent keyword matching.
- ๐ฏ Simple KeywordMatching: Enhanced first-word keyword matching with 200+ keyword mappings
- ๐ฏ LLM KeywordMatching: AI-powered matching with LLM(now only support SiliconFlow)
- ๐จ Comprehensive Emoji Support: All 69 official gitmojis from the gitmoji standard
- โก Git Integration: Seamless integration with your Git workflow
- ๐ Dry Run Mode: Preview commits before executing
- ๐ Emoji Display: View all available gitmojis with Unicode rendering
- ๐ก๏ธ Robust Error Handling: Validates staged changes and Git repository status
- ๐งช Comprehensive Testing: 65 tests covering unit, integration, and edge cases
- ๐ Enhanced CLI Experience: ANSI colors, progress indicators, and user-friendly output
- Support for more LLM APIs
- Custom keyword mapping configuration
- Integration with commit message templates
- Rust 1.70+ with Cargo
- Git installed and configured
git clone https://github.com/yourusername/auto-gitmoji.git
cd auto-gitmoji
cargo build --release
cargo install --path .cargo install auto-gitmoji
# or with your own API_KEY
cargo install auto-gitmoji --features llm# Commit with automatic gitmoji selection
amoji "add new user authentication feature"
# Output: โจ :sparkles: add new user authentication feature
# Preview without committing (dry run)
amoji "fix login validation bug" --dry-run
# Output: ๐ :bug: fix login validation bug
# Show all available emojis
amoji --show-emoji
# Get detailed help with examples
amoji --help-message# Feature additions
amoji "add user profile page"
# Result: โจ :sparkles: add user profile page
# Bug fixes
amoji "fix memory leak in data processor"
# Result: ๐ :bug: fix memory leak in data processor
# Hotfixes
amoji "hotfix critical authentication vulnerability"
# Result: ๐๏ธ :ambulance: hotfix critical authentication vulnerability
# Documentation
amoji "docs update installation guide"
# Result: ๐ :memo: docs update installation guide
# Refactoring
amoji "refactor authentication module"
# Result: โป๏ธ :recycle: refactor authentication module
# Performance improvements
amoji "optimize database query performance"
# Result: โก :zap: optimize database query performance
# Testing
amoji "test user registration flow"
# Result: ๐งช :test_tube: test user registration flow
# Dependencies
amoji "update package dependencies"
# Result: ๐ฆ :package: update package dependencies
# Security
amoji "security fix for JWT validation"
# Result: ๐ :lock: security fix for JWT validation- ๐ Analysis: Commit message analyzed word by word
- ๐งน Cleaning: Non-alphanumeric characters replaced with spaces for better word extraction
- ๐ Extraction: Words split by whitespace and normalized to lowercase
- ๐ฏ Matching: First word matched against comprehensive keyword database
- โจ Formatting: Complete commit message formatted with appropriate gitmoji
| Category | Keywords | Emoji |
|---|---|---|
| Features | add, new, create, implement, introduce, feat |
โจ :sparkles: |
| Bug Fixes | fix, repair, resolve, correct, patch |
๐ :bug: |
| Hotfixes | hotfix, urgent, critical |
๐๏ธ :ambulance: |
| Documentation | docs, documentation, readme, comment |
๐ :memo: |
| Refactoring | refactor, restructure, reorganize, cleanup |
โป๏ธ :recycle: |
| Performance | optimize, performance, speed, cache, perf |
โก :zap: |
| Testing | test, testing, spec, coverage |
๐งช :test_tube: |
| Security | security, vulnerability, auth, permission |
๐ :lock: |
| Styling | style, format, lint, prettier |
๐ :lipstick: |
| Dependencies | deps, dependency, package, upgrade |
๐ฆ :package: |
| Configuration | config, configuration, settings, env |
โ๏ธ :gear: |
The tool uses a clean strategy pattern with pluggable matchers:
pub trait GitmojiMatcher {
fn match_emoji(&self, message: &str) -> Result<MatcherResult>;
fn name(&self) -> &'static str;
}
pub type MatcherResult = Option<(String, String)>; // (emoji_code, formatted_message)Current Matchers:
- SimpleMatcher: Keyword-based matching with 200+ keywords
- LLMMatcher: AI-powered matching (optional feature)
amoji [OPTIONS] [MESSAGE]
ARGUMENTS:
[MESSAGE] The commit message
OPTIONS:
-d, --dry-run Show what would be committed without actually committing
-s, --show-emoji Show available emoji codes
-m, --help-message Show help message with usage examples
-h, --help Print help
-V, --version Print version# Debug build
cargo build
# Release build
cargo build --release# Run all tests
cargo test
# Run with output
cargo test -- --nocapture
# Run specific test module
cargo test matcher::tests# Development
cargo run -- "your commit message"
# With features
cargo run --features llm -- "your commit message"
# Dry run
cargo run -- "your commit message" --dry-runsrc/
โโโ main.rs # CLI application entry point
โโโ lib.rs # Library exports and integration tests
โโโ commit.rs # Git commit operations
โโโ emoji.rs # Emoji lookup and mapping
โโโ matcher/
โโโ mod.rs # Matcher trait and factory
โโโ simple.rs # Keyword-based matcher
โโโ llm.rs # LLM-based matcher (feature gated)
tests/
โโโ integration_tests.rs # Full workflow integration tests
fixtures/
โโโ gitmojis.json # Official gitmoji data (69 emojis)
โโโ keyword_map.json # Keyword to emoji mappings (200+ keywords)
[features]
default = []
llm = ["reqwest", "tokio", "dotenvy"]To enable LLM support:
cargo build --features llm# For LLM feature
export API_KEY="your-api-key"- Test Coverage: 65 tests (56 unit + 9 integration)
- Performance: < 100ms for typical operations
- Reliability: Comprehensive error handling and edge case coverage
- Compatibility: Works with all major terminals and Git workflows
- Fork the repository
- Create a feature branch
- Make your changes with tests
- Ensure all tests pass:
cargo test - Submit a pull request
- Use
cargo fmtfor formatting - Use
cargo clippyfor linting - Follow Rust 2024 edition standards
- Add tests for new functionality
This project is licensed under the MIT License. See the LICENSE file for details.
- Gitmoji for the comprehensive emoji standard
- The Rust community for excellent tooling and libraries
- Contributors and users who provide feedback and improvements