[Bug] Stats unavailable when project directories are symlinks
Bug Description
/stats shows "No stats available yet" when project dirs under ~/.claude/projects are symlinks
Version: 2.1.281, macOS (Darwin 24.6.0)
Setup: every entry in ~/.claude/projects/ is a symlink to a real directory
elsewhere (synced store), e.g.
~/.claude/projects/-Users-studio -> ~/Dropbox/.../claude-projects/_HOME_
~1200 session .jsonl files exist and are real files inside the targets.
Sessions, --resume, transcripts all work fine.
Bug: /stats says "No stats available yet. Start using Claude Code!"
Cause: the transcript scanner does
readdir(projectsDir, {withFileTypes}) -> .filter(d => d.isDirectory())
Dirent.isDirectory() is false for symlinks, so all project dirs are skipped,
files.length === 0, and the empty result is returned before even reading
stats-cache.json (which still holds 166 sessions from an older computation).
The same pattern (isFile()) would also drop symlinked .jsonl files.
Expected: follow symlinks, e.g. accept d.isSymbolicLink() and check with
fs.stat() whether the target is a directory/file.
Environment Info
- Platform: darwin
- Terminal: vscode
- Version: 2.1.281
- Feedback ID: 5bbb6e12-b989-41a5-a12d-7ea268ef2a45
Errors
[]