# eglavin/fork-version architecture

> Architecture diagram of the GitHub repository eglavin/fork-version, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/eglavin/fork-version
- Repository: https://github.com/eglavin/fork-version

## Overview

##### Main Components

a. Core Processing Components:
- Version Management System
- Changelog Generator
- File Management System
- Git Integration Layer
- Configuration Management

b. Input/Output Components:
- CLI Interface
- File System Interface
- Git Repository Interface

**┌─ User Interface Layer ─────────────────────┐**
- CLI Interface                              │
- ┬───────────────────────┘
- ↓
**┌─ Configuration Layer ───────────────────────┐**
- Config Manager                              │
- File Config                              │
- CLI Arguments                            │
- Default Settings                         │
- ┬───────────────────────┘
- ↓
**┌─ Core Processing Layer ──────────────────────┐**
- ┌─────────────┐  ┌──────────┐  ┌──────────┐ │
- Version   │  │Changelog │  │   File   │ │
- Processor  │←→│Generator │←→│ Manager  │ │
- ┘  └──────────┘  └──────────┘ │
- ┬───────────────────────┘
- ↓
**┌─ Integration Layer ────────────────────────┐**
- Git Operations                             │
- File System Operations                     │
- ┘

##### Component Details

a. User Interface Layer:
- CLI command processing
- Configuration file parsing
- Help and version information handling

b. Configuration Layer:
- Config merging from multiple sources
- Validation and schema checking
- Default configuration handling

c. Core Processing Layer:
- Version Management:
- Version detection
- Version bumping
- Pre-release handling
- Changelog Generation:
- Commit parsing
- Conventional commits processing
- Markdown generation
- File Management:
- File type detection
- Version updating in different file formats
- File state tracking

d. Integration Layer:
- Git operations:
- Commit creation
- Tag management
- Repository state checking
- File system operations:
- File reading/writing
- Glob pattern matching
- Path resolution

##### Data Flow Indicators

- Command flow from CLI to processing components
- File reading/writing operations
- Git operation flow
- Configuration distribution
- Version information flow
- Changelog generation process

##### Additional Elements

Include:
- Version flow indicators
- File type support indicators
- Configuration source indicators
- Error handling paths
- Optional operation paths (e.g., dry run mode)

##### Notes

Annotations for:
- Supported file types
- Configuration options
- CLI arguments
- Exit codes
- Pre-release handling
- Version determination logic

Remember to emphasize:
- The modular nature of the system
- The clear separation of concerns
- The extensibility points
- The configuration flexibility
- The error handling paths
- The optional feature paths

