Fix code-review findings: 10-known.sh value-match bug (proven live), bootstrap.sh symlink race + missing sources + accidental exit-on-eval, fx.sh misleading picker text + FX_AUTO short-circuit
This commit is contained in:
+23
-4
@@ -62,13 +62,27 @@ fx() {
|
||||
fi
|
||||
export FX_OUTPUT
|
||||
|
||||
# Under FX_AUTO only the first candidate is ever used (head -1
|
||||
# below), so gathering every source unconditionally would mean
|
||||
# always paying for the 25-30s local-LLM/remote-API tiers even
|
||||
# when a free source already answered and that answer is
|
||||
# guaranteed to win -- exactly the cost the NN- numbering claims to
|
||||
# avoid. Stop at the first source that produces anything once
|
||||
# FX_AUTO is set. Without it (the interactive picker), keep
|
||||
# gathering everything: a later, better-verified candidate
|
||||
# shouldn't be hidden behind an earlier weak match when a human is
|
||||
# the one choosing.
|
||||
candidates=$(
|
||||
for src in "$FX_SOURCES_DIR"/*; do
|
||||
[ -x "$src" ] || continue
|
||||
label="${src##*/}"
|
||||
"$src" "$cmd" 2>/dev/null | while IFS= read -r line; do
|
||||
[ -n "$line" ] && printf '[%s] %s\n' "$label" "$line"
|
||||
done
|
||||
out=$("$src" "$cmd" 2>/dev/null)
|
||||
if [ -n "$out" ]; then
|
||||
printf '%s\n' "$out" | while IFS= read -r line; do
|
||||
[ -n "$line" ] && printf '[%s] %s\n' "$label" "$line"
|
||||
done
|
||||
[ -n "$FX_AUTO" ] && break
|
||||
fi
|
||||
done | awk -F'] ' '!seen[$2]++'
|
||||
)
|
||||
|
||||
@@ -83,7 +97,12 @@ fx() {
|
||||
printf '%s\n' "$candidates" | while IFS= read -r line; do
|
||||
i=$((i+1)); printf '%d) %s\n' "$i" "$line"
|
||||
done
|
||||
printf 'pick a number (blank to type your own): '
|
||||
# "blank to give up", not "type your own": fx already
|
||||
# committed f's stdin to this pipe, so a blank answer here
|
||||
# can't fall through to a real terminal read the way f()'s
|
||||
# own bare prompt does -- it just pipes an empty line into
|
||||
# f(), same as when zero candidates were found at all.
|
||||
printf 'pick a number (blank to give up): '
|
||||
read -r n
|
||||
[ -n "$n" ] && chosen=$(printf '%s\n' "$candidates" | sed -n "${n}p" | sed 's/^\[[^]]*\] //')
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user