Token导航 LogoToken导航TokenDH.com
开发敏感数据clawhub未标认证来源可访问clear审计通过

safe-update安全更新

Agent Skill

safe-update 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 OpenClaw 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

19,169

周安装

815

GitHub Stars

2

下载量

6,716
OpenClaw

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

MIT-0

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:safe-update(安全更新)
来源仓库:https://github.com/hacksing/safe-update
安装命令:
openclaw skills install safe-update
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 OpenClaw 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

ClawHubOpenClaw
openclaw skills install safe-update

简介

safe-update 从源代码更新 OpenClaw,支持自定义路径和分支。

  • 它包含拉取、构建和服务重启流程,适合版本升级。
  • 安装后可在 OpenClaw 中调用,需确保 Git 环境可用。
  • 使用前应备份当前配置,防止更新冲突。
  • 建议在非高峰时段执行以减少影响。safe-update 属于开发类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

name
safe-update
description
Update OpenClaw from source code. Supports custom project path and branch. Includes pulling latest branch, rebasing, building and installing, restarting service. Triggered when user asks to update OpenClaw, sync source, rebase branch, or rebuild.

Safe Update

Update OpenClaw from source to the latest version while preserving local changes.

⚠️ Important Warnings

  • This script performs git rebase and git push --force - may lose local changes if not properly committed
  • Uses npm i -g . for global installation - may require sudo
  • Uses systemctl --user restart - will restart the OpenClaw service
  • Backup your config before running! (see below)

Requirements

Required binaries (must be installed):

  • git
  • npm / node
  • systemctl (for restarting gateway)

Configuration

Environment Variables (optional)

# Set custom project path
export OPENCLAW_PROJECT_DIR="/path/to/openclaw"

# Set custom branch (default: main)
export OPENCLAW_BRANCH="your-feature-branch"

# Enable dry-run mode (no actual changes)
export DRY_RUN="true"

Or Pass as Arguments

./update.sh --dir /path/to/openclaw --branch your-branch

Workflow

Step 1: Analyze Current State (Must Run First)

Before executing any update, check:

  1. Whether the current branch has uncommitted changes
  2. Whether the current branch has local modifications
  3. Whether upstream has new commits
  4. Recommend the most appropriate update strategy based on the situation

Recommended Strategy:

ScenarioRecommended MethodRationale
Uncommitted local changesCommit/stash first, then mergeSafe, no lost changes
Only clean local commitsmerge or rebasemerge is safer, rebase keeps history clean
Preparing a PRrebase recommendedKeeps history tidy
Routine dev updatemerge recommendedSimple, less error-prone

Step 2: Ask User for Confirmation

After presenting the recommended options, you must wait for user confirmation before executing.

Step 3: Execute Update

# 1. Enter project directory
cd "${OPENCLAW_PROJECT_DIR:-$HOME/projects/openclaw}"

# 2. Backup config files (good practice before update!)
echo "=== Backing up config files ==="
mkdir -p ~/.openclaw/backups
BACKUP_SUFFIX=$(date +%Y%m%d-%H%M%S)

# Backup main config
cp ~/.openclaw/openclaw.json ~/.openclaw/backups/openclaw.json.bak.$BACKUP_SUFFIX
echo "✅ Backed up: openclaw.json"

# Backup auth profiles (if exists)
if [ -f ~/.openclaw/agents/main/agent/auth-profiles.json ]; then
  cp ~/.openclaw/agents/main/agent/auth-profiles.json \
     ~/.openclaw/backups/auth-profiles.json.bak.$BACKUP_SUFFIX
  echo "✅ Backed up: auth-profiles.json"
fi

echo "💡 Backups saved to: ~/.openclaw/backups/"
echo ""

# 3. Add upstream repository (if not added)
git remote add upstream https://github.com/openclaw/openclaw.git 2>/dev/null || true

# 4. Fetch upstream changes
git fetch upstream

# 5. Update target branch (use merge or rebase based on user's choice)
git checkout $BRANCH
# merge: git merge upstream/$BRANCH
# rebase: git rebase upstream/$BRANCH

# 6. View changelog
echo "=== Full Changelog ==="
CURRENT_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v$(node -e 'console.log(require("./package.json").version)')")
echo "Current version: $CURRENT_TAG"
echo ""

# 7. Build and install
npm run build
npm i -g .

# 8. Reinstall systemd service (to update version number)
echo "=== Reinstalling Gateway service ==="
openclaw daemon install --force

# 9. Check version
NEW_VERSION=$(openclaw --version)
echo "✅ Update complete! New version: $NEW_VERSION"
echo ""

# 10. Ask user whether to restart
echo "=== Gateway needs restart to apply updates ==="
echo "Confirm restart? (y/N)"

Quick Script

Run scripts/update.sh to automatically complete all steps above.

Command Line Options

./update.sh [OPTIONS]

Options:
  --dir PATH       OpenClaw project directory (default: $HOME/projects/openclaw)
  --branch NAME    Git branch to update (default: main)
  --mode MODE      Update mode: merge or rebase (if not specified, will analyze and recommend)
  --dry-run       Show what would be done without executing
  --help          Show this help message

Examples

# Update with defaults (will analyze and recommend)
./update.sh

# Update specific branch
./update.sh --branch feat/my-branch

# Force merge mode
./update.sh --mode merge

# Force rebase mode
./update.sh --mode rebase

# Dry run (preview only)
./update.sh --dry-run

# Custom project path
./update.sh --dir /opt/openclaw --branch main

Notes

  • Rebase may cause conflicts - if conflicts occur, resolve manually and continue
  • Force push - after rebase, if pushing to fork, use git push --force
  • Service reinstall - will update version in systemd unit file
  • User confirms restart - Gateway will not restart until you confirm
  • Backup first - always backup before updating!

Troubleshooting

Git Conflicts During Rebase

# Resolve conflicts manually, then:
git add .
git rebase --continue
# Continue with build steps

Build Fails

# Clean and retry:
rm -rf node_modules dist
npm install
npm run build

Gateway Won't Start

# Check status:
systemctl --user status openclaw-gateway

# View logs:
journalctl --user -u openclaw-gateway -n 50

适合场景

01

OpenClaw 用户查找和安装 Skill 时

02

用户想查找某类 Agent Skill 时

03

需要根据任务场景推荐可安装能力包时

04

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

OpenClaw

91.08%
按下载量换算6,117

安全审计

VirusTotal

通过

ClawScan

通过

Static analysis

未展示

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills