66
77import typer
88
9- from code_assistant_manager .cli .option_utils import (
10- ensure_project_dir ,
11- resolve_level_targets ,
12- )
9+ from code_assistant_manager .cli .option_utils import ensure_project_dir
1310from code_assistant_manager .prompts import PromptManager
1411
1512logger = logging .getLogger (__name__ )
2623VALID_LEVELS = ["user" , "project" ]
2724
2825
26+ def _build_targets (
27+ app : Optional [str ],
28+ level : Optional [str ],
29+ project_dir : Optional [Path ],
30+ ) -> List [Dict ]:
31+ """Build target list for uninstallation."""
32+ targets = []
33+ apps = [app ] if app else VALID_APP_TYPES
34+ levels = [level ] if level else VALID_LEVELS
35+
36+ for a in apps :
37+ for l in levels :
38+ targets .append ({"app" : a , "level" : l , "project_dir" : project_dir })
39+
40+ return targets
41+
42+
2943def uninstall_prompt (
3044 target : str = typer .Option (
3145 ...,
@@ -77,11 +91,11 @@ def uninstall_prompt(
7791
7892 # Determine what to uninstall
7993 if target == "all" :
80- targets = resolve_level_targets (None , None , project_dir )
94+ targets = _build_targets (None , None , project_dir )
8195 elif target == "app" :
82- targets = resolve_level_targets (app , None , project_dir )
96+ targets = _build_targets (app , None , project_dir )
8397 elif target == "level" :
84- targets = resolve_level_targets (None , level , project_dir )
98+ targets = _build_targets (None , level , project_dir )
8599
86100 if not targets :
87101 typer .echo ("No targets found to uninstall." )
@@ -94,8 +108,8 @@ def uninstall_prompt(
94108 typer .echo ("No prompts found to uninstall." )
95109 return
96110
97- # Show what will be removed and confirm
98- if not _confirm_uninstall (all_targets ):
111+ # Show what will be removed and confirm (skip if force)
112+ if not force and not _confirm_uninstall (all_targets ):
99113 typer .echo ("Uninstall cancelled." )
100114 return
101115
@@ -119,7 +133,7 @@ def _collect_uninstall_targets(targets: List[Dict]) -> List[Dict]:
119133 for prompt in prompts :
120134 all_targets .append (
121135 {
122- "prompt_id" : prompt .prompt_id ,
136+ "prompt_id" : prompt .id ,
123137 "app" : app ,
124138 "level" : level ,
125139 "project_dir" : project_dir ,
0 commit comments