Skip to main content

strip_type_prefix

Function strip_type_prefix 

Source
pub fn strip_type_prefix(
    summary: &str,
    commit_type: &str,
    scope: Option<&str>,
) -> String
Expand description

Strip conventional commit type prefix if LLM included it in summary.

Some models return the full format feat(scope): summary instead of just summary. This function removes the prefix to normalize the response.

Tries the exact type(scope): prefix first, then type: (no scope), then a generic type(any-scope): pattern. All comparisons are case-insensitive on the type token so Fix(tui): / Feat: are stripped too.