Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions Packs/pai-observability-server/src/Observability/manage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,20 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Ensure bun is in PATH (for apps launched from macOS)
export PATH="$HOME/.bun/bin:/opt/homebrew/bin:/usr/local/bin:$PATH"

# Auto-install dependencies if missing (check for specific binaries, not just dirs)
install_deps_if_needed() {
# Server needs typescript
if [ ! -f "$SCRIPT_DIR/apps/server/node_modules/.bin/tsc" ]; then
echo "📦 Installing server dependencies..."
(cd "$SCRIPT_DIR/apps/server" && bun install)
fi
# Client needs vite
if [ ! -f "$SCRIPT_DIR/apps/client/node_modules/.bin/vite" ]; then
echo "📦 Installing client dependencies..."
(cd "$SCRIPT_DIR/apps/client" && bun install)
fi
}

case "${1:-}" in
start)
# Check if already running
Expand All @@ -15,6 +29,9 @@ case "${1:-}" in
exit 1
fi

# Install dependencies if needed
install_deps_if_needed

# Start server (silent)
cd "$SCRIPT_DIR/apps/server"
bun run dev >/dev/null 2>&1 &
Expand Down Expand Up @@ -92,6 +109,9 @@ case "${1:-}" in
exit 1
fi

# Install dependencies if needed
install_deps_if_needed

# Start server detached (for menu bar app use)
cd "$SCRIPT_DIR/apps/server"
nohup bun run dev >/dev/null 2>&1 &
Expand Down