Skip to content

docs(powershell): add Output & Streams guidance discouraging Write-Host#193

Merged
MarkMichaelis merged 1 commit into
mainfrom
feat/192-output-streams
Jun 7, 2026
Merged

docs(powershell): add Output & Streams guidance discouraging Write-Host#193
MarkMichaelis merged 1 commit into
mainfrom
feat/192-output-streams

Conversation

@MarkMichaelis

Copy link
Copy Markdown
Contributor

Summary

Adds an Output & Streams section to .github/instructions/powershell.instructions.md (the guidelines previously had no output-stream guidance).

  • Choose the output cmdlet by intent; avoid Write-Host (PSScriptAnalyzer PSAvoidUsingWriteHost) because it cannot be captured, redirected, or suppressed.
    • Write-Output -- pipeline data / return values
    • Write-Information -- human-facing status (stream 6)
    • Write-Verbose / Write-Debug -- opt-in diagnostics
    • Write-Warning / Write-Error (or throw) -- problems
  • Color is a host concern: Write-Warning is auto-yellow and Write-Error auto-red; tune via \System.Management.Automation.PSStyle on PowerShell 7.2+. No hand-rolled color.
  • Write-Host reserved for intentional decorative interactive console UX only.

Documentation-only, generic, ASCII-only. No existing scripts refactored.

Closes #192

Steer authors to intent-appropriate output cmdlets (Write-Output for data,
Write-Information for status, Write-Verbose/Write-Debug for diagnostics,
Write-Warning/Write-Error for problems) instead of Write-Host, which cannot be
captured, redirected, or suppressed (PSScriptAnalyzer PSAvoidUsingWriteHost).

Document that color is a host concern: Write-Warning is auto-yellow and
Write-Error auto-red, configurable via \System.Management.Automation.PSStyle in PowerShell 7.2+. Reserve
Write-Host for intentional decorative interactive console UX only.

Closes #192

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@MarkMichaelis MarkMichaelis merged commit 65b12a0 into main Jun 7, 2026
2 checks passed
@MarkMichaelis MarkMichaelis deleted the feat/192-output-streams branch June 7, 2026 18:00
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.

docs(powershell): add Output & Streams guidance discouraging Write-Host

1 participant