Fix: Allow cc-wrapped to work without stats-cache.json#1
Open
mkusaka wants to merge 1 commit intonumman-ali:mainfrom
Open
Fix: Allow cc-wrapped to work without stats-cache.json#1mkusaka wants to merge 1 commit intonumman-ali:mainfrom
mkusaka wants to merge 1 commit intonumman-ali:mainfrom
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
cc-wrapped currently requires
~/.claude/stats-cache.jsonto exist, but this file is only created when thestatsCachesetting is enabled in Claude Code. This makes the tool unusable for users who haven't enabled that setting.Changes
checkClaudeDataExists()to check for~/.claude/projects/directory instead ofstats-cache.jsonloadClaudeStatsCache()gracefully return an empty object when the file doesn't existWhy
The actual data collection (
collectClaudeUsageSummary) reads from theprojects/directory's JSONL files, not fromstats-cache.json.The stats cache is only used as a fallback data source. Therefore, requiring
stats-cache.jsonfor the existence check was unnecessarily restrictive.Test plan
stats-cache.json- now works correctlyprojects/directory