publish.ps1
param([switch]$CheckOnly)
$ErrorActionPreference = 'Stop'
Set-Location -LiteralPath $PSScriptRoot
Get-Command lms -ErrorAction Stop | Out-Null
$manifest = Get-Content -LiteralPath (Join-Path $PSScriptRoot 'manifest.json') -Raw | ConvertFrom-Json
if ($manifest.owner -ne 'yuanjumay' -or $manifest.name -ne 'web-security-mcp') {
throw 'Unexpected manifest. Verify owner and plugin name before publishing.'
}
$savedPreference = $ErrorActionPreference
try {
# Windows PowerShell 5.1 turns native stderr into NativeCommandError records.
# LM Studio writes startup/progress messages there even on success.
$ErrorActionPreference = 'Continue'
$identityOutput = & lms whoami 2>&1
$identityExitCode = $LASTEXITCODE
} finally {
$ErrorActionPreference = $savedPreference
}
$identity = @($identityOutput | ForEach-Object { $_.ToString() })
$identityText = ($identity -join "`n") -replace '\x1b\[[0-9;]*m', ''
if ($identityExitCode -ne 0) {
Write-Output $identity
throw "lms whoami failed (exit code $identityExitCode). Start LM Studio and retry. Review the CLI error above before changing login settings."
}
if ($identityText -notmatch 'logged in as:\s*yuanjumay(?:\s|$)') {
Write-Output $identity
throw 'Sign in as yuanjumay with lms login, then run this script again.'
}
Write-Output $identity
if ($CheckOnly) {
Write-Output 'Account and manifest checks passed. No upload was performed.'
exit 0
}
Write-Output 'Publishing yuanjumay/web-security-mcp to LM Studio Hub. The CLI will ask for confirmation.'
try {
$ErrorActionPreference = 'Continue'
& lms push --write-revision
$pushExitCode = $LASTEXITCODE
} finally {
$ErrorActionPreference = $savedPreference
}
if ($pushExitCode -ne 0) { throw 'Publication failed. Review the CLI error above.' }
publish.ps1
param([switch]$CheckOnly)
$ErrorActionPreference = 'Stop'
Set-Location -LiteralPath $PSScriptRoot
Get-Command lms -ErrorAction Stop | Out-Null
$manifest = Get-Content -LiteralPath (Join-Path $PSScriptRoot 'manifest.json') -Raw | ConvertFrom-Json
if ($manifest.owner -ne 'yuanjumay' -or $manifest.name -ne 'web-security-mcp') {
throw 'Unexpected manifest. Verify owner and plugin name before publishing.'
}
$savedPreference = $ErrorActionPreference
try {
# Windows PowerShell 5.1 turns native stderr into NativeCommandError records.
# LM Studio writes startup/progress messages there even on success.
$ErrorActionPreference = 'Continue'
$identityOutput = & lms whoami 2>&1
$identityExitCode = $LASTEXITCODE
} finally {
$ErrorActionPreference = $savedPreference
}
$identity = @($identityOutput | ForEach-Object { $_.ToString() })
$identityText = ($identity -join "`n") -replace '\x1b\[[0-9;]*m', ''
if ($identityExitCode -ne 0) {
Write-Output $identity
throw "lms whoami failed (exit code $identityExitCode). Start LM Studio and retry. Review the CLI error above before changing login settings."
}
if ($identityText -notmatch 'logged in as:\s*yuanjumay(?:\s|$)') {
Write-Output $identity
throw 'Sign in as yuanjumay with lms login, then run this script again.'
}
Write-Output $identity
if ($CheckOnly) {
Write-Output 'Account and manifest checks passed. No upload was performed.'
exit 0
}
Write-Output 'Publishing yuanjumay/web-security-mcp to LM Studio Hub. The CLI will ask for confirmation.'
try {
$ErrorActionPreference = 'Continue'
& lms push --write-revision
$pushExitCode = $LASTEXITCODE
} finally {
$ErrorActionPreference = $savedPreference
}
if ($pushExitCode -ne 0) { throw 'Publication failed. Review the CLI error above.' }