From e4149ce50214d354ef7f0fc4ac752c312c29cc3d Mon Sep 17 00:00:00 2001 From: leetcrypt Date: Tue, 9 Jun 2026 14:27:56 -0700 Subject: [PATCH] fix(ai): strip inline backticks wrapping generated commands Benchmarking showed qwen2.5-coder commonly wraps its one-liner in a single pair of backticks (`cmd`), which the triple-fence stripper missed. Strip a matching leading+trailing backtick pair only, leaving inline command substitution intact. Co-Authored-By: Claude Opus 4.6 --- super-man.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/super-man.sh b/super-man.sh index f604352..1e0d56e 100755 --- a/super-man.sh +++ b/super-man.sh @@ -335,10 +335,14 @@ ai_build_prompt() { esac } -# Strip markdown fences and surrounding blank lines from a raw model response. +# Strip markdown fences, surrounding blank lines, and a single pair of inline +# backticks wrapping the whole line (coder models often emit `cmd`). Only a +# matching leading+trailing pair is removed, so command substitution like +# `date` inside a longer command is left untouched. ai_clean_response() { awk '/^[[:space:]]*```/ { next } { print }' \ | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' \ + | sed -E 's/^`(.*)`$/\1/' \ | sed '/^$/d' }