Skip to content

fix(skillhub): preserve catalog scope boundaries - #3826

Merged
MagicLizi merged 2 commits into
mainfrom
fix/skillhub-scope-boundaries
Sep 3, 2026
Merged

fix(skillhub): preserve catalog scope boundaries#3826
MagicLizi merged 2 commits into
mainfrom
fix/skillhub-scope-boundaries

Conversation

@xd-bobo

@xd-bobo xd-bobo commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

这次改了什么

摘要

修复 Cindy Skill Hub 在公开目录、组织目录和原生管理视图之间丢失 catalog scope 的问题,避免同 slug Skill 被查询、同步、学习或更新成另一目录的记录。同时收紧账号切换期间的写入边界,并让旧 XD 客户端留下的 registry 数据在升级时安全迁移。

变更类型

  • feat 新功能
  • fix 缺陷修复
  • refactor / perf 重构或性能优化
  • docs / test / chore 文档、测试或工程维护
  • 其他:

范围

  • 关联 Issue / 需求:feat(skillhub): connect clients to Cindy SkillHub #3682 合并后的 review follow-up
  • 本 PR 包含:自动同步、Learn、市场安装状态和可见性迁移的 scope 贯穿;registry 锁内逐条迁移;账号切换写门禁;Mobile scoped Learn 语法;相关测试与协议文档
  • 明确不包含:cindy-skill-hub-server 修改、旧 xd-skill-hub-server 路由迁移、服务端兼容 fallback
  • 用户可见变化:公开与组织目录中的同 slug Skill 不再串数据;组织 Skill 的 Learn、同步和版本状态使用正确目录;账号切换时不再可能沿用旧身份写入
  • 是否存在 breaking change:无。访问 Cindy Skill Hub 的客户端版本尚未发布;已发布旧客户端仍只访问 xd-skill-hub-server

UI 变化

不涉及:本 PR 命中 Renderer 文件,但只修正隐藏的目录 scope、安装状态派生和 IPC 参数,不改变布局、样式、文案或交互入口,因此无需截图。

  • 引用的设计规范:不涉及视觉实现;未修改 docs/design-rules/DESIGN.md 所约束的视觉属性

怎么验证的

自动验证

VITE_CINDY_AUTH_REGION=global pnpm test:unit:related
结果:通过;desktop 与 mobile related unit 均通过

pnpm --filter desktop typecheck
结果:通过

pnpm --filter mobile typecheck
结果:通过

修改文件 ESLint
结果:通过

pnpm check:dev-docs
pnpm check:endpoints
结果:通过

另执行 Skill Hub、Learn、Registry、IPC、安装和 Mobile slash command 定向测试,全部通过。

手工验证

不涉及:本次为目录作用域与持久化边界修复,使用定向单测覆盖 market/team 同 slug、旧 registry 迁移、并发写回、移动端解析和账号切换场景。

未执行的验证

未启动 Desktop 或 Mobile 做人工 UI 验证;本 PR 无视觉变化。未运行完整 pnpm test:all,已按仓库门禁运行 test:unit:related

风险

风险分类

  • 无已知风险
  • SQLite / migration
  • system prompt
  • 协议兼容
  • 权限 / 安全 / 用户数据
  • 存量插件兼容(批准状态 / 指纹 / manifest 校验 / 安装布局 / 包格式)
  • 原生层 / fingerprint / OTA
  • 跨平台差异
  • 其他:

影响与回滚

  • 影响范围:Desktop Skill Hub registry、市场同步与 Learn;Mobile 到 Desktop 的 Learn 请求。registry 迁移是逐安装记录的追加字段,旧客户端会忽略;已发布客户端继续使用旧 XD endpoint,不受 Cindy Skill Hub wire 契约影响。
  • 回滚 / 降级方式:可回滚本提交;新增 registry 字段为向后兼容字段,不需要数据库或人工回填。降级客户端后产生的无 scope 条目会在再次升级时重新识别和迁移。

