#!/bin/bash
# anolis:summary=Locate an installed Qwen or Qoder executable
# anolis:args=<qwen|qoder>
# anolis:hidden=true
export PATH="$HOME/.local/bin:${PATH:-}"
case "${1:-}" in
  qwen) candidates=(qwen) ;;
  qoder) candidates=(qoder qodercli) ;;
  *) echo 'Supported agents: qwen, qoder' >&2; exit 1 ;;
esac
for name in "${candidates[@]}"; do
  path=$(command -v -- "$name") || continue
  [[ -f $path && -x $path ]] && { printf '%s\n' "$path"; exit 0; }
done
echo "$1 is not installed; use: anolis agent install $1" >&2
exit 127
