Skip to content

perf(skills): 批量导入 Skill 文件夹并复用上次成功位置 - #1172

Merged
vastsa merged 3 commits into
vastsa:mainfrom
hui455:codex/skill-folder-batch
Sep 29, 2026
Merged

vastsa merged 3 commits into
vastsa:mainfrom
hui455:codex/skill-folder-batch

Conversation

@hui455

@hui455 hui455 commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

问题

逐个导入 N 个 Skill 文件夹时,需要重复打开原生目录选择器 N 次、发起 N 次桌面 IPC 请求,并刷新技能列表 N 次。下一轮导入还要重新找到来源目录,整批操作耗时增加。

改动

  • “导入目录”支持一次选中多个各自包含 SKILL.md 的文件夹。
  • 主进程对选中的每个文件夹继续调用现有 skills.import。一个目录失败不会阻断后续导入;界面反馈成功数量、失败数量和首个错误,列表只刷新一次。
  • 在本机应用数据中记住最后一个成功导入的 Skill 文件夹的上一级目录,下次从该目录打开选择器。取消或整批失败不改动记录;目录已不存在时使用系统默认位置。
  • “导入文件”保持原有的单文件选择。同步 IPC 返回结果、界面反馈、行为规范和 E2E 场景。

导入 N 个目录时,选择器打开、渲染进程到主进程的请求和列表刷新各由 N 次降为 1 次;host 内部的 N 次导入仍顺序执行。总耗时尚未做受控测量。

验证

  • 相关 Node 测试:32 项通过;覆盖多目录顺序导入、失败隔离、最后成功目录记忆和旧单文件入口。
  • pnpm lint、pnpm build:js、Desktop 类型检查:通过。
  • 从当前 worktree 构建 Rust host,使用隔离 Electron 配置启动;host 协议 11 与桌面匹配,启动 E2E 通过。
  • Windows 隔离桌面实测同次选中 epsilon/、zeta/、broken/:前两个出现在列表,缺少 SKILL.md 的 broken/ 未落盘;下次选择器从最后成功目录的上一级打开。
  • 未做受控的总耗时基准;原生交互只在 Windows 验证。

兼容性

单文件导入的返回结果和 host 的 skills.import 合同保持不变;目录导入新增 imported 与 failed 字段。每个目录继续沿用原有的路径检查、复制与失败规则。

操作截图

Windows 原生选择器一次选中多个 Skill 文件夹。截图展示选择操作;导入成功与失败结果见上方验证。

Windows 原生目录选择器批量选择 Skill 文件夹

hui455 and others added 3 commits September 28, 2026 16:08
Reduce repeated picker launches, IPC requests, and list reloads when
users import several skills. Keep each host import independent and reopen
the picker beside the last successfully imported folder.
The old handler-wide assertion rejected the new folder multi-selection
even though file imports still select one file. Keep the check on the
file path and make handler extraction tolerant of platform line endings.
@vastsa
vastsa merged commit f9543be into vastsa:main Sep 29, 2026
4 checks passed
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