Skip to content

Commit 4d6e2d8

Browse files
committed
autoupgrade latest major only
1 parent 4407d5d commit 4d6e2d8

File tree

1 file changed

+3
-1
lines changed
  • packages/opencode/src/installation

1 file changed

+3
-1
lines changed

packages/opencode/src/installation/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,9 @@ export namespace Installation {
142142
export const USER_AGENT = `opencode/${CHANNEL}/${VERSION}`
143143

144144
export async function latest() {
145-
return fetch(`https://registry.npmjs.org/opencode-ai/${CHANNEL}`)
145+
const [major] = VERSION.split(".").map((x) => Number(x))
146+
const channel = CHANNEL === "latest" ? `latest-${major}` : CHANNEL
147+
return fetch(`https://registry.npmjs.org/opencode-ai/${channel}`)
146148
.then((res) => {
147149
if (!res.ok) throw new Error(res.statusText)
148150
return res.json()

0 commit comments

Comments
 (0)