feat(opencode): expose built-in TUI commands via GET /opencode/command#301
Open
talhaimtiaz09 wants to merge 1 commit into
Open
feat(opencode): expose built-in TUI commands via GET /opencode/command#301talhaimtiaz09 wants to merge 1 commit into
talhaimtiaz09 wants to merge 1 commit into
Conversation
GET /opencode/command previously returned [] when no native OpenCode proxy was configured (e.g. Claude Code mode), so the built-in TUI commands (compact, clear, scroll, etc.) were undiscoverable via the API. Return the built-in command set in that fallback path so frontends can render a complete command palette without depending on a native OpenCode server. Built-ins carry a type: "builtin" discriminator since they are TUI actions rather than prompt-template commands. Closes rivet-dev#142
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #142.
GET /opencode/commandpreviously returned[]when no native OpenCode proxy is configured (e.g. Claude Code mode), so the built-in TUI commands (session.compact,prompt.clear, scroll actions, etc.) were undiscoverable via the API. Frontends/Gigacode had no way to list the full command set without a native OpenCode server.This change returns the built-in command set in that fallback path, covering every command from the issue's
EventTuiCommandExecutelist.Shape
Built-in TUI commands are actions, not prompt-template commands, so they don't fit the custom-command shape cleanly. They're returned as:
{ "name": "session.compact", "description": "Compact/summarize context", "type": "builtin" }The
type: "builtin"discriminator lets a frontend distinguish them from custom/user commands while still rendering them in a palette. Happy to adjust the shape if you'd prefer something else.Scope / notes
oc_command_list(server/packages/opencode-adapter/src/lib.rs); the native-proxy path is unchanged./commandto be exhaustive in that mode too; I kept this PR scoped to the no-proxy case (issue goal chore(site): added site #3).cargobuild for this change; it's a small, self-contained addition using already-imported types. Please flag if CI surfaces anything and I'll fix it.