diff options
Diffstat (limited to 'claude-templates/bin')
| -rwxr-xr-x | claude-templates/bin/page-signal | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/claude-templates/bin/page-signal b/claude-templates/bin/page-signal index 5a87c67..ef64258 100755 --- a/claude-templates/bin/page-signal +++ b/claude-templates/bin/page-signal @@ -2,18 +2,20 @@ # # page-signal — wrap signal-cli send for paging Craig via Signal. # -# Defaults to --note-to-self for safety. Outbound (to another contact) -# requires an explicit --to <+number> on every call. No defaults, no batch. +# Sends from a dedicated pager account to Craig's Signal account by +# default. Override the recipient with --to <+number-or-uuid>. # # Usage: -# page-signal "message" # note-to-self +# page-signal "message" # page Craig (default recipient) # page-signal --file path "message" # with attachment -# page-signal --to +15551234567 "msg" # outbound (explicit recipient) +# page-signal --to +15551234567 "msg" # override recipient (number or UUID) # page-signal --quiet "message" # suppress success output # page-signal --json "message" # structured output (timestamp + status) # echo "msg" | page-signal # message from stdin (no positional) # -# Requires signal-cli installed and registered with an account. +# Sender account and default recipient come from PAGE_SIGNAL_ACCOUNT and +# PAGE_SIGNAL_TO; both have built-in defaults below. Requires signal-cli +# installed and registered with the sender account. # # Use this when desktop notifications won't reach the user — page-signal # fires cross-device. For routine completions and periodic status pings, @@ -25,11 +27,12 @@ set -euo pipefail quiet=0 json=0 file= -recipient_args=(--note-to-self) +account="${PAGE_SIGNAL_ACCOUNT:-+15045173983}" +recipient_args=("${PAGE_SIGNAL_TO:-b1b5601e-6126-47f8-afaa-0a59f5188fde}") message= usage() { - sed -n '3,21p' "$0" | sed 's/^# \{0,1\}//' + sed -n '3,23p' "$0" | sed 's/^# \{0,1\}//' } while [ "$#" -gt 0 ]; do @@ -53,10 +56,11 @@ while [ "$#" -gt 0 ]; do shift 2 ;; --to) - [ "$#" -ge 2 ] || { echo "page-signal: --to needs a +E.164 number" >&2; exit 2; } + [ "$#" -ge 2 ] || { echo "page-signal: --to needs a +E.164 number or a Signal account UUID" >&2; exit 2; } case "$2" in +[0-9]*) ;; - *) echo "page-signal: --to expects +E.164 (e.g. +15551234567)" >&2; exit 2 ;; + [0-9a-fA-F]*-[0-9a-fA-F]*-[0-9a-fA-F]*) ;; + *) echo "page-signal: --to expects +E.164 (e.g. +15551234567) or a Signal account UUID" >&2; exit 2 ;; esac recipient_args=("$2") shift 2 @@ -91,7 +95,7 @@ if [ -z "$message" ]; then fi # Build the send command. -cmd=(signal-cli send -m "$message") +cmd=(signal-cli -a "$account" send -m "$message") if [ -n "$file" ]; then cmd+=(-a "$file") fi |
