Problem
PwrCortex currently renders results via hand-rolled Write-Host UI (Write-ResponseBox, Write-Status, box drawing, colored banners in Private/Rendering.ps1 and the Public cmdlets). This violates the directive in PwrClaude/CLAUDE.md:
Rich/structured output: emit objects + a .format.ps1xml formatter, never hand-roll Write-Host UI.
Write-Host output is non-capturable, non-suppressible, non-pipeable, and forces one hardcoded layout on every caller. It also ignores Format-Table/Format-List overrides, terminal width, and -AutoSize.
Files with Write-Host that should be converted:
Public/Send-LLMMessage.ps1
Public/Invoke-LLM.ps1
Public/Invoke-LLMAgent.ps1
Public/Invoke-LLMSwarm.ps1
Public/Get-LLMProviders.ps1
Public/Expand-LLMProcess.ps1
Public/Enter-LLMChat.ps1
Private/Swarm.ps1
Private/Rendering.ps1
Proposed fix
- Ensure every public cmdlet returns a real
[PSCustomObject] (LLMResponse, LLMSwarmResult, LLMProvider, etc.) with named types via PSTypeName.
- Add
PwrCortex.format.ps1xml with <View> definitions for each type: list view for LLMResponse (content + tokens + steps), table view for LLMProvider (name, model, has-key), custom view for LLMSwarmResult.
- Register the formatter via
FormatsToProcess in PwrCortex.psd1.
- Remove
Write-ResponseBox, Write-Status, and the ANSI palette / box-drawing helpers in Config.ps1 used only by hand-rolled UI.
- Interactive REPL (
Enter-LLMChat) is allowed to keep terminal-only literal text (prompts, banners) — that is legitimate Write-Host.
Acceptance
Invoke-LLM ... | Export-Csv works (object pipeline intact).
Invoke-LLM ... | Format-List * shows all fields; default view is concise.
- No
Write-Host -ForegroundColor Red anywhere in the module.
-Quiet becomes unnecessary for machine-readable pipelines (the formatter is off by default when piping).
Related
- Sibling issue: "Expand LLMSwarmResult.Synthesis into structured PSCustomObject"
- Sibling issue: "Use Write-Progress for long-running operations"
Problem
PwrCortex currently renders results via hand-rolled
Write-HostUI (Write-ResponseBox,Write-Status, box drawing, colored banners inPrivate/Rendering.ps1and the Public cmdlets). This violates the directive inPwrClaude/CLAUDE.md:Write-Hostoutput is non-capturable, non-suppressible, non-pipeable, and forces one hardcoded layout on every caller. It also ignoresFormat-Table/Format-Listoverrides, terminal width, and-AutoSize.Files with
Write-Hostthat should be converted:Public/Send-LLMMessage.ps1Public/Invoke-LLM.ps1Public/Invoke-LLMAgent.ps1Public/Invoke-LLMSwarm.ps1Public/Get-LLMProviders.ps1Public/Expand-LLMProcess.ps1Public/Enter-LLMChat.ps1Private/Swarm.ps1Private/Rendering.ps1Proposed fix
[PSCustomObject](LLMResponse,LLMSwarmResult,LLMProvider, etc.) with named types viaPSTypeName.PwrCortex.format.ps1xmlwith<View>definitions for each type: list view forLLMResponse(content + tokens + steps), table view forLLMProvider(name, model, has-key), custom view forLLMSwarmResult.FormatsToProcessinPwrCortex.psd1.Write-ResponseBox,Write-Status, and the ANSI palette / box-drawing helpers inConfig.ps1used only by hand-rolled UI.Enter-LLMChat) is allowed to keep terminal-only literal text (prompts, banners) — that is legitimateWrite-Host.Acceptance
Invoke-LLM ... | Export-Csvworks (object pipeline intact).Invoke-LLM ... | Format-List *shows all fields; default view is concise.Write-Host -ForegroundColor Redanywhere in the module.-Quietbecomes unnecessary for machine-readable pipelines (the formatter is off by default when piping).Related