tweakcc-fixed 2.0.9 → 2.0.11

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
@@ -3,13 +3,13 @@
3
3
  A hard fork of [Piebald-AI/tweakcc](https://github.com/Piebald-AI/tweakcc) that patches an installed Claude Code in place — both npm `cli.js` and the JavaScript embedded in a native Bun binary — to apply **curated system-prompt overrides** and a set of **fork-only patches**. It is purpose-built to pair with [skrabe/lobotomized-claude-code](https://github.com/skrabe/lobotomized-claude-code), and it stays current with every Claude Code release through its own prompt-extraction pipeline.
4
4
 
5
5
  > [!IMPORTANT]
6
- > **This fork is a superset of upstream and no longer merges from it (2026-06-04).** Upstream's `tweakcc` gates system-prompt overrides **off** for native installs and doesn't have this fork's override mechanisms (inline-blob, system-reminders) or extended extractor; we add those and apply system prompts to native installs too. Upstream is essentially static — recent releases are version bumps plus prompt-data drops we supersede (our extractor names 990 prompts for CC 2.1.179 under our own per-model override conventions (capturing every model-facing string below the old 500-char floor), including 546 ids absent from Piebald's published extract) — so there's nothing to gain by merging. We keep the `upstream` remote only as a **fetch-only comparison signal** and extract our own prompts.
6
+ > **This fork is a superset of upstream and no longer merges from it (2026-06-04).** Upstream's `tweakcc` gates system-prompt overrides **off** for native installs and doesn't have this fork's override mechanisms (inline-blob, system-reminders) or extended extractor; we add those and apply system prompts to native installs too. Upstream is essentially static — recent releases are version bumps plus prompt-data drops we supersede (our extractor names 1018 prompts for CC 2.1.185 under our own per-model override conventions (capturing every model-facing string below the old 500-char floor), including 565 ids absent from Piebald's published extract) — so there's nothing to gain by merging. We keep the `upstream` remote only as a **fetch-only comparison signal** and extract our own prompts.
7
7
 
8
8
  | | |
9
9
  | ---------------------- | --------------------------------------------------------------------------------------------------------- |
