Skip to content

fix: use directory junctions on Windows for skill linking#24823

Merged
scidomino merged 1 commit into
google-gemini:mainfrom
enjoykumawat:fix/windows-symlink-junction
Apr 7, 2026
Merged

fix: use directory junctions on Windows for skill linking#24823
scidomino merged 1 commit into
google-gemini:mainfrom
enjoykumawat:fix/windows-symlink-junction

Conversation

@enjoykumawat

Copy link
Copy Markdown
Contributor

Summary

Fixes #24816 — Skill linking fails on Windows with EPERM: operation not permitted because fs.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 EPERM when calling fs.symlink(src, dest, 'dir').

Fix: Use 'junction' type instead of 'dir' on Windows. Directory junctions:

  • Work without elevated privileges or Developer Mode
  • Behave like symlinks for directory access
  • Are a standard Windows NTFS feature
  • Return true for lstat().isSymbolicLink()

Changes

  • packages/cli/src/utils/skillUtils.ts: Use 'junction' type on Windows in linkSkill()
  • packages/cli/src/utils/skillUtils.test.ts: Enable 3 previously skipped Windows tests (removed itif guards and unused itif variable), fix test symlink call to use junction on Windows

Test plan

  • All 11 skillUtils.test.ts tests pass (including 3 previously skipped on Windows)
  • ESLint + Prettier pass via pre-commit hooks
  • Verified on Windows 11 — junctions created successfully without admin privileges

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
@enjoykumawat enjoykumawat requested a review from a team as a code owner April 7, 2026 10:58
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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

  • Windows Compatibility: Updated skill linking to use directory junctions on Windows, resolving EPERM errors that previously required elevated privileges or Developer Mode.
  • Test Suite Improvements: Enabled previously skipped Windows tests in the skill utility suite and updated them to use the new junction-based linking approach.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@gemini-cli gemini-cli Bot added the area/core Issues related to User Interface, OS Support, Core Functionality label Apr 7, 2026

@scidomino scidomino left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@scidomino scidomino enabled auto-merge April 7, 2026 18:59
@scidomino scidomino added this pull request to the merge queue Apr 7, 2026
Merged via the queue into google-gemini:main with commit ab3075f Apr 7, 2026
30 checks passed
warrenzhu25 pushed a commit to warrenzhu25/gemini-cli that referenced this pull request Apr 9, 2026
@sripasg sripasg added the size/m A medium sized PR label Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/core Issues related to User Interface, OS Support, Core Functionality size/m A medium sized PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Permission error with skills linking on Windows 10

3 participants