pub fn suggest_scope_fix(
message: &str,
files: &[&str],
valid_scopes: &[ScopeDefinition],
issues: &[CommitIssue],
) -> Option<CommitSuggestion>Expand description
Deterministically suggests a corrected message for an unknown-scope or
missing-scope issue.
Resolves a scope from files against valid_scopes via
crate::git::commit::resolve_scope — no AI, no network. Returns None
when there’s nothing to suggest: neither issue is present, the subject
doesn’t parse, resolve_scope can’t resolve anything from files, or
the resolved scope doesn’t actually change the message.
An existing-but-wrong scope (unknown-scope) is replaced via
crate::git::commit::refine_message_scope. A missing scope
(missing-scope, only reachable when rules.require_scope is set) is
inserted between the type (and any breaking-change !) and the colon —
refine_message_scope is deliberately not reused for this case, since its
contract is “replace an existing scope,” never “add one.”