@@ -73,7 +73,6 @@ def simple_edit_distance(s1: str, s2: str) -> int:
7373@click .option ( 
7474    "--add-scope" , 
7575    "-a" , 
76-     "--add_scope" , 
7776    multiple = True , 
7877    cls = MutuallyExclusiveOption , 
7978    mutually_exclusive = ["remove_scope" ], 
@@ -82,22 +81,26 @@ def simple_edit_distance(s1: str, s2: str) -> int:
8281@click .option ( 
8382    "--remove-scope" , 
8483    "-r" , 
85-     "--remove_scope" , 
8684    multiple = True , 
8785    cls = MutuallyExclusiveOption , 
8886    mutually_exclusive = ["add_scope" ], 
8987    help = "Remove scopes: -r capability_id::scope (repeatable)." , 
9088) 
91- @click .option ("-n" , "--dry-run" , is_flag = True , help = "Show planned changes only (File diff, no write)." ) 
92- @click .option ("--config" , type = click .Path (path_type = Path ), default = Path ("agentup.yml" ), show_default = True ) 
89+ @click .option ("-n" , "--dry-run" , is_flag = True , help = "Show planned changes without writing to the file." ) 
90+ @click .option ( 
91+     "--config" , 
92+     type = click .Path (path_type = Path , readable = True , dir_okay = False , file_okay = True ), 
93+     default = Path ("agentup.yml" ), 
94+     show_default = True , 
95+ ) 
9396@click .pass_context  
9497def  manage (
9598    ctx : click .Context ,
9699    plugin_name : str ,
97100    add_scope : tuple [str , ...],
98101    remove_scope : tuple [str , ...],
99102    dry_run : bool ,
100-     config : Path   |   None ,
103+     config : Path ,
101104):
102105    """Add or remove scopes on a plugin capability in agentup.yml. 
103106
@@ -106,8 +109,12 @@ def manage(
106109    agentup plugin manage brave_search -a search_images::search:images:query 
107110    agentup plugin manage brave_search -r search_internet::search:web:query 
108111    """ 
109-     # Resolve config path 
110-     intent_config_path  =  config  if  config  else  (Path .cwd () /  "agentup.yml" )
112+ 
113+     intent_config_path  =  config .resolve ()
114+ 
115+     if  not  intent_config_path .is_file ():
116+         click .secho (f"Configuration file not found at '{ intent_config_path }  , fg = "red" )
117+         ctx .exit (1 )
111118
112119    # Load config 
113120    try :
@@ -117,7 +124,7 @@ def manage(
117124        ctx .exit (1 )
118125
119126    # Validate plugin exists in config 
120-     if  not   intent_config . plugins   or   plugin_name  not  in intent_config .plugins :
127+     if  plugin_name  not  in intent_config .plugins :
121128        click .secho (f"Plugin '{ plugin_name } { intent_config_path }  , fg = "red" )
122129        ctx .exit (1 )
123130
@@ -163,11 +170,9 @@ def manage(
163170            click .secho (f"Capability '{ capability_id } { plugin_name }  , fg = "yellow" )
164171            continue 
165172        cap_override  =  plugin_override .capabilities [capability_id ]
166-         scopes  =  cap_override .required_scopes  or  []
167-         if  scope_name  in  scopes :
173+         if  cap_override .required_scopes  and  scope_name  in  cap_override .required_scopes :
168174            planned_changes .append (f"DROP scope '{ scope_name } { capability_id } { plugin_name }  )
169-             scopes .remove (scope_name )
170-             cap_override .required_scopes  =  scopes 
175+             cap_override .required_scopes  =  scope_name 
171176            changed  =  True 
172177        else :
173178            click .secho (
0 commit comments