# Windows EXE Packaging

This project ships Windows users an installer EXE that installs the prepared local app package. The installed app keeps business data under:

```text
%LOCALAPPDATA%\Facebook AI Operator
```

Uninstalling the program removes the installed app files, but does not delete customer data, logs, licenses, uploads, Chrome debug profile, or evidence files.

## Build The Client Package

From macOS, Linux, WSL, or Git Bash:

```bash
npm run package:windows
```

This creates:

```text
dist/windows-client-package/FacebookAIOperator
dist/FacebookAIOperator-0.2.0-client-windows.zip
dist/FacebookAIOperator-client-windows.zip
```

By default the package includes the Windows x64 Node.js runtime under:

```text
runtime/node
```

Set `FACEBOOK_AUTO_BUNDLE_NODE=false` only if the customer machine will already have Node.js 20+ installed.

## Build The Installer EXE

Install Inno Setup 6 on a Windows build machine, copy or keep this repo there, then run:

```powershell
.\scripts\build-windows-installer.ps1
```

Or from Git Bash / macOS with a configured Inno compiler:

```bash
npm run package:windows:installer
```

The output is:

```text
dist/FacebookAIOperator-Setup-0.2.0.exe
```

The installer creates:

- Start menu shortcut: `Facebook AI Operator`
- Optional desktop shortcut: `Facebook AI Operator`
- Start menu shortcut: `Facebook AI Operator Debug Chrome`

The main shortcut runs `Launch Facebook AI Operator.vbs`, which hides the console window and delegates to `Start Facebook AI Operator.cmd`.

## Windows Login-State Flow

1. Install and launch `Facebook AI Operator`.
2. The launcher starts the local server and opens the workbench.
3. The launcher also attempts to start `Start Debug Chrome.cmd`.
4. The customer logs into Facebook once in that debug Chrome window.
5. In the setup page, click `检测并标记 Facebook 登录`.

The dedicated debug Chrome profile is stored under:

```text
%LOCALAPPDATA%\Facebook AI Operator\ChromeProfile
```
