mirror of
https://github.com/tanweai/pua.git
synced 2026-09-19 02:19:52 +08:00
ccaa9c0227
get_flavor() only assigned PUA_LANGUAGE inside the `if [ -f "$config" ]` branch. Callers (frustration-trigger.sh / pua-loop-hook.sh / failure-detector.sh) run under `set -euo pipefail`, so on first-run users without ~/.pua/config.json, line 179's `[ "$PUA_LANGUAGE" = "zh" ]` tripped `unbound variable` and exit 1 — throwing a red hook error on every UserPromptSubmit. Fix: declare `PUA_LANGUAGE=""` unconditionally at the top of get_flavor so it always has a definition regardless of config file presence. E2E verified: `set -euo pipefail; source flavor-helper.sh; get_flavor` with no config → exits 0 instead of trapping. Closes #144 Reported-by: @maj1999 (thorough repro + root-cause analysis)