fix(install): symlink creation failing when a real directory already exists at destination#90
Merged
Merged
Conversation
… just symlinks When a real directory (e.g. left by a previous npx-based install) existed at the symlink destination, the old symlink-only check returned false and skipped removal, causing createSymbolicLink to fail with EEXIST. Using attributesOfItem (lstat-based) to detect any item at the path makes install idempotent regardless of what was there.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
Description
SkillSymLinkerandSymLinkerboth checked for an existing symlink at the destination path before creating a new one, but did not handle the case where a real directory or file existed there..claude/skills/<skill>was a real directory (e.g. left by a previousnpx skills addinstall or manual creation),createSymbolicLinkfailed withEEXIST.attributesOfItem(which islstat-based and detects any item — files, directories, and symlinks including dangling ones), making install fully idempotent regardless of what previously existed at the path.Type of Change
How Has This Been Tested?
Reproduce:
mkdir -p .claude/skills/swift-concurrency && luca install --spec Lucafile.yml --quiet— fails before the fix, succeeds after.Two regression tests added:
SkillSymLinkerTests.test_setSymLink_whenRealDirectoryExistsAtDestination_replacesWithSymlinkSymLinkerTests.createSymLink_whenRealFileExistsAtSymlinkPath_replacesWithSymlinkChecklist
CI Considerations
Breaking Changes?
Additional Notes
The same
symLinkExistspattern existed in bothSkillSymLinkerandSymLinker— both are fixed. The privatesymLinkExistshelper is removed from each since it is no longer needed.