Skip to content

Commit bae1807

Browse files
denelonCopilot
andcommitted
Update spec: new settings object, PowerShell cmdlets, fix settings interaction
- Replace extended disableInstallNotes with new userMessages settings object - Add PowerShell cmdlet section (Install/Update/Uninstall/Repair-WinGetPackage) - Fix flow matrix to reflect independent settings controls - Add Show-WinGetPackage output details Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 9116923 commit bae1807

1 file changed

Lines changed: 101 additions & 8 deletions

File tree

doc/specs/#3483 - UserMessages.md

Lines changed: 101 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,9 @@ Post-action messages are displayed in both interactive and non-interactive modes
155155
| `winget import` | Each package's `Pre*` shown, prompt Y/n per package | Each package's `Post*` shown | Follows the same per-package model |
156156
| WinGet Configuration (DSC) | Displayed in log output, no prompt | Displayed in log output | Configuration is inherently non-interactive |
157157
| Operation failure | `Pre*` shown before attempt | `Post*` NOT shown | Post-messages only appear on success |
158-
| `disableInstallNotes` setting enabled | `Pre*` still shown (not affected) | `Post*` suppressed | Pre-messages are operational; post-messages are informational |
158+
| `disableInstallNotes` setting enabled | `Pre*` still shown (not affected) | `Post*` still shown (controlled by `userMessages` settings, not `disableInstallNotes`) | Legacy setting does not affect new fields |
159+
| `userMessages.disablePostActionMessages` enabled | `Pre*` still shown | `Post*` suppressed | New setting for new fields |
160+
| `userMessages.disablePreActionMessages` enabled | `Pre*` suppressed, no prompt | `Post*` still shown | Suppresses both display and prompt |
159161

160162
#### Bulk Operations (`upgrade --all`, `import`)
161163

@@ -165,16 +167,32 @@ A future enhancement could aggregate pre-messages and present them as a summary
165167

166168
### Settings
167169

168-
The existing `installBehavior.disableInstallNotes` setting is extended:
170+
A new `userMessages` settings object is introduced under the root of the WinGet settings file. The existing `installBehavior.disableInstallNotes` setting is **not modified** and continues to control only the legacy `InstallationNotes` field.
169171

170-
| Setting | Current behavior | New behavior |
171-
|---------|-----------------|-------------|
172-
| `disableInstallNotes: true` | Suppresses `InstallationNotes` after install | Suppresses all `Post*` messages (`PostInstall`, `PostUpgrade`, `PostUninstall`) |
173-
| `disableInstallNotes: false` (default) | Shows `InstallationNotes` after install | Shows all `Post*` messages |
172+
```json
173+
{
174+
"userMessages": {
175+
"disablePreActionMessages": false,
176+
"disablePostActionMessages": false
177+
}
178+
}
179+
```
180+
181+
| Setting | Default | Description |
182+
|---------|---------|-------------|
183+
| `userMessages.disablePreActionMessages` | `false` | When `true`, suppresses all pre-action messages (`PreInstall`, `PreUpgrade`, `PreUninstall`) and their associated prompts. The operation proceeds as if the user confirmed. |
184+
| `userMessages.disablePostActionMessages` | `false` | When `true`, suppresses all post-action messages (`PostInstall`, `PostUpgrade`, `PostUninstall`). |
174185

175-
Pre-action messages are not affected by this setting because they serve an operational purpose (informing users before a potentially impactful action).
186+
**Interaction with existing settings:**
176187

177-
> **Future consideration:** If community feedback indicates a need, a separate `disablePreActionMessages` setting could be added. This is not included in this specification.
188+
| `disableInstallNotes` | `userMessages.disablePostActionMessages` | `InstallationNotes` | `UserMessages.Post*` |
189+
|----------------------|------------------------------------------|---------------------|----------------------|
190+
| `false` | `false` | Shown | Shown |
191+
| `true` | `false` | Suppressed | Shown |
192+
| `false` | `true` | Shown | Suppressed |
193+
| `true` | `true` | Suppressed | Suppressed |
194+
195+
The two settings are independent. `disableInstallNotes` governs the legacy field; `userMessages.disablePostActionMessages` governs the new fields. This avoids changing the meaning of an existing setting and gives users granular control during the transition period.
178196

