#!/bin/bash
# Tavily API wrapper with auto-loaded key

# Load API key from config if not set
if [ -z "$TAVILY_API_KEY" ]; then
  if [ -f "$HOME/.openclaw/workspace/.env.tavily" ]; then
    export TAVILY_API_KEY=$(grep "TAVILY_API_KEY" "$HOME/.openclaw/workspace/.env.tavily" | cut -d'=' -f2)
  fi
fi

# Run the Tavily command
node /Users/mattbruce/.agents/skills/tavily/scripts/search.mjs "$@"