"""Check GDScript files for compilation/parse errors via the Godot bridge."""

from __future__ import annotations

from godotiq.bridge.session import get_bridge


async def check_errors(scope: str = "scene") -> dict:
    """Check GDScript files for compilation errors.

    Args:
        scope: "scene" (current scene + autoloads), "project" (all .gd files),
               or a "res://path/to/script.gd" (single file).

    Returns:
        Dict with errors array, total count, scripts_checked, and scope.
    """
    bridge = await get_bridge()
    result = await bridge.request("check_errors", params={"scope": scope})
    return result
