# arelius-d/fedupdate architecture

> Architecture diagram of the GitHub repository arelius-d/fedupdate, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/arelius-d/fedupdate
- Repository: https://github.com/arelius-d/fedupdate

## Overview

#### Purpose and entry points
FedUpDate is a Windows 11 update-control suite that consolidates Windows Update/Defender, WinGet, and Microsoft Store updates while enforcing user-selected update-service policies and supporting rollback. The main dispatcher is `fedupdate.ps1`, with terminal compatibility through `fedupdate.cmd` and silent GUI launch through `fedupdate-gui.vbs`. Installation, upgrade, and removal lifecycle actions start in `install.ps1`.

#### Core orchestration
`core/Engine.psm1` is the application-level coordinator: it loads shared configuration/logging and routes CLI operations such as scan, update, watchdog, rollback, scheduling, versioning, and self-update. `fedupdate.ps1` selects CLI, TUI, or GUI execution mode and passes command intent into the core. Shared persistent behavior is controlled by `core/Config.ps1`; operational events are emitted through `core/Logger.ps1`.

#### Unified update pipeline
The update flow has three independently invocable rings, coordinated for `update -All`:
- OS and Defender updates: `core/OSUpdateEngine.ps1`, using Windows Update Agent COM and Defender tooling.
- Third-party application discovery/upgrades: `core/WingetEngine.ps1`, invoking and interpreting `winget.exe`.
- Store application synchronization: `core/StoreEngine.ps1`, using Windows MDM/CIM update-scan facilities.

The orchestration boundary permits one-ring updates or a full sequence, and supports `-WhatIf` to propagate simulation semantics without state mutation.

#### State protection and rollback
`core/AntiTamperWatchdog.ps1` audits and enforces selected service/task policies around Windows update behavior, including an on-boot scheduled enforcement guard. Any managed registry, service, or task changes must pass through the state-recording boundary in `core/RollbackEngine.ps1`, which maintains the reversible ledger and restores latest, all, or selected transactions. This makes policy enforcement distinct from update installation: updates may run while persistent system-control changes remain auditable and reversible.

#### Restart and automation control
`core/RebootEngine.ps1` evaluates multiple Windows pending-restart indicators and applies configured or per-run reboot policy after update work. It intentionally distinguishes actionable servicing reboots from ordinary installer cleanup. `core/Scheduler.ps1` owns Windows Task Scheduler registration/removal for recurring automated runs; scheduled work re-enters the same core command pipeline rather than duplicating update logic.

#### Interface adapters
The ANSI terminal dashboard in `tui/TuiEngine.ps1` is an interactive adapter over core operations. The desktop application is a local desktop-hosted web UI: `gui/src/Program.cs` supplies the native WPF/WebView2 host, `gui/Server.ps1` provides the local HTTP/IPC bridge to PowerShell operations, and `gui/app.js` manages browser-side state and commands. UI layers should remain clients of the core rather than directly altering update or rollback state.

#### Runtime and external boundaries
The system runs primarily in Windows PowerShell, Windows service/task/registry APIs, CIM/WMI, and Windows Update COM. External executables/services include `winget.exe`, Defender’s `MpCmdRun.exe`, Microsoft Store/MDM facilities, and Windows Task Scheduler. Desktop GUI build/runtime depends on the Windows C# compiler and Microsoft WebView2 libraries, assembled through `gui/build.ps1` and `gui/SetupLibs.ps1`.

