Browse Source

fix: Skip opencode upgrade if same version (#720)

Liang-Shih Lin 7 months ago
parent
commit
2446483df5
1 changed files with 9 additions and 0 deletions
  1. 9 0
      packages/opencode/src/cli/cmd/upgrade.ts

+ 9 - 0
packages/opencode/src/cli/cmd/upgrade.ts

@@ -35,6 +35,15 @@ export const UpgradeCommand = {
     }
     prompts.log.info("Using method: " + method)
     const target = args.target ?? (await Installation.latest())
+
+    if (Installation.VERSION === target) {
+      prompts.log.warn(
+        `opencode upgrade skipped: ${target} is already installed`,
+      )
+      prompts.outro("Done")
+      return
+    }
+
     prompts.log.info(`From ${Installation.VERSION} → ${target}`)
     const spinner = prompts.spinner()
     spinner.start("Upgrading...")