claude-code-cache-fix 1.9.0 → 1.9.1
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 +25 -0
- package/claude-fixed.bat +5 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -104,6 +104,30 @@ The wrapper dynamically resolves your npm global root, constructs a `file:///` U
|
|
|
104
104
|
|
|
105
105
|
Credit: [@TomTheMenace](https://github.com/anthropics/claude-code/issues/38335) contributed the Windows wrapper and validated the interceptor across a 7.5-hour, 536-call Opus 4.6 session on Windows — 98.4% cache hit rate, 81% of calls had fingerprint instability that the interceptor corrected.
|
|
106
106
|
|
|
107
|
+
## VS Code Extension (experimental)
|
|
108
|
+
|
|
109
|
+
If you use Claude Code through the VS Code extension rather than the CLI, you may be able to load the interceptor via VS Code settings:
|
|
110
|
+
|
|
111
|
+
```json
|
|
112
|
+
{
|
|
113
|
+
"claude-code.environmentVariables": {
|
|
114
|
+
"NODE_OPTIONS": "--import /path/to/claude-code-cache-fix/preload.mjs"
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Replace `/path/to` with your npm global root (`npm root -g`). Example for a typical Linux setup:
|
|
120
|
+
|
|
121
|
+
```json
|
|
122
|
+
{
|
|
123
|
+
"claude-code.environmentVariables": {
|
|
124
|
+
"NODE_OPTIONS": "--import /home/username/.npm-global/lib/node_modules/claude-code-cache-fix/preload.mjs"
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
**Status: needs community testing.** We've confirmed the `claude-code.environmentVariables` setting exists but haven't verified it propagates `NODE_OPTIONS` to the CC subprocess. If you test this, please report back on [#16](https://github.com/cnighswonger/claude-code-cache-fix/issues/16).
|
|
130
|
+
|
|
107
131
|
## How it works
|
|
108
132
|
|
|
109
133
|
The module intercepts `globalThis.fetch` before Claude Code makes API calls to `/v1/messages`. On each call it:
|
|
@@ -522,6 +546,7 @@ measurable signature of cache-efficiency degradation.
|
|
|
522
546
|
- **[@fgrosswig](https://github.com/fgrosswig)** — [claude-usage-dashboard](https://github.com/fgrosswig/claude-usage-dashboard) forensic methodology: cost-factor overhead ratio metric, `anthropic-*` header capture pattern, proxy NDJSON schema that informed our dashboard interop layer
|
|
523
547
|
- **[@TomTheMenace](https://github.com/TomTheMenace)** — Windows `.bat` wrapper for the interceptor, first Windows platform validation (7.5h/536-call Opus 4.6 session, 98.4% cache hit rate, 81% fingerprint instability corrected)
|
|
524
548
|
- **[@arjansingh](https://github.com/arjansingh)** — nvm-compatible wrapper script with dynamic `npm root -g` path resolution (PR #15)
|
|
549
|
+
- **[@beekamai](https://github.com/beekamai)** — Windows URL-encoding fix for `claude-fixed.bat` when npm root contains spaces (PR #17)
|
|
525
550
|
|
|
526
551
|
If you contributed to the community effort on these issues and aren't listed here, please open an issue or PR — we want to credit everyone properly.
|
|
527
552
|
|
package/claude-fixed.bat
CHANGED
|
@@ -17,6 +17,10 @@ REM
|
|
|
17
17
|
REM Credit: @TomTheMenace (https://github.com/anthropics/claude-code/issues/38335)
|
|
18
18
|
REM Part of claude-code-cache-fix: https://github.com/cnighswonger/claude-code-cache-fix
|
|
19
19
|
|
|
20
|
+
REM Resolve npm global root and URL-encode it so spaces (e.g. "C:\Program Files\nodejs")
|
|
21
|
+
REM don't break NODE_OPTIONS parsing. Without encoding, Node splits --import file:/// on
|
|
22
|
+
REM the literal space and fails with ERR_MODULE_NOT_FOUND: Cannot find module 'C:\Program'.
|
|
20
23
|
for /f "delims=" %%G in ('npm root -g') do set "NPM_GLOBAL=%%G"
|
|
21
|
-
|
|
24
|
+
for /f "delims=" %%U in ('powershell -NoProfile -Command "[System.Uri]::EscapeUriString(('%NPM_GLOBAL:\=/%' + '/claude-code-cache-fix/preload.mjs'))"') do set "PRELOAD_URL=%%U"
|
|
25
|
+
set NODE_OPTIONS=--import file:///%PRELOAD_URL%
|
|
22
26
|
node "%NPM_GLOBAL%\@anthropic-ai\claude-code\cli.js" %*
|
package/package.json
CHANGED