Skip to content

feat: add WinGet upgrade option to PowerShell update notification (#5477) - #5558

Open
PtJade Ceramic (PtJade-Ceramic) wants to merge 4 commits into
PowerShell:mainfrom
PtJade-Ceramic:feat/winget-upgrade
Open

feat: add WinGet upgrade option to PowerShell update notification (#5477)#5558
PtJade Ceramic (PtJade-Ceramic) wants to merge 4 commits into
PowerShell:mainfrom
PtJade-Ceramic:feat/winget-upgrade

Conversation

@PtJade-Ceramic

@PtJade-Ceramic PtJade Ceramic (PtJade-Ceramic) commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

PR Summary

When a new PowerShell version is available, this PR adds WinGet integration to the update notification:

  • Detect WinGet availability and latest version via winget show
  • Upgrade with WinGet button when WinGet has a newer version than installed
  • Install WinGet button for Windows users without WinGet
  • View WinGet Progress button to follow winget-pkgs issues/PRs
  • Falls back to GitHub API when WinGet CLI is unavailable

WinGet only exists on Windows, so its buttons are offered there only, and the prompt is built by a pure buildUpdatePrompt() function so its buttons and message can be tested.

Resolves #5477.

PR Checklist

  • PR has a meaningful title
  • Summarized changes
  • PR has tests
  • This PR is ready to merge and is not work in progress

Testing

  • npm run compile, npm run lint, npm run format and npx tsc --noEmit pass.
  • New tests in test/features/UpdatePowerShell.test.ts cover the version parsing (from winget show output and from winget-pkgs manifest listings) and the buttons and notes the prompt produces for each WinGet state, including that WinGet options are not offered off Windows.
  • CI is green on Windows, macOS and Linux. Getting there needed four temporary, TODO-marked changes for pre-existing infrastructure problems (see CI Tests: PowerShellEditorServices build cannot restore .NET reference packs (NuGet feed returns 401), failing every branch since 2026-06-25 #5592): nuget.org plus package source mapping for the PowerShellEditorServices build, @vscode/test-electron 3.x for the renamed macOS binary, npmjs for the @vscode scope until the PowerShell npm mirror has that version, and fail-fast: false. They are easy to drop or move into a separate PR.

@JustinGrote

Copy link
Copy Markdown
Collaborator

Thanks for your submission! I'm going to convert this to draft status until tests pass, let us know when it is ready for review!

@JustinGrote
Justin Grote (JustinGrote) marked this pull request as draft July 21, 2026 20:17
@PtJade-Ceramic
PtJade Ceramic (PtJade-Ceramic) marked this pull request as ready for review July 22, 2026 08:09
@PtJade-Ceramic
PtJade Ceramic (PtJade-Ceramic) marked this pull request as draft July 22, 2026 08:17
@PtJade-Ceramic PtJade Ceramic (PtJade-Ceramic) changed the title feat: add WinGet upgrade option to PowerShell update notification (#5477) WIP: feat: add WinGet upgrade option to PowerShell update notification (#5477) Jul 22, 2026
@PtJade-Ceramic PtJade Ceramic (PtJade-Ceramic) changed the title WIP: feat: add WinGet upgrade option to PowerShell update notification (#5477) feat: add WinGet upgrade option to PowerShell update notification (#5477) Jul 22, 2026
@PtJade-Ceramic
PtJade Ceramic (PtJade-Ceramic) marked this pull request as ready for review July 22, 2026 08:26
@JustinGrote

Copy link
Copy Markdown
Collaborator

PtJade Ceramic (@PtJade-Ceramic)
image

@JustinGrote
Justin Grote (JustinGrote) marked this pull request as draft July 22, 2026 23:07
@PtJade-Ceramic

PtJade Ceramic (PtJade-Ceramic) commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

PtJade Ceramic (@PtJade-Ceramic) image

The code changes are clean — the macOS failure is a CI environment issue (VS Code Insiders download/corruption), unrelated to this PR. Could someone with write access please re-run the failed jobs? Thanks!

@PtJade-Ceramic
PtJade Ceramic (PtJade-Ceramic) marked this pull request as ready for review July 23, 2026 10:31
@PtJade-Ceramic
PtJade Ceramic (PtJade-Ceramic) requested a review from a team as a code owner July 23, 2026 10:31
Copilot AI balanced review requested due to automatic review settings September 12, 2026 11:55

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Test-first: covers parsing of 'winget show' output and of winget-pkgs manifest listings, plus the buttons and notes the update prompt should show for each WinGet state, including that WinGet is not offered off Windows.
…werShell#5477)

Detects WinGet via 'winget show --id Microsoft.PowerShell', falling back to the winget-pkgs listing when the CLI is missing. The prompt can upgrade with WinGet, install WinGet, and follow WinGet's progress, noting the version WinGet currently has. It is built by a pure buildUpdatePrompt() function, and WinGet options are only offered on Windows.
@PtJade-Ceramic

PtJade Ceramic (PtJade-Ceramic) commented Sep 12, 2026

Copy link
Copy Markdown
Contributor Author

All checks are green now — the first green CI Tests run on this repo since 2026-06-25. Three separate infrastructure problems were in the way:

  1. The PSES build could not restore. The nuget.config in the PowerShellEditorServices checkout lists only an Azure DevOps feed that returns 401 for packages it has not cached (details in CI Tests: PowerShellEditorServices build cannot restore .NET reference packs (NuGet feed returns 401), failing every branch since 2026-06-25 #5592), so the .NET reference packs could not be restored. Worked around here by adding nuget.org plus a packageSourceMapping for the framework reference packs.
  2. macOS could not launch the Insiders build. VS Code 1.110 renamed the macOS main executable from Contents/MacOS/Electron to the product name (Code - Insiders for Insiders), and @vscode/test-electron 2.x hardcodes the old path, so every macOS run died with spawn ... Electron ENOENT before any test loaded. Fixed by updating it to 3.x, which resolves the executable from the bundle's Info.plist.
  3. The npm install skipped the new package. The PowerShell npm mirror has not cached @vscode/test-electron 3.x and returns 401 for packages it has not cached; npm silently skips optional dependencies it cannot fetch, so the CI workaround serves it from npmjs until the mirror is refreshed.

The CI changes are marked with TODOs — happy to drop them or move them into a separate PR if you prefer. The matrix also had the default fail-fast, which cancelled the other platforms as soon as one failed; it is false now so every platform reports.

Nothing here changes the feature itself: the branch is rebased on main, and the change is one source file plus tests (compile, lint, format and tsc --noEmit pass locally; the new tests cover the version parsing and the prompt built for each WinGet state).

Two small asks: #5477 was closed as not planned after a misunderstanding — this is about upgrading PowerShell itself via WinGet (VS Code already manages the extension), not about shipping the extension via WinGet. And could a maintainer add the Issue-Enhancement / Area-UI labels (I don't have permission) and take a look? Thanks!

@PtJade-Ceramic
PtJade Ceramic (PtJade-Ceramic) force-pushed the feat/winget-upgrade branch 2 times, most recently from 5d1b946 to 12e0256 Compare September 12, 2026 16:47
Temporary workaround: PSES's nuget.config only lists an Azure DevOps feed, which returns 401 (Unauthorized) for anonymous downloads, so CI fails while restoring the .NET reference packs before any tests run. Drop this once that is fixed upstream.
@PtJade-Ceramic
PtJade Ceramic (PtJade-Ceramic) force-pushed the feat/winget-upgrade branch 4 times, most recently from 0a3ccc1 to fd56c92 Compare September 12, 2026 18:40
VS Code 1.110 renamed the macOS main executable from 'Contents/MacOS/Electron' to the product name ('Code - Insiders' for Insiders), so v2's hardcoded path fails with 'spawn ... Electron ENOENT' before any test runs. v3 resolves it from the bundle's Info.plist. CI needs the `@vscode` scope served by npmjs meanwhile: the PowerShell npm mirror has not cached 3.1.0 yet and returns 401 for packages it has not cached, which npm silently skips for optional dependencies.

Fixes PowerShell#5592.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow upgrading with WinGet

3 participants