๐งน leetrs clean
Invalidates and resets local application cache, problem metadata, and stored authentication credentials.
๐ Overviewโ
leetrs clean (and its alias leetrs reset) completely purges locally cached state from your system. This command is designed to recover from corrupted cache files, force a clean synchronization with LeetCode's servers, or securely log out by removing stored session tokens.
Target Filesโ
Running leetrs clean safely targets and deletes the following files:
| File | Location | Content |
|---|---|---|
data.json | OS data directory | Cached problem catalog, difficulty levels, acceptance rates, and topic tags |
user.json | OS data directory | Cached user profile information |
credentials.json | OS config / data directory | Stored LEETCODE_SESSION and csrftoken authentication cookies |
โก Usageโ
# Clean local cache and stored credentials
leetrs clean
# Or using the reset alias
leetrs reset
๐ Example Outputโ
When cache or credential files are present:
๐งน Cleaning local cache and credentials...
โ Removed data.json (problem cache)
โ Removed user.json (problem cache)
โ Removed credentials.json (stored credentials)
โจ Successfully cleared 3 file(s). Local state has been reset.
When everything is already clean:
๐งน Cleaning local cache and credentials...
โจ Everything is already clean. No cache or credential files found.
๐ก When to Useโ
- Corrupted Problem Cache: If problem lists fail to render properly or show partial data in the TUI, run
leetrs cleanto trigger a fresh download on the next launch. - Account Logout / Switching: To clear saved credentials before authenticating with a different LeetCode account.
- Stale Metadata: To force an immediate update of problem lists, acceptance percentages, and tags without waiting for background cache refresh.