stynx_code_commands/application/
execute_command.rs1use crate::domain::{CommandResult, SlashCommand};
2use crate::infrastructure::handlers;
3
4pub async fn execute_command(command: SlashCommand) -> CommandResult {
5 match command {
6 SlashCommand::Help => handlers::handle_help(),
7 SlashCommand::Clear => handlers::handle_clear(),
8 SlashCommand::Compact => handlers::handle_compact(),
9 SlashCommand::Cost => CommandResult::Output("Use /cost from the main loop.".into()),
10 SlashCommand::Model(name) => handlers::handle_model(&name),
11 SlashCommand::Diff => handlers::handle_diff().await,
12 SlashCommand::Status => handlers::handle_status().await,
13 SlashCommand::Doctor => handlers::handle_doctor().await,
14 SlashCommand::Config => CommandResult::Output("Use /config from the main loop.".into()),
15 SlashCommand::Permissions => CommandResult::Output("Use /permissions from the main loop.".into()),
16 SlashCommand::Session(id) => handlers::handle_session(&id).await,
17 SlashCommand::Plan => CommandResult::Output("Use /plan from the main loop.".into()),
18 SlashCommand::Usage => CommandResult::Output("Use /usage from the main loop.".into()),
19 SlashCommand::Mode => CommandResult::Output("Use /mode from the main loop.".into()),
20 SlashCommand::Think => CommandResult::Output("Use /think from the main loop.".into()),
21 SlashCommand::Add(_) => CommandResult::Output("Use /add from the main loop.".into()),
22 SlashCommand::Files => CommandResult::Output("Use /files from the main loop.".into()),
23 SlashCommand::Memory => CommandResult::Output("Use /memory from the main loop.".into()),
24 SlashCommand::Export => CommandResult::Output("Use /export from the main loop.".into()),
25 SlashCommand::Rewind(_) => CommandResult::Output("Use /rewind from the main loop.".into()),
26 SlashCommand::Review => CommandResult::Output("Use /review from the main loop.".into()),
27 SlashCommand::Commit => CommandResult::Output("Use /commit from the main loop.".into()),
28 SlashCommand::Fast => CommandResult::Output("Use /fast from the main loop.".into()),
29 SlashCommand::Effort(_) => CommandResult::Output("Use /effort from the main loop.".into()),
30 SlashCommand::Copy => CommandResult::Output("Use /copy from the main loop.".into()),
31 SlashCommand::Login => CommandResult::Output("Use /login from the main loop.".into()),
32 SlashCommand::Logout => CommandResult::Output("Use /logout from the main loop.".into()),
33 SlashCommand::Vim => CommandResult::Output("Use /vim from the main loop.".into()),
34 SlashCommand::Version => CommandResult::Output("Use /version from the main loop.".into()),
35 SlashCommand::Quit => CommandResult::Quit,
36 }
37}