0xmux 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.
Files changed (2) hide show
  1. package/bin/0xmux.js +60 -0
  2. package/package.json +24 -0
package/bin/0xmux.js ADDED
@@ -0,0 +1,60 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { spawnSync } = require('child_process');
4
+ const path = require('path');
5
+
6
+ const PLATFORM_MAP = {
7
+ 'darwin-arm64': '@0xmux/darwin-arm64',
8
+ 'darwin-x64': '@0xmux/darwin-x64',
9
+ 'linux-x64': '@0xmux/linux-x64',
10
+ };
11
+
12
+ function getBinaryPath() {
13
+ const key = `${process.platform}-${process.arch}`;
14
+ const pkg = PLATFORM_MAP[key];
15
+
16
+ if (!pkg) {
17
+ console.error(`Unsupported platform: ${key}`);
18
+ console.error(`Supported: ${Object.keys(PLATFORM_MAP).join(', ')}`);
19
+ process.exit(1);
20
+ }
21
+
22
+ try {
23
+ const pkgDir = path.dirname(require.resolve(`${pkg}/package.json`));
24
+ return path.join(pkgDir, 'bin', 'oxmux-server');
25
+ } catch {
26
+ // Fallback: check if binary is in same directory (postinstall fallback)
27
+ const local = path.join(__dirname, '..', 'bin', 'oxmux-server');
28
+ try {
29
+ require('fs').accessSync(local, require('fs').constants.X_OK);
30
+ return local;
31
+ } catch {
32
+ console.error(`Could not find 0xmux binary for ${key}`);
33
+ console.error(`Package ${pkg} may not be installed.`);
34
+ console.error(`Try: npm install -g 0xmux`);
35
+ process.exit(1);
36
+ }
37
+ }
38
+ }
39
+
40
+ function main() {
41
+ const binary = getBinaryPath();
42
+ const args = process.argv.slice(2);
43
+
44
+ while (true) {
45
+ const result = spawnSync(binary, args, {
46
+ stdio: 'inherit',
47
+ env: process.env,
48
+ });
49
+
50
+ // Exit code 42 = restart requested
51
+ if (result.status === 42) {
52
+ console.log('\n0xMux restarting...\n');
53
+ continue;
54
+ }
55
+
56
+ process.exit(result.status ?? 1);
57
+ }
58
+ }
59
+
60
+ main();
package/package.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "0xmux",
3
+ "version": "0.1.0",
4
+ "description": "Hacker-grade tmux session manager with web UI",
5
+ "license": "MIT",
6
+ "bin": {
7
+ "0xmux": "bin/0xmux.js"
8
+ },
9
+ "optionalDependencies": {
10
+ "@0xmux/darwin-arm64": "0.1.0",
11
+ "@0xmux/darwin-x64": "0.1.0",
12
+ "@0xmux/linux-x64": "0.1.0"
13
+ },
14
+ "keywords": [
15
+ "tmux",
16
+ "terminal",
17
+ "session-manager",
18
+ "web-ui"
19
+ ],
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "https://github.com/DLHTX/0xMux"
23
+ }
24
+ }