diff --git a/src-tauri/src/commands/slash_commands.rs b/src-tauri/src/commands/slash_commands.rs index f25c140..82bf71e 100644 --- a/src-tauri/src/commands/slash_commands.rs +++ b/src-tauri/src/commands/slash_commands.rs @@ -197,6 +197,54 @@ fn find_markdown_files(dir: &Path, files: &mut Vec) -> Result<()> { Ok(()) } +/// Create default/built-in slash commands +fn create_default_commands() -> Vec { + vec![ + SlashCommand { + id: "default-add-dir".to_string(), + name: "add-dir".to_string(), + full_command: "/add-dir".to_string(), + scope: "default".to_string(), + namespace: None, + file_path: "".to_string(), + content: "Add additional working directories".to_string(), + description: Some("Add additional working directories".to_string()), + allowed_tools: vec![], + has_bash_commands: false, + has_file_references: false, + accepts_arguments: false, + }, + SlashCommand { + id: "default-init".to_string(), + name: "init".to_string(), + full_command: "/init".to_string(), + scope: "default".to_string(), + namespace: None, + file_path: "".to_string(), + content: "Initialize project with CLAUDE.md guide".to_string(), + description: Some("Initialize project with CLAUDE.md guide".to_string()), + allowed_tools: vec![], + has_bash_commands: false, + has_file_references: false, + accepts_arguments: false, + }, + SlashCommand { + id: "default-review".to_string(), + name: "review".to_string(), + full_command: "/review".to_string(), + scope: "default".to_string(), + namespace: None, + file_path: "".to_string(), + content: "Request code review".to_string(), + description: Some("Request code review".to_string()), + allowed_tools: vec![], + has_bash_commands: false, + has_file_references: false, + accepts_arguments: false, + }, + ] +} + /// Discover all custom slash commands #[tauri::command] pub async fn slash_commands_list( @@ -205,6 +253,9 @@ pub async fn slash_commands_list( info!("Discovering slash commands"); let mut commands = Vec::new(); + // Add default commands + commands.extend(create_default_commands()); + // Load project commands if project path is provided if let Some(proj_path) = project_path { let project_commands_dir = PathBuf::from(&proj_path).join(".claude").join("commands"); diff --git a/src/components/SlashCommandPicker.tsx b/src/components/SlashCommandPicker.tsx index 36bab2a..f02cafc 100644 --- a/src/components/SlashCommandPicker.tsx +++ b/src/components/SlashCommandPicker.tsx @@ -105,11 +105,11 @@ export const SlashCommandPicker: React.FC = ({ // Filter by active tab if (activeTab === "default") { - // No default/built-in commands yet - filteredByTab = []; + // Show default/built-in commands + filteredByTab = commands.filter(cmd => cmd.scope === "default"); } else { // Show all custom commands (both user and project) - filteredByTab = commands; + filteredByTab = commands.filter(cmd => cmd.scope !== "default"); } // Then filter by search query @@ -309,15 +309,64 @@ export const SlashCommandPicker: React.FC = ({ <> {/* Default Tab Content */} {activeTab === "default" && ( -
- - - No default commands available - -

- Default commands are built-in system commands -

-
+ <> + {filteredCommands.length === 0 && ( +
+ + + {searchQuery ? 'No commands found' : 'No default commands available'} + + {!searchQuery && ( +

+ Default commands are built-in system commands +

+ )} +
+ )} + + {filteredCommands.length > 0 && ( +
+
+ {filteredCommands.map((command, index) => { + const Icon = getCommandIcon(command); + const isSelected = index === selectedIndex; + + return ( + + ); + })} +
+
+ )} + )} {/* Custom Tab Content */}