@@ -1164,10 +1164,7 @@ export namespace Config {
11641164 if ( lineIndex !== - 1 && lines [ lineIndex ] . trim ( ) . startsWith ( "//" ) ) {
11651165 continue // Skip if line is commented
11661166 }
1167- let filePath = match . replace ( / ^ \{ f i l e : / , "" ) . replace ( / \} $ / , "" )
1168- if ( filePath . startsWith ( "~/" ) ) {
1169- filePath = path . join ( os . homedir ( ) , filePath . slice ( 2 ) )
1170- }
1167+ const filePath = Filesystem . resolveTilde ( match . replace ( / ^ \{ f i l e : / , "" ) . replace ( / \} $ / , "" ) )
11711168 const resolvedPath = path . isAbsolute ( filePath ) ? filePath : path . resolve ( configDir , filePath )
11721169 const fileContent = (
11731170 await Bun . file ( resolvedPath )
@@ -1224,14 +1221,26 @@ export namespace Config {
12241221 await Bun . write ( configFilepath , updated ) . catch ( ( ) => { } )
12251222 }
12261223 const data = parsed . data
1227- if ( data . plugin ) {
1228- for ( let i = 0 ; i < data . plugin . length ; i ++ ) {
1229- const plugin = data . plugin [ i ]
1230- try {
1231- data . plugin [ i ] = import . meta. resolve ! ( plugin , configFilepath )
1232- } catch ( err ) { }
1224+ const expand = ( arr ?: string [ ] ) => arr ?. forEach ( ( v , i ) => ( arr [ i ] = Filesystem . resolveTilde ( v ) ) )
1225+
1226+ expand ( data . instructions )
1227+ expand ( data . plugin )
1228+ if ( data . skills ) expand ( data . skills . paths )
1229+
1230+ for ( const mcp of Object . values ( data . mcp ?? { } ) )
1231+ if ( typeof mcp === "object" && "type" in mcp && mcp . type === "local" ) expand ( mcp . command )
1232+ for ( const lsp of Object . values ( data . lsp ?? { } ) )
1233+ if ( typeof lsp === "object" && "command" in lsp ) expand ( lsp . command )
1234+ for ( const fmt of Object . values ( data . formatter ?? { } ) )
1235+ if ( typeof fmt === "object" && "command" in fmt ) expand ( fmt . command )
1236+
1237+ data . plugin = data . plugin ?. map ( ( p : string ) => {
1238+ try {
1239+ return import . meta. resolve ! ( p , configFilepath )
1240+ } catch {
1241+ return p
12331242 }
1234- }
1243+ } )
12351244 return data
12361245 }
12371246
0 commit comments