Skip to content

fix(skills): update in-place instead of relocating namespaced skills#13423

Draft
SamMorrowDrums wants to merge 3 commits into
cli:trunkfrom
SamMorrowDrums:fix-skill-update-in-place
Draft

fix(skills): update in-place instead of relocating namespaced skills#13423
SamMorrowDrums wants to merge 3 commits into
cli:trunkfrom
SamMorrowDrums:fix-skill-update-in-place

Conversation

@SamMorrowDrums
Copy link
Copy Markdown
Contributor

Summary

When gh skill update --dir was used on a namespaced skill layout ({dir}/{namespace}/{name}/SKILL.md), the install base was computed by walking up two filepath.Dir levels instead of one. This caused the updated skill to land at the wrong (shallower) path and the original directory to be deleted via os.RemoveAll.

Changes

  • Always use filepath.Dir(u.local.dir) as the install base so the update writes back into the exact directory where the skill was found - regardless of flat or namespaced layout.
  • Clean directory contents before re-installing to remove stale files from the previous version while preserving the directory itself (keeping symlinks, mounts, and external references intact).
  • Updated unit test to expect in-place behavior instead of relocation + deletion.
  • Added acceptance test (skills-update-inplace.txtar) that plants a namespaced skill, updates via --dir one level up, and verifies the skill stays in its original location.

Closes #13370

SamMorrowDrums and others added 2 commits May 13, 2026 23:22
When `gh skill update --dir` was used on a namespaced skill layout
({dir}/{namespace}/{name}/SKILL.md), the install base was computed by
walking up two filepath.Dir levels instead of one. This caused the
updated skill to land at the wrong (shallower) path and the original
directory to be deleted via os.RemoveAll.

Always use filepath.Dir(u.local.dir) as the install base so the update
writes back into the exact directory where the skill was found. Clean
the directory contents before re-installing to remove stale files from
the previous version while preserving the directory itself (keeping
symlinks, mounts, and external references intact).

Closes cli#13370

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
When gh skill update --dir was used on a namespaced skill layout
({dir}/{namespace}/{name}/SKILL.md), the install base was computed by
walking up two filepath.Dir levels instead of one. This caused the
updated skill to land at the wrong (shallower) path and the original
directory to be deleted via os.RemoveAll.

Always use filepath.Dir(u.local.dir) as the install base so the update
writes back into the exact directory where the skill was found. Clean
the directory contents before re-installing to remove stale files from
the previous version while preserving the directory itself (keeping
symlinks, mounts, and external references intact).

Closes cli#13370

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot added external pull request originating outside of the CLI core team needs-triage needs to be reviewed labels May 13, 2026
Removed issue reference from comment about updating namespaced skill.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external pull request originating outside of the CLI core team needs-triage needs to be reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gh skill update --dir relocates the skill and deletes the original install directory

1 participant