Build a TypeScript pull-request reviewer that combines Git diffs, TypeScript Compiler API diagnostics, local AST rules, and OpenAI structured output. The result is a small CLI that can run locally or in CI while keeping compiler failures separate from contextual AI feedback.

What You Will Build

TypeScript is valuable because it makes contracts visible before code runs. A pull request can weaken those contracts without producing an immediate compiler error: a new any annotation can erase checking at a boundary, an assertion through unknown can force incompatible values into a trusted type, and a diagnostic suppression can hide a real mismatch. These patterns are not always defects, but they deserve deliberate review.

This tutorial builds type-guardian, a command-line reviewer for the current Git branch. It follows a layered approach:

The Git diff defines the pull-request scope.