跳到主要内容

clawdbot update

安全地更新 Clawdbot,并在稳定版 (stable)、测试版 (beta) 和开发版 (dev) 频道之间切换。

如果您是通过 npm/pnpm 安装的(全局安装,无 git 元数据),请参考 更新 中的包管理器流程进行更新。

用法

clawdbot update
clawdbot update status
clawdbot update wizard
clawdbot update --channel beta
clawdbot update --channel dev
clawdbot update --tag beta
clawdbot update --no-restart
clawdbot update --json
clawdbot --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 标签/分支/SHA(针对源码检出),以及更新可用性。

clawdbot update status
clawdbot update status --json
clawdbot update status --timeout 10

选项:

  • --json:打印机器可读的状态 JSON。
  • --timeout <seconds>:检查超时时间(默认为 3 秒)。

update wizard

交互式流程,用于选择更新频道并确认更新后是否重启网关(默认为重启)。如果您在没有 git 检出的情况下选择 dev,它会提示创建一个。

工作原理

当您显式切换频道(--channel ...)时,Clawdbot 还会保持安装方式的一致性:

  • dev → 确保存在 git 检出(默认:~/clawdbot,可通过 CLAWDBOT_GIT_DIR 覆盖),更新该检出,并从该检出安装全局 CLI。
  • stable/beta → 使用匹配的 dist-tag 从 npm 安装。

Git 检出流程

频道:

  • stable:检出最新的非测试版标签,然后进行构建 (build) + 诊断 (doctor)。
  • beta:检出最新的 -beta 标签,然后进行构建 + 诊断。
  • dev:检出 main 分支,然后进行获取 (fetch) + 变基 (rebase)。

高级步骤:

  1. 要求工作区整洁(无未提交的更改)。
  2. 切换到所选频道(标签或分支)。
  3. 获取上游代码(仅限 dev)。
  4. 仅限 dev:在临时工作区中进行预检 lint + TypeScript 构建;如果最新提交构建失败,则向后回溯最多 10 个提交,以寻找最新的可整洁构建的版本。
  5. 变基到所选提交(仅限 dev)。
  6. 安装依赖(优先使用 pnpm;npm 作为回退)。
  7. 构建核心代码 + 构建控制台 UI。
  8. 运行 clawdbot doctor 作为最后的“安全更新”检查。
  9. 将插件同步到活动频道(dev 使用内置扩展;stable/beta 使用 npm)并更新从 npm 安装的插件。

--update 简写

clawdbot --update 会重写为 clawdbot update(对 shell 和启动脚本很有用)。

另请参见