# rizlem/gitdiff architecture

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

- Interactive diagram: https://gitdiagram.com/rizlem/gitdiff
- Repository: https://github.com/rizlem/gitdiff

## Overview

DiffScribe turns a developer’s uncommitted Git diff into a Discord commit-message summary: the CLI identifies the author, cleans and chunks the diff, then posts it to Discord; the bot buffers the chunks, asks Groq for structured analysis, and publishes the formatted result. Configuration is shared by the CLI and bot. The bot excerpt is partial, so internal steps shown follow only the visible handling and API flow; no persistence layer is evident.

Main entry points: [`src/diff_cli.py`](https://github.com/rizlem/gitdiff/blob/main/src/diff_cli.py) (Diff CLI), [`src/diff_analyzer_bot.py`](https://github.com/rizlem/gitdiff/blob/main/src/diff_analyzer_bot.py) (Message handler), [`src/config_loader.py`](https://github.com/rizlem/gitdiff/blob/main/src/config_loader.py) (Config loader), [`config.example.yaml`](https://github.com/rizlem/gitdiff/blob/main/config.example.yaml) (Example config)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_local["Local capture"]
  node_cli["Diff CLI<br/>[diff_cli.py]"]
end

subgraph group_bot["Discord analysis"]
  node_bot_handler["Message handler"]
  node_diff_buffer["Diff buffer"]
  node_response_parser["Response parser"]
  node_result_embed["Result embed"]
end

subgraph group_config["Configuration"]
  node_config_loader["Config loader<br/>[config_loader.py]"]
  node_config_example["Example config"]
end

node_developer(("Developer"))
node_git["Git repository"]
node_webhook["Discord"]
node_groq["Groq API"]

node_developer -->|"runs"| node_cli
node_cli -->|"reads diff"| node_git
node_cli -->|"loads config"| node_config_loader
node_cli -->|"posts chunks"| node_webhook
node_webhook -->|"dispatches messages"| node_bot_handler
node_bot_handler -->|"buffers chunks"| node_diff_buffer
node_bot_handler -->|"requests analysis"| node_groq
node_groq -->|"returns JSON"| node_response_parser
node_response_parser -->|"provides fields"| node_result_embed
node_bot_handler -->|"sends result"| node_webhook
node_config_example -.->|"example settings"| node_config_loader
node_config_loader -->|"returns settings"| node_cli
node_config_loader -->|"returns settings"| node_bot_handler

click node_cli "https://github.com/rizlem/gitdiff/blob/main/src/diff_cli.py"
click node_bot_handler "https://github.com/rizlem/gitdiff/blob/main/src/diff_analyzer_bot.py"
click node_diff_buffer "https://github.com/rizlem/gitdiff/blob/main/src/diff_analyzer_bot.py"
click node_response_parser "https://github.com/rizlem/gitdiff/blob/main/src/diff_analyzer_bot.py"
click node_result_embed "https://github.com/rizlem/gitdiff/blob/main/src/diff_analyzer_bot.py"
click node_config_loader "https://github.com/rizlem/gitdiff/blob/main/src/config_loader.py"
click node_config_example "https://github.com/rizlem/gitdiff/blob/main/config.example.yaml"

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 toneBlue
class node_bot_handler,node_diff_buffer,node_response_parser,node_result_embed toneAmber
class node_config_loader,node_config_example,node_groq toneMint
class node_developer,node_git,node_webhook toneIndigo
```

## Components

### Local capture

- [Diff CLI](https://github.com/rizlem/gitdiff/blob/main/src/diff_cli.py): `src/diff_cli.py`

### Discord analysis

- [Message handler](https://github.com/rizlem/gitdiff/blob/main/src/diff_analyzer_bot.py): `src/diff_analyzer_bot.py`
- [Diff buffer](https://github.com/rizlem/gitdiff/blob/main/src/diff_analyzer_bot.py): `src/diff_analyzer_bot.py`
- [Response parser](https://github.com/rizlem/gitdiff/blob/main/src/diff_analyzer_bot.py): `src/diff_analyzer_bot.py`
- [Result embed](https://github.com/rizlem/gitdiff/blob/main/src/diff_analyzer_bot.py): `src/diff_analyzer_bot.py`

### Configuration

- [Config loader](https://github.com/rizlem/gitdiff/blob/main/src/config_loader.py): `src/config_loader.py`
- [Example config](https://github.com/rizlem/gitdiff/blob/main/config.example.yaml): `config.example.yaml`

### Other components

- **Developer**
- **Git repository**
- **Discord**
- **Groq API**

## Connections

- Developer → Diff CLI: runs
- Diff CLI → Git repository: reads diff
- Diff CLI → Config loader: loads config
- Diff CLI → Discord: posts chunks
- Discord → Message handler: dispatches messages
- Message handler → Diff buffer: buffers chunks
- Message handler → Groq API: requests analysis
- Groq API → Response parser: returns JSON
- Response parser → Result embed: provides fields
- Message handler → Discord: sends result
- Example config → Config loader: example settings
- Config loader → Diff CLI: returns settings
- Config loader → Message handler: returns settings
