# chlorine6104/cld-tools architecture

> Architecture diagram of the GitHub repository chlorine6104/cld-tools, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/chlorine6104/cld-tools
- Repository: https://github.com/chlorine6104/cld-tools

## Overview

CLD-tools is a desktop and command-line toolkit for translating and modifying game CLD files. Users extract dialogue and embedded assets, edit the exported CSV or resources, then repack changes into a separate CLD; a Perl-only diff capability compares two files. The GUI and CLI are implemented in main.py and invoke the Perl tools. README.md documents the tool behavior and outputs; the excerpts show GUI setup and tool lookup, but not the full CLI dispatch or Perl internals, so those links rely on documented behavior.

Main entry points: [`cld_extract.pl`](https://github.com/chlorine6104/cld-tools/blob/main/cld_extract.pl) (CLD extraction), [`cld_repack.pl`](https://github.com/chlorine6104/cld-tools/blob/main/cld_repack.pl) (CLD repacking), [`main.py`](https://github.com/chlorine6104/cld-tools/blob/main/main.py) (GUI and CLI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App interface"]
  node_app["GUI and CLI<br/>[main.py]"]
end

subgraph group_processing["CLD processing"]
  node_extract["CLD extraction<br/>[cld_extract.pl]"]
  node_repack["CLD repacking<br/>[cld_repack.pl]"]
end

subgraph group_artifacts["Translation artifacts"]
  node_source["Input CLD"]
  node_template["Dialogue template"]
  node_csv["Dialogue CSV"]
  node_images["Extracted images"]
  node_fonts["Extracted fonts"]
  node_output["Repacked CLD"]
end

subgraph group_comparison["Comparison"]
  node_compare["CLD comparison"]
  node_other["Comparison CLD"]
  node_report["Difference report"]
end

node_user(("Translator"))

node_user -->|"runs"| node_app
node_app -->|"launches"| node_extract
node_app -->|"launches"| node_repack
node_source -->|"extracts from"| node_extract
node_template -->|"templates export"| node_extract
node_extract -->|"exports"| node_csv
node_extract -->|"extracts"| node_images
node_extract -->|"extracts"| node_fonts
node_user -->|"edits"| node_csv
node_user -->|"modifies"| node_images
node_user -->|"replaces"| node_fonts
node_source -->|"repackages"| node_repack
node_csv -->|"applies translations"| node_repack
node_images -->|"replaces assets"| node_repack
node_fonts -->|"replaces font"| node_repack
node_repack -->|"writes"| node_output
node_user -->|"runs Perl tool"| node_compare
node_source -->|"compares"| node_compare
node_other -->|"compares"| node_compare
node_compare -->|"reports differences"| node_report

click node_app "https://github.com/chlorine6104/cld-tools/blob/main/main.py"
click node_extract "https://github.com/chlorine6104/cld-tools/blob/main/cld_extract.pl"
click node_repack "https://github.com/chlorine6104/cld-tools/blob/main/cld_repack.pl"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app toneBlue
class node_extract,node_repack toneAmber
class node_source,node_template,node_csv,node_images,node_fonts,node_output toneMint
class node_compare,node_other,node_report toneRose
class node_user toneIndigo
```

## Components

### App interface

- [GUI and CLI](https://github.com/chlorine6104/cld-tools/blob/main/main.py): `main.py`

### CLD processing

- [CLD extraction](https://github.com/chlorine6104/cld-tools/blob/main/cld_extract.pl): `cld_extract.pl`
- [CLD repacking](https://github.com/chlorine6104/cld-tools/blob/main/cld_repack.pl): `cld_repack.pl`

### Translation artifacts

- **Input CLD**
- **Dialogue template**
- **Dialogue CSV**
- **Extracted images**
- **Extracted fonts**
- **Repacked CLD**

### Comparison

- **CLD comparison**
- **Comparison CLD**
- **Difference report**

### Other components

- **Translator**

## Connections

- Translator → GUI and CLI: runs (evidence: `README.md`)
- GUI and CLI → CLD extraction: launches (evidence: `main.py`)
- GUI and CLI → CLD repacking: launches (evidence: `main.py`)
- Input CLD → CLD extraction: extracts from (evidence: `README.md`)
- Dialogue template → CLD extraction: templates export (evidence: `README.md`)
- CLD extraction → Dialogue CSV: exports (evidence: `README.md`)
- CLD extraction → Extracted images: extracts (evidence: `README.md`)
- CLD extraction → Extracted fonts: extracts (evidence: `README.md`)
- Translator → Dialogue CSV: edits (evidence: `README.md`)
- Translator → Extracted images: modifies (evidence: `README.md`)
- Translator → Extracted fonts: replaces (evidence: `README.md`)
- Input CLD → CLD repacking: repackages (evidence: `README.md`)
- Dialogue CSV → CLD repacking: applies translations (evidence: `README.md`)
- Extracted images → CLD repacking: replaces assets (evidence: `README.md`)
- Extracted fonts → CLD repacking: replaces font (evidence: `README.md`)
- CLD repacking → Repacked CLD: writes (evidence: `README.md`)
- Translator → CLD comparison: runs Perl tool (evidence: `README.md`)
- Input CLD → CLD comparison: compares (evidence: `README.md`)
- Comparison CLD → CLD comparison: compares (evidence: `README.md`)
- CLD comparison → Difference report: reports differences (evidence: `README.md`)
