sisyphus-dev-ai 612e9b3e03 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>
2026-01-11 09:56:09 +00:00

25 lines
770 B
TypeScript

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)
})
})
})