summaryrefslogtreecommitdiff
path: root/lib/brainstorm-server/stop-server.sh
diff options
context:
space:
mode:
authorJesse Vincent <jesse@fsck.com>2026-03-09 15:35:02 -0700
committerJesse Vincent <jesse@fsck.com>2026-03-09 15:35:02 -0700
commit133a0a80c65c9f71206e31a08511fab1869354f2 (patch)
treeb658a1b53fb78d962a3a78bd941e0dd14715853f /lib/brainstorm-server/stop-server.sh
parentd2d6cf485286ca9af69b84557e4da4c1d83a58e0 (diff)
parent57b346ddbcd338334e7598089f93f7340ac42d58 (diff)
Merge dev-reorder10: Release v5.0.0v5.0.0
Diffstat (limited to 'lib/brainstorm-server/stop-server.sh')
-rwxr-xr-xlib/brainstorm-server/stop-server.sh31
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/brainstorm-server/stop-server.sh b/lib/brainstorm-server/stop-server.sh
new file mode 100755
index 0000000..c3724de
--- /dev/null
+++ b/lib/brainstorm-server/stop-server.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+# Stop the brainstorm server and clean up
+# Usage: stop-server.sh <screen_dir>
+#
+# Kills the server process. Only deletes session directory if it's
+# under /tmp (ephemeral). Persistent directories (.superpowers/) are
+# kept so mockups can be reviewed later.
+
+SCREEN_DIR="$1"
+
+if [[ -z "$SCREEN_DIR" ]]; then
+ echo '{"error": "Usage: stop-server.sh <screen_dir>"}'
+ exit 1
+fi
+
+PID_FILE="${SCREEN_DIR}/.server.pid"
+
+if [[ -f "$PID_FILE" ]]; then
+ pid=$(cat "$PID_FILE")
+ kill "$pid" 2>/dev/null
+ rm -f "$PID_FILE" "${SCREEN_DIR}/.server.log"
+
+ # Only delete ephemeral /tmp directories
+ if [[ "$SCREEN_DIR" == /tmp/* ]]; then
+ rm -rf "$SCREEN_DIR"
+ fi
+
+ echo '{"status": "stopped"}'
+else
+ echo '{"status": "not_running"}'
+fi