2026-01-02 15:13:03 -07:00
|
|
|
#!/bin/bash
|
|
|
|
|
# Daily Journal Prompt Generator - Run Script
|
|
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
|
|
echo "📓 Daily Journal Prompt Generator"
|
|
|
|
|
echo "================================="
|
|
|
|
|
|
|
|
|
|
# Check if Python is installed
|
2026-01-02 17:36:24 -07:00
|
|
|
if ! command -v python3 &>/dev/null; then
|
|
|
|
|
echo "❌ Python 3 is required but not installed."
|
|
|
|
|
exit 1
|
2026-01-02 15:13:03 -07:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Check if .env file exists
|
|
|
|
|
if [ ! -f ".env" ]; then
|
2026-01-02 17:36:24 -07:00
|
|
|
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
|
2026-01-02 15:13:03 -07:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Check if dependencies are installed
|
|
|
|
|
echo "🔍 Checking dependencies..."
|
2026-01-02 17:36:24 -07:00
|
|
|
if ! python3 -c "import openai, dotenv" &>/dev/null; then
|
|
|
|
|
echo "📦 Installing dependencies..."
|
|
|
|
|
pip install -r requirements.txt
|
2026-01-02 15:13:03 -07:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Parse command line arguments
|
|
|
|
|
INTERACTIVE=false
|
|
|
|
|
SIMPLE=false
|
|
|
|
|
STATS=false
|
2026-01-02 17:36:24 -07:00
|
|
|
POOL_STATS=false
|
|
|
|
|
FILL_POOL=false
|
2026-01-02 15:13:03 -07:00
|
|
|
HELP=false
|
|
|
|
|
|
|
|
|
|
while [[ $# -gt 0 ]]; do
|
2026-01-02 17:36:24 -07:00
|
|
|
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
|
2026-01-02 15:13:03 -07:00
|
|
|
done
|
|
|
|
|
|
|
|
|
|
if [ "$HELP" = true ]; then
|
2026-01-02 17:36:24 -07:00
|
|
|
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
|
2026-01-02 15:13:03 -07:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [ "$STATS" = true ]; then
|
2026-01-02 17:36:24 -07:00
|
|
|
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
|
2026-01-02 15:13:03 -07:00
|
|
|
elif [ "$INTERACTIVE" = true ]; then
|
2026-01-02 17:36:24 -07:00
|
|
|
echo "🎮 Starting interactive mode..."
|
|
|
|
|
python3 generate_prompts.py --interactive
|
2026-01-02 15:13:03 -07:00
|
|
|
elif [ "$SIMPLE" = true ]; then
|
2026-01-02 17:36:24 -07:00
|
|
|
echo "⚡ Running simple version..."
|
|
|
|
|
python3 simple_generate.py
|
2026-01-02 15:13:03 -07:00
|
|
|
else
|
2026-01-02 17:36:24 -07:00
|
|
|
echo "✨ Drawing prompts from pool..."
|
|
|
|
|
python3 generate_prompts.py
|
2026-01-02 15:13:03 -07:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
echo ""
|
|
|
|
|
echo "✅ Done! Happy journaling! 📓"
|