moltbot update
**作用:**更新 Moltbot 到最新版本;在 stable/beta/dev 频道间安全切换。若通过 npm/pnpm 全局安装(无 git 元数据),更新通过包管理器进行——见 更新。
用法
运行:
moltbot update
moltbot update status
moltbot update wizard
moltbot update --channel beta
moltbot update --channel dev
moltbot update --tag beta
moltbot update --no-restart
moltbot update --json
moltbot --update选项
--no-restart:成功更新后跳过重启网关服务。--channel <stable|beta|dev>:设置更新频道(git + npm;在配置中持久化)。--tag <dist-tag|version>:仅本次更新覆盖 npm dist-tag 或版本。--json:打印机器可读的UpdateRunResultJSON。--timeout <seconds>:每步超时(默认 1200 秒)。
说明:降级需确认,因旧版本可能破坏配置。
update status
显示活跃更新频道 + git tag/branch/SHA(对源码检出),以及更新可用性。
moltbot update status
moltbot update status --json
moltbot update status --timeout 10选项:--json:打印机器可读的状态 JSON;--timeout <seconds>:检查超时(默认 3 秒)。
update wizard
交互式选择更新频道并确认更新后是否重启网关(默认重启)。若在无 git 检出的情况下选择 dev,会提供创建检出的选项。
工作原理
显式切换频道(--channel ...)时,Moltbot 也会保持安装方法一致:
dev→ 确保 git 检出(默认~/moltbot,可用CLAWDBOT_GIT_DIR覆盖),更新并从该检出安装全局 CLI。stable/beta→ 用匹配的 dist-tag 从 npm 安装。
Git 检出流程
频道:
stable:检出最新非 beta tag,然后构建 + doctor。beta:检出最新-betatag,然后构建 + doctor。dev:检出main,然后 fetch + rebase。
高层流程:
- 需要干净工作树(无未提交变更)。
- 切换到所选频道(tag 或分支)。
- fetch upstream(仅 dev)。
- 仅 dev:在临时工作树中预检 lint + TypeScript 构建;若 tip 失败,向上回溯最多 10 次提交以找到最新干净构建。
- Rebase 到所选提交(仅 dev)。
- 安装依赖(优先 pnpm,回退 npm)。
- 构建并构建控制 UI。
- 运行
moltbot doctor作为最终”安全更新”检查。 - 将插件同步到活跃频道(dev 使用 bundled 扩展;stable/beta 使用 npm)并更新 npm 安装的插件。
--update 简写
moltbot --update 改写为 moltbot update(对 shell 与启动器脚本有用)。
另见
最后更新于: