fix(url): move single-instance lock before app.whenReady for proper URL forwarding
On macOS, when `open -a Peek URL` is invoked while Peek is already running,
Electron launches a second process. The single-instance lock must be acquired
BEFORE app.whenReady() so Electron can properly forward the Apple Event
(open-url) to the primary instance. Previously, requestSingleInstanceLock()
was called inside onReady (after app.whenReady), causing the second instance
to receive and then discard the open-url event when it quit.
Changes:
- Move requestSingleInstance() and registerSecondInstanceHandler() to module
top-level (after setProfile, before app.whenReady) in entry.ts
- Pass URL from argv as additionalData in requestSingleInstanceLock() so the
primary instance receives it via second-instance event
- Handle additionalData in second-instance handler for URL forwarding
- Add diagnostic file logging to /tmp/peek-url-debug.log to trace the
complete URL handling flow in packaged builds
Testing needed:
1. Build packaged app: yarn build:electron
2. Launch Peek normally (cold start)
3. Run: open -a Peek https://example.com (warm: app already running)
4. Run: open -a Peek https://example.com (cold: app not running)
5. Check /tmp/peek-url-debug.log for diagnostic output
6. Verify URL opens in both warm and cold start cases