feat: add default slash commands and update UI to display them
- Add built-in slash commands: /add-dir, /init, /review - Update slash_commands_list to include default commands - Enhance SlashCommandPicker UI to show default commands in dedicated tab - Improve empty state handling with search-aware messaging - Add proper command display with icons, descriptions, and scope badges
This commit is contained in:
@@ -197,6 +197,54 @@ fn find_markdown_files(dir: &Path, files: &mut Vec<PathBuf>) -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Create default/built-in slash commands
|
||||
fn create_default_commands() -> Vec<SlashCommand> {
|
||||
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");
|
||||
|
Reference in New Issue
Block a user