GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: adjust upgrade command to use gh releases page if not npm/bun/pn… · naraga/opencode@4abaa05

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • packages/opencode/src/installation
    • index.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎packages/opencode/src/installation/index.ts‎

Copy file name to clipboardExpand all lines: packages/opencode/src/installation/index.ts
+21-10Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,8 @@ export namespace Installation {
166166

167167
export async function latest(installMethod?: Method) {
168168
const detectedMethod = installMethod || (await method())
169+
170+
// Use brew formula API for homebrew core formula
169171
if (detectedMethod === "brew") {
170172
const formula = await getBrewFormula()
171173
if (formula === "opencode") {
@@ -178,19 +180,28 @@ export namespace Installation {
178180
}
179181
}
180182

181-
const registry = await iife(async () => {
182-
const r = (await $`npm config get registry`.quiet().nothrow().text()).trim()
183-
const reg = r || "https://registry.npmjs.org"
184-
return reg.endsWith("/") ? reg.slice(0, -1) : reg
185-
})
186-
const [major] = VERSION.split(".").map((x) => Number(x))
187-
// const channel = CHANNEL === "latest" ? `latest-${major}` : CHANNEL
188-
const channel = CHANNEL
189-
return fetch(`${registry}/opencode-ai/${channel}`)
183+
// Use npm registry for npm/bun/pnpm
184+
if (detectedMethod === "npm" || detectedMethod === "bun" || detectedMethod === "pnpm") {
185+
const registry = await iife(async () => {
186+
const r = (await $`npm config get registry`.quiet().nothrow().text()).trim()
187+
const reg = r || "https://registry.npmjs.org"
188+
return reg.endsWith("/") ? reg.slice(0, -1) : reg
189+
})
190+
const channel = CHANNEL
191+
return fetch(`${registry}/opencode-ai/${channel}`)
192+
.then((res) => {
193+
if (!res.ok) throw new Error(res.statusText)
194+
return res.json()
195+
})
196+
.then((data: any) => data.version)
197+
}
198+
199+
// Use GitHub releases for everything else (curl, yarn, brew tap, unknown)
200+
return fetch("https://api.github.com/repos/sst/opencode/releases/latest")
190201
.then((res) => {
191202
if (!res.ok) throw new Error(res.statusText)
192203
return res.json()
193204
})
194-
.then((data: any) => data.version)
205+
.then((data: any) => data.tag_name.replace(/^v/, ""))
195206
}
196207
}

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.