fix: handle symlinks in dev mode linking#390
Merged
technophile-04 merged 1 commit intomainfrom Feb 9, 2026
Merged
Conversation
The linkRecursive function now properly handles symbolic links by recreating them at the destination instead of attempting to hard link them, which caused EPERM errors on macOS. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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:
After #386, if you try to run the extension in dev mode it was failing with the below error:
Error
Why this happend?
Templates contain symlinks - The .claude/skills/ directory has symlinks pointing to
../../.agents/skills/:defi-protocol-templates ->
../../.agents/skills/defi-protocol-templatessolidity-security ->
../../.agents/skills/solidity-securitylstatSyncdoesn't follow symlinks - The original code usedlstatSync(source).isDirectory()to check if a path is a directory. UnlikestatSync,lstatSyncreturns info about the symlink itself, not its target. So a symlink pointing to adirectory returns false for
isDirectory().Hard links don't work for symlinks to directories - When the symlink wasn't detected as a
directory, the code fell through to
link(source, destination)which creates a hard link. OnmacOS (and most Unix systems), you cannot create hard links for symlinks that point to
directories - this fails with EPERM.
The Fix
Check if the source is a symlink first using
stat.isSymbolicLink(), and if so, read the link target with readlinkSync and recreate the symlink at the destination usingsymlink()