SPB Git

Repository Public

cr-hook 958 B 18 lines

1#!/bin/sh2# cr-hook — Claude Code hook relay for Claude Remote.3# Registered in ~/.claude/settings.json for Notification / Stop / UserPromptSubmit / SessionStart.4# Outside a Claude Remote terminal session (no CR_SESSION_ID) it does nothing. It never prints5# anything, never blocks Claude for more than ~2 s and ALWAYS exits 0.6[ -n "${CR_SESSION_ID:-}" ] || exit 07[ -n "${CR_HOOK_SOCKET:-}" ] || exit 08[ -n "${CR_HOOK_TOKEN:-}" ] || exit 09command -v curl >/dev/null 2>&1 || exit 010# The hook JSON arrives on stdin and is forwarded as the request body. The token is passed11# through a curl config on fd 3 so that it never appears in the process list.12curl --silent --max-time 2 --unix-socket "$CR_HOOK_SOCKET" --config /dev/fd/3 \13  -X POST -H 'Content-Type: application/json' -H "X-CR-Session: $CR_SESSION_ID" \14  --data-binary @- http://localhost/hooks/claude >/dev/null 2>&1 3<<EOF_CFG15header = "Authorization: Bearer $CR_HOOK_TOKEN"16EOF_CFG17exit 018
Files main
Menu

Theme