diff options
Diffstat (limited to 'skills/brainstorming/scripts')
| -rw-r--r-- | skills/brainstorming/scripts/server.js | 2 | ||||
| -rwxr-xr-x | skills/brainstorming/scripts/start-server.sh | 12 | ||||
| -rwxr-xr-x | skills/brainstorming/scripts/stop-server.sh | 28 |
3 files changed, 38 insertions, 4 deletions
diff --git a/skills/brainstorming/scripts/server.js b/skills/brainstorming/scripts/server.js index dec2f7a..86c3080 100644 --- a/skills/brainstorming/scripts/server.js +++ b/skills/brainstorming/scripts/server.js @@ -94,7 +94,7 @@ const WAITING_PAGE = `<!DOCTYPE html> h1 { color: #333; } p { color: #666; }</style> </head> <body><h1>Brainstorm Companion</h1> -<p>Waiting for Claude to push a screen...</p></body></html>`; +<p>Waiting for the agent to push a screen...</p></body></html>`; const frameTemplate = fs.readFileSync(path.join(__dirname, 'frame-template.html'), 'utf-8'); const helperScript = fs.readFileSync(path.join(__dirname, 'helper.js'), 'utf-8'); diff --git a/skills/brainstorming/scripts/start-server.sh b/skills/brainstorming/scripts/start-server.sh index b5f5a75..a60025c 100755 --- a/skills/brainstorming/scripts/start-server.sh +++ b/skills/brainstorming/scripts/start-server.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Start the brainstorm server and output connection info # Usage: start-server.sh [--project-dir <path>] [--host <bind-host>] [--url-host <display-host>] [--foreground] [--background] # @@ -64,6 +64,16 @@ if [[ -n "${CODEX_CI:-}" && "$FOREGROUND" != "true" && "$FORCE_BACKGROUND" != "t FOREGROUND="true" fi +# Windows/Git Bash reaps nohup background processes. Auto-foreground when detected. +if [[ "$FOREGROUND" != "true" && "$FORCE_BACKGROUND" != "true" ]]; then + case "${OSTYPE:-}" in + msys*|cygwin*|mingw*) FOREGROUND="true" ;; + esac + if [[ -n "${MSYSTEM:-}" ]]; then + FOREGROUND="true" + fi +fi + # Generate unique session directory SESSION_ID="$$-$(date +%s)" diff --git a/skills/brainstorming/scripts/stop-server.sh b/skills/brainstorming/scripts/stop-server.sh index c3724de..2e5973d 100755 --- a/skills/brainstorming/scripts/stop-server.sh +++ b/skills/brainstorming/scripts/stop-server.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Stop the brainstorm server and clean up # Usage: stop-server.sh <screen_dir> # @@ -17,7 +17,31 @@ PID_FILE="${SCREEN_DIR}/.server.pid" if [[ -f "$PID_FILE" ]]; then pid=$(cat "$PID_FILE") - kill "$pid" 2>/dev/null + + # Try to stop gracefully, fallback to force if still alive + kill "$pid" 2>/dev/null || true + + # Wait for graceful shutdown (up to ~2s) + for i in {1..20}; do + if ! kill -0 "$pid" 2>/dev/null; then + break + fi + sleep 0.1 + done + + # If still running, escalate to SIGKILL + if kill -0 "$pid" 2>/dev/null; then + kill -9 "$pid" 2>/dev/null || true + + # Give SIGKILL a moment to take effect + sleep 0.1 + fi + + if kill -0 "$pid" 2>/dev/null; then + echo '{"status": "failed", "error": "process still running"}' + exit 1 + fi + rm -f "$PID_FILE" "${SCREEN_DIR}/.server.log" # Only delete ephemeral /tmp directories |
