pub struct CommitAnalysis {
pub detected_type: String,
pub detected_scope: String,
pub proposed_message: String,
pub file_changes: FileChanges,
pub diff_summary: String,
pub diff_file: String,
pub file_diffs: Vec<FileDiffRef>,
}Expand description
Commit analysis information.
Fields§
§detected_type: StringAutomatically detected conventional commit type (feat, fix, docs, test, chore, etc.).
detected_scope: StringAutomatically detected scope based on file paths (cli, git, data, etc.).
proposed_message: StringAI-generated conventional commit message based on file changes.
file_changes: FileChangesDetailed statistics about file changes in this commit.
diff_summary: StringGit diff –stat output showing lines changed per file.
diff_file: StringPath to diff file showing line-by-line changes.
file_diffs: Vec<FileDiffRef>Per-file diff references for individual file changes.
Implementations§
Source§impl CommitAnalysis
impl CommitAnalysis
Sourcepub fn analyze_commit(repo: &Repository, commit: &Commit<'_>) -> Result<Self>
pub fn analyze_commit(repo: &Repository, commit: &Commit<'_>) -> Result<Self>
Analyzes a commit and generates analysis information.
Sourcepub fn refine_scope(&mut self, scope_defs: &[ScopeDefinition])
pub fn refine_scope(&mut self, scope_defs: &[ScopeDefinition])
Re-detects scope using file_patterns from scope definitions.
More specific patterns (more literal path components) win regardless of definition order in scopes.yaml. Equally specific matches are joined with “, “. If no scope definitions match, the existing detected_scope is kept as a fallback.
Sourcepub fn suggest_message(
&self,
original_message: &str,
scope_defs: &[ScopeDefinition],
) -> String
pub fn suggest_message( &self, original_message: &str, scope_defs: &[ScopeDefinition], ) -> String
Builds a deterministic replacement for original_message without AI.
Unlike Self::proposed_message, which is generated before scope
definitions are applied (and covers only the first line), this resolves
the scope from scope_defs first, corrects the scope of an
already-conventional subject the way the AI path does, and keeps the
original body verbatim. A commit that already conforms comes back
unchanged.
Trait Implementations§
Source§impl Clone for CommitAnalysis
impl Clone for CommitAnalysis
Source§impl Debug for CommitAnalysis
impl Debug for CommitAnalysis
Source§impl<'de> Deserialize<'de> for CommitAnalysis
impl<'de> Deserialize<'de> for CommitAnalysis
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for CommitAnalysis
impl RefUnwindSafe for CommitAnalysis
impl Send for CommitAnalysis
impl Sync for CommitAnalysis
impl Unpin for CommitAnalysis
impl UnsafeUnpin for CommitAnalysis
impl UnwindSafe for CommitAnalysis
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more