summaryrefslogtreecommitdiffhomepage
path: root/packages/web/src/content/docs/plugins.mdx
diff options
context:
space:
mode:
authorAiden Cline <[email protected]>2026-01-17 13:09:27 -0600
committerAiden Cline <[email protected]>2026-01-17 13:09:30 -0600
commit58f7da6e9f8fb08a9f42a0d2cc34a18b2475ddea (patch)
tree29b8c2ae5cc38d0967987d1bafc4e01334e42a2f /packages/web/src/content/docs/plugins.mdx
parent5a199b04cbbc8a582d8130d4d8e37e052094cc50 (diff)
downloadopencode-58f7da6e9f8fb08a9f42a0d2cc34a18b2475ddea.tar.gz
opencode-58f7da6e9f8fb08a9f42a0d2cc34a18b2475ddea.zip
docs: document the plural forms
Diffstat (limited to 'packages/web/src/content/docs/plugins.mdx')
-rw-r--r--packages/web/src/content/docs/plugins.mdx24
1 files changed, 12 insertions, 12 deletions
diff --git a/packages/web/src/content/docs/plugins.mdx b/packages/web/src/content/docs/plugins.mdx
index bf26744f6..66a1b3cad 100644
--- a/packages/web/src/content/docs/plugins.mdx
+++ b/packages/web/src/content/docs/plugins.mdx
@@ -19,8 +19,8 @@ There are two ways to load plugins.
Place JavaScript or TypeScript files in the plugin directory.
-- `.opencode/plugin/` - Project-level plugins
-- `~/.config/opencode/plugin/` - Global plugins
+- `.opencode/plugins/` - Project-level plugins
+- `~/.config/opencode/plugins/` - Global plugins
Files in these directories are automatically loaded at startup.
@@ -57,8 +57,8 @@ Plugins are loaded from all sources and all hooks run in sequence. The load orde
1. Global config (`~/.config/opencode/opencode.json`)
2. Project config (`opencode.json`)
-3. Global plugin directory (`~/.config/opencode/plugin/`)
-4. Project plugin directory (`.opencode/plugin/`)
+3. Global plugin directory (`~/.config/opencode/plugins/`)
+4. Project plugin directory (`.opencode/plugins/`)
Duplicate npm packages with the same name and version are loaded once. However, a local plugin and an npm plugin with similar names are both loaded separately.
@@ -85,7 +85,7 @@ Local plugins and custom tools can use external npm packages. Add a `package.jso
OpenCode runs `bun install` at startup to install these. Your plugins and tools can then import them.
-```ts title=".opencode/plugin/my-plugin.ts"
+```ts title=".opencode/plugins/my-plugin.ts"
import { escape } from "shescape"
export const MyPlugin = async (ctx) => {
@@ -103,7 +103,7 @@ export const MyPlugin = async (ctx) => {
### Basic structure
-```js title=".opencode/plugin/example.js"
+```js title=".opencode/plugins/example.js"
export const MyPlugin = async ({ project, client, $, directory, worktree }) => {
console.log("Plugin initialized!")
@@ -215,7 +215,7 @@ Here are some examples of plugins you can use to extend opencode.
Send notifications when certain events occur:
-```js title=".opencode/plugin/notification.js"
+```js title=".opencode/plugins/notification.js"
export const NotificationPlugin = async ({ project, client, $, directory, worktree }) => {
return {
event: async ({ event }) => {
@@ -240,7 +240,7 @@ If you’re using the OpenCode desktop app, it can send system notifications aut
Prevent opencode from reading `.env` files:
-```javascript title=".opencode/plugin/env-protection.js"
+```javascript title=".opencode/plugins/env-protection.js"
export const EnvProtection = async ({ project, client, $, directory, worktree }) => {
return {
"tool.execute.before": async (input, output) => {
@@ -258,7 +258,7 @@ export const EnvProtection = async ({ project, client, $, directory, worktree })
Plugins can also add custom tools to opencode:
-```ts title=".opencode/plugin/custom-tools.ts"
+```ts title=".opencode/plugins/custom-tools.ts"
import { type Plugin, tool } from "@opencode-ai/plugin"
export const CustomToolsPlugin: Plugin = async (ctx) => {
@@ -292,7 +292,7 @@ Your custom tools will be available to opencode alongside built-in tools.
Use `client.app.log()` instead of `console.log` for structured logging:
-```ts title=".opencode/plugin/my-plugin.ts"
+```ts title=".opencode/plugins/my-plugin.ts"
export const MyPlugin = async ({ client }) => {
await client.app.log({
service: "my-plugin",
@@ -311,7 +311,7 @@ Levels: `debug`, `info`, `warn`, `error`. See [SDK documentation](https://openco
Customize the context included when a session is compacted:
-```ts title=".opencode/plugin/compaction.ts"
+```ts title=".opencode/plugins/compaction.ts"
import type { Plugin } from "@opencode-ai/plugin"
export const CompactionPlugin: Plugin = async (ctx) => {
@@ -335,7 +335,7 @@ The `experimental.session.compacting` hook fires before the LLM generates a cont
You can also replace the compaction prompt entirely by setting `output.prompt`:
-```ts title=".opencode/plugin/custom-compaction.ts"
+```ts title=".opencode/plugins/custom-compaction.ts"
import type { Plugin } from "@opencode-ai/plugin"
export const CustomCompactionPlugin: Plugin = async (ctx) => {