# socketteer/gitloom architecture

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

- Interactive diagram: https://gitdiagram.com/socketteer/gitloom
- Repository: https://github.com/socketteer/gitloom

## Overview

##### Main Components

a) Core Components:
- CLI Interface (Entry Point)
- Text Generation Controller
- Git Manager
- File System Handler
- Anthropic API Client

b) External Dependencies:
- Anthropic API (Claude Models)
- Git System
- File System

##### Component Details

CLI Interface:
- Input parsing for command-line options
- Configuration handling (settings.json)

Text Generation Controller:
- Two modes (Base/Chat)
- Model configuration options

Git Manager:
- Branch management
- Commit handling
- Repository initialization

File System Handler:
- File reading/writing
- Support for different file types (txt/jsonl)

##### Additional Details

Annotations for:
- Configuration options
- File formats (txt/jsonl)
- Git branch naming conventions
- API key handling

##### The two distinct modes of operation

Keep the abstraction level focused on the main architectural components while showing the key interactions that make GitLoom unique: the combination of AI text generation with Git version control.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Overview
    subgraph Overview
        DESC["GitLoom: CLI Tool for Versioned AI Text Generation"]
    end

    %% User Interface Layer
    subgraph UI
        CLI["CLI Interface"]:::ui
        click CLI "https://github.com/socketteer/gitloom/blob/main/gitloom/gitloom.py"
        BASE["Base Mode"]:::mode
        CHAT["Chat Mode"]:::mode
        CLI --> BASE
        CLI --> CHAT
    end

    %% Application Core Layer
    subgraph Core
        TGC["Text Generation Controller"]:::core
        click TGC "https://github.com/socketteer/gitloom/blob/main/gitloom/gitloom.py"
        GM["Git Manager"]:::core
        click GM "https://github.com/socketteer/gitloom/blob/main/gitloom/gitloom.py"
        FSH["File System Handler"]:::core
        click FSH "https://github.com/socketteer/gitloom/blob/main/gitloom/gitloom.py"
        AC["Anthropic API Client"]:::core
        click AC "https://github.com/socketteer/gitloom/blob/main/gitloom/gitloom.py"
    end

    %% External Services Layer
    subgraph External
        AAPI["Anthropic API<br/>(Claude Models)"]:::external
        GIT["Local Git System"]:::storage
        FS["File System"]:::storage
    end

    %% Testing Components
    subgraph Testing
        BT["Base Mode Tests"]:::test
        click BT "https://github.com/socketteer/gitloom/blob/main/tests/test1_base_multiple.sh"
        CT["Chat Mode Tests"]:::test
        click CT "https://github.com/socketteer/gitloom/blob/main/tests/test3_chat_new.sh"
        TR["Test Runner"]:::test
        click TR "https://github.com/socketteer/gitloom/blob/main/tests/run_all_tests.sh"
    end

    %% Connections
    BASE --> TGC
    CHAT --> TGC
    TGC --> AC
    TGC --> GM
    TGC --> FSH
    AC --> AAPI
    GM --> GIT
    FSH --> FS
    BT -.-> BASE
    CT -.-> CHAT

    %% Component Styles
    classDef ui fill:#FFD700,stroke:#333,stroke-width:2px
    classDef core fill:#4169E1,stroke:#333,stroke-width:2px,color:white
    classDef external fill:#90EE90,stroke:#333,stroke-width:2px
    classDef storage fill:#808080,stroke:#333,stroke-width:2px,color:white
    classDef mode fill:#FFA500,stroke:#333,stroke-width:2px
    classDef test fill:#BA55D3,stroke:#333,stroke-width:2px,color:white

    %% Legend
    subgraph Legend
        L1["UI Components"]:::ui
        L2["Core Components"]:::core
        L3["External Services"]:::external
        L4["Storage Systems"]:::storage
        L5["Operation Modes"]:::mode
        L6["Test Components"]:::test
    end
```
