#!/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 POOL_STATS=false FILL_POOL=false HELP=false while [[ $# -gt 0 ]]; do case $1 in -i | --interactive) INTERACTIVE=true shift ;; -s | --simple) SIMPLE=true shift ;; --stats) STATS=true shift ;; --pool-stats) POOL_STATS=true shift ;; --fill-pool) FILL_POOL=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 " --pool-stats Show prompt pool statistics" echo " --fill-pool Fill prompt pool using AI (makes API call)" echo " -h, --help Show this help message" echo "" echo "Examples:" echo " ./run.sh # Draw prompts from pool (default)" echo " ./run.sh -i # Interactive mode" echo " ./run.sh -s # Simple version" echo " ./run.sh --stats # Show history statistics" echo " ./run.sh --pool-stats # Show pool statistics" echo " ./run.sh --fill-pool # Fill prompt pool using AI" exit 0 fi if [ "$STATS" = true ]; then echo "📊 Showing history statistics..." python3 generate_prompts.py --stats elif [ "$POOL_STATS" = true ]; then echo "📊 Showing pool statistics..." python3 generate_prompts.py --pool-stats elif [ "$FILL_POOL" = true ]; then echo "🔄 Filling prompt pool using AI..." python3 generate_prompts.py --fill-pool 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 "✨ Drawing prompts from pool..." python3 generate_prompts.py fi echo "" echo "✅ Done! Happy journaling! 📓"