@mmux/mmux 0.1.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/bin/mmux.js ADDED
@@ -0,0 +1,79 @@
1
+ #!/usr/bin/env node
2
+
3
+ const childProcess = require("child_process");
4
+ const fs = require("fs");
5
+ const os = require("os");
6
+ const path = require("path");
7
+
8
+ const packageJson = require("../package.json");
9
+
10
+ function target() {
11
+ if (process.platform === "linux" && process.arch === "x64") {
12
+ return { archive: "mmux-linux-x86_64.tar.gz" };
13
+ }
14
+
15
+ if (process.platform === "darwin" && process.arch === "arm64") {
16
+ return { archive: "mmux-darwin-arm64.tar.gz" };
17
+ }
18
+
19
+ if (process.platform === "darwin" && process.arch === "x64") {
20
+ return { archive: "mmux-darwin-x86_64.tar.gz" };
21
+ }
22
+
23
+ console.error(`Unsupported platform for @mmux/mmux: ${process.platform}/${process.arch}`);
24
+ process.exit(1);
25
+ }
26
+
27
+ const selected = target();
28
+ const packageRoot = path.resolve(__dirname, "..");
29
+ const archivePath = path.join(packageRoot, "artifacts", selected.archive);
30
+ const cacheDir = path.join(
31
+ os.tmpdir(),
32
+ "mmux-npm",
33
+ `${packageJson.version}-${process.platform}-${process.arch}`
34
+ );
35
+ const binaryPath = path.join(cacheDir, "mmux");
36
+
37
+ if (!fs.existsSync(archivePath)) {
38
+ console.error(`Missing mmux archive: ${archivePath}`);
39
+ process.exit(1);
40
+ }
41
+
42
+ if (!fs.existsSync(binaryPath)) {
43
+ fs.rmSync(cacheDir, { recursive: true, force: true });
44
+ fs.mkdirSync(cacheDir, { recursive: true });
45
+
46
+ const extract = childProcess.spawnSync("tar", ["-xzf", archivePath, "-C", cacheDir], {
47
+ stdio: "inherit"
48
+ });
49
+
50
+ if (extract.status !== 0) {
51
+ process.exit(extract.status || 1);
52
+ }
53
+
54
+ if (!fs.existsSync(binaryPath)) {
55
+ console.error(`Archive ${selected.archive} did not contain an mmux binary`);
56
+ process.exit(1);
57
+ }
58
+ fs.chmodSync(binaryPath, 0o755);
59
+
60
+ const microsandboxPath = path.join(cacheDir, "mmux-microsandbox-node");
61
+ if (fs.existsSync(microsandboxPath)) {
62
+ fs.chmodSync(microsandboxPath, 0o755);
63
+ }
64
+ }
65
+
66
+ const result = childProcess.spawnSync(binaryPath, process.argv.slice(2), {
67
+ stdio: "inherit"
68
+ });
69
+
70
+ if (result.error) {
71
+ console.error(result.error.message);
72
+ process.exit(1);
73
+ }
74
+
75
+ if (result.signal) {
76
+ process.kill(process.pid, result.signal);
77
+ }
78
+
79
+ process.exit(result.status === null ? 1 : result.status);
package/package.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "@mmux/mmux",
3
+ "version": "0.1.0",
4
+ "description": "MCP controller for tmux-backed local and remote coding sessions.",
5
+ "license": "Apache-2.0",
6
+ "homepage": "https://github.com/ilijaljubicic/mmux",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/ilijaljubicic/mmux.git"
10
+ },
11
+ "bin": {
12
+ "mmux": "bin/mmux.js"
13
+ },
14
+ "files": [
15
+ "bin/",
16
+ "artifacts/"
17
+ ],
18
+ "publishConfig": {
19
+ "access": "public"
20
+ }
21
+ }