Fix /cd failing on Windows when target directory contains '.'#324
Merged
mpfaffenberger merged 1 commit intompfaffenberger:mainfrom May 7, 2026
Merged
Conversation
mpfaffenberger
approved these changes
May 7, 2026
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.
Summary
Users reported that
/cdcan fail on Windows when the target directory contains a dot (for example:repo.v2).This PR fixes that behavior.
User-facing issue
On Windows, commands like the following could fail with
Not a directoryeven when the directory exists:/cd C:\Users\alice\repo.v2/cd "C:\Users\alice\repo.v2"Root cause
handle_cd_command()used POSIX-styleshlex.split()for all platforms.On Windows, that parsing can corrupt native backslash paths, causing directory checks to fail.
Dotted folder names were a common real-world case where this surfaced.
What changed
code_puppy/command_line/core_commands.pyshlexparsing on Windows (os.name == "nt") to preserve Windows path semantics.split(maxsplit=1).tests/command_line/test_core_commands_extended.pyAdded regression tests for Windows
/cdwith dotted directory names:C:\...\repo.v2)"C:\...\repo.v2")Validation
uv run pytest -q tests/command_line/test_core_commands_extended.py -k "cd_windows or cd_with_special_characters or cd_with_relative_path or cd_with_tilde_expansion"uv run pytest -q tests/test_command_handler.py -k "test_cd_"Risk
Low. Change is scoped to
/cdparsing with focused regression coverage.