Revert: all refactor commits migrating from Bun.file() to Filesystem module

This commit is contained in:
Dax Raad
2026-02-18 19:41:14 -05:00
parent 3a07dd8d96
commit 568eccb4c6
25 changed files with 216 additions and 294 deletions

View File

@@ -2,7 +2,6 @@ import path from "path"
import { mkdir } from "fs/promises"
import { Log } from "../util/log"
import { Global } from "../global"
import { Filesystem } from "../util/filesystem"
export namespace Discovery {
const log = Log.create({ service: "skill-discovery" })
@@ -20,14 +19,14 @@ export namespace Discovery {
}
async function get(url: string, dest: string): Promise<boolean> {
if (await Filesystem.exists(dest)) return true
if (await Bun.file(dest).exists()) return true
return fetch(url)
.then(async (response) => {
if (!response.ok) {
log.error("failed to download", { url, status: response.status })
return false
}
if (response.body) await Filesystem.writeStream(dest, response.body)
await Bun.write(dest, await response.text())
return true
})
.catch((err) => {
@@ -89,7 +88,7 @@ export namespace Discovery {
)
const md = path.join(root, "SKILL.md")
if (await Filesystem.exists(md)) result.push(root)
if (await Bun.file(md).exists()) result.push(root)
}),
)