How kabirkhanuja/repoarchitectagent works
Purpose and Entry Points
RepoArchitectAgent analyzes a GitHub repository, builds a structured representation, produces AI-assisted explanations/diagrams/recommendations, and presents results in a browser. Backend entry point: api/index.py (FastAPI, served via Uvicorn). Frontend entry points: web/app/page.tsx and web/app/dashboard/page.tsx (Next.js App Router). A CLI-capable analysis orchestrator exists at api/orchestration/analyze_repo.py.
API Boundary and Request Orchestration
api/index.py exposes analysis and generation endpoints. It coordinates repository analysis and dedicated LLM-backed output generation, returning data consumed by the Next.js client. api/orchestration/actions.py and api/orchestration/analyze_repo.py form the workflow layer separating HTTP handling from repository-processing steps.
Repository Acquisition and Metadata
The ingestion boundary accepts a GitHub repository reference, clones or materializes it locally, and gathers GitHub-facing metadata. api/ingestion/clone_repo.py manages source checkout; api/ingestion/github_meta.py handles repository metadata. Local filesystem and Git operations are isolated through api/utils/fs.py and api/utils/git.py, with cleanup in api/utils/cleanup.py.
Static Analysis Pipeline
Analysis reads the checked-out repository and derives stack, structure, dependencies, and risks. Key stages are api/analysis/detect_stack.py, api/analysis/parse_structure.py, api/analysis/dependencies.py, and api/analysis/risks.py. Shared parsing logic in api/helpers/repo_parsers.py provides the boundary between raw source files and normalized analysis facts.
Intermediate Representation
The system consolidates analysis results into a repository IR, rather than coupling generators directly to filesystem scans. api/ir/schema.py defines the representation contract and api/ir/builder.py constructs it. This IR is the principal handoff from deterministic analysis to API responses and AI-generated artifacts.
AI Generation and External Services
LLM adapters generate repository summaries, Mermaid source, and CI-oriented output from analysis/IR context: api/llm/summarize.py, api/llm/generate_mermaid.py, and api/llm/generate_ci.py. The stated external providers are Groq (LLaMA) and optional Anthropic Claude; GitHub API access supports metadata and recommendation-oriented analysis. Environment-driven configuration is centralized in api/config.py.
Web Presentation
The Next.js/TypeScript frontend calls the backend through web/lib/api.ts, with result shapes in web/lib/types.ts. Repository submission and user flow are centered in web/components/repository-analyzer.tsx; results rendering is in web/components/analysis-results.tsx; Mermaid visualization is rendered by web/components/MermaidViewer.tsx. This client is a presentation layer and depends on FastAPI for repository processing and AI calls.
Automation and Deployment
Kestra can execute the repository-analysis workflow through kestra/blueprint_repo_analysis.yml. GitHub Actions define CI/deployment automation in .github/workflows/ci-generated.yml and .github/workflows/deploy.yml. Material runtimes are Python 3.9+ for FastAPI/analysis and Node.js 18+ for Next.js; the frontend is suitable for Vercel-style deployment, while API hosting must provide credentials and local temporary clone storage.
Main entry points: builder.py IR builder · index.py FastAPI API · actions.py Workflow actions · summarize.py Summary generator
Components 20
FastAPI & workflow
- FastAPI API · HTTP boundary for analysis and generation.
api/index.py - Analysis workflow
api/orchestration/analyze_repo.py - Workflow actions
api/orchestration/actions.py
Repository ingestion
- Repository checkout
api/ingestion/clone_repo.py - GitHub metadata
api/ingestion/github_meta.py - Local repository · Checked-out source available to pipeline stages.
Analysis & IR
- Source parsers
api/helpers/repo_parsers.py - Static analysis · Detects stack, structure, dependencies, and risks.
api/analysis/detect_stack.py - IR builder
api/ir/builder.py - Repository IR schema
api/ir/schema.py
AI generation
- Summary generator
api/llm/summarize.py - Diagram generator
api/llm/generate_mermaid.py - CI generator
api/llm/generate_ci.py - Groq / Claude
Next.js client
- App & dashboard pages
web/app/page.tsx - Repository analyzer
web/components/repository-analyzer.tsx - Backend API client
web/lib/api.ts - Results & Mermaid viewer
web/components/analysis-results.tsx
Automation
- Kestra workflow
kestra/blueprint_repo_analysis.yml - GitHub Actions
.github/workflows/ci-generated.yml
Connections 23
- App & dashboard pages → Repository analyzer: hosts
- Repository analyzer → Backend API client: submits repository
- Backend API client → FastAPI API: calls
- FastAPI API → Analysis workflow: orchestrates
- Analysis workflow → Workflow actions: uses
- Workflow actions → Repository checkout: checks out
- Workflow actions → GitHub metadata: collects
- Repository checkout → Local repository: materializes
- Local repository → Source parsers: source files
- Source parsers → Static analysis: normalized facts
- Static analysis → IR builder: analysis results
- Repository IR schema → IR builder: defines
- IR builder → Summary generator: IR context
- IR builder → Diagram generator: IR context
- IR builder → CI generator: IR context
- Summary generator → Groq / Claude: generates via
- Diagram generator → Groq / Claude: generates via
- CI generator → Groq / Claude: generates via
- Summary generator → FastAPI API: artifacts
- Diagram generator → Results & Mermaid viewer: Mermaid source
- FastAPI API → Results & Mermaid viewer: analysis response
- Kestra workflow → Analysis workflow: executes
- GitHub Actions → Kestra workflow: CI/deployment automation