Repository navigation
fix(prompts): treat symlinks to directories as directories in path - #659
Open
Abmichael01 wants to merge 1 commit into
Open
Abmichael01 wants to merge 1 commit into
Abmichael01 wants to merge 1 commit into
Conversation
`path` checked entries with lstat, which describes the link itself, so a symlink to a directory counted as a file. With `directory: true` it was never suggested and could not be submitted, even when its exact path was typed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0147uBPeX9ixTKJddVsvFtix
🦋 Changeset detectedLatest commit: 950b94f The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Member
|
hey @Abmichael01 before creating a pr, it is recommended opening an issue for previous discussion. so this will be on hold before we get a chance to talk about it. thanks in advance! 😄 |
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.
What does this PR do?
pathchecks entries withlstatSync, which describes the link itself, so a symlink to a directory counts as a file. Withdirectory: truethat means:On macOS this should include
/tmp, which is a symlink to/private/tmp(I tested on Linux).To reproduce with 1.9.0:
mkdir real && ln -s real linkThe prompt now uses
statSync, which follows links.statSyncthrows for broken and circular links, and one of those would have emptied the whole list, so they are caught and still count as files, as before.One behavior change without
directory: whenrootorinitialValueis a symlinked directory, the prompt now lists its contents, as it already does for a normal directory. Before, it suggested the link itself.I searched for an existing issue and did not find one. The fix is small, so I included the reproduction here instead of opening one, but I can open an issue if you prefer.
Type of change
Checklist
pnpm testpasses (or targeted tests for my change)pnpm formathas been runI ran the
coreandpromptstest suites, the type check, and Biome on the changed files. I did not runpnpm buildlocally. Circular links are not in the unit tests becausememfshangs on them; I checked that case on a real file system.AI-generated code disclosure
🤖 Generated with Claude Code
https://claude.ai/code/session_0147uBPeX9ixTKJddVsvFtix