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

@@ -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`
更多资料:

View File

@@ -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、测试和分发包。
## 数据备份与恢复

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