# haesleinhuepf/git-bob architecture

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

- Interactive diagram: https://gitdiagram.com/haesleinhuepf/git-bob
- Repository: https://github.com/haesleinhuepf/git-bob

## Overview

##### Main Components
- GitHub & GitLab CI Integration: Show the workflow files (in .github/workflows and .gitlab) that trigger git-bob. These workflows receive triggers (e.g., “git-bob comment”, “git-bob solve”) from issues and PR comments.
- Trigger and Issue Handling Module: Represent the module(s) that detect commands from GitHub issues/PRs (such as in tests and endpoints modules) and “orchestrate” the whole process.
- Core Business Logic (Python Package – src/git_bob): Emphasize the primary Python package that contains submodules:
- _github_utilities and _gitlab_utilities (for interacting with the respective platforms),
- _endpoints and _ai_github_utilities (for communicating with external LLM endpoints),
- _logger, _terminal, and _utilities (for internal system management and logging).
- Plugin / Extension Architecture: The system’s design allows for adding new trigger words and prompt handlers via the plugin system (configured via setup.cfg and entry points). Mark this as a separate component that interfaces with the core modules.
- Data Management & File Interactions: Show how the system accesses various file types (e.g., Jupyter notebooks, markdown, PowerPoint files inside the “data” folder) and logs interactions for reproducibility and traceability.

##### Relationships and Interactions
- A clear flow:
a. Trigger: GitHub/GitLab CI workflow (initiated by a user comment on an issue or PR) →
b. Workflow Execution: Calls the git-bob command line tool (or library) that internally calls modules in src/git_bob.
c. Processing: The core logic processes the request, using _github_utilities/_gitlab_utilities to fetch or comment on issues, and _endpoints to call the correct LLM endpoint.
d. Response: The response (e.g., a comment, a pull request modification, or creation) is sent back to the source platform.

##### Architectural Patterns and Design Principles
- Modularization: Clearly separate CI integration, core logic, external service communications, and plugin extensions.
- Plugin Architecture: Highlight the extensibility point where additional functionalities (trigger words or prompt handlers) can be added.
- Separation of Concerns: Distinguish between business logic (handling the AI interactions/conversation flow) and integration logic (platform communications using PyGithub and GitLab utilities).

##### Technologies, Frameworks, and Libraries
- Python 3.x (shown via setup.py, pyproject.toml, requirements.txt)
- GitHub Workflows & GitLab CI (via YAML files in .github/workflows and .gitlab)
- PyGithub library for GitHub interaction
- External LLM API integrations (with configurable API keys as environment variables)
- Testing frameworks (pytest integrated with the tests/ directory)
- Documentation (docs/) to assist with installation and usage tutorials

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Trigger
    U("User Command (Issue/PR comment)"):::trigger

    %% CI Integration Layer
    subgraph "GitHub CI Workflows"
        GitHub_bob("git-bob Workflow"):::ci_workflow
        GitHub_pytest("pytest Workflow"):::ci_workflow
    end

    subgraph "GitLab CI Workflows"
        GitLab("GitLab CI Workflow"):::ci_workflow
    end

    %% Processing Layer
    TH("Trigger & Issue Handler"):::trigger
    CB("Core Business Logic"):::core
    LLM("LLM API Integration"):::llm
    PL("Plugin/Extension Architecture"):::plugin
    DM("Data & File Interactions"):::data
    Resp("Response Sent to Platform"):::core

    %% Flow Connections
    U -->|"triggers"| GitHub_bob
    U -->|"triggers"| GitHub_pytest
    U -->|"triggers"| GitLab

    GitHub_bob --> TH
    GitHub_pytest --> TH
    GitLab --> TH

    TH --> CB
    CB -->|"calls"| LLM
    LLM -->|"returns"| CB
    CB --> PL
    CB --> DM
    CB --> Resp

    %% Click Events
    click GitHub_bob "https://github.com/haesleinhuepf/git-bob/blob/main/.github/workflows/git-bob.yml"
    click GitHub_pytest "https://github.com/haesleinhuepf/git-bob/blob/main/.github/workflows/pytest.yml"
    click GitLab "https://github.com/haesleinhuepf/git-bob/blob/main/.gitlab/.gitlab-ci.yml"
    click TH "https://github.com/haesleinhuepf/git-bob/blob/main/src/git_bob/_endpoints.py"
    click CB "https://github.com/haesleinhuepf/git-bob/tree/main/src/git_bob"
    click LLM "https://github.com/haesleinhuepf/git-bob/blob/main/src/git_bob/_ai_github_utilities.py"
    click PL "https://github.com/haesleinhuepf/git-bob/blob/main/setup.cfg"
    click DM "https://github.com/haesleinhuepf/git-bob/tree/main/src/git_bob/data"

    %% Styles
    classDef ci_workflow fill:#cfe2ff,stroke:#0d6efd,stroke-width:2px;
    classDef trigger fill:#fff3cd,stroke:#ffc107,stroke-width:2px;
    classDef core fill:#d1e7dd,stroke:#0f5132,stroke-width:2px;
    classDef llm fill:#e2d6f0,stroke:#6f42c1,stroke-width:2px;
    classDef plugin fill:#f8d7da,stroke:#dc3545,stroke-width:2px;
    classDef data fill:#dbe9f4,stroke:#0d6efd,stroke-width:2px;
```
