How qzhao19/auto-commit works
auto-commit is a Rust CLI that turns staged Git changes—or an in-progress Git operation—into a Conventional Commits message, then lets the user accept, regenerate, or switch candidates before committing. The principal path loads configuration, inspects repository state, classifies and budgets staged diffs, assembles a prompt, calls an LLM, validates its response, and enters an interactive review loop. The README also documents OpenAI-compatible and Ollama backends and layered configuration. Unsampled subsystem links are included only where the README or source index supports them.
Main entry points: main.rs CLI workflow · cycle.rs Candidate review · runner.rs Git command runner · collector.rs Repository preflight
Components 20
CLI entry
- CLI workflow
src/main.rs
Git analysis
- Repository preflight
src/core/git/preflight/collector.rs - Operation detection
src/core/git/operation/detector.rs - Staged metadata
src/core/git/staged/collector.rs - Diff classification
src/core/git/diff/classifier.rs - Diff budgeting
src/core/git/diff/planner.rs - Diff extraction
src/core/git/diff/extractor.rs - Assembly context
src/core/pipe/context.rs
Message generation
- Prompt assembly
src/core/pipe/assembler.rs - LLM client
src/core/llm/client.rs - Provider adapters
src/core/llm/provider - Message validation
src/core/pipe/validator.rs
Review and commit
- Candidate review
src/core/inter/cycle.rs - Terminal UI
src/infra/terminal/ui.rs - Candidate cache
src/infra/cache/candidates.rs
Runtime support
- Configuration loading
src/infra/config/loader.rs - Git command runner
src/infra/git/runner.rs
Other components
- Developer
- LLM services
- Git repository
Connections 27
- Developer → CLI workflow: runs
README.md - CLI workflow → Configuration loading: loads config
src/main.rs - CLI workflow → Git command runner: creates runner
src/main.rs - CLI workflow → Repository preflight: starts pipeline
- Repository preflight → Git command runner: queries repository
src/core/git/preflight/collector.rs - CLI workflow → Operation detection: detects state
- CLI workflow → Staged metadata: collects staged data
- CLI workflow → Diff classification: classifies files
- CLI workflow → Diff budgeting: plans budget
- CLI workflow → Diff extraction: extracts diff
- Repository preflight → Git repository: inspects
src/core/git/preflight/collector.rs - Operation detection → Git repository: inspects state
src/core/git/operation/detector.rs - Staged metadata → Git repository: reads index
- Diff extraction → Git repository: reads diff
src/core/git/diff/extractor.rs - CLI workflow → Assembly context: receives result
src/main.rs - CLI workflow → Prompt assembly: assembles prompt
src/main.rs - Prompt assembly → Assembly context: uses context
src/core/pipe/assembler.rs - CLI workflow → LLM client: requests message
src/main.rs - LLM client → Provider adapters: dispatches request
src/core/llm/client.rs - Provider adapters → LLM services: sends request
README.md - CLI workflow → Message validation: validates response
src/main.rs - CLI workflow → Candidate review: starts review
src/main.rs - Candidate review → Terminal UI: renders interface
src/core/inter/cycle.rs - Candidate review → Candidate cache: uses candidates
src/core/inter/cycle.rs - CLI workflow → Git command runner: commits accepted
src/main.rs - Git command runner → Git repository: runs Git commands
src/infra/git/runner.rs - Developer → Candidate review: reviews choices
README.md