"""Loads the hyphenated `model-router.py` hook as an importable module.

The hook ships as `packages/cli/hooks/model-router.py` (hyphenated to match
the operator-local `~/.claude/hooks/` filename convention). A hyphen is not a
legal module-name char, so a plain `import` cannot reach it. Load it by path.

Stdlib-only so the tests run under either `pytest` (CI / the kg-service
Docker image) or a bare `python3 -m unittest` on any host — no third-party
dependency, fully offline.
"""

from __future__ import annotations

import importlib.util
from pathlib import Path
from types import ModuleType

_HOOK_PATH = Path(__file__).resolve().parent.parent / "model-router.py"


def load_model_router() -> ModuleType:
    spec = importlib.util.spec_from_file_location("model_router_hook", _HOOK_PATH)
    assert spec is not None and spec.loader is not None
    module = importlib.util.module_from_spec(spec)
    spec.loader.exec_module(module)
    return module
