Skip to content

feat(opencode): expose built-in TUI commands via GET /opencode/command#301

Open
talhaimtiaz09 wants to merge 1 commit into
rivet-dev:mainfrom
talhaimtiaz09:feat/opencode-builtin-commands
Open

feat(opencode): expose built-in TUI commands via GET /opencode/command#301
talhaimtiaz09 wants to merge 1 commit into
rivet-dev:mainfrom
talhaimtiaz09:feat/opencode-builtin-commands

Conversation

@talhaimtiaz09

Copy link
Copy Markdown

Summary

Closes #142.

GET /opencode/command previously 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 EventTuiCommandExecute list.

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

  • Fix is in the mounted handler oc_command_list (server/packages/opencode-adapter/src/lib.rs); the native-proxy path is unchanged.
  • When a native OpenCode proxy is configured, its response is still returned as-is. Merging the built-ins into the proxied custom-command list is a natural follow-up if you want /command to be exhaustive in that mode too; I kept this PR scoped to the no-proxy case (issue goal chore(site): added site #3).
  • I have not run a local cargo build 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.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: expose all OpenCode built-in commands via /opencode/command endpoint

2 participants