prospector/scripts/stop.sh
Natalie c8eb57108f feat(install): tray app + MCP step + detached run; fix local prod token proxy
./run install now also builds the Prospector.app menu-bar tray (~/Applications:
❖ Open/Stop/Quit, AppleScript-ObjC + sips/iconutil, no Swift/deps) and registers
the prospector MCP in Claude (Desktop + global, non-invasive). New ./run stop and
./run tray; SKIP_DB/SKIP_TRAY/SKIP_MCP escape hatches.

app.sh: --detach (background, for the tray), reuse an already-running instance
instead of colliding, fail loudly if a process we started dies, pidfile in .run/.

Fix the local front door: a prod build calls /prospector/* (api.ts API_BASE), so
vite preview now proxies /prospector (passthrough) while dev keeps /api (rewrite),
both injecting the bearer token. find_psql handles keg-only postgresql@N.

Verified end-to-end: ./run install (deps/env/DB+5 migrations/build/tray/MCP),
./run app serves markets through the token proxy (200; 401 without token), tray
launches resident, web tsc + 160 backend tests green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-29 08:49:53 -04:00

23 lines
657 B
Bash
Executable file

#!/usr/bin/env bash
# Stop the detached prospector app started by app.sh. Kills only the PIDs we
# recorded in .run/app.pids — never a blanket node kill.
#
# scripts/stop.sh stop API + web front door
# ./run stop (preferred entrypoint)
set -euo pipefail
. "$(dirname "${BASH_SOURCE[0]}")/lib.sh"
PIDFILE="$REPO_ROOT/.run/app.pids"
[[ -f "$PIDFILE" ]] || { ok "nothing to stop (no $PIDFILE)"; exit 0; }
stopped=0
while read -r pid; do
[[ -n "$pid" ]] || continue
if kill -0 "$pid" 2>/dev/null; then
kill "$pid" 2>/dev/null && stopped=$((stopped + 1))
fi
done < "$PIDFILE"
rm -f "$PIDFILE"
ok "stopped $stopped process(es)"