"""Startup flow — first-run checks for auth and telemetry."""

from __future__ import annotations

from pathlib import Path

from ievo.core.global_config import get_config
from ievo.core.telemetry import init_sentry


def ensure_startup(home: Path) -> None:
    """Run first-time setup checks. Idempotent — skips already-configured steps.

    1. Claude auth check (if not configured)
    2. Telemetry opt-in (if not asked yet)
    3. Initialize Sentry (if enabled)
    """
    # Claude auth
    if get_config(home, "claude_auth") is None:
        from ievo.core.claude_auth import prompt_claude_auth

        prompt_claude_auth(home)

    # Telemetry
    if get_config(home, "telemetry") is None:
        from ievo.core.telemetry import prompt_telemetry

        prompt_telemetry(home)

    # Initialize Sentry (no-op if disabled or already initialized)
    init_sentry(home)
