experiments in a post-browser web
10
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat(run:packaged): cohesive build+package+run against an ephemeral profile

Adds an `isEphemeralProfile()` helper (`dev`, `test-*`, `tmp-*`) and
uses it ONLY for the single-instance-lock skip in
`requestSingleInstance`. `isTestProfile()` continues to gate the
Playwright-specific behaviors (dock hide, session restore skip, etc.)
so `tmp-*` profiles get production-like UX: dock visible, close-on-
blur active, session restore, default-browser prompt, etc.

Replaces the existing `run:packaged` (which used `open` and couldn't
pass env vars, couldn't rebuild, and collided with any running prod
instance) with a single command that: kills any prior packaged
instance, runs `yarn build`, packages via `electron-builder --dir`,
then launches `out/mac-arm64/Peek.app/Contents/MacOS/Peek` in the
terminal foreground with `PROFILE=tmp-<timestamp>`.

The other `run:packaged:*` variants (`:debug`, `:bg`, `:debug:bg`,
`:check`) are unchanged — they still hit the binary directly for
post-hoc runs without a rebuild.

Reverts the earlier band-aid that gated `applyDockPreference` on
`E2E_TEST` instead of `isTestProfile()` — with the `tmp-*` path in
place that workaround is no longer needed.

+21 -5
+12
backend/electron/config.ts
··· 75 75 export function isDevProfile(): boolean { 76 76 return _profile === 'dev'; 77 77 } 78 + 79 + /** 80 + * True for any non-production ephemeral profile — dev, test-*, or 81 + * tmp-* manual-smoke profiles. Used only by the single-instance lock 82 + * check: these profiles always skip the lock so multiple instances 83 + * (prod + manual + parallel tests) can coexist. Does NOT gate any 84 + * test-only behaviors — those still use `isTestProfile()` or the 85 + * `E2E_TEST` env var as appropriate. 86 + */ 87 + export function isEphemeralProfile(): boolean { 88 + return isDevProfile() || isTestProfile() || _profile.startsWith('tmp-'); 89 + }
+5 -3
backend/electron/main.ts
··· 21 21 import { initTray } from './tray.js'; 22 22 import { registerLocalShortcut, unregisterLocalShortcut, handleLocalShortcut, registerGlobalShortcut, unregisterGlobalShortcut, unregisterShortcutsForAddress } from './shortcuts.js'; 23 23 import { scopes, publish, subscribe, unsubscribe, hasSubscriber, setExtensionBroadcaster, getSystemAddress } from './pubsub.js'; 24 - import { WEB_CORE_ADDRESS, isTestProfile, isDevProfile, isHeadless, getProfile, setTilePreloadPath, getTilePreloadPath, DEBUG } from './config.js'; 24 + import { WEB_CORE_ADDRESS, isTestProfile, isDevProfile, isEphemeralProfile, isHeadless, getProfile, setTilePreloadPath, getTilePreloadPath, DEBUG } from './config.js'; 25 25 import { getSystemThemeBackgroundColor } from './windows.js'; 26 26 import { getProfileSession, getPartitionString, getCurrentProfileId } from './session-partition.js'; 27 27 import { getIzuiCoordinator } from './izui-state.js'; ··· 1905 1905 * Skips lock in dev/test profiles to allow running alongside production 1906 1906 */ 1907 1907 export function requestSingleInstance(): boolean { 1908 - // Skip single-instance lock in dev/test profiles to allow running alongside production 1909 - if (isDevProfile() || isTestProfile()) { 1908 + // Skip single-instance lock for ephemeral profiles (dev / test-* / 1909 + // tmp-*) so production, parallel tests, and manual sandbox runs can 1910 + // coexist with a running production instance. 1911 + if (isEphemeralProfile()) { 1910 1912 DEBUG && console.log('Skipping single-instance lock for profile:', getProfile()); 1911 1913 return true; 1912 1914 }
+3 -1
backend/electron/windows.ts
··· 364 364 /** 365 365 * Apply dock visibility based on user preference. 366 366 * Call at startup and when the showInDockAndSwitcher preference changes. 367 - * In test profiles, always hides the dock. 367 + * Test profiles always hide the dock. Manual sandboxes should use 368 + * `PROFILE=tmp-*` (which bypasses the single-instance lock without 369 + * inheriting test-only behaviors — see `isEphemeralProfile`). 368 370 */ 369 371 export function applyDockPreference(): void { 370 372 if (process.platform !== 'darwin' || !app.dock) return;
+1 -1
package.json
··· 125 125 "//-- Packaged Electron --//": "", 126 126 "kill:packaged": "pkill -f 'out/mac-arm64/Peek.app' || true", 127 127 "kill:prod": "pkill -f '/Applications/Peek.app' || true", 128 - "run:packaged": "yarn kill:packaged; open out/mac-arm64/Peek.app", 128 + "run:packaged": "./scripts/timed.sh sh -c 'yarn kill:packaged; yarn build && electron-builder --dir && PROFILE=tmp-$(date +%s) out/mac-arm64/Peek.app/Contents/MacOS/Peek'", 129 129 "run:packaged:debug": "yarn kill:packaged; DEBUG=1 out/mac-arm64/Peek.app/Contents/MacOS/Peek", 130 130 "run:packaged:bg": "yarn kill:packaged; out/mac-arm64/Peek.app/Contents/MacOS/Peek > /tmp/packaged-debug.log 2>&1 &", 131 131 "run:packaged:debug:bg": "yarn kill:packaged; DEBUG=1 out/mac-arm64/Peek.app/Contents/MacOS/Peek > /tmp/packaged-debug.log 2>&1 &",