# nightlessbaron/rebibemecode architecture

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

- Interactive diagram: https://gitdiagram.com/nightlessbaron/rebibemecode
- Repository: https://github.com/nightlessbaron/rebibemecode

## Overview

##### Project type and purpose
- This is a full-stack Python web application (Flask) with an integrated AI-powered CLI component.
- Purpose: Provide a web UI and CLI for automatically analyzing and migrating legacy code repositories into a modern codebase using an AI model (Claude Sonnet 4.5) wrapped by the Cursor CLI.

##### File structure
- Top-level:
- app.py / main.py – Flask app and CLI entry point
- requirements.txt – dependencies
- templates/ – Jinja2 HTML templates for index and results pages
- classes/ – core Python modules:
– revive_agent.py: encapsulates Cursor CLI calls
– utils.py: setup and orchestration utilities
– clean_logger.py: parsing/formatting streaming output
- tests/ – unit tests (e.g., streaming)
- docs/ – architecture and usage guides
- .cursor/cli.json – Cursor CLI configuration
- assets/ – demo video and images
- No traditional database; observability via Weights & Biases / Weave.

##### Key insights from the README
- Architecture described as:
1. Flask Web App (Index, Results, API Endpoints)
2. ReviveAgent (Cursor CLI wrapper)
3. Claude Sonnet 4.5 (AI service)
4. Work Directory (r_base, r_old, scripts, summaries)
- Uses Server-Sent Events for live streaming.
- Integrates with W&B Weave for tracing/metrics.
- Git operations, conda environment management, and diff viewer.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend (Browser/UI)" 
        UI["Index Page"]:::frontend
        Results["Results Page"]:::frontend
        Assets["Demo Video/Images"]:::frontend
        Browser["Web Browser"]:::frontend
        UI -->|"Served as HTML"| Browser
        Results -->|"Served as HTML"| Browser
        Assets -->|"Static content"| Browser
        Browser -->|"HTTP POST /submit (JSON)"| Flask
        Browser -->|"SSE /stream"| SSE
    end

    %% Backend Layer
    subgraph "Backend"
        subgraph "HTTP/API Layer"
            Flask["app.py"]:::logic
            SSE["/stream Endpoint"]:::logic
        end
        subgraph "Orchestration Layer"
            Utils["classes/utils.py"]:::logic
            Agent["classes/revive_agent.py"]:::logic
            Logger["classes/clean_logger.py"]:::logic
        end
        subgraph "External Integrations"
            CursorConfig[".cursor/cli.json"]:::external
            CLItool["Cursor CLI"]:::external
            AI["Claude Sonnet 4.5"]:::external
            WAndB["W&B Weave API"]:::external
            Git["Git & Conda"]:::external
        end
        subgraph "Workspace & Filesystem"
            WorkDir["Work Directory"]:::storage
            Scripts["Shell Scripts"]:::storage
            Repos["r_base / r_old Repos"]:::storage
        end

        Flask -->|"calls"| Utils
        Flask -->|"streams via"| SSE
        Utils -->|"invoke"| Agent
        Agent -->|"exec Shell"| CLItool
        Agent -->|"parse output"| Logger
        CLItool -->|"reads config"| CursorConfig
        CLItool -->|"calls API"| AI
        Agent -->|"emit metrics"| WAndB
        Agent -->|"git operations"| Git
        Agent -->|"manage workspace"| WorkDir
        WorkDir --> Scripts
        WorkDir --> Repos
    end

    %% CLI Entrypoint
    main["main.py"]:::logic
    main -->|"CLI commands"| Utils

    %% Development Artifacts
    subgraph "Dev Artifacts"
        TestStream["tests/test_streaming.py"]:::storage
        TestAgent["classes/simple_revive_agent_test.py"]:::storage
        STREAMING["docs/STREAMING_GUIDE.md"]:::storage
        WEBIF["docs/WEB_INTERFACE_README.md"]:::storage
        WEAVE["docs/weave.md"]:::storage
        INSTALL["docs/install.md"]:::storage
        DAYTONA["docs/daytona.md"]:::storage
        LOGO["docs/logo.md"]:::storage
        Requirements["requirements.txt"]:::storage
        README["README.md"]:::storage
    end

    %% Connections for tests
    TestStream --> Agent
    TestAgent --> Agent

    %% Click Events
    click UI "https://github.com/nightlessbaron/rebibemecode/blob/main/templates/index.html"
    click Results "https://github.com/nightlessbaron/rebibemecode/blob/main/templates/results.html"
    click Assets "https://github.com/nightlessbaron/rebibemecode/blob/main/assets/demo_webhack.mp4"
    click Flask "https://github.com/nightlessbaron/rebibemecode/blob/main/app.py"
    click SSE "https://github.com/nightlessbaron/rebibemecode/blob/main/."
    click Utils "https://github.com/nightlessbaron/rebibemecode/blob/main/classes/utils.py"
    click Agent "https://github.com/nightlessbaron/rebibemecode/blob/main/classes/revive_agent.py"
    click Logger "https://github.com/nightlessbaron/rebibemecode/blob/main/classes/clean_logger.py"
    click CursorConfig "https://github.com/nightlessbaron/rebibemecode/blob/main/.cursor/cli.json"
    click main "https://github.com/nightlessbaron/rebibemecode/blob/main/main.py"
    click TestStream "https://github.com/nightlessbaron/rebibemecode/blob/main/tests/test_streaming.py"
    click TestAgent "https://github.com/nightlessbaron/rebibemecode/blob/main/classes/simple_revive_agent_test.py"
    click STREAMING "https://github.com/nightlessbaron/rebibemecode/blob/main/docs/STREAMING_GUIDE.md"
    click WEBIF "https://github.com/nightlessbaron/rebibemecode/blob/main/docs/WEB_INTERFACE_README.md"
    click WEAVE "https://github.com/nightlessbaron/rebibemecode/blob/main/docs/weave.md"
    click INSTALL "https://github.com/nightlessbaron/rebibemecode/blob/main/docs/install.md"
    click DAYTONA "https://github.com/nightlessbaron/rebibemecode/blob/main/docs/daytona.md"
    click LOGO "https://github.com/nightlessbaron/rebibemecode/blob/main/docs/logo.md"
    click Requirements "https://github.com/nightlessbaron/rebibemecode/blob/main/requirements.txt"
    click README "https://github.com/nightlessbaron/rebibemecode/blob/main/README.md"

    %% Styles
    classDef frontend fill:#AEDFF7,stroke:#036,stroke-width:1px;
    classDef logic fill:#C6F6C6,stroke:#062,stroke-width:1px;
    classDef external fill:#FFDDA0,stroke:#A65D00,stroke-width:1px;
    classDef storage fill:#E0E0E0,stroke:#444,stroke-width:1px;
```
