|
| 1 | +# GitMe Bot Workflow |
| 2 | + |
| 3 | +GitMe is an AI-powered Discord bot that provides human-readable summaries of GitHub activities. This document outlines the technical workflow and system architecture of the bot. |
| 4 | + |
| 5 | +## Core Workflow |
| 6 | + |
| 7 | +The bot follows a reactive event-driven architecture triggered by GitHub webhooks. |
| 8 | + |
| 9 | +1. **Event Trigger**: A developer performs an action on a tracked GitHub repository (Push, Pull Request, or Issue). |
| 10 | +2. **Webhook Delivery**: GitHub sends a secure HTTP POST request containing a JSON payload to the GitMe bot's `/webhook` endpoint. |
| 11 | +3. **Payload Processing**: The `webhookController` parses the request, identifies the event type, and validates the data. |
| 12 | +4. **AI Summarization (Pushes Only)**: |
| 13 | + * For commit messages, the `aiService` is invoked. |
| 14 | + * It sends the technical commit message to a local **LM Studio** instance (running a model like **Gemma**). |
| 15 | + * The LLM generates a concise, layman-friendly summary. |
| 16 | +5. **Notification Construction**: The `discordService` takes the event details (and AI summary) to create a "Rich Embed" with: |
| 17 | + * Color-coded indicators (Green for features, Red for fixes, Purple for merges). |
| 18 | + * Author information and avatars. |
| 19 | + * Direct links to the GitHub event. |
| 20 | +6. **Discord Delivery**: The notification is posted to the configured Discord channel using the **Discord.js** library. |
| 21 | + |
| 22 | +--- |
| 23 | + |
| 24 | +## System Architecture Diagram |
| 25 | + |
| 26 | +The diagram below illustrates the flow of data between GitHub, the GitMe bot, the local AI model, and Discord. |
| 27 | + |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | +--- |
| 32 | + |
| 33 | +## Component Responsibilities |
| 34 | + |
| 35 | +| Component | Responsibility | |
| 36 | +| :--- | :--- | |
| 37 | +| **`index.js`** | Application entry point; initializes Express server and routes. | |
| 38 | +| **`webhookController.js`** | Orchestrates the primary flow; handles GitHub payload parsing and logic branching. | |
| 39 | +| **`aiService.js`** | Communicates with the local LM Studio API to generate natural language summaries. | |
| 40 | +| **`discordService.js`** | Handles Discord Embed formatting and communication with the Discord API. | |
| 41 | +| **`env.js`** | Manages environment configurations (tokens, IDs, model names). | |
| 42 | + |
| 43 | +--- |
| 44 | + |
| 45 | +## Feature Comparison by Event |
| 46 | + |
| 47 | +| Event Type | AI Summary | Embed Color | Key Metadata Included | |
| 48 | +| :--- | :--- | :--- | :--- | |
| 49 | +| **Push** | ✅ Yes | Blue/Varies | Branch, Commit Hash, Author | |
| 50 | +| **Pull Request** | ❌ No | Green (Open) / Purple (Merged) | Base/Head Branches, Title | |
| 51 | +| **Issue** | ❌ No | Green (Open) / Red (Closed) | Issue Title, Body Snippet | |
0 commit comments