#!/bin/bash source .venv/bin/activate if [ -f .env ]; then source .env export REPLICATE_API_TOKEN export OPENROUTER_API_KEY else echo "No .env file found." echo "Write a .env file with the variables: REPLICATE_API_TOKEN" fi export HORDE_DATA_DIR=$(realpath ./local-data) case "$1" in "") mkdir -p $HORDE_DATA_DIR python backend/src/app.py ;; "cli") # deprecated lol node cli/main.js "$2" ;; "test") export HORDE_DATA_DIR=$(realpath ./test-data) mkdir -p $HORDE_DATA_DIR rm -rf $HORDE_DATA_DIR/* # Start backend in the background python backend/src/app.py & BACKEND_PID=$! echo "Started backend: $BACKEND_PID" sleep 5 # Run tests cd testing bash signup.sh #node login.js node suite.js # Finalize the backend server kill $BACKEND_PID ;; "watch") # requires 'inotify-tools' package cd frontend while inotifywait -r -e modify,create,delete lib; do flutter build web done ;; # Create migrations based on the current schema in database.py "migration") cd backend/src tortoise -c database.TORTOISE_ORM makemigrations ;; "deploy") bash deploy/run.sh "${@:2}" ;; # Execute with custom home directory if it exists *) if [ -d "$1" ]; then export HORDE_DATA_DIR=$(realpath $1) python backend/src/app.py else echo "Error: unknown command or directory '$1'" fi ;; esac