openclaw update
安全地更新 OpenClaw 并在 stable/beta/dev 通道之间切换。
如果您通过 npm/pnpm(全局安装,无 git 元数据)安装,更新将通过 更新 中的包管理器流程进行。
用法
bash
openclaw update
openclaw update status
openclaw update wizard
openclaw update --channel beta
openclaw update --channel dev
openclaw update --tag beta
openclaw update --no-restart
openclaw update --json
openclaw --update选项
--no-restart:成功更新后跳过重启 Gateway 服务。--channel <stable|beta|dev>:设置更新通道(git + npm;持久化到配置中)。--tag <dist-tag|version>:仅为此次更新覆盖 npm dist-tag 或版本。--json:打印机器可读的UpdateRunResultJSON。--timeout <seconds>:每步超时时间(默认为 1200 秒)。
注意:降级需要确认,因为旧版本可能会破坏配置。
update status
显示活动的更新通道 + git 标签/分支/SHA(对于源代码检出),以及更新可用性。
bash
openclaw update status
openclaw update status --json
openclaw update status --timeout 10选项:
--json:打印机器可读的状态 JSON。--timeout <seconds>:检查超时时间(默认为 3 秒)。
update wizard
交互式流程,用于选择更新通道并确认是否在更新后重启 Gateway (默认为重启)。如果您在没有 git 检出的情况下选择 dev,它会 提供创建一个。
它的作用
当您明确切换通道时(--channel ...),OpenClaw 还会保持 安装方法对齐:
dev→ 确保 git 检出(默认:~/openclaw,使用OPENCLAW_GIT_DIR覆盖), 更新它,并从该检出安装全局 CLI。stable/beta→ 使用匹配的 dist-tag 从 npm 安装。
Git 检出流程
通道:
stable:检出最新的非 beta 标签,然后构建 + doctor。beta:检出最新的-beta标签,然后构建 + doctor。dev:检出main,然后 fetch + rebase。
高层次流程:
- 需要干净的工作树(没有未提交的更改)。
- 切换到选定的通道(标签或分支)。
- 获取上游(仅 dev)。
- 仅 dev:在临时工作树中进行预检查 lint + TypeScript 构建;如果顶端失败,回溯最多 10 个提交以找到最新的干净构建。
- 变基到选定的提交(仅 dev)。
- 安装依赖(首选 pnpm;回退到 npm)。
- 构建 + 构建 Control UI。
- 运行
openclaw doctor作为最终的"安全更新"检查。 - 将插件同步到活动通道(dev 使用捆绑扩展;stable/beta 使用 npm)并更新 npm 安装的插件。
--update 简写
openclaw --update 重写为 openclaw update(对 shell 和启动器脚本很有用)。