diff --git a/README.md b/README.md index 7f23e92..f4dc98d 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ pnpm db:postgres:validate python tests/test_upload_skill.py ``` -修改内置 Agent 上传 Skill 后,运行 `powershell -ExecutionPolicy Bypass -File scripts/package-upload-skill.ps1` 更新 `skill-packages/upload-delivery-desk-work.zip`。 +修改内置 Agent 上传 Skill 后,运行 `powershell -ExecutionPolicy Bypass -File scripts/package-upload-skill.ps1` 更新 `skill-packages/upload-delivery-desk-work.zip`。该 ZIP 可直接上传到 Skill 安装器,根目录必须直接包含 `SKILL.md`。 更多资料: diff --git a/docs/operator-runbook.md b/docs/operator-runbook.md index dc78c50..9406302 100644 --- a/docs/operator-runbook.md +++ b/docs/operator-runbook.md @@ -60,7 +60,7 @@ python tests/test_upload_skill.py powershell -ExecutionPolicy Bypass -File scripts/package-upload-skill.ps1 ``` -打包脚本会先运行回归测试,再生成 `skill-packages/upload-delivery-desk-work.zip`。计划文件写入已忽略的 `tmp/`;接口或层级变化后必须同步更新 Skill、测试和分发包。 +打包脚本会先运行回归测试,再生成 `skill-packages/upload-delivery-desk-work.zip`,并校验 ZIP 根目录直接包含 `SKILL.md`。计划文件写入已忽略的 `tmp/`;接口或层级变化后必须同步更新 Skill、测试和分发包。 ## 数据备份与恢复 diff --git a/scripts/package-upload-skill.ps1 b/scripts/package-upload-skill.ps1 index 9c6ba1c..c6d6b25 100644 --- a/scripts/package-upload-skill.ps1 +++ b/scripts/package-upload-skill.ps1 @@ -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 diff --git a/skill-packages/upload-delivery-desk-work.zip b/skill-packages/upload-delivery-desk-work.zip index 37ed241..4361fbf 100644 Binary files a/skill-packages/upload-delivery-desk-work.zip and b/skill-packages/upload-delivery-desk-work.zip differ