disallow some slash commands while a task is running (#2792)

/new, /init, /models, /approvals, etc. don't work correctly during a
turn. disable them.
This commit is contained in:
Jeremy Rose
2025-08-28 10:15:59 -07:00
committed by GitHub
parent 4e9ad23864
commit e5611aab07
2 changed files with 27 additions and 1 deletions

View File

@@ -52,6 +52,24 @@ impl SlashCommand {
pub fn command(self) -> &'static str {
self.into()
}
/// Whether this command can be run while a task is in progress.
pub fn available_during_task(self) -> bool {
match self {
SlashCommand::New
| SlashCommand::Init
| SlashCommand::Compact
| SlashCommand::Model
| SlashCommand::Approvals
| SlashCommand::Logout => false,
SlashCommand::Diff
| SlashCommand::Mention
| SlashCommand::Status
| SlashCommand::Mcp
| SlashCommand::Quit
| SlashCommand::TestApproval => true,
}
}
}
/// Return all built-in commands in a Vec paired with their command string.