[PR #9683] feat(tui): add tui.attach config and --attach flag to connect to existing server #13193

Closed
opened 2026-02-16 18:18:03 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/9683

State: closed
Merged: No


Summary

This essentially allows you to be able to have a default server set for the TUI so that you don't manually have to run opencode attach <server> every single time.

It also adds an additional option in the /status that allows you to see what server you are currently attached too.

This is what it looks like when it is connected to its own spawned server:
image

And this is what it looks like when it is connected to a server in the attach json:

image
  • Adds tui.attach config option to automatically connect TUI to an existing OpenCode server
  • Adds --attach <url> CLI flag for ad-hoc server attachment
  • Shows "Attached to {url}" in status dialog when connected to external server
  • Falls back to spawning a new worker if the configured server is unavailable

Usage

Via config (opencode.json):

{
  "tui": {
    "attach": "http://opencode.local"
  }
}

Via CLI flag:

opencode --attach http://localhost:4096

Testing

Tested locally by running a server on opencode.local and verifying the TUI attaches without spawning a new worker.

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/9683 **State:** closed **Merged:** No --- ## Summary This essentially allows you to be able to have a _default_ server set for the TUI so that you don't manually have to run `opencode attach <server>` every single time. It also adds an additional option in the /status that allows you to see what server you are currently attached too. This is what it looks like when it is connected to its own spawned server: <img width="912" height="744" alt="image" src="https://github.com/user-attachments/assets/6f5ca913-48c0-41d6-8442-93a5199dce9a" /> And this is what it looks like when it is connected to a server in the attach json: <img width="912" height="744" alt="image" src="https://github.com/user-attachments/assets/27a77604-f9f0-4cbd-9aef-65e5bc72f149" /> - Adds `tui.attach` config option to automatically connect TUI to an existing OpenCode server - Adds `--attach <url>` CLI flag for ad-hoc server attachment - Shows "Attached to {url}" in status dialog when connected to external server - Falls back to spawning a new worker if the configured server is unavailable ## Usage **Via config (`opencode.json`):** ```json { "tui": { "attach": "http://opencode.local" } } ``` **Via CLI flag:** ```bash opencode --attach http://localhost:4096 ``` ## Testing Tested locally by running a server on `opencode.local` and verifying the TUI attaches without spawning a new worker.
yindo added the pull-request label 2026-02-16 18:18:03 -05:00
yindo closed this issue 2026-02-16 18:18:03 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#13193