openclaw update

安全地更新 OpenClaw 並在 stable/beta/dev 頻道之間切換。

若你是透過 npm/pnpm 安裝(全域安裝,無 git 中繼資料),更新請依照 Updating 中的套件管理器流程進行。

用法

openclaw update
openclaw update status
openclaw update wizard
openclaw update --channel beta
openclaw update --channel dev
openclaw update --tag beta
openclaw update --dry-run
openclaw update --no-restart
openclaw update --json
openclaw --update

選項

  • --no-restart:成功更新後不重啟 Gateway 服務。
  • --channel <stable|beta|dev>:設定更新頻道(git + npm;會持久化到設定中)。
  • --tag <dist-tag|version>:僅針對此次更新覆寫 npm dist-tag 或版本。
  • --dry-run:預覽計畫的更新操作(頻道/標籤/目標/重啟流程),不寫入設定、不安裝、不同步外掛、不重啟。
  • --json:輸出機器可讀的 UpdateRunResult JSON。
  • --timeout <seconds>:各步驟的逾時時間(預設 1200 秒)。

注意:降級需要確認,因為舊版本可能破壞設定。

update status

顯示目前的更新頻道 + git tag/branch/SHA(原始碼簽出時),以及是否有可用更新。

openclaw update status
openclaw update status --json
openclaw update status --timeout 10

選項:

  • --json:輸出機器可讀的狀態 JSON。
  • --timeout <seconds>:檢查逾時(預設 3 秒)。

update wizard

互動式流程,讓你選擇更新頻道並確認更新後是否重啟 Gateway (預設會重啟)。若你選擇 dev 但沒有 git 簽出,會提供建立的選項。

執行內容

當你明確切換頻道時(--channel ...),OpenClaw 也會保持 安裝方式一致:

  • dev → 確保有 git 簽出(預設:~/openclaw,可透過 OPENCLAW_GIT_DIR 覆寫), 更新它,並從該簽出安裝全域 CLI。
  • stable/beta → 使用對應的 dist-tag 從 npm 安裝。

Gateway 核心的自動更新機制(透過設定啟用時)使用相同的更新路徑。

Git 簽出流程

頻道:

  • stable:簽出最新的非 beta 標籤,然後建置 + doctor 檢查。
  • beta:簽出最新的 -beta 標籤,然後建置 + doctor 檢查。
  • dev:簽出 main,然後 fetch + rebase。

概要流程:

  1. 需要乾淨的工作樹(沒有未提交的變更)。
  2. 切換到選定的頻道(標籤或分支)。
  3. 取得上游(僅 dev)。
  4. 僅 dev:在暫時工作樹中進行預檢 lint + TypeScript 建置;若最新提交失敗,會向前回溯最多 10 個提交找到最近的乾淨建置。
  5. 在選定的提交上進行 rebase(僅 dev)。
  6. 安裝相依套件(優先使用 pnpm;退回 npm)。
  7. 建置 + 建置 Control UI。
  8. 執行 openclaw doctor 作為最終的「安全更新」檢查。
  9. 將外掛同步到目前的頻道(dev 使用內建擴充功能;stable/beta 使用 npm)並更新 npm 安裝的外掛。

--update 簡寫

openclaw --update 會改寫為 openclaw update(適用於 shell 和啟動腳本)。

另請參閱