# viru04/agent-hub architecture

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

- Interactive diagram: https://gitdiagram.com/viru04/agent-hub
- Repository: https://github.com/viru04/agent-hub

## Overview

agentHub indexes the pinned awesome-copilot collection into a safety- and role-aware marketplace, then supports discovery in a web UI or CLI and hash-verified installation of selected assets. The CLI resolves assets and bundles, fetches their indexed upstream files, checks integrity and local conflicts, writes them to the chosen scope, and records a lockfile. The README documents build-to-index behavior and additional CLI features; unsampled implementation details are represented only where that documentation supports them.

Main entry points: [`web/src/App.jsx`](https://github.com/viru04/agent-hub/blob/main/web/src/App.jsx) (Marketplace UI), [`lib/ingest.mjs`](https://github.com/viru04/agent-hub/blob/main/lib/ingest.mjs) (Asset ingestion), [`cli/src/install.mjs`](https://github.com/viru04/agent-hub/blob/main/cli/src/install.mjs) (Verified installer), [`cli/src/main.mjs`](https://github.com/viru04/agent-hub/blob/main/cli/src/main.mjs) (Command routing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_indexing["Curation &amp; indexing"]
  node_curation["Curation data"]
  node_ingest["Asset ingestion<br/>[ingest.mjs]"]
  node_frontmatter["Frontmatter parser<br/>[frontmatter.mjs]"]
  node_safety["Safety heuristics<br/>[scan.mjs]"]
  node_schema["Curation schemas<br/>[schema.mjs]"]
  node_registrydata["Generated index"]
end

subgraph group_marketplace["Web marketplace"]
  node_app["Marketplace UI<br/>[App.jsx]"]
  node_assetcard["Asset cards<br/>[AssetCard.jsx]"]
  node_assetdetails["Asset details<br/>[AssetDetails.jsx]"]
  node_cartui["Install cart UI<br/>[InstallCart.jsx]"]
  node_cart["Cart sharing<br/>[cart.js]"]
end

subgraph group_cli["CLI discovery"]
  node_entry["CLI command<br/>[agenthub.mjs]"]
  node_main["Command routing<br/>[main.mjs]"]
  node_registry["Registry access<br/>[registry.mjs]"]
end

subgraph group_install["Installation &amp; state"]
  node_resolve["Asset resolution<br/>[resolve.mjs]"]
  node_installer["Verified installer<br/>[install.mjs]"]
  node_targets["Local or global files"]
  node_lock["Install lockfile"]
end

node_upstream["awesome-copilot"]
node_webuser(("Marketplace user"))
node_cliuser(("CLI user"))

node_upstream -->|"supplies pinned assets"| node_ingest
node_curation -->|"configures curation"| node_ingest
node_ingest -->|"parses metadata"| node_frontmatter
node_ingest -->|"scans content"| node_safety
node_ingest -->|"validates curation"| node_schema
node_ingest -->|"generates index"| node_registrydata
node_webuser -->|"browses"| node_app
node_app -->|"fetches index"| node_registrydata
node_app -->|"renders cards"| node_assetcard
node_app -->|"renders details"| node_assetdetails
node_app -->|"renders cart"| node_cartui
node_app -->|"encodes cart"| node_cart
node_cartui -->|"creates commands"| node_cart
node_cliuser -->|"runs command"| node_entry
node_entry -->|"dispatches to"| node_main
node_main -->|"opens registry"| node_registry
node_registry -->|"reads index"| node_registrydata
node_main -->|"invokes install"| node_installer
node_installer -->|"resolves specs"| node_resolve
node_installer -->|"fetches source files"| node_registry
node_registry -->|"fetches pinned files"| node_upstream
node_installer -->|"writes verified files"| node_targets
node_installer -->|"updates install record"| node_lock
node_main -->|"reads installed state"| node_lock

click node_curation "https://github.com/viru04/agent-hub/tree/main/curation"
click node_ingest "https://github.com/viru04/agent-hub/blob/main/lib/ingest.mjs"
click node_frontmatter "https://github.com/viru04/agent-hub/blob/main/lib/frontmatter.mjs"
click node_safety "https://github.com/viru04/agent-hub/blob/main/lib/scan.mjs"
click node_schema "https://github.com/viru04/agent-hub/blob/main/lib/schema.mjs"
click node_app "https://github.com/viru04/agent-hub/blob/main/web/src/App.jsx"
click node_assetcard "https://github.com/viru04/agent-hub/blob/main/web/src/components/AssetCard.jsx"
click node_assetdetails "https://github.com/viru04/agent-hub/blob/main/web/src/components/AssetDetails.jsx"
click node_cartui "https://github.com/viru04/agent-hub/blob/main/web/src/components/InstallCart.jsx"
click node_cart "https://github.com/viru04/agent-hub/blob/main/web/src/cart.js"
click node_entry "https://github.com/viru04/agent-hub/blob/main/cli/bin/agenthub.mjs"
click node_main "https://github.com/viru04/agent-hub/blob/main/cli/src/main.mjs"
click node_registry "https://github.com/viru04/agent-hub/blob/main/cli/src/registry.mjs"
click node_resolve "https://github.com/viru04/agent-hub/blob/main/cli/src/resolve.mjs"
click node_installer "https://github.com/viru04/agent-hub/blob/main/cli/src/install.mjs"

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_curation,node_ingest,node_frontmatter,node_safety,node_schema,node_registrydata,node_webuser,node_cliuser toneBlue
class node_app,node_assetcard,node_assetdetails,node_cartui,node_cart toneAmber
class node_entry,node_main,node_registry toneMint
class node_resolve,node_installer,node_targets,node_lock toneRose
class node_upstream toneIndigo
```

## Components

### Curation & indexing

- [Curation data](https://github.com/viru04/agent-hub/tree/main/curation): `curation`
- [Asset ingestion](https://github.com/viru04/agent-hub/blob/main/lib/ingest.mjs): `lib/ingest.mjs`
- [Frontmatter parser](https://github.com/viru04/agent-hub/blob/main/lib/frontmatter.mjs): `lib/frontmatter.mjs`
- [Safety heuristics](https://github.com/viru04/agent-hub/blob/main/lib/scan.mjs): `lib/scan.mjs`
- [Curation schemas](https://github.com/viru04/agent-hub/blob/main/lib/schema.mjs): `lib/schema.mjs`
- **Generated index**

### Web marketplace

- [Marketplace UI](https://github.com/viru04/agent-hub/blob/main/web/src/App.jsx): `web/src/App.jsx`
- [Asset cards](https://github.com/viru04/agent-hub/blob/main/web/src/components/AssetCard.jsx): `web/src/components/AssetCard.jsx`
- [Asset details](https://github.com/viru04/agent-hub/blob/main/web/src/components/AssetDetails.jsx): `web/src/components/AssetDetails.jsx`
- [Install cart UI](https://github.com/viru04/agent-hub/blob/main/web/src/components/InstallCart.jsx): `web/src/components/InstallCart.jsx`
- [Cart sharing](https://github.com/viru04/agent-hub/blob/main/web/src/cart.js): `web/src/cart.js`

### CLI discovery

- [CLI command](https://github.com/viru04/agent-hub/blob/main/cli/bin/agenthub.mjs): `cli/bin/agenthub.mjs`
- [Command routing](https://github.com/viru04/agent-hub/blob/main/cli/src/main.mjs): `cli/src/main.mjs`
- [Registry access](https://github.com/viru04/agent-hub/blob/main/cli/src/registry.mjs): `cli/src/registry.mjs`

### Installation & state

- [Asset resolution](https://github.com/viru04/agent-hub/blob/main/cli/src/resolve.mjs): `cli/src/resolve.mjs`
- [Verified installer](https://github.com/viru04/agent-hub/blob/main/cli/src/install.mjs): `cli/src/install.mjs`
- **Local or global files**
- **Install lockfile**

### Other components

- **awesome-copilot**
- **Marketplace user**
- **CLI user**

## Connections

- awesome-copilot → Asset ingestion: supplies pinned assets (evidence: `README.md`)
- Curation data → Asset ingestion: configures curation (evidence: `lib/ingest.mjs`)
- Asset ingestion → Frontmatter parser: parses metadata (evidence: `lib/ingest.mjs`)
- Asset ingestion → Safety heuristics: scans content (evidence: `lib/ingest.mjs`)
- Asset ingestion → Curation schemas: validates curation (evidence: `lib/ingest.mjs`)
- Asset ingestion → Generated index: generates index (evidence: `README.md`)
- Marketplace user → Marketplace UI: browses
- Marketplace UI → Generated index: fetches index (evidence: `web/src/App.jsx`)
- Marketplace UI → Asset cards: renders cards (evidence: `web/src/App.jsx`)
- Marketplace UI → Asset details: renders details (evidence: `web/src/App.jsx`)
- Marketplace UI → Install cart UI: renders cart (evidence: `web/src/App.jsx`)
- Marketplace UI → Cart sharing: encodes cart (evidence: `web/src/App.jsx`)
- Install cart UI → Cart sharing: creates commands (evidence: `web/src/components/InstallCart.jsx`)
- CLI user → CLI command: runs command (evidence: `README.md`)
- CLI command → Command routing: dispatches to (evidence: `cli/bin/agenthub.mjs`)
- Command routing → Registry access: opens registry (evidence: `cli/src/main.mjs`)
- Registry access → Generated index: reads index (evidence: `cli/src/registry.mjs`)
- Command routing → Verified installer: invokes install (evidence: `cli/src/main.mjs`)
- Verified installer → Asset resolution: resolves specs (evidence: `cli/src/install.mjs`)
- Verified installer → Registry access: fetches source files (evidence: `cli/src/registry.mjs`)
- Registry access → awesome-copilot: fetches pinned files (evidence: `cli/src/registry.mjs`)
- Verified installer → Local or global files: writes verified files (evidence: `cli/src/install.mjs`)
- Verified installer → Install lockfile: updates install record (evidence: `cli/src/install.mjs`)
- Command routing → Install lockfile: reads installed state (evidence: `cli/src/main.mjs`)
