Add debug-only slash command for rollout path (#5936)
## Summary - add a debug-only `/rollout` slash command that prints the rollout file path or reports when none is known - surface the new command in the slash command metadata and cover it with unit tests <img width="539" height="99" alt="image" src="https://github.com/user-attachments/assets/688e1334-8a06-4576-abb8-ada33b458661" />
This commit is contained in:
@@ -26,7 +26,7 @@ pub enum SlashCommand {
|
||||
Logout,
|
||||
Quit,
|
||||
Feedback,
|
||||
#[cfg(debug_assertions)]
|
||||
Rollout,
|
||||
TestApproval,
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ impl SlashCommand {
|
||||
SlashCommand::Approvals => "choose what Codex can do without approval",
|
||||
SlashCommand::Mcp => "list configured MCP tools",
|
||||
SlashCommand::Logout => "log out of Codex",
|
||||
#[cfg(debug_assertions)]
|
||||
SlashCommand::Rollout => "print the rollout file path",
|
||||
SlashCommand::TestApproval => "test approval request",
|
||||
}
|
||||
}
|
||||
@@ -76,14 +76,23 @@ impl SlashCommand {
|
||||
| SlashCommand::Mcp
|
||||
| SlashCommand::Feedback
|
||||
| SlashCommand::Quit => true,
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
SlashCommand::Rollout => true,
|
||||
SlashCommand::TestApproval => true,
|
||||
}
|
||||
}
|
||||
|
||||
fn is_visible(self) -> bool {
|
||||
match self {
|
||||
SlashCommand::Rollout | SlashCommand::TestApproval => cfg!(debug_assertions),
|
||||
_ => true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Return all built-in commands in a Vec paired with their command string.
|
||||
pub fn built_in_slash_commands() -> Vec<(&'static str, SlashCommand)> {
|
||||
SlashCommand::iter().map(|c| (c.command(), c)).collect()
|
||||
SlashCommand::iter()
|
||||
.filter(|command| command.is_visible())
|
||||
.map(|c| (c.command(), c))
|
||||
.collect()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user