Skip to content

Commit 53b15b7

Browse files
committed
fix: resolve Config import to use standalone loadThemeFile export
1 parent bb07325 commit 53b15b7

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

packages/opencode/src/cli/cmd/tui/context/theme.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ import { useRenderer } from "@opentui/solid"
4141
import { createStore, produce } from "solid-js/store"
4242
import { Global } from "@/global"
4343
import { Filesystem } from "@/util"
44-
import { Config } from "../../../../config/config"
44+
import { loadThemeFile } from "../../../../config/config"
4545
import { useTuiConfig } from "./tui-config"
4646
import { isRecord } from "@/util/record"
4747
import type { TuiThemeCurrent } from "@opencode-ai/plugin/tui"
@@ -502,7 +502,7 @@ async function getCustomThemes() {
502502
const name = path.basename(item, ext)
503503

504504
// Use JSONC parser for all theme files regardless of extension
505-
result[name] = await Config.loadThemeFile(item)
505+
result[name] = await loadThemeFile(item)
506506
}
507507
}
508508
return result

packages/opencode/test/config/theme.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { describe, test, expect, beforeAll, afterAll } from "bun:test"
22
import { tmpdir } from "os"
33
import { join } from "path"
4-
import { Config } from "../../src/config/config"
4+
import { loadThemeFile } from "../../src/config/config"
55
import { writeFileSync, mkdirSync, rmSync } from "fs"
66

77
describe("Theme Loading", () => {
@@ -29,7 +29,7 @@ describe("Theme Loading", () => {
2929
const themeFile = join(tempDir, "test-theme.jsonc")
3030
writeFileSync(themeFile, themeContent)
3131

32-
const theme = await Config.loadThemeFile(themeFile)
32+
const theme = await loadThemeFile(themeFile)
3333

3434
expect(theme.theme.primary).toBe("#ff0000")
3535
expect(theme.theme.secondary).toBe("#00ff00")
@@ -47,7 +47,7 @@ describe("Theme Loading", () => {
4747
const themeFile = join(tempDir, "test-theme.jsonc")
4848
writeFileSync(themeFile, themeContent)
4949

50-
const theme = await Config.loadThemeFile(themeFile)
50+
const theme = await loadThemeFile(themeFile)
5151

5252
// Environment variable should NOT be processed in themes
5353
expect(theme.theme.primary).toBe("{env:TEST_COLOR}")
@@ -68,7 +68,7 @@ describe("Theme Loading", () => {
6868
const themeFile = join(tempDir, "test-theme.jsonc")
6969
writeFileSync(themeFile, themeContent)
7070

71-
const theme = await Config.loadThemeFile(themeFile)
71+
const theme = await loadThemeFile(themeFile)
7272

7373
// File inclusion should NOT be processed in themes
7474
expect(theme.theme.primary).toBe("{file:color.txt}")
@@ -86,7 +86,7 @@ describe("Theme Loading", () => {
8686
const themeFile = join(tempDir, "test-theme.jsonc")
8787
writeFileSync(themeFile, themeContent)
8888

89-
const theme = await Config.loadThemeFile(themeFile)
89+
const theme = await loadThemeFile(themeFile)
9090

9191
expect(theme.theme.primary).toBe("#ff0000")
9292
expect(theme.theme.secondary).toBe("#00ff00")
@@ -103,13 +103,13 @@ describe("Theme Loading", () => {
103103
const themeFile = join(tempDir, "test-theme.jsonc")
104104
writeFileSync(themeFile, themeContent)
105105

106-
expect(Config.loadThemeFile(themeFile)).rejects.toThrow()
106+
expect(loadThemeFile(themeFile)).rejects.toThrow()
107107
})
108108

109109
test("should throw error for empty theme file", async () => {
110110
const themeFile = join(tempDir, "empty-theme.jsonc")
111111
writeFileSync(themeFile, "")
112112

113-
expect(Config.loadThemeFile(themeFile)).rejects.toThrow("Empty theme file")
113+
expect(loadThemeFile(themeFile)).rejects.toThrow("Empty theme file")
114114
})
115115
})

0 commit comments

Comments
 (0)