Files
vibe-kanban/crates/server
Louis Knight-Webb e5aa72e907 Re-rank file search (vibe-kanban) (#514)
* Cleanup script changes for task attempt f7987e81-2e4a-47e7-9d54-cc27930b694b

* Commit changes from coding agent for task attempt f7987e81-2e4a-47e7-9d54-cc27930b694b

* Cleanup script changes for task attempt f7987e81-2e4a-47e7-9d54-cc27930b694b

* fmt

* Perfect! ** Refactoring Complete**

## Summary

Successfully refactored the FileRanker to remove all direct git2 dependencies and consolidated all git operations in GitService:

### **Key Changes Made:**

1. **Enhanced GitService** (`crates/services/src/services/git.rs`):
   -  Added `HeadInfo` struct with `branch: String` and `oid: String`
   -  Added `get_head_info()` method that returns both branch name and commit SHA
   -  Updated `get_current_branch()` to be a thin wrapper maintaining backward compatibility

2. **Refactored FileRanker** (`crates/services/src/services/file_ranker.rs`):
   - �� **Removed all `git2` imports** - now purely focused on ranking logic
   -  Changed cache to store `head_sha: String` instead of `head_oid: git2::Oid`
   -  Updated cache validation to use `GitService.get_head_info()`
   -  Updated cache storage to use `GitService.get_head_info()`

### **Benefits Achieved:**

- **🎯 Clean Separation**: FileRanker = pure ranking logic, GitService = all git I/O
- **🧪 Better Testability**: FileRanker no longer depends on git2, easier to mock/test
- **🔄 Future-Proof**: All git backend changes centralized in GitService  
- ** Zero Performance Impact**: Same caching behavior and efficiency
- **🔄 Backward Compatibility**: Existing `get_current_branch()` callers unaffected

### **Architecture Now:**
```
FileRanker (ranking logic only)
    ↓ delegates to
GitService (single git facade)
    ↓ encapsulates  
git2 (implementation detail)
```

The refactoring successfully achieved proper separation of concerns while maintaining all existing functionality and performance characteristics.

* Cleanup script changes for task attempt f7987e81-2e4a-47e7-9d54-cc27930b694b
2025-08-19 11:23:14 +01:00
..
2025-08-08 13:53:27 +01:00
2025-08-19 08:46:59 +00:00