Add mobile project icon thumbnails to picker - #575
Conversation
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
The latest updates on your projects. Learn more about Vercel for GitHub. |
📝 WalkthroughWalkthroughA new ChangesMobile Project Icon Thumbnail Resolution
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested labels
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
arul28
commented
Jun 14, 2026
@copilot review but do not make fixes |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Summary
Verification
Summary by CodeRabbit
Greptile Summary
This PR extracts mobile project icon thumbnailing into a shared
projectIconThumbnail.tsmodule consumed by both the Electron desktop host and the ADE CLI brain, replacing the inline 12-line snippet inmain.tswith a singleresolveMobileProjectIconDataUrl()call.projectIconThumbnail.ts: implements a three-tier resolution chain (ElectronnativeImage→ macOSsipsrasterizer → raw PNG data URL fallback), backed by a 64-entry LRU mtime+size-keyed cache whose key includes a\"native\"/\"headless\"context prefix to prevent cross-context cache pollution.main.ts: slimmed down to a one-liner delegate call; no behaviour change for desktop users.cli.ts: plugsresolveMobileProjectIconDataUrl()into the headless project catalog, giving mobile clients icon thumbnails even when connected to a standalone CLI brain.Confidence Score: 5/5
Safe to merge — the change is a pure extraction/refactor with no new external dependencies and all error paths return null rather than throwing.
The new thumbnail module handles every failure path defensively (try/catch around nativeImage, sips, and file I/O; finally-block temp-dir cleanup), the LRU cache correctly distinguishes native vs. headless contexts, and the four new tests exercise the full resolution chain including the cache-isolation case. main.ts is a straightforward one-liner delegate with identical observable behaviour for desktop users.
No files require special attention. The previously flagged cross-package import in apps/ade-cli/src/cli.ts is a structural concern already on the team's radar.
Important Files Changed
Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD A["resolveMobileProjectIconDataUrl(projectRoot, options)"] --> B["resolveProjectIcon(projectRoot)"] B -->|"no sourcePath"| Z1["return null"] B -->|"sourcePath found"| C["fileSignature(sourcePath)"] C --> D{"Cache hit?\n(key = context:sourcePath\nmtime+size match)"} D -->|"yes"| E["LRU refresh\nreturn cached value"] D -->|"no"| F["nativeImagePngDataUrl()\noptions.nativeImage?"] F -->|"available & decodes"| G["nativeImage.resize(64x64).toDataURL()"] G --> K["cache + return PNG data URL"] F -->|"unavailable or empty"| H["sipsPngDataUrl()\ndefaultSipsRasterizer or override"] H -->|"sips succeeds"| I["mkdtemp → sips → read → rmSync"] I --> K H -->|"sips fails / not macOS"| J{"icon.mimeType\n=== image/png?"} J -->|"yes"| L["return icon.dataUrl (raw, unresized)"] J -->|"no (SVG/ICO/WebP)"| Z2["return null"] L --> K K["setThumbnailCache(key, entry)"]Reviews (2): Last reviewed commit: "Keep mobile icon thumbnail caches contex..." | Re-trigger Greptile