Преглед изворни кода

handle brew upgrades better

Dax Raad пре 8 месеци
родитељ
комит
da35a64fa1
2 измењених фајлова са 11 додато и 1 уклоњено
  1. 1 0
      packages/opencode/src/cli/cmd/upgrade.ts
  2. 10 1
      packages/opencode/src/installation/index.ts

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

@@ -25,6 +25,7 @@ export const UpgradeCommand = {
       prompts.outro("Done")
       return
     }
+    prompts.log.info("Installed via " + method)
     const target = args.target ?? (await Installation.latest())
     prompts.log.info(`From ${Installation.VERSION} → ${target}`)
     const spinner = prompts.spinner()

+ 10 - 1
packages/opencode/src/installation/index.ts

@@ -66,6 +66,10 @@ export namespace Installation {
         name: "bun" as const,
         command: () => $`bun pm ls -g`.throws(false).text(),
       },
+      {
+        name: "brew" as const,
+        command: () => $`brew list --formula opencode-ai`.throws(false).text(),
+      },
     ]
 
     checks.sort((a, b) => {
@@ -97,13 +101,18 @@ export namespace Installation {
     const cmd = (() => {
       switch (method) {
         case "curl":
-          return $`curl -fsSL https://opencode.ai/install | bash`
+          return $`curl -fsSL https://opencode.ai/install | bash`.env({
+            VERSION: target,
+            ...process.env,
+          })
         case "npm":
           return $`npm install -g opencode-ai@${target}`
         case "pnpm":
           return $`pnpm install -g opencode-ai@${target}`
         case "bun":
           return $`bun install -g opencode-ai@${target}`
+        case "brew":
+          return $`brew install sst/tap/opencode`
         default:
           throw new Error(`Unknown method: ${method}`)
       }