openAgent
gitlabThe open source UNIVERSAL agent.
clone
https://gitlab.com/bitzzdev/openAgent.gitAIagentautomationopen-sourceuniversal-agent
import { expect, test } from "bun:test"import type { Configuration } from "electron-builder"const legacyDesktopEntry = "resources/linux/opencode-desktop.desktop"const channels = [{ channel: "dev", appId: "ai.opencode.desktop.dev" },{ channel: "beta", appId: "ai.opencode.desktop.beta" },{ channel: "prod", appId: "ai.opencode.desktop" },] as constfor (const channel of channels) {test(`uses one Linux desktop identity for ${channel.channel}`, async () => {const previous = process.env.OPENCODE_CHANNELprocess.env.OPENCODE_CHANNEL = channel.channelconst module = await import(`./electron-builder.config.ts?channel=${channel.channel}`)const config = module.default as Configurationif (previous === undefined) delete process.env.OPENCODE_CHANNELelse process.env.OPENCODE_CHANNEL = previousexpect(config.appId).toBe(channel.appId)expect(config.extraMetadata?.desktopName).toBe(`${channel.appId}.desktop`)expect(config.linux?.executableName).toBe(channel.appId)expect(config.linux?.desktop?.entry?.StartupWMClass).toBe(channel.appId)expect(config.deb?.fpm).toContainEqual(expect.stringContaining(`/usr/share/metainfo/${channel.appId}.metainfo.xml`))expect(config.rpm?.fpm).toContainEqual(expect.stringContaining(`/usr/share/metainfo/${channel.appId}.metainfo.xml`))})}test("keeps a hidden prod launcher for old Linux pins", async () => {const previous = process.env.OPENCODE_CHANNELprocess.env.OPENCODE_CHANNEL = "prod"const module = await import("./electron-builder.config.ts?compat=prod")const config = module.default as Configurationif (previous === undefined) delete process.env.OPENCODE_CHANNELelse process.env.OPENCODE_CHANNEL = previousexpect(config.deb?.fpm?.some((entry) =>entry.endsWith("opencode-desktop.desktop=/usr/share/applications/opencode-desktop.desktop"),),).toBe(true)expect(config.rpm?.fpm?.some((entry) =>entry.endsWith("opencode-desktop.desktop=/usr/share/applications/opencode-desktop.desktop"),),).toBe(true)const desktop = await Bun.file(legacyDesktopEntry).text()expect(desktop).toContain("Exec=/opt/OpenCode/ai.opencode.desktop %U")expect(desktop).toContain("Icon=ai.opencode.desktop")expect(desktop).toContain("StartupWMClass=ai.opencode.desktop")expect(desktop).toContain("NoDisplay=true")})test("bundles the CLI outside the dev app archive", async () => {const previous = process.env.OPENCODE_CHANNELprocess.env.OPENCODE_CHANNEL = "dev"const module = await import("./electron-builder.config.ts?cli-resource")const config = module.default as Configurationif (previous === undefined) delete process.env.OPENCODE_CHANNELelse process.env.OPENCODE_CHANNEL = previousexpect(config.files).toContain("!resources/opencode-cli*")expect(config.extraResources).toContainEqual({from: "resources/",to: "",filter: ["opencode-cli*"],})})for (const channel of ["beta", "prod"] as const) {test(`does not bundle the CLI in ${channel} builds`, async () => {const previous = process.env.OPENCODE_CHANNELprocess.env.OPENCODE_CHANNEL = channelconst module = await import(`./electron-builder.config.ts?no-cli-resource=${channel}`)const config = module.default as Configurationif (previous === undefined) delete process.env.OPENCODE_CHANNELelse process.env.OPENCODE_CHANNEL = previousexpect(config.extraResources).not.toContainEqual({from: "resources/",to: "",filter: ["opencode-cli*"],})})}