fix: detect both openclaw and openclaw.mjs binary names in gateway discovery
find_openclaw() only searched for openclaw.mjs, missing systems where the binary is named just "openclaw" (e.g., npm install -g openclaw). Now checks both names in PATH and in hardcoded paths. Added run_openclaw() helper that invokes via node for .mjs files and directly for standalone binaries. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+22
-9
@@ -484,18 +484,22 @@ install_uv() {
|
|||||||
OPENCLAW_PATH=""
|
OPENCLAW_PATH=""
|
||||||
|
|
||||||
find_openclaw() {
|
find_openclaw() {
|
||||||
# Try PATH first
|
# Try PATH first — check both "openclaw" and "openclaw.mjs" binary names
|
||||||
if command -v openclaw.mjs &>/dev/null; then
|
for bin_name in openclaw openclaw.mjs; do
|
||||||
OPENCLAW_PATH="$(command -v openclaw.mjs)"
|
if command -v "$bin_name" &>/dev/null; then
|
||||||
return 0
|
OPENCLAW_PATH="$(command -v "$bin_name")"
|
||||||
fi
|
return 0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
# Check common installation paths
|
# Check common installation paths
|
||||||
local -a openclaw_paths=(
|
local -a openclaw_paths=(
|
||||||
"${HOME}/.openclaw/openclaw.mjs"
|
"${HOME}/.openclaw/openclaw.mjs"
|
||||||
"/usr/local/bin/openclaw.mjs"
|
"/usr/local/bin/openclaw.mjs"
|
||||||
|
"/usr/local/bin/openclaw"
|
||||||
"/usr/local/lib/node_modules/openclaw/openclaw.mjs"
|
"/usr/local/lib/node_modules/openclaw/openclaw.mjs"
|
||||||
"${HOME}/.npm-global/lib/node_modules/openclaw/openclaw.mjs"
|
"${HOME}/.npm-global/lib/node_modules/openclaw/openclaw.mjs"
|
||||||
|
"${HOME}/.npm-global/bin/openclaw"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Also check for node_modules in common project locations
|
# Also check for node_modules in common project locations
|
||||||
@@ -531,6 +535,15 @@ check_openclaw() {
|
|||||||
success "OpenClaw gateway found at ${OPENCLAW_PATH}"
|
success "OpenClaw gateway found at ${OPENCLAW_PATH}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Run openclaw command — uses node for .mjs files, direct execution otherwise
|
||||||
|
run_openclaw() {
|
||||||
|
if [[ "$OPENCLAW_PATH" == *.mjs ]]; then
|
||||||
|
node "$OPENCLAW_PATH" "$@"
|
||||||
|
else
|
||||||
|
"$OPENCLAW_PATH" "$@"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Plugin installation — clone, build, install, enable
|
# Plugin installation — clone, build, install, enable
|
||||||
# Flow based on openclaw/Dockerfile.e2e
|
# Flow based on openclaw/Dockerfile.e2e
|
||||||
@@ -585,17 +598,17 @@ install_plugin() {
|
|||||||
|
|
||||||
# Install the plugin using OpenClaw's CLI
|
# Install the plugin using OpenClaw's CLI
|
||||||
info "Installing claude-mem plugin into OpenClaw..."
|
info "Installing claude-mem plugin into OpenClaw..."
|
||||||
if ! node "$OPENCLAW_PATH" plugins install "$installable_dir" 2>&1; then
|
if ! run_openclaw plugins install "$installable_dir" 2>&1; then
|
||||||
error "Failed to install claude-mem plugin"
|
error "Failed to install claude-mem plugin"
|
||||||
error "Try manually: node ${OPENCLAW_PATH} plugins install <path>"
|
error "Try manually: ${OPENCLAW_PATH} plugins install <path>"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Enable the plugin
|
# Enable the plugin
|
||||||
info "Enabling claude-mem plugin..."
|
info "Enabling claude-mem plugin..."
|
||||||
if ! node "$OPENCLAW_PATH" plugins enable claude-mem 2>&1; then
|
if ! run_openclaw plugins enable claude-mem 2>&1; then
|
||||||
error "Failed to enable claude-mem plugin"
|
error "Failed to enable claude-mem plugin"
|
||||||
error "Try manually: node ${OPENCLAW_PATH} plugins enable claude-mem"
|
error "Try manually: ${OPENCLAW_PATH} plugins enable claude-mem"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user