Skip to content

fix: use SKILL.md name as skill directory name instead of server slug - #144

Merged
jeff-r2026 merged 1 commit into
mainfrom
fix/skill-dir-name-mismatch-main
Jul 3, 2026
Merged

fix: use SKILL.md name as skill directory name instead of server slug#144
jeff-r2026 merged 1 commit into
mainfrom
fix/skill-dir-name-mismatch-main

Conversation

@jeff-r2026

Copy link
Copy Markdown
Collaborator

Summary

  • HTTP 拉取 skill 时,installSkillZip() 现在读取 SKILL.md frontmatter 的 name: 字段,当其与服务端 skill_slug 不同时,将安装目录重命名为 SKILL.md 中的名称
  • 新增 _slug-map.json 映射文件(slug → 实际目录名),支持 uninstall_skill 按 slug 正确查找被重命名的目录
  • name 缺失或不合法时安全降级到使用 slug 作为目录名

Test plan

  • 新增 5 个 installSkillZip 测试覆盖:slug/name 不匹配重命名、无 name 降级、不安全 name 降级、重装清理
  • 新增 1 个 executeSkillCommand 测试覆盖 slug map uninstall
  • 所有 17 个 skill-command 测试通过
  • 所有 7 个 source-http 测试通过(无回归)
  • TypeScript 类型检查通过

🤖 Generated with Claude Code

…slug

When skills are fetched via HTTP, the server-provided skill_slug was used
as the directory name, but the SKILL.md frontmatter name field could differ,
making the skill unrecognizable. Now installSkillZip reads the SKILL.md name
after extraction and renames the directory accordingly, with a _slug-map.json
to support uninstall-by-slug lookup.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jeff-r2026
jeff-r2026 merged commit e8020b6 into main Jul 3, 2026
7 checks passed
@jeff-r2026
jeff-r2026 deleted the fix/skill-dir-name-mismatch-main branch July 3, 2026 07:11
@hsuchifeng hsuchifeng mentioned this pull request Jul 3, 2026
3 tasks
jeff-r2026 added a commit that referenced this pull request Jul 8, 2026
…r slug (#162)

* fix(local-agent): name HTTP-synced skills by SKILL.md name, not server slug

When skills are delivered over the HTTP local-agent path, the directory was
named after the server-provided skill_slug. But the SKILL.md `name:` frontmatter
is what the AI tool uses to identify a skill, and the two can differ — so a
skill synced as slug "skillsaaa" landed at ~/.codebuddy/skills/skillsaaa and was
unrecognizable. The git-native path already fixed this in skill-command.ts
(#144); this brings the HTTP path (local-agent.ts) in line.

- resolveSkillDirName() reads the SKILL.md name after extraction and uses it as
  the on-disk directory name when it differs from the slug, passing path-safety
  validation; falls back to the slug when the name is missing/equal/unsafe.
- The manifest records dir_name (keyed by slug) so uninstall_skill can locate
  and remove the SKILL.md-name directory when the backend only knows the slug.

Not a regression from #161 — verified by building the prior internal release and
reproducing identical slug-based naming; this is a pre-existing gap in the HTTP
path since it was introduced.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* test(local-agent): wrap zip body in Buffer for BodyInit type compat

CI's @types/node types `zipSync`'s return as `Uint8Array<ArrayBufferLike>`,
which is not assignable to `BodyInit` in `new Response(...)`. Wrap it in
`Buffer.from()` (a valid BodyInit) so `tsc --noEmit` passes across type versions.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
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.

1 participant