360 Secure SkillHub
360 安全技能中心

Oc Self Update

运行 scripts/check_update.sh 对比当前版本与 npm 上的最新版本,向用户报告结果;用户确认后按 latest、beta 或 dev 渠道用 npm 全局安装 OpenClaw,完成后提示用户手动重启网关。安装失败时只原样报告错误,不自动重试或重启。

spideystreet
spideystreet
热度 66.29
最近更新 2026-05-11 17:28:38
分类:自动化依赖:代码执行 / 读写文件 / 第三方 API应用场景:自动化脚本 / DevOps / 工作流

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add oc-self-update
Metadata
name
oc-self-update
description
Check for OpenClaw updates and self-update the installation. Use when the user asks to update OpenClaw, check for updates, upgrade the bot, install a new version, or says a new release is available.
metadata
{"openclaw":{"requires":{"bins":["npm"]}}}

OpenClaw Self-Update

OpenClaw is distributed as an npm package. Version scheme: YYYY.M.D (date-based).

Workflow

1. Check for updates

Run the check script:

{ "tool": "exec", "command": "bash {baseDir}/scripts/check_update.sh" }

Report the result to the user clearly:

  • If already up to date: say so and show current version
  • If an update is available: show current vs latest and ask for confirmation before updating

2. Apply update

Only run after user confirms. Use the channel the user configured (default: latest):

{ "tool": "exec", "command": "npm install -g openclaw@latest" }
Channel Command
Stable (default) npm install -g openclaw@latest
Beta npm install -g openclaw@beta
Dev npm install -g openclaw@dev

3. Confirm result

After a successful install, inform the user that a gateway restart is required for changes to take effect. Do not restart automatically — tell the user to run openclaw restart or stop/start the daemon.

✅ OpenClaw updated: {old_version} → {new_version}
⚠️ Restart the gateway: openclaw restart

4. Error handling

  • If check_update.sh fails → report the error, suggest checking network or npm config
  • If npm install fails → report the error as-is, do not retry without user input
  • If the user asks for a channel that doesn't exist → show the channel table and ask again

Examples

User says Action
"Check for updates" Run check script, report current vs latest
"Update openclaw" Run check script, if update available ask confirmation, then install
"Switch to beta channel" Install openclaw@beta, remind to restart
"What version am I on?" Run check script, report current version