15 releases (8 breaking)
Uses new Rust 2024
| 0.9.3 | Aug 8, 2025 |
|---|---|
| 0.8.4 | Aug 7, 2025 |
#1383 in Command line utilities
16KB
194 lines
📦 cargo-c-build
AI-assisted Git commit automation during Rust builds
cargo-c-build is a custom Cargo tool that enhances your development workflow by automatically committing your changes with AI-generated commit messages every time you build your Rust project. This creates a detailed, rollback-friendly version history, especially useful when working in AI-driven or experimental environments.
🔍 What It Does
- Checks your Git working directory for modified files.
- If changes are found:
- Uses
git diffto generate a context summary. - Sends that summary to an OpenAI model to generate a meaningful commit message.
- Builds your project using
cargo build. - If the build succeeds:
- Stages all modified files.
- Commits the changes with the generated message.
- Uses
- If the build fails, nothing is committed.
- Supports flag pass through such as: -release, --features, or -vv.
🧠 Why Use This?
With more tools (and even developers) relying on AI to generate or modify code, it's easy to lose track of changes. This crate provides:
- ✅ Automatic version control checkpoints
- ✅ Detailed, AI-generated commit messages
- ✅ Safe rollback options when changes go wrong
- ✅ Zero manual Git work during development
- ✅ Auditability for AI-generated modifications
🗺️ Roadmap
Building toward smarter and more flexible automation, here’s what’s on the horizon for cargo‑c‑build:
- Support more model provider options instead of just OpenAi.
- Support nightly toolchain.
⚙️ Installation
📦 Crates.io
# Step 1: Download the Crate
cargo install cargo-c-build
# Step 2/3: Locate Package or Working Directory and Create .env with the below inside of it.
Add API_KEY which is OpenAi Key.
Add API_URL which is "https://api.openai.com/v1/chat/completions".
Add API_MODEL which can be any OpenAi Model. (Default is "gpt-4.1-nano")
# Step 4: Run the custom build tool
cargo c-build
# Step 5: Have Fun!
":)"
📦 Local Install
# Step 1: Build the crate
cargo build
# Step 2: Install it locally
cargo install --path .
# Step 3: Locate Package or Working Directory and Create .env with the below inside of it.
Add API_KEY which is OpenAi Key.
Add API_URL which is "https://api.openai.com/v1/chat/completions".
Add API_MODEL which can be any OpenAi Model. (Default is "gpt-4.1-nano")
# Step 4: Run the custom build tool
cargo c-build
# Step 5: Have Fun!
":)"
Dependencies
~7–21MB
~241K SLoC