# eedcd/map-packer architecture

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

- Interactive diagram: https://gitdiagram.com/eedcd/map-packer
- Repository: https://github.com/eedcd/map-packer

## Overview

map-packer is a Minecraft map-packing CLI. A user invokes commands through the Typer entry point: init scaffolds a map project, sync copies a configured save into a target and optionally prunes pristine chunks and clears cached lighting/heightmaps, then pack optionally minifies datapacks and creates a named archive in a supported format. Configuration and terminal presentation are shared internal layers. The excerpts show the command registrations and sync’s configuration/UI/world dependencies; pack’s datapack-minification capability is documented in its source. Other internal calls are omitted where excerpts do not establish them.

Main entry points: [`src/commands/sync.py`](https://github.com/eedcd/map-packer/blob/main/src/commands/sync.py) (Save sync), [`src/commands/pack.py`](https://github.com/eedcd/map-packer/blob/main/src/commands/pack.py) (Archive pack), [`src/cli.py`](https://github.com/eedcd/map-packer/blob/main/src/cli.py) (Command router), [`src/lib/ui.py`](https://github.com/eedcd/map-packer/blob/main/src/lib/ui.py) (Terminal UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["CLI entry"]
  node_cli["Command router<br/>[cli.py]"]
  node_ui["Terminal UI<br/>[ui.py]"]
end

subgraph group_setup["Project setup"]
  node_init["Project init<br/>[init.py]"]
  node_config["Config reader<br/>[config.py]"]
end

subgraph group_sync["World sync"]
  node_sync_command["Save sync<br/>[sync.py]"]
  node_save_env["Save path input<br/>[sync.py]"]
  node_sync_files["File reconciliation<br/>[sync.py]"]
  node_prune["Pristine chunk pruning<br/>[world.py]"]
  node_optimize["Chunk cache cleanup<br/>[world.py]"]
end

subgraph group_pack["Archive packing"]
  node_pack_command["Archive pack<br/>[pack.py]"]
  node_minify["Datapack minifier<br/>[datapack.py]"]
  node_archive["Compressed map archive<br/>[pack.py]"]
end

node_user(("CLI user"))

node_user -->|"invokes"| node_cli
node_cli -->|"registers"| node_init
node_cli -->|"registers"| node_sync_command
node_cli -->|"registers"| node_pack_command
node_init -->|"reports through"| node_ui
node_sync_command -->|"reads"| node_save_env
node_sync_command -->|"loads"| node_config
node_sync_command -->|"reconciles"| node_sync_files
node_sync_command -->|"prunes via"| node_prune
node_sync_command -->|"optimizes via"| node_optimize
node_sync_command -->|"reports through"| node_ui
node_pack_command -->|"loads"| node_config
node_pack_command -->|"minifies via"| node_minify
node_pack_command -->|"writes"| node_archive
node_pack_command -->|"reports through"| node_ui

click node_cli "https://github.com/eedcd/map-packer/blob/main/src/cli.py"
click node_init "https://github.com/eedcd/map-packer/blob/main/src/commands/init.py"
click node_config "https://github.com/eedcd/map-packer/blob/main/src/lib/config.py"
click node_sync_command "https://github.com/eedcd/map-packer/blob/main/src/commands/sync.py"
click node_save_env "https://github.com/eedcd/map-packer/blob/main/src/commands/sync.py"
click node_sync_files "https://github.com/eedcd/map-packer/blob/main/src/commands/sync.py"
click node_prune "https://github.com/eedcd/map-packer/blob/main/src/lib/world.py"
click node_optimize "https://github.com/eedcd/map-packer/blob/main/src/lib/world.py"
click node_pack_command "https://github.com/eedcd/map-packer/blob/main/src/commands/pack.py"
click node_minify "https://github.com/eedcd/map-packer/blob/main/src/lib/datapack.py"
click node_archive "https://github.com/eedcd/map-packer/blob/main/src/commands/pack.py"
click node_ui "https://github.com/eedcd/map-packer/blob/main/src/lib/ui.py"

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_cli,node_ui,node_user toneBlue
class node_init,node_config toneAmber
class node_sync_command,node_save_env,node_sync_files,node_prune,node_optimize toneMint
class node_pack_command,node_minify,node_archive toneRose
```

## Components

### CLI entry

- [Command router](https://github.com/eedcd/map-packer/blob/main/src/cli.py): `src/cli.py`
- [Terminal UI](https://github.com/eedcd/map-packer/blob/main/src/lib/ui.py): `src/lib/ui.py`

### Project setup

- [Project init](https://github.com/eedcd/map-packer/blob/main/src/commands/init.py): `src/commands/init.py`
- [Config reader](https://github.com/eedcd/map-packer/blob/main/src/lib/config.py): `src/lib/config.py`

### World sync

- [Save sync](https://github.com/eedcd/map-packer/blob/main/src/commands/sync.py): `src/commands/sync.py`
- [Save path input](https://github.com/eedcd/map-packer/blob/main/src/commands/sync.py): `src/commands/sync.py`
- [File reconciliation](https://github.com/eedcd/map-packer/blob/main/src/commands/sync.py): `src/commands/sync.py`
- [Pristine chunk pruning](https://github.com/eedcd/map-packer/blob/main/src/lib/world.py): `src/lib/world.py`
- [Chunk cache cleanup](https://github.com/eedcd/map-packer/blob/main/src/lib/world.py): `src/lib/world.py`

### Archive packing

- [Archive pack](https://github.com/eedcd/map-packer/blob/main/src/commands/pack.py): `src/commands/pack.py`
- [Datapack minifier](https://github.com/eedcd/map-packer/blob/main/src/lib/datapack.py): `src/lib/datapack.py`
- [Compressed map archive](https://github.com/eedcd/map-packer/blob/main/src/commands/pack.py): `src/commands/pack.py`

### Other components

- **CLI user**

## Connections

- CLI user → Command router: invokes (evidence: `src/cli.py`)
- Command router → Project init: registers (evidence: `src/cli.py`)
- Command router → Save sync: registers (evidence: `src/cli.py`)
- Command router → Archive pack: registers (evidence: `src/cli.py`)
- Project init → Terminal UI: reports through (evidence: `src/commands/init.py`)
- Save sync → Save path input: reads (evidence: `src/commands/sync.py`)
- Save sync → Config reader: loads (evidence: `src/commands/sync.py`)
- Save sync → File reconciliation: reconciles (evidence: `src/commands/sync.py`)
- Save sync → Pristine chunk pruning: prunes via (evidence: `src/commands/sync.py`)
- Save sync → Chunk cache cleanup: optimizes via (evidence: `src/commands/sync.py`)
- Save sync → Terminal UI: reports through (evidence: `src/commands/sync.py`)
- Archive pack → Config reader: loads (evidence: `src/commands/pack.py`)
- Archive pack → Datapack minifier: minifies via (evidence: `src/commands/pack.py`)
- Archive pack → Compressed map archive: writes (evidence: `src/commands/pack.py`)
- Archive pack → Terminal UI: reports through (evidence: `src/commands/pack.py`)
