MCPcopy Index your code
hub / github.com/github/spec-kit / _set_default_integration

Function _set_default_integration

src/specify_cli/integrations/_helpers.py:285–329  ·  view source on GitHub ↗

Persist *key* as default and align active runtime metadata.

(
    project_root: Path,
    state: dict[str, Any],
    key: str,
    integration: Any,
    installed_keys: list[str],
    *,
    script_type: str | None = None,
    raw_options: str | None = None,
    parsed_options: dict[str, Any] | None = None,
    refresh_templates: bool = True,
    refresh_templates_force: bool = False,
    refresh_hint: str | None = None,
)

Source from the content-addressed store, hash-verified

283# ---------------------------------------------------------------------------
284
285def _set_default_integration(
286 project_root: Path,
287 state: dict[str, Any],
288 key: str,
289 integration: Any,
290 installed_keys: list[str],
291 *,
292 script_type: str | None = None,
293 raw_options: str | None = None,
294 parsed_options: dict[str, Any] | None = None,
295 refresh_templates: bool = True,
296 refresh_templates_force: bool = False,
297 refresh_hint: str | None = None,
298) -> None:
299 """Persist *key* as default and align active runtime metadata."""
300 from .. import _install_shared_infra
301 resolved_script = _resolve_integration_script_type(project_root, state, key, script_type)
302 settings = _with_integration_setting(
303 state,
304 key,
305 integration,
306 script_type=resolved_script,
307 raw_options=raw_options,
308 parsed_options=parsed_options,
309 )
310
311 if refresh_templates:
312 try:
313 _install_shared_infra(
314 project_root,
315 resolved_script,
316 invoke_separator=_invoke_separator_for_integration(
317 integration, {"integration_settings": settings}, key, parsed_options
318 ),
319 force=refresh_templates_force,
320 refresh_managed=True,
321 refresh_hint=refresh_hint,
322 )
323 except (ValueError, OSError) as exc:
324 raise _SharedTemplateRefreshError(
325 f"Failed to refresh shared infrastructure for '{key}': {exc}"
326 ) from exc
327
328 _write_integration_json(project_root, key, installed_keys, settings)
329 _update_init_options_for_integration(project_root, integration, script_type=resolved_script)
330
331
332def _set_default_integration_or_exit(*args: Any, **kwargs: Any) -> None:

Callers 2

integration_switchFunction · 0.85

Tested by

no test coverage detected