diff options
| author | Aiden Cline <[email protected]> | 2025-11-04 00:52:15 -0600 |
|---|---|---|
| committer | Aiden Cline <[email protected]> | 2025-11-04 00:52:26 -0600 |
| commit | d341d26e37fd458bffc6b51c7fe5a4d33eaa182f (patch) | |
| tree | 5f5a733f1706c47ab848c57a2ba73fc4558e5971 /packages | |
| parent | d49b1b25d12f45614e4bf77a26202b52ac8e629b (diff) | |
| download | opencode-d341d26e37fd458bffc6b51c7fe5a4d33eaa182f.tar.gz opencode-d341d26e37fd458bffc6b51c7fe5a4d33eaa182f.zip | |
update brew handling
Diffstat (limited to 'packages')
| -rw-r--r-- | packages/console/app/src/routes/temp.tsx | 12 | ||||
| -rw-r--r-- | packages/opencode/src/installation/index.ts | 58 | ||||
| -rw-r--r-- | packages/web/src/components/Lander.astro | 4 | ||||
| -rw-r--r-- | packages/web/src/content/docs/index.mdx | 2 |
4 files changed, 46 insertions, 30 deletions
diff --git a/packages/console/app/src/routes/temp.tsx b/packages/console/app/src/routes/temp.tsx index 379f79f7a..59987e4d0 100644 --- a/packages/console/app/src/routes/temp.tsx +++ b/packages/console/app/src/routes/temp.tsx @@ -79,17 +79,19 @@ export default function Home() { <strong>LSP enabled</strong> Automatically loads the right LSPs for the LLM </li> <li> - <strong>opencode zen</strong> A <a href="/docs/zen">curated list of models</a> provided by opencode{" "} - <label>New</label> + <strong>opencode zen</strong> A <a href="/docs/zen">curated list of models</a>{" "} + provided by opencode <label>New</label> </li> <li> <strong>Multi-session</strong> Start multiple agents in parallel on the same project </li> <li> - <strong>Shareable links</strong> Share a link to any sessions for reference or to debug + <strong>Shareable links</strong> Share a link to any sessions for reference or to + debug </li> <li> - <strong>Claude Pro</strong> Log in with Anthropic to use your Claude Pro or Max account + <strong>Claude Pro</strong> Log in with Anthropic to use your Claude Pro or Max + account </li> <li> <strong>Use any model</strong> Supports 75+ LLM providers through{" "} @@ -121,7 +123,7 @@ export default function Home() { <h3 data-component="title">homebrew</h3> <button data-copy data-slot="button"> <span> - brew install <strong>sst/tap/opencode</strong> + brew install <strong>opencode</strong> </span> <CopyStatus /> </button> diff --git a/packages/opencode/src/installation/index.ts b/packages/opencode/src/installation/index.ts index f2df5b409..323810e3e 100644 --- a/packages/opencode/src/installation/index.ts +++ b/packages/opencode/src/installation/index.ts @@ -73,7 +73,7 @@ export namespace Installation { }, { name: "brew" as const, - command: () => $`brew list --formula opencode-ai`.throws(false).text(), + command: () => $`brew list --formula opencode`.throws(false).text(), }, ] @@ -87,7 +87,7 @@ export namespace Installation { for (const check of checks) { const output = await check.command() - if (output.includes("opencode-ai")) { + if (output.includes(check.name === "brew" ? "opencode" : "opencode-ai")) { return check.name } } @@ -102,28 +102,42 @@ export namespace Installation { }), ) + async function getBrewFormula() { + const tapFormula = await $`brew list --formula sst/tap/opencode`.throws(false).text() + if (tapFormula.includes("opencode")) return "sst/tap/opencode" + const coreFormula = await $`brew list --formula opencode`.throws(false).text() + if (coreFormula.includes("opencode")) return "opencode" + return "opencode" + } + export async function upgrade(method: Method, target: string) { - const cmd = (() => { - switch (method) { - case "curl": - return $`curl -fsSL https://opencode.ai/install | bash`.env({ - ...process.env, - VERSION: target, - }) - 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`.env({ - HOMEBREW_NO_AUTO_UPDATE: "1", - }) - default: - throw new Error(`Unknown method: ${method}`) + let cmd + switch (method) { + case "curl": + cmd = $`curl -fsSL https://opencode.ai/install | bash`.env({ + ...process.env, + VERSION: target, + }) + break + case "npm": + cmd = $`npm install -g opencode-ai@${target}` + break + case "pnpm": + cmd = $`pnpm install -g opencode-ai@${target}` + break + case "bun": + cmd = $`bun install -g opencode-ai@${target}` + break + case "brew": { + const formula = await getBrewFormula() + cmd = $`brew install ${formula}`.env({ + HOMEBREW_NO_AUTO_UPDATE: "1", + }) + break } - })() + default: + throw new Error(`Unknown method: ${method}`) + } const result = await cmd.quiet().throws(false) log.info("upgraded", { method, diff --git a/packages/web/src/components/Lander.astro b/packages/web/src/components/Lander.astro index ef032e49e..421b2a5c8 100644 --- a/packages/web/src/components/Lander.astro +++ b/packages/web/src/components/Lander.astro @@ -109,9 +109,9 @@ if (image) { </div> <div class="col3"> <h3>Homebrew</h3> - <button class="command" data-command="brew install sst/tap/opencode"> + <button class="command" data-command="brew install opencode"> <code> - <span>brew install</span> <span class="highlight">sst/tap/opencode</span> + <span>brew install</span> <span class="highlight">opencode</span> </code> <span class="copy"> <CopyIcon /> diff --git a/packages/web/src/content/docs/index.mdx b/packages/web/src/content/docs/index.mdx index dab62d8bc..f6d2b3129 100644 --- a/packages/web/src/content/docs/index.mdx +++ b/packages/web/src/content/docs/index.mdx @@ -67,7 +67,7 @@ You can also install it with the following commands: - **Using Homebrew on macOS and Linux** ```bash - brew install sst/tap/opencode + brew install opencode ``` - **Using Paru on Arch Linux** |
