Conversation
Now it works with every CC version from 0.2.9 to 2.1.23.
📝 WalkthroughWalkthroughThe PR refactors user message display patching from multi-parameter function signatures to a unified config-driven architecture. The Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/patches/userMessageDisplay.ts`:
- Around line 234-238: The code builds formattedMessage and chalkFormattedString
by injecting config.format directly into a template literal, which breaks if
config.format contains backticks or `${`; fix this by pre-escaping those
sequences before composing formattedMessage — e.g., create an escapedFormat from
config.format where backticks are replaced with \` and the sequence `${` is
replaced with `\${`, then use escapedFormat in the existing formattedMessage
(`formattedMessage` and `chalkFormattedString`) so the patched JS remains valid;
update the code paths that reference config.format (the formattedMessage
construction and chalkFormattedString) to use the escapedFormat variable
instead.
🧹 Nitpick comments (1)
src/patches/helpers.ts (1)
293-310: Tighten ink-box regex to avoid false positives in minified bundles.Line 293-296 uses wide
.{0,2000}/.{0,200}spans, which can over-match in minified code and select the wrong component. Consider constraining the match to the current function body to keep it strict and deterministic.♻️ Proposed tightening (stay within function body)
- const inkBoxPattern = - /function ([$\w]+)\(.{0,2000}\b([$\w]+)=[$\w]+(?:\.default)?\.createElement\("ink-box".{0,200}?return \2/; + const inkBoxPattern = + /function ([$\w]+)\([^)]*\)\{[^}]{0,2000}\b([$\w]+)=[$\w]+(?:\.default)?\.createElement\("ink-box"[^}]{0,200}?return \2/;Based on learnings: “In patches under src/patches/, assume code works with minified, original Claude Code installations. Patch regexes must be strict and match the minified format exactly (ignore formatting differences like whitespace/newlines).”
Now it works with every CC version from 0.2.9 to 2.1.23.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.