# ejaaskel/yocto-cve-parser architecture

> Architecture diagram of the GitHub repository ejaaskel/yocto-cve-parser, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ejaaskel/yocto-cve-parser
- Repository: https://github.com/ejaaskel/yocto-cve-parser

## Overview

##### Project type and purpose
- This is a standalone, open-source, command-line tool written in Python.
- Purpose: parse Yocto’s CVE checker JSON output, apply filters/sorting, and display a human-readable report.

##### File structure
- Top level:
- README.md – project description, usage guide
- cve-parser.py – all code resides in a single script
- No subdirectories, no external services, no databases – this is a simple CLI utility.

##### README for additional insights
- The script reads a JSON file generated by Yocto (via `cve-check`), then:
- Parses the JSON
- Applies filters (by CVSS score, status, etc.)
- Sorts and formats the results
- Prints output to stdout
- All configuration is passed via CLI flags (-f, ‑ms, ‑Ms, ‑vs, etc.).

a. User / CLI Interface
b. Input JSON File (Yocto CVE summary)
c. Parser Module (JSON loader → internal data structures)
d. Filter Module (applies score/status filters)
e. Sort Module (orders results per user flags)
f. Formatter / Output Module (formats to table/text and writes to console)
g. External dependency: Python runtime (3.x)

##### Relationships and interactions
- User invokes `python3 cve-parser.py` with flags → CLI Interface
- CLI Interface reads the JSON file path → passes to Parser
- Parser emits a list of CVE objects → fed into Filter
- Filter applies user-specified criteria → filtered list → goes to Sort
- Sort orders the list → passes to Formatter
- Formatter sends formatted text to stdout

##### Architectural patterns and design principles
- Single-entry script → procedural / modular design
- Separation of concerns: parsing, filtering, sorting, formatting all distinct
- Extensibility: new filters or output formats can be added as separate functions or classes

##### Detail without overcomplication
- Flags or configuration points as annotations near the CLI or Filter module
- Python version or libraries (e.g., built-in `json` module) as small text under relevant modules
- Where future extensions (new filters or output formats) would plug in

## Diagram (Mermaid)

```mermaid
flowchart TD
    User["User"]:::external
    CLI["CLI Interface"]:::userFacing
    Parser["Parser Module"]:::processing
    Filter["Filter Module"]:::processing
    Sorter["Sort Module"]:::processing
    Formatter["Formatter / Output Module"]:::userFacing
    JSON["Input JSON File"]:::external
    Python["Python Runtime (3.x)"]:::external
    Console["Console / stdout"]:::external
    README["Project Description & Usage Guide"]:::external

    User -->|"invokes script with flags"| CLI
    Python -->|"executes script"| CLI
    CLI -->|"passes file path & flags"| Parser
    JSON -.->|"raw JSON"| Parser
    Parser -->|"CVE list"| Filter
    Filter -->|"filtered list"| Sorter
    Sorter -->|"sorted list"| Formatter
    Formatter -->|"formatted text"| Console

    click CLI "https://github.com/ejaaskel/yocto-cve-parser/blob/main/cve-parser.py"
    click Parser "https://github.com/ejaaskel/yocto-cve-parser/blob/main/cve-parser.py"
    click Filter "https://github.com/ejaaskel/yocto-cve-parser/blob/main/cve-parser.py"
    click Sorter "https://github.com/ejaaskel/yocto-cve-parser/blob/main/cve-parser.py"
    click Formatter "https://github.com/ejaaskel/yocto-cve-parser/blob/main/cve-parser.py"
    click README "https://github.com/ejaaskel/yocto-cve-parser/blob/main/README.md"

    classDef userFacing fill:#4DA6FF,stroke:#333,stroke-width:1px,color:#fff;
    classDef processing fill:#A2FCA8,stroke:#333,stroke-width:1px;
    classDef external fill:#CCCCCC,stroke:#333,stroke-width:1px;
```
