# jetbrains/qodana-cli architecture

> Architecture diagram of the GitHub repository jetbrains/qodana-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/jetbrains/qodana-cli
- Repository: https://github.com/jetbrains/qodana-cli

## Overview

##### Main Components

a) Core Components:
- CLI Interface (entry point)
- Core Engine
- Platform Services
- Cloud Integration
- Container Management (cdnet)
- SARIF Processing

b) External Dependencies:
- Docker/Podman Runtime
- Qodana Linters (Docker Images)
- Qodana Cloud
- Local IDE installations (optional)
- Version Control Systems

##### Component Relationships

**User Interface Layer:**
- CLI Commands (scan, init, show, send, view, contributors, cloc)

**Core Processing Layer:**
- Core Engine (core/)
- Platform Services (platform/)
- Cloud Integration (cloud/)
- Container Management (cdnet/)

**External Services Layer:**
- Docker Runtime
- Qodana Cloud
- CI Systems (GitLab, BitBucket, etc.)
- Local IDE

##### Key Architectural Elements

a) Command Flow:
- Command flow from CLI input through the system
- Configuration loading (qodana.yaml)
- Report generation paths
- Demonstrate cloud interaction paths

b) Data Flow:
- Project source code input
- Cache management
- Results processing
- Report generation
- Cloud data transmission

##### Implementation Details

- Blue rectangles: Core components
- Green rectangles: External services
- Yellow diamonds: Decision points
- Red octagons: Security boundaries

##### Specific Features to Highlight

- Configuration management
- Container orchestration
- Report generation and viewing
- Cloud integration
- Multi-platform support
- Caching mechanism
- Security features

##### Important Notes

- Keep the main workflow (scan -> analyze -> report) prominent
- Clear separation between local and cloud components
- Security boundaries and authentication points
- Error handling paths
- Configuration impact points

##### The security and authentication mechanisms

Remember to maintain a balance between detail and clarity, focusing on the core workflow while providing enough technical detail for implementation understanding.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph CLI
        CLI_ROOT["CLI Interface"]:::cli
        CLI_SCAN["Scan Command"]:::cli
        CLI_SHOW["Show Command"]:::cli
        CLI_SEND["Send Command"]:::cli
        CLI_VIEW["View Command"]:::cli
        CLI_CONTRIB["Contributors Command"]:::cli
        CLI_CLOC["CLOC Command"]:::cli
        
        CLI_ROOT --> CLI_SCAN
        CLI_ROOT --> CLI_SHOW
        CLI_ROOT --> CLI_SEND
        CLI_ROOT --> CLI_VIEW
        CLI_ROOT --> CLI_CONTRIB
        CLI_ROOT --> CLI_CLOC
    end

    subgraph Core
        CORE["Core Engine"]:::core
        CONTAINER["Container Management"]:::core
        RUN_SCENARIO["Run Scenario"]:::core
        OPTIONS["Core Options"]:::core
    end

    subgraph Platform
        PLATFORM["Platform Services"]:::platform
        CONFIG["Configurator"]:::platform
        GIT["Git Integration"]:::platform
        YAML["YAML Processing"]:::platform
        PUBLISHER["Report Publisher"]:::platform
        OUTPUT["Output Handler"]:::platform
    end

    subgraph Cloud
        CLOUD["Cloud Integration"]:::cloud
        ENDPOINTS["Cloud Endpoints"]:::cloud
        CLOUD_REPORT["Cloud Report"]:::cloud
        LICENSE["License Management"]:::cloud
    end

    subgraph Container
        CDNET["Container Network"]:::container
        MOUNT["Container Mount"]:::container
        CONTAINER_INIT["Container Init"]:::container
    end

    subgraph SARIF
        SARIF_PROC["SARIF Processing"]:::sarif
        SARIF_SCHEMA["SARIF Schema"]:::sarif
        SARIF_VERSION["SARIF Versioning"]:::sarif
    end

    subgraph External
        DOCKER[("Docker/Podman")]:::external
        QODANA_CLOUD[("Qodana Cloud")]:::external
        VCS[("Version Control")]:::external
        IDE[("Local IDE")]:::external
    end

    CLI_SCAN --> CORE
    CORE --> CONTAINER
    CORE --> PLATFORM
    PLATFORM --> CLOUD
    PLATFORM --> SARIF_PROC
    CONTAINER --> CDNET
    CDNET --> DOCKER
    CLOUD --> QODANA_CLOUD
    PLATFORM --> VCS
    PLATFORM --> IDE

    classDef cli fill:#1E88E5,stroke:#0D47A1,color:white
    classDef core fill:#43A047,stroke:#1B5E20,color:white
    classDef platform fill:#FFB300,stroke:#FF6F00,color:black
    classDef cloud fill:#8E24AA,stroke:#4A148C,color:white
    classDef container fill:#F4511E,stroke:#BF360C,color:white
    classDef sarif fill:#00ACC1,stroke:#006064,color:white
    classDef external fill:#757575,stroke:#424242,color:white

    click CLI_ROOT "https://github.com/JetBrains/qodana-cli/blob/main/cmd/root.go"
    click CLI_SCAN "https://github.com/JetBrains/qodana-cli/blob/main/cmd/scan.go"
    click CLI_SHOW "https://github.com/JetBrains/qodana-cli/blob/main/cmd/show.go"
    click CLI_SEND "https://github.com/JetBrains/qodana-cli/blob/main/cmd/send.go"
    click CLI_VIEW "https://github.com/JetBrains/qodana-cli/blob/main/cmd/view.go"
    click CLI_CONTRIB "https://github.com/JetBrains/qodana-cli/blob/main/cmd/contributors.go"
    click CLI_CLOC "https://github.com/JetBrains/qodana-cli/blob/main/cmd/cloc.go"
    click CORE "https://github.com/JetBrains/qodana-cli/tree/main/core/"
    click CONTAINER "https://github.com/JetBrains/qodana-cli/blob/main/core/container.go"
    click RUN_SCENARIO "https://github.com/JetBrains/qodana-cli/blob/main/core/run_scenario.go"
    click OPTIONS "https://github.com/JetBrains/qodana-cli/blob/main/core/options.go"
    click PLATFORM "https://github.com/JetBrains/qodana-cli/tree/main/platform/"
    click CONFIG "https://github.com/JetBrains/qodana-cli/blob/main/platform/configurator.go"
    click GIT "https://github.com/JetBrains/qodana-cli/blob/main/platform/git.go"
    click YAML "https://github.com/JetBrains/qodana-cli/blob/main/platform/yaml.go"
    click CLOUD "https://github.com/JetBrains/qodana-cli/tree/main/cloud/"
    click ENDPOINTS "https://github.com/JetBrains/qodana-cli/blob/main/cloud/endpoints.go"
    click CLOUD_REPORT "https://github.com/JetBrains/qodana-cli/blob/main/cloud/report.go"
    click CDNET "https://github.com/JetBrains/qodana-cli/tree/main/cdnet/"
    click MOUNT "https://github.com/JetBrains/qodana-cli/blob/main/cdnet/mount.go"
    click CONTAINER_INIT "https://github.com/JetBrains/qodana-cli/blob/main/cdnet/init.go"
    click SARIF_PROC "https://github.com/JetBrains/qodana-cli/tree/main/sarif/"
    click SARIF_SCHEMA "https://github.com/JetBrains/qodana-cli/blob/main/sarif/schema.go"
    click SARIF_VERSION "https://github.com/JetBrains/qodana-cli/blob/main/platform/sarifVersioning.go"
    click PUBLISHER "https://github.com/JetBrains/qodana-cli/blob/main/platform/publisher.go"
    click OUTPUT "https://github.com/JetBrains/qodana-cli/blob/main/platform/output.go"
    click LICENSE "https://github.com/JetBrains/qodana-cli/blob/main/cloud/license.go"
```
