diff --git a/src/commands/profile.rs b/src/commands/profile.rs index d038623..7d7523d 100644 --- a/src/commands/profile.rs +++ b/src/commands/profile.rs @@ -437,10 +437,18 @@ impl ProfileCommand { let repo_path = repo.path().to_string_lossy().to_string(); - manager.set_repo_profile(repo_path, name.to_string())?; + manager.set_repo_profile(repo_path.clone(), name.to_string())?; + + // Get the profile and apply it to the repository + let profile = manager.get_profile(name) + .ok_or_else(|| anyhow::anyhow!("Profile '{}' not found", name))?; + + profile.apply_to_repo(repo.inner())?; + manager.record_profile_usage(name, Some(repo_path))?; manager.save()?; println!("{} Set '{}' for current repository", "✓".green(), name.cyan()); + println!("{} Applied profile '{}' to current repository", "✓".green(), name.cyan()); Ok(()) } diff --git a/src/config/profile.rs b/src/config/profile.rs index b1cad0c..bb8c1d5 100644 --- a/src/config/profile.rs +++ b/src/config/profile.rs @@ -194,6 +194,21 @@ impl GitProfile { if let Some(key) = self.signing_key() { config.set_str("user.signingkey", key)?; + + if self.settings.auto_sign_commits { + config.set_bool("commit.gpgsign", true)?; + } + + if self.settings.auto_sign_tags { + config.set_bool("tag.gpgsign", true)?; + } + } + + if let Some(ref ssh) = self.ssh { + if let Some(ref key_path) = ssh.private_key_path { + config.set_str("core.sshCommand", + &format!("ssh -i {}", key_path.display()))?; + } } Ok(()) diff --git a/src/generator/mod.rs b/src/generator/mod.rs index a637ae4..c082bd7 100644 --- a/src/generator/mod.rs +++ b/src/generator/mod.rs @@ -2,7 +2,6 @@ use crate::config::{CommitFormat, LlmConfig, Language}; use crate::git::{CommitInfo, GitRepo}; use crate::llm::{GeneratedCommit, LlmClient}; use anyhow::{Context, Result}; -use chrono::Utc; /// Content generator using LLM pub struct ContentGenerator { @@ -114,8 +113,7 @@ impl ContentGenerator { format: CommitFormat, language: Language, ) -> Result { - use dialoguer::{Confirm, Select}; - use console::Term; + use dialoguer::Select; let diff = repo.get_staged_diff()?; @@ -145,7 +143,6 @@ impl ContentGenerator { "✓ Accept and commit", "🔄 Regenerate", "✏️ Edit", - "📋 Copy to clipboard", "❌ Cancel", ]; @@ -165,24 +162,13 @@ impl ContentGenerator { let edited = crate::utils::editor::edit_content(&generated.to_conventional())?; generated = self.parse_edited_commit(&edited, format)?; } - 3 => { - #[cfg(feature = "clipboard")] - { - arboard::Clipboard::new()?.set_text(generated.to_conventional())?; - println!("Copied to clipboard!"); - } - #[cfg(not(feature = "clipboard"))] - { - println!("Clipboard feature not enabled"); - } - } - 4 => anyhow::bail!("Cancelled by user"), + 3 => anyhow::bail!("Cancelled by user"), _ => {} } } } - fn parse_edited_commit(&self, edited: &str, format: CommitFormat) -> Result { + fn parse_edited_commit(&self, edited: &str, _format: CommitFormat) -> Result { let parsed = crate::git::commit::parse_commit_message(edited); Ok(GeneratedCommit { diff --git a/src/git/changelog.rs b/src/git/changelog.rs index ead0f78..d09600b 100644 --- a/src/git/changelog.rs +++ b/src/git/changelog.rs @@ -1,6 +1,6 @@ use super::{CommitInfo, GitRepo}; use anyhow::{Context, Result}; -use chrono::{DateTime, TimeZone, Utc}; +use chrono::{DateTime, Utc}; use std::collections::HashMap; use std::fs; use std::path::Path; @@ -232,8 +232,6 @@ impl ChangelogGenerator { let mut breaking = vec![]; for commit in commits { - let msg = commit.subject(); - if commit.message.contains("BREAKING CHANGE") { breaking.push(commit); } diff --git a/src/git/commit.rs b/src/git/commit.rs index 1807025..dbfaa26 100644 --- a/src/git/commit.rs +++ b/src/git/commit.rs @@ -1,5 +1,5 @@ use super::GitRepo; -use anyhow::{bail, Context, Result}; +use anyhow::{bail, Result}; use chrono::Local; /// Commit builder for creating commits diff --git a/src/git/mod.rs b/src/git/mod.rs index de4882e..fc754e4 100644 --- a/src/git/mod.rs +++ b/src/git/mod.rs @@ -8,10 +8,6 @@ pub mod changelog; pub mod commit; pub mod tag; -pub use changelog::ChangelogGenerator; -pub use commit::CommitBuilder; -pub use tag::TagBuilder; - /// Git repository wrapper with enhanced cross-platform support pub struct GitRepo { repo: Repository, diff --git a/src/git/tag.rs b/src/git/tag.rs index e14526a..93c4edc 100644 --- a/src/git/tag.rs +++ b/src/git/tag.rs @@ -1,5 +1,5 @@ use super::GitRepo; -use anyhow::{bail, Context, Result}; +use anyhow::{bail, Result}; use semver::Version; /// Tag builder for creating tags diff --git a/src/i18n/mod.rs b/src/i18n/mod.rs index 4b07f2c..30c6237 100644 --- a/src/i18n/mod.rs +++ b/src/i18n/mod.rs @@ -2,6 +2,4 @@ pub mod messages; pub mod translator; pub use messages::Messages; -pub use translator::Translator; -pub use translator::translate_commit_type; pub use translator::translate_changelog_category; diff --git a/src/llm/mod.rs b/src/llm/mod.rs index 44794fd..f5ae849 100644 --- a/src/llm/mod.rs +++ b/src/llm/mod.rs @@ -1,6 +1,5 @@ use anyhow::{bail, Context, Result}; use async_trait::async_trait; -use serde::{Deserialize, Serialize}; use std::time::Duration; use crate::config::Language; diff --git a/src/llm/openrouter.rs b/src/llm/openrouter.rs index 0f4c7ed..8b0f0f6 100644 --- a/src/llm/openrouter.rs +++ b/src/llm/openrouter.rs @@ -239,7 +239,7 @@ pub const OPENROUTER_MODELS: &[&str] = &[ ]; /// Check if a model name is valid -pub fn is_valid_model(model: &str) -> bool { +pub fn is_valid_model(_model: &str) -> bool { // Since OpenRouter supports many models, we'll allow any model name // but provide some popular ones as suggestions true