# Auto Commit Message Generator A Rust CLI tool that analyzes git staged changes and automatically generates conventional commit messages. It parses diffs to understand modifications and suggests appropriate messages following the Conventional Commits specification. ## Features - **Automatic commit type classification**: Detects feat, fix, docs, refactor, test, chore, build, ci, style, and perf commits - **Smart scope detection**: Automatically extracts module/directory scope from changed files - **Interactive mode**: Allows users to select/override commit type with a terminal UI - **Dry-run support**: Preview commit messages without actually committing - **Multiple message options**: Generates alternative commit messages for selection ## Installation ### From Source ```bash git clone cd auto-commit cargo build --release cargo install --path . ``` ### Prerequisites - Rust 1.70 or later - Git - C compiler (gcc, clang, or MSVC) for building dependencies ## Usage ### Basic Usage ```bash # Stage your changes git add . # Run auto-commit auto-commit ``` ### Options ```bash --dry-run Preview the commit message without committing --type, -t Override the detected commit type (e.g., --type feat) --scope, -s Override the detected scope (e.g., --scope auth) --no-interactive Skip interactive prompts --verbose, -v Show detailed staged changes --help Show help message --version Show version information ``` ## Commit Types The tool follows the [Conventional Commits](https://www.conventionalcommits.org/) specification: | Type | Description | |------|-------------| | `feat` | A new feature | | `fix` | A bug fix | | `docs` | Documentation only changes | | `style` | Changes that do not affect the meaning of the code (white-space, formatting, etc) | | `refactor` | A code change that neither fixes a bug nor adds a feature | | `test` | Adding missing tests or correcting existing tests | | `chore` | Changes to the build process or auxiliary tools | | `build` | Changes that affect the build system or external dependencies | | `ci` | Changes to our CI configuration files and scripts | | `perf` | A code change that improves performance | ## Examples ```bash # Interactive mode (default) auto-commit # Preview without committing auto-commit --dry-run # Force a specific commit type auto-commit --type fix # Override both type and scope auto-commit --type feat --scope auth # Non-interactive mode auto-commit --no-interactive ``` ## Message Format Generated messages follow the format: ``` (): ``` Examples: - `feat(auth): add login functionality` - `fix(api): resolve null pointer exception` - `docs: update README with new installation instructions` ## Building ```bash # Debug build cargo build # Release build cargo build --release # Run tests cargo test # Check formatting cargo fmt -- --check # Run clippy cargo clippy -- -D warnings ``` ## License MIT License