From 7c0e5d5e1d7a7e1d59d72b998a97606b8ec0b1bd Mon Sep 17 00:00:00 2001 From: Davor Racic Date: Fri, 6 Feb 2026 14:27:51 +0100 Subject: [PATCH] fix: make SPACE key toggle selections in autocomplete multiselect prompts (#1557) - Override _isActionKey to treat SPACE as an action key instead of search input, and add key handler to toggle selections when not navigating - update IDE selection prompt message from "Select tools:" to "Integrate with:". --- tools/cli/lib/prompts.js | 19 +++++++++++++++++++ tools/cli/lib/ui.js | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/tools/cli/lib/prompts.js b/tools/cli/lib/prompts.js index 7ab2d21e..c51d68d1 100644 --- a/tools/cli/lib/prompts.js +++ b/tools/cli/lib/prompts.js @@ -322,6 +322,25 @@ async function autocompleteMultiselect(options) { }, }); + // === FIX: Make SPACE always act as selection key (not search input) === + // Override _isActionKey to treat SPACE like TAB - always an action key + // This prevents SPACE from being added to the search input + const originalIsActionKey = prompt._isActionKey.bind(prompt); + prompt._isActionKey = function (char, key) { + if (key && key.name === 'space') { + return true; + } + return originalIsActionKey(char, key); + }; + + // Handle SPACE toggle when NOT navigating (internal code only handles it when isNavigating=true) + prompt.on('key', (char, key) => { + if (key && key.name === 'space' && !prompt.isNavigating && prompt.focusedValue !== undefined) { + prompt.toggleSelected(prompt.focusedValue); + } + }); + // === END FIX === + const result = await prompt.prompt(); await handleCancel(result); return result; diff --git a/tools/cli/lib/ui.js b/tools/cli/lib/ui.js index 2ed7ab9f..811931f5 100644 --- a/tools/cli/lib/ui.js +++ b/tools/cli/lib/ui.js @@ -634,7 +634,7 @@ class UI { // Interactive mode const interactiveSelectedIdes = await prompts.autocompleteMultiselect({ - message: 'Select tools:', + message: 'Integrate with:', options: allToolOptions, initialValues: configuredIdes.length > 0 ? configuredIdes : undefined, required: false,