# cosmix-6/info-snipe architecture

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

- Interactive diagram: https://gitdiagram.com/cosmix-6/info-snipe
- Repository: https://github.com/cosmix-6/info-snipe

## Overview

info-snipe is a Python library and CLI for fetching news by genre and country, normalizing results, and returning only unseen articles. The main workflow is to configure a genre, fetch from RSS and optionally NewsAPI, assign stable content identities, filter against persistent seen-state, then return or display fresh articles. SQLite is the default store; Postgres is an optional alternative backend. The graph reflects the sampled implementation and documented capabilities; the Postgres injection path is shown as unverified because its wiring was not excerpted.

Main entry points: [`info_snipe/fetcher.py`](https://github.com/cosmix-6/info-snipe/blob/master/info_snipe/fetcher.py) (News fetcher), [`info_snipe/cli.py`](https://github.com/cosmix-6/info-snipe/blob/master/info_snipe/cli.py) (CLI), [`info_snipe/__init__.py`](https://github.com/cosmix-6/info-snipe/blob/master/info_snipe/__init__.py) (Default factory), [`info_snipe/sources/rss_source.py`](https://github.com/cosmix-6/info-snipe/blob/master/info_snipe/sources/rss_source.py) (RSS adapter)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry and output"]
  node_cli["CLI<br/>[cli.py]"]
  node_factory["Default factory<br/>[__init__.py]"]
  node_cli_output["Terminal output<br/>[cli.py]"]
end

subgraph group_retrieval["News retrieval"]
  node_fetcher["News fetcher<br/>[fetcher.py]"]
  node_genres["Genre registry<br/>[genres.py]"]
  node_source_contract["Source contract<br/>[base.py]"]
  node_rss["RSS adapter<br/>[rss_source.py]"]
  node_newsapi["NewsAPI adapter<br/>[newsapi_source.py]"]
end

subgraph group_state["Identity and seen state"]
  node_article["Article model<br/>[models.py]"]
  node_identity["Content identity<br/>[content_id.py]"]
  node_sqlite[("SQLite seen store<br/>[store.py]")]
  node_postgres[("Postgres seen store<br/>[store_postgres.py]")]
end

node_consumer(("Library user"))
node_cli_user(("CLI user"))
node_rss_feeds{{"RSS feeds"}}
node_newsapi_service{{"NewsAPI service"}}

node_consumer -->|"calls fetch"| node_fetcher
node_cli_user -->|"runs"| node_cli
node_cli -->|"builds fetcher"| node_factory
node_cli -->|"lists choices"| node_genres
node_factory -->|"constructs"| node_fetcher
node_factory -->|"includes"| node_rss
node_factory -->|"adds when keyed"| node_newsapi
node_factory -->|"creates default"| node_sqlite
node_fetcher -->|"resolves genre"| node_genres
node_fetcher -->|"dispatches fetch"| node_source_contract
node_rss -->|"implements"| node_source_contract
node_newsapi -->|"implements"| node_source_contract
node_rss -->|"reads feed config"| node_genres
node_newsapi -->|"reads query config"| node_genres
node_rss -->|"fetches feeds"| node_rss_feeds
node_newsapi -->|"requests articles"| node_newsapi_service
node_fetcher -->|"creates IDs"| node_identity
node_fetcher -->|"normalizes into"| node_article
node_fetcher -->|"filters and records"| node_sqlite
node_fetcher -.->|"accepts compatible store"| node_postgres
node_cli -->|"fetches articles"| node_fetcher
node_cli -->|"prints results"| node_cli_output
node_fetcher -->|"returns articles"| node_consumer

click node_cli "https://github.com/cosmix-6/info-snipe/blob/master/info_snipe/cli.py"
click node_factory "https://github.com/cosmix-6/info-snipe/blob/master/info_snipe/__init__.py"
click node_fetcher "https://github.com/cosmix-6/info-snipe/blob/master/info_snipe/fetcher.py"
click node_genres "https://github.com/cosmix-6/info-snipe/blob/master/info_snipe/genres.py"
click node_source_contract "https://github.com/cosmix-6/info-snipe/blob/master/info_snipe/sources/base.py"
click node_rss "https://github.com/cosmix-6/info-snipe/blob/master/info_snipe/sources/rss_source.py"
click node_newsapi "https://github.com/cosmix-6/info-snipe/blob/master/info_snipe/sources/newsapi_source.py"
click node_article "https://github.com/cosmix-6/info-snipe/blob/master/info_snipe/models.py"
click node_identity "https://github.com/cosmix-6/info-snipe/blob/master/info_snipe/content_id.py"
click node_sqlite "https://github.com/cosmix-6/info-snipe/blob/master/info_snipe/store.py"
click node_postgres "https://github.com/cosmix-6/info-snipe/blob/master/info_snipe/store_postgres.py"
click node_cli_output "https://github.com/cosmix-6/info-snipe/blob/master/info_snipe/cli.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,node_factory,node_cli_output,node_consumer,node_cli_user toneBlue
class node_fetcher,node_genres,node_source_contract,node_rss,node_newsapi toneAmber
class node_article,node_identity,node_sqlite,node_postgres,node_newsapi_service toneMint
class node_rss_feeds toneIndigo
```

## Components

### Entry and output

- [CLI](https://github.com/cosmix-6/info-snipe/blob/master/info_snipe/cli.py): `info_snipe/cli.py`
- [Default factory](https://github.com/cosmix-6/info-snipe/blob/master/info_snipe/__init__.py): `info_snipe/__init__.py`
- [Terminal output](https://github.com/cosmix-6/info-snipe/blob/master/info_snipe/cli.py): `info_snipe/cli.py`

### News retrieval

- [News fetcher](https://github.com/cosmix-6/info-snipe/blob/master/info_snipe/fetcher.py): `info_snipe/fetcher.py`
- [Genre registry](https://github.com/cosmix-6/info-snipe/blob/master/info_snipe/genres.py): `info_snipe/genres.py`
- [Source contract](https://github.com/cosmix-6/info-snipe/blob/master/info_snipe/sources/base.py): `info_snipe/sources/base.py`
- [RSS adapter](https://github.com/cosmix-6/info-snipe/blob/master/info_snipe/sources/rss_source.py): `info_snipe/sources/rss_source.py`
- [NewsAPI adapter](https://github.com/cosmix-6/info-snipe/blob/master/info_snipe/sources/newsapi_source.py): `info_snipe/sources/newsapi_source.py`

### Identity and seen state

- [Article model](https://github.com/cosmix-6/info-snipe/blob/master/info_snipe/models.py): `info_snipe/models.py`
- [Content identity](https://github.com/cosmix-6/info-snipe/blob/master/info_snipe/content_id.py): `info_snipe/content_id.py`
- [SQLite seen store](https://github.com/cosmix-6/info-snipe/blob/master/info_snipe/store.py): `info_snipe/store.py`
- [Postgres seen store](https://github.com/cosmix-6/info-snipe/blob/master/info_snipe/store_postgres.py): `info_snipe/store_postgres.py`

### Other components

- **Library user**
- **CLI user**
- **RSS feeds**
- **NewsAPI service**

## Connections

- Library user → News fetcher: calls fetch (evidence: `README.md`)
- CLI user → CLI: runs (evidence: `README.md`)
- CLI → Default factory: builds fetcher (evidence: `info_snipe/cli.py`)
- CLI → Genre registry: lists choices (evidence: `info_snipe/cli.py`)
- Default factory → News fetcher: constructs (evidence: `info_snipe/__init__.py`)
- Default factory → RSS adapter: includes (evidence: `info_snipe/__init__.py`)
- Default factory → NewsAPI adapter: adds when keyed (evidence: `info_snipe/__init__.py`)
- Default factory → SQLite seen store: creates default (evidence: `info_snipe/__init__.py`)
- News fetcher → Genre registry: resolves genre (evidence: `info_snipe/fetcher.py`)
- News fetcher → Source contract: dispatches fetch (evidence: `info_snipe/fetcher.py`)
- RSS adapter → Source contract: implements (evidence: `info_snipe/sources/rss_source.py`)
- NewsAPI adapter → Source contract: implements (evidence: `info_snipe/sources/newsapi_source.py`)
- RSS adapter → Genre registry: reads feed config (evidence: `info_snipe/sources/rss_source.py`)
- NewsAPI adapter → Genre registry: reads query config (evidence: `info_snipe/sources/newsapi_source.py`)
- RSS adapter → RSS feeds: fetches feeds (evidence: `info_snipe/sources/rss_source.py`)
- NewsAPI adapter → NewsAPI service: requests articles (evidence: `info_snipe/sources/newsapi_source.py`)
- News fetcher → Content identity: creates IDs (evidence: `info_snipe/fetcher.py`)
- News fetcher → Article model: normalizes into (evidence: `info_snipe/fetcher.py`)
- News fetcher → SQLite seen store: filters and records (evidence: `info_snipe/fetcher.py`)
- News fetcher → Postgres seen store: accepts compatible store
- CLI → News fetcher: fetches articles (evidence: `info_snipe/cli.py`)
- CLI → Terminal output: prints results (evidence: `info_snipe/cli.py`)
- News fetcher → Library user: returns articles (evidence: `README.md`)
