pocketshell 0.0.0 → 1.0.3

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/README.md ADDED
@@ -0,0 +1,19 @@
1
+ # pocketshell
2
+
3
+ Secure mobile-to-host terminal access. This npm package installs the
4
+ `pocketshell` host-agent CLI as a prebuilt binary.
5
+
6
+ ```sh
7
+ npm i -g pocketshell
8
+ pocketshell pair
9
+ pocketshell daemon start
10
+ ```
11
+
12
+ The binary itself ships in one of four platform-specific packages
13
+ (`@pocketshell/darwin-arm64`, `@pocketshell/linux-x64-gnu`,
14
+ `@pocketshell/linux-arm64-gnu`, `@pocketshell/linux-x64-musl`) and is
15
+ selected automatically via npm's `os` / `cpu` / `libc` filtering on
16
+ `optionalDependencies`.
17
+
18
+ For the curl-based installer (with Sigstore signature verification) and
19
+ full docs, see https://pocketshell.app.
@@ -0,0 +1,74 @@
1
+ #!/usr/bin/env node
2
+ // Thin Node shim. The real `pocketshell` binary ships inside one of the
3
+ // platform-specific @pocketshell/<triple> packages, declared as
4
+ // optionalDependencies. npm installs only the package whose os/cpu/libc
5
+ // matches the user's machine, so by the time this shim runs, exactly one
6
+ // of them is present on disk. We resolve its location and exec the binary
7
+ // with the user's argv.
8
+ //
9
+ // Runtime libc detection (musl vs glibc on Linux) mirrors npm's own
10
+ // optional-dep filtering, so the package chosen here always matches what
11
+ // npm actually installed.
12
+
13
+ 'use strict';
14
+
15
+ const { spawnSync } = require('child_process');
16
+ const path = require('path');
17
+ const fs = require('fs');
18
+
19
+ function detectLinuxLibc() {
20
+ try {
21
+ if (fs.existsSync('/etc/alpine-release')) return 'musl';
22
+ if (
23
+ fs.existsSync('/lib/ld-musl-x86_64.so.1') ||
24
+ fs.existsSync('/lib/ld-musl-aarch64.so.1')
25
+ ) {
26
+ return 'musl';
27
+ }
28
+ } catch (_) {}
29
+ return 'gnu';
30
+ }
31
+
32
+ function resolvePackageName() {
33
+ const { platform, arch } = process;
34
+ if (platform === 'darwin' && arch === 'arm64') return '@pocketshell/darwin-arm64';
35
+ if (platform === 'linux' && arch === 'arm64') return '@pocketshell/linux-arm64-gnu';
36
+ if (platform === 'linux' && arch === 'x64') {
37
+ return detectLinuxLibc() === 'musl'
38
+ ? '@pocketshell/linux-x64-musl'
39
+ : '@pocketshell/linux-x64-gnu';
40
+ }
41
+ return null;
42
+ }
43
+
44
+ const pkgName = resolvePackageName();
45
+ if (!pkgName) {
46
+ console.error(
47
+ `pocketshell: no prebuilt binary for ${process.platform}/${process.arch}.\n` +
48
+ `Supported: darwin/arm64, linux/x64 (gnu+musl), linux/arm64.\n` +
49
+ `See https://pocketshell.app for manual install options.`
50
+ );
51
+ process.exit(1);
52
+ }
53
+
54
+ let pkgRoot;
55
+ try {
56
+ pkgRoot = path.dirname(require.resolve(`${pkgName}/package.json`));
57
+ } catch (_) {
58
+ console.error(
59
+ `pocketshell: platform package ${pkgName} is not installed.\n` +
60
+ `This usually means npm skipped optional dependencies ` +
61
+ `(e.g. --no-optional / --omit=optional).\n` +
62
+ `Reinstall with: npm i -g pocketshell`
63
+ );
64
+ process.exit(1);
65
+ }
66
+
67
+ const binPath = path.join(pkgRoot, 'bin', 'pocketshell');
68
+ const result = spawnSync(binPath, process.argv.slice(2), { stdio: 'inherit' });
69
+
70
+ if (result.error) {
71
+ console.error(`pocketshell: failed to launch binary: ${result.error.message}`);
72
+ process.exit(1);
73
+ }
74
+ process.exit(result.status == null ? 1 : result.status);
package/package.json CHANGED
@@ -1,6 +1,26 @@
1
1
  {
2
2
  "name": "pocketshell",
3
- "version": "0.0.0",
4
- "description": "Placeholder for trusted-publishing bootstrap. See https://pocketshell.app",
5
- "license": "Apache-2.0"
3
+ "version": "1.0.3",
4
+ "description": "Secure mobile-to-host terminal access — installs the pocketshell host-agent CLI.",
5
+ "homepage": "https://pocketshell.app",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/yashagldit/PocketShell"
9
+ },
10
+ "license": "Apache-2.0",
11
+ "bin": {
12
+ "pocketshell": "bin/pocketshell.js"
13
+ },
14
+ "files": [
15
+ "bin/"
16
+ ],
17
+ "engines": {
18
+ "node": ">=14"
19
+ },
20
+ "optionalDependencies": {
21
+ "@pocketshell/darwin-arm64": "1.0.3",
22
+ "@pocketshell/linux-x64-gnu": "1.0.3",
23
+ "@pocketshell/linux-arm64-gnu": "1.0.3",
24
+ "@pocketshell/linux-x64-musl": "1.0.3"
25
+ }
6
26
  }