# jianfengye/redline architecture

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

- Interactive diagram: https://gitdiagram.com/jianfengye/redline
- Repository: https://github.com/jianfengye/redline

## Overview

Redline is a VS Code/Cursor code-review extension. The main workflow is to import a merge request or choose a branch comparison, prepare repositories and diffs, browse changed files in the editor, then inspect function impact and AI guidance or read and post review comments. The graph preserves these distinct stages and the documented Remote-SSH bridge. Source excerpts are partial, so links between several UI and orchestration components rely on README-described behavior; unsampled implementation details are not inferred.

Main entry points: [`src/review/ReviewController.ts`](https://github.com/jianfengye/redline/blob/main/src/review/ReviewController.ts) (Review controller), [`src/ai/aiReviewActions.ts`](https://github.com/jianfengye/redline/blob/main/src/ai/aiReviewActions.ts) (AI review actions), [`src/review/ReviewContentProvider.ts`](https://github.com/jianfengye/redline/blob/main/src/review/ReviewContentProvider.ts) (Review content), [`src/ai/collectFileGuideImpact.ts`](https://github.com/jianfengye/redline/blob/main/src/ai/collectFileGuideImpact.ts) (Impact collection)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_review["Review preparation"]
  node_extension["Extension entry<br/>[extension.ts]"]
  node_mr_input["MR import<br/>[mrInputPanel.ts]"]
  node_controller["Review controller"]
  node_repo_discovery["Repository discovery<br/>[discoverRepos.ts]"]
  node_git["Git operations<br/>[GitService.ts]"]
  node_remote_update["Remote updates<br/>[remoteUpdate.ts]"]
  node_diff["Diff model<br/>[diff.ts]"]
end

subgraph group_editor["Editor review"]
  node_change_tree["Changed files tree"]
  node_editor_open["Editor navigation<br/>[openTarget.ts]"]
  node_virtual_content["Review content"]
  node_review_uri["Review URI<br/>[reviewUri.ts]"]
end

subgraph group_impact["Impact analysis"]
  node_impact_menu["Impact command<br/>[impactMenu.ts]"]
  node_impact_query["LSP caller query<br/>[queryImpact.ts]"]
  node_impact_walk["Impact traversal<br/>[walkImpact.ts]"]
  node_impact_store["Impact results<br/>[ImpactStore.ts]"]
  node_impact_view["Impact tree view<br/>[ImpactView.ts]"]
end

subgraph group_ai["AI guidance"]
  node_ai_actions["AI review actions<br/>[aiReviewActions.ts]"]
  node_ai_collect["Impact collection"]
  node_ai_guide["Guide generation<br/>[aiGuideCore.ts]"]
  node_ai_runner["Cursor CLI runner"]
  node_ai_panels["AI review panels<br/>[AiReviewPanel.ts]"]
  node_ai_webview["Guide webview<br/>[AiGuideWebview.ts]"]
  node_bridge_protocol["Bridge protocol"]
  node_local_bridge["Local SSH bridge<br/>[extension.ts]"]
end

subgraph group_comments["MR discussions"]
  node_comment_api["MR comment API<br/>[mrComment.ts]"]
  node_comment_views["Comment views<br/>[CommentPanel.ts]"]
  node_editor_comments["Inline comments<br/>[EditorComments.ts]"]
end

node_engineer(("Reviewer"))
node_cursor_cli["Cursor CLI"]

node_engineer -->|"uses"| node_extension
node_engineer -->|"pastes MR"| node_mr_input
node_mr_input -->|"submits review"| node_controller
node_controller -->|"matches repositories"| node_repo_discovery
node_controller -->|"prepares branches"| node_git
node_controller -->|"updates tree"| node_change_tree
node_git -->|"parses changes"| node_diff
node_controller -->|"checks updates"| node_remote_update
node_engineer -->|"selects changes"| node_change_tree
node_controller -->|"opens files"| node_editor_open
node_controller -->|"serves review files"| node_virtual_content
node_virtual_content -->|"reads URI"| node_review_uri
node_virtual_content -->|"loads file content"| node_git
node_engineer -->|"requests impact"| node_impact_menu
node_impact_menu -->|"queries callers"| node_impact_query
node_impact_query -->|"walks callers"| node_impact_walk
node_impact_store -->|"stores paths"| node_impact_walk
node_impact_view -->|"renders paths"| node_impact_walk
node_engineer -->|"starts AI review"| node_ai_actions
node_ai_actions -->|"collects impact"| node_ai_collect
node_ai_collect -->|"queries callers"| node_impact_query
node_ai_collect -->|"uses results"| node_impact_store
node_ai_actions -->|"parses guidance"| node_ai_guide
node_ai_actions -->|"runs agent"| node_ai_runner
node_ai_runner -.->|"invokes"| node_cursor_cli
node_ai_actions -->|"shows results"| node_ai_panels
node_ai_actions -->|"opens guide"| node_ai_webview
node_ai_actions -->|"dispatches progress"| node_bridge_protocol
node_local_bridge -->|"uses protocol"| node_bridge_protocol
node_local_bridge -.->|"runs locally"| node_cursor_cli
node_engineer -->|"reads discussions"| node_comment_views
node_comment_views -->|"loads and replies"| node_comment_api
node_engineer -->|"adds inline comment"| node_editor_comments
node_editor_comments -->|"posts comment"| node_comment_api

click node_extension "https://github.com/jianfengye/redline/blob/main/src/extension.ts"
click node_mr_input "https://github.com/jianfengye/redline/blob/main/src/review/mrInputPanel.ts"
click node_controller "https://github.com/jianfengye/redline/blob/main/src/review/ReviewController.ts"
click node_repo_discovery "https://github.com/jianfengye/redline/blob/main/src/review/discoverRepos.ts"
click node_git "https://github.com/jianfengye/redline/blob/main/src/git/GitService.ts"
click node_remote_update "https://github.com/jianfengye/redline/blob/main/src/git/remoteUpdate.ts"
click node_diff "https://github.com/jianfengye/redline/blob/main/src/shared/diff.ts"
click node_change_tree "https://github.com/jianfengye/redline/blob/main/src/review/ChangesTreeProvider.ts"
click node_editor_open "https://github.com/jianfengye/redline/blob/main/src/editor/openTarget.ts"
click node_virtual_content "https://github.com/jianfengye/redline/blob/main/src/review/ReviewContentProvider.ts"
click node_review_uri "https://github.com/jianfengye/redline/blob/main/src/review/reviewUri.ts"
click node_impact_menu "https://github.com/jianfengye/redline/blob/main/src/editor/impactMenu.ts"
click node_impact_query "https://github.com/jianfengye/redline/blob/main/src/impact/queryImpact.ts"
click node_impact_walk "https://github.com/jianfengye/redline/blob/main/src/impact/walkImpact.ts"
click node_impact_store "https://github.com/jianfengye/redline/blob/main/src/impact/ImpactStore.ts"
click node_impact_view "https://github.com/jianfengye/redline/blob/main/src/impact/ImpactView.ts"
click node_ai_actions "https://github.com/jianfengye/redline/blob/main/src/ai/aiReviewActions.ts"
click node_ai_collect "https://github.com/jianfengye/redline/blob/main/src/ai/collectFileGuideImpact.ts"
click node_ai_guide "https://github.com/jianfengye/redline/blob/main/src/ai/aiGuideCore.ts"
click node_ai_runner "https://github.com/jianfengye/redline/blob/main/src/ai/CursorAgentRunner.ts"
click node_ai_panels "https://github.com/jianfengye/redline/blob/main/src/ai/AiReviewPanel.ts"
click node_ai_webview "https://github.com/jianfengye/redline/blob/main/src/ai/AiGuideWebview.ts"
click node_bridge_protocol "https://github.com/jianfengye/redline/blob/main/src/ai/localBridgeProtocol.ts"
click node_local_bridge "https://github.com/jianfengye/redline/blob/main/local-bridge/src/extension.ts"
click node_comment_api "https://github.com/jianfengye/redline/blob/main/src/review/mrComment.ts"
click node_comment_views "https://github.com/jianfengye/redline/blob/main/src/review/CommentPanel.ts"
click node_editor_comments "https://github.com/jianfengye/redline/blob/main/src/review/EditorComments.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_extension,node_mr_input,node_controller,node_repo_discovery,node_git,node_remote_update,node_diff,node_engineer toneBlue
class node_change_tree,node_editor_open,node_virtual_content,node_review_uri toneAmber
class node_impact_menu,node_impact_query,node_impact_walk,node_impact_store,node_impact_view toneMint
class node_ai_actions,node_ai_collect,node_ai_guide,node_ai_runner,node_ai_panels,node_ai_webview,node_bridge_protocol,node_local_bridge toneRose
class node_comment_api,node_comment_views,node_editor_comments,node_cursor_cli toneIndigo
```

## Components

### Review preparation

- [Extension entry](https://github.com/jianfengye/redline/blob/main/src/extension.ts): `src/extension.ts`
- [MR import](https://github.com/jianfengye/redline/blob/main/src/review/mrInputPanel.ts): `src/review/mrInputPanel.ts`
- [Review controller](https://github.com/jianfengye/redline/blob/main/src/review/ReviewController.ts): `src/review/ReviewController.ts`
- [Repository discovery](https://github.com/jianfengye/redline/blob/main/src/review/discoverRepos.ts): `src/review/discoverRepos.ts`
- [Git operations](https://github.com/jianfengye/redline/blob/main/src/git/GitService.ts): `src/git/GitService.ts`
- [Remote updates](https://github.com/jianfengye/redline/blob/main/src/git/remoteUpdate.ts): `src/git/remoteUpdate.ts`
- [Diff model](https://github.com/jianfengye/redline/blob/main/src/shared/diff.ts): `src/shared/diff.ts`

### Editor review

- [Changed files tree](https://github.com/jianfengye/redline/blob/main/src/review/ChangesTreeProvider.ts): `src/review/ChangesTreeProvider.ts`
- [Editor navigation](https://github.com/jianfengye/redline/blob/main/src/editor/openTarget.ts): `src/editor/openTarget.ts`
- [Review content](https://github.com/jianfengye/redline/blob/main/src/review/ReviewContentProvider.ts): `src/review/ReviewContentProvider.ts`
- [Review URI](https://github.com/jianfengye/redline/blob/main/src/review/reviewUri.ts): `src/review/reviewUri.ts`

### Impact analysis

- [Impact command](https://github.com/jianfengye/redline/blob/main/src/editor/impactMenu.ts): `src/editor/impactMenu.ts`
- [LSP caller query](https://github.com/jianfengye/redline/blob/main/src/impact/queryImpact.ts): `src/impact/queryImpact.ts`
- [Impact traversal](https://github.com/jianfengye/redline/blob/main/src/impact/walkImpact.ts): `src/impact/walkImpact.ts`
- [Impact results](https://github.com/jianfengye/redline/blob/main/src/impact/ImpactStore.ts): `src/impact/ImpactStore.ts`
- [Impact tree view](https://github.com/jianfengye/redline/blob/main/src/impact/ImpactView.ts): `src/impact/ImpactView.ts`

### AI guidance

- [AI review actions](https://github.com/jianfengye/redline/blob/main/src/ai/aiReviewActions.ts): `src/ai/aiReviewActions.ts`
- [Impact collection](https://github.com/jianfengye/redline/blob/main/src/ai/collectFileGuideImpact.ts): `src/ai/collectFileGuideImpact.ts`
- [Guide generation](https://github.com/jianfengye/redline/blob/main/src/ai/aiGuideCore.ts): `src/ai/aiGuideCore.ts`
- [Cursor CLI runner](https://github.com/jianfengye/redline/blob/main/src/ai/CursorAgentRunner.ts): `src/ai/CursorAgentRunner.ts`
- [AI review panels](https://github.com/jianfengye/redline/blob/main/src/ai/AiReviewPanel.ts): `src/ai/AiReviewPanel.ts`
- [Guide webview](https://github.com/jianfengye/redline/blob/main/src/ai/AiGuideWebview.ts): `src/ai/AiGuideWebview.ts`
- [Bridge protocol](https://github.com/jianfengye/redline/blob/main/src/ai/localBridgeProtocol.ts): `src/ai/localBridgeProtocol.ts`
- [Local SSH bridge](https://github.com/jianfengye/redline/blob/main/local-bridge/src/extension.ts): `local-bridge/src/extension.ts`

### MR discussions

- [MR comment API](https://github.com/jianfengye/redline/blob/main/src/review/mrComment.ts): `src/review/mrComment.ts`
- [Comment views](https://github.com/jianfengye/redline/blob/main/src/review/CommentPanel.ts): `src/review/CommentPanel.ts`
- [Inline comments](https://github.com/jianfengye/redline/blob/main/src/review/EditorComments.ts): `src/review/EditorComments.ts`

### Other components

- **Reviewer**
- **Cursor CLI**

## Connections

- Reviewer → Extension entry: uses (evidence: `README.md`)
- Reviewer → MR import: pastes MR (evidence: `README.md`)
- MR import → Review controller: submits review (evidence: `README.md`)
- Review controller → Repository discovery: matches repositories (evidence: `README.md`)
- Review controller → Git operations: prepares branches (evidence: `src/review/ReviewController.ts`)
- Review controller → Changed files tree: updates tree (evidence: `src/review/ChangesTreeProvider.ts`)
- Git operations → Diff model: parses changes (evidence: `src/git/GitService.ts`)
- Review controller → Remote updates: checks updates (evidence: `README.md`)
- Reviewer → Changed files tree: selects changes (evidence: `README.md`)
- Review controller → Editor navigation: opens files (evidence: `src/review/ReviewController.ts`)
- Review controller → Review content: serves review files (evidence: `src/review/ReviewController.ts`)
- Review content → Review URI: reads URI (evidence: `src/review/ReviewContentProvider.ts`)
- Review content → Git operations: loads file content (evidence: `src/review/ReviewContentProvider.ts`)
- Reviewer → Impact command: requests impact (evidence: `README.md`)
- Impact command → LSP caller query: queries callers
- LSP caller query → Impact traversal: walks callers (evidence: `src/impact/queryImpact.ts`)
- Impact results → Impact traversal: stores paths (evidence: `src/impact/ImpactStore.ts`)
- Impact tree view → Impact traversal: renders paths (evidence: `src/impact/ImpactView.ts`)
- Reviewer → AI review actions: starts AI review (evidence: `README.md`)
- AI review actions → Impact collection: collects impact (evidence: `src/ai/aiReviewActions.ts`)
- Impact collection → LSP caller query: queries callers (evidence: `src/ai/collectFileGuideImpact.ts`)
- Impact collection → Impact results: uses results (evidence: `src/ai/collectFileGuideImpact.ts`)
- AI review actions → Guide generation: parses guidance (evidence: `src/ai/aiReviewActions.ts`)
- AI review actions → Cursor CLI runner: runs agent (evidence: `src/ai/aiReviewActions.ts`)
- Cursor CLI runner → Cursor CLI: invokes
- AI review actions → AI review panels: shows results (evidence: `README.md`)
- AI review actions → Guide webview: opens guide (evidence: `src/ai/aiReviewActions.ts`)
- AI review actions → Bridge protocol: dispatches progress (evidence: `src/ai/aiReviewActions.ts`)
- Local SSH bridge → Bridge protocol: uses protocol (evidence: `local-bridge/src/extension.ts`)
- Local SSH bridge → Cursor CLI: runs locally (evidence: `README.md`)
- Reviewer → Comment views: reads discussions (evidence: `README.md`)
- Comment views → MR comment API: loads and replies (evidence: `src/review/CommentPanel.ts`)
- Reviewer → Inline comments: adds inline comment (evidence: `README.md`)
- Inline comments → MR comment API: posts comment (evidence: `src/review/EditorComments.ts`)
