# unit-mesh/auto-dev-vscode architecture

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

- Interactive diagram: https://gitdiagram.com/unit-mesh/auto-dev-vscode
- Repository: https://github.com/unit-mesh/auto-dev-vscode

## Overview

##### Main Components Architecture

The system should be divided into these major components:

a) Core Extension Layer
- AutoDevExtension (Entry point)
- Service Container
- Configuration Management
- Command System

b) Feature Modules
- Code Intelligence
- Chat System
- Code Search
- Action System
- Context Providers
- Prompt Management

c) Integration Layer
- VSCode API Integration
- LLM Providers
- External Tools Integration

##### Detailed Component Breakdown

a) Code Intelligence System
- Tree-sitter Integration
- AST Analysis
- Code Structure Analysis
- Language-specific Providers

b) Search & Indexing System
- Embedding System
- Vector Search
- Chunk Management
- Multiple RAG Strategies

c) Action System
- Code Actions
- Quick Fixes
- Code Lens
- Refactoring Actions

##### Data Flow Representation

**User Input -> Command System -> Feature Module -> LLM Provider -> Result Processing -> UI Update**

##### Integration Points

Connections for:
- VSCode Extension API
- Language Servers
- LLM Providers (OpenAI, Anthropic, etc.)
- Local Tools (git, tree-sitter)

##### Specific Implementation Details

Create sections for:
- Provider Container Management
- Template System
- Configuration Management
- Context Management

##### Key Architectural Patterns

Highlight:
- Provider Pattern for extensibility
- Command Pattern for actions
- Observer Pattern for events
- Strategy Pattern for different implementations

##### Cross-cutting Concerns

Shared services:
- Logging System
- Error Handling
- Configuration Management
- Resource Management

##### The separation of concerns between different components

Remember to:

- Keep components grouped logically
- Clear interaction patterns
- Maintain a balance between detail and clarity
- Version/configuration management
- Security boundaries

This architecture should reflect the plugin's capability to handle multiple languages, support various AI providers, and maintain extensibility while keeping the core system maintainable and performant.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Core Extension Layer
    subgraph Core
        ADE["AutoDevExtension"]
        SC["Service Container"]
        CM["Configuration Management"]
        CS["Command System"]
    end

    %% Feature Modules
    subgraph Features
        direction TB
        subgraph CodeIntel["Code Intelligence"]
            direction TB
            TSI["Tree-sitter Integration"]
            AST["AST Analysis"]
            CSA["Code Structure Analysis"]
            LSP["Language-specific Providers"]
        end

        subgraph ChatSys["Chat System"]
            direction TB
            CI["Chat Interface"]
            CM2["Chat Management"]
        end

        subgraph Search["Search & Indexing"]
            direction TB
            ES["Embedding System"]
            VS["Vector Search"]
            ChM["Chunk Management"]
            RAG["RAG Strategies"]
        end

        subgraph Action["Action System"]
            direction TB
            CA["Code Actions"]
            QF["Quick Fixes"]
            CL["Code Lens"]
            RA["Refactoring Actions"]
        end

        CP["Context Providers"]
        PM["Prompt Management"]
    end

    %% Integration Layer
    subgraph Integration
        VAPI["VSCode API"]
        LLMP["LLM Providers"]
        ETI["External Tools"]
    end

    %% Cross-cutting Concerns
    subgraph CrossCutting
        direction TB
        LS["Logging System"]
        EH["Error Handling"]
        RM["Resource Management"]
    end

    %% Connections
    ADE --> SC
    ADE --> CM
    ADE --> CS
    CS --> Features
    Features --> LLMP
    VAPI --> ADE
    CrossCutting --> Core
    CrossCutting --> Features
    Integration --> Core

    %% Styling
    classDef core fill:#a8d1f0
    classDef feature fill:#90EE90
    classDef integration fill:#FFE5B4
    classDef crosscutting fill:#FFB6C1

    class ADE,SC,CM,CS core
    class CodeIntel,ChatSys,Search,Action,CP,PM feature
    class VAPI,LLMP,ETI integration
    class LS,EH,RM crosscutting

    %% Click Events
    click ADE "https://github.com/unit-mesh/auto-dev-vscode/blob/master/src/AutoDevExtension.ts"
    click SC "https://github.com/unit-mesh/auto-dev-vscode/blob/master/src/base/common/instantiation/instantiationService.ts"
    click CM "https://github.com/unit-mesh/auto-dev-vscode/blob/master/src/base/common/configuration/configurationService.ts"
    click CS "https://github.com/unit-mesh/auto-dev-vscode/blob/master/src/commands/commandsService.ts"
    click CodeIntel "https://github.com/unit-mesh/auto-dev-vscode/tree/master/src/code-context/"
    click ChatSys "https://github.com/unit-mesh/auto-dev-vscode/tree/master/src/editor/views/chat/"
    click Search "https://github.com/unit-mesh/auto-dev-vscode/tree/master/src/code-search/"
    click Action "https://github.com/unit-mesh/auto-dev-vscode/tree/master/src/action/"
    click CP "https://github.com/unit-mesh/auto-dev-vscode/tree/master/src/context-provider/"
    click PM "https://github.com/unit-mesh/auto-dev-vscode/tree/master/src/prompt-manage/"
    click VAPI "https://github.com/unit-mesh/auto-dev-vscode/blob/master/src/base/common/vscode.ts"
    click LLMP "https://github.com/unit-mesh/auto-dev-vscode/tree/master/src/base/common/language-models/providers/"
    click ETI "https://github.com/unit-mesh/auto-dev-vscode/tree/master/src/toolchain-context/"
    click CA "https://github.com/unit-mesh/auto-dev-vscode/blob/master/src/action/_base/CodeActionCreator.ts"
    click QF "https://github.com/unit-mesh/auto-dev-vscode/blob/master/src/action/providers/AutoDevQuickFixProvider.ts"
    click CL "https://github.com/unit-mesh/auto-dev-vscode/blob/master/src/action/providers/AutoDevCodeLensProvider.ts"
    click RA "https://github.com/unit-mesh/auto-dev-vscode/tree/master/src/action/refactor/"
    click ES "https://github.com/unit-mesh/auto-dev-vscode/tree/master/src/code-search/embedding/"
    click VS "https://github.com/unit-mesh/auto-dev-vscode/tree/master/src/code-search/search/"
    click ChM "https://github.com/unit-mesh/auto-dev-vscode/tree/master/src/code-search/chunk/"
    click LS "https://github.com/unit-mesh/auto-dev-vscode/tree/master/src/base/common/log/"
    click EH "https://github.com/unit-mesh/auto-dev-vscode/tree/master/src/base/common/messages/"
    click RM "https://github.com/unit-mesh/auto-dev-vscode/blob/master/src/base/common/lifecycle.ts"
```
