# sadabx/tost architecture

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

- Interactive diagram: https://gitdiagram.com/sadabx/tost
- Repository: https://github.com/sadabx/tost

## Overview

#### Purpose and Deliverables
TOST is a .NET 8 Steam companion that installs, configures, and safely manages Steam-related game manifests, Lua plugins, and backend tooling. It targets Windows and Linux: OpenSteamTool on Windows and SLSsteam on Linux. The primary product is an Avalonia desktop application; Linux also has a terminal entry point.

#### Entry Points and Product Shell
- Desktop startup and Avalonia application composition: `Desktop/Program.cs`, `Desktop/App.axaml.cs`, `Desktop/App.axaml`.
- The floating desktop drop target is the primary interactive surface: `Desktop/FloatingIconWindow.cs`.
- Linux CLI entry point: `CLI/Linux/Program.cs`.
- The retired WinForms implementation remains a reference/legacy product, isolated under `Legacy/WinForms/Program.cs`.

#### Shared Domain and Steam Discovery
Core owns non-UI behavior and Steam filesystem knowledge. Steam discovery detects standard and Linux/Flatpak installations, then exposes installation paths for downstream import and integration operations.
- `Core/Steam/SteamDiscovery.cs`
- `Core/Steam/LinuxSteamDiscovery.cs`
- `Core/Steam/SteamInstallation.cs`

Steam lifecycle actions, including restart coordination, are separated from discovery:
- `Core/Steam/SteamRestartService.cs`
- `Desktop/Services/SteamLifecycleService.cs`
- `Desktop/Services/SteamProcessGuard.cs`

#### Import Pipeline and Managed State
Dropped ZIP, manifest, and Lua inputs flow through inspection/parsing and import services before being routed into Steam/backend locations. The design boundary is important: Lua is parsed for declarations rather than executed, and existing files are backed up before replacement.
- `Core/Imports/SteamImportInspector.cs`
- `Core/Imports/SteamImportService.cs`
- `Core/Imports/SteamAppManifestParser.cs`

Managed installations are recorded and later enumerated, removed, or restored through:
- `Core/GameManagement/ManagedGameService.cs`
- `Desktop/Views/GameManagerView.cs`
- `Desktop/Views/ImportView.cs`

#### Platform Integration Providers
`IIntegrationProvider` abstracts the backend-specific operations and status. This keeps desktop/UI flows independent of whether Steam is managed through OpenSteamTool or SLSsteam.
- `Core/Integrations/IIntegrationProvider.cs`
- `Core/Integrations/IntegrationStatus.cs`

Windows-oriented backend provisioning is represented by:
- `Core/Integrations/OpenSteamTool/OpenSteamToolInstallerService.cs`

Linux’s SLSsteam provider owns install/repair, diagnostics, configuration inspection, conversion of imported data, recovery, and release-related behavior:
- `Core/Integrations/SlsSteam/SlsSteamProvider.cs`
- `Core/Integrations/SlsSteam/SlsSteamInstallerService.cs`
- `Core/Integrations/SlsSteam/SlsSteamImportConversionService.cs`

#### Linux Steam Configuration and Launch Boundary
For Linux, imported app IDs, overrides, and depot keys are converted into SLSsteam/Steam configuration. TOST supports native Steam launch wrappers and Flatpak per-user launch environment overrides; launch hooks are explicitly managed rather than embedded in the UI.
- `Core/Integrations/SlsSteam/SlsSteamConfigService.cs`
- `Core/Integrations/SlsSteam/SlsSteamLaunchConfigurationService.cs`
- `Core/Integrations/SlsSteam/SlsSteamLaunchHookService.cs`

Depot-key registration is a separate Steam-specific concern:
- `Core/Steam/SteamDepotKeyService.cs`
- `Core/Integrations/SlsSteam/SlsSteamImportConfigService.cs`

#### UI Workflows, Local Configuration, and Distribution
The Avalonia views expose integration setup, import, recovery, logs, settings, and game management, while desktop services bridge those workflows to Core and platform APIs.
- `Desktop/Views/IntegrationView.cs`
- `Desktop/Views/RecoveryView.cs`
- `Desktop/Services/SlsSteamLaunchPlanFactory.cs`

