@@ -485,3 +485,108 @@ func TestConfig_Version_LoadLegacyWithoutVersion(t *testing.T) {
485485 require .NoError (t , config .saveTo (configFile ))
486486 assert .Equal (t , CurrentVersion , config .Version )
487487}
488+
489+ func TestConfig_Settings_HideToolResults (t * testing.T ) {
490+ t .Parallel ()
491+
492+ tmpDir := t .TempDir ()
493+ configFile := filepath .Join (tmpDir , "config.yaml" )
494+
495+ config := & Config {
496+ Settings : & Settings {
497+ HideToolResults : true ,
498+ },
499+ }
500+
501+ require .NoError (t , config .saveTo (configFile ))
502+
503+ loaded , err := loadFrom (configFile , "" )
504+ require .NoError (t , err )
505+
506+ assert .NotNil (t , loaded .Settings )
507+ assert .True (t , loaded .Settings .HideToolResults )
508+ }
509+
510+ func TestConfig_Settings_Empty (t * testing.T ) {
511+ t .Parallel ()
512+
513+ tmpDir := t .TempDir ()
514+ configFile := filepath .Join (tmpDir , "config.yaml" )
515+
516+ config , err := loadFrom (configFile , "" )
517+ require .NoError (t , err )
518+
519+ // GetSettings should return an empty Settings struct, not nil
520+ settings := config .GetSettings ()
521+ assert .NotNil (t , settings )
522+ assert .False (t , settings .HideToolResults )
523+ }
524+
525+ func TestConfig_Settings_GetSettingsNil (t * testing.T ) {
526+ t .Parallel ()
527+
528+ config := & Config {Aliases : make (map [string ]* Alias )}
529+
530+ // GetSettings should return an empty Settings struct when Settings is nil
531+ settings := config .GetSettings ()
532+ assert .NotNil (t , settings )
533+ assert .False (t , settings .HideToolResults )
534+ }
535+
536+ func TestConfig_AliasWithHideToolResults (t * testing.T ) {
537+ t .Parallel ()
538+
539+ tmpDir := t .TempDir ()
540+ configFile := filepath .Join (tmpDir , "config.yaml" )
541+
542+ config := & Config {
543+ Aliases : map [string ]* Alias {
544+ "hidden" : {Path : "agentcatalog/coder" , HideToolResults : true },
545+ "full" : {Path : "agentcatalog/coder" , Yolo : true , Model : "openai/gpt-4o" , HideToolResults : true },
546+ },
547+ }
548+
549+ require .NoError (t , config .saveTo (configFile ))
550+
551+ loaded , err := loadFrom (configFile , "" )
552+ require .NoError (t , err )
553+
554+ // Verify hide_tool_results option
555+ hiddenAlias , ok := loaded .GetAlias ("hidden" )
556+ require .True (t , ok )
557+ assert .Equal (t , "agentcatalog/coder" , hiddenAlias .Path )
558+ assert .True (t , hiddenAlias .HideToolResults )
559+ assert .False (t , hiddenAlias .Yolo )
560+ assert .Empty (t , hiddenAlias .Model )
561+
562+ // Verify all options together
563+ fullAlias , ok := loaded .GetAlias ("full" )
564+ require .True (t , ok )
565+ assert .True (t , fullAlias .HideToolResults )
566+ assert .True (t , fullAlias .Yolo )
567+ assert .Equal (t , "openai/gpt-4o" , fullAlias .Model )
568+ }
569+
570+ func TestAlias_HasOptions (t * testing.T ) {
571+ t .Parallel ()
572+
573+ tests := []struct {
574+ name string
575+ alias * Alias
576+ expected bool
577+ }{
578+ {"nil alias" , nil , false },
579+ {"empty alias" , & Alias {Path : "test" }, false },
580+ {"yolo only" , & Alias {Path : "test" , Yolo : true }, true },
581+ {"model only" , & Alias {Path : "test" , Model : "openai/gpt-4o" }, true },
582+ {"hide_tool_results only" , & Alias {Path : "test" , HideToolResults : true }, true },
583+ {"all options" , & Alias {Path : "test" , Yolo : true , Model : "openai/gpt-4o" , HideToolResults : true }, true },
584+ }
585+
586+ for _ , tt := range tests {
587+ t .Run (tt .name , func (t * testing.T ) {
588+ t .Parallel ()
589+ assert .Equal (t , tt .expected , tt .alias .HasOptions ())
590+ })
591+ }
592+ }
0 commit comments