herm-tui 1.6.0-dev.4 → 1.6.0-dev.5
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/bin/herm.cjs +62 -0
- package/package.json +2 -2
package/bin/herm.cjs
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Launcher shim: locate a bun runtime and exec dist/index.js under it.
|
|
3
|
+
// Node shebang so npm's cmd-shim generates a .ps1 that invokes node.exe,
|
|
4
|
+
// which is always resolvable (npm itself is running under it). A bun
|
|
5
|
+
// shebang produces a .ps1 that looks for a literal bun.exe in PATH and
|
|
6
|
+
// fails when bun was installed via `npm i -g bun` (npm/cmd-shim#95).
|
|
7
|
+
|
|
8
|
+
const cp = require("child_process")
|
|
9
|
+
const fs = require("fs")
|
|
10
|
+
const path = require("path")
|
|
11
|
+
|
|
12
|
+
const win = process.platform === "win32"
|
|
13
|
+
const exe = win ? "bun.exe" : "bun"
|
|
14
|
+
const here = path.dirname(fs.realpathSync(__filename))
|
|
15
|
+
const entry = [path.join(here, "..", "index.js"), path.join(here, "..", "dist", "index.js")]
|
|
16
|
+
.find(fs.existsSync) ?? path.join(here, "..", "src", "index.tsx")
|
|
17
|
+
|
|
18
|
+
function walk(dir, rel) {
|
|
19
|
+
for (;;) {
|
|
20
|
+
const p = path.join(dir, "node_modules", ...rel)
|
|
21
|
+
if (fs.existsSync(p)) return p
|
|
22
|
+
const up = path.dirname(dir)
|
|
23
|
+
if (up === dir) return null
|
|
24
|
+
dir = up
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// BUN_INSTALL (official installer) → node_modules/bun (npm -g bun sibling)
|
|
29
|
+
// → node_modules/.bin (pm-local) → PATH.
|
|
30
|
+
const bun = (() => {
|
|
31
|
+
if (process.env.HERM_BUN) return process.env.HERM_BUN
|
|
32
|
+
const inst = process.env.BUN_INSTALL
|
|
33
|
+
if (inst) {
|
|
34
|
+
const p = path.join(inst, "bin", exe)
|
|
35
|
+
if (fs.existsSync(p)) return p
|
|
36
|
+
}
|
|
37
|
+
return walk(here, ["bun", "bin", exe])
|
|
38
|
+
?? walk(here, [".bin", win ? "bun.cmd" : "bun"])
|
|
39
|
+
?? "bun"
|
|
40
|
+
})()
|
|
41
|
+
|
|
42
|
+
const child = cp.spawn(bun, [entry, ...process.argv.slice(2)], {
|
|
43
|
+
stdio: "inherit",
|
|
44
|
+
shell: win && bun.endsWith(".cmd"),
|
|
45
|
+
})
|
|
46
|
+
child.on("error", (e) => {
|
|
47
|
+
if (e.code === "ENOENT") {
|
|
48
|
+
console.error("herm: bun runtime not found.")
|
|
49
|
+
console.error(win
|
|
50
|
+
? ' install: powershell -c "irm bun.sh/install.ps1 | iex"'
|
|
51
|
+
: " install: curl -fsSL https://bun.sh/install | bash")
|
|
52
|
+
} else {
|
|
53
|
+
console.error(e.message)
|
|
54
|
+
}
|
|
55
|
+
process.exit(1)
|
|
56
|
+
})
|
|
57
|
+
for (const sig of ["SIGINT", "SIGTERM", "SIGHUP"])
|
|
58
|
+
process.on(sig, () => { try { child.kill(sig) } catch {} })
|
|
59
|
+
child.on("exit", (code, sig) => {
|
|
60
|
+
if (sig) return process.kill(process.pid, sig)
|
|
61
|
+
process.exit(code ?? 0)
|
|
62
|
+
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "herm-tui",
|
|
3
|
-
"version": "1.6.0-dev.
|
|
3
|
+
"version": "1.6.0-dev.5",
|
|
4
4
|
"description": "A modern TUI for Hermes Agent",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"provenance": true
|
|
20
20
|
},
|
|
21
21
|
"bin": {
|
|
22
|
-
"herm": "
|
|
22
|
+
"herm": "bin/herm.cjs"
|
|
23
23
|
},
|
|
24
24
|
"optionalDependencies": {
|
|
25
25
|
"@opentui/core-darwin-arm64": "0.2.2",
|