# krazi49/poli-cli architecture

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

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

## Overview

poli is a Python command-line wrapper that gives pacman an apt-like command vocabulary and adds AUR support. The main workflow routes a user command through the CLI to package operations, which query pacman or resolve and build AUR packages; progress output is handled by the display layer. Separate command branches provide search and package information, dependency trees, ownership lookup, integrity checks, system statistics, and operation history. The graph follows the sampled CLI, package, and reporting code; other README-listed capabilities are included where documented, with evidence limits reflected in omitted links.

Main entry points: [`poli/cli.py`](https://github.com/krazi49/poli-cli/blob/main/poli/cli.py) (CLI dispatch), [`poli/pacman.py`](https://github.com/krazi49/poli-cli/blob/main/poli/pacman.py) (Package operations), [`poli/aur.py`](https://github.com/krazi49/poli-cli/blob/main/poli/aur.py) (AUR queries), [`poli/tree.py`](https://github.com/krazi49/poli-cli/blob/main/poli/tree.py) (Dependency tree)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_commands["Command interface"]
  node_cli["CLI dispatch<br/>[cli.py]"]
end

subgraph group_packages["Package operations"]
  node_package_ops["Package operations<br/>[pacman.py]"]
  node_aur["AUR queries<br/>[aur.py]"]
  node_aur_build["AUR builder<br/>[pacman.py]"]
  node_pacman_runner["Pacman runner<br/>[pacman.py]"]
end

subgraph group_insights["System insights"]
  node_stats["Stats and audit<br/>[stats.py]"]
  node_history["Operation history<br/>[stats.py]"]
  node_dependency_tree["Dependency tree<br/>[tree.py]"]
  node_ownership["File ownership<br/>[cli.py]"]
end

subgraph group_support["Shared support"]
  node_display["Terminal display<br/>[display.py]"]
  node_config["User config<br/>[config.py]"]
end

node_user(("User"))
node_pacman["pacman"]
node_aur_rpc["AUR RPC"]
node_pacman_log[("pacman log")]

node_user -->|"runs command"| node_cli
node_cli -->|"dispatches operations"| node_package_ops
node_cli -->|"searches and looks up"| node_aur
node_cli -->|"runs reports"| node_stats
node_cli -->|"requests history"| node_history
node_cli -->|"requests tree"| node_dependency_tree
node_cli -->|"checks file owner"| node_pacman
node_package_ops -->|"queries and changes packages"| node_pacman
node_package_ops -->|"resolves dependencies"| node_aur
node_package_ops -->|"builds AUR packages"| node_aur_build
node_package_ops -->|"runs package commands"| node_pacman_runner
node_pacman_runner -->|"executes commands"| node_pacman
node_pacman_runner -->|"updates progress"| node_display
node_aur_build -->|"clones package source"| node_aur_rpc
node_aur -->|"queries package data"| node_aur_rpc
node_aur -->|"checks repository packages"| node_pacman
node_aur -->|"reports errors"| node_display
node_package_ops -->|"loads settings"| node_config
node_stats -->|"queries package state"| node_pacman
node_history -->|"reads operations"| node_pacman_log
node_dependency_tree -->|"reads dependencies"| node_pacman
node_dependency_tree -->|"prints tree"| node_display

click node_cli "https://github.com/krazi49/poli-cli/blob/main/poli/cli.py"
click node_package_ops "https://github.com/krazi49/poli-cli/blob/main/poli/pacman.py"
click node_aur "https://github.com/krazi49/poli-cli/blob/main/poli/aur.py"
click node_aur_build "https://github.com/krazi49/poli-cli/blob/main/poli/pacman.py"
click node_pacman_runner "https://github.com/krazi49/poli-cli/blob/main/poli/pacman.py"
click node_stats "https://github.com/krazi49/poli-cli/blob/main/poli/stats.py"
click node_history "https://github.com/krazi49/poli-cli/blob/main/poli/stats.py"
click node_dependency_tree "https://github.com/krazi49/poli-cli/blob/main/poli/tree.py"
click node_ownership "https://github.com/krazi49/poli-cli/blob/main/poli/cli.py"
click node_display "https://github.com/krazi49/poli-cli/blob/main/poli/display.py"
click node_config "https://github.com/krazi49/poli-cli/blob/main/poli/config.py"

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_user toneBlue
class node_package_ops,node_aur,node_aur_build,node_pacman_runner,node_pacman_log toneAmber
class node_stats,node_history,node_dependency_tree,node_ownership toneMint
class node_display,node_config toneRose
class node_pacman,node_aur_rpc toneIndigo
```

## Components

### Command interface

- [CLI dispatch](https://github.com/krazi49/poli-cli/blob/main/poli/cli.py): `poli/cli.py`

### Package operations

- [Package operations](https://github.com/krazi49/poli-cli/blob/main/poli/pacman.py): `poli/pacman.py`
- [AUR queries](https://github.com/krazi49/poli-cli/blob/main/poli/aur.py): `poli/aur.py`
- [AUR builder](https://github.com/krazi49/poli-cli/blob/main/poli/pacman.py): `poli/pacman.py`
- [Pacman runner](https://github.com/krazi49/poli-cli/blob/main/poli/pacman.py): `poli/pacman.py`

### System insights

- [Stats and audit](https://github.com/krazi49/poli-cli/blob/main/poli/stats.py): `poli/stats.py`
- [Operation history](https://github.com/krazi49/poli-cli/blob/main/poli/stats.py): `poli/stats.py`
- [Dependency tree](https://github.com/krazi49/poli-cli/blob/main/poli/tree.py): `poli/tree.py`
- [File ownership](https://github.com/krazi49/poli-cli/blob/main/poli/cli.py): `poli/cli.py`

### Shared support

- [Terminal display](https://github.com/krazi49/poli-cli/blob/main/poli/display.py): `poli/display.py`
- [User config](https://github.com/krazi49/poli-cli/blob/main/poli/config.py): `poli/config.py`

### Other components

- **User**
- **pacman**
- **AUR RPC**
- **pacman log**

## Connections

- User → CLI dispatch: runs command (evidence: `README.md`)
- CLI dispatch → Package operations: dispatches operations (evidence: `poli/cli.py`)
- CLI dispatch → AUR queries: searches and looks up (evidence: `poli/cli.py`)
- CLI dispatch → Stats and audit: runs reports (evidence: `poli/cli.py`)
- CLI dispatch → Operation history: requests history (evidence: `poli/cli.py`)
- CLI dispatch → Dependency tree: requests tree (evidence: `poli/cli.py`)
- CLI dispatch → pacman: checks file owner (evidence: `poli/cli.py`)
- Package operations → pacman: queries and changes packages (evidence: `poli/pacman.py`)
- Package operations → AUR queries: resolves dependencies (evidence: `poli/pacman.py`)
- Package operations → AUR builder: builds AUR packages (evidence: `poli/pacman.py`)
- Package operations → Pacman runner: runs package commands (evidence: `poli/pacman.py`)
- Pacman runner → pacman: executes commands (evidence: `poli/pacman.py`)
- Pacman runner → Terminal display: updates progress (evidence: `poli/pacman.py`)
- AUR builder → AUR RPC: clones package source (evidence: `poli/pacman.py`)
- AUR queries → AUR RPC: queries package data (evidence: `poli/aur.py`)
- AUR queries → pacman: checks repository packages (evidence: `poli/aur.py`)
- AUR queries → Terminal display: reports errors (evidence: `poli/aur.py`)
- Package operations → User config: loads settings (evidence: `poli/pacman.py`)
- Stats and audit → pacman: queries package state (evidence: `poli/stats.py`)
- Operation history → pacman log: reads operations (evidence: `poli/stats.py`)
- Dependency tree → pacman: reads dependencies (evidence: `poli/tree.py`)
- Dependency tree → Terminal display: prints tree (evidence: `poli/tree.py`)
