Skip to content

Commit eb0d50c

Browse files
authored
feat: improve init wizard Enter key behavior (#156)
Update the tool selection wizard so pressing Enter on a highlighted tool automatically selects it before proceeding to the review step. This aligns with common CLI expectations where Enter confirms the highlighted item. Changes: - Add logic to select the currently highlighted tool when Enter is pressed - Update help text to clarify that Enter selects the highlighted tool - Maintain Space key for toggling multiple selections This reduces friction during onboarding by matching user expectations, especially for users who navigate to a tool and press Enter without first toggling it with Space.
1 parent c482f1b commit eb0d50c

File tree

4 files changed

+43
-1
lines changed

4 files changed

+43
-1
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
## Why
2+
- Users frequently scroll to a tool and press Enter without toggling it, resulting in no configuration changes.
3+
- The current workflow deviates from common CLI expectations where Enter confirms the highlighted item.
4+
- Aligning behavior with user expectations reduces friction during onboarding.
5+
6+
## What Changes
7+
- Update the init wizard so pressing Enter on a highlighted tool selects it before moving to the review step.
8+
- Adjust interactive instructions to clarify Enter selects the current tool and Space still toggles selections.
9+
- Refresh specs to capture the clarified behavior for the interactive menu.
10+
11+
## Impact
12+
- Users who press Enter without toggling now configure the highlighted tool instead of exiting with no selections.
13+
- Spacebar multi-select support remains unchanged for power users.
14+
- Documentation better reflects how the wizard behaves.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
## MODIFIED Requirements
2+
### Requirement: Interactive Mode
3+
The command SHALL provide an interactive menu for AI tool selection with clear navigation instructions.
4+
#### Scenario: Displaying interactive menu
5+
- **WHEN** run in fresh or extend mode
6+
- **THEN** present a looping select menu that lets users toggle tools with Space and review selections with Enter
7+
- **AND** when Enter is pressed on a highlighted selectable tool that is not already selected, automatically add it to the selection before moving to review so the highlighted tool is configured
8+
- **AND** label already configured tools with "(already configured)" while keeping disabled options marked "coming soon"
9+
- **AND** change the prompt copy in extend mode to "Which AI tools would you like to add or refresh?"
10+
- **AND** display inline instructions clarifying that Space toggles tools and Enter selects the highlighted tool before reviewing selections
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
## 1. Implementation
2+
- [x] Update the tool selection wizard to auto-select the highlighted tool when Enter is pressed without prior toggles.
3+
- [x] Refresh inline instructions copy so Enter behavior is clear.
4+
- [x] Adjust or add tests if needed to cover the new selection flow.
5+
6+
## 2. Validation
7+
- [x] Run `pnpm run build`.
8+
- [x] Run `pnpm test` (or targeted suite) if applicable.

src/core/init.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,16 @@ const toolSelectionWizard = createPrompt<string[], ToolWizardConfig>(
220220
}
221221

222222
if (isEnterKey(key)) {
223+
const current = config.choices[cursor];
224+
if (
225+
current &&
226+
current.selectable &&
227+
!selectedSet.has(current.value)
228+
) {
229+
const next = new Set(selected);
230+
next.add(current.value);
231+
updateSelected(next);
232+
}
223233
setStep('review');
224234
setError(null);
225235
return;
@@ -298,7 +308,7 @@ const toolSelectionWizard = createPrompt<string[], ToolWizardConfig>(
298308
lines.push(PALETTE.white(config.baseMessage));
299309
lines.push(
300310
PALETTE.midGray(
301-
'Use ↑/↓ to move · Space to toggle · Enter to review selections.'
311+
'Use ↑/↓ to move · Space to toggle · Enter selects highlighted tool and reviews.'
302312
)
303313
);
304314
lines.push('');

0 commit comments

Comments
 (0)