From c84fae98048836642a65463b8530cc559bc15fe0 Mon Sep 17 00:00:00 2001 From: Jacob Mathison Date: Wed, 24 Jun 2026 15:52:27 -0500 Subject: [PATCH] fix(ci): find node during toolkit socket deploy --- scripts/deploy/restart-toolkit-socket.sh | 40 ++++++++++++++++++++++-- src/data/toolkit/changelog.json | 12 +++++++ 2 files changed, 50 insertions(+), 2 deletions(-) diff --git a/scripts/deploy/restart-toolkit-socket.sh b/scripts/deploy/restart-toolkit-socket.sh index 75e631c..32de296 100755 --- a/scripts/deploy/restart-toolkit-socket.sh +++ b/scripts/deploy/restart-toolkit-socket.sh @@ -9,8 +9,39 @@ pid_file="$repo_path/.toolkit-socket.pid" log_directory="$repo_path/logs" log_file="$log_directory/toolkit-socket.log" +find_executable() { + executable_name="$1" + + for executable_path in \ + "$executable_name" \ + "/opt/homebrew/bin/$executable_name" \ + "/usr/local/bin/$executable_name" \ + "/usr/bin/$executable_name" \ + "$HOME/.nvm/versions/node"/*"/bin/$executable_name"; do + if command -v "$executable_path" >/dev/null 2>&1; then + command -v "$executable_path" + return 0 + fi + + if [ -x "$executable_path" ]; then + printf '%s\n' "$executable_path" + return 0 + fi + done + + return 1 +} + cd "$repo_path" +node_bin="$(find_executable node || true)" +npm_bin="$(find_executable npm || true)" + +if [ -z "$node_bin" ]; then + echo "[deploy:toolkit] node was not found. Install Node or add it to a standard deploy PATH." + exit 1 +fi + if [ ! -f package.json ] || [ ! -f socket/server.mjs ]; then echo "[deploy:toolkit] $repo_path is not a Bone Kingdom repo checkout." exit 1 @@ -21,8 +52,13 @@ mkdir -p "$log_directory" \ "$repo_path/src/assets/music/uploads" if [ ! -d "$repo_path/node_modules/socket.io" ]; then + if [ -z "$npm_bin" ]; then + echo "[deploy:toolkit] npm was not found and dependencies are missing." + exit 1 + fi + echo "[deploy:toolkit] node_modules missing socket.io; installing workspace dependencies." - npm install --no-audit --no-fund + "$npm_bin" install --no-audit --no-fund fi if [ -f "$pid_file" ]; then @@ -41,7 +77,7 @@ echo "[deploy:toolkit] starting socket on $socket_host:$socket_port" TOOLKIT_SOCKET_HOST="$socket_host" \ TOOLKIT_SOCKET_PORT="$socket_port" \ TOOLKIT_SOCKET_CORS_ORIGIN="$socket_cors_origin" \ - nohup node socket/server.mjs >"$log_file" 2>&1 & + nohup "$node_bin" socket/server.mjs >"$log_file" 2>&1 & socket_pid="$!" printf '%s\n' "$socket_pid" > "$pid_file" diff --git a/src/data/toolkit/changelog.json b/src/data/toolkit/changelog.json index 3db7241..089f7b9 100644 --- a/src/data/toolkit/changelog.json +++ b/src/data/toolkit/changelog.json @@ -11,6 +11,18 @@ "Validated Gitea API reachability from inside the Kubernetes namespace." ] }, + { + "id": "woodpecker-toolkit-socket-node-path", + "version": "0.0.5-20260624-local", + "createdAt": "2026-06-24", + "title": "Woodpecker Toolkit Socket Node Path", + "summary": "Fixed deployed Toolkit socket restarts when SSH sessions do not load the user's Node path.", + "changes": [ + "Updated the Toolkit socket restart script to find Node and npm from standard macOS, Homebrew, and NVM locations.", + "Kept the restart command safe for non-interactive SSH deploy sessions.", + "Preserved the shared workspace socket behavior for deployed Toolkit editing." + ] + }, { "id": "deployed-toolkit-socket-workspace", "version": "0.0.5-20260624-local",