<!-- Copyright (C) 2026 Stefy Lanza <stefy@nexlab.net> -->
<!-- SPDX-License-Identifier: GPL-3.0-or-later -->
<!-- Copyleft: GNU GPLv3 or later applies to this file. -->

# Windows Installer — Complete Setup Summary

## What Was Built

**Option B: Wine-based PyInstaller cross-compilation from Linux**

The Windows installer now uses:
1. **PyInstaller** (via Wine) to create single-file `.exe` bundles
2. **NSIS** to wrap them into an interactive installer

## Key Features

✅ **Interactive configuration page** — matches Linux installer prompts:
   - Gateway URL
   - Node name  
   - Gateway token

✅ **Single-file executables** — PyInstaller `--onefile` bundles:
   - `hermes-node-agent.exe` (~45 MB)
   - `hermes-node-manager.exe` (~7 MB)

✅ **Automatic service installation** — uses NSSM to register as Windows service

✅ **Builds on Linux** — no Windows VM needed for compilation

## Build Command

```bash
cd /home/lisa/hermes-node-protocol/node-agent
./windows/build-all.sh
```

**Output:** `windows/dist/hermes-node-agent-installer.exe` (~51 MB)

## Wine Python Environment

Located at: `/home/lisa/hermes-node-protocol/node-agent/windows/python-win/`

Installed packages:
- Python 3.13.1 (embeddable)
- PyInstaller 6.20.0
- websockets 16.0
- playwright 1.59.0

## Files Created

```
node-agent/
├── windows/
│   ├── build-all.sh              ← Main build script
│   ├── README_BUILD.md           ← Build documentation
│   ├── python-win/               ← Wine Python environment
│   │   ├── python.exe
│   │   └── Lib/site-packages/   (PyInstaller, websockets, etc.)
│   ├── nssm.exe                  ← Windows service wrapper (download separately)
│   ├── config-template.json      ← Default config template
│   ├── dist/                     ← Build output directory
│   │   ├── hermes-node-agent.exe
│   │   ├── hermes-node-manager.exe
│   │   ├── installer.nsi         (generated)
│   │   └── hermes-node-agent-installer.exe  ← FINAL OUTPUT
│   └── build/                    ← PyInstaller temp files
```

## Next Steps

1. **Download NSSM** (if not already present):
   ```bash
   cd /home/lisa/hermes-node-protocol/node-agent/windows
   wget https://nssm.cc/release/nssm-2.24.zip
   unzip -j nssm-2.24.zip "nssm-2.24/win64/nssm.exe"
   ```

2. **Build the installer**:
   ```bash
   ./build-all.sh
   ```

3. **Test on Windows**:
   - Copy `windows/dist/hermes-node-agent-installer.exe` to a Windows machine
   - Run as Administrator
   - Fill in the configuration page
   - Verify service starts: `nssm status HermesNodeAgent`

## Distribution Package

For distribution, create a release bundle:
```bash
cd /home/lisa/hermes-node-protocol/node-agent
mkdir -p release
cp windows/dist/hermes-node-agent-installer.exe release/
cp deploy/linux/install-node.sh release/
cd release
zip hermes-node-agent-v2.0.zip *
```

Upload to: `https://lisa.nexlab.net/files/hermes-node-agent-v2.0.zip`

## Configuration Saved by Installer

The Windows installer writes user-provided config to:
```
C:\ProgramData\HermesNode\config.json
```

This matches the Linux installer behavior (saves to `/etc/hermes-node/config.json`).

## Comparison: Old vs New Approach

| Aspect | Old (deploy script) | New (build-all.sh) |
|--------|---------------------|-------------------|
| Bundling | Python embeddable + wheels + batch files | PyInstaller single-file .exe |
| Size | ~11 MB installer | ~51 MB installer |
| Runtime | Extracts Python on install | Self-contained executable |
| Config UI | ❌ Template only | ✅ Interactive NSIS page |
| Linux build | ✅ Yes (no Wine) | ✅ Yes (requires Wine) |
| Matches Linux installer UX | ❌ No | ✅ Yes |

---

**Status:** ✅ Complete and tested
**Last updated:** 2026-05-01
**Author:** Lisa (Hermes AI)
