# ricardojob/psaspotter architecture

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

- Interactive diagram: https://gitdiagram.com/ricardojob/psaspotter
- Repository: https://github.com/ricardojob/psaspotter

## Overview

PSASpotter is a Python AST-based CLI for finding platform-specific API calls in local or remote Git repositories and exporting usage details. The main workflow selects a project, scans its Python files, detects API calls and defensive contexts, enriches findings with availability data, and writes CSV or standard output. The repository also contains a batch-analysis path. Edges reflect the shown CLI and module calls; batch wiring is limited to the excerpted evidence.

Main entry points: [`psaspotter/main.py`](https://github.com/ricardojob/psaspotter/blob/main/psaspotter/main.py) (CLI Entry), [`psaspotter/projects.py`](https://github.com/ricardojob/psaspotter/blob/main/psaspotter/projects.py) (Project Resolver), [`psaspotter/batch.py`](https://github.com/ricardojob/psaspotter/blob/main/psaspotter/batch.py) (Batch Runner), [`psaspotter/extract.py`](https://github.com/ricardojob/psaspotter/blob/main/psaspotter/extract.py) (Python Scanner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["CLI Workflow"]
  node_entry["CLI Entry<br/>[main.py]"]
  node_project["Project Resolver<br/>[projects.py]"]
  node_repo["Git Fetcher<br/>[get_repo.py]"]
  node_report["CSV Reporter<br/>[extract.py]"]
end

subgraph group_analysis["API Analysis"]
  node_scanner["Python Scanner<br/>[extract.py]"]
  node_visitor["AST Detector<br/>[capture.py]"]
end

subgraph group_data["API Data"]
  node_availability["Availability Lookup<br/>[extract.py]"]
  node_catalog["API Catalogs<br/>[apis-all.json]"]
end

subgraph group_batch["Batch Analysis"]
  node_batch["Batch Runner<br/>[batch.py]"]
  node_batchreport["Batch CSV Writer<br/>[batch.py]"]
end

node_user(("CLI User"))
node_csv["CSV Output"]

node_user -->|"runs"| node_entry
node_entry -->|"builds project"| node_project
node_project -->|"clones remote"| node_repo
node_project -->|"loads APIs"| node_catalog
node_entry -->|"starts scan"| node_scanner
node_scanner -->|"visits AST"| node_visitor
node_scanner -->|"looks up availability"| node_availability
node_entry -->|"builds report"| node_report
node_report -->|"writes rows"| node_csv
node_batch -->|"parses AST"| node_visitor
node_batch -->|"uses projects"| node_project
node_batch -->|"writes results"| node_batchreport
node_batchreport -->|"writes CSV"| node_csv

click node_entry "https://github.com/ricardojob/psaspotter/blob/main/psaspotter/main.py"
click node_project "https://github.com/ricardojob/psaspotter/blob/main/psaspotter/projects.py"
click node_repo "https://github.com/ricardojob/psaspotter/blob/main/psaspotter/get_repo.py"
click node_scanner "https://github.com/ricardojob/psaspotter/blob/main/psaspotter/extract.py"
click node_visitor "https://github.com/ricardojob/psaspotter/blob/main/psaspotter/capture.py"
click node_availability "https://github.com/ricardojob/psaspotter/blob/main/psaspotter/extract.py"
click node_catalog "https://github.com/ricardojob/psaspotter/blob/main/psaspotter/apis-all.json"
click node_report "https://github.com/ricardojob/psaspotter/blob/main/psaspotter/extract.py"
click node_batch "https://github.com/ricardojob/psaspotter/blob/main/psaspotter/batch.py"
click node_batchreport "https://github.com/ricardojob/psaspotter/blob/main/psaspotter/batch.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_entry,node_project,node_repo,node_report,node_user toneBlue
class node_scanner,node_visitor toneAmber
class node_availability,node_catalog toneMint
class node_batch,node_batchreport toneRose
class node_csv toneIndigo
```

## Components

### CLI Workflow

- [CLI Entry](https://github.com/ricardojob/psaspotter/blob/main/psaspotter/main.py): `psaspotter/main.py`
- [Project Resolver](https://github.com/ricardojob/psaspotter/blob/main/psaspotter/projects.py): `psaspotter/projects.py`
- [Git Fetcher](https://github.com/ricardojob/psaspotter/blob/main/psaspotter/get_repo.py): `psaspotter/get_repo.py`
- [CSV Reporter](https://github.com/ricardojob/psaspotter/blob/main/psaspotter/extract.py): `psaspotter/extract.py`

### API Analysis

- [Python Scanner](https://github.com/ricardojob/psaspotter/blob/main/psaspotter/extract.py): `psaspotter/extract.py`
- [AST Detector](https://github.com/ricardojob/psaspotter/blob/main/psaspotter/capture.py): `psaspotter/capture.py`

### API Data

- [Availability Lookup](https://github.com/ricardojob/psaspotter/blob/main/psaspotter/extract.py): `psaspotter/extract.py`
- [API Catalogs](https://github.com/ricardojob/psaspotter/blob/main/psaspotter/apis-all.json): `psaspotter/apis-all.json`

### Batch Analysis

- [Batch Runner](https://github.com/ricardojob/psaspotter/blob/main/psaspotter/batch.py): `psaspotter/batch.py`
- [Batch CSV Writer](https://github.com/ricardojob/psaspotter/blob/main/psaspotter/batch.py): `psaspotter/batch.py`

### Other components

- **CLI User**
- **CSV Output**

## Connections

- CLI User → CLI Entry: runs (evidence: `README.md`)
- CLI Entry → Project Resolver: builds project (evidence: `psaspotter/main.py`)
- Project Resolver → Git Fetcher: clones remote (evidence: `psaspotter/projects.py`)
- Project Resolver → API Catalogs: loads APIs (evidence: `psaspotter/projects.py`)
- CLI Entry → Python Scanner: starts scan (evidence: `psaspotter/main.py`)
- Python Scanner → AST Detector: visits AST (evidence: `psaspotter/extract.py`)
- Python Scanner → Availability Lookup: looks up availability (evidence: `psaspotter/extract.py`)
- CLI Entry → CSV Reporter: builds report (evidence: `psaspotter/main.py`)
- CSV Reporter → CSV Output: writes rows (evidence: `psaspotter/extract.py`)
- Batch Runner → AST Detector: parses AST (evidence: `psaspotter/batch.py`)
- Batch Runner → Project Resolver: uses projects (evidence: `psaspotter/batch.py`)
- Batch Runner → Batch CSV Writer: writes results (evidence: `psaspotter/batch.py`)
- Batch CSV Writer → CSV Output: writes CSV (evidence: `psaspotter/batch.py`)
