opencode-lazy
v0.2.2
Published
Plugin manager for OpenCode. Search, install, and manage plugins without leaving your session.
Maintainers
Readme
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.
How it works
The plugin registers a /plugin slash command and four tools via OpenCode's plugin hooks. When you run a command, the LLM calls the appropriate tool, which hits the npm registry and modifies your opencode.json directly. Config modifications use jsonc-parser to preserve any comments in your config files.
Installation
npm install -g opencode-lazyThen add to the plugin array in your opencode.json:
{
"plugin": ["opencode-lazy"]
}Usage
/plugin search <query> Search npm for OpenCode plugins
/plugin install <name> Add a plugin to your config
/plugin list Show all installed plugins
/plugin remove <name> Remove a plugin from your configSearch for plugins
/plugin search authSearches the npm registry for packages prefixed with opencode- and returns matching results with name, version, and description. Supports scoped packages (@org/opencode-*).
Install a plugin
/plugin install opencode-wakatimeValidates the package on npm, adds it to your opencode.json plugin array. 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 listShows all plugins from both global and project configs.
Remove a plugin
/plugin remove opencode-wakatimeRemoves the plugin from your config. Restart OpenCode to apply.
How it works (technical)
- Registers a
/plugincommand via theconfighook at startup - Registers four tools via the
toolhook (plugin_search,plugin_install,plugin_list,plugin_remove) - Searches npm using the public registry API (
registry.npmjs.org/-/v1/search) - Filters results to packages prefixed with
opencode-or tagged withopencode-plugin - Modifies
opencode.jsonusingjsonc-parserto preserve comments and formatting - Supports both global (
~/.config/opencode/) and project-level configs
Limitations
- Restart required after install/remove — OpenCode doesn't support hot-reloading plugins
- Token cost — Each
/plugincommand 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
