# gamermax1254/ai_code_checker architecture

> Architecture diagram of the GitHub repository gamermax1254/ai_code_checker, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/gamermax1254/ai_code_checker
- Repository: https://github.com/gamermax1254/ai_code_checker

## Overview

Ai Code Checker is a desktop Python-code vulnerability reviewer and network-port scanner, with local Ollama analysis and configurable UI. The main flow is user input through the UI to code or network scanning, then AI-generated findings and recommendations displayed as reports. Startup checks Ollama/model availability and Nmap; settings persist locally. The README documents themes, fonts, offline-after-download operation, and both scan modes. Some UI code is omitted, so network-report handoff and UI-to-AI wiring are represented only where documented; update checking is an optional integration.

Main entry points: [`ui.py`](https://github.com/gamermax1254/ai_code_checker/blob/master/ui.py) (Desktop UI), [`ai_engine.py`](https://github.com/gamermax1254/ai_code_checker/blob/master/ai_engine.py) (AI engine), [`scanners.py`](https://github.com/gamermax1254/ai_code_checker/blob/master/scanners.py) (Network scanner), [`initializer.py`](https://github.com/gamermax1254/ai_code_checker/blob/master/initializer.py) (Startup checks)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Desktop app"]
  node_ui["Desktop UI<br/>[ui.py]"]
end

subgraph group_scanning["Scanning"]
  node_code["Code scanner<br/>[scanners.py]"]
  node_network["Network scanner<br/>[scanners.py]"]
end

subgraph group_ai["Local AI"]
  node_engine["AI engine<br/>[ai_engine.py]"]
end

subgraph group_setup["Setup and settings"]
  node_init["Startup checks<br/>[initializer.py]"]
  node_settings["Settings manager"]
  node_settings_file[("Settings file<br/>[settings.json]")]
  node_config["Runtime config<br/>[config.py]"]
end

node_user(("User"))
node_nmap["Nmap"]
node_ollama["Ollama service"]
node_github["GitHub Releases"]

node_user -->|"enters scans"| node_ui
node_ui -->|"submits code"| node_code
node_code -->|"requests review"| node_engine
node_engine -->|"sends prompt"| node_ollama
node_ollama -->|"returns analysis"| node_engine
node_engine -->|"returns report"| node_code
node_ui -->|"submits target"| node_network
node_network -->|"runs port scan"| node_nmap
node_network -->|"returns port report"| node_ui
node_ui -->|"requests network advice"| node_engine
node_ui -->|"reads and updates"| node_settings
node_settings -->|"loads and saves"| node_settings_file
node_engine -->|"stores model choice"| node_settings
node_init -->|"checks and downloads model"| node_ollama
node_init -->|"checks availability"| node_nmap
node_network -->|"uses command"| node_config
node_init -->|"uses API base"| node_config
node_engine -->|"uses API base"| node_config
node_ui -.->|"checks releases"| node_github

click node_ui "https://github.com/gamermax1254/ai_code_checker/blob/master/ui.py"
click node_init "https://github.com/gamermax1254/ai_code_checker/blob/master/initializer.py"
click node_code "https://github.com/gamermax1254/ai_code_checker/blob/master/scanners.py"
click node_network "https://github.com/gamermax1254/ai_code_checker/blob/master/scanners.py"
click node_engine "https://github.com/gamermax1254/ai_code_checker/blob/master/ai_engine.py"
click node_settings "https://github.com/gamermax1254/ai_code_checker/blob/master/settings_manager.py"
click node_settings_file "https://github.com/gamermax1254/ai_code_checker/blob/master/settings.json"
click node_config "https://github.com/gamermax1254/ai_code_checker/blob/master/config.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_ui,node_user toneBlue
class node_code,node_network toneAmber
class node_engine toneMint
class node_init,node_settings,node_settings_file,node_config toneRose
class node_nmap,node_ollama,node_github toneIndigo
```

## Components

### Desktop app

- [Desktop UI](https://github.com/gamermax1254/ai_code_checker/blob/master/ui.py): `ui.py`

### Scanning

- [Code scanner](https://github.com/gamermax1254/ai_code_checker/blob/master/scanners.py): `scanners.py`
- [Network scanner](https://github.com/gamermax1254/ai_code_checker/blob/master/scanners.py): `scanners.py`

### Local AI

- [AI engine](https://github.com/gamermax1254/ai_code_checker/blob/master/ai_engine.py): `ai_engine.py`

### Setup and settings

- [Startup checks](https://github.com/gamermax1254/ai_code_checker/blob/master/initializer.py): `initializer.py`
- [Settings manager](https://github.com/gamermax1254/ai_code_checker/blob/master/settings_manager.py): `settings_manager.py`
- [Settings file](https://github.com/gamermax1254/ai_code_checker/blob/master/settings.json): `settings.json`
- [Runtime config](https://github.com/gamermax1254/ai_code_checker/blob/master/config.py): `config.py`

### Other components

- **User**
- **Nmap**
- **Ollama service**
- **GitHub Releases**

## Connections

- User → Desktop UI: enters scans
- Desktop UI → Code scanner: submits code
- Code scanner → AI engine: requests review
- AI engine → Ollama service: sends prompt
- Ollama service → AI engine: returns analysis
- AI engine → Code scanner: returns report
- Desktop UI → Network scanner: submits target
- Network scanner → Nmap: runs port scan
- Network scanner → Desktop UI: returns port report
- Desktop UI → AI engine: requests network advice
- Desktop UI → Settings manager: reads and updates
- Settings manager → Settings file: loads and saves
- AI engine → Settings manager: stores model choice
- Startup checks → Ollama service: checks and downloads model
- Startup checks → Nmap: checks availability
- Network scanner → Runtime config: uses command
- Startup checks → Runtime config: uses API base
- AI engine → Runtime config: uses API base
- Desktop UI → GitHub Releases: checks releases
