@@ -398,6 +398,8 @@ fn collect_cortex_home_items(home_dir: &Path) -> Result<Vec<RemovalItem>> {
398398 // Configuration files
399399 let config_files = [
400400 ( "config.toml" , "Main configuration file" ) ,
401+ ( "agents.toml" , "Agent configuration" ) ,
402+ ( "aliases.toml" , "Command aliases" ) ,
401403 ( "credentials.json" , "Authentication credentials" ) ,
402404 ( "auth.json" , "OAuth tokens" ) ,
403405 ] ;
@@ -976,4 +978,32 @@ mod tests {
976978 | InstallMethod :: Unknown => { }
977979 }
978980 }
981+
982+ #[ test]
983+ fn test_collect_cortex_home_items_includes_agent_config_files ( ) {
984+ let temp_home = tempfile:: tempdir ( ) . unwrap ( ) ;
985+ let cortex_home = temp_home. path ( ) . join ( ".cortex" ) ;
986+ fs:: create_dir_all ( & cortex_home) . unwrap ( ) ;
987+
988+ for file_name in [ "config.toml" , "agents.toml" , "aliases.toml" ] {
989+ fs:: write ( cortex_home. join ( file_name) , "test = true\n " ) . unwrap ( ) ;
990+ }
991+
992+ let items = collect_cortex_home_items ( temp_home. path ( ) ) . unwrap ( ) ;
993+
994+ assert ! (
995+ items
996+ . iter( )
997+ . any( |item| item. path == cortex_home. join( "config.toml" ) ) ,
998+ "control config.toml should be collected"
999+ ) ;
1000+
1001+ for file_name in [ "agents.toml" , "aliases.toml" ] {
1002+ let item = items
1003+ . iter ( )
1004+ . find ( |item| item. path == cortex_home. join ( file_name) )
1005+ . unwrap_or_else ( || panic ! ( "{file_name} should be collected" ) ) ;
1006+ assert_eq ! ( item. category, RemovalCategory :: Config ) ;
1007+ }
1008+ }
9791009}
0 commit comments