fix(parser): preserve JSON escapes in quoted args#16
fix(parser): preserve JSON escapes in quoted args#16dannylin108 wants to merge 2 commits intoopenclaw:mainfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bb665341b9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (ch === quote) { | ||
| quote = null; | ||
| continue; |
There was a problem hiding this comment.
Preserve escaped apostrophes in single-quoted args
The new single-quote branch closes on every ' character, so inputs that rely on \' now break with Unclosed quote instead of producing a literal apostrophe. For example, --args-json '{"prompt":"don\'t"}' (a common pattern when wrapping JSON in single quotes) parsed before this change but now fails, which can break prompt/JSON payloads containing apostrophes in existing pipelines.
Useful? React with 👍 / 👎.
e2f905a to
efc6895
Compare
Summary
tokenizeCommandso quoted parsing does not strip arbitrary backslashes\\n/\\tin double-quoted tokens--args-jsonhandlingWhy
--args-jsonpayloads (especially prompt-rich JSON) could be corrupted during tokenization because backslashes were always consumed in quoted mode. This broke valid JSON before command handlers parsed it.Validation
pnpm buildnode --test dist/test/parser.test.jsfix #17