# bodo-run/yek architecture

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

- Interactive diagram: https://gitdiagram.com/bodo-run/yek
- Repository: https://github.com/bodo-run/yek

## Overview

##### Main Components

a) Core Components:
- Input Processing System
- File Processing Pipeline
- Output Generation System
- Configuration Management
- Priority Management

b) Supporting Components:
- Git Integration
- Parallel Processing Engine
- Size/Token Management

**Input Layer → Processing Layer → Output Layer**

##### Specific Component Details

a) Input Layer:
- Directory Scanner (handles multiple input directories)
- GitIgnore Parser (integrates with .gitignore rules)
- Config Loader (handles yek.yaml/toml/json)

b) Processing Layer:
- File Filter System
- Binary File Detection
- Size/Token Limiter
- Pattern Matcher (ignore/unignore)
- Priority Engine
- Git History Analyzer
- Priority Rules Processor
- Parallel Processing Manager

c) Output Layer:
- Template Engine
- Output Handler
- File Writer
- Stream Manager

##### Key Relationships to Highlight

- How the configuration system (yek.yaml) influences multiple components
- Parallel processing flow
- Demonstrate how the priority system affects the final output order
- Git integration's influence on priority scoring

##### Implementation Details

- How config.rs interfaces with the main system
- Parallel.rs's role in processing
- Demonstrate how priority.rs affects file ordering
- Defaults.rs influence on system behavior

##### Special Notes

Unique aspects:
- Git history integration for priority
- Parallel processing for performance
- Flexible configuration system
- Stream vs. file output handling

Remember to include the performance optimization aspects, as the README emphasizes the tool's speed as a key feature, being 230x faster than alternatives.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Input
        DS[Directory Scanner]
        GIP[GitIgnore Parser]
        CL[Config Loader]:::config
    end

    subgraph Processing
        subgraph "File Filter System"
            BFD[Binary File Detection]
            STL[Size/Token Limiter]
            PM[Pattern Matcher]
        end

        subgraph "Priority Engine"
            GHA[Git History Analyzer]
            PRP[Priority Rules Processor]:::priority
        end

        PPM[Parallel Processing Manager]:::parallel
    end

    subgraph Output
        TE[Template Engine]
        subgraph "Output Handler"
            FW[File Writer]
            SM[Stream Manager]
        end
    end

    subgraph "Core Components"
        CLI[CLI Entry Point]:::core
        LIB[Core Library]:::core
    end

    subgraph "Testing & CI"
        E2E[E2E Tests]:::testing
        CT[Config Tests]:::testing
        LT[Lib Tests]:::testing
        MT[Main Tests]:::testing
        CI[CI/CD Workflows]:::cicd
    end

    subgraph "Performance"
        BM[Benchmarking]:::bench
    end

    DS --> BFD
    GIP --> BFD
    CL --> PM
    BFD --> STL
    STL --> PM
    PM --> PRP
    GHA --> PRP
    PRP --> PPM
    PPM --> TE
    TE --> FW
    TE --> SM

    %% Component Mappings
    click CL "https://github.com/bodo-run/yek/blob/main/src/config.rs"
    click PRP "https://github.com/bodo-run/yek/blob/main/src/priority.rs"
    click PPM "https://github.com/bodo-run/yek/blob/main/src/parallel.rs"
    click CLI "https://github.com/bodo-run/yek/blob/main/src/main.rs"
    click LIB "https://github.com/bodo-run/yek/blob/main/src/lib.rs"
    click E2E "https://github.com/bodo-run/yek/blob/main/tests/e2e_test.rs"
    click CT "https://github.com/bodo-run/yek/blob/main/tests/config_test.rs"
    click LT "https://github.com/bodo-run/yek/blob/main/tests/lib_test.rs"
    click MT "https://github.com/bodo-run/yek/blob/main/tests/main_test.rs"
    click CI "https://github.com/bodo-run/yek/blob/main/.github/workflows/ci.yml"
    click BM "https://github.com/bodo-run/yek/blob/main/benches/serialization.rs"

    classDef default fill:#f9f,stroke:#333,stroke-width:2px
    classDef config fill:#ff9,stroke:#333,stroke-width:2px
    classDef priority fill:#f99,stroke:#333,stroke-width:2px
    classDef parallel fill:#9ff,stroke:#333,stroke-width:2px
    classDef core fill:#99f,stroke:#333,stroke-width:2px
    classDef testing fill:#9f9,stroke:#333,stroke-width:2px
    classDef cicd fill:#f96,stroke:#333,stroke-width:2px
    classDef bench fill:#69f,stroke:#333,stroke-width:2px
```
