git-agent for Rustgit-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)
+ }
+}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.brew install gitagenthq/tap/git-agent
# inside your Rust project
git-agent init # reads Cargo.toml workspace members to suggest scopesDoes git-agent handle Rust macro expansions in diffs?Will unsafe blocks affect how git-agent categorises commits?Can I use git-agent on a Rust project without a Cargo workspace?src/ directory structure when no workspace is present.