# gechr/prl architecture

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

- Interactive diagram: https://gitdiagram.com/gechr/prl
- Repository: https://github.com/gechr/prl

## Overview

prl is a GitHub pull-request search, browsing, and action CLI. Its principal workflow turns flags and free-text terms into GitHub search criteria, retrieves and filters pull requests, then presents results or performs requested actions. The README also documents a full-screen TUI, continuous refresh, grouping, cloning, browser and clipboard actions, and plugin-backed Slack delivery. Source excerpts show search execution, REST actions, and TUI refresh behavior; other links below rely on documented capabilities, so evidence is limited to those excerpts and README statements.

Main entry points: [`main.go`](https://github.com/gechr/prl/blob/main/main.go) (Workflow orchestration), [`tui.go`](https://github.com/gechr/prl/blob/main/tui.go) (Interactive browser), [`cli.go`](https://github.com/gechr/prl/blob/main/cli.go) (Flags and CLI), [`github.go`](https://github.com/gechr/prl/blob/main/github.go) (GitHub clients)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inputs["Query and configuration"]
  node_cli["Flags and CLI<br/>[cli.go]"]
  node_config["Configuration<br/>[config.go]"]
  node_query["Query parsing<br/>[query.go]"]
end

subgraph group_github["GitHub data and actions"]
  node_search["Search planning<br/>[search.go]"]
  node_github_api["GitHub clients<br/>[github.go]"]
  node_pr_data["Pull request data<br/>[types.go]"]
  node_actions["PR actions<br/>[api.go]"]
  node_review_actions["Review actions<br/>[review.go]"]
  node_cache[("Result cache<br/>[list_cache.go]")]
end

subgraph group_experience["Result experiences"]
  node_main["Workflow orchestration<br/>[main.go]"]
  node_output["Output rendering<br/>[output.go]"]
  node_grouping["Result grouping<br/>[group.go]"]
  node_table["Table display<br/>[table.go]"]
  node_tui["Interactive browser<br/>[tui.go]"]
  node_tui_actions["TUI actions<br/>[tui_actions.go]"]
  node_tui_filters["TUI filters<br/>[tui_filters.go]"]
  node_browser["Browser opening<br/>[browser.go]"]
  node_clone["Repository cloning<br/>[clone.go]"]
end

subgraph group_extensions["Integrations"]
  node_plugin["Plugin integration<br/>[plugin.go]"]
end

subgraph group_review["AI review"]
  node_ai_review["AI review launch<br/>[review.go]"]
  node_prompt["Review prompts<br/>[review_prompt.go]"]
end

node_user(("CLI user"))
node_github_service{{"GitHub"}}
node_gh_cli{{"gh CLI"}}
node_slack{{"Slack"}}

node_user -->|"sets flags"| node_cli
node_cli -->|"loads defaults"| node_config
node_cli -->|"supplies terms"| node_query
node_query -->|"builds criteria"| node_search
node_search -->|"executes search"| node_github_api
node_github_api -->|"queries pull requests"| node_github_service
node_github_api -->|"returns results"| node_pr_data
node_main -.->|"fetches matches"| node_search
node_main -.->|"renders results"| node_output
node_main -->|"groups results"| node_grouping
node_output -.->|"renders table"| node_table
node_main -->|"launches browser"| node_tui
node_tui -.->|"filters results"| node_tui_filters
node_tui -->|"dispatches actions"| node_tui_actions
node_tui -->|"saves results"| node_cache
node_main -->|"runs requested actions"| node_actions
node_actions -->|"updates pull requests"| node_github_service
node_main -->|"clones repositories"| node_clone
node_main -->|"opens pages"| node_browser
node_main -->|"uses plugin"| node_plugin
node_plugin -->|"sends results"| node_slack
node_main -.->|"launches review"| node_ai_review
node_ai_review -->|"renders prompt"| node_prompt
node_ai_review -->|"starts review session"| node_gh_cli

click node_cli "https://github.com/gechr/prl/blob/main/cli.go"
click node_config "https://github.com/gechr/prl/blob/main/config.go"
click node_query "https://github.com/gechr/prl/blob/main/query.go"
click node_search "https://github.com/gechr/prl/blob/main/search.go"
click node_github_api "https://github.com/gechr/prl/blob/main/github.go"
click node_pr_data "https://github.com/gechr/prl/blob/main/types.go"
click node_actions "https://github.com/gechr/prl/blob/main/api.go"
click node_review_actions "https://github.com/gechr/prl/blob/main/review.go"
click node_cache "https://github.com/gechr/prl/blob/main/list_cache.go"
click node_main "https://github.com/gechr/prl/blob/main/main.go"
click node_output "https://github.com/gechr/prl/blob/main/output.go"
click node_grouping "https://github.com/gechr/prl/blob/main/group.go"
click node_table "https://github.com/gechr/prl/blob/main/table.go"
click node_tui "https://github.com/gechr/prl/blob/main/tui.go"
click node_tui_actions "https://github.com/gechr/prl/blob/main/tui_actions.go"
click node_tui_filters "https://github.com/gechr/prl/blob/main/tui_filters.go"
click node_browser "https://github.com/gechr/prl/blob/main/browser.go"
click node_clone "https://github.com/gechr/prl/blob/main/clone.go"
click node_plugin "https://github.com/gechr/prl/blob/main/plugin.go"
click node_ai_review "https://github.com/gechr/prl/blob/main/review.go"
click node_prompt "https://github.com/gechr/prl/blob/main/review_prompt.go"

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_cli,node_config,node_query,node_user toneBlue
class node_search,node_github_api,node_pr_data,node_actions,node_review_actions,node_cache toneAmber
class node_main,node_output,node_grouping,node_table,node_tui,node_tui_actions,node_tui_filters,node_browser,node_clone toneMint
class node_plugin toneRose
class node_ai_review,node_prompt,node_github_service,node_gh_cli,node_slack toneIndigo
```

## Components

### Query and configuration

- [Flags and CLI](https://github.com/gechr/prl/blob/main/cli.go): `cli.go`
- [Configuration](https://github.com/gechr/prl/blob/main/config.go): `config.go`
- [Query parsing](https://github.com/gechr/prl/blob/main/query.go): `query.go`

### GitHub data and actions

- [Search planning](https://github.com/gechr/prl/blob/main/search.go): `search.go`
- [GitHub clients](https://github.com/gechr/prl/blob/main/github.go): `github.go`
- [Pull request data](https://github.com/gechr/prl/blob/main/types.go): `types.go`
- [PR actions](https://github.com/gechr/prl/blob/main/api.go): `api.go`
- [Review actions](https://github.com/gechr/prl/blob/main/review.go): `review.go`
- [Result cache](https://github.com/gechr/prl/blob/main/list_cache.go): `list_cache.go`

### Result experiences

- [Workflow orchestration](https://github.com/gechr/prl/blob/main/main.go): `main.go`
- [Output rendering](https://github.com/gechr/prl/blob/main/output.go): `output.go`
- [Result grouping](https://github.com/gechr/prl/blob/main/group.go): `group.go`
- [Table display](https://github.com/gechr/prl/blob/main/table.go): `table.go`
- [Interactive browser](https://github.com/gechr/prl/blob/main/tui.go): `tui.go`
- [TUI actions](https://github.com/gechr/prl/blob/main/tui_actions.go): `tui_actions.go`
- [TUI filters](https://github.com/gechr/prl/blob/main/tui_filters.go): `tui_filters.go`
- [Browser opening](https://github.com/gechr/prl/blob/main/browser.go): `browser.go`
- [Repository cloning](https://github.com/gechr/prl/blob/main/clone.go): `clone.go`

### Integrations

- [Plugin integration](https://github.com/gechr/prl/blob/main/plugin.go): `plugin.go`

### AI review

- [AI review launch](https://github.com/gechr/prl/blob/main/review.go): `review.go`
- [Review prompts](https://github.com/gechr/prl/blob/main/review_prompt.go): `review_prompt.go`

### Other components

- **CLI user**
- **GitHub**
- **gh CLI**
- **Slack**

## Connections

- CLI user → Flags and CLI: sets flags
- Flags and CLI → Configuration: loads defaults
- Flags and CLI → Query parsing: supplies terms
- Query parsing → Search planning: builds criteria (evidence: `search.go`)
- Search planning → GitHub clients: executes search (evidence: `search.go`)
- GitHub clients → GitHub: queries pull requests
- GitHub clients → Pull request data: returns results
- Workflow orchestration → Search planning: fetches matches
- Workflow orchestration → Output rendering: renders results
- Workflow orchestration → Result grouping: groups results (evidence: `main.go`)
- Output rendering → Table display: renders table
- Workflow orchestration → Interactive browser: launches browser
- Interactive browser → TUI filters: filters results
- Interactive browser → TUI actions: dispatches actions (evidence: `tui.go`)
- Interactive browser → Result cache: saves results (evidence: `tui.go`)
- Workflow orchestration → PR actions: runs requested actions (evidence: `main.go`)
- PR actions → GitHub: updates pull requests (evidence: `api.go`)
- Workflow orchestration → Repository cloning: clones repositories
- Workflow orchestration → Browser opening: opens pages
- Workflow orchestration → Plugin integration: uses plugin
- Plugin integration → Slack: sends results
- Workflow orchestration → AI review launch: launches review
- AI review launch → Review prompts: renders prompt (evidence: `review_prompt.go`)
- AI review launch → gh CLI: starts review session (evidence: `review.go`)
