feat: add WinGet upgrade option to PowerShell update notification (#5477) by PtJade-Ceramic · Pull Request #5558 · PowerShell/vscode-powershell · GitHub
Skip to content

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

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

PtJade Ceramic (PtJade-Ceramic) wants to merge 5 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

@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

@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.

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.

🟡 Changes recommended

Unresolved WinGet detection, action, terminal, progress-link, and test-coverage issues remain.

4 open findings

🧠 Review effort: Lite

Comment thread src/features/UpdatePowerShell.ts Outdated
Comment thread src/features/UpdatePowerShell.ts Outdated
Comment thread src/features/UpdatePowerShell.ts Outdated
Comment thread src/features/UpdatePowerShell.ts Outdated
- Only offer "Upgrade with WinGet" when the installed WinGet reports a newer
  version; otherwise `winget update` is a guaranteed no-op while the message
  already says WinGet has not caught up. "View WinGet Progress" is still
  offered while the catalog lags.
- Treat only ENOENT from `winget show` as WinGet being missing. Other failures
  (source lookups, network problems, and so on) keep WinGet installed with an
  unknown version instead of offering to install it.
- Run the install action in an explicit `powershell.exe` terminal, since
  `Add-AppxPackage` is a PowerShell cmdlet and the user's default terminal
  profile may be cmd or Git Bash.
- Show the terminal before sending the WinGet command so progress and errors
  are visible, matching how the extension reveals its own terminal.
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