# ikaustav/git-code-port architecture

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

- Interactive diagram: https://gitdiagram.com/ikaustav/git-code-port
- Repository: https://github.com/ikaustav/git-code-port

## Overview

Git Code Port is a browser extension that saves selected web content into user-owned GitHub repositories. Its main workflow is user-initiated capture, local suggestions and safety checks, explicit review, then a confirmed GitHub write; the side panel supports retrieval and version management. The graph follows documented behavior and available source references. Some UI routing and GitHub operation details are not fully sampled, so uncertain connections are omitted.

Main entry points: [`src/review/review.js`](https://github.com/ikaustav/git-code-port/blob/main/src/review/review.js) (Review and commit), [`src/sidepanel/sidepanel.js`](https://github.com/ikaustav/git-code-port/blob/main/src/sidepanel/sidepanel.js) (Workspace side panel), [`src/options/options.js`](https://github.com/ikaustav/git-code-port/blob/main/src/options/options.js) (Connection settings), [`src/popup/popup.js`](https://github.com/ikaustav/git-code-port/blob/main/src/popup/popup.js) (Toolbar popup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["Capture and entry"]
  node_background["Capture dispatcher<br/>[service-worker.js]"]
  node_capture_logic["Selection capture<br/>[capture.js]"]
  node_popup["Toolbar popup<br/>[popup.js]"]
end

subgraph group_prepare["Classification and review"]
  node_review["Review and commit<br/>[review.js]"]
  node_classifier["Content classifier<br/>[classify.js]"]
  node_categories["Category formats<br/>[categories.js]"]
  node_languages["Language detection<br/>[languages.js]"]
  node_filename["Filename and folders<br/>[filename.js]"]
  node_validation["Destination validation<br/>[validation.js]"]
  node_secret_scan["Secret scanning<br/>[secret-scan.js]"]
end

subgraph group_github["GitHub persistence"]
  node_github_client["GitHub API client<br/>[api.js]"]
  node_github[("GitHub repositories")]
  node_settings[("Settings and token<br/>[settings.js]")]
  node_options["Connection settings<br/>[options.js]"]
end

subgraph group_workspace["History and workspace"]
  node_history_index[("Capture index<br/>[index.js]")]
  node_sidepanel["Workspace side panel<br/>[sidepanel.js]"]
  node_explore["Explore view<br/>[explore.js]"]
  node_history_diff["Version diff<br/>[diff.js]"]
  node_diff_view["Diff display<br/>[diff-view.js]"]
  node_history_ui["History rendering<br/>[history.js]"]
  node_theme["Theme<br/>[theme.js]"]
end

node_user(("User"))

node_user -->|"initiates capture"| node_background
node_background -->|"dispatches capture"| node_capture_logic
node_user -->|"opens popup"| node_popup
node_user -->|"confirms capture"| node_review
node_review -->|"requests suggestions"| node_classifier
node_classifier -->|"uses categories"| node_categories
node_classifier -->|"detects language"| node_languages
node_classifier -->|"suggests path"| node_filename
node_classifier -->|"sanitizes names"| node_validation
node_review -->|"builds metadata"| node_filename
node_review -->|"scans content"| node_secret_scan
node_review -->|"validates destination"| node_validation
node_review -->|"reads preferences"| node_settings
node_review -->|"records capture"| node_history_index
node_review -->|"performs confirmed writes"| node_github_client
node_github_client -->|"calls Contents API"| node_github
node_options -->|"manages token"| node_settings
node_options -->|"verifies connection"| node_github_client
node_options -->|"clears history"| node_history_index
node_sidepanel -->|"loads preferences"| node_settings
node_sidepanel -->|"retrieves versions"| node_github_client
node_sidepanel -->|"searches captures"| node_history_index
node_sidepanel -->|"uses explore view"| node_explore
node_sidepanel -->|"renders comparisons"| node_diff_view
node_sidepanel -->|"records restores"| node_history_index
node_diff_view -->|"computes differences"| node_history_diff
node_popup -->|"loads preferences"| node_settings
node_popup -->|"loads recent captures"| node_history_index
node_popup -->|"renders history"| node_history_ui
node_options -->|"renders history"| node_history_ui
node_popup -->|"applies theme"| node_theme
node_options -->|"applies theme"| node_theme

click node_background "https://github.com/ikaustav/git-code-port/blob/main/src/background/service-worker.js"
click node_capture_logic "https://github.com/ikaustav/git-code-port/blob/main/src/capture/capture.js"
click node_popup "https://github.com/ikaustav/git-code-port/blob/main/src/popup/popup.js"
click node_review "https://github.com/ikaustav/git-code-port/blob/main/src/review/review.js"
click node_classifier "https://github.com/ikaustav/git-code-port/blob/main/src/classifier/classify.js"
click node_categories "https://github.com/ikaustav/git-code-port/blob/main/src/classifier/categories.js"
click node_languages "https://github.com/ikaustav/git-code-port/blob/main/src/processing/languages.js"
click node_filename "https://github.com/ikaustav/git-code-port/blob/main/src/processing/filename.js"
click node_validation "https://github.com/ikaustav/git-code-port/blob/main/src/utils/validation.js"
click node_secret_scan "https://github.com/ikaustav/git-code-port/blob/main/src/processing/secret-scan.js"
click node_github_client "https://github.com/ikaustav/git-code-port/blob/main/src/github/api.js"
click node_settings "https://github.com/ikaustav/git-code-port/blob/main/src/storage/settings.js"
click node_options "https://github.com/ikaustav/git-code-port/blob/main/src/options/options.js"
click node_history_index "https://github.com/ikaustav/git-code-port/blob/main/src/history/index.js"
click node_sidepanel "https://github.com/ikaustav/git-code-port/blob/main/src/sidepanel/sidepanel.js"
click node_explore "https://github.com/ikaustav/git-code-port/blob/main/src/sidepanel/explore.js"
click node_history_diff "https://github.com/ikaustav/git-code-port/blob/main/src/history/diff.js"
click node_diff_view "https://github.com/ikaustav/git-code-port/blob/main/src/ui/diff-view.js"
click node_history_ui "https://github.com/ikaustav/git-code-port/blob/main/src/ui/history.js"
click node_theme "https://github.com/ikaustav/git-code-port/blob/main/src/ui/theme.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_background,node_capture_logic,node_popup,node_user toneBlue
class node_review,node_classifier,node_categories,node_languages,node_filename,node_validation,node_secret_scan toneAmber
class node_github_client,node_github,node_settings,node_options toneMint
class node_history_index,node_sidepanel,node_explore,node_history_diff,node_diff_view,node_history_ui,node_theme toneRose
```

## Components

### Capture and entry

- [Capture dispatcher](https://github.com/ikaustav/git-code-port/blob/main/src/background/service-worker.js): `src/background/service-worker.js`
- [Selection capture](https://github.com/ikaustav/git-code-port/blob/main/src/capture/capture.js): `src/capture/capture.js`
- [Toolbar popup](https://github.com/ikaustav/git-code-port/blob/main/src/popup/popup.js): `src/popup/popup.js`

### Classification and review

- [Review and commit](https://github.com/ikaustav/git-code-port/blob/main/src/review/review.js): `src/review/review.js`
- [Content classifier](https://github.com/ikaustav/git-code-port/blob/main/src/classifier/classify.js): `src/classifier/classify.js`
- [Category formats](https://github.com/ikaustav/git-code-port/blob/main/src/classifier/categories.js): `src/classifier/categories.js`
- [Language detection](https://github.com/ikaustav/git-code-port/blob/main/src/processing/languages.js): `src/processing/languages.js`
- [Filename and folders](https://github.com/ikaustav/git-code-port/blob/main/src/processing/filename.js): `src/processing/filename.js`
- [Destination validation](https://github.com/ikaustav/git-code-port/blob/main/src/utils/validation.js): `src/utils/validation.js`
- [Secret scanning](https://github.com/ikaustav/git-code-port/blob/main/src/processing/secret-scan.js): `src/processing/secret-scan.js`

### GitHub persistence

- [GitHub API client](https://github.com/ikaustav/git-code-port/blob/main/src/github/api.js): `src/github/api.js`
- **GitHub repositories**
- [Settings and token](https://github.com/ikaustav/git-code-port/blob/main/src/storage/settings.js): `src/storage/settings.js`
- [Connection settings](https://github.com/ikaustav/git-code-port/blob/main/src/options/options.js): `src/options/options.js`

### History and workspace

- [Capture index](https://github.com/ikaustav/git-code-port/blob/main/src/history/index.js): `src/history/index.js`
- [Workspace side panel](https://github.com/ikaustav/git-code-port/blob/main/src/sidepanel/sidepanel.js): `src/sidepanel/sidepanel.js`
- [Explore view](https://github.com/ikaustav/git-code-port/blob/main/src/sidepanel/explore.js): `src/sidepanel/explore.js`
- [Version diff](https://github.com/ikaustav/git-code-port/blob/main/src/history/diff.js): `src/history/diff.js`
- [Diff display](https://github.com/ikaustav/git-code-port/blob/main/src/ui/diff-view.js): `src/ui/diff-view.js`
- [History rendering](https://github.com/ikaustav/git-code-port/blob/main/src/ui/history.js): `src/ui/history.js`
- [Theme](https://github.com/ikaustav/git-code-port/blob/main/src/ui/theme.js): `src/ui/theme.js`

### Other components

- **User**

## Connections

- User → Capture dispatcher: initiates capture (evidence: `README.md`)
- Capture dispatcher → Selection capture: dispatches capture (evidence: `src/background/service-worker.js`)
- User → Toolbar popup: opens popup (evidence: `README.md`)
- User → Review and commit: confirms capture (evidence: `README.md`)
- Review and commit → Content classifier: requests suggestions (evidence: `src/review/review.js`)
- Content classifier → Category formats: uses categories (evidence: `src/classifier/classify.js`)
- Content classifier → Language detection: detects language (evidence: `src/classifier/classify.js`)
- Content classifier → Filename and folders: suggests path (evidence: `src/classifier/classify.js`)
- Content classifier → Destination validation: sanitizes names (evidence: `src/classifier/classify.js`)
- Review and commit → Filename and folders: builds metadata (evidence: `src/review/review.js`)
- Review and commit → Secret scanning: scans content (evidence: `src/review/review.js`)
- Review and commit → Destination validation: validates destination (evidence: `src/review/review.js`)
- Review and commit → Settings and token: reads preferences (evidence: `src/review/review.js`)
- Review and commit → Capture index: records capture (evidence: `src/review/review.js`)
- Review and commit → GitHub API client: performs confirmed writes (evidence: `src/review/review.js`)
- GitHub API client → GitHub repositories: calls Contents API (evidence: `src/github/api.js`)
- Connection settings → Settings and token: manages token (evidence: `src/options/options.js`)
- Connection settings → GitHub API client: verifies connection (evidence: `src/options/options.js`)
- Connection settings → Capture index: clears history (evidence: `src/options/options.js`)
- Workspace side panel → Settings and token: loads preferences (evidence: `src/sidepanel/sidepanel.js`)
- Workspace side panel → GitHub API client: retrieves versions (evidence: `src/sidepanel/sidepanel.js`)
- Workspace side panel → Capture index: searches captures (evidence: `src/sidepanel/sidepanel.js`)
- Workspace side panel → Explore view: uses explore view (evidence: `src/sidepanel/sidepanel.js`)
- Workspace side panel → Diff display: renders comparisons (evidence: `src/sidepanel/sidepanel.js`)
- Workspace side panel → Capture index: records restores (evidence: `README.md`)
- Diff display → Version diff: computes differences (evidence: `src/ui/diff-view.js`)
- Toolbar popup → Settings and token: loads preferences (evidence: `src/popup/popup.js`)
- Toolbar popup → Capture index: loads recent captures (evidence: `src/popup/popup.js`)
- Toolbar popup → History rendering: renders history (evidence: `src/popup/popup.js`)
- Connection settings → History rendering: renders history (evidence: `src/options/options.js`)
- Toolbar popup → Theme: applies theme (evidence: `src/popup/popup.js`)
- Connection settings → Theme: applies theme (evidence: `src/options/options.js`)
