# lgarron/folderify architecture

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

- Interactive diagram: https://gitdiagram.com/lgarron/folderify
- Repository: https://github.com/lgarron/folderify

## Overview

##### Main Components

a) Input Processing Layer:
- Command Line Interface (src/main.rs, src/command.rs, src/options.rs)
- Input Validation & Error Handling (src/error.rs)
- Resource Management (src/resources.rs)

b) Core Processing Layer:
- ImageMagick Integration (src/magick.rs)
- Output Path Management (src/output_paths.rs)
- Primitive Types (src/primitives.rs)

c) External Dependencies:
- ImageMagick CLI
- macOS System Tools (iconutil, sips, etc.)
- Optional Tools (fileicon)

**┌─────────────────────┐**
- Input Layer      │
- ┘
- ↓
**┌─────────────────────┐**
- Processing Layer   │
- ┘
- ↓
**┌─────────────────────┐**
- Output Layer     │
- ┘

##### Component Relationships

- User input → Command parsing → Options validation

##### Key Elements to Highlight

a) Input Processing:
- PNG mask file input
- Command-line arguments
- macOS version detection

b) Core Processing:
- Image manipulation via ImageMagick
- Size variants generation (16x16 through 512x512@2x)
- Light/dark mode processing
- Badge application (if specified)

c) Output Options:
- .icns file generation
- .iconset folder creation

##### Technical Details

Annotations for:
- Supported image dimensions (384px height, 128px width multiples)
- Grid system (16px grid)
- Supported macOS versions
- Required system dependencies

- User interaction
- Image processing
- System integration
- File system operations

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef core fill:#b3d1ff,stroke:#4d88ff
    classDef external fill:#90EE90,stroke:#228B22
    classDef io fill:#FFB366,stroke:#FF8000
    classDef optional fill:#E0E0E0,stroke:#808080
    
    %% Input Layer
    subgraph Input
        CLI["Command Line Interface"]:::core
        CMD["Command Processing"]:::core
        OPT["Options & Validation"]:::core
        ERR["Error Handling"]:::core
    end

    %% Core Processing Layer
    subgraph Processing
        ICE["Icon Conversion Engine"]:::core
        IMG["ImageMagick Integration"]:::core
        RES["Resource Management"]:::core
        PRM["Primitive Types"]:::core
        
        subgraph Resources
            BADGES["Badges"]:::io
            FOLDERS["Folders"]:::io
        end
    end

    %% External Dependencies
    subgraph System
        MAGICK["ImageMagick CLI"]:::external
        MACOS["macOS Tools"]:::external
        FILEICON["fileicon"]:::optional
    end

    %% Output Layer
    subgraph Output
        OUT["Output Path Management"]:::core
        ICNS[".icns Generation"]:::io
        ICONSET[".iconset Creation"]:::io
        FOLDER["Folder Icon Application"]:::io
    end

    %% Relationships
    CLI --> CMD
    CMD --> OPT
    OPT --> ERR
    CMD --> ICE
    ICE --> IMG
    IMG --> MAGICK
    RES --> BADGES
    RES --> FOLDERS
    ICE --> OUT
    OUT --> ICNS
    OUT --> ICONSET
    OUT --> FOLDER
    FOLDER --> MACOS
    FOLDER -.-> FILEICON

    %% Click Events
    click CLI "https://github.com/lgarron/folderify/blob/main/src/main.rs"
    click CMD "https://github.com/lgarron/folderify/blob/main/src/command.rs"
    click OPT "https://github.com/lgarron/folderify/blob/main/src/options.rs"
    click ERR "https://github.com/lgarron/folderify/blob/main/src/error.rs"
    click ICE "https://github.com/lgarron/folderify/blob/main/src/icon_conversion.rs"
    click IMG "https://github.com/lgarron/folderify/blob/main/src/magick.rs"
    click RES "https://github.com/lgarron/folderify/blob/main/src/resources.rs"
    click PRM "https://github.com/lgarron/folderify/blob/main/src/primitives.rs"
    click BADGES "https://github.com/lgarron/folderify/tree/main/src/resources/badges/"
    click FOLDERS "https://github.com/lgarron/folderify/tree/main/src/resources/folders/"
    click OUT "https://github.com/lgarron/folderify/blob/main/src/output_paths.rs"

    %% Legend
    subgraph Legend
        L1["Core Components"]:::core
        L2["External Dependencies"]:::external
        L3["Input/Output"]:::io
        L4["Optional Tools"]:::optional
    end
```
