cmux 0.8.3 → 0.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/bin/cmux.js +53 -0
- package/package.json +15 -31
- package/bin/cmux +0 -58
- package/lib/cmux +0 -0
- package/lib/postinstall.js +0 -104
package/bin/cmux.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
// Launcher for `npx cmux` / a global `cmux` install. The actual TUI is a
|
|
5
|
+
// prebuilt Rust binary shipped in a per-platform optional dependency
|
|
6
|
+
// (cmux-tui-<platform>); npm installs only the one matching os+cpu. This shim
|
|
7
|
+
// resolves that binary and execs it, forwarding argv, stdio, exit code, and
|
|
8
|
+
// signals so cmux behaves exactly like the native binary.
|
|
9
|
+
|
|
10
|
+
const { spawnSync } = require("child_process");
|
|
11
|
+
|
|
12
|
+
const PACKAGE_BY_PLATFORM = {
|
|
13
|
+
"darwin-arm64": "cmux-tui-darwin-arm64",
|
|
14
|
+
"darwin-x64": "cmux-tui-darwin-x64",
|
|
15
|
+
"linux-x64": "cmux-tui-linux-x64",
|
|
16
|
+
"linux-arm64": "cmux-tui-linux-arm64",
|
|
17
|
+
// win32-x64 pending: ghostty vt headers fail bindgen under mingw clang.
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const key = `${process.platform}-${process.arch}`;
|
|
21
|
+
const pkg = PACKAGE_BY_PLATFORM[key];
|
|
22
|
+
|
|
23
|
+
if (!pkg) {
|
|
24
|
+
console.error(
|
|
25
|
+
`cmux: no prebuilt binary for ${key}. Supported: ${Object.keys(PACKAGE_BY_PLATFORM).join(", ")}.`
|
|
26
|
+
);
|
|
27
|
+
process.exit(1);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const binName = process.platform === "win32" ? "cmux-tui.exe" : "cmux-tui";
|
|
31
|
+
|
|
32
|
+
let binPath;
|
|
33
|
+
try {
|
|
34
|
+
binPath = require.resolve(`${pkg}/bin/${binName}`);
|
|
35
|
+
} catch {
|
|
36
|
+
console.error(
|
|
37
|
+
`cmux: platform package ${pkg} is not installed. Reinstall cmux, ` +
|
|
38
|
+
`or set npm to install optional dependencies (--include=optional).`
|
|
39
|
+
);
|
|
40
|
+
process.exit(1);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const result = spawnSync(binPath, process.argv.slice(2), { stdio: "inherit" });
|
|
44
|
+
|
|
45
|
+
if (result.error) {
|
|
46
|
+
console.error(`cmux: failed to launch ${binPath}: ${result.error.message}`);
|
|
47
|
+
process.exit(1);
|
|
48
|
+
}
|
|
49
|
+
if (result.signal) {
|
|
50
|
+
process.kill(process.pid, result.signal);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
process.exit(result.status === null ? 1 : result.status);
|
package/package.json
CHANGED
|
@@ -1,43 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cmux",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
"cloud",
|
|
9
|
-
"sandbox",
|
|
10
|
-
"development",
|
|
11
|
-
"e2b",
|
|
12
|
-
"vscode",
|
|
13
|
-
"vnc"
|
|
14
|
-
],
|
|
15
|
-
"homepage": "https://cmux.sh",
|
|
3
|
+
"version": "0.9.1",
|
|
4
|
+
"description": "cmux — a tmux-like terminal multiplexer TUI backed by libghostty-vt. Run with `npx cmux`.",
|
|
5
|
+
"bin": {
|
|
6
|
+
"cmux": "bin/cmux.js"
|
|
7
|
+
},
|
|
16
8
|
"repository": {
|
|
17
9
|
"type": "git",
|
|
18
|
-
"url": "git+https://github.com/manaflow-ai/
|
|
19
|
-
"directory": "
|
|
10
|
+
"url": "git+https://github.com/manaflow-ai/cmux.git",
|
|
11
|
+
"directory": "cmux-tui/dist/npm/cmux"
|
|
20
12
|
},
|
|
13
|
+
"homepage": "https://github.com/manaflow-ai/cmux/tree/main/cmux-tui",
|
|
21
14
|
"license": "MIT",
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
"cmux": "bin/cmux"
|
|
15
|
+
"engines": {
|
|
16
|
+
"node": ">=18"
|
|
25
17
|
},
|
|
26
18
|
"files": [
|
|
27
|
-
"bin"
|
|
28
|
-
"lib"
|
|
19
|
+
"bin/cmux.js"
|
|
29
20
|
],
|
|
30
|
-
"scripts": {
|
|
31
|
-
"postinstall": "node lib/postinstall.js"
|
|
32
|
-
},
|
|
33
21
|
"optionalDependencies": {
|
|
34
|
-
"cmux-darwin-arm64": "0.
|
|
35
|
-
"cmux-darwin-x64": "0.
|
|
36
|
-
"cmux-linux-
|
|
37
|
-
"cmux-linux-
|
|
38
|
-
"cmux-win32-x64": "0.8.3"
|
|
39
|
-
},
|
|
40
|
-
"engines": {
|
|
41
|
-
"node": ">=16"
|
|
22
|
+
"cmux-tui-darwin-arm64": "0.9.1",
|
|
23
|
+
"cmux-tui-darwin-x64": "0.9.1",
|
|
24
|
+
"cmux-tui-linux-x64": "0.9.1",
|
|
25
|
+
"cmux-tui-linux-arm64": "0.9.1"
|
|
42
26
|
}
|
|
43
27
|
}
|
package/bin/cmux
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* cmux CLI wrapper - delegates to the native binary.
|
|
4
|
-
*
|
|
5
|
-
* This script exists so npm can create a proper bin symlink at install time.
|
|
6
|
-
* The postinstall script will overwrite this file with the platform-specific
|
|
7
|
-
* native binary. If postinstall hasn't run yet, this wrapper finds and
|
|
8
|
-
* executes the binary from lib/ or the platform package.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
const { execFileSync } = require("child_process");
|
|
12
|
-
const path = require("path");
|
|
13
|
-
const fs = require("fs");
|
|
14
|
-
|
|
15
|
-
const binName = process.platform === "win32" ? "cmux.exe" : "cmux";
|
|
16
|
-
|
|
17
|
-
// Look for the native binary in these locations (in order)
|
|
18
|
-
const candidates = [
|
|
19
|
-
// lib/cmux - copied by build process as fallback
|
|
20
|
-
path.join(__dirname, "..", "lib", binName),
|
|
21
|
-
// Platform package in node_modules (hoisted)
|
|
22
|
-
...getPlatformPaths(),
|
|
23
|
-
];
|
|
24
|
-
|
|
25
|
-
function getPlatformPaths() {
|
|
26
|
-
const platform = process.platform;
|
|
27
|
-
const arch = process.arch;
|
|
28
|
-
const pkgName = `cmux-${platform}-${arch}`;
|
|
29
|
-
return [
|
|
30
|
-
path.join(__dirname, "..", "..", pkgName, "bin", binName),
|
|
31
|
-
path.join(__dirname, "..", "node_modules", pkgName, "bin", binName),
|
|
32
|
-
];
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
let binaryPath;
|
|
36
|
-
for (const candidate of candidates) {
|
|
37
|
-
if (fs.existsSync(candidate)) {
|
|
38
|
-
binaryPath = candidate;
|
|
39
|
-
break;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
if (!binaryPath) {
|
|
44
|
-
console.error("cmux: Could not find native binary. Try reinstalling: npm install -g cmux");
|
|
45
|
-
process.exit(1);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
try {
|
|
49
|
-
const result = execFileSync(binaryPath, process.argv.slice(2), {
|
|
50
|
-
stdio: "inherit",
|
|
51
|
-
env: process.env,
|
|
52
|
-
});
|
|
53
|
-
} catch (err) {
|
|
54
|
-
if (err.status !== null) {
|
|
55
|
-
process.exit(err.status);
|
|
56
|
-
}
|
|
57
|
-
throw err;
|
|
58
|
-
}
|
package/lib/cmux
DELETED
|
Binary file
|
package/lib/postinstall.js
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Post-install script for cmux
|
|
4
|
-
* Copies the platform-specific binary to the bin directory
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
const fs = require('fs');
|
|
8
|
-
const path = require('path');
|
|
9
|
-
|
|
10
|
-
const PLATFORMS = {
|
|
11
|
-
'darwin-arm64': 'cmux-darwin-arm64',
|
|
12
|
-
'darwin-x64': 'cmux-darwin-x64',
|
|
13
|
-
'linux-arm64': 'cmux-linux-arm64',
|
|
14
|
-
'linux-x64': 'cmux-linux-x64',
|
|
15
|
-
'win32-x64': 'cmux-win32-x64',
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
function getPlatformPackage() {
|
|
19
|
-
const platform = process.platform;
|
|
20
|
-
const arch = process.arch;
|
|
21
|
-
|
|
22
|
-
// Map Node.js arch to our naming
|
|
23
|
-
let archName = arch;
|
|
24
|
-
if (arch === 'x64') archName = 'x64';
|
|
25
|
-
else if (arch === 'arm64') archName = 'arm64';
|
|
26
|
-
|
|
27
|
-
const key = `${platform}-${archName}`;
|
|
28
|
-
return PLATFORMS[key];
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function findBinary(packageName) {
|
|
32
|
-
const binName = process.platform === 'win32' ? 'cmux.exe' : 'cmux';
|
|
33
|
-
|
|
34
|
-
// Try to find the binary in node_modules
|
|
35
|
-
const possiblePaths = [
|
|
36
|
-
// Hoisted to top-level node_modules (local install)
|
|
37
|
-
path.join(__dirname, '..', '..', packageName, 'bin'),
|
|
38
|
-
// In our own node_modules
|
|
39
|
-
path.join(__dirname, '..', 'node_modules', packageName, 'bin'),
|
|
40
|
-
// Global install - sibling package
|
|
41
|
-
path.join(__dirname, '..', '..', '..', packageName, 'bin'),
|
|
42
|
-
// pnpm global
|
|
43
|
-
path.join(__dirname, '..', '..', '.pnpm', 'node_modules', packageName, 'bin'),
|
|
44
|
-
];
|
|
45
|
-
|
|
46
|
-
// Also try require.resolve to find the package
|
|
47
|
-
try {
|
|
48
|
-
const pkgPath = require.resolve(`${packageName}/package.json`, { paths: [path.join(__dirname, '..')] });
|
|
49
|
-
const pkgBinPath = path.join(path.dirname(pkgPath), 'bin', binName);
|
|
50
|
-
possiblePaths.unshift(path.dirname(pkgBinPath));
|
|
51
|
-
} catch (e) {
|
|
52
|
-
// Package not resolvable, continue with other paths
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
for (const p of possiblePaths) {
|
|
56
|
-
const binPath = path.join(p, binName);
|
|
57
|
-
if (fs.existsSync(binPath)) {
|
|
58
|
-
return binPath;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
return null;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
function main() {
|
|
66
|
-
const platformPackage = getPlatformPackage();
|
|
67
|
-
|
|
68
|
-
if (!platformPackage) {
|
|
69
|
-
console.error(`Unsupported platform: ${process.platform}-${process.arch}`);
|
|
70
|
-
console.error('Supported platforms: darwin-arm64, darwin-x64, linux-arm64, linux-x64, win32-x64');
|
|
71
|
-
process.exit(1);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
const sourceBinary = findBinary(platformPackage);
|
|
75
|
-
|
|
76
|
-
if (!sourceBinary) {
|
|
77
|
-
// Binary not found - try to install the platform package
|
|
78
|
-
console.error(`cmux: Platform package ${platformPackage} not found`);
|
|
79
|
-
console.error(`cmux: Please ensure the package installed correctly.`);
|
|
80
|
-
console.error(`cmux: You can try: npm install -g ${platformPackage}`);
|
|
81
|
-
// Don't exit with error - npm might still be installing optional deps
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
const binDir = path.join(__dirname, '..', 'bin');
|
|
86
|
-
const destBinary = path.join(binDir, process.platform === 'win32' ? 'cmux.exe' : 'cmux');
|
|
87
|
-
|
|
88
|
-
// Ensure bin directory exists
|
|
89
|
-
if (!fs.existsSync(binDir)) {
|
|
90
|
-
fs.mkdirSync(binDir, { recursive: true });
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
// Copy the binary
|
|
94
|
-
fs.copyFileSync(sourceBinary, destBinary);
|
|
95
|
-
|
|
96
|
-
// Make executable on Unix
|
|
97
|
-
if (process.platform !== 'win32') {
|
|
98
|
-
fs.chmodSync(destBinary, 0o755);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
console.log(`cmux: Installed ${platformPackage} binary`);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
main();
|