claudefix 2.7.2 → 2.7.3
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/bin/claude-fixed.js +1 -1
- package/bin/wrapper.js.template +10 -12
- package/package.json +1 -1
package/bin/claude-fixed.js
CHANGED
|
@@ -225,7 +225,7 @@ const TOTAL_MEM_MB = Math.floor(os.totalmem() / 1024 / 1024);
|
|
|
225
225
|
const MEM_PERCENT = Math.min(100, Math.max(1,
|
|
226
226
|
parseInt(process.env.CLAUDEFIX_MEM_PERCENT, 10) || config.memPercent || 35
|
|
227
227
|
)) / 100;
|
|
228
|
-
const MAX_HEAP_MB = Math.floor(TOTAL_MEM_MB * MEM_PERCENT);
|
|
228
|
+
const MAX_HEAP_MB = Math.min(4096, Math.floor(TOTAL_MEM_MB * MEM_PERCENT));
|
|
229
229
|
const WARN_THRESHOLD_MB = Math.floor(MAX_HEAP_MB * 0.7);
|
|
230
230
|
const CRITICAL_THRESHOLD_MB = Math.floor(MAX_HEAP_MB * 0.9);
|
|
231
231
|
|
package/bin/wrapper.js.template
CHANGED
|
@@ -18,9 +18,9 @@ const os = require('os');
|
|
|
18
18
|
const VERSIONS_DIR = path.join(os.homedir(), '.local/share/claude/versions');
|
|
19
19
|
const CLAUDEFIX_SCRIPT = '/usr/lib/node_modules/claudefix/bin/claude-fixed.js'; // Absolute path set at install time
|
|
20
20
|
|
|
21
|
-
// Memory limit: 35% of total RAM
|
|
21
|
+
// Memory limit: 35% of total RAM, capped at 4096MB
|
|
22
22
|
const TOTAL_MB = Math.floor(os.totalmem() / 1024 / 1024);
|
|
23
|
-
const MAX_HEAP = Math.floor(TOTAL_MB * 0.35);
|
|
23
|
+
const MAX_HEAP = Math.min(4096, Math.floor(TOTAL_MB * 0.35));
|
|
24
24
|
|
|
25
25
|
function findClaude() {
|
|
26
26
|
// 1. Check versions directory (self-updating claude)
|
|
@@ -73,15 +73,13 @@ if (!isLinux || disabled) {
|
|
|
73
73
|
c.on('exit', code => process.exit(code || 0));
|
|
74
74
|
} else {
|
|
75
75
|
// Linux - apply PTY color filter AND memory limits
|
|
76
|
+
// MUST spawn child process — NODE_OPTIONS/require() in same process
|
|
77
|
+
// does NOT apply --max-old-space-size (V8 sets heap at startup)
|
|
76
78
|
process.env.CLAUDE_REAL_BINARY = bin;
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
env: { ...process.env, NODE_OPTIONS: '--max-old-space-size=' + MAX_HEAP }
|
|
84
|
-
});
|
|
85
|
-
c.on('exit', code => process.exit(code || 0));
|
|
86
|
-
}
|
|
79
|
+
const nodeArgs = ['--max-old-space-size=' + MAX_HEAP, CLAUDEFIX_SCRIPT, ...process.argv.slice(2)];
|
|
80
|
+
const c = spawn(process.execPath, nodeArgs, {
|
|
81
|
+
stdio: 'inherit',
|
|
82
|
+
env: { ...process.env, CLAUDE_REAL_BINARY: bin }
|
|
83
|
+
});
|
|
84
|
+
c.on('exit', code => process.exit(code ?? 0));
|
|
87
85
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claudefix",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.3",
|
|
4
4
|
"description": "Fixes screen glitching, blocky colors, AND MEMORY LEAKS in Claude Code CLI on Linux and macOS. All features optional via env vars. Shows config options on install. Developed by Hardwick Software Services @ https://justcalljon.pro",
|
|
5
5
|
"main": "index.cjs",
|
|
6
6
|
"bin": {
|