cargo-c-build

Crates.iocargo-c-build
lib.rscargo-c-build
version0.9.3
created_at2025-08-06 23:48:06.033809+00
updated_at2025-08-08 01:27:22.954136+00
descriptionAn AI-enhanced git automation tool that builds and commits Rust projects with AI-generated commit messages for every build run.
homepage
repository
max_upload_size
id1784493
size54,891
Logan (Logan-Garrett)

documentation

README

📦 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 diff to 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.
  • 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!
":)"
Commit count: 0

cargo fmt