Support quoted image paths and preserve prompt in CLI image command - #1206
Open
nordicnode wants to merge 1 commit into
Open
Support quoted image paths and preserve prompt in CLI image command#1206nordicnode wants to merge 1 commit into
nordicnode wants to merge 1 commit into
Conversation
Contributor
|
Good find and a clean fix. The old The extraction into A few things worth double-checking before this lands:
Small, in-scope, correctly tested — this looks portable as-is. |
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.
Support quoted image paths and preserve prompt in CLI image command
Summary
• Fixes
/image <path> [message]command parsing in the CLI to properly handle quoted paths ("..."and'...') and backslash-escaped spaces (\).• Previously,
args.trim().split(/\s+/)broke paths with spaces (common for screenshots on macOS/Windows) into separate tokens, corrupting the image filename (e.g."/path/to/mycausing a file-not-found error) and leaking the remainder into the message.• Extracts
parseImageCommandArgsinto a standalone, pure utility (cli/src/commands/parse-image-args.ts) that correctly isolates the image path from the accompanying message.• In
cli/src/commands/command-registry.ts, preserves any returned prompt message inparams.setInputValueso the user's instructions are retained in the input field alongside the attached image rather than being wiped byclearInput(params).• Replaces the duplicated test parser in
cli/src/commands/__tests__/image.test.tswith the real utility and adds unit test cases for quoted paths with spaces, escaped spaces, and quote edge cases.Test plan
[✓]
bun test --config=/dev/null src/commands/__tests__/image.test.ts— 16 pass, 0 fail (added tests for double/single quoted paths with spaces, escaped spaces, and prompt retention)[✓]
bun run --cwd cli typecheck— 0 errors[✓] PR hygiene checks pass cleanly