Public/Show-OSSLicenses.ps1
|
# Copyright (c) 2026 Jeffrey Snover. All rights reserved. # Licensed under the MIT License. See LICENSE file in the project root. function Show-OSSLicenses { <# .SYNOPSIS Displays third-party open source license notices for AI Triad apps. .DESCRIPTION Reads the THIRD-PARTY-NOTICES.txt files generated by each Electron app and outputs their contents. By default shows notices for all three apps. Use -App to filter to a specific application. .PARAMETER App Which app's notices to display: TaxonomyEditor, POViewer, SummaryViewer, or All (default). .PARAMETER PassThru Return the file path(s) instead of displaying content. .EXAMPLE Show-OSSLicenses # Displays all third-party license notices. .EXAMPLE Show-OSSLicenses -App TaxonomyEditor # Displays only Taxonomy Editor license notices. .EXAMPLE Show-OSSLicenses -PassThru # Returns paths to THIRD-PARTY-NOTICES.txt files. #> [CmdletBinding()] param( [ValidateSet('All', 'TaxonomyEditor', 'POViewer', 'SummaryViewer')] [string]$App = 'All', [switch]$PassThru ) Set-StrictMode -Version Latest $ErrorActionPreference = 'Stop' $apps = @{ TaxonomyEditor = @{ Label = 'Taxonomy Editor'; Dir = 'taxonomy-editor' } POViewer = @{ Label = 'POViewer'; Dir = 'poviewer' } SummaryViewer = @{ Label = 'Summary Viewer'; Dir = 'summary-viewer' } } $selected = if ($App -eq 'All') { $apps.Keys } else { @($App) } foreach ($key in $selected | Sort-Object) { $info = $apps[$key] $noticesPath = Join-Path $script:RepoRoot $info.Dir 'THIRD-PARTY-NOTICES.txt' if (-not (Test-Path $noticesPath)) { Write-Warning "$($info.Label): THIRD-PARTY-NOTICES.txt not found. Run 'npm run licenses' in $($info.Dir)/." continue } if ($PassThru) { [PSCustomObject]@{ App = $info.Label Path = $noticesPath } } else { Write-Host "`n$('=' * 72)" -ForegroundColor Cyan Write-Host " $($info.Label) — Third-Party Licenses" -ForegroundColor Cyan Write-Host "$('=' * 72)`n" -ForegroundColor Cyan Get-Content $noticesPath -Raw | Write-Host } } } |