cloverleaf-larry/VERSION
Bryan Johnson 99f0b03c8c v0.6.1: fix TOOLS_JSON crash + slash robustness + backspace
THREE bugs that Bryan hit in v0.6.0:

(1) TOOLS_JSON: unbound variable crash on any unrecognised input.
    Root cause: the TOOLS_JSON assignment was a single-quoted string spanning
    ~40 lines, and apostrophes in tool descriptions (Anthropic's, 'codametrix',
    protocol's, etc.) closed the bash string prematurely. Bash then tried to
    execute fragments of the JSON as shell commands ("NAME: command not found"
    warnings) and TOOLS_JSON never got assigned. With set -u, the first
    reference to $TOOLS_JSON crashed the whole script.
    Fix: switch to a quoted-EOF heredoc — TOOLS_JSON=$(cat <<'TOOLS_END' ...
    TOOLS_END). Heredoc with single-quoted delimiter preserves content
    literally — apostrophes, backslashes, all of it. Verified: all 31 tool
    defs now parse as valid JSON (including the previously-broken nc_msgs).
    Also fixed the pre-existing \\" → \" escape error in nc_msgs.

(2) Slash command brittleness: /ssh-add\ * pattern matched only when args
    were present; /ssh-add alone fell through to the catchall and reported
    "unknown command". Also failed silently with no usage message on the
    too-few-args path.
    Fix: rewrote all SSH slash patterns as /ssh-foo* (matches both with and
    without trailing args), with a _slash_args() helper that cleanly extracts
    the arg portion. Every handler now validates and prints "usage: ..." on
    missing args before continuing. New _run_ssh_helper() wrapper centralises
    the installed-check and swallows helper exit codes so they don't propagate
    into the main loop.

(3) Backspace not working in MobaXterm/Cygwin terminals.
    Root cause: terminal sends ^? (DEL) for backspace but stty erase is often
    set to ^H (BS) in MobaXterm, so backspace passes through as a literal
    character.
    Fix: stty erase '^?' at REPL startup (harmless if already correct), AND
    switch read_user_input to use `read -e -r -p` which uses libreadline for
    line editing — backspace, arrow keys, history all work via readline now,
    bypassing the terminal's stty config entirely. Falls back to plain read
    on environments without readline support.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-27 10:45:49 -07:00

2 lines
6 B
Plaintext