git-agent for Rust

Precise conventional commits for Rust crates and workspaces

git-agent understands Cargo workspace layouts and Rust's ownership patterns, splitting your staged changes into clean atomic commits with conventional messages that match the Rust community's standards.

diff --git a/src/error.rs b/src/error.rs index 8c1d3f2..5e9a7b4 100644 --- a/src/error.rs +++ b/src/error.rs @@ -1,10 +1,22 @@ -use std::fmt; +use std::fmt; +use std::io; #[derive(Debug)] pub enum Error { NotFound(String), Unauthorized, + Io(io::Error), + Parse { input: String, reason: String }, } impl fmt::Display for Error { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { Error::NotFound(key) => write!(f, "not found: {key}"), Error::Unauthorized => write!(f, "unauthorized"), + Error::Io(e) => write!(f, "io error: {e}"), + Error::Parse { input, reason } => { + write!(f, "parse error on {input!r:?}: {reason}") + } } } } + +impl From<io::Error> for Error { + fn from(e: io::Error) -> Self { + Error::Io(e) + } +}
git-agent output
feat(error): add Io and Parse variants to Error enum - add Error::Io(io::Error) variant with From<io::Error> impl for ? operator use - add Error::Parse with structured input/reason fields for diagnostic context - implement Display for both new variants Callers that perform file I/O can now propagate errors with ? instead of manually wrapping; the Parse variant carries enough context for user-facing error messages without a separate error type.
  • Understands Cargo workspace members and suggests per-crate scopes
  • Separates Cargo.lock updates into chore commits automatically
  • Distinguishes trait definition changes from trait implementation changes
  • Handles macro-heavy code diffs without losing context
brew install gitagenthq/tap/git-agent # inside your Rust project git-agent init # reads Cargo.toml workspace members to suggest scopes
Does git-agent handle Rust macro expansions in diffs?
git-agent works on the source diff, not the expanded output. Proc-macro and derive attribute changes are treated as normal source changes.
Will unsafe blocks affect how git-agent categorises commits?
git-agent detects unsafe block additions and will note them in the commit body, but the commit type is still determined by the overall change intent (feat, fix, refactor, etc.).
Can I use git-agent on a Rust project without a Cargo workspace?
Yes. Single-crate projects work out of the box. git-agent infers scopes from your src/ directory structure when no workspace is present.