Skip to content

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

@NathanFlurry

Description

@NathanFlurry

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions