commit 560ec6105d3126e3ddbbf0dd2ffd3837a9a74696 Author: zlei9 Date: Sun Mar 29 09:37:57 2026 +0800 Initial commit with translated description diff --git a/SKILL.md b/SKILL.md new file mode 100644 index 0000000..07b1cd6 --- /dev/null +++ b/SKILL.md @@ -0,0 +1,86 @@ +--- +name: openclaw-auto-updater +description: "使用可靠的cron模板、时区安全调度和清晰的摘要输出来安排自动OpenClaw和技能更新。用于免维护、计划升级和简洁的更新报告。" +--- + +# OpenClaw Auto-Updater + +Run **scheduled updates** for OpenClaw and installed skills using cron messages (no scripts required). Focus: safe scheduling, predictable output, and minimal manual work. + +## What it does + +- Runs OpenClaw updates on a fixed schedule +- Updates all installed skills via ClawHub +- Sends a concise, readable summary (updated / unchanged / failed) + +## Setup (daily updates) + +**Daily at 03:30 Europe/Berlin**: +```bash +openclaw cron add \ + --name "OpenClaw Auto-Update" \ + --cron "30 3 * * *" \ + --tz "Europe/Berlin" \ + --session isolated \ + --wake now \ + --deliver \ + --message "Run daily auto-updates: 1) openclaw update --yes --json 2) clawdhub update --all 3) report versions updated + errors." +``` + +### Weekly (Sunday 04:00) +```bash +openclaw cron add \ + --name "OpenClaw Auto-Update (Weekly)" \ + --cron "0 4 * * 0" \ + --tz "Europe/Berlin" \ + --session isolated \ + --wake now \ + --deliver \ + --message "Run weekly auto-updates: openclaw update --yes --json; clawdhub update --all; summarize changes." +``` + +## Safer modes + +**Dry run (no changes):** +```bash +openclaw cron add \ + --name "OpenClaw Auto-Update (Dry)" \ + --cron "30 3 * * *" \ + --tz "Europe/Berlin" \ + --session isolated \ + --wake now \ + --deliver \ + --message "Check updates only: openclaw update status; clawdhub update --all --dry-run; summarize what would change." +``` + +**Core only (skip skills):** +```bash +openclaw cron add \ + --name "OpenClaw Auto-Update (Core Only)" \ + --cron "30 3 * * *" \ + --tz "Europe/Berlin" \ + --session isolated \ + --wake now \ + --deliver \ + --message "Update OpenClaw only: openclaw update --yes --json; summarize version change." +``` + +## Summary format (recommended) +``` +🔄 OpenClaw Auto-Update + +OpenClaw: 2026.2.1 → 2026.2.2 (OK) +Skills updated: 3 +Skills unchanged: 12 +Errors: none +``` + +## Troubleshooting + +- If updates fail, include the error in the summary. +- Schedule off-hours; updates may restart the gateway. +- Use explicit timezones to avoid surprises. + +## References +- `references/agent-guide.md` → deeper implementation notes +- `references/summary-examples.md` → formatting examples diff --git a/_meta.json b/_meta.json new file mode 100644 index 0000000..4d94170 --- /dev/null +++ b/_meta.json @@ -0,0 +1,6 @@ +{ + "ownerId": "kn7arha4qn88fsapjx587fwad17zymk1", + "slug": "openclaw-auto-updater", + "version": "1.0.0", + "publishedAt": 1770138450070 +} \ No newline at end of file diff --git a/references/agent-guide.md b/references/agent-guide.md new file mode 100644 index 0000000..13545a3 --- /dev/null +++ b/references/agent-guide.md @@ -0,0 +1,123 @@ +# Agent Implementation Guide + +When asked to set up auto-updates, follow this procedure. + +## Step 1: Detect Installation Type + +```bash +# Check if installed via npm globally +npm list -g openclaw 2>/dev/null && echo "npm-global" + +# Check if installed via source (git) +[ -d ~/.openclaw/.git ] || [ -f /opt/openclaw/.git/config ] && echo "source-install" + +# Check pnpm +pnpm list -g openclaw 2>/dev/null && echo "pnpm-global" + +# Check bun +bun pm ls -g 2>/dev/null | grep openclaw && echo "bun-global" +``` + +## Step 2: Create the Update Script (Optional) + +For complex setups, create a helper script at `~/.openclaw/scripts/auto-update.sh`: + +```bash +#!/bin/bash +set -e +LOG_FILE="${HOME}/.openclaw/logs/auto-update.log" +mkdir -p "$(dirname "$LOG_FILE")" +log() { echo "[$(date '+%Y-%m-%d %H:%M:%S')] $1" >> "$LOG_FILE"; } + +log "Starting auto-update..." + +# Capture starting versions +OPENCLAW_VERSION_BEFORE=$(openclaw --version 2>/dev/null || echo "unknown") + +# Update OpenClaw +log "Updating OpenClaw..." +if command -v npm &> /dev/null && npm list -g openclaw &> /dev/null; then + npm update -g openclaw@latest 2>&1 | tee -a "$LOG_FILE" +elif command -v pnpm &> /dev/null && pnpm list -g openclaw &> /dev/null; then + pnpm update -g openclaw@latest 2>&1 | tee -a "$LOG_FILE" +elif command -v bun &> /dev/null; then + bun update -g openclaw@latest 2>&1 | tee -a "$LOG_FILE" +else + log "Running openclaw update (source install)" + openclaw update 2>&1 | tee -a "$LOG_FILE" || true +fi + +# Run doctor for migrations +log "Running doctor..." +openclaw doctor --yes 2>&1 | tee -a "$LOG_FILE" || true + +# Capture new version +OPENCLAW_VERSION_AFTER=$(openclaw --version 2>/dev/null || echo "unknown") + +# Update skills +log "Updating skills via ClawHub..." +SKILL_OUTPUT=$(clawdhub update --all 2>&1) || true + +echo "$SKILL_OUTPUT" >> "$LOG_FILE" +log "Auto-update complete." + +# Output summary for agent to parse + +echo "---UPDATE_SUMMARY_START---" +echo "openclaw_before: $OPENCLAW_VERSION_BEFORE" +echo "openclaw_after: $OPENCLAW_VERSION_AFTER" +echo "skill_output: $SKILL_OUTPUT" +echo "---UPDATE_SUMMARY_END---" +``` + +## Step 3: Add Cron Job + +Recommended: built-in cron with an isolated session: + +```bash +openclaw cron add \ + --name "Daily Auto-Update" \ + --cron "0 4 * * *" \ + --tz "America/Los_Angeles" \ + --session isolated \ + --wake now \ + --deliver \ + --message "Run the daily auto-update routine: 1. Check and update OpenClaw (npm/pnpm/bun/global or source). 2. Run openclaw doctor --yes. 3. Update all skills: clawdhub update --all. 4. Report version before/after, updated skills, and any errors." +``` + +## Step 4: Verify Setup + +```bash +openclaw cron list +openclaw --version +clawdhub list +``` + +## Customization Prompts + +**Different time:** +```bash +--cron "0 6 * * *" +``` + +**Different timezone:** +```bash +--tz "Europe/London" +``` + +**Weekly instead of daily:** +```bash +--cron "0 4 * * 0" +``` + +## Error Handling + +If updates fail: +1. Log the error clearly +2. Still report partial success +3. Suggest manual intervention if needed + +Common errors to handle: +- `EACCES`: permission denied → fix permissions +- Network timeouts → retry once, then report +- Git conflicts (source installs) → suggest `openclaw update --yes` or manual cleanup diff --git a/references/summary-examples.md b/references/summary-examples.md new file mode 100644 index 0000000..5412a8f --- /dev/null +++ b/references/summary-examples.md @@ -0,0 +1,91 @@ +# Update Summary Examples + +Reference examples for formatting the update report message. + +## Full Update (Everything Changed) +``` +🔄 Daily Auto-Update Complete + +**OpenClaw** +Updated: v2026.2.1 → v2026.2.2 + +**Skills Updated (3)** +1. prd: 2.0.3 → 2.0.4 +2. browser: 1.2.0 → 1.2.1 +3. nano-banana-pro: 3.1.0 → 3.1.2 + +**Skills Already Current (5)** +prj, gemini, browser, sag, himalaya + +✅ All updates completed successfully. +``` + +## No Updates Available +``` +🔄 Daily Auto-Update Check + +**OpenClaw**: v2026.2.2 (already latest) +**Skills**: All installed skills are current. +Nothing to update today. +``` + +## Partial Update (Skills Only) +``` +🔄 Daily Auto-Update Complete + +**OpenClaw**: v2026.2.2 (no update available) + +**Skills Updated (2)** +1. himalaya: 1.0.0 → 1.0.1 +2. 1password: 2.1.0 → 2.2.0 + +**Skills Already Current (6)** +prd, gemini, browser, sag, things-mac, peekaboo + +✅ Skill updates completed. +``` + +## Update With Errors +``` +🔄 Daily Auto-Update Complete (with issues) + +**OpenClaw**: v2026.2.1 → v2026.2.2 + +✅ **Skills Updated (1)** +1. prd: 2.0.3 → 2.0.4 + +❌ **Skills Failed (1)** +1. nano-banana-pro: update failed + Error: Network timeout while downloading v3.1.2 + Recommendation: Run `clawdhub update nano-banana-pro` manually + +**Skills Already Current (6)** +prj, gemini, browser, sag, himalaya, peekaboo + +⚠️ Completed with 1 error. +``` + +## First Run / Setup Confirmation +``` +🔄 Auto-Updater Configured +Daily updates will run at 4:00 AM (Europe/Berlin). + +**What will be updated:** +- OpenClaw core +- All installed skills via ClawHub + +**Current status:** +- OpenClaw: v2026.2.2 +- Installed skills: 8 + +To modify: `openclaw cron edit "Daily Auto-Update"` +To disable: `openclaw cron remove "Daily Auto-Update"` +``` + +## Formatting Guidelines +1. Use emojis sparingly (🔄 + ✅/❌) +2. Lead with what changed +3. Group updated vs current vs failed +4. Include version numbers (before → after) +5. Keep it short +6. Surface errors prominently