Skip to content
LE0-LinPublic

About

Commit-pinned interactive codebase walkthroughs with Git-blob SHA-1 span verification, bounded static ingestion, and portable Tour schemas.

Topics

Resources

Stars

2 stars

Watchers

1 watching

Forks

Repository files navigation

RepoPlay

Commit-Pinned Interactive Codebase Walkthroughs with Git-Blob Verification & Bounded Static Ingestion
Trace end-to-end features from CLI/API entrypoints to output artifacts—backed by exact 40-char Git commits, SHA-verified source snapshots, and zero-execution safety boundaries.

CI TypeScript 5.9 Next.js 16 React 19 Zod 4 MIT License

简体中文 · Architecture · Safety Boundaries · Quick Start · Roadmap

RepoPlay three-pane interactive codebase walkthrough showing feature path, illustrative state transition, and commit-pinned source lines

RepoPlay landing page and repository importer

Curated Tour Library & Bounded Public Repo Importer

RepoPlay branch comparison and tour continuation

Branch Output Comparison & Cross-Feature Continuation


Why RepoPlay?

Reading an unfamiliar repository by jumping across raw files loses causal flow, while free-form LLM codebase summaries frequently hallucinate file paths, drift across commits, or conflate schematic examples with runtime traces.

RepoPlay turns a concrete software feature into a deterministic, step-by-step interactive tour where every explanation and state transition is cryptographically anchored to immutable Git blobs:

  • Three-Pane Causal Walkthroughs: Synchronizes the Feature Execution Path (left), Step Narrative & Illustrative Input→Output State (center), and Exact Commit-Pinned Source Spans (right), with keyboard-accessible Path / Step / Source tabs on mobile viewports (docs/screenshots/mobile-source.jpg).
  • Cryptographic Source-Span Integrity (lib/tour.ts): Every TourDocument binds a full 40-character commit SHA, UTF-8 file snapshots, canonical Git blob SHA-1 digests, and 1-based line ranges—rejecting drifted or fabricated code excerpts at both build and import time.
  • Zero-Execution Untrusted Repo Ingestion (lib/github.ts): Reads public GitHub trees over strictly canonicalized API endpoints with hard byte, file-count, timeout, and stalled-stream cancellation budgets—never cloning, installing dependencies, or executing untrusted code.
  • Self-Contained Portable Artifacts: Tours export and import as standalone, schema-validated .tour.json bundles (docs/tour-document.schema.json) that re-verify blob hashes locally and clearly separate reviewed guides from unreviewed local imports.

Architecture & Verification Pipeline

flowchart LR
    GH["Public GitHub Repo<br/>(owner/repo)"] --> IMP["Bounded Static Importer<br/>(lib/github.ts)"]
    IMP -->|"40-char SHA + prioritized blobs<br/>(≤256 KB, ≤20s, secret-filtered)"| ADP["Optional ModelAdapter<br/>(lib/model.ts) or Curated JSON"]
    ADP --> VAL["Strict Schema & Span Verifier<br/>(lib/tour.ts · Zod 4)"]
    VAL -->|"Verify 1-based line ranges<br/>& Git blob SHA-1 equality"| DOC["Verified TourDocument<br/>({ tour, files })"]
    DOC --> UI["Responsive 3-Pane Player<br/>(Deep links · Branch diff · JSON export)"]
Loading

Included Source-Verified Tours

Out of the box—with zero API keys, network calls, or external services—RepoPlay ships three end-to-end architectural tours pinned to LE0-Lin/AgentConfigScore@633ccef:

Tour ID End-to-End Execution Path Steps Verified Anchor Spans
scan-to-report CLI Entry → Policy Load → File Discovery → Context Parse → Rule Match → Category-Capped Score → JSON / Terminal Report 7 cli.py, scanner.py, rules.py
rule-lookup Command Dispatch → Arg Parsing → Rule Catalog Lookup → Unique-ID Contract → Structured Explanation 5 cli.py, rules.py
auditable-exception Config Schema → Validation → Threshold Gate → Scoped Suppression → Retained Audit Trail 5 config.py, scanner.py

Security & Ingestion Boundaries

RepoPlay treats all imported repository metadata, source files, and .tour.json documents as untrusted data:

Boundary Enforced Contract
URL & Redirect Hardening Accepts only owner/repo on github.com; rejects embedded credentials, custom ports, query strings, arbitrary hosts, and HTTP redirects.
Resource & Stream Caps Caps upstream repo size (20 MB), Git tree entries (2,000), retained files (12), per-file size (48 KB), total decoded bytes (256 KB), GitHub timeout (20 s), and body-stream read deadline (5 s with reader cancellation).
Secret & Binary Filtering Excludes binary/invalid UTF-8 payloads, symlinks, submodules, lockfiles, .env/key paths, and common token patterns (sk-*, ghp_*, AKIA*, PEM private keys) prior to model serialization.
XSS & Provenance Isolation Renders all imported source and explanations strictly as React text nodes (never raw HTML); labels imported/generated tours as local / unreviewed in isolated per-tab sessionStorage.

Quick Start

Requires Node.js 20.9+ and npm:

git clone https://github.com/LE0-Lin/RepoPlay.git
cd RepoPlay
npm ci
npm run dev

Open http://127.0.0.1:3000 to explore the interactive tours immediately (binds to loopback 127.0.0.1 by default).

Optional: Configure OpenAI-Compatible Tour Generation

Built-in tours and .tour.json import/export require no configuration. To experiment with server-side tour generation on new public repositories, copy .env.example to .env.local:

REPOPLAY_GITHUB_TOKEN=
REPOPLAY_MODEL_ENDPOINT=https://your-provider.example/v1/chat/completions
REPOPLAY_MODEL_NAME=your-model
REPOPLAY_MODEL_API_KEY=your-key

Secrets remain strictly server-side (never NEXT_PUBLIC_*). Every model response must pass lib/tour.ts schema validation and exact character-for-character excerpt matching against the fetched commit blobs before the player accepts it.


Verification Suite & Project Structure

npm run typecheck        # Strict TypeScript 5.9 static type verification
npm test                 # 21 unit & boundary tests (schema, blob SHA, stream timeouts, host guards, adapter stubs)
npm run verify:samples   # Re-verifies all built-in tours against Git blob SHA-1s and line spans
npm run build            # Production Next.js 16 compilation
app/                 Next.js App Router pages, tour player routes & bounded API endpoints
components/          Three-pane desktop/mobile interactive Tour player & state/diff views
data/                Curated Tour JSON specifications & commit-pinned source snapshots
lib/tour.ts          Authoritative Zod 4 schema, 1-based span verifier & Git blob SHA checker
lib/github.ts        Hardened public GitHub tree/blob reader with byte & deadline budgets
lib/model.ts         Provider-agnostic structured generation adapter
tests/               21 deterministic contract, security-boundary & stream-cancellation tests
docs/                Published JSON Schemas (tour.schema.json, tour-document.schema.json) & UI captures

Released under the MIT License by Zhibo Lin (@LE0-Lin); embedded sample snapshots retain their upstream MIT notice.

About

Commit-pinned interactive codebase walkthroughs with Git-blob SHA-1 span verification, bounded static ingestion, and portable Tour schemas.

Topics

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages