opencode-session-tab-delete
v0.1.2
Published
OpenCode 2 TUI plugin that adds Delete to session tab context menus.
Maintainers
Readme
opencode-session-tab-delete
OpenCode 2 TUI plugin that adds a Delete action next to the native session-tab context menu.
Install
Install from npm:
opencode2 plugin add opencode-session-tab-deleteFor local development, expose the plugin through the global plugin discovery directory.
OpenCode scans ~/.config/opencode/plugins/<name>/ for an index.{ts,tsx,js,...} entry plus an
optional sibling tui.{ts,tsx,...}; the CLI auto-loads the TUI entry and rewrites imports of
@opentui/*, solid-js, and @opencode-ai/plugin/tui to its own bundled runtime.
Do not put a local path in the plugins array of ~/.config/opencode/cli.json: that loader
only supports npm/Git package specifiers — a file:// entry pointing at a file is skipped
silently, and one pointing at a directory is resolved as a package (importing <dir>/tui
literally, which fails with ENOENT).
Link the entry directory (a junction on Windows, a symlink elsewhere) so sources stay editable in place:
# Windows (PowerShell)
New-Item -ItemType Junction `
-Path "$env:USERPROFILE\.config\opencode\plugins\session-tab-delete" `
-Target "C:\path\to\opencode-session-tab-delete\src"# macOS / Linux
ln -s /path/to/opencode-session-tab-delete/src ~/.config/opencode/plugins/session-tab-deleteRestart opencode2 after changing discovery content.
Usage
- Right-click a session tab and click the plugin-provided
Deleterow. - Confirm in the standard OpenCode dialog.
The plugin calls the normal session.remove API. OpenCode's session.deleted event removes the tab and returns to the next session or home. Failed requests are shown as error toasts.
Compatibility
OpenCode 2 currently has no public TUI extension point for adding an item inside its native tab menu. The plugin therefore observes the existing menu's geometry and places one plugin-owned row directly below it. The native New tab, Rename, and Close items remain unchanged.
The right-click bridge is isolated in src/tui.tsx. It uses the beta OpenTUI mouse-dispatch method so it can capture the tab before the native handler stops propagation. If a future OpenTUI release changes that internal method, the right-click row may need a compatibility update.
Development
npm install
npm run typecheck
npm test