# ogxd/project-curator architecture

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

- Interactive diagram: https://gitdiagram.com/ogxd/project-curator
- Repository: https://github.com/ogxd/project-curator

## Overview

##### Project Type & Purpose
- This is a Unity Editor package designed to help users clean up and maintain their Unity projects. It achieves this by analyzing asset dependencies, visualizing referencers, and indicating build inclusion statuses.

##### Analyzing the File Structure
- The file tree reveals that the package is structured mainly around an "Editor" folder containing all core scripts (e.g., ProjectCuratorWindow, ProjectCuratorData, AssetProcessor, and other utility classes).
- The presence of a package.json indicates that this is a self-contained Unity package, ready for installation through the Unity Package Manager.

##### Key Components
- Unity Editor Integration:
- A component representing how the package integrates with the Unity Editor (e.g., “Project Curator Editor Window”).
- User interactions such as selecting an asset from the Project window.
- Asset Dependency Analyzer:
- A module that processes asset dependencies and referencers (e.g., AssetProcessor.cs, ProjectCurator.cs).
- Data flow from asset selection to dependency analysis.
- Status Checker and Build Inclusion Module:
- How assets are classified into various statuses such as "Not Included," "Scene In Build," or "Resource Asset." These would be managed by modules such as ProjectCuratorData.cs.
- Utility & Helper Components:
- Elements like string utilities and resources (e.g., Editor/StringUtility.cs, Editor/Resources) that support core functionalities.
- Event-Driven Database/Rebuild Mechanism:
- Listener/component that handles changes in the asset database and rebuilds dependency mappings based on asset creation, movement, or deletion.

##### Relationships & Interactions
- Flow from the Editor Window to the Asset Dependency Analyzer, then to the Status Checker.
- Recursive interactions where the analyzer uses dependency data to determine build inclusion both directly and via transitive references.
- Connections to Unity’s underlying asset database and event system which are the sources for asset information.

##### Architectural Patterns & Design Principles
- This package follows a modular structure commonly seen in Unity editor extensions. The separation between UI (Project Curator Window), logic (analytical scripts like ProjectCurator.cs), and data (ProjectCuratorData.cs) resembles the separation of concerns principle.
- Use components to denote how dependencies are computed recursively. Clearly differentiate between “editor” components (exists only in the Unity Editor) versus runtime components (none in this case since it’s an editor-only tool).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% UI Components
    subgraph "UI Components"
        A("Project Window Overlay"):::ui
        B("Project Curator Editor Window"):::ui
    end

    %% Processing Modules
    subgraph "Processing Modules"
        subgraph "Asset Dependency Analyzer"
            C("Asset Processor"):::processing
            D("Project Curator"):::processing
        end
        E("Status Checker & Build Inclusion Module"):::data
        F("Event-Driven Asset Information Handler"):::event
    end

    %% Utility Components
    subgraph "Utility Components"
        G("String Utility"):::utility
        H("Resource Files"):::utility
    end

    %% Unity Environment
    subgraph "Unity Environment"
        I("Asset Database & Event System"):::external
    end

    %% Connections
    A -->|"userSelection"| B
    B -->|"triggerAnalysis"| C
    C -->|"processDependencies"| D
    D -->|"updateStatuses"| E
    D -->|"monitorChanges"| F
    D -->|"queryDB"| I
    F -->|"listenUpdates"| I
    C -->|"usesUtility"| G
    C -->|"usesResources"| H
    E -->|"displayResults"| B

    %% Click Events
    click B "https://github.com/ogxd/project-curator/blob/master/Editor/ProjectCuratorWindow.cs"
    click A "https://github.com/ogxd/project-curator/blob/master/Editor/ProjectWindowOverlay.cs"
    click C "https://github.com/ogxd/project-curator/blob/master/Editor/AssetProcessor.cs"
    click D "https://github.com/ogxd/project-curator/blob/master/Editor/ProjectCurator.cs"
    click E "https://github.com/ogxd/project-curator/blob/master/Editor/ProjectCuratorData.cs"
    click G "https://github.com/ogxd/project-curator/blob/master/Editor/StringUtility.cs"
    click H "https://github.com/ogxd/project-curator/tree/master/Editor/Resources"
    click F "https://github.com/ogxd/project-curator/blob/master/Editor/AssetInfo.cs"

    %% Styles
    classDef ui fill:#cce5ff,stroke:#004085,stroke-width:2px;
    classDef processing fill:#d4edda,stroke:#155724,stroke-width:2px;
    classDef data fill:#f8d7da,stroke:#721c24,stroke-width:2px;
    classDef utility fill:#fff3cd,stroke:#856404,stroke-width:2px;
    classDef event fill:#e2e3e5,stroke:#6c757d,stroke-width:2px;
    classDef external fill:#d1ecf1,stroke:#0c5460,stroke-width:2px;
```
