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
17 changes: 10 additions & 7 deletions packages/opencode/src/installation/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,14 +218,17 @@ export const layer: Layer.Layer<Service, never, HttpClient.HttpClient | ChildPro
// }

if (detectedMethod === "curl") {
const headers = yield* text([
"curl",
"-sI",
"https://github.com/XiaomiMiMo/MiMo-Code/releases/latest",
])
const match = headers.match(/^location:.*\/tag\/v([0-9][^\s/]*)/im)
const response = yield* httpOk.execute(
HttpClientRequest.get("https://api.github.com/repos/XiaomiMiMo/MiMo-Code/releases/latest").pipe(
HttpClientRequest.acceptJson,
),
)
const body = yield* HttpClientResponse.schemaBodyJson(
z.object({ tag_name: z.string() }),
)(response)
const match = body.tag_name.match(/^v(.+)$/)
if (match) return match[1]
return yield* Effect.die(new Error("failed to resolve latest version from GitHub releases redirect"))
return body.tag_name
}

if (detectedMethod === "npm" || detectedMethod === "bun" || detectedMethod === "pnpm") {
Expand Down