# pandyapreet/gitcontext architecture

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

- Interactive diagram: https://gitdiagram.com/pandyapreet/gitcontext
- Repository: https://github.com/pandyapreet/gitcontext

## Overview

Git Context is a local Tauri desktop app for managing multiple Git identities and SSH keys. The main workflow is: create a provider profile, select it for a repository or as the global identity, preview the resulting Git/SSH configuration changes, apply them, and verify or undo the result. The graph also preserves documented capabilities for environment detection, key generation, account checks, history, tray switching, launch-in-context, and settings. Backend ownership beyond the sampled excerpts is limited to the README and source-index references; uncertain internal links are omitted.

Main entry points: [`src/App.tsx`](https://github.com/pandyapreet/gitcontext/blob/main/src/App.tsx) (App shell), [`src-tauri/src/service.rs`](https://github.com/pandyapreet/gitcontext/blob/main/src-tauri/src/service.rs) (Configuration service), [`src-tauri/src/lib.rs`](https://github.com/pandyapreet/gitcontext/blob/main/src-tauri/src/lib.rs) (Tauri command runtime), [`src/lib/api.ts`](https://github.com/pandyapreet/gitcontext/blob/main/src/lib/api.ts) (Desktop command API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop experience"]
  node_app["App shell<br/>[App.tsx]"]
  node_workspace["Workspace state<br/>[use-workspace.ts]"]
  node_screens["Profile and settings screens<br/>[screens.tsx]"]
  node_management["Change preview and management<br/>[manage-dialog.tsx]"]
  node_switcher["Command palette<br/>[quick-switcher.tsx]"]
  node_updates["Application updates<br/>[updates.tsx]"]
end

subgraph group_identity["Profiles and keys"]
  node_profileform["Profile editor<br/>[profile-form.tsx]"]
  node_keysetup["SSH key setup<br/>[key-setup.tsx]"]
  node_identityhealth["Identity health"]
  node_providerlogic["Provider and profile rules<br/>[providers.ts]"]
end

subgraph group_configuration["Configuration operations"]
  node_api["Desktop command API<br/>[api.ts]"]
end

subgraph group_backend["Rust backend"]
  node_service["Configuration service<br/>[service.rs]"]
  node_git["Git repository operations<br/>[git.rs]"]
  node_ssh["SSH operations<br/>[ssh.rs]"]
  node_provider["Provider checks and remotes<br/>[provider.rs]"]
  node_detection["Environment detection<br/>[detection.rs]"]
  node_process["System process execution<br/>[process.rs]"]
  node_global["Global profile and tray<br/>[global.rs]"]
  node_storage[("Local app storage<br/>[storage.rs]")]
  node_model["Domain models<br/>[model.rs]"]
  node_runtime["Tauri command runtime<br/>[lib.rs]"]
end

node_developer(("Developer"))
node_provider_services{{"GitHub and GitLab"}}
node_system_tools{{"Git, OpenSSH and OS"}}
node_config_files["Git and SSH config files"]

node_developer -->|"uses"| node_app
node_app -->|"reads state"| node_workspace
node_app -->|"renders"| node_screens
node_app -->|"renders"| node_management
node_app -->|"offers actions"| node_switcher
node_app -->|"renders"| node_updates
node_screens -->|"edits profiles"| node_profileform
node_profileform -->|"embeds"| node_keysetup
node_profileform -->|"uses defaults"| node_providerlogic
node_screens -->|"requests actions"| node_api
node_workspace -->|"loads and mutates"| node_api
node_management -->|"uses workspace"| node_workspace
node_identityhealth -->|"requests verification"| node_api
node_api -->|"invokes commands"| node_runtime
node_runtime -->|"dispatches operations"| node_service
node_runtime -->|"dispatches detection"| node_detection
node_runtime -->|"dispatches global actions"| node_global
node_runtime -->|"dispatches persistence"| node_storage
node_service -->|"runs system commands"| node_process
node_service -->|"uses provider logic"| node_provider
node_service -.->|"handles repository config"| node_git
node_service -.->|"handles SSH config"| node_ssh
node_detection -->|"inspects environment"| node_system_tools
node_process -->|"runs tools"| node_system_tools
node_ssh -->|"uses OpenSSH"| node_system_tools
node_provider -->|"checks accounts"| node_provider_services
node_service -->|"previews and applies"| node_config_files
node_storage -->|"journals backups"| node_config_files
node_developer -->|"provides username"| node_provider_services

click node_app "https://github.com/pandyapreet/gitcontext/blob/main/src/App.tsx"
click node_workspace "https://github.com/pandyapreet/gitcontext/blob/main/src/hooks/use-workspace.ts"
click node_screens "https://github.com/pandyapreet/gitcontext/blob/main/src/components/screens.tsx"
click node_management "https://github.com/pandyapreet/gitcontext/blob/main/src/components/manage-dialog.tsx"
click node_switcher "https://github.com/pandyapreet/gitcontext/blob/main/src/components/quick-switcher.tsx"
click node_updates "https://github.com/pandyapreet/gitcontext/blob/main/src/components/updates.tsx"
click node_profileform "https://github.com/pandyapreet/gitcontext/blob/main/src/components/profile-form.tsx"
click node_keysetup "https://github.com/pandyapreet/gitcontext/blob/main/src/components/key-setup.tsx"
click node_identityhealth "https://github.com/pandyapreet/gitcontext/blob/main/src/components/identity-health.tsx"
click node_providerlogic "https://github.com/pandyapreet/gitcontext/blob/main/src/lib/providers.ts"
click node_api "https://github.com/pandyapreet/gitcontext/blob/main/src/lib/api.ts"
click node_service "https://github.com/pandyapreet/gitcontext/blob/main/src-tauri/src/service.rs"
click node_git "https://github.com/pandyapreet/gitcontext/blob/main/src-tauri/src/git.rs"
click node_ssh "https://github.com/pandyapreet/gitcontext/blob/main/src-tauri/src/ssh.rs"
click node_provider "https://github.com/pandyapreet/gitcontext/blob/main/src-tauri/src/provider.rs"
click node_detection "https://github.com/pandyapreet/gitcontext/blob/main/src-tauri/src/detection.rs"
click node_process "https://github.com/pandyapreet/gitcontext/blob/main/src-tauri/src/process.rs"
click node_global "https://github.com/pandyapreet/gitcontext/blob/main/src-tauri/src/global.rs"
click node_storage "https://github.com/pandyapreet/gitcontext/blob/main/src-tauri/src/storage.rs"
click node_model "https://github.com/pandyapreet/gitcontext/blob/main/src-tauri/src/model.rs"
click node_runtime "https://github.com/pandyapreet/gitcontext/blob/main/src-tauri/src/lib.rs"

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_app,node_workspace,node_screens,node_management,node_switcher,node_updates toneBlue
class node_profileform,node_keysetup,node_identityhealth,node_providerlogic toneAmber
class node_api toneMint
class node_service,node_git,node_ssh,node_provider,node_detection,node_process,node_global,node_storage,node_model,node_runtime toneRose
class node_developer,node_provider_services,node_system_tools,node_config_files toneIndigo
```

## Components

### Desktop experience

- [App shell](https://github.com/pandyapreet/gitcontext/blob/main/src/App.tsx): `src/App.tsx`
- [Workspace state](https://github.com/pandyapreet/gitcontext/blob/main/src/hooks/use-workspace.ts): `src/hooks/use-workspace.ts`
- [Profile and settings screens](https://github.com/pandyapreet/gitcontext/blob/main/src/components/screens.tsx): `src/components/screens.tsx`
- [Change preview and management](https://github.com/pandyapreet/gitcontext/blob/main/src/components/manage-dialog.tsx): `src/components/manage-dialog.tsx`
- [Command palette](https://github.com/pandyapreet/gitcontext/blob/main/src/components/quick-switcher.tsx): `src/components/quick-switcher.tsx`
- [Application updates](https://github.com/pandyapreet/gitcontext/blob/main/src/components/updates.tsx): `src/components/updates.tsx`

### Profiles and keys

- [Profile editor](https://github.com/pandyapreet/gitcontext/blob/main/src/components/profile-form.tsx): `src/components/profile-form.tsx`
- [SSH key setup](https://github.com/pandyapreet/gitcontext/blob/main/src/components/key-setup.tsx): `src/components/key-setup.tsx`
- [Identity health](https://github.com/pandyapreet/gitcontext/blob/main/src/components/identity-health.tsx): `src/components/identity-health.tsx`
- [Provider and profile rules](https://github.com/pandyapreet/gitcontext/blob/main/src/lib/providers.ts): `src/lib/providers.ts`

### Configuration operations

- [Desktop command API](https://github.com/pandyapreet/gitcontext/blob/main/src/lib/api.ts): `src/lib/api.ts`

### Rust backend

- [Configuration service](https://github.com/pandyapreet/gitcontext/blob/main/src-tauri/src/service.rs): `src-tauri/src/service.rs`
- [Git repository operations](https://github.com/pandyapreet/gitcontext/blob/main/src-tauri/src/git.rs): `src-tauri/src/git.rs`
- [SSH operations](https://github.com/pandyapreet/gitcontext/blob/main/src-tauri/src/ssh.rs): `src-tauri/src/ssh.rs`
- [Provider checks and remotes](https://github.com/pandyapreet/gitcontext/blob/main/src-tauri/src/provider.rs): `src-tauri/src/provider.rs`
- [Environment detection](https://github.com/pandyapreet/gitcontext/blob/main/src-tauri/src/detection.rs): `src-tauri/src/detection.rs`
- [System process execution](https://github.com/pandyapreet/gitcontext/blob/main/src-tauri/src/process.rs): `src-tauri/src/process.rs`
- [Global profile and tray](https://github.com/pandyapreet/gitcontext/blob/main/src-tauri/src/global.rs): `src-tauri/src/global.rs`
- [Local app storage](https://github.com/pandyapreet/gitcontext/blob/main/src-tauri/src/storage.rs): `src-tauri/src/storage.rs`
- [Domain models](https://github.com/pandyapreet/gitcontext/blob/main/src-tauri/src/model.rs): `src-tauri/src/model.rs`
- [Tauri command runtime](https://github.com/pandyapreet/gitcontext/blob/main/src-tauri/src/lib.rs): `src-tauri/src/lib.rs`

### Other components

- **Developer**
- **GitHub and GitLab**
- **Git, OpenSSH and OS**
- **Git and SSH config files**

## Connections

- Developer → App shell: uses (evidence: `README.md`)
- App shell → Workspace state: reads state (evidence: `src/App.tsx`)
- App shell → Profile and settings screens: renders (evidence: `src/App.tsx`)
- App shell → Change preview and management: renders (evidence: `src/App.tsx`)
- App shell → Command palette: offers actions (evidence: `src/App.tsx`)
- App shell → Application updates: renders (evidence: `src/App.tsx`)
- Profile and settings screens → Profile editor: edits profiles (evidence: `src/components/screens.tsx`)
- Profile editor → SSH key setup: embeds (evidence: `src/components/profile-form.tsx`)
- Profile editor → Provider and profile rules: uses defaults (evidence: `src/components/profile-form.tsx`)
- Profile and settings screens → Desktop command API: requests actions (evidence: `src/components/screens.tsx`)
- Workspace state → Desktop command API: loads and mutates (evidence: `src/hooks/use-workspace.ts`)
- Change preview and management → Workspace state: uses workspace (evidence: `src/components/manage-dialog.tsx`)
- Identity health → Desktop command API: requests verification (evidence: `src/components/identity-health.tsx`)
- Desktop command API → Tauri command runtime: invokes commands (evidence: `src/lib/api.ts`)
- Tauri command runtime → Configuration service: dispatches operations (evidence: `src-tauri/src/lib.rs`)
- Tauri command runtime → Environment detection: dispatches detection (evidence: `src-tauri/src/lib.rs`)
- Tauri command runtime → Global profile and tray: dispatches global actions (evidence: `src-tauri/src/lib.rs`)
- Tauri command runtime → Local app storage: dispatches persistence (evidence: `src-tauri/src/lib.rs`)
- Configuration service → System process execution: runs system commands (evidence: `src-tauri/src/service.rs`)
- Configuration service → Provider checks and remotes: uses provider logic (evidence: `src-tauri/src/service.rs`)
- Configuration service → Git repository operations: handles repository config
- Configuration service → SSH operations: handles SSH config
- Environment detection → Git, OpenSSH and OS: inspects environment (evidence: `README.md`)
- System process execution → Git, OpenSSH and OS: runs tools (evidence: `README.md`)
- SSH operations → Git, OpenSSH and OS: uses OpenSSH (evidence: `README.md`)
- Provider checks and remotes → GitHub and GitLab: checks accounts (evidence: `README.md`)
- Configuration service → Git and SSH config files: previews and applies (evidence: `README.md`)
- Local app storage → Git and SSH config files: journals backups (evidence: `README.md`)
- Developer → GitHub and GitLab: provides username (evidence: `README.md`)
