# bugsterapp/bugster-cli architecture

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

- Interactive diagram: https://gitdiagram.com/bugsterapp/bugster-cli
- Repository: https://github.com/bugsterapp/bugster-cli

## Overview

##### Project type and purpose
- This is a Python-based command-line interface (“Bugster CLI”) that analyzes local projects, detects frameworks, gathers Git metadata, and communicates with the Bugster backend (via REST/WebSocket) to report or retrieve information.
- The README confirms it’s a CLI tool intended for installation via script or pip, having commands like “analyze”, “login”, “init”, etc.

##### File structure
- Top-level files/directories:
- bugster/           ← main package
- scripts/           ← helper install/build scripts
- .github/workflows  ← CI/CD pipelines
- setup.py, pyproject.toml, requirements.txt ← packaging/config
- Inside bugster/:
- cli.py             ← entrypoint defining CLI interface
- commands/          ← command handlers (analyze, login, init, test, middleware)
- analyzer/          ← core analysis engine, subdivided into framework_detector & app_analyzer
- clients/           ← modules for communicating with external services (mcp_client, ws_client)
- libs/              ← internal services (test_cases_service), settings, enums, errors
- utils/             ← file I/O, Git info, user config helpers
- constants.py, types.py ← shared definitions

##### README for additional insights
- “bugster analyze” presumably invokes analyzer → clients → remote API.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Main Flow
    A["User Terminal"]:::external
    A -->|"bugster analyze"| B["CLI Entrypoint\n(bugster/cli.py)"]:::local
    B --> C["Command Dispatcher\n(bugster/commands/*.py)"]:::local

    subgraph "Command Handlers" 
        direction TB
        C1["Analyze Command\n(bugster/commands/analyze.py)"]:::local
        C2["Login Command\n(bugster/commands/login.py)"]:::local
        C3["Init Command\n(bugster/commands/init.py)"]:::local
        C4["Test Command\n(bugster/commands/test.py)"]:::local
        C5["Middleware\n(bugster/commands/middleware.py)"]:::local
    end
    C --> C1
    C --> C2
    C --> C3
    C --> C4
    C --> C5

    C1 --> D["Analyzer Pipeline\n(bugster/analyzer/main.py)"]:::local

    subgraph "Analyzer Pipeline"
        direction TB
        D1["Framework Detector\n(bugster/analyzer/core/framework_detector/main.py)"]:::local
        D2["App Analyzer\n(bugster/analyzer/core/app_analyzer/main.py)"]:::local
        D3["Next.js Analyzer\n(bugster/analyzer/core/app_analyzer/next_js_analyzer.py)"]:::local
        D4["App Models\n(bugster/analyzer/core/app_analyzer/dataclasses.py)"]:::local
        D5["Tree Utility\n(bugster/analyzer/core/app_analyzer/utils/get_tree_structure.py)"]:::local
        D6["Git Metadata\n(bugster/analyzer/utils/get_git_info.py)"]:::local
        D7["Assertions\n(bugster/analyzer/utils/assert_utils.py)"]:::local
        D8["Errors\n(bugster/analyzer/utils/errors.py)"]:::local
    end
    D --> D1
    D --> D2
    D2 --> D3
    D2 --> D4
    D2 --> D5
    D --> D6
    D --> D7
    D --> D8

    D --> E["Library Services"]:::local
    subgraph "Internal Services"
        direction TB
        E1["Test Cases Service\n(bugster/libs/services/test_cases_service.py)"]:::local
        E2["Settings\n(bugster/libs/settings.py)"]:::local
        E3["Enums\n(bugster/libs/utils/enums.py)"]:::local
        E4["Errors\n(bugster/libs/utils/errors.py)"]:::local
        E5["Constants\n(bugster/constants.py)"]:::local
        E6["Types\n(bugster/types.py)"]:::local
        E7["User Config\n(bugster/utils/user_config.py)"]:::local
        E8["File Utils\n(bugster/utils/file.py)"]:::local
    end
    E --> E1
    E --> E2
    E --> E3
    E --> E4
    E --> E5
    E --> E6
    E --> E7
    E --> E8

    E --> F["Client Layer"]:::external
    subgraph "Clients"
        direction TB
        F1["MCP Client\n(bugster/clients/mcp_client.py)"]:::external
        F2["WebSocket Client\n(bugster/clients/ws_client.py)"]:::external
    end
    F --> F1
    F --> F2

    F --> G(["External Bugster Backend\n(REST/WebSocket API)"]):::external
    G -->|response| A

    %% CI/CD & Packaging
    subgraph "CI/CD & Build" 
        direction TB
        CI1[".github/workflows/ci.yml"]:::ci
        CI2[".github/workflows/release.yml"]:::ci
        S1["scripts/install.py"]:::ci
        S2["scripts/install.sh"]:::ci
        S3["scripts/install.bat"]:::ci
        S4["scripts/build.py"]:::ci
        S5["scripts/dev.py"]:::ci
        S6["scripts/update_dependencies.py"]:::ci
        P1["setup.py"]:::ci
        P2["pyproject.toml"]:::ci
        P3["requirements.txt"]:::ci
        P4["bugster.spec"]:::ci
    end

    %% Click Events
    click B "https://github.com/bugsterapp/bugster-cli/blob/main/bugster/cli.py"
    click C1 "https://github.com/bugsterapp/bugster-cli/blob/main/bugster/commands/analyze.py"
    click C2 "https://github.com/bugsterapp/bugster-cli/blob/main/bugster/commands/login.py"
    click C3 "https://github.com/bugsterapp/bugster-cli/blob/main/bugster/commands/init.py"
    click C4 "https://github.com/bugsterapp/bugster-cli/blob/main/bugster/commands/test.py"
    click C5 "https://github.com/bugsterapp/bugster-cli/blob/main/bugster/commands/middleware.py"
    click D "https://github.com/bugsterapp/bugster-cli/blob/main/bugster/analyzer/main.py"
    click D1 "https://github.com/bugsterapp/bugster-cli/blob/main/bugster/analyzer/core/framework_detector/main.py"
    click D2 "https://github.com/bugsterapp/bugster-cli/blob/main/bugster/analyzer/core/app_analyzer/main.py"
    click D3 "https://github.com/bugsterapp/bugster-cli/blob/main/bugster/analyzer/core/app_analyzer/next_js_analyzer.py"
    click D4 "https://github.com/bugsterapp/bugster-cli/blob/main/bugster/analyzer/core/app_analyzer/dataclasses.py"
    click D5 "https://github.com/bugsterapp/bugster-cli/blob/main/bugster/analyzer/core/app_analyzer/utils/get_tree_structure.py"
    click D6 "https://github.com/bugsterapp/bugster-cli/blob/main/bugster/analyzer/utils/get_git_info.py"
    click D7 "https://github.com/bugsterapp/bugster-cli/blob/main/bugster/analyzer/utils/assert_utils.py"
    click D8 "https://github.com/bugsterapp/bugster-cli/blob/main/bugster/analyzer/utils/errors.py"
    click E1 "https://github.com/bugsterapp/bugster-cli/blob/main/bugster/libs/services/test_cases_service.py"
    click E2 "https://github.com/bugsterapp/bugster-cli/blob/main/bugster/libs/settings.py"
    click E3 "https://github.com/bugsterapp/bugster-cli/blob/main/bugster/libs/utils/enums.py"
    click E4 "https://github.com/bugsterapp/bugster-cli/blob/main/bugster/libs/utils/errors.py"
    click E5 "https://github.com/bugsterapp/bugster-cli/blob/main/bugster/constants.py"
    click E6 "https://github.com/bugsterapp/bugster-cli/blob/main/bugster/types.py"
    click E7 "https://github.com/bugsterapp/bugster-cli/blob/main/bugster/utils/user_config.py"
    click E8 "https://github.com/bugsterapp/bugster-cli/blob/main/bugster/utils/file.py"
    click F1 "https://github.com/bugsterapp/bugster-cli/blob/main/bugster/clients/mcp_client.py"
    click F2 "https://github.com/bugsterapp/bugster-cli/blob/main/bugster/clients/ws_client.py"
    click CI1 "https://github.com/bugsterapp/bugster-cli/blob/main/.github/workflows/ci.yml"
    click CI2 "https://github.com/bugsterapp/bugster-cli/blob/main/.github/workflows/release.yml"
    click S1 "https://github.com/bugsterapp/bugster-cli/blob/main/scripts/install.py"
    click S2 "https://github.com/bugsterapp/bugster-cli/blob/main/scripts/install.sh"
    click S3 "https://github.com/bugsterapp/bugster-cli/blob/main/scripts/install.bat"
    click S4 "https://github.com/bugsterapp/bugster-cli/blob/main/scripts/build.py"
    click S5 "https://github.com/bugsterapp/bugster-cli/blob/main/scripts/dev.py"
    click S6 "https://github.com/bugsterapp/bugster-cli/blob/main/scripts/update_dependencies.py"
    click P1 "https://github.com/bugsterapp/bugster-cli/blob/main/setup.py"
    click P2 "https://github.com/bugsterapp/bugster-cli/blob/main/pyproject.toml"
    click P3 "https://github.com/bugsterapp/bugster-cli/blob/main/requirements.txt"
    click P4 "https://github.com/bugsterapp/bugster-cli/blob/main/bugster.spec"

    %% Styles
    classDef local fill:#9f6,stroke:#333,stroke-width:1px
    classDef external fill:#6cf,stroke:#333,stroke-width:1px
    classDef ci fill:#ccc,stroke:#333,stroke-width:1px
```
