diff --git a/src-tauri/src/commands.rs b/src-tauri/src/commands.rs index 41ea7b7..00da09a 100644 --- a/src-tauri/src/commands.rs +++ b/src-tauri/src/commands.rs @@ -1228,6 +1228,35 @@ pub async fn list_memory_files() -> Result { }) } +#[tauri::command] +pub async fn get_claude_version() -> Result { + tracing::debug!("Getting Claude CLI version"); + + let output = std::process::Command::new("claude") + .arg("--version") + .output(); + + match output { + Ok(output) => { + if output.status.success() { + let version = String::from_utf8_lossy(&output.stdout) + .trim() + .to_string(); + tracing::info!("Claude CLI version: {}", version); + Ok(version) + } else { + let error = String::from_utf8_lossy(&output.stderr); + tracing::error!("Failed to get Claude version: {}", error); + Err(format!("Failed to get Claude version: {}", error)) + } + } + Err(e) => { + tracing::error!("Failed to execute claude --version: {}", e); + Err(format!("Failed to execute claude --version: {}", e)) + } + } +} + #[cfg(test)] mod tests { use super::*; diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 8f31c0b..1637f23 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -194,6 +194,7 @@ pub fn run() { stop_discord_rpc, close_application, list_memory_files, + get_claude_version, ]) .run(tauri::generate_context!()) .expect("error while running tauri application"); diff --git a/src/lib/components/CliVersion.svelte b/src/lib/components/CliVersion.svelte new file mode 100644 index 0000000..affb99a --- /dev/null +++ b/src/lib/components/CliVersion.svelte @@ -0,0 +1,68 @@ + + +
+ + + + + CLI {version} +
+ + diff --git a/src/lib/components/InputBar.svelte b/src/lib/components/InputBar.svelte index d2b2b8e..907cddf 100644 --- a/src/lib/components/InputBar.svelte +++ b/src/lib/components/InputBar.svelte @@ -18,6 +18,7 @@ import MessageModeSelector from "$lib/components/MessageModeSelector.svelte"; import SlashCommandMenu from "$lib/components/SlashCommandMenu.svelte"; import SystemClock from "$lib/components/SystemClock.svelte"; + import CliVersion from "$lib/components/CliVersion.svelte"; import { getCurrentMode } from "$lib/stores/messageMode"; import { formatMessageWithMode } from "$lib/types/messageMode"; import { @@ -916,6 +917,7 @@ User: ${formattedMessage}`; Clipboard +