Skip to content

feat: colorized console output + per-site progress bar (3.4.0) - #60

Merged
luigilink merged 1 commit into
mainfrom
feat/visual-output
Sep 30, 2026
Merged

luigilink merged 1 commit into
mainfrom
feat/visual-output

Conversation

@luigilink

Copy link
Copy Markdown
Owner

Cosmetic 3.4.0 (MINOR): colourized run output with a safe plain-text fallback, plus a per-site progress bar. Validated live on the demo tenant (see run: colored tags + framed summary + progress bar).

What changed

  • Write-SpsLine / Write-SpsRule helpers. Per-site lines and the end-of-run summary now carry coloured status tags: site (cyan), [jit ] grant/revoke (magenta), [ ok ] applied (green), [skip] skipped/compliant (grey), [warn] / [deny]. Plus a framed summary block.
  • Safe colour gating. Colour is ANSI via $PSStyle, emitted only when $script:UseColor = (not Azure Automation) AND ($PSStyle present) AND (output not redirected) AND (host SupportsVirtualTerminal). Azure Automation, redirected/piped output and non-VT hosts get a plain ASCII fallback; OutputRendering='Host' keeps Start-Transcript logs ANSI-free (verified).
  • Per-site progress bar (Write-Progress, Site X of N + percent), suppressed under Azure Automation.
  • Unchanged contracts: results.json and the HTML report are built from $script:RunResults (untouched); the machine-readable --- SPSCleanVersions finished: … --- anchor line is kept; Write-Warning/Write-Error left as-is; Get-TenantSiteUrls still returns a clean array (uses Write-Verbose).

Tests

195 Pester pass (+5: Write-SpsLine plain/colour, Write-SpsRule, progress gating). .ps1 UTF-8 BOM + CRLF preserved.

Targeted for 3.4.0 (release cut separately).

Add Write-SpsLine / Write-SpsRule visual helpers and route the per-site run
lines and the end-of-run summary through them: colored status tags (site, jit,
ok, skip, warn, deny) + a framed summary block.

Color is ANSI via $PSStyle, emitted ONLY on an interactive VT console
($script:UseColor gates on: not Azure Automation, PSStyle present, output not
redirected, host SupportsVirtualTerminal). Azure Automation, redirected/piped
output and non-VT hosts get a plain ASCII fallback; OutputRendering='Host'
keeps Start-Transcript logs ANSI-free. results.json and the HTML report are
unchanged (built from $script:RunResults), and the machine-readable
'--- SPSCleanVersions finished: ... ---' anchor line is kept.

Also rapatriate the per-site Write-Progress bar (Site X of N + percent) from
the earlier feat/write-progress spike, gated out of Azure Automation.

Write-Warning/Write-Error lines are intentionally left as-is. 195 Pester pass
(+5 visual/progress tests). POC previewer _poc-visual.ps1 gitignored.
@luigilink
luigilink merged commit 1749871 into main Sep 30, 2026
1 check passed
@luigilink
luigilink deleted the feat/visual-output branch September 30, 2026 12:23
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.

1 participant