From daf36918413ad60a081e960b21af420468904f41 Mon Sep 17 00:00:00 2001 From: Tommaso Sciortino Date: Mon, 23 Mar 2026 17:25:31 +0000 Subject: [PATCH] fix: "allow always" for commands with paths (#23558) --- packages/core/src/utils/shell-utils.test.ts | 6 ++++-- packages/core/src/utils/shell-utils.ts | 6 +----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/packages/core/src/utils/shell-utils.test.ts b/packages/core/src/utils/shell-utils.test.ts index 81b43abf50..933ca84817 100644 --- a/packages/core/src/utils/shell-utils.test.ts +++ b/packages/core/src/utils/shell-utils.test.ts @@ -119,8 +119,10 @@ describe('getCommandRoots', () => { expect(getCommandRoots('ls -l')).toEqual(['ls']); }); - it('should handle paths and return the binary name', () => { - expect(getCommandRoots('/usr/local/bin/node script.js')).toEqual(['node']); + it('should handle paths and return the full path', () => { + expect(getCommandRoots('/usr/local/bin/node script.js')).toEqual([ + '/usr/local/bin/node', + ]); }); it('should return an empty array for an empty string', () => { diff --git a/packages/core/src/utils/shell-utils.ts b/packages/core/src/utils/shell-utils.ts index 89f50a9ce7..d2b28a348c 100644 --- a/packages/core/src/utils/shell-utils.ts +++ b/packages/core/src/utils/shell-utils.ts @@ -264,11 +264,7 @@ function normalizeCommandName(raw: string): string { return raw.slice(1, -1); } } - const trimmed = raw.trim(); - if (!trimmed) { - return trimmed; - } - return trimmed.split(/[\\/]/).pop() ?? trimmed; + return raw.trim(); } function extractNameFromNode(node: Node): string | null {