# congson95dev/git-handler architecture

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

- Interactive diagram: https://gitdiagram.com/congson95dev/git-handler
- Repository: https://github.com/congson95dev/git-handler

## Overview

##### Main Components
- Script Components: Clearly mark the individual scripts—create_tag.sh, delete_tag.sh, and create_pr.sh—as the core functional units. Each script provides a specific operation across multiple repositories.
- Configuration & Permissions: Include a component that represents configuration steps (e.g., permission granting with chmod, environment configuration).
- Multiple Repositories Environment: Since the use-case involves operating on multiple repositories (organized under a “prefix-folder”), incorporate these as a collective external component that the scripts act upon.

##### Relationships and Interactions
- Verify configuration and permissions.
- Interact with the external git-handler configuration.
- Call GitHub CLI (gh) when creating pull requests.
- Perform tag operations on multiple repositories.
- External Communication: Indicate that create_pr.sh relies on an external process (gh CLI installation) which subsequently triggers interactions with GitHub for authentication and pull request management.

##### Architectural Patterns and Design Principles
- Script-based Utility Tool: Emphasize that this solution is implemented as lightweight scripting, meaning it is essentially a “glue” tool coordinating operations over other repositories.
- Modularity: Even though the code base is small, treat each script as an independent module offering a single responsibility aligned with standard modular design.
- Procedural Flow: Illustrate a linear process design which starts from user command execution and flows into operations on multiple independent repositories.

##### Included Technologies, Frameworks, and Libraries
- Shell Scripting environment (bash or sh)
- Git for version control
- GitHub CLI (gh) as an external tool for pull request creation and GitHub interaction
- Standard Linux tools for permissions and package installation (e.g., wget)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Nodes
    User["User / Local Machine"]:::user
    createTag["create_tag.sh"]:::script
    deleteTag["delete_tag.sh"]:::script
    createPR["create_pr.sh"]:::script
    Config["Configuration & Permissions"]:::config
    GH["GitHub CLI (gh)"]:::external
    Repos["Target Repositories"]:::repo

    %% Subgraphs for visual grouping of scripts
    subgraph "Utility Scripts"
        createTag
        deleteTag
        createPR
    end

    %% Connections from User to scripts
    User -->|"executes"| createTag
    User -->|"executes"| deleteTag
    User -->|"executes"| createPR

    %% Connections from scripts to configuration
    createTag -->|"requiresConfig"| Config
    deleteTag -->|"requiresConfig"| Config
    createPR -->|"requiresConfig"| Config

    %% Script operations on repositories
    createTag -->|"updates"| Repos
    deleteTag -->|"updates"| Repos

    %% create_pr.sh external dependency flow
    createPR -->|"calls"| GH
    GH -->|"contacts"| Repos

    %% Click Events based on Component Mapping
    click createTag "https://github.com/congson95dev/git-handler/blob/master//create_tag.sh"
    click deleteTag "https://github.com/congson95dev/git-handler/blob/master//delete_tag.sh"
    click createPR "https://github.com/congson95dev/git-handler/blob/master//create_pr.sh"
    click Config "https://github.com/congson95dev/git-handler/blob/master//README.md"

    %% Styles
    classDef user fill:#cce5ff,stroke:#004085,stroke-width:2px;
    classDef script fill:#d4edda,stroke:#155724,stroke-width:2px;
    classDef config fill:#fff3cd,stroke:#856404,stroke-width:2px;
    classDef external fill:#f8d7da,stroke:#721c24,stroke-width:2px;
    classDef repo fill:#e2e3e5,stroke:#41464b,stroke-width:2px;
```
