# lqmnah/rebes architecture

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

- Interactive diagram: https://gitdiagram.com/lqmnah/rebes
- Repository: https://github.com/lqmnah/rebes

## Overview

Rebes is a macOS utility combining cleanup, battery and fan controls, live monitoring, maintenance, and a menu-bar companion. Users work through the SwiftUI app; cleanup flows from scan and review to confirmed Trash-only cleaning, while privileged hardware actions go through HelperClient to the root helper or its admin-prompt fallback. The README documents additional cleanup and maintenance capabilities whose detailed wiring is not present in the sampled source, so those links are kept at documented subsystem boundaries. Grouped paths identify their implementation areas; several subsystem details are based on README evidence rather than inspected source.

Main entry points: [`Sources/Rebes/ContentView.swift`](https://github.com/lqmnah/rebes/blob/main/Sources/Rebes/ContentView.swift) (Main navigation), [`Sources/RebesCore/HelperClient.swift`](https://github.com/lqmnah/rebes/blob/main/Sources/RebesCore/HelperClient.swift) (Helper client), [`Sources/Rebes/SmartCareView.swift`](https://github.com/lqmnah/rebes/blob/main/Sources/Rebes/SmartCareView.swift) (Smart Care), [`Sources/Rebes/LargeFilesView.swift`](https://github.com/lqmnah/rebes/blob/main/Sources/Rebes/LargeFilesView.swift) (Cleanup tools)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App experience"]
  node_app["Rebes app<br/>[RebesApp.swift]"]
  node_mainview["Main navigation<br/>[ContentView.swift]"]
  node_dashboard["Dashboard"]
  node_menubar["Menu bar panel<br/>[MenuBarPanel.swift]"]
  node_statusbar["Status bar controller"]
  node_settings["Settings<br/>[SettingsView.swift]"]
end

subgraph group_clean["Cleanup and maintenance"]
  node_smartcare["Smart Care"]
  node_junk["Junk scanning<br/>[JunkScanner.swift]"]
  node_scanner["Disk and file scans<br/>[DiskScanner.swift]"]
  node_leftovers["App leftovers"]
  node_cleaner["Safe cleaner<br/>[SafeCleaner.swift]"]
  node_cleanupviews["Cleanup tools"]
  node_maintenance["Maintenance tools"]
end

subgraph group_monitor["Monitoring and controls"]
  node_monitor["System monitor"]
  node_batteryui["Battery controls"]
  node_fanui["Fan controls"]
  node_batteryreader["Battery reader"]
end

subgraph group_privileged["Privileged hardware"]
  node_helperclient["Helper client<br/>[HelperClient.swift]"]
  node_daemon["Root helper daemon<br/>[Daemon.swift]"]
  node_helpercli["Helper CLI<br/>[main.swift]"]
  node_whitelist["Write whitelist<br/>[Whitelist.swift]"]
  node_smc["SMC access<br/>[SMC.swift]"]
end

node_user(("Mac user"))
node_hardware[("Mac hardware")]
node_filesystem[("Mac filesystem")]
node_settingsstore[("UserDefaults")]

node_user -->|"opens"| node_app
node_app -->|"shows"| node_mainview
node_mainview -->|"navigates"| node_dashboard
node_mainview -->|"navigates"| node_smartcare
node_mainview -->|"navigates"| node_cleanupviews
node_mainview -->|"navigates"| node_batteryui
node_mainview -->|"navigates"| node_fanui
node_mainview -->|"navigates"| node_maintenance
node_user -->|"requests scan"| node_smartcare
node_smartcare -->|"scans junk"| node_junk
node_smartcare -->|"checks disk"| node_scanner
node_smartcare -->|"cleans selected"| node_cleaner
node_cleanupviews -->|"scans files"| node_scanner
node_cleanupviews -->|"matches leftovers"| node_leftovers
node_cleanupviews -->|"cleans safely"| node_cleaner
node_junk -->|"reads paths"| node_filesystem
node_scanner -->|"reads sizes"| node_filesystem
node_cleaner -->|"moves to Trash"| node_filesystem
node_maintenance -->|"requests privileged action"| node_helperclient
node_dashboard -->|"reads metrics"| node_monitor
node_menubar -->|"reads live stats"| node_monitor
node_statusbar -->|"opens panel"| node_menubar
node_app -->|"starts companion"| node_statusbar
node_monitor -->|"reads battery"| node_batteryreader
node_batteryreader -->|"reads telemetry"| node_hardware
node_batteryui -->|"sets charge policy"| node_helperclient
node_fanui -->|"sets fan control"| node_helperclient
node_settings -->|"manages Full Access"| node_helperclient
node_settings -->|"persists preferences"| node_settingsstore
node_helperclient -->|"calls over XPC"| node_daemon
node_helperclient -.->|"admin fallback"| node_helpercli
node_daemon -->|"validates writes"| node_whitelist
node_helpercli -->|"validates writes"| node_whitelist
node_daemon -->|"reads and writes"| node_smc
node_helpercli -->|"reads and writes"| node_smc
node_smc -->|"accesses SMC"| node_hardware

click node_app "https://github.com/lqmnah/rebes/blob/main/Sources/Rebes/RebesApp.swift"
click node_mainview "https://github.com/lqmnah/rebes/blob/main/Sources/Rebes/ContentView.swift"
click node_dashboard "https://github.com/lqmnah/rebes/blob/main/Sources/Rebes/DashboardView.swift"
click node_menubar "https://github.com/lqmnah/rebes/blob/main/Sources/Rebes/MenuBarPanel.swift"
click node_statusbar "https://github.com/lqmnah/rebes/blob/main/Sources/Rebes/StatusBarController.swift"
click node_settings "https://github.com/lqmnah/rebes/blob/main/Sources/Rebes/SettingsView.swift"
click node_smartcare "https://github.com/lqmnah/rebes/blob/main/Sources/Rebes/SmartCareView.swift"
click node_junk "https://github.com/lqmnah/rebes/blob/main/Sources/RebesCore/JunkScanner.swift"
click node_scanner "https://github.com/lqmnah/rebes/blob/main/Sources/RebesCore/DiskScanner.swift"
click node_leftovers "https://github.com/lqmnah/rebes/blob/main/Sources/RebesCore/LeftoverMatcher.swift"
click node_cleaner "https://github.com/lqmnah/rebes/blob/main/Sources/RebesCore/SafeCleaner.swift"
click node_cleanupviews "https://github.com/lqmnah/rebes/blob/main/Sources/Rebes/LargeFilesView.swift"
click node_maintenance "https://github.com/lqmnah/rebes/blob/main/Sources/Rebes/MaintenanceView.swift"
click node_monitor "https://github.com/lqmnah/rebes/blob/main/Sources/Rebes/SystemMonitor.swift"
click node_batteryui "https://github.com/lqmnah/rebes/blob/main/Sources/Rebes/ChargeControlView.swift"
click node_fanui "https://github.com/lqmnah/rebes/blob/main/Sources/Rebes/KipasSuhuView.swift"
click node_batteryreader "https://github.com/lqmnah/rebes/blob/main/Sources/RebesCore/BatteryReader.swift"
click node_helperclient "https://github.com/lqmnah/rebes/blob/main/Sources/RebesCore/HelperClient.swift"
click node_daemon "https://github.com/lqmnah/rebes/blob/main/Sources/RebesHelper/Daemon.swift"
click node_helpercli "https://github.com/lqmnah/rebes/blob/main/Sources/RebesHelper/main.swift"
click node_whitelist "https://github.com/lqmnah/rebes/blob/main/Sources/RebesCore/Whitelist.swift"
click node_smc "https://github.com/lqmnah/rebes/blob/main/Sources/RebesCore/SMC.swift"

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_app,node_mainview,node_dashboard,node_menubar,node_statusbar,node_settings,node_user toneBlue
class node_smartcare,node_junk,node_scanner,node_leftovers,node_cleaner,node_cleanupviews,node_maintenance,node_hardware,node_filesystem,node_settingsstore toneAmber
class node_monitor,node_batteryui,node_fanui,node_batteryreader toneMint
class node_helperclient,node_daemon,node_helpercli,node_whitelist,node_smc toneRose
```

## Components

### App experience

- [Rebes app](https://github.com/lqmnah/rebes/blob/main/Sources/Rebes/RebesApp.swift): `Sources/Rebes/RebesApp.swift`
- [Main navigation](https://github.com/lqmnah/rebes/blob/main/Sources/Rebes/ContentView.swift): `Sources/Rebes/ContentView.swift`
- [Dashboard](https://github.com/lqmnah/rebes/blob/main/Sources/Rebes/DashboardView.swift): `Sources/Rebes/DashboardView.swift`
- [Menu bar panel](https://github.com/lqmnah/rebes/blob/main/Sources/Rebes/MenuBarPanel.swift): `Sources/Rebes/MenuBarPanel.swift`
- [Status bar controller](https://github.com/lqmnah/rebes/blob/main/Sources/Rebes/StatusBarController.swift): `Sources/Rebes/StatusBarController.swift`
- [Settings](https://github.com/lqmnah/rebes/blob/main/Sources/Rebes/SettingsView.swift): `Sources/Rebes/SettingsView.swift`

### Cleanup and maintenance

- [Smart Care](https://github.com/lqmnah/rebes/blob/main/Sources/Rebes/SmartCareView.swift): `Sources/Rebes/SmartCareView.swift`
- [Junk scanning](https://github.com/lqmnah/rebes/blob/main/Sources/RebesCore/JunkScanner.swift): `Sources/RebesCore/JunkScanner.swift`
- [Disk and file scans](https://github.com/lqmnah/rebes/blob/main/Sources/RebesCore/DiskScanner.swift): `Sources/RebesCore/DiskScanner.swift`
- [App leftovers](https://github.com/lqmnah/rebes/blob/main/Sources/RebesCore/LeftoverMatcher.swift): `Sources/RebesCore/LeftoverMatcher.swift`
- [Safe cleaner](https://github.com/lqmnah/rebes/blob/main/Sources/RebesCore/SafeCleaner.swift): `Sources/RebesCore/SafeCleaner.swift`
- [Cleanup tools](https://github.com/lqmnah/rebes/blob/main/Sources/Rebes/LargeFilesView.swift): `Sources/Rebes/LargeFilesView.swift`
- [Maintenance tools](https://github.com/lqmnah/rebes/blob/main/Sources/Rebes/MaintenanceView.swift): `Sources/Rebes/MaintenanceView.swift`

### Monitoring and controls

- [System monitor](https://github.com/lqmnah/rebes/blob/main/Sources/Rebes/SystemMonitor.swift): `Sources/Rebes/SystemMonitor.swift`
- [Battery controls](https://github.com/lqmnah/rebes/blob/main/Sources/Rebes/ChargeControlView.swift): `Sources/Rebes/ChargeControlView.swift`
- [Fan controls](https://github.com/lqmnah/rebes/blob/main/Sources/Rebes/KipasSuhuView.swift): `Sources/Rebes/KipasSuhuView.swift`
- [Battery reader](https://github.com/lqmnah/rebes/blob/main/Sources/RebesCore/BatteryReader.swift): `Sources/RebesCore/BatteryReader.swift`

### Privileged hardware

- [Helper client](https://github.com/lqmnah/rebes/blob/main/Sources/RebesCore/HelperClient.swift): `Sources/RebesCore/HelperClient.swift`
- [Root helper daemon](https://github.com/lqmnah/rebes/blob/main/Sources/RebesHelper/Daemon.swift): `Sources/RebesHelper/Daemon.swift`
- [Helper CLI](https://github.com/lqmnah/rebes/blob/main/Sources/RebesHelper/main.swift): `Sources/RebesHelper/main.swift`
- [Write whitelist](https://github.com/lqmnah/rebes/blob/main/Sources/RebesCore/Whitelist.swift): `Sources/RebesCore/Whitelist.swift`
- [SMC access](https://github.com/lqmnah/rebes/blob/main/Sources/RebesCore/SMC.swift): `Sources/RebesCore/SMC.swift`

### Other components

- **Mac user**
- **Mac hardware**
- **Mac filesystem**
- **UserDefaults**

## Connections

- Mac user → Rebes app: opens
- Rebes app → Main navigation: shows
- Main navigation → Dashboard: navigates
- Main navigation → Smart Care: navigates
- Main navigation → Cleanup tools: navigates
- Main navigation → Battery controls: navigates
- Main navigation → Fan controls: navigates
- Main navigation → Maintenance tools: navigates
- Mac user → Smart Care: requests scan
- Smart Care → Junk scanning: scans junk
- Smart Care → Disk and file scans: checks disk
- Smart Care → Safe cleaner: cleans selected
- Cleanup tools → Disk and file scans: scans files
- Cleanup tools → App leftovers: matches leftovers
- Cleanup tools → Safe cleaner: cleans safely
- Junk scanning → Mac filesystem: reads paths
- Disk and file scans → Mac filesystem: reads sizes
- Safe cleaner → Mac filesystem: moves to Trash
- Maintenance tools → Helper client: requests privileged action
- Dashboard → System monitor: reads metrics
- Menu bar panel → System monitor: reads live stats
- Status bar controller → Menu bar panel: opens panel
- Rebes app → Status bar controller: starts companion
- System monitor → Battery reader: reads battery
- Battery reader → Mac hardware: reads telemetry
- Battery controls → Helper client: sets charge policy
- Fan controls → Helper client: sets fan control
- Settings → Helper client: manages Full Access
- Settings → UserDefaults: persists preferences
- Helper client → Root helper daemon: calls over XPC
- Helper client → Helper CLI: admin fallback
- Root helper daemon → Write whitelist: validates writes
- Helper CLI → Write whitelist: validates writes
- Root helper daemon → SMC access: reads and writes
- Helper CLI → SMC access: reads and writes
- SMC access → Mac hardware: accesses SMC
