[CmdletBinding(SupportsShouldProcess)] param( [Parameter(Mandatory = $true)] [ValidatePattern('^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$')] [string] $RepoId, [string] $HfCommand = 'hf', [switch] $CreatePullRequest ) $ErrorActionPreference = 'Stop' $releaseRoot = $PSScriptRoot $validator = Join-Path $releaseRoot 'scripts\validate_release.py' python $validator if ($LASTEXITCODE -ne 0) { throw 'Release validation failed; upload stopped.' } & $HfCommand auth whoami --format json | Out-Null if ($LASTEXITCODE -ne 0) { throw "Hugging Face login required. Run: $HfCommand auth login" } if (-not $PSCmdlet.ShouldProcess($RepoId, 'Create public model repository and upload UMoX documentation')) { return } & $HfCommand repos create $RepoId --type model --public --exist-ok if ($LASTEXITCODE -ne 0) { throw 'Hugging Face repository creation failed.' } $uploadArgs = @( 'upload', $RepoId, $releaseRoot, '.', '--type', 'model', '--commit-message', 'Publish UMoX Qwen3.6 Snapdragon X2 research prototype' ) if ($CreatePullRequest) { $uploadArgs += '--create-pr' } & $HfCommand @uploadArgs if ($LASTEXITCODE -ne 0) { throw 'Hugging Face upload failed.' } Write-Host "Published https://huggingface.co/$RepoId"