Files
hack-house/scripts/hh-direnv.sh
T
leetcrypt 2cd61ee598 feat(mobile): hh launcher + direnv auto-host for Termux/Fairphone
Add a single `hh` launcher (host/join/web/status/stop + operator
passthrough) and a direnv snippet so `cd`-ing into a project dir
auto-hosts a room named after it. Verified live on the Fairphone:
two rooms coexist on port-scoped tmux windows (manual :8799 +
direnv :8801), status health-checks each via curl (ss/netstat are
unreliable on Android), stop-all tears down cleanly.

Termux notes baked in: no /usr/bin/env (invoke via the `hh` alias,
not the shebang); status enumerates operator daemons under
$TMPDIR/hh-bridge.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-07-07 22:10:53 -07:00

23 lines
908 B
Bash

# hh-direnv.sh — source this from a directory's .envrc to auto-host a
# hack-house room whenever you `cd` in (direnv triggers it).
#
# # .envrc
# source "$HOME/hh-mobile/scripts/hh-direnv.sh"
#
# The room is named after the directory. Override before sourcing:
# export HH_PORT=8801 ; export HH_PASSWORD=hunter2
# source "$HOME/hh-mobile/scripts/hh-direnv.sh"
#
# Auto-host is ON by default; disable with `export HH_AUTOHOST=0` (env still set).
export HH_NAME="${HH_NAME:-$(basename "$PWD")}"
export HH_PORT="${HH_PORT:-8799}"
export HH_PASSWORD="${HH_PASSWORD:-hh-mobile}"
export HH_BIND="${HH_BIND:-0.0.0.0}"
if [ "${HH_AUTOHOST:-1}" = "1" ]; then
# idempotent: the launcher no-ops if the host window already exists
bash "$HOME/hh-mobile/scripts/hh" host "$HH_NAME" "$HH_PORT" >/dev/null 2>&1 || true
echo "hh: auto-hosting room '$HH_NAME' on :$HH_PORT (HH_AUTOHOST=0 to disable)" >&2
fi