fix(skill): prevent re-install from wiping skills when source equals destination#5
Merged
Merged
Conversation
…destination When a skill's discovered source path is the same as (or overlaps) the install destination (e.g. authoring skills directly in .agents/skills), the installer cleaned the destination before copying, deleting the source and leaving an empty/stale SKILL.md. Route all copy paths through a syncDirectory helper that no-ops when source and destination resolve to the same path and stages overlapping sources before cleaning. Add a regression test.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
skill addcould leaveSKILL.mdempty/stale because.agents/skills(the canonical install destination) is also a skill-discovery path. Discovery would select the already-installed copy as the source, then the installerrm'd the destination before copying — deleting the source and copying an empty dir.syncDirectoryhelper that no-ops when source and destination resolve to the same path, and stages overlapping sources to a temp dir before cleaning. RoutedinstallByCopy,installBySymlink, and the symlink→copy fallback through it.Test plan
preserves content when the source path is the canonical destinationSKILL.mdpnpm build && pnpm typecheck && pnpm lint && pnpm testall green (371 passing)