# zombie/blind-reviews architecture

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

- Interactive diagram: https://gitdiagram.com/zombie/blind-reviews
- Repository: https://github.com/zombie/blind-reviews

## Overview

##### Project type and purpose
- This is a cross-browser extension (“Blind Code Reviews”) whose goal is to redact or hide author names on code-review pages (GitHub and Bugzilla).

##### File structure
Top-level artifacts:
- manifest.json – WebExtension manifest that wires everything together
- package.json, .travis.yml – build/test configuration
- github/ & bugzilla/ – site-specific content scripts and CSS
- debug.html, debug.js – local debugging harness for the extension
- test/ – automated tests (e.g., test/github-public.js)

Patterns and choices:
- Modular content scripts per host site (GitHub vs. Bugzilla)
- Shared JS (“common.js”) and per-site styles (“blind.css”)
- Debug harness running the same JS in an isolated page
- Standard WebExtension architecture (manifest → content/background scripts → resources)

##### README for additional insights
- Confirms it’s a browser extension to redact review authors
- Build steps: npm install, npm test

a. Main components:
1. Browser (host environment)
2. WebExtension Manifest
3. Content Scripts – GitHub module & Bugzilla module
4. Shared Libraries – common.js, request.js, reviewboard.js, show_bug.js, splinter.js
5. CSS Assets – blind.css per site
7. Background or Debug Harness – debug.html & debug.js (local dev)
8. Test Runner – Node.js + test/github-public.js
9. CI Pipeline – .travis.yml

b. Relationships and interactions:
- The browser loads manifest.json → registers content scripts for matching URLs
- On page load (GitHub or Bugzilla), the corresponding content script is injected
- Content script loads its blind.css and common.js modules, then calls site-specific JS to redact author names
- debug.html loads the same JS/CSS modules in a standalone context for interactive debugging
- Tests invoke the JS modules headlessly (Node + JSDOM or similar) to validate redaction logic
- CI (.travis.yml) runs npm test on every commit

c. Architectural patterns and design principles:
- Modular content scripts: one directory per target site
- Shared code extracted into common.js
- Separation of concerns: CSS for styling/redaction, JS for DOM manipulation and logic
- Standard WebExtension API usage (manifest → content/background → messaging if needed)
- Test-first approach with automated CI

d. Key technologies/frameworks:
- WebExtension Manifest v2/v3 API
- Vanilla JavaScript (ES modules, common.js)
- CSS for runtime redaction
- Node.js + Mocha or Jest for tests
- Travis CI for continuous integration

## Diagram (Mermaid)

```mermaid
flowchart TB
    Browser["Browser / Host Pages"]:::host

    Manifest["WebExtension Manifest\n(manifest.json)"]:::runtime
    click Manifest "https://github.com/zombie/blind-reviews/blob/master/manifest.json"

    subgraph "Content Scripts"
        direction TB
        GitHubModule["GitHub Module"]:::runtime
        click GitHubModule "https://github.com/zombie/blind-reviews/tree/master/github/"
        GitHubCommon["GitHub Shared JS\n(common.js)"]:::runtime
        click GitHubCommon "https://github.com/zombie/blind-reviews/blob/master/github/common.js"
        GitHubCSS["GitHub CSS\n(blind.css)"]:::assets
        click GitHubCSS "https://github.com/zombie/blind-reviews/blob/master/github/blind.css"

        BugzillaModule["Bugzilla Module"]:::runtime
        click BugzillaModule "https://github.com/zombie/blind-reviews/tree/master/bugzilla/"
        BugzillaCommon["Bugzilla Shared JS\n(common.js)"]:::runtime
        click BugzillaCommon "https://github.com/zombie/blind-reviews/blob/master/bugzilla/common.js"
        BugzillaRequest["request.js"]:::runtime
        click BugzillaRequest "https://github.com/zombie/blind-reviews/blob/master/bugzilla/request.js"
        BugzillaReview["reviewboard.js"]:::runtime
        click BugzillaReview "https://github.com/zombie/blind-reviews/blob/master/bugzilla/reviewboard.js"
        BugzillaShow["show_bug.js"]:::runtime
        click BugzillaShow "https://github.com/zombie/blind-reviews/blob/master/bugzilla/show_bug.js"
        BugzillaSplinter["splinter.js"]:::runtime
        click BugzillaSplinter "https://github.com/zombie/blind-reviews/blob/master/bugzilla/splinter.js"
        BugzillaMyDash["mydashboard.js"]:::runtime
        click BugzillaMyDash "https://github.com/zombie/blind-reviews/blob/master/bugzilla/mydashboard.js"
        BugzillaCSS["Bugzilla CSS\n(blind.css)"]:::assets
        click BugzillaCSS "https://github.com/zombie/blind-reviews/blob/master/bugzilla/blind.css"
    end

    subgraph "Resources (Icons)" 
        direction TB
        IconPNG1["black.png"]:::assets
        click IconPNG1 "https://github.com/zombie/blind-reviews/tree/master/Resources/PNG/black"
        IconPNG2["primary-squared.png"]:::assets
        click IconPNG2 "https://github.com/zombie/blind-reviews/tree/master/Resources/PNG/primary-squared"
        IconPNG3["primary.png"]:::assets
        click IconPNG3 "https://github.com/zombie/blind-reviews/tree/master/Resources/PNG/primary"
        IconPNG4["white.png"]:::assets
        click IconPNG4 "https://github.com/zombie/blind-reviews/tree/master/Resources/PNG/white"
        IconSVG["SVG Icons"]:::assets
        click IconSVG "https://github.com/zombie/blind-reviews/tree/master/Resources/SVG"
    end

    subgraph "Debug Harness"
        direction TB
        DebugHTML["debug.html"]:::runtime
        click DebugHTML "https://github.com/zombie/blind-reviews/blob/master/debug.html"
        DebugJS["debug.js"]:::runtime
        click DebugJS "https://github.com/zombie/blind-reviews/blob/master/debug.js"
    end

    subgraph "Test & CI"
        direction TB
        PackageJSON["package.json\n/npm scripts"]:::runtime
        click PackageJSON "https://github.com/zombie/blind-reviews/blob/master/package.json"
        JSConfig["jsconfig.json"]:::runtime
        click JSConfig "https://github.com/zombie/blind-reviews/blob/master/jsconfig.json"
        TestRunner["Test Runner\n(test/github-public.js)"]:::test
        click TestRunner "https://github.com/zombie/blind-reviews/blob/master/test/github-public.js"
        CI["Continuous Integration\n(.travis.yml)"]:::test
        click CI "https://github.com/zombie/blind-reviews/blob/master/.travis.yml"
    end

    Browser --> Manifest
    Manifest --> GitHubModule
    Manifest --> BugzillaModule
    Manifest --> IconPNG1
    Manifest --> IconPNG2
    Manifest --> IconPNG3
    Manifest --> IconPNG4
    Manifest --> IconSVG
    Manifest --> DebugHTML
    Manifest --> PackageJSON

    GitHubModule --> GitHubCommon
    GitHubModule --> GitHubCSS
    BugzillaModule --> BugzillaCommon
    BugzillaModule --> BugzillaRequest
    BugzillaModule --> BugzillaReview
    BugzillaModule --> BugzillaShow
    BugzillaModule --> BugzillaSplinter
    BugzillaModule --> BugzillaMyDash
    BugzillaModule --> BugzillaCSS

    GitHubModule --> Browser
    BugzillaModule --> Browser

    DebugHTML --> DebugJS
    DebugHTML --> GitHubCommon
    DebugHTML --> BugzillaCommon
    DebugHTML --> GitHubCSS
    DebugHTML --> BugzillaCSS

    TestRunner --> GitHubCommon
    TestRunner --> BugzillaCommon
    TestRunner --> GitHubCSS
    TestRunner --> BugzillaCSS

    CI --> TestRunner
    CI --> PackageJSON

    classDef host fill:#e0f7fa,stroke:#006064,color:#004d40
    classDef runtime fill:#e8f5e9,stroke:#1b5e20,color:#2e7d32
    classDef assets fill:#fff3e0,stroke:#e65100,color:#bf360c
    classDef test fill:#f3e5f5,stroke:#6a1b9a,color:#4a148c
```
