Update tldr extension
Description
Fixes https://github.com/raycast/extensions/issues/23848
Checklist
- [x] I read the extension guidelines
- [x] I read the documentation about publishing
- [x] I ran
npm run buildand tested this distribution build in Raycast - [x] I checked that files in the
assetsfolder are used by the extension itself - [x] I checked that assets used by the
READMEare placed outside of themetadatafolder
Thank you for your contribution! :tada:
🔔 @pomdtr @ridemountainpig @0xdhrv you might want to have a look.
You can use this guide to learn how to check out the Pull Request locally in order to test it.
📋 Quick checkout commands
BRANCH="ext/tldr"
FORK_URL="https://github.com/0xdhrv/raycast-extensions.git"
EXTENSION_NAME="tldr"
REPO_NAME="raycast-extensions"
git clone -n --depth=1 --filter=tree:0 -b $BRANCH $FORK_URL
cd $REPO_NAME
git sparse-checkout set --no-cone "extensions/$EXTENSION_NAME"
git checkout
cd "extensions/$EXTENSION_NAME"
npm install && npm run dev
Due to our current reduced availability, the initial review may take up to 10-15 business days.
@greptileai, could you please do a fresh review of this PR?
Greptile Summary
This PR fixes a critical memory issue (JS heap out of memory) that prevented the TLDR extension from working on Windows. The root cause was the old implementation downloading and extracting a large ZIP file containing all TLDR pages, then using globby to scan thousands of files simultaneously, which exceeded the JavaScript heap limit.
Key Changes
- Replaced ZIP download approach with GitHub API: Instead of downloading/extracting a ~50MB ZIP and scanning all files at once, the new implementation uses GitHub's tree API to list files, then fetches individual pages from raw.githubusercontent.com
-
Removed memory-intensive dependencies: Eliminated
adm-zipandglobbypackages which were causing the heap overflow - Progressive loading with batching: Fetches pages in batches of 50 to prevent memory spikes, with exponential backoff retry logic
-
Smart caching: Uses Raycast's
LocalStoragefor efficient 7-day caching instead of file system operations - Improved UX: Added progress indicators during cache updates and platform filtering dropdown
How It Fixes the Issue
The original implementation tried to process all ~9,000 TLDR pages at once by extracting a ZIP file and running file system glob operations, which exhausted available memory. The new approach:
- Makes one API call to get the file tree
- Fetches content progressively in batches from CDN (no rate limits)
- Processes pages incrementally, preventing memory buildup
This architectural change eliminates the memory bottleneck while providing better performance and user experience.
Confidence Score: 5/5
- This PR is safe to merge - it fixes a critical production issue with a well-architected solution
- The implementation successfully addresses the reported memory issue by replacing the problematic ZIP extraction approach with an efficient GitHub API solution. The code includes proper error handling, retry logic, batching to prevent memory spikes, and maintains backward compatibility. The architectural change is sound and eliminates the root cause.
- No files require special attention
Important Files Changed
| Filename | Overview |
|---|---|
| extensions/tldr/src/search.tsx | Complete rewrite from file-system based approach to GitHub API approach - memory efficient and fixes heap overflow issue |
| extensions/tldr/package.json | Removed adm-zip and globby dependencies that were causing memory issues |
| extensions/tldr/CHANGELOG.md | Added changelog entry for the fix with proper placeholder format |
@greptileai, could you please do a fresh review of this PR?
Published to the Raycast Store: https://raycast.com/pomdtr/tldr
:tada: :tada: :tada:
We've rewarded your Raycast account with some credits. You will soon be able to exchange them for some swag.