# akprasadop/blastradius architecture

> Architecture diagram of the GitHub repository akprasadop/blastradius, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/akprasadop/blastradius
- Repository: https://github.com/akprasadop/blastradius

## Overview

Blastradius evaluates TypeScript pull requests against Linear intent, combining deterministic AST impact analysis with Gemini review before commenting on the PR. The webhook handler owns the workflow: it extracts the ticket, fetches intent and changed files, clones the branch, runs analysis, applies a confidence gate, and posts the result. The README documents this pipeline; source excerpts show the handler’s calls and the AST walker’s implementation. The graph omits undocumented internals of GitHub’s API and the unsampled behavior of external services.

Main entry points: [`src/webhook/server.ts`](https://github.com/akprasadop/blastradius/blob/main/src/webhook/server.ts) (Webhook Workflow), [`src/llm/evaluator.ts`](https://github.com/akprasadop/blastradius/blob/main/src/llm/evaluator.ts) (Gemini Evaluator), [`src/github/app.ts`](https://github.com/akprasadop/blastradius/blob/main/src/github/app.ts) (GitHub App), [`src/linear/client.ts`](https://github.com/akprasadop/blastradius/blob/main/src/linear/client.ts) (Linear Client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingress["Webhook and GitHub"]
  node_handler["Webhook Workflow<br/>[server.ts]"]
  node_githubapp["GitHub App<br/>[app.ts]"]
end

subgraph group_intent["Requirement Intent"]
  node_parser["Issue ID Parser<br/>[parser.ts]"]
  node_linearclient["Linear Client<br/>[client.ts]"]
end

subgraph group_analysis["Blast Radius Analysis"]
  node_checkout["Ephemeral Clone<br/>[server.ts]"]
  node_walker["TypeScript AST Walker"]
  node_walkertypes["Analysis Result Types<br/>[types.ts]"]
end

subgraph group_review["Evaluation and Reporting"]
  node_evaluator["Gemini Evaluator<br/>[evaluator.ts]"]
  node_gate["Confidence Gate<br/>[server.ts]"]
  node_comment["PR Review Comment<br/>[server.ts]"]
end

node_pr(("Pull Request"))
node_github["GitHub API"]
node_linear["Linear API"]
node_gemini["Gemini API"]

node_pr -->|"sends webhook"| node_handler
node_handler -->|"uses app"| node_githubapp
node_githubapp -->|"configures webhooks"| node_github
node_handler -->|"extracts issue ID"| node_parser
node_handler -->|"fetches intent"| node_linearclient
node_linearclient -->|"fetches issue"| node_linear
node_handler -->|"fetches changed files"| node_github
node_handler -->|"clones branch"| node_checkout
node_checkout -->|"clones repository"| node_github
node_handler -->|"runs analysis"| node_walker
node_walker -->|"uses result types"| node_walkertypes
node_handler -->|"evaluates intent and impact"| node_evaluator
node_evaluator -->|"requests evaluation"| node_gemini
node_evaluator -->|"returns evaluation"| node_handler
node_handler -->|"checks confidence"| node_gate
node_gate -->|"constructs report"| node_comment
node_handler -->|"posts comment"| node_github

click node_handler "https://github.com/akprasadop/blastradius/blob/main/src/webhook/server.ts"
click node_githubapp "https://github.com/akprasadop/blastradius/blob/main/src/github/app.ts"
click node_parser "https://github.com/akprasadop/blastradius/blob/main/src/linear/parser.ts"
click node_linearclient "https://github.com/akprasadop/blastradius/blob/main/src/linear/client.ts"
click node_checkout "https://github.com/akprasadop/blastradius/blob/main/src/webhook/server.ts"
click node_walker "https://github.com/akprasadop/blastradius/blob/main/src/walker/TypeScriptWalker.ts"
click node_walkertypes "https://github.com/akprasadop/blastradius/blob/main/src/walker/types.ts"
click node_evaluator "https://github.com/akprasadop/blastradius/blob/main/src/llm/evaluator.ts"
click node_gate "https://github.com/akprasadop/blastradius/blob/main/src/webhook/server.ts"
click node_comment "https://github.com/akprasadop/blastradius/blob/main/src/webhook/server.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_handler,node_githubapp toneBlue
class node_parser,node_linearclient toneAmber
class node_checkout,node_walker,node_walkertypes,node_pr,node_github,node_linear,node_gemini toneMint
class node_evaluator,node_gate,node_comment toneRose
```

## Components

### Webhook and GitHub

- [Webhook Workflow](https://github.com/akprasadop/blastradius/blob/main/src/webhook/server.ts): `src/webhook/server.ts`
- [GitHub App](https://github.com/akprasadop/blastradius/blob/main/src/github/app.ts): `src/github/app.ts`

### Requirement Intent

- [Issue ID Parser](https://github.com/akprasadop/blastradius/blob/main/src/linear/parser.ts): `src/linear/parser.ts`
- [Linear Client](https://github.com/akprasadop/blastradius/blob/main/src/linear/client.ts): `src/linear/client.ts`

### Blast Radius Analysis

- [Ephemeral Clone](https://github.com/akprasadop/blastradius/blob/main/src/webhook/server.ts): `src/webhook/server.ts`
- [TypeScript AST Walker](https://github.com/akprasadop/blastradius/blob/main/src/walker/TypeScriptWalker.ts): `src/walker/TypeScriptWalker.ts`
- [Analysis Result Types](https://github.com/akprasadop/blastradius/blob/main/src/walker/types.ts): `src/walker/types.ts`

### Evaluation and Reporting

- [Gemini Evaluator](https://github.com/akprasadop/blastradius/blob/main/src/llm/evaluator.ts): `src/llm/evaluator.ts`
- [Confidence Gate](https://github.com/akprasadop/blastradius/blob/main/src/webhook/server.ts): `src/webhook/server.ts`
- [PR Review Comment](https://github.com/akprasadop/blastradius/blob/main/src/webhook/server.ts): `src/webhook/server.ts`

### Other components

- **Pull Request**
- **GitHub API**
- **Linear API**
- **Gemini API**

## Connections

- Pull Request → Webhook Workflow: sends webhook (evidence: `README.md`)
- Webhook Workflow → GitHub App: uses app (evidence: `src/webhook/server.ts`)
- GitHub App → GitHub API: configures webhooks (evidence: `src/github/app.ts`)
- Webhook Workflow → Issue ID Parser: extracts issue ID (evidence: `src/webhook/server.ts`)
- Webhook Workflow → Linear Client: fetches intent (evidence: `src/webhook/server.ts`)
- Linear Client → Linear API: fetches issue (evidence: `src/linear/client.ts`)
- Webhook Workflow → GitHub API: fetches changed files (evidence: `src/webhook/server.ts`)
- Webhook Workflow → Ephemeral Clone: clones branch (evidence: `src/webhook/server.ts`)
- Ephemeral Clone → GitHub API: clones repository (evidence: `README.md`)
- Webhook Workflow → TypeScript AST Walker: runs analysis (evidence: `src/webhook/server.ts`)
- TypeScript AST Walker → Analysis Result Types: uses result types (evidence: `src/walker/TypeScriptWalker.ts`)
- Webhook Workflow → Gemini Evaluator: evaluates intent and impact (evidence: `src/webhook/server.ts`)
- Gemini Evaluator → Gemini API: requests evaluation (evidence: `src/llm/evaluator.ts`)
- Gemini Evaluator → Webhook Workflow: returns evaluation (evidence: `src/webhook/server.ts`)
- Webhook Workflow → Confidence Gate: checks confidence (evidence: `src/webhook/server.ts`)
- Confidence Gate → PR Review Comment: constructs report (evidence: `src/webhook/server.ts`)
- Webhook Workflow → GitHub API: posts comment (evidence: `src/webhook/server.ts`)
