feat: Enhanced Tab Completion for Interactive Mode
@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
- 65
- Forks
- 7
- Avg merge
- 1h 30m
- Merged PRs (30d)
- 25
Contributor guide
No contributing guide indexed for this repository
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
-
priority:medium status:backlog type:bug
Difficulty 5/5 Over a week Newbie friendliness 28/100
-
priority:high status:in-progress type:enhancement
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
priority:low status:backlog type:enhancement
-
priority:medium status:backlog type:enhancement
-
priority:low status:backlog type:enhancement
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
gitbutlerapp/gitbutler#15998 · 1 comment ·
-
bug triage:deciding
Difficulty 1/5 Under an hour Newbie friendliness 88/100
open-telemetry/otel-arrow#4132 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100