feat: enhance project-specific slash commands management
- Add scopeFilter prop to SlashCommandsManager for filtering by scope - Replace browser confirm() with proper delete confirmation dialog - Fix slash_command_delete to handle project commands with project_path param - Add Slash Commands tab to ProjectSettings as the default tab - Add Commands button to ClaudeCodeSession for quick access - Improve error handling and user feedback for delete operations - Better UI text when showing project-specific commands only
This commit is contained in:
@@ -416,11 +416,25 @@ pub async fn slash_command_save(
|
||||
|
||||
/// Delete a slash command
|
||||
#[tauri::command]
|
||||
pub async fn slash_command_delete(command_id: String) -> Result<String, String> {
|
||||
pub async fn slash_command_delete(command_id: String, project_path: Option<String>) -> Result<String, String> {
|
||||
info!("Deleting slash command: {}", command_id);
|
||||
|
||||
// Get the command to find its file path
|
||||
let command = slash_command_get(command_id.clone()).await?;
|
||||
// First, we need to determine if this is a project command by parsing the ID
|
||||
let is_project_command = command_id.starts_with("project-");
|
||||
|
||||
// If it's a project command and we don't have a project path, error out
|
||||
if is_project_command && project_path.is_none() {
|
||||
return Err("Project path required to delete project commands".to_string());
|
||||
}
|
||||
|
||||
// List all commands (including project commands if applicable)
|
||||
let commands = slash_commands_list(project_path).await?;
|
||||
|
||||
// Find the command by ID
|
||||
let command = commands
|
||||
.into_iter()
|
||||
.find(|cmd| cmd.id == command_id)
|
||||
.ok_or_else(|| format!("Command not found: {}", command_id))?;
|
||||
|
||||
// Delete the file
|
||||
fs::remove_file(&command.file_path)
|
||||
|
Reference in New Issue
Block a user