Skip to content

Commit 9710ecb

Browse files
authored
feat: add auto-reindexing in analyze function for improved file indexing (#18)
- Implemented an auto-reindex feature to ensure the index reflects current files on disk. - Added a warning message for non-fatal errors during the auto-reindex process, allowing the analysis to proceed with a stale index if necessary.
1 parent f8f5a34 commit 9710ecb

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

internal/cli/analyze.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@ func runAnalyze(files []string) error {
6464
}
6565
defer idx.Close()
6666

67+
// Auto-reindex to ensure the index reflects current files on disk.
68+
if err := autoReindex(idx); err != nil {
69+
// Non-fatal: proceed with stale index rather than failing.
70+
fmt.Fprintf(os.Stderr, "Warning: auto-reindex failed: %v\n", err)
71+
}
72+
6773
// Convert all files to repo-relative paths.
6874
targets := make([]string, len(files))
6975
for i, file := range files {

0 commit comments

Comments
 (0)