关于 plugin-installer
plugin-installer 帮助 OpenCode 用户浏览、评估并安装社区目录中的插件,提供安装与设置信息,也可记录新发现的插件以供后续查阅。
主要功能
- 01浏览插件目录
- 02查看插件设置详情
- 03推荐并配置安装
- 04固定或更新插件版本
- 05记录新发现的插件
适用场景
- 01按需求查找插件
- 02确认 OAuth 和配置步骤
- 03将插件添加到 opencode.json
- 04将插件记录到目录
安装
复制下面的命令,在终端中运行。
npx skills add https:/ / github.com/ igorwarzocha/ opencode-workflows --skill plugin-installer安装后在 Claude Code 中输入/plugin-installer确认已加载。
包含的文件
除 SKILL.md 外,安装时一起下载的参考资料和脚本。
references/plugins/llm-api-key-proxy.mdopencode-dcp.mdopencode-gemini-auth.mdopencode-md-table-formatter.mdopencode-openai-codex-auth.mdopencode-tokenscope.mdopenhax-codex.mdpickle-thinker.mdscripts/list_plugins.py详细介绍
OpenCode 插件安装器
帮助用户发现、评估和安装社区目录中的 OpenCode 插件。
1. 列出可用插件
运行目录脚本查看可用插件:
python3 ~/.config/opencode/skill/plugin-installer/scripts/list_plugins.py
输出内容为 name: description,并附有详细文件的路径。
2. 阅读插件详情
对于相关匹配项,阅读完整的插件文件:
references/plugins/<filename>.md
每个文件都包含:
- 安装配置(可复制粘贴的 JSON)
- 设置步骤
- 功能和注意事项
- 文档链接
3. 推荐并安装
向用户展示:
- 插件的功能
opencode.json的安装代码片段- 任何设置步骤(OAuth、配置文件等)
<question_tool>
批处理: 相关问题有 2 个或以上时,使用 question 工具。单个问题 → 使用纯文本。
语法: header 不超过 12 个字符,label 为 1–5 个词,并在默认选项后添加“(Recommended)”。
适用场景:有多个插件符合需求,或插件设置较为复杂。
</question_tool>
安装格式
将其添加到 opencode.json 的 plugin 数组中:
{
"plugin": [
"package-name@version"
]
}
配置位置:
- 全局:
~/.config/opencode/opencode.json - 项目:
.opencode/opencode.json
固定版本
// Pin version (RECOMMENDED)
"plugin": ["[email protected]"]
// Auto-update on restart
"plugin": ["package@latest"]
// Locked to first install (never updates)
"plugin": ["package"]
遇到问题时强制更新:
rm -rf ~/.cache/opencode/node_modules ~/.cache/opencode/bun.lock
<documenting_new_plugins>
将新插件添加到目录
发现新的 OpenCode 插件时(通过网页搜索、GitHub、npm 或用户提及),必须记录相关信息,以供日后参考。
步骤 1:收集插件信息
创建文档前,请收集以下信息:
| 信息 | 查找位置 |
|---|---|
| 软件包名称 | npm 注册表、GitHub 仓库名称 |
| 描述 | README、package.json 中的描述 |
| 安装语法 | 检查是否为带作用域的名称(@org/pkg)或普通名称(pkg) |
| 版本策略 | 是否建议使用 @latest 或固定版本? |
| 设置步骤 | OAuth 流程、配置文件、环境变量 |
| 提供商/模型要求 | 是否仅适用于特定提供商? |
| 已知问题 | GitHub 问题、兼容性说明 |
步骤 2:创建插件文件
位置: ~/.config/opencode/skill/plugin-installer/references/plugins/<name>.md
命名规则: 使用 npm 软件包名称;对于带作用域的软件包,将 / 替换为 -:
opencode-foo→opencode-foo.md@org/opencode-bar→org-opencode-bar.md
步骤 3:使用此模板
---
name: package-name-or-@scope/package-name
description: One-line description for catalog listing (max ~80 chars)
---
# Plugin Display Name
Brief description of what this plugin does and why someone would use it.
## Installation
\`\`\`jsonc
{
"plugin": ["package-name@latest"]
}
\`\`\`
## Setup
### Prerequisites
- List any requirements (accounts, API keys, other tools)
### Configuration
Step-by-step setup instructions.
## Features
- Key feature 1
- Key feature 2
## Caveats
- Known limitations
- Compatibility notes
## Links
- [GitHub](https://github.com/...)
- [npm](https://www.npmjs.com/package/...)
步骤 4:验证目录
创建文件后,运行列表脚本确认插件已显示:
python3 ~/.config/opencode/skill/plugin-installer/scripts/list_plugins.py
</documenting_new_plugins>
<frontmatter_requirements>
| 字段 | 必填 | 用途 |
|---|---|---|
name | 是 | 与 "plugin": [] 中使用的名称完全一致的软件包名称 |
description | 是 | 在目录列表中显示的简短描述 |
重要: name 必须与 npm 软件包名称完全一致(包括任何作用域)。用户会将其复制到自己的 opencode.json 中。
</frontmatter_requirements>
记录新插件
假设你在 npm 上发现了 @cooldev/opencode-metrics。创建:
文件: ~/.config/opencode/skill/plugin-installer/references/plugins/cooldev-opencode-metrics.md
---
name: @cooldev/opencode-metrics
description: Track AI usage metrics and export to dashboards
---
# OpenCode Metrics
Export your OpenCode usage data to external dashboards...
## Installation
\`\`\`jsonc
{
"plugin": ["@cooldev/opencode-metrics@latest"]
}
\`\`\`
...