mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-05-25 15:31:10 +08:00
fix: handle root-level skill repos during installation
When a repo itself is a single skill (SKILL.md at repo root), the discovery phase sets directory to the repo name, but after ZIP extraction (which strips the root folder), no matching subdirectory exists. Add a fallback to check if SKILL.md exists directly in the extracted temp directory before reporting SKILL_DIR_NOT_FOUND. Fixes installation of repos like zlbigger/Google-SEOs.skill.
This commit is contained in:
@@ -680,6 +680,13 @@ impl SkillService {
|
||||
found.display()
|
||||
);
|
||||
source = found;
|
||||
} else if temp_dir.join("SKILL.md").exists() {
|
||||
// 根级 Skill:仓库本身就是 skill,SKILL.md 直接在解压根目录
|
||||
log::info!(
|
||||
"Skill directory '{}' not found, but SKILL.md exists at root, using temp_dir",
|
||||
target_name,
|
||||
);
|
||||
source = temp_dir.clone();
|
||||
} else {
|
||||
let _ = fs::remove_dir_all(&temp_dir);
|
||||
return Err(anyhow!(format_skill_error(
|
||||
|
||||
Reference in New Issue
Block a user