# amrhalim/github-pr-extension architecture

> Architecture diagram of the GitHub repository amrhalim/github-pr-extension, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/amrhalim/github-pr-extension
- Repository: https://github.com/amrhalim/github-pr-extension

## Overview

This is a tiny Chrome extension for clearing Viewed markers on a GitHub pull-request page. The user clicks the extension action; its popup code finds the active tab, checks that it is on GitHub, injects a page function that clicks Viewed buttons, and reports the count or an error. The popup controller and injected behavior are both implemented in popup.js. The graph follows the README and sampled popup.js; it does not infer additional behavior from the unsampled manifest or popup markup.

Main entry points: [`popup.js`](https://github.com/amrhalim/github-pr-extension/blob/main/popup.js) (Popup controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_user(("User"))
node_controller["Popup controller<br/>[popup.js]"]
node_chrome["Chrome tab APIs"]
node_unchecker["Viewed unchecker<br/>[popup.js]"]
node_github["GitHub PR page"]

node_user -->|"clicks extension"| node_controller
node_controller -->|"queries and injects"| node_chrome
node_chrome -->|"returns tab and count"| node_controller
node_controller -->|"executes function"| node_unchecker
node_unchecker -->|"clicks Viewed buttons"| node_github

click node_controller "https://github.com/amrhalim/github-pr-extension/blob/main/popup.js"
click node_unchecker "https://github.com/amrhalim/github-pr-extension/blob/main/popup.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_user,node_unchecker toneBlue
class node_controller toneTeal
class node_chrome toneMint
class node_github toneIndigo
```

## Components

### Other components

- **User**
- [Popup controller](https://github.com/amrhalim/github-pr-extension/blob/main/popup.js): `popup.js`
- **Chrome tab APIs**
- [Viewed unchecker](https://github.com/amrhalim/github-pr-extension/blob/main/popup.js): `popup.js`
- **GitHub PR page**

## Connections

- User → Popup controller: clicks extension (evidence: `README.md`)
- Popup controller → Chrome tab APIs: queries and injects (evidence: `popup.js`)
- Chrome tab APIs → Popup controller: returns tab and count (evidence: `popup.js`)
- Popup controller → Viewed unchecker: executes function (evidence: `popup.js`)
- Viewed unchecker → GitHub PR page: clicks Viewed buttons (evidence: `popup.js`)
