niahere 0.2.4 → 0.2.6

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/nia +29 -13
  2. package/package.json +1 -1
package/bin/nia CHANGED
@@ -1,17 +1,28 @@
1
1
  #!/bin/sh
2
- if ! command -v bun >/dev/null 2>&1; then
2
+
3
+ # Check if bun is available (including ~/.bun/bin which may not be in PATH yet)
4
+ BUN_CMD=""
5
+ if command -v bun >/dev/null 2>&1; then
6
+ BUN_CMD="bun"
7
+ elif [ -x "$HOME/.bun/bin/bun" ]; then
8
+ BUN_CMD="$HOME/.bun/bin/bun"
9
+ fi
10
+
11
+ if [ -z "$BUN_CMD" ]; then
3
12
  echo "niahere requires Bun runtime."
4
13
  printf "Install Bun now? (y/n) "
5
14
  read -r answer
6
15
  if [ "$answer" = "y" ] || [ "$answer" = "Y" ]; then
7
16
  curl -fsSL https://bun.sh/install | bash
8
- export BUN_INSTALL="$HOME/.bun"
9
- export PATH="$BUN_INSTALL/bin:$PATH"
10
- if ! command -v bun >/dev/null 2>&1; then
17
+ BUN_CMD="$HOME/.bun/bin/bun"
18
+ if [ ! -x "$BUN_CMD" ]; then
11
19
  echo "Bun install failed. Install manually: curl -fsSL https://bun.sh/install | bash"
12
20
  exit 1
13
21
  fi
22
+ echo ""
14
23
  echo "Bun installed. Continuing..."
24
+ echo "(Open a new terminal for bun to be in PATH permanently)"
25
+ echo ""
15
26
  else
16
27
  echo ""
17
28
  echo "Install manually: curl -fsSL https://bun.sh/install | bash"
@@ -20,13 +31,18 @@ if ! command -v bun >/dev/null 2>&1; then
20
31
  fi
21
32
  fi
22
33
 
23
- # Resolve symlink to find the actual package directory
24
- SCRIPT="$0"
25
- while [ -L "$SCRIPT" ]; do
26
- DIR="$(cd "$(dirname "$SCRIPT")" && pwd)"
27
- SCRIPT="$(readlink "$SCRIPT")"
28
- case "$SCRIPT" in /*) ;; *) SCRIPT="$DIR/$SCRIPT" ;; esac
29
- done
30
- PACKAGE_DIR="$(cd "$(dirname "$SCRIPT")/.." && pwd)"
34
+ # Resolve the real path of this script (follows symlinks)
35
+ REAL="$(realpath "$0" 2>/dev/null)" || REAL="$0"
36
+ PACKAGE_DIR="$(dirname "$REAL")/.."
37
+ ENTRY="$PACKAGE_DIR/src/cli/index.ts"
38
+
39
+ if [ ! -f "$ENTRY" ]; then
40
+ ENTRY="$(npm root -g 2>/dev/null)/niahere/src/cli/index.ts"
41
+ fi
42
+
43
+ if [ ! -f "$ENTRY" ]; then
44
+ echo "Error: could not find niahere. Try: npm i -g niahere"
45
+ exit 1
46
+ fi
31
47
 
32
- exec bun "$PACKAGE_DIR/src/cli/index.ts" "$@"
48
+ exec "$BUN_CMD" "$ENTRY" "$@"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "niahere",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
4
4
  "description": "A personal AI assistant daemon — scheduled jobs, chat across Telegram and Slack, persona system, and visual identity.",
5
5
  "type": "module",
6
6
  "scripts": {