# edmondfrank/gitee_cli architecture

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

- Interactive diagram: https://gitdiagram.com/edmondfrank/gitee_cli
- Repository: https://github.com/edmondfrank/gitee_cli

## Overview

##### Main Components Identification

a) Core Components:
- CLI Interface Layer (lib/gitee_cli.ex)
- API Client Layer (lib/gitee_cat/)
- Command Modules
- Authentication System
- LLM Integration

**[User Terminal] → [CLI Interface Layer]**
- ↓
**[Command Modules] ← → [Authentication System]**
- ↓
- [API Client Layer] → [Gitee API]
- ↓
- [LLM Integration]

##### Component Details

a) CLI Interface Layer:
- Main entry point (lib/gitee_cli.ex)
- To command modules:
- Enterprises
- Pulls
- Issues
- Attach Files
- Auth
- LLM

b) API Client Layer (GiteeCat):
- Separate modules for different API endpoints:
- Users
- Enterprises
- Issues
- Pulls
- Attach Files

c) Authentication System:
- Both authentication methods:
- Access Token
- Cookie-based auth

##### Important Relationships to Highlight

- Bidirectional flow between CLI and API client
- Authentication flow
- Demonstrate how commands interact with the API client
- LLM integration points

##### Specific Implementation Details

- The modular structure of commands (enterprises, pulls, issues)
- The separation between CLI logic (gitee_cli/) and API client (gitee_cat/)
- The authentication flow supporting both token and cookie-based auth
- The LLM integration capability

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef cli fill:#b3d9ff,stroke:#333
    classDef api fill:#90EE90,stroke:#333
    classDef auth fill:#FFE5B4,stroke:#333
    classDef llm fill:#DDA0DD,stroke:#333
    classDef external fill:#D3D3D3,stroke:#333
    classDef storage fill:#FFB6C1,stroke:#333

    %% User Entry Point
    User[User Terminal]:::external
    CLI[CLI Interface]:::cli
    click CLI "https://github.com/edmondfrank/gitee_cli/blob/main/lib/gitee_cli.ex"

    %% Command Modules
    subgraph Commands
        Enterprises[Enterprises Commands]:::cli
        Pulls[Pulls Commands]:::cli
        Issues[Issues Commands]:::cli
        AttachFiles[Attach Files Commands]:::cli
    end
    click Enterprises "https://github.com/edmondfrank/gitee_cli/tree/main/lib/gitee_cli/enterprises/"
    click Pulls "https://github.com/edmondfrank/gitee_cli/tree/main/lib/gitee_cli/pulls/"
    click Issues "https://github.com/edmondfrank/gitee_cli/tree/main/lib/gitee_cli/issues/"
    click AttachFiles "https://github.com/edmondfrank/gitee_cli/tree/main/lib/gitee_cli/attach_files/"

    %% Authentication
    Auth[Authentication System]:::auth
    TokenStore[(Token/Cookie Storage)]:::storage
    click Auth "https://github.com/edmondfrank/gitee_cli/blob/main/lib/gitee_cli/auth.ex"

    %% API Client Layer
    APIClient[API Client]:::api
    click APIClient "https://github.com/edmondfrank/gitee_cli/blob/main/lib/gitee_cat/client.ex"

    %% API Endpoints
    subgraph APIEndpoints
        EnterprisesAPI[Enterprises API]:::api
        IssuesAPI[Issues API]:::api
        PullsAPI[Pulls API]:::api
        UsersAPI[Users API]:::api
        AttachFilesAPI[Attach Files API]:::api
    end
    click EnterprisesAPI "https://github.com/edmondfrank/gitee_cli/blob/main/lib/gitee_cat/enterprises.ex"
    click IssuesAPI "https://github.com/edmondfrank/gitee_cli/blob/main/lib/gitee_cat/issues.ex"
    click PullsAPI "https://github.com/edmondfrank/gitee_cli/blob/main/lib/gitee_cat/pulls.ex"
    click UsersAPI "https://github.com/edmondfrank/gitee_cli/blob/main/lib/gitee_cat/users.ex"
    click AttachFilesAPI "https://github.com/edmondfrank/gitee_cli/blob/main/lib/gitee_cat/attach_files.ex"

    %% LLM Integration
    subgraph LLM
        LLMSetup[LLM Setup]:::llm
        LLMFunctions[LLM Functions]:::llm
        LLMAsk[LLM Ask Interface]:::llm
    end
    click LLMSetup "https://github.com/edmondfrank/gitee_cli/blob/main/lib/gitee_cli/llm/setup.ex"
    click LLMFunctions "https://github.com/edmondfrank/gitee_cli/blob/main/lib/gitee_cli/llm/functions.ex"
    click LLMAsk "https://github.com/edmondfrank/gitee_cli/blob/main/lib/gitee_cli/llm/ask.ex"
    click LLM "https://github.com/edmondfrank/gitee_cli/tree/main/lib/gitee_cli/llm/"

    %% External Services
    GiteeAPI[Gitee API]:::external
    LLMService[LLM Service]:::external

    %% Utilities and Config
    Utils[Utilities]:::cli
    Config[Configuration]:::cli
    click Utils "https://github.com/edmondfrank/gitee_cli/blob/main/lib/gitee_cli/utils.ex"
    click Config "https://github.com/edmondfrank/gitee_cli/blob/main/config/config.exs"

    %% Relationships
    User --> CLI
    CLI --> Commands
    Commands --> APIClient
    APIClient --> APIEndpoints
    APIEndpoints --> GiteeAPI
    Auth <--> TokenStore
    APIClient <--> Auth
    Commands <--> LLM
    LLM --> LLMService
    Commands --> Utils
    Config --> CLI

    %% Legend
    subgraph Legend
        CLI_Legend[CLI Components]:::cli
        API_Legend[API Components]:::api
        Auth_Legend[Auth Components]:::auth
        LLM_Legend[LLM Components]:::llm
        External_Legend[External Services]:::external
        Storage_Legend[Storage]:::storage
    end
```
