commit ef651a5ed314db795fe0573e45d482f78c66193f
parent c2b24b64fc523ce1f7bf6825c22da1befa5bd716
Author: citbl <citbl@citbl.org>
Date: Sun, 24 May 2026 14:00:50 +1000
minor
Diffstat:
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/mtcl/makefile b/mtcl/makefile
@@ -7,7 +7,6 @@ LUA_COMMAND ?= $(LUA) $(LUA_ENTRY) $(LUA_INPUT)
FMT_COMMAND ?= stylua --column-width 80 .
-EXPLAIN_ENABLED ?= 1
# EXPLAIN_MODEL ?= google/gemini-2.5-flash-lite
EXPLAIN_MODEL ?= openai/gpt-5.4-mini-fast
# EXPLAIN_MODEL ?= opencode-go/kimi-k2.6
@@ -20,14 +19,14 @@ EXPLAIN_TMP ?= $${TMPDIR:-/tmp}/mtcl-explain.XXXXXX
# we don't write any code with AI
# but LUA errors can be confusing being all dynamic
-# use `make huh`, to ask a model to explain the issue, via opencode.
+# use `make huh`, to ask a model to explain the issue, via opencode. It won't do it without a stack trace.
define run_with_explain
@tmp="$$(mktemp "$(EXPLAIN_TMP)")"; \
$(1) >"$$tmp" 2>&1; \
status=$$?; \
cat "$$tmp"; \
-if [ $$status -ne 0 ] && [ "$(EXPLAIN_ENABLED)" != "0" ]; then \
+if [ $$status -ne 0 ]; then \
line=$$(awk -v marker="$(EXPLAIN_MARKER)" 'index($$0, marker) { print prev; found=1; exit } { prev = $$0 } END { exit !found }' "$$tmp" 2>/dev/null || true); \
if [ -n "$$line" ]; then \
printf '\n%s\n' "$(EXPLAIN_TITLE)"; \