claudescreenfix-hardwicksoftware 2.2.1 → 2.3.0
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/install-hook.cjs +70 -0
- package/package.json +6 -3
package/install-hook.cjs
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Auto-install Claude hook on npm install
|
|
4
|
+
*/
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
const path = require('path');
|
|
7
|
+
const os = require('os');
|
|
8
|
+
|
|
9
|
+
const HOOK_NAME = 'screenfix-loader.js';
|
|
10
|
+
const CLAUDE_HOOKS_DIR = path.join(os.homedir(), '.claude', 'hooks');
|
|
11
|
+
|
|
12
|
+
const HOOK_CONTENT = `#!/usr/bin/env node
|
|
13
|
+
/**
|
|
14
|
+
* CLAUDE SCREENFIX LOADER HOOK
|
|
15
|
+
* ============================
|
|
16
|
+
*
|
|
17
|
+
* SessionStart hook that loads claudescreenfix-hardwicksoftware
|
|
18
|
+
* to fix VTE rendering glitches on headless/VNC displays.
|
|
19
|
+
*
|
|
20
|
+
* Auto-installed by: npm install claudescreenfix-hardwicksoftware
|
|
21
|
+
*
|
|
22
|
+
* Hook Event: SessionStart
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
try {
|
|
26
|
+
const screenfix = require('claudescreenfix-hardwicksoftware');
|
|
27
|
+
screenfix.install();
|
|
28
|
+
} catch (e) {
|
|
29
|
+
// screenfix not installed or failed, continue silently
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Hook must output valid JSON for SessionStart
|
|
33
|
+
const input = process.argv[2] || '{}';
|
|
34
|
+
try {
|
|
35
|
+
const hookEvent = JSON.parse(input);
|
|
36
|
+
if (hookEvent.type === 'SessionStart') {
|
|
37
|
+
console.log(JSON.stringify({ result: '' }));
|
|
38
|
+
}
|
|
39
|
+
} catch (e) {
|
|
40
|
+
// Not a valid hook call, ignore
|
|
41
|
+
}
|
|
42
|
+
`;
|
|
43
|
+
|
|
44
|
+
function install() {
|
|
45
|
+
try {
|
|
46
|
+
// Create hooks dir if needed
|
|
47
|
+
if (!fs.existsSync(CLAUDE_HOOKS_DIR)) {
|
|
48
|
+
fs.mkdirSync(CLAUDE_HOOKS_DIR, { recursive: true });
|
|
49
|
+
console.log('[screenfix] Created ' + CLAUDE_HOOKS_DIR);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const hookPath = path.join(CLAUDE_HOOKS_DIR, HOOK_NAME);
|
|
53
|
+
|
|
54
|
+
// Check if hook already exists
|
|
55
|
+
if (fs.existsSync(hookPath)) {
|
|
56
|
+
console.log('[screenfix] Hook already exists at ' + hookPath);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Write the hook
|
|
61
|
+
fs.writeFileSync(hookPath, HOOK_CONTENT, { mode: 0o755 });
|
|
62
|
+
console.log('[screenfix] Installed hook to ' + hookPath);
|
|
63
|
+
console.log('[screenfix] Restart Claude Code to activate headless mode fix');
|
|
64
|
+
} catch (e) {
|
|
65
|
+
console.error('[screenfix] Failed to install hook:', e.message);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Run install
|
|
70
|
+
install();
|
package/package.json
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claudescreenfix-hardwicksoftware",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"description": "fixes scroll glitch + VNC/headless rendering in claude code cli - strips BG colors
|
|
3
|
+
"version": "2.3.0",
|
|
4
|
+
"description": "fixes scroll glitch + VNC/headless rendering in claude code cli - auto-installs hook, strips BG colors on Xvfb",
|
|
5
5
|
"main": "index.cjs",
|
|
6
6
|
"bin": {
|
|
7
7
|
"claude-fixed": "./bin/claude-fixed.js"
|
|
8
8
|
},
|
|
9
|
-
"scripts": {
|
|
9
|
+
"scripts": {
|
|
10
|
+
"postinstall": "node install-hook.cjs"
|
|
11
|
+
},
|
|
10
12
|
"keywords": [
|
|
11
13
|
"claude",
|
|
12
14
|
"terminal",
|
|
@@ -32,6 +34,7 @@
|
|
|
32
34
|
"files": [
|
|
33
35
|
"index.cjs",
|
|
34
36
|
"loader.cjs",
|
|
37
|
+
"install-hook.cjs",
|
|
35
38
|
"bin/",
|
|
36
39
|
"README.md",
|
|
37
40
|
"LICENSE"
|