Add a `desktop/` Electron app that embeds the existing Node server + node-pty (all-in-one): the window loads http://127.0.0.1:<port>/ and reuses the frontend unchanged; other LAN devices can still connect. The server needs zero changes — startServer(cfg)/loadConfig already support programmatic embedding. - Pure, unit-tested modules: port, shell, server-config, deep-link, notify-policy, notifications, live-poll, prefs, settings-store (94 tests; desktop/src ~97% cov) - Electron glue: main/window/tray/menu/preload/embedded-server/logger (hardened: contextIsolation, sandbox, deny foreign-origin navigation) - Native value: OS notifications driven by /live-sessions status, tray, deep links - Packaging (electron-builder -> arm64 .dmg): ships dist/ + public/ + node_modules on-disk under Resources so the server resolves its deps from /Applications; node-pty rebuilt for the Electron ABI - Docs: docs/DESKTOP_PLAN.md; PROGRESS_LOG updated Verified: desktop tsc clean; 1401 tests pass; coverage >=80% (desktop/src 97/95/100/97); .dmg built and launch-tested on arm64 (server boots, UI serves 200, node-pty loads).
29 lines
1.2 KiB
TypeScript
29 lines
1.2 KiB
TypeScript
/**
|
|
* desktop/src/shell.ts — the default login shell to spawn per host platform.
|
|
*
|
|
* The backend's loadConfig defaults SHELL_PATH to `$SHELL ?? /bin/zsh`, which is
|
|
* meaningless on Windows (no $SHELL, no /bin/zsh). The desktop shell overrides
|
|
* SHELL_PATH with this platform-aware default (see server-config.ts) so a
|
|
* Windows install spawns PowerShell (ConPTY-friendly) instead of a bogus path.
|
|
*/
|
|
|
|
/** Windows default: PowerShell works with node-pty's ConPTY backend out of the box. */
|
|
const WINDOWS_DEFAULT_SHELL = 'powershell.exe'
|
|
/** macOS fallback when $SHELL is unset (the default login shell since Catalina). */
|
|
const MACOS_FALLBACK_SHELL = '/bin/zsh'
|
|
/** Linux / other POSIX fallback when $SHELL is unset. */
|
|
const POSIX_FALLBACK_SHELL = '/bin/bash'
|
|
|
|
/**
|
|
* Resolve the shell to spawn for `platform`. win32 → PowerShell; darwin →
|
|
* $SHELL or /bin/zsh; anything else (linux, etc.) → $SHELL or /bin/bash.
|
|
*/
|
|
export function defaultShellForPlatform(
|
|
platform: NodeJS.Platform,
|
|
env: NodeJS.ProcessEnv,
|
|
): string {
|
|
if (platform === 'win32') return WINDOWS_DEFAULT_SHELL
|
|
if (platform === 'darwin') return env.SHELL ?? MACOS_FALLBACK_SHELL
|
|
return env.SHELL ?? POSIX_FALLBACK_SHELL
|
|
}
|