# wibus-wee/injectgui architecture

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

- Interactive diagram: https://gitdiagram.com/wibus-wee/injectgui
- Repository: https://github.com/wibus-wee/injectgui

## Overview

##### Project Type and Purpose
- InjectGUI is a macOS integrated injection framework with a graphical user interface. It is designed to perform tasks like backing up executable files, managing permissions (including process termination), handling deep code signing, and interacting with tools such as Tccutil. Its functionality relates to code injection and modification operations on macOS, and it integrates closely with the related InjectLib project.
- The README makes it clear that while the project is feature-complete in many respects, there are known issues and planned future improvements. It is a GUI tool targeted for macOS, allowing users to control system-level injection operations.

##### Analyzing the File Structure
- Top-Level Organization:
- The project has a clear separation between frontend (UI / Views) and backend (core logic). The key directories include:
▸ InjectGUI/App – Contains the main application entry point (InjectGUIApp.swift) and constants.
▸ InjectGUI/View – Contains various SwiftUI view files (e.g., ContentView, AdminPrivilegeView, Settings views) that build the UI.
▸ InjectGUI/Backend – Contains core business logic files (e.g., Injector.swift, Executor.swift, SoftwareManager.swift, configuration files) that implement the injection functionality.
▸ InjectGUI/Extension – This folder provides helper extensions and utility functions for strings, fonts, URLs, scenes, and published storage.
▸ InjectGUI/Util – Contains likely one-off helper routines (for example, setting up the Application Support directory).
▸ Other folders like Assets.xcassets, Localizables, and Preview Content provide support resources.
- Project Metadata and CI/CD:
- The presence of version control files (.gitignore), GitHub Actions workflows in the .github/workflows directory, and Xcode project files indicate a systematic build and maintenance process.
- Configuration files (e.g., config.json) and Xcode-specific files show that the project is built in a structured development environment.

##### Main Components
- UI / Frontend:
- Represented by the “View” directory (and parts of the “App” folder) which includes various screens and settings (ContentView, SidebarView, SettingsView, etc.). This is the primary interaction layer for the macOS user.
- Application Entry & Coordination:
- The “App” folder (specifically the InjectGUIApp.swift file) functions as the entry point, coordinating high-level app initialization, routing, and possibly state management.
- Backend Logic / Injection Engine:
- Housed in the “Backend” directory. Key components include:
▸ Injector – Responsible for performing the injection tasks.
▸ Executor – Likely coordinates execution calls and manages task flows.
▸ Configuration and InjectConfiguration – Manage dynamic parameters, settings, or environment configurations.
▸ SoftwareManager – Probably oversees the management of system software states or compatibility.
▸ Cache – Used to improve performance or store transitional state.
- Extensions and Utilities:
- “Extension” and “Util” directories provide cross-cutting functionalities that support both UI and backend operations. They include helper methods and extensions to simplify the operations on common data types and resources.
- External Dependencies:
- While not part of the internal modules, the README explicitly references a dependency on the InjectLib project, which may influence API calls or integration behaviors.

##### Relationships and Data Flow
- The user interacts with the UI (Views) which sends commands or data to the application’s coordinator (InjectGUIApp.swift).
- The coordinator forwards requests to the Backend components (Injector, Executor, SoftwareManager) which execute the core injection logic.
- Backend modules use configuration data (from config.json, Configuration.swift, and InjectConfiguration.swift) and possibly auxiliary services provided in the Extensions/Util folders.
- Feedback, process status, or error messages are then routed back to the UI for display.
- External resources (such as localized text in Localizables, image assets in Assets.xcassets) support both frontend and backend processes.
- The CI/CD workflow (in .github/workflows) triggers builds based on commits and might be represented as part of a deployment/update cycle.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Frontend Layer
    subgraph "Frontend Layer"
        UI["User Interface (Views)"]:::frontend
    end

    %% Application Coordination
    subgraph "Application Coordination"
        App["Application Entry/Coordinator"]:::coordinator
    end

    %% Backend Engine
    subgraph "Backend Engine"
        Injector["Injector"]:::backend
        Executor["Executor"]:::backend
        Config1["Configuration.swift"]:::backend
        Config2["InjectConfiguration.swift"]:::backend
        SoftwareMgr["Software Manager"]:::backend
        Cache["Cache"]:::backend
    end

    %% Utilities
    subgraph "Utilities & Extensions"
        Extensions["Extensions"]:::utilities
        Helpers["Helper Utilities"]:::utilities
    end

    %% Resources
    subgraph "Resources & Assets"
        Assets["Assets"]:::resources
        Localizations["Localizations"]:::resources
    end

    %% CI/CD Processes
    subgraph "CI/CD Processes"
        CI["CI/CD Workflows"]:::cicd
    end

    %% External Dependency
    External["InjectLib (External)"]:::external

    %% Data Flow Connections
    UI -->|"triggers"| App
    App -->|"commands"| Injector
    App -->|"commands"| Executor
    App -->|"configures"| Config1
    App -->|"configures"| Config2
    App -->|"manages"| SoftwareMgr
    App -->|"caches"| Cache
    Injector -->|"feedback"| UI
    Executor -->|"feedback"| UI
    SoftwareMgr -->|"feedback"| UI
    Cache -->|"feedback"| UI

    %% Backend using Utilities
    Injector -->|"uses"| Extensions
    Executor -->|"uses"| Helpers
    Config1 -->|"uses"| Extensions
    Config2 -->|"uses"| Extensions
    SoftwareMgr -->|"uses"| Extensions
    Cache -->|"uses"| Helpers

    %% Application Integration & External Dependency
    App -->|"integrates"| External

    %% Resources supporting Frontend
    Assets -->|"supports"| UI
    Localizations -->|"supports"| UI

    %% CI/CD triggering builds
    CI -->|"triggersBuild"| App

    %% Styling Classes
    classDef frontend fill:#ffcccc,stroke:#333,stroke-width:2px;
    classDef coordinator fill:#ccffcc,stroke:#333,stroke-width:2px;
    classDef backend fill:#cce5ff,stroke:#333,stroke-width:2px;
    classDef utilities fill:#ffffcc,stroke:#333,stroke-width:2px;
    classDef resources fill:#d9d9d9,stroke:#333,stroke-width:2px;
    classDef external fill:#ffebcc,stroke:#333,stroke-width:2px;
    classDef cicd fill:#e6ccff,stroke:#333,stroke-width:2px;

    %% Click Events
    click UI "https://github.com/wibus-wee/injectgui/tree/main/InjectGUI/View"
    click App "https://github.com/wibus-wee/injectgui/blob/main/InjectGUI/App/InjectGUIApp.swift"
    click Injector "https://github.com/wibus-wee/injectgui/blob/main/InjectGUI/Backend/Injector.swift"
    click Executor "https://github.com/wibus-wee/injectgui/blob/main/InjectGUI/Backend/Executor.swift"
    click Config1 "https://github.com/wibus-wee/injectgui/blob/main/InjectGUI/Backend/Configuration.swift"
    click Config2 "https://github.com/wibus-wee/injectgui/blob/main/InjectGUI/Backend/InjectConfiguration.swift"
    click SoftwareMgr "https://github.com/wibus-wee/injectgui/blob/main/InjectGUI/Backend/SoftwareManager.swift"
    click Cache "https://github.com/wibus-wee/injectgui/blob/main/InjectGUI/Backend/Cache.swift"
    click Extensions "https://github.com/wibus-wee/injectgui/tree/main/InjectGUI/Extension"
    click Helpers "https://github.com/wibus-wee/injectgui/blob/main/InjectGUI/Util/SetupApplicationSupportDirectory.swift"
    click Assets "https://github.com/wibus-wee/injectgui/blob/main/InjectGUI/Assets.xcassets"
    click Localizations "https://github.com/wibus-wee/injectgui/tree/main/InjectGUI/Localizables"
```