Main entry points: [`core/Engine.psm1`](https://github.com/arelius-d/fedupdate/blob/main/core/Engine.psm1) (Application coordinator), [`core/AntiTamperWatchdog.ps1`](https://github.com/arelius-d/fedupdate/blob/main/core/AntiTamperWatchdog.ps1) (Policy watchdog), [`core/Scheduler.ps1`](https://github.com/arelius-d/fedupdate/blob/main/core/Scheduler.ps1) (Automation scheduler), [`core/OSUpdateEngine.ps1`](https://github.com/arelius-d/fedupdate/blob/main/core/OSUpdateEngine.ps1) (OS & Defender updates)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry &amp; lifecycle"]
  node_dispatcher["PowerShell dispatcher<br/>entry script<br/>[fedupdate.ps1]"]
  node_cmd["CMD compatibility<br/>launcher<br/>[fedupdate.cmd]"]
  node_vbs["Silent GUI launcher<br/>[fedupdate-gui.vbs]"]
  node_installer["Install lifecycle<br/>lifecycle script<br/>[install.ps1]"]
end

subgraph group_core["Core control"]
  node_engine["Application coordinator<br/>PowerShell module<br/>[Engine.psm1]"]
  node_config[("Persistent configuration<br/>shared state<br/>[Config.ps1]")]
  node_logger["Operational logging<br/>shared service<br/>[Logger.ps1]"]
  node_watchdog["Policy watchdog<br/>policy enforcement"]
  node_rollback[("Rollback ledger<br/>state protection<br/>[RollbackEngine.ps1]")]
  node_reboot["Restart policy<br/>reboot control<br/>[RebootEngine.ps1]"]
  node_scheduler["Automation scheduler<br/>task scheduling<br/>[Scheduler.ps1]"]
end

subgraph group_updates["Update rings"]
  node_osupdate["OS &amp; Defender updates<br/>update ring<br/>[OSUpdateEngine.ps1]"]
  node_winget["Third-party app updates<br/>update ring<br/>[WingetEngine.ps1]"]
  node_store["Store app updates<br/>update ring<br/>[StoreEngine.ps1]"]
end

subgraph group_interfaces["Interface adapters"]
  node_tui["ANSI terminal dashboard<br/>interactive adapter<br/>[TuiEngine.ps1]"]
  node_guihost["WPF/WebView2 host<br/>desktop host<br/>[Program.cs]"]
  node_guiserver["Local GUI bridge<br/>HTTP/IPC adapter<br/>[Server.ps1]"]
  node_guiapp["Browser UI<br/>web client<br/>[app.js]"]
end

subgraph group_windows["Windows &amp; external boundaries"]
  node_windowsapi{{"Windows update &amp; policy APIs<br/>platform boundary"}}
  node_external{{"Update executables &amp; services<br/>external boundary"}}
end

node_cmd -->|"launches"| node_dispatcher
node_vbs -->|"launches GUI mode"| node_dispatcher
node_dispatcher -->|"passes command intent"| node_engine
node_installer -->|"installs and upgrades"| node_engine
node_engine -->|"loads policy"| node_config
node_engine -->|"emits events"| node_logger
node_engine -->|"runs OS ring"| node_osupdate
node_engine -->|"runs app ring"| node_winget
node_engine -->|"runs Store ring"| node_store
node_engine -->|"controls enforcement"| node_watchdog
node_engine -->|"requests rollback"| node_rollback
node_engine -->|"applies reboot policy"| node_reboot
node_engine -->|"manages automation"| node_scheduler
node_watchdog -->|"records managed changes"| node_rollback
node_watchdog -->|"enforces services and tasks"| node_windowsapi
node_rollback -->|"restores system state"| node_windowsapi
node_reboot -->|"reads restart indicators"| node_windowsapi
node_scheduler -->|"registers scheduled tasks"| node_windowsapi
node_scheduler -.->|"scheduled re-entry"| node_engine
node_osupdate -->|"uses Update COM"| node_windowsapi
node_osupdate -->|"runs Defender tooling"| node_external
node_winget -->|"invokes winget"| node_external
node_store -->|"uses Store/MDM scan"| node_external
node_tui -->|"invokes core commands"| node_engine
node_guiapp -->|"sends UI commands"| node_guiserver
node_guiserver -->|"bridges operations"| node_engine
node_guihost -->|"hosts"| node_guiapp
node_guihost -->|"hosts local bridge"| node_guiserver

click node_dispatcher "https://github.com/arelius-d/fedupdate/blob/main/fedupdate.ps1"
click node_cmd "https://github.com/arelius-d/fedupdate/blob/main/fedupdate.cmd"
click node_vbs "https://github.com/arelius-d/fedupdate/blob/main/fedupdate-gui.vbs"
click node_installer "https://github.com/arelius-d/fedupdate/blob/main/install.ps1"
click node_engine "https://github.com/arelius-d/fedupdate/blob/main/core/Engine.psm1"
click node_config "https://github.com/arelius-d/fedupdate/blob/main/core/Config.ps1"
click node_logger "https://github.com/arelius-d/fedupdate/blob/main/core/Logger.ps1"
click node_watchdog "https://github.com/arelius-d/fedupdate/blob/main/core/AntiTamperWatchdog.ps1"
click node_rollback "https://github.com/arelius-d/fedupdate/blob/main/core/RollbackEngine.ps1"
click node_reboot "https://github.com/arelius-d/fedupdate/blob/main/core/RebootEngine.ps1"
click node_scheduler "https://github.com/arelius-d/fedupdate/blob/main/core/Scheduler.ps1"
click node_osupdate "https://github.com/arelius-d/fedupdate/blob/main/core/OSUpdateEngine.ps1"
click node_winget "https://github.com/arelius-d/fedupdate/blob/main/core/WingetEngine.ps1"
click node_store "https://github.com/arelius-d/fedupdate/blob/main/core/StoreEngine.ps1"
click node_tui "https://github.com/arelius-d/fedupdate/blob/main/tui/TuiEngine.ps1"
click node_guihost "https://github.com/arelius-d/fedupdate/blob/main/gui/src/Program.cs"
click node_guiserver "https://github.com/arelius-d/fedupdate/blob/main/gui/Server.ps1"
click node_guiapp "https://github.com/arelius-d/fedupdate/blob/main/gui/app.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_dispatcher,node_cmd,node_vbs,node_installer toneBlue
class node_engine,node_config,node_logger,node_watchdog,node_rollback,node_reboot,node_scheduler toneAmber
class node_osupdate,node_winget,node_store toneMint
class node_tui,node_guihost,node_guiserver,node_guiapp toneRose
class node_windowsapi,node_external toneIndigo
```

## Components

### Entry & lifecycle

- [PowerShell dispatcher](https://github.com/arelius-d/fedupdate/blob/main/fedupdate.ps1): entry script · Selects CLI, TUI, or GUI mode. · `fedupdate.ps1`
- [CMD compatibility](https://github.com/arelius-d/fedupdate/blob/main/fedupdate.cmd): launcher · `fedupdate.cmd`
- [Silent GUI launcher](https://github.com/arelius-d/fedupdate/blob/main/fedupdate-gui.vbs): launcher · `fedupdate-gui.vbs`
- [Install lifecycle](https://github.com/arelius-d/fedupdate/blob/main/install.ps1): lifecycle script · Installs, upgrades, and removes the suite. · `install.ps1`

### Core control

- [Application coordinator](https://github.com/arelius-d/fedupdate/blob/main/core/Engine.psm1): PowerShell module · Routes commands and coordinates shared services. · `core/Engine.psm1`
- [Persistent configuration](https://github.com/arelius-d/fedupdate/blob/main/core/Config.ps1): shared state · `core/Config.ps1`
- [Operational logging](https://github.com/arelius-d/fedupdate/blob/main/core/Logger.ps1): shared service · `core/Logger.ps1`
- [Policy watchdog](https://github.com/arelius-d/fedupdate/blob/main/core/AntiTamperWatchdog.ps1): policy enforcement · Audits and enforces update service and task policies. · `core/AntiTamperWatchdog.ps1`
- [Rollback ledger](https://github.com/arelius-d/fedupdate/blob/main/core/RollbackEngine.ps1): state protection · Records managed changes and restores transactions. · `core/RollbackEngine.ps1`
- [Restart policy](https://github.com/arelius-d/fedupdate/blob/main/core/RebootEngine.ps1): reboot control · Evaluates pending restart indicators after update work. · `core/RebootEngine.ps1`
- [Automation scheduler](https://github.com/arelius-d/fedupdate/blob/main/core/Scheduler.ps1): task scheduling · Registers recurring runs that re-enter the command pipeline. · `core/Scheduler.ps1`

### Update rings

- [OS & Defender updates](https://github.com/arelius-d/fedupdate/blob/main/core/OSUpdateEngine.ps1): update ring · `core/OSUpdateEngine.ps1`
- [Third-party app updates](https://github.com/arelius-d/fedupdate/blob/main/core/WingetEngine.ps1): update ring · `core/WingetEngine.ps1`
- [Store app updates](https://github.com/arelius-d/fedupdate/blob/main/core/StoreEngine.ps1): update ring · `core/StoreEngine.ps1`

### Interface adapters

- [ANSI terminal dashboard](https://github.com/arelius-d/fedupdate/blob/main/tui/TuiEngine.ps1): interactive adapter · `tui/TuiEngine.ps1`
- [WPF/WebView2 host](https://github.com/arelius-d/fedupdate/blob/main/gui/src/Program.cs): desktop host · `gui/src/Program.cs`
- [Local GUI bridge](https://github.com/arelius-d/fedupdate/blob/main/gui/Server.ps1): HTTP/IPC adapter · `gui/Server.ps1`
- [Browser UI](https://github.com/arelius-d/fedupdate/blob/main/gui/app.js): web client · `gui/app.js`

### Windows & external boundaries

- **Windows update & policy APIs**: platform boundary · COM, CIM/WMI, registry, services, and Task Scheduler.
- **Update executables & services**: external boundary · winget, Defender tooling, and Store/MDM facilities.

## Connections

- CMD compatibility → PowerShell dispatcher: launches
- Silent GUI launcher → PowerShell dispatcher: launches GUI mode
- PowerShell dispatcher → Application coordinator: passes command intent
- Install lifecycle → Application coordinator: installs and upgrades
- Application coordinator → Persistent configuration: loads policy
- Application coordinator → Operational logging: emits events
- Application coordinator → OS & Defender updates: runs OS ring
- Application coordinator → Third-party app updates: runs app ring
- Application coordinator → Store app updates: runs Store ring
- Application coordinator → Policy watchdog: controls enforcement
- Application coordinator → Rollback ledger: requests rollback
- Application coordinator → Restart policy: applies reboot policy
- Application coordinator → Automation scheduler: manages automation
- Policy watchdog → Rollback ledger: records managed changes
- Policy watchdog → Windows update & policy APIs: enforces services and tasks
- Rollback ledger → Windows update & policy APIs: restores system state
- Restart policy → Windows update & policy APIs: reads restart indicators
- Automation scheduler → Windows update & policy APIs: registers scheduled tasks
- Automation scheduler → Application coordinator: scheduled re-entry
- OS & Defender updates → Windows update & policy APIs: uses Update COM
- OS & Defender updates → Update executables & services: runs Defender tooling
- Third-party app updates → Update executables & services: invokes winget
- Store app updates → Update executables & services: uses Store/MDM scan
- ANSI terminal dashboard → Application coordinator: invokes core commands
- Browser UI → Local GUI bridge: sends UI commands
- Local GUI bridge → Application coordinator: bridges operations
- WPF/WebView2 host → Browser UI: hosts
- WPF/WebView2 host → Local GUI bridge: hosts local bridge
