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
This commit is contained in:
7
bin/amc
7
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
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
Reference in New Issue
Block a user