"""Verifier handlers (#184–#186, #192).

Thin MCP-tool wrappers over the pure verifiers in
``active_claude_github_mcp.validators``. The verifiers themselves are
sync (pure-CPU, no IO) and live separately so they can be unit-tested
without dragging the MCP / handler / context surface in.
"""
from __future__ import annotations

from mcp.types import TextContent

from ...context import ServerContext
from ...validators.diff import verify_diff_covers_plan as _verify_diff
from ...validators.plan import verify_plan_completeness as _verify_plan
from ..helpers import ok


async def verify_plan_completeness(
    ctx: ServerContext,
    plan_body: str,
) -> list[TextContent]:
    """Run the deterministic plan-frontmatter verifier (#184).

    Returns the structured report from
    ``validators.plan.verify_plan_completeness`` wrapped in an MCP
    ``TextContent`` payload. Handler is async by MCP convention even
    though the underlying verifier is pure-CPU sync.
    """
    return ok(_verify_plan(plan_body))


async def verify_diff_covers_plan(
    ctx: ServerContext,
    plan_body: str,
    diff_text: str,
    evidence_text: str = "",
) -> list[TextContent]:
    """Run the deterministic plan-vs-diff comparator (#185).

    Sibling of ``verify_plan_completeness``. Pure-CPU sync verifier
    wrapped in an async handler per MCP convention.
    """
    return ok(_verify_diff(plan_body, diff_text, evidence_text))
