Set the default integration without uninstalling other integrations.
(
key: str = typer.Argument(help="Installed integration key to make the default"),
force: bool = typer.Option(False, "--force", help="Overwrite existing shared infrastructure files, including customizations, while changing the default"),
)
| 205 | |
| 206 | @integration_app.command("use") |
| 207 | def integration_use( |
| 208 | key: str = typer.Argument(help="Installed integration key to make the default"), |
| 209 | force: bool = typer.Option(False, "--force", help="Overwrite existing shared infrastructure files, including customizations, while changing the default"), |
| 210 | ): |
| 211 | """Set the default integration without uninstalling other integrations.""" |
| 212 | from . import get_integration |
| 213 | from .. import _require_specify_project |
| 214 | |
| 215 | project_root = _require_specify_project() |
| 216 | current = _read_integration_json(project_root) |
| 217 | installed_keys = _installed_integration_keys(current) |
| 218 | if key not in installed_keys: |
| 219 | console.print(f"[red]Error:[/red] Integration '{key}' is not installed.") |
| 220 | if installed_keys: |
| 221 | console.print(f"[yellow]Installed integrations:[/yellow] {', '.join(installed_keys)}") |
| 222 | else: |
| 223 | console.print("Install one with: [cyan]specify integration install <key>[/cyan]") |
| 224 | raise typer.Exit(1) |
| 225 | |
| 226 | integration = get_integration(key) |
| 227 | if integration is None: |
| 228 | console.print(f"[red]Error:[/red] Unknown integration '{key}'") |
| 229 | raise typer.Exit(1) |
| 230 | |
| 231 | raw_options, parsed_options = _resolve_integration_options(integration, current, key, None) |
| 232 | _set_default_integration_or_exit( |
| 233 | project_root, |
| 234 | current, |
| 235 | key, |
| 236 | integration, |
| 237 | installed_keys, |
| 238 | raw_options=raw_options, |
| 239 | parsed_options=parsed_options, |
| 240 | refresh_templates_force=force, |
| 241 | refresh_hint=( |
| 242 | "To overwrite customizations, re-run with " |
| 243 | f"[cyan]specify integration use {key} --force[/cyan]." |
| 244 | ), |
| 245 | ) |
| 246 | _register_extensions_for_agent( |
| 247 | project_root, |
| 248 | key, |
| 249 | continuing="The integration was selected, but installed extensions may need re-registration.", |
| 250 | ) |
| 251 | console.print(f"[green]✓[/green] Default integration set to [bold]{key}[/bold].") |
| 252 | |
| 253 | |
| 254 | # ===== Integration catalog discovery commands ===== |
nothing calls this directly
no test coverage detected