v2.2.1 — UX parser hardening
What's fixed in v2.2.1
Patch release addressing three token-swallowing UX bugs reported against 2.2.0, plus a short ls alias and a soft hint when commands target devices that aren't in the local cache.
Bug fixes
-
--profile/--config/--fields/--audit-log-pathno longer swallow subcommand names.
Before:switchbot --profile devices listsilently used"devices"as the profile and printedunknown command 'list'.
After: exits 2 with--profile requires a value but got "devices", which is a subcommand name. -
--timeout/--retry-on-429/--max/--portno longer swallow the next argv token.
Before:switchbot --timeout devices listsilently parsedNaNas the timeout.
After: exits 2 with--timeout requires a numeric value, got "devices". -
Subcommand argParser errors now correctly exit 2.
switchbot events mqtt-tail --max --helpand similar previously exited 1 (or hung on unsettled top-level await). Commander'sexitOverrideis now applied recursively to every registered subcommand. -
MQTT
state='failed'now exits 1 cleanly. AWS IoT credential expiry and other transport failures previously surfaced as Node'sUnsettled Top-Level Awaitmessage.
New UX
switchbot devices ls— short alias fordevices list.- Soft hint for uncached device IDs —
devices command <id> ...prints a non-blocking stderr note when<id>isn't in the local cache, so typos surface before the API call.
Under the hood
- New argParser factory (
intArg/durationArg/stringArg/enumArg) centralises required-value validation across all 15 subcommands. - Shell completion scripts (bash / zsh / fish / powershell) now cover every subcommand (including
mcp,events,quota,catalog,cache,doctor,schema,history,plan,capabilities) and every new global flag.
Compatibility
No breaking changes. No new public API, no new dependencies. 720/720 tests passing.
Full changelog
See commit history for details.