User preferences and Linux autostart are persisted/configured in Core; desktop startup registration is platform-facing:
- `Core/Configuration/TostPreferences.cs`
- `Core/Configuration/LinuxAutostartService.cs`
- `Desktop/Services/StartupRegistrationService.cs`

Release packaging targets Linux AppImage/deb/package formats and Arch AUR, with GitHub Actions release automation:
- `.github/workflows/release.yml`
- `packaging/linux/build-packages.sh`
- `packaging/aur/tost-bin/PKGBUILD`

Main entry points: [`Desktop/Views/ImportView.cs`](https://github.com/sadabx/tost/blob/main/Desktop/Views/ImportView.cs) (Desktop workflows), [`Core/Integrations/SlsSteam/SlsSteamConfigService.cs`](https://github.com/sadabx/tost/blob/main/Core/Integrations/SlsSteam/SlsSteamConfigService.cs) (SLSsteam configuration), [`Core/Integrations/IIntegrationProvider.cs`](https://github.com/sadabx/tost/blob/main/Core/Integrations/IIntegrationProvider.cs) (Integration provider contract), [`Core/Imports/SteamImportService.cs`](https://github.com/sadabx/tost/blob/main/Core/Imports/SteamImportService.cs) (Safe import)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop Product"]
  node_desktop_startup["Avalonia startup<br/>desktop entry<br/>[Program.cs]"]
  node_app_composition["App composition<br/>Avalonia app<br/>[App.axaml.cs]"]
  node_drop_target["Floating drop target<br/>desktop surface"]
  node_desktop_workflows["Desktop workflows<br/>Avalonia views<br/>[ImportView.cs]"]
  node_lifecycle_bridge["Steam lifecycle bridge<br/>desktop service"]
end

subgraph group_core["Core Domain"]
  node_steam_discovery["Steam discovery<br/>core service<br/>[SteamDiscovery.cs]"]
  node_steam_restart["Steam restart coordination<br/>core service"]
  node_import_inspection["Input inspection<br/>import parser"]
  node_import_service["Safe import<br/>import service"]
  node_managed_games[("Managed game state<br/>game management")]
  node_integration_contract{{"Integration provider contract<br/>provider interface"}}
  node_windows_backend["OpenSteamTool provisioning<br/>Windows backend"]
  node_depot_keys["Depot-key registration<br/>Steam service"]
end

subgraph group_linux["Linux Integration"]
  node_sls_provider["SLSsteam provider<br/>Linux backend"]
  node_sls_conversion["Import conversion<br/>Linux conversion"]
  node_sls_config["SLSsteam configuration<br/>Linux config service"]
  node_launch_hooks["Launch hooks<br/>launch configuration"]
  node_linux_cli["Linux CLI<br/>CLI entry<br/>[Program.cs]"]
end

subgraph group_delivery["Distribution"]
  node_release_automation["Release automation<br/>CI workflow<br/>[release.yml]"]
  node_linux_packages["Linux packages<br/>package scripts<br/>[build-packages.sh]"]
end

node_desktop_startup -->|"starts"| node_app_composition
node_app_composition -->|"hosts"| node_drop_target
node_drop_target -->|"opens workflows"| node_desktop_workflows
node_desktop_workflows -->|"submits inputs"| node_import_inspection
node_import_inspection -->|"validated input"| node_import_service
node_import_service -->|"records installation"| node_managed_games
node_desktop_workflows -->|"manages"| node_managed_games
node_desktop_workflows -->|"uses"| node_integration_contract
node_integration_contract -->|"implemented by"| node_windows_backend
node_integration_contract -->|"implemented by"| node_sls_provider
node_steam_discovery -->|"provides Steam paths"| node_import_service
node_steam_discovery -->|"locates installation"| node_sls_config
node_lifecycle_bridge -->|"coordinates"| node_steam_restart
node_sls_provider -->|"converts imports"| node_sls_conversion
node_sls_conversion -->|"applies data"| node_sls_config
node_sls_config -->|"registers keys"| node_depot_keys
node_sls_config -->|"configures launch"| node_launch_hooks
node_linux_cli -->|"invokes"| node_sls_provider
node_release_automation -->|"builds with"| node_linux_packages

click node_desktop_startup "https://github.com/sadabx/tost/blob/main/Desktop/Program.cs"
click node_app_composition "https://github.com/sadabx/tost/blob/main/Desktop/App.axaml.cs"
click node_drop_target "https://github.com/sadabx/tost/blob/main/Desktop/FloatingIconWindow.cs"
click node_desktop_workflows "https://github.com/sadabx/tost/blob/main/Desktop/Views/ImportView.cs"
click node_lifecycle_bridge "https://github.com/sadabx/tost/blob/main/Desktop/Services/SteamLifecycleService.cs"
click node_steam_discovery "https://github.com/sadabx/tost/blob/main/Core/Steam/SteamDiscovery.cs"
click node_steam_restart "https://github.com/sadabx/tost/blob/main/Core/Steam/SteamRestartService.cs"
click node_import_inspection "https://github.com/sadabx/tost/blob/main/Core/Imports/SteamImportInspector.cs"
click node_import_service "https://github.com/sadabx/tost/blob/main/Core/Imports/SteamImportService.cs"
click node_managed_games "https://github.com/sadabx/tost/blob/main/Core/GameManagement/ManagedGameService.cs"
click node_integration_contract "https://github.com/sadabx/tost/blob/main/Core/Integrations/IIntegrationProvider.cs"
click node_windows_backend "https://github.com/sadabx/tost/blob/main/Core/Integrations/OpenSteamTool/OpenSteamToolInstallerService.cs"
click node_depot_keys "https://github.com/sadabx/tost/blob/main/Core/Steam/SteamDepotKeyService.cs"
click node_sls_provider "https://github.com/sadabx/tost/blob/main/Core/Integrations/SlsSteam/SlsSteamProvider.cs"
click node_sls_conversion "https://github.com/sadabx/tost/blob/main/Core/Integrations/SlsSteam/SlsSteamImportConversionService.cs"
click node_sls_config "https://github.com/sadabx/tost/blob/main/Core/Integrations/SlsSteam/SlsSteamConfigService.cs"
click node_launch_hooks "https://github.com/sadabx/tost/blob/main/Core/Integrations/SlsSteam/SlsSteamLaunchHookService.cs"
click node_linux_cli "https://github.com/sadabx/tost/blob/main/CLI/Linux/Program.cs"
click node_release_automation "https://github.com/sadabx/tost/blob/main/.github/workflows/release.yml"
click node_linux_packages "https://github.com/sadabx/tost/blob/main/packaging/linux/build-packages.sh"

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_desktop_startup,node_app_composition,node_drop_target,node_desktop_workflows,node_lifecycle_bridge toneBlue
class node_steam_discovery,node_steam_restart,node_import_inspection,node_import_service,node_managed_games,node_integration_contract,node_windows_backend,node_depot_keys toneAmber
class node_sls_provider,node_sls_conversion,node_sls_config,node_launch_hooks,node_linux_cli toneMint
class node_release_automation,node_linux_packages toneRose
```

## Components

### Desktop Product

Avalonia shell and workflow bridge.

- [Avalonia startup](https://github.com/sadabx/tost/blob/main/Desktop/Program.cs): desktop entry · `Desktop/Program.cs`
- [App composition](https://github.com/sadabx/tost/blob/main/Desktop/App.axaml.cs): Avalonia app · `Desktop/App.axaml.cs`
- [Floating drop target](https://github.com/sadabx/tost/blob/main/Desktop/FloatingIconWindow.cs): desktop surface · Primary interactive drop surface. · `Desktop/FloatingIconWindow.cs`
- [Desktop workflows](https://github.com/sadabx/tost/blob/main/Desktop/Views/ImportView.cs): Avalonia views · Integration, import, recovery, and game-management flows. · `Desktop/Views/ImportView.cs`
- [Steam lifecycle bridge](https://github.com/sadabx/tost/blob/main/Desktop/Services/SteamLifecycleService.cs): desktop service · `Desktop/Services/SteamLifecycleService.cs`

### Core Domain

Shared Steam, import, and managed-state behavior.

- [Steam discovery](https://github.com/sadabx/tost/blob/main/Core/Steam/SteamDiscovery.cs): core service · Finds standard, Linux, and Flatpak Steam installations. · `Core/Steam/SteamDiscovery.cs`
- [Steam restart coordination](https://github.com/sadabx/tost/blob/main/Core/Steam/SteamRestartService.cs): core service · `Core/Steam/SteamRestartService.cs`
- [Input inspection](https://github.com/sadabx/tost/blob/main/Core/Imports/SteamImportInspector.cs): import parser · Inspects ZIP, manifest, and Lua declarations without executing Lua. · `Core/Imports/SteamImportInspector.cs`
- [Safe import](https://github.com/sadabx/tost/blob/main/Core/Imports/SteamImportService.cs): import service · Backs up existing files before replacement and routes imported content. · `Core/Imports/SteamImportService.cs`
- [Managed game state](https://github.com/sadabx/tost/blob/main/Core/GameManagement/ManagedGameService.cs): game management · Records, enumerates, removes, and restores managed installations. · `Core/GameManagement/ManagedGameService.cs`
- [Integration provider contract](https://github.com/sadabx/tost/blob/main/Core/Integrations/IIntegrationProvider.cs): provider interface · Backend-independent operations and status boundary. · `Core/Integrations/IIntegrationProvider.cs`
- [OpenSteamTool provisioning](https://github.com/sadabx/tost/blob/main/Core/Integrations/OpenSteamTool/OpenSteamToolInstallerService.cs): Windows backend · `Core/Integrations/OpenSteamTool/OpenSteamToolInstallerService.cs`
- [Depot-key registration](https://github.com/sadabx/tost/blob/main/Core/Steam/SteamDepotKeyService.cs): Steam service · `Core/Steam/SteamDepotKeyService.cs`

### Linux Integration

SLSsteam provisioning and launch configuration.

- [SLSsteam provider](https://github.com/sadabx/tost/blob/main/Core/Integrations/SlsSteam/SlsSteamProvider.cs): Linux backend · Owns install, repair, diagnostics, recovery, and release behavior. · `Core/Integrations/SlsSteam/SlsSteamProvider.cs`
- [Import conversion](https://github.com/sadabx/tost/blob/main/Core/Integrations/SlsSteam/SlsSteamImportConversionService.cs): Linux conversion · Converts imported data for SLSsteam and Steam configuration. · `Core/Integrations/SlsSteam/SlsSteamImportConversionService.cs`
- [SLSsteam configuration](https://github.com/sadabx/tost/blob/main/Core/Integrations/SlsSteam/SlsSteamConfigService.cs): Linux config service · Applies app IDs, overrides, and depot-key configuration. · `Core/Integrations/SlsSteam/SlsSteamConfigService.cs`
- [Launch hooks](https://github.com/sadabx/tost/blob/main/Core/Integrations/SlsSteam/SlsSteamLaunchHookService.cs): launch configuration · Manages native wrappers and Flatpak per-user launch overrides. · `Core/Integrations/SlsSteam/SlsSteamLaunchHookService.cs`
- [Linux CLI](https://github.com/sadabx/tost/blob/main/CLI/Linux/Program.cs): CLI entry · `CLI/Linux/Program.cs`

### Distribution

Linux packages and release automation.

- [Release automation](https://github.com/sadabx/tost/blob/main/.github/workflows/release.yml): CI workflow · Builds Linux release artifacts. · `.github/workflows/release.yml`
- [Linux packages](https://github.com/sadabx/tost/blob/main/packaging/linux/build-packages.sh): package scripts · AppImage, deb/package, and AUR distribution inputs. · `packaging/linux/build-packages.sh`

## Connections

- Avalonia startup → App composition: starts
- App composition → Floating drop target: hosts
- Floating drop target → Desktop workflows: opens workflows
- Desktop workflows → Input inspection: submits inputs
- Input inspection → Safe import: validated input
- Safe import → Managed game state: records installation
- Desktop workflows → Managed game state: manages
- Desktop workflows → Integration provider contract: uses
- Integration provider contract → OpenSteamTool provisioning: implemented by
- Integration provider contract → SLSsteam provider: implemented by
- Steam discovery → Safe import: provides Steam paths
- Steam discovery → SLSsteam configuration: locates installation
- Steam lifecycle bridge → Steam restart coordination: coordinates
- SLSsteam provider → Import conversion: converts imports
- Import conversion → SLSsteam configuration: applies data
- SLSsteam configuration → Depot-key registration: registers keys
- SLSsteam configuration → Launch hooks: configures launch
- Linux CLI → SLSsteam provider: invokes
- Release automation → Linux packages: builds with
