diff --git a/README.md b/README.md index f2df2e5..ed17adc 100644 --- a/README.md +++ b/README.md @@ -144,6 +144,8 @@ The installer is **all-in-one**: if OpenCode isn't already installed, it bootstr curl -fsSL https://git.lohmar.co.uk/cclohmar/NewOpenAgents/raw/branch/main/install.sh | bash ``` +Even though the script arrives over a pipe, it is **interactive**: it reads your answers from the terminal (`/dev/tty`). In a non-terminal context (CI), it runs with safe defaults instead of prompting. + ### Or clone, then install (recommended for updates) ```bash diff --git a/install.sh b/install.sh index a796435..b2713f0 100755 --- a/install.sh +++ b/install.sh @@ -71,6 +71,24 @@ error() { printf "${RED}✗${NC} %s\n" "$1" >&2; } step() { printf "\n${MAGENTA}${BOLD}▶${NC} %s\n\n" "$1"; } die() { error "$1"; exit 1; } +# Prompting — works even under `curl … | bash`, where stdin is the script pipe. +# We prompt on the controlling terminal instead of relying on stdin. +have_tty() { + [ -t 1 ] || return 1 + [ -t 0 ] && return 0 + [ -r /dev/tty ] +} + +tty_read() { + local __var="$1" __val="" + if [ -t 0 ] || [ ! -r /dev/tty ]; then + read -r __val || true + else + read -r __val