Skip to content

Commit a3739c7

Browse files
authored
Merge pull request #102 from browser-use/db-filename
fix(core): use bcode database filename
2 parents 60c3a27 + 5da41a9 commit a3739c7

2 files changed

Lines changed: 23 additions & 2 deletions

File tree

‎packages/core/src/database/database.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ export function path() {
5050
process.env.OPENCODE_DISABLE_CHANNEL_DB === "1" ||
5151
process.env.OPENCODE_DISABLE_CHANNEL_DB === "true"
5252
)
53-
return join(Global.Path.data, "opencode.db")
54-
return join(Global.Path.data, `opencode-${InstallationChannel.replace(/[^a-zA-Z0-9._-]/g, "-")}.db`)
53+
return join(Global.Path.data, "bcode.db")
54+
return join(Global.Path.data, `bcode-${InstallationChannel.replace(/[^a-zA-Z0-9._-]/g, "-")}.db`)
5555
}
5656

5757
export const defaultLayer = Layer.unwrap(
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { describe, expect, test } from "bun:test"
2+
import path from "path"
3+
import { Database } from "@opencode-ai/core/database/database"
4+
import { Global } from "@opencode-ai/core/global"
5+
import { InstallationChannel } from "@opencode-ai/core/installation/version"
6+
7+
describe("Database.path", () => {
8+
test("uses BrowserCode database filenames", () => {
9+
delete process.env.OPENCODE_DISABLE_CHANNEL_DB
10+
11+
expect(Database.path()).toBe(
12+
["latest", "beta", "prod"].includes(InstallationChannel)
13+
? path.join(Global.Path.data, "bcode.db")
14+
: path.join(Global.Path.data, `bcode-${InstallationChannel.replace(/[^a-zA-Z0-9._-]/g, "-")}.db`),
15+
)
16+
17+
process.env.OPENCODE_DISABLE_CHANNEL_DB = "1"
18+
expect(Database.path()).toBe(path.join(Global.Path.data, "bcode.db"))
19+
delete process.env.OPENCODE_DISABLE_CHANNEL_DB
20+
})
21+
})

0 commit comments

Comments
 (0)