# SignalReach Beta Packaging

This repo can now be staged into a clean beta bundle and turned into a Windows installer without shipping local run debris.

## 1. Clean the repo

From the repo root:

```powershell
powershell -ExecutionPolicy Bypass -File .\packaging\clean_repo.ps1
```

What it removes by default:

- `.venv`
- `build`, `dist`, `signalreach.egg-info`
- `dem_cache`
- `out\runs`
- `out\_ui_staging`
- `state_transfer_*`
- `__pycache__`, `*.pyc`, `*.bak`, `*.tmp`, `*.old`

Optional:

```powershell
powershell -ExecutionPolicy Bypass -File .\packaging\clean_repo.ps1 -IncludeLogs -IncludeCasepacks
```

## 2. Stage a clean beta bundle

```powershell
powershell -ExecutionPolicy Bypass -File .\packaging\stage_beta_bundle.ps1 -CleanFirst
```

That creates:

- `dist\signalreach-beta`
- `dist\signalreach-beta.zip`

The staged folder and zip contain only the app files needed for a beta drop:

- `signalreach\`
- `ui\`
- `docs\`
- `examples\`
- `missions\`
- `packaging\bootstrap_beta_env.py`
- launchers and Python packaging metadata

The staged bundle intentionally excludes local caches, run output, state transfer folders, `.venv`, and Python bytecode.
It also writes `signalreach_runtime_profile.json`, which makes the beta build launch in `standard` tier, enables signed license enforcement, and hides environmental penalty controls such as vegetation, structure, and moisture.
The staged beta bundles now include a signed beta license plus `license_public.json`, and the current beta expires on **July 1, 2026**.

## 3. Build the installer

Install [Inno Setup 6](https://jrsoftware.org/isinfo.php), then run:

```powershell
powershell -ExecutionPolicy Bypass -File .\packaging\build_beta_installer.ps1 -CleanFirst
```

That will:

- refresh the clean staged bundle
- compile `packaging\signalreach_beta.iss`
- write `dist\signalreach-beta-installer.exe`

## 4. What the beta installer does

The installer copies the staged bundle into `Program Files\SignalReach Beta`, then runs:

`packaging\bootstrap_beta_env.cmd`

That bootstrap step:

- finds Python 3.12+
- installs Python with `winget` if it is missing
- creates a local `.venv`
- runs `pip install .[ui]`

Because the UI dependencies are defined as the `ui` extra in [pyproject.toml](/C:/dev/rfplanner/pyproject.toml), one install step provisions both:

- the CLI engine package
- the FastAPI/uvicorn UI server

## 5. Launcher behavior

[START_SIGNALREACH.exe](/C:/dev/rfplanner/dist/signalreach-beta/START_SIGNALREACH.exe) is now the friendly Windows launcher for packaged beta builds. It opens a small status window, avoids PowerShell in the shipped launch path, and opens the browser when the local UI server is ready.

The shipped Windows beta keeps the top level simple:

- `START_SIGNALREACH.exe`
- `STOP_SIGNALREACH.exe`
- `SignalReach\...`

The bootstrap logic for the Windows beta now lives in [bootstrap_beta_env.py](/C:/dev/rfplanner/packaging/bootstrap_beta_env.py), and the top-level Windows launcher files are native launcher exes built from Python/Tkinter rather than a PowerShell wrapper.

## 6. Linux beta archive

For Linux peer review builds, stage a Linux-friendly beta bundle and `tar.gz` archive:

```powershell
powershell -ExecutionPolicy Bypass -File .\packaging\stage_beta_bundle_linux.ps1 -CleanFirst
```

That creates:

- `dist\signalreach-beta-linux`
- `dist\signalreach-beta-linux.tar.gz`

The Linux archive includes:

- `launch_signalreach.sh`
- `packaging\bootstrap_beta_env.sh`
- the same beta runtime profile used by the Windows beta bundle
- a signed beta license that expires on July 1, 2026

Linux testers should:

```bash
tar -xzf signalreach-beta-linux.tar.gz
cd signalreach-beta-linux
chmod +x launch_signalreach.sh packaging/bootstrap_beta_env.sh
./launch_signalreach.sh
```

Notes:

- Linux beta expects Python 3.12+ to already be installed.
- First launch creates a local `.venv` and runs `pip install '.[ui]'`.
- Runtime data defaults to `$XDG_DATA_HOME/SignalReach` or `~/.local/share/SignalReach`.
- The bundled beta license expires on July 1, 2026.

## 7. macOS beta archive

For macOS peer review builds, stage a macOS-friendly beta bundle and `tar.gz` archive:

```powershell
powershell -ExecutionPolicy Bypass -File .\packaging\stage_beta_bundle_macos.ps1 -CleanFirst
```

That creates:

- `dist\signalreach-beta-macos`
- `dist\signalreach-beta-macos.tar.gz`

The macOS archive includes:

- `launch_signalreach.command`
- `launch_signalreach.sh`
- `packaging\bootstrap_beta_env.sh`
- the same beta runtime profile used by the Windows and Linux beta bundles
- a signed beta license that expires on July 1, 2026

macOS testers should:

```bash
tar -xzf signalreach-beta-macos.tar.gz
cd signalreach-beta-macos
chmod +x launch_signalreach.command launch_signalreach.sh packaging/bootstrap_beta_env.sh
./launch_signalreach.command
```

Notes:

- macOS beta expects Python 3.12+ to already be installed.
- First launch creates a local `.venv` and runs `pip install '.[ui]'`.
- Runtime data defaults to `~/Library/Application Support/SignalReach`.
- The bundled beta license expires on July 1, 2026.
