From 7acee51e9ef442c0f7762de4c290c0202843590e Mon Sep 17 00:00:00 2001 From: Martijn de Boer Date: Wed, 13 May 2026 07:38:26 +0200 Subject: [PATCH 1/2] fix: guard against undefined error in yargs fail callback Running `smartthings` or `smartthings -h` without a subcommand crashed with a TypeError instead of showing usage help. Co-Authored-By: Claude Sonnet 4.6 --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 3f6f8708..cec45ce4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -32,7 +32,7 @@ export const buildInstance = (commands: CommandModule[]): Argv => { /* eslint-enable @typescript-eslint/naming-convention */ .completion('generate-completions-script', 'output completion script setup') .fail((message, error, yargs) => { - if ('isAxiosError' in error && error.isAxiosError) { + if (error && 'isAxiosError' in error && error.isAxiosError) { // We don't print axiosError.message here because it just duplicates the things // we're displaying but unformatted. const axiosError = error as AxiosError From 5c9021f7d7410e67d3dc42148a613e85ffa44aea Mon Sep 17 00:00:00 2001 From: Martijn de Boer Date: Wed, 13 May 2026 07:47:42 +0200 Subject: [PATCH 2/2] chore: add changeset for fail callback fix Co-Authored-By: Claude Sonnet 4.6 --- .changeset/fix-undefined-error-in-fail-callback.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/fix-undefined-error-in-fail-callback.md diff --git a/.changeset/fix-undefined-error-in-fail-callback.md b/.changeset/fix-undefined-error-in-fail-callback.md new file mode 100644 index 00000000..f0745e34 --- /dev/null +++ b/.changeset/fix-undefined-error-in-fail-callback.md @@ -0,0 +1,5 @@ +--- +"@smartthings/cli": patch +--- + +Fix TypeError crash when running `smartthings` or `smartthings -h` without a subcommand. Yargs passes `undefined` as the error argument to the `.fail()` callback for validation failures; the `in` operator threw when the operand was `undefined`.