# thewizardshell/froggit architecture

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

- Interactive diagram: https://gitdiagram.com/thewizardshell/froggit
- Repository: https://github.com/thewizardshell/froggit

## Overview

##### Project type and purpose
- Froggit is a standalone terminal-based Git client written in Go.
- It provides a text-based user interface (TUI) for common Git operations, optional GitHub CLI integration, and customizable behavior via a YAML config file.
- Key use cases: staging, committing, branching, merging, stashing, rebasing, remote management, and GitHub repository creation/cloning.

##### File structure
- Top-level files:
- main.go – application entry point
- go.mod/go.sum – dependency management
- scripts/ – installer scripts for different platforms
- internal/ – core application packages:
- config/ – load and validate `froggit.yml` (configuration subsystem)
- gh/ – adapter for GitHub CLI (`gh`) operations
- git/ – wrapper around Git CLI commands, provides programmatic Git operations
- tui/ – text-based UI layer, subdivided into:
· app.go – application lifecycle & event loop (controller)
· model/ – in-memory representation of UI state (model)
· views/ – individual screen components (view)
· update/ – logic for asynchronous operations and update handlers
- utils/ – general helper functions
- docs/ – architecture, development guides, shortcuts
- .github/ – CI workflows, issue templates

##### README for additional insights
- Confirms Go 1.20+ requirement, dependency on Git and optional GitHub CLI.
- Points to docs/architecture.md for high-level overview.
- Describes major features, configuration options, and key shortcuts.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Entry
    User["User"]:::external

    %% CLI Layer
    subgraph "CLI Layer"
        main["main.go"]:::cli
        scripts_sh["install.sh"]:::cli
        scripts_ps["install.ps1"]:::cli
    end

    %% Core Logic
    subgraph "Core Logic"
        config["Configuration Loader"]:::core
        gitAdapter["Git Adapter"]:::core
        ghAdapter["GitHub Adapter"]:::core
        utils["Utilities"]:::core
    end

    %% TUI Layer
    subgraph "TUI Layer"
        controller["TUI Controller & Event Loop"]:::ui
        model["TUI Model"]:::ui
        views["TUI Views & Controls"]:::ui
        update["Update Subsystem"]:::ui
    end

    %% External Dependencies
    subgraph "External Dependencies"
        gitcli["Local Git"]:::external
        ghcli["GitHub CLI"]:::external
        term["Terminal Emulator"]:::external
    end

    %% Connections
    User -->|invokes| main
    main -->|load config| config
    main -->|start TUI| controller

    config -->|pass settings| controller

    controller -->|initialize| model
    controller -->|load views| views

    controller -->|exec git commands| gitAdapter
    gitAdapter -->|spawn processes| gitcli
    gitcli -->|return results| gitAdapter
    gitAdapter -->|results| controller

    controller -->|exec gh commands| ghAdapter
    ghAdapter -->|spawn processes| ghcli
    ghcli -->|return results| ghAdapter
    ghAdapter -->|results| controller

    controller -->|render| views
    views -->|output| term

    controller -->|dispatch async tasks| update
    update -->|event callbacks| controller

    utils -->|helpers| config
    utils -->|helpers| gitAdapter
    utils -->|helpers| controller
    utils -->|helpers| update

    %% Click Events
    click main "https://github.com/thewizardshell/froggit/blob/master/main.go"
    click scripts_sh "https://github.com/thewizardshell/froggit/blob/master/scripts/install.sh"
    click scripts_ps "https://github.com/thewizardshell/froggit/blob/master/scripts/install.ps1"
    click config "https://github.com/thewizardshell/froggit/blob/master/internal/config/config.go"
    click gitAdapter "https://github.com/thewizardshell/froggit/blob/master/internal/git/git.go"
    click ghAdapter "https://github.com/thewizardshell/froggit/blob/master/internal/gh/client.go"
    click controller "https://github.com/thewizardshell/froggit/blob/master/internal/tui/app.go"
    click model "https://github.com/thewizardshell/froggit/blob/master/internal/tui/model/model.go"
    click views "https://github.com/thewizardshell/froggit/tree/master/internal/tui/views/"
    click update "https://github.com/thewizardshell/froggit/blob/master/internal/tui/update/update.go"
    click utils "https://github.com/thewizardshell/froggit/blob/master/internal/utils/PrintableChar.go"

    %% Styles
    classDef cli fill:#b2f5ea,stroke:#333,stroke-width:1px
    classDef core fill:#9ae6b4,stroke:#333,stroke-width:1px
    classDef ui fill:#bee3f8,stroke:#333,stroke-width:1px
    classDef external fill:#fbd38d,stroke:#333,stroke-width:1px
```
