feature/pi-refactor
 1#!/usr/bin/env bash
 2# Test script for Pi-based Daneel bot
 3#
 4# This script runs the new Pi-based implementation
 5
 6set -euo pipefail
 7
 8# Check if we're in the right directory
 9if [ ! -f "package.json" ] || ! grep -q "daneel" package.json; then
10    echo "Error: Must run from daneel project directory"
11    exit 1
12fi
13
14# Check if built
15if [ ! -d "dist/pi" ]; then
16    echo "Building project..."
17    npm run build
18fi
19
20# Required environment variables
21: "${DANEEL_XMPP_JID:=researchbot@xmpp.sbr.pm}"
22: "${DANEEL_OWNER_JID:=vincent@xmpp.sbr.pm}"
23
24# Check for required password
25if [ -z "${DANEEL_XMPP_PASSWORD:-}" ]; then
26    echo "ERROR: DANEEL_XMPP_PASSWORD is not set"
27    echo ""
28    echo "To get the password from aomi:"
29    echo "  ssh aomi.home 'sudo cat /run/agenix/xmpp-research-bot-password'"
30    echo ""
31    echo "Then set it:"
32    echo "  export DANEEL_XMPP_PASSWORD='<password>'"
33    exit 1
34fi
35
36# Check for API key (Pi uses GEMINI_API_KEY for Google/Gemini models)
37if [ -z "${GEMINI_API_KEY:-}" ] && [ -z "${ANTHROPIC_API_KEY:-}" ] && [ -z "${OPENAI_API_KEY:-}" ]; then
38    echo "ERROR: No API key found"
39    echo ""
40    echo "Set at least one of:"
41    echo "  export GEMINI_API_KEY='...'        (for Gemini)"
42    echo "  export ANTHROPIC_API_KEY='...'     (for Claude)"
43    echo "  export OPENAI_API_KEY='...'        (for GPT)"
44    exit 1
45fi
46
47# Optional settings
48: "${DANEEL_DATA_DIR:=./data}"
49: "${DANEEL_INBOX_PATH:=~/desktop/org/inbox.org}"
50: "${DANEEL_DEBUG:=true}"
51
52# Create data directory
53mkdir -p "$DANEEL_DATA_DIR"
54
55echo "=== Daneel Pi Test Configuration ==="
56echo "XMPP JID:      $DANEEL_XMPP_JID"
57echo "Owner JID:     $DANEEL_OWNER_JID"
58echo "Data Dir:      $DANEEL_DATA_DIR"
59echo "Inbox Path:    $DANEEL_INBOX_PATH"
60echo "Debug:         $DANEEL_DEBUG"
61echo ""
62echo "API Keys:"
63echo "  Gemini:    $([ -n "${GEMINI_API_KEY:-}" ] && echo "✓" || echo "✗")"
64echo "  Anthropic: $([ -n "${ANTHROPIC_API_KEY:-}" ] && echo "✓" || echo "✗")"
65echo "  OpenAI:    $([ -n "${OPENAI_API_KEY:-}" ] && echo "✓" || echo "✗")"
66echo ""
67echo "Starting Daneel (Pi Edition)..."
68echo "==================================="
69echo ""
70
71# Export environment
72export DANEEL_XMPP_JID
73export DANEEL_XMPP_PASSWORD
74export DANEEL_OWNER_JID
75export DANEEL_DATA_DIR
76export DANEEL_INBOX_PATH
77export DANEEL_DEBUG
78export GOOGLE_API_KEY
79
80# Run the Pi-based bot (now the default)
81exec npm start