microsoft / microsoft/winget-cli

Add Configure Support to PowerShell client.

Open
#5,758 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Command-Configure Issue-Feature PowerShell
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 commands
    • Microsoft.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:

  1. Invoke-WinGetConfigure - Apply configuration files (equivalent to winget configure)
  2. Show-WinGetConfiguration - Display configuration details (equivalent to winget configure show)
  3. Get-WinGetConfigurationHistory - Show configuration history (equivalent to winget configure list)
  4. Test-WinGetConfiguration - Test configuration against system (equivalent to winget configure test)
  5. Test-WinGetConfigurationFile - Validate configuration files (equivalent to winget configure validate)
  6. Export-WinGetConfiguration - Export system configuration (equivalent to winget configure export)

Implementation Requirements

Files to Modify:

  • src/PowerShell/Microsoft.WinGet.Client/ModuleFiles/Microsoft.WinGet.Client.psd1 - Add new cmdlets to exports
  • src/PowerShell/Microsoft.WinGet.Client.Cmdlets/ - Add new cmdlet implementations
  • src/PowerShell/Microsoft.WinGet.Client.Engine/ - Add configuration command engines

Key Implementation Steps:

  1. Reference existing configuration engine from Microsoft.WinGet.Configuration.Engine
  2. Create cmdlet classes following existing patterns (like InstallPackageCmdlet.cs)
  3. Implement parameter mapping from CLI arguments to PowerShell parameters
  4. Add proper error handling and progress reporting
  5. 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
  1. Dependency Management: Ensure Microsoft.WinGet.Configuration.Engine is properly referenced and deployed
  2. Error Handling: Implement proper exception handling following existing patterns
  3. Parameter Validation: Add proper parameter validation attributes
  4. Progress Reporting: Implement progress reporting for long-running operations
  5. Cancellation Support: Add cancellation token support for async operations
  6. 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
  1. Unit tests for each cmdlet
  2. Integration tests with actual configuration files
  3. Error condition testing
  4. Performance testing for large configuration sets
  5. 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):
  1. src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/InvokeWinGetConfigureCmdlet.cs
  2. src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/ShowWinGetConfigurationCmdlet.cs
  3. src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/GetWinGetConfigurationHistoryCmdlet.cs
  4. src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/TestWinGetConfigurationCmdlet.cs
  5. src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/TestWinGetConfigurationFileCmdlet.cs
  6. src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Cmdlets/ExportWinGetConfigurationCmdlet.cs
Files to Modify (2 files):
  1. src/PowerShell/Microsoft.WinGet.Client.Cmdlets/Microsoft.WinGet.Client.Cmdlets.csproj
  2. src/PowerShell/Microsoft.WinGet.Client/ModuleFiles/Microsoft.WinGet.Client.psd1
Files to Create (Engine wrapper):
  1. src/PowerShell/Microsoft.WinGet.Client.Engine/Commands/ConfigurationWrapperCommand.cs
Files to Create (Help documentation - 6 files):
  1. src/PowerShell/Help/Microsoft.WinGet.Client/Invoke-WinGetConfigure.md
  2. src/PowerShell/Help/Microsoft.WinGet.Client/Show-WinGetConfiguration.md
  3. src/PowerShell/Help/Microsoft.WinGet.Client/Get-WinGetConfigurationHistory.md
  4. src/PowerShell/Help/Microsoft.WinGet.Client/Test-WinGetConfiguration.md
  5. src/PowerShell/Help/Microsoft.WinGet.Client/Test-WinGetConfigurationFile.md
  6. src/PowerShell/Help/Microsoft.WinGet.Client/Export-WinGetConfiguration.md
Files to Modify (Testing):
  1. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.