opencode-lazy

Plugin manager for OpenCode. Search, install, and manage plugins without leaving your session.
Inspired by lazy.nvim — you should never have to leave your editor to manage plugins.
Installation
npm install -g opencode-lazy
Then add to the plugin array in your opencode.json:
{
"plugin": ["opencode-lazy"]
}
Or use a local path for development:
{
"plugin": ["/path/to/opencode-lazy"]
}
Usage
The plugin registers a /plugin slash command with four operations:
/plugin search <query> Search npm for OpenCode plugins
/plugin install <name> Add a plugin to your config and install it
/plugin list Show all installed plugins
/plugin remove <name> Remove a plugin from your config
Search for plugins
/plugin search auth
Searches the npm registry for packages prefixed with opencode- and returns matching results with name, version, and description.
Install a plugin
/plugin install opencode-wakatime
Validates the package on npm, adds it to your opencode.json plugin array, and installs it. Restart OpenCode to activate.
By default, plugins are added to the global config (~/.config/opencode/opencode.json). The LLM can also install to the project config if you ask.
List installed plugins
/plugin list
Shows all plugins from both global and project configs.
Remove a plugin
/plugin remove opencode-wakatime
Removes the plugin from your config. Restart OpenCode to apply.
How it works
The plugin uses two OpenCode hooks:
config hook — Injects the /plugin command definition at startup
tool hook — Registers four tools (plugin_search, plugin_install, plugin_list, plugin_remove) that the LLM calls when you use the /plugin command
Config modifications use jsonc-parser to preserve any comments in your opencode.json files.
Limitations
- Restart required after install/remove — OpenCode doesn't support hot-reloading plugins
- Token cost — Each
/plugin command uses a small number of tokens since the LLM is in the loop
- No version pinning — Always installs the latest version from npm
Disclaimer
This project is not built by the OpenCode team and is not affiliated with OpenCode in any way.
License
MIT