From 494bd1da737ee208ec5b152d650de0e18c24c859 Mon Sep 17 00:00:00 2001 From: Pheem49 Date: Sat, 20 Jun 2026 21:12:15 +0700 Subject: [PATCH 1/2] style: run cargo fmt to fix formatting issues --- crates/mint-cli/src/agent.rs | 10 ++++---- crates/mint-cli/src/main.rs | 32 +++++++++++++++--------- crates/mint-cli/src/updater.rs | 28 +++++++++++++++------ crates/mint-core/src/code_tools.rs | 36 ++++++++++++++++++++------- crates/mint-core/src/lib.rs | 4 +-- crates/mint-core/src/orchestration.rs | 18 +++++++++----- 6 files changed, 86 insertions(+), 42 deletions(-) diff --git a/crates/mint-cli/src/agent.rs b/crates/mint-cli/src/agent.rs index e707a0a..b377bcd 100644 --- a/crates/mint-cli/src/agent.rs +++ b/crates/mint-cli/src/agent.rs @@ -787,15 +787,15 @@ fn confirm_pausing_interrupt(prompt: &str, approval_active: &AtomicBool) -> bool fn format_markdown_bold(text: &str) -> String { let mut formatted_lines = Vec::new(); let mut in_code_block = false; - + for line in text.lines() { let mut formatted_line = line.to_string(); let trimmed = line.trim_start(); - + if trimmed.starts_with("```") { in_code_block = !in_code_block; } - + if !in_code_block { let hash_count = trimmed.chars().take_while(|&c| c == '#').count(); if hash_count > 0 && hash_count <= 6 { @@ -818,10 +818,10 @@ fn format_markdown_bold(text: &str) -> String { // Do not format markdown inside code blocks formatted_line = line.to_string(); } - + formatted_lines.push(formatted_line); } - + let mut result = formatted_lines.join("\n"); if text.ends_with('\n') { result.push('\n'); diff --git a/crates/mint-cli/src/main.rs b/crates/mint-cli/src/main.rs index 71b1e3d..8b31376 100644 --- a/crates/mint-cli/src/main.rs +++ b/crates/mint-cli/src/main.rs @@ -10,11 +10,11 @@ use mint_core::{ CHAT_CLI_ID, Capability, ChatRequest, CodeEdit, CodePatchHunk, KnowledgeStore, MemoryStore, MintConfig, TaskStore, apply_code_edits, assert_path_capability, build_code_patch, build_symbol_index, classify_shell_command, config_path, create_folder, execute_native_plugin, - find_paths, index_semantic_code, initialize_config, inspect_code_plan, list_code_files, - load_config, native_plugins, orchestrate_chat_stream_with_fallback, - orchestrate_chat_with_fallback, propose_code_edits, read_code_file, repository_summary, - run_shell_command, search_code, search_semantic_code, set_config_value, - parse_github_url, fetch_github_repo_summary, + fetch_github_repo_summary, find_paths, index_semantic_code, initialize_config, + inspect_code_plan, list_code_files, load_config, native_plugins, + orchestrate_chat_stream_with_fallback, orchestrate_chat_with_fallback, parse_github_url, + propose_code_edits, read_code_file, repository_summary, run_shell_command, search_code, + search_semantic_code, set_config_value, }; mod agent; @@ -2746,18 +2746,24 @@ fn print_shell_output(output: &mint_core::ShellOutput) { ); } - - async fn run_github_overview(repo: &str, config: &MintConfig) -> Result<()> { let Some((owner, repo_name)) = parse_github_url(repo) else { - anyhow::bail!("Invalid GitHub repository URL/format. Please use 'owner/repo' or a full GitHub URL."); + anyhow::bail!( + "Invalid GitHub repository URL/format. Please use 'owner/repo' or a full GitHub URL." + ); }; - println!("Fetching information for {}/{} from GitHub...", owner, repo_name); + println!( + "Fetching information for {}/{} from GitHub...", + owner, repo_name + ); let summary = match fetch_github_repo_summary(&owner, &repo_name).await { Ok(s) => s, Err(e) => { - anyhow::bail!("Failed to fetch repository summary: {}. Check that the repository is public and spelled correctly.", e); + anyhow::bail!( + "Failed to fetch repository summary: {}. Check that the repository is public and spelled correctly.", + e + ); } }; @@ -2781,13 +2787,15 @@ async fn run_github_overview(repo: &str, config: &MintConfig) -> Result<()> { ) .await?; - println!("\n--- AI Repository Overview for {}/{} ---", owner, repo_name); + println!( + "\n--- AI Repository Overview for {}/{} ---", + owner, repo_name + ); println!("{}", response.text); println!("--------------------------------------------------"); Ok(()) } - #[cfg(test)] mod tests { use super::*; diff --git a/crates/mint-cli/src/updater.rs b/crates/mint-cli/src/updater.rs index 5ad2b4d..c6dad79 100644 --- a/crates/mint-cli/src/updater.rs +++ b/crates/mint-cli/src/updater.rs @@ -1,5 +1,5 @@ -use std::process::Command; use std::path::PathBuf; +use std::process::Command; use std::time::{SystemTime, UNIX_EPOCH}; use anyhow::{Context, Result, bail}; @@ -165,7 +165,11 @@ pub fn print_update_notice(current: &str, latest: &str) { let notes_url = "https://github.com/Pheem49/Mint/releases/latest"; // Text lengths (including 1 leading space) - let title_clean_len = 1 + 3 + format!("Update available! {} -> {}", current, latest).chars().count(); + let title_clean_len = 1 + + 3 + + format!("Update available! {} -> {}", current, latest) + .chars() + .count(); let command_msg_len = 1 + command_msg.len(); let notes_label_len = 1 + notes_label.len(); let notes_url_len = 1 + notes_url.len(); @@ -173,16 +177,24 @@ pub fn print_update_notice(current: &str, latest: &str) { let max_len = command_msg_len .max(title_clean_len) .max(notes_label_len) - .max(notes_url_len) + 1; // plus 1 for trailing space before right border + .max(notes_url_len) + + 1; // plus 1 for trailing space before right border let border = "─".repeat(max_len); println!("\x1b[33m╭{}╮\x1b[0m", border); - + // Line 1: Title - let title_display = format!(" ✨ Update available! \x1b[1;32m{}\x1b[0;33m -> \x1b[1;32m{}\x1b[0;33m", current, latest); + let title_display = format!( + " ✨ Update available! \x1b[1;32m{}\x1b[0;33m -> \x1b[1;32m{}\x1b[0;33m", + current, latest + ); let padding1 = max_len - title_clean_len; - println!("\x1b[33m│\x1b[0m{}{}\x1b[33m│\x1b[0m", title_display, " ".repeat(padding1)); - + println!( + "\x1b[33m│\x1b[0m{}{}\x1b[33m│\x1b[0m", + title_display, + " ".repeat(padding1) + ); + // Line 2: Command let padding2 = max_len - command_msg_len; println!( @@ -209,7 +221,7 @@ pub fn print_update_notice(current: &str, latest: &str) { notes_url, " ".repeat(padding5) ); - + println!("\x1b[33m╰{}╯\x1b[0m\n", border); } diff --git a/crates/mint-core/src/code_tools.rs b/crates/mint-core/src/code_tools.rs index 5a8f2d1..e32d15f 100644 --- a/crates/mint-core/src/code_tools.rs +++ b/crates/mint-core/src/code_tools.rs @@ -466,12 +466,13 @@ fn is_ignored_directory(path: &Path) -> bool { } pub fn parse_github_url(url: &str) -> Option<(String, String)> { - let cleaned = url.trim() + let cleaned = url + .trim() .trim_start_matches("https://") .trim_start_matches("http://") .trim_start_matches("www.") .trim_start_matches("github.com/"); - + let parts: Vec<&str> = cleaned.split('/').collect(); if parts.len() >= 2 { let owner = parts[0].to_string(); @@ -493,17 +494,26 @@ pub async fn fetch_github_repo_summary(owner: &str, repo: &str) -> Result Result().await { @@ -538,7 +552,11 @@ pub async fn fetch_github_repo_summary(owner: &str, repo: &str) -> Result().await { diff --git a/crates/mint-core/src/lib.rs b/crates/mint-core/src/lib.rs index 49fda02..74b2edb 100644 --- a/crates/mint-core/src/lib.rs +++ b/crates/mint-core/src/lib.rs @@ -31,8 +31,8 @@ pub use chat::{ pub use code_tools::{ AppliedCodeEdit, CodeEdit, CodeEditPreview, CodeEditProposal, CodeFile, CodeInspectionError, CodePatchHunk, CodePlan, CodeSearchHit, RepositorySummary, apply_code_edits, build_code_patch, - inspect_code_plan, list_code_files, propose_code_edits, read_code_file, repository_summary, - search_code, parse_github_url, fetch_github_repo_summary, + fetch_github_repo_summary, inspect_code_plan, list_code_files, parse_github_url, + propose_code_edits, read_code_file, repository_summary, search_code, }; pub use config::{ ConfigError, MintConfig, config_path, initialize_config, load_config, save_config, diff --git a/crates/mint-core/src/orchestration.rs b/crates/mint-core/src/orchestration.rs index 76c50d8..369550b 100644 --- a/crates/mint-core/src/orchestration.rs +++ b/crates/mint-core/src/orchestration.rs @@ -51,7 +51,8 @@ pub async fn resolve_github_links(message: &str, config: &MintConfig) -> String use std::sync::OnceLock; static RE: OnceLock = OnceLock::new(); let re = RE.get_or_init(|| { - regex::Regex::new(r"https?://(?:www\.)?github\.com/([a-zA-Z0-9\-_.]+)/([a-zA-Z0-9\-_.]+)").unwrap() + regex::Regex::new(r"https?://(?:www\.)?github\.com/([a-zA-Z0-9\-_.]+)/([a-zA-Z0-9\-_.]+)") + .unwrap() }); let mut resolved_msg = message.to_string(); @@ -64,11 +65,16 @@ pub async fn resolve_github_links(message: &str, config: &MintConfig) -> String if repo.ends_with(".git") { repo = repo[..repo.len() - 4].to_string(); } - let repo_clean: String = repo.chars().take_while(|c| c.is_alphanumeric() || *c == '-' || *c == '_' || *c == '.').collect(); - + let repo_clean: String = repo + .chars() + .take_while(|c| c.is_alphanumeric() || *c == '-' || *c == '_' || *c == '.') + .collect(); + let repo_key = format!("{owner}/{repo_clean}"); if resolved_repos.insert(repo_key.clone()) { - if let Ok(summary) = crate::code_tools::fetch_github_repo_summary(owner, &repo_clean).await { + if let Ok(summary) = + crate::code_tools::fetch_github_repo_summary(owner, &repo_clean).await + { resolved_msg.push_str(&format!( "\n\n--- Auto-Resolved GitHub Metadata for {} ---\n{}\n--------------------------------------------", repo_key, summary @@ -2075,8 +2081,8 @@ mod tests { assert_eq!(decision.action, "finish"); assert!(decision.input.summary.is_empty()); - let decision = parse_decision(r#"{"thought":"done"}"#) - .expect("missing finish should parse"); + let decision = + parse_decision(r#"{"thought":"done"}"#).expect("missing finish should parse"); assert_eq!(decision.action, "finish"); assert!(decision.input.summary.is_empty()); } From 926f07f369bc06465b81db78bcc9610a36c0678b Mon Sep 17 00:00:00 2001 From: Pheem49 Date: Sat, 20 Jun 2026 21:25:32 +0700 Subject: [PATCH 2/2] chore: remove CLI build and artifact collection steps from release workflow --- .github/workflows/release.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 287bfcb..969e89b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -58,16 +58,11 @@ jobs: - name: Build desktop bundle run: npm run tauri:build - - name: Build CLI - run: npm run build:cli - - name: Collect artifacts run: | mkdir -p release-artifacts cp target/release/bundle/deb/*.deb release-artifacts/ cp target/release/bundle/tar/*.tar.gz release-artifacts/ - cp target/release/mint release-artifacts/mint-cli-linux-x86_64 - sha256sum release-artifacts/* > release-artifacts/SHA256SUMS - name: Upload workflow artifacts uses: actions/upload-artifact@v4