mirror of
https://github.com/openai/codex.git
synced 2026-09-14 11:57:03 +00:00
tui: restore multi-agents slash alias
Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
@@ -19,7 +19,7 @@ use crate::bottom_pane::bottom_pane_view::BottomPaneView;
|
||||
use crate::bottom_pane::popup_consts::MAX_POPUP_ROWS;
|
||||
use crate::bottom_pane::selection_popup_common::render_menu_surface;
|
||||
use crate::key_hint;
|
||||
use crate::slash_command::built_in_slash_commands;
|
||||
use crate::slash_command::visible_built_in_slash_commands;
|
||||
use crate::wrapping::RtOptions;
|
||||
use crate::wrapping::word_wrap_lines;
|
||||
|
||||
@@ -103,7 +103,7 @@ impl SlashHelpView {
|
||||
},
|
||||
];
|
||||
|
||||
for (_, cmd) in built_in_slash_commands() {
|
||||
for cmd in visible_built_in_slash_commands() {
|
||||
rows.push(HelpRow {
|
||||
plain_text: format!("/{}", cmd.command()),
|
||||
line: Line::from(format!("/{}", cmd.command()).cyan().bold()),
|
||||
|
||||
@@ -101,6 +101,19 @@ mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn multi_agents_alias_still_resolves_for_dispatch() {
|
||||
assert_eq!(
|
||||
find_builtin_command("multi-agents", all_enabled_flags()),
|
||||
Some(SlashCommand::MultiAgents)
|
||||
);
|
||||
assert_eq!(
|
||||
find_builtin_command("subagents", all_enabled_flags()),
|
||||
Some(SlashCommand::MultiAgents)
|
||||
);
|
||||
assert_eq!(SlashCommand::MultiAgents.command(), "subagents");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn fast_command_is_hidden_when_disabled() {
|
||||
let mut flags = all_enabled_flags();
|
||||
|
||||
@@ -56,7 +56,7 @@ pub enum SlashCommand {
|
||||
Realtime,
|
||||
Settings,
|
||||
TestApproval,
|
||||
#[strum(serialize = "subagents")]
|
||||
#[strum(serialize = "subagents", serialize = "multi-agents")]
|
||||
MultiAgents,
|
||||
// Debugging commands.
|
||||
#[strum(serialize = "debug-m-drop")]
|
||||
@@ -119,7 +119,59 @@ impl SlashCommand {
|
||||
/// Command string without the leading '/'. Provided for compatibility with
|
||||
/// existing code that expects a method named `command()`.
|
||||
pub fn command(self) -> &'static str {
|
||||
self.into()
|
||||
match self {
|
||||
SlashCommand::MultiAgents => "subagents",
|
||||
_ => self.into(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Additional accepted built-in names besides `command()`.
|
||||
pub fn command_aliases(self) -> &'static [&'static str] {
|
||||
match self {
|
||||
SlashCommand::Help
|
||||
| SlashCommand::Model
|
||||
| SlashCommand::Fast
|
||||
| SlashCommand::Approvals
|
||||
| SlashCommand::Permissions
|
||||
| SlashCommand::ElevateSandbox
|
||||
| SlashCommand::SandboxReadRoot
|
||||
| SlashCommand::Experimental
|
||||
| SlashCommand::Skills
|
||||
| SlashCommand::Review
|
||||
| SlashCommand::Rename
|
||||
| SlashCommand::New
|
||||
| SlashCommand::Resume
|
||||
| SlashCommand::Fork
|
||||
| SlashCommand::Init
|
||||
| SlashCommand::Compact
|
||||
| SlashCommand::Plan
|
||||
| SlashCommand::Collab
|
||||
| SlashCommand::Agent
|
||||
| SlashCommand::Diff
|
||||
| SlashCommand::Copy
|
||||
| SlashCommand::Mention
|
||||
| SlashCommand::Status
|
||||
| SlashCommand::DebugConfig
|
||||
| SlashCommand::Statusline
|
||||
| SlashCommand::Theme
|
||||
| SlashCommand::Mcp
|
||||
| SlashCommand::Apps
|
||||
| SlashCommand::Logout
|
||||
| SlashCommand::Quit
|
||||
| SlashCommand::Exit
|
||||
| SlashCommand::Feedback
|
||||
| SlashCommand::Rollout
|
||||
| SlashCommand::Ps
|
||||
| SlashCommand::Stop
|
||||
| SlashCommand::Clear
|
||||
| SlashCommand::Personality
|
||||
| SlashCommand::Realtime
|
||||
| SlashCommand::Settings
|
||||
| SlashCommand::TestApproval
|
||||
| SlashCommand::MemoryDrop
|
||||
| SlashCommand::MemoryUpdate => &[],
|
||||
SlashCommand::MultiAgents => &["multi-agents"],
|
||||
}
|
||||
}
|
||||
|
||||
/// Human-facing forms accepted by the TUI.
|
||||
@@ -313,7 +365,22 @@ pub enum SlashCommandExecutionKind {
|
||||
pub fn built_in_slash_commands() -> Vec<(&'static str, SlashCommand)> {
|
||||
SlashCommand::iter()
|
||||
.filter(|command| command.is_visible())
|
||||
.map(|c| (c.command(), c))
|
||||
.flat_map(|command| {
|
||||
std::iter::once((command.command(), command)).chain(
|
||||
command
|
||||
.command_aliases()
|
||||
.iter()
|
||||
.copied()
|
||||
.map(move |alias| (alias, command)),
|
||||
)
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// Return all visible built-in commands once each, in presentation order.
|
||||
pub fn visible_built_in_slash_commands() -> Vec<SlashCommand> {
|
||||
SlashCommand::iter()
|
||||
.filter(|command| command.is_visible())
|
||||
.collect()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user