Developer Tool · GitHub API · Import Graph Analysis · 2026 · Solo build

Branch Delta

Two-tree GitHub PR structural import diff: fetch base and head commit trees, extract module-level imports via regex across TS/JS/Python, compute directed graph delta (added/removed edges, new/dropped modules), format a GitHub Flavored Markdown table, and POST it as a PR review comment — server-side API route keeps the PAT out of the browser.

The problem

Reviewing a pull request for structural changes — new module dependencies introduced, removed ones, net coupling delta — requires manually scanning every changed file. There is no tooling that computes and posts this as a structured review comment.

Architecture

Key decisions

01

Server-side API route keeps PAT out of browser

All GitHub API calls are server-side (Next.js API route with runtime: nodejs). The PAT is sent in the POST body and used only server-side, never forwarded to any client-side state or logged.

02

Regex-based import extraction over AST parsing

Top-level static imports are reliably captured by three regexes (ESM from, CJS require, Python import/from). AST parsing would require a TypeScript/Babel dependency and significantly longer build times for marginal coverage improvement of edge cases not relevant to structural footprint analysis.

03

Two-tree API approach over file diff approach

The GitHub Trees API provides the full file tree at any SHA, enabling the computation of a complete structural adjacency graph for each commit rather than just analyzing the line-level diff. This surfaces cross-file coupling changes that wouldn't appear in a simple diff.

04

Bounded parallel fetch (50 files cap)

Changed source files are bounded at 50 to avoid GitHub secondary rate limits on large PRs. Within that bound, all file content fetches run in parallel to minimize latency.

Metrics

42 tests
TDD tests (42/42 pass)
3 languages
TS/JS/Python import extraction