# gnomegl/gitslurp architecture

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

- Interactive diagram: https://gitdiagram.com/gnomegl/gitslurp
- Repository: https://github.com/gnomegl/gitslurp

## Overview

##### Main Components

a. Core Components:
- CLI Interface (Entry Point)
- GitHub API Client Module
- Scanner Module
- Models Layer
- Utils Layer

b. External Dependencies:
- GitHub API
- TruffleHog Patterns Integration

##### Component Organization

Top Level:
**┌─ CLI Interface (main.go)**
- Internal Modules
- GitHub Client
- Scanner
- Models
- Utils

##### Detailed Component Breakdown

a. GitHub Client Module (internal/github):
- Client Configuration
- API Handlers (commits, gists, org)
- Process Management

b. Scanner Module (internal/scanner):
- As a processing layer with:
- Links Scanner
- Patterns Scanner
- Secrets Scanner

c. Models Layer (internal/models):
- As a data structure layer
- To both GitHub and Scanner modules

##### Data Flow Representation

**CLI Interface → GitHub Client → GitHub API**
**GitHub Client → Scanner Module**
**Scanner Module → Models Layer**

##### Additional Details

Annotations for:
- Authentication flow
- Rate limiting handling
- Pattern matching rules
- Secret detection patterns

##### Technical Stack Indicators

Relevant technologies:
- Go 1.21+
- GitHub API v3
- TruffleHog Patterns

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph UI
        CLI[CLI Interface]
        Art[Art Resources]
    end

    subgraph Processing
        Scanner[Scanner Module]
        GitHub[GitHub Module]
        Models[Models Layer]
        Utils[Utils Layer]
    end

    subgraph "Scanner Components"
        Links[Links Processor]
        Patterns[Pattern Detection]
        Secrets[Secrets Scanner]
    end

    subgraph "GitHub Components"
        Client[GitHub Client]
        Config[Configuration Manager]
        Commits[Commit Processor]
        Org[Organization Handler]
        Gists[Gist Handler]
        Process[GitHub Process Handler]
    end

    subgraph "External Services"
        GitHubAPI[GitHub API]
        TruffleHog[TruffleHog Patterns]
    end

    %% Relationships
    CLI --> GitHub
    CLI --> Scanner
    GitHub <--> GitHubAPI
    Scanner --> TruffleHog
    Scanner --> Models
    GitHub --> Models
    Utils --> GitHub
    Utils --> Scanner
    Art --> CLI

    %% Scanner Relationships
    Scanner --> Links
    Scanner --> Patterns
    Scanner --> Secrets

    %% GitHub Component Relationships
    GitHub --> Client
    GitHub --> Config
    GitHub --> Commits
    GitHub --> Org
    GitHub --> Gists
    GitHub --> Process

    %% Styling
    classDef default fill:#f9f9f9,stroke:#333,stroke-width:2px
    classDef external fill:#90EE90,stroke:#333
    classDef core fill:#ADD8E6,stroke:#333
    classDef security fill:#FFB6C1,stroke:#333
    classDef processing fill:#FFE4B5,stroke:#333

    class GitHubAPI,TruffleHog external
    class CLI,GitHub,Models,Utils core
    class Secrets security
    class Scanner,Links,Patterns processing

    %% Click Events
    click CLI "https://github.com/gnomegl/gitslurp/blob/master/main.go"
    click Client "https://github.com/gnomegl/gitslurp/blob/master/internal/github/client.go"
    click Config "https://github.com/gnomegl/gitslurp/blob/master/internal/github/config.go"
    click Commits "https://github.com/gnomegl/gitslurp/blob/master/internal/github/commits.go"
    click Org "https://github.com/gnomegl/gitslurp/blob/master/internal/github/org.go"
    click Gists "https://github.com/gnomegl/gitslurp/blob/master/internal/github/gists.go"
    click Process "https://github.com/gnomegl/gitslurp/blob/master/internal/github/process.go"
    click Links "https://github.com/gnomegl/gitslurp/blob/master/internal/scanner/links.go"
    click Patterns "https://github.com/gnomegl/gitslurp/blob/master/internal/scanner/patterns.go"
    click Secrets "https://github.com/gnomegl/gitslurp/blob/master/internal/scanner/secrets.go"
    click Models "https://github.com/gnomegl/gitslurp/blob/master/internal/models/types.go"
    click Utils "https://github.com/gnomegl/gitslurp/blob/master/internal/utils/version.go"
    click Art "https://github.com/gnomegl/gitslurp/blob/master/internal/art/logo.go"
```
