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