Skip to content

A tiny friend in your Mac's notch and on your iPhone that keeps an eye on your AI coding agents: Claude Code, Codex, Cursor, Gemini CLI, Antigravity and more. Approve from the notch or your Lock Screen.

nb-hook runs off the Mac and can use another socket

NikitaBulichev85f25965cd50
diff --git a/NotchBuddy/Sources/App/HookServer.swift b/NotchBuddy/Sources/App/HookServer.swift
index d7ef3437..ba0451ee 100644
--- a/NotchBuddy/Sources/App/HookServer.swift
+++ b/NotchBuddy/Sources/App/HookServer.swift
@@ -3231,16 +3231,24 @@ extension Notification.Name {
// MARK: - nb-hook shell wrapper (same for both GitHub and App Store)
// Invoked by Claude Code via /bin/sh or directly via shebang.
// Always exits 0 — never blocks Claude Code.
-// Checks xcode-select before running python3 to avoid triggering the
+// On macOS, checks xcode-select before running python3 to avoid triggering the
// "install developer tools" dialog on machines without Xcode CLI tools.
+// Elsewhere (the hook copied to a Linux machine reached over SSH, docs/REMOTE.md)
+// it runs the python3 found in PATH.
private let nbHookShellWrapper = """
#!/bin/sh
# Coucou hook relay — always exits 0, never blocks Claude Code
HOOK_DIR="$(dirname "$0")"
+PY=""
+if [ "$(uname -s)" = "Darwin" ]; then
+ xcode-select -p >/dev/null 2>&1 && PY=/usr/bin/python3
+else
+ PY=$(command -v python3 2>/dev/null)
+fi
out=""
-if xcode-select -p >/dev/null 2>&1; then
- out=$(/usr/bin/python3 "$HOOK_DIR/nb-hook.py" "$@" 2>/dev/null)
+if [ -n "$PY" ]; then
+ out=$("$PY" "$HOOK_DIR/nb-hook.py" "$@" 2>/dev/null)
rc=$?
if [ "$rc" -ne 0 ] || [ -z "$out" ]; then
out=""
@@ -3376,8 +3384,10 @@ def main():
if '--statusline' not in sys.argv[1:]:
return
+ # COUCOU_SOCKET points the relay at another socket, for instance the one an
+ # `ssh -R` tunnel forwards from the Mac to a remote machine (docs/REMOTE.md).
socket_path = os.path.expanduser(
- '~/Library/Application Support/NotchBuddy/nb.sock'
+ os.environ.get('COUCOU_SOCKET') or '~/Library/Application Support/NotchBuddy/nb.sock'
)
# --statusline mode: relay rate_limits to Coucou, then delegate to saved previous
@@ -3729,8 +3739,10 @@ def main():
if '--statusline' not in sys.argv[1:]:
return
+ # COUCOU_SOCKET points the relay at another socket, for instance the one an
+ # `ssh -R` tunnel forwards from the Mac to a remote machine (docs/REMOTE.md).
socket_path = os.path.expanduser(
- '~/Library/Containers/fr.louisraille.Coucou/Data/nb.sock'
+ os.environ.get('COUCOU_SOCKET') or '~/Library/Containers/fr.louisraille.Coucou/Data/nb.sock'
)
# --statusline mode: relay rate_limits to Coucou, then delegate to saved previous