# ayoisaiah/f2 architecture

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

- Interactive diagram: https://gitdiagram.com/ayoisaiah/f2
- Repository: https://github.com/ayoisaiah/f2

## Overview

##### Main Components

a. Core Components:
- Command Line Interface (CLI)
- File Processing Engine
- Validation System
- Renaming Engine
- Reporting System

b. Supporting Components:
- Variable Processor
- Backup Manager
- Conflict Resolution System
- File Finding System
- CSV Handler

##### Component Organization

**Top Layer: User Interface**

**Middle Layer: Core Processing**

**Bottom Layer: File System Integration**

##### Specific Component Details

a. Input Layer:
- CLI Interface (cmd/f2)
- Configuration Parser (internal/config)
- Input Validators (validate/)

b. Processing Layer:
- Find Module (find/)
- Replace Module (replace/)
- Rename Module (rename/)
- Sort Module (internal/sortfiles)

c. Output Layer:
- Report Generator (report/)
- Backup System (rename/backup.go)
- File System Operations (internal/file)

##### Key Relationships to Highlight

- Data flow from CLI input → Validation → Processing → File System Operations
- Backup system's interaction with file operations
- Demonstrate how the variable processor integrates with the replacement engine
- Conflict resolution flow in the renaming process

##### Component Interactions

**Input → Validation → Find Files → Process Variables → Rename → Report**
- ↓
- Backup System

##### Technical Details

- Go packages structure (based on the file tree)
- External dependencies (from go.mod)
- File system abstraction layer
- Error handling flow

##### Notes for Implementation

- Keep the main workflow clear and centered
- Related components visually
- Use consistent sizing for similar components
- Version information
- Notes about cross-platform compatibility

Remember to include the test architecture parallel to the main components, as the project has extensive test coverage (visible in the _test directories).

This system design should help developers understand both the high-level architecture and the detailed component interactions that make F2 a robust file renaming tool.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Input
        CLI["Command Line Interface"]
        Config["Configuration System"]
        Validate["Validation System"]
    end

    subgraph Core
        App["Core Application Logic"]
        Find["File Finding System"]
        Replace["Replace Engine"]
        Variables["Variable Processor"]
        Sort["File Sorting System"]
        Status["Status Management"]
        PathUtil["Path Utilities"]
    end

    subgraph FileOps
        FSOps["File System Operations"]
        Rename["Renaming Engine"]
        Backup["Backup Manager"]
        CSV["CSV Handler"]
    end

    subgraph Output
        Report["Reporting System"]
    end

    %% Relationships
    CLI --> Config
    Config --> Validate
    Validate --> App
    App --> Find
    Find --> CSV
    Find --> Sort
    App --> Replace
    Replace --> Variables
    Replace --> PathUtil
    App --> Rename
    Rename --> Backup
    Rename --> FSOps
    App --> Status
    Status --> Report

    %% Styling
    classDef core fill:#b3e0ff,stroke:#333,stroke-width:2px
    classDef file fill:#98fb98,stroke:#333,stroke-width:2px
    classDef validation fill:#fff59d,stroke:#333,stroke-width:2px
    classDef output fill:#ffb3b3,stroke:#333,stroke-width:2px

    class App,Find,Replace,Variables,Sort,Status,PathUtil core
    class FSOps,Rename,Backup,CSV file
    class Validate,Config validation
    class Report output

    %% Click events
    click CLI "https://github.com/ayoisaiah/f2/blob/master/cmd/f2/main.go"
    click Validate "https://github.com/ayoisaiah/f2/blob/master/validate/validate.go"
    click Rename "https://github.com/ayoisaiah/f2/blob/master/rename/rename.go"
    click Backup "https://github.com/ayoisaiah/f2/blob/master/rename/backup.go"
    click Report "https://github.com/ayoisaiah/f2/blob/master/report/report.go"
    click Find "https://github.com/ayoisaiah/f2/blob/master/find/find.go"
    click CSV "https://github.com/ayoisaiah/f2/blob/master/find/csv.go"
    click Variables "https://github.com/ayoisaiah/f2/blob/master/replace/variables/variables.go"
    click App "https://github.com/ayoisaiah/f2/blob/master/app/app.go"
    click FSOps "https://github.com/ayoisaiah/f2/blob/master/internal/file/file.go"
    click Config "https://github.com/ayoisaiah/f2/blob/master/internal/config/config.go"
    click Sort "https://github.com/ayoisaiah/f2/blob/master/internal/sortfiles/sortfiles.go"
    click Replace "https://github.com/ayoisaiah/f2/blob/master/replace/replace.go"
    click Status "https://github.com/ayoisaiah/f2/blob/master/internal/status/status.go"
    click PathUtil "https://github.com/ayoisaiah/f2/blob/master/internal/pathutil/pathutil.go"
```
