from __future__ import annotations

from pathlib import Path

import yaml


def test_allegro_config_targets_kimi_house() -> None:
    config = yaml.safe_load(Path("wizards/allegro/config.yaml").read_text())

    assert config["model"]["provider"] == "kimi-coding"
    assert config["model"]["default"] == "kimi-for-coding"
    assert config["platforms"]["api_server"]["extra"]["port"] == 8645


def test_allegro_service_uses_isolated_home() -> None:
    text = Path("wizards/allegro/hermes-allegro.service").read_text()

    assert "HERMES_HOME=/root/wizards/allegro/home" in text
    assert "hermes gateway run --replace" in text


def test_deploy_script_requires_external_secret() -> None:
    text = Path("bin/deploy-allegro-house.sh").read_text()

    assert "~/.config/kimi/api_key" in text
    assert "sk-kimi-" not in text