# phodal/shire architecture

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

- Interactive diagram: https://gitdiagram.com/phodal/shire
- Repository: https://github.com/phodal/shire

## Overview

##### Main Components Identification

The system should be divided into these major components:

a. Core Components:
- Language Engine (shirelang/)
- Core Services (core/)
- Language Support Modules (languages/)
- Toolsets (toolsets/)

b. Integration Layers:
- IDE Integration Layer
- LLM Integration Layer
- External Tools Integration

##### Key Architectural Elements

a. Plugin Architecture:
- Core Plugin Infrastructure
- Extension Points
- Service Providers

b. Language Processing Pipeline:
- Lexer/Parser
- Compiler
- Execution Engine

##### Detailed Component Breakdown

**[IDE Integration Layer]**
- ↑↓
**[Shire Core]**
- Language Engine
- Lexer/Parser
- Compiler
- Executor
- Core Services
- Provider System
- Variable System
- Action System
- Integration Services
- LLM Connector
- Tool Integration

**[Language Support]     [Toolsets]**
- ↑                    ↑
- [Core]─────┘

##### Data Flow Representation

Main data flows:
- User Input → Language Processing → LLM Interaction → IDE Actions
- Code Analysis → Context Building → LLM Prompt → Response Handling
- Tool Integration → Action Execution → Result Processing

##### Key Integration Points

Crucial integration areas:
- LLM API Integration
- IDE Extension Points
- External Tool Connectors
- Language Support Modules

##### Component Details

- Language Engine:
- Syntax Processing
- Compilation
- Execution Control

- Core Services:
- Context Management
- Variable Handling
- Action Coordination

- Integration Layer:
- IDE Communication
- Tool Orchestration
- Response Processing

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef core fill:#2196F3,stroke:#1565C0,color:white
    classDef lang fill:#4CAF50,stroke:#388E3C,color:white
    classDef integration fill:#FF9800,stroke:#F57C00,color:white
    classDef external fill:#9E9E9E,stroke:#616161,color:white
    classDef pipeline fill:#673AB7,stroke:#512DA8,color:white

    %% IDE Integration Layer
    subgraph IDE
        IDEIntegration["IDE Integration"]:::integration
        ActionSystem["Action System"]:::integration
    end
    click IDEIntegration "https://github.com/phodal/shire/tree/main/shirelang/src/main/kotlin/com/phodal/shirelang/actions/"
    click ActionSystem "https://github.com/phodal/shire/tree/main/core/src/main/kotlin/com/phodal/shirecore/provider/action/"

    %% Core Layer
    subgraph Core
        ShireCore["Shire Core"]:::core
        ProviderSystem["Provider System"]:::core
        VarSystem["Variable System"]:::core
        IntegrationServices["Integration Services"]:::core
    end
    click ShireCore "https://github.com/phodal/shire/tree/main/core/src/main/kotlin/com/phodal/shirecore/"
    click ProviderSystem "https://github.com/phodal/shire/tree/main/core/src/main/kotlin/com/phodal/shirecore/provider/"
    click VarSystem "https://github.com/phodal/shire/tree/main/core/src/main/kotlin/com/phodal/shirecore/variable/"
    click IntegrationServices "https://github.com/phodal/shire/tree/main/core/src/main/kotlin/com/phodal/shirecore/integration/"

    %% Language Engine
    subgraph LangEngine
        LexerParser["Lexer/Parser"]:::pipeline
        Compiler["Compiler"]:::pipeline
        Executor["Executor"]:::pipeline
    end
    click LexerParser "https://github.com/phodal/shire/tree/main/shirelang/src/main/kotlin/com/phodal/shirelang/lexer/"
    click Compiler "https://github.com/phodal/shire/tree/main/shirelang/src/main/kotlin/com/phodal/shirelang/compiler/"
    click Executor "https://github.com/phodal/shire/tree/main/shirelang/src/main/kotlin/com/phodal/shirelang/compiler/execute/"

    %% Language Support
    subgraph LangSupport
        Java["Java Support"]:::lang
        Kotlin["Kotlin Support"]:::lang
        Python["Python Support"]:::lang
        JavaScript["JavaScript Support"]:::lang
    end
    click Java "https://github.com/phodal/shire/tree/main/languages/shire-java/"
    click Kotlin "https://github.com/phodal/shire/tree/main/languages/shire-kotlin/"
    click Python "https://github.com/phodal/shire/tree/main/languages/shire-python/"
    click JavaScript "https://github.com/phodal/shire/tree/main/languages/shire-javascript/"

    %% External Integration
    subgraph External
        LLMConnector["LLM Connector"]:::external
        ToolIntegration["Tool Integration"]:::external
    end
    click LLMConnector "https://github.com/phodal/shire/tree/main/core/src/main/kotlin/com/phodal/shirecore/llm/"
    click ToolIntegration "https://github.com/phodal/shire/tree/main/toolsets/"

    %% Tool Integration
    subgraph Tools
        Database["Database"]:::external
        Git["Git"]:::external
        HttpClient["HTTP Client"]:::external
        SonarQube["SonarQube"]:::external
    end
    click Database "https://github.com/phodal/shire/tree/main/toolsets/database/"
    click Git "https://github.com/phodal/shire/tree/main/toolsets/git/"
    click HttpClient "https://github.com/phodal/shire/tree/main/toolsets/httpclient/"
    click SonarQube "https://github.com/phodal/shire/tree/main/toolsets/sonarqube/"

    %% Relationships
    IDEIntegration <--> ShireCore
    ShireCore <--> LexerParser
    LexerParser --> Compiler
    Compiler --> Executor
    ShireCore <--> ProviderSystem
    ShireCore <--> VarSystem
    ShireCore <--> IntegrationServices
    IntegrationServices <--> LLMConnector
    IntegrationServices <--> ToolIntegration
    ToolIntegration --> Database
    ToolIntegration --> Git
    ToolIntegration --> HttpClient
    ToolIntegration --> SonarQube
    ShireCore --> Java
    ShireCore --> Kotlin
    ShireCore --> Python
    ShireCore --> JavaScript
    ActionSystem <--> ShireCore

    %% Legend
    subgraph Legend
        L1["Core Components"]:::core
        L2["Language Processing"]:::pipeline
        L3["Integration Points"]:::integration
        L4["External Services"]:::external
        L5["Language Support"]:::lang
    end
```
