openclaw update
安全更新 OpenClaw,并在 stable/beta/dev 渠道间切换。
如果你通过 npm/pnpm 安装(全局安装,无 git 元数据),更新将通过
Updating 中的包管理器流程完成。
用法
选项
--no-restart:成功更新后跳过重启 Gateway 服务。--channel <stable|beta|dev>:设置更新渠道(git + npm;写入配置)。--tag <dist-tag|version>:仅本次更新覆盖 npm dist-tag 或版本。--json:输出机器可读的UpdateRunResultJSON。--timeout <seconds>:每步超时时间(默认 1200s)。
update status
显示当前更新渠道 + git tag/branch/SHA(源码检出),以及更新可用性。
--json:输出机器可读的状态 JSON。--timeout <seconds>:检查超时(默认 3s)。
update wizard
交互式流程,选择更新渠道并确认更新后是否重启 Gateway(默认重启)。
如果选择 dev 但没有 git 检出,会提示创建。
做了什么
当你显式切换渠道(--channel ...),OpenClaw 也会保持安装方式一致:
dev→ 确保存在 git 检出(默认~/openclaw,可用OPENCLAW_GIT_DIR覆盖), 更新它,并从该检出安装全局 CLI。stable/beta→ 使用对应 dist-tag 从 npm 安装。
Git 检出流程
渠道:stable:检出最新非 beta tag,然后 build + doctor。beta:检出最新-betatag,然后 build + doctor。dev:检出main,然后 fetch + rebase。
- 需要干净的工作树(无未提交更改)。
- 切换到选定渠道(tag 或分支)。
- 拉取上游(仅 dev)。
- 仅 dev:在临时 worktree 中预检 lint + TypeScript build;若 tip 失败,则最多回退 10 个提交找到最新可构建版本。
- 仅 dev:rebase 到所选提交。
- 安装依赖(优先 pnpm;npm 兜底)。
- 构建 + 构建 Control UI。
- 运行
openclaw doctor作为最终的“安全更新”检查。 - 将插件同步到当前渠道(dev 使用内置扩展;stable/beta 使用 npm)并更新 npm 安装的插件。
--update 简写
openclaw --update 会重写为 openclaw update(便于 shell 与启动脚本)。
另请参阅
openclaw doctor(在 git 检出时会建议先运行 update)- Development channels
- Updating
- CLI reference