Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion packages/web/src/content/docs/plugins.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,22 @@ export const MyPlugin = async (ctx) => {

```js title=".opencode/plugins/example.js"
export const MyPlugin = async ({ project, client, $, directory, worktree }) => {
console.log("Plugin initialized!")
await client.app.log({
body: {
service: "my-plugin",
level: "info",
message: "Plugin initialized",
},
})

return {
// Hook implementations go here
}
}
```

For TUI plugins, avoid `console.log()` and `console.error()`. They write to the same terminal session as the client UI and can disrupt the input area. Prefer `client.app.log()` instead.

The plugin function receives:

- `project`: The current project information.
Expand Down
Loading