#!/usr/bin/env bash
# Fetch AI/agent drafts with expanded keyword set (original 6 + 6 new).
# Run from project root: bash scripts/fetch-expanded-keywords.sh
#
# New keywords added 2026-03-03 after probing Datatracker API:
#   mcp, agentic, inference, generative, intelligent, aipref
# These brought in ~101 new drafts (260 -> 361).

set -euo pipefail
cd "$(dirname "$0")/.."

echo "=== Fetching with expanded keywords ==="
python -m ietf_analyzer.cli fetch \
  -k mcp -k agentic -k inference -k generative -k intelligent -k aipref

echo ""
echo "=== Draft count ==="
sqlite3 data/drafts.db "SELECT COUNT(*) || ' total drafts' FROM drafts;"
sqlite3 data/drafts.db "SELECT COUNT(*) || ' drafts with full text' FROM drafts WHERE full_text IS NOT NULL AND full_text != '';"
