tui: add feature-gated /plan slash command to switch to Plan mode (#10103)

## Summary
Adds a simple `/plan` slash command in the TUI that switches the active
collaboration mode to Plan mode. The command is only available when the
`collaboration_modes` feature is enabled.

## Changes
- Add `plan_mask` helper in `codex-rs/tui/src/collaboration_modes.rs`
- Add `SlashCommand::Plan` metadata in
`codex-rs/tui/src/slash_command.rs`
- Implement and hard-gate `/plan` dispatch in
`codex-rs/tui/src/chatwidget.rs`
- Hide `/plan` when collaboration modes are disabled in
`codex-rs/tui/src/bottom_pane/slash_commands.rs`
- Update command popup tests in
`codex-rs/tui/src/bottom_pane/command_popup.rs`
- Add a focused unit test for `/plan` in
`codex-rs/tui/src/chatwidget/tests.rs`

## Behavior notes
- `/plan` is now a no-op if `Feature::CollaborationModes` is disabled.
- When enabled, `/plan` switches directly to Plan mode without opening
the picker.

## Codex author
`codex resume 019c05da-d7c3-7322-ae2c-3ca38d0ef702`
This commit is contained in:
Charley Cunningham authored and GitHub committed 2026-01-29 16:40:43 -08:00
1 parent 81a17bb2c1
commit 11958221a3
6 files changed
+72 -9

No files matched your search

+24 -7
View File
@@ -2668,10 +2668,29 @@ impl ChatWidget {
SlashCommand::Personality => {
self.open_personality_popup();
}
SlashCommand::Collab => {
if self.collaboration_modes_enabled() {
self.open_collaboration_modes_popup();
SlashCommand::Plan => {
if !self.collaboration_modes_enabled() {
self.add_info_message(
"Collaboration modes are disabled.".to_string(),
Some("Enable collaboration modes to use /plan.".to_string()),
);
return;
}
if let Some(mask) = collaboration_modes::plan_mask(self.models_manager.as_ref()) {
self.set_collaboration_mask(mask);
} else {
self.add_info_message("Plan mode unavailable right now.".to_string(), None);
}
}
SlashCommand::Collab => {
if !self.collaboration_modes_enabled() {
self.add_info_message(
"Collaboration modes are disabled.".to_string(),
Some("Enable collaboration modes to use /collab.".to_string()),
);
return;
}
self.open_collaboration_modes_popup();
}
SlashCommand::Agent => {
self.app_event_tx.send(AppEvent::OpenAgentPicker);
@@ -2844,11 +2863,9 @@ impl ChatWidget {
let trimmed = args.trim();
match cmd {
SlashCommand::Collab => {
SlashCommand::Collab | SlashCommand::Plan => {
let _ = trimmed;
if self.collaboration_modes_enabled() {
self.open_collaboration_modes_popup();
}
self.dispatch_command(cmd);
}
SlashCommand::Review if !trimmed.is_empty() => {
self.submit_op(Op::Review {