Skip to content

About

Auto-refreshing local dev servers sidebar for OpenCode Desktop: discover ports, open, copy URLs and stop dev servers.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

@carlosstenzel/opencode-local-servers

English · Português (Brasil)

npm

A GUI plugin for OpenCode Desktop (Electron) that adds a Local servers panel to the side region: it lists development servers running on the machine (port, project, process) and opens each one in the browser with a click.

Not to be confused with OpenCode Rune: Rune uses Luau plugins and does not load this package's gui-experimental API.

Features

  • Compact side panel: status indicator, icon, project name (process working directory), port chip and three actions: copy URL, stop and open.
  • Clicking a row (or the → button) opens http://localhost:<port> in the default browser. The copy button uses the app clipboard.
  • Stop button (only for dev servers with a known PID): asks for confirmation and sends SIGTERM to the process. The server is only stopped if it is still listening on exactly the same port as the listed PID.
  • Automatic refresh every 8 seconds, controlled by the Auto switch in the header. It pauses while the window is hidden and reloads once when you return; the Refresh button remains available for manual use.
  • Online dev servers are marked only by a green dot on the row; the rest of the card stays neutral, and system ports are dimmed.
  • By default it shows only dev servers (port 3000–9999 with a resolved process directory); Show all includes the other listening ports.
  • Loading, empty and error states, plus toasts for copy/stop.
  • Entry in the side region's + menu, a button in the panel tab strip and a Servers: N row in the project menu.
  • Pill above the composer with dev servers (click opens the URL).
  • Palette commands: Local servers: open panel, Local servers: refresh and Local servers: stop a server (choose from a list).
  • Theme-aware visuals: colors derive from currentColor via color-mix; the only green highlight is the status dot, blended into the theme.

Preview

Illustrative image with fictional names, ports and commands (no real data):

Local servers side panel

How ports are detected

In the plugin server (RPC local-servers), in this order:

  1. ss -H -ltnp
  2. lsof -nP -iTCP -sTCP:LISTEN -F pcn
  3. netstat -ltnp

For each PID it reads /proc/<pid>/cwd to find the project folder. If none of these tools is available the list is empty (no error).

The plugin never runs arbitrary commands from the GUI. It only opens validated http(s) URLs and, when you confirm Stop, sends SIGTERM to the PID still listening on the displayed port — never to a system PID, to OpenCode itself, or to a process no longer associated with the current list.

Processes owned by other users (e.g. root) may appear without PID/name because ss/lsof do not show that data without privileges. On macOS there is no /proc, so items appear by command name as "other ports".

Requirements

  • Electron-based OpenCode Desktop with @opencode/plugin/gui support.
  • Linux with ss (iproute2), or lsof/netstat available on PATH.

Installation

Install from npm:

opencode plugin add @carlosstenzel/opencode-local-servers

Or directly from GitHub (npm is not required):

opencode plugin add github:carlosstenzel/opencode-local-servers

To check it:

opencode plugin list
opencode plugin check

Or add it manually to ~/.config/opencode/opencode.json:

{
  "plugins": ["@carlosstenzel/opencode-local-servers"]
}

The GUI part is the ./gui-experimental export; the dist/gui-experimental.cjs bundle is generated by prepack.

Development

npm install
npm run typecheck
npm run build

Watch rebuild:

npm run dev

Publishing

npm publish --access public

prepack runs typecheck and build before packaging.

License

MIT — see LICENSE.

About

Auto-refreshing local dev servers sidebar for OpenCode Desktop: discover ports, open, copy URLs and stop dev servers.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages