# mlawren/githook-perltidy architecture

> Architecture diagram of the GitHub repository mlawren/githook-perltidy, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mlawren/githook-perltidy
- Repository: https://github.com/mlawren/githook-perltidy

## Overview

##### Main Components

a. Command Interface Layer
- Main entry point (bin/githook-perltidy)
- Two primary commands: 'install' and 'pre-commit'

b. Core Processing Components
- App::githook::perltidy (main module)
- Installation Handler (App::githook::perltidy::install)
- Pre-commit Handler (App::githook::perltidy::pre_commit)
- CI-specific variants of these components

c. External Tools Integration
- Perl::Tidy
- Perl::Critic
- Pod::Tidy
- Pod::Text (for README generation)

d. Configuration Management
- .perltidyrc / .perltidyrc.sweetened
- .podtidy-opts
- .perlcriticrc
- .readme_from

e. Git Integration
- Git Index interaction
- Git Hooks directory
- Working Directory

##### Specific Elements

- Rectangles: Core application modules
- Hexagons: External tools (Perl::Tidy, Perl::Critic, etc.)
- Rounded rectangles: Git components

##### Key Processes to Highlight

a. Installation Flow:
Git Repo → install command → Hook Installation → Git hooks directory

b. Pre-commit Flow:
Git commit → pre-commit hook → File processing → Git index update

##### Additional Details

- Temporary directory usage
- Error handling paths
- Optional components (Perl::Critic, Pod::Tidy)
- Configuration file dependencies

##### Notes for Implementation

- Keep the main flow clear and centered
- Related components together
- Use clear labels for all components
- Version information
- Notes about environment variables (NO_GITHOOK_PERLTIDY)

- Easy alignment and spacing
- Export to common formats

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph CLI
        CMD[Command Interface]
        INSTALL[Install Command]
        PRECOMMIT[Pre-commit Command]
    end

    subgraph Core
        MAIN[Core Processing Module]
        INSTHAND[Installation Handler]
        INSTCI[CI Installation Handler]
        PREHAND[Pre-commit Handler]
        PRECICI[CI Pre-commit Handler]
    end

    subgraph "External Tools"
        PTIDY{{Perl::Tidy}}
        PCRITIC{{Perl::Critic}}
        PODTIDY{{Pod::Tidy}}
        PODTEXT{{Pod::Text}}
    end

    subgraph "Configuration"
        PTIDYRC[(perltidyrc)]
        PODTIDYRC[(podtidy-opts)]
        PCRITICRC[(perlcriticrc)]
        README[(readme_from)]
    end

    subgraph "Git Integration"
        GINDEX[Git Index]
        GHOOKS[Git Hooks Directory]
        WDIR[Working Directory]
    end

    %% Command Flow
    CMD --> INSTALL & PRECOMMIT
    INSTALL --> INSTHAND
    PRECOMMIT --> PREHAND
    INSTHAND --> INSTCI
    PREHAND --> PRECICI

    %% Core Processing
    MAIN --> INSTHAND & PREHAND
    INSTHAND --> GHOOKS
    PREHAND --> GINDEX
    PREHAND --> WDIR

    %% Tool Integration
    PREHAND --> PTIDY & PCRITIC & PODTIDY
    PTIDY --> GINDEX
    PCRITIC --> GINDEX
    PODTIDY --> GINDEX
    PODTEXT --> README

    %% Configuration Reading
    PTIDY -.-> PTIDYRC
    PODTIDY -.-> PODTIDYRC
    PCRITIC -.-> PCRITICRC
    PODTEXT -.-> README

    %% Click Events
    click CMD "https://github.com/mlawren/githook-perltidy/tree/main/bin/githook-perltidy"
    click MAIN "https://github.com/mlawren/githook-perltidy/blob/main/lib/App/githook/perltidy.pm"
    click INSTHAND "https://github.com/mlawren/githook-perltidy/blob/main/lib/App/githook/perltidy/install.pm"
    click INSTCI "https://github.com/mlawren/githook-perltidy/blob/main/lib/App/githook/perltidy/install_CI.pm"
    click PREHAND "https://github.com/mlawren/githook-perltidy/blob/main/lib/App/githook/perltidy/pre_commit.pm"
    click PRECICI "https://github.com/mlawren/githook-perltidy/blob/main/lib/App/githook/perltidy/pre_commit_CI.pm"
    click PTIDYRC "https://github.com/mlawren/githook-perltidy/blob/main/.perltidyrc"
    click PODTIDYRC "https://github.com/mlawren/githook-perltidy/blob/main/.podtidy-opts"
    click README "https://github.com/mlawren/githook-perltidy/blob/main/.readme_from"

    %% Styling
    classDef default fill:#f9f9f9,stroke:#333,stroke-width:1px
    classDef core fill:#b3e0ff,stroke:#333
    classDef git fill:#90EE90,stroke:#333
    classDef tool fill:#FFB366,stroke:#333
    classDef config fill:#E6E6E6,stroke:#333
    
    class MAIN,INSTHAND,INSTCI,PREHAND,PRECICI core
    class GINDEX,GHOOKS,WDIR git
    class PTIDY,PCRITIC,PODTIDY,PODTEXT tool
    class PTIDYRC,PODTIDYRC,PCRITICRC,README config
```
