How sha547/repo-architecture-viz works
Repo Architecture Visualizer is a Chrome extension for turning a GitHub repository’s files and imports into an interactive dependency graph. The main workflow starts with the injected GitHub button, opens the viewer, fetches repository data through the background worker, then parses and resolves imports, builds and analyzes the graph, and renders it. The viewer also offers search/filtering and exports; optional AI explanation sends graph structure—not source code—to Anthropic. Background and viewer excerpts support the main calls; README statements support documented features whose implementation details were not sampled.
Main entry points: viewer.ts Viewer Workflow · background.ts Background Worker · content.ts Repo Button · extract-imports.ts Import Extraction
Components 17
Entry and Viewer
- Repo Button
src/content/content.ts - Viewer Workflow
src/viewer/viewer.ts
Repository Acquisition
- Background Worker
src/background/background.ts - Repo Fetching
src/background/background.ts - SHA-Keyed Cache
src/background/background.ts
Graph Analysis
- Import Extraction
src/viewer/parser/extract-imports.ts - Parse Worker
src/viewer/parser/worker.ts - Path Resolution
src/viewer/parser/resolver.ts - Graph Builder
src/viewer/graph/builder.ts - Graph Analytics
src/viewer/graph/analytics.ts
Graph Presentation
- Force Graph
src/viewer/graph/force-layout.ts - Search and Filter
src/viewer/viewer.ts - Graph Exporters
src/viewer/exporters.ts
Other components
- GitHub User
- GitHub API
- Anthropic API
- Chrome Local Storage
Connections 18
- GitHub User → Repo Button: clicks button
README.md - Repo Button → Background Worker: opens viewer
src/content/content.ts - Background Worker → Viewer Workflow: opens tab
src/background/background.ts - Viewer Workflow → Background Worker: requests repo data
src/viewer/viewer.ts - Background Worker → Repo Fetching: dispatches fetch
src/background/background.ts - Repo Fetching → GitHub API: fetches tree and files
src/background/background.ts - Repo Fetching → SHA-Keyed Cache: reads and writes
src/background/background.ts - Background Worker → Chrome Local Storage: stores credentials
src/background/background.ts - Viewer Workflow → Import Extraction: extracts imports
src/viewer/viewer.ts - Parse Worker → Import Extraction: uses extractor
src/viewer/parser/worker.ts - Viewer Workflow → Path Resolution: resolves paths
src/viewer/viewer.ts - Viewer Workflow → Graph Builder: builds graph
src/viewer/viewer.ts - Viewer Workflow → Graph Analytics: computes metrics
src/viewer/viewer.ts - Viewer Workflow → Force Graph: renders graph
src/viewer/viewer.ts - Viewer Workflow → Search and Filter: provides controls
README.md - Viewer Workflow → Graph Exporters: exports graph
src/viewer/viewer.ts - Viewer Workflow → Background Worker: requests explanation
src/viewer/viewer.ts - Background Worker → Anthropic API: sends graph summary
src/background/background.ts