Sidebar metadata + tagged reload isolation (#16)

* Sidebar primitives + tagged dev isolation

* Allow wider sidebar resize

* Fix tagged socket selection + panel id errors

* Fix progress label quoting + bundle suffix sanitize

* Skip ctrl-enter keybind test when keystrokes blocked

* Fix shell nc hang + prune stale per-surface sidebar metadata
This commit is contained in:
Lawrence Chen 2026-02-06 18:09:56 -08:00 committed by GitHub
parent b3c2a8c7c3
commit 7e69751e1b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 2538 additions and 72 deletions

View file

@ -183,6 +183,7 @@ if [[ -n "$TAG" && "$APP_NAME" != "$SEARCH_APP_NAME" ]]; then
APP_SUPPORT_DIR="$HOME/Library/Application Support/cmuxterm"
CMUXD_SOCKET="${APP_SUPPORT_DIR}/cmuxd-dev-${TAG_SLUG}.sock"
CMUX_SOCKET="/tmp/cmuxterm-debug-${TAG_SLUG}.sock"
echo "$CMUX_SOCKET" > /tmp/cmuxterm-last-socket-path || true
/usr/libexec/PlistBuddy -c "Add :LSEnvironment dict" "$INFO_PLIST" 2>/dev/null || true
/usr/libexec/PlistBuddy -c "Set :LSEnvironment:CMUXD_UNIX_PATH \"${CMUXD_SOCKET}\"" "$INFO_PLIST" 2>/dev/null \
|| /usr/libexec/PlistBuddy -c "Add :LSEnvironment:CMUXD_UNIX_PATH string \"${CMUXD_SOCKET}\"" "$INFO_PLIST"
@ -206,9 +207,12 @@ fi
# Ensure any running instance is fully terminated, regardless of DerivedData path.
/usr/bin/osascript -e "tell application id \"${BUNDLE_ID}\" to quit" >/dev/null 2>&1 || true
sleep 0.3
pkill -f "/${BASE_APP_NAME}.app/Contents/MacOS/${BASE_APP_NAME}" || true
if [[ "${APP_NAME}" != "${BASE_APP_NAME}" ]]; then
pkill -f "/${APP_NAME}.app/Contents/MacOS/${APP_NAME}" || true
if [[ -z "$TAG" ]]; then
# Non-tag mode: kill any running instance (across any DerivedData path) to avoid socket conflicts.
pkill -f "/${BASE_APP_NAME}.app/Contents/MacOS/${BASE_APP_NAME}" || true
else
# Tag mode: only kill the tagged instance; allow side-by-side with the main app.
pkill -f "${APP_NAME}.app/Contents/MacOS/${BASE_APP_NAME}" || true
fi
sleep 0.3
CMUXD_SRC="$PWD/cmuxd/zig-out/bin/cmuxd"
@ -221,7 +225,33 @@ if [[ -x "$CMUXD_SRC" ]]; then
cp "$CMUXD_SRC" "$BIN_DIR/cmuxd"
chmod +x "$BIN_DIR/cmuxd"
fi
open "$APP_PATH"
# Avoid inheriting cmuxterm/ghostty environment variables from the terminal that
# runs this script (often inside another cmuxterm instance), which can cause
# socket and resource-path conflicts.
OPEN_CLEAN_ENV=(
env
-u CMUX_SOCKET_PATH
-u CMUX_TAB_ID
-u CMUX_PANEL_ID
-u CMUXD_UNIX_PATH
-u CMUX_TAG
-u CMUXTERM_TAG
-u CMUX_BUNDLE_ID
-u CMUXTERM_BUNDLE_ID
-u CMUX_SHELL_INTEGRATION
-u GHOSTTY_BIN_DIR
-u GHOSTTY_RESOURCES_DIR
-u GHOSTTY_SHELL_FEATURES
-u TERMINFO
-u XDG_DATA_DIRS
)
if [[ -n "${TAG_SLUG:-}" && -n "${CMUX_SOCKET:-}" ]]; then
# Ensure tag-specific socket paths win even if the caller has CMUX_* overrides.
"${OPEN_CLEAN_ENV[@]}" CMUX_SOCKET_PATH="$CMUX_SOCKET" CMUXD_UNIX_PATH="$CMUXD_SOCKET" open "$APP_PATH"
else
"${OPEN_CLEAN_ENV[@]}" open "$APP_PATH"
fi
osascript -e "tell application id \"${BUNDLE_ID}\" to activate" || true
# Safety: ensure only one instance is running.