feat(intelligence): add competitor watch system
- Weekly automated scraping of 10 competitors - Structured data storage (competitors.json) - Validation and alerting scripts - First weekly report (2026-07-11) with 4 critical findings: 1. Premise Data acquired by Culmen (Aug 2025) 2. Streetbees bankruptcy (Aug 2025) 3. Moody's/Cape Analytics integration progressing 4. Sweden Platform Work Act proposed (Dec 2026) - Cron scheduled for Saturdays 07:00 UTC
This commit is contained in:
+58
@@ -0,0 +1,58 @@
|
||||
#!/bin/bash
|
||||
# Alert-skript för kritiska konkurrensförändringar
|
||||
# Skickar notis vid viktiga händelser
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
WORKSPACE="/home/bernt/.openclaw/workspace"
|
||||
WATCH_DIR="$WORKSPACE/intelligence/competitor-watch"
|
||||
DATE=$(date +%Y-%m-%d)
|
||||
|
||||
ALERT_LEVEL="${1:-info}" # info, warning, critical
|
||||
MESSAGE="${2:-}"
|
||||
|
||||
# Färger för terminal
|
||||
RED='\033[0;31m'
|
||||
YELLOW='\033[1;33m'
|
||||
GREEN='\033[0;32m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
echo "=== Konkurrens-alert — $DATE ==="
|
||||
echo "Nivå: $ALERT_LEVEL"
|
||||
echo ""
|
||||
|
||||
# Logga alerten
|
||||
LOG_FILE="$WATCH_DIR/data/alerts.log"
|
||||
echo "$(date -Iseconds) [$ALERT_LEVEL] $MESSAGE" >> "$LOG_FILE"
|
||||
|
||||
# Visa alert
|
||||
case "$ALERT_LEVEL" in
|
||||
critical)
|
||||
echo -e "${RED}🚨 KRITISK ALERT${NC}"
|
||||
echo "$MESSAGE"
|
||||
echo ""
|
||||
echo "Åtgärd krävs OMGÅENDE. Meddela Erik."
|
||||
;;
|
||||
warning)
|
||||
echo -e "${YELLOW}⚠️ VARNING${NC}"
|
||||
echo "$MESSAGE"
|
||||
echo ""
|
||||
echo "Övervaka situationen. Uppdatera vid nästa revision."
|
||||
;;
|
||||
*)
|
||||
echo -e "${GREEN}ℹ️ INFO${NC}"
|
||||
echo "$MESSAGE"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Spara alert till fil för historik
|
||||
ALERT_FILE="$WATCH_DIR/data/alerts/${DATE}_${ALERT_LEVEL}.txt"
|
||||
mkdir -p "$(dirname "$ALERT_FILE")"
|
||||
cat > "$ALERT_FILE" << EOF
|
||||
Datum: $(date -Iseconds)
|
||||
Nivå: $ALERT_LEVEL
|
||||
Meddelande: $MESSAGE
|
||||
EOF
|
||||
|
||||
echo ""
|
||||
echo "Alert loggad: $LOG_FILE"
|
||||
Reference in New Issue
Block a user