Summary
Fix the existing update() method to actually work. Most infrastructure already exists.
What Already Works
- ✅ State management with file hashes (
indexer-state.json)
- ✅
detectChangedFiles() using SHA-256 comparison
- ✅
update() method orchestration
- ✅ Doc IDs contain file path (e.g.,
src/auth.ts:func:10)
- ✅ CLI
dev update command
What's Broken
delete() throws error — We just never implemented it
- New files not detected — Only iterates
state.files, misses new files
- Deleted files leave orphans — Not cleaned up
Implementation
1. Implement delete by file path prefix (~1 hour)
// In store.ts
async deleteByFilePrefix(filePrefix: string): Promise<void> {
await this.table.delete(`id LIKE '${filePrefix}:%'`);
}
2. Add new file detection (~30 min)
// In detectChangedFiles()
// Also scan for files NOT in state.files
const allFiles = await scanForFiles(repoPath);
const newFiles = allFiles.filter(f => !state.files[f]);
3. Handle deleted files (~30 min)
// Files in state but not on disk
const deletedFiles = Object.keys(state.files)
.filter(f => !existsSync(f));
// Delete their docs from vector store
Success Criteria
Out of Scope
- Git commit SHA tracking (optimization, not required)
- Watch mode
Parent Epic
Part of #104 - Performance & Reliability Critical Path
Summary
Fix the existing
update()method to actually work. Most infrastructure already exists.What Already Works
indexer-state.json)detectChangedFiles()using SHA-256 comparisonupdate()method orchestrationsrc/auth.ts:func:10)dev updatecommandWhat's Broken
delete()throws error — We just never implemented itstate.files, misses new filesImplementation
1. Implement delete by file path prefix (~1 hour)
2. Add new file detection (~30 min)
3. Handle deleted files (~30 min)
Success Criteria
dev updatedetects changed filesdev updatedetects new filesdev updateremoves docs for deleted files--forcestill triggers full reindexOut of Scope
Parent Epic
Part of #104 - Performance & Reliability Critical Path