Skip to main content

๐Ÿงน 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:

FileLocationContent
data.jsonOS data directoryCached problem catalog, difficulty levels, acceptance rates, and topic tags
user.jsonOS data directoryCached user profile information
credentials.jsonOS config / data directoryStored 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โ€‹

  1. Corrupted Problem Cache: If problem lists fail to render properly or show partial data in the TUI, run leetrs clean to trigger a fresh download on the next launch.
  2. Account Logout / Switching: To clear saved credentials before authenticating with a different LeetCode account.
  3. Stale Metadata: To force an immediate update of problem lists, acceptance percentages, and tags without waiting for background cache refresh.