microsoft / microsoft/winget-cli
Add Configure Support to PowerShell client.
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 26.4k
- Forks
- 1.8k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 15
Description
Relevant area(s)
WinGet CLI
Description of the new feature / enhancement
Current State Analysis
The Issue: The main Microsoft.WinGet.Client PowerShell module is missing configure command functionality, while the native CLI has complete configure support.
What's Available:
-
CLI: Full configure support with subcommands (configure, show, list, test, validate, export)
-
PowerShell: Two separate modules:
Microsoft.WinGet.Client- Main module MISSING configure commandsMicrosoft.WinGet.Configuration- Separate module with PARTIAL configure functionality
Recommended Upgrade Path
Option 1: Integrate Configure Commands into Main Module (Recommended)
Add these cmdlets to Microsoft.WinGet.Client module for CLI parity:
Invoke-WinGetConfigure- Apply configuration files (equivalent towinget configure)Show-WinGetConfiguration- Display configuration details (equivalent towinget configure show)Get-WinGetConfigurationHistory- Show configuration history (equivalent towinget configure list)Test-WinGetConfiguration- Test configuration against system (equivalent towinget configure test)Test-WinGetConfigurationFile- Validate configuration files (equivalent towinget configure validate)Export-WinGetConfiguration- Export system configuration (equivalent towinget configure export)
Implementation Requirements
Files to Modify:
src/PowerShell/Microsoft.WinGet.Client/ModuleFiles/Microsoft.WinGet.Client.psd1- Add new cmdlets to exportssrc/PowerShell/Microsoft.WinGet.Client.Cmdlets/- Add new cmdlet implementationssrc/PowerShell/Microsoft.WinGet.Client.Engine/- Add configuration command engines
Key Implementation Steps:
- Reference existing configuration engine from
Microsoft.WinGet.Configuration.Engine - Create cmdlet classes following existing patterns (like
InstallPackageCmdlet.cs) - Implement parameter mapping from CLI arguments to PowerShell parameters
- Add proper error handling and progress reporting
- Update module manifest with new cmdlets and aliases
Key Implementation Notes:
- Use existing configuration engine from
Microsoft.WinGet.Configuration.Engine - Follow existing cmdlet patterns from
InstallPackageCmdlet.cs - Implement proper parameter validation and error handling
- Support pipeline input and ShouldProcess
Benefits and Outcomes:
This upgrade would provide users with a unified PowerShell experience for all WinGet functionality, including configuration management, within a single module.
Proposed technical implementation details
WinGet PowerShell Configure Command Upgrade Plan
Overview
This document provides specific modifications needed to add configure command support to the main Microsoft.WinGet.Client PowerShell module, achieving feature parity with the native WinGet CLI.
Current State Analysis
Missing Functionality
The main Microsoft.WinGet.Client module lacks these CLI configure commands:
- winget configure --file → Need Invoke-WinGetConfigure
- winget configure show --file → Need Show-WinGetConfiguration
- winget configure list → Need Get-WinGetConfigurationHistory
- winget configure test --file → Need Test-WinGetConfiguration
- winget configure validate --file → Need Test-WinGetConfigurationFile
- winget configure export --output config.yaml --all → Need Export-WinGetConfiguration
- winget configure export --packageid RARLab.WinRAR → Need Export-WinGetConfiguration
- winget configure export --module Windows.PowerShell --resource PSModuleResource --output config.xml
Existing Infrastructure
- Microsoft.WinGet.Configuration.Engine already exists with ConfigurationCommand class
- Configuration processing logic is implemented and working
- PowerShell cmdlet patterns are established in the main module
Implementation Plan
Phase 1: Project Dependencies
1.1 Update Microsoft.WinGet.Client.Cmdlets.csproj
File: src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Microsoft.WinGet.Client.Cmdlets.csproj
Add Project Reference:
xml <ItemGroup> <ProjectReference Include="..\Microsoft.WinGet.Configuration.Engine\Microsoft.WinGet.Configuration.Engine.csproj" /> </ItemGroup>
Add Package Reference:
xml <ItemGroup> <PackageReference Include="Microsoft.Management.Configuration.Processor" /> </ItemGroup>
1.2 Update Dependency Copy Targets
Add to CopyDirectDependencies target:
xml <ModuleDirectDependency Include="$(OutputPath)Microsoft.WinGet.Configuration.Engine.dll" /> <ModuleDirectDependency Include="$(OutputPath)Microsoft.WinGet.Configuration.Engine.pdb" Condition="'$(Configuration)' == 'Debug'" />
Phase 2: Create New Cmdlet Files
2.1 InvokeWinGetConfigureCmdlet.cs
File: src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/InvokeWinGetConfigureCmdlet.cs
Key implementation points:
- Use ConfigurationCommand from Microsoft.WinGet.Configuration.Engine
- Follow existing cmdlet patterns from InstallPackageCmdlet.cs
- Implement proper parameter validation and error handling
- Support pipeline input and ShouldProcess
2.2 ShowWinGetConfigurationCmdlet.cs
File: src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/ShowWinGetConfigurationCmdlet.cs
Key implementation points:
- Display configuration details without applying
- Support file path parameter
- Output PSConfigurationSet object
2.3 GetWinGetConfigurationHistoryCmdlet.cs
File: src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/GetWinGetConfigurationHistoryCmdlet.cs
Key implementation points:
- List configuration history
- Support filtering by history item
- Support remove and watch operations
2.4 TestWinGetConfigurationCmdlet.cs
File: src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/TestWinGetConfigurationCmdlet.cs
Key implementation points:
- Test configuration against current system state
- Return test results without applying changes
- Support confirmation prompts
2.5 TestWinGetConfigurationFileCmdlet.cs
File: src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/TestWinGetConfigurationFileCmdlet.cs
Key implementation points:
- Validate configuration file syntax and semantics
- Return validation results
- No system changes
2.6 ExportWinGetConfigurationCmdlet.cs
File: src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/ExportWinGetConfigurationCmdlet.cs
Key implementation points:
- Export system configuration to file
- Requires integration with CLI ConfigureExportCommand
- May need additional CLI wrapper functionality
Phase 3: Update Module Manifest
3.1 Update Microsoft.WinGet.Client.psd1
File: src/PowerShell/Microsoft.WinGet.Client/ModuleFiles/Microsoft.WinGet.Client.psd1
Add to CmdletsToExport array:
powershell 'Invoke-WinGetConfigure' 'Show-WinGetConfiguration' 'Get-WinGetConfigurationHistory' 'Test-WinGetConfiguration' 'Test-WinGetConfigurationFile' 'Export-WinGetConfiguration'
Add to AliasesToExport array:
powershell 'iwgcfg' 'shwgcfg' 'gwgcfgh' 'twgcfg' 'twgcfgf' 'ewgcfg'
Phase 4: Engine Integration
4.1 Create Configuration Command Wrapper
File: src/PowerShell/Microsoft.WinGet.Client.Engine/Commands/ConfigurationWrapperCommand.cs
Purpose: Provide a bridge between the main client cmdlets and the configuration engine, handling:
- Configuration set creation and management
- Error handling and progress reporting
- Async operation management
- Proper resource cleanup
Phase 5: Help Documentation
5.1 Create Help Files
Create markdown help files in src/PowerShell/Help/Microsoft.WinGet.Client/:
- Invoke-WinGetConfigure.md
- Show-WinGetConfiguration.md
- Get-WinGetConfigurationHistory.md
- Test-WinGetConfiguration.md
- Test-WinGetConfigurationFile.md
- Export-WinGetConfiguration.md
Phase 6: Testing
6.1 Update Test Files
File: src/PowerShell/tests/Microsoft.WinGet.Client.Tests.ps1
Add comprehensive test cases for:
- Cmdlet existence and parameter validation
- Configuration file processing
- Error handling scenarios
- Integration with existing functionality
Implementation Notes
Key Considerations
- Dependency Management: Ensure Microsoft.WinGet.Configuration.Engine is properly referenced and deployed
- Error Handling: Implement proper exception handling following existing patterns
- Parameter Validation: Add proper parameter validation attributes
- Progress Reporting: Implement progress reporting for long-running operations
- Cancellation Support: Add cancellation token support for async operations
- Security: Ensure proper validation of configuration files and user permissions
CLI Integration Points
- ConfigureExportCommand.cpp needs PowerShell wrapper for export functionality
- Configuration workflows from AppInstallerCLICore need to be accessible
- May require additional COM API exposure for some functionality
Testing Strategy
- Unit tests for each cmdlet
- Integration tests with actual configuration files
- Error condition testing
- Performance testing for large configuration sets
- Security testing for malicious configuration files
Completion Criteria
- All 6 new cmdlets implemented and working
- Module manifest updated with new cmdlets and aliases
- Project dependencies properly configured
- Help documentation created
- Unit tests passing
- Integration tests passing
- No breaking changes to existing functionality
- Performance benchmarks met
- Security review completed
File Modification Summary
Files to Create (6 cmdlet files):
- src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/InvokeWinGetConfigureCmdlet.cs
- src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/ShowWinGetConfigurationCmdlet.cs
- src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/GetWinGetConfigurationHistoryCmdlet.cs
- src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/TestWinGetConfigurationCmdlet.cs
- src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/TestWinGetConfigurationFileCmdlet.cs
- src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/ExportWinGetConfigurationCmdlet.cs
Files to Modify (2 files):
- src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Microsoft.WinGet.Client.Cmdlets.csproj
- src/PowerShell/Microsoft.WinGet.Client/ModuleFiles/Microsoft.WinGet.Client.psd1
Files to Create (Engine wrapper):
- src/PowerShell/Microsoft.WinGet.Client.Engine/Commands/ConfigurationWrapperCommand.cs
Files to Create (Help documentation - 6 files):
- src/PowerShell/Help/Microsoft.WinGet.Client/Invoke-WinGetConfigure.md
- src/PowerShell/Help/Microsoft.WinGet.Client/Show-WinGetConfiguration.md
- src/PowerShell/Help/Microsoft.WinGet.Client/Get-WinGetConfigurationHistory.md
- src/PowerShell/Help/Microsoft.WinGet.Client/Test-WinGetConfiguration.md
- src/PowerShell/Help/Microsoft.WinGet.Client/Test-WinGetConfigurationFile.md
- src/PowerShell/Help/Microsoft.WinGet.Client/Export-WinGetConfiguration.md
Files to Modify (Testing):
- src/PowerShell/tests/Microsoft.WinGet.Client.Tests.ps1
This upgrade plan provides ChatGPT-5 with the specific file modifications, code implementations, and integration points needed to successfully add configure command support to the WinGet PowerShell module.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the existing cmdlet patterns in InstallPackageCmdlet.cs, the Microsoft.WinGet.Client.Cmdlets.csproj, and the Microsoft.WinGet.Configuration.Engine entry points. Review the module manifest and Microsoft.WinGet.Client.Tests.ps1 alongside the proposed cmdlet, wrapper, help, and dependency files. Done means all six configure cmdlets are integrated, exported, documented, tested, and provide the listed CLI-parity behavior without breaking existing functionality.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, csharp, powershell
- Domain
- cli, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100