fix: make systemd service portable across machines

- Add start-proxy.sh wrapper that handles nvm/fnm/volta/asdf
- Add install-service.sh for one-command installation
- Remove hardcoded node version paths from service file
This commit is contained in:
2026-02-01 20:12:56 +01:00
parent 5deb0b0754
commit 1050b96d2a
3 changed files with 90 additions and 7 deletions

49
docs/start-proxy.sh Executable file
View File

@@ -0,0 +1,49 @@
#!/bin/bash
# Wrapper script for antigravity-claude-proxy that handles various Node.js version managers
# Used by the systemd service to ensure node is available in PATH
set -e
# Try nvm
if [ -z "$NVM_DIR" ]; then
export NVM_DIR="$HOME/.nvm"
fi
if [ -s "$NVM_DIR/nvm.sh" ]; then
source "$NVM_DIR/nvm.sh"
fi
# Try fnm
if command -v fnm &> /dev/null; then
eval "$(fnm env)"
elif [ -d "$HOME/.fnm" ]; then
export PATH="$HOME/.fnm:$PATH"
eval "$(fnm env 2>/dev/null)" || true
fi
# Try volta
if [ -d "$HOME/.volta" ]; then
export VOLTA_HOME="$HOME/.volta"
export PATH="$VOLTA_HOME/bin:$PATH"
fi
# Try asdf
if [ -s "$HOME/.asdf/asdf.sh" ]; then
source "$HOME/.asdf/asdf.sh"
fi
# Verify node is available
if ! command -v node &> /dev/null; then
echo "Error: node not found in PATH after sourcing version managers" >&2
echo "PATH: $PATH" >&2
exit 1
fi
# Verify antigravity-claude-proxy is available
if ! command -v antigravity-claude-proxy &> /dev/null; then
echo "Error: antigravity-claude-proxy not found in PATH" >&2
echo "Install with: npm install -g antigravity-claude-proxy" >&2
echo "PATH: $PATH" >&2
exit 1
fi
exec antigravity-claude-proxy "$@"