fix(cli): restart stale clients after updates

This commit is contained in:
Kit Langton 2026-07-05 13:31:19 -04:00
commit 910af9a122
13 changed files with 246 additions and 25 deletions

View file

@ -7,6 +7,18 @@ import os from "node:os"
import path from "node:path"
import { ServiceConfig } from "../src/services/service-config"
test("only replaces older semantic versions", () => {
expect(ServiceConfig.canReplaceVersion("1.0.0", "2.0.0")).toBe(true)
expect(ServiceConfig.canReplaceVersion("2.0.0", "1.0.0")).toBe(false)
expect(ServiceConfig.canReplaceVersion("1.0.0", "1.0.0")).toBe(false)
expect(ServiceConfig.canReplaceVersion("0.0.0-next-9999", "0.0.0-next-15000")).toBe(true)
expect(ServiceConfig.canReplaceVersion("0.0.0-next-15000", "0.0.0-next-9999")).toBe(false)
expect(ServiceConfig.canReplaceVersion("0.0.0-next-15000.1", "0.0.0-next-15000.2")).toBe(true)
expect(ServiceConfig.canReplaceVersion("0.0.0-next-15000.10", "0.0.0-next-15000.9")).toBe(false)
expect(ServiceConfig.canReplaceVersion("0.0.0-next-15000.10", "0.0.0-next-15000.10")).toBe(false)
expect(ServiceConfig.canReplaceVersion(undefined, "1.0.0")).toBe(true)
})
test("local channel stores service config with the local service filename", async () => {
const root = await fs.mkdtemp(path.join(os.tmpdir(), "opencode-service-"))
try {