# unit-mesh/auto-dev architecture

> Architecture diagram of the GitHub repository unit-mesh/auto-dev, 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/unit-mesh/auto-dev
- Repository: https://github.com/unit-mesh/auto-dev

## Overview

This project is an IntelliJ IDEA plugin—AutoDev for Intellij—that integrates AI-powered code generation, testing, documentation, refactoring, and more right into the IDE. It is designed to support multiple programming languages (Java, Kotlin, JavaScript/TypeScript, Python, Rust, Golang, etc.) via dedicated modules and extension packages. Its purpose is to act as an “AI copilot” (or “coding wizard”) that analyzes code context, generates or refactors code, runs tests, and even produces UI sketches (such as diff views, terminals, webviews, etc.) all from within the IDE.

##### Major Components/Modules
- Plugin Core: This is the heart of the AutoDev plugin (located under the “core” directory and “src/main/kotlin/cc/unitmesh/devti”). It includes the main bundle, notifications, and overall plugin configuration. It also contains the entry points that hook into the IntelliJ platform.
- IDE Integration: Represent the integration layer that communicates with the IntelliJ Platform APIs. This consists of elements for registering actions, intentions, tool windows (e.g., for “Sketch” views), status bar widgets, and run configurations.
- Language Support Modules: There are several language-specific support components (folders for “goland”, “java”, “javascript”, “kotlin”, “pycharm”, “rust”, etc.). Each of these modules provides context builders, code completion and refactoring tools, testing services, and living documentation tailored for their respective language.

##### Relationships and Interactions
- The Plugin Core communicates with the IntelliJ Platform (UI components, actions, project contexts) and coordinates AI interactions.
- The Core delegates language-specific tasks to the integrated modules. For example, when a code action is triggered, language-specific context builders (from the Java, Kotlin, etc. modules) fetch the AST and contextual data.
- The Sketch subsystem interfaces with both the UI elements (tool windows, web views) and the core logic to generate and update dynamic visual components.
- The AI/LLM integration layer accepts prompts (which may be customized) and sends them to external AI servers, then routes the responses back to the corresponding actions (like auto code generation, documentation creation, or testing fixes).
- External extensions (under exts) plug into the overall architecture to provide additional functionalities such as version control support, Dockerfile generation, CI/CD configuration, and even specialized display panels in the IDE.

##### Architectural Patterns and Design Principles
- Modularization: The project is organized into well-defined modules (core, language-specific support, and extension plugins) reflecting high cohesion and low coupling.
- Plugin Pattern: Uses IntelliJ’s extension point framework to allow integration of custom actions, contexts, and run configurations.
- Dependency Injection: While not explicitly detailed, several components (like settings, LLM integration, and context providers) likely load dependencies dynamically, allowing for customizable and extensible features.
- Clear Separation of Concerns: Different areas (UI actions, context providers, AI prompt management, agent processing) are kept in separate packages.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Main System"
        IntelliJ["IntelliJ Platform"]:::external
        IDEIntegration["IDE Integration"]:::core
        PluginCore["Plugin Core"]:::core
        SketchSubsystem["AutoDev Sketch Subsystem"]:::sketch
        AILLM1["AI/LLM Integration (llm2)"]:::ai
        AILLM2["AI/LLM Integration (llms)"]:::ai
        Extensions["External Services & Extensions"]:::extension

        subgraph "Language Support Modules"
            Java["Java Module (Java)"]:::language
            Kotlin["Kotlin Module"]:::language
            JavaScript["JavaScript/TypeScript Module"]:::language
            Python["Python Module"]:::language
            Rust["Rust Module"]:::language
            Golang["Golang Module"]:::language
        end
    end

    IntelliJ -->|"integratesWith"| IDEIntegration
    IDEIntegration -->|"triggers"| PluginCore
    PluginCore -->|"delegatesTo"| Java
    PluginCore -->|"delegatesTo"| Kotlin
    PluginCore -->|"delegatesTo"| JavaScript
    PluginCore -->|"delegatesTo"| Python
    PluginCore -->|"delegatesTo"| Rust
    PluginCore -->|"delegatesTo"| Golang
    PluginCore <-->|"updatesSketches"| SketchSubsystem
    PluginCore -->|"sendsPromptsTo"| AILLM1
    PluginCore -->|"sendsPromptsTo"| AILLM2
    Extensions -->|"extends"| PluginCore

    click PluginCore "https://github.com/unit-mesh/auto-dev/tree/master/core/src/main/kotlin/cc/unitmesh/devti"
    click IDEIntegration "https://github.com/unit-mesh/auto-dev/blob/master/core/src/main/resources/META-INF/autodev-core.xml"
    click Java "https://github.com/unit-mesh/auto-dev/tree/master/java/src/main/kotlin/cc/unitmesh/idea"
    click Kotlin "https://github.com/unit-mesh/auto-dev/tree/master/kotlin/src/main/kotlin/cc/unitmesh/kotlin"
    click JavaScript "https://github.com/unit-mesh/auto-dev/tree/master/javascript/src/main/kotlin/cc/unitmesh/ide/javascript"
    click Python "https://github.com/unit-mesh/auto-dev/tree/master/pycharm/src/main/kotlin/cc/unitmesh/python"
    click Rust "https://github.com/unit-mesh/auto-dev/tree/master/rust/src/main/kotlin/cc/unitmesh/rust"
    click Golang "https://github.com/unit-mesh/auto-dev/tree/master/goland/src/main/kotlin/cc/unitmesh/go"
    click SketchSubsystem "https://github.com/unit-mesh/auto-dev/tree/master/core/src/main/kotlin/cc/unitmesh/devti/sketch"
    click AILLM1 "https://github.com/unit-mesh/auto-dev/tree/master/core/src/main/kotlin/cc/unitmesh/devti/llm2"
    click AILLM2 "https://github.com/unit-mesh/auto-dev/tree/master/core/src/main/kotlin/cc/unitmesh/devti/llms"
    click Extensions "https://github.com/unit-mesh/auto-dev/tree/master/exts"

    classDef core fill:#FFD700,stroke:#333,stroke-width:2px;
    classDef external fill:#ADD8E6,stroke:#333,stroke-width:2px;
    classDef language fill:#90EE90,stroke:#333,stroke-width:2px;
    classDef sketch fill:#FFA07A,stroke:#333,stroke-width:2px;
    classDef ai fill:#FFB6C1,stroke:#333,stroke-width:2px;
    classDef extension fill:#DDA0DD,stroke:#333,stroke-width:2px;
```
