# unknownvps/cfetools architecture

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

- Interactive diagram: https://gitdiagram.com/unknownvps/cfetools
- Repository: https://github.com/unknownvps/cfetools

## Overview

CFETools (Axle) is a C++ command-line tool for encoding files into BMP images and decoding them back, with compression, encryption, folder support, and diff/patch and file-splitting workflows. The principal path is command dispatch, image creation and pixel writing, then BMP reading, reconstruction, and any requested decompression or unpacking. Separate command families provide patching and threshold-based share reconstruction. Some command implementations were not sampled, so links for those documented workflows reflect the command and subsystem paths in the tree; uncertain internal wiring is omitted.

Main entry points: [`main.cpp`](https://github.com/unknownvps/cfetools/blob/main/main.cpp) (CLI entry), [`func/file_creation/create_file.cpp`](https://github.com/unknownvps/cfetools/blob/main/func/file_creation/create_file.cpp) (File reconstruction), [`func/img_creation/create_img.cpp`](https://github.com/unknownvps/cfetools/blob/main/func/img_creation/create_img.cpp) (Image creation), [`utils/bmp/writer/bmp_writer.cpp`](https://github.com/unknownvps/cfetools/blob/main/utils/bmp/writer/bmp_writer.cpp) (BMP pixel writer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI and commands"]
  node_main["CLI entry<br/>[main.cpp]"]
  node_cmdloader["Command loader<br/>[command_loader.h]"]
  node_encodecmd["Encode command<br/>[encode.h]"]
  node_decodecmd["Decode command<br/>[decode.h]"]
  node_packcmd["Pack command<br/>[pack.h]"]
  node_compresscmd["Compress command<br/>[compress.h]"]
  node_patchcmd["Patch commands<br/>[patch.h]"]
  node_splitcmd["Split command<br/>[split.h]"]
end

subgraph group_image["Image encoding"]
  node_imagecreate["Image creation<br/>[create_img.cpp]"]
  node_bmpwriter["BMP pixel writer<br/>[bmp_writer.cpp]"]
  node_aio["Embedded metadata<br/>[aio_header.cpp]"]
  node_folderpack["Folder packing<br/>[folder_packer.cpp]"]
end

subgraph group_restore["Decode and restore"]
  node_bmpreader["BMP pixel reader<br/>[bmp_reader.cpp]"]
  node_filecreate["File reconstruction<br/>[create_file.cpp]"]
  node_decompress["Decompression<br/>[decompress.cpp]"]
  node_hashers["File verification<br/>[fileHasher.hpp]"]
end

subgraph group_delta["Diff and patch"]
  node_patchengine["Patch engine<br/>[patch.cpp]"]
end

subgraph group_shares["Split and integrate"]
  node_integratecmd["Integrate command<br/>[integrate.h]"]
  node_splitengine["Share processing"]
end

node_user(("CLI user"))
node_output["Files and shares"]

node_user -->|"runs commands"| node_main
node_main -->|"loads commands"| node_cmdloader
node_main -->|"dispatches"| node_encodecmd
node_main -->|"dispatches"| node_decodecmd
node_main -->|"dispatches"| node_packcmd
node_main -->|"dispatches"| node_compresscmd
node_main -->|"dispatches"| node_patchcmd
node_main -->|"dispatches"| node_splitcmd
node_main -->|"dispatches"| node_integratecmd
node_encodecmd -->|"creates image"| node_imagecreate
node_packcmd -->|"packs folders"| node_folderpack
node_imagecreate -->|"writes pixels"| node_bmpwriter
node_bmpwriter -->|"writes metadata"| node_aio
node_bmpwriter -->|"writes BMP"| node_output
node_imagecreate -.->|"writes metadata file"| node_output
node_decodecmd -->|"reads image"| node_bmpreader
node_bmpreader -->|"provides decoded bytes"| node_filecreate
node_filecreate -->|"decompresses payload"| node_decompress
node_filecreate -->|"unpacks folders"| node_folderpack
node_filecreate -->|"verifies file"| node_hashers
node_filecreate -->|"writes restored files"| node_output
node_patchcmd -->|"creates or applies"| node_patchengine
node_patchengine -->|"writes patch or result"| node_output
node_splitcmd -->|"splits file"| node_splitengine
node_splitengine -->|"writes shares"| node_output
node_integratecmd -->|"reconstructs shares"| node_splitengine
node_integratecmd -->|"writes reconstructed file"| node_output

click node_main "https://github.com/unknownvps/cfetools/blob/main/main.cpp"
click node_cmdloader "https://github.com/unknownvps/cfetools/blob/main/cmds/command_loader.h"
click node_encodecmd "https://github.com/unknownvps/cfetools/blob/main/cmds/encode.h"
click node_decodecmd "https://github.com/unknownvps/cfetools/blob/main/cmds/decode.h"
click node_packcmd "https://github.com/unknownvps/cfetools/blob/main/cmds/pack.h"
click node_compresscmd "https://github.com/unknownvps/cfetools/blob/main/cmds/compress.h"
click node_patchcmd "https://github.com/unknownvps/cfetools/blob/main/cmds/patch.h"
click node_splitcmd "https://github.com/unknownvps/cfetools/blob/main/cmds/split.h"
click node_integratecmd "https://github.com/unknownvps/cfetools/blob/main/cmds/integrate.h"
click node_imagecreate "https://github.com/unknownvps/cfetools/blob/main/func/img_creation/create_img.cpp"
click node_bmpwriter "https://github.com/unknownvps/cfetools/blob/main/utils/bmp/writer/bmp_writer.cpp"
click node_aio "https://github.com/unknownvps/cfetools/blob/main/utils/aio/aio_header.cpp"
click node_folderpack "https://github.com/unknownvps/cfetools/blob/main/func/folder_packer/folder_packer.cpp"
click node_bmpreader "https://github.com/unknownvps/cfetools/blob/main/utils/bmp/reader/bmp_reader.cpp"
click node_filecreate "https://github.com/unknownvps/cfetools/blob/main/func/file_creation/create_file.cpp"
click node_decompress "https://github.com/unknownvps/cfetools/blob/main/utils/compress/decompress.cpp"
click node_hashers "https://github.com/unknownvps/cfetools/blob/main/utils/hashers/fileHasher.hpp"
click node_patchengine "https://github.com/unknownvps/cfetools/blob/main/func/patch_creation/patch.cpp"
click node_splitengine "https://github.com/unknownvps/cfetools/blob/main/func/split_integrate/split_integrate.cpp"

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_main,node_cmdloader,node_encodecmd,node_decodecmd,node_packcmd,node_compresscmd,node_patchcmd,node_splitcmd,node_user toneBlue
class node_imagecreate,node_bmpwriter,node_aio,node_folderpack toneAmber
class node_bmpreader,node_filecreate,node_decompress,node_hashers toneMint
class node_patchengine toneRose
class node_integratecmd,node_splitengine,node_output toneIndigo
```

## Components

### CLI and commands

- [CLI entry](https://github.com/unknownvps/cfetools/blob/main/main.cpp): `main.cpp`
- [Command loader](https://github.com/unknownvps/cfetools/blob/main/cmds/command_loader.h): `cmds/command_loader.h`
- [Encode command](https://github.com/unknownvps/cfetools/blob/main/cmds/encode.h): `cmds/encode.h`
- [Decode command](https://github.com/unknownvps/cfetools/blob/main/cmds/decode.h): `cmds/decode.h`
- [Pack command](https://github.com/unknownvps/cfetools/blob/main/cmds/pack.h): `cmds/pack.h`
- [Compress command](https://github.com/unknownvps/cfetools/blob/main/cmds/compress.h): `cmds/compress.h`
- [Patch commands](https://github.com/unknownvps/cfetools/blob/main/cmds/patch.h): `cmds/patch.h`
- [Split command](https://github.com/unknownvps/cfetools/blob/main/cmds/split.h): `cmds/split.h`

### Image encoding

- [Image creation](https://github.com/unknownvps/cfetools/blob/main/func/img_creation/create_img.cpp): `func/img_creation/create_img.cpp`
- [BMP pixel writer](https://github.com/unknownvps/cfetools/blob/main/utils/bmp/writer/bmp_writer.cpp): `utils/bmp/writer/bmp_writer.cpp`
- [Embedded metadata](https://github.com/unknownvps/cfetools/blob/main/utils/aio/aio_header.cpp): `utils/aio/aio_header.cpp`
- [Folder packing](https://github.com/unknownvps/cfetools/blob/main/func/folder_packer/folder_packer.cpp): `func/folder_packer/folder_packer.cpp`

### Decode and restore

- [BMP pixel reader](https://github.com/unknownvps/cfetools/blob/main/utils/bmp/reader/bmp_reader.cpp): `utils/bmp/reader/bmp_reader.cpp`
- [File reconstruction](https://github.com/unknownvps/cfetools/blob/main/func/file_creation/create_file.cpp): `func/file_creation/create_file.cpp`
- [Decompression](https://github.com/unknownvps/cfetools/blob/main/utils/compress/decompress.cpp): `utils/compress/decompress.cpp`
- [File verification](https://github.com/unknownvps/cfetools/blob/main/utils/hashers/fileHasher.hpp): `utils/hashers/fileHasher.hpp`

### Diff and patch

- [Patch engine](https://github.com/unknownvps/cfetools/blob/main/func/patch_creation/patch.cpp): `func/patch_creation/patch.cpp`

### Split and integrate

- [Integrate command](https://github.com/unknownvps/cfetools/blob/main/cmds/integrate.h): `cmds/integrate.h`
- [Share processing](https://github.com/unknownvps/cfetools/blob/main/func/split_integrate/split_integrate.cpp): `func/split_integrate/split_integrate.cpp`

### Other components

- **CLI user**
- **Files and shares**

## Connections

- CLI user → CLI entry: runs commands
- CLI entry → Command loader: loads commands
- CLI entry → Encode command: dispatches
- CLI entry → Decode command: dispatches
- CLI entry → Pack command: dispatches
- CLI entry → Compress command: dispatches
- CLI entry → Patch commands: dispatches
- CLI entry → Split command: dispatches
- CLI entry → Integrate command: dispatches
- Encode command → Image creation: creates image
- Pack command → Folder packing: packs folders
- Image creation → BMP pixel writer: writes pixels
- BMP pixel writer → Embedded metadata: writes metadata
- BMP pixel writer → Files and shares: writes BMP
- Image creation → Files and shares: writes metadata file
- Decode command → BMP pixel reader: reads image
- BMP pixel reader → File reconstruction: provides decoded bytes
- File reconstruction → Decompression: decompresses payload
- File reconstruction → Folder packing: unpacks folders
- File reconstruction → File verification: verifies file
- File reconstruction → Files and shares: writes restored files
- Patch commands → Patch engine: creates or applies
- Patch engine → Files and shares: writes patch or result
- Split command → Share processing: splits file
- Share processing → Files and shares: writes shares
- Integrate command → Share processing: reconstructs shares
- Integrate command → Files and shares: writes reconstructed file
