Compare commits

..

2 Commits

Author SHA1 Message Date
Dax
f380c757ff Merge branch 'dev' into migrate-skill-discovery 2026-02-18 17:53:44 -05:00
Dax Raad
8fd4568071 refactor: migrate src/skill/discovery.ts from Bun.file()/Bun.write() to Filesystem module
Replace Bun-specific file operations with Filesystem module:

- Add Filesystem import from ../util/filesystem

- Replace Bun.file().exists() with Filesystem.exists()

- Replace Bun.write() with Filesystem.write()

All 17 skill tests pass.
2026-02-18 10:55:25 -05:00
2 changed files with 5 additions and 5 deletions

View File

@@ -1,6 +1,5 @@
import { Flag } from "@/flag/flag"
import { lazy } from "@/util/lazy"
import { Filesystem } from "@/util/filesystem"
import path from "path"
import { spawn, type ChildProcess } from "child_process"
@@ -44,7 +43,7 @@ export namespace Shell {
// git.exe is typically at: C:\Program Files\Git\cmd\git.exe
// bash.exe is at: C:\Program Files\Git\bin\bash.exe
const bash = path.join(git, "..", "..", "bin", "bash.exe")
if (Filesystem.stat(bash)?.size) return bash
if (Bun.file(bash).size) return bash
}
return process.env.COMSPEC || "cmd.exe"
}

View File

@@ -2,6 +2,7 @@ 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" })
@@ -19,14 +20,14 @@ export namespace Discovery {
}
async function get(url: string, dest: string): Promise<boolean> {
if (await Bun.file(dest).exists()) return true
if (await Filesystem.exists(dest)) return true
return fetch(url)
.then(async (response) => {
if (!response.ok) {
log.error("failed to download", { url, status: response.status })
return false
}
await Bun.write(dest, await response.text())
await Filesystem.write(dest, await response.text())
return true
})
.catch((err) => {
@@ -88,7 +89,7 @@ export namespace Discovery {
)
const md = path.join(root, "SKILL.md")
if (await Bun.file(md).exists()) result.push(root)
if (await Filesystem.exists(md)) result.push(root)
}),
)