# trinhminhtriet/rmrfrs architecture

> Architecture diagram of the GitHub repository trinhminhtriet/rmrfrs, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/trinhminhtriet/rmrfrs
- Repository: https://github.com/trinhminhtriet/rmrfrs

## Overview

##### Project Type and Purpose
- rmrfrs is a Rust-based command-line filesystem cleaning tool. It scans directories (via recursive search) and identifies removable or unnecessary files within known project structures (e.g., Cargo, CMake, Composer, etc.).
- The tool is built as multiple Cargo packages and includes both a core library (rmrfrs-lib) and user interfaces (rmrfrs and rmrfrs-ui).

##### Analyzing the File Structure
- Top-Level Components:
- rmrfrs-lib: Contains the core business logic and key functionalities that perform scanning, analysis, and cleaning operations.
- rmrfrs-ui: Likely represents a UI layer (or an alternative entrypoint) that wraps the core functionality to provide an enhanced user experience.
- rmrfrs: Houses a primary binary (with a main.rs) that acts as the command-line interface (CLI) for end users.
- .github, scripts, and configuration files: These directories indicate CI/CD pipelines (GitHub workflows, dependabot configuration) and release/versioning scripts.
- The Cargo.toml files across directories denote separate Cargo packages, suggesting a modular design where each module/package has a focused responsibility.

##### Key Components
- rmrfrs (CLI Component): The executable entry that the user runs; responsible for handling command-line arguments, initiating scans, and reporting results.
- rmrfrs-lib (Core Library): Contains the logic to perform directory traversal, file analysis, and cleaning operations. rmrfrs and rmrfrs-ui both likely depend on this shared library.
- rmrfrs-ui (User Interface): A separate binary (or module) which might offer additional interactive or visual features compared to the CLI.
- Filesystem: Represented as an external component since rmrfrs interacts directly with the file system (recursive directory scanning, file deletion, and space analysis).
- CI/CD Pipeline: Represent the GitHub workflows and scripts which automate testing, releases, and versioning.
- Configuration/Dependency Management: The Cargo configuration files and GitHub workflows, indicating dependency management and build process.

##### Relationships and Interactions
- rmrfrs and rmrfrs-ui both import and use rmrfrs-lib to perform the core cleaning logic.
- The CLI component (rmrfrs) receives user input (through command-line parameters), then passes commands to the library, which communicates with the filesystem to perform scans and deletions.
- CI/CD (via GitHub workflows and scripts) automatically build, test, and publish all components when changes are made.
- The external environment (like local file systems) is manipulated by the library to clean out unwanted files.

##### Architectural Patterns and Design Principles
- Modularity: The clear separation into rmrfrs-lib and front-end modules (CLI and UI) follows a layered architecture where the core logic is abstracted from the interface.
- Single Responsibility: Each Cargo package has a distinct role— the library handles cleaning logic, and the executables manage user interaction.
- Reusability: By isolating the core functions into a library, both CLI and UI components can reuse the same cleaning logic without duplication.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Build & Automation"
        A["CI/CD Pipeline"]:::cicd
        B["Configuration/Dependency Management"]:::config
    end

    subgraph "User Interfaces"
        C["rmrfrs (CLI)"]:::cli
        D["rmrfrs-ui (UI)"]:::ui
    end

    E["rmrfrs-lib (Core Library)"]:::core
    F["Filesystem"]:::fs

    %% Component Relationships
    C -->|"uses"| E
    D -->|"uses"| E
    E -->|"scans"| F

    %% Automation Relationships (dotted lines)
    A -.->|"automates"| C
    A -.->|"automates"| D
    A -.->|"automates"| E
    B -.->|"configures"| C
    B -.->|"configures"| D
    B -.->|"configures"| E

    %% Click Events
    click C "https://github.com/trinhminhtriet/rmrfrs/blob/master/rmrfrs/src/main.rs"
    click D "https://github.com/trinhminhtriet/rmrfrs/blob/master/rmrfrs-ui/src/main.rs"
    click E "https://github.com/trinhminhtriet/rmrfrs/blob/master/rmrfrs-lib/src/lib.rs"
    click A "https://github.com/trinhminhtriet/rmrfrs/tree/master/.github/workflows"
    click B "https://github.com/trinhminhtriet/rmrfrs/blob/master/Cargo.toml"

    %% Styles
    classDef cli fill:#a3d5d3,stroke:#333,stroke-width:2px;
    classDef ui fill:#a3d5d3,stroke:#333,stroke-width:2px;
    classDef core fill:#f9e79f,stroke:#333,stroke-width:2px;
    classDef fs fill:#85c1e9,stroke:#333,stroke-width:2px;
    classDef cicd fill:#d2b4de,stroke:#333,stroke-width:2px;
    classDef config fill:#aed6f1,stroke:#333,stroke-width:2px;
```
