0
470
近 7 天 10
29.1
生态多维模型
4 个月前
2026-04-03
快速安装与配置
opencode.json写入当前项目的 opencode.json,只对这个仓库生效。
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-plugin-selector@1.0.1"]
}写入 ~/.config/opencode/opencode.json,对所有项目生效。
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-plugin-selector@1.0.1"]
}若你要在本地改造这个插件,先装到项目里再从本地路径引用。
shell
pnpm add -D opencode-plugin-selectoropencode 启动时会通过内嵌运行时自动加载 npm 依赖并缓存至本地目录,无需手动在全局环境执行安装。
Interactive plugin selector for OpenCode - easily manage your plugins with a beautiful TUI
Features
- 🎨 Beautiful TUI - Interactive multiselect interface powered by @clack/prompts
- ⚡ Fast - Instant loading with known plugins list
- ✓ Status indicators - See which plugins are installed/active at a glance
- 💾 Auto-sync - Automatically updates your
opencode.jsonconfiguration - 🔄 Preserves versions - Maintains version specifiers for existing plugins
- 🌍 Cross-platform - Works on Windows, macOS, and Linux
Installation
From npm (Recommended)
Add to your OpenCode configuration:
{
"plugin": ["opencode-plugin-selector"]
}
OpenCode will automatically install it on startup.
Manual Installation
npm install -g opencode-plugin-selector
Or add to your project:
npm install opencode-plugin-selector
Usage
In OpenCode
Just type the command:
/plugins
This opens an interactive menu where you can:
- ↑↓ - Navigate through plugins
- Space - Toggle plugin selection
- Enter - Confirm selection
- Esc - Cancel
Example
╭─────────────────────────────────────╮
│ OpenCode Plugin Selector │
├─────────────────────────────────────┤
│ ◉ opencode-firecrawl ✓ │
│ Web scraping via Firecrawl │
│ │
│ ◯ oh-my-opencode ✓ │
│ Background agents, LSP tools │
│ │
│ ◯ opencode-wakatime ✗ │
│ Track usage with Wakatime │
╰─────────────────────────────────────╯
[↑↓ Navigate] [Space Toggle] [Enter Confirm]
How It Works
- Plugin Discovery - Loads known plugins from the OpenCode ecosystem
- Status Check - Scans
~/.cache/opencode/node_modules/for installed plugins - Config Sync - Reads
~/.config/opencode/opencode.jsonfor active plugins - Interactive Selection - Presents a multiselect TUI
- Config Update - Saves your selection back to
opencode.json - Restart Required - Restart OpenCode to apply changes
Supported Plugins
The selector includes all known plugins from the OpenCode ecosystem:
- Auth plugins:
opencode-antigravity-auth,opencode-openai-codex-auth,opencode-gemini-auth - Development:
opencode-daytona,opencode-devcontainers,opencode-worktree - Monitoring:
opencode-helicone-session,opencode-wakatime,opencode-sentry-monitor - Utilities:
opencode-firecrawl,opencode-pty,opencode-scheduler - Agents:
oh-my-opencode,opencode-background-agents,opencode-workspace - And many more...
Configuration
The plugin respects your existing opencode.json configuration:
{
"plugin": [
"opencode-plugin-selector",
"opencode-firecrawl@1.2.0",
"oh-my-opencode@latest"
]
}
Version specifiers are preserved when you update your selection.
Development
Prerequisites
- Node.js 18+
- Bun (for running OpenCode)
Setup
git clone https://github.com/yourusername/opencode-plugin-selector.git
cd opencode-plugin-selector
npm install
Build
npm run build
Test Locally
Add to your opencode.json:
{
"plugin": ["./path/to/opencode-plugin-selector"]
}
API Reference
Plugin Hook
The plugin implements the tui.command.execute hook:
{
'tui.command.execute': async (input, output) => {
if (input.command === 'plugins') {
// Show interactive selector
}
}
}
Functions
getAllPlugins()- Get all available plugins with statusgetActivePlugins()- Get currently enabled pluginsupdatePlugins(plugins: string[])- Update configurationgetInstalledPlugins()- Get plugins installed in cache
Troubleshooting
Plugin not loading?
- Check your
opencode.jsonsyntax - Ensure the plugin is in the
pluginarray - Restart OpenCode
Config not updating?
- Check file permissions on
~/.config/opencode/opencode.json - Ensure the file is valid JSON
- Check OpenCode logs for errors
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- OpenCode - The AI coding assistant
- @clack/prompts - Beautiful CLI prompts
- picocolors - Terminal colors
Related
Made with ❤️ for the OpenCode community