@@ -28,6 +28,7 @@ pub const AMAZONQ_FILENAME: &str = "AmazonQ.md";
2828
2929/// Configuration for context files, containing paths to include in the context.
3030#[ derive( Debug , Clone , Serialize , Deserialize , Default ) ]
31+ #[ serde( default ) ]
3132pub struct ContextConfig {
3233 /// List of file paths or glob patterns to include in the context.
3334 pub paths : Vec < String > ,
@@ -503,11 +504,10 @@ impl ContextManager {
503504 self . save_config ( global) . await
504505 }
505506
506- /// Sets the "disabled" field on any [`Hook`] with the given name to be true or false
507+ /// Sets the "disabled" field on any [`Hook`] with the given name
507508 /// # Arguments
508- /// * `enable` - If true, the "disabled" field are is to false. If false, the "disabled" field
509- /// is set to true
510- pub async fn enable_hook ( & mut self , name : & str , global : bool , enable : bool ) -> Result < ( ) > {
509+ /// * `disable` - Set "disabled" field to this value
510+ pub async fn set_hook_disabled ( & mut self , name : & str , global : bool , disable : bool ) -> Result < ( ) > {
511511 let config = self . get_config_mut ( global) ;
512512
513513 config
@@ -516,24 +516,23 @@ impl ContextManager {
516516 . iter_mut ( )
517517 . chain ( config. hooks . per_prompt . iter_mut ( ) )
518518 . filter ( |h| h. name == name)
519- . for_each ( |h| h. disabled = !enable ) ;
519+ . for_each ( |h| h. disabled = disable ) ;
520520
521521 self . save_config ( global) . await
522522 }
523523
524- /// Sets the "disabled" field on all [`Hook`]s to be true or false
524+ /// Sets the "disabled" field on all [`Hook`]s
525525 /// # Arguments
526- /// * `enable` - If true, all "disabled" fields are set to false. If false, all "disabled"
527- /// fields are set to true
528- pub async fn enable_all_hooks ( & mut self , global : bool , enable : bool ) -> Result < ( ) > {
526+ /// * `disable` - Set all "disabled" fields to this value
527+ pub async fn set_all_hooks_disabled ( & mut self , global : bool , disable : bool ) -> Result < ( ) > {
529528 let config = self . get_config_mut ( global) ;
530529
531530 config
532531 . hooks
533532 . conversation_start
534533 . iter_mut ( )
535534 . chain ( config. hooks . per_prompt . iter_mut ( ) )
536- . for_each ( |h| h. disabled = !enable ) ;
535+ . for_each ( |h| h. disabled = disable ) ;
537536
538537 self . save_config ( global) . await
539538 }
0 commit comments