@net-mesh/deck 0.19.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/LICENSE ADDED
@@ -0,0 +1,3 @@
1
+ Apache-2.0
2
+
3
+ See https://github.com/ai-2070/net/blob/master/LICENSE for the full text.
package/README.md ADDED
@@ -0,0 +1,33 @@
1
+ # @net-mesh/deck
2
+
3
+ The operator cyberdeck — terminal UI for the Net mesh.
4
+
5
+ ```sh
6
+ npm install -g @net-mesh/deck
7
+ net-deck
8
+ ```
9
+
10
+ `@net-mesh/deck` is a thin Node.js shim — installing it pulls in
11
+ the right per-platform binary package as an `optionalDependency`
12
+ (npm refuses to install packages that don't match the host's
13
+ `os` / `cpu` / `libc`). The shim resolves the installed package
14
+ at runtime and `exec`s the bundled `net-deck` binary.
15
+
16
+ Supported targets:
17
+
18
+ - linux x86_64 (glibc + musl)
19
+ - linux aarch64 (glibc + musl)
20
+ - macOS x86_64 + aarch64
21
+ - Windows x86_64 + aarch64
22
+
23
+ ## Other install paths
24
+
25
+ - **crates.io** — `cargo install net-deck`
26
+ - **cargo-binstall** — `cargo binstall net-deck` (downloads the
27
+ prebuilt tarball from GitHub Releases, no compile)
28
+ - **GitHub Releases** — download the tarball / zip directly from
29
+ [the releases page](https://github.com/ai-2070/net/releases)
30
+ - **PyPI** — `pip install net-deck`
31
+
32
+ See the [main README](https://github.com/ai-2070/net) for the
33
+ full surface.
@@ -0,0 +1,94 @@
1
+ #!/usr/bin/env node
2
+ // Shim that locates the platform-specific @net-mesh/deck-<triple>
3
+ // package and execs its bundled `net-deck` binary. See
4
+ // `../../cli/npm/bin/net-mesh.js` for the design notes — the two
5
+ // shims are deliberately parallel.
6
+
7
+ 'use strict';
8
+
9
+ const child_process = require('node:child_process');
10
+ const fs = require('node:fs');
11
+ const path = require('node:path');
12
+
13
+ function detectLibc() {
14
+ if (process.platform !== 'linux') return null;
15
+ try {
16
+ const report = process.report.getReport();
17
+ if (report && report.header && report.header.glibcVersionRuntime) {
18
+ return 'gnu';
19
+ }
20
+ } catch (_) {}
21
+ try {
22
+ const ldd = child_process.execFileSync('/usr/bin/ldd', ['--version'], {
23
+ encoding: 'utf8',
24
+ stdio: ['ignore', 'pipe', 'pipe'],
25
+ });
26
+ if (/musl/i.test(ldd)) return 'musl';
27
+ } catch (_) {}
28
+ return 'gnu';
29
+ }
30
+
31
+ function resolvePlatformPackage() {
32
+ const platform = process.platform;
33
+ const arch = process.arch;
34
+ const libc = detectLibc();
35
+ if (platform === 'linux') {
36
+ if (arch === 'x64') return `@net-mesh/deck-linux-x64-${libc}`;
37
+ if (arch === 'arm64') return `@net-mesh/deck-linux-arm64-${libc}`;
38
+ }
39
+ if (platform === 'darwin') {
40
+ if (arch === 'x64') return '@net-mesh/deck-darwin-x64';
41
+ if (arch === 'arm64') return '@net-mesh/deck-darwin-arm64';
42
+ }
43
+ if (platform === 'win32') {
44
+ if (arch === 'x64') return '@net-mesh/deck-win32-x64';
45
+ if (arch === 'arm64') return '@net-mesh/deck-win32-arm64';
46
+ }
47
+ throw new Error(
48
+ `Unsupported platform: ${platform}-${arch}${libc ? `-${libc}` : ''}. ` +
49
+ 'See https://github.com/ai-2070/net for the list of supported targets.',
50
+ );
51
+ }
52
+
53
+ function findBinary() {
54
+ const pkg = resolvePlatformPackage();
55
+ const binName = process.platform === 'win32' ? 'net-deck.exe' : 'net-deck';
56
+ let pkgJsonPath;
57
+ try {
58
+ pkgJsonPath = require.resolve(`${pkg}/package.json`);
59
+ } catch (err) {
60
+ throw new Error(
61
+ `Failed to locate ${pkg}. The optional dependency may not have ` +
62
+ 'installed — check your npm install logs. ' +
63
+ `Underlying error: ${err.message}`,
64
+ );
65
+ }
66
+ const binPath = path.join(path.dirname(pkgJsonPath), 'bin', binName);
67
+ if (!fs.existsSync(binPath)) {
68
+ throw new Error(
69
+ `Binary missing at ${binPath}. The platform package is malformed.`,
70
+ );
71
+ }
72
+ return binPath;
73
+ }
74
+
75
+ function main() {
76
+ let binPath;
77
+ try {
78
+ binPath = findBinary();
79
+ } catch (err) {
80
+ process.stderr.write(`net-deck: ${err.message}\n`);
81
+ process.exit(127);
82
+ }
83
+ const result = child_process.spawnSync(binPath, process.argv.slice(2), {
84
+ stdio: 'inherit',
85
+ windowsHide: false,
86
+ });
87
+ if (result.error) {
88
+ process.stderr.write(`net-deck: ${result.error.message}\n`);
89
+ process.exit(1);
90
+ }
91
+ process.exit(result.status === null ? 1 : result.status);
92
+ }
93
+
94
+ main();
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "@net-mesh/deck",
3
+ "version": "0.19.0",
4
+ "description": "net-deck — operator cyberdeck (terminal UI) for the Net mesh",
5
+ "license": "Apache-2.0",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/ai-2070/net"
9
+ },
10
+ "keywords": [
11
+ "net-mesh",
12
+ "mesh",
13
+ "tui",
14
+ "cyberdeck",
15
+ "operator"
16
+ ],
17
+ "bin": {
18
+ "net-deck": "bin/net-deck.js"
19
+ },
20
+ "files": [
21
+ "bin/net-deck.js",
22
+ "README.md",
23
+ "LICENSE"
24
+ ],
25
+ "engines": {
26
+ "node": ">=18"
27
+ },
28
+ "//": "Per-platform binary packages are listed as optionalDependencies. npm fetches only the one whose `os`/`cpu`/`libc` constraints match the install host; bin/net-deck.js resolves whichever landed at runtime and execs the bundled binary.",
29
+ "optionalDependencies": {
30
+ "@net-mesh/deck-linux-x64-gnu": "0.19.0",
31
+ "@net-mesh/deck-linux-x64-musl": "0.19.0",
32
+ "@net-mesh/deck-linux-arm64-gnu": "0.19.0",
33
+ "@net-mesh/deck-linux-arm64-musl": "0.19.0",
34
+ "@net-mesh/deck-darwin-x64": "0.19.0",
35
+ "@net-mesh/deck-darwin-arm64": "0.19.0",
36
+ "@net-mesh/deck-win32-x64": "0.19.0",
37
+ "@net-mesh/deck-win32-arm64": "0.19.0"
38
+ }
39
+ }