feat: Add btw alias for side slash command (#23592)

This commit is contained in:
anp-oai authored and GitHub committed 2026-05-20 15:49:35 +00:00
1 parent e9f59e30d9
commit f198ca115b
7 files changed
+279 -16

No files matched your search

+18 -12
View File
@@ -30,8 +30,6 @@ struct PreparedSlashCommandArgs {
}
const SIDE_STARTING_CONTEXT_LABEL: &str = "Side starting...";
const SIDE_REVIEW_UNAVAILABLE_MESSAGE: &str =
"'/side' is unavailable while code review is running.";
const SIDE_SLASH_COMMAND_UNAVAILABLE_HINT: &str =
"Press Ctrl+C to return to the main thread first.";
const GOAL_USAGE: &str = "Usage: /goal <objective>";
@@ -114,9 +112,12 @@ impl ChatWidget {
});
}
fn request_empty_side_conversation(&mut self) {
fn request_empty_side_conversation(&mut self, cmd: SlashCommand) {
let Some(parent_thread_id) = self.thread_id else {
self.add_error_message("'/side' is unavailable before the session starts.".to_string());
let command = cmd.command();
self.add_error_message(format!(
"'/{command}' is unavailable before the session starts."
));
return;
};
@@ -239,8 +240,8 @@ impl ChatWidget {
);
}
}
SlashCommand::Side => {
self.request_empty_side_conversation();
SlashCommand::Side | SlashCommand::Btw => {
self.request_empty_side_conversation(cmd);
}
SlashCommand::Agent | SlashCommand::MultiAgents => {
self.app_event_tx.send(AppEvent::OpenAgentPicker);
@@ -745,11 +746,12 @@ impl ChatWidget {
self.bottom_pane.drain_pending_submission_state();
}
}
SlashCommand::Side if !trimmed.is_empty() => {
SlashCommand::Side | SlashCommand::Btw if !trimmed.is_empty() => {
let Some(parent_thread_id) = self.thread_id else {
self.add_error_message(
"'/side' is unavailable before the session starts.".to_string(),
);
let command = cmd.command();
self.add_error_message(format!(
"'/{command}' is unavailable before the session starts."
));
return;
};
let user_message = self.prepared_inline_user_message(
@@ -957,6 +959,7 @@ impl ChatWidget {
| SlashCommand::Plan
| SlashCommand::Goal
| SlashCommand::Side
| SlashCommand::Btw
| SlashCommand::Keymap
| SlashCommand::Agent
| SlashCommand::MultiAgents
@@ -1017,11 +1020,14 @@ impl ChatWidget {
}
fn ensure_side_command_allowed_outside_review(&mut self, cmd: SlashCommand) -> bool {
if cmd != SlashCommand::Side || !self.review.is_review_mode {
if !matches!(cmd, SlashCommand::Side | SlashCommand::Btw) || !self.review.is_review_mode {
return true;
}
self.add_error_message(SIDE_REVIEW_UNAVAILABLE_MESSAGE.to_string());
let command = cmd.command();
self.add_error_message(format!(
"'/{command}' is unavailable while code review is running."
));
self.bottom_pane.drain_pending_submission_state();
false
}