This will provide a clear understanding of how Fork-Version processes version management tasks while maintaining its focus on versioning and changelog generation aspects.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and classes
    classDef ui fill:#2196F3,stroke:#1565C0,color:white
    classDef config fill:#FFC107,stroke:#FFA000,color:black
    classDef core fill:#4CAF50,stroke:#388E3C,color:white
    classDef integration fill:#9C27B0,stroke:#7B1FA2,color:white
    classDef file fill:#FF5722,stroke:#E64A19,color:white
    classDef util fill:#607D8B,stroke:#455A64,color:white

    %% User Interface Layer
    CLI["CLI Interface"]:::ui
    click CLI "https://github.com/eglavin/fork-version/blob/main/src/cli.ts"

    %% Configuration Layer
    subgraph ConfigLayer["Configuration Management"]
        Config["Main Config"]:::config
        DefaultSettings["Default Settings"]:::config
        CLIArgs["CLI Arguments"]:::config
        UserConfig["User Config"]:::config
        ConfigTypes["Config Types"]:::config
        
        Config --> DefaultSettings
        Config --> CLIArgs
        Config --> UserConfig
        Config --> ConfigTypes
    end
    click Config "https://github.com/eglavin/fork-version/blob/main/src/config/load-config.ts"
    click DefaultSettings "https://github.com/eglavin/fork-version/blob/main/src/config/defaults.ts"
    click CLIArgs "https://github.com/eglavin/fork-version/blob/main/src/config/cli-arguments.js"
    click UserConfig "https://github.com/eglavin/fork-version/blob/main/src/config/user-config.ts"
    click ConfigTypes "https://github.com/eglavin/fork-version/blob/main/src/config/types.ts"

    %% Core Processing Layer
    subgraph CoreLayer["Core Processing"]
        VersionProc["Version Processor"]:::core
        ChangelogGen["Changelog Generator"]:::core
        TagMgmt["Tag Management"]:::core
        CommitProc["Commit Processing"]:::core
        
        VersionProc <--> ChangelogGen
        ChangelogGen <--> TagMgmt
        TagMgmt <--> CommitProc
    end
    click VersionProc "https://github.com/eglavin/fork-version/blob/main/src/process/version.ts"
    click ChangelogGen "https://github.com/eglavin/fork-version/blob/main/src/process/changelog.ts"
    click TagMgmt "https://github.com/eglavin/fork-version/blob/main/src/process/tag.ts"
    click CommitProc "https://github.com/eglavin/fork-version/blob/main/src/process/commit.ts"

    %% File Management Layer
    subgraph FileLayer["File Management"]
        FileMgr["File Manager"]:::file
        JSONHandler["JSON Handler"]:::file
        YAMLHandler["YAML Handler"]:::file
        TextHandler["Plain Text Handler"]:::file
        MSBuildHandler["MS Build Handler"]:::file
        
        FileMgr --> JSONHandler
        FileMgr --> YAMLHandler
        FileMgr --> TextHandler
        FileMgr --> MSBuildHandler
    end
    click FileMgr "https://github.com/eglavin/fork-version/blob/main/src/files/file-manager.ts"
    click JSONHandler "https://github.com/eglavin/fork-version/blob/main/src/files/json-package.ts"
    click YAMLHandler "https://github.com/eglavin/fork-version/blob/main/src/files/yaml-package.ts"
    click TextHandler "https://github.com/eglavin/fork-version/blob/main/src/files/plain-text.ts"
    click MSBuildHandler "https://github.com/eglavin/fork-version/blob/main/src/files/ms-build-project.ts"

    %% Integration Layer
    subgraph IntegrationLayer["Integration Layer"]
        GitOps["Git Operations"]:::integration
        FileState["File State Tracking"]:::integration
        CommitFormat["Commit Message Formatting"]:::integration
        ReleaseType["Release Type Handler"]:::integration
        
        GitOps <--> FileState
        GitOps <--> CommitFormat
        GitOps <--> ReleaseType
    end
    click GitOps "https://github.com/eglavin/fork-version/blob/main/src/utils/git.ts"
    click FileState "https://github.com/eglavin/fork-version/blob/main/src/utils/file-state.ts"
    click CommitFormat "https://github.com/eglavin/fork-version/blob/main/src/utils/format-commit-message.ts"
    click ReleaseType "https://github.com/eglavin/fork-version/blob/main/src/utils/release-type.ts"

    %% Utility Components
    Logger["Logger"]:::util
    Schema["JSON Schema"]:::util
    click Logger "https://github.com/eglavin/fork-version/blob/main/src/utils/logger.ts"
    click Schema "https://github.com/eglavin/fork-version/blob/main/schema/latest.json"

    %% Connections between layers
    CLI --> Config
    ConfigLayer --> CoreLayer
    CoreLayer --> FileLayer
    CoreLayer --> IntegrationLayer
    FileLayer --> IntegrationLayer
    Logger --> CLI
    Logger --> CoreLayer
    Logger --> IntegrationLayer
    Schema --> Config

    %% Legend
    subgraph Legend
        UI["User Interface"]:::ui
        CONF["Configuration"]:::config
        CORE["Core Processing"]:::core
        INT["Integration"]:::integration
        FILE["File Management"]:::file
        UTIL["Utilities"]:::util
    end
```
