fix(skill): 修正上传 Skill 安装包结构

This commit is contained in:
yuzhe
2026-07-22 18:31:27 +08:00
parent b8b4d7a11c
commit 3bfb481c71
4 changed files with 16 additions and 3 deletions

View File

@@ -38,7 +38,20 @@ Add-Type -AssemblyName System.IO.Compression.FileSystem
$sourcePath,
$packagePath,
[System.IO.Compression.CompressionLevel]::Optimal,
$true
$false
)
$archive = [System.IO.Compression.ZipFile]::OpenRead($packagePath)
try {
$entries = @($archive.Entries | ForEach-Object { $_.FullName.Replace('\', '/') })
if ($entries -notcontains 'SKILL.md') {
throw 'Packaged Skill must contain SKILL.md at the ZIP root.'
}
if ($entries | Where-Object { $_ -like "$skillName/*" }) {
throw 'Packaged Skill contains an extra top-level directory.'
}
} finally {
$archive.Dispose()
}
Write-Output $packagePath