# lordphoenix1223/stl-inspector-cli architecture

> Architecture diagram of the GitHub repository lordphoenix1223/stl-inspector-cli, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lordphoenix1223/stl-inspector-cli
- Repository: https://github.com/lordphoenix1223/stl-inspector-cli

## Overview

STL Inspector is a small command-line utility for turning one or more STL files into geometry summaries. The user supplies file paths and an output format; the CLI calls the inspector, which reads and identifies each file, parses ASCII or binary geometry, and computes metadata. The CLI then prints a table or JSON. The runtime is concentrated in two source files; the parser’s internal stages are shown separately, though they share one implementation file.

Main entry points: [`src/stl_inspector/cli.py`](https://github.com/lordphoenix1223/stl-inspector-cli/blob/main/src/stl_inspector/cli.py) (CLI arguments), [`src/stl_inspector/parser.py`](https://github.com/lordphoenix1223/stl-inspector-cli/blob/main/src/stl_inspector/parser.py) (STL inspector)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["Command-line interface"]
  node_cli_entry["CLI arguments<br/>[cli.py]"]
  node_cli_output["Table / JSON output<br/>[cli.py]"]
end

subgraph group_inspect["STL inspection"]
  node_inspect_stl["STL inspector<br/>[parser.py]"]
  node_file_read["File validation and read<br/>[parser.py]"]
  node_format_detect["Format detection<br/>[parser.py]"]
  node_ascii_parse["ASCII STL parser<br/>[parser.py]"]
  node_binary_parse["Binary STL parser<br/>[parser.py]"]
  node_geometry_summary["Geometry summary<br/>[parser.py]"]
end

node_user(("User"))

node_user -->|"provides paths"| node_cli_entry
node_cli_entry -->|"inspects files"| node_inspect_stl
node_inspect_stl -->|"reads file"| node_file_read
node_inspect_stl -->|"detects format"| node_format_detect
node_format_detect -->|"dispatches ASCII"| node_ascii_parse
node_format_detect -->|"dispatches binary"| node_binary_parse
node_ascii_parse -->|"summarizes vertices"| node_geometry_summary
node_binary_parse -->|"summarizes vertices"| node_geometry_summary
node_cli_entry -->|"formats reports"| node_cli_output
node_cli_output -->|"prints results"| node_user

click node_cli_entry "https://github.com/lordphoenix1223/stl-inspector-cli/blob/main/src/stl_inspector/cli.py"
click node_cli_output "https://github.com/lordphoenix1223/stl-inspector-cli/blob/main/src/stl_inspector/cli.py"
click node_inspect_stl "https://github.com/lordphoenix1223/stl-inspector-cli/blob/main/src/stl_inspector/parser.py"
click node_file_read "https://github.com/lordphoenix1223/stl-inspector-cli/blob/main/src/stl_inspector/parser.py"
click node_format_detect "https://github.com/lordphoenix1223/stl-inspector-cli/blob/main/src/stl_inspector/parser.py"
click node_ascii_parse "https://github.com/lordphoenix1223/stl-inspector-cli/blob/main/src/stl_inspector/parser.py"
click node_binary_parse "https://github.com/lordphoenix1223/stl-inspector-cli/blob/main/src/stl_inspector/parser.py"
click node_geometry_summary "https://github.com/lordphoenix1223/stl-inspector-cli/blob/main/src/stl_inspector/parser.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_cli_entry,node_cli_output,node_user toneBlue
class node_inspect_stl,node_file_read,node_format_detect,node_ascii_parse,node_binary_parse,node_geometry_summary toneAmber
```

## Components

### Command-line interface

- [CLI arguments](https://github.com/lordphoenix1223/stl-inspector-cli/blob/main/src/stl_inspector/cli.py): `src/stl_inspector/cli.py`
- [Table / JSON output](https://github.com/lordphoenix1223/stl-inspector-cli/blob/main/src/stl_inspector/cli.py): `src/stl_inspector/cli.py`

### STL inspection

- [STL inspector](https://github.com/lordphoenix1223/stl-inspector-cli/blob/main/src/stl_inspector/parser.py): `src/stl_inspector/parser.py`
- [File validation and read](https://github.com/lordphoenix1223/stl-inspector-cli/blob/main/src/stl_inspector/parser.py): `src/stl_inspector/parser.py`
- [Format detection](https://github.com/lordphoenix1223/stl-inspector-cli/blob/main/src/stl_inspector/parser.py): `src/stl_inspector/parser.py`
- [ASCII STL parser](https://github.com/lordphoenix1223/stl-inspector-cli/blob/main/src/stl_inspector/parser.py): `src/stl_inspector/parser.py`
- [Binary STL parser](https://github.com/lordphoenix1223/stl-inspector-cli/blob/main/src/stl_inspector/parser.py): `src/stl_inspector/parser.py`
- [Geometry summary](https://github.com/lordphoenix1223/stl-inspector-cli/blob/main/src/stl_inspector/parser.py): `src/stl_inspector/parser.py`

### Other components

- **User**

## Connections

- User → CLI arguments: provides paths (evidence: `README.md`)
- CLI arguments → STL inspector: inspects files (evidence: `src/stl_inspector/cli.py`)
- STL inspector → File validation and read: reads file (evidence: `src/stl_inspector/parser.py`)
- STL inspector → Format detection: detects format (evidence: `src/stl_inspector/parser.py`)
- Format detection → ASCII STL parser: dispatches ASCII (evidence: `src/stl_inspector/parser.py`)
- Format detection → Binary STL parser: dispatches binary (evidence: `src/stl_inspector/parser.py`)
- ASCII STL parser → Geometry summary: summarizes vertices (evidence: `src/stl_inspector/parser.py`)
- Binary STL parser → Geometry summary: summarizes vertices (evidence: `src/stl_inspector/parser.py`)
- CLI arguments → Table / JSON output: formats reports (evidence: `src/stl_inspector/cli.py`)
- Table / JSON output → User: prints results (evidence: `src/stl_inspector/cli.py`)
