From 0551b9fd891d1cfd6c19c7298fd5b10f0d3fe083 Mon Sep 17 00:00:00 2001 From: teernisse Date: Wed, 25 Feb 2026 11:21:30 -0500 Subject: [PATCH] fix: cross-platform browser opening and hook robustness bin/amc: - Add cross-platform browser opening: try 'open' (macOS) first, fall back to 'xdg-open' (Linux) for desktop environments - Wrap browser opening in conditional to avoid errors on headless systems bin/amc-hook: - Fix edge case in question extraction where tool_input.get("questions") could return None instead of empty list, causing TypeError --- bin/amc | 7 ++++++- bin/amc-hook | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/bin/amc b/bin/amc index 8d7f36a..bac124b 100755 --- a/bin/amc +++ b/bin/amc @@ -34,7 +34,12 @@ case "$cmd" in echo "AMC started (pid $!)" fi fi - open "http://127.0.0.1:$PORT" + # Open browser (platform-specific) + if command -v open &>/dev/null; then + open "http://127.0.0.1:$PORT" + elif command -v xdg-open &>/dev/null; then + xdg-open "http://127.0.0.1:$PORT" + fi ;; stop) if is_running; then diff --git a/bin/amc-hook b/bin/amc-hook index df7545e..4405b24 100755 --- a/bin/amc-hook +++ b/bin/amc-hook @@ -73,7 +73,7 @@ def _extract_questions(hook): if not isinstance(tool_input, dict): return [] - questions = tool_input.get("questions", []) + questions = tool_input.get("questions") or [] result = [] for q in questions: entry = {