# joselorentelopez/git_cli architecture

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

- Interactive diagram: https://gitdiagram.com/joselorentelopez/git_cli
- Repository: https://github.com/joselorentelopez/git_cli

## Overview

##### Project type and purpose
- This is a developer tool (an open-source CLI/GUI wrapper) around Git, implemented in Python.
- It provides two “front ends”:
- A terminal-based CLI (src/git_CLI.py)
- A Streamlit-based web GUI (src/front/st_front.py)
- Its purpose is to simplify core Git operations (init, branch, commit, push/pull, etc.) for users.

##### File structure
- Top-level:
- README.md – project overview, installation, usage
- src/ – all source code
- Inside src/:
- git_CLI.py – main CLI interface that parses commands, invokes Git functionality
- front/ – Streamlit front end
– st_front.py (assumed) – UI definitions, handlers that call the same underlying logic
- No service subfolders, config files, or tests are present; architecture is simple and monolithic in code but bifurcated at runtime into two UIs.

##### Key architectural insights from the README
- Core logic (repo management, branch ops, file status, commit history, remote sync) is centralized in one Python module.
- Both CLI and Streamlit UI invoke the same core logic functions.
- Under the hood it likely uses either direct system calls to Git or a Python Git library.
- Future features (merge-conflict resolution, SSH, stash) will fit into the same core logic layer.

##### Components
a. User Interfaces
– Terminal CLI (git_CLI.py)
– Streamlit GUI (st_front.py)
b. Core Logic Layer
– Command parser & dispatcher
– Git operation handlers (init, branch, commit, push/pull, etc.)
c. External Systems & Resources
– Local file system (working directory, .git folder)
– Git executable or Git Python library
– Remote Git server (GitHub, GitLab, etc.)
d. Data Flows & Interactions
– User → UI (CLI or GUI)
– UI → Core Logic (via function calls)
– Core Logic ↔ Git executable/library
– Core Logic ↔ File system (read/write .git, workspace files)
– Core Logic ↔ Remote Git server (over HTTP/SSH)

##### Architectural patterns and design principles
- Separation of Concerns:
- Presentation (CLI, GUI) is decoupled from core business logic.
- Core logic does not depend on a specific UI.
- Single Responsibility: each module handles one layer (UI vs. logic vs. external integration).
- Future extensibility: new UIs or features plug into the same core logic.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Presentation Layer
    subgraph "Presentation Layer"
        direction TB
        CLI["Terminal CLI"]:::ui
        GUI["Streamlit GUI"]:::ui
    end

    %% Core Logic Layer
    subgraph "Core Logic Layer"
        direction TB
        Core["Core Logic\n(Command Parser & Git Handlers)"]:::core
    end

    %% Infrastructure / External Systems
    subgraph "Infrastructure & External"
        direction TB
        GitExec["Git Library / Executable"]:::ext
        FS["Local File System\n(.git + Workspace)"]:::ext
        Remote["Remote Git Server\n(HTTP/SSH)"]:::ext
    end

    %% Documentation
    Docs["README.md"]:::ext

    %% Connections
    CLI -->|"invokes"| Core
    GUI -->|"invokes"| Core
    Core -->|"executes commands"| GitExec
    Core -->|"reads/writes"| FS
    Core -.->|"HTTP/SSH"| Remote

    %% Click Events
    click CLI "https://github.com/joselorentelopez/git_cli/blob/main/src/git_CLI.py"
    click GUI "https://github.com/joselorentelopez/git_cli/blob/main/src/front/st_front.py"
    click Core "https://github.com/joselorentelopez/git_cli/blob/main/src/git_CLI.py"
    click Docs "https://github.com/joselorentelopez/git_cli/blob/main/README.md"

    %% Styles
    classDef ui fill:#D0E8F2,stroke:#005b96,color:#000;
    classDef core fill:#D5F5D5,stroke:#237a00,color:#000;
    classDef ext fill:#E2E3E5,stroke:#7f8c8d,color:#000
```
