更新
CoderClaw 发展迅速(尚未到”1.0”)。将更新视为发布基础设施:更新 → 运行检查 → 重启(或使用会重启的 coderclaw update)→ 验证。
推荐:重新运行网站安装程序(原地升级)
Section titled “推荐:重新运行网站安装程序(原地升级)”首选的更新路径是重新运行网站上的安装程序。它会检测现有安装、原地升级,并在需要时运行 coderclaw doctor。
curl -fsSL https://coderclaw.ai/install.sh | bash说明:
- 如果你不想再次运行新手引导向导,添加
--no-onboard。 - 对于源码安装,使用:
安装程序仅在仓库干净时才会执行
Terminal window curl -fsSL https://coderclaw.ai/install.sh | bash -s -- --install-method git --no-onboardgit pull --rebase。 - 对于全局安装,脚本底层使用
npm install -g coderclaw@latest。 - 旧版说明:
coderclaw仍可作为兼容性垫片使用。
- 了解你的安装方式:全局(npm/pnpm)还是源码(git clone)。
- 了解你的 Gateway 网关运行方式:前台终端还是受管理服务(launchd/systemd)。
- 快照你的定制内容:
- 配置:
~/.coderclaw/coderclaw.json - 凭证:
~/.coderclaw/credentials/ - 工作区:
~/.coderclaw/workspace
- 配置:
更新(全局安装)
Section titled “更新(全局安装)”全局安装(选择一个):
npm i -g coderclaw@latestpnpm add -g coderclaw@latest我们不推荐将 Bun 用于 Gateway 网关运行时(WhatsApp/Telegram 有 bug)。
切换更新渠道(git + npm 安装):
coderclaw update --channel betacoderclaw update --channel devcoderclaw update --channel stable使用 --tag <dist-tag|version> 进行一次性安装指定标签/版本。
渠道语义和发布说明参见开发渠道。
注意:在 npm 安装上,Gateway 网关在启动时会记录更新提示(检查当前渠道标签)。通过 update.checkOnStart: false 禁用。
然后:
coderclaw doctorcoderclaw gateway restartcoderclaw health说明:
- 如果你的 Gateway 网关作为服务运行,
coderclaw gateway restart优于杀死 PID。 - 如果你固定在特定版本,参见下面的”回滚/固定”。
更新(coderclaw update)
Section titled “更新(coderclaw update)”对于源码安装(git checkout),首选:
coderclaw update它运行一个相对安全的更新流程:
- 需要干净的工作树。
- 切换到选定的渠道(标签或分支)。
- 获取并 rebase 到配置的上游(dev 渠道)。
- 安装依赖、构建、构建控制 UI,并运行
coderclaw doctor。 - 默认重启 Gateway 网关(使用
--no-restart跳过)。
如果你通过 npm/pnpm 安装(没有 git 元数据),coderclaw update 将尝试通过你的包管理器更新。如果无法检测到安装,请改用”更新(全局安装)“。
更新(控制 UI / RPC)
Section titled “更新(控制 UI / RPC)”控制 UI 有更新并重启(RPC:update.run)。它:
- 运行与
coderclaw update相同的源码更新流程(仅限 git checkout)。 - 写入带有结构化报告(stdout/stderr 尾部)的重启哨兵。
- 重启 Gateway 网关并向最后活跃的会话 ping 报告。
如果 rebase 失败,Gateway 网关会中止并在不应用更新的情况下重启。
更新(从源码)
Section titled “更新(从源码)”从仓库 checkout:
首选:
coderclaw update手动(大致等效):
git pullpnpm installpnpm buildpnpm ui:build # 首次运行时自动安装 UI 依赖coderclaw doctorcoderclaw health说明:
- 当你运行打包的
coderclaw二进制文件(coderclaw.mjs)或使用 Node 运行dist/时,pnpm build很重要。 - 如果你从仓库 checkout 运行而没有全局安装,CLI 命令使用
pnpm coderclaw ...。 - 如果你直接从 TypeScript 运行(
pnpm coderclaw ...),通常不需要重新构建,但配置迁移仍然适用 → 运行 doctor。 - 在全局和 git 安装之间切换很容易:安装另一种方式,然后运行
coderclaw doctor以便将 Gateway 网关服务入口点重写为当前安装。
始终运行:coderclaw doctor
Section titled “始终运行:coderclaw doctor”Doctor 是”安全更新”命令。它故意很无聊:修复 + 迁移 + 警告。
注意:如果你是源码安装(git checkout),coderclaw doctor 会提供先运行 coderclaw update。
它通常做的事情:
- 迁移已弃用的配置键/旧版配置文件位置。
- 审计私信策略并对有风险的”开放”设置发出警告。
- 检查 Gateway 网关健康状况,可以提供重启。
- 检测并将旧版 Gateway 网关服务(launchd/systemd;旧版 schtasks)迁移到当前 CoderClaw 服务。
- 在 Linux 上,确保 systemd 用户 lingering(这样 Gateway 网关在登出后仍能存活)。
详情:Doctor
启动/停止/重启 Gateway 网关
Section titled “启动/停止/重启 Gateway 网关”CLI(无论操作系统都适用):
coderclaw gateway statuscoderclaw gateway stopcoderclaw gateway restartcoderclaw gateway --port 18789coderclaw logs --follow如果你使用受管理服务:
- macOS launchd(应用捆绑的 LaunchAgent):
launchctl kickstart -k gui/$UID/bot.molt.gateway(使用bot.molt.<profile>;旧版com.coderclaw.*仍然有效) - Linux systemd 用户服务:
systemctl --user restart coderclaw-gateway[-<profile>].service - Windows(WSL2):
systemctl --user restart coderclaw-gateway[-<profile>].servicelaunchctl/systemctl仅在服务已安装时有效;否则运行coderclaw gateway install。
运行手册 + 确切的服务标签:Gateway 网关运行手册
回滚/固定(当出问题时)
Section titled “回滚/固定(当出问题时)”固定(全局安装)
Section titled “固定(全局安装)”安装已知良好的版本(将 <version> 替换为最后可用的版本):
npm i -g coderclaw@<version>pnpm add -g coderclaw@<version>提示:要查看当前发布的版本,运行 npm view coderclaw version。
然后重启 + 重新运行 doctor:
coderclaw doctorcoderclaw gateway restart按日期固定(源码)
Section titled “按日期固定(源码)”选择某个日期的提交(示例:“2026-01-01 时 main 的状态”):
git fetch origingit checkout "$(git rev-list -n 1 --before=\"2026-01-01\" origin/main)"然后重新安装依赖 + 重启:
pnpm installpnpm buildcoderclaw gateway restart如果你之后想回到最新版本:
git checkout maingit pull如果你卡住了
Section titled “如果你卡住了”- 再次运行
coderclaw doctor并仔细阅读输出(它通常会告诉你修复方法)。 - 查看:故障排除
- 在 Discord 上提问:https://discord.gg/9gUsc2sNG6