fix(install): recognise junctions at skill-link paths#82
Merged
Conversation
A junction (mklink /J) at ~/.claude/skills/<name> reports is_symlink() == False, so the installer fell into the real-directory branch and called shutil.rmtree, which refuses links outright — crashing install_hooks before the JSON writes. Junctions are the natural workaround for the installer's own "enable Developer Mode" warning (they need no privilege), so the crash hits exactly the users the symlink fallback was written for. Treat junctions like symlinks: skip when already pointing at the source, otherwise remove the link itself (unlink, with os.rmdir fallback for dir junctions) and never its target. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
🟢 Claude BugBot Analysis
No bugs found in the changes. The fix correctly guards junction handling with os.path.isjunction (safe given the project's Python >=3.12 requirement and the function's cross-platform no-op behavior), and the fallback os.rmdir on unlink failure only removes the reparse point, not target contents.
No bugs were detected in this PR.
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
Deploying #81 crashed
install_hookson this machine: a junction (mklink /J) at~/.claude/skills/better-memory-synthesizereportsis_symlink() == False, so the installer fell into the real-directory branch and calledshutil.rmtree, which refuses links ("Cannot call rmtree on a symbolic link"). The crash lands before the settings.json / .claude.json writes — a total install failure.Junctions need no Developer Mode, making them the natural manual workaround for the installer's own symlink-privilege WARN — i.e. the crash targets exactly the locked-down-Windows users the fallback exists for.
Fix
is_symlink() or os.path.isjunction(...).unlink(),os.rmdirfallback for dir junctions — never the target's contents.Tests
mklink /J, runs the installer, asserts exit 0 + both configs written + junction untouched (skips where junctions can't be created).tests/cli/test_install_hooks.py+tests/e2e/test_setup_sh.py: 44 passed.🤖 Generated with Claude Code