From ae398539c5de6f0dea245807f9a58c8126acc29f Mon Sep 17 00:00:00 2001 From: Dax Date: Wed, 18 Feb 2026 18:09:45 -0500 Subject: [PATCH] refactor: migrate src/session/instruction.ts from Bun.file() to Filesystem module (#14130) --- packages/opencode/src/session/instruction.ts | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/packages/opencode/src/session/instruction.ts b/packages/opencode/src/session/instruction.ts index 6fb2a7aeb..d65ada278 100644 --- a/packages/opencode/src/session/instruction.ts +++ b/packages/opencode/src/session/instruction.ts @@ -85,7 +85,7 @@ export namespace InstructionPrompt { } for (const file of globalFiles()) { - if (await Bun.file(file).exists()) { + if (await Filesystem.exists(file)) { paths.add(path.resolve(file)) break } @@ -120,9 +120,7 @@ export namespace InstructionPrompt { const paths = await systemPaths() const files = Array.from(paths).map(async (p) => { - const content = await Bun.file(p) - .text() - .catch(() => "") + const content = await Filesystem.readText(p).catch(() => "") return content ? "Instructions from: " + p + "\n" + content : "" }) @@ -164,7 +162,7 @@ export namespace InstructionPrompt { export async function find(dir: string) { for (const file of FILES) { const filepath = path.resolve(path.join(dir, file)) - if (await Bun.file(filepath).exists()) return filepath + if (await Filesystem.exists(filepath)) return filepath } } @@ -182,9 +180,7 @@ export namespace InstructionPrompt { if (found && found !== target && !system.has(found) && !already.has(found) && !isClaimed(messageID, found)) { claim(messageID, found) - const content = await Bun.file(found) - .text() - .catch(() => undefined) + const content = await Filesystem.readText(found).catch(() => undefined) if (content) { results.push({ filepath: found, content: "Instructions from: " + found + "\n" + content }) }