Skip to content

fix(install): symlink creation failing when a real directory already exists at destination#90

Merged
albertodebortoli merged 1 commit into
mainfrom
fix/failed-symlink-creation
Jun 9, 2026
Merged

fix(install): symlink creation failing when a real directory already exists at destination#90
albertodebortoli merged 1 commit into
mainfrom
fix/failed-symlink-creation

Conversation

@albertodebortoli

@albertodebortoli albertodebortoli commented Jun 9, 2026

Copy link
Copy Markdown
Member

Description

  • SkillSymLinker and SymLinker both 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.
  • When .claude/skills/<skill> was a real directory (e.g. left by a previous npx skills add install or manual creation), createSymbolicLink failed with EEXIST.
  • Fix replaces the symlink-only check with attributesOfItem (which is lstat-based and detects any item — files, directories, and symlinks including dangling ones), making install fully idempotent regardless of what previously existed at the path.
  • Closes #

Type of Change

  • Feature
  • Bug fix
  • Maintenance / Refactor
  • Documentation
  • CI / Tooling
  • Other (specify)

How Has This Been Tested?

  • Added / updated unit tests
  • Manually tested locally (describe)
  • Tested on macOS (arch: arm64 / x86_64)
  • Other

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_replacesWithSymlink
  • SymLinkerTests.createSymLink_whenRealFileExistsAtSymlinkPath_replacesWithSymlink

Checklist

  • Swift code builds locally (swift build)
  • Tests pass locally (swift test)
  • Code style / formatting respected
  • Documentation updated (README / comments)
  • Version / tag alignment considered (if release related)
  • PR title follows conventional style (optional)

CI Considerations

  • Affects build time notably
  • Requires new secrets / env vars
  • Alters release process

Breaking Changes?

  • No
  • Yes (describe impact and migration path)

Additional Notes

The same symLinkExists pattern existed in both SkillSymLinker and SymLinker — both are fixed. The private symLinkExists helper is removed from each since it is no longer needed.

… 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.
@albertodebortoli albertodebortoli added this to the 0.20.0 milestone Jun 9, 2026
@albertodebortoli albertodebortoli added feature New feature or enhancement bugfix Something isn't working and removed feature New feature or enhancement labels Jun 9, 2026
@codecov

codecov Bot commented Jun 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@albertodebortoli albertodebortoli marked this pull request as ready for review June 9, 2026 11:03
@albertodebortoli albertodebortoli changed the title Fix symlink creation failing when a real directory already exists at destination fix(install): symlink creation failing when a real directory already exists at destination Jun 9, 2026
@albertodebortoli albertodebortoli merged commit 36109db into main Jun 9, 2026
3 checks passed
@albertodebortoli albertodebortoli deleted the fix/failed-symlink-creation branch June 9, 2026 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant