Repository navigation
fix(prompts): handle trailing backslash in path prompt directory mode - #627
Merged
43081j merged 2 commits intoOct 28, 2026
Merged
Conversation
On Windows the native separator is `\`, but the directory-mode check only looked for a trailing `/`. Typing `C:\project\` with `directory: true` listed the siblings of `C:\project` filtered by `C:\project\`, so the prompt showed no matches and Enter could not submit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: abe678d 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 |
Contributor
Author
43081j
reviewed
Oct 27, 2026
Per review: treat a trailing "/" or "\" as a separator regardless of platform, and move the Windows cases into path.test.ts behind skipIf. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
43081j
approved these changes
Oct 28, 2026
commit: |
Open
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?
On Windows, the
pathprompt withdirectory: truecan't descend into a directory with the native separator. TypingC:\project\shows "No matches found", and Enter just reports "Please select a path". The same happens wheninitialValueends in\.The directory-mode check only looked for a trailing
/, so a trailing\fell through todirname(). The prompt then listed the siblings ofC:\project, filtered byC:\project\, which matched nothing. This PR treats a trailingpath.septhe same as/. On POSIX nothing changes, sincesepis/.There's no issue for this; I found it while running the path prompt tests on Windows 11, and the fix is small enough to discuss here.
The new test mocks
node:pathwithpath.win32and mapsC:\…paths onto memfs, so it also runs on Linux CI. It fails onmain(both cases return the cancel symbol) and passes with this change.Typing
/on Windows still doesn't match, becausejoin()rewrites the suggestions to\. I left that for a separate change.Type of change
Checklist
pnpm testpasses (or targeted tests for my change)pnpm formathas been runAI-generated code disclosure
I used Claude Code to write this change.