# stuinfla/repo-explainer architecture

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

- Interactive diagram: https://gitdiagram.com/stuinfla/repo-explainer
- Repository: https://github.com/stuinfla/repo-explainer

## Overview

explainmyrepo turns a GitHub repository into a quality-gated explainer page, an editable GitHub repository, and an AI knowledge pack. Its principal workflow runs from repository submission through cloning, source understanding, creative direction, authoring, visualization, assembly, grading, and deployment. The README documents this sequence and the major capabilities; sampled source supports the shared build context, knowledge-base query path, and diagram generation, but does not expose every station’s implementation.

Main entry points: [`src/orchestrator.mjs`](https://github.com/stuinfla/repo-explainer/blob/main/src/orchestrator.mjs) (Station orchestrator), [`kb/build-kb.mjs`](https://github.com/stuinfla/repo-explainer/blob/main/kb/build-kb.mjs) (Knowledge-base builder), [`tools/deploy.mjs`](https://github.com/stuinfla/repo-explainer/blob/main/tools/deploy.mjs) (Deploy gate), [`src/brain.mjs`](https://github.com/stuinfla/repo-explainer/blob/main/src/brain.mjs) (Explainer authoring)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_build["Build orchestration"]
  node_runner["Build runner<br/>[agentic-runner.mjs]"]
  node_orchestrator["Station orchestrator<br/>[orchestrator.mjs]"]
  node_context["Build context<br/>[build-context.mjs]"]
end

subgraph group_understanding["Repository understanding"]
  node_clone["Repository clone<br/>[clone-repo.mjs]"]
  node_kb_build["Knowledge-base builder<br/>[build-kb.mjs]"]
  node_kb_analysis["Source analysis"]
  node_primer["Grounded primer<br/>[index-primer.mjs]"]
end

subgraph group_creation["Explainer creation"]
  node_concept["Concept tournament"]
  node_brain["Explainer authoring<br/>[brain.mjs]"]
  node_visuals["Visual generation<br/>[make-diagrams.mjs]"]
  node_assembly["Page and pack<br/>[assemble-page.mjs]"]
end

subgraph group_delivery["Quality and delivery"]
  node_grader["Quality grading<br/>[quality-grade.mjs]"]
  node_refine["Refinement loop<br/>[orchestrator.mjs]"]
  node_deploy["Deploy gate<br/>[deploy.mjs]"]
  node_publish["Repo publishing<br/>[publish-repo.mjs]"]
  node_outputs["Three build artifacts"]
end

node_visitor(("Repository submitter"))
node_source_repo["Target repository"]
node_model_services{{"Model services"}}
node_hosting{{"Hosting service"}}

node_visitor -->|"submits repo"| node_runner
node_runner -->|"starts build"| node_orchestrator
node_orchestrator -->|"updates slots"| node_context
node_orchestrator -->|"dispatches clone"| node_clone
node_clone -->|"clones source"| node_source_repo
node_orchestrator -->|"dispatches build"| node_kb_build
node_kb_build -->|"extracts structure"| node_kb_analysis
node_kb_build -->|"authors primer"| node_primer
node_orchestrator -->|"dispatches contest"| node_concept
node_concept -->|"requests pitches"| node_model_services
node_orchestrator -->|"dispatches authoring"| node_brain
node_brain -->|"generates content"| node_model_services
node_orchestrator -->|"dispatches visuals"| node_visuals
node_visuals -.->|"generates imagery"| node_model_services
node_orchestrator -->|"dispatches assembly"| node_assembly
node_assembly -->|"writes page and pack"| node_outputs
node_orchestrator -->|"dispatches grading"| node_grader
node_orchestrator -->|"runs refine loop"| node_refine
node_refine -->|"re-authors weak copy"| node_brain
node_refine -->|"reassembles page"| node_assembly
node_refine -->|"regrades build"| node_grader
node_orchestrator -->|"dispatches deploy"| node_deploy
node_deploy -->|"deploys and verifies"| node_hosting
node_orchestrator -->|"dispatches publishing"| node_publish
node_publish -->|"publishes explainer repo"| node_outputs
node_deploy -->|"returns live page"| node_outputs

click node_runner "https://github.com/stuinfla/repo-explainer/blob/main/bin/agentic-runner.mjs"
click node_orchestrator "https://github.com/stuinfla/repo-explainer/blob/main/src/orchestrator.mjs"
click node_context "https://github.com/stuinfla/repo-explainer/blob/main/src/build-context.mjs"
click node_clone "https://github.com/stuinfla/repo-explainer/blob/main/tools/clone-repo.mjs"
click node_kb_build "https://github.com/stuinfla/repo-explainer/blob/main/kb/build-kb.mjs"
click node_kb_analysis "https://github.com/stuinfla/repo-explainer/tree/main/kb"
click node_primer "https://github.com/stuinfla/repo-explainer/blob/main/kb/index-primer.mjs"
click node_concept "https://github.com/stuinfla/repo-explainer/blob/main/tools/concept-tournament.mjs"
click node_brain "https://github.com/stuinfla/repo-explainer/blob/main/src/brain.mjs"
click node_visuals "https://github.com/stuinfla/repo-explainer/blob/main/tools/make-diagrams.mjs"
click node_assembly "https://github.com/stuinfla/repo-explainer/blob/main/tools/assemble-page.mjs"
click node_grader "https://github.com/stuinfla/repo-explainer/blob/main/tools/quality-grade.mjs"
click node_refine "https://github.com/stuinfla/repo-explainer/blob/main/src/orchestrator.mjs"
click node_deploy "https://github.com/stuinfla/repo-explainer/blob/main/tools/deploy.mjs"
click node_publish "https://github.com/stuinfla/repo-explainer/blob/main/tools/publish-repo.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_runner,node_orchestrator,node_context toneBlue
class node_clone,node_kb_build,node_kb_analysis,node_primer toneAmber
class node_concept,node_brain,node_visuals,node_assembly toneMint
class node_grader,node_refine,node_deploy,node_publish,node_outputs toneRose
class node_visitor,node_source_repo,node_model_services,node_hosting toneIndigo
```

## Components

### Build orchestration

- [Build runner](https://github.com/stuinfla/repo-explainer/blob/main/bin/agentic-runner.mjs): `bin/agentic-runner.mjs`
- [Station orchestrator](https://github.com/stuinfla/repo-explainer/blob/main/src/orchestrator.mjs): `src/orchestrator.mjs`
- [Build context](https://github.com/stuinfla/repo-explainer/blob/main/src/build-context.mjs): `src/build-context.mjs`

### Repository understanding

- [Repository clone](https://github.com/stuinfla/repo-explainer/blob/main/tools/clone-repo.mjs): `tools/clone-repo.mjs`
- [Knowledge-base builder](https://github.com/stuinfla/repo-explainer/blob/main/kb/build-kb.mjs): `kb/build-kb.mjs`
- [Source analysis](https://github.com/stuinfla/repo-explainer/tree/main/kb): `kb`
- [Grounded primer](https://github.com/stuinfla/repo-explainer/blob/main/kb/index-primer.mjs): `kb/index-primer.mjs`

### Explainer creation

- [Concept tournament](https://github.com/stuinfla/repo-explainer/blob/main/tools/concept-tournament.mjs): `tools/concept-tournament.mjs`
- [Explainer authoring](https://github.com/stuinfla/repo-explainer/blob/main/src/brain.mjs): `src/brain.mjs`
- [Visual generation](https://github.com/stuinfla/repo-explainer/blob/main/tools/make-diagrams.mjs): `tools/make-diagrams.mjs`
- [Page and pack](https://github.com/stuinfla/repo-explainer/blob/main/tools/assemble-page.mjs): `tools/assemble-page.mjs`

### Quality and delivery

- [Quality grading](https://github.com/stuinfla/repo-explainer/blob/main/tools/quality-grade.mjs): `tools/quality-grade.mjs`
- [Refinement loop](https://github.com/stuinfla/repo-explainer/blob/main/src/orchestrator.mjs): `src/orchestrator.mjs`
- [Deploy gate](https://github.com/stuinfla/repo-explainer/blob/main/tools/deploy.mjs): `tools/deploy.mjs`
- [Repo publishing](https://github.com/stuinfla/repo-explainer/blob/main/tools/publish-repo.mjs): `tools/publish-repo.mjs`
- **Three build artifacts**

### Other components

- **Repository submitter**
- **Target repository**
- **Model services**
- **Hosting service**

## Connections

- Repository submitter → Build runner: submits repo
- Build runner → Station orchestrator: starts build
- Station orchestrator → Build context: updates slots
- Station orchestrator → Repository clone: dispatches clone
- Repository clone → Target repository: clones source
- Station orchestrator → Knowledge-base builder: dispatches build
- Knowledge-base builder → Source analysis: extracts structure
- Knowledge-base builder → Grounded primer: authors primer
- Station orchestrator → Concept tournament: dispatches contest
- Concept tournament → Model services: requests pitches
- Station orchestrator → Explainer authoring: dispatches authoring
- Explainer authoring → Model services: generates content
- Station orchestrator → Visual generation: dispatches visuals
- Visual generation → Model services: generates imagery
- Station orchestrator → Page and pack: dispatches assembly
- Page and pack → Three build artifacts: writes page and pack
- Station orchestrator → Quality grading: dispatches grading
- Station orchestrator → Refinement loop: runs refine loop
- Refinement loop → Explainer authoring: re-authors weak copy
- Refinement loop → Page and pack: reassembles page
- Refinement loop → Quality grading: regrades build
- Station orchestrator → Deploy gate: dispatches deploy
- Deploy gate → Hosting service: deploys and verifies
- Station orchestrator → Repo publishing: dispatches publishing
- Repo publishing → Three build artifacts: publishes explainer repo
- Deploy gate → Three build artifacts: returns live page
