From 90126e8842e8b8749d49bc275bcb7507e5a97c9a Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 14 May 2026 15:34:33 +0200 Subject: [PATCH] fix(scripts): resolve siblings from $SCRIPT_DIR + drop hardcoded recodee fallbacks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After the extraction to a standalone repo, the original cross-script references via $REPO/scripts/codex-fleet/X break for two reasons: 1. $REPO is the user's project root (set via CODEX_FLEET_REPO_ROOT) — no longer the same location as the clone. The clone is wherever the user `git clone`d codex-fleet, e.g. ~/codex-fleet/. Sibling scripts must resolve from the clone, not from the project root. 2. The hardcoded /home/deadpool/Documents/recodee fallback default in REPO=, FORCE_CLAIM_REPO=, FLEET_TICK_REPO=, etc. only resolves correctly on the original maintainer's machine. This commit: - Adds SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" to every script that uses it (full-bringup, force-claim, cap-swap-daemon, fleet-tick-daemon). - Replaces 25 occurrences of $REPO/scripts/codex-fleet/X with $SCRIPT_DIR/X across 6 files (full-bringup, codex-fleet-2, force-claim, proactive-probe, fleet-tick-daemon, cap-swap-daemon). - Reroutes every REPO/REPO_ROOT default that was hardcoded to /home/deadpool/Documents/recodee onto a three-step lookup: explicit env override → $CODEX_FLEET_REPO_ROOT → walk-up from $SCRIPT_DIR. 12 scripts updated. - tmux-bindings.conf now requires CODEX_FLEET_REPO_ROOT in the env of the `tmux source-file` caller (no fallback, since tmux conf cannot derive paths from its own location). After this, the standalone clone works from any path on any machine, and points at any project's openspec/plans/ via CODEX_FLEET_REPO_ROOT. Co-Authored-By: Claude Opus 4.7 (1M context) --- scripts/codex-fleet/cap-swap-daemon.sh | 6 ++- .../codex-fleet/claim-release-supervisor.sh | 4 +- scripts/codex-fleet/claim-trigger.sh | 4 +- scripts/codex-fleet/codex-fleet-2.sh | 10 ++--- scripts/codex-fleet/fleet-tick-daemon.sh | 6 ++- scripts/codex-fleet/fleet-tick.sh | 2 +- scripts/codex-fleet/force-claim.sh | 6 ++- scripts/codex-fleet/full-bringup.sh | 40 ++++++++++--------- scripts/codex-fleet/plan-anim.sh | 2 +- scripts/codex-fleet/plan-tree-anim.sh | 2 +- scripts/codex-fleet/plan-tree-pin.sh | 2 +- scripts/codex-fleet/proactive-probe.sh | 2 +- scripts/codex-fleet/tmux-bindings.conf | 11 ++--- scripts/codex-fleet/waves-anim.sh | 2 +- 14 files changed, 55 insertions(+), 44 deletions(-) diff --git a/scripts/codex-fleet/cap-swap-daemon.sh b/scripts/codex-fleet/cap-swap-daemon.sh index 9847e45..45cf61f 100755 --- a/scripts/codex-fleet/cap-swap-daemon.sh +++ b/scripts/codex-fleet/cap-swap-daemon.sh @@ -13,7 +13,9 @@ # replacements because cap-probe filters them. set -eo pipefail -REPO="${REPO:-/home/deadpool/Documents/recodee}" +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +# Autodetect REPO from the clone location; env override wins. +REPO="${REPO:-${CODEX_FLEET_REPO_ROOT:-$(cd "$SCRIPT_DIR/../.." && pwd)}}" SESSION="${SESSION:-codex-fleet}" WAKE="${WAKE:-/tmp/codex-fleet-wake-prompt.md}" LOG="${LOG:-/tmp/claude-viz/cap-swap.log}" @@ -190,7 +192,7 @@ sweep_once() { local need; need=$capped [ "$need" -gt "$CANDIDATES_PER_SWAP" ] && need=$CANDIDATES_PER_SWAP local healthy - healthy=$(bash "$REPO/scripts/codex-fleet/cap-probe.sh" "$need" $ranked 2>>"$LOG" || true) + healthy=$(bash "$SCRIPT_DIR/cap-probe.sh" "$need" $ranked 2>>"$LOG" || true) local healthy_n; healthy_n=$(printf '%s\n' "$healthy" | grep -c '@' || true) if [ "$healthy_n" -eq 0 ]; then log "cap-probe returned no healthy accounts; will retry next sweep" diff --git a/scripts/codex-fleet/claim-release-supervisor.sh b/scripts/codex-fleet/claim-release-supervisor.sh index 41b55dc..ceb84c8 100755 --- a/scripts/codex-fleet/claim-release-supervisor.sh +++ b/scripts/codex-fleet/claim-release-supervisor.sh @@ -25,7 +25,7 @@ # CR_SUP_WINDOW tmux window with codex panes (default: overview) # CR_SUP_INTERVAL poll period in seconds (default: 60) # CR_SUP_MIN_IDLE_SEC minimum claim age before releasing (default: 120) -# CR_SUP_REPO_ROOT repo root (default: /home/deadpool/Documents/recodee) +# CR_SUP_REPO_ROOT repo root (default: autodetect from script location) # CR_SUP_DRY 1 = log only, do not call release (default: 0) # # Run standalone: @@ -39,7 +39,7 @@ SESSION="${CR_SUP_SESSION:-codex-fleet}" WINDOW="${CR_SUP_WINDOW:-overview}" INTERVAL="${CR_SUP_INTERVAL:-60}" MIN_IDLE_SEC="${CR_SUP_MIN_IDLE_SEC:-120}" -REPO_ROOT="${CR_SUP_REPO_ROOT:-/home/deadpool/Documents/recodee}" +REPO_ROOT="${CR_SUP_REPO_ROOT:-${CODEX_FLEET_REPO_ROOT:-$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)}}" DRY="${CR_SUP_DRY:-0}" MODE="loop" diff --git a/scripts/codex-fleet/claim-trigger.sh b/scripts/codex-fleet/claim-trigger.sh index 5517d59..36ac178 100755 --- a/scripts/codex-fleet/claim-trigger.sh +++ b/scripts/codex-fleet/claim-trigger.sh @@ -12,7 +12,7 @@ # bash scripts/codex-fleet/claim-trigger.sh --once --dry-run # # Env: -# CLAIM_TRIGGER_REPO=/home/deadpool/Documents/recodee +# CLAIM_TRIGGER_REPO= (default: autodetect from script location) # CLAIM_TRIGGER_SESSION=codex-fleet # CLAIM_TRIGGER_WINDOW=overview # CLAIM_TRIGGER_DEBOUNCE_MS=500 @@ -20,7 +20,7 @@ # CLAIM_TRIGGER_PLAN_JSON=/path/to/plan.json # optional single-plan pin set -eo pipefail -REPO="${CLAIM_TRIGGER_REPO:-/home/deadpool/Documents/recodee}" +REPO="${CLAIM_TRIGGER_REPO:-${CODEX_FLEET_REPO_ROOT:-$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)}}" SESSION="${CLAIM_TRIGGER_SESSION:-codex-fleet}" WINDOW="${CLAIM_TRIGGER_WINDOW:-overview}" DEBOUNCE_MS="${CLAIM_TRIGGER_DEBOUNCE_MS:-500}" diff --git a/scripts/codex-fleet/codex-fleet-2.sh b/scripts/codex-fleet/codex-fleet-2.sh index fc7c9d6..c4c0b77 100755 --- a/scripts/codex-fleet/codex-fleet-2.sh +++ b/scripts/codex-fleet/codex-fleet-2.sh @@ -93,11 +93,11 @@ echo "[codex-fleet-2] session=$SESSION plan=$PLAN_SLUG" # in-worktree edit shows up immediately, then falls back to the primary # checkout so dashboards that live only in user-untracked locations # (waves-anim-generic.sh, review-board.sh, ...) still work. -FALLBACK_REPO="${CODEX_FLEET_2_FALLBACK_REPO:-/home/deadpool/Documents/recodee}" +FALLBACK_REPO="${CODEX_FLEET_2_FALLBACK_REPO:-${CODEX_FLEET_REPO_ROOT:-$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)}}" resolve_script() { local name="$1" - if [[ -f "$REPO/scripts/codex-fleet/$name" ]]; then - printf '%s\n' "$REPO/scripts/codex-fleet/$name" + if [[ -f "$SCRIPT_DIR/$name" ]]; then + printf '%s\n' "$SCRIPT_DIR/$name" elif [[ -f "$FALLBACK_REPO/scripts/codex-fleet/$name" ]]; then printf '%s\n' "$FALLBACK_REPO/scripts/codex-fleet/$name" fi @@ -141,8 +141,8 @@ tmux select-window -t "$SESSION:plan" # now comes from the `#S` token rendered inside style-tabs.sh's session badge # pill (e.g. `◖ ◆ codex-fleet-2 ◗`), so both sessions read as one fleet visual # language and pre-iOS overrides don't shadow the global palette. -if [[ -x "$REPO/scripts/codex-fleet/style-tabs.sh" ]]; then - CODEX_FLEET_SESSION="$SESSION" bash "$REPO/scripts/codex-fleet/style-tabs.sh" >/dev/null 2>&1 || true +if [[ -x "$SCRIPT_DIR/style-tabs.sh" ]]; then + CODEX_FLEET_SESSION="$SESSION" bash "$SCRIPT_DIR/style-tabs.sh" >/dev/null 2>&1 || true fi if (( USE_KITTY == 1 )) && command -v kitty >/dev/null 2>&1; then diff --git a/scripts/codex-fleet/fleet-tick-daemon.sh b/scripts/codex-fleet/fleet-tick-daemon.sh index bbd2202..5f42061 100755 --- a/scripts/codex-fleet/fleet-tick-daemon.sh +++ b/scripts/codex-fleet/fleet-tick-daemon.sh @@ -12,8 +12,10 @@ # FLEET_TICK_INTERVAL=2 bash scripts/codex-fleet/fleet-tick-daemon.sh set +e -REPO="${FLEET_TICK_DAEMON_REPO:-/home/deadpool/Documents/recodee}" -SCRIPT="$REPO/scripts/codex-fleet/fleet-tick.sh" +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +# Autodetect REPO from the clone location; env override wins. +REPO="${FLEET_TICK_DAEMON_REPO:-${CODEX_FLEET_REPO_ROOT:-$(cd "$SCRIPT_DIR/../.." && pwd)}}" +SCRIPT="$SCRIPT_DIR/fleet-tick.sh" INTERVAL="${FLEET_TICK_INTERVAL:-2}" LOG_DIR="${FLEET_TICK_DAEMON_LOG_DIR:-/tmp/claude-viz}" mkdir -p "$LOG_DIR" diff --git a/scripts/codex-fleet/fleet-tick.sh b/scripts/codex-fleet/fleet-tick.sh index 04e1f5e..d6ad82b 100755 --- a/scripts/codex-fleet/fleet-tick.sh +++ b/scripts/codex-fleet/fleet-tick.sh @@ -7,7 +7,7 @@ set -eo pipefail INTERVAL="${FLEET_TICK_INTERVAL:-5}" TMUX_SESSION="${CODEX_FLEET_SESSION:-codex-fleet}" -REPO="${FLEET_TICK_REPO:-/home/deadpool/Documents/recodee}" +REPO="${FLEET_TICK_REPO:-${CODEX_FLEET_REPO_ROOT:-$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)}}" PLAN_JSON="${FLEET_TICK_PLAN_JSON:-$REPO/openspec/plans/rust-ph13-14-15-completion-2026-05-13/plan.json}" STATE_OUT="${FLEET_TICK_STATE_OUT:-/tmp/claude-viz/live-fleet-state.txt}" PLAN_OUT="${FLEET_TICK_PLAN_OUT:-/tmp/claude-viz/live-plan-design.txt}" diff --git a/scripts/codex-fleet/force-claim.sh b/scripts/codex-fleet/force-claim.sh index 320a4e8..3b4b698 100755 --- a/scripts/codex-fleet/force-claim.sh +++ b/scripts/codex-fleet/force-claim.sh @@ -41,7 +41,9 @@ # CODEX_FLEET_CLAIM_MODE=both|event|poll # default: both set -eo pipefail -REPO="${FORCE_CLAIM_REPO:-/home/deadpool/Documents/recodee}" +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +# Autodetect REPO from the clone location; env override wins. +REPO="${FORCE_CLAIM_REPO:-${CODEX_FLEET_REPO_ROOT:-$(cd "$SCRIPT_DIR/../.." && pwd)}}" SESSION="${FORCE_CLAIM_SESSION:-codex-fleet}" WINDOW="${FORCE_CLAIM_WINDOW:-overview}" LOOP=0 @@ -216,7 +218,7 @@ start_claim_trigger() { return 0 fi - local trigger="$REPO/scripts/codex-fleet/claim-trigger.sh" + local trigger="$SCRIPT_DIR/claim-trigger.sh" if [[ ! -x "$trigger" ]]; then printf '[%s] claim-trigger unavailable at %s; continuing with poll mode\n' "$(date +%T)" "$trigger" >&2 return 0 diff --git a/scripts/codex-fleet/full-bringup.sh b/scripts/codex-fleet/full-bringup.sh index 184fdc6..e8fdcaa 100755 --- a/scripts/codex-fleet/full-bringup.sh +++ b/scripts/codex-fleet/full-bringup.sh @@ -16,7 +16,11 @@ set -eo pipefail -REPO="${REPO:-/home/deadpool/Documents/recodee}" +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +# Autodetect REPO from the clone location; env override wins. Lets the +# same script run from any path (e.g. ~/codex-fleet/) and lets operators +# point CODEX_FLEET_REPO_ROOT at a separate project root for plan lookup. +REPO="${REPO:-${CODEX_FLEET_REPO_ROOT:-$(cd "$SCRIPT_DIR/../.." && pwd)}}" WAKE="${WAKE:-/tmp/codex-fleet-wake-prompt.md}" N_PANES=8 ATTACH=1 @@ -111,7 +115,7 @@ fi # 5. Verify wake prompt exists if [ ! -f "$WAKE" ]; then warn "wake prompt missing at $WAKE; using scripts/codex-fleet/worker-prompt.md" - WAKE="$REPO/scripts/codex-fleet/worker-prompt.md" + WAKE="$SCRIPT_DIR/worker-prompt.md" [ -f "$WAKE" ] || die "no wake prompt found at $WAKE either" fi @@ -145,7 +149,7 @@ CAND_N=$(printf "%s\n" "$CANDIDATES" | wc -l) log "ranked $CAND_N candidates by codex-auth score; running live probe..." # (b) Live probe — keep only candidates whose codex CLI is actually usable. -HEALTHY_EMAILS=$(bash "$REPO/scripts/codex-fleet/cap-probe.sh" "$N_PANES" $CANDIDATES 2>/tmp/cap-probe.err) || true +HEALTHY_EMAILS=$(bash "$SCRIPT_DIR/cap-probe.sh" "$N_PANES" $CANDIDATES 2>/tmp/cap-probe.err) || true HEALTHY_N=$(printf "%s\n" "$HEALTHY_EMAILS" | grep -c "@" || true) if [ "$HEALTHY_N" -lt "$N_PANES" ]; then warn "cap-probe found only $HEALTHY_N/$N_PANES healthy accounts" @@ -224,11 +228,11 @@ done <<< "$ACCOUNTS" # 11. Create fleet / plan / waves windows log "creating fleet / plan / waves windows" -tmux new-window -d -t "$SESSION:" -n fleet "bash $REPO/scripts/codex-fleet/fleet-state-anim.sh" -tmux new-window -d -t "$SESSION:" -n plan "bash $REPO/scripts/codex-fleet/plan-tree-anim.sh" -tmux new-window -d -t "$SESSION:" -n waves "bash $REPO/scripts/codex-fleet/waves-anim-generic.sh" -tmux new-window -d -t "$SESSION:" -n review "bash $REPO/scripts/codex-fleet/review-board.sh" -tmux new-window -d -t "$SESSION:" -n watcher "bash $REPO/scripts/codex-fleet/watcher-board.sh" +tmux new-window -d -t "$SESSION:" -n fleet "bash $SCRIPT_DIR/fleet-state-anim.sh" +tmux new-window -d -t "$SESSION:" -n plan "bash $SCRIPT_DIR/plan-tree-anim.sh" +tmux new-window -d -t "$SESSION:" -n waves "bash $SCRIPT_DIR/waves-anim-generic.sh" +tmux new-window -d -t "$SESSION:" -n review "bash $SCRIPT_DIR/review-board.sh" +tmux new-window -d -t "$SESSION:" -n watcher "bash $SCRIPT_DIR/watcher-board.sh" # legacy plain watcher (replaced by graphical watcher-board.sh): # tmux new-window ... "watch -n 2 -t -c 'cat /tmp/claude-viz/cap-swap-status.txt 2>/dev/null; echo; echo --- recent swaps ---; tail -20 /tmp/claude-viz/cap-swap.log 2>/dev/null'" tmux set-option -w -t "$SESSION:plan" remain-on-exit on @@ -238,7 +242,7 @@ tmux set-option -w -t "$SESSION:waves" remain-on-exit on # borders with `▭ #{@panel}` headers, sticky right-click menu). Runs after # windows exist so window-status-format covers all six tabs. log "applying iOS-style chrome" -CODEX_FLEET_SESSION="$SESSION" bash "$REPO/scripts/codex-fleet/style-tabs.sh" >/dev/null 2>&1 \ +CODEX_FLEET_SESSION="$SESSION" bash "$SCRIPT_DIR/style-tabs.sh" >/dev/null 2>&1 \ || warn "style-tabs.sh failed (chrome will fall back to tmux defaults)" # 12. Sibling fleet-ticker session: ticker + cap-swap + state-pump @@ -259,10 +263,10 @@ mkdir -p "$FLEET_STATE_DIR/supervisor" # ticker uses fleet-tick-daemon.sh wrapper — re-spawn-safe vs the raw # fleet-tick.sh which `set -eo pipefail`-crashes mid-tick on any failed # regex / capture-pane and silently halts the live viz. -tmux new-session -d -s "$TICKER_SESSION" -n ticker "bash $REPO/scripts/codex-fleet/fleet-tick-daemon.sh" -tmux new-window -d -t "$TICKER_SESSION:" -n cap-swap "bash $REPO/scripts/codex-fleet/cap-swap-daemon.sh" -tmux new-window -d -t "$TICKER_SESSION:" -n state-pump "bash $REPO/scripts/codex-fleet/colony-state-pump.sh" -tmux new-window -d -t "$TICKER_SESSION:" -n review-detector "bash $REPO/scripts/codex-fleet/plan-complete-detector.sh" +tmux new-session -d -s "$TICKER_SESSION" -n ticker "bash $SCRIPT_DIR/fleet-tick-daemon.sh" +tmux new-window -d -t "$TICKER_SESSION:" -n cap-swap "bash $SCRIPT_DIR/cap-swap-daemon.sh" +tmux new-window -d -t "$TICKER_SESSION:" -n state-pump "bash $SCRIPT_DIR/colony-state-pump.sh" +tmux new-window -d -t "$TICKER_SESSION:" -n review-detector "bash $SCRIPT_DIR/plan-complete-detector.sh" # force-claim scans ALL openspec plans every 15s, finds deps-satisfied # `available` tasks, and dispatches them onto idle codex panes via # tmux send-keys. Keeps the fleet pulled into ready work when its @@ -273,7 +277,7 @@ tmux new-window -d -t "$TICKER_SESSION:" -n review-detector "bash $REPO/scripts # is wrong here because we have 6 windows and `1` maps to `fleet`, the # state-anim viz pane — so without this override the daemon reported # "no idle codex panes" forever while the actual workers idled in window 0. -tmux new-window -d -t "$TICKER_SESSION:" -n force-claim "FORCE_CLAIM_WINDOW=overview bash $REPO/scripts/codex-fleet/force-claim.sh --loop --interval=15" +tmux new-window -d -t "$TICKER_SESSION:" -n force-claim "FORCE_CLAIM_WINDOW=overview bash $SCRIPT_DIR/force-claim.sh --loop --interval=15" # claim-release-supervisor scans all openspec plans every 60s, finds claims # held by agents whose codex pane has gone back to the default prompt @@ -282,7 +286,7 @@ tmux new-window -d -t "$TICKER_SESSION:" -n force-claim "FORCE_CLAIM_WINDOW=ove # stranded --apply so force-claim can re-route them. Distinct from # supervisor.sh (kitty-spawning quota replacement, opt-in via # CODEX_FLEET_SUPERVISOR=1) — this watcher only mutates Colony state. -tmux new-window -d -t "$TICKER_SESSION:" -n claim-release "CR_SUP_SESSION=$SESSION CR_SUP_WINDOW=overview bash $REPO/scripts/codex-fleet/claim-release-supervisor.sh --loop --interval=60" +tmux new-window -d -t "$TICKER_SESSION:" -n claim-release "CR_SUP_SESSION=$SESSION CR_SUP_WINDOW=overview bash $SCRIPT_DIR/claim-release-supervisor.sh --loop --interval=60" # stall-watcher: every 60s, `colony rescue stranded --apply` releases claims # held > 30m without progress, then enqueues a takeover_recommended event @@ -292,16 +296,16 @@ tmux new-window -d -t "$TICKER_SESSION:" -n claim-release "CR_SUP_SESSION=$SESS # per takeover event, which conflicts with the single-kitty-with-tmux-tabs # fleet UX. Re-enable per-bringup with CODEX_FLEET_SUPERVISOR=1, or run # `bash scripts/codex-fleet/supervisor.sh` manually when auto-rescue is wanted. -tmux new-window -d -t "$TICKER_SESSION:" -n stall-watcher "bash $REPO/scripts/codex-fleet/stall-watcher.sh" +tmux new-window -d -t "$TICKER_SESSION:" -n stall-watcher "bash $SCRIPT_DIR/stall-watcher.sh" if [ "${CODEX_FLEET_SUPERVISOR:-0}" = "1" ]; then - tmux new-window -d -t "$TICKER_SESSION:" -n supervisor "bash $REPO/scripts/codex-fleet/supervisor.sh" + tmux new-window -d -t "$TICKER_SESSION:" -n supervisor "bash $SCRIPT_DIR/supervisor.sh" else log "supervisor window skipped (set CODEX_FLEET_SUPERVISOR=1 to enable auto-takeover spawns)" fi # 12b. Chrome the ticker session too so attaching to it shows the same iOS # tab strip / rounded pane borders / sticky menu as the main session. -CODEX_FLEET_SESSION="$TICKER_SESSION" bash "$REPO/scripts/codex-fleet/style-tabs.sh" >/dev/null 2>&1 \ +CODEX_FLEET_SESSION="$TICKER_SESSION" bash "$SCRIPT_DIR/style-tabs.sh" >/dev/null 2>&1 \ || warn "style-tabs.sh failed for $TICKER_SESSION" # 12c. Verify chrome actually rendered (catches the session-local `status on` diff --git a/scripts/codex-fleet/plan-anim.sh b/scripts/codex-fleet/plan-anim.sh index a823f32..7abc295 100755 --- a/scripts/codex-fleet/plan-anim.sh +++ b/scripts/codex-fleet/plan-anim.sh @@ -23,7 +23,7 @@ for a in "$@"; do done INTERVAL_S=$(awk -v ms="$INTERVAL_MS" 'BEGIN{printf "%.3f", ms/1000}') -REPO="${PLAN_ANIM_REPO:-/home/deadpool/Documents/recodee}" +REPO="${PLAN_ANIM_REPO:-${CODEX_FLEET_REPO_ROOT:-$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)}}" PLAN_JSON="${PLAN_ANIM_PLAN_JSON:-$REPO/openspec/plans/rust-ph13-14-15-completion-2026-05-13/plan.json}" PLAN_SLUG="$(basename "$(dirname "$PLAN_JSON")")" diff --git a/scripts/codex-fleet/plan-tree-anim.sh b/scripts/codex-fleet/plan-tree-anim.sh index 98589c4..12eeade 100755 --- a/scripts/codex-fleet/plan-tree-anim.sh +++ b/scripts/codex-fleet/plan-tree-anim.sh @@ -16,7 +16,7 @@ # PLAN_TREE_ANIM_INTERVAL_MS=800 ... # tick override set -eo pipefail -REPO="${PLAN_TREE_ANIM_REPO:-/home/deadpool/Documents/recodee}" +REPO="${PLAN_TREE_ANIM_REPO:-${CODEX_FLEET_REPO_ROOT:-$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)}}" # 500ms keeps the spinner pulse feeling alive without burning CPU — each # render is ~60ms (jq + tmux display-message + awk clamp) so duty-cycle ≈ 12%. INTERVAL_MS="${PLAN_TREE_ANIM_INTERVAL_MS:-500}" diff --git a/scripts/codex-fleet/plan-tree-pin.sh b/scripts/codex-fleet/plan-tree-pin.sh index 7218a5f..1cee64b 100755 --- a/scripts/codex-fleet/plan-tree-pin.sh +++ b/scripts/codex-fleet/plan-tree-pin.sh @@ -13,7 +13,7 @@ # bash scripts/codex-fleet/plan-tree-pin.sh --show # print current pin set -eo pipefail -REPO="${PLAN_TREE_PIN_REPO:-/home/deadpool/Documents/recodee}" +REPO="${PLAN_TREE_PIN_REPO:-${CODEX_FLEET_REPO_ROOT:-$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)}}" PIN_FILE="${PLAN_TREE_ANIM_PIN_FILE:-/tmp/claude-viz/plan-tree-pin.txt}" mkdir -p "$(dirname "$PIN_FILE")" diff --git a/scripts/codex-fleet/proactive-probe.sh b/scripts/codex-fleet/proactive-probe.sh index 9629645..1374401 100755 --- a/scripts/codex-fleet/proactive-probe.sh +++ b/scripts/codex-fleet/proactive-probe.sh @@ -23,7 +23,7 @@ CACHE_DIR="${CACHE_DIR:-/tmp/claude-viz/cap-probe-cache}" POOL_FILE="${POOL_FILE:-/tmp/claude-viz/healthy-pool.txt}" LOG="${LOG:-/tmp/claude-viz/proactive-probe.log}" PROBE_PROACTIVE_INTERVAL="${PROBE_PROACTIVE_INTERVAL:-300}" -CAP_PROBE_SCRIPT="${CAP_PROBE_SCRIPT:-$REPO/scripts/codex-fleet/cap-probe.sh}" +CAP_PROBE_SCRIPT="${CAP_PROBE_SCRIPT:-$SCRIPT_DIR/cap-probe.sh}" ONCE=0 usage() { diff --git a/scripts/codex-fleet/tmux-bindings.conf b/scripts/codex-fleet/tmux-bindings.conf index 241e148..e401a91 100644 --- a/scripts/codex-fleet/tmux-bindings.conf +++ b/scripts/codex-fleet/tmux-bindings.conf @@ -6,9 +6,10 @@ # Bindings: # prefix m — open iOS Action Sheet (down, swap, retarget, open watcher) -# Resolve repo root: env override → walk up from this conf's directory. -# tmux source-file evaluates literal commands; cannot derive paths from the -# conf's own location, so fall back to $HOME/Documents/recodee until the -# CODEX_FLEET_REPO_ROOT env is plumbed through everywhere (extract-p1 plan). +# Resolve repo root: tmux source-file evaluates literal commands and cannot +# derive paths from this conf's own location, so callers must export +# CODEX_FLEET_REPO_ROOT in the env of the `tmux` invocation that sources +# this file. full-bringup.sh sets it automatically; install.sh writes the +# export to your shell rc. bind-key m display-popup -B -E -w 60 -h 16 \ - "bash ${CODEX_FLEET_REPO_ROOT:-$HOME/Documents/recodee}/scripts/codex-fleet/bin/menu-action-sheet.sh" + "bash ${CODEX_FLEET_REPO_ROOT:?CODEX_FLEET_REPO_ROOT must be set before sourcing tmux-bindings.conf}/scripts/codex-fleet/bin/menu-action-sheet.sh" diff --git a/scripts/codex-fleet/waves-anim.sh b/scripts/codex-fleet/waves-anim.sh index c765694..0629590 100755 --- a/scripts/codex-fleet/waves-anim.sh +++ b/scripts/codex-fleet/waves-anim.sh @@ -23,7 +23,7 @@ for a in "$@"; do done INTERVAL_S=$(awk -v ms="$INTERVAL_MS" 'BEGIN{printf "%.3f", ms/1000}') -REPO="${WAVES_ANIM_REPO:-/home/deadpool/Documents/recodee}" +REPO="${WAVES_ANIM_REPO:-${CODEX_FLEET_REPO_ROOT:-$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)}}" PLAN_JSON="${WAVES_ANIM_PLAN_JSON:-$REPO/openspec/plans/rust-ph13-14-15-completion-2026-05-13/plan.json}" PLAN_SLUG="$(basename "$(dirname "$PLAN_JSON")")" ACTIVE_FILE="${WAVES_ANIM_ACTIVE_FILE:-/tmp/claude-viz/fleet-active-accounts.txt}"