提交前检查

  • 已 review 完整 diff
  • 每个 commit 都带 DCO 签名(git commit -s,见 DCO
  • UI 改动已在「UI 变化」注明引用的设计规范(不涉及 UI 则跳过)
  • 未提交凭证、令牌或授权文件
  • 已补充必要文档
  • 已确认测试结果或说明未执行原因

Signed-off-by: xd-bobo <caojianbo@xd.com>
@xd-bobo
xd-bobo requested a review from a team as a code owner September 2, 2026 23:14
@greptile-apps

greptile-apps Bot commented Sep 2, 2026

Copy link
Copy Markdown

Greptile Summary

此 PR 将 catalog scope 贯穿 Skill Hub 的 Learn、自动同步、安装状态、可见性更新和移动端协议,并把 registry scope 迁移改为锁内逐安装记录执行。

  • Hub Learn 请求、命令展示与 provenance 默认并保存 market/team scope
  • 自动同步和 renderer 安装状态改用 catalog scope 与 slug 的组合键
  • registry 增加逐条迁移标记,并在服务锁内完成迁移和写回
  • 账号切换期间阻止 Skill Hub 写入,Mobile Learn 支持显式 scope

Confidence Score: 4/5

合并前应处理同一 slug 同时出现在 market 与 team 自动同步配置时其中一条会被静默跳过的问题。

scoped 配置现在允许同 slug 的两条目录记录同时进入同步,但安装路径和 registry 安装槽仍按 slug 共享,导致两条记录无法同时落盘。

Files Needing Attention: apps/desktop/src/main/skillhub/autoSyncService.ts

Important Files Changed

Filename Overview
apps/desktop/src/main/skillhub/autoSyncService.ts 自动同步已按 catalog scope 查询和匹配,但允许同 slug 的多 scope 配置进入仅有一个文件系统安装槽的流程。
apps/desktop/src/main/skillhub/registry/registryService.ts 将迁移写回移至逐 skill 锁内,并按 previous scope 精确更新 registry 条目。
apps/desktop/src/main/skillhub/registry/migrations.ts 将顶层迁移标记替换为逐安装记录标记,以便识别降级后新增的旧格式条目。
apps/desktop/src/main/skillhub/marketService.ts 可见性修改完成后按来源 catalog scope 更新对应本地安装记录。
apps/desktop/src/main/learn-host/controller.ts Hub Learn 全流程规范化并保留 catalog scope,缺省值统一为 market。
apps/desktop/src/renderer/features/skillhub/hooks/useMarketList.ts 本地安装状态按 catalog scope 与 slug 组合匹配,避免同名市场记录串联。
apps/mobile/src/session/desktopSlashCommands.ts Mobile Learn 解析器支持显式 market/team scope,并兼容旧语法默认 market。

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  C[自动同步配置<br/>scope + slug] --> S[Skill Hub scoped sync]
  S --> A[AutoSync 顺序处理]
  A --> I[Install Service]
  I --> P[全局路径<br/>~/.agents/skills/slug]
  I --> R[Registry 条目<br/>slug + installPath]
  P -. 同 slug 的不同 scope 冲突 .-> P
Loading
Prompt To Fix All With AI
### Issue 1
apps/desktop/src/main/skillhub/autoSyncService.ts:653-656
**同名多目录安装槽冲突**

当自动同步配置同时包含同一 slug 的 market 与 team 记录时,新的组合键去重会保留两条记录,但安装路径和 registry 安装槽仍只按 slug 区分;第一条安装后,第二条会因目标目录已存在而被静默跳过,导致其中一个目录的目标版本和内容未被安装。

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Reviews (1): Last reviewed commit: "fix(skillhub): preserve catalog scope bo..." | Re-trigger Greptile

Comment thread apps/desktop/src/main/skillhub/autoSyncService.ts Outdated
@MagicLizi

Copy link
Copy Markdown
Contributor

@xd-bobo 👋 这个 PR 还有 1 条 review conversation 没 resolve(apps/desktop/src/main/skillhub/autoSyncService.ts),auto-review 因此暂时跳过、没法继续审查 / 合并。

如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。

@MagicLizi MagicLizi added status:awaiting-bot-review 等外部审查机器人表态(review-pr 自动维护,仅展示) touches:core 改动碰到架构核心路径(review-pr 自动维护,仅展示) touches:product-ui 改动碰到产品 / UI 面(review-pr 自动维护,仅展示) touches:rules 改动碰到规则 / 规范文档(review-pr 自动维护,仅展示) and removed status:awaiting-bot-review 等外部审查机器人表态(review-pr 自动维护,仅展示) labels Sep 2, 2026
@MagicLizi

Copy link
Copy Markdown
Contributor

命中 UI 路径(apps/desktop/src/renderer/features/skillhub/SkillhubDetailView.tsx / apps/desktop/src/renderer/features/skillhub/components/VisibilityEditorDialog.tsx / apps/desktop/src/renderer/features/skillhub/hooks/useMarketList.ts 等)但 description 未附界面效果证据——建议补充改动后效果:截图/录屏,或改动后界面的 HTML 页面(```html 代码块、.html 附件或在线预览链接),便于确认界面符合 DESIGN.md 设计规范。

Signed-off-by: xd-bobo <caojianbo@xd.com>
@xd-bobo

xd-bobo commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator Author

@MagicLizi 两项均已核对并处理:

  • 关于未 resolve 的 conversation:对应问题已在 fe1037d73 修复、补充回归测试,并已回复和 resolve;当前 unresolved conversation 为 0。
  • 关于 UI 效果证据:本 PR 虽命中 Renderer 文件,但改动仅限 catalog scope 传递、IPC 参数和安装状态的数据匹配,不改变布局、样式、文案或交互入口。PR description 的「UI 变化」已明确登记为不涉及,因此截图/录屏为 N/A。

当前 GitHub checks 19/19 通过,无失败或运行中检查。

@MagicLizi MagicLizi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

代码重审通过:当前 head 未发现 P0/P1,全部 conversation 已 resolve。catalog scope 贯穿 Learn/自动同步/安装状态/可见性/移动端协议;registry 迁移改为锁内逐安装记录;账号切换写门禁 fail-closed。heavy 软命中 2 处均为测试里的 fs.writeFileSync,不是外发或越权。

@MagicLizi
MagicLizi merged commit 2779e99 into main Sep 3, 2026
19 checks passed
@MagicLizi
MagicLizi deleted the fix/skillhub-scope-boundaries branch September 3, 2026 03:45
@MagicLizi

Copy link
Copy Markdown
Contributor

合了。公开目录和组织目录里同名 Skill 不再串数据,账号切换时也不会拿着旧身份去写——这块边界终于钉死了。

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

Labels

touches:core 改动碰到架构核心路径(review-pr 自动维护,仅展示) touches:product-ui 改动碰到产品 / UI 面(review-pr 自动维护,仅展示) touches:rules 改动碰到规则 / 规范文档(review-pr 自动维护,仅展示)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants