claudescreenfix-hardwicksoftware 2.2.0 → 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/index.cjs CHANGED
@@ -35,12 +35,15 @@ const CLEAR_SCREEN = '\x1b[2J';
35
35
  const HOME_CURSOR = '\x1b[H';
36
36
 
37
37
  // regex patterns for ANSI sequences we want to strip in headless mode
38
- // ONLY background colors - foreground colors stay intact
38
+ // background colors + inverse video (which swaps FG to BG)
39
39
  const ANSI_BG_PATTERNS = [
40
40
  /\x1b\[48;5;\d+m/g, // 256-color background: \x1b[48;5;XXXm
41
41
  /\x1b\[48;2;\d+;\d+;\d+m/g, // true color background: \x1b[48;2;R;G;Bm
42
42
  /\x1b\[4[0-7]m/g, // standard background colors: \x1b[40m - \x1b[47m
43
43
  /\x1b\[10[0-7]m/g, // bright background colors: \x1b[100m - \x1b[107m
44
+ /\x1b\[7m/g, // inverse video - swaps FG/BG, causes same glitch
45
+ /\x1b\[27m/g, // inverse off (no-op but clean it up)
46
+ /\x1b\[49m/g, // default background color
44
47
  ];
45
48
 
46
49
  // config - tweak these if needed
@@ -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.2.0",
4
- "description": "fixes scroll glitch + VNC/headless rendering in claude code cli - strips BG colors that break VTE on Xvfb",
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"