feat: Enhanced Tab Completion for Interactive Mode
Maintainers usually reply within 1 day
@inureyes is already working on this.
Since Dec 16, 2025.
Assessment
This issue has not been assessed yet.
Description
Overview
Implement advanced tab completion capabilities for bssh's interactive mode, including remote path completion, command completion based on remote $PATH, and history-based completion suggestions. This will significantly improve the user experience by providing context-aware autocompletion similar to modern shells.
Technical Approach
Architecture Design
The implementation will use rustyline's built-in completion framework with custom completers that leverage SSH channels to fetch remote information. We'll implement a multi-tiered completion system:
-
Completion Engine Architecture
- Create a composite completer that delegates to specialized completers based on context
- Cache remote data to minimize SSH round-trips
- Implement async completion fetching with timeout handling
- Use a priority system: history > remote paths > remote commands
-
Data Caching Strategy
- Cache remote $PATH directories and executables for 5 minutes
- Cache recently accessed directory listings for 1 minute
- Maintain a sliding window of command history (last 1000 commands)
- Implement cache invalidation on directory changes
-
Context Detection
- Parse current command line to determine completion context
- Detect if completing a command, path, or argument
- Handle special characters and escape sequences
- Support both absolute and relative path completion
Key Features
- Tab completion for remote paths with <100ms latency (cached)
- Command completion includes all executables in remote $PATH
- History-based suggestions appear within 50ms
- Completion works correctly across node switches
- Cache persists between sessions
Implementation Phases
Phase 1: Foundation and Architecture
- Create completion module structure at
src/completion/mod.rs - Implement context parser at
src/completion/parser.rs - Create cache manager at
src/completion/cache.rs - Implement SSH data fetcher at
src/completion/remote_fetcher.rs
Phase 2: Core Completion Implementations
- Implement remote path completer at
src/completion/path_completer.rs - Implement remote command completer at
src/completion/command_completer.rs - Implement history-based completer at
src/completion/history_completer.rs - Create composite completer at
src/completion/composite_completer.rs
Phase 3: Integration with Interactive Mode
- Extend
InteractiveCommandto use custom completer - Add completion configuration to
InteractiveConfig - Implement async completion updates
- Add multi-node completion support
Phase 4: Advanced Features and Optimization
- Implement smart completion features (git, docker, kubectl argument completion)
- Add visual completion enhancements (color-coding, hints, preview)
- Optimize performance (incremental updates, bloom filters, batching)
- Add completion debugging and metrics
Phase 5: Testing & Polish
- Write comprehensive unit tests
- Add integration tests
- Update documentation
- Polish user experience
Dependencies
External Dependencies
rustyline = "17.0"- Already present, provides completion framework- Consider adding
fuzzy-matcher = "0.3"for fuzzy history matching - Consider adding
lru = "0.12"for LRU cache implementation - May need
shellexpand = "3.1"for path expansion
Internal Dependencies
- Existing SSH client implementation (
src/ssh/tokio_client/) - Existing interactive mode infrastructure (
src/commands/interactive.rs) - Configuration system (
src/config.rs) - Node session management
Success Criteria
Functional Requirements
- Tab completion works for remote paths with <100ms latency (cached)
- Command completion includes all executables in remote $PATH
- History-based suggestions appear within 50ms
- Completion works correctly across node switches
- Cache persists between sessions
Performance Benchmarks
- Initial PATH scan completes within 2 seconds
- Subsequent completions served from cache in <10ms
- Memory usage for caches stays under 50MB
- No blocking of interactive input during completion
- Support for directories with 10,000+ files
User Experience
- Completion feels as responsive as local shell
- Clear visual feedback for completion types
- Intuitive behavior matching user expectations
- Graceful handling of network issues
- Consistent behavior across all nodes
Related Work
- Original task document:
.claude/tasks/todo/1_enhanced_tab_completion.md
- Dominant language
- Rust
- Stars
- 71
- Forks
- 7
- Avg merge
- 4h 51m
- Merged PRs (30d)
- 14
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from lablup/bssh
-
feat(ssh): add webauthn-sk host-key supportPossibly taken @inureyes claimed this 25 days ago. Openpriority:low status:blocked type:enhancement
Difficulty 4/5 3-5 days Newbie friendliness 48/100
lablup/bssh#345 · 1 assignee ·
Maintainers usually reply within 1 day
-
fix(security): enforce sk-* UP and UV flags once russh exposes the signaturePossibly taken @inureyes claimed this 25 days ago. Openpriority:medium status:blocked type:security
Difficulty 5/5 Over a week Newbie friendliness 35/100
lablup/bssh#340 · 1 assignee ·
Maintainers usually reply within 1 day
-
fix(security): verify the server host key presented on re-keyPossibly taken @inureyes claimed this 25 days ago. Openpriority:low status:blocked type:security
Difficulty 5/5 Over a week Newbie friendliness 25/100
lablup/bssh#336 · 1 assignee ·
Maintainers usually reply within 1 day
-
feat(agent): bind destination-constrained agent keys with [email protected]Possibly taken @inureyes claimed this 25 days ago. Openpriority:medium status:blocked type:enhancement
Difficulty 5/5 Over a week Newbie friendliness 25/100
lablup/bssh#327 · 1 assignee ·
Maintainers usually reply within 1 day
-
perf(sftp): adopt the russh-sftp borrowed write API in upload dispatchPossibly taken @inureyes claimed this 25 days ago. Openpriority:medium status:backlog type:performance
Difficulty 4/5 3-5 days Newbie friendliness 45/100
lablup/bssh#323 · 1 assignee ·
Maintainers usually reply within 1 day
Similar issues
-
area:ui effort:medium enhancement P7 source:agent
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
marketing
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
machine rename accepts a label already used by another machine, making --machine <label> ambiguousOpenmaintainer-needed p2 remote triaged
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
bug help wanted ui
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
userFRM/egui-charts#4605 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day