From 6ee1f91c0446c2e0a5b3e7bda56fa66694788a8c Mon Sep 17 00:00:00 2001 From: DevForge Engineer Date: Mon, 18 May 2026 16:23:34 -0400 Subject: [PATCH] fix(cli): replace undefined 'typer' references with 'click' in MCP error handler MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The mcp() command referenced typer.echo and typer.Exit but never imported typer. This caused a NameError when click-to-mcp was not installed, masking the helpful install instruction. Since the project uses Click (not Typer), switched to click.echo and click.Exit. Fixes: - F821: Undefined name 'typer' → use click.echo / click.Exit - B904: raise from None to suppress exception chain - I001: auto-fixed import sort in _render_costs --- src/deploydiff/cli.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/deploydiff/cli.py b/src/deploydiff/cli.py index 4e45b08..8b97d0d 100644 --- a/src/deploydiff/cli.py +++ b/src/deploydiff/cli.py @@ -112,8 +112,8 @@ def mcp(): try: from click_to_mcp import serve_stdio except ImportError: - typer.echo("Error: click-to-mcp is required for MCP support. Install with: pip install click-to-mcp", err=True) - raise typer.Exit(code=1) + click.echo("Error: click-to-mcp is required for MCP support. Install with: pip install click-to-mcp", err=True) + raise click.Exit(code=1) from None serve_stdio(main, name="deploydiff") @@ -144,8 +144,8 @@ def _load_plan( def _render_costs(estimates: list[CostEstimate], plan: DeployPlan, console: Console) -> None: """Render cost estimates to the console.""" - from rich.table import Table from rich import box + from rich.table import Table table = Table(title="Cost Impact Estimate", box=box.ROUNDED, show_header=True) table.add_column("Resource", style="bold")