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

Open
#142 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
38/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
openapi, rust
Domain
api, backend

Research direction

Start with the oc_command_list and oc_tui_execute_command handlers in server/packages/sandbox-agent/src/opencode_compat.rs. Read the OpenCode OpenAPI spec at resources/agent-schemas/artifacts/openapi/opencode.json and research/specs/command-shell-exec.md, then compare the existing custom-command proxy with the built-in command strings. Done means the command listing mechanism exposes the complete expected set, including built-in TUI commands, without relying on a native proxy.

Written by the indexing model from the issue text.

Description

Problem

The GET /opencode/command endpoint currently only returns custom/user-defined commands (source: command, mcp, skill). Built-in TUI commands like /compact, /clear, /undo, etc. are hardcoded in the OpenCode TUI client and not discoverable via any API endpoint.

This means Gigacode has no way to expose or list the full set of available commands to users or frontends.

Built-in TUI commands that need coverage

These are the commands defined in OpenCode's EventTuiCommandExecute enum, currently only executable via POST /tui/execute-command:

  • session.compact — compact/summarize context
  • session.list — list sessions
  • session.new — create new session
  • session.share — share session
  • session.interrupt — interrupt current generation
  • prompt.clear — clear prompt input
  • prompt.submit — submit prompt
  • agent.cycle — cycle between agents
  • session.page.up / session.page.down — scroll page
  • session.line.up / session.line.down — scroll line
  • session.half.page.up / session.half.page.down — scroll half page
  • session.first / session.last — jump to first/last

Current behavior

  • GET /opencode/command proxies to native OpenCode (returns custom commands like /init, /review, skills) or returns [] if no proxy is configured
  • POST /tui/execute-command accepts built-in command strings but there's no listing endpoint
  • No single endpoint returns the full set of available commands (custom + built-in)

Expected behavior

The GET /opencode/command endpoint (or a supplementary mechanism) should return all available commands, including built-in TUI commands, so that:

  1. Frontends can render a complete command palette
  2. Users can discover all available commands
  3. Gigacode doesn't depend on the native OpenCode proxy just to list built-in commands

Relevant code

  • oc_command_list handler: server/packages/sandbox-agent/src/opencode_compat.rs
  • oc_tui_execute_command handler: server/packages/sandbox-agent/src/opencode_compat.rs
  • OpenCode OpenAPI spec: resources/agent-schemas/artifacts/openapi/opencode.json
  • Command stub spec: research/specs/command-shell-exec.md
Dominant language
TypeScript
Stars
1.6k
Forks
125
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from rivet-dev/sandbox-agent

All issues in rivet-dev/sandbox-agent

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.