Add Windows Electron desktop support (#1093)

* fix: make upstream sync actions target the selected remote

Ensure fetch and pull actually honor upstream selection so fork maintenance works from the Git sidebar, and surface upstream branch status alongside the primary origin-tracking indicators.

* feat: add Windows Electron desktop foundation

* fix(electron): stabilize Windows desktop packaging

* fix(electron): stabilize Windows desktop chrome

Use native Windows titlebar behavior with an Alt-accessible hidden menu, and harden Windows dev command launching so the desktop app follows platform conventions.

* fix(electron): stabilize Windows dev startup

* fix(electron): clarify desktop artifact names

* fix(electron): harden Windows desktop release and launch

* fix(electron): address Windows release review

* fix(electron): point updater and release links to org repo

* Fix Windows settings persistence fallback

* Fix Windows Electron dev startup

* Add Windows Electron window controls

* Fix Windows Electron install and opencode launch

* fix: resolve git status for repositories without upstream

Fixes repository detection stuck on Checking repository
Handles git status when no upstream is configured
Adds regression coverage for git status loading

* Add Windows app menu button

* fix: preserve file editor line endings

* ci: add desktop release smoke workflow

---------

Co-authored-by: Bohdan Triapitsyn <artmore@protonmail.com>
This commit is contained in:
Dave Otero
2026-05-26 18:13:59 +03:00
committed by GitHub
co-authored by Bohdan Triapitsyn
parent cc7969ac00
commit becd240168
59 changed files with 2260 additions and 246 deletions
+51 -5
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env node
import { spawn } from 'node:child_process';
import { spawn, spawnSync } from 'node:child_process';
import { existsSync, rmSync } from 'node:fs';
import os from 'node:os';
import path from 'node:path';
@@ -11,12 +11,36 @@ const repoRoot = path.resolve(__dirname, '..');
const useDetachedChildren = process.platform === 'darwin';
const webRoot = path.join(repoRoot, 'packages/web');
const quoteWindowsCommandArg = (value) => `"${String(value).replace(/"/g, '""')}"`;
function resolveWindowsCommand(command) {
if (process.platform !== 'win32' || path.isAbsolute(command)) {
return command;
}
const result = spawnSync('where.exe', [command], { encoding: 'utf8', windowsHide: true });
if (result.error || result.status !== 0) {
return command;
}
const candidates = String(result.stdout || '').split(/\r?\n/).map((line) => line.trim()).filter(Boolean);
return candidates.find((entry) => /\.(exe|cmd|bat)$/i.test(entry)) || candidates[0] || command;
}
function run(label, command, args, env = {}, options = {}) {
return spawn(command, args, {
const resolvedCommand = resolveWindowsCommand(command);
const isWindowsCommandScript = process.platform === 'win32' && /\.(cmd|bat)$/i.test(resolvedCommand);
const spawnCommand = isWindowsCommandScript ? (process.env.ComSpec || 'cmd.exe') : resolvedCommand;
const spawnArgs = isWindowsCommandScript
? ['/d', '/s', '/c', ['call', quoteWindowsCommandArg(resolvedCommand), ...args.map(quoteWindowsCommandArg)].join(' ')]
: args;
return spawn(spawnCommand, spawnArgs, {
cwd: options.cwd || repoRoot,
stdio: 'inherit',
env: { ...process.env, ...env },
detached: useDetachedChildren,
windowsVerbatimArguments: isWindowsCommandScript,
}).on('error', (error) => {
console.error(`[dev:web:hmr] Failed to start ${label}:`, error);
});
@@ -43,6 +67,17 @@ function waitForExit(child, timeoutMs) {
});
}
function killWindowsProcessTree(pid) {
if (!pid) return;
try {
spawnSync('taskkill.exe', ['/PID', String(pid), '/T', '/F'], {
stdio: 'ignore',
windowsHide: true,
});
} catch {
}
}
function signalChild(child, signal) {
if (!child || child.exitCode !== null || child.signalCode !== null) {
return;
@@ -70,6 +105,11 @@ async function stopChildTree(child) {
signalChild(child, 'SIGINT');
await waitForExit(child, 2500);
if (process.platform === 'win32' && child.exitCode === null && child.signalCode === null) {
killWindowsProcessTree(child.pid);
await waitForExit(child, 1000);
}
if (child.exitCode === null && child.signalCode === null) {
signalChild(child, 'SIGTERM');
await waitForExit(child, 2500);
@@ -112,9 +152,15 @@ function clearViteCache() {
clearViteCache();
const api = run('api', 'bun', ['run', '--cwd', 'packages/web', 'dev:server:watch'], {
OPENCHAMBER_PORT: backendPort,
});
const api = run(
'api',
'bun',
['x', 'nodemon', '--watch', 'server', '--ext', 'js', '--exec', `bun server/index.js --port ${backendPort}`],
{
OPENCHAMBER_PORT: backendPort,
},
{ cwd: webRoot },
);
const vite = run(
'vite',
'bun',