File tree Expand file tree Collapse file tree
packages/opencode/src/skill Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import path from "path"
22import { mkdir } from "fs/promises"
33import { Log } from "../util/log"
44import { Global } from "../global"
5+ import { Filesystem } from "../util/filesystem"
56
67export namespace Discovery {
78 const log = Log . create ( { service : "skill-discovery" } )
@@ -19,14 +20,14 @@ export namespace Discovery {
1920 }
2021
2122 async function get ( url : string , dest : string ) : Promise < boolean > {
22- if ( await Bun . file ( dest ) . exists ( ) ) return true
23+ if ( await Filesystem . exists ( dest ) ) return true
2324 return fetch ( url )
2425 . then ( async ( response ) => {
2526 if ( ! response . ok ) {
2627 log . error ( "failed to download" , { url, status : response . status } )
2728 return false
2829 }
29- await Bun . write ( dest , await response . text ( ) )
30+ if ( response . body ) await Filesystem . writeStream ( dest , response . body )
3031 return true
3132 } )
3233 . catch ( ( err ) => {
@@ -88,7 +89,7 @@ export namespace Discovery {
8889 )
8990
9091 const md = path . join ( root , "SKILL.md" )
91- if ( await Bun . file ( md ) . exists ( ) ) result . push ( root )
92+ if ( await Filesystem . exists ( md ) ) result . push ( root )
9293 } ) ,
9394 )
9495
You can’t perform that action at this time.
0 commit comments