# leptos-null/classdumpctl architecture

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

- Interactive diagram: https://gitdiagram.com/leptos-null/classdumpctl
- Repository: https://github.com/leptos-null/classdumpctl

## Overview

##### Project type and purpose
- This is a native command-line tool (classdumpctl) written in Objective-C/SwiftPM that dumps Objective-C class and protocol headers.
- It depends on the ClassDumpRuntime library to inspect Mach-O images and the dyld_shared_cache.
- Core use cases: single class or protocol inspection, library/framework dumping, full shared-cache dumping with concurrency.

##### File structure
- Top-level:
– .github/workflows: CI build and release pipelines
– .swiftpm + Package.swift: Swift Package Manager manifest and Xcode integration
– ClassDumpRuntime (git submodule): underlying parsing library
– control, entitlements.plist, Makefile, LICENSE.md
- Patterns:
– CLI “frontend” (argument parsing, orchestration)
– Library “backend” (ClassDumpRuntime handles low-level Mach-O/dyld parsing)
– Output formatting layer (ANSI vs. HTML)
– Concurrency/job manager (when dumping entire cache)
- Deployment/config: SwiftPM for build, GitHub Actions for CI/CD.

##### README for insights
- Usage modes: single class/protocol, per-image dump, full cache dump with -j concurrency.
- Flags control “strip” behaviors (protocol conformance, overrides, duplicates).
- Architecture hints: core runtime library + formatting + file I/O + parallel processing.

##### Key advice
- Be detailed but avoid over-fragmenting: group low-level POSIX calls under “File I/O Module.”
- Git submodule relationship for ClassDumpRuntime in a side-note.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% External User
    User["User (stdin/stdout)"]:::external

    %% CLI Frontend
    subgraph "CLI Frontend" 
        direction TB
        ArgParser["Argument Parser\n(flags, modes)"]:::frontend
        Orchestrator["Orchestrator/Job Manager"]:::frontend
        Concurrency["Concurrency Controller\n(worker pool)"]:::frontend
    end

    %% Core Runtime Library
    subgraph "ClassDumpRuntime Library" 
        direction TB
        MachOLoader["Mach-O Image Loader"]:::core
        DylibReader["dyld_shared_cache Reader"]:::core
        SymbolExtractor["Symbol Extractor\n(classes, protocols)"]:::core
    end

    %% Formatter Module
    subgraph "Formatter Module"
        direction TB
        ANSIFormatter["ANSI Color Formatter"]:::frontend
        HTMLFormatter["HTML Formatter"]:::frontend
    end

    %% File I/O Module
    subgraph "File I/O Module"
        direction TB
        DirCreator["Directory Creator"]:::core
        FileWriter["File Writer"]:::core
        Stdout["Stdout"]:::core
    end

    %% External Systems
    subgraph "External Systems"
        direction TB
        OSAPIs["OS APIs\n(dyld, file system)"]:::external
        InputBinaries["Input Binaries\n(frameworks, caches)"]:::external
    end

    %% Git Submodule Note
    NoteSubmodule["Git Submodule:\nClassDumpRuntime"]:::note

    %% License and Docs
    README["README.md"]:::doc
    License["LICENSE.md"]:::doc

    %% Connections
    User -->|invokes CLI| ArgParser
    ArgParser -->|Parsed args| Orchestrator
    Orchestrator -->|schedule tasks| Concurrency
    Concurrency -->|inspect image| MachOLoader
    Concurrency -->|inspect cache| DylibReader
    MachOLoader -->|raw data| SymbolExtractor
    DylibReader -->|raw data| SymbolExtractor
    SymbolExtractor -->|Header data| ANSIFormatter
    SymbolExtractor -->|Header data| HTMLFormatter
    ANSIFormatter -->|Formatted output| FileWriter
    HTMLFormatter -->|Formatted output| FileWriter
    ANSIFormatter -->|Formatted output| Stdout
    HTMLFormatter -->|Formatted output| Stdout
    FileWriter -->|uses| OSAPIs
    MachOLoader -->|calls| OSAPIs
    DylibReader -->|calls| OSAPIs
    InputBinaries -->|provided to| MachOLoader
    InputBinaries -->|provided to| DylibReader
    NoteSubmodule -.-> ClassDumpRuntime

    %% Click Events
    click ArgParser "https://github.com/leptos-null/classdumpctl/blob/main/Sources/classdumpctl/main.m"
    click ANSIFormatter "https://github.com/leptos-null/classdumpctl/blob/main/Sources/classdumpctl/ansi-color.h"
    click MachOLoader "https://github.com/leptos-null/classdumpctl/tree/main/ClassDumpRuntime/"
    click DylibReader "https://github.com/leptos-null/classdumpctl/tree/main/ClassDumpRuntime/"
    click SymbolExtractor "https://github.com/leptos-null/classdumpctl/tree/main/ClassDumpRuntime/"
    click README "https://github.com/leptos-null/classdumpctl/blob/main/README.md"
    click License "https://github.com/leptos-null/classdumpctl/blob/main/LICENSE.md"
    click Orchestrator "https://github.com/leptos-null/classdumpctl/blob/main/Sources/classdumpctl/main.m"
    click Concurrency "https://github.com/leptos-null/classdumpctl/blob/main/Sources/classdumpctl/main.m"
    click OSAPIs "https://github.com/leptos-null/classdumpctl/blob/main/entitlements.plist"
    click FileWriter "https://github.com/leptos-null/classdumpctl/tree/main/Makefile"
    click DirCreator "https://github.com/leptos-null/classdumpctl/tree/main/Makefile"
    click README "https://github.com/leptos-null/classdumpctl/blob/main/README.md"
    click License "https://github.com/leptos-null/classdumpctl/blob/main/LICENSE.md"
    click README "https://github.com/leptos-null/classdumpctl/blob/main/README.md"
    click OSAPIs "https://github.com/leptos-null/classdumpctl/blob/main/entitlements.plist"
    click NoteSubmodule "https://github.com/leptos-null/classdumpctl/tree/main/ClassDumpRuntime/"
    click ArgParser "https://github.com/leptos-null/classdumpctl/blob/main/Package.swift"
    click Orchestrator "https://github.com/leptos-null/classdumpctl/tree/main/.swiftpm/"
    click README "https://github.com/leptos-null/classdumpctl/blob/main/README.md"
    click License "https://github.com/leptos-null/classdumpctl/blob/main/LICENSE.md"
    click FileWriter "https://github.com/leptos-null/classdumpctl/tree/main/control"
    click DirCreator "https://github.com/leptos-null/classdumpctl/tree/main/control"

    %% Legend
    subgraph Legend
        direction TB
        F["Blue: User-facing components"]:::frontend
        C["Green: Core library components"]:::core
        E["Gray: External systems"]:::external
    end

    %% Styles
    classDef frontend fill:#E0F7FA,stroke:#00796B,color:#004D40;
    classDef core fill:#E8F5E9,stroke:#2E7D32,color:#1B5E20;
    classDef external fill:#ECEFF1,stroke:#546E7A,color:#37474F;
    classDef note fill:#FFF3E0,stroke:#FB8C00,color:#E65100;
    classDef doc fill:#F3E5F5,stroke:#6A1B9A,color:#4A148C;
```
