@@ -1176,10 +1176,7 @@ export namespace Config {
11761176 if ( lineIndex !== - 1 && lines [ lineIndex ] . trim ( ) . startsWith ( "//" ) ) {
11771177 continue // Skip if line is commented
11781178 }
1179- let filePath = match . replace ( / ^ \{ f i l e : / , "" ) . replace ( / \} $ / , "" )
1180- if ( filePath . startsWith ( "~/" ) ) {
1181- filePath = path . join ( os . homedir ( ) , filePath . slice ( 2 ) )
1182- }
1179+ const filePath = Filesystem . resolveTilde ( match . replace ( / ^ \{ f i l e : / , "" ) . replace ( / \} $ / , "" ) )
11831180 const resolvedPath = path . isAbsolute ( filePath ) ? filePath : path . resolve ( configDir , filePath )
11841181 const fileContent = (
11851182 await Bun . file ( resolvedPath )
@@ -1236,14 +1233,26 @@ export namespace Config {
12361233 await Bun . write ( configFilepath , updated ) . catch ( ( ) => { } )
12371234 }
12381235 const data = parsed . data
1239- if ( data . plugin ) {
1240- for ( let i = 0 ; i < data . plugin . length ; i ++ ) {
1241- const plugin = data . plugin [ i ]
1242- try {
1243- data . plugin [ i ] = import . meta. resolve ! ( plugin , configFilepath )
1244- } catch ( err ) { }
1236+ const expand = ( arr ?: string [ ] ) => arr ?. forEach ( ( v , i ) => ( arr [ i ] = Filesystem . resolveTilde ( v ) ) )
1237+
1238+ expand ( data . instructions )
1239+ expand ( data . plugin )
1240+ if ( data . skills ) expand ( data . skills . paths )
1241+
1242+ for ( const mcp of Object . values ( data . mcp ?? { } ) )
1243+ if ( typeof mcp === "object" && "type" in mcp && mcp . type === "local" ) expand ( mcp . command )
1244+ for ( const lsp of Object . values ( data . lsp ?? { } ) )
1245+ if ( typeof lsp === "object" && "command" in lsp ) expand ( lsp . command )
1246+ for ( const fmt of Object . values ( data . formatter ?? { } ) )
1247+ if ( typeof fmt === "object" && "command" in fmt ) expand ( fmt . command )
1248+
1249+ data . plugin = data . plugin ?. map ( ( p : string ) => {
1250+ try {
1251+ return import . meta. resolve ! ( p , configFilepath )
1252+ } catch {
1253+ return p
12451254 }
1246- }
1255+ } )
12471256 return data
12481257 }
12491258
0 commit comments