3688d732c0
Memind CI / Test, build, and release guards (push) Successful in 6m43s
Add prod runner and LaunchAgent installer so Tang chatBridge toggle can reach a live OpenAI-compatible bridge after env enablement. Co-authored-by: Cursor <cursoragent@cursor.com>
73 lines
1.9 KiB
Bash
Executable File
73 lines
1.9 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
NODE_BIN="${NODE_BIN:-/opt/homebrew/opt/node@24/bin/node}"
|
|
RUNNER="${ROOT}/scripts/run-cursor-chat-bridge-prod.sh"
|
|
LABEL="${MEMIND_CURSOR_CHAT_BRIDGE_LABEL:-cn.tkmind.cursor-chat-bridge}"
|
|
PLIST="$HOME/Library/LaunchAgents/${LABEL}.plist"
|
|
LOG="$HOME/Library/Logs/memind-cursor-chat-bridge.log"
|
|
GUI="gui/$(id -u)"
|
|
PORT="${MEMIND_CURSOR_CHAT_BRIDGE_PORT:-18040}"
|
|
|
|
mkdir -p "$HOME/Library/LaunchAgents" "$HOME/Library/Logs"
|
|
|
|
if [[ ! -x "$NODE_BIN" ]]; then
|
|
NODE_BIN="$(command -v node)"
|
|
fi
|
|
if [[ ! -f "$RUNNER" ]]; then
|
|
echo "cursor chat bridge runner not found: $RUNNER" >&2
|
|
exit 1
|
|
fi
|
|
chmod +x "$RUNNER"
|
|
|
|
cat > "$PLIST" <<EOF
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
<plist version="1.0">
|
|
<dict>
|
|
<key>Label</key>
|
|
<string>$LABEL</string>
|
|
<key>ProgramArguments</key>
|
|
<array>
|
|
<string>/bin/bash</string>
|
|
<string>$RUNNER</string>
|
|
</array>
|
|
<key>WorkingDirectory</key>
|
|
<string>$ROOT</string>
|
|
<key>RunAtLoad</key>
|
|
<true/>
|
|
<key>KeepAlive</key>
|
|
<true/>
|
|
<key>ThrottleInterval</key>
|
|
<integer>10</integer>
|
|
<key>StandardOutPath</key>
|
|
<string>$LOG</string>
|
|
<key>StandardErrorPath</key>
|
|
<string>$LOG</string>
|
|
<key>EnvironmentVariables</key>
|
|
<dict>
|
|
<key>PATH</key>
|
|
<string>/opt/homebrew/bin:/opt/homebrew/opt/node@24/bin:/usr/local/bin:/usr/bin:/bin</string>
|
|
<key>MEMIND_CURSOR_CHAT_BRIDGE_ENABLED</key>
|
|
<string>1</string>
|
|
<key>MEMIND_CURSOR_CHAT_BRIDGE_ENTRYPOINT</key>
|
|
<string>1</string>
|
|
<key>MEMIND_CURSOR_CHAT_BRIDGE_PORT</key>
|
|
<string>$PORT</string>
|
|
</dict>
|
|
</dict>
|
|
</plist>
|
|
EOF
|
|
|
|
plutil -lint "$PLIST"
|
|
launchctl bootout "$GUI/$LABEL" 2>/dev/null || true
|
|
launchctl bootstrap "$GUI" "$PLIST"
|
|
launchctl enable "$GUI/$LABEL"
|
|
launchctl kickstart -k "$GUI/$LABEL"
|
|
|
|
echo "installed $PLIST"
|
|
echo "runner: $RUNNER"
|
|
echo "port: $PORT"
|
|
echo "log: $LOG"
|