Skip to content

feat: Add searchable autocomplete prompts for selection args - #601

Merged
razor-x merged 1 commit into
mainfrom
claude/interactive-input-nav-lfgrrm
Aug 4, 2026
Merged

feat: Add searchable autocomplete prompts for selection args#601
razor-x merged 1 commit into
mainfrom
claude/interactive-input-nav-lfgrrm

Conversation

@razor-x

@razor-x razor-x commented Aug 4, 2026

Copy link
Copy Markdown
Member

Summary

Enhanced the CLI's interactive prompts to support searchable autocomplete lists with keyboard navigation using Ctrl+p/n (in addition to arrow keys). This improves usability when selecting from long lists of workspaces or servers.

Key Changes

  • New prompt key translation layer (prompt-keys.ts): Translates Ctrl+p and Ctrl+n keypresses to arrow key escape sequences, allowing prompts to recognize these common navigation chords
  • Enhanced search functionality (prompt.ts): Added searchChoices function that filters choices by any whitespace-separated term, matching case-insensitively against both title and description fields
  • Integrated custom input handling: Modified prompt() to use a custom input stream that translates arrow key chords and applies the search function to autocomplete prompts
  • Updated prompt types: Changed workspace and server selection prompts from select to autocomplete type to enable searching through potentially long lists
  • Comprehensive test coverage: Added tests for key translation, search functionality, and end-to-end prompt interactions

Notable Implementation Details

  • The createPromptInput function wraps stdin to intercept keypresses and translate Ctrl+p/n before the prompt library sees them, avoiding the need to modify the underlying prompt library
  • Search matches any part of a choice's title or description, not just prefixes, making it easier to find items by partial names
  • The implementation properly manages terminal state by resuming stdin and cleaning up listeners after prompts complete
  • All existing prompt functionality is preserved; the changes are purely additive

https://claude.ai/code/session_01NgxWoYAQLVsGsNGLBdDYHi

@razor-x
razor-x force-pushed the claude/interactive-input-nav-lfgrrm branch from aeff1c7 to 1606bfa Compare August 4, 2026 19:28
Both were the only lists that could not be searched, while selecting a
device or a command already could.

Searching matches any part of a name rather than only what it starts with,
which is all a list of servers sharing a scheme could be found by.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NgxWoYAQLVsGsNGLBdDYHi
@razor-x
razor-x force-pushed the claude/interactive-input-nav-lfgrrm branch from 1606bfa to 6d94c7f Compare August 4, 2026 19:31
@razor-x razor-x changed the title Add searchable autocomplete prompts with Ctrl+p/n navigation feat: Add searchable autocomplete prompts for selection args Aug 4, 2026
@razor-x
razor-x marked this pull request as ready for review August 4, 2026 21:28
@razor-x
razor-x merged commit f79f696 into main Aug 4, 2026
12 checks passed
@razor-x
razor-x deleted the claude/interactive-input-nav-lfgrrm branch August 5, 2026 05:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants