# neophack/vscode-git-graph-rs architecture

> Architecture diagram of the GitHub repository neophack/vscode-git-graph-rs, 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/neophack/vscode-git-graph-rs
- Repository: https://github.com/neophack/vscode-git-graph-rs

## Overview

Git Graph RS is a VS Code Git-history and repository-inspection extension backed by an in-process Rust read engine, with Git CLI fallback for unsupported reads and writes. The principal flow is user → extension/repository selection → backend → repository data → graph and detail views. Distinct read stages include refs/history, details and diffs, file content, search, and configuration; write actions and optional integrations branch separately. Paths and edges reflect the README and sampled source; unsampled subsystem wiring is kept broad or omitted.

Main entry points: [`native/node/src/lib.rs`](https://github.com/neophack/vscode-git-graph-rs/blob/main/native/node/src/lib.rs) (Node API Binding), [`web/main.ts`](https://github.com/neophack/vscode-git-graph-rs/blob/main/web/main.ts) (Graph Webview), [`src/dataSource.ts`](https://github.com/neophack/vscode-git-graph-rs/blob/main/src/dataSource.ts) (Data Source), [`src/extension.ts`](https://github.com/neophack/vscode-git-graph-rs/blob/main/src/extension.ts) (Extension Activation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_host["Extension Host"]
  node_extension["Extension Activation<br/>[extension.ts]"]
  node_repos["Repository Manager<br/>[repoManager.ts]"]
  node_source["Data Source<br/>[dataSource.ts]"]
  node_backend["Backend Router<br/>[index.ts]"]
  node_addon["Addon Loader<br/>[addon.ts]"]
  node_commands["Write Commands<br/>[commands.ts]"]
end

subgraph group_engine["Rust Read Engine"]
  node_binding["Node API Binding<br/>[lib.rs]"]
  node_repo["Repository Handle Cache<br/>[repository.rs]"]
  node_history["History And Graph<br/>[graph.rs]"]
  node_refs["Refs And Stashes<br/>[refs.rs]"]
  node_details["Commit Details<br/>[details.rs]"]
  node_diffs["Diffs And Comparisons<br/>[diff.rs]"]
  node_files["File Content<br/>[blob.rs]"]
  node_search["History Search<br/>[log.rs]"]
  node_config["Repository Config<br/>[config.rs]"]
end

subgraph group_views["Graph Views"]
  node_graphview["Graph Webview<br/>[main.ts]"]
  node_detailsview["Commit Detail View"]
  node_compareview["Binary Compare View"]
  node_gerritview["Gerrit View<br/>[gerritView.ts]"]
end

subgraph group_integrations["Writes And Integrations"]
  node_cli["Git CLI Backend<br/>[cliBackend.ts]"]
  node_gerrit["Gerrit Integration<br/>[gerrit.ts]"]
  node_pullrequests["Pull Request Links<br/>[pullRequests.ts]"]
  node_avatars["Avatar Lookup<br/>[avatarManager.ts]"]
end

node_user(("User"))
node_gitrepo[("Git Repository")]
node_gitcli["Git CLI"]
node_gerritremote["Gerrit Server"]
node_avatarservices["Avatar Services"]

node_user -->|"uses"| node_extension
node_extension -->|"manages repositories"| node_repos
node_extension -->|"provides data"| node_source
node_source -->|"requests Git data"| node_backend
node_backend -->|"tries engine"| node_addon
node_backend -.->|"falls back"| node_cli
node_addon -->|"loads"| node_binding
node_cli -->|"runs commands"| node_gitcli
node_binding -->|"gets handle"| node_repo
node_binding -->|"dispatches"| node_history
node_binding -->|"dispatches"| node_refs
node_binding -->|"dispatches"| node_details
node_binding -->|"dispatches"| node_diffs
node_binding -->|"dispatches"| node_files
node_binding -->|"dispatches"| node_search
node_binding -->|"dispatches"| node_config
node_repo -->|"opens and caches"| node_gitrepo
node_history -->|"reads history"| node_gitrepo
node_refs -->|"reads refs"| node_gitrepo
node_details -->|"reads details"| node_gitrepo
node_diffs -->|"reads diffs"| node_gitrepo
node_files -->|"reads blobs"| node_gitrepo
node_search -->|"searches history"| node_gitrepo
node_config -->|"reads config"| node_gitrepo
node_source -->|"sends view data"| node_graphview
node_graphview -->|"opens details"| node_detailsview
node_source -->|"supplies file comparison"| node_compareview
node_commands -->|"performs writes"| node_cli
node_graphview -->|"requests actions"| node_commands
node_gerrit -.->|"fetches changes"| node_gerritremote
node_gerritview -->|"requests review data"| node_gerrit
node_graphview -->|"shows review details"| node_gerritview
node_pullrequests -->|"provides links"| node_graphview
node_avatars -.->|"fetches images"| node_avatarservices

click node_extension "https://github.com/neophack/vscode-git-graph-rs/blob/main/src/extension.ts"
click node_repos "https://github.com/neophack/vscode-git-graph-rs/blob/main/src/repoManager.ts"
click node_source "https://github.com/neophack/vscode-git-graph-rs/blob/main/src/dataSource.ts"
click node_backend "https://github.com/neophack/vscode-git-graph-rs/blob/main/src/backend/index.ts"
click node_addon "https://github.com/neophack/vscode-git-graph-rs/blob/main/src/backend/addon.ts"
click node_cli "https://github.com/neophack/vscode-git-graph-rs/blob/main/src/backend/cliBackend.ts"
click node_binding "https://github.com/neophack/vscode-git-graph-rs/blob/main/native/node/src/lib.rs"
click node_repo "https://github.com/neophack/vscode-git-graph-rs/blob/main/native/core/src/repository.rs"
click node_history "https://github.com/neophack/vscode-git-graph-rs/blob/main/native/core/src/graph.rs"
click node_refs "https://github.com/neophack/vscode-git-graph-rs/blob/main/native/core/src/refs.rs"
click node_details "https://github.com/neophack/vscode-git-graph-rs/blob/main/native/core/src/details.rs"
click node_diffs "https://github.com/neophack/vscode-git-graph-rs/blob/main/native/core/src/diff.rs"
click node_files "https://github.com/neophack/vscode-git-graph-rs/blob/main/native/core/src/blob.rs"
click node_search "https://github.com/neophack/vscode-git-graph-rs/blob/main/native/core/src/log.rs"
click node_config "https://github.com/neophack/vscode-git-graph-rs/blob/main/native/core/src/config.rs"
click node_graphview "https://github.com/neophack/vscode-git-graph-rs/blob/main/web/main.ts"
click node_detailsview "https://github.com/neophack/vscode-git-graph-rs/blob/main/web/commitDetailsView.ts"
click node_compareview "https://github.com/neophack/vscode-git-graph-rs/blob/main/src/binaryCompareView.ts"
click node_commands "https://github.com/neophack/vscode-git-graph-rs/blob/main/src/commands.ts"
click node_gerrit "https://github.com/neophack/vscode-git-graph-rs/blob/main/src/gerrit.ts"
click node_gerritview "https://github.com/neophack/vscode-git-graph-rs/blob/main/web/gerritView.ts"
click node_pullrequests "https://github.com/neophack/vscode-git-graph-rs/blob/main/src/pullRequests.ts"
click node_avatars "https://github.com/neophack/vscode-git-graph-rs/blob/main/src/avatarManager.ts"

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_extension,node_repos,node_source,node_backend,node_addon,node_commands,node_user toneBlue
class node_binding,node_repo,node_history,node_refs,node_details,node_diffs,node_files,node_search,node_config,node_gitrepo toneAmber
class node_graphview,node_detailsview,node_compareview,node_gerritview,node_gerritremote toneMint
class node_cli,node_gerrit,node_pullrequests,node_avatars toneRose
class node_gitcli,node_avatarservices toneIndigo
```

## Components

### Extension Host

- [Extension Activation](https://github.com/neophack/vscode-git-graph-rs/blob/main/src/extension.ts): `src/extension.ts`
- [Repository Manager](https://github.com/neophack/vscode-git-graph-rs/blob/main/src/repoManager.ts): `src/repoManager.ts`
- [Data Source](https://github.com/neophack/vscode-git-graph-rs/blob/main/src/dataSource.ts): `src/dataSource.ts`
- [Backend Router](https://github.com/neophack/vscode-git-graph-rs/blob/main/src/backend/index.ts): `src/backend/index.ts`
- [Addon Loader](https://github.com/neophack/vscode-git-graph-rs/blob/main/src/backend/addon.ts): `src/backend/addon.ts`
- [Write Commands](https://github.com/neophack/vscode-git-graph-rs/blob/main/src/commands.ts): `src/commands.ts`

### Rust Read Engine

- [Node API Binding](https://github.com/neophack/vscode-git-graph-rs/blob/main/native/node/src/lib.rs): `native/node/src/lib.rs`
- [Repository Handle Cache](https://github.com/neophack/vscode-git-graph-rs/blob/main/native/core/src/repository.rs): `native/core/src/repository.rs`
- [History And Graph](https://github.com/neophack/vscode-git-graph-rs/blob/main/native/core/src/graph.rs): `native/core/src/graph.rs`
- [Refs And Stashes](https://github.com/neophack/vscode-git-graph-rs/blob/main/native/core/src/refs.rs): `native/core/src/refs.rs`
- [Commit Details](https://github.com/neophack/vscode-git-graph-rs/blob/main/native/core/src/details.rs): `native/core/src/details.rs`
- [Diffs And Comparisons](https://github.com/neophack/vscode-git-graph-rs/blob/main/native/core/src/diff.rs): `native/core/src/diff.rs`
- [File Content](https://github.com/neophack/vscode-git-graph-rs/blob/main/native/core/src/blob.rs): `native/core/src/blob.rs`
- [History Search](https://github.com/neophack/vscode-git-graph-rs/blob/main/native/core/src/log.rs): `native/core/src/log.rs`
- [Repository Config](https://github.com/neophack/vscode-git-graph-rs/blob/main/native/core/src/config.rs): `native/core/src/config.rs`

### Graph Views

- [Graph Webview](https://github.com/neophack/vscode-git-graph-rs/blob/main/web/main.ts): `web/main.ts`
- [Commit Detail View](https://github.com/neophack/vscode-git-graph-rs/blob/main/web/commitDetailsView.ts): `web/commitDetailsView.ts`
- [Binary Compare View](https://github.com/neophack/vscode-git-graph-rs/blob/main/src/binaryCompareView.ts): `src/binaryCompareView.ts`
- [Gerrit View](https://github.com/neophack/vscode-git-graph-rs/blob/main/web/gerritView.ts): `web/gerritView.ts`

### Writes And Integrations

- [Git CLI Backend](https://github.com/neophack/vscode-git-graph-rs/blob/main/src/backend/cliBackend.ts): `src/backend/cliBackend.ts`
- [Gerrit Integration](https://github.com/neophack/vscode-git-graph-rs/blob/main/src/gerrit.ts): `src/gerrit.ts`
- [Pull Request Links](https://github.com/neophack/vscode-git-graph-rs/blob/main/src/pullRequests.ts): `src/pullRequests.ts`
- [Avatar Lookup](https://github.com/neophack/vscode-git-graph-rs/blob/main/src/avatarManager.ts): `src/avatarManager.ts`

### Other components

- **User**
- **Git Repository**
- **Git CLI**
- **Gerrit Server**
- **Avatar Services**

## Connections

- User → Extension Activation: uses
- Extension Activation → Repository Manager: manages repositories
- Extension Activation → Data Source: provides data
- Data Source → Backend Router: requests Git data
- Backend Router → Addon Loader: tries engine
- Backend Router → Git CLI Backend: falls back
- Addon Loader → Node API Binding: loads
- Git CLI Backend → Git CLI: runs commands
- Node API Binding → Repository Handle Cache: gets handle
- Node API Binding → History And Graph: dispatches
- Node API Binding → Refs And Stashes: dispatches
- Node API Binding → Commit Details: dispatches
- Node API Binding → Diffs And Comparisons: dispatches
- Node API Binding → File Content: dispatches
- Node API Binding → History Search: dispatches
- Node API Binding → Repository Config: dispatches
- Repository Handle Cache → Git Repository: opens and caches
- History And Graph → Git Repository: reads history
- Refs And Stashes → Git Repository: reads refs
- Commit Details → Git Repository: reads details
- Diffs And Comparisons → Git Repository: reads diffs
- File Content → Git Repository: reads blobs
- History Search → Git Repository: searches history
- Repository Config → Git Repository: reads config
- Data Source → Graph Webview: sends view data
- Graph Webview → Commit Detail View: opens details
- Data Source → Binary Compare View: supplies file comparison
- Write Commands → Git CLI Backend: performs writes
- Graph Webview → Write Commands: requests actions
- Gerrit Integration → Gerrit Server: fetches changes
- Gerrit View → Gerrit Integration: requests review data
- Graph Webview → Gerrit View: shows review details
- Pull Request Links → Graph Webview: provides links
- Avatar Lookup → Avatar Services: fetches images
