fix(install): run onboarding + profile wizard in curl|bash (gate on stdin, not stdout) (#32)
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 / </dev/null) still skips — verified. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
73fef645a5
commit
37d249caad
4 changed files with 11 additions and 5 deletions
|
|
@ -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'
|
||||
|
||||
╔═══════════════════════════════════════════════════════════════════╗
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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|да|Да)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue