Skip to content

feat(core): replace fdir crawler with git ls-files + ripgrep fallback#93

Open
BingqingLyu wants to merge 19 commits into
mainfrom
fork-pr-3214-feat-git-ls-files-file-search
Open

feat(core): replace fdir crawler with git ls-files + ripgrep fallback#93
BingqingLyu wants to merge 19 commits into
mainfrom
fork-pr-3214-feat-git-ls-files-file-search

Conversation

@BingqingLyu

@BingqingLyu BingqingLyu commented Apr 27, 2026

Copy link
Copy Markdown
Owner

Summary

Replaces the fdir-based filesystem crawler with a two-tier strategy for the @ file mention autocomplete feature.

Closes QwenLM#3137

Problem

The current fdir crawler re-scans the entire directory tree on every keystroke, which is slow on large repos and doesn't respect .gitignore natively.

Solution

Three-level fallback strategy:

  1. Primary: git ls-files — for git repos. Fast, .gitignore-aware, reads directly from git index
  2. Fallback 1: ripgrep --files — for non-git directories. 20s timeout, 20MB buffer cap, respects .gitignore automatically
  3. Fallback 2: fdir — original behavior preserved as last resort

Supporting improvements:

  • Mtime-based change detection — watches .git/index mtime, skips re-crawl when nothing changed
  • 5s refresh throttling — prevents rebuilding index on every keystroke
  • Async chunked indexing — yields to event loop every 1000 entries, keeps UI responsive with 200k+ files
  • Background untracked file merge — untracked files fetched async with 10s timeout
  • Windows path normalization — POSIX-style paths throughout
  • Bug fix — handle empty string from path.posix.relative when crawlDirectory equals gitRoot

Testing

  • 76/76 filesearch tests pass
  • 4 new tests added: git repo path, non-git fallback, throttling, mtime detection
  • npm run preflight

scrollDynasty and others added 19 commits April 13, 2026 17:20
Co-authored-by: Shaojin Wen <shaojin.wensj@alibaba-inc.com>
Co-authored-by: Shaojin Wen <shaojin.wensj@alibaba-inc.com>
@BingqingLyu BingqingLyu added conflicting-group-1 conflicting-group-1 Conflicting PR group 1 — review as a batch conflicting-pr Shares at least one cross-PR dependency with other PRs and removed conflicting-group-1 labels May 7, 2026
@BingqingLyu

BingqingLyu commented May 7, 2026

Copy link
Copy Markdown
Owner Author

Conflict Group 1

This PR shares modified functions with 1 other PR(s): #100.

These PRs should be reviewed as a batch — merging one may affect the others.

Function File Also modified by
crawl crawler.ts #100
graph LR
    PR93["PR #93"]
    Fcrawl_3215["crawl<br>crawler.ts"]
    PR93 -->|modifies| Fcrawl_3215
    PR100["PR #100"]
    PR100 -->|modifies| Fcrawl_3215
Loading

Posted by codegraph-ai conflict detection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

conflicting-group-1 Conflicting PR group 1 — review as a batch conflicting-pr Shares at least one cross-PR dependency with other PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace fdir filesystem crawler with git ls-files + ripgrep for file search

2 participants