# gokcehan/lf architecture

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

- Interactive diagram: https://gitdiagram.com/gokcehan/lf
- Repository: https://github.com/gokcehan/lf

## Overview

##### Main Components

a) Core Components:
- File Manager UI Engine (ui.go)
- Navigation System (nav.go)
- File System Operations (os.go, os_windows.go)
- Command Evaluation System (eval.go)
- Client-Server Architecture (client.go, server.go)

b) Supporting Components:
- Configuration System
- File Watching System (watch.go)
- Shell Integration (etc/ directory contents)

**┌─────────────────────────────────────────┐**
- UI Layer                   │
- (Terminal Interface - ui.go, sixel.go) │
- ┤
- Application Core              │
- ┌──────────┐        ┌──────────┐    │
- Client  │◄─────► │  Server  │    │
- ┘        └──────────┘    │
- ┤
- File Management Layer           │
- Navigation  │  Watching  │ Operations  │
- ┘

##### Key Relationships to Highlight

a) Client-Server Communication:
- Bidirectional communication between client.go and server.go
- Asynchronous I/O operations

b) File System Interaction:
- How the file operations layer interfaces with the OS
- Platform-specific implementations (df_*.go files)

##### Implementation Details to Note

- A notes section explaining the asynchronous nature of operations

##### Additional Elements

- Version control and build process flow (from .github/workflows)
- Configuration file handling flow

##### Shell integration points

Remember to include a small section showing how the configuration files and shell integration scripts connect to the main application, as these are important for user customization but shouldn't dominate the main architectural view.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph UI_Layer
        UI["UI Engine"]:::ui
        SIXEL["Sixel Support"]:::ui
    end

    subgraph Core_Layer
        CLIENT["Client"]:::core
        SERVER["Server"]:::core
        EVAL["Command Evaluator"]:::core
        OPTS["Options Manager"]:::core
        COMPLETE["Command Completion"]:::core
    end

    subgraph FileSystem_Layer
        NAV["Navigation System"]:::fs
        WATCH["File Watcher"]:::fs
        FSOPS["File Operations"]:::fs
        COPY["Copy Operations"]:::fs
    end

    subgraph Platform_Layer
        DF_WIN["Windows DF"]:::platform
        DF_BSD["OpenBSD DF"]:::platform
        DF_STATFS["StatFS"]:::platform
        DF_STATVFS["StatVFS"]:::platform
        OS_WIN["Windows OS Ops"]:::platform
    end

    subgraph Support_Layer
        COLORS["Color Manager"]:::support
        ICONS["Icon Manager"]:::support
    end

    subgraph Config_Layer
        LFRC["LF Config"]:::config
        COLOR_CFG["Color Config"]:::config
        ICON_CFG["Icon Config"]:::config
    end

    subgraph Shell_Integration
        BASH["Bash"]:::shell
        FISH["Fish"]:::shell
        ZSH["Zsh"]:::shell
        CSH["Csh"]:::shell
        PWSH["PowerShell"]:::shell
    end

    APP["Main App"]:::main
    MAIN["Entry Point"]:::main

    %% Relationships
    MAIN --> APP
    APP --> UI
    APP --> CLIENT
    APP --> SERVER

    UI --> CLIENT
    UI --> COLORS
    UI --> ICONS
    UI --> SIXEL

    CLIENT <--> SERVER
    SERVER --> EVAL
    SERVER --> FSOPS
    SERVER --> NAV
    SERVER --> WATCH

    EVAL --> COMPLETE
    EVAL --> OPTS

    FSOPS --> COPY
    FSOPS --> |Windows| OS_WIN
    FSOPS --> |Windows| DF_WIN
    FSOPS --> |OpenBSD| DF_BSD
    FSOPS --> |Unix| DF_STATFS
    FSOPS --> |Unix| DF_STATVFS

    %% Configuration relationships
    LFRC -.-> APP
    COLOR_CFG -.-> COLORS
    ICON_CFG -.-> ICONS

    %% Shell integration relationships
    BASH -.-> APP
    FISH -.-> APP
    ZSH -.-> APP
    CSH -.-> APP
    PWSH -.-> APP

    %% Styling
    classDef ui fill:#3498db
    classDef core fill:#f1c40f
    classDef fs fill:#2ecc71
    classDef platform fill:#95a5a6
    classDef support fill:#e74c3c
    classDef config fill:#9b59b6
    classDef shell fill:#1abc9c
    classDef main fill:#34495e

    %% Click events
    click UI "https://github.com/gokcehan/lf/blob/master/ui.go"
    click SIXEL "https://github.com/gokcehan/lf/blob/master/sixel.go"
    click NAV "https://github.com/gokcehan/lf/blob/master/nav.go"
    click FSOPS "https://github.com/gokcehan/lf/blob/master/os.go"
    click OS_WIN "https://github.com/gokcehan/lf/blob/master/os_windows.go"
    click EVAL "https://github.com/gokcehan/lf/blob/master/eval.go"
    click CLIENT "https://github.com/gokcehan/lf/blob/master/client.go"
    click SERVER "https://github.com/gokcehan/lf/blob/master/server.go"
    click COLORS "https://github.com/gokcehan/lf/blob/master/colors.go"
    click ICONS "https://github.com/gokcehan/lf/blob/master/icons.go"
    click WATCH "https://github.com/gokcehan/lf/blob/master/watch.go"
    click BASH "https://github.com/gokcehan/lf/blob/master/etc/lf.bash"
    click FISH "https://github.com/gokcehan/lf/blob/master/etc/lf.fish"
    click ZSH "https://github.com/gokcehan/lf/blob/master/etc/lf.zsh"
    click CSH "https://github.com/gokcehan/lf/blob/master/etc/lf.csh"
    click PWSH "https://github.com/gokcehan/lf/blob/master/etc/lf.ps1"
    click LFRC "https://github.com/gokcehan/lf/blob/master/etc/lfrc.example"
    click COLOR_CFG "https://github.com/gokcehan/lf/blob/master/etc/colors.example"
    click ICON_CFG "https://github.com/gokcehan/lf/blob/master/etc/icons.example"
    click DF_WIN "https://github.com/gokcehan/lf/blob/master/df_windows.go"
    click DF_BSD "https://github.com/gokcehan/lf/blob/master/df_openbsd.go"
    click DF_STATFS "https://github.com/gokcehan/lf/blob/master/df_statfs.go"
    click DF_STATVFS "https://github.com/gokcehan/lf/blob/master/df_statvfs.go"
    click MAIN "https://github.com/gokcehan/lf/blob/master/main.go"
    click APP "https://github.com/gokcehan/lf/blob/master/app.go"
    click COPY "https://github.com/gokcehan/lf/blob/master/copy.go"
    click COMPLETE "https://github.com/gokcehan/lf/blob/master/complete.go"
    click OPTS "https://github.com/gokcehan/lf/blob/master/opts.go"
```
