Compare commits

..

3 Commits

Author SHA1 Message Date
Dax
075e6818b9 Merge branch 'dev' into migrate-provider 2026-02-18 17:53:42 -05:00
Dax
8090c0b517 Merge branch 'dev' into migrate-provider 2026-02-18 17:26:25 -05:00
Dax Raad
36f8057249 refactor: migrate src/provider/provider.ts from Bun.file() to Filesystem module
Replace Bun.file().json() with Filesystem.readJson():

- Add Filesystem import from ../util/filesystem

- Replace Bun.file().json() with Filesystem.readJson<T>() with proper type parameter

All 222 provider tests pass.
2026-02-18 10:53:48 -05:00
2 changed files with 5 additions and 4 deletions

View File

@@ -16,6 +16,7 @@ import { Flag } from "../flag/flag"
import { iife } from "@/util/iife"
import { Global } from "../global"
import path from "path"
import { Filesystem } from "../util/filesystem"
// Direct imports for bundled providers
import { createAmazonBedrock, type AmazonBedrockProviderSettings } from "@ai-sdk/amazon-bedrock"
@@ -1291,8 +1292,9 @@ export namespace Provider {
if (cfg.model) return parseModel(cfg.model)
const providers = await list()
const recent = (await Bun.file(path.join(Global.Path.state, "model.json"))
.json()
const recent = (await Filesystem.readJson<{ recent?: { providerID: string; modelID: string }[] }>(
path.join(Global.Path.state, "model.json"),
)
.then((x) => (Array.isArray(x.recent) ? x.recent : []))
.catch(() => [])) as { providerID: string; modelID: string }[]
for (const entry of recent) {

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"
}