Fix#664
Open
mike1858 wants to merge 1 commit into
Open
Conversation
BenIsLegit
pushed a commit
to BenIsLegit/tweakcc-fixed
that referenced
this pull request
Apr 18, 2026
…contexts PR Piebald-AI#664's backslash-doubler runs before every delimiter branch, including backticks. For template-literal content, escapeDepthZeroBackticks is already parity-aware for backticks, so pre-doubling turns `\`find\`` into `\` + closing backtick + `find`, terminating the template early and breaking cli.js parsing with "Expected CommonJS module to have a function wrapper" on load. Limit doubling to " and ' contexts. Affects Piebald-AI#660.
BenIsLegit
pushed a commit
to BenIsLegit/tweakcc-fixed
that referenced
this pull request
Apr 18, 2026
…doubling fix The two backtick-context tests from PR Piebald-AI#664 encoded the 'literal text' interpretation of prompt content, which doesn't match tweakcc's data format (markdown files store JS-source-escaped form, extracted from cli.js template literals). The scoped-doubling fix in a3c2f84 preserves already-escaped backticks; update assertions to match.
BenIsLegit
pushed a commit
to BenIsLegit/tweakcc-fixed
that referenced
this pull request
Apr 18, 2026
…contexts PR Piebald-AI#664's backslash-doubler runs before every delimiter branch, including backticks. For template-literal content, escapeDepthZeroBackticks is already parity-aware for backticks, so pre-doubling turns `\`find\`` into `\` + closing backtick + `find`, terminating the template early and breaking cli.js parsing with "Expected CommonJS module to have a function wrapper" on load. Limit doubling to " and ' contexts. Affects Piebald-AI#660.
BenIsLegit
pushed a commit
to BenIsLegit/tweakcc-fixed
that referenced
this pull request
Apr 18, 2026
…doubling fix The two backtick-context tests from PR Piebald-AI#664 encoded the 'literal text' interpretation of prompt content, which doesn't match tweakcc's data format (markdown files store JS-source-escaped form, extracted from cli.js template literals). The scoped-doubling fix in a3c2f84 preserves already-escaped backticks; update assertions to match.
BenIsLegit
pushed a commit
to BenIsLegit/tweakcc-fixed
that referenced
this pull request
Apr 18, 2026
Document that this is a temporary tweakcc fork while upstream catches up. Lists the base version (4.0.11 at upstream 2e1d03e / 2.1.113), the four cherry-picked open upstream PRs (Piebald-AI#601, Piebald-AI#646, Piebald-AI#655, Piebald-AI#664) with credits, and the four fork-specific fixes added on top (scoped backslash-doubling, backtick test realignment, 2.1.113 regex updates, verbose-destructure guard). Points readers at the upstream README for full docs.
BenIsLegit
pushed a commit
to BenIsLegit/tweakcc-fixed
that referenced
this pull request
Apr 18, 2026
The fix list mentioned "PR Piebald-AI#664" three times in prose without linking, and the fork commit hashes were plain inline code. Hyperlink each "PR Piebald-AI#664" to the upstream PR and each fork commit hash to its GitHub page so readers can click through to the full diff. Also add a cross- link from bcce70a to the originating issue Piebald-AI#660.
nathaniel-yuri
added a commit
to nathaniel-yuri/tweakcc-fixed
that referenced
this pull request
Jun 2, 2026
…d-AI#660 × Piebald-AI#163 interaction) PR Piebald-AI#163 added escapeNonAsciiChars inside applyIdentifierMapping; the helper emits a single-backslash \uXXXX form (e.g. \u2014 for em-dash) so cli.js gets a valid Unicode escape JS will evaluate as the codepoint. PR Piebald-AI#664 (for Piebald-AI#660) added a post-pass at the apply step that doubles EVERY backslash in the replacement when the surrounding delimiter is " or '. The doubler runs AFTER applyIdentifierMapping, so the \ that escapeNonAsciiChars just emitted gets doubled to \\, and cli.js ends up with \\u2014 — JS then evaluates that as the literal 6-char string \u2014, not the em-dash codepoint. User-visible effect: every non-ASCII character in customized prompts injected into "..." or '...' slots renders as its raw escape source at runtime. Fix: move the non-ASCII escape from applyIdentifierMapping (pre-doubling) into patches/systemPrompts.ts AFTER the backslash-doubling block, gated on the same shouldEscapeNonAscii detection. The doubler now sees raw non-ASCII bytes (which contain no backslashes to double); then the escape emits the single-backslash form on a clean slate. Behavior preserved for backslashes the user actually wrote in markdown (e.g. \"user\" — still doubled, intent of Piebald-AI#660 preserved) and for the backtick branch (no doubling either before or after the fix — the in-applyIdentifierMapping escape used to run for backticks too, so the new caller-side escape preserves that). - src/systemPromptSync.ts: drop escapeNonAscii from applyIdentifierMapping + loadSystemPromptsWithRegex signatures; export escapeNonAsciiChars so the caller can run it. - src/patches/systemPrompts.ts: import escapeNonAsciiChars; drop the middle arg from the loadSystemPromptsWithRegex call; add the escape step right after the backslash-doubling block. - src/patches/systemPrompts.test.ts: 3 new vitest cases — em-dash + ", middle-dot + ', em-dash + ` — locking in the single-backslash output shape per delimiter and the new ordering invariant. - src/tests/systemPromptSync.test.ts: drop the obsolete middle 'false' arg from the only test caller that passed it positionally.
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.
No description provided.