Skip to content

v2.2.1 — UX parser hardening

Choose a tag to compare

@chenliuyun chenliuyun released this 20 Apr 00:30
be3a56f

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-path no longer swallow subcommand names.
    Before: switchbot --profile devices list silently used "devices" as the profile and printed unknown command 'list'.
    After: exits 2 with --profile requires a value but got "devices", which is a subcommand name.

  • --timeout / --retry-on-429 / --max / --port no longer swallow the next argv token.
    Before: switchbot --timeout devices list silently parsed NaN as 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 --help and similar previously exited 1 (or hung on unsettled top-level await). Commander's exitOverride is 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's Unsettled Top-Level Await message.

New UX

  • switchbot devices ls — short alias for devices list.
  • Soft hint for uncached device IDsdevices 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.