From f9b21d730c3964652eaad4e165592e702644ff87 Mon Sep 17 00:00:00 2001 From: l0ng-ai <24760907+l0ng-ai@users.noreply.github.com> Date: Thu, 1 Oct 2026 05:22:57 +0800 Subject: [PATCH] fix(terminal): offer OpenCode's commands in the composer's menu OpenCode takes slash commands typed at its input, pasted ones included, but the composer's `/` menu listed none for it and its placeholder left out the commands hint. List the ones its own menu opens with, in its words. Amp keeps an empty list: its `/` opens a command palette that a message cannot drive. --- src/terminal/composer.rs | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/terminal/composer.rs b/src/terminal/composer.rs index bf4b7db6..a2f0f0bb 100644 --- a/src/terminal/composer.rs +++ b/src/terminal/composer.rs @@ -525,6 +525,22 @@ fn builtin_commands(agent: CLIAgent) -> &'static [(&'static str, &'static str)] ("/stats", "Show session statistics"), ("/help", "Show help"), ], + CLIAgent::OpenCode => &[ + ("/new", "New session"), + ("/models", "Switch model"), + ("/agents", "Switch agent"), + ("/sessions", "Switch session"), + ("/compact", "Compact session"), + ("/undo", "Undo previous message"), + ("/review", "Review changes"), + ("/init", "Guided AGENTS.md setup"), + ("/share", "Share session"), + ("/status", "View status"), + ("/mcps", "Toggle MCPs"), + ("/help", "Help"), + ], + // Amp has no typed commands: `/` on an empty input opens its command + // palette, which a message cannot drive. _ => &[], } } @@ -2599,7 +2615,12 @@ mod tests { #[test] fn each_agents_builtin_commands_are_distinct_slash_words() { - for agent in [CLIAgent::Claude, CLIAgent::Codex, CLIAgent::Gemini] { + for agent in [ + CLIAgent::Claude, + CLIAgent::Codex, + CLIAgent::Gemini, + CLIAgent::OpenCode, + ] { let names: Vec<&str> = builtin_commands(agent).iter().map(|(n, _)| *n).collect(); for (i, name) in names.iter().enumerate() { assert!(name.starts_with('/') && !name.contains(' '), "{name}");