Skip to content

Conversation

@midaz
Copy link
Contributor

@midaz midaz commented Aug 24, 2025

I added tab completion functionality to the CLI UX to better emulate a terminal:

Features

Command Completion: Type partial commands and tab to complete

  • he + Tab → shows head and help, then cycles through them
  • l + Tab → shows less, locate, ls, then cycles through them
  • Single matches auto-complete with a space

Argument Completion: Tab completion for command arguments

  • File commands (ls, cat, less, etc.) → completes filenames
  • whois → completes team member names
  • tldr → completes portfolio company names
  • cd → completes directory names

Smart Cycling: Multiple tabs cycle through options on the same line

  • First Tab: Shows all available options
  • Subsequent Tabs: Cycles through each option
  • Enter: Executes the selected command

JS Implementation

  • Added simple state tracking (tabIndex, tabOptions, tabBase) in
    terminal-ext.js
  • Enhanced tab handler in terminal.js with cycling logic
  • Resets completion state on any non-tab key press

Testing

Try these examples:

  1. Type who + Tab → completes to who, Tab again → cycles between whois
    and whoami
  2. Type e + Tab → shows all 'e' commands, Tab again → cycles through them
  3. Type ls + Tab → completes to ls , Tab again → shows files

- Implements cycling through multiple completion options
- Supports command completion (e.g., 'he' → 'help', 'head')
- Supports argument completion for file commands (ls, cat, less, etc.)
- Supports argument completion for whois, tldr, and other commands
- Maintains simple state tracking with tabIndex, tabOptions, and tabBase
- Resets completion state on any non-tab key press

This makes the CLI behave more like a real terminal where users can:
- Press Tab to see available completions
- Press Tab repeatedly to cycle through options
- Hit Enter to execute the selected command
@ledwards ledwards self-assigned this Aug 28, 2025
@ledwards
Copy link
Contributor

Ok this is amazing. And helpful PR notes! Well done.

Works perfect locally. 🚢

@ledwards ledwards merged commit fb59a36 into rootvc:main Aug 28, 2025
4 checks passed
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