refactor: migrate src/acp/agent.ts from Bun.file() to Filesystem module (#14139)
This commit is contained in:
@@ -30,6 +30,7 @@ import {
|
|||||||
|
|
||||||
import { Log } from "../util/log"
|
import { Log } from "../util/log"
|
||||||
import { pathToFileURL } from "bun"
|
import { pathToFileURL } from "bun"
|
||||||
|
import { Filesystem } from "../util/filesystem"
|
||||||
import { ACPSessionManager } from "./session"
|
import { ACPSessionManager } from "./session"
|
||||||
import type { ACPConfig } from "./types"
|
import type { ACPConfig } from "./types"
|
||||||
import { Provider } from "../provider/provider"
|
import { Provider } from "../provider/provider"
|
||||||
@@ -228,8 +229,7 @@ export namespace ACP {
|
|||||||
const metadata = permission.metadata || {}
|
const metadata = permission.metadata || {}
|
||||||
const filepath = typeof metadata["filepath"] === "string" ? metadata["filepath"] : ""
|
const filepath = typeof metadata["filepath"] === "string" ? metadata["filepath"] : ""
|
||||||
const diff = typeof metadata["diff"] === "string" ? metadata["diff"] : ""
|
const diff = typeof metadata["diff"] === "string" ? metadata["diff"] : ""
|
||||||
const file = Bun.file(filepath)
|
const content = (await Filesystem.exists(filepath)) ? await Filesystem.readText(filepath) : ""
|
||||||
const content = (await file.exists()) ? await file.text() : ""
|
|
||||||
const newContent = getNewContent(content, diff)
|
const newContent = getNewContent(content, diff)
|
||||||
|
|
||||||
if (newContent) {
|
if (newContent) {
|
||||||
|
|||||||
Reference in New Issue
Block a user