# drunkwcodes/bb7 architecture

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

- Interactive diagram: https://gitdiagram.com/drunkwcodes/bb7
- Repository: https://github.com/drunkwcodes/bb7

## Overview

##### Project Type and Purpose
- bb7 is a command-line based TDD coding bot that merges chat functionality with automated testing abilities. It integrates Text-to-Speech (TTS) and local Retrieval-Augmented Generation (RAG) features. Its primary purpose is to assist developers by recognizing Python project structures, running tests, and even chatting, all while leveraging external tools such as ollama and the llama3.2 model.

##### Analyzing the File Structure
- Top-level directories include:
- .github: Contains workflow configurations for continuous integration (running tests and uploading releases).
- src: Houses the core application logic under the bb7 package.
- tests: Contains unit tests, including notebook demos for evaluating RAG functionality.
- Inside src/bb7, key modules are:
- chat.py: Likely handles chatbot communications.
- cli.py: Parses and manages command-line interactions (the entry-point from pipx installation).
- .py: Scans the Python project structure to intelligently find and run tests.
- rag.py: Implements local Retrieval-Augmented Generation for document-based queries.
- write.py: Manages test-writing or output generation.
- utils.py: Contains helper functions used across modules.
- Build/configuration files (pyproject.toml, pdm.lock) indicate Python package setup, dependency management, and an organized code base.

##### Extracting Insights from the README
- The README reinforces the project’s ability to:
- Act as an interactive chat terminal with various commands (/exit, /voice, /select, etc.).
- Recognize and run tests within a Python project.
- Utilize TTS for voice conversations.
- Operate in a TDD context with strong support for iterative testing.
- Installation instructions emphasize the importance of external dependencies (ollama and the llama3.2 model).

##### Final Suggestions
- Be as detailed as possible: separate the project into its many logical components and add annotations describing their purpose and interactions.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Interface Layer
    subgraph "User Interface Layer"
        cliHandler["CLI Handler"]:::ui
        chatEngine["Chat Terminal"]:::ui
    end

    %% Internal Logic Layer
    subgraph "Internal Logic Layer"
        projectExaminer["Project Examiner"]:::logic
        ragProcessor["RAG Processor"]:::logic
        testWriter["Test Writer/TDD Engine"]:::logic
        utilities["Utility Functions"]:::logic
    end

    %% External Integration Layer
    subgraph "External Integration Layer"
        extOllama["External ollama Service (llama3.2)"]:::external
        extTTS["External TTS Service"]:::external
    end

    %% Connections from User Interface to Internal Logic
    cliHandler -->|"initiates chat"| chatEngine
    cliHandler -->|"triggers project_scan"| projectExaminer
    cliHandler -->|"activates_test_writing"| testWriter
    cliHandler -->|"requests_RAG_processing"| ragProcessor
    cliHandler -->|"activates_voice_commands"| extTTS

    %% Internal processing interactions
    chatEngine -->|"utilizes_utilities"| utilities
    testWriter -->|"uses_utilities"| utilities
    projectExaminer -->|"feeds_test_data"| testWriter

    %% External service interaction
    ragProcessor -->|"Model_Inference/RAG_Queries"| extOllama

    %% Click Events
    click cliHandler "https://github.com/drunkwcodes/bb7/blob/main/src/bb7/cli.py"
    click chatEngine "https://github.com/drunkwcodes/bb7/blob/main/src/bb7/chat.py"
    click projectExaminer "https://github.com/drunkwcodes/bb7/blob/main/src/bb7/examine.py"
    click ragProcessor "https://github.com/drunkwcodes/bb7/blob/main/src/bb7/rag.py"
    click testWriter "https://github.com/drunkwcodes/bb7/blob/main/src/bb7/write.py"
    click utilities "https://github.com/drunkwcodes/bb7/blob/main/src/bb7/utils.py"

    %% Styles
    classDef ui fill:#cce5ff,stroke:#004085,stroke-width:2px;
    classDef logic fill:#d4edda,stroke:#155724,stroke-width:2px;
    classDef external fill:#f8d7da,stroke:#721c24,stroke-width:2px;
```
