# d-led/pathdebug architecture

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

- Interactive diagram: https://gitdiagram.com/d-led/pathdebug
- Repository: https://github.com/d-led/pathdebug

## Overview

##### Main Components Identification
The project is a Go-based CLI tool with these main components:

a. Command Layer (cmd/)
- Entry points and CLI command handling
- Version information

b. Core Logic Layer (common/)
- Path analysis and validation
- Environment variable processing
- File system interactions
- Script parsing and source detection

c. View Layer (view/)
- Multiple output format handlers
- Rendering capabilities

d. Render Layer (render/)
- Table rendering specifics

##### Component Relationships

**[CLI Interface] → [Command Handler]**
- ↓
**[File System] → [Path Analysis Engine] ← [Environment Variables]**
- ↓
- [Source Detection] ← → [Script Parser]
- ↓
**[Variable Expander] → [Results Processor]**
- ↓
- [View Manager] → [Output Formatters]

##### Technical Details

Annotations for:
- Go-based implementation
- Supported platforms (Linux, Darwin)
- External dependencies (minimal)
- File system interaction points

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Input
        CLI["CLI Interface"]:::cli
        ENV["Environment Variables"]:::input
        FS["File System"]:::input
    end

    subgraph Command
        CH["Command Handler"]:::cmd
        VM["Version Management"]:::cmd
    end

    subgraph Core
        PAE["Path Analysis Engine"]:::core
        EVP["Environment Variable Processing"]:::core
        FSI["File System Interactions"]:::core
        SP["Script Parser"]:::core
        VE["Variable Expander"]:::core
        SD["Source Detection"]:::core
        KP["Known Paths"]:::core
        EH["Error Handler"]:::core
        PFS["Path File Source"]:::core
        SSM["Script Source Management"]:::core
    end

    subgraph Output
        VM2["View Manager"]:::output
        subgraph Formatters
            CSV["CSV Format"]:::format
            JSON["JSON Format"]:::format
            TABLE["Table Format"]:::format
        end
        TR["Table Renderer"]:::output
    end

    %% Connections
    CLI --> CH
    CH --> VM
    CH --> PAE
    ENV --> EVP
    FS --> FSI
    FSI --> SD
    EVP --> PAE
    SD --> SP
    SP --> SSM
    PAE --> VE
    VE --> KP
    KP --> EH
    PAE --> VM2
    VM2 --> CSV
    VM2 --> JSON
    VM2 --> TABLE
    TABLE --> TR

    %% Click Events
    click CLI "https://github.com/d-led/pathdebug/blob/main/cmd/root.go"
    click VM "https://github.com/d-led/pathdebug/blob/main/cmd/version.go"
    click PAE "https://github.com/d-led/pathdebug/blob/main/common/results.go"
    click EVP "https://github.com/d-led/pathdebug/blob/main/common/env_source.go"
    click FSI "https://github.com/d-led/pathdebug/blob/main/common/os_filesystem.go"
    click SP "https://github.com/d-led/pathdebug/blob/main/common/script_parser.go"
    click VE "https://github.com/d-led/pathdebug/blob/main/common/variable_expander.go"
    click SD "https://github.com/d-led/pathdebug/blob/main/common/candidate_source.go"
    click CSV "https://github.com/d-led/pathdebug/blob/main/view/csv.go"
    click JSON "https://github.com/d-led/pathdebug/blob/main/view/json.go"
    click TABLE "https://github.com/d-led/pathdebug/blob/main/view/table.go"
    click VM2 "https://github.com/d-led/pathdebug/blob/main/view/view.go"
    click TR "https://github.com/d-led/pathdebug/blob/main/render/table.go"
    click KP "https://github.com/d-led/pathdebug/blob/main/common/known_paths.go"
    click EH "https://github.com/d-led/pathdebug/blob/main/common/errors.go"
    click SSM "https://github.com/d-led/pathdebug/blob/main/common/script_list_source.go"
    click PFS "https://github.com/d-led/pathdebug/blob/main/common/paths_f_source.go"

    %% Styles
    classDef cli fill:#2196F3,stroke:#1565C0,color:white
    classDef input fill:#90CAF9,stroke:#64B5F6,color:black
    classDef cmd fill:#4CAF50,stroke:#388E3C,color:white
    classDef core fill:#81C784,stroke:#66BB6A,color:black
    classDef output fill:#FFA726,stroke:#FB8C00,color:white
    classDef format fill:#FFB74D,stroke:#FFA726,color:black

    %% Legend
    subgraph Legend
        L1["Input Components"]:::input
        L2["Command Components"]:::cmd
        L3["Core Components"]:::core
        L4["Output Components"]:::output
        L5["Format Types"]:::format
    end
```
