Private/Invoke-GitHubModelsReview.ps1
|
function Invoke-GitHubModelsReview { <# .SYNOPSIS Invoke code review using GitHub Models (free tier) .DESCRIPTION Calls GitHub Models API (OpenAI-compatible) with retry logic. .PARAMETER ReviewContext Array of file diffs .PARAMETER Rules Review rules markdown .PARAMETER ApiKey GitHub token .PARAMETER Config Provider configuration .PARAMETER MaxTokens Maximum output tokens .OUTPUTS System.Array - Array of violations .NOTES Author: waldo Version: 1.0.0 GitHub Models uses OpenAI-compatible API #> [CmdletBinding()] param( [Parameter(Mandatory = $true)] [array]$ReviewContext, [Parameter(Mandatory = $true)] [string]$Rules, [Parameter(Mandatory = $true)] [string]$ApiKey, [Parameter(Mandatory = $true)] [object]$Config, [Parameter(Mandatory = $false)] [int]$MaxTokens = 4000 ) begin { Write-Verbose "Starting $($MyInvocation.MyCommand.Name)" } process { try { # GitHub Models uses OpenAI-compatible API Write-Host "Using GitHub Models (free tier)" return Invoke-OpenAIReview -ReviewContext $ReviewContext -Rules $Rules -ApiKey $ApiKey -Config $Config -MaxTokens $MaxTokens } catch { Write-Error "Error in $($MyInvocation.MyCommand.Name): $_" throw } } end { Write-Verbose "Completed $($MyInvocation.MyCommand.Name)" } } |