179197
### COM API
180198

@@ -200,6 +218,81 @@ interface IPackageUserMessages : IInspectable
200218

201219
COM consumers are responsible for their own interactivity model. The WinGet COM API does not prompt — it returns the data and the consumer decides how to handle it.
202220

221+
### PowerShell Cmdlets
222+
223+
The WinGet PowerShell module cmdlets consume the COM API and must surface `UserMessages` appropriately.
224+
225+
#### Affected Cmdlets
226+
227+
| Cmdlet | Pre-message field | Post-message field |
228+
|--------|-------------------|-------------------|
229+
| `Install-WinGetPackage` | `PreInstall` | `PostInstall` |
230+
| `Update-WinGetPackage` | `PreUpgrade` | `PostUpgrade` |
231+
| `Uninstall-WinGetPackage` | `PreUninstall` | `PostUninstall` |
232+
| `Repair-WinGetPackage` | `PreInstall` (reuses install messages) | `PostInstall` (reuses install messages) |
233+
234+
#### Interactive Behavior
235+
236+
When running interactively in a PowerShell session, cmdlets follow the same pattern as the CLI:
237+
238+
```powershell
239+
PS> Install-WinGetPackage -Id Publisher.ExampleApp
240+
241+
The following information has been provided by the package publisher:
242+
243+
This package requires 2 GB of disk space and will modify your PATH.
244+
245+
Do you wish to continue?
246+
[Y] Yes [N] No (default is "Y"):
247+
```
248+
249+
The prompt uses `$Host.UI.PromptForChoice` (or equivalent) to integrate with PowerShell's native prompting, supporting `-Confirm` and `-WhatIf` patterns where applicable.
250+
251+
#### Non-Interactive / Pipeline Behavior
252+
253+
When running non-interactively (e.g., in a script with no host, or when the user passes `-Force`), pre-action messages are written to the verbose stream (`Write-Verbose`) and the operation proceeds without prompting:
254+
255+
```powershell
256+
PS> Install-WinGetPackage -Id Publisher.ExampleApp -Force -Verbose
257+
VERBOSE: Publisher message (PreInstall): This package requires 2 GB of disk space and will modify your PATH.
258+
```
259+
260+
Post-action messages are written to the information stream (`Write-Information`) so they appear by default but can be suppressed with `-InformationAction SilentlyContinue`.
261+
262+
#### Output Object
263+
264+
The result objects returned by cmdlets should include UserMessages in their output when present:
265+
266+
```powershell
267+
PS> $result = Install-WinGetPackage -Id Publisher.ExampleApp
268+
PS> $result.UserMessages
269+
270+
PreInstall : This package requires 2 GB of disk space and will modify your PATH.
271+
PostInstall : Restart your terminal to use the CLI.
272+
```
273+
274+
This allows scripts to programmatically inspect messages after an operation:
275+
276+
```powershell
277+
$result = Install-WinGetPackage -Id Publisher.ExampleApp -Force
278+
if ($result.UserMessages.PostInstall) {
279+
Write-Host "Note from publisher: $($result.UserMessages.PostInstall)" -ForegroundColor Yellow
280+
}
281+
```
282+
283+
#### Find-WinGetPackage / Show-WinGetPackage
284+
285+
The `Show-WinGetPackage` (or `Get-WinGetPackage`) cmdlet should include `UserMessages` in its output when displaying package metadata, allowing users to review messages before deciding to install:
286+
287+
```powershell
288+
PS> Show-WinGetPackage -Id Publisher.ExampleApp | Select-Object -ExpandProperty UserMessages
289+
290+
PreInstall : This package requires 2 GB of disk space and will modify your PATH.
291+
PostInstall : Restart your terminal to use the CLI.
292+
PreUpgrade : Back up your configuration file before upgrading.
293+
PostUpgrade : Review the changelog for breaking changes.
294+
```
295+
203296
### Validation Pipeline (winget-pkgs)
204297

205298
The `winget validate` command and the automated validation pipeline in the winget-pkgs repository must handle `UserMessages` correctly:

0 commit comments

Comments
 (0)