Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .zed/debug.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[
{
"label": "Build & Debug",
"adapter": "CodeLLDB",
"build": {
"command": "cargo",
"args": ["run", "--", "--dry", "-v"]
},
"program": "$ZED_WORKTREE_ROOT/target/debug/gim",
"sourceLanguages": ["rust"],
"request": "launch",
"args": []
}
]
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "git-intelligence-message"
version = "2.1.1"
version = "2.1.3"
edition = "2024"
description = "An advanced Git commit message generation utility with AI assistance"
authors = ["Sheldon.Wei<sheldon.sh.hb@gmail.com>"]
Expand Down
18 changes: 18 additions & 0 deletions src/commands/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,24 @@ fn new_version_available() -> Result<(bool, Version, Version), Box<dyn std::erro

/// Gets the latest version from Homebrew
fn get_latest_version_by_homebrew() -> Result<Version, Box<dyn std::error::Error>> {
if let Ok(repo) = String::from_utf8(Command::new("brew").arg("--repository").output()?.stdout) {
let fetch_head = format!("{}/.git/FETCH_HEAD", repo.trim());
let should_update = match std::fs::metadata(&fetch_head) {
Ok(meta) => {
let modified = meta.modified()?;
std::time::SystemTime::now().duration_since(modified)?
> std::time::Duration::from_secs(86400)
}
Err(_) => true,
};

if should_update {
output::print_verbose("Homebrew index is outdated, running 'brew update'...");
let _ = Command::new("brew").arg("update").status();
} else {
output::print_verbose("Homebrew index was updated recently.");
}
}
// Get latest version from Homebrew
let output = Command::new("brew")
.args(["info", "--json=v2", REPOSITORY])
Expand Down
10 changes: 5 additions & 5 deletions src/core/diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ fn select_files(changes: Vec<FileChange>, max_files: usize) -> Vec<String> {
"Code changes ({} lines) exceed 50% of total ({} lines), filtering to code files only",
code_lines, total_lines
));
changes.into_iter()
changes
.into_iter()
.filter(|c| c.file_type == FileType::Code)
.collect()
} else {
Expand All @@ -115,14 +116,13 @@ fn select_files(changes: Vec<FileChange>, max_files: usize) -> Vec<String> {

// Take top N files by lines changed if max_files is set
if max_files > 0 {
filtered_changes.into_iter()
filtered_changes
.into_iter()
.take(max_files)
.map(|c| c.path)
.collect()
} else {
filtered_changes.into_iter()
.map(|c| c.path)
.collect()
filtered_changes.into_iter().map(|c| c.path).collect()
}
}

Expand Down
1 change: 1 addition & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ async fn main() {
std::process::exit(1);
}
utils::output::print_normal("");
utils::output::print_promotion();

// Give the background update check task a chance to complete
if let Some(handle) = update_check_handle {
Expand Down
7 changes: 7 additions & 0 deletions src/utils/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,10 @@ pub fn print_warning(message: &str) {
eprintln!("⚠️ {}", message);
}
}

/// Prints promotion message for Rudist Redis client.
pub fn print_promotion() {
if !is_quiet() {
println!("\n🚀 Give AI-powered Redis GUI a try! https://redis-egui-client.pages.dev/");
}
}
Loading