# rosmord/jseshutils architecture

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

- Interactive diagram: https://gitdiagram.com/rosmord/jseshutils
- Repository: https://github.com/rosmord/jseshutils

## Overview

##### Project type and purpose
- This is a set of independent command-line Java utilities (an “open-source tool” category) that leverage the JSesh library to process SVG files.
- Each subdirectory (jsesh-makesvgindex, jsesh-normalizesvg) is a standalone Maven project with a Main class and a comparator utility.

##### Key components
a. User / CLI
- The end user invokes one of the two JARs from the shell, passing input/output paths and options.
b. jsesh-makesvgindex module
- Main.java – parses arguments, invokes SVG indexing routine.
- GardinerFileOrderComparator – sorts SVG files according to a custom order.
c. jsesh-normalizesvg module
- Main.java – parses arguments, invokes SVG normalization routine.
- GardinerFileOrderComparator – sorts SVG files before normalization.
d. JSesh core library (external dependency)
- Provides APIs to read, manipulate, and write SVG fragments for Egyptian hieroglyphs.
e. File system
- Input directory containing SVG files.
- Output directory where index pages or normalized SVGs are written.

##### Relationships and data flows
- The User/CLI calls the Main class in one of the modules.
- Main loads file names from the input directory.
- It calls GardinerFileOrderComparator to sort the file list.
- It invokes relevant JSesh library APIs:
- For “makeSVGIndex”, generate an HTML or XML index referencing each SVG.
- For “normalizeSVG”, apply canonical transforms (e.g., flatten transforms, standardize units).
- Results are written back to the file system (output directory).

##### Architectural patterns & design principles
- Modular, single-responsibility CLI applications: each module has one Main entry point and one core comparator utility.
- Clear separation of concerns:
- Argument parsing and orchestration in Main
- Sorting logic in a dedicated comparator class
- SVG processing in JSesh library
- External dependency is injected at compile time via Maven.

##### Technologies / frameworks
- Java (source code in src/main/java)
- Maven for build and dependency management (pom.xml in each module)
- JSesh library (declared as a Maven dependency)
- Standard Java I/O for file handling

## Diagram (Mermaid)

```mermaid
graph TB
    %% Global Entities
    User["User / CLI"]:::cli
    FSIn["File System\n(Input Directory)"]:::fs
    FSOut["File System\n(Output Directory)"]:::fs
    JSeshLib[(JSesh Core Library)]:::ext

    %% Modules
    subgraph "jsesh-makesvgindex"
        MakeMain["Main.java"]:::module
        MakeComp["GardinerFileOrderComparator.java"]:::module
        MakePom["pom.xml"]:::module
    end

    subgraph "jsesh-normalizesvg"
        NormMain["Main.java"]:::module
        NormComp["GardinerFileOrderComparator.java"]:::module
        NormPom["pom.xml"]:::module
    end

    %% Connections for makesvgindex
    User -->|"java -jar makesvgindex.jar"| MakeMain
    FSIn -->|"load files"| MakeMain
    MakeMain -->|"sort files"| MakeComp
    MakeComp --> MakeMain
    MakeMain -->|"call SVG API"| JSeshLib
    JSeshLib --> MakeMain
    MakeMain -->|"write output"| FSOut

    %% Connections for normalizesvg
    User -->|"java -jar normalizesvg.jar"| NormMain
    FSIn -->|"load files"| NormMain
    NormMain -->|"sort files"| NormComp
    NormComp --> NormMain
    NormMain -->|"call SVG API"| JSeshLib
    JSeshLib --> NormMain
    NormMain -->|"write output"| FSOut

    %% Click Events
    click User "https://github.com/rosmord/jseshutils/blob/main/README.md"
    click MakeMain "https://github.com/rosmord/jseshutils/blob/main/jsesh-makesvgindex/src/main/java/org/qenherkhopeshef/makeSVGIndex/Main.java"
    click MakeComp "https://github.com/rosmord/jseshutils/blob/main/jsesh-makesvgindex/src/main/java/org/qenherkhopeshef/makeSVGIndex/GardinerFileOrderComparator.java"
    click MakePom "https://github.com/rosmord/jseshutils/blob/main/jsesh-makesvgindex/pom.xml"
    click NormMain "https://github.com/rosmord/jseshutils/blob/main/jsesh-normalizesvg/src/main/java/org/qenherkhopeshef/svgnormalize/Main.java"
    click NormComp "https://github.com/rosmord/jseshutils/blob/main/jsesh-normalizesvg/src/main/java/org/qenherkhopeshef/svgnormalize/GardinerFileOrderComparator.java"
    click NormPom "https://github.com/rosmord/jseshutils/blob/main/jsesh-normalizesvg/pom.xml"

    %% Styles
    classDef cli fill:lightgreen,stroke:#333,stroke-width:1px;
    classDef module fill:lightblue,stroke:#333,stroke-width:1px;
    classDef ext fill:orange,stroke:#333,stroke-width:1px;
    classDef fs fill:#dddddd,stroke:#333,stroke-width:1px;
```
