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
18 changes: 10 additions & 8 deletions packages/opencode/src/installation/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,14 +218,16 @@ 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)
if (match) return match[1]
return yield* Effect.die(new Error("failed to resolve latest version from GitHub releases redirect"))
// Resolve the latest version from FDS, matching the source the install
// script downloads from (fast in mainland China). Override base via
// MIMO_FDS_BASE to mirror the install script.
const base = (process.env.MIMO_FDS_BASE || "https://mimocode.cnbj1.mi-fds.com/mimocode/mimocode").replace(
/\/+$/,
"",
)
const version = (yield* text(["curl", "-fsSL", `${base}/releases/latest`])).trim().replace(/^v/, "")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

得检查一下到底是不是一个版本号

if (version) return version
return yield* Effect.die(new Error("failed to resolve latest version from FDS"))
}

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