localhand 0.0.1 → 0.2.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/README.md CHANGED
@@ -2,4 +2,6 @@
2
2
 
3
3
  A steady hand on your local machine.
4
4
 
5
+ npx localhand
6
+
5
7
  https://localhand.dev
package/bin/localhand.js CHANGED
@@ -1,2 +1,33 @@
1
1
  #!/usr/bin/env node
2
- console.log('localhand is not available yet. See https://localhand.dev');
2
+ // Runs the agent binary from this platform's package (installed by npm as an optional dependency).
3
+ // Filled in at packaging time: NAME (the command and package name) and DISPLAY.
4
+ 'use strict';
5
+ const { spawnSync } = require('child_process');
6
+
7
+ const NAME = 'localhand';
8
+ const DISPLAY = 'localhand';
9
+ const SUPPORTED = { 'linux-x64': `@${NAME}/linux-x64` };
10
+
11
+ const platform = `${process.platform}-${process.arch}`;
12
+ const pkg = SUPPORTED[platform];
13
+ if (!pkg) {
14
+ console.error(`${DISPLAY} isn't available for ${platform} yet. Supported: ${Object.keys(SUPPORTED).join(', ')}.`);
15
+ process.exit(1);
16
+ }
17
+
18
+ let binary;
19
+ try {
20
+ binary = require.resolve(`${pkg}/bin/${NAME}`);
21
+ } catch {
22
+ console.error(`${DISPLAY}'s ${platform} package is missing. Reinstall (npx ${NAME}@latest), and check that optional dependencies aren't disabled.`);
23
+ process.exit(1);
24
+ }
25
+
26
+ // The terminal is passed straight through: the agent takes it over (raw mode) and gives it back.
27
+ const result = spawnSync(binary, process.argv.slice(2), { stdio: 'inherit' });
28
+ if (result.error) {
29
+ console.error(`Couldn't start ${DISPLAY}: ${result.error.message}`);
30
+ process.exit(1);
31
+ }
32
+ if (result.signal) process.kill(process.pid, result.signal);
33
+ process.exit(result.status ?? 1);
package/package.json CHANGED
@@ -1,9 +1,11 @@
1
1
  {
2
2
  "name": "localhand",
3
- "version": "0.0.1",
3
+ "version": "0.2.1",
4
4
  "description": "A steady hand on your local machine.",
5
5
  "homepage": "https://localhand.dev",
6
6
  "license": "UNLICENSED",
7
7
  "bin": { "localhand": "bin/localhand.js" },
8
- "files": ["bin"]
8
+ "files": ["bin"],
9
+ "engines": { "node": ">=16" },
10
+ "optionalDependencies": { "@localhand/linux-x64": "0.2.1" }
9
11
  }