10
10
  | **This fork** | [skrabe/tweakcc-fixed](https://github.com/skrabe/tweakcc-fixed) |
11
11
  | **Base** | [Piebald-AI/tweakcc](https://github.com/Piebald-AI/tweakcc) @ `bc41a43`, then diverged |
12
- | **Target CC versions** | 2.0.98 through **2.1.181** |
12
+ | **Target CC versions** | 2.0.98 through **2.1.185** |
13
13
  | **Install** | `npx tweakcc-fixed@latest` — published on npm from this repo ([Install](#install)) |
14
14
  | **Pairs with** | [skrabe/lobotomized-claude-code](https://github.com/skrabe/lobotomized-claude-code) (per-model overrides) |
15
15
  | **Agent guide** | [`AGENTS.md`](./AGENTS.md) — bug-class diagnostics, patch authoring, the version-bump pipeline |
@@ -26,7 +26,7 @@ A directory `~/.tweakcc/system-reminders/` with one `.md` file per editable dyna
26
26
  - **Custom body** → pristine content replaced.
27
27
  - **`{{placeholder}}` tokens** → whitelisted JS expressions substituted at apply time.
28
28
 
29
- Files are seeded automatically on first `--apply`. The registry (~30 entries) covers the claudeMd context wrapper, the anti-thinking nudge, MCP per-server overrides, token/budget telemetry, plan-mode reminders, hook/tool-call wrappers, the task-list reminder, the ultrathink booster, the user-sent-new-message wrap, the stop-hook session-goal, and more. UI: `tweakcc` → **System reminders (injection lobotomy)**.
29
+ Files are seeded automatically on first `--apply`. The registry (35 entries) covers the claudeMd context wrapper, the anti-thinking nudge, MCP per-server overrides, token/budget telemetry, plan-mode reminders, hook/tool-call wrappers, the task-list reminder, the ultrathink booster, the user-sent-new-message wrap, the stop-hook session-goal, and more. UI: `tweakcc` → **System reminders (injection lobotomy)**.
30
30
 
31
31
  ### MCP per-server instruction routing
32
32
 
@@ -69,11 +69,11 @@ Fork-only patch work: scoping #664's backslash-doubling to quote contexts only (
69
69
 
70
70
  These come from the tweakcc base and work unchanged in this fork: system-prompt customization, custom themes, thinking-verb and spinner customization, toolsets (`/toolset`), input-pattern highlighters, `opusplan[1m]`, MCP startup optimization, table-format options, token-count rounding, statusline throttling, `AGENTS.md`/`CLAUDE.md` alternate names, session naming (`/title`, `/rename`), subagent model selection, and the `unpack` / `repack` CLI commands.
71
71
 
72
- For detailed docs on these shared features, see the [upstream tweakcc README](https://github.com/Piebald-AI/tweakcc#readme) — with the caveat that upstream is now v4 and has diverged, so its API / `adhoc-patch` / remote-config sections and native-install behavior describe upstream's build, not this fork.
72
+ For detailed docs on these shared features, see the [upstream tweakcc README](https://github.com/Piebald-AI/tweakcc#readme) — with the caveat that upstream is now v4 and has diverged, so its `adhoc-patch` / remote-config sections and native-install behavior describe upstream's build, not this fork. For this fork's programmatic surface, see [Library API](#library-api) below rather than upstream's API docs.
73
73
 
74
74
  ## Pairing with lobotomized-claude-code
75
75
 
76
- Use this fork's extraction surface with [skrabe/lobotomized-claude-code](https://github.com/skrabe/lobotomized-claude-code) — per-model override sets (**Claude Opus 4.8**, Claude Fable 5) tuned against this fork's extraction. Our named-prompt JSON catches prompts Piebald's published extract doesn't (546 ids for CC 2.1.179 absent from their extract), and the system-reminder + `string`-kind reach lets the overrides cover content the base mechanisms can't.
76
+ Use this fork's extraction surface with [skrabe/lobotomized-claude-code](https://github.com/skrabe/lobotomized-claude-code) — per-model override sets (**Claude Opus 4.8**, Claude Fable 5) tuned against this fork's extraction. Our named-prompt JSON catches prompts Piebald's published extract doesn't (565 ids for CC 2.1.185 absent from their extract), and the system-reminder + `string`-kind reach lets the overrides cover content the base mechanisms can't.
77
77
 
78
78
  ## Install
79
79
 
@@ -107,6 +107,47 @@ node dist/index.mjs --apply
107
107
 
108
108
  tweakcc-fixed patches Claude Code's minified `cli.js`, reading customizations from `~/.tweakcc/config.json`. For npm installs `cli.js` is patched directly; for native installs the JS is extracted from the Bun binary with [node-lief](https://github.com/Piebald-AI/node-lief), patched, and repacked (with stale Bun bytecode cleared). Updating Claude Code overwrites the patches, but they live in your config, so reapply with `--apply`. Revert with `--restore`.
109
109
 
110
+ ## Library API
111
+
112
+ Besides the CLI, `tweakcc-fixed` is published as a library — the building blocks
113
+ the tool uses, exposed for writing your own Claude Code patching scripts. Every
114
+ export is documented inline (JSDoc, shipped in the `.d.ts`).
115
+
116
+ ```ts
117
+ import {
118
+ tryDetectInstallation,
119
+ readContent,
120
+ writeContent,
121
+ backupFile,
122
+ helpers,
123
+ } from 'tweakcc-fixed';
124
+
125
+ // Find Claude Code (npm or native Bun install)
126
+ const installation = await tryDetectInstallation();
127
+
128
+ // Back up before touching anything
129
+ await backupFile(installation.path, './cli.js.bak');
130
+
131
+ // Read the JS (extracted from the native binary when needed)
132
+ const { content, clearBytecode } = await readContent(installation);
133
+
134
+ // Patch it — `helpers` finds minified identifiers in the bundle
135
+ const reactVar = helpers.getReactVar(content);
136
+ const patched = content.replace(/…/, '…');
137
+
138
+ // Write it back. For native installs this repacks the binary; `clearBytecode`
139
+ // MUST be threaded through from readContent so a stale Bun bytecode cache
140
+ // doesn't keep running the old code.
141
+ await writeContent(installation, patched, clearBytecode);
142
+ ```
143
+
144
+ Main exports: `findAllInstallations` / `tryDetectInstallation` /
145
+ `showInteractiveInstallationPicker` (detection), `readContent` / `writeContent`
146
+ (JS I/O across npm + native), `backupFile` / `restoreBackup`, `readTweakccConfig`
147
+ plus the config-path helpers, the `helpers` toolkit (minified-identifier finders
148
+ + diff utilities), and the `Installation` / `TweakccConfig` / `Settings` /
149
+ `DetectInstallationOptions` types.
150
+
110
151
  ## The `showtime` skill (CC version-bump pipeline)
111
152
 
112
153
  When Claude Code ships a new version, [`skills/showtime/`](./skills/showtime/) is a [Claude Code skill](https://docs.claude.com/en/docs/claude-code/skills) that drives the whole bump end-to-end on your local machine — extract the new `cli.js`, run the prompt extractor, drive the version-bump report to zero, realign drifted overrides, and prove it landed clean against a **four-zeros** bar (smoke + apply-hygiene + no-orphan-overrides + no-latent-var-breakage). It ships three files: