# elshadhu/repositorycontextpackager architecture

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

- Interactive diagram: https://gitdiagram.com/elshadhu/repositorycontextpackager
- Repository: https://github.com/elshadhu/repositorycontextpackager

## Overview

RepositoryContextPackager is a CLI that turns selected local files and Git metadata into a shareable repository-context report. The main workflow loads config, parses and merges CLI options, then renders either a token-count tree or a report with repository location, Git details, directory structure, file contents, and statistics. Filtering, file traversal, and utility functions support these stages. The README documents recent-file and include/exclude filtering, multiple input paths, and directory-only output. Some implementation details are unsampled, so unsupported internal links are omitted.

Main entry points: [`src/renderer.cpp`](https://github.com/elshadhu/repositorycontextpackager/blob/main/src/renderer.cpp) (Report orchestrator), [`src/main.cpp`](https://github.com/elshadhu/repositorycontextpackager/blob/main/src/main.cpp) (Application entry), [`src/utils.cpp`](https://github.com/elshadhu/repositorycontextpackager/blob/main/src/utils.cpp) (File utilities), [`src/config_manager.cpp`](https://github.com/elshadhu/repositorycontextpackager/blob/main/src/config_manager.cpp) (Config merge)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["CLI and configuration"]
  node_cli["CLI options<br/>[cli.cpp]"]
  node_config["Config merge<br/>[config_manager.cpp]"]
  node_main["Application entry<br/>[main.cpp]"]
end

subgraph group_analysis["Repository analysis"]
  node_git["Git metadata<br/>[git_info.cpp]"]
  node_tree["Directory traversal<br/>[fs_travel.cpp]"]
end

subgraph group_render["Report generation"]
  node_renderer["Report orchestrator<br/>[renderer.cpp]"]
  node_report["Context report"]
  node_token_tree["Token-count tree<br/>[renderer.cpp]"]
  node_structure["Structure section<br/>[renderer.cpp]"]
  node_contents["File contents<br/>[renderer.cpp]"]
  node_statistics["File statistics<br/>[renderer.cpp]"]
end

subgraph group_support["Filtering and utilities"]
  node_filter["Filter manager<br/>[filter.cpp]"]
  node_utils["File utilities<br/>[utils.cpp]"]
  node_git_discovery["Git repository discovery<br/>[utils.hpp]"]
end

node_developer(("Developer"))

node_developer -->|"provides arguments"| node_cli
node_main -->|"loads and merges"| node_config
node_main -->|"parses arguments"| node_cli
node_main -->|"dispatches rendering"| node_renderer
node_renderer -->|"writes output"| node_report
node_renderer -->|"finds repository"| node_git_discovery
node_renderer -->|"requests metadata"| node_git
node_renderer -->|"renders structure"| node_structure
node_structure -->|"traverses directories"| node_tree
node_renderer -->|"renders file contents"| node_contents
node_renderer -->|"counts files and lines"| node_statistics
node_renderer -->|"renders token view"| node_token_tree
node_renderer -->|"checks selected files"| node_filter
node_renderer -->|"reads and counts files"| node_utils
node_tree -->|"reads file contents"| node_utils
node_config -->|"configures include and recent filters"| node_utils

click node_cli "https://github.com/elshadhu/repositorycontextpackager/blob/main/src/cli.cpp"
click node_config "https://github.com/elshadhu/repositorycontextpackager/blob/main/src/config_manager.cpp"
click node_main "https://github.com/elshadhu/repositorycontextpackager/blob/main/src/main.cpp"
click node_renderer "https://github.com/elshadhu/repositorycontextpackager/blob/main/src/renderer.cpp"
click node_git "https://github.com/elshadhu/repositorycontextpackager/blob/main/src/git_info.cpp"
click node_tree "https://github.com/elshadhu/repositorycontextpackager/blob/main/src/fs_travel.cpp"
click node_filter "https://github.com/elshadhu/repositorycontextpackager/blob/main/src/filter.cpp"
click node_utils "https://github.com/elshadhu/repositorycontextpackager/blob/main/src/utils.cpp"
click node_git_discovery "https://github.com/elshadhu/repositorycontextpackager/blob/main/include/utils.hpp"
click node_token_tree "https://github.com/elshadhu/repositorycontextpackager/blob/main/src/renderer.cpp"
click node_structure "https://github.com/elshadhu/repositorycontextpackager/blob/main/src/renderer.cpp"
click node_contents "https://github.com/elshadhu/repositorycontextpackager/blob/main/src/renderer.cpp"
click node_statistics "https://github.com/elshadhu/repositorycontextpackager/blob/main/src/renderer.cpp"

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_cli,node_config,node_main toneBlue
class node_git,node_tree toneAmber
class node_renderer,node_report,node_token_tree,node_structure,node_contents,node_statistics toneMint
class node_filter,node_utils,node_git_discovery toneRose
class node_developer toneIndigo
```

## Components

### CLI and configuration

- [CLI options](https://github.com/elshadhu/repositorycontextpackager/blob/main/src/cli.cpp): `src/cli.cpp`
- [Config merge](https://github.com/elshadhu/repositorycontextpackager/blob/main/src/config_manager.cpp): `src/config_manager.cpp`
- [Application entry](https://github.com/elshadhu/repositorycontextpackager/blob/main/src/main.cpp): `src/main.cpp`

### Repository analysis

- [Git metadata](https://github.com/elshadhu/repositorycontextpackager/blob/main/src/git_info.cpp): `src/git_info.cpp`
- [Directory traversal](https://github.com/elshadhu/repositorycontextpackager/blob/main/src/fs_travel.cpp): `src/fs_travel.cpp`

### Report generation

- [Report orchestrator](https://github.com/elshadhu/repositorycontextpackager/blob/main/src/renderer.cpp): `src/renderer.cpp`
- **Context report**
- [Token-count tree](https://github.com/elshadhu/repositorycontextpackager/blob/main/src/renderer.cpp): `src/renderer.cpp`
- [Structure section](https://github.com/elshadhu/repositorycontextpackager/blob/main/src/renderer.cpp): `src/renderer.cpp`
- [File contents](https://github.com/elshadhu/repositorycontextpackager/blob/main/src/renderer.cpp): `src/renderer.cpp`
- [File statistics](https://github.com/elshadhu/repositorycontextpackager/blob/main/src/renderer.cpp): `src/renderer.cpp`

### Filtering and utilities

- [Filter manager](https://github.com/elshadhu/repositorycontextpackager/blob/main/src/filter.cpp): `src/filter.cpp`
- [File utilities](https://github.com/elshadhu/repositorycontextpackager/blob/main/src/utils.cpp): `src/utils.cpp`
- [Git repository discovery](https://github.com/elshadhu/repositorycontextpackager/blob/main/include/utils.hpp): `include/utils.hpp`

### Other components

- **Developer**

## Connections

- Developer → CLI options: provides arguments (evidence: `README.md`)
- Application entry → Config merge: loads and merges (evidence: `src/main.cpp`)
- Application entry → CLI options: parses arguments (evidence: `src/main.cpp`)
- Application entry → Report orchestrator: dispatches rendering (evidence: `src/main.cpp`)
- Report orchestrator → Context report: writes output (evidence: `src/renderer.cpp`)
- Report orchestrator → Git repository discovery: finds repository (evidence: `src/renderer.cpp`)
- Report orchestrator → Git metadata: requests metadata (evidence: `src/renderer.cpp`)
- Report orchestrator → Structure section: renders structure (evidence: `src/renderer.cpp`)
- Structure section → Directory traversal: traverses directories (evidence: `src/renderer.cpp`)
- Report orchestrator → File contents: renders file contents (evidence: `src/renderer.cpp`)
- Report orchestrator → File statistics: counts files and lines (evidence: `src/renderer.cpp`)
- Report orchestrator → Token-count tree: renders token view (evidence: `src/renderer.cpp`)
- Report orchestrator → Filter manager: checks selected files (evidence: `src/renderer.cpp`)
- Report orchestrator → File utilities: reads and counts files (evidence: `src/renderer.cpp`)
- Directory traversal → File utilities: reads file contents (evidence: `src/fs_travel.cpp`)
- Config merge → File utilities: configures include and recent filters (evidence: `src/config_manager.cpp`)
