# cloudsmith-io/cloudsmith-cli architecture

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

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

## Overview

Cloudsmith CLI is a Python command-line client for Cloudsmith’s REST API. Users invoke commands through the lazy command-line entry point; command families cover package transfer and lifecycle, repository administration, authentication, and organization features such as policies and quotas. The CLI’s API layer configures requests and the shared HTTP session handles transport concerns. The README documents the broad command capabilities, while sampled source and the SOURCE INDEX support only selected internal links; uncertain command-to-API details are therefore represented at the documented API boundary.

Main entry points: [`cloudsmith_cli/cli/commands/main.py`](https://github.com/cloudsmith-io/cloudsmith-cli/blob/master/cloudsmith_cli/cli/commands/main.py) (Main command group), [`cloudsmith_cli/cli/commands/auth.py`](https://github.com/cloudsmith-io/cloudsmith-cli/blob/master/cloudsmith_cli/cli/commands/auth.py) (Authentication), [`cloudsmith_cli/__main__.py`](https://github.com/cloudsmith-io/cloudsmith-cli/blob/master/cloudsmith_cli/__main__.py) (CLI entry point), [`cloudsmith_cli/cli/commands`](https://github.com/cloudsmith-io/cloudsmith-cli/tree/master/cloudsmith_cli/cli/commands) (Package lifecycle)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["CLI entry"]
  node_entrypoint["CLI entry point<br/>[__main__.py]"]
  node_command_dispatch["Command dispatch<br/>[command.py]"]
  node_main_commands["Main command group<br/>[main.py]"]
  node_cli_support["CLI configuration<br/>[config.py]"]
end

subgraph group_packages["Package workflows"]
  node_package_commands["Package lifecycle"]
  node_push["Package upload<br/>[push.py]"]
  node_download["Package download<br/>[download.py]"]
end

subgraph group_admin["Account and administration"]
  node_repo_commands["Repository management<br/>[repos.py]"]
  node_auth_commands["Authentication<br/>[auth.py]"]
  node_sso["SAML and SSO<br/>[sso.py]"]
  node_policy_commands["Organization policies"]
  node_quota_commands["Quota reporting"]
  node_metrics_commands["Repository metrics"]
end

subgraph group_platform["API and transport"]
  node_api_facade["API configuration<br/>[init.py]"]
  node_api_resources["API resources"]
  node_session["HTTP session<br/>[session.py]"]
end

subgraph group_extensions["Integrations"]
  node_mcp["MCP server<br/>[server.py]"]
end

node_user(("CLI user"))
node_api_service{{"Cloudsmith REST API"}}
node_external_api_user(("MCP client"))

node_user -->|"runs"| node_entrypoint
node_entrypoint -->|"invokes"| node_main_commands
node_main_commands -->|"configures"| node_command_dispatch
node_main_commands -->|"uses"| node_cli_support
node_main_commands -->|"dispatches"| node_package_commands
node_package_commands -->|"manages packages"| node_api_service
node_push -->|"uploads packages"| node_api_service
node_download -->|"downloads packages"| node_api_service
node_repo_commands -->|"manages repositories"| node_api_service
node_auth_commands -->|"uses SSO"| node_sso
node_auth_commands -->|"authenticates"| node_api_service
node_policy_commands -->|"manages policies"| node_api_service
node_quota_commands -->|"reads quotas"| node_api_service
node_metrics_commands -->|"reads metrics"| node_api_service
node_api_facade -->|"configures transport"| node_session
node_api_resources -.->|"calls"| node_api_service
node_external_api_user -->|"connects"| node_mcp

click node_entrypoint "https://github.com/cloudsmith-io/cloudsmith-cli/blob/master/cloudsmith_cli/__main__.py"
click node_command_dispatch "https://github.com/cloudsmith-io/cloudsmith-cli/blob/master/cloudsmith_cli/cli/command.py"
click node_main_commands "https://github.com/cloudsmith-io/cloudsmith-cli/blob/master/cloudsmith_cli/cli/commands/main.py"
click node_cli_support "https://github.com/cloudsmith-io/cloudsmith-cli/blob/master/cloudsmith_cli/cli/config.py"
click node_package_commands "https://github.com/cloudsmith-io/cloudsmith-cli/tree/master/cloudsmith_cli/cli/commands"
click node_push "https://github.com/cloudsmith-io/cloudsmith-cli/blob/master/cloudsmith_cli/cli/commands/push.py"
click node_download "https://github.com/cloudsmith-io/cloudsmith-cli/blob/master/cloudsmith_cli/core/download.py"
click node_repo_commands "https://github.com/cloudsmith-io/cloudsmith-cli/blob/master/cloudsmith_cli/cli/commands/repos.py"
click node_auth_commands "https://github.com/cloudsmith-io/cloudsmith-cli/blob/master/cloudsmith_cli/cli/commands/auth.py"
click node_sso "https://github.com/cloudsmith-io/cloudsmith-cli/blob/master/cloudsmith_cli/core/sso.py"
click node_policy_commands "https://github.com/cloudsmith-io/cloudsmith-cli/tree/master/cloudsmith_cli/cli/commands/policy"
click node_quota_commands "https://github.com/cloudsmith-io/cloudsmith-cli/tree/master/cloudsmith_cli/cli/commands/quota"
click node_metrics_commands "https://github.com/cloudsmith-io/cloudsmith-cli/tree/master/cloudsmith_cli/cli/commands/metrics"
click node_api_facade "https://github.com/cloudsmith-io/cloudsmith-cli/blob/master/cloudsmith_cli/core/api/init.py"
click node_api_resources "https://github.com/cloudsmith-io/cloudsmith-cli/tree/master/cloudsmith_cli/core/api"
click node_session "https://github.com/cloudsmith-io/cloudsmith-cli/blob/master/cloudsmith_cli/core/session.py"
click node_mcp "https://github.com/cloudsmith-io/cloudsmith-cli/blob/master/cloudsmith_cli/core/mcp/server.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_entrypoint,node_command_dispatch,node_main_commands,node_cli_support,node_user,node_external_api_user toneBlue
class node_package_commands,node_push,node_download toneAmber
class node_repo_commands,node_auth_commands,node_sso,node_policy_commands,node_quota_commands,node_metrics_commands,node_api_service toneMint
class node_api_facade,node_api_resources,node_session toneRose
class node_mcp toneIndigo
```

## Components

### CLI entry

- [CLI entry point](https://github.com/cloudsmith-io/cloudsmith-cli/blob/master/cloudsmith_cli/__main__.py): `cloudsmith_cli/__main__.py`
- [Command dispatch](https://github.com/cloudsmith-io/cloudsmith-cli/blob/master/cloudsmith_cli/cli/command.py): `cloudsmith_cli/cli/command.py`
- [Main command group](https://github.com/cloudsmith-io/cloudsmith-cli/blob/master/cloudsmith_cli/cli/commands/main.py): `cloudsmith_cli/cli/commands/main.py`
- [CLI configuration](https://github.com/cloudsmith-io/cloudsmith-cli/blob/master/cloudsmith_cli/cli/config.py): `cloudsmith_cli/cli/config.py`

### Package workflows

- [Package lifecycle](https://github.com/cloudsmith-io/cloudsmith-cli/tree/master/cloudsmith_cli/cli/commands): `cloudsmith_cli/cli/commands`
- [Package upload](https://github.com/cloudsmith-io/cloudsmith-cli/blob/master/cloudsmith_cli/cli/commands/push.py): `cloudsmith_cli/cli/commands/push.py`
- [Package download](https://github.com/cloudsmith-io/cloudsmith-cli/blob/master/cloudsmith_cli/core/download.py): `cloudsmith_cli/core/download.py`

### Account and administration

- [Repository management](https://github.com/cloudsmith-io/cloudsmith-cli/blob/master/cloudsmith_cli/cli/commands/repos.py): `cloudsmith_cli/cli/commands/repos.py`
- [Authentication](https://github.com/cloudsmith-io/cloudsmith-cli/blob/master/cloudsmith_cli/cli/commands/auth.py): `cloudsmith_cli/cli/commands/auth.py`
- [SAML and SSO](https://github.com/cloudsmith-io/cloudsmith-cli/blob/master/cloudsmith_cli/core/sso.py): `cloudsmith_cli/core/sso.py`
- [Organization policies](https://github.com/cloudsmith-io/cloudsmith-cli/tree/master/cloudsmith_cli/cli/commands/policy): `cloudsmith_cli/cli/commands/policy`
- [Quota reporting](https://github.com/cloudsmith-io/cloudsmith-cli/tree/master/cloudsmith_cli/cli/commands/quota): `cloudsmith_cli/cli/commands/quota`
- [Repository metrics](https://github.com/cloudsmith-io/cloudsmith-cli/tree/master/cloudsmith_cli/cli/commands/metrics): `cloudsmith_cli/cli/commands/metrics`

### API and transport

- [API configuration](https://github.com/cloudsmith-io/cloudsmith-cli/blob/master/cloudsmith_cli/core/api/init.py): `cloudsmith_cli/core/api/init.py`
- [API resources](https://github.com/cloudsmith-io/cloudsmith-cli/tree/master/cloudsmith_cli/core/api): `cloudsmith_cli/core/api`
- [HTTP session](https://github.com/cloudsmith-io/cloudsmith-cli/blob/master/cloudsmith_cli/core/session.py): `cloudsmith_cli/core/session.py`

### Integrations

- [MCP server](https://github.com/cloudsmith-io/cloudsmith-cli/blob/master/cloudsmith_cli/core/mcp/server.py): `cloudsmith_cli/core/mcp/server.py`

### Other components

- **CLI user**
- **Cloudsmith REST API**
- **MCP client**

## Connections

- CLI user → CLI entry point: runs (evidence: `cloudsmith_cli/__main__.py`)
- CLI entry point → Main command group: invokes (evidence: `cloudsmith_cli/__main__.py`)
- Main command group → Command dispatch: configures (evidence: `cloudsmith_cli/cli/commands/main.py`)
- Main command group → CLI configuration: uses (evidence: `cloudsmith_cli/cli/commands/main.py`)
- Main command group → Package lifecycle: dispatches (evidence: `cloudsmith_cli/cli/commands/main.py`)
- Package lifecycle → Cloudsmith REST API: manages packages
- Package upload → Cloudsmith REST API: uploads packages
- Package download → Cloudsmith REST API: downloads packages
- Repository management → Cloudsmith REST API: manages repositories
- Authentication → SAML and SSO: uses SSO (evidence: `cloudsmith_cli/cli/commands/auth.py`)
- Authentication → Cloudsmith REST API: authenticates
- Organization policies → Cloudsmith REST API: manages policies
- Quota reporting → Cloudsmith REST API: reads quotas
- Repository metrics → Cloudsmith REST API: reads metrics
- API configuration → HTTP session: configures transport (evidence: `cloudsmith_cli/core/api/init.py`)
- API resources → Cloudsmith REST API: calls
- MCP client → MCP server: connects (evidence: `cloudsmith_cli/core/mcp/server.py`)
