more-tui-plugins
Sebastian Herrlinger 2026-02-13 23:45:50 +01:00
parent 059a6b3f8b
commit 8da0e61d38
1 changed files with 27 additions and 0 deletions

View File

@ -162,6 +162,14 @@ If you provided options in config, they will be available as the second argument
Plugins can also export a `{ server, tui }` object. The server loader executes `server` (same as a normal plugin function). The TUI loader executes `tui` **only** when a TUI is running.
To load a TUI plugin, add it to `tui.json`:
```json title="tui.json"
{
"plugin": ["my-tui-plugin"]
}
```
```ts title=".opencode/plugins/example.ts"
export const MyPlugin = {
server: async (ctx, options) => {
@ -183,6 +191,25 @@ TUI input includes:
- `url`: server URL
- `directory`: optional working directory
Example: hook into the renderer and react to terminal resize events.
```ts title=".opencode/plugins/resize-listener.ts"
import type { TuiPlugin } from "@opencode-ai/plugin"
export const MyPlugin: { tui: TuiPlugin } = {
tui: async (ctx) => {
const onResize = (width: number, height: number) => {
console.log("terminal resized", { width, height })
}
ctx.renderer.on("resize", onResize)
// later, if needed:
// ctx.renderer.off("resize", onResize)
},
}
```
---
### Themes from plugins