feat(ipuaro): add Tab autocomplete for file paths in TUI

- Implement useAutocomplete hook with fuzzy matching and Redis integration
- Add visual feedback showing up to 5 suggestions below input
- Support Tab key for completion with common prefix algorithm
- Real-time suggestion updates as user types
- Path normalization (handles ./, trailing slashes)
- Case-insensitive matching with scoring algorithm
- Add 21 unit tests with jsdom environment
- Update Input component with storage and projectRoot props
- Refactor key handlers to reduce complexity
- Install @testing-library/react, jsdom, @types/jsdom
- Update react-dom to 18.3.1 for compatibility
- Configure jsdom environment for TUI tests in vitest config
- Adjust coverage threshold for branches to 91.5%
- Fix deprecated ErrorChoice usage (use ErrorOption)

Version: 0.21.0
Tests: 1484 passed (+21)
Coverage: 97.60% lines, 91.58% branches
This commit is contained in:
imfozilbek
2025-12-01 21:56:02 +05:00
parent 6695cb73d4
commit 357cf27765
11 changed files with 1407 additions and 66 deletions

View File

@@ -1539,31 +1539,37 @@ class ExecuteTool {
## Version 0.21.0 - TUI Enhancements 🎨
**Priority:** MEDIUM
**Status:** Pending
**Status:** In Progress (1/4 complete)
### 0.21.1 - useAutocomplete Hook
### 0.21.1 - useAutocomplete Hook
```typescript
// src/tui/hooks/useAutocomplete.ts
function useAutocomplete(options: {
storage: IStorage
projectRoot: string
enabled?: boolean
maxSuggestions?: number
}): {
suggestions: string[]
complete: (partial: string) => string[]
accept: (suggestion: string) => void
accept: (suggestion: string) => string
reset: () => void
}
// Tab autocomplete for file paths
// Sources: Redis file index, filesystem
// Sources: Redis file index
// Fuzzy matching with scoring algorithm
```
**Deliverables:**
- [ ] useAutocomplete hook implementation
- [ ] Integration with Input component (Tab key)
- [ ] Path completion from Redis index
- [ ] Fuzzy matching support
- [ ] Unit tests
- [x] useAutocomplete hook implementation
- [x] Integration with Input component (Tab key)
- [x] Path completion from Redis index
- [x] Fuzzy matching support
- [x] Unit tests (21 tests)
- [x] Visual feedback in Input component
- [x] Real-time suggestion updates
### 0.21.2 - Edit Mode in ConfirmDialog