fix: use directory junctions on Windows for skill linking#24823
Conversation
On Windows, `fs.symlink()` with type `'dir'` requires elevated privileges or Developer Mode, causing EPERM errors for standard users. Switch to `'junction'` type on Windows which works without special permissions while maintaining symlink behavior on macOS/Linux. Also enables 3 previously skipped Windows tests in skillUtils.test.ts that now pass with this fix. Fixes google-gemini#24816
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a critical issue where skill linking failed on Windows due to permission restrictions when creating directory symlinks. By switching to directory junctions on Windows, the CLI can now perform these operations without requiring administrative access or special system configurations, while maintaining the expected behavior for directory access. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request enables skill linking and uninstallation functionality on Windows by utilizing directory junctions instead of symbolic links. This change, which addresses issue #24816, allows the CLI to create links without requiring elevated privileges or Developer Mode. Consequently, the tests in skillUtils.test.ts have been updated to run on all platforms, and the platform-specific itif helper has been removed. I have no feedback to provide as there were no review comments.
scidomino
left a comment
There was a problem hiding this comment.
Normally I don't even look at external PRs that aren't for help-wanted issues but I'll make an exception for a one liner like this.
Summary
Fixes #24816 — Skill linking fails on Windows with
EPERM: operation not permittedbecausefs.symlink()with type'dir'requires elevated privileges or Developer Mode.Root cause: On Windows, creating directory symlinks requires either Administrator privileges or Developer Mode to be enabled. Standard users get
EPERMwhen callingfs.symlink(src, dest, 'dir').Fix: Use
'junction'type instead of'dir'on Windows. Directory junctions:trueforlstat().isSymbolicLink()Changes
packages/cli/src/utils/skillUtils.ts: Use'junction'type on Windows inlinkSkill()packages/cli/src/utils/skillUtils.test.ts: Enable 3 previously skipped Windows tests (removeditifguards and unuseditifvariable), fix test symlink call to use junction on WindowsTest plan
skillUtils.test.tstests pass (including 3 previously skipped on Windows)