#!/bin/bash # Daily Journal Prompt Generator - Run Script set -e echo "📓 Daily Journal Prompt Generator" echo "=================================" # Check if Python is installed if ! command -v python3 &> /dev/null; then echo "❌ Python 3 is required but not installed." exit 1 fi # Check if .env file exists if [ ! -f ".env" ]; then echo "⚠️ .env file not found. Creating from example..." if [ -f "example.env" ]; then cp example.env .env echo "✅ Created .env file from example." echo " Please edit .env and add your API key." exit 1 else echo "❌ example.env not found either." exit 1 fi fi # Check if dependencies are installed echo "🔍 Checking dependencies..." if ! python3 -c "import openai, dotenv" &> /dev/null; then echo "📦 Installing dependencies..." pip install -r requirements.txt fi # Parse command line arguments INTERACTIVE=false SIMPLE=false STATS=false HELP=false while [[ $# -gt 0 ]]; do case $1 in -i|--interactive) INTERACTIVE=true shift ;; -s|--simple) SIMPLE=true shift ;; --stats) STATS=true shift ;; -h|--help) HELP=true shift ;; *) echo "❌ Unknown option: $1" echo " Use -h for help" exit 1 ;; esac done if [ "$HELP" = true ]; then echo "Usage: ./run.sh [OPTIONS]" echo "" echo "Options:" echo " -i, --interactive Run in interactive mode (with rich interface)" echo " -s, --simple Run simple version (no rich dependency)" echo " --stats Show prompt history statistics" echo " -h, --help Show this help message" echo "" echo "Examples:" echo " ./run.sh # Generate prompts (default)" echo " ./run.sh -i # Interactive mode" echo " ./run.sh -s # Simple version" echo " ./run.sh --stats # Show statistics" exit 0 fi if [ "$STATS" = true ]; then echo "📊 Showing statistics..." python3 generate_prompts.py --stats elif [ "$INTERACTIVE" = true ]; then echo "🎮 Starting interactive mode..." python3 generate_prompts.py --interactive elif [ "$SIMPLE" = true ]; then echo "⚡ Running simple version..." python3 simple_generate.py else echo "✨ Generating prompts..." python3 generate_prompts.py fi echo "" echo "✅ Done! Happy journaling! 📓"