From 7289d66676f5ca9d2c5f9e4aa6a07c36b9f65f54 Mon Sep 17 00:00:00 2001 From: gonzaloriestra <14979109+gonzaloriestra@users.noreply.github.com> Date: Sat, 29 Aug 2026 00:39:17 +0000 Subject: [PATCH 1/3] Refactor parseCommand to use early return guard clause Simplify control flow in parseCommand by using an early continue when processing characters inside quoted strings, reducing nesting. --- packages/cli-kit/src/public/node/system.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/cli-kit/src/public/node/system.ts b/packages/cli-kit/src/public/node/system.ts index 4cc5c5384e4..3607b840e87 100644 --- a/packages/cli-kit/src/public/node/system.ts +++ b/packages/cli-kit/src/public/node/system.ts @@ -139,16 +139,16 @@ function parseCommand(command: string): string[] { for (const char of command) { if (inQuote) { if (char === inQuote) { - // End of quoted section inQuote = null } else { current += char } - } else if (char === '"' || char === "'") { - // Start of quoted section + continue + } + + if (char === '"' || char === "'") { inQuote = char } else if (char === ' ' || char === '\t') { - // Whitespace outside quotes - end current token if (current) { result.push(current) current = '' @@ -158,7 +158,6 @@ function parseCommand(command: string): string[] { } } - // Don't forget the last token if (current) { result.push(current) } From 17636d1a4ee8663be977c7d7fd95b7ea35e6d654 Mon Sep 17 00:00:00 2001 From: gonzaloriestra <14979109+gonzaloriestra@users.noreply.github.com> Date: Sat, 29 Aug 2026 00:49:28 +0000 Subject: [PATCH 2/3] Refactor parseCommand to use early return guard clause Simplify control flow in parseCommand by using an early continue when processing characters inside quoted strings, reducing nesting. From 5c0534aa41755c3089a95f6d24a216b776e3e6bf Mon Sep 17 00:00:00 2001 From: gonzaloriestra <14979109+gonzaloriestra@users.noreply.github.com> Date: Sat, 29 Aug 2026 00:59:48 +0000 Subject: [PATCH 3/3] Refactor parseCommand to use early return guard clause Simplify control flow in parseCommand by using an early continue when processing characters inside quoted strings, reducing nesting.