From 37d249caad96f903e0dd4af40bf1ff829449f463 Mon Sep 17 00:00:00 2001 From: KeiSei84 <2206745@gmail.com> Date: Fri, 22 May 2026 10:25:27 +0800 Subject: [PATCH] fix(install): run onboarding + profile wizard in curl|bash (gate on stdin, not stdout) (#32) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit web-install.sh tees stdout to a logfile, so -t 1 is false even in an interactive curl|bash; the /dev/tty fix reattached only stdin. Wizard gates required BOTH -t 0 and -t 1, so onboarding (language select) and bootstrap's profile wizard were silently skipped on the primary install path. Prompts go to stderr and read from stdin — interactive stdin is the only real requirement. Gates: bootstrap.sh, lib-onboarding.sh (×2), lib-preflight.sh, lib-hooks.sh. Non-interactive (CI / --- bootstrap.sh | 5 ++++- install/lib-hooks.sh | 2 +- install/lib-onboarding.sh | 7 +++++-- install/lib-preflight.sh | 2 +- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index d507da5..dc47e0e 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -48,7 +48,10 @@ done # fallback to cortex for compat with v0.16 default behaviour. prompt_profile() { if [ -n "$PROFILE" ]; then return 0; fi - if [ ! -t 0 ] || [ ! -t 1 ]; then PROFILE="cortex"; return 0; fi + # Interactive iff stdin is a terminal. NOT stdout: web-install.sh tees stdout + # to a logfile (pipe), so -t 1 is false even in an interactive curl|bash. + # Prompts print to the terminal via tee; the menu reads from stdin. + if [ ! -t 0 ]; then PROFILE="cortex"; return 0; fi cat <<'WIZARD' ╔═══════════════════════════════════════════════════════════════════╗ diff --git a/install/lib-hooks.sh b/install/lib-hooks.sh index b4fd38a..518c64e 100644 --- a/install/lib-hooks.sh +++ b/install/lib-hooks.sh @@ -129,7 +129,7 @@ maybe_activate_hooks() { elif [ ! -f "$settings_file" ]; then say "no existing settings.json; installing snippet" activate_hooks && DID_ACTIVATE=1 - elif [ -t 0 ] && [ -t 1 ]; then + elif [ -t 0 ]; then # stdin-only: stdout may be tee'd in curl|bash if [ "$COLOR" = "1" ]; then printf '\033[1;36m[install]\033[0m activate hooks now? [y/N] ' else diff --git a/install/lib-onboarding.sh b/install/lib-onboarding.sh index 5206d37..dabaa88 100644 --- a/install/lib-onboarding.sh +++ b/install/lib-onboarding.sh @@ -41,8 +41,11 @@ REGISTRY_MODELS="$KIT_DIR/_blocks/registries/models.toml" onboarding_should_run() { [ -f "$ONBOARDED_FLAG" ] && return 1 [ "${KEISEI_SKIP_ONBOARD:-}" = "1" ] && return 1 + # Interactive iff stdin is a terminal. We deliberately do NOT require -t 1: + # the curl|bash bootstrapper (web-install.sh) tees stdout to a logfile, so + # -t 1 is false even in an interactive session. Prompts go to stderr, input + # reads from stdin — an interactive stdin is the only real requirement. [ ! -t 0 ] && return 1 - [ ! -t 1 ] && return 1 return 0 } @@ -66,7 +69,7 @@ onboarding_run() { if ! preflight_run "$ONBOARDING_PROVIDER"; then echo "" >&2 echo " ⚠ ${STR_PREFLIGHT_FAILED:-Preflight failed — provider may not work.}" >&2 - if [ -t 0 ] && [ -t 1 ]; then + if [ -t 0 ]; then # stdin-only: stdout may be tee'd in curl|bash read -r -p " ${STR_PREFLIGHT_CONTINUE:-Continue anyway? [y/N]} " _ans case "$_ans" in y|Y|yes|да|Да) diff --git a/install/lib-preflight.sh b/install/lib-preflight.sh index 42ffebe..dd3225b 100644 --- a/install/lib-preflight.sh +++ b/install/lib-preflight.sh @@ -25,7 +25,7 @@ preflight_offer_install() { echo " ⚠ $cli не найден." >&2 echo " Установить: $install_cmd" >&2 echo "" >&2 - if [ -t 0 ] && [ -t 1 ]; then + if [ -t 0 ]; then # stdin-only: stdout may be tee'd in curl|bash echo " ⓘ команда: $install_cmd" >&2 read -r -p " Поставить сейчас? [y/N/skip] " ans case "$ans" in