Files
vibe-kanban/crates/services/Cargo.toml
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

57 lines
1.5 KiB
TOML

[package]
name = "services"
version = "0.0.63"
edition = "2024"
[dependencies]
utils = { path = "../utils" }
executors = { path = "../executors" }
db = { path = "../db" }
tokio = { workspace = true }
tokio-util = { version = "0.7", features = ["io"] }
axum = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
anyhow = { workspace = true }
tracing = { workspace = true }
tracing-subscriber = { workspace = true }
sqlx = { version = "0.8.6", features = ["runtime-tokio-rustls", "sqlite", "chrono", "uuid"] }
chrono = { version = "0.4", features = ["serde"] }
uuid = { version = "1.0", features = ["v4", "serde"] }
ts-rs = { workspace = true }
dirs = "5.0"
xdg = "3.0"
git2 = "0.18"
async-trait = "0.1"
libc = "0.2"
rust-embed = "8.2"
directories = "6.0.0"
open = "5.3.2"
pathdiff = "0.2.1"
ignore = "0.4"
command-group = { version = "5.0", features = ["with-tokio"] }
openssl-sys = { workspace = true }
regex = "1.11.1"
notify-rust = "4.11"
octocrab = "0.44"
os_info = "3.12.0"
sentry = { version = "0.41.0", features = ["anyhow", "backtrace", "panic", "debug-images"] }
sentry-tracing = { version = "0.41.0", features = ["backtrace"] }
reqwest = { version = "0.12", features = ["json"] }
lazy_static = "1.4"
futures-util = "0.3"
json-patch = "2.0"
backon = "1.5.1"
base64 = "0.22"
thiserror = { workspace = true }
futures = "0.3.31"
tokio-stream = "0.1.17"
secrecy = "0.10.3"
strum_macros = "0.27.2"
strum = "0.27.2"
notify = "8.2.0"
notify-debouncer-full = "0.5.0"
dunce = "1.0"
dashmap = "6.1"
once_cell = "1.20"