feat: /prompts slash command (#1937)

- Shows several example prompts which include @-mentions 

------
https://chatgpt.com/codex/tasks/task_i_6894779ba8cc832ca0c871d17ee06aae
This commit is contained in:
ae
2025-08-07 03:55:59 -07:00
committed by GitHub
parent 1e4bf81653
commit 7c20160676
4 changed files with 33 additions and 0 deletions

View File

@@ -110,6 +110,9 @@ pub(crate) enum HistoryCell {
/// Output from the `/status` command.
StatusOutput { view: TextBlock },
/// Output from the `/prompts` command.
PromptsOutput { view: TextBlock },
/// Error event from the backend.
ErrorEvent { view: TextBlock },
@@ -142,6 +145,7 @@ impl HistoryCell {
| HistoryCell::BackgroundEvent { view }
| HistoryCell::GitDiffOutput { view }
| HistoryCell::StatusOutput { view }
| HistoryCell::PromptsOutput { view }
| HistoryCell::ErrorEvent { view }
| HistoryCell::SessionInfo { view }
| HistoryCell::CompletedExecCommand { view }
@@ -201,6 +205,7 @@ impl HistoryCell {
Line::from(format!(" /init - {}", SlashCommand::Init.description()).dim()),
Line::from(format!(" /status - {}", SlashCommand::Status.description()).dim()),
Line::from(format!(" /diff - {}", SlashCommand::Diff.description()).dim()),
Line::from(format!(" /prompts - {}", SlashCommand::Prompts.description()).dim()),
Line::from("".dim()),
];
HistoryCell::WelcomeMessage {
@@ -525,6 +530,23 @@ impl HistoryCell {
}
}
pub(crate) fn new_prompts_output() -> Self {
let lines: Vec<Line<'static>> = vec![
Line::from("/prompts".magenta()),
Line::from(""),
Line::from(" 1. Explain this codebase"),
Line::from(" 2. Summarize recent commits"),
Line::from(" 3. Implement {feature}"),
Line::from(" 4. Find and fix a bug in @filename"),
Line::from(" 5. Write tests for @filename"),
Line::from(" 6. Improve documentation in @filename"),
Line::from(""),
];
HistoryCell::PromptsOutput {
view: TextBlock::new(lines),
}
}
pub(crate) fn new_error_event(message: String) -> Self {
let lines: Vec<Line<'static>> =
vec![vec!["🖐 ".red().bold(), message.into()].into(), "".into()];