How chocolatey/choco works
Chocolatey is a Windows package manager exposed primarily through the choco CLI. The main user workflow is to invoke a package command, resolve package sources and metadata, then install, upgrade, or remove packages; the README also highlights refreshing the current shell environment after installation. The source index confirms key CLI, NuGet, configuration, and platform modules, but many implementations were not sampled, so uncertain internal links are omitted or shown as unverified.
Main entry points: NugetService.cs Package operations · Program.cs CLI entry · UpdateSessionEnvironmentCommand.cs PowerShell commands · commands Commands
Components 22
CLI and configuration
- CLI entry
src/chocolatey.console/Program.cs - Commands
src/chocolatey/infrastructure.app/commands - Configuration
src/chocolatey/infrastructure.app/configuration/ChocolateyConfiguration.cs - App parameters
src/chocolatey/infrastructure.app/ApplicationParameters.cs
Package operations
- Package operations
src/chocolatey/infrastructure.app/services/NugetService.cs - Package sources
src/chocolatey/infrastructure.app/domain/SourceTypes.cs - Package results
src/chocolatey/infrastructure/results/PackageResult.cs - Local repository
src/chocolatey/infrastructure.app/nuget/ChocolateyLocalPackageRepository.cs - Installer handlers
src/chocolatey/infrastructure.app/domain/installers - Package templates
src/chocolatey/infrastructure.app/templates - Pack and push
src/chocolatey/infrastructure.app/nuget
Runtime services
- Filesystem API
src/chocolatey/infrastructure/filesystem/IFileSystem.cs - File operations
src/chocolatey/infrastructure/filesystem/DotNetFileSystem.cs - Platform detection
src/chocolatey/infrastructure/platforms/Platform.cs - Event manager
src/chocolatey/infrastructure/events/EventManager.cs - Logging
src/chocolatey/infrastructure/logging/Log.cs - String resources
src/chocolatey/StringResources.cs
Shell integration
- PowerShell commands
src/Chocolatey.PowerShell/Commands/UpdateSessionEnvironmentCommand.cs - Environment helper
src/Chocolatey.PowerShell/Helpers/EnvironmentHelper.cs
Other components
- CLI user
- PowerShell session
- Package repository
Connections 21
- CLI user → CLI entry: invokes
README.md - CLI entry → Commands: dispatches
- CLI entry → Configuration: configures
src/chocolatey.console/Program.cs - CLI entry → App parameters: reads
src/chocolatey.console/Program.cs - Commands → Package operations: runs package actions
- Package operations → Configuration: reads
src/chocolatey/infrastructure.app/services/NugetService.cs - Package operations → Package sources: uses sources
src/chocolatey/infrastructure.app/services/NugetService.cs - Package operations → Package results: produces results
src/chocolatey/infrastructure.app/services/NugetService.cs - Package operations → Local repository: uses repository
- Package operations → Installer handlers: runs installers
- Package operations → Package repository: retrieves packages
- CLI user → Package repository: chooses packages
README.md - Pack and push → Package repository: publishes packages
- Filesystem API → File operations: implemented by
src/chocolatey/infrastructure/platforms/Platform.cs - Platform detection → Filesystem API: initializes
src/chocolatey/infrastructure/platforms/Platform.cs - CLI entry → Platform detection: bootstraps runtime
src/chocolatey.console/Program.cs - CLI entry → Logging: configures
src/chocolatey.console/Program.cs - Package operations → String resources: references
src/chocolatey/infrastructure.app/services/NugetService.cs - PowerShell commands → Environment helper: uses
src/Chocolatey.PowerShell/Commands/UpdateSessionEnvironmentCommand.cs - PowerShell session → PowerShell commands: runs refreshenv
README.md - PowerShell commands → PowerShell session: updates environment
README.md