fix: Correctly pass value of WingetSourceCustom, Fixes #1043#1135
fix: Correctly pass value of WingetSourceCustom, Fixes #1043#1135Salamek wants to merge 8 commits intoRomanitho:developfrom
Conversation
required functions and replace hardoded -s 'winget' with -s $src
|
Hi, thanks for your contribution! Regarding |
for backward compatibility
|
Ok i have added -Source parameter to Winget-Install that defaults to 'winget' when not provided |
Remove deprecated notes regarding standalone usage and GitHub link.
There was a problem hiding this comment.
Pull request overview
This PR fixes WAU’s handling of a custom WinGet source (WAU_WingetSourceCustom) by threading the configured source through update-related functions, replacing several hardcoded -s winget usages that prevent upgrades from non-default repositories.
Changes:
- Pass
$Script:WingetSourceCustomintoUpdate-App, and propagate it intoGet-AppInfoandConfirm-Installation. - Replace hardcoded WinGet source arguments with a passed-in
$src/$Sourcein several functions. - Adjust workflow permissions for the “Close inactive issues” GitHub Action job.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
Sources/Winget-AutoUpdate/mods/_Mods-Functions.ps1 |
Adds optional src parameter to mod helper install/uninstall wrappers and uses it in winget calls. |
Sources/Winget-AutoUpdate/functions/Update-App.ps1 |
Adds src parameter and uses it when building winget upgrade/install params; forwards to helper functions. |
Sources/Winget-AutoUpdate/functions/Get-AppInfo.ps1 |
Adds src parameter and uses it in winget show. |
Sources/Winget-AutoUpdate/functions/Confirm-Installation.ps1 |
Adds src parameter and uses it in winget export. |
Sources/Winget-AutoUpdate/Winget-Upgrade.ps1 |
Passes configured custom source into Update-App. |
Sources/Winget-AutoUpdate/Winget-Install.ps1 |
Introduces a Source parameter and attempts to apply it in install/uninstall flows (currently with blocking issues). |
.github/workflows/GA_Close-Inactive-Issues.yml |
Expands job token permissions to include contents: write. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
$Source, use array for $WingetArgs since parameters could also contain spaces and that would break while using - split ""
|
I also ended up accidentally writing a drop-in replacement for WAU in Rust: Feature parity currently looks roughly like this: I wasn’t sure how long it would take for WAU to implement my proposed changes and ship a new release. Along the way, I also ran into several limitations in WAU that aren’t easily fixable without a significant rewrite of the codebase:
My implementation addresses this by being source-aware-deny/allow/override lists can specify the source for a given package ID, and updates across all installed sources are enabled by default (with behavior configurable via lists).
My implementation introduces scope awareness, allowing deny/allow/override lists to define scope-specific behavior per package ID.
In my implementation, logs are written to Another issue was that the scheduled task in user context needed to be run with “Run with highest privileges”; otherwise, WAU didn’t have sufficient permissions to perform
Instead, I implemented standard I also plan to create a separate compatibility executable that mimics the mods approach, which can be integrated via these hooks if needed. Is that worth it? I have no idea how often is this feature used. |
|
Hi @Salamek, Thanks for the detailed comparison! You've clearly identified the structural limits I wanted to address. I was leaning towards a C# rewrite specifically to implement the WinGet COM API (Microsoft.Management.Deployment) rather than just parsing CLI output. I have a few questions to see how your project compares: Under the hood: Does your Rust version use the WinGet COM API directly, or is it a high-performance wrapper around the winget.exe CLI? Language choice: My concern with Rust is the barrier to entry for the current WAU community, which is mostly composed of Windows SysAdmins familiar with PowerShell/C#. Personally, coming from a strong PowerShell background, I find C# much more aligned with the existing ecosystem and easier for future contributors to maintain. The Mods: Regarding security, since the Mods folder is in %ProgramFiles%, it's already protected by NTFS permissions. Standard users can't touch it. However, I agree that a 'Hook' system is a cleaner approach for a modern rewrite. I’m still deciding on the best path forward, but I’m strongly considering sticking with C# for its native integration with Windows APIs and its accessibility for our community. Let’s keep discussing! |
Before starting, I evaluated three possible approaches to interfacing with WinGet:
From what I found:
So I went with option 1 (CLI) as the most pragmatic starting point, with a plan to support all three via a configurable backend: The code is structured with this in mind. The implementation does not call At the moment, there are two backends:
Adding a COM backend should be straightforward, Rust has solid Windows bindings via the
I did consider C#, but one of my main priorities was cross-platform development, since I do most of my work outside Windows VMs. While .NET is cross-platform, I personally found Rust’s tooling much more straightforward:
Example setup is essentially: That said, I do understand your point about accessibility for the existing WAU community, PowerShell/C# is definitely more familiar in that space. (Rust is already being introduced in parts of Windows, especially where memory safety matters. It’s still early days, but adoption is clearly growing, so I’d consider it a bit of future proofing 🙂 ) I’d frame the tradeoff like this:
On contributors: I think familiarity still matters, but tooling (including LLMs) is lowering the barrier a lot, making language choice slightly less restrictive than it used to be. I think i can say that bigger part of future PR's will be created with LLMs help where language wont be that important for contributors. (Like i'm already receiving PRs of good quality (most likely just human checked) that are created by claude...)
I may have misunderstood parts of this, but I was under the impression that mods could be auto downloaded and executed from external sources (e.g., URL-based listings). If that’s not the case, then my concern is less relevant.
Rust can integrate with Windows APIs at a similar level to C/C++, using the In worst case scenario, you can use my rust implementation as basic template for your C# version, or i could try to implement COM version backend and decide later... |
|
Hi @Salamek, Thanks for the detailed breakdown. Your architectural choice of a 'Backend' abstraction (CLI/PS/COM) is really smart and provides great flexibility. However, from my perspective with WAU, I feel like we’re at a point where we only have two real paths: either we stay as a PS/Wrapper (simple but fragile), or we jump straight to a C#/COM-API (complex but native). I don’t see much long-term value in building another CLI wrapper, even a fast one, if we’re still parsing text output. That’s why I want to put 100% of my focus on the COM API for WAU 3.0. Regarding the language, you make a strong point about Rust’s safety and deployment benefits. But for WAU, I believe C# is the right choice for the community. Even if LLMs help with PRs, I still think a human check by someone who understands the code is essential before going to production, and our contributors are much more comfortable with the .NET ecosystem. I’m currently deep-diving into the COM API 'black box' (testing SYSTEM context, In-Proc vs Out-of-Proc, etc.). It’s a steep learning curve, but it feels like the right 'native' path to make the tool truly robust. I’ll definitely use your implementation as a blueprint for the source/scope logic, and I’ll adopt a 'Hook' system (pre/post upgrade) as you suggested, as it's much cleaner than the current Mods approach. Let’s keep 'comparing notes' while we both tackle the COM integration! Best regards |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
@Romanitho Copilot identified issues are out of scope of this PR, but i suggest checking my comments to them. |
Correctly pass value of WingetSourceCustom, to required functions and replace hardcoded -s 'winget' with -s $src
Proposed Changes
WAU allows to set WAU_WingetSourceCustom registry key to specify what repository should WAU work with, but this key value is used only in few places, in rest it was hardcoded to 'winget' making autoupdates impossible
Related Issues
#1043