Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .github/workflows/ci-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Windows

on:
push:
branches: [main]
pull_request:

jobs:
core-tests:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.0.x"

- name: Test core library
run: dotnet test apps/windows/WInstaller.Core.Tests/WInstaller.Core.Tests.csproj

# The core targets plain net8.0 by design (see apps/windows/README.md), so
# the same tests also run on Linux — proving no accidental Windows-only APIs
# leak into the domain layer.
core-tests-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.0.x"

- name: Test core library
run: dotnet test apps/windows/WInstaller.Core.Tests/WInstaller.Core.Tests.csproj

app-build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.0.x"

- name: Publish WinUI 3 app (unpackaged, self-contained)
run: >
dotnet publish apps/windows/WInstaller.App/WInstaller.App.csproj
-c Release -r win-x64 -p:Platform=x64
-p:WindowsAppSDKSelfContained=true --self-contained true
-o ${{ runner.temp }}/publish
15 changes: 15 additions & 0 deletions .github/workflows/parity.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,18 @@ jobs:

- name: Check screen parity
run: python3 scripts/check_screen_parity.py

strings-sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install dependencies
run: pip install pyyaml

- name: Check generated strings are in sync with copy.yaml
run: python3 scripts/gen_strings_dotnet.py --check
53 changes: 53 additions & 0 deletions .github/workflows/release-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Release Windows app

on:
release:
types: [published]
workflow_dispatch:
inputs:
tag:
description: "Existing release tag to attach the built app to"
required: true

permissions:
contents: write

jobs:
build-and-upload:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.release.tag_name || inputs.tag }}

- uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.0.x"

- name: Test core library
run: dotnet test apps/windows/WInstaller.Core.Tests/WInstaller.Core.Tests.csproj

# Unpackaged self-contained publish: runs on a clean Windows 10/11
# machine with no runtime or Windows App SDK install. The zip is
# unsigned until code signing is provisioned (ADR-0006 Phase 4 exit
# criterion); MSIX becomes the primary format once a certificate exists.
- name: Publish WinUI 3 app (portable, self-contained)
run: >
dotnet publish apps/windows/WInstaller.App/WInstaller.App.csproj
-c Release -r win-x64 -p:Platform=x64
-p:WindowsAppSDKSelfContained=true --self-contained true
-o ${{ runner.temp }}/publish

- name: Zip portable app
shell: pwsh
run: >
Compress-Archive -Path "${{ runner.temp }}/publish/*"
-DestinationPath "${{ runner.temp }}/wInstaller-Windows-x64.zip"

- name: Upload asset to release
shell: pwsh
env:
GH_TOKEN: ${{ github.token }}
run: |
$tag = "${{ github.event.release.tag_name || inputs.tag }}"
gh release upload $tag "${{ runner.temp }}/wInstaller-Windows-x64.zip" --clobber -R "${{ github.repository }}"
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,9 @@ xcuserdata/
__pycache__/
*.pyc


# .NET / WinUI (apps/windows)
bin/
obj/
publish/
*.user
61 changes: 51 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

<p align="center">
<a href="https://github.com/pedrobritx/winstaller/actions/workflows/ci-macos.yml"><img alt="macOS CI" src="https://github.com/pedrobritx/winstaller/actions/workflows/ci-macos.yml/badge.svg"></a>
<a href="https://github.com/pedrobritx/winstaller/actions/workflows/ci-windows.yml"><img alt="Windows CI" src="https://github.com/pedrobritx/winstaller/actions/workflows/ci-windows.yml/badge.svg"></a>
<a href="https://github.com/pedrobritx/winstaller/actions/workflows/docs-lint.yml"><img alt="Docs lint" src="https://github.com/pedrobritx/winstaller/actions/workflows/docs-lint.yml/badge.svg"></a>
<a href="LICENSE.md"><img alt="License: Noncommercial" src="https://img.shields.io/badge/license-noncommercial-blue"></a>
</p>
Expand All @@ -22,16 +23,19 @@ before destructive actions, validates the result, and keeps everything local.

**wInstaller is expanding from macOS-only to macOS, Windows, and Linux.** Each
platform gets a fully native UI — SwiftUI, WinUI 3, and GTK4/libadwaita — built
on one shared Rust core engine. See [Architecture](#architecture) below and
[docs/adr/](docs/adr/) for the full reasoning.
on one shared core engine. The macOS and Windows apps have landed; Linux is
next. See [Architecture](#architecture) below and [docs/adr/](docs/adr/) for
the full reasoning.

## Download

| macOS | Windows | Linux |
|---|---|---|
| [Releases](https://github.com/pedrobritx/winstaller/releases) | *Coming soon (Phase 3)* | *Coming soon (Phase 2)* |
| [Releases](https://github.com/pedrobritx/winstaller/releases) | [Releases](https://github.com/pedrobritx/winstaller/releases) | *Coming soon (Phase 2)* |

Until signed release artifacts exist for a platform, build from source — see below.
Release artifacts are currently unsigned (Gatekeeper/SmartScreen will warn on
first launch); signing and notarization are tracked for 1.0. You can always
build from source instead — see below.

## Status

Expand All @@ -48,11 +52,25 @@ The macOS app is feature-complete for the first-release happy path:
- Liquid Glass SwiftUI interface (macOS 26) with native-material fallback
- App icon and `.app` packaging script

The Windows app covers the same first-release happy path natively
(`apps/windows/`):

- C# domain core mirroring the same state machine and safety gates
(`WInstaller.Core`, unit-tested on Windows *and* Linux in CI)
- Disk enumeration via PowerShell storage cmdlets with boot/system-disk
filtering at every layer
- Read-only ISO mount + inspection (`Mount-DiskImage -Access ReadOnly`)
- Real erase → GPT/FAT32 format → `robocopy` → validate → eject pipeline
- `DISM /Split-Image` for oversized `install.wim` files (no third-party tools)
- A single UAC prompt scoped to the destructive step only (ADR-0003)
- Local logging with user-profile redaction, Simulate (dry-run) mode
- WinUI 3 assistant UI with Mica, generated from the shared string table

> **Safety note:** Real disk operations format the selected removable drive.
> Always verify the target and prefer the Simulate toggle first. Destructive
> operations have not been run on hardware in CI — test on a spare USB.

Windows and Linux native apps are planned (see [ROADMAP.md](docs/specs/ROADMAP.md) and the
The Linux native app is planned next (see [ROADMAP.md](docs/specs/ROADMAP.md) and the
phased delivery plan referenced from the ADRs).

## Building from source
Expand Down Expand Up @@ -96,11 +114,28 @@ swift test \

**Requirements:** Swift 6.0+, macOS 15.0+, Xcode 16+ or Command Line Tools.

### Windows *(planned — Phase 3)*
### Windows

Requires Windows 10 1809+ and the [.NET 8 SDK](https://dotnet.microsoft.com/download/dotnet/8.0).

The Windows app (WinUI 3 + C#/.NET, `apps/windows/`) does not exist yet. Once it
lands, build instructions will appear here (`dotnet build` against
`WInstaller.sln`).
```powershell
git clone https://github.com/pedrobritx/winstaller.git
cd winstaller/apps/windows

dotnet build WInstaller.sln # core + tests + WinUI 3 app
dotnet test WInstaller.Core.Tests # engine/parser/executor tests
dotnet run --project WInstaller.App # launch the assistant
```

To produce the portable release build (what CI attaches to releases):

```powershell
dotnet publish WInstaller.App -c Release -r win-x64 -p:Platform=x64 `
-p:WindowsAppSDKSelfContained=true --self-contained true -o publish
```

See [apps/windows/README.md](apps/windows/README.md) for how the app drives
PowerShell storage cmdlets, robocopy, and DISM, and for the elevation model.

### Linux *(planned — Phase 2)*

Expand Down Expand Up @@ -135,7 +170,7 @@ or [VISION.md](docs/specs/VISION.md) for the complete set of interaction princip

## Architecture

wInstaller is three native UIs sharing one Rust core engine:
wInstaller is three native UIs sharing one core engine:

- **macOS**: SwiftUI, calling into the core via a Swift wrapper package.
- **Windows**: WinUI 3 + C#/.NET, calling into the core via P/Invoke.
Expand All @@ -148,6 +183,12 @@ native, with no cross-platform UI framework. See [ARCHITECTURE.md](docs/specs/AR
and every decision record under [docs/adr/](docs/adr/), starting with
[docs/adr/0001-core-language-and-ffi.md](docs/adr/0001-core-language-and-ffi.md).

> **Transition note:** the shared Rust core (ADR-0001) has not landed yet.
> Today the macOS app implements the core in Swift (`Sources/WInstallerCore`)
> and the Windows app in C# (`apps/windows/WInstaller.Core`) — both against
> the same screen registry, shared copy source, and safety rules, so swapping
> in the Rust core later replaces internals, not behavior.

## Documentation Map

- [PRODUCT.md](docs/specs/PRODUCT.md): mission, users, success criteria, and non-goals.
Expand Down
79 changes: 79 additions & 0 deletions apps/windows/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# wInstaller for Windows

The native Windows app: **WinUI 3 + C#/.NET 8** (ADR-0004), sharing the
canonical screen flow, copy, and design tokens with the macOS and Linux apps
(ADR-0008).

## Layout

| Project | Purpose |
|---|---|
| `WInstaller.Core` | Domain logic: typed state machine, ISO detection, disk enumeration, safety gates, executor, local logging. Targets plain `net8.0` so tests run on any OS. |
| `WInstaller.Core/Scripts/*.ps1` | Bundled PowerShell helpers. Every system call is argv-only (`-File script.ps1 -Param value`) — never a shell-interpolated string. |
| `WInstaller.App` | The WinUI 3 assistant UI (unpackaged deployment). |
| `WInstaller.Core.Tests` | xunit tests for the engine, parsers, executor pipeline, and logger redaction. |

> **Transition note (ADR-0001):** the long-term plan is one shared Rust core
> behind a C ABI. Until that lands, this app mirrors the macOS approach — the
> core domain logic is implemented natively (here in C#, `WInstaller.Core`)
> against the same screen registry, copy source, and safety rules, so the
> eventual swap to the Rust core replaces internals, not behavior.

## How it talks to Windows

- **Disk enumeration**: `Get-Disk`/`Get-Partition`/`Get-Volume` via
`list-disks.ps1`, parsed defensively as JSON. Boot/system disks are filtered
out and refused at every layer.
- **ISO inspection**: `Mount-DiskImage -Access ReadOnly`, directory scan,
dismount. The ISO is never modified.
- **Erase/format**: `prepare-usb.ps1` (Clear-Disk → Initialize-Disk GPT →
New-Partition → Format-Volume FAT32). This is the only elevated step — a
single UAC prompt scoped to the destructive operation (ADR-0003), *after*
the type-the-drive-name confirmation. The script re-checks the
boot/system/USB-bus gates inside the elevated context.
- **Copy**: `robocopy /E` (exit codes < 8 are success).
- **Oversized `install.wim`**: split into `.swm` parts with
`DISM /Split-Image` (ships with Windows — no third-party tool needed).
- **Eject**: Shell.Application `InvokeVerb('Eject')`.

FAT32 note: Windows refuses to format FAT32 volumes larger than 32 GB, so on
bigger sticks wInstaller creates a 32 GB installer partition and leaves the
rest unallocated (the warning is surfaced in the plan review step).

## Build and run

Requires Windows 10 1809+ and the [.NET 8 SDK](https://dotnet.microsoft.com/download/dotnet/8.0).

```powershell
cd apps/windows
dotnet build WInstaller.sln # builds core + tests + WinUI app (x64)
dotnet test WInstaller.Core.Tests # engine/parser/executor tests
dotnet run --project WInstaller.App # launch the assistant
```

The core library and its tests also build and run on macOS/Linux
(`dotnet test WInstaller.Core.Tests`); only `WInstaller.App` needs Windows.

## Package (portable zip)

```powershell
dotnet publish WInstaller.App -c Release -r win-x64 -p:Platform=x64 `
-p:WindowsAppSDKSelfContained=true --self-contained true -o publish
Compress-Archive publish\* wInstaller-Windows-x64.zip
```

This is what `.github/workflows/release-windows.yml` attaches to GitHub
releases. The artifact is currently **unsigned** — SmartScreen will warn on
first run until code signing is provisioned (tracked as the ADR-0006 Phase 4
exit criterion; MSIX becomes the primary format once a certificate exists).

## Strings

User-facing copy is generated — do not edit `Strings/AppStrings.resx` by hand:

```bash
# edit shared/strings/copy.yaml, then:
python3 scripts/gen_strings_dotnet.py
```

CI fails if the committed `.resx` drifts from `copy.yaml`.
12 changes: 12 additions & 0 deletions apps/windows/WInstaller.App/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Application
x:Class="WInstaller.App.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
19 changes: 19 additions & 0 deletions apps/windows/WInstaller.App/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using Microsoft.UI.Xaml;

namespace WInstaller.App;

public partial class App : Application
{
private Window? _window;

public App()
{
InitializeComponent();
}

protected override void OnLaunched(LaunchActivatedEventArgs args)
{
_window = new MainWindow();
_window.Activate();
}
}
27 changes: 27 additions & 0 deletions apps/windows/WInstaller.App/AppStrings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using System.Resources;

namespace WInstaller.App;

/// <summary>
/// Reads the string table generated from shared/strings/copy.yaml
/// (scripts/gen_strings_dotnet.py). Do not hardcode user-facing copy —
/// add it to copy.yaml and regenerate (ADR-0008).
/// </summary>
internal static class AppStrings
{
private static readonly ResourceManager Manager =
new("WInstaller.App.Strings.AppStrings", typeof(AppStrings).Assembly);

public static string Get(string key) => Manager.GetString(key) ?? key;

/// <summary>Fills copy.yaml-style placeholders like {drive_name}.</summary>
public static string Format(string key, params (string Name, string Value)[] replacements)
{
var text = Get(key);
foreach (var (name, value) in replacements)
{
text = text.Replace("{" + name + "}", value);
}
return text;
}
}
Binary file added apps/windows/WInstaller.App/Assets/wInstaller.ico
Binary file not shown.
Loading
Loading