# yb85/scantailor-advanced-osx architecture

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

- Interactive diagram: https://gitdiagram.com/yb85/scantailor-advanced-osx
- Repository: https://github.com/yb85/scantailor-advanced-osx

## Overview

##### Main components
- Homebrew Formula & Installation:
- Files: scantailor.rb, install.sh, and README instructions.
- Purpose: Automate the installation of Scantailor (Advanced) via Homebrew, including support for compiling the binary (HEAD or release) and installation logs.
- Bundler:
- Directory: bundler/
- Files: sanity_check.command, scantailor_bundler.command, and the bundled .app template (scantailor_bundle_template.app with its Contents/Info.plist and Resources).
- Purpose: Using fish shell and macdeployqt, the bundler scripts take the installed Scantailor binary and create a macOS App bundle.
- Documentation & Supporting Resources:
- Directory: docs/ and README.md.
- Purpose: Provide usage instructions, configuration details, and sample assets (e.g., images in docs/assets/img) for users or developers.
- External Dependencies:
- Dependencies include Homebrew, Git, Fish shell, and Qt6 (providing macdeployqt).
- As external systems interacting with the installation and bundling workflows.

##### Relationships and interactions
- The installation process is initiated by executing install.sh or running Homebrew commands (as documented in the README), which then uses the Homebrew formula (scantailor.rb).
- Once installed, the Scantailor binary is placed in the system path.
- The bundler scripts (e.g., scantailor_bundler.command) then reference this binary (via the output of “which scantailor”) to create a packaged OSX App using a pre-made .app template.
- There is an external dependency on QT6 (for macdeployqt) and on the Fish shell (for executing the bundler script). Validate that these dependencies are correctly linked (as noted by the brew link command in README).
- Documentation (docs and README) guides users through installation and bundling, feeding back into the overall process.

##### Architectural patterns and design principles
- Separation of concerns is clearly visible: the project separates installation (Homebrew formula) from the OS X App bundling (with its own script and template).
- There is a clear workflow pattern: Installation → Binary installation → Bundling of the binary into an OSX App.
- External dependencies are clearly delineated (i.e., Homebrew, Fish shell, Qt6).

##### Technologies, frameworks, or libraries
- Homebrew is used to manage installation (scantailor.rb and install.sh).
- QT6 is the primary framework for the Scantailor application and is used by macdeployqt for bundling.
- The Fish shell is required to run the bundler commands.
- The .app bundle structure (with Info.plist and associated resources) is typical of macOS application packaging.

##### Instructing the principal software engineer
- The Installation component (install.sh → Homebrew formula → System Path/Binary).
- The Bundling component (bundler scripts → App Bundle Template → Bundled OSX App).
- External dependency interactions (QT6 via macdeployqt, Fish shell).
- Documentation and user-guidance (docs and README).

Happy diagramming!

## Diagram (Mermaid)

```mermaid
graph TD
    %% Installation Component
    subgraph "Installation Component"
        A["Install Script (install.sh)"]:::installer
        B["Homebrew Formula (scantailor.rb)"]:::installer
        C["Documentation Instructions (README)"]:::docs
    end

    %% Installed Binary produced by Installation Component
    D["Installed Scantailor Binary (system path)"]:::core

    A -->|"executes"| D
    B -->|"defines install"| D

    %% Bundler Component
    subgraph "Bundler Component"
        E["sanity_check.command"]:::bundler
        F["scantailor_bundler.command"]:::bundler
        G["OSX App Bundle Template"]:::bundler
    end

    D -->|"located via whichscantailor"| E
    E -->|"invokes"| F
    F -->|"bundles into"| G

    %% External Dependencies
    subgraph "External Dependencies"
        H["QT6 (macdeployqt)"]:::external
        I["Fish Shell"]:::external
    end

    I -->|"required by"| F
    H -->|"provides bundling"| F

    %% Documentation & Support
    subgraph "Documentation & Support"
        J["Docs (docs/)"]:::docs
        K["README Instructions (README)"]:::docs
    end

    %% Styles
    classDef installer fill:#f9c,stroke:#333,stroke-width:2px;
    classDef bundler fill:#ccf,stroke:#333,stroke-width:2px;
    classDef docs fill:#cfc,stroke:#333,stroke-width:2px;
    classDef external fill:#fc9,stroke:#333,stroke-width:2px;
    classDef core fill:#eef,stroke:#333,stroke-width:2px;

    %% Click Events for Installer Component
    click A "https://github.com/yb85/scantailor-advanced-osx/blob/master/install.sh"
    click B "https://github.com/yb85/scantailor-advanced-osx/blob/master/scantailor.rb"
    click C "https://github.com/yb85/scantailor-advanced-osx/blob/master/README.md"

    %% Click Events for Bundler Component
    click E "https://github.com/yb85/scantailor-advanced-osx/blob/master/bundler/sanity_check.command"
    click F "https://github.com/yb85/scantailor-advanced-osx/blob/master/bundler/scantailor_bundler.command"
    click G "https://github.com/yb85/scantailor-advanced-osx/blob/master/bundler/scantailor_bundle_template.app"

    %% Click Events for Documentation & Support
    click J "https://github.com/yb85/scantailor-advanced-osx/tree/master/docs/"
    click K "https://github.com/yb85/scantailor-advanced-osx/blob/master/README.md"
```
