# mlohajner/afst architecture

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

- Interactive diagram: https://gitdiagram.com/mlohajner/afst
- Repository: https://github.com/mlohajner/afst

## Overview

AFST is a one-way, cumulative file-sync and archival tool. A user supplies source and destination directories; the core snapshots both, uses GNU diff to identify changes, then transfers only files needing copies while retaining snapshots. The optional Zenity GUI collects the directories and runs the same core script; a desktop launcher is also provided. The README documents these relationships, but no source excerpts were available, so internal call details and AFST2 behavior are not inferred.

Main entry points: [`afst.sh`](https://github.com/mlohajner/afst/blob/main/afst.sh) (Sync command), [`afst-gui.sh`](https://github.com/mlohajner/afst/blob/main/afst-gui.sh) (Folder picker), [`AFST.desktop`](https://github.com/mlohajner/afst/blob/main/AFST.desktop) (Desktop launcher)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_sync["Sync and archive"]
  node_core["Sync command<br/>[afst.sh]"]
  node_snapshots["State snapshots<br/>[afst.sh]"]
  node_diff["Change analysis<br/>[afst.sh]"]
  node_transfer["File transfer<br/>[afst.sh]"]
  node_history["Retained snapshots<br/>[afst.sh]"]
end

subgraph group_gui["Graphical interface"]
  node_gui["Folder picker<br/>[afst-gui.sh]"]
  node_launcher["Desktop launcher<br/>[AFST.desktop]"]
end

node_user(("User"))
node_source["Source directory"]
node_destination["Destination directory"]
node_zenity["Zenity"]

node_user -->|"runs with paths"| node_core
node_core -->|"snapshots both"| node_snapshots
node_source -->|"source state"| node_snapshots
node_destination -->|"destination state"| node_snapshots
node_snapshots -->|"compares with diff"| node_diff
node_diff -->|"selects files"| node_transfer
node_transfer -->|"copies files"| node_destination
node_core -->|"retains snapshots"| node_history
node_user -->|"opens"| node_gui
node_gui -.->|"uses"| node_zenity
node_gui -->|"runs same script"| node_core
node_launcher -->|"launches"| node_gui

click node_core "https://github.com/mlohajner/afst/blob/main/afst.sh"
click node_snapshots "https://github.com/mlohajner/afst/blob/main/afst.sh"
click node_diff "https://github.com/mlohajner/afst/blob/main/afst.sh"
click node_transfer "https://github.com/mlohajner/afst/blob/main/afst.sh"
click node_history "https://github.com/mlohajner/afst/blob/main/afst.sh"
click node_gui "https://github.com/mlohajner/afst/blob/main/afst-gui.sh"
click node_launcher "https://github.com/mlohajner/afst/blob/main/AFST.desktop"

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_core,node_snapshots,node_diff,node_transfer,node_history,node_user toneBlue
class node_gui,node_launcher toneAmber
class node_source,node_destination,node_zenity toneIndigo
```

## Components

### Sync and archive

- [Sync command](https://github.com/mlohajner/afst/blob/main/afst.sh): `afst.sh`
- [State snapshots](https://github.com/mlohajner/afst/blob/main/afst.sh): `afst.sh`
- [Change analysis](https://github.com/mlohajner/afst/blob/main/afst.sh): `afst.sh`
- [File transfer](https://github.com/mlohajner/afst/blob/main/afst.sh): `afst.sh`
- [Retained snapshots](https://github.com/mlohajner/afst/blob/main/afst.sh): `afst.sh`

### Graphical interface

- [Folder picker](https://github.com/mlohajner/afst/blob/main/afst-gui.sh): `afst-gui.sh`
- [Desktop launcher](https://github.com/mlohajner/afst/blob/main/AFST.desktop): `AFST.desktop`

### Other components

- **User**
- **Source directory**
- **Destination directory**
- **Zenity**

## Connections

- User → Sync command: runs with paths (evidence: `README.md`)
- Sync command → State snapshots: snapshots both (evidence: `README.md`)
- Source directory → State snapshots: source state (evidence: `README.md`)
- Destination directory → State snapshots: destination state (evidence: `README.md`)
- State snapshots → Change analysis: compares with diff (evidence: `README.md`)
- Change analysis → File transfer: selects files (evidence: `README.md`)
- File transfer → Destination directory: copies files (evidence: `README.md`)
- Sync command → Retained snapshots: retains snapshots (evidence: `README.md`)
- User → Folder picker: opens (evidence: `README.md`)
- Folder picker → Zenity: uses (evidence: `README.md`)
- Folder picker → Sync command: runs same script (evidence: `README.md`)
- Desktop launcher → Folder picker: launches (evidence: `README.md`)
