# smlfg/mydealz-cli architecture

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

- Interactive diagram: https://gitdiagram.com/smlfg/mydealz-cli
- Repository: https://github.com/smlfg/mydealz-cli

## Overview

mydealz-cli is a read-only command-line client that emits JSON for deal searches, deal details, and local keyword watches. The main workflow parses CLI input, builds a search URL, fetches public HTML, parses and filters deal records, then emits the result; show follows its own fetch-and-parse path, while watch compares results with local state. The graph reflects excerpted calls and README-documented behavior; the optional Playwright renderer is documented but its implementation was not sampled.

Main entry points: [`src/mydealz_cli/cli.py`](https://github.com/smlfg/mydealz-cli/blob/main/src/mydealz_cli/cli.py) (Command dispatch), [`src/mydealz_cli/http_client.py`](https://github.com/smlfg/mydealz-cli/blob/main/src/mydealz_cli/http_client.py) (HTTP client), [`src/mydealz_cli/parser.py`](https://github.com/smlfg/mydealz-cli/blob/main/src/mydealz_cli/parser.py) (Deal list parser), [`src/mydealz_cli/watch.py`](https://github.com/smlfg/mydealz-cli/blob/main/src/mydealz_cli/watch.py) (New-deal comparison)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["CLI entry"]
  node_command["Command dispatch<br/>[cli.py]"]
  node_json["JSON output<br/>[cli.py]"]
end

subgraph group_search["Search pipeline"]
  node_url["Search URL builder<br/>[url_builder.py]"]
  node_parse_search["Deal list parser<br/>[parser.py]"]
  node_filter["Local filtering<br/>[cli.py]"]
end

subgraph group_detail["Deal details"]
  node_detail_url["Deal URL resolution<br/>[cli.py]"]
  node_detail_parse["Metadata detail parser<br/>[parser.py]"]
  node_renderer["Playwright rendering"]
end

subgraph group_watch["Local watch"]
  node_watch_diff["New-deal comparison<br/>[watch.py]"]
  node_watch_state[("Watch state file<br/>[watch.py]")]
end

subgraph group_transport["HTTP transport"]
  node_fetch["HTTP client<br/>[http_client.py]"]
end

node_user(("CLI user"))
node_mydealz["mydealz.de"]

node_user -->|"invokes"| node_command
node_command -->|"builds query URL"| node_url
node_command -->|"fetches search"| node_fetch
node_fetch -->|"GETs HTML"| node_mydealz
node_command -->|"parses response"| node_parse_search
node_parse_search -->|"raises parse errors"| node_fetch
node_command -->|"filters deals"| node_filter
node_command -->|"emits JSON"| node_json
node_command -->|"resolves detail"| node_detail_url
node_command -->|"fetches detail"| node_fetch
node_command -->|"parses metadata"| node_detail_parse
node_detail_parse -->|"raises parse errors"| node_fetch
node_command -.->|"optionally renders"| node_renderer
node_command -->|"loads and saves"| node_watch_state
node_command -->|"compares results"| node_watch_diff
node_watch_diff -->|"reads saved IDs"| node_watch_state
node_command -->|"emits watch results"| node_json

click node_command "https://github.com/smlfg/mydealz-cli/blob/main/src/mydealz_cli/cli.py"
click node_url "https://github.com/smlfg/mydealz-cli/blob/main/src/mydealz_cli/url_builder.py"
click node_fetch "https://github.com/smlfg/mydealz-cli/blob/main/src/mydealz_cli/http_client.py"
click node_parse_search "https://github.com/smlfg/mydealz-cli/blob/main/src/mydealz_cli/parser.py"
click node_filter "https://github.com/smlfg/mydealz-cli/blob/main/src/mydealz_cli/cli.py"
click node_json "https://github.com/smlfg/mydealz-cli/blob/main/src/mydealz_cli/cli.py"
click node_detail_url "https://github.com/smlfg/mydealz-cli/blob/main/src/mydealz_cli/cli.py"
click node_detail_parse "https://github.com/smlfg/mydealz-cli/blob/main/src/mydealz_cli/parser.py"
click node_watch_diff "https://github.com/smlfg/mydealz-cli/blob/main/src/mydealz_cli/watch.py"
click node_watch_state "https://github.com/smlfg/mydealz-cli/blob/main/src/mydealz_cli/watch.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_command,node_json,node_user toneBlue
class node_url,node_parse_search,node_filter toneAmber
class node_detail_url,node_detail_parse,node_renderer toneMint
class node_watch_diff,node_watch_state toneRose
class node_fetch,node_mydealz toneIndigo
```

## Components

### CLI entry

- [Command dispatch](https://github.com/smlfg/mydealz-cli/blob/main/src/mydealz_cli/cli.py): `src/mydealz_cli/cli.py`
- [JSON output](https://github.com/smlfg/mydealz-cli/blob/main/src/mydealz_cli/cli.py): `src/mydealz_cli/cli.py`

### Search pipeline

- [Search URL builder](https://github.com/smlfg/mydealz-cli/blob/main/src/mydealz_cli/url_builder.py): `src/mydealz_cli/url_builder.py`
- [Deal list parser](https://github.com/smlfg/mydealz-cli/blob/main/src/mydealz_cli/parser.py): `src/mydealz_cli/parser.py`
- [Local filtering](https://github.com/smlfg/mydealz-cli/blob/main/src/mydealz_cli/cli.py): `src/mydealz_cli/cli.py`

### Deal details

- [Deal URL resolution](https://github.com/smlfg/mydealz-cli/blob/main/src/mydealz_cli/cli.py): `src/mydealz_cli/cli.py`
- [Metadata detail parser](https://github.com/smlfg/mydealz-cli/blob/main/src/mydealz_cli/parser.py): `src/mydealz_cli/parser.py`
- **Playwright rendering**

### Local watch

- [New-deal comparison](https://github.com/smlfg/mydealz-cli/blob/main/src/mydealz_cli/watch.py): `src/mydealz_cli/watch.py`
- [Watch state file](https://github.com/smlfg/mydealz-cli/blob/main/src/mydealz_cli/watch.py): `src/mydealz_cli/watch.py`

### HTTP transport

- [HTTP client](https://github.com/smlfg/mydealz-cli/blob/main/src/mydealz_cli/http_client.py): `src/mydealz_cli/http_client.py`

### Other components

- **CLI user**
- **mydealz.de**

## Connections

- CLI user → Command dispatch: invokes (evidence: `README.md`)
- Command dispatch → Search URL builder: builds query URL (evidence: `src/mydealz_cli/cli.py`)
- Command dispatch → HTTP client: fetches search (evidence: `src/mydealz_cli/cli.py`)
- HTTP client → mydealz.de: GETs HTML (evidence: `src/mydealz_cli/http_client.py`)
- Command dispatch → Deal list parser: parses response (evidence: `src/mydealz_cli/cli.py`)
- Deal list parser → HTTP client: raises parse errors (evidence: `src/mydealz_cli/parser.py`)
- Command dispatch → Local filtering: filters deals (evidence: `src/mydealz_cli/cli.py`)
- Command dispatch → JSON output: emits JSON (evidence: `README.md`)
- Command dispatch → Deal URL resolution: resolves detail (evidence: `README.md`)
- Command dispatch → HTTP client: fetches detail (evidence: `src/mydealz_cli/cli.py`)
- Command dispatch → Metadata detail parser: parses metadata (evidence: `src/mydealz_cli/cli.py`)
- Metadata detail parser → HTTP client: raises parse errors (evidence: `src/mydealz_cli/parser.py`)
- Command dispatch → Playwright rendering: optionally renders (evidence: `README.md`)
- Command dispatch → Watch state file: loads and saves (evidence: `src/mydealz_cli/cli.py`)
- Command dispatch → New-deal comparison: compares results (evidence: `src/mydealz_cli/cli.py`)
- New-deal comparison → Watch state file: reads saved IDs (evidence: `src/mydealz_cli/watch.py`)
- Command dispatch → JSON output: emits watch results (evidence: `src/mydealz_cli/cli.py`)
