@hlix/cli 0.7.0 → 0.7.2

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
@@ -30,7 +30,9 @@ the workspace the credential names pays for the coder, and `/model` offers only
30
30
  the models that workspace serves. In a `local` or `docker` sandbox you may add
31
31
  endpoints of your own — see **Your own model endpoints** below.
32
32
 
33
- Requires Node.js 22.19 or newer.
33
+ The npm package requires Node.js 22.19 or newer. The Homebrew install
34
+ (`brew install hlix-ai/tap/hlix`) is one self-contained executable and needs
35
+ no Node.js.
34
36
 
35
37
  ## Install
36
38
 
@@ -40,12 +42,20 @@ hlix --help # the commands
40
42
  hlix # open Hlix Code
41
43
  ```
42
44
 
45
+ `hlix` runs as one self-contained executable: npm installs the one for your
46
+ platform (`@hlix/cli-darwin-arm64`, `-darwin-x64`, `-linux-x64` or
47
+ `-linux-arm64`) and `hlix` runs it directly. Where there is none (Windows,
48
+ musl-based Linux, `--omit=optional`) the Node build in this package runs
49
+ instead, after one line on stderr. Without npm,
50
+ `curl -fsSL https://staging.hlix.ai/install.sh | bash` installs the same
51
+ executable, and so does `brew install hlix-ai/tap/hlix`.
52
+
43
53
  For CI, and for anything else that must not change underneath you, pin the
44
54
  version instead of floating to `latest`:
45
55
 
46
56
  ```bash
47
- npm install --global @hlix/cli@0.7.0
48
- npx @hlix/cli@0.7.0 status --json
57
+ npm install --global @hlix/cli@0.7.2
58
+ npx @hlix/cli@0.7.2 status --json
49
59
  ```
50
60
 
51
61
  ## Authenticate
package/bin/hlix ADDED
@@ -0,0 +1,37 @@
1
+ #!/usr/bin/env node
2
+ // `hlix` as npm installs it. After a normal install the postinstall
3
+ // (install.cjs) has replaced this file with the standalone binary itself, so
4
+ // this only runs when that did not happen: scripts off (--ignore-scripts, pnpm)
5
+ // runs the platform package's binary from here; no platform package
6
+ // (--omit=optional, an unsupported platform) runs the Node build, after one line.
7
+ import { spawn } from "node:child_process"
8
+ import { createRequire } from "node:module"
9
+ import { fileURLToPath } from "node:url"
10
+
11
+ const { nativeBinary } = createRequire(import.meta.url)("../install.cjs")
12
+ const found = nativeBinary()
13
+ let command = found.binary
14
+ let args = process.argv.slice(2)
15
+ if (!command) {
16
+ process.stderr.write(`hlix: using the Node build (${found.reason})\n`)
17
+ command = process.execPath
18
+ args = [fileURLToPath(new URL("../dist/index.js", import.meta.url)), ...args]
19
+ }
20
+
21
+ // This copy is the one a person installed; the binary runs from the platform
22
+ // package, so it is told which path to report (hlix status).
23
+ const child = spawn(command, args, { stdio: "inherit", env: { ...process.env, HLIX_SELF: process.argv[1] } })
24
+ // The terminal signals the whole process group; a signal sent to this
25
+ // process alone (a supervisor, `kill`) is passed on instead of orphaning it.
26
+ const forward = (signal) => child.kill(signal)
27
+ const signals = ["SIGINT", "SIGTERM", "SIGHUP"]
28
+ for (const signal of signals) process.on(signal, forward)
29
+ child.on("error", (error) => {
30
+ process.stderr.write(`hlix: ${command}: ${error.message}\n`)
31
+ process.exit(1)
32
+ })
33
+ child.on("exit", (code, signal) => {
34
+ for (const name of signals) process.off(name, forward)
35
+ if (signal) process.kill(process.pid, signal)
36
+ else process.exit(code ?? 1)
37
+ })