Files
tilbudgivern/carpenter-agent-openai-quickstart.sh

113 lines
2.7 KiB
Bash
Executable File

#!/usr/bin/env bash
# 🔨 OpenAI Carpenter Agent - Quick Start
# Set up and run the intelligent AI-powered carpenter agent
set -e
echo "🔨 OPENAI CARPENTER AGENT - QUICK START"
echo "========================================"
echo ""
# Colors
GREEN='\033[0;32m'
BLUE='\033[0;34m'
RED='\033[0;31m'
NC='\033[0m'
# Check for OPENAI_API_KEY
if [ -z "$OPENAI_API_KEY" ]; then
echo -e "${RED}❌ OPENAI_API_KEY not set!${NC}"
echo ""
echo "You need an OpenAI API key to use this agent."
echo ""
echo "Step 1: Get API key from https://platform.openai.com/account/api-keys"
echo "Step 2: Export it in your terminal:"
echo " export OPENAI_API_KEY=\"sk-...\""
echo ""
echo "Or save to .env file:"
echo " echo 'OPENAI_API_KEY=sk-...' >> .env"
echo " source .env"
echo ""
exit 1
fi
echo -e "${GREEN}✅ OPENAI_API_KEY found${NC}"
echo ""
# Show menu
echo -e "${BLUE}Select an option:${NC}"
echo ""
echo "1. 💬 Interactive chat with carpenter"
echo "2. 🤖 Generate quotes automatically"
echo "3. 🌐 Run browser automation tests"
echo "4. 📖 View documentation"
echo "5. ❌ Exit"
echo ""
read -p "Choose (1-5): " choice
case $choice in
1)
echo ""
echo -e "${BLUE}Starting interactive carpenter agent...${NC}"
echo ""
read -p "Select carpenter (lars/jannick/alexander) [lars]: " carpenter
carpenter=${carpenter:-lars}
node carpenter-agent-openai.js --interactive --carpenter=$carpenter
;;
2)
echo ""
echo -e "${BLUE}Generating quotes automatically...${NC}"
echo ""
read -p "How many quotes? (default: 5): " count
count=${count:-5}
echo ""
echo "Generating $count quotes..."
node carpenter-agent-openai.js --generate-quotes=$count --save
echo ""
echo -e "${GREEN}✅ Quotes saved to: test-results/carpenter-openai-data/${NC}"
;;
3)
echo ""
echo -e "${BLUE}Running browser automation tests...${NC}"
echo ""
read -p "Browser mode? (headed/ui/normal) [headed]: " mode
mode=${mode:-headed}
echo ""
cd tests
if [ "$mode" = "ui" ]; then
npx playwright test carpenter-agent-openai.spec.js --ui
elif [ "$mode" = "headed" ]; then
npx playwright test carpenter-agent-openai.spec.js --headed
else
npx playwright test carpenter-agent-openai.spec.js
fi
cd ..
;;
4)
echo ""
echo "Opening documentation..."
if command -v code &> /dev/null; then
code docs/OPENAI_CARPENTER_AGENT_GUIDE.md
else
cat docs/OPENAI_CARPENTER_AGENT_GUIDE.md | less
fi
;;
5)
echo "Goodbye!"
exit 0
;;
*)
echo -e "${RED}Invalid option${NC}"
exit 1
;;
esac
echo ""
echo -e "${GREEN}Done!${NC}"