# microsoft/winget-cli architecture

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

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

## Overview

WinGet is a Windows package manager: users discover packages from configured sources and can install, update, remove, download, or manage them. The CLI’s command and execution-context layers support those operations; repository search represents the package-discovery stage. The README also documents configuration, PowerShell cmdlets, and package-manager APIs. Source excerpts are limited, so links between individual commands, workflows, and repository operations are shown as unverified where their call sites were not sampled.

Main entry points: [`src/AppInstallerCLICore/Command.h`](https://github.com/microsoft/winget-cli/blob/master/src/AppInstallerCLICore/Command.h) (Command model), [`src/AppInstallerCLI/main.cpp`](https://github.com/microsoft/winget-cli/blob/master/src/AppInstallerCLI/main.cpp) (WinGet CLI), [`src/AppInstallerCLICore/ExecutionContext.h`](https://github.com/microsoft/winget-cli/blob/master/src/AppInstallerCLICore/ExecutionContext.h) (Execution context), [`src/AppInstallerRepositoryCore/Public/winget/RepositorySearch.h`](https://github.com/microsoft/winget-cli/blob/master/src/AppInstallerRepositoryCore/Public/winget/RepositorySearch.h) (Search model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI runtime"]
  node_cli["WinGet CLI<br/>[main.cpp]"]
  node_commands["Command model<br/>[Command.h]"]
  node_execution["Execution context<br/>[ExecutionContext.h]"]
  node_arguments["Arguments<br/>[Argument.h]"]
  node_checkpoints[("Resume checkpoints")]
  node_completion["Shell completion<br/>[CompletionFlow.cpp]"]
end

subgraph group_packages["Package management"]
  node_install["Install workflow<br/>[InstallFlow.cpp]"]
  node_download["Download workflow<br/>[DownloadFlow.cpp]"]
  node_updates["Update workflow<br/>[UpdateFlow.cpp]"]
  node_uninstall["Uninstall workflow<br/>[UninstallFlow.cpp]"]
  node_repair["Repair workflow<br/>[RepairFlow.cpp]"]
  node_sources[("Package sources")]
  node_search["Search model<br/>[RepositorySearch.h]"]
end

subgraph group_configuration["Configuration"]
  node_config["Configuration commands"]
  node_config_flow["Configuration workflow"]
  node_remoting["Configuration remoting<br/>[Program.cs]"]
end

subgraph group_interfaces["Client interfaces"]
  node_powershell["PowerShell cmdlets"]
  node_deployment_api["Deployment API<br/>[PackageManager.cpp]"]
  node_mcp["MCP server<br/>[Program.cs]"]
end

node_user(("User"))
node_external_sources[("Configured sources")]

node_user -->|"runs commands"| node_cli
node_cli -.->|"dispatches"| node_commands
node_commands -->|"uses context"| node_execution
node_execution -->|"holds arguments"| node_arguments
node_commands -->|"records resume"| node_checkpoints
node_commands -.->|"dispatches completion"| node_completion
node_commands -.->|"dispatches install"| node_install
node_commands -.->|"dispatches download"| node_download
node_commands -.->|"dispatches updates"| node_updates
node_commands -.->|"dispatches uninstall"| node_uninstall
node_commands -.->|"dispatches repair"| node_repair
node_sources -.->|"supports search"| node_search
node_search -->|"queries packages"| node_external_sources
node_commands -.->|"dispatches configuration"| node_config
node_config -.->|"uses workflow"| node_config_flow
node_remoting -.->|"uses configuration"| node_config_flow
node_powershell -.->|"uses package manager"| node_deployment_api
node_mcp -.->|"offers package tools"| node_cli

click node_cli "https://github.com/microsoft/winget-cli/blob/master/src/AppInstallerCLI/main.cpp"
click node_commands "https://github.com/microsoft/winget-cli/blob/master/src/AppInstallerCLICore/Command.h"
click node_execution "https://github.com/microsoft/winget-cli/blob/master/src/AppInstallerCLICore/ExecutionContext.h"
click node_arguments "https://github.com/microsoft/winget-cli/blob/master/src/AppInstallerCLICore/Argument.h"
click node_checkpoints "https://github.com/microsoft/winget-cli/blob/master/src/AppInstallerCLICore/CheckpointManager.cpp"
click node_completion "https://github.com/microsoft/winget-cli/blob/master/src/AppInstallerCLICore/Workflows/CompletionFlow.cpp"
click node_install "https://github.com/microsoft/winget-cli/blob/master/src/AppInstallerCLICore/Workflows/InstallFlow.cpp"
click node_download "https://github.com/microsoft/winget-cli/blob/master/src/AppInstallerCLICore/Workflows/DownloadFlow.cpp"
click node_updates "https://github.com/microsoft/winget-cli/blob/master/src/AppInstallerCLICore/Workflows/UpdateFlow.cpp"
click node_uninstall "https://github.com/microsoft/winget-cli/blob/master/src/AppInstallerCLICore/Workflows/UninstallFlow.cpp"
click node_repair "https://github.com/microsoft/winget-cli/blob/master/src/AppInstallerCLICore/Workflows/RepairFlow.cpp"
click node_sources "https://github.com/microsoft/winget-cli/blob/master/src/AppInstallerRepositoryCore/RepositorySource.cpp"
click node_search "https://github.com/microsoft/winget-cli/blob/master/src/AppInstallerRepositoryCore/Public/winget/RepositorySearch.h"
click node_config "https://github.com/microsoft/winget-cli/blob/master/src/AppInstallerCLICore/Commands/ConfigureCommand.cpp"
click node_config_flow "https://github.com/microsoft/winget-cli/blob/master/src/AppInstallerCLICore/Workflows/ConfigurationFlow.cpp"
click node_remoting "https://github.com/microsoft/winget-cli/blob/master/src/ConfigurationRemotingServer/Program.cs"
click node_powershell "https://github.com/microsoft/winget-cli/blob/master/src/PowerShell/Microsoft.WinGet.Client.Engine/Commands/WinGetPackageManagerCommand.cs"
click node_deployment_api "https://github.com/microsoft/winget-cli/blob/master/src/Microsoft.Management.Deployment/PackageManager.cpp"
click node_mcp "https://github.com/microsoft/winget-cli/blob/master/src/WinGetMCPServer/Program.cs"

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_commands,node_execution,node_arguments,node_checkpoints,node_completion,node_user toneBlue
class node_install,node_download,node_updates,node_uninstall,node_repair,node_sources,node_search,node_external_sources toneAmber
class node_config,node_config_flow,node_remoting toneMint
class node_powershell,node_deployment_api,node_mcp toneRose
```

## Components

### CLI runtime

- [WinGet CLI](https://github.com/microsoft/winget-cli/blob/master/src/AppInstallerCLI/main.cpp): `src/AppInstallerCLI/main.cpp`
- [Command model](https://github.com/microsoft/winget-cli/blob/master/src/AppInstallerCLICore/Command.h): `src/AppInstallerCLICore/Command.h`
- [Execution context](https://github.com/microsoft/winget-cli/blob/master/src/AppInstallerCLICore/ExecutionContext.h): `src/AppInstallerCLICore/ExecutionContext.h`
- [Arguments](https://github.com/microsoft/winget-cli/blob/master/src/AppInstallerCLICore/Argument.h): `src/AppInstallerCLICore/Argument.h`
- [Resume checkpoints](https://github.com/microsoft/winget-cli/blob/master/src/AppInstallerCLICore/CheckpointManager.cpp): `src/AppInstallerCLICore/CheckpointManager.cpp`
- [Shell completion](https://github.com/microsoft/winget-cli/blob/master/src/AppInstallerCLICore/Workflows/CompletionFlow.cpp): `src/AppInstallerCLICore/Workflows/CompletionFlow.cpp`

### Package management

- [Install workflow](https://github.com/microsoft/winget-cli/blob/master/src/AppInstallerCLICore/Workflows/InstallFlow.cpp): `src/AppInstallerCLICore/Workflows/InstallFlow.cpp`
- [Download workflow](https://github.com/microsoft/winget-cli/blob/master/src/AppInstallerCLICore/Workflows/DownloadFlow.cpp): `src/AppInstallerCLICore/Workflows/DownloadFlow.cpp`
- [Update workflow](https://github.com/microsoft/winget-cli/blob/master/src/AppInstallerCLICore/Workflows/UpdateFlow.cpp): `src/AppInstallerCLICore/Workflows/UpdateFlow.cpp`
- [Uninstall workflow](https://github.com/microsoft/winget-cli/blob/master/src/AppInstallerCLICore/Workflows/UninstallFlow.cpp): `src/AppInstallerCLICore/Workflows/UninstallFlow.cpp`
- [Repair workflow](https://github.com/microsoft/winget-cli/blob/master/src/AppInstallerCLICore/Workflows/RepairFlow.cpp): `src/AppInstallerCLICore/Workflows/RepairFlow.cpp`
- [Package sources](https://github.com/microsoft/winget-cli/blob/master/src/AppInstallerRepositoryCore/RepositorySource.cpp): `src/AppInstallerRepositoryCore/RepositorySource.cpp`
- [Search model](https://github.com/microsoft/winget-cli/blob/master/src/AppInstallerRepositoryCore/Public/winget/RepositorySearch.h): `src/AppInstallerRepositoryCore/Public/winget/RepositorySearch.h`

### Configuration

- [Configuration commands](https://github.com/microsoft/winget-cli/blob/master/src/AppInstallerCLICore/Commands/ConfigureCommand.cpp): `src/AppInstallerCLICore/Commands/ConfigureCommand.cpp`
- [Configuration workflow](https://github.com/microsoft/winget-cli/blob/master/src/AppInstallerCLICore/Workflows/ConfigurationFlow.cpp): `src/AppInstallerCLICore/Workflows/ConfigurationFlow.cpp`
- [Configuration remoting](https://github.com/microsoft/winget-cli/blob/master/src/ConfigurationRemotingServer/Program.cs): `src/ConfigurationRemotingServer/Program.cs`

### Client interfaces

- [PowerShell cmdlets](https://github.com/microsoft/winget-cli/blob/master/src/PowerShell/Microsoft.WinGet.Client.Engine/Commands/WinGetPackageManagerCommand.cs): `src/PowerShell/Microsoft.WinGet.Client.Engine/Commands/WinGetPackageManagerCommand.cs`
- [Deployment API](https://github.com/microsoft/winget-cli/blob/master/src/Microsoft.Management.Deployment/PackageManager.cpp): `src/Microsoft.Management.Deployment/PackageManager.cpp`
- [MCP server](https://github.com/microsoft/winget-cli/blob/master/src/WinGetMCPServer/Program.cs): `src/WinGetMCPServer/Program.cs`

### Other components

- **User**
- **Configured sources**

## Connections

- User → WinGet CLI: runs commands (evidence: `README.md`)
- WinGet CLI → Command model: dispatches
- Command model → Execution context: uses context (evidence: `src/AppInstallerCLICore/Command.h`)
- Execution context → Arguments: holds arguments (evidence: `src/AppInstallerCLICore/ExecutionContext.h`)
- Command model → Resume checkpoints: records resume (evidence: `src/AppInstallerCLICore/CheckpointManager.cpp`)
- Command model → Shell completion: dispatches completion
- Command model → Install workflow: dispatches install
- Command model → Download workflow: dispatches download
- Command model → Update workflow: dispatches updates
- Command model → Uninstall workflow: dispatches uninstall
- Command model → Repair workflow: dispatches repair
- Package sources → Search model: supports search
- Search model → Configured sources: queries packages (evidence: `README.md`)
- Command model → Configuration commands: dispatches configuration
- Configuration commands → Configuration workflow: uses workflow
- Configuration remoting → Configuration workflow: uses configuration
- PowerShell cmdlets → Deployment API: uses package manager
- MCP server → WinGet CLI: offers package tools
