From 2c229bc18084912c43c93c8ef6394cb3576f5a16 Mon Sep 17 00:00:00 2001 From: lihan3238 Date: Tue, 5 May 2026 23:40:03 +0800 Subject: [PATCH] fix(cli): replace all hyphens in shell completion command names The shell completion generators for bash and zsh used `command.replace("-", "__")` which only replaces the first hyphen in command names. For commands with multiple hyphens like `type-check-v2`, this produced `type__check-v2` instead of the correct `type__check__v2`. Partially addresses #6114 --- packages/cli/src/internal/commandDescriptor.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/cli/src/internal/commandDescriptor.ts b/packages/cli/src/internal/commandDescriptor.ts index 5b8437800aa..f696d8b132e 100644 --- a/packages/cli/src/internal/commandDescriptor.ts +++ b/packages/cli/src/internal/commandDescriptor.ts @@ -1081,7 +1081,7 @@ const getBashCompletionsInternal = ( : pipe( info.parentCommands, Arr.append(info.command.name), - Arr.map((command) => command.replace("-", "__")) + Arr.map((command) => command.replaceAll("-", "__")) ) const caseName = Arr.join(preformatted, ",") const funcName = Arr.join(preformatted, "__") @@ -1238,7 +1238,7 @@ const getZshCompletionsInternal = ( : pipe( info.parentCommands, Arr.append(info.command.name), - Arr.map((command) => command.replace("-", "__")) + Arr.map((command) => command.replaceAll("-", "__")) ) const underscoreName = Arr.join(preformatted, "__") const spaceName = Arr.join(preformatted, " ")