Skip to content

Fix: Allow cc-wrapped to work without stats-cache.json#1

Open
mkusaka wants to merge 1 commit intonumman-ali:mainfrom
mkusaka:fix/check-projects-dir-instead-of-stats-cache
Open

Fix: Allow cc-wrapped to work without stats-cache.json#1
mkusaka wants to merge 1 commit intonumman-ali:mainfrom
mkusaka:fix/check-projects-dir-instead-of-stats-cache

Conversation

@mkusaka
Copy link

@mkusaka mkusaka commented Dec 26, 2025

Summary

cc-wrapped currently requires ~/.claude/stats-cache.json to exist, but this file is only created when the statsCache setting is enabled in Claude Code. This makes the tool unusable for users who haven't enabled that setting.

Changes

  • Modified checkClaudeDataExists() to check for ~/.claude/projects/ directory instead of stats-cache.json
  • Made loadClaudeStatsCache() gracefully return an empty object when the file doesn't exist

Why

The actual data collection (collectClaudeUsageSummary) reads from the projects/ directory's JSONL files, not from stats-cache.json.
The stats cache is only used as a fallback data source. Therefore, requiring stats-cache.json for the existence check was unnecessarily restrictive.

Test plan

  • Tested on a system without stats-cache.json - now works correctly
  • Verified stats are collected from projects/ directory

…ache.json

The previous check required ~/.claude/stats-cache.json which is only
created when statsCache setting is enabled. This made cc-wrapped
unusable for users without that setting.

Now checks for ~/.claude/projects/ directory which always exists when
Claude Code has been used. Also made loadClaudeStatsCache() gracefully
return an empty object when the file doesn't exist.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant