hyperstack-cli 0.3.10 → 0.3.11

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/hs.js +24 -2
  2. package/package.json +1 -1
package/bin/hs.js CHANGED
@@ -5,9 +5,31 @@ const path = require("path");
5
5
  const fs = require("fs");
6
6
 
7
7
  const binName = process.platform === "win32" ? "hs.exe" : "hs";
8
- const binPath = path.join(__dirname, binName);
8
+ const localBinPath = path.join(__dirname, binName);
9
9
 
10
- if (!fs.existsSync(binPath)) {
10
+ // Try local binary first, then fall back to PATH
11
+ function getBinaryPath() {
12
+ // 1. Check for bundled binary (npm postinstall)
13
+ if (fs.existsSync(localBinPath)) {
14
+ return localBinPath;
15
+ }
16
+
17
+ // 2. Check system PATH (cargo install, manual install)
18
+ const whichCmd = process.platform === "win32" ? "where" : "which";
19
+ const result = spawnSync(whichCmd, ["hs"], { encoding: "utf8" });
20
+ if (result.status === 0 && result.stdout) {
21
+ const systemBin = result.stdout.trim().split("\n")[0];
22
+ if (fs.existsSync(systemBin)) {
23
+ return systemBin;
24
+ }
25
+ }
26
+
27
+ return null;
28
+ }
29
+
30
+ const binPath = getBinaryPath();
31
+
32
+ if (!binPath) {
11
33
  console.error(
12
34
  "Hyperstack CLI binary not found. This usually means the postinstall script failed.\n" +
13
35
  "Try reinstalling: npm install hyperstack-cli\n" +
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hyperstack-cli",
3
- "version": "0.3.10",
3
+ "version": "0.3.11",
4
4
  "description": "Hyperstack CLI - Real-time Solana streaming pipelines",
5
5
  "bin": {
6
6
  "hs": "./bin/hs.js",