How kvale-io/repobot-clean works
Purpose and Runtime
RepoBot is a standalone repository-intelligence system: a public Next.js site backed exclusively by MySQL, with reviewed repository records, controlled taxonomy, deterministic qualification, and separately modeled relationships/graph views. It uses Node 24, Next.js/TypeScript, MySQL 8.4, and GitHub repository metadata. Production is deployed by Hostinger from main; CI runs in GitHub Actions.
Key entry points: src/app/page.tsx, src/app/catalog/page.tsx, src/app/graph/page.tsx, src/server/operator/server.ts, and workflow scripts in scripts/.
Public Application and Discovery Surface
Next App Router pages render the catalog, individual repository records, relationship graph, agent/anatomy content, knowledge content, and recycling-yard discovery surface. Shared visual/SEO shell is centralized in src/app/layout.tsx, src/components/site-header.tsx, and src/components/structured-data.tsx.
Public routes read authoritative published data rather than CSV/JSON repository fixtures. Machine-facing discovery includes src/app/robots.ts, src/app/sitemap.ts, and src/app/llms.txt/route.ts.
Repository Authority and Persistence Boundary
MySQL is the sole runtime authority; versioned normalized schema is established by database/001_repository_system.sql and database/002_permanent_repository_ingestion.sql. Database connectivity and table definitions are isolated in src/server/db/config.ts, src/server/db/pool.ts, and src/server/db/tables.ts.
Store modules provide persistence boundaries for repositories, intake, revisions, qualification, releases, sources, and public recycling queries, e.g. src/server/db/repository-store.ts, src/server/db/intake-store.ts, and src/server/db/release-store.ts. CSV files under data/ are intake/policy inputs, not application fallback data.
Controlled Ingestion and Editorial Pipeline
Repository publication is an audited stateful pipeline: CSV intake creates staged candidates; identity handling deduplicates them; deterministic rules qualify candidates; editorial packets are exported/imported; prepared releases atomically publish or exactly roll back. Primary orchestration lives in src/server/services/intake-batch.ts, src/server/services/qualify-candidate.ts, and src/server/services/publication.ts.
Operational entry points are scripts/intake-csv.ts, scripts/qualify-run.ts, scripts/export-claude-packets.ts, scripts/import-claude-drafts.ts, and release scripts under scripts/release-*.ts. Claude is constrained to editorial draft exchange, with contract validation in src/core/editorial/claude-contract.ts and src/server/services/claude-editorial.ts; no AI provider is required at runtime.
Domain Validation and Policy Layers
Schemas and rules protect each major transition and prevent unreviewed data crossing into public views. Intake identity/schema, qualification rules, publication idempotency, and verification policy are defined in src/core/intake/identity.ts, src/core/qualification/rules-v1.ts, src/core/publication/idempotency.ts, and src/core/verification/policy.ts.
Taxonomy and relationships are independent controlled layers, represented by src/core/taxonomy/schema-v2.ts, src/core/relationships/schema-v2.ts, and src/core/relationships/public-v2.ts. This separation distinguishes approved repository classifications from evidence-verified claims and architectural links.
Graph, Catalog, and Public Projections
Catalog query/load/publication modules transform authoritative records into public listing and detail models: src/core/catalog/load.ts, src/core/catalog/query-v2.ts, and src/components/repository-detail-v2.tsx. The public recycling yard is a constrained discovery projection through src/core/recycling/public-query.ts and src/components/recycling-yard.tsx.
The Seven-role NodeScape graph has dedicated model, search, terminology, and presentation layers: src/core/graph/model-v2.ts, src/core/graph/nodescape-v2.ts, and src/components/repo-graph-nodescape.tsx. Graph UI does not redefine source relationships; it presents the controlled graph/relationship models.
Operator and External-Service Boundary
The operator service exposes controlled sessions, routing, candidate review, intake, and actions via src/server/operator/server.ts, src/server/operator/router.ts, and src/server/services/operator-actions.ts. GitHub access is bounded to source metadata acquisition in src/server/github/repository-source.ts.
Release quality is enforced by .github/workflows/release-gate.yml, which provisions disposable MySQL and validates migrations, clean data boundaries, tests, type checks, build, and production dependency audit. Destructive ingestion verification is intentionally constrained by scripts/verify-ingestion-foundation.ts.
Main entry points: repository-store.ts Repository stores · page.tsx Next.js public routes · intake-batch.ts Intake and qualification · intake-csv.ts Operational scripts
Components 19
Public application
- Next.js public routes · Catalog, records, graph, content, and discovery pages.
src/app/page.tsx - Site shell and SEO
src/app/layout.tsx - Machine discovery · Robots, sitemap, and LLM discovery outputs.
src/app/robots.ts
Domain models and projections
- Catalog projections · Builds published listing and repository detail models.
src/core/catalog/load.ts - Recycling-yard projection
src/core/recycling/public-query.ts - Taxonomy and relationships · Separates approved classifications, claims, and architectural links.
src/core/relationships/schema-v2.ts - NodeScape graph · Presents controlled relationship models without redefining them.
src/core/graph/model-v2.ts
Editorial pipeline
- Transition policy · Identity, qualification, publication, and verification controls.
src/core/qualification/rules-v1.ts - Intake and qualification · Stages CSV candidates, deduplicates identity, and applies deterministic rules.
src/server/services/intake-batch.ts - Editorial draft exchange · Validates constrained Claude packet imports and exports.
src/server/services/claude-editorial.ts - Atomic publication · Publishes prepared releases or rolls them back exactly.
src/server/services/publication.ts
Persistence and operations
- Operator service · Sessions, review routing, intake, and operational actions.
src/server/operator/server.ts - Operational scripts · CSV intake, qualification, editorial exchange, releases, and verification.
scripts/intake-csv.ts - Repository stores · Stores repositories, intake, revisions, qualification, releases, and sources.
src/server/db/repository-store.ts - MySQL authority · Sole runtime authority for published and pipeline state.
database/001_repository_system.sql - Release gate · Validates disposable-MySQL migrations, boundaries, checks, build, and dependency audit.
.github/workflows/release-gate.yml
Other components
- Visitors and crawlers
- GitHub metadata · Bounded repository-source metadata acquisition.
src/server/github/repository-source.ts - Hostinger production · Deploys the main branch.
Connections 25
- Visitors and crawlers → Next.js public routes: browse
- Visitors and crawlers → Machine discovery: discover
- Next.js public routes → Site shell and SEO: renders in
- Next.js public routes → Catalog projections: loads catalog
- Next.js public routes → Recycling-yard projection: loads discovery
- Next.js public routes → NodeScape graph: renders graph
- Machine discovery → Catalog projections: indexes published data
- Catalog projections → Repository stores: reads
- Recycling-yard projection → Repository stores: reads
- NodeScape graph → Taxonomy and relationships: presents
- Taxonomy and relationships → Repository stores: controlled records
- Operational scripts → Intake and qualification: runs
- Operator service → Intake and qualification: controls
- Intake and qualification → Transition policy: enforces
- Intake and qualification → Repository stores: stages candidates
- GitHub metadata → Intake and qualification: metadata
- Operational scripts → Editorial draft exchange: exchanges packets
- Editorial draft exchange → Repository stores: stores reviewed drafts
- Operational scripts → Atomic publication: releases
- Atomic publication → Transition policy: idempotency checks
- Atomic publication → Repository stores: publishes or rolls back
- Repository stores → MySQL authority: persists
- Release gate → MySQL authority: provisions disposable instance
- Release gate → Hostinger production: gates deployment from main
- Hostinger production → Next.js public routes: hosts