refactor: migrate src/session/instruction.ts from Bun.file() to Filesystem module (#14130)

This commit is contained in:
Dax
2026-02-18 18:09:45 -05:00
committed by GitHub
parent 359360ad86
commit ae398539c5

View File

@@ -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 })
}