# prooflinedev/cli architecture

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

- Interactive diagram: https://gitdiagram.com/prooflinedev/cli
- Repository: https://github.com/prooflinedev/cli

## Overview

Proofline CLI is a local client for Proofline’s review service. The main workflow selects repository changes or a scan target, applies local safety checks where relevant, requests or reads review data, then interprets and presents findings. Separate commands cover retained-review history, fix verification, coverage uploads, MCP tools and Git hooks. The graph also preserves authentication, agent registration and self-update capabilities. Source excerpts are partial; documented capabilities are included, while edges without visible call ownership are omitted.

Main entry points: [`src/api.rs`](https://github.com/prooflinedev/cli/blob/main/src/api.rs) (Review API client), [`src/lib.rs`](https://github.com/prooflinedev/cli/blob/main/src/lib.rs) (Command router), [`src/scan.rs`](https://github.com/prooflinedev/cli/blob/main/src/scan.rs) (Repository scans), [`src/git.rs`](https://github.com/prooflinedev/cli/blob/main/src/git.rs) (Git change selection)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI workflows"]
  node_commands["Command router<br/>[lib.rs]"]
  node_review["Review commands<br/>[lib.rs]"]
  node_scan["Repository scans<br/>[scan.rs]"]
  node_coverage["Coverage upload<br/>[coverage.rs]"]
  node_history["History and reruns<br/>[lib.rs]"]
  node_fixes["Fix verification<br/>[fixes.rs]"]
end

subgraph group_local["Repository workflows"]
  node_git["Git change selection<br/>[git.rs]"]
  node_preflight["Secret preflight<br/>[preflight.rs]"]
  node_hooks["Git hooks<br/>[hooks.rs]"]
end

subgraph group_service["Service access"]
  node_api["Review API client<br/>[api.rs]"]
  node_service(("Proofline service"))
end

subgraph group_results["Review results"]
  node_model["Review data model<br/>[model.rs]"]
  node_outcome["Outcome evaluation<br/>[outcome.rs]"]
  node_render["Terminal rendering<br/>[render.rs]"]
  node_sarif["SARIF export<br/>[sarif.rs]"]
  node_annotations["CI annotations<br/>[annotations.rs]"]
  node_github["GitHub Actions<br/>[github_actions.rs]"]
end

subgraph group_identity["Identity and extensions"]
  node_credentials["Credentials<br/>[credentials.rs]"]
  node_device["Device sign-in<br/>[device.rs]"]
  node_mcp["MCP bridge<br/>[mcp.rs]"]
  node_knowledge["Knowledge commands<br/>[knowledge.rs]"]
  node_agent["Agent registration<br/>[agent.rs]"]
  node_agentconfig["Client config editing<br/>[config.rs]"]
  node_update["Self-update<br/>[update.rs]"]
end

node_user(("CLI user"))

node_user -->|"runs commands"| node_commands
node_commands -->|"dispatches"| node_review
node_commands -->|"dispatches"| node_scan
node_commands -->|"dispatches"| node_coverage
node_commands -->|"dispatches"| node_history
node_commands -->|"dispatches"| node_fixes
node_review -->|"selects changes"| node_git
node_review -->|"checks secrets"| node_preflight
node_review -->|"requests reviews"| node_api
node_scan -->|"requests scan"| node_api
node_scan -->|"resolves target"| node_git
node_coverage -->|"uploads reports"| node_api
node_history -->|"reads records"| node_api
node_fixes -.->|"requests verification"| node_api
node_api -->|"sends HTTP"| node_service
node_api -->|"decodes responses"| node_model
node_review -.->|"prints findings"| node_render
node_render -->|"evaluates status"| node_outcome
node_sarif -->|"evaluates status"| node_outcome
node_sarif -->|"projects review"| node_model
node_github -.->|"prints annotations"| node_annotations
node_hooks -->|"selects commits"| node_git
node_hooks -->|"requests reviews"| node_api
node_device -->|"requests credentials"| node_api
node_device -->|"loads credentials"| node_credentials
node_mcp -->|"forwards calls"| node_api
node_knowledge -->|"calls tools"| node_api
node_knowledge -->|"uses tools"| node_mcp
node_agent -->|"edits client config"| node_agentconfig
node_update -->|"checks update"| node_api

click node_commands "https://github.com/prooflinedev/cli/blob/main/src/lib.rs"
click node_review "https://github.com/prooflinedev/cli/blob/main/src/lib.rs"
click node_scan "https://github.com/prooflinedev/cli/blob/main/src/scan.rs"
click node_coverage "https://github.com/prooflinedev/cli/blob/main/src/coverage.rs"
click node_history "https://github.com/prooflinedev/cli/blob/main/src/lib.rs"
click node_fixes "https://github.com/prooflinedev/cli/blob/main/src/fixes.rs"
click node_git "https://github.com/prooflinedev/cli/blob/main/src/git.rs"
click node_preflight "https://github.com/prooflinedev/cli/blob/main/src/preflight.rs"
click node_hooks "https://github.com/prooflinedev/cli/blob/main/src/hooks.rs"
click node_api "https://github.com/prooflinedev/cli/blob/main/src/api.rs"
click node_credentials "https://github.com/prooflinedev/cli/blob/main/src/credentials.rs"
click node_device "https://github.com/prooflinedev/cli/blob/main/src/device.rs"
click node_mcp "https://github.com/prooflinedev/cli/blob/main/src/mcp.rs"
click node_knowledge "https://github.com/prooflinedev/cli/blob/main/src/knowledge.rs"
click node_agent "https://github.com/prooflinedev/cli/blob/main/src/agent.rs"
click node_agentconfig "https://github.com/prooflinedev/cli/blob/main/src/agent/config.rs"
click node_update "https://github.com/prooflinedev/cli/blob/main/src/update.rs"
click node_model "https://github.com/prooflinedev/cli/blob/main/src/model.rs"
click node_outcome "https://github.com/prooflinedev/cli/blob/main/src/outcome.rs"
click node_render "https://github.com/prooflinedev/cli/blob/main/src/render.rs"
click node_sarif "https://github.com/prooflinedev/cli/blob/main/src/sarif.rs"
click node_annotations "https://github.com/prooflinedev/cli/blob/main/src/annotations.rs"
click node_github "https://github.com/prooflinedev/cli/blob/main/src/github_actions.rs"

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_commands,node_review,node_scan,node_coverage,node_history,node_fixes,node_user toneBlue
class node_git,node_preflight,node_hooks toneAmber
class node_api,node_service toneMint
class node_model,node_outcome,node_render,node_sarif,node_annotations,node_github toneRose
class node_credentials,node_device,node_mcp,node_knowledge,node_agent,node_agentconfig,node_update toneIndigo
```

## Components

### CLI workflows

- [Command router](https://github.com/prooflinedev/cli/blob/main/src/lib.rs): `src/lib.rs`
- [Review commands](https://github.com/prooflinedev/cli/blob/main/src/lib.rs): `src/lib.rs`
- [Repository scans](https://github.com/prooflinedev/cli/blob/main/src/scan.rs): `src/scan.rs`
- [Coverage upload](https://github.com/prooflinedev/cli/blob/main/src/coverage.rs): `src/coverage.rs`
- [History and reruns](https://github.com/prooflinedev/cli/blob/main/src/lib.rs): `src/lib.rs`
- [Fix verification](https://github.com/prooflinedev/cli/blob/main/src/fixes.rs): `src/fixes.rs`

### Repository workflows

- [Git change selection](https://github.com/prooflinedev/cli/blob/main/src/git.rs): `src/git.rs`
- [Secret preflight](https://github.com/prooflinedev/cli/blob/main/src/preflight.rs): `src/preflight.rs`
- [Git hooks](https://github.com/prooflinedev/cli/blob/main/src/hooks.rs): `src/hooks.rs`

### Service access

- [Review API client](https://github.com/prooflinedev/cli/blob/main/src/api.rs): `src/api.rs`
- **Proofline service**

### Review results

- [Review data model](https://github.com/prooflinedev/cli/blob/main/src/model.rs): `src/model.rs`
- [Outcome evaluation](https://github.com/prooflinedev/cli/blob/main/src/outcome.rs): `src/outcome.rs`
- [Terminal rendering](https://github.com/prooflinedev/cli/blob/main/src/render.rs): `src/render.rs`
- [SARIF export](https://github.com/prooflinedev/cli/blob/main/src/sarif.rs): `src/sarif.rs`
- [CI annotations](https://github.com/prooflinedev/cli/blob/main/src/annotations.rs): `src/annotations.rs`
- [GitHub Actions](https://github.com/prooflinedev/cli/blob/main/src/github_actions.rs): `src/github_actions.rs`

### Identity and extensions

- [Credentials](https://github.com/prooflinedev/cli/blob/main/src/credentials.rs): `src/credentials.rs`
- [Device sign-in](https://github.com/prooflinedev/cli/blob/main/src/device.rs): `src/device.rs`
- [MCP bridge](https://github.com/prooflinedev/cli/blob/main/src/mcp.rs): `src/mcp.rs`
- [Knowledge commands](https://github.com/prooflinedev/cli/blob/main/src/knowledge.rs): `src/knowledge.rs`
- [Agent registration](https://github.com/prooflinedev/cli/blob/main/src/agent.rs): `src/agent.rs`
- [Client config editing](https://github.com/prooflinedev/cli/blob/main/src/agent/config.rs): `src/agent/config.rs`
- [Self-update](https://github.com/prooflinedev/cli/blob/main/src/update.rs): `src/update.rs`

### Other components

- **CLI user**

## Connections

- CLI user → Command router: runs commands (evidence: `README.md`)
- Command router → Review commands: dispatches (evidence: `src/lib.rs`)
- Command router → Repository scans: dispatches (evidence: `src/scan.rs`)
- Command router → Coverage upload: dispatches (evidence: `src/coverage.rs`)
- Command router → History and reruns: dispatches (evidence: `src/lib.rs`)
- Command router → Fix verification: dispatches (evidence: `src/lib.rs`)
- Review commands → Git change selection: selects changes (evidence: `README.md`)
- Review commands → Secret preflight: checks secrets (evidence: `README.md`)
- Review commands → Review API client: requests reviews (evidence: `src/lib.rs`)
- Repository scans → Review API client: requests scan (evidence: `src/scan.rs`)
- Repository scans → Git change selection: resolves target (evidence: `src/scan.rs`)
- Coverage upload → Review API client: uploads reports (evidence: `src/coverage.rs`)
- History and reruns → Review API client: reads records (evidence: `src/lib.rs`)
- Fix verification → Review API client: requests verification
- Review API client → Proofline service: sends HTTP (evidence: `README.md`)
- Review API client → Review data model: decodes responses (evidence: `src/api.rs`)
- Review commands → Terminal rendering: prints findings (evidence: `src/lib.rs`)
- Terminal rendering → Outcome evaluation: evaluates status (evidence: `src/render.rs`)
- SARIF export → Outcome evaluation: evaluates status (evidence: `src/sarif.rs`)
- SARIF export → Review data model: projects review (evidence: `src/sarif.rs`)
- GitHub Actions → CI annotations: prints annotations
- Git hooks → Git change selection: selects commits (evidence: `src/hooks.rs`)
- Git hooks → Review API client: requests reviews (evidence: `src/hooks.rs`)
- Device sign-in → Review API client: requests credentials (evidence: `src/device.rs`)
- Device sign-in → Credentials: loads credentials (evidence: `src/device.rs`)
- MCP bridge → Review API client: forwards calls (evidence: `src/mcp.rs`)
- Knowledge commands → Review API client: calls tools (evidence: `src/knowledge.rs`)
- Knowledge commands → MCP bridge: uses tools (evidence: `src/knowledge.rs`)
- Agent registration → Client config editing: edits client config (evidence: `src/agent/config.rs`)
- Self-update → Review API client: checks update (evidence: `src/update.rs`)
