autocommit-rs
Tool that generates and publishes conventional commits from staged changes in one go. For free :)
This is a Rust port of the original @wthrajat/autocommit TypeScript project.
Prerequisites
Installation
From crates.io (recommended)
From source
The binary will be at ./target/release/autocommit. Copy it to your PATH:
Pre-built binaries
Pre-built binaries for Linux, macOS (Intel & Apple Silicon), and Windows are available on the GitHub Releases page.
Updating
Or download the latest pre-built binary from the GitHub Releases page.
Usage
-
Do code changes in any repo you're working on and stage them:
-
Run
autocommitin the terminal: -
Choose an option:
- Accept and commit: Commits right away.
- Edit message: Opens a text editor to adjust the message before committing.
- Regenerate: Asks the AI for a new attempt.
- Quit: Cancels the operation.
Command-line options
| Flag | Description |
|---|---|
-v, --version |
Show version |
-h, --help |
Show help message |
--openai-key <key> |
Set OpenAI API key |
--gemini-key <key> |
Set Gemini API key |
--model <model> |
Set default model (openai or gemini) |
--short |
Use short message style (one-line summary) |
--long |
Use long message style (with description) |
--sign |
Enable GPG signed commits |
--no-sign |
Disable GPG signed commits |
--no-verify |
Bypass pre-commit and commit-msg git hooks |
Environment variables
| Variable | Description |
|---|---|
OPENAI_API_KEY |
OpenAI API key (overrides config file) |
GEMINI_API_KEY |
Google Gemini API key (overrides config file) |
AUTOCOMMIT_MODEL |
Model to use: openai or gemini |
AUTOCOMMIT_MESSAGE_STYLE |
Message style: short or long |
Configuration
Configuration is stored in ~/.autocommitrc as JSON. On first run, autocommit will guide you through an interactive setup.
Local development
Releasing
New releases are automated via GitHub Actions. To publish a new version:
Initial setup (one-time)
-
Log in to crates.io
Follow the prompt to create and paste an API token from crates.io/tokens.
-
Add the token to GitHub Secrets
- Go to repo settings → Secrets and variables → Actions
- Add
CRATES_IO_TOKENwith the token from step 1
Release a new version
-
Update the version in
Cargo.toml:= "0.2.0" -
Commit and push to
main:
The release workflow will automatically (no need to push tags manually):
- Create a git tag (
v0.2.0) - Publish the crate to crates.io
- Build binaries for Linux, macOS, and Windows
- Create a GitHub Release with the binaries attached
Manual publish (if needed)
If you need to publish without the automated workflow:
License
MIT