PStips-AIEnhanced.ps1

$script:PsTips = $null

function Get-PSTip {
    $uri = 'https://raw.githubusercontent.com/deadlydog/PowerShell.tiPS/main/src/tiPS/PowerShellTips.json'
    
    if ($null -eq $script:PsTips) {
        $script:PsTips = Invoke-RestMethod $uri | ConvertTo-Json
    }

    Write-Host "[$(Get-Date)] Now, AI-Enhanced PowerShell Tips!" -ForegroundColor Cyan
    $script:PsTips | ai -Instructions @'
- choose one and only one tip from the input json
- nice headers and subsections
- use bullets
- include urls and author from the input json.
- at the end add max 25 words about it
- output to markdown
 
## Tip {{Title}}
 
{{Description}}
 
- **Author**: [{{Author}}]({{AuthorUrl}})
 
{{References}}
 
{{Summary}}
 
'@
 | glow
}