Skip to content

Commit da35a64

Browse files
committed
handle brew upgrades better
1 parent 460338c commit da35a64

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

packages/opencode/src/cli/cmd/upgrade.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export const UpgradeCommand = {
2525
prompts.outro("Done")
2626
return
2727
}
28+
prompts.log.info("Installed via " + method)
2829
const target = args.target ?? (await Installation.latest())
2930
prompts.log.info(`From ${Installation.VERSION}${target}`)
3031
const spinner = prompts.spinner()

packages/opencode/src/installation/index.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ export namespace Installation {
6666
name: "bun" as const,
6767
command: () => $`bun pm ls -g`.throws(false).text(),
6868
},
69+
{
70+
name: "brew" as const,
71+
command: () => $`brew list --formula opencode-ai`.throws(false).text(),
72+
},
6973
]
7074

7175
checks.sort((a, b) => {
@@ -97,13 +101,18 @@ export namespace Installation {
97101
const cmd = (() => {
98102
switch (method) {
99103
case "curl":
100-
return $`curl -fsSL https://opencode.ai/install | bash`
104+
return $`curl -fsSL https://opencode.ai/install | bash`.env({
105+
VERSION: target,
106+
...process.env,
107+
})
101108
case "npm":
102109
return $`npm install -g opencode-ai@${target}`
103110
case "pnpm":
104111
return $`pnpm install -g opencode-ai@${target}`
105112
case "bun":
106113
return $`bun install -g opencode-ai@${target}`
114+
case "brew":
115+
return $`brew install sst/tap/opencode`
107116
default:
108117
throw new Error(`Unknown method: ${method}`)
109118
}

0 commit comments

Comments
 (0)