快速开始

管理插件

大多数插件工作流只需要几个命令:搜索、安装、重启 Gateway 网关、验证,并在不再需要该插件时卸载。

列出插件

openclaw plugins list
openclaw plugins list --enabled
openclaw plugins list --verbose
openclaw plugins list --json

脚本请使用 --json。当插件包声明了 dependenciesoptionalDependencies 时,它会包含注册表诊断信息和每个插件的静态 dependencyStatus

openclaw plugins list --json \
  | jq '.plugins[] | {id, enabled, format, source, dependencyStatus}'

plugins list 是一次冷库存检查。它显示 OpenClaw 可以从配置、清单和插件注册表中发现的内容;它不能证明已经运行的 Gateway 网关进程导入了该插件运行时。

安装插件

# Search ClawHub for plugin packages.
openclaw plugins search "calendar"

# Bare package specs try ClawHub first, then npm fallback.
openclaw plugins install <package>

# Force one source.
openclaw plugins install clawhub:<package>
openclaw plugins install npm:<package>

# Install a specific version or dist-tag.
openclaw plugins install clawhub:<package>@1.2.3
openclaw plugins install clawhub:<package>@beta
openclaw plugins install npm:@scope/[email protected]
openclaw plugins install npm:@openclaw/codex

# Install from git or a local development checkout.
openclaw plugins install git:github.com/acme/[email protected]
openclaw plugins install ./my-plugin
openclaw plugins install --link ./my-plugin

安装插件代码后,重启为你的渠道提供服务的 Gateway 网关:

openclaw gateway restart
openclaw plugins inspect <plugin-id> --runtime --json

当你需要证明插件注册了工具、钩子、服务、Gateway 网关方法或插件自有 CLI 命令等运行时表面时,请使用 inspect --runtime

更新插件

openclaw plugins update <plugin-id>
openclaw plugins update <npm-package-or-spec>
openclaw plugins update --all

如果插件是从 npm dist-tag(例如 @beta)安装的,后续 update <plugin-id> 调用会复用记录的标签。传入显式 npm spec 会把跟踪的安装切换到该 spec,用于后续更新。

openclaw plugins update @scope/openclaw-plugin@beta
openclaw plugins update @scope/openclaw-plugin

第二条命令会在插件之前固定到精确版本或标签时,将它移回注册表的默认发布线。

openclaw update 在 beta 渠道上运行时,默认线 npm 和 ClawHub 插件记录会先尝试匹配的插件 @beta 版本。如果该 beta 版本不存在,OpenClaw 会回退到记录的默认/latest spec。对于 npm 插件,当 beta 包存在但安装验证失败时,OpenClaw 也会回退。精确版本和显式标签(例如 @rc@beta)会被保留。

卸载插件

openclaw plugins uninstall <plugin-id> --dry-run
openclaw plugins uninstall <plugin-id>
openclaw plugins uninstall <plugin-id> --keep-files
openclaw gateway restart

卸载会移除插件的配置条目、插件索引记录、允许/拒绝列表条目,以及适用时的链接加载路径。托管安装目录会被移除,除非你传入 --keep-files

在 Nix 模式(OPENCLAW_NIX_MODE=1)下,插件安装、更新、卸载、启用和禁用命令会被禁用。请改为在该安装的 Nix 源中管理这些选择;对于 nix-openclaw,请使用智能体优先的快速开始

发布插件

你可以将外部插件发布到 ClawHubnpmjs.com,或两者都发布。

发布到 ClawHub

ClawHub 是 OpenClaw 插件的主要公开发现表面。它会在安装前为用户提供可搜索的元数据、版本历史和注册表扫描结果。

npm i -g clawhub
clawhub login
clawhub package publish your-org/your-plugin --dry-run
clawhub package publish your-org/your-plugin
clawhub package publish your-org/[email protected]

用户通过以下命令从 ClawHub 安装:

openclaw plugins install clawhub:<package>
openclaw plugins install <package>

裸形式仍会先检查 ClawHub。

发布到 npmjs.com

原生 npm 插件必须包含插件清单和 package.json OpenClaw 入口点元数据。

{
  "name": "@acme/openclaw-plugin",
  "version": "1.0.0",
  "type": "module",
  "openclaw": {
    "extensions": ["./dist/index.js"]
  }
}
npm publish --access public

用户通过以下命令安装仅 npm 的插件:

openclaw plugins install npm:@acme/openclaw-plugin
openclaw plugins install npm:@acme/openclaw-plugin@beta
openclaw plugins install npm:@acme/[email protected]

如果同一个包也可在 ClawHub 上获得,npm: 会跳过 ClawHub 查找并强制使用 npm 解析。

来源选择

  • ClawHub:当你需要 OpenClaw 原生发现、扫描摘要、版本和安装提示时使用。
  • npmjs.com:当你已经发布 JavaScript 包,或需要 npm dist-tag/私有注册表工作流时使用。
  • Git:当你想直接从分支、标签或提交安装时使用。
  • 本地路径:当你在同一台机器上开发或测试插件时使用。

相关内容