summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDax <[email protected]>2026-02-18 19:20:16 -0500
committerGitHub <[email protected]>2026-02-18 19:20:16 -0500
commit9e6cb8910109cc6b11792e0bfac9268d65122c74 (patch)
tree4be28e83056327bd8aa8aa54ddaee88d65ebdf3e
parenta8347c3762881f03e096e484a72302302f025a65 (diff)
downloadopencode-9e6cb8910109cc6b11792e0bfac9268d65122c74.tar.gz
opencode-9e6cb8910109cc6b11792e0bfac9268d65122c74.zip
refactor: migrate src/mcp/auth.ts from Bun.file()/Bun.write() to Filesystem module (#14125)
-rw-r--r--packages/opencode/src/mcp/auth.ts10
1 files changed, 4 insertions, 6 deletions
diff --git a/packages/opencode/src/mcp/auth.ts b/packages/opencode/src/mcp/auth.ts
index 0f91a35b8..399986376 100644
--- a/packages/opencode/src/mcp/auth.ts
+++ b/packages/opencode/src/mcp/auth.ts
@@ -1,6 +1,7 @@
import path from "path"
import z from "zod"
import { Global } from "../global"
+import { Filesystem } from "../util/filesystem"
export namespace McpAuth {
export const Tokens = z.object({
@@ -53,25 +54,22 @@ export namespace McpAuth {
}
export async function all(): Promise<Record<string, Entry>> {
- const file = Bun.file(filepath)
- return file.json().catch(() => ({}))
+ return Filesystem.readJson<Record<string, Entry>>(filepath).catch(() => ({}))
}
export async function set(mcpName: string, entry: Entry, serverUrl?: string): Promise<void> {
- const file = Bun.file(filepath)
const data = await all()
// Always update serverUrl if provided
if (serverUrl) {
entry.serverUrl = serverUrl
}
- await Bun.write(file, JSON.stringify({ ...data, [mcpName]: entry }, null, 2), { mode: 0o600 })
+ await Filesystem.writeJson(filepath, { ...data, [mcpName]: entry }, 0o600)
}
export async function remove(mcpName: string): Promise<void> {
- const file = Bun.file(filepath)
const data = await all()
delete data[mcpName]
- await Bun.write(file, JSON.stringify(data, null, 2), { mode: 0o600 })
+ await Filesystem.writeJson(filepath, data, 0o600)
}
export async function updateTokens(mcpName: string, tokens: Tokens, serverUrl?: string): Promise<void> {