# romboooo/depcatcher architecture

> Architecture diagram of the GitHub repository romboooo/depcatcher, 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/romboooo/depcatcher
- Repository: https://github.com/romboooo/depcatcher

## Overview

depcatcher is a CLI for inspecting ELF runtime dependencies and analyzing configured sources. Users can inspect one ELF file, or provide a YAML config whose sources are analyzed as package.json files or ELF dependency graphs; results are printed to the terminal. The ELF workflow extracts metadata, expands search paths, resolves libraries, and recursively builds provider relationships. The README contains no capability details, so this map relies on the sampled implementation; command registration in the root command was not excerpted.

Main entry points: [`internal/cli/inspect.go`](https://github.com/romboooo/depcatcher/blob/main/internal/cli/inspect.go) (Inspect command), [`internal/cli/analyze.go`](https://github.com/romboooo/depcatcher/blob/main/internal/cli/analyze.go) (Analyze command), [`internal/graph/graph.go`](https://github.com/romboooo/depcatcher/blob/main/internal/graph/graph.go) (ELF graph builder), [`internal/elfscan/inspect.go`](https://github.com/romboooo/depcatcher/blob/main/internal/elfscan/inspect.go) (ELF inspector)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI workflows"]
  node_main["Program entry<br/>[main.go]"]
  node_root["Root command<br/>[root.go]"]
  node_inspect["Inspect command<br/>[inspect.go]"]
  node_analyze["Analyze command<br/>[analyze.go]"]
end

subgraph group_analysis["Dependency analysis"]
  node_config["Config reader<br/>[config.go]"]
  node_elfscan["ELF inspector<br/>[inspect.go]"]
  node_paths["Path expansion<br/>[paths.go]"]
  node_find["Library finder<br/>[find.go]"]
  node_graph["ELF graph builder<br/>[graph.go]"]
  node_packagejson["Package reader<br/>[read.go]"]
end

subgraph group_domain["Domain model"]
  node_unit["Unit model<br/>[unit.go]"]
  node_requirement["Requirement model<br/>[requirement.go]"]
end

node_user(("CLI user"))
node_terminal(("Terminal output"))

node_user -->|"invokes"| node_main
node_main -->|"executes"| node_root
node_user -.->|"requests inspection"| node_inspect
node_user -.->|"provides config"| node_analyze
node_inspect -->|"inspects ELF"| node_elfscan
node_inspect -->|"expands search paths"| node_paths
node_inspect -->|"resolves libraries"| node_find
node_inspect -->|"prints results"| node_terminal
node_analyze -->|"reads config"| node_config
node_analyze -->|"reads package source"| node_packagejson
node_analyze -->|"builds ELF graph"| node_graph
node_analyze -->|"prints units"| node_terminal
node_graph -->|"inspects units"| node_elfscan
node_graph -->|"expands paths"| node_paths
node_graph -->|"finds providers"| node_find
node_elfscan -->|"creates requirements"| node_requirement
node_elfscan -->|"builds unit"| node_unit
node_packagejson -->|"creates requirements"| node_requirement
node_packagejson -->|"builds unit"| node_unit

click node_main "https://github.com/romboooo/depcatcher/blob/main/main.go"
click node_root "https://github.com/romboooo/depcatcher/blob/main/internal/cli/root.go"
click node_inspect "https://github.com/romboooo/depcatcher/blob/main/internal/cli/inspect.go"
click node_analyze "https://github.com/romboooo/depcatcher/blob/main/internal/cli/analyze.go"
click node_config "https://github.com/romboooo/depcatcher/blob/main/internal/config/config.go"
click node_elfscan "https://github.com/romboooo/depcatcher/blob/main/internal/elfscan/inspect.go"
click node_paths "https://github.com/romboooo/depcatcher/blob/main/internal/resolver/paths.go"
click node_find "https://github.com/romboooo/depcatcher/blob/main/internal/resolver/find.go"
click node_graph "https://github.com/romboooo/depcatcher/blob/main/internal/graph/graph.go"
click node_packagejson "https://github.com/romboooo/depcatcher/blob/main/internal/packagejson/read.go"
click node_unit "https://github.com/romboooo/depcatcher/blob/main/internal/model/unit.go"
click node_requirement "https://github.com/romboooo/depcatcher/blob/main/internal/model/requirement.go"

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_root,node_inspect,node_analyze,node_user toneBlue
class node_config,node_elfscan,node_paths,node_find,node_graph,node_packagejson toneAmber
class node_unit,node_requirement toneMint
class node_terminal toneIndigo
```

## Components

### CLI workflows

- [Program entry](https://github.com/romboooo/depcatcher/blob/main/main.go): `main.go`
- [Root command](https://github.com/romboooo/depcatcher/blob/main/internal/cli/root.go): `internal/cli/root.go`
- [Inspect command](https://github.com/romboooo/depcatcher/blob/main/internal/cli/inspect.go): `internal/cli/inspect.go`
- [Analyze command](https://github.com/romboooo/depcatcher/blob/main/internal/cli/analyze.go): `internal/cli/analyze.go`

### Dependency analysis

- [Config reader](https://github.com/romboooo/depcatcher/blob/main/internal/config/config.go): `internal/config/config.go`
- [ELF inspector](https://github.com/romboooo/depcatcher/blob/main/internal/elfscan/inspect.go): `internal/elfscan/inspect.go`
- [Path expansion](https://github.com/romboooo/depcatcher/blob/main/internal/resolver/paths.go): `internal/resolver/paths.go`
- [Library finder](https://github.com/romboooo/depcatcher/blob/main/internal/resolver/find.go): `internal/resolver/find.go`
- [ELF graph builder](https://github.com/romboooo/depcatcher/blob/main/internal/graph/graph.go): `internal/graph/graph.go`
- [Package reader](https://github.com/romboooo/depcatcher/blob/main/internal/packagejson/read.go): `internal/packagejson/read.go`

### Domain model

- [Unit model](https://github.com/romboooo/depcatcher/blob/main/internal/model/unit.go): `internal/model/unit.go`
- [Requirement model](https://github.com/romboooo/depcatcher/blob/main/internal/model/requirement.go): `internal/model/requirement.go`

### Other components

- **CLI user**
- **Terminal output**

## Connections

- CLI user → Program entry: invokes (evidence: `main.go`)
- Program entry → Root command: executes (evidence: `main.go`)
- CLI user → Inspect command: requests inspection
- CLI user → Analyze command: provides config
- Inspect command → ELF inspector: inspects ELF (evidence: `internal/cli/inspect.go`)
- Inspect command → Path expansion: expands search paths (evidence: `internal/cli/inspect.go`)
- Inspect command → Library finder: resolves libraries (evidence: `internal/cli/inspect.go`)
- Inspect command → Terminal output: prints results (evidence: `internal/cli/inspect.go`)
- Analyze command → Config reader: reads config (evidence: `internal/cli/analyze.go`)
- Analyze command → Package reader: reads package source (evidence: `internal/cli/analyze.go`)
- Analyze command → ELF graph builder: builds ELF graph (evidence: `internal/cli/analyze.go`)
- Analyze command → Terminal output: prints units (evidence: `internal/cli/analyze.go`)
- ELF graph builder → ELF inspector: inspects units (evidence: `internal/graph/graph.go`)
- ELF graph builder → Path expansion: expands paths (evidence: `internal/graph/graph.go`)
- ELF graph builder → Library finder: finds providers (evidence: `internal/graph/graph.go`)
- ELF inspector → Requirement model: creates requirements (evidence: `internal/elfscan/inspect.go`)
- ELF inspector → Unit model: builds unit (evidence: `internal/elfscan/inspect.go`)
- Package reader → Requirement model: creates requirements (evidence: `internal/packagejson/read.go`)
- Package reader → Unit model: builds unit (evidence: `internal/packagejson/read.go`)
