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