# xdp64xg/torn-intel architecture

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

- Interactive diagram: https://gitdiagram.com/xdp64xg/torn-intel
- Repository: https://github.com/xdp64xg/torn-intel

## Overview

TornIntel is a faction-data analysis CLI: users choose a module and sync mode, the application imports Torn data, stores it locally, and exposes queries and reports. Its domain areas include attacks, chains, ranked wars and payouts, armoury, crimes, and revives; Discord provides a bridge to CLI commands plus community-management features. The graph reflects documented entry points and indexed references; several module implementations and wiring paths were not sampled, so uncertain links are omitted.

Main entry points: [`core/engine.py`](https://github.com/xdp64xg/torn-intel/blob/main/core/engine.py) (Command Engine), [`repositories`](https://github.com/xdp64xg/torn-intel/tree/main/repositories) (Data Repositories), [`modules/attacks`](https://github.com/xdp64xg/torn-intel/tree/main/modules/attacks) (Attacks Sync and Reports), [`services/discord_bot_service.py`](https://github.com/xdp64xg/torn-intel/blob/main/services/discord_bot_service.py) (Discord Bot Bridge)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Command Interfaces"]
  node_main["Python Entry<br/>[main.py]"]
  node_cli["CLI Parser and Commands"]
end

subgraph group_runtime["Application Runtime"]
  node_engine["Command Engine<br/>[engine.py]"]
  node_container["Service Container<br/>[container.py]"]
  node_http["HTTP Client<br/>[http_client.py]"]
end

subgraph group_domains["Faction Data Domains"]
  node_attacks["Attacks Sync and Reports"]
  node_chains["Chains Sync and Queries"]
  node_rankedwars["Ranked Wars and Payouts"]
  node_armoury["Armoury Data and Reports"]
  node_crimes["Crime Slots and Reports"]
  node_revives["Revives and Requests"]
end

subgraph group_storage["Persistence and Data"]
  node_models["Domain Models"]
  node_database[("SQLite Database<br/>[database.py]")]
  node_repositories["Data Repositories"]
end

subgraph group_community["Discord Features"]
  node_discord["Discord Bot Bridge"]
  node_shopwatch["Shoplifting Alerts"]
  node_revive_listener["Revive Request Listener"]
end

node_user(("CLI User"))
node_api{{"Torn API"}}

node_user -->|"runs"| node_main
node_main -->|"builds commands"| node_cli
node_main -->|"creates"| node_engine
node_cli -->|"dispatches"| node_engine
node_engine -->|"uses services"| node_container
node_engine -->|"routes commands"| node_attacks
node_engine -->|"routes commands"| node_chains
node_engine -->|"routes commands"| node_rankedwars
node_engine -->|"routes commands"| node_armoury
node_engine -->|"routes commands"| node_crimes
node_engine -->|"routes commands"| node_revives
node_attacks -->|"requests data"| node_http
node_chains -->|"parses as"| node_models
node_attacks -->|"parses as"| node_models
node_http -.->|"requests data"| node_api
node_engine -.->|"stores synced data"| node_database
node_repositories -.->|"reads and writes"| node_database
node_armoury -->|"queries data"| node_repositories
node_attacks -->|"reports from"| node_repositories
node_crimes -->|"queries slots"| node_repositories
node_revives -->|"stores requests"| node_repositories
node_user -->|"uses bot"| node_discord
node_discord -->|"shells out"| node_main
node_discord -->|"supports alerts"| node_shopwatch
node_discord -.->|"supports requests"| node_revive_listener

click node_main "https://github.com/xdp64xg/torn-intel/blob/main/main.py"
click node_cli "https://github.com/xdp64xg/torn-intel/tree/main/cli"
click node_engine "https://github.com/xdp64xg/torn-intel/blob/main/core/engine.py"
click node_container "https://github.com/xdp64xg/torn-intel/blob/main/services/container.py"
click node_http "https://github.com/xdp64xg/torn-intel/blob/main/services/http_client.py"
click node_attacks "https://github.com/xdp64xg/torn-intel/tree/main/modules/attacks"
click node_chains "https://github.com/xdp64xg/torn-intel/tree/main/modules/chains"
click node_rankedwars "https://github.com/xdp64xg/torn-intel/tree/main/modules/rankedwars"
click node_armoury "https://github.com/xdp64xg/torn-intel/tree/main/modules/armoury"
click node_crimes "https://github.com/xdp64xg/torn-intel/tree/main/modules/crimes"
click node_revives "https://github.com/xdp64xg/torn-intel/tree/main/modules/revives"
click node_models "https://github.com/xdp64xg/torn-intel/tree/main/models"
click node_database "https://github.com/xdp64xg/torn-intel/blob/main/services/database.py"
click node_repositories "https://github.com/xdp64xg/torn-intel/tree/main/repositories"
click node_discord "https://github.com/xdp64xg/torn-intel/blob/main/services/discord_bot_service.py"
click node_shopwatch "https://github.com/xdp64xg/torn-intel/blob/main/services/shoplifting_watcher.py"
click node_revive_listener "https://github.com/xdp64xg/torn-intel/blob/main/services/revive_request_listener.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_main,node_cli,node_user toneBlue
class node_engine,node_container,node_http toneAmber
class node_attacks,node_chains,node_rankedwars,node_armoury,node_crimes,node_revives,node_api toneMint
class node_models,node_database,node_repositories toneRose
class node_discord,node_shopwatch,node_revive_listener toneIndigo
```

## Components

### Command Interfaces

- [Python Entry](https://github.com/xdp64xg/torn-intel/blob/main/main.py): `main.py`
- [CLI Parser and Commands](https://github.com/xdp64xg/torn-intel/tree/main/cli): `cli`

### Application Runtime

- [Command Engine](https://github.com/xdp64xg/torn-intel/blob/main/core/engine.py): `core/engine.py`
- [Service Container](https://github.com/xdp64xg/torn-intel/blob/main/services/container.py): `services/container.py`
- [HTTP Client](https://github.com/xdp64xg/torn-intel/blob/main/services/http_client.py): `services/http_client.py`

### Faction Data Domains

- [Attacks Sync and Reports](https://github.com/xdp64xg/torn-intel/tree/main/modules/attacks): `modules/attacks`
- [Chains Sync and Queries](https://github.com/xdp64xg/torn-intel/tree/main/modules/chains): `modules/chains`
- [Ranked Wars and Payouts](https://github.com/xdp64xg/torn-intel/tree/main/modules/rankedwars): `modules/rankedwars`
- [Armoury Data and Reports](https://github.com/xdp64xg/torn-intel/tree/main/modules/armoury): `modules/armoury`
- [Crime Slots and Reports](https://github.com/xdp64xg/torn-intel/tree/main/modules/crimes): `modules/crimes`
- [Revives and Requests](https://github.com/xdp64xg/torn-intel/tree/main/modules/revives): `modules/revives`

### Persistence and Data

- [Domain Models](https://github.com/xdp64xg/torn-intel/tree/main/models): `models`
- [SQLite Database](https://github.com/xdp64xg/torn-intel/blob/main/services/database.py): `services/database.py`
- [Data Repositories](https://github.com/xdp64xg/torn-intel/tree/main/repositories): `repositories`

### Discord Features

- [Discord Bot Bridge](https://github.com/xdp64xg/torn-intel/blob/main/services/discord_bot_service.py): `services/discord_bot_service.py`
- [Shoplifting Alerts](https://github.com/xdp64xg/torn-intel/blob/main/services/shoplifting_watcher.py): `services/shoplifting_watcher.py`
- [Revive Request Listener](https://github.com/xdp64xg/torn-intel/blob/main/services/revive_request_listener.py): `services/revive_request_listener.py`

### Other components

- **CLI User**
- **Torn API**

## Connections

- CLI User → Python Entry: runs
- Python Entry → CLI Parser and Commands: builds commands (evidence: `main.py`)
- Python Entry → Command Engine: creates (evidence: `main.py`)
- CLI Parser and Commands → Command Engine: dispatches (evidence: `main.py`)
- Command Engine → Service Container: uses services (evidence: `core/engine.py`)
- Command Engine → Attacks Sync and Reports: routes commands (evidence: `core/engine.py`)
- Command Engine → Chains Sync and Queries: routes commands (evidence: `core/engine.py`)
- Command Engine → Ranked Wars and Payouts: routes commands (evidence: `core/engine.py`)
- Command Engine → Armoury Data and Reports: routes commands (evidence: `core/engine.py`)
- Command Engine → Crime Slots and Reports: routes commands (evidence: `core/engine.py`)
- Command Engine → Revives and Requests: routes commands (evidence: `core/engine.py`)
- Attacks Sync and Reports → HTTP Client: requests data (evidence: `modules/attacks/sync.py`)
- Chains Sync and Queries → Domain Models: parses as (evidence: `modules/chains/sync.py`)
- Attacks Sync and Reports → Domain Models: parses as (evidence: `modules/attacks/sync.py`)
- HTTP Client → Torn API: requests data
- Command Engine → SQLite Database: stores synced data
- Data Repositories → SQLite Database: reads and writes
- Armoury Data and Reports → Data Repositories: queries data (evidence: `modules/armoury/queries.py`)
- Attacks Sync and Reports → Data Repositories: reports from (evidence: `modules/attacks/report.py`)
- Crime Slots and Reports → Data Repositories: queries slots (evidence: `modules/crimes/queries.py`)
- Revives and Requests → Data Repositories: stores requests (evidence: `modules/revives/sync.py`)
- CLI User → Discord Bot Bridge: uses bot
- Discord Bot Bridge → Python Entry: shells out (evidence: `services/discord_bot_service.py`)
- Discord Bot Bridge → Shoplifting Alerts: supports alerts (evidence: `services/discord_bot_service.py`)
- Discord Bot Bridge → Revive Request Listener: supports requests
