# bravinevans/shin architecture

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

- Interactive diagram: https://gitdiagram.com/bravinevans/shin
- Repository: https://github.com/bravinevans/shin

## Overview

shin is a security-focused Arch package-manager helper. The main workflow dispatches CLI requests, loads repository configuration, syncs package databases, searches and ranks package sources, checks trust and conflicts, then installs binary or AUR packages. Separate command paths handle system and AUR upgrades, removal, and cache cleaning. The README documents additional behavior that is not fully visible in the excerpts; edges for those documented actions cite it. Unsampled implementation details are not inferred.

Main entry points: [`src/main.rs`](https://github.com/bravinevans/shin/blob/main/src/main.rs) (CLI dispatcher), [`src/install.rs`](https://github.com/bravinevans/shin/blob/main/src/install.rs) (Install and remove), [`src/search.rs`](https://github.com/bravinevans/shin/blob/main/src/search.rs) (Search and ranking), [`src/clean.rs`](https://github.com/bravinevans/shin/blob/main/src/clean.rs) (Cache cleaning)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_orchestration["Command orchestration"]
  node_main["CLI dispatcher<br/>[main.rs]"]
  node_config["Config and repo setup<br/>[config.rs]"]
end

subgraph group_sources["Sources and sync"]
  node_sync["Package sync<br/>[sync.rs]"]
  node_search["Search and ranking<br/>[search.rs]"]
  node_alpm[("libalpm databases")]
  node_aur_rpc["AUR RPC"]
end

subgraph group_safety["Safety and install"]
  node_trust["Trust and PKGBUILD audit<br/>[trust.rs]"]
  node_resolve["Dependency and conflict plan<br/>[resolve.rs]"]
  node_install["Install and remove<br/>[install.rs]"]
end

subgraph group_maintenance["Maintenance"]
  node_aur_upgrade["AUR upgrade flow<br/>[aur_upgrade.rs]"]
  node_clean["Cache cleaning<br/>[clean.rs]"]
  node_audit_log[("Audit log")]
end

node_user(("CLI user"))
node_pacman["pacman"]

node_user -->|"issues command"| node_main
node_main -->|"loads settings"| node_config
node_main -->|"requests sync"| node_sync
node_main -->|"requests search"| node_search
node_main -->|"plans install"| node_resolve
node_main -->|"dispatches action"| node_install
node_main -->|"starts AUR upgrade"| node_aur_upgrade
node_main -->|"starts cleaning"| node_clean
node_config -->|"bootstraps keyring"| node_trust
node_sync -->|"reads repo config"| node_config
node_sync -->|"runs sync"| node_pacman
node_search -->|"searches databases"| node_alpm
node_search -->|"queries packages"| node_aur_rpc
node_resolve -->|"checks installed state"| node_alpm
node_resolve -->|"compares versions"| node_search
node_install -->|"accepts install plan"| node_resolve
node_install -->|"reviews AUR build"| node_trust
node_install -->|"installs or removes"| node_pacman
node_install -->|"records actions"| node_audit_log
node_aur_upgrade -->|"checks AUR versions"| node_search
node_aur_upgrade -->|"builds updates"| node_install
node_clean -->|"cleans package cache"| node_pacman
node_clean -->|"uses home directory"| node_config
node_clean -->|"records cleaning"| node_audit_log

click node_main "https://github.com/bravinevans/shin/blob/main/src/main.rs"
click node_config "https://github.com/bravinevans/shin/blob/main/src/config.rs"
click node_sync "https://github.com/bravinevans/shin/blob/main/src/sync.rs"
click node_search "https://github.com/bravinevans/shin/blob/main/src/search.rs"
click node_trust "https://github.com/bravinevans/shin/blob/main/src/trust.rs"
click node_resolve "https://github.com/bravinevans/shin/blob/main/src/resolve.rs"
click node_install "https://github.com/bravinevans/shin/blob/main/src/install.rs"
click node_aur_upgrade "https://github.com/bravinevans/shin/blob/main/src/aur_upgrade.rs"
click node_clean "https://github.com/bravinevans/shin/blob/main/src/clean.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_main,node_config,node_user toneBlue
class node_sync,node_search,node_alpm,node_aur_rpc toneAmber
class node_trust,node_resolve,node_install toneMint
class node_aur_upgrade,node_clean,node_audit_log toneRose
class node_pacman toneIndigo
```

## Components

### Command orchestration

- [CLI dispatcher](https://github.com/bravinevans/shin/blob/main/src/main.rs): `src/main.rs`
- [Config and repo setup](https://github.com/bravinevans/shin/blob/main/src/config.rs): `src/config.rs`

### Sources and sync

- [Package sync](https://github.com/bravinevans/shin/blob/main/src/sync.rs): `src/sync.rs`
- [Search and ranking](https://github.com/bravinevans/shin/blob/main/src/search.rs): `src/search.rs`
- **libalpm databases**
- **AUR RPC**

### Safety and install

- [Trust and PKGBUILD audit](https://github.com/bravinevans/shin/blob/main/src/trust.rs): `src/trust.rs`
- [Dependency and conflict plan](https://github.com/bravinevans/shin/blob/main/src/resolve.rs): `src/resolve.rs`
- [Install and remove](https://github.com/bravinevans/shin/blob/main/src/install.rs): `src/install.rs`

### Maintenance

- [AUR upgrade flow](https://github.com/bravinevans/shin/blob/main/src/aur_upgrade.rs): `src/aur_upgrade.rs`
- [Cache cleaning](https://github.com/bravinevans/shin/blob/main/src/clean.rs): `src/clean.rs`
- **Audit log**

### Other components

- **CLI user**
- **pacman**

## Connections

- CLI user → CLI dispatcher: issues command (evidence: `README.md`)
- CLI dispatcher → Config and repo setup: loads settings (evidence: `src/main.rs`)
- CLI dispatcher → Package sync: requests sync (evidence: `src/main.rs`)
- CLI dispatcher → Search and ranking: requests search (evidence: `src/main.rs`)
- CLI dispatcher → Dependency and conflict plan: plans install (evidence: `README.md`)
- CLI dispatcher → Install and remove: dispatches action (evidence: `src/main.rs`)
- CLI dispatcher → AUR upgrade flow: starts AUR upgrade (evidence: `src/main.rs`)
- CLI dispatcher → Cache cleaning: starts cleaning (evidence: `src/main.rs`)
- Config and repo setup → Trust and PKGBUILD audit: bootstraps keyring (evidence: `src/config.rs`)
- Package sync → Config and repo setup: reads repo config (evidence: `src/sync.rs`)
- Package sync → pacman: runs sync (evidence: `src/sync.rs`)
- Search and ranking → libalpm databases: searches databases (evidence: `README.md`)
- Search and ranking → AUR RPC: queries packages (evidence: `src/search.rs`)
- Dependency and conflict plan → libalpm databases: checks installed state (evidence: `src/resolve.rs`)
- Dependency and conflict plan → Search and ranking: compares versions (evidence: `src/resolve.rs`)
- Install and remove → Dependency and conflict plan: accepts install plan (evidence: `src/install.rs`)
- Install and remove → Trust and PKGBUILD audit: reviews AUR build (evidence: `src/install.rs`)
- Install and remove → pacman: installs or removes (evidence: `README.md`)
- Install and remove → Audit log: records actions (evidence: `src/install.rs`)
- AUR upgrade flow → Search and ranking: checks AUR versions (evidence: `src/aur_upgrade.rs`)
- AUR upgrade flow → Install and remove: builds updates (evidence: `src/aur_upgrade.rs`)
- Cache cleaning → pacman: cleans package cache (evidence: `src/clean.rs`)
- Cache cleaning → Config and repo setup: uses home directory (evidence: `src/clean.rs`)
- Cache cleaning → Audit log: records cleaning (evidence: `src/clean.rs`)
