tweakcc-fixed 1.0.2 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # tweakcc-fixed
2
2
 
3
- A **temporary fork of [tweakcc](https://github.com/Piebald-AI/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.
3
+ A **temporary fork of [tweakcc](https://github.com/Piebald-AI/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.128**) while upstream catches up.
4
4
 
5
5
  > [!NOTE]
6
6
  > 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](https://github.com/Piebald-AI/tweakcc), switch back to upstream.
@@ -11,7 +11,7 @@ For full documentation of what tweakcc is and how to use it, see the [**upstream
11
11
 
12
12
  - **Upstream tweakcc version:** `4.0.11`
13
13
  - **Based on upstream commit:** [`2e1d03e`](https://github.com/Piebald-AI/tweakcc/commit/2e1d03e) — _Prompts for 2.1.113_ ([#692](https://github.com/Piebald-AI/tweakcc/pull/692))
14
- - **Target Claude Code versions:** up to and including **2.1.113**
14
+ - **Target Claude Code versions:** up to and including **2.1.128**
15
15
  - **This package's version:** starts at `1.0.x` on first publish, with its own semver independent of upstream
16
16
 
17
17
  ## Cherry-picked upstream PRs
@@ -50,6 +50,21 @@ These are not in any upstream PR and are unique to this fork.
50
50
  - **[`3114c5b`](https://github.com/BenIsLegit/tweakcc-fixed/commit/3114c5b) — Forward theme fg/bg tokens to the replacement `Text` so "default" colors survive wrapping.**
51
51
  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.
52
52
 
53
+ - **[`1e28b59`](https://github.com/BenIsLegit/tweakcc-fixed/commit/1e28b59) — Match the shrunken past-tense thinking-verb array in recent CC builds.**
54
+ 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.
55
+
56
+ - **[`cc12f96`](https://github.com/BenIsLegit/tweakcc-fixed/commit/cc12f96) — Flatten the `{head, hiddenLines, tail}` text prop so long pastes in the user message display don't render as `[object Object]`.**
57
+ 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.
58
+
59
+ - **[`c66f604`](https://github.com/BenIsLegit/tweakcc-fixed/commit/c66f604) — Paint wrapped user-message lines with the configured bg.**
60
+ 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.
61
+
62
+ - **[`9ef9328`](https://github.com/BenIsLegit/tweakcc-fixed/commit/9ef9328) — Rewrite the CC ≥2.1.79 `userMessageDisplay` path as attribute-preserving surgery (finally fixes wrapped-line bg).**
63
+ 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).
64
+
65
+ - **[`f64268a`](https://github.com/BenIsLegit/tweakcc-fixed/commit/f64268a) — Restore four broken patches on CC 2.1.128 (Patches applied indication, Thinker format, Session memory, User message display).**
66
+ Four patches stopped applying on CC 2.1.128. Root causes were two helper-function regressions plus two pattern-shape changes — the bundle prologue, Box component, spinner signature, and session-memory feature all shifted in 2.1.128's build. **`getModuleLoaderFunction`** only matched the old ternary `H=H!=null?…:…` form; 2.1.128 emits `var K=H!=null&&typeof H==="object"` instead, so the regex now accepts an optional `var |let ` prefix and either `?` or `&&` after `!=null`, and the prologue slice grew 2000→5000 chars. **`findBoxComponent`** gains a Method 5 matching the new exhaustive destructured signature (`children`/`ref`/`tabIndex`/`autoFocus` together) — the older memo, displayName, and ink-box-localvar shapes are gone. Both helpers gate `patchesAppliedIndication` and `userMessageDisplay`, so fixing them unblocks both. **`thinkerFormat`'s** `approxAreaPatternNew` now allows any number of intervening `key:val,` pairs between `overrideMessage:` and `spinnerSuffix:` (2.1.128 inserted `isCompacting` and `compactingHintText` between them, breaking the 2.1.113-era adjacency anchor). **`sessionMemory`** is rewritten as graceful degradation because 2.1.128 dropped the `tengu_session_memory` flag, the `# Session Title` config block (per-section/total token limits), and the `minimumMessageTokensToInit`/`minimumTokensBetweenUpdate`/`toolCallsBetweenUpdates` knobs entirely — only `tengu_coral_fern` (past-session search) remains. Each sub-patch now no-ops on missing patterns instead of failing the whole combined patch, so the patch reports green on 2.1.128 with just the past-sessions bypass active. Three now-graceful skip messages downgraded console.error→console.log with a clear "(skipping; expected on CC ≥2.1.128)" note. Also downgrades `patchesAppliedIndication`'s "header component function not found" log similarly — that's been a graceful PATCH 3 skip on every CC ≥2.1.86 release, not an error. Verified end-to-end: 228/228 unit tests pass; `--apply` against the real 2.1.128 native binary reports ✓ for all four previously-failing patches; the patched cli.js was inspected directly and contains all expected insertions (`\n4.0.11 (tweakcc)` after both `(Claude Code)` version-output occurrences, the `+ tweakcc v4.0.11` strings in all three banner contexts, and the React-compiler `_tw=` createElement variable).
67
+
53
68
  ## Installation
54
69
 
55
70
  Published to npm as [`tweakcc-fixed`](https://www.npmjs.com/package/tweakcc-fixed). Run without installation: