Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.
TypeScript adhdagent-orchestrationai-agentscanvasclaude-codecodexcoding-agentsdeveloper-toolselectrongeminilinuxmacosmultiplexeropencodeparallel-agentsterminalterminal-emulatorterminal-multiplexertmuxworkspace-manager
feat(packaging): Windows packaging groundwork — NSIS target, .ico, bootstrap, smoke CI
enes589fff5a94a5
diff --git a/.github/workflows/win-package-smoke.yml b/.github/workflows/win-package-smoke.ymlnew file mode 100644index 000000000..d541dbda0--- /dev/null+++ b/.github/workflows/win-package-smoke.yml@@ -0,0 +1,47 @@+name: Windows package smoke++# Manual-only packaging smoke test for the Windows target (groundwork from #276 / #300 stack):+# proves that `electron-builder --win` produces an NSIS installer + zip from a clean checkout on+# windows-latest, whose runner image already ships the Visual Studio Build Tools + Python that+# node-pty/smart-whisper compilation needs.+#+# BUILD ONLY — this workflow must NEVER publish. `dist:win` passes `--publish never`, nothing+# here uploads to the update feed or creates a release, and the produced installer is unsigned.+# Windows is not a shippable target until the session-host phase merges; release wiring (signing,+# latest.yml on nodeterm.dev/updates, a release.yml job) is a deliberate follow-up.+on:+ workflow_dispatch:++permissions:+ contents: read++jobs:+ package-win:+ runs-on: windows-latest+ steps:+ - uses: actions/checkout@v7++ - uses: actions/setup-node@v7+ with:+ node-version: '22'+ cache: 'npm'++ # postinstall patches node-pty and rebuilds node-pty + smart-whisper against Electron's+ # ABI — the same install the quality-windows CI job already proves green on this image.+ - name: Install dependencies+ run: npm ci++ # make-icon (build/icon.png + build/icon.ico) + electron-vite build + electron-builder+ # --win --x64 --publish never. Unsigned by design: no signing secrets are exposed here.+ - name: Package (NSIS installer + zip, never published)+ run: npm run dist:win++ # The artifact names are the contract: a silent target/artifactName regression should+ # fail here, not on a release day.+ - name: Verify expected artifacts+ shell: bash+ run: |+ ls -la dist+ version=$(node -p "require('./package.json').version")+ test -f "dist/nodeterm-Setup-${version}.exe" || { echo "::error::NSIS installer missing"; exit 1; }+ ls dist/nodeterm-*-win.zip >/dev/null 2>&1 || { echo "::error::win zip missing"; exit 1; }diff --git a/.gitignore b/.gitignoreindex 29f76f115..0d4a71606 100644--- a/.gitignore+++ b/.gitignore@@ -8,6 +8,7 @@ dist/*.tsbuildinfobuild/icon.png+build/icon.ico# bundled tmux — a ~2MB universal binary, built by scripts/build-tmux.mjs (the source of truth)# and copied into the app by electron-builder's mac extraResources. Never committed.diff --git a/CLAUDE.md b/CLAUDE.mdindex 92d74eaca..29d074159 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -1900,10 +1900,29 @@ Voice-to-text input captured via microphone, turned into terminal text via on-deBuilt with **electron-builder** (config in the `package.json` `build` block: appId`com.nodeterm.app`, productName `nodeterm`, mac dmg+zip for arm64 **and** x64, `asarUnpack`node-pty, output `dist/`). The app icon is generated from the nodeterm mark by-`scripts/make-icon.mjs` (sharp → `build/icon.png`, 1024², gitignored — regenerated by-`make-icon`); electron-builder derives the `.icns`. Scripts: `npm run make-icon`, `npm run dist`-(local **unsigned** arm64 `.dmg` smoke test). Production release signing/notarization and the-update-feed hosting are handled outside this repo.+`scripts/make-icon.mjs` (sharp → `build/icon.png` 1024² + multi-resolution `build/icon.ico`+for Windows, both gitignored — regenerated by `make-icon`, which every dist script runs first);+electron-builder derives the `.icns` from the PNG. Scripts: `npm run make-icon`, `npm run dist`+(local **unsigned** arm64 `.dmg` smoke test), `npm run dist:win` (unsigned x64 NSIS installer ++zip, `--publish never`). Production release signing/notarization and the update-feed hosting are+handled outside this repo.++**Windows packaging is GROUNDWORK, not a shippable app** (extracted from external PR #276; a+Windows build is unusable until the session-host phase merges). Deliberate decisions: the target+is **NSIS via electron-builder** — the fork switched to Squirrel.Windows+(`electron-builder-squirrel-windows` + an 800-line `windows-installer.mjs` wrapper + its own+update feed), but our pipeline is electron-builder end-to-end and NSIS is built in, needs no+extra dependency, and is what electron-updater's generic provider expects on Windows — so+Squirrel was not adopted. Builds are **unsigned** (no Windows cert; electron-builder skips+signing when no cert env is present). `bootstrap-windows.bat` (repo root) takes a fresh Windows+machine to a built checkout: it verifies Node ≥ 20 / VS Build Tools C++ / Python 3 with exact+winget hints (it never installs machine-wide tools itself, and refuses to run elevated) and runs+`npm ci`. `.github/workflows/win-package-smoke.yml` is a **workflow_dispatch-only** packaging+smoke on windows-latest — build only, never publishes. **Follow-ups, in order:** Windows+auto-update wiring (electron-updater NSIS leg + `latest.yml` on the nodeterm.dev feed — blocked+on signing: an unsigned auto-update is a downgrade in trust), a release.yml Windows job, and the+fork's PE-identity polish (electron-builder leaves `OriginalFilename` empty; the fork's+`resedit`-based afterSign hook fixes it — cosmetic for NSIS, load-bearing only for Squirrel).Auto-update uses **electron-updater** (`src/main/updater.ts`, `initUpdater(onBeforeRestart?)` from `index.ts`):runs **only when `app.isPackaged`** (dev = no-op), checks on launch + every 6h, auto-downloads,diff --git a/bootstrap-windows.bat b/bootstrap-windows.batnew file mode 100644index 000000000..5473cdc44--- /dev/null+++ b/bootstrap-windows.bat@@ -0,0 +1,98 @@+@echo off+setlocal EnableExtensions+rem =============================================================================================+rem bootstrap-windows.bat — take a fresh Windows checkout to an installed, buildable nodeterm.+rem+rem What it does: verifies the toolchain a native-module Electron build needs (Node >= 20, npm,+rem Visual Studio Build Tools with the C++ workload, Python 3 — node-pty and smart-whisper are+rem compiled against Electron's ABI by the npm `postinstall` hook), then runs `npm ci`.+rem+rem What it does NOT do: install anything machine-wide. Each missing tool is reported with the+rem exact winget command to run — installs that touch Program Files are a decision for the+rem human at the keyboard, not for a bootstrap script.+rem+rem Invoke by ABSOLUTE path from automation (cmd /c "C:\path\to\repo\bootstrap-windows.bat"):+rem on machines with NoDefaultCurrentDirectoryInExePath=1 a relative `cmd /c bootstrap-windows.bat`+rem fails even though the file exists, because cmd refuses to search the current directory.+rem+rem After it succeeds:+rem npm run dev - development mode with HMR+rem npm run dist:win - unsigned NSIS installer + zip into dist\ (packaging smoke test)+rem =============================================================================================++set "REPO=%~dp0"+if "%REPO:~-1%"=="\" set "REPO=%REPO:~0,-1%"++rem --- Refuse elevation: npm lifecycle scripts must never run as Administrator. ----------------+"%WINDIR%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -NonInteractive -Command "$p=[Security.Principal.WindowsPrincipal]::new([Security.Principal.WindowsIdentity]::GetCurrent()); if($p.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)){exit 86}else{exit 0}" >nul 2>nul+if errorlevel 86 (+ echo [FAILED] Do not run this script as Administrator. Open a normal prompt and rerun.+ exit /b 1+)++echo === nodeterm Windows bootstrap ===+echo Repository: "%REPO%"+echo.++rem --- Node.js >= 20 ----------------------------------------------------------------------------+where node >nul 2>nul+if errorlevel 1 (+ echo [MISSING] Node.js was not found on PATH.+ echo Install: winget install OpenJS.NodeJS.LTS+ echo then open a NEW prompt and rerun this script.+ exit /b 1+)+for /f "tokens=1 delims=." %%v in ('node -p "process.versions.node"') do set "NODE_MAJOR=%%v"+if %NODE_MAJOR% LSS 20 (+ echo [FAILED] Node.js ^>= 20 is required; found major version %NODE_MAJOR%.+ echo Upgrade: winget install OpenJS.NodeJS.LTS+ exit /b 1+)+echo [OK] Node.js major %NODE_MAJOR%++rem --- Visual Studio Build Tools with the C++ workload (node-gyp / electron-rebuild) ------------+set "VSWHERE=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"+if not exist "%VSWHERE%" (+ echo [MISSING] Visual Studio Build Tools were not found ^(vswhere.exe absent^).+ echo Install: winget install Microsoft.VisualStudio.2022.BuildTools --override "--quiet --add Microsoft.VisualStudio.Workload.VCTools --includeRecommended"+ echo ^(elevated; then open a NEW prompt and rerun this script^)+ exit /b 1+)+"%VSWHERE%" -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath >nul 2>nul+if errorlevel 1 (+ echo [MISSING] A Visual Studio install exists but lacks the C++ build tools component.+ echo Install: winget install Microsoft.VisualStudio.2022.BuildTools --override "--quiet --add Microsoft.VisualStudio.Workload.VCTools --includeRecommended"+ exit /b 1+)+echo [OK] Visual Studio C++ build tools++rem --- Python 3 (node-gyp) -----------------------------------------------------------------------+py -3 --version >nul 2>nul+if errorlevel 1 (+ python --version >nul 2>nul+ if errorlevel 1 (+ echo [MISSING] Python 3 was not found ^(node-gyp needs it^).+ echo Install: winget install Python.Python.3.12+ echo then open a NEW prompt and rerun this script.+ exit /b 1+ )+)+echo [OK] Python 3++rem --- Install dependencies (postinstall patches node-pty + rebuilds native modules) ------------+echo.+echo Running npm ci ...+pushd "%REPO%"+call npm ci+set "NPM_EXIT=%ERRORLEVEL%"+popd+if not "%NPM_EXIT%"=="0" (+ echo [FAILED] npm ci exited with code %NPM_EXIT%. See the output above.+ exit /b %NPM_EXIT%+)++echo.+echo [DONE] Dependencies installed and native modules rebuilt against Electron's ABI.+echo npm run dev - development mode with HMR+echo npm run dist:win - unsigned NSIS installer + zip into dist\+exit /b 0diff --git a/package.json b/package.jsonindex 27a5092a5..288c782f0 100644--- a/package.json+++ b/package.json@@ -25,6 +25,7 @@"make-social": "node scripts/make-social.mjs","dist": "npm run make-icon && electron-vite build && electron-builder --mac --arm64 -c.mac.identity=null -c.mac.notarize=false","dist:linux": "npm run make-icon && electron-vite build && electron-builder --linux",+ "dist:win": "npm run make-icon && electron-vite build && electron-builder --win --x64 --publish never","release": "npm run make-icon && electron-vite build && sh -c 'electron-builder --mac --arm64 --x64 --publish never; s=$?; npm run rebuild; exit $s'","postinstall": "node scripts/patch-node-pty.mjs && electron-rebuild -f -w node-pty,smart-whisper"},@@ -106,6 +107,28 @@}]},+ "win": {+ "icon": "build/icon.ico",+ "target": [+ {+ "target": "nsis",+ "arch": [+ "x64"+ ]+ },+ {+ "target": "zip",+ "arch": [+ "x64"+ ]+ }+ ]+ },+ "nsis": {+ "artifactName": "${productName}-Setup-${version}.${ext}",+ "oneClick": true,+ "perMachine": false+ },"publish": {"provider": "generic","url": "https://nodeterm.dev/updates"diff --git a/scripts/make-icon.mjs b/scripts/make-icon.mjsindex 88d492fcf..5c26f1724 100644--- a/scripts/make-icon.mjs+++ b/scripts/make-icon.mjs@@ -1,5 +1,7 @@-// Renders the nodeterm app icon into build/icon.png (1024x1024) for electron-builder,-// which derives the macOS .icns from it. Run: npm run make-icon+// Renders the nodeterm app icon into build/icon.png (1024x1024) and the multi-resolution+// build/icon.ico used by Windows packaging (both gitignored — regenerated by `npm run+// make-icon`, which every dist script runs first). electron-builder derives the macOS+// .icns from the PNG and hands the ICO to NSIS/the exe resource editor as-is.//// Design: a black macOS-Terminal-style window (dark rounded square + window dots),// with the nodeterm node-graph mark in our purple inside it.@@ -48,3 +50,53 @@ mkdirSync('build', { recursive: true })const png = await sharp(Buffer.from(svg)).png().toBuffer()writeFileSync('build/icon.png', png)console.log('wrote build/icon.png (1024x1024)')++// --- Windows .ico (multi-resolution) ---+//+// electron-builder's `win.icon` expects a real ICO container, not a PNG wearing a `.ico`+// extension — Explorer, the taskbar and "Programs and Features" each pick a frame by SIZE,+// and a single-frame file gets stretched/blurred everywhere but the one size it matches.+// NSIS additionally requires a 256px frame to be present.+//+// Windows Vista+ accepts PNG-compressed frames packed directly inside an ICO container (no+// BMP/DIB re-encoding required), so this renders the same SVG mark at each standard size and+// writes a small hand-rolled ICO container around the PNGs — no extra npm dependency for+// something this documented (MS-ICO: a 6-byte ICONDIR header, then one 16-byte ICONDIRENTRY+// per frame, then the frame bytes back to back).+const ICO_SIZES = [16, 24, 32, 48, 64, 128, 256]++/** Pack PNG buffers (one per size, same order as `sizes`) into a Windows ICO file buffer. */+function packIco(sizes, pngBuffers) {+ const HEADER_BYTES = 6+ const ENTRY_BYTES = 16+ const dir = Buffer.alloc(HEADER_BYTES)+ dir.writeUInt16LE(0, 0) // reserved, must be 0+ dir.writeUInt16LE(1, 2) // image type: 1 = icon+ dir.writeUInt16LE(sizes.length, 4) // frame count++ const entries = []+ let offset = HEADER_BYTES + ENTRY_BYTES * sizes.length+ for (let i = 0; i < sizes.length; i++) {+ const size = sizes[i]+ const data = pngBuffers[i]+ const entry = Buffer.alloc(ENTRY_BYTES)+ // Width/height are single bytes; the ICO format's documented escape is 0 == 256px.+ entry.writeUInt8(size >= 256 ? 0 : size, 0)+ entry.writeUInt8(size >= 256 ? 0 : size, 1)+ entry.writeUInt8(0, 2) // color count: 0 = no palette (true color)+ entry.writeUInt8(0, 3) // reserved, must be 0+ entry.writeUInt16LE(1, 4) // color planes+ entry.writeUInt16LE(32, 6) // bits per pixel (32 = RGBA)+ entry.writeUInt32LE(data.length, 8) // size of this frame's data+ entry.writeUInt32LE(offset, 12) // offset of this frame's data from file start+ entries.push(entry)+ offset += data.length+ }+ return Buffer.concat([dir, ...entries, ...pngBuffers])+}++const icoFrames = await Promise.all(+ ICO_SIZES.map((size) => sharp(Buffer.from(svg)).resize(size, size).png().toBuffer())+)+writeFileSync('build/icon.ico', packIco(ICO_SIZES, icoFrames))+console.log(`wrote build/icon.ico (${ICO_SIZES.join('/')}px frames)`)