mirror of
https://github.com/wesammustafa/opencode-primer.git
synced 2026-11-18 18:04:22 +00:00
- Bump every version pin, pricing table, and model ID to the verified 2026-07-05 state (v1.17.13): Claude Fable 5 / Sonnet 5 on Zen, new free tier, deprecation sunset table, v1.17.x changelog section - Cover gaps: OpenCode Go vs Zen billing, Anthropic subscription-login removal (PR #18186), MCP resources, --mini mode, --auto flag, yolo mode - Fix correctness bugs: command-template !`cmd` syntax in docs and .opencode/commands, protect-secrets regex missing 'cat .env', dual plugin exports, quickstart PATH fix, Playwright MCP flags, ctrl+d keybind conflict, agent/command required-field claims - Fix links: cursor.com, windsurf.com, platform.claude.com, code.claude.com, opencode.ai/discord, Vercel Grep announcement - Rebrand: banner (Images/banner.svg), 1280x640 social preview asset, hero redesign with star CTA, ecosystem stats, private vulnerability reporting channel, CI-matching local checks, MD060 lint opt-out
46 lines
1.5 KiB
Markdown
46 lines
1.5 KiB
Markdown
# `.opencode/plugins/`
|
|
|
|
Working examples of OpenCode plugins. Drop-in to any project — pure JS, no npm dependencies.
|
|
|
|
| Plugin | What it does |
|
|
|---|---|
|
|
| [`protect-secrets.js`](protect-secrets.js) | Blocks any tool call (read/write/bash) touching `.env*`, `secrets/`, `credentials*`, SSH keys, `.npmrc`, `.pypirc`. |
|
|
| [`audit-log.js`](audit-log.js) | Appends a one-line JSON record of every completed tool call to `.opencode/audit.jsonl`. |
|
|
|
|
## How they load
|
|
|
|
OpenCode auto-loads every `.js` / `.ts` file in `.opencode/plugins/` at session start. No registration step.
|
|
|
|
```bash
|
|
opencode # loads both plugins automatically
|
|
opencode --pure # skip all plugins for one run
|
|
```
|
|
|
|
## Audit how this plugin folder fires
|
|
|
|
```bash
|
|
tail -f .opencode/audit.jsonl # watch tool calls live
|
|
```
|
|
|
|
Sample line:
|
|
|
|
```json
|
|
{"ts":"2026-06-08T19:30:12.451Z","tool":"edit","arg_keys":["filePath","oldString","newString"],"title":"src/api/auth.ts"}
|
|
```
|
|
|
|
## Disabling temporarily
|
|
|
|
Three options:
|
|
|
|
1. Move the plugin file out of `.opencode/plugins/`.
|
|
2. Comment out **all** exports in the file (every export is loaded, so a leftover one keeps the plugin alive) — or rename the file to a non-`.js`/`.ts` extension.
|
|
3. Gate the body of the plugin on an env var:
|
|
|
|
```js
|
|
if (process.env.OPENCODE_DISABLE_AUDIT_LOG) return {};
|
|
```
|
|
|
|
## Writing your own
|
|
|
|
See [`docs/plugins.md`](../../docs/plugins.md) for the full API, event list, and more patterns (auto-format on save, idle notifications, etc.).
|