gitbit 0.1.0

A lightweight Git automation tool that generates commit messages from diffs using AI (Gemini).
1
2
3
4
5
6
7
8
9
10
11
12
use regex::Regex;

pub fn generate_message(diff: &str) -> String {
    if diff.trim().is_empty() {
        return "chore: minor updates".to_string();
    }

    let added = Regex::new(r"^\+[^+]").unwrap().find_iter(diff).count();
    let removed = Regex::new(r"^\-[^-]").unwrap().find_iter(diff).count();

    format!("update: {} additions, {} deletions", added, removed)
}