fix: auto-detect terminal color support instead of forcing it

FORCE_COLOR defaulted to 1, emitting ANSI codes unconditionally. On SSH
sessions without a proper TTY or with TERM=dumb this caused color codes
to render text invisible. Now colors are enabled only when stdout is an
interactive terminal; FORCE_COLOR=1 can still override when needed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-05 22:41:51 +02:00
parent 640296d7d1
commit 3153b6a24d
+5 -1
View File
@@ -16,8 +16,12 @@ WHIP_CONFIG="${WHIP_CONFIG:-arty.yml}"
WHIP_HOOKS_DIR=".whip/hooks"
WHIP_CHANGELOG="${WHIP_CHANGELOG:-CHANGELOG.md}"
# Colors for output - only use colors if output is to a terminal or if FORCE_COLOR is set
# Enable colors only when stdout is a real terminal (or FORCE_COLOR=1 overrides)
if [[ -t 1 && "${TERM:-}" != "dumb" ]]; then
export FORCE_COLOR=${FORCE_COLOR:-"1"}
else
export FORCE_COLOR=${FORCE_COLOR:-"0"}
fi
if [[ "$FORCE_COLOR" = "0" ]]; then
export RED=''
export GREEN=''