# adomorn/github-enhancer architecture

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

- Interactive diagram: https://gitdiagram.com/adomorn/github-enhancer
- Repository: https://github.com/adomorn/github-enhancer

## Overview

GitHub Enhancer is a private, token-free Chrome extension workbench for collecting and revisiting investigation context on GitHub. Users open the toolbar popup or in-page panel, which mounts shared tools against the current GitHub page: save pages, collect code, manage workspaces, search conversations, prepare reply drafts, and track private PR review notes and marks. Page-specific tools read loaded GitHub content and perform narrow actions; shared messaging routes durable mutations through the background worker to local storage. Settings and portable backup import/export are a separate options flow. Several feature modules are documented but their internal wiring is not sampled, so those links are limited to supported entry points.

Main entry points: [`src/shared/ui.js`](https://github.com/adomorn/github-enhancer/blob/develop/src/shared/ui.js) (Shared workbench UI), [`src/content/main.js`](https://github.com/adomorn/github-enhancer/blob/develop/src/content/main.js) (Page lifecycle), [`src/popup/popup.js`](https://github.com/adomorn/github-enhancer/blob/develop/src/popup/popup.js) (Toolbar workbench), [`src/shared/client.js`](https://github.com/adomorn/github-enhancer/blob/develop/src/shared/client.js) (Message and draft client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_surfaces["Extension surfaces"]
  node_popup["Toolbar workbench<br/>[popup.js]"]
  node_panel["In-page workbench<br/>[panel.js]"]
  node_options["Settings and backups<br/>[options.js]"]
end

subgraph group_page["GitHub page tools"]
  node_content["Page lifecycle<br/>[main.js]"]
  node_reading["Reading preferences<br/>[reading.js]"]
  node_reviewpage["Loaded diff adapter<br/>[review-tools.js]"]
end

subgraph group_features["Investigation features"]
  node_workbench["Shared workbench UI<br/>[ui.js]"]
  node_basket["Code basket<br/>[basket.js]"]
  node_workspaces["Workspaces<br/>[workspaces.js]"]
  node_conversation["Conversation navigator<br/>[conversation.js]"]
  node_composer["Reply drafts<br/>[composer.js]"]
  node_review["Private PR review<br/>[review.js]"]
  node_readingfeature["Reading controls<br/>[review.js]"]
end

subgraph group_state["Local state"]
  node_client["Message and draft client<br/>[client.js]"]
  node_worker["Message boundary<br/>[service-worker.js]"]
  node_store["State operations<br/>[store.js]"]
  node_storage[("Browser storage<br/>[store.js]")]
  node_model["Data rules<br/>[model.js]"]
end

node_person(("GitHub user"))
node_github["GitHub page"]
node_chrome["Chrome APIs"]

node_person -->|"opens"| node_popup
node_person -->|"opens"| node_panel
node_person -->|"configures"| node_options
node_popup -->|"queries tab"| node_chrome
node_popup -->|"requests page data"| node_content
node_panel -->|"exchanges context"| node_content
node_content -->|"reads page"| node_github
node_content -->|"applies preferences"| node_reading
node_content -->|"collects diff data"| node_reviewpage
node_reviewpage -->|"reads loaded diffs"| node_github
node_popup -->|"mounts"| node_workbench
node_panel -->|"mounts"| node_workbench
node_workbench -->|"uses"| node_basket
node_workbench -->|"uses"| node_workspaces
node_workbench -->|"uses"| node_conversation
node_workbench -->|"uses"| node_composer
node_workbench -->|"uses"| node_review
node_workbench -.->|"uses"| node_readingfeature
node_workbench -->|"requests state"| node_client
node_options -->|"requests state"| node_client
node_client -->|"sends messages"| node_worker
node_worker -->|"dispatches"| node_store
node_store -->|"validates state"| node_model
node_store -->|"reads and writes"| node_storage
node_client -->|"stores drafts"| node_chrome
node_options -->|"imports and exports"| node_model

click node_popup "https://github.com/adomorn/github-enhancer/blob/develop/src/popup/popup.js"
click node_panel "https://github.com/adomorn/github-enhancer/blob/develop/src/panel/panel.js"
click node_options "https://github.com/adomorn/github-enhancer/blob/develop/src/options/options.js"
click node_content "https://github.com/adomorn/github-enhancer/blob/develop/src/content/main.js"
click node_reading "https://github.com/adomorn/github-enhancer/blob/develop/src/content/reading.js"
click node_reviewpage "https://github.com/adomorn/github-enhancer/blob/develop/src/content/review-tools.js"
click node_client "https://github.com/adomorn/github-enhancer/blob/develop/src/shared/client.js"
click node_worker "https://github.com/adomorn/github-enhancer/blob/develop/src/background/service-worker.js"
click node_store "https://github.com/adomorn/github-enhancer/blob/develop/src/background/store.js"
click node_storage "https://github.com/adomorn/github-enhancer/blob/develop/src/background/store.js"
click node_model "https://github.com/adomorn/github-enhancer/blob/develop/src/shared/model.js"
click node_workbench "https://github.com/adomorn/github-enhancer/blob/develop/src/shared/ui.js"
click node_basket "https://github.com/adomorn/github-enhancer/blob/develop/src/shared/basket.js"
click node_workspaces "https://github.com/adomorn/github-enhancer/blob/develop/src/shared/workspaces.js"
click node_conversation "https://github.com/adomorn/github-enhancer/blob/develop/src/shared/conversation.js"
click node_composer "https://github.com/adomorn/github-enhancer/blob/develop/src/shared/composer.js"
click node_review "https://github.com/adomorn/github-enhancer/blob/develop/src/shared/review.js"
click node_readingfeature "https://github.com/adomorn/github-enhancer/blob/develop/src/shared/review.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_popup,node_panel,node_options,node_person toneBlue
class node_content,node_reading,node_reviewpage toneAmber
class node_workbench,node_basket,node_workspaces,node_conversation,node_composer,node_review,node_readingfeature,node_chrome toneMint
class node_client,node_worker,node_store,node_storage,node_model toneRose
class node_github toneIndigo
```

## Components

### Extension surfaces

- [Toolbar workbench](https://github.com/adomorn/github-enhancer/blob/develop/src/popup/popup.js): `src/popup/popup.js`
- [In-page workbench](https://github.com/adomorn/github-enhancer/blob/develop/src/panel/panel.js): `src/panel/panel.js`
- [Settings and backups](https://github.com/adomorn/github-enhancer/blob/develop/src/options/options.js): `src/options/options.js`

### GitHub page tools

- [Page lifecycle](https://github.com/adomorn/github-enhancer/blob/develop/src/content/main.js): `src/content/main.js`
- [Reading preferences](https://github.com/adomorn/github-enhancer/blob/develop/src/content/reading.js): `src/content/reading.js`
- [Loaded diff adapter](https://github.com/adomorn/github-enhancer/blob/develop/src/content/review-tools.js): `src/content/review-tools.js`

### Investigation features

- [Shared workbench UI](https://github.com/adomorn/github-enhancer/blob/develop/src/shared/ui.js): `src/shared/ui.js`
- [Code basket](https://github.com/adomorn/github-enhancer/blob/develop/src/shared/basket.js): `src/shared/basket.js`
- [Workspaces](https://github.com/adomorn/github-enhancer/blob/develop/src/shared/workspaces.js): `src/shared/workspaces.js`
- [Conversation navigator](https://github.com/adomorn/github-enhancer/blob/develop/src/shared/conversation.js): `src/shared/conversation.js`
- [Reply drafts](https://github.com/adomorn/github-enhancer/blob/develop/src/shared/composer.js): `src/shared/composer.js`
- [Private PR review](https://github.com/adomorn/github-enhancer/blob/develop/src/shared/review.js): `src/shared/review.js`
- [Reading controls](https://github.com/adomorn/github-enhancer/blob/develop/src/shared/review.js): `src/shared/review.js`

### Local state

- [Message and draft client](https://github.com/adomorn/github-enhancer/blob/develop/src/shared/client.js): `src/shared/client.js`
- [Message boundary](https://github.com/adomorn/github-enhancer/blob/develop/src/background/service-worker.js): `src/background/service-worker.js`
- [State operations](https://github.com/adomorn/github-enhancer/blob/develop/src/background/store.js): `src/background/store.js`
- [Browser storage](https://github.com/adomorn/github-enhancer/blob/develop/src/background/store.js): `src/background/store.js`
- [Data rules](https://github.com/adomorn/github-enhancer/blob/develop/src/shared/model.js): `src/shared/model.js`

### Other components

- **GitHub user**
- **GitHub page**
- **Chrome APIs**

## Connections

- GitHub user → Toolbar workbench: opens
- GitHub user → In-page workbench: opens
- GitHub user → Settings and backups: configures
- Toolbar workbench → Chrome APIs: queries tab
- Toolbar workbench → Page lifecycle: requests page data
- In-page workbench → Page lifecycle: exchanges context
- Page lifecycle → GitHub page: reads page
- Page lifecycle → Reading preferences: applies preferences
- Page lifecycle → Loaded diff adapter: collects diff data
- Loaded diff adapter → GitHub page: reads loaded diffs
- Toolbar workbench → Shared workbench UI: mounts
- In-page workbench → Shared workbench UI: mounts
- Shared workbench UI → Code basket: uses
- Shared workbench UI → Workspaces: uses
- Shared workbench UI → Conversation navigator: uses
- Shared workbench UI → Reply drafts: uses
- Shared workbench UI → Private PR review: uses
- Shared workbench UI → Reading controls: uses
- Shared workbench UI → Message and draft client: requests state
- Settings and backups → Message and draft client: requests state
- Message and draft client → Message boundary: sends messages
- Message boundary → State operations: dispatches
- State operations → Data rules: validates state
- State operations → Browser storage: reads and writes
- Message and draft client → Chrome APIs: stores drafts
- Settings and backups → Data rules: imports and exports
