Files
claude-skills/scripts/package-mcpb.ps1
T
Dominic Gundel 2fd4164ee7 Add Claude Desktop extensions (.mcpb) for WordCraft and GridCraft.
Ship unsigned MCPB packages built from the ArtCraft Launcher CLIs, with install docs and skill 0.2.0 updates.
2026-10-19 16:07:21 +02:00

58 lines
1.6 KiB
PowerShell

# Builds dist\<name>-v<version>.mcpb from skills\<name>\extension\
# Steps: fetch-cli, mcpb validate, mcpb pack. Unsigned (no cert).
# Usage: scripts\package-mcpb.ps1 -Name <skill-name> [-CliPath <path>]
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() }