# rudrodip/gitday architecture

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

- Interactive diagram: https://gitdiagram.com/rudrodip/gitday
- Repository: https://github.com/rudrodip/gitday

## Overview

##### Main Components
a. CLI Interface (User)
b. Core Application Process (Node/Bun runtime)
- Command Dispatcher
- Git Client Module
- Diff & Commit Fetcher
- Noise Filter
- Prompt Builder
- AI Client (Google Gemini API wrapper)
- Output Handler (Console or File Writer)
- Config Manager (reads/writes `~/.gitday-config.json` or env var)
c. External Dependencies
- Local Git executable & repository
- Google Gemini AI service (HTTPS API)
- File system (config file + output files)

##### Relationships & Data Flow
- User invokes `gitday <command>` in terminal →
Command Dispatcher routes to the appropriate workflow (today, unpushed, both, config).
- For summary commands:
1. Git Client Module calls `git log` / `git diff` to fetch commits & diffs.
2. Diff & Commit Fetcher parses raw data.
3. Noise Filter removes lock-file changes, trivial diffs.
4. Prompt Builder creates a structured prompt (features, refactors, issues).
5. AI Client sends prompt to Google Gemini API, receives generated summary.
6. Output Handler writes summary to `prompt.txt` (or user-specified file) or prints to console.
- Config commands read/update `~/.gitday-config.json` or environment variable.

##### Architectural Patterns & Principles
- Modular Design: each responsibility (git access, filtering, prompting, AI integration, I/O) lives in its own module.
- Single-Process, Event-Driven CLI: the whole workflow executes sequentially within one Bun/Node process.
- External Service Integration: clear boundary between local (git, file system) and remote (Gemini API).
- Configuration Abstraction: Config Manager hides file vs. env-var storage.

##### Key Technologies & Frameworks
- Language & Runtime: TypeScript on Bun
- Git: local binary invoked via child process
- AI: Google Gemini API (HTTPS)
- File I/O: Node fs through Bun stdlib
- Config Storage: JSON file in user’s home directory

- Internal modules
- External systems (Git, Google Gemini, File System)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% CLI Layer
    CLI["CLI Interface"]:::internal
    CLI -->|"invoke command"| CommandDispatcher

    %% Core Application Process
    subgraph "Core Application Process"
        direction TB
        CommandDispatcher["Command Dispatcher"]:::internal
        DiffCommitFetcher["Diff & Commit Fetcher"]:::internal
        NoiseFilter["Noise Filter"]:::internal
        PromptBuilder["Prompt Builder"]:::internal
        AIClient["AI Client (Google Gemini API wrapper)"]:::internal
        OutputHandler["Output Handler (Console or File Writer)"]:::internal
        ConfigManager["Config Manager"]:::internal

        CommandDispatcher -->|"1. git log/diff"| GitCLI
        GitCLI[(Local Git executable)]:::external
        GitCLI -->|"raw data"| DiffCommitFetcher
        DiffCommitFetcher -->|"parsed data"| NoiseFilter
        NoiseFilter -->|"filtered data"| PromptBuilder
        PromptBuilder -->|"prompt"| AIClient
        AIClient -->|"summary"| OutputHandler
        OutputHandler -->|"write/print"| CLI
        CommandDispatcher -->|"config operations"| ConfigManager
        ConfigManager -->|"read/write"| FileSystem
        OutputHandler -->|"file write"| FileSystem
    end

    %% External Dependencies
    FileSystem[(File System)]:::external
    AIService[(Google Gemini API)]:::external

    AIClient -->|"HTTPS request/response"| AIService

    %% Click Events
    click CLI "https://github.com/rudrodip/gitday/blob/main/src/index.ts"
    click CommandDispatcher "https://github.com/rudrodip/gitday/blob/main/src/index.ts"
    click GitCLI "https://github.com/rudrodip/gitday/blob/main/src/index.ts"
    click DiffCommitFetcher "https://github.com/rudrodip/gitday/blob/main/src/index.ts"
    click NoiseFilter "https://github.com/rudrodip/gitday/blob/main/src/index.ts"
    click PromptBuilder "https://github.com/rudrodip/gitday/blob/main/src/index.ts"
    click AIClient "https://github.com/rudrodip/gitday/blob/main/src/index.ts"
    click OutputHandler "https://github.com/rudrodip/gitday/blob/main/src/index.ts"
    click ConfigManager "https://github.com/rudrodip/gitday/blob/main/src/index.ts"

    %% Styles
    classDef internal fill:#D6EAF8,stroke:#21618C,stroke-width:1px
    classDef external fill:#FADBD8,stroke:#C0392B,stroke-width:1px,stroke-dasharray: 5 5
```
