Skip to content

BenIsLegit/tweakcc-fixed

 
 

Repository files navigation

tweakcc-fixed

A temporary fork of tweakcc that bundles together several pending upstream fixes, with a few additional fixes on top, so tweakcc works cleanly against recent Claude Code releases (through CC 2.1.113) while upstream catches up.

Note

This fork exists only to unblock users while the fixes below are reviewed and merged upstream. Once the relevant PRs land in Piebald-AI/tweakcc, switch back to upstream.

For full documentation of what tweakcc is and how to use it, see the upstream README.

Base

  • Upstream tweakcc version: 4.0.11
  • Based on upstream commit: 2e1d03ePrompts for 2.1.113 (#692)
  • Target Claude Code versions: up to and including 2.1.113
  • This package's version: starts at 1.0.x on first publish, with its own semver independent of upstream

Cherry-picked upstream PRs

All four PRs below are open (unmerged) upstream at the time of forking. Their fixes are required for tweakcc to function on current CC builds.

PR Author What it fixes
#601 @signadou Handle WASMagic import errors gracefully during native installation detection
#646 @sla-te Support the React Compiler output and async refactoring introduced in CC 2.1.85–2.1.88 (affects most patches)
#655 @LeonFedotov Fall back to npm source when Bun bytecode extraction produces non-patchable JS, and thread a clearBytecode flag through the content API so repack clears stale compiled code
#664 @mike1858 Resolves issue #660 — two patches broke cli.js due to literal \" sequences in prompt content

Additional fixes on top

These are not in any upstream PR and are unique to this fork.

  • bcce70a — Scope PR #664's backslash-doubling to quote contexts. PR #664's pre-processing ran before every delimiter branch — including backticks. In template-literal content, escapeDepthZeroBackticks is already parity-aware, so pre-doubling backslashes inside a template prematurely terminated the template and caused cli.js to fail to load with "Expected CommonJS module to have a function wrapper". This fix scopes the doubling to double-quoted and single-quoted strings only. Affects issue #660.

  • 207b57c — Align PR #664's backtick tests with the scoped-doubling fix. The two backtick-context tests encoded a literal-text interpretation of prompt content, which doesn't match tweakcc's storage format (markdown files hold the JS-source-escaped form extracted from cli.js template literals). Tests now assert the scoped behavior.

  • 3c08e0c — Adapt patch regexes to CC 2.1.113's minified shapes. Updates matchers in opusplan1m, patchesAppliedIndication, thinkerFormat, and verboseProperty so each patch still locates its target in the 2.1.113 build output.

  • c87898c — Don't overwrite verbose:X inside destructuring patterns. The verboseProperty patch was greedy enough to match { verbose: localName } in destructure targets and replace it with verbose: true, which is a syntax error. The fix scopes the replacement to property-value positions only.

  • dc84a6c — Preserve CC's theme background and default padding in the userMessageDisplay patch. Stock CC 2.1.79+ sets backgroundColor: "userMessageBackground" and paddingRight: 1 on the user-message Box; the replacement Box dropped both, stripping the theme-provided message background and the trailing column of bg that hugs the text. backgroundColor: "default" now re-emits the theme token, paddingX/paddingY accept 'default' (emitting paddingRight: 1 to match CC's native look), and the UI gains Default/Custom radios for each padding axis. Default settings flip to 'default' so ctrl+R and fresh installs match CC's out-of-box appearance.

  • 89555eb — Make ctrl+R honor the new default fg/bg modes. restoreToOriginal was hardcoding 'none'/'default' for the bg/fg modes, which stopped lining up after the default settings shifted in dc84a6c. The mode is now derived from DEFAULT_SETTINGS so restore actually matches what new installs get.

  • 3114c5b — Forward theme fg/bg tokens to the replacement Text so "default" colors survive wrapping. When fg/bg is 'default' the chalk chain emits no color codes, so the inner Text fell back to the terminal's default fg — and on narrow/wrapped user messages whole cells rendered without the theme color (matching the report that "default" bg/fg worked on slash commands but not regular messages). The patch now also forwards color: "text" and backgroundColor: "userMessageBackground" onto the replacement Text so the theme colors reach the cells chalk can't paint.

  • 1e28b59 — Match the shrunken past-tense thinking-verb array in recent CC builds. Apply-time failed with patch: thinkingVerbs: failed to find past tense verbs pattern. The past-tense regex required {50,} capitalised entries — which matched the pre-2.x ~170-entry list but not the 8-entry -ed cooking array CC now ships (observed across 2.1.70–2.1.113): ["Baked","Brewed","Churned","Cogitated","Cooked","Crunched","Sautéed","Worked"]. The fix anchors each entry on an ed suffix and drops the minimum to {6,}, which keeps us from colliding with the far-larger present-tense -ing array (handled by the earlier pass) or the user's substituted -ing verbs. 2.1.113 is a bun-compiled native binary that encodes "Sautéed" as the literal escape "Saut\xE9ed" rather than raw UTF-8; the existing character class already covers backslash/x/hex-digit/é, so both serialisation forms match without a code change — verified against all four cli.js shapes.

  • cc12f96 — Flatten the {head, hiddenLines, tail} text prop so long pastes in the user message display don't render as [object Object]. CC 2.1.79+ hoisted the long-message collapse from the inner EjK-style subcomponent into the caller via useMemo — when the original text exceeds ~10,000 chars (typical for pasted blocks) the text prop becomes {head:string, hiddenLines:number, tail:string} instead of a string. The patch captured that prop as messageVar and interpolated it with `${$}` in a template literal, which stringifies an object to "[object Object]" and wiped out the entire user message display for any long paste. The fix replaces the naive interpolation with a runtime ternary that detects the object variant and flattens it to head + "(N line[s] hidden)" + tail, mirroring CC's native collapse output; strings, null, and undefined all pass through unchanged. A small but important secondary fix: the emitted expression contains a $&& sequence, and String.prototype.replace treats $& in a string replacement as the matched substring, which would corrupt the output — using a function replacer bypasses $-substitution entirely.

  • c66f604 — Paint wrapped user-message lines with the configured bg. Reported: with custom User Message Display settings, a message long enough to wrap in the terminal had its highlight only on line 1 — line 2+ rendered against the terminal default bg. Two bugs collided: (1) boxAttrsObjStr was finalized right after the padding/border block, before the fg/bg block ran, so every boxAttrs.push('backgroundColor:...') was silently discarded (this also broke the default-theme bg added in 3114c5b, leaving the Box without its userMessageBackground token). (2) For a custom rgb(r,g,b) the patch only added .bgRgb() to the chalk chain — those ANSI bg escapes live inside the text content, and when Ink word-wraps the message the escape on line 1 doesn't reliably re-open on line 2. Fix: finalize boxAttrsObjStr after the bg block, and for custom bg also push backgroundColor:"rgb(r,g,b)" onto both Box and Text so Ink paints the full padded width across every wrapped line.

  • 9ef9328 — Rewrite the CC ≥2.1.79 userMessageDisplay path as attribute-preserving surgery (finally fixes wrapped-line bg). Even after c66f604, line 2+ of a wrapped message STILL rendered without the configured bg. Root cause was structural, not an ordering bug: the patch was replacing CC's entire outer Box+subcomponent tree with its own, dropping every layout attribute CC sets on that Box — most importantly flexDirection:"column". Without it, the Box defaults to row layout and no longer inherits full parent width from CC's row-flex message-list parent, so Ink only paints the Box bg to the content width of line 1. The redesign tries the modern pattern first (the legacy pattern's {text:VAR} alternative ALSO matched 2.1.79+ shapes, so the legacy path was silently handling new-CC cases), captures the Box attrs dict as a regex group, and only mutates what the user is customizing: custom rgb(r,g,b) replaces CC's bg ternary with a static literal; null strips the bg attr; 'default' leaves CC's ternary intact (so message-actions-mode switching still works); border/padding/alignSelf overrides append onto the CSV. The inner EjK call is replaced with createElement(Text, {color, backgroundColor, bold:!0, italic:!0, ...}, template) using Ink's native Text props instead of chalk ANSI — Ink's layout pass paints bg and re-opens style codes on every wrapped line, which chalk-in-string doesn't reliably do. The legacy (CC ≤2.1.21) path keeps its prior chalk-chain behavior since those versions never had the wrap bug. Object-variant flattening from cc12f96 moves into a shared helper with the tightened typeof x==="object"&&x!==null guard (handles ""/0 cleanly). Verified against CC 2.1.112's cli.js: the replacement preserves flexDirection:"column", marginTop:q?1:0, and paddingRight:w?0:1 verbatim; an end-to-end Ink render test confirms every wrapped line now has the bg ANSI re-opened at its start across padding spaces. Supersedes c66f604's Ink-level bg push on both Box and Text (now handled via the preserved/mutated attrs instead).

Installation

Published to npm as tweakcc-fixed. Run without installation:

npx tweakcc-fixed@latest              # interactive UI
npx tweakcc-fixed@latest --apply      # apply customizations from ~/.tweakcc/config.json

Tip

Always use @latest. This fork is actively iterating on fixes as new Claude Code versions ship and as more upstream fixes are cherry-picked. Without @latest, npx will reuse a cached copy from its last run and you may miss newly-published fixes. @latest forces a fresh resolve against the npm registry.

Or install globally (re-run to upgrade):

npm install -g tweakcc-fixed@latest
# or: pnpm add -g tweakcc-fixed@latest

tweakcc-fixed                  # interactive UI
tweakcc-fixed --apply          # apply customizations

Note

The binary is named tweakcc-fixed (not tweakcc) to avoid conflicting with an upstream tweakcc install. Everything else — flags, config format, API, patch list — is identical to upstream. See the upstream README for full documentation.

License

MIT, inherited from upstream. Copyright © 2026 Piebald LLC. This fork adds only the fixes described above; all core tweakcc code remains under the upstream copyright and license.

About

Customize Claude Code's system prompts, create custom toolsets, input pattern highlighters, themes/thinking verbs/spinners, customize input box & user message styling, support AGENTS.md, unlock private/unreleased features, and much more. Supports both native/npm installs on all platforms.

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors

No contributors

Languages

  • TypeScript 95.8%
  • JavaScript 3.9%
  • Python 0.3%