diff --git a/crates/forge_main/src/model.rs b/crates/forge_main/src/model.rs index c0faa48830..f069645792 100644 --- a/crates/forge_main/src/model.rs +++ b/crates/forge_main/src/model.rs @@ -351,6 +351,24 @@ impl ForgeCommandManager { "Usage: :rename . Please provide a name for the conversation." )); } + Ok(SlashCommand::Rename(name)) + } + "/delete" => Ok(SlashCommand::Delete), + text => { + let parts = text.split_ascii_whitespace().collect::>(); + + if let Some(command) = parts.first() { + // Check if it's an agent command pattern (/agent-*) + if command.starts_with("/agent-") { + let command_name = command.strip_prefix('/').unwrap(); + if let Some(found_command) = self.find(command_name) { + // Extract the agent ID from the command value + if let Some(agent_id) = &found_command.value { + return Ok(SlashCommand::AgentSwitch(agent_id.clone())); + } + } + return Err(anyhow::anyhow!("{command} is not a valid agent command")); + } // Check if it's an agent command pattern (agent-*) if command_name.starts_with("agent-") { diff --git a/crates/forge_main/src/ui.rs b/crates/forge_main/src/ui.rs index 9967c7e317..e27f7d60f4 100644 --- a/crates/forge_main/src/ui.rs +++ b/crates/forge_main/src/ui.rs @@ -2264,7 +2264,12 @@ impl A + Send + Sync> UI } async fn handle_delete_conversation(&mut self) -> anyhow::Result<()> { - let conversation_id = self.init_conversation().await?; + let conversation_id = self + .state + .conversation_id + .ok_or_else(|| anyhow::anyhow!("No active conversation to delete. Start a conversation first."))?; + + self.validate_conversation_exists(&conversation_id).await?; self.on_conversation_delete(conversation_id).await?; Ok(()) }