fix(auto-update): implement channel-based version fetching
Add support for npm dist-tag channels (@beta, @next, @canary) in auto-update mechanism. Users pinned to oh-my-opencode@beta now correctly fetch and compare against beta channel instead of stable latest. - Add extractChannel() to detect channel from version string - Modify getLatestVersion() to accept channel parameter - Update auto-update flow to use channel-aware fetching - Add comprehensive tests for channel detection and fetching - Resolves #687 Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import { describe, test, expect } from "bun:test"
|
||||
import { getLatestVersion } from "./checker"
|
||||
|
||||
describe("auto-update-checker/checker", () => {
|
||||
describe("getLatestVersion", () => {
|
||||
test("accepts channel parameter", async () => {
|
||||
const result = await getLatestVersion("beta")
|
||||
|
||||
expect(typeof result === "string" || result === null).toBe(true)
|
||||
})
|
||||
|
||||
test("accepts latest channel", async () => {
|
||||
const result = await getLatestVersion("latest")
|
||||
|
||||
expect(typeof result === "string" || result === null).toBe(true)
|
||||
})
|
||||
|
||||
test("works without channel (defaults to latest)", async () => {
|
||||
const result = await getLatestVersion()
|
||||
|
||||
expect(typeof result === "string" || result === null).toBe(true)
|
||||
})
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user