@@ -222,7 +222,7 @@ def _derive_target_repo_from_url(zip_url: str) -> str:
222222
223223
224224def sync_team_ai_directives (
225- repo_url : str , project_root : Path , * , install : bool = True , skip_tls : bool = False
225+ repo_url : str , project_root : Path , * , install : bool = True , force : bool = False
226226) -> tuple [str , Path ]:
227227 """Install team-ai-directives as extension from ZIP URL or local path.
228228
@@ -231,7 +231,8 @@ def sync_team_ai_directives(
231231 project_root: Project root directory
232232 install: If True, copy local directories to .specify/extensions/.
233233 If False, use local directories in-place (reference mode).
234- skip_tls: Skip TLS verification (for HTTPS URLs)
234+ force: If True, remove existing team-ai-directives before reinstalling.
235+ If False (default), raise error if already installed.
235236
236237 Returns:
237238 Tuple of (status, path) where status is "installed", "local", or "reference"
@@ -266,6 +267,11 @@ def sync_team_ai_directives(
266267 # Install mode: copy to .specify/extensions/
267268 ext_manager = ExtensionManager (project_root )
268269 speckit_version = get_speckit_version ()
270+
271+ # Force override: remove existing team-ai-directives before reinstalling
272+ if force and ext_manager .registry .is_installed (TEAM_DIRECTIVES_DIRNAME ):
273+ ext_manager .remove (TEAM_DIRECTIVES_DIRNAME )
274+
269275 manifest = ext_manager .install_from_directory (
270276 potential_path , speckit_version , priority = 1
271277 )
@@ -279,6 +285,10 @@ def sync_team_ai_directives(
279285 ext_manager = ExtensionManager (project_root )
280286 speckit_version = get_speckit_version ()
281287
288+ # Force override: remove existing team-ai-directives before reinstalling
289+ if force and ext_manager .registry .is_installed (TEAM_DIRECTIVES_DIRNAME ):
290+ ext_manager .remove (TEAM_DIRECTIVES_DIRNAME )
291+
282292 download_dir = project_root / ".specify" / "extensions" / ".cache" / "downloads"
283293 download_dir .mkdir (parents = True , exist_ok = True )
284294 zip_path = download_dir / "team-ai-directives-download.zip"
0 commit comments