# seif2222/depscan architecture

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

- Interactive diagram: https://gitdiagram.com/seif2222/depscan
- Repository: https://github.com/seif2222/depscan

## Overview

depscan is a dependency vulnerability scanner with npm and Python project parsers, OSV advisory matching, severity assessment, and structured report validation/statistics. The intended user flow is to invoke the CLI on a project and obtain scan results, but the available excerpts do not show the CLI-to-core call or a report-writing stage, so those links are not asserted. The graph retains the core package’s major modules; relationships are limited to visible imports, calls, exports, or explicitly marked unverified integrations.

Main entry points: [`core/src/index.ts`](https://github.com/seif2222/depscan/blob/main/core/src/index.ts) (Core exports), [`core/src/match.ts`](https://github.com/seif2222/depscan/blob/main/core/src/match.ts) (Vulnerability matching), [`core/src/validate-report.ts`](https://github.com/seif2222/depscan/blob/main/core/src/validate-report.ts) (Report validation), [`core/src/python-parse.ts`](https://github.com/seif2222/depscan/blob/main/core/src/python-parse.ts) (Python parser)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["CLI entry"]
  node_cli["CLI command<br/>[bin.ts]"]
  node_cli_api["CLI API<br/>[index.ts]"]
end

subgraph group_inputs["Project inputs"]
  node_npm["npm parser<br/>[npm-parse.ts]"]
  node_python["Python parser<br/>[python-parse.ts]"]
  node_package_keys["Package keys<br/>[package-key.ts]"]
  node_dependency_tree["Dependency tree<br/>[build-tree.ts]"]
  node_parse_errors["Parse errors<br/>[errors.ts]"]
end

subgraph group_scan["Advisory scanning"]
  node_core_api["Core exports<br/>[index.ts]"]
  node_matcher["Vulnerability matching<br/>[match.ts]"]
  node_osv_http["OSV HTTP client<br/>[osv-http.ts]"]
  node_osv_cache[("OSV cache<br/>[osv-cache.ts]")]
  node_osv_types["OSV data types<br/>[osv-types.ts]"]
end

subgraph group_report["Report and analysis"]
  node_cvss["CVSS scoring<br/>[cvss.ts]"]
  node_severity_map["Severity mapping<br/>[severity-map.ts]"]
  node_severity["Severity utilities<br/>[severity.ts]"]
  node_stats["Report statistics<br/>[stats.ts]"]
  node_json_schema["JSON schema validation<br/>[json-schema.ts]"]
  node_report_schema["Report schema<br/>[report-schema.ts]"]
  node_report_validation["Report validation<br/>[validate-report.ts]"]
  node_analyze["Analysis entry<br/>[analyze.ts]"]
end

node_user(("Engineer"))
node_osv_service["OSV API"]

node_user -->|"invokes"| node_cli
node_cli -->|"dispatches to"| node_cli_api
node_cli_api -.->|"uses"| node_core_api
node_core_api -->|"exports"| node_npm
node_core_api -->|"exports"| node_python
node_core_api -->|"exports"| node_dependency_tree
node_core_api -->|"exports"| node_matcher
node_core_api -->|"exports"| node_osv_http
node_core_api -->|"exports"| node_osv_cache
node_core_api -->|"exports"| node_severity_map
node_core_api -->|"exports"| node_report_validation
node_core_api -->|"exports"| node_stats
node_npm -->|"uses"| node_package_keys
node_npm -->|"raises"| node_parse_errors
node_python -->|"uses"| node_package_keys
node_python -->|"raises"| node_parse_errors
node_dependency_tree -->|"uses"| node_package_keys
node_matcher -->|"compares versions"| node_package_keys
node_matcher -->|"assesses severity"| node_severity_map
node_matcher -->|"normalizes names"| node_python
node_matcher -.->|"queries"| node_osv_http
node_matcher -.->|"reads and writes"| node_osv_cache
node_osv_http -->|"sends queries"| node_osv_service
node_severity_map -->|"scores vectors"| node_cvss
node_report_validation -->|"validates against"| node_json_schema
node_report_validation -->|"uses"| node_report_schema
node_report_validation -->|"checks totals"| node_stats

click node_cli "https://github.com/seif2222/depscan/blob/main/cli/src/bin.ts"
click node_cli_api "https://github.com/seif2222/depscan/blob/main/cli/src/index.ts"
click node_core_api "https://github.com/seif2222/depscan/blob/main/core/src/index.ts"
click node_npm "https://github.com/seif2222/depscan/blob/main/core/src/npm-parse.ts"
click node_python "https://github.com/seif2222/depscan/blob/main/core/src/python-parse.ts"
click node_package_keys "https://github.com/seif2222/depscan/blob/main/core/src/package-key.ts"
click node_dependency_tree "https://github.com/seif2222/depscan/blob/main/core/src/build-tree.ts"
click node_parse_errors "https://github.com/seif2222/depscan/blob/main/core/src/errors.ts"
click node_matcher "https://github.com/seif2222/depscan/blob/main/core/src/match.ts"
click node_osv_http "https://github.com/seif2222/depscan/blob/main/core/src/osv-http.ts"
click node_osv_cache "https://github.com/seif2222/depscan/blob/main/core/src/osv-cache.ts"
click node_osv_types "https://github.com/seif2222/depscan/blob/main/core/src/osv-types.ts"
click node_cvss "https://github.com/seif2222/depscan/blob/main/core/src/cvss.ts"
click node_severity_map "https://github.com/seif2222/depscan/blob/main/core/src/severity-map.ts"
click node_severity "https://github.com/seif2222/depscan/blob/main/core/src/severity.ts"
click node_stats "https://github.com/seif2222/depscan/blob/main/core/src/stats.ts"
click node_json_schema "https://github.com/seif2222/depscan/blob/main/core/src/json-schema.ts"
click node_report_schema "https://github.com/seif2222/depscan/blob/main/core/src/report-schema.ts"
click node_report_validation "https://github.com/seif2222/depscan/blob/main/core/src/validate-report.ts"
click node_analyze "https://github.com/seif2222/depscan/blob/main/core/src/analyze.ts"

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_cli,node_cli_api toneBlue
class node_npm,node_python,node_package_keys,node_dependency_tree,node_parse_errors toneAmber
class node_core_api,node_matcher,node_osv_http,node_osv_cache,node_osv_types,node_osv_service toneMint
class node_cvss,node_severity_map,node_severity,node_stats,node_json_schema,node_report_schema,node_report_validation,node_analyze toneRose
class node_user toneIndigo
```

## Components

### CLI entry

- [CLI command](https://github.com/seif2222/depscan/blob/main/cli/src/bin.ts): `cli/src/bin.ts`
- [CLI API](https://github.com/seif2222/depscan/blob/main/cli/src/index.ts): `cli/src/index.ts`

### Project inputs

- [npm parser](https://github.com/seif2222/depscan/blob/main/core/src/npm-parse.ts): `core/src/npm-parse.ts`
- [Python parser](https://github.com/seif2222/depscan/blob/main/core/src/python-parse.ts): `core/src/python-parse.ts`
- [Package keys](https://github.com/seif2222/depscan/blob/main/core/src/package-key.ts): `core/src/package-key.ts`
- [Dependency tree](https://github.com/seif2222/depscan/blob/main/core/src/build-tree.ts): `core/src/build-tree.ts`
- [Parse errors](https://github.com/seif2222/depscan/blob/main/core/src/errors.ts): `core/src/errors.ts`

### Advisory scanning

- [Core exports](https://github.com/seif2222/depscan/blob/main/core/src/index.ts): `core/src/index.ts`
- [Vulnerability matching](https://github.com/seif2222/depscan/blob/main/core/src/match.ts): `core/src/match.ts`
- [OSV HTTP client](https://github.com/seif2222/depscan/blob/main/core/src/osv-http.ts): `core/src/osv-http.ts`
- [OSV cache](https://github.com/seif2222/depscan/blob/main/core/src/osv-cache.ts): `core/src/osv-cache.ts`
- [OSV data types](https://github.com/seif2222/depscan/blob/main/core/src/osv-types.ts): `core/src/osv-types.ts`

### Report and analysis

- [CVSS scoring](https://github.com/seif2222/depscan/blob/main/core/src/cvss.ts): `core/src/cvss.ts`
- [Severity mapping](https://github.com/seif2222/depscan/blob/main/core/src/severity-map.ts): `core/src/severity-map.ts`
- [Severity utilities](https://github.com/seif2222/depscan/blob/main/core/src/severity.ts): `core/src/severity.ts`
- [Report statistics](https://github.com/seif2222/depscan/blob/main/core/src/stats.ts): `core/src/stats.ts`
- [JSON schema validation](https://github.com/seif2222/depscan/blob/main/core/src/json-schema.ts): `core/src/json-schema.ts`
- [Report schema](https://github.com/seif2222/depscan/blob/main/core/src/report-schema.ts): `core/src/report-schema.ts`
- [Report validation](https://github.com/seif2222/depscan/blob/main/core/src/validate-report.ts): `core/src/validate-report.ts`
- [Analysis entry](https://github.com/seif2222/depscan/blob/main/core/src/analyze.ts): `core/src/analyze.ts`

### Other components

- **Engineer**
- **OSV API**

## Connections

- Engineer → CLI command: invokes
- CLI command → CLI API: dispatches to (evidence: `cli/src/bin.ts`)
- CLI API → Core exports: uses
- Core exports → npm parser: exports (evidence: `core/src/index.ts`)
- Core exports → Python parser: exports (evidence: `core/src/index.ts`)
- Core exports → Dependency tree: exports (evidence: `core/src/index.ts`)
- Core exports → Vulnerability matching: exports (evidence: `core/src/index.ts`)
- Core exports → OSV HTTP client: exports (evidence: `core/src/index.ts`)
- Core exports → OSV cache: exports (evidence: `core/src/index.ts`)
- Core exports → Severity mapping: exports (evidence: `core/src/index.ts`)
- Core exports → Report validation: exports (evidence: `core/src/index.ts`)
- Core exports → Report statistics: exports (evidence: `core/src/index.ts`)
- npm parser → Package keys: uses (evidence: `core/src/npm-parse.ts`)
- npm parser → Parse errors: raises (evidence: `core/src/npm-parse.ts`)
- Python parser → Package keys: uses (evidence: `core/src/python-parse.ts`)
- Python parser → Parse errors: raises (evidence: `core/src/python-parse.ts`)
- Dependency tree → Package keys: uses (evidence: `core/src/build-tree.ts`)
- Vulnerability matching → Package keys: compares versions (evidence: `core/src/match.ts`)
- Vulnerability matching → Severity mapping: assesses severity (evidence: `core/src/match.ts`)
- Vulnerability matching → Python parser: normalizes names (evidence: `core/src/match.ts`)
- Vulnerability matching → OSV HTTP client: queries (evidence: `core/src/match.ts`)
- Vulnerability matching → OSV cache: reads and writes (evidence: `core/src/match.ts`)
- OSV HTTP client → OSV API: sends queries (evidence: `core/src/osv-http.ts`)
- Severity mapping → CVSS scoring: scores vectors (evidence: `core/src/severity-map.ts`)
- Report validation → JSON schema validation: validates against (evidence: `core/src/validate-report.ts`)
- Report validation → Report schema: uses (evidence: `core/src/validate-report.ts`)
- Report validation → Report statistics: checks totals (evidence: `core/src/validate-report.ts`)
