Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion packages/opencode/src/installation/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,12 @@ export namespace Installation {
export async function latest() {
const [major] = VERSION.split(".").map((x) => Number(x))
const channel = CHANNEL === "latest" ? `latest-${major}` : CHANNEL
return fetch(`https://registry.npmjs.org/opencode-ai/${channel}`)

// Get npm registry and ensure it ends with slash
const registry = await Bun.$`npm config get registry`.text().then((t) => t.trim())
const registryUrl = registry.endsWith("/") ? registry : `${registry}/`

return fetch(`${registryUrl}opencode-ai/${channel}`)
.then((res) => {
if (!res.ok) throw new Error(res.statusText)
return res.json()
Expand Down