# Builds dist\-v.mcpb from skills\\extension\ # Steps: fetch-cli, mcpb validate, mcpb pack. Unsigned (no cert). # Usage: scripts\package-mcpb.ps1 -Name [-CliPath ] param( [Parameter(Mandatory = $true)][string]$Name, [string]$CliPath ) . (Join-Path $PSScriptRoot 'lib.ps1') $dir = Join-Path $SkillsDir $Name $ext = Join-Path $dir 'extension' if (-not (Test-Path (Join-Path $ext 'manifest.json'))) { Write-Host "skills/$Name/extension/ fehlt." exit 1 } $ver = Get-SkillVersion $dir if (-not $ver) { Write-Host "CHANGELOG von $Name hat keine Version." exit 1 } $fetchArgs = @{ Name = $Name } if ($CliPath) { $fetchArgs.CliPath = $CliPath } & (Join-Path $PSScriptRoot 'fetch-cli.ps1') @fetchArgs if ($LASTEXITCODE -ne 0) { exit 1 } $manPath = Join-Path $ext 'manifest.json' $man = Read-Text $manPath | ConvertFrom-Json if ($man.version -cne $ver) { Write-Host "manifest.json version '$($man.version)' != CHANGELOG '$ver'." exit 1 } New-Item -ItemType Directory -Force -Path $DistDir | Out-Null $out = Join-Path $DistDir "$Name-v$ver.mcpb" if (Test-Path $out) { Remove-Item $out -Force } Push-Location $ext try { npx --yes @anthropic-ai/mcpb validate . if ($LASTEXITCODE -ne 0) { exit 1 } npx --yes @anthropic-ai/mcpb pack . $out if ($LASTEXITCODE -ne 0) { exit 1 } } finally { Pop-Location } Write-Host '' Write-Host "dist/$Name-v$ver.mcpb" Add-Type -AssemblyName System.IO.Compression.FileSystem $zip = [IO.Compression.ZipFile]::OpenRead($out) try { foreach ($e in $zip.Entries) { Write-Host ('{0,12} {1}' -f $e.Length, $e.FullName) } } finally { $zip.Dispose() }