mirror of
https://github.com/colbymchenry/codegraph.git
synced 2026-10-18 22:02:49 +08:00
c897daf85d
* fix(watcher): auto-sync changes inside symlinked directories (#770) The file watcher (Linux inotify strategy) did not follow directory symlinks when building its watch set, so a project dir symlinked into the workspace root was silently invisible to the watcher. Changes: 1. watcher.ts: watchTree() now detects isSymbolicLink() entries, resolves real targets with realpathSync(), and recursively watches directory symlinks. Guards against cycles with a visitedRealDirs Set — tracking regular dirs too so a symlink→already-visited-path is also detected. Mirrors the indexer's walk() in extraction/index.ts. 2. utils.ts: Added allowSymlinkedDirs parameter to validatePathWithinRoot(). When true, skips the realpath check that would reject watched symlinks whose targets live outside the lexical project root. All internal sync/index paths pass true here; user-facing paths (MCP layer) keep the existing strict validation. 3. extraction/index.ts: All internal sync/index paths now pass allowSymlinkedDirs: true so the watcher can read files from symlinked directories. 4. __tests__/watcher.test.ts: Added integration test for symlinked directory auto-sync, plus a symlink-cycle detection test. Signed-off-by: dengzhongyuan <dengzhongyuan@uniontech.com> * fix(watcher): auto-sync symlinked directory changes across platforms (#770) Directory indexing followed symlinks that native watchers did not cover. Discover targets with realpath cycle guards, preserve logical paths, and install bounded supplemental watches. Reconcile watches after topology and scope changes, and preserve changes arriving during a full sync. Retain strict content-serving containment and cover lifecycle, resource limits, and cleanup. Co-authored-by: dengzhongyuan <dengzhongyuan@uniontech.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(watcher): auto-sync symlinked directory changes across platforms (#770) Directory indexing followed symlinks that native watchers did not cover. Discover targets with realpath cycle guards, preserve logical paths, and install bounded supplemental watches. Reconcile watches after topology and scope changes, and preserve changes arriving during a full sync. Retain strict content-serving containment and cover lifecycle, resource limits, and cleanup. Co-authored-by: dengzhongyuan <dengzhongyuan@uniontech.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(watcher): auto-sync symlinked directory changes across platforms (#770) Directory indexing followed symlinks that native watchers did not cover. Discover targets with realpath cycle guards, preserve logical paths, and install bounded supplemental watches. Reconcile watches after topology and scope changes, and preserve changes arriving during a full sync. Retain strict content-serving containment and cover lifecycle, resource limits, and cleanup. Co-authored-by: dengzhongyuan <dengzhongyuan@uniontech.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Signed-off-by: dengzhongyuan <dengzhongyuan@uniontech.com> Co-authored-by: dengzhongyuan <dengzhongyuan@uniontech.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>