Improve type safety and fix minor issues in beads-mcp
Type Safety Improvements: - Change dict → dict[str, Any] throughout codebase for explicit typing - Add PEP 561 py.typed marker file to export type information - Add types-requests to dev dependencies - Improve signal handler typing (FrameType | None) - Improve decorator typing (Callable[..., Awaitable[T]]) - Add quickstart() abstract method to BdClientBase for interface completeness Bug Fixes: - Fix variable shadowing: beads_dir → local_beads_dir in bd_client.py - Improve error handling in mail.py:_call_agent_mail() to prevent undefined error - Make working_dir required (not Optional) in BdDaemonClient - Remove unnecessary 'or' defaults for required Pydantic fields Validation: - mypy passes with no errors - All unit tests passing - Daemon quickstart returns helpful static text (RPC doesn't support this command)
This commit is contained in:
@@ -7,7 +7,7 @@ import subprocess
|
||||
import sys
|
||||
from contextvars import ContextVar
|
||||
from functools import lru_cache
|
||||
from typing import Annotated, TYPE_CHECKING
|
||||
from typing import Annotated, Any, TYPE_CHECKING
|
||||
|
||||
from .bd_client import create_bd_client, BdClientBase, BdError
|
||||
|
||||
@@ -516,7 +516,7 @@ async def beads_blocked() -> list[BlockedIssue]:
|
||||
return await client.blocked()
|
||||
|
||||
|
||||
async def beads_inspect_migration() -> dict:
|
||||
async def beads_inspect_migration() -> dict[str, Any]:
|
||||
"""Get migration plan and database state for agent analysis.
|
||||
|
||||
AI agents should:
|
||||
@@ -531,7 +531,7 @@ async def beads_inspect_migration() -> dict:
|
||||
return await client.inspect_migration()
|
||||
|
||||
|
||||
async def beads_get_schema_info() -> dict:
|
||||
async def beads_get_schema_info() -> dict[str, Any]:
|
||||
"""Get current database schema for inspection.
|
||||
|
||||
Returns tables, schema version, config, sample issue IDs, and detected prefix.
|
||||
@@ -543,7 +543,7 @@ async def beads_get_schema_info() -> dict:
|
||||
|
||||
async def beads_repair_deps(
|
||||
fix: Annotated[bool, "If True, automatically remove orphaned dependencies"] = False,
|
||||
) -> dict:
|
||||
) -> dict[str, Any]:
|
||||
"""Find and optionally fix orphaned dependency references.
|
||||
|
||||
Scans all issues for dependencies pointing to non-existent issues.
|
||||
@@ -560,7 +560,7 @@ async def beads_repair_deps(
|
||||
|
||||
async def beads_detect_pollution(
|
||||
clean: Annotated[bool, "If True, delete detected test issues"] = False,
|
||||
) -> dict:
|
||||
) -> dict[str, Any]:
|
||||
"""Detect test issues that leaked into production database.
|
||||
|
||||
Detects test issues using pattern matching:
|
||||
@@ -578,7 +578,7 @@ async def beads_detect_pollution(
|
||||
async def beads_validate(
|
||||
checks: Annotated[str | None, "Comma-separated list of checks (orphans,duplicates,pollution,conflicts)"] = None,
|
||||
fix_all: Annotated[bool, "If True, auto-fix all fixable issues"] = False,
|
||||
) -> dict:
|
||||
) -> dict[str, Any]:
|
||||
"""Run comprehensive database health checks.
|
||||
|
||||
Available checks:
|
||||
|
||||
Reference in New Issue
Block a user