843e4d1002
Memind CI / Test, build, and release guards (push) Successful in 2m58s
Prevent duplicate active scheduled tasks, fail static preparing contracts when HTML is missing, raise MindSpace remote timeout default to 30s, and add 103 repair scripts for inspection follow-ups. Co-authored-by: Cursor <cursoragent@cursor.com>
53 lines
1.8 KiB
Bash
Executable File
53 lines
1.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
ROOT="${GOOSED_NATIVE_ROOT:-/Users/john/Project/tkmind_go-native}"
|
|
LAUNCHD_DIR="${HOME}/Library/LaunchAgents"
|
|
GUI="gui/$(id -u)"
|
|
PATH_EXPORT='export PATH="/opt/homebrew/opt/node@24/bin:/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin"'
|
|
|
|
log() { printf '[repair-goosed-harness-path] %s\n' "$*"; }
|
|
|
|
patch_run_script() {
|
|
local script="${ROOT}/run-goosed-native.sh"
|
|
[[ -f "${script}" ]] || { log "missing ${script}"; exit 1; }
|
|
if grep -q 'opt/homebrew/opt/node@24/bin' "${script}"; then
|
|
log "run-goosed-native.sh already exports node PATH"
|
|
return 0
|
|
fi
|
|
cp "${script}" "${script}.bak-inspection-$(date +%Y%m%d-%H%M%S)"
|
|
awk -v path_line="${PATH_EXPORT}" '
|
|
/^set -euo pipefail$/ {
|
|
print
|
|
print path_line
|
|
next
|
|
}
|
|
{ print }
|
|
' "${script}" > "${script}.tmp"
|
|
mv "${script}.tmp" "${script}"
|
|
chmod +x "${script}"
|
|
log "patched ${script}"
|
|
}
|
|
|
|
patch_launchd_plist() {
|
|
local port="$1"
|
|
local plist="${LAUNCHD_DIR}/cn.tkmind.goosed-native-${port}.plist"
|
|
[[ -f "${plist}" ]] || return 0
|
|
if plutil -extract EnvironmentVariables raw "${plist}" >/dev/null 2>&1; then
|
|
plutil -replace EnvironmentVariables.PATH -string "/opt/homebrew/opt/node@24/bin:/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin" "${plist}"
|
|
else
|
|
plutil -insert EnvironmentVariables -dictionary "${plist}"
|
|
plutil -insert EnvironmentVariables.PATH -string "/opt/homebrew/opt/node@24/bin:/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin" "${plist}"
|
|
fi
|
|
launchctl bootout "${GUI}/cn.tkmind.goosed-native-${port}" 2>/dev/null || true
|
|
launchctl bootstrap "${GUI}" "${plist}"
|
|
log "reloaded ${plist}"
|
|
}
|
|
|
|
patch_run_script
|
|
for port in 18006 18007 18008 18009 18010 18011 18012 18013 18014; do
|
|
patch_launchd_plist "${port}"
|
|
done
|
|
|
|
log "done"
|