Skip to content

# feat(install): 目录条目展开为子级安装,支持与用户自定义 skills 共存#19

Open
ranger1112 wants to merge 1 commit intotelagod:mainfrom
ranger1112:feat/skills-coexistence-v2
Open

# feat(install): 目录条目展开为子级安装,支持与用户自定义 skills 共存#19
ranger1112 wants to merge 1 commit intotelagod:mainfrom
ranger1112:feat/skills-coexistence-v2

Conversation

@ranger1112
Copy link
Copy Markdown

Supersedes #18

问题

当前 installCore()skills/output-styles/bin/lib/ 等目录视为单一整体单元:整体备份 → 删除 → 全量覆盖。这导致用户原有的自定义 skills 在安装期间被"冻结"到 .sage-backup/ 中,只有卸载时才能恢复,无法与 Code Abyss skills 共存。

方案

将目录类安装条目展开为 immediate children 逐个安装,而不是整个目录替换。

installCore() 改动:

  • 对每个 filesToInstall 条目检测 srcPath 是否为目录
  • 目录 → fs.readdirSync() 枚举 children,过滤 shouldSkip() 后逐个安装
  • 每个 child 独立备份、独立 manifest 追踪({root: "claude", path: "skills/domains"} 而非 {path: "skills"}
  • 文件类型保持原有逻辑不变

runUninstall() + uninstall.js 改动:

  • 移除空目录裁剪的 normalized.root !== tgt 守卫
  • 子级安装后同域内的父目录在所有 child 被移除后形成空壳,需统一清理

验证

基于 v2.1.8 (telagod/main) rebase,按最新口径全部重新验证:

验证项 结果
npm run verify:skills 26 skills ✅
npm test -- --runInBand 217 passed(5 个 Windows 预置失败,非本次改动)✅
Smoke tests(Claude/Codex/Gemini/OpenClaw) 12/12 ✅
默认不生成 explicit commands commands/ 目录不存在 ✅
用户 skill 共存(安装前后) 安装→卸载全周期存活 ✅
.sage-backup/manifest.json 恢复链兼容 install→uninstall→reinstall→uninstall 全链路正常 ✅

改动文件

文件 + -
bin/install.js 50 23
bin/uninstall.js 4 1

向后兼容

  • 旧版 manifest 中 {path: "skills"} 整目录条目仍以 rmSafe 删除,行为不变
  • 新版 manifest 中 {path: "skills/domains"} 等子条目逐条删除 + 空目录裁剪
  • manifest_version 保持 v2,不做版本号升级

基于 reviewer 在 #18 的反馈完整 rebase:基于 v2.1.8 主线,包含 OpenClaw target、runtimeRoots 支持等最新变更,按新口径重新验证。

…stence

Replace monolithic directory copy with child-level installation in
installCore(). User files in target dirs (skills/, output-styles/,
bin/lib/) are now preserved — only Code Abyss entries are backed up
and replaced individually.

Also enable empty-parent-dir pruning for all manifest entries during
uninstall, removing the cross-root restriction so stale dirs from
child-level install are cleaned up regardless of root domain.

Rebased on v2.1.8 (telagod/main). Verified:
- npm test --runInBand: 217 passed (5 pre-existing Windows-only failures)
- npm run verify:skills: 26 skills
- Smoke: 12/12 (Claude/Codex/Gemini/OpenClaw)
- No explicit commands generated by default
- User skills survive install→uninstall cycle
- .sage-backup/manifest.json restore chain compatible
Copilot AI review requested due to automatic review settings April 30, 2026 02:19
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants