diff --git a/install.sh b/install.sh index eebfd28..3ed2ad3 100755 --- a/install.sh +++ b/install.sh @@ -13,6 +13,7 @@ set -eu # KINDLING_VERSION release tag to install (e.g. v0.1.0); default: latest # KINDLING_INSTALL_DIR install directory; default: ~/.local/bin # KINDLING_REPO GitHub repo to install from; default: eddacraft/kindling +# KINDLING_NO_DEMO set to 1 to skip the sample memory prompt # # POSIX sh, shellcheck-clean. @@ -24,6 +25,10 @@ INSTALL_DIR="${KINDLING_INSTALL_DIR:-${HOME}/.local/bin}" # even when INSTALL_DIR is not yet on PATH. KINDLING_CMD="" +# "yes" once the sample memory is loaded, "skipped" otherwise; tailors the +# closing hints. +DEMO_LOADED="skipped" + # --- helpers --- info() { printf '\033[1;34m==>\033[0m %s\n' "$1"; } @@ -32,6 +37,11 @@ error() { printf '\033[1;31merror:\033[0m %s\n' "$1" >&2; exit 1; } command_exists() { command -v "$1" >/dev/null 2>&1; } +# True when a controlling terminal can be opened for prompts. Under +# `curl | sh` stdin is the script, so prompts read from /dev/tty instead; in CI +# or other headless runs there is no terminal, so prompts are skipped. +has_tty() { (: /dev/null; } + # --- platform detection --- detect_target() { @@ -183,6 +193,34 @@ setup_claude_code() { esac } +offer_demo() { + [ -n "$KINDLING_CMD" ] || return 0 + + case "${KINDLING_NO_DEMO:-}" in + 1 | [yY] | [yY][eE][sS] | [tT][rR][uU][eE]) return 0 ;; + esac + + # Never block a headless install: without a terminal there is no one to ask. + has_tty || return 0 + + printf '\n' + printf ' Load sample memory to try search? [Y/n] ' + + answer="y" + read -r answer