@hmduc16031996/claude-mb-bridge 2.3.4 → 2.3.5
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/dist/index.js +1 -1
- package/package.json +1 -1
- package/scripts/postinstall.cjs +39 -12
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ const program = new Command();
|
|
|
6
6
|
program
|
|
7
7
|
.name('claude-mobile-bridge')
|
|
8
8
|
.description('Bridge Claude Code CLI to mobile via WebView')
|
|
9
|
-
.version('2.3.
|
|
9
|
+
.version('2.3.5')
|
|
10
10
|
.option('--token <token>', 'Pairing token from mobile app')
|
|
11
11
|
.option('--server <url>', 'Backend server URL', 'http://127.0.0.1:3110')
|
|
12
12
|
.option('--path <path>', 'Working directory', process.cwd())
|
package/package.json
CHANGED
package/scripts/postinstall.cjs
CHANGED
|
@@ -11,13 +11,38 @@
|
|
|
11
11
|
const fs = require('fs');
|
|
12
12
|
const path = require('path');
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
const possiblePaths = [
|
|
16
|
-
path.join(__dirname, '..', 'node_modules', 'node-pty', 'prebuilds'),
|
|
17
|
-
path.join(__dirname, '..', '..', 'node-pty', 'prebuilds'),
|
|
18
|
-
];
|
|
14
|
+
console.log('🔧 Running postinstall to fix node-pty permissions...');
|
|
19
15
|
|
|
20
|
-
|
|
16
|
+
const findNodePtyPrebuilds = () => {
|
|
17
|
+
// Try to find node-pty using require.resolve
|
|
18
|
+
try {
|
|
19
|
+
const ptyPath = require.resolve('node-pty/package.json');
|
|
20
|
+
const prebuilds = path.join(path.dirname(ptyPath), 'prebuilds');
|
|
21
|
+
if (fs.existsSync(prebuilds)) {
|
|
22
|
+
return [prebuilds];
|
|
23
|
+
}
|
|
24
|
+
} catch (e) {
|
|
25
|
+
// node-pty not found via require.resolve
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Fallback to manual path searching
|
|
29
|
+
const possiblePaths = [
|
|
30
|
+
path.join(__dirname, '..', 'node_modules', 'node-pty', 'prebuilds'),
|
|
31
|
+
path.join(__dirname, '..', '..', 'node-pty', 'prebuilds'),
|
|
32
|
+
path.join(__dirname, '..', '..', '..', 'node-pty', 'prebuilds'),
|
|
33
|
+
path.join(process.cwd(), 'node_modules', 'node-pty', 'prebuilds'),
|
|
34
|
+
];
|
|
35
|
+
return possiblePaths.filter(p => fs.existsSync(p));
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const prebuildsPaths = findNodePtyPrebuilds();
|
|
39
|
+
|
|
40
|
+
if (prebuildsPaths.length === 0) {
|
|
41
|
+
console.log('⚠️ node-pty prebuilds directory not found. Skipping permission fix.');
|
|
42
|
+
process.exit(0);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
for (const prebuildsPath of prebuildsPaths) {
|
|
21
46
|
try {
|
|
22
47
|
const entries = fs.readdirSync(prebuildsPath);
|
|
23
48
|
|
|
@@ -26,14 +51,16 @@ for (const prebuildsPath of possiblePaths) {
|
|
|
26
51
|
|
|
27
52
|
const spawnHelper = path.join(prebuildsPath, entry, 'spawn-helper');
|
|
28
53
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
54
|
+
if (fs.existsSync(spawnHelper)) {
|
|
55
|
+
try {
|
|
56
|
+
fs.chmodSync(spawnHelper, 0o755);
|
|
57
|
+
console.log(`✅ Fixed spawn-helper permissions: ${spawnHelper}`);
|
|
58
|
+
} catch (e) {
|
|
59
|
+
console.error(`❌ Failed to fix permissions for ${spawnHelper}: ${e.message}`);
|
|
60
|
+
}
|
|
34
61
|
}
|
|
35
62
|
}
|
|
36
63
|
} catch (e) {
|
|
37
|
-
|
|
64
|
+
console.error(`❌ Error reading directory ${prebuildsPath}: ${e.message}`);
|
|
38
65
|
}
|
|
39
66
|
}
|