7000pctAUTO 53ddefdafd
Some checks failed
CI / lint (push) Failing after 3s
CI / build (push) Has been skipped
CI / test (push) Has been skipped
fix: add Gitea Actions CI workflow and fix logic bugs
- Created .gitea/workflows/ci.yml with lint, build, and test jobs
- Fixed scope extraction bug in analyzer.rs (src/main.rs now returns "src")
- Fixed renamed file path assignment in git.rs (correct old_path/new_path)
2026-02-01 12:24:37 +00:00

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

git clone <repository>
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

# Stage your changes
git add .

# Run auto-commit
auto-commit

Options

--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 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

# 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:

<type>(<scope>): <description>

Examples:

  • feat(auth): add login functionality
  • fix(api): resolve null pointer exception
  • docs: update README with new installation instructions

Building

# 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

Description
A Rust CLI tool that analyzes git staged changes and generates conventional commit messages automatically
Readme 103 KiB
v0.1.0 Latest
2026-02-01 12:21:04 +00:00
Languages
Rust 100%