15a1bbcee0
Repository sits at the OpenCode config root rather than inside skills/ or
plugins/. OpenCode scans exactly those two subdirectories, and a .git
directory inside either one is picked up as a plugin and fails to load:
loading plugin id=.../plugins/.git entrypoint=.../plugins/.git/index
failed to load plugin ... AggregateError: 2 errors building .../plugins/.git/index
The watcher.ignore config option does not help: it only suppresses filesystem
update events, not plugin discovery, and the "-" disable prefix only applies to
plugins listed in opencode.json(c), not auto-discovered ones.
.gitignore admits only skills/ and plugins/ (plus itself). Personal config
(opencode.jsonc, cli.json, service.json) and node_modules stay local.
skills/opencode-plugins V2-only plugin authoring reference and 7 templates,
transcribed from the V2 docs with the URL on every file
plugins/searxng-search searxng_search tool over a self-hosted SearXNG JSON API
123 lines
4.8 KiB
JSON
123 lines
4.8 KiB
JSON
// opencode.jsonc — plugin configuration template
|
|
//
|
|
// Docs: https://opencode.ai/v2/docs/plugins
|
|
// Terminal plugins: https://opencode.ai/v2/docs/cli/plugins
|
|
//
|
|
// https://opencode.ai/v2/docs/config states: "OpenCode supports JSON and
|
|
// JSONC. Use JSONC when you want comments or trailing commas." Use the
|
|
// two-slash form used below. (Hash comments would not parse — that is a
|
|
// property of JSONC, not something the page states.)
|
|
//
|
|
// Keep the $schema line to match the docs. Be aware that
|
|
// https://opencode.ai/config.json does not match the V2 config shape: its
|
|
// Config has additionalProperties: false, has no "plugins" key, types "skills"
|
|
// as an object, and has no "worktree" key. So some editors will flag the array
|
|
// below as invalid. There is no published V2 config schema
|
|
// (https://opencode.ai/v2/config.json returns 404). Never infer V2 field names
|
|
// from that file. Drop the line if you prefer a clean editor.
|
|
|
|
{
|
|
"$schema": "https://opencode.ai/config.json",
|
|
|
|
"plugins": [
|
|
// --- package plugins ---
|
|
"opencode-acme-plugin",
|
|
"opencode-acme-plugin@1.2.0", // exact versions stay pinned
|
|
"@acme/opencode-plugin",
|
|
|
|
// --- local paths ---
|
|
// RELATIVE PATHS RESOLVE FROM THE CONFIG FILE CONTAINING THIS ENTRY,
|
|
// not from the working directory. (The `skills` array is the opposite.)
|
|
"./plugins/local",
|
|
"../shared/plugin.ts",
|
|
"/absolute/path/plugin.ts",
|
|
"file:///home/me/plugins/local",
|
|
|
|
// --- with options --- (read them in setup via ctx.options, untyped)
|
|
{
|
|
"package": "./plugins/company",
|
|
"options": {
|
|
"strict": true
|
|
}
|
|
}
|
|
]
|
|
}
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// Disabling plugins
|
|
//
|
|
// Entries are processed in order. Prefix an ID or wildcard with "-" to disable,
|
|
// "*" for every plugin, ".*" for an ID prefix. A later ID re-enables one.
|
|
//
|
|
// "plugins": ["*", "-opencode.provider.*", "opencode.provider.openai", "-acme.reviewer"]
|
|
//
|
|
// Two built-ins ignore removals so a repository cannot switch off policy
|
|
// enforcement: opencode.config.policy and opencode.provider.opencode.
|
|
//
|
|
// ---------------------------------------------------------------------------
|
|
// CLI-only plugins go in cli.json, not here.
|
|
//
|
|
// A plugin in this file that exports "./tui" is loaded automatically by the CLI.
|
|
// Do NOT also add it to cli.json. The CLI gets the active plugin list from the
|
|
// connected server, so it works when the server is remote.
|
|
//
|
|
// cli.json is for plugins that run locally in the terminal and must stay active
|
|
// against a remote server.
|
|
//
|
|
// ---------------------------------------------------------------------------
|
|
// Precedence
|
|
//
|
|
// Plugin arrays from applicable config files apply from lowest to highest
|
|
// precedence rather than replacing one another:
|
|
//
|
|
// ~/.config/opencode/opencode.jsonc
|
|
// ./opencode.jsonc
|
|
// ./.opencode/opencode.jsonc
|
|
//
|
|
// ---------------------------------------------------------------------------
|
|
// Discovery
|
|
//
|
|
// Direct .ts/.js files and immediate package directories load from every
|
|
// discovered .opencode/plugins/, plus the global config directory:
|
|
//
|
|
// .opencode/plugins/concise.ts
|
|
// .opencode/plugins/acme-package/
|
|
// ~/.config/opencode/plugins/status/index.ts
|
|
// ~/.config/opencode/plugins/status/tui.ts
|
|
//
|
|
// A plugins/ directory beside a project-root opencode.json(c) is NOT
|
|
// discovered automatically — configure it explicitly or move it under .opencode/.
|
|
//
|
|
// ---------------------------------------------------------------------------
|
|
// CLI commands
|
|
//
|
|
// add and remove write to the GLOBAL config (~/.config/opencode/opencode.jsonc).
|
|
//
|
|
// opencode plugin add opencode-acme-plugin@1.2.0
|
|
// opencode plugin add github:acme/opencode-plugin
|
|
// opencode plugin add 'github:acme/plugins#main::path:packages/opencode-plugin'
|
|
// opencode plugin list
|
|
// opencode plugin list --builtin
|
|
// opencode plugin check
|
|
// opencode plugin update
|
|
// opencode plugin update opencode-acme-plugin
|
|
// opencode plugin remove opencode-acme-plugin@1.2.0
|
|
//
|
|
// Pass a configured package target to check or update only that package.
|
|
// plugin add accepts npm names with versions, tags, or ranges, plus
|
|
// npm-compatible Git specs. Tarballs and npm aliases are NOT accepted.
|
|
//
|
|
// plugin check covers server and TUI-only package plugins. Local plugins and
|
|
// exact package revisions are skipped.
|
|
//
|
|
// ---------------------------------------------------------------------------
|
|
// Reload
|
|
//
|
|
// Watched config directories reload automatically. Startup loads cached package
|
|
// plugins immediately, installs missing packages in the background, and checks
|
|
// unpinned npm and Git plugins for updates without changing the installed
|
|
// package. Exact versions and full commit hashes stay pinned.
|
|
//
|
|
// touch .opencode/plugins/concise/index.ts
|
|
// opencode service restart // for unwatched local dependencies
|