summaryrefslogtreecommitdiff
path: root/skills
diff options
context:
space:
mode:
authorJesse Vincent <jesse@fsck.com>2026-10-22 22:17:50 +0000
committerJesse Vincent <jesse@fsck.com>2026-10-23 03:38:19 +0000
commitfa50d836bf7b0e2f08f493839dc2211ed6fb3bb9 (patch)
tree83107c790f77def76f19d5d73ce1d89518776cb3 /skills
parentb58deb3b948d4c305feeac122700100419ee2777 (diff)
brainstorming: resolve a relative --project-dir before start-server.sh cdsfix/2524-relative-project-dir
start-server.sh built SESSION_DIR, PID_FILE, LOG_FILE and BRAINSTORM_DIR from --project-dir as given, then ran `cd "$SCRIPT_DIR"` before using them. A relative project dir like `.` was re-rooted at the scripts directory, so the log and pid redirects failed and the server never reported server-started: "Server failed to start within 5 seconds". Resolve the project dir to an absolute path with `mkdir -p` + `cd && pwd` right before deriving the session paths. mkdir -p keeps the existing behavior of creating a project dir that doesn't exist yet (the Windows lifecycle test relies on it), CDPATH is cleared so a relative name can't resolve to some other directory, and `--` covers names starting with a dash. Works on bash 3.2 without realpath or readlink -f. Fixes #2524. Claude-Session: https://claude.ai/code/session_01SHANcr4A71nzuU9et4Fnba
Diffstat (limited to 'skills')
-rwxr-xr-xskills/brainstorming/scripts/start-server.sh7
1 files changed, 7 insertions, 0 deletions
diff --git a/skills/brainstorming/scripts/start-server.sh b/skills/brainstorming/scripts/start-server.sh
index 016a8e4..f6d538a 100755
--- a/skills/brainstorming/scripts/start-server.sh
+++ b/skills/brainstorming/scripts/start-server.sh
@@ -114,6 +114,13 @@ umask 077
SESSION_ID="$$-$(date +%s)"
if [[ -n "$PROJECT_DIR" ]]; then
+ # Make the project dir absolute now: the script cds into its own directory
+ # before starting the server, which would re-root a relative path there.
+ # mkdir -p keeps the existing behavior of creating a missing project dir.
+ if ! PROJECT_DIR="$(mkdir -p -- "$PROJECT_DIR" && CDPATH='' cd -- "$PROJECT_DIR" && pwd)"; then
+ echo "{\"error\": \"Cannot create or enter --project-dir\"}"
+ exit 1
+ fi
SESSION_DIR="${PROJECT_DIR}/.superpowers/brainstorm/${SESSION_ID}"
# Persist the bound port and key per project so a restart reuses them and an
# already-open browser tab reconnects to the same URL with a valid cookie.