fix(skill): 修正上传 Skill 安装包结构
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user