From 63998954570e4ac8273460e24a3aac9053d6f180 Mon Sep 17 00:00:00 2001 From: JoeVenner Date: Tue, 21 Apr 2026 18:06:18 +0100 Subject: [PATCH 1/2] fix(skills,cli,tests): address pre-publish review issues - Remove duplicate/conflicting petfeeder pitfall lines (1-10 vs 1-60) - Skip MCP tests gracefully when optional mcp dependency is missing - Move DeviceController instantiation after device existence check --- src/iotcli/cli/commands/control.py | 3 ++- src/iotcli/skills/generator.py | 1 - tests/test_mcp.py | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/iotcli/cli/commands/control.py b/src/iotcli/cli/commands/control.py index e882496..984e4b6 100644 --- a/src/iotcli/cli/commands/control.py +++ b/src/iotcli/cli/commands/control.py @@ -37,12 +37,13 @@ def control(ctx, action, device_name, value): """Control a device: on, off, status, set property=value.""" out = Output(ctx.obj["json_output"]) cfg: ConfigManager = ctx.obj["config"] - ctrl = DeviceController(verbose=ctx.obj["verbose"], debug=ctx.obj["debug"]) device = cfg.get_device_or_none(device_name) if not device: out.error(f"Device not found: {device_name}") + ctrl = DeviceController(verbose=ctx.obj["verbose"], debug=ctx.obj["debug"]) + try: if action == "on": if not out.json_mode: diff --git a/src/iotcli/skills/generator.py b/src/iotcli/skills/generator.py index be92df7..97b841c 100644 --- a/src/iotcli/skills/generator.py +++ b/src/iotcli/skills/generator.py @@ -159,7 +159,6 @@ def build_device_context(device: Device) -> dict[str, Any]: "petfeeder": [ "`on` triggers exactly **one quick portion** — it does NOT let you choose the amount.", "To dispense a specific amount use `set \"portions=N\"` (N = 1–10). This is the correct command for scheduled or on-demand feeding.", - "To dispense a specific amount use `set \"portions=N\"` (N = 1–60). This is the correct command for scheduled or on-demand feeding.", "Always query status first to check `food_level` before feeding — dispense may fail silently if the hopper is empty.", ], "airfryer": [ diff --git a/tests/test_mcp.py b/tests/test_mcp.py index 2a429ed..1c17724 100644 --- a/tests/test_mcp.py +++ b/tests/test_mcp.py @@ -11,6 +11,8 @@ import json import pytest +pytest.importorskip("mcp") + from iotcli.config.manager import ConfigManager from iotcli.core.device import Device, DeviceStatus from iotcli.mcp.tools import list_tools, handle_tool From 1b486df679db378931d61e7c16923a1d75e1c3ae Mon Sep 17 00:00:00 2001 From: JoeVenner Date: Tue, 21 Apr 2026 18:15:46 +0100 Subject: [PATCH 2/2] Update src/iotcli/cli/commands/control.py Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> --- src/iotcli/cli/commands/control.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/iotcli/cli/commands/control.py b/src/iotcli/cli/commands/control.py index 984e4b6..5a76970 100644 --- a/src/iotcli/cli/commands/control.py +++ b/src/iotcli/cli/commands/control.py @@ -38,10 +38,11 @@ def control(ctx, action, device_name, value): out = Output(ctx.obj["json_output"]) cfg: ConfigManager = ctx.obj["config"] + device = cfg.get_device_or_none(device_name) device = cfg.get_device_or_none(device_name) if not device: out.error(f"Device not found: {device_name}") - + return ctrl = DeviceController(verbose=ctx.obj["verbose"], debug=ctx.obj["debug"]) try: