diff options
| author | Dax <[email protected]> | 2026-02-18 19:27:11 -0500 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-02-18 19:27:11 -0500 |
| commit | 36bc07a5af1c5a98bf1f9e6c1913ee720286ca6d (patch) | |
| tree | 5e3555bcc4a762fb64d727fe75562767b24288fc | |
| parent | 270b807cdf004b4ae398414e1475f9dc24e5cb43 (diff) | |
| download | opencode-36bc07a5af1c5a98bf1f9e6c1913ee720286ca6d.tar.gz opencode-36bc07a5af1c5a98bf1f9e6c1913ee720286ca6d.zip | |
refactor: migrate src/tool/write.ts from Bun.file() to Filesystem module (#14119)
| -rw-r--r-- | packages/opencode/src/tool/write.ts | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/packages/opencode/src/tool/write.ts b/packages/opencode/src/tool/write.ts index eca64d303..8c1e53cca 100644 --- a/packages/opencode/src/tool/write.ts +++ b/packages/opencode/src/tool/write.ts @@ -26,9 +26,8 @@ export const WriteTool = Tool.define("write", { const filepath = path.isAbsolute(params.filePath) ? params.filePath : path.join(Instance.directory, params.filePath) await assertExternalDirectory(ctx, filepath) - const file = Bun.file(filepath) - const exists = await file.exists() - const contentOld = exists ? await file.text() : "" + const exists = await Filesystem.exists(filepath) + const contentOld = exists ? await Filesystem.readText(filepath) : "" if (exists) await FileTime.assert(ctx.sessionID, filepath) const diff = trimDiff(createTwoFilesPatch(filepath, filepath, contentOld, params.content)) @@ -42,7 +41,7 @@ export const WriteTool = Tool.define("write", { }, }) - await Bun.write(filepath, params.content) + await Filesystem.write(filepath, params.content) await Bus.publish(File.Event.Edited, { file: filepath